|
4 | 4 | // @name:zh-TW 大人的Greasyfork |
5 | 5 | // @name:ja 大人のGreasyfork |
6 | 6 | // @namespace hoothin |
7 | | -// @version 0.70 |
| 7 | +// @version 0.80 |
8 | 8 | // @description Merge adult results of sleazyfork into greasyfork when the script is no longer anonymously available, add rating score and version for scripts then |
9 | 9 | // @description:zh-CN 在Greasyfork的搜索结果中添加Sleazyfork上的成人脚本,增加评分与版本号,并在访问匿名不可用脚本时跳转至Sleazyfork |
10 | 10 | // @description:zh-TW 在Greasyfork的搜索結果中添加Sleazyfork上的成人腳本,增加評分與版本號,並在訪問匿名不可用腳本時跳轉至Sleazyfork |
|
92 | 92 | } |
93 | 93 | var sortDiv=document.querySelector("#script-list-sort"); |
94 | 94 | if(sortDiv){ |
| 95 | + var switchFilter=document.createElement("div"),enableFilter=!GM_getValue("disableFilter"); |
| 96 | + var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; |
| 97 | + var observer = new MutationObserver(function(records){ |
| 98 | + records.map(function(record) { |
| 99 | + for(var i=0;i<record.addedNodes.length;i++){ |
| 100 | + var curNode=record.addedNodes[i]; |
| 101 | + if(curNode.className=="script-list"){ |
| 102 | + var scripts=curNode.querySelectorAll('li'); |
| 103 | + for(let i=0;i<scripts.length;i++){ |
| 104 | + let script=scripts[i]; |
| 105 | + addScore(script); |
| 106 | + } |
| 107 | + if(enableFilter)filter(curNode); |
| 108 | + } |
| 109 | + } |
| 110 | + }); |
| 111 | + }); |
| 112 | + var option = { |
| 113 | + 'childList': true |
| 114 | + }; |
| 115 | + observer.observe(document.querySelector("body>.width-constraint"), option); |
95 | 116 | var scripts=document.querySelectorAll('ol.script-list>li'); |
96 | 117 | for(let i=0;i<scripts.length;i++){ |
97 | 118 | let script=scripts[i]; |
|
103 | 124 | style.type = 'text/css'; |
104 | 125 | document.querySelector('head').appendChild(style); |
105 | 126 | var bullshit="vip.*视频|百度(云|网盘)|AntiGame|split|Agar|agar\.io|alis\.io|angel\.io|ExtencionRipXChetoMalo|AposBot|DFxLite|ZTx-Lite|AposFeedingBot|AposLoader|Blah Blah|Orc Clan Script|Astro\s*Empires|^\s*Attack|^\s*Battle|BiteFight|Blood\s*Wars|Bots|Bots4|Brawler|\bBvS\b|Business\s*Tycoon|Castle\s*Age|City\s*Ville|chopcoin\.io|Comunio|Conquer\s*Club|CosmoPulse|cursors\.io|Dark\s*Orbit|Dead\s*Frontier|Diep\.io|\bDOA\b|doblons\.io|DotD|Dossergame|Dragons\s*of\s*Atlantis|driftin\.io|Dugout|\bDS[a-z]+\n|elites\.io|Empire\s*Board|eRep(ublik)?|Epic.*War|ExoPlanet|Falcon Tools|Feuerwache|Farming|FarmVille|Fightinfo|Frontier\s*Ville|Ghost\s*Trapper|Gladiatus|Goalline|Gondal|gota\.io|Grepolis|Hobopolis|\bhwm(\b|_)|Ikariam|\bIT2\b|Jellyneo|Kapi\s*Hospital|Kings\s*Age|Kingdoms?\s*of|knastv(ö|oe)gel|Knight\s*Fight|\b(Power)?KoC(Atta?ck)?\b|\bKOL\b|Kongregate|Last\s*Emperor|Legends?\s*of|Light\s*Rising|lite\.ext\.io|Lockerz|\bLoU\b|Mafia\s*(Wars|Mofo)|Menelgame|Mob\s*Wars|Mouse\s*Hunt|Molehill\s*Empire|NeoQuest|MyFreeFarm|narwhale\.io|Neopets|Nemexia|\bOGame\b|Ogar(io)?|Pardus|Pennergame|Pigskin\s*Empire|PlayerScripts|pokeradar\.io|Popmundo|Po?we?r\s*(Bot|Tools)|PsicoTSI|Ravenwood|Schulterglatze|slither\.io|slitherplus\.io|slitheriogameplay|SpaceWars|splix\.io|\bSW_[a-z]+\n|\bSnP\b|The\s*Crims|The\s*West|torto\.io|Travian|Treasure\s*Isl(and|e)|Tribal\s*Wars|TW.?PRO|Vampire\s*Wars|vertix\.io|War\s*of\s*Ninja|West\s*Wars|wings\.io|\bWoD\b|World\s*of\s*Dungeons|wtf\s*battles|Wurzelimperium"; |
106 | | - var filterName="Enable Filter",filteredNum; |
107 | | - var filter=function(){ |
108 | | - filteredNum=0; |
109 | | - [].forEach.call(document.querySelectorAll('article>h2'), function(item) { |
| 127 | + var filterName="Enable Filter",filteredNum=0; |
| 128 | + var filter=function(t){ |
| 129 | + [].forEach.call(t.querySelectorAll('article>h2'), function(item) { |
110 | 130 | if(new RegExp(bullshit,"i").test(item.innerText)){ |
111 | 131 | item.parentNode.parentNode.classList.add('filtered'); |
112 | 132 | filteredNum++; |
113 | 133 | } |
114 | 134 | }); |
115 | 135 | }; |
116 | | - var switchFilter=document.createElement("div"),enableFilter=!GM_getValue("disableFilter"); |
117 | | - if(enableFilter)filter(); |
| 136 | + if(enableFilter)filter(document); |
118 | 137 | switchFilter.innerHTML='<input type="checkBox" name="switchFilter" id="switchFilter"/><label for="switchFilter">'+filterName+(filteredNum?' ('+filteredNum+' filtered)':'')+'</label>'; |
119 | 138 | var switchFilterCheckbox=switchFilter.querySelector('#switchFilter'); |
120 | 139 | var switchFilterLabel=switchFilterCheckbox.nextSibling; |
|
126 | 145 | }); |
127 | 146 | switchFilterLabel.innerHTML=filterName; |
128 | 147 | }else{ |
129 | | - filter(); |
| 148 | + filteredNum=0; |
| 149 | + filter(document); |
130 | 150 | switchFilterLabel.innerHTML=filterName+' ('+filteredNum+' filtered)'; |
131 | 151 | } |
132 | 152 | GM_setValue("disableFilter",enableFilter); |
|
0 commit comments