// ==UserScript== // @name 饰品筛选倒余额 比例自定义 支持buff c5game igxe // @namespace http://tampermonkey.net/ // @icon https://store.steampowered.com/favicon.ico // @version 0.14 // @description 饰品筛选倒余额 可视化比例自定义面板 支持buff c5game igxe // @author wsz987 // @match *://buff.163.com/market/?game=* // @match *://buff.163.com/market/goods?goods_id=* // @match *://www.c5game.com/* // @match *://www.igxe.cn/* // @match *://www.igxe.cn/product/* // @require https://cdn.staticfile.org/jquery/1.12.4/jquery.min.js // @grant GM_getValue // @grant GM_setValue // @supportURL https://keylol.com/t577669-1-1 igxe document.querySelectorAll(" div.sum.fr") c5game document.querySelectorAll(" span.num").length // @downloadURL none // ==/UserScript== const $ = window.jQuery; /*A 上一页 S 居中且过滤 D 下一页 W 居中 E 过滤后全部打开*/ (function() { 'use strict'; window.onload=function(){ web(); middle(); tool() try{ document.onkeydown=function(event){ var e = event || window.event || arguments.callee.caller.arguments[0]; if(e && e.keyCode==83){ middle().then(filter()) } if(e && e.keyCode==68){ nextpage(); } if(e && e.keyCode==65){ prevpage(); } if(e && e.keyCode==87){ middle(); } if(e && e.keyCode==69){ filter().then(allopen()); } } }catch(e){console.log(e)} } if(window.location.href.indexOf('buff.163.com/market/goods?goods_id=')>-1||window.location.href.indexOf('www.igxe.cn/product')>-1||window.location.href.indexOf('c5game.com/dota/')>-1||window.location.href.indexOf('c5game.com/csgo/')>-1){ setTimeout(function(){ for(var i=0;i<10;i++){ setTimeout(choice,500*i); } },3000); } })(); function tool(){ var li = "
A 上一页
S  过滤
D 下一页
W 居中
E 过滤后全部打开
"; var tool ="
<重置>
" $("body").append(li,tool); $('.pre_pagebtn')[0].onclick=function(){ prevpage(); } $('.next_pagebtn')[0].onclick=function(){ nextpage(); } var saved_default=['300','0.7','0.75'], saved_update = GM_getValue("saved_tool"); $('.price_tool_reset')[0].onclick=function(){ //reset GM_setValue("saved_tool",saved_default); initdata() alert('重置成功 默认数据["300","0.7","0.75"]') } if (saved_update == null) { GM_setValue("saved_tool",saved_default); } console.log(GM_getValue('saved_tool')) initdata() $("#sale_count")[0].onchange= function(){ saved_update[0]=parseInt($("#sale_count")[0].value) if(saved_update[0]>0&&window.location.href.indexOf('buff.163.com/market/?game=')>-1){window.location.reload()} if(saved_update[0]>0&&window.location.href.indexOf('www.igxe.cn')>-1&&window.location.href.indexOf('product')==-1){window.location.reload()} if(saved_update[0]>0&&window.location.href.indexOf('www.c5game.com')>-1){window.location.reload()} GM_setValue("saved_tool",saved_update); }; $("#ideal")[0].onchange= function(){ if($("#ideal")[0].value==''||$("#ideal")[0].value<0.6||$("#ideal")[0].value>=1){alert('理想比例值为0.6~<1')} else{ saved_update[1]=$("#ideal")[0].value GM_setValue("saved_tool",saved_update); } }; $("#unideal")[0].onchange= function(){ if($("#unideal")[0].value==''||$("#unideal")[0].value<0.6||$("#unideal")[0].value>=1){alert('最高比例值为0.6~<1')} else{ saved_update[2]= $("#unideal")[0].value GM_setValue("saved_tool",saved_update); } }; } function choice(){ try{ var lsr=eval($(".lsr")[0].innerText), hbr=eval($(".hbr")[0].innerText), Value_1=eval(GM_getValue('saved_tool')[1]), Value_2=eval(GM_getValue('saved_tool')[2]); //lsr出售价比例 hbr收购价比例 console.log(GM_getValue('saved_tool')[1],GM_getValue('saved_tool')[2]); if(lsr>eval(1)||hbr>eval(1)){window.close()} if(lsr>Value_1){ if(hbr>Value_2){ window.close(); } }else{ if(hbr>Value_2){ window.close(); } } }catch(e){console.log(e)} } function web(){ if(window.location.href.indexOf('buff.163.com/market/?game=')>-1){ GM_setValue('website',['.market-card','f_Bold c_Gray','.lazy','20']) } if(window.location.href.split('/')[3]!=''&& window.location.href.indexOf('www.igxe.cn')>-1 && window.location.href.split('/')[3]!='product'){ GM_setValue('website',['.dataList','sum','.label','20']) } if(window.location.href.split('/')[3]!=''&& window.location.href.indexOf('www.c5game.com')>-1 ){ GM_setValue('website',['.list-item4','num','.market-state','28']) } } function filter(){ //过滤 return new Promise(resolve => { if($("#sale_count")[0].value==''){alert('最低在售值不能为空')} else{ console.log("666") var n=0, l=document.getElementsByClassName(GM_getValue('website')[1]), i=l.length-1; for(i;i>=0;i--){ if(eval(l[i].innerHTML.replace(/[^0-9]/g, '')) { if($(GM_getValue('website')[0]).width()>$(window).height()){ $(this).scrollTop($(GM_getValue('website')[0]).offset().top) }else{ $(this).scrollTop($(GM_getValue('website')[0]).offset().top+($(window).height()-$(GM_getValue('website')[0]).width())/2); } }); } }catch(e){console.log(e)} } function nextpage(){ try{ document.getElementsByClassName("page-link next")[0].click(); try{ setTimeout(filter,2000); }catch(e){console.log(e)} }catch(e){ try{ console.log(e) document.getElementsByClassName("next")[0].childNodes[0].click(); }catch(e){console.log(e) document.getElementsByClassName("next js-page")[0].click();} } } function prevpage(){ try{ document.getElementsByClassName("page-link prev")[0].click(); }catch(e){ try{ console.log(e) document.getElementsByClassName("previous")[0].childNodes[0].click(); }catch(e){console.log(e) document.getElementsByClassName("prev js-page")[0].click();} } } function allopen(){ try{ var i=0,l=$(GM_getValue('website')[2]) for(i;i