diff --git a/SrcJuying.js b/SrcJuying.js index 40eeb559..0f72b1ef 100644 --- a/SrcJuying.js +++ b/SrcJuying.js @@ -451,11 +451,17 @@ function sousuo2() { clearMyVar('sousuo$input'); })); var searchurl = $('').lazyRule(() => { - return $('hiker://empty#noRecordHistory##noHistory#').rule((name) => { - require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJyXunmi.js'); - xunmi(name); - }, input); - }); + let recordlist = storage0.getItem('searchrecord') || []; + recordlist.unshift(input); + if(recordlist.length>10){ + recordlist.splice(recordlist.length-1,1); + } + storage0.setItem('searchrecord', recordlist); + return $('hiker://empty#noRecordHistory##noHistory#').rule((name) => { + require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJyXunmi.js'); + xunmi(name); + }, input); + }); var d = []; d.push({ title: "🔍", @@ -506,12 +512,49 @@ function sousuo2() { }, searchurl) } }); - + if(getItem('searchrecordide','0')=='1'){ + let recordlist = storage0.getItem('searchrecord') || []; + if(recordlist.length>0){ + d.push({ + title: '🗑清空', + url: $('#noLoading#').lazyRule(() => { + clearItem('searchrecord'); + deleteItemByCls('searchrecord'); + return "hiker://empty"; + }), + col_type: 'scroll_button' + }); + } + recordlist.forEach(item=>{ + d.push({ + title: item, + url: item + searchurl, + col_type: 'scroll_button', + extra: { + cls: 'searchrecord', + } + }); + }) + } d.push({ title: '\t热搜榜\t\t\t', url: "hiker://empty", pic_url: 'https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq/it/u=3779990328,1416553241&fm=179&app=35&f=PNG?w=60&h=70&s=E7951B62A4639D153293A4E90300401B', - col_type: 'icon_small_3' + col_type: 'icon_small_3', + extra: { + longClick: [{ + title: "开启/关闭搜索历史记录显示", + js: $.toString(() => { + if(getItem('searchrecordide','0')=='1'){ + clearItem('searchrecordide'); + }else{ + setItem('searchrecordide','1'); + } + refreshPage(false); + return "toast://已切换" + }) + }] + } }); var resoufile = "hiker://files/rules/Src/Juying/resou.json";