diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 9e5919f..18fefcf 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1444,10 +1444,10 @@ "message":"More Extensons" }, "con_ad":{ - "message":"Show advertisement" + "message":"Show advertisements on current options page" }, "des_ad":{ - "message":"Ads are only shown on the current settings page and will never appear on other pages. Thank you for your supporting." + "message":"Ads are only shown on the current options page and will never appear on other pages. Thank you for your supporting." }, "des_moreextlist":{ "message":"These extensions are developed by me. Welcome to install and use." @@ -1526,5 +1526,59 @@ }, "closeapps":{ "message":"Close all Mini-apps in tab" + }, + "magnet":{ + "message":"Torrent Hash To Magnet URI" + }, + "btn_clear":{ + "message":"CLEAR" + }, + "magnet_placeholder_input":{ + "message":"Input torrent hash text." + }, + "homepage_grouptop":{ + "message":"Most Visited Sites" + }, + "homepage_groupdefault":{ + "message":"Default Group" + }, + "homepage_grouplist":{ + "message":"Sites group list" + }, + "homepage_editmode":{ + "message":"Edit Mode" + }, + "homepage_newgroup":{ + "message":"Add an new group" + }, + "homepage_grouptitle":{ + "message":"Group Name" + }, + "homepage_sitetitle":{ + "message":"Site Name" + }, + "homepage_siteurl":{ + "message":"Site URL" + }, + "homepage_placeurl":{ + "message":"Including prefix: http, https and etc." + }, + "homepage_cfmlistdel":{ + "message":"This will delete all sites in the group, Please confirm the operation." + }, + "homepage_ctm":{ + "message":"Add to Mini-apps: Home Page" + }, + "n_homepage_last":{ + "message":"Set the last sites group as a default one" + }, + "msg_conferr0":{ + "message":"Failed to save settings. The error message is:" + }, + "msg_conferr1":{ + "message":"smartUp Gestures will try to roll back to the previous settings." + }, + "notif_title_conferr":{ + "message":"Settings save Failed!" } } \ No newline at end of file diff --git a/_locales/zh_CN/messages.json b/_locales/zh_CN/messages.json index f759081..6bb8f59 100644 --- a/_locales/zh_CN/messages.json +++ b/_locales/zh_CN/messages.json @@ -1419,10 +1419,10 @@ "message":"扩展推荐" }, "con_ad":{ - "message":"展示广告" + "message":"在当前的设置页展示广告" }, "des_ad":{ - "message":"广告仅在当前的设置页展现,绝不会在其它页面出现。本扩展一直在不断更新,需要并感谢你的支持。" + "message":"广告仅在当前的设置页展现,绝不会在其它页面出现。感谢你的支持。" }, "des_moreextlist":{ "message":"这些扩展都是本人所开发,欢迎安装使用。" @@ -1501,5 +1501,59 @@ }, "closeapps":{ "message":"关闭当前页内所有迷你应用" + }, + "magnet":{ + "message":"特征码转磁链" + }, + "btn_clear":{ + "message":"清除" + }, + "magnet_placeholder_input":{ + "message":"输入特征码。" + }, + "homepage_grouptop":{ + "message":"最常访问的网站" + }, + "homepage_groupdefault":{ + "message":"默认分组" + }, + "homepage_grouplist":{ + "message":"网站分组列表" + }, + "homepage_editmode":{ + "message":"编辑模式" + }, + "homepage_newgroup":{ + "message":"新增分组" + }, + "homepage_grouptitle":{ + "message":"分组名称" + }, + "homepage_sitetitle":{ + "message":"网站名称" + }, + "homepage_siteurl":{ + "message":"网站地址" + }, + "homepage_placeurl":{ + "message":"包括前缀:http,https等。" + }, + "homepage_cfmlistdel":{ + "message":"该操作会删除相应分组下的所有网站,请再次确认。" + }, + "homepage_ctm":{ + "message":"添加到迷你应用-主页" + }, + "n_homepage_last":{ + "message":"设置上一次选中的网站分组为默认" + }, + "msg_conferr0":{ + "message":"设置保存失败。错误信息如下:" + }, + "msg_conferr1":{ + "message":"smartUp手势将尝试回滚到之前的设置。" + }, + "notif_title_conferr":{ + "message":"设置保存失败!" } } \ No newline at end of file diff --git a/change.log b/change.log index 36b9ef7..68ba79e 100644 --- a/change.log +++ b/change.log @@ -1,5 +1,14 @@ { "log": [ + { + "ver":"6.6.260.1045", + "date":"2020.02.16", + "content":[ + "new action: magnet", + "upgrade homepage", + "fix bug: issues@github: #74, #84, try to fix #72" + ] + }, { "ver":"6.5.1348.1026", "date":"2019.10.16", diff --git a/css/apps_basic.css b/css/apps_basic.css index b1283d6..072465a 100644 --- a/css/apps_basic.css +++ b/css/apps_basic.css @@ -210,6 +210,7 @@ smartup .su_menu img{ padding: 2px; } smartup .su_options{ + transition:all .2s ease-in-out; position: absolute; left: 0; top: 0; diff --git a/css/inject/homepage.css b/css/inject/homepage.css index 4582218..634e78d 100644 --- a/css/inject/homepage.css +++ b/css/inject/homepage.css @@ -1,5 +1,6 @@ smartup.su_apps#su_apps_homepage .su_homepage_box{ width: 550px; + min-height: 120px; padding: 8px; } smartup.su_apps#su_apps_homepage .su_homepage_cp{ @@ -8,7 +9,7 @@ smartup.su_apps#su_apps_homepage .su_homepage_cp{ font-size: 10px; color: #ccc; text-align: right; - width: 580px; + width: auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; @@ -17,6 +18,7 @@ smartup.su_apps#su_apps_homepage .su_homepage_cp{ position: absolute; right: 0; bottom: 0; + text-shadow: 0.5px 0.5px 0 #000000; } smartup.su_apps#su_apps_homepage ul{ /*padding: 10px;*/ @@ -60,4 +62,168 @@ smartup.su_apps#su_apps_homepage .su_homepage_li div span{ overflow: hidden; white-space: nowrap; text-overflow: ellipsis; +} +smartup.su_apps#su_apps_homepage .su_homepage_listbox{ + background-color: rgb(231, 233, 253); + height: 100%; + width: 200px; + position: absolute; + left: 0; + top: 0; + opacity: 0.9; + overflow: hidden auto; + z-index: 100; +} +smartup.su_apps#su_apps_homepage .su_homepage_listul{ + list-style-type: none; + margin: 0 0 0 -8px; + padding: 2px 0; + background: #e7e9fd; + transition:all .4s ease-in-out; + opacity: 1; +} +smartup.su_apps#su_apps_homepage .su_homepage_listli{ + transition:all .3s ease-out; + text-align: right; + width: 100%; + height: 30px; + line-height: 30px; + font-size: 14px; + cursor: pointer; + margin: 2px 0; + padding-right: 8px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} +smartup.su_apps#su_apps_homepage .su_homepage_listli:hover .su_homepage_listbtndel{ + margin-left: 8px; +} +smartup.su_apps#su_apps_homepage .su_homepage_listli:hover .su_homepage_listbtndel:hover{ + background-color: red; +} +smartup.su_apps#su_apps_homepage .su_homepage_listli:hover, +smartup.su_apps#su_apps_homepage .su_homepage_listlicur{ + background: #a6baff; + color: #3f51b5; + /*border-right: 3px solid #5677fc !important;*/ +} +smartup.su_apps#su_apps_homepage .su_homepage_listlicur{ + color: #3f51b5; + font-weight: bold; +} +smartup.su_apps#su_apps_homepage .su_homepage_listaddbox{ + border: 1px #fff0 solid; + border-radius: 20px; +} +smartup.su_apps#su_apps_homepage .su_homepage_listaddbox:hover{ + border-color: #fff; + cursor: pointer; +} +smartup.su_apps#su_apps_homepage .su_homepage_listaddvaluebox{ + display: none; +} +smartup.su_apps#su_apps_homepage .su_homepage_listaddtext{ + width: 80px; +} +smartup.su_apps#su_apps_homepage .su_homepage_listaddbtn{ + border-top: 1px solid #d0d9ff; + padding: 10px 32px; + position: absolute; + bottom: 0; + background: #e7e9fd; + width: auto; +} +smartup.su_apps#su_apps_homepage .su_homepage_listaddbtn:hover{ + cursor: pointer; +} +smartup.su_apps#su_apps_homepage .su_homepage_item{ + overflow: hidden; +} +smartup.su_apps#su_apps_homepage .su_homepage_item:hover .su_homepage_itembtndel{ + margin-right: -8px !important; +} +smartup.su_apps#su_apps_homepage .su_homepage_item:hover .su_homepage_itembtndel:hover{ + background-color: red; +} +smartup.su_apps#su_apps_homepage .su_homepage_itemaddbox{ + width: 360px; + height: auto; + padding: 4px; + background: #cef; + margin: 0 auto; + position: absolute; + right: 12px; + top: 12px; + border-radius: 2px; +} +smartup.su_apps#su_apps_homepage .su_homepage_itembtndel{ + transition:all .3s ease-out; + float: right; + margin: -34px -44px 0 0 !important; + width: 36px; + height: 36px; + text-align: center; + background: rgba(0, 0, 0, 0.5); + color: white !important; + font-size: 16px !important; +} +smartup.su_apps#su_apps_homepage .su_homepage_boxbtnclose{ + position: absolute; + right: 0; + top: 0; + padding: 2px; +} +smartup.su_apps#su_apps_homepage .su_homepage_addboxmain{ + width: 360px; +} +smartup.su_apps#su_apps_homepage .su_homepage_addboxlabel{ + width: 120px; + display: inline-block; + text-align: right; +} +smartup.su_apps#su_apps_homepage .su_homepage_boxgroup{ + width: 120px; +} +smartup.su_apps#su_apps_homepage .su_homepage_addboxbtn{ + text-align: center; + margin: 8px 0; +} +smartup.su_apps#su_apps_homepage .su_homepage_listbtndel{ + transition:all .3s ease-out; + float: left; + width: 24px; + text-align: center; + margin-left: -16px; + background: rgba(0, 0, 0, 0.5); + color: white !important; + font-size: 16px !important; +} +smartup.su_apps#su_apps_homepage .su_homepage_editbg{ + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.5); + position: absolute; + left: 0; + top: 0; + z-index: 101; +} +smartup.su_apps#su_apps_homepage .su_homepage_editbox{ + margin: 0 auto; + width: auto; + height: auto; + top: 48px; + left: 120px; + padding: 4px; + background: #cef; + margin: 0 auto; + position: absolute; + border-radius: 2px; + z-index: 102; +} +smartup.su_apps#su_apps_homepage .su_homepage_editmode{ + background-color: red; +} +smartup.su_apps#su_apps_homepage .su_homepage_listitembox{ + margin: 16px 0; } \ No newline at end of file diff --git a/css/inject/magnet.css b/css/inject/magnet.css new file mode 100644 index 0000000..64b98c5 --- /dev/null +++ b/css/inject/magnet.css @@ -0,0 +1,34 @@ +smartup.su_apps#su_apps_magnet .su_magnetbox{ + width: 520px; + padding: 8px; +} +smartup.su_apps#su_apps_magnet .su_magenet_domleft{ + text-align: center; + width: 240px; + float: left; +} +smartup.su_apps#su_apps_magnet .su_magenet_domleft button{ + margin-bottom: 8px; + margin-top: 8px; +} +smartup.su_apps#su_apps_magnet .su_magenet_link{ + text-align: left; + text-decoration: underline; + color: blue; + display: inline-block; + word-break: break-all; + margin-top: 8px; +} +smartup.su_apps#su_apps_magnet textarea{ + display: block; + width: 240px; + height: 64px; + font-size: 14px; +} +smartup.su_apps#su_apps_magnet .su_magenet_qr{ + height: auto; + width: auto; + padding-left: 8px; + margin-bottom: 8px; + float: right; +} \ No newline at end of file diff --git a/css/inject/tbkjx.css b/css/inject/tbkjx.css index 1f5bffe..05c5896 100644 --- a/css/inject/tbkjx.css +++ b/css/inject/tbkjx.css @@ -77,10 +77,25 @@ smartup.su_apps#su_apps_tbkjx .su_tbkjx_sortbtncur{ color: rgb(255, 255, 255); background: rgb(86, 119, 252); } +smartup.su_apps#su_apps_tbkjx .su_tbkjx_platform{ + margin-bottom: 2px; +} +smartup.su_apps#su_apps_tbkjx .su_tbkjx_platformbtn{ + font-size: 10px; + height: 18px; + line-height: 18px; + min-width: auto; + padding: 0 4px; + margin: 0; +} +smartup.su_apps#su_apps_tbkjx .su_tbkjx_platformbtn_cur{ + color: rgb(255, 255, 255); + background: rgb(86, 119, 252); +} smartup.su_apps#su_apps_tbkjx .su_tbkjx_extent{ /*padding: 4px 0;*/ padding: 0; - margin-bottom: 4px; + margin-bottom: 2px; } smartup.su_apps#su_apps_tbkjx .su_tbkjx_extenttext{ width: 35px; @@ -146,7 +161,7 @@ smartup.su_apps#su_apps_tbkjx .su_tbkjx_listjing{ padding-top: 86px; padding-top: 0; -margin-top: 106px; +margin-top: 120px; position: initial; } smartup.su_apps#su_apps_tbkjx .su_tbkjx_listjing ul{ @@ -158,7 +173,7 @@ height: 288px; overflow-y: auto; overflow-x: hidden; height: 328px; -height: 278px; +height: 264px; padding: 2px 0; } smartup.su_apps#su_apps_tbkjx .su_tbkjx_listjing li{ diff --git a/css/options.css b/css/options.css index c05503c..15eb86c 100644 --- a/css/options.css +++ b/css/options.css @@ -628,7 +628,7 @@ smartup.su_apps{ } #msgbox{ min-width: 300px; - height: 40px; + min-height: 40px; line-height: 40px; background: rgba(202,239,197,.98); position: fixed; @@ -643,6 +643,10 @@ smartup.su_apps{ font-size: 16px; font-weight: bold; } +#msgbox div{ + text-align: left; + line-height: 20px; +} .head{ height: 40px; margin-top: 40px; @@ -796,7 +800,7 @@ smartup.su_apps{ .menup{ height: 40px; line-height: 40px; - font-size: 18px; + font-size: 16px; font-weight: bold; color: rgba(0,0,0,.9); border-top: 1px solid transparent; diff --git a/html/options.html b/html/options.html index 507413e..97e45d1 100644 --- a/html/options.html +++ b/html/options.html @@ -437,6 +437,7 @@


+
@@ -502,7 +503,7 @@
-
+

diff --git a/image/add.svg b/image/add.svg new file mode 100644 index 0000000..50395b3 --- /dev/null +++ b/image/add.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/js/actions.js b/js/actions.js index a9f403b..0d3ed50 100644 --- a/js/actions.js +++ b/js/actions.js @@ -99,7 +99,8 @@ let actions={ {name:"autoreload"}, {name:"homepage"}, {name:"tbkjx"}, - {name:"appslist"} + {name:"appslist"}, + {name:"magnet"} /*{name:"gmail"}, {name:"ary"}, {name:"color"}, @@ -117,7 +118,8 @@ let actions={ {name:"mail",selects:["n_mail","n_tab"],texts:["n_mail_prefix","n_mail_domain"]}, {name:"print"}, {name:"extdisable"}, - {name:"mute",selects:["n_mute"]} + {name:"mute",selects:["n_mute"]}, + {name:"magnet"} ], [//ag_exp {name:"recentclosed"}, @@ -144,7 +146,8 @@ let actions={ {name:"txtsearch",selects:["n_txtengine","n_encoding","n_optype","n_position"],checks:["n_pin"]}, {name:"qr"}, {name:"tts",selects:["n_voicename","n_gender"],ranges:["n_rate","n_pitch","n_volume"]}, - {name:"speaker"} + {name:"speaker"}, + {name:"magnet"} ] ], ldrg_group:["ag_none",/*"ag_tab","ag_copy",*/"ag_others"], diff --git a/js/apps_basic.js b/js/apps_basic.js index 688a233..4bff436 100644 --- a/js/apps_basic.js +++ b/js/apps_basic.js @@ -298,21 +298,24 @@ sue.apps={ var domopt=sue.apps.getAPPboxEle(e).querySelector(".su_options"); var _opt=window.getComputedStyle(domopt).opacity==0?true:false; if(_opt){ - domopt.style.cssText+="opacity:1;z-index:10;"; + domopt.style.cssText+="display:block;"; + window.setTimeout(function(){domopt.style.cssText+="opacity:1;z-index:10;";},10) }else{ domopt.style.cssText+="opacity:0;z-index:-1;"; + window.setTimeout(function(){domopt.style.cssText+="display:none;";},200) } }, initPos:function(dom){ let _fn=function(){ - console.log(dom) dom.querySelector(".su_main").style.cssText+="max-height:"+(window.innerHeight-100)+"px;"; document.body.appendChild(dom); var _appname=dom.dataset.appname; - var _height=window.getComputedStyle(dom).height, - _width=window.getComputedStyle(dom).width; - _height=parseInt(_height.substr(0,_height.length-2)); - _width=parseInt(_width.substr(0,_width.length-2)); + // var _height=window.getComputedStyle(dom).height, + // _width=window.getComputedStyle(dom).width; + var _height=dom.getBoundingClientRect().height; + _width=dom.getBoundingClientRect().width; + // _height=parseInt(_height.substr(0,_height.length-2)); + // _width=parseInt(_width.substr(0,_width.length-2)); dom.style.cssText+="left:"+(window.innerWidth-_width)/2+"px;"; dom.style.cssText+="opacity:.98;top:"+(window.innerHeight-_height)/2+"px;"; window.setTimeout(function(){ @@ -323,5 +326,17 @@ sue.apps={ _fn(); //dom.style.cssText+="opacity:.98;top:"+(window.innerHeight-_height)/2+"px;"; },100) + }, + fixURL:function(url){ + var arrayPre=["http://","https://","ftp://","chrome://","chrome-extension://","view-source:chrome-extension://","moz-extension://","about://","about:","file:///"]; + var _flag=false; + for(var i=0;i'+sub.message.selEle.str+'<\/a>'; clipOBJ.select(); - document.execCommand('copy', false, null); + document.execCommand('copy'); clipOBJ.remove(); } var thepers=["clipboardRead"]; @@ -1962,7 +1985,7 @@ var sub={ var clipOBJ=document.body.appendChild(document.createElement("textarea")); clipOBJ.value=sub.message.selEle.img; clipOBJ.select(); - document.execCommand('copy', false, null); + document.execCommand('copy'); clipOBJ.remove(); } @@ -2340,6 +2363,16 @@ var sub={ }, //mini apps + magnet:function(){ + console.log(sub.message.selEle); + var _appname="magnet"; + sub.initAppconf(_appname); + var _obj={}; + _obj.seltxt=sub.message.selEle?sub.message.selEle.txt:""; + _obj.drawtype=sub.message.drawType; + sub.cons[_appname]=_obj; + sub.insertTest(_appname); + }, tbkjx:function(){ var _appname="tbkjx"; sub.initAppconf(_appname); @@ -2350,7 +2383,10 @@ var sub={ var _appname="homepage"; sub.initAppconf(_appname); chrome.topSites.get(function(sites){ - sub.cons[_appname]=sites; + let _obj={}; + _obj.sites=sites; + _obj.listId=localStorage.getItem("homepageListId"); + sub.cons[_appname]=_obj; sub.insertTest(_appname); }); } @@ -2488,7 +2524,7 @@ var sub={ var _appname="appslist"; sub.initAppconf(_appname); var _obj={} - _obj.apps=["rss","tablist","random","extmgm","recentbk","recentht","recentclosed","synced","base64","qr","numc","speaker","jslist","lottery","convertcase","autoreload","homepage"]; + _obj.apps=["rss","tablist","random","extmgm","recentbk","recentht","recentclosed","synced","base64","qr","numc","speaker","jslist","lottery","convertcase","autoreload","homepage","magnet"]; chrome.tabs.saveAsPDF?_obj.apps.push("savepdf"):null; navigator.language=="zh-CN"?_obj.apps.push("tbkjx"):null; sub.cons[_appname]=_obj; @@ -2587,7 +2623,7 @@ var sub={ console.log("url:"+url+"\ntarget:"+target+"\nindex:"+position+"\npin:"+pin); var fixURL=function(url){ //if() - var fixstrs=["http://","https://","ftp://","chrome://","chrome-extension://","view-source:chrome-extension://","view-source:","moz-extension://","ms-browser-extension://","about:"]; + var fixstrs=["http://","https://","ftp://","chrome://","chrome-extension://","view-source:chrome-extension://","view-source:","moz-extension://","ms-browser-extension://","about:","file:///"]; var theFlag=false; for(var i=0;iresponse.json()) .then(json=>{ + console.log(_configURL); if(!localStorage.getItem("tbkjx_dataversion")||Number(json.version)>=sub.date.get()){ _url=_url+"?"+sub.date.get().toString(); localStorage.setItem("tbkjx_dataversion",json.version); diff --git a/js/event.js b/js/event.js index f282ab9..8ed8c9d 100644 --- a/js/event.js +++ b/js/event.js @@ -1041,7 +1041,7 @@ var sue={ case"paste": var clipOBJ=document.body.appendChild(document.createElement("textarea")); clipOBJ.focus(); - document.execCommand('paste', false, null); + document.execCommand('paste'); var clipData=clipOBJ.value; sue.startEle.value+=response.paste; break; diff --git a/js/inject/homepage.js b/js/inject/homepage.js index b366fcb..36c3ab8 100644 --- a/js/inject/homepage.js +++ b/js/inject/homepage.js @@ -7,7 +7,9 @@ sue.apps.homepage={ headTitle:"homepage", headCloseBtn:true, menu:[ - {src:"/image/options.png",title:"app_tip_opt",className:"menu_item menu_item_opt"} + {src:"/image/menu.svg",title:"homepage_grouplist",className:"menu_item menu_item_homepagelist"}, + {src:"/image/options.png",title:"app_tip_opt",className:"menu_item menu_item_opt"}, + {src:"/image/edit.png",title:"homepage_editmode",className:"menu_item menu_item_homepageedit"} ], options:[ {type:"select",label:"n_optype",name:"n_optype",value:["s_new","s_back","s_current","s_incog"]}, @@ -16,7 +18,8 @@ sue.apps.homepage={ {type:"checkbox",label:"n_closebox",name:"n_closebox",checked:true}, {type:"checkbox",label:"n_homepage_icon",name:"n_homepage_icon",checked:true}, {type:"checkbox",label:"n_homepage_bg",name:"n_homepage_bg",checked:true}, - {type:"checkbox",label:"n_homepage_resize",name:"n_homepage_resize",checked:true} + {type:"checkbox",label:"n_homepage_resize",name:"n_homepage_resize",checked:true}, + {type:"checkbox",label:"n_homepage_last",name:"n_homepage_last",checked:true} ] } sue.apps.init(); @@ -27,6 +30,18 @@ sue.apps.homepage={ let theAppBox=sue.apps.domCreate("div",{setName:["className"],setValue:["su_homepage_box"]}); dom.querySelector(".su_main").appendChild(theAppBox); + let _listBox=sue.apps.domCreate("div",{setName:["className"],setValue:["su_homepage_listbox"]}); + dom.appendChild(_listBox); + let _listItemBox=sue.apps.domCreate("div",{setName:["className"],setValue:["su_homepage_listitembox"]}); + _listBox.appendChild(_listItemBox); + sue.apps.homepage.listInit(dom); + sue.apps.homepage.cons.curListId=0; + + sue.apps.homepage.cons.curListId=sue.apps.homepage.listId; + if(sue.apps.homepage.cons.curListId==null){ + sue.apps.homepage.cons.curListId=0; + } + sue.apps.homepage.listSwitch(dom,sue.apps.homepage.cons.curListId); if(sue.apps.homepage.config.n_homepage_bg){ dom.querySelector(".su_head").style.background="none"; @@ -35,43 +50,406 @@ sue.apps.homepage={ chrome.runtime.sendMessage({type:"appsAction",app:"homepage",action:"getImageURL"}); } - sue.apps.homepage.initItem(); dom.addEventListener("click",this.handleEvent,false); }, + listInit:function(e){ + let _dom=sue.apps.homepage.dom.querySelector(".su_homepage_listitembox"); + let _ul=sue.apps.domCreate("ul",{setName:["className"],setValue:["su_homepage_listul"]}); + _dom.textContent=""; + let _groups=sue.apps.homepage.config.sitegroup.slice(0); + _groups.unshift(sue.apps.i18n("homepage_grouptop")); + for(var i=0;i<_groups.length;i++){ + var _li=sue.apps.domCreate("li",{setName:["className"],setValue:["su_homepage_listli"]},null,null,{setName:["id"],setValue:[i]},_groups[i]); + _ul.appendChild(_li); + } + _dom.appendChild(_ul); + // sue.apps.homepage.listSwitch(e); + sue.apps.homepage.listInitEditmode(e); + }, + listInitEditmode:function(e){ + let _domList=sue.apps.getAPPboxEle(e).querySelector(".su_homepage_listbox"); + if(sue.apps.homepage.cons.editMode){ + let _listAddBtn=sue.apps.domCreate("div",{setName:["className"],setValue:["su_homepage_listaddbtn"]},null,"background:url("+chrome.runtime.getURL("image/add.svg")+") no-repeat 2px 5px #e7e9fd;",null,sue.apps.i18n("homepage_newgroup")); + _domList.appendChild(_listAddBtn); + }else{ + let _listAddBtn=_domList.querySelector(".su_homepage_listaddbtn"); + _listAddBtn?_listAddBtn.remove():null; + } + + let _listLis=sue.apps.getAPPboxEle(e).querySelectorAll(".su_homepage_listul li"); + if(sue.apps.homepage.cons.editMode){ + for(var i=1;i<_listLis.length;i++){ + var _spanDel=sue.apps.domCreate("span",{setName:["className","title"],setValue:["su_homepage_listbtndel",sue.apps.i18n("btn_del")]},null,null,{setName:["id"],setValue:i},"x"); + _listLis[i].appendChild(_spanDel); + } + }else{ + for(var i=1;i<_listLis.length;i++){ + var _spanDel=_listLis[i].querySelector(".su_homepage_listbtndel"); + _spanDel?_spanDel.remove():null; + } + } + let curId=sue.apps.homepage.cons.curListId; + sue.apps.homepage.itemInit(curId,e); + for(var i=0;i<_listLis.length;i++){ + if(i==curId){ + _listLis[i].classList.add("su_homepage_listlicur"); + }else{ + _listLis[i].classList.remove("su_homepage_listlicur"); + } + } + }, + listSwitch:function(e,id){ + if(id!=null){ + sue.apps.homepage.cons.curListId=id; + //if id>length, set to 0 + if(id>sue.apps.homepage.config.sitegroup.length){ + sue.apps.homepage.cons.curListId=0; + } + }else if(e.target&&e.target.classList&&e.target.classList.contains("su_homepage_listli")){ + sue.apps.homepage.cons.curListId=e.target.dataset.id; + } + if(sue.apps.homepage.config.n_homepage_last){ + chrome.runtime.sendMessage({type:"appsAction",app:"homepage",action:"setListId",value:sue.apps.homepage.cons.curListId}) + } + sue.apps.homepage.itemInit(sue.apps.homepage.cons.curListId,e); + let _lis=(sue.apps.getAPPboxEle(e)).querySelectorAll(".su_homepage_listul li"); + for(var i=0;i<_lis.length;i++){ + if(i==sue.apps.homepage.cons.curListId){ + _lis[i].classList.add("su_homepage_listlicur"); + }else{ + _lis[i].classList.remove("su_homepage_listlicur"); + } + } + sue.apps.homepage.listShow(e); + }, + listNew:function(e){ + let dom=sue.apps.getAPPboxEle(e)/*.querySelector(".su_apps")*/, + domBg=sue.apps.domCreate("div",{setName:["className"],setValue:["su_homepage_editbg"]}), + domBox=sue.apps.domCreate("div",{setName:["className"],setValue:["su_homepage_editbox"]}); + + let boxMain=sue.apps.domCreate("div",{setName:["className"],setValue:["su_homepage_addboxmain"]}), + boxTitleLabel=sue.apps.domCreate("label",{setName:["className"],setValue:["su_homepage_addboxlabel"]},null,null,null,sue.apps.i18n("homepage_grouptitle")), + boxTitle=sue.apps.domCreate("input",{setName:["className","type"],setValue:["su_homepage_boxtitle","text"]}); + boxMain.appendChild(boxTitleLabel); + boxMain.appendChild(boxTitle); + domBox.appendChild(boxMain); + + let boxBtn=sue.apps.domCreate("div",{setName:["className"],setValue:["su_homepage_addboxbtn"]}), + boxBtnClose=sue.apps.domCreate("button",{setName:["className"],setValue:["su_homepage_boxbtncancel"]},null,null,null,sue.apps.i18n("btn_cancel")), + boxBtnSave=sue.apps.domCreate("button",{setName:["className"],setValue:["su_homepage_listbtnadd"]},null,null,null,sue.apps.i18n("btn_done")); + boxBtn.appendChild(boxBtnClose); + boxBtn.appendChild(boxBtnSave); + domBox.appendChild(boxBtn); + + dom.appendChild(domBg); + dom.appendChild(domBox); + }, + listNewSave:function(e){ + sue.apps.homepage.config.sitegroup.push(sue.apps.getAPPboxEle(e).querySelector(".su_homepage_boxtitle").value); + sue.apps.homepage.config.sites.push([]); + sue.apps.homepage.saveConf(); + sue.apps.homepage.listInit(e); + }, + listEdit:function(e){ + let id=parseInt(e.target.dataset.id)-1; + if(id==-1){return;} + let dom=sue.apps.getAPPboxEle(e)/*.querySelector(".su_apps")*/, + domBg=sue.apps.domCreate("div",{setName:["className"],setValue:["su_homepage_editbg"]}), + domBox=sue.apps.domCreate("div",{setName:["className"],setValue:["su_homepage_editbox"]}); + + let boxMain=sue.apps.domCreate("div",{setName:["className"],setValue:["su_homepage_addboxmain"]}), + boxTitleLabel=sue.apps.domCreate("label",{setName:["className"],setValue:["su_homepage_addboxlabel"]},null,null,null,sue.apps.i18n("homepage_grouptitle")), + boxTitle=sue.apps.domCreate("input",{setName:["className","type","value"],setValue:["su_homepage_boxtitle","text",sue.apps.homepage.config.sitegroup[id]]}); + boxMain.appendChild(boxTitleLabel); + boxMain.appendChild(boxTitle); + domBox.appendChild(boxMain); + + let boxBtn=sue.apps.domCreate("div",{setName:["className"],setValue:["su_homepage_addboxbtn"]}), + boxBtnClose=sue.apps.domCreate("button",{setName:["className"],setValue:["su_homepage_boxbtncancel"]},null,null,null,sue.apps.i18n("btn_cancel")), + boxBtnSave=sue.apps.domCreate("button",{setName:["className"],setValue:["su_homepage_listbtnedit"]},null,null,{setName:["id"],setValue:[id]},sue.apps.i18n("btn_done")); + boxBtn.appendChild(boxBtnClose); + boxBtn.appendChild(boxBtnSave); + domBox.appendChild(boxBtn); + + dom.appendChild(domBg); + dom.appendChild(domBox); + }, + listEditSave:function(e){ + sue.apps.homepage.config.sitegroup[e.target.dataset.id]=sue.apps.getAPPboxEle(e).querySelector(".su_homepage_boxtitle").value; + console.log(sue.apps.homepage.config.sitegroup[e.target.dataset.id]); + sue.apps.homepage.saveConf(); + sue.apps.homepage.listInit(e); + }, + listDel:function(e){ + let dom=sue.apps.getAPPboxEle(e); + let id=parseInt(e.target.parentNode.dataset.id)-1; + sue.apps.homepage.cons.curListId=parseInt(e.target.parentNode.dataset.id)-1; + if(window.confirm(sue.apps.i18n("homepage_cfmlistdel"))){ + sue.apps.homepage.config.sitegroup.splice(id,1); + sue.apps.homepage.config.sites.splice(id,1) + sue.apps.homepage.saveConf(); + sue.apps.homepage.listInit(sue.apps.getAPPboxEle(e)); + } + }, + listShow:function(e){ + let _dom=(e?sue.apps.getAPPboxEle(e):false)||sue.apps.homepage.dom; + _dom=_dom.querySelector(".su_homepage_listbox"); + _dom.style.display=window.getComputedStyle(_dom).display=="none"?"block":"none"; + }, + saveConf:function(){ + chrome.runtime.sendMessage({type:"apps_saveconf",apptype:"homepage",config:sue.apps.homepage.config}); + }, handleEvent:function(e){ switch(e.type){ case"click": if(e.target.classList.contains("su_homepage_item")){ - chrome.runtime.sendMessage({type:"appsAction",app:"homepage",action:"openItem",value:e.target.dataset.url}) - if(sue.apps.homepage.config.n_closebox){ - sue.apps.boxClose(e); + if(sue.apps.homepage.cons.editMode){ + sue.apps.homepage.itemEdit(e); + }else{ + chrome.runtime.sendMessage({type:"appsAction",app:"homepage",action:"openItem",value:e.target.dataset.url}) + if(sue.apps.homepage.config.n_closebox){ + sue.apps.boxClose(e); + } } + }else if(e.target.classList.contains("su_homepage_listli")){ + sue.apps.homepage.cons.editMode?sue.apps.homepage.listEdit(e):sue.apps.homepage.listSwitch(e); + }else if(e.target.classList.contains("su_homepage_listaddbtnbox")){ + sue.apps.homepage.showAddbox(e); + }else if(e.target.classList.contains("su_homepage_listaddbtn")){ + sue.apps.homepage.listNew(e); + }else if(e.target.classList.contains("su_homepage_listbtnadd")){ + sue.apps.homepage.listNewSave(e); + sue.apps.homepage.itemEditClose(e); + }else if(e.target.classList.contains("menu_item_homepagelist")){ + sue.apps.homepage.listShow(e); + }else if(e.target.classList.contains("menu_item_homepageedit")){ + sue.apps.homepage.editMode(e); + sue.apps.homepage.itemInit(sue.apps.getAPPboxEle(e).querySelector(".su_homepage_listlicur")?parseInt(sue.apps.getAPPboxEle(e).querySelector(".su_homepage_listlicur").dataset.id):0,e); + sue.apps.homepage.listInit(e); + }else if(e.target.classList.contains("su_homepage_itemadd")){ + sue.apps.homepage.itemNew(e); + }else if(e.target.classList.contains("su_homepage_boxbtncancel")){ + sue.apps.homepage.itemEditClose(e); + }else if(e.target.classList.contains("su_homepage_boxbtnnew")){ + sue.apps.homepage.itemNewSave(e); + sue.apps.homepage.itemEditClose(e); + }else if(e.target.classList.contains("su_homepage_boxbtnedit")){ + sue.apps.homepage.itemEditSave(e); + sue.apps.homepage.itemEditClose(e); + }else if(e.target.classList.contains("su_homepage_itembtndel")){ + sue.apps.homepage.itemDel(e); + }else if(e.target.classList.contains("su_homepage_listbtnedit")){ + sue.apps.homepage.listEditSave(e); + sue.apps.homepage.itemEditClose(e); + }else if(e.target.classList.contains("su_homepage_listbtndel")){ + sue.apps.homepage.listDel(e); + }else if(e.target.classList.contains("su_homepage_ctmbtnsave")){ + sue.apps.homepage.itemCTMSave(e); + sue.apps.homepage.itemEditClose(e); } } }, - initItem:function(){ - let _dom=sue.apps.homepage.dom.querySelector(".su_homepage_box"); - let _ul=sue.apps.domCreate("ul"); - for(var i=0;i=0;i--){ + if(data[i][5]==1){ + data.splice(i,1); + } + } + }else if(sue.apps.tbkjx.cons.platform==2){ + for(var i=data.length-1;i>=0;i--){ + if(data[i][5]==0){ + data.splice(i,1); + } + } + } + return data; + } + + data=getPlatformData(data.slice(0)); sue.apps.tbkjx.cons.curData=data.slice(0); //// let _listLength=sue.apps.tbkjx.config.n_num; @@ -211,6 +239,12 @@ sue.apps.tbkjx={ if(e.target.classList.contains("su_tbkjx_img")||(e.target.parentNode&&e.target.parentNode.classList.contains("su_tbkjx_qr"))){ sue.apps.tbkjx.showQR(); } + if(e.target.classList.contains("su_tbkjx_platformbtn")){ + sue.apps.tbkjx.cons.platform=Number(e.target.dataset.platform); + sue.apps.tbkjx.platformBtn(); + sue.apps.tbkjx.initList(sue.apps.tbkjx.cons.platformBase,0); + sue.apps.tbkjx.itemSort(sue.apps.tbkjx.cons.curSort); + } break; case"keypress": if(e.keyCode==13&&e.target.id=="su_tbkjx_searchkey"){ @@ -221,6 +255,13 @@ sue.apps.tbkjx={ break; } }, + platformBtn:function(){ + let platformBtns=sue.apps.tbkjx.dom.querySelectorAll(".su_tbkjx_platformbtn"); + for(var i=0;i","notifications","storage","contextMenus","tts"], + "permissions": ["tabs","","notifications","storage","contextMenus","unlimitedStorage","tts"], "optional_permissions": ["downloads","downloads.shelf","clipboardRead","clipboardWrite","bookmarks","history","management","sessions","pageCapture","background","topSites"] } \ No newline at end of file diff --git a/manifest_note b/manifest_note index c403df0..b8bd0b8 100644 --- a/manifest_note +++ b/manifest_note @@ -1,7 +1,7 @@ //The diffrent betwen browsers, from line 455 //chrome "incognito": "split", -"permissions": ["tabs","","notifications","storage","contextMenus","tts"], +"permissions": ["tabs","","notifications","storage","contextMenus","unlimitedStorage","tts"], "optional_permissions": ["downloads","downloads.shelf","clipboardRead","clipboardWrite","bookmarks","history","management","sessions","pageCapture","background","topSites"] //firefox @@ -9,5 +9,5 @@ "optional_permissions": ["browserSettings"] //firefox -"permissions": ["tabs","","notifications","storage","contextMenus","management","sessions"], +"permissions": ["tabs","","notifications","storage","contextMenus","unlimitedStorage","management","sessions"], "optional_permissions": ["browserSettings","downloads","clipboardRead","clipboardWrite","bookmarks","history","topSites"]