-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.js
52 lines (42 loc) · 1.17 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
50
51
52
"use strict";
let Browser=typeof browser=='undefined' ? chrome : browser;
let keys=[
'remove_readers_link',
'remove_mentions_link',
'remove_grants_link',
'remove_premium_link',
'remove_premium_menu_item',
'remove_search_alerts_menu_item',
'remove_grants_updates',
'remove_mentions_updates',
'remove_readers_updates',
'remove_profile_visitors_analytics',
'remove_cv_analytics',
'disable_bulk_download_question',
'remove_bulk_download_links',
'remove_full_pdf_package_links',
'remove_figures_links',
'remove_translate_links',
'disable_key_takeaways',
'remove_key_takeaways_links',
'remove_rating_modals',
'remove_discussion_modals'
];
document.addEventListener ('DOMContentLoaded',() => {
let callback=function (settings) {
for (var key in settings)
document.getElementById (key).checked=settings[key];
};
if (typeof browser=='undefined')
chrome.storage.sync.get (null,callback);
else
browser.storage.sync.get().then (callback);
keys.forEach (key => {
let checkbox=document.getElementById (key);
checkbox.addEventListener ('change',function () {
let settings={};
settings[this.id]=this.checked;
Browser.storage.sync.set (settings);
});
});
});