-
Notifications
You must be signed in to change notification settings - Fork 1
/
options.js
29 lines (27 loc) · 905 Bytes
/
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
$(function(){
$('#synchonize').click(function(){
synchronizeChrome();
});
$('#getAllfromChromeStorage').click(function(){
chrome.storage.sync.get(null, function(items) {
//console.dir(items);
//var allKeys = Object.keys(items);
//console.dir(allKeys);
var numberUpdated = 0;
var updatedKeys = [];
_.map(items, function(value, key){
//console.log(key);
var localValue = localStorage.getObject(key);
if(localValue == undefined || localValue == null) {
localStorage.setItem(key, value);
updatedKeys.push(key);
numberUpdated ++;
}
})
alert('number items is imported from chrome storage to local storage is ' + numberUpdated + '\n' + updatedKeys.join('\n'));
});
});
$("#exportToJson").click(function(){
$('#result').html(JSON.stringify(StorageApi.getAllWordFromLocalStorage(), null, 4));
});
});