87,996
社区成员
发帖
与我相关
我的任务
分享
var iconArray = [
{
name: 'Google',
image: 'https://i.ibb.co/R9HMTyR/1-5.png',
host: ['www.google.com'],
popup: function (text, name) {
open('https://www.google.com/s?wd=' + encodeURIComponent(text), name);
console.log(name);
}
},
{
name: 'Bing',
image: 'https://i.ibb.co/R9HMTyR/1-5.png',
host: ['www.bing.com'],
popup: function (text, name) {
open('https://www.bing.com/s?wd=' + encodeURIComponent(text), name);
console.log(name);
}
},
]
function open(url, a) {
try {
if(GM_openInTab(url, { loadInBackground: true, insert: true, setParent :true })){
if(GM_getValue(a).times){
GM_setValue(a, {
'times': GM_getValue(a).times + 1
});
}else{
GM_setValue(a, {
'times': 1
});
}
console.log('times-'+GM_getValue(a).times);
} else{
}
} catch (error) {
return GM_openInTab(url, { loadInBackground: true, insert: true, setParent :true });
}
}
{
"Google": {
"times": "1",
},
"Bing": {
"times": "4",
},
}