Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
zimocode committed Apr 6, 2021
2 parents dfea10e + e45797e commit ed3119e
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 142 deletions.
26 changes: 26 additions & 0 deletions README-zh_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<p align="center">
<img width="100px" src="https://user-images.githubusercontent.com/29518677/113705830-7c8fc580-9710-11eb-9b75-f2eddd761590.png" align="center" alt="GitHub Readme Stats" />
<h2 align="center">smartUp手势</h2>
<p align="center">一个更好的手势类扩展。功能包括:鼠标手势,简易拖曳,超级拖曳,摇杆手势和滚轮手势。</p>
<p align="center">
<a href="https://github.com/zimocode/smartup/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/zimocode/smartup" />
</a>
<a href="https://github.com/zimocdoe/smartup/members">
<img alt="forks" src="https://img.shields.io/github/forks/zimocode/smartup" />
</a>
<a href="https://github.com/zimocode/smartup/stargazers">
<img alt="Stars" src="https://img.shields.io/github/stars/zimocode/smartup" />
</a>
<a href="https://github.com/zimocode/smartup/pulls">
<img alt="GitHub pull requests" src="https://img.shields.io/github/license/zimocode/smartup" />
</a>
<br />
</p>

<p align="center">
<a href="/docs/readme_fr.md">English</a>
·
<a href="/docs/readme_cn.md">简体中文</a>
</p>
</p>
29 changes: 6 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<p align="center">
<img width="100px" src="https://res.cloudinary.com/anuraghazra/image/upload/v1594908242/logo_ccswme.svg" align="center" alt="GitHub Readme Stats" />
<h2 align="center">smartup手势</h2>
<p align="center">一个更好的手势类扩展。功能包括:鼠标手势,简易拖曳,超级拖曳,摇杆手势和滚轮手势。</p>
</p>
<img width="100px" src="https://user-images.githubusercontent.com/29518677/113705830-7c8fc580-9710-11eb-9b75-f2eddd761590.png" align="center" alt="GitHub Readme Stats" />
<h2 align="center">smartUp Gestures</h2>
<p align="center">A better gestures extension. Features include: mouse gestures, simple drag, super drag, rocker gestures and wheel gestures.</p>
<p align="center">
<a href="https://github.com/zimocode/smartup/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/zimocode/smartup" />
Expand All @@ -17,27 +16,11 @@
<img alt="GitHub pull requests" src="https://img.shields.io/github/license/zimocode/smartup" />
</a>
<br />
<br />
<a href="https://a.paddle.com/v2/click/16413/119403?link=1227">
<img src="https://img.shields.io/badge/Supported%20by-VSCode%20Power%20User%20%E2%86%92-gray.svg?colorA=655BE1&colorB=4F44D6&style=for-the-badge"/>
</a>
<a href="https://a.paddle.com/v2/click/16413/119403?link=2345">
<img src="https://img.shields.io/badge/Supported%20by-Node%20Cli.com%20%E2%86%92-gray.svg?colorA=61c265&colorB=4CAF50&style=for-the-badge"/>
</a>
</p>

<p align="center">
<a href="#demo">查看 Demo</a>
·
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new/choose">报告 Bug</a>
·
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new/choose">请求增加功能</a>
</p>
<p align="center">
<a href="/docs/readme_fr.md">English</a>
<a href="/docs/README.md">English</a>
·
<a href="/docs/readme_cn.md">简体中文</a>
<a href="/docs/README-zh_CN.md">简体中文</a>
</p>
</p>
<p align="center">喜欢这个项目?请考虑<a href="https://www.paypal.me/anuraghazra">捐赠</a>来帮助它完善!

</p>
9 changes: 6 additions & 3 deletions css/options.css
Original file line number Diff line number Diff line change
Expand Up @@ -1802,7 +1802,7 @@ summary:hover{
}
#donate_box .donate_listli{
cursor: pointer;
max-width: 64px;
max-width: 128px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
Expand All @@ -1821,8 +1821,10 @@ summary:hover{
display: none;
}
#donate_box #donate_content{
padding: 8px;
/*padding-top: 1px;*/
border-top: 1px solid #999;
background-color: #fff;
width: 360px;
}
#donate_box .donate_contentlist{
display: none;
Expand All @@ -1833,7 +1835,8 @@ summary:hover{
}
#donate_box .donate_contentlist img{
display: block;
width: 192px;
/*width: 192px;*/
width: 100%;
margin: 0 auto;
}
#donate_box .donate_contentlist span{
Expand Down
211 changes: 96 additions & 115 deletions js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ var suo={
break;
}
if(ele.classList.contains("donate_listli")){
suo.donateBox.switchDonate(ele);
suo.donateBox.switch(ele);
}
if(ele.classList.contains("menuplus_save")){
suo.saveConf2();
Expand Down Expand Up @@ -2600,139 +2600,120 @@ var suo={
donateBox:{
init:function(){
chrome.runtime.sendMessage({type:"getDonateData"},function(response){
console.log(response)
if(response.value){
suo.cons.xhrDonate=response.value;
let localType=navigator.language,
_url="https://apis.zimoapps.com/su";
localType=localType.replace("-","_");
fetch(_url,{
method:"GET",
cache:"no-cache"
}).then(response=>response.json())
.then(response=>{
suo.cons.xhrDonate=response;
suo.donateBox.show();
}else{
let xhr = new XMLHttpRequest(),
localType=navigator.language,
_url="https://push.zimoapps.com/smartup/message.json";
//localType="zh-CN";
// _url="../message.json";
xhr.onreadystatechange=function(){
if (xhr.readyState == 4){
let items=JSON.parse(DOMPurify.sanitize(xhr.response));
console.log(items)
if(items.options.on){
if((items.all_local&&items.all_local.length>0)||(items[localType]&&items[localType].length>0)){
suo.cons.xhrDonate=items;
suo.donateBox.show();
chrome.runtime.sendMessage({type:"setDonateData",value:items});
}
}
let data={
donate:[],
ad:[]
}
if(response[0]&&response[0]["on"]&&response[0].donate[0][localType]){
data.donate.push(response[0].donate[0][localType]);
}else{
if(response[0].donate[0]["default"]){
data.donate.push(response[0].donate[0]["default"]);
}else{
data.donate.length=0;
}
}
xhr.open('GET',_url+"?"+new Date().getTime(), true);
xhr.send();
}
if(response[1]&&response[1]["on"]&&response[1].ad[0][localType]){
data.ad.push(response[1].ad[0][localType]);
}else{
if(response[1].ad[0]["default"]){
data.ad.push(response[1].ad[0]["default"]);
}else{
data.ad.length=0;
}
}
suo.donateBox.dom(data);
})
})
},
show:function(){
document.querySelector("#donate_box").style.cssText+="display:block;";
},
checkPushMessage:function(){
let _items=suo.cons.xhrDonate;
let lang=navigator.language;
//lang="zh-CN";
let i=0,itemArray=[];
itemLocal=_items[lang],
itemAllLocal=_items.all_local;
if(_items.all_local_i18n&&_items.all_local_i18n[lang]){
for(i=0;i<_items.all_local_i18n[lang].length;i++){
for(var ii in _items.all_local_i18n[lang][i]){
itemAllLocal[i][ii]=_items.all_local_i18n[lang][i][ii]
}
}
}
if(itemLocal){itemArray.push(itemLocal)}
if(itemAllLocal){itemArray.push(itemAllLocal)}
suo.donateBox.setPushDom(itemArray)
},
setPushDom:function(items){
console.log(items)
dom:function(items){
let domMain=document.querySelector("#donate_main"),
domList=document.querySelector("#donate_list"),
domContent=document.querySelector("#donate_content");
domList.textContent="";
domContent.textContent="";
let i=0,ii=0,id_i=0,id_ii=0;
let initDom=function(itemOBJ){
let i=0,ii=0;
for(i=0;i<itemOBJ.length;i++){
console.log(itemOBJ[i]);
var _list=document.createElement("li");
_list.classList.add("donate_listli");
_list.setAttribute("id",id_i);
_list.innerText=itemOBJ[i].title;
_list.title=itemOBJ[i].title;
if(i==0&&id_i==0){_list.classList.add("donate_listcurrent");}
domList.appendChild(_list);
id_i++;
}
for(ii=0;ii<itemOBJ.length;ii++){
console.log(ii);
var _content=document.createElement("div");
_content.classList.add("donate_contentlist");
_content.setAttribute("id",id_ii);
if(ii==0&&id_ii==0){_content.classList.add("donate_contentcurrent")}
if(itemOBJ[ii].img){
if(itemOBJ[ii].imglink){
var _a=suo.domCreate2("a",{setName:["href","target"],setValue:[itemOBJ[ii].imglink,"_blank"]});
var _img=suo.domCreate2("img",{setName:["src"],setValue:[itemOBJ[ii].img]});
_a.appendChild(_img);
_content.appendChild(_a);
}else{
var _img=document.createElement("img");
_img.src=itemOBJ[ii].img;
_content.appendChild(_img);
}
}
if(itemOBJ[ii].qrcode){
var _qrcode=document.createElement("div");
new QRCode(_qrcode,itemOBJ[ii].qrcode);
_content.appendChild(_qrcode);
}
if(itemOBJ[ii].link){
let initDom=function(itemOBJ,id){
var _list=suo.domCreate2("li",{setName:["className","title"],setValue:["donate_listli",itemOBJ.name]},null,null,{setName:["id"],setValue:[id]},itemOBJ.name);
domList.appendChild(_list);
var _content=suo.domCreate2("div",{setName:["className"],setValue:["donate_contentlist"]},null,null,{setName:["id"],setValue:[id]});
switch(itemOBJ.type){
case"text":
var _text=document.createElement("span");
_text.textContent=itemOBJ.text;
_content.appendChild(_text);
break;
case"img":
var _img=document.createElement("img");
_img.src=itemOBJ.url;
_content.appendChild(_img);
break;
case"link":
var _link=document.createElement("a");
_link.href=itemOBJ[ii].link;
_link.href=itemOBJ.url;
_link.target="_blank";
_link.innerText=itemOBJ[ii].linktext;
_link.textContent=itemOBJ.text;
_content.appendChild(_link);
}
if(itemOBJ[ii].des){
var _des=document.createElement("span");
_des.innerText=itemOBJ[ii].des;
_content.appendChild(_des);
}
domContent.appendChild(_content);
id_ii++;
break;
case"linkimg":
var _a=suo.domCreate2("a",{setName:["href","target"],setValue:[itemOBJ.url,"_blank"]});
var _img=suo.domCreate2("img",{setName:["src"],setValue:[itemOBJ.img]});
_a.appendChild(_img);
_content.appendChild(_a);
break;
case"qrcode":
console.log("qr")
var _qrcode=document.createElement("div");
new QRCode(_qrcode,itemOBJ.code);
_content.appendChild(_qrcode);
break;
}
domContent.appendChild(_content);
// return _list;
}
for(i=0;i<items.length;i++){
initDom(items[i]);
for(var i=0;items.donate&&items.donate[0]&&items.donate[0].length>0&&i<items.donate[0].length;i++){
initDom(items.donate[0][i],i);
}
document.querySelector("#donate_loading").style.cssText+="display:none;";
domMain.style.cssText+="display:block;";
document.querySelector("#donate_btn_close").style.cssText+="display:block;";
document.querySelector("#donate_btn_hide").style.cssText+="display:block;";
let _flag=i;
for(var i=0;items.ad&&items.ad[0]&&items.ad[0].length>0&&i<items.ad[0].length;i++){
initDom(items.ad[0][i],_flag+i);
}
suo.donateBox.switch(document.querySelectorAll("#donate_list li")[0]);
},
switchDonate:function(ele){
console.log(ele);
console.log(ele.id);
document.querySelector(".donate_listcurrent").classList.remove("donate_listcurrent");
ele.classList.add("donate_listcurrent");

let donateContents=document.querySelectorAll(".donate_contentlist");
let contentLastCurrent=document.querySelector(".donate_contentcurrent");
contentLastCurrent.classList.remove("donate_contentcurrent");
let contentCurrent=document.querySelector(".donate_contentlist[id='"+ele.id+"']");
contentCurrent.classList.add("donate_contentcurrent");
switch:function(dom){
let lists=document.querySelectorAll("#donate_main #donate_list li"),
contents=document.querySelectorAll("#donate_main #donate_content .donate_contentlist");
for(var i=0;i<lists.length;i++){
if(lists[i].classList.contains("donate_listcurrent")){
lists[i].classList.remove("donate_listcurrent");
}
}
dom.classList.add("donate_listcurrent");
for(var i=0;i<contents.length;i++){
if(contents[i].classList.contains("donate_contentcurrent")){
contents[i].classList.remove("donate_contentcurrent");
}
}
document.querySelector("div[data-id='"+dom.dataset.id+"']").classList.add("donate_contentcurrent");
},
show:function(){
document.querySelector("#donate_box").style.cssText+="display:block;";
},
showDonate:function(){
document.querySelector("#donate_main").style.cssText+="display:none;";
document.querySelector("#donate_loading").style.cssText+="display:block;";
suo.donateBox.checkPushMessage();
document.querySelector("#donate_loading").style.cssText+="display:none;";
// domMain.style.cssText+="display:block;";
document.querySelector("#donate_main").style.cssText+="display:block;";
document.querySelector("#donate_btn_close").style.cssText+="display:block;";
document.querySelector("#donate_btn_hide").style.cssText+="display:block;";
},
hideDonate:function(ele){
console.log(ele);
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"minimum_chrome_version": "22",
"name": "__MSG_ext_name__",
"short_name":"smartUp",
"version": "6.7.366.1104",
"version": "6.7.501.1106",
"description": "__MSG_ext_des__",
"default_locale": "en",
"author":"zimo",
Expand Down

0 comments on commit ed3119e

Please sign in to comment.