Greasy Fork is available in English.
keylol论坛有卡游戏标记 嗨皮喜加一
当前为
// ==UserScript==
// @name keylol有卡游戏标记
// @namespace http://tampermonkey.net/
// @icon https://keylol.com/favicon.ico
// @version 0.16
// @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';
var json=await start();
search_card(json).then(add_Btn());
})();
function search_card(json){
var font_Color_Card = "deeppink", //有卡字体颜色
font_Color_BS="darkorange", //包类型字体颜色
font_Weight = "bolder"; //字体加粗
//颜色自定义可以参考这位老哥 https://keylol.com/t587368-1-1
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].charAt(0).toUpperCase() + arr_href[1].slice(1)+"]: "+$(this).context.innerText;
$(this).context.style.color=font_Color_BS;
console.log($(this).text());
}
if(json.hasOwnProperty(arr_href[2])==true){
$(this).context.className+=' own_trading_cards';
$(this).context.text="[Card]: "+$(this).context.innerText; /*按需求添加/删除"//"是否显示有卡标签*/
$(this).context.style.color=font_Color_Card;
$(this).context.style.fontWeight = font_Weight;
}
})
});
}
function start(){
return new Promise(resolve => {
var settings = {
"url": "https://bartervg.com/browse/cards/json/",
"method": "GET",
"timeout": 0,
};
$.ajax(settings).done(function (response) {
resolve(response);
});
});
};
function add_Btn(){
if($('.own_trading_cards').length>0){
tab_Btn_a(); //这个不影响浏览
pinkgun(); /*如果左下角粉枪影响观看 加"//"/删除*/
}
}
function tab_Btn_a(){
$('.plc div.authi>a[rel=nofollow]').eq(0).after(`<span class="pipe">|</span><a href="javascript:void(0);" id="tab_Btn_a">一键打包</a>`);
$('#tab_Btn_a').click(()=>add_game())
}
function pinkgun(){
$("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可以自定义图片
document.querySelector("#pinkgun_btn").style.top=window.innerHeight-'64'+'px';
$('#pinkgun_btn').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).parents('div.showhide').length>0){
arr.push("[url="+$(this).context.href+"]"+$(this).text().slice(7)+"[/url]");
console.log($(this).text());
}
}
});
$('textarea').val(str+arr.join('\n'));
}