// ==UserScript==
// @name 饰品筛选倒余额 比例自定义 支持buff c5game igxe
// @namespace http://tampermonkey.net/
// @icon https://store.steampowered.com/favicon.ico
// @version 0.21
// @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
// @require https://cdn.staticfile.org/vue/2.4.2/vue.min.js
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_openInTab
// @grant GM_addStyle
// @supportURL https://keylol.com/t577669-1-1
// @downloadURL none
// ==/UserScript==
/*A 上一页
S 居中且过滤
D 下一页
W 居中
E 过滤后全部打开*/
(function() {
'use strict';
const tool_default = ['300','0.7','0.75','3','2']//自定义默认配置
web();
middle()
try{
document.onkeydown=function(event){
var e = event || window.event || arguments.callee.caller.arguments[0];
if(e && e.keyCode==83){
middle().then(v.filter())
}
if(e && e.keyCode==68){
v.nextpage();
}
if(e && e.keyCode==65){
v.prevpage();
}
if(e && e.keyCode==87){
middle();
}
if(e && e.keyCode==69){
v.filter().then(v.allopen());
}
}
}catch(e){console.log(e)}
//var tool ="
"
$("body").append(`
`);
if(GM_getValue("saved")==null)
GM_setValue("saved", tool_default)
console.log(`配置[${GM_getValue('saved')}]`)
var saved_update = GM_getValue("saved")
var v=new Vue({
el: '#tools',
data:{
count:GM_getValue("saved")[0],
idea:GM_getValue("saved")[1],
unidea:GM_getValue("saved")[2],
timeout:GM_getValue("saved")[3],
fortimeout:GM_getValue("saved")[4]
},
mounted() {
if(location.href.includes('buff.163.com/market/goods?goods_id=')||location.href.includes('www.igxe.cn/product')||location.href.includes('c5game.com/dota/')||location.href.includes('c5game.com/csgo/item')){
console.log(`${this.timeout}s后开始筛选 ${this.fortimeout}次校验`)
setTimeout(()=>{
if(this.choice()){
for (var i = 0; i < this.fortimeout; i++) {
(i=> {
setTimeout(()=>{
this.choice()
}, 500 * i);
})(i);
}
}
},this.timeout*1000);
}
},
methods:{
prevpage(){
try{
$(".page-link.prev")[0].click();
}catch(e){
try{
console.log(e)
$(".previous")[0].childNodes[0].click();
}catch(e){console.log(e)
$(".prev.js-page")[0].click();}
}
},
nextpage(){
try{
$(".page-link.next")[0].click()
try{
setTimeout(this.filter,2000);
}catch(e){console.log(e)}
}catch(e){
try{
console.log(e)
$(".next")[0].childNodes[0].click();
}catch(e){
console.log(e)
$(".next.js-page")[0].click();
}
}
},
tools_reset(){
console.log('数据重置')
GM_setValue("saved", null)
window.location.reload()
},
choice(){
try{
var lsr=eval($(".lsr")[0].innerText),
hbr=eval($(".hbr")[0].innerText),
Value_1=eval(this.idea),
Value_2=eval(this.unidea); //lsr出售价比例 hbr收购价比例
console.log(GM_getValue('saved')[1],GM_getValue('saved')[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)
return true
}
},
filter(){
return new Promise(resolve => {
let n=0
Array.from($(website[1])).filter(x=>{
if(eval(x.innerHTML.replace(/[^0-9]/g, ''))>parseInt(this.count))
return
++n;
x.parentNode.parentNode.remove();
})
if(eval(n)==eval(website[3])){
this.nextpage();
}
});
},
allopen(){
let i=0,l=$(website[2])
for(i;i {
try{
if(!location.href.includes('buff.163.com/market/goods?goods_id=')||!location.href.includes('product')||!location.href.includes('www.c5game.com/dota/')){
if($(website[0]).width()>$(window).height()){
$(this).scrollTop($(website[0]).offset().top)
}else{
$(this).scrollTop($(website[0]).offset().top+($(window).height()-$(website[0]).width())/2);
}
}
}catch(e){console.log(e)}
});
}
GM_addStyle(`
.card {
position: relative;
display: flex;
flex-direction: column;
min-width: 0;
word-wrap: break-word;
background-color: #fff;
background-clip: border-box;
border: 1px solid rgba(0, 0, 0, 0.125);
border-radius: 0.25rem;
}
.card-header {
padding: 0.75rem 1.25rem;
margin-bottom: 0;
background-color: rgba(0, 0, 0, 0.03);
border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}
.card-body {
flex: 1 1 auto;
text-align: center;
padding: 0.5rem 1rem 0rem;
}
.card-footer {
padding: 0.75rem 1.25rem;
background-color: rgba(0, 0, 0, 0.03);
border-top: 1px solid rgba(0, 0, 0, 0.125);
}
.btn {
display: inline-block;
font-weight: 400;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
border: 1px solid transparent;
padding: 0.375rem 0.75rem;
font-size: 1rem;
line-height: 1.5;
border-radius: 0.25rem;
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.btn-group{
position: relative;
display: -ms-inline-flexbox;
display: inline-flex;
vertical-align: middle;
}
.badge {
display: inline-block;
padding: 0.25em 0.4em;
font-size: 75%;
font-weight: 700;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: 0.25rem;
}
.badge-secondary {
color: #fff !important;
background-color: #6c757d;
}
label {
color:rgb(0, 0, 0);
display: inline-block;
margin-bottom: 0.5rem;
}
*, *::before, *::after {
box-sizing: border-box;
}
input {
padding: 1px 0px;
border-width: 2px;
border-style: inset;
border-color: initial;
border-image: initial;
font: 400 13.3333px Arial;
margin: 0;
font-family: inherit;
overflow: visible;
font-size: inherit;
line-height: inherit;
overflow: visible;
}
a{
text-decoration: none;
}
`)