|
@@ -12,6 +12,13 @@ chrome.storage.local.get(['wordsArr','starsArr','wordsObj','wordOpt','setting'],
|
|
|
wordDataObj = items.wordsObj?items.wordsObj:{};
|
|
|
wordOpt = items.wordOpt?items.wordOpt:{};
|
|
|
setting = items.setting?items.setting:{timerMin:10};
|
|
|
+ chrome.app.window.create('windows/popup.html', {
|
|
|
+ id:'popup',
|
|
|
+ resizable:false,
|
|
|
+ alwaysOnTop:true,
|
|
|
+ hidden:true,
|
|
|
+ frame:{type:'none'}
|
|
|
+ });
|
|
|
setTimer();
|
|
|
});
|
|
|
chrome.app.runtime.onLaunched.addListener(function() {
|
|
@@ -28,26 +35,11 @@ chrome.app.runtime.onLaunched.addListener(function() {
|
|
|
});
|
|
|
});
|
|
|
var showWordInfo = function(word){
|
|
|
- var oldWindow = chrome.app.window.get('popup');
|
|
|
- if(oldWindow){
|
|
|
- createPopup(oldWindow,word);
|
|
|
- }else{
|
|
|
- chrome.app.window.create('windows/popup.html', {
|
|
|
- id:'popup',
|
|
|
- resizable:false,
|
|
|
- alwaysOnTop:true,
|
|
|
- hidden:true,
|
|
|
- frame:{type:'none'}
|
|
|
- },function(popup){
|
|
|
- createPopup(popup,word);
|
|
|
- });
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function createPopup(popup,word){
|
|
|
+ var popup = chrome.app.window.get('popup');
|
|
|
var popWidth = 300,popHeight = 400;
|
|
|
currentWord = word;
|
|
|
chrome.system.display.getInfo(function(display){
|
|
|
+ console.log(123)
|
|
|
var displayOpt = display[0].workArea;
|
|
|
popup.outerBounds.left = displayOpt.width - popWidth - 20;
|
|
|
popup.outerBounds.top = 20 + displayOpt.top;
|
|
@@ -58,6 +50,7 @@ function createPopup(popup,word){
|
|
|
// chrome.storage.local.set({wordsObj:bg.wordDataObj,wordOpt:bg.wordOpt});
|
|
|
// });
|
|
|
});
|
|
|
+
|
|
|
}
|
|
|
|
|
|
function randomShow(){
|
|
@@ -130,4 +123,14 @@ function importWord(wordArr){
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+function clearDatas(){
|
|
|
+ wordDataArr = [];
|
|
|
+ wordStarArr = [];
|
|
|
+ wordDataObj = {};
|
|
|
+ wordOpt = {};
|
|
|
+ chrome.runtime.sendMessage('updateStarList');
|
|
|
+ chrome.storage.local.set({wordsArr:wordDataArr,wordsObj:wordDataObj,wordOpt:wordOpt,starsArr:wordStarArr},function(e){
|
|
|
+ chrome.notifications.create('clearDone',{iconUrl:'./asset/img/logo@x128.png',message:'数据清除成功',type:'basic',title:'清除完成!'});
|
|
|
+ })
|
|
|
+}
|
|
|
|