From 92b6786656025e6b3c50ba54bf997054e48cc9c1 Mon Sep 17 00:00:00 2001 From: zimocode Date: Sun, 16 Feb 2020 20:00:36 +0800 Subject: [PATCH 1/2] error if there's no sub for rss --- change.log | 7 +++++++ js/inject/rss.js | 2 +- manifest.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/change.log b/change.log index 68ba79e..64b909b 100644 --- a/change.log +++ b/change.log @@ -1,5 +1,12 @@ { "log": [ + { + "ver":"6.6.260.1046", + "date":"2020.02.16", + "content":[ + "fix bug: error if there's no sub for rss" + ] + }, { "ver":"6.6.260.1045", "date":"2020.02.16", diff --git a/js/inject/rss.js b/js/inject/rss.js index e49b192..8659d1c 100644 --- a/js/inject/rss.js +++ b/js/inject/rss.js @@ -59,7 +59,7 @@ sue.apps.rss={ sue.apps.rss.rss(dom,sue.apps.rss.config.feed[0]); sue.apps.rss.menu(dom); }else{ - dom.querySelector(".rssbox").textContent="there is no sub."; + dom.querySelector(".rss_box").textContent="there is no sub."; sue.apps.rss.showSub(dom) } diff --git a/manifest.json b/manifest.json index b32ecc4..ce6cd9e 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "minimum_chrome_version": "22", "name": "smartUp Gestures(Beta)", "short_name":"smartUp", - "version": "6.6.260.1045", + "version": "6.6.260.1046", "description": "__MSG_ext_des__", "default_locale": "en", "author":"zimo", From 9829e69db2902a7167b13de2c8d57ddce993da41 Mon Sep 17 00:00:00 2001 From: zimocode Date: Tue, 18 Feb 2020 21:03:59 +0800 Subject: [PATCH 2/2] fix #85 --- change.log | 6 +- js/background.js | 37 +++++----- js/event.js | 187 ++++------------------------------------------- manifest.json | 2 +- 4 files changed, 36 insertions(+), 196 deletions(-) diff --git a/change.log b/change.log index 64b909b..026b0ec 100644 --- a/change.log +++ b/change.log @@ -1,10 +1,10 @@ { "log": [ { - "ver":"6.6.260.1046", - "date":"2020.02.16", + "ver":"6.6.262.1048", + "date":"2020.02.18", "content":[ - "fix bug: error if there's no sub for rss" + "fix bugs: error if there's no sub for rss, issues@github: #85" ] }, { diff --git a/js/background.js b/js/background.js index 3be213d..02527e5 100644 --- a/js/background.js +++ b/js/background.js @@ -1661,7 +1661,7 @@ var sub={ clipOBJ.remove(); }) } - var thepers=["clipboardRead"]; + var thepers=["clipboardWrite"]; var theorgs; sub.checkPermission(thepers,theorgs,theFunction); }, @@ -1774,7 +1774,7 @@ var sub={ document.execCommand('copy'); clipOBJ.remove(); } - var thepers=["clipboardRead"]; + var thepers=["clipboardWrite"]; var theorgs; sub.checkPermission(thepers,theorgs,theFunction); }, @@ -1897,7 +1897,7 @@ var sub={ document.execCommand('copy'); clipOBJ.remove(); } - var thepers=["clipboardRead"]; + var thepers=["clipboardWrite"]; var theorgs; sub.checkPermission(thepers,theorgs,theFunction); }, @@ -1910,7 +1910,7 @@ var sub={ document.execCommand('copy'); clipOBJ.remove(); } - var thepers=["clipboardRead"]; + var thepers=["clipboardWrite"]; var theorgs; sub.checkPermission(thepers,theorgs,theFunction); }, @@ -1923,7 +1923,7 @@ var sub={ document.execCommand('copy'); clipOBJ.remove(); } - var thepers=["clipboardRead"]; + var thepers=["clipboardWrite"]; var theorgs; sub.checkPermission(thepers,theorgs,theFunction); }, @@ -1989,7 +1989,7 @@ var sub={ clipOBJ.remove(); } - var thepers=["clipboardRead"]; + var thepers=["clipboardWrite"]; var theorgs; sub.checkPermission(thepers,theorgs,theFunction); }, @@ -2001,7 +2001,7 @@ var sub={ .then(buffer => chrome.clipboard.setImageData(buffer,(sub.message.selEle.img.substr(sub.message.selEle.img.length-4)==".jpg"?"jpeg":"png"))) } - let thepers=["clipboardRead"],theorgs; + let thepers=["clipboardWrite"],theorgs; sub.checkPermission(thepers,theorgs,theFunction); }, imgsearch:function(){ @@ -3771,18 +3771,19 @@ var sub={ sub.theConf=getConf(); sub.theConf.type="action"; if(sub.theConf.name=="paste"){//for action paste - if(sub.cons.permissions.contains("clipboardWrite")) { - var clipOBJ=document.body.appendChild(document.createElement("textarea")); - clipOBJ.focus(); - document.execCommand('paste'); - var clipData=clipOBJ.value; - clipOBJ.remove(); - sub.theConf.paste=clipData; + sendResponse(sub.theConf);//error log, if none sendResponse + sub.checkPermission(["clipboardRead"],null,function(){ + var domCB=document.createElement("textarea"); + domCB.classList.add("su_cb_textarea"); + document.body.appendChild(domCB); + domCB.focus(); + document.execCommand("paste"); + sub.theConf.paste=domCB.value; sub.theConf.typeAction="paste"; - sendResponse(sub.theConf); - }else { - sub.checkPermission(["clipboardWrite"]); - } + chrome.tabs.sendMessage(sender.tab.id,{type:"actionPaste",value:sub.theConf},function(response){ + domCB.remove(); + }); + }); }else{ sendResponse(sub.theConf); } diff --git a/js/event.js b/js/event.js index 8ed8c9d..d2fbe76 100644 --- a/js/event.js +++ b/js/event.js @@ -79,9 +79,6 @@ var sue={ window.addEventListener("dragover",this.handleEvent,false); window.addEventListener("dragend",this.handleEvent,false); } - // if(config.general.settings.clickcancel){ - // window.addEventListener("mouseclick",this.handleEvent,false); - // } if(config.general.settings.esc){ window.addEventListener("keydown",this.handleEvent,false); } @@ -89,13 +86,10 @@ var sue={ document.addEventListener("click",this.handleEvent,false); } if(config.general.fnswitch.fnwges){ - //window.addEventListener("mousewheel",this.handleEvent,false); window.addEventListener("wheel",this.handleEvent,false); } }, initHandle2:function(){ - //document.addEventListener("mousedown",this.handleEvent,false); - //sue.document.addEventListener("mouseup",this.handleEvent,false); sue.document.addEventListener("mousemove",this.handleEvent,false); sue.document.addEventListener("mouseover",this.handleEvent,false); sue.document.addEventListener("contextmenu",this.handleEvent,false); @@ -131,12 +125,7 @@ var sue={ wheelDelta:e.deltaY } - chrome.runtime.sendMessage(extID,{type:"action_wges",sendValue:sendValue,selEle:sue.selEle},function(response){ - // if(response.name=="scroll"){ - // console.log("scroll") - // e.preventDefault(); - // } - }) + chrome.runtime.sendMessage(extID,{type:"action_wges",sendValue:sendValue,selEle:sue.selEle}) e.preventDefault(); } break; @@ -164,7 +153,6 @@ var sue={ if(e.keyCode==27){ sue.break=true; sue.stopMges(e); - //sue.timeout_nomenu=true; } break; case"mousedown": @@ -172,7 +160,6 @@ var sue={ &&config.general.fnswitch.fnmges &&e.buttons==config.mges.settings.model &&!e[config.mges.settings.holdkey+"Key"]){ - //console.log("mousedown"); sue.lineDrawReady(e,"mges"); } //fix rges mouseup bug @@ -182,7 +169,6 @@ var sue={ } break; case"mouseup": - //console.log(e) if((e.button==1&&config.mges.settings.model==4) ||(e.button==2&&e.button==config.mges.settings.model&&(config.general.linux.cancelmenu&&sue.cons.os!="win"))){ if(sue._dirArray&&sue.drawing){ @@ -204,7 +190,6 @@ var sue={ } break; case"contextmenu": - //console.log("contextmenu") if(config.general.linux.cancelmenu &&sue.cons.os!="win"){ //fix mges @@ -256,7 +241,6 @@ var sue={ e.preventDefault(); } //fix switchtab by rges or wges - // console.log(sue.cons.switchtab) if(sue.cons.switchtab&&sue.cons.switchtab.contextmenu){ e.preventDefault(); sue.cons.switchtab.contextmenu=false; @@ -264,15 +248,11 @@ var sue={ break; case"mousemove": - //console.log(sue.drawing) if(sue.drawing&&e.buttons==config.mges.settings.model){ - // console.log("move") sue.lineDraw(e); } break; case"dragstart": - //console.log("dragstart") - //console.log(e.target.draggable) if(!extDisable &&((config.general.fnswitch.fndrg&&!e[config.drg.settings.holdkey+"Key"]) ||(config.general.fnswitch.fnsdrg&&!e[config.sdrg.settings.holdkey+"Key"]))){ @@ -282,7 +262,6 @@ var sue={ } break; case"dragover": - //console.log("dragover") if(sue.drawing){ sue.lineDraw(e,sue.drawType[0]); if(sue.drawType[0]=="drg"&&config[sue.drawType[0]].ui.tip.type=="follow"){ @@ -294,28 +273,13 @@ var sue={ e.preventDefault(); } //drag to text box, cancel - //console.log(sue.cons.drginbox) if(!sue.cons.drginbox&&config[sue.drawType[0]].settings.drgtobox&&e.target&&e.target.type&&(e.target.type=="textarea"||e.target.type=="text")){ sue.break=true; sue.stopMges(e); } - // if(config[sue.drawType[0]].settings.drgtobox&&e.path[0]&&e.path[0].type&&(e.path[0].type=="textarea"||e.path[0].type=="text")){ - // sue.break=true; - // sue.stopMges(e); - // } } break; case"dragend": - // var test=function(e){ - // console.log("drag") - // if(e.keyCode==27){ - // sue.break=true; - // sue.stopMges(e); - // sue.timeout_nomenu=true; - // } - // } - // document.addEventListener("keydown",test,false) - if(sue._dirArray&&sue.drawing){ sue.stopMges(e); } @@ -388,7 +352,6 @@ var sue={ for(var i=0;i<_uiarray.length;i++){ if(config[sue.drawType[0]].ui&&config[sue.drawType[0]].ui[_uiarray[i]].enable){ sue.UI(config[sue.drawType[0]].ui[_uiarray[i]].style); - //sue.UI(config.mges.ui[_uiarray[i]].style) } } }, @@ -398,13 +361,8 @@ var sue={ var dx=Math.abs(x-sue._lastX); var dy=Math.abs(y-sue._lastY); var dz=Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2)); - //console.log(dx+"/"+dy+"/"+dz) if(dz<1){return} sue.uiPos(e); - - //return; - //console.log(sue.drawType[0]) - //sue.ui_line(e) (config[sue.drawType[0]].ui.line.enable||editMode)?sue.ui_line(e):null; if(dxdy?(xdy?(x22.5&&angle<=67.5&&y>sue._lastY&&xdy ){ - // dir=xdy?(x0){ @@ -866,7 +763,6 @@ var sue={ directimg:function(direct){ var myDeg={L:"0deg",U:"90deg",R:"180deg",D:"270deg"}; return myDeg[direct]; - //return "-webkit-transform:rotate(+"+myDeg[direct]+");"; }, domDir2:function(img){ var domimg=document.createElement("img"); @@ -896,7 +792,6 @@ var sue={ let domUIs=sue.document.querySelectorAll("div[data-suui=uibox]"), i=0,domWidth,domHeight; e=e.targetTouches?e.targetTouches[0]:e; - //console.log(domUIs) for(i=0;i