Greasy Fork is available in English.
keylol论坛有卡游戏标记 嗨皮喜加一
当前为
// ==UserScript==
// @name keylol有卡游戏标记
// @namespace http://tampermonkey.net/
// @icon https://keylol.com/favicon.ico
// @version 0.1
// @description keylol论坛有卡游戏标记 嗨皮喜加一
// @author wsz987
// @match https://keylol.com/*
// @match https://www.keylol.com/*
// @require https://cdn.staticfile.org/jquery/1.12.4/jquery.min.js
// @supportURL https://keylol.com/suid-973554
// ==/UserScript==
(async function() { // 这里面含有"//"去掉 插件就只会在特定网址显示 但不会很全面因为我只匹配了一些
'use strict';
//let sale="typeid%3D47",exchange="typeid%3D49",bundle="26filter%3Dauthor%26orderby%3Ddateline";
//var herf=window.location.href;
var json=await start();
//if(herf.indexOf(sale)>-1||herf.indexOf(exchange)>-1||herf.indexOf(bundle)>-1){
search_card(json).then(pinkgun()).then(function(){
$('.steam-info-loaded').each(function(){
if($(this).context.style){}
});
});
//}
})();
function search_card(json){
return new Promise(resolve => {
$('.steam-info-link').each(function(){
var arr_href=$(this).context.pathname.split('/')
if(arr_href[1]=='bundle'||arr_href[1]=='sub'){
$(this).context.text=arr_href[1].toUpperCase()+"包 "+$(this).context.innerText;
console.log($(this).text());
}
if(json.hasOwnProperty(arr_href[2])==true){
$(this).context.className+=' own_trading_cards';
//$(this).context.text="有卡 "+$(this).context.innerText;
$(this).context.style.color="red"; //字体颜色更改
}
})
});
}
function start(){
return new Promise(resolve => {
var settings = {
"url": "https://bartervg.com/browse/cards/json/",
"method": "GET",
"timeout": 0,
"headers": {
"Cookie": "__cfduid=d9963484df5418914544663bb4c3e773c1587472310"
},
};
$.ajax(settings).done(function (response) {
resolve(response);
});
});
};
function pinkgun(){
if($('.own_trading_cards').length>0){
$('.plc div.authi>a[rel=nofollow]').eq(0).after(`<span class="pipe">|</span><a href="javascript:void(0);" id="pinkgun_btn">一键打包</a>`);
$("body").append("<div id='pinkgun_btn' style='cursor:pointer;z-index:998;position:fixed;text-align: center;left:10px;top:700px;'><img src='https://keylol.com/uc_server/data/avatar/000/06/59/64_avatar_small.jpg' height='55' ><br/>大佬专用<br/>一键打包<br/>有卡游戏</div>")
//上边这一条是左下角图片觉得烦可以在前面加"//"屏蔽 img里面的src可以自定义图片
$('#pinkgun_btn').each(()=>{
$(this).click(()=>{
add_game();
});
})
}
}
function add_game(){
var arr=[],str = $('textarea').val();
$('.own_trading_cards').each(function(){
if($(this).context.parentNode.style.backgroundColor!=="black"){
if($(this).context.parentNode.parentNode.parentNode.className!=="showhide"){
arr.push("[url="+$(this).context.href+"]"+$(this).text()+"[/url]");
console.log($(this).text());
}
}
});
$('textarea').val(str+arr.join('\n'));
}