-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.js
49 lines (35 loc) · 1.12 KB
/
options.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
(function($) {
chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
if (request.method === "getOptions") {
sendResponse({ tabLocation: localStorage.RestoreGoogleReaderLink_tabLocation, tabName: localStorage.RestoreGoogleReaderLink_tabName });
} else {
sendResponse({});
}
});
var tabLocation = localStorage.RestoreGoogleReaderLink_tabLocation,
tabName = localStorage.RestoreGoogleReaderLink_tabName;
if (tabLocation) {
$("#tablocation").val(tabLocation);
}
if (tabName) {
$("#tabname").val(tabName);
}
$("#save").click(function(e) {
var tabLocation = parseInt($("#tablocation").val(), 10),
tabName = $("#tabname").val();
if (tabLocation) {
tabLocation = Math.abs(tabLocation);
localStorage.RestoreGoogleReaderLink_tabLocation = tabLocation;
}
if (tabName) {
localStorage.RestoreGoogleReaderLink_tabName = tabName;
}
var message = $("<div>").addClass("message").html("Options saved.");
$("#main").prepend(message);
setTimeout(function() {
message.fadeOut('normal', function() {
message.remove();
});
}, 750);
});
})(jQuery);