-
Notifications
You must be signed in to change notification settings - Fork 9
/
options.js
44 lines (38 loc) · 1.1 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
var getReviewUrl = function(){
var url;
if(gIsChrome)
url = "https://chrome.google.com/webstore/detail/google-translate-plus/" + getExtensionID() + "/reviews?hl=en";
else
url = "https://addons.mozilla.org/en-US/firefox/addon/google-translate-plus/#reviews";
return url;
};
var savePreferences = function(){
var max_history = $("input[name='max_history']:checked").val();
getBrowser().storage.local.set(
{"max_history": max_history},
function(result){
$("#status").html("Preferences saved.<br/><br/>");
setTimeout(function() {
$("#status").html("");
}, 3000);
}
);
};
var pullPreferences = function(){
getBrowser().storage.local.get(
["max_history"],
function(result){
console.log("@GTP, options", result.max_history);
if(result.max_history){
$("input[name='max_history'][value='" + result.max_history + "']").prop("checked", true);
}
}
);
};
$(document).ready(function(){
$("#save").click(savePreferences);
$("#review").click(function(){
window.open(getReviewUrl(), "_blank");
});
pullPreferences();
});