Greasy Fork

来自缓存

Greasy Fork is available in English.

keylol有卡游戏标记

keylol论坛有卡游戏标记 嗨皮喜加一

当前为 2020-04-23 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         keylol有卡游戏标记
// @namespace    http://tampermonkey.net/
// @icon      	 https://keylol.com/favicon.ico
// @version      0.14
// @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;
                $(this).context.style.color="pink";
                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">一键打包</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').click(()=>add_game())
        $('#pinkgun_btn_a').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"&&$(this).context.parentNode.parentNode.className!=="showhide"&&$(this).context.parentNode.className!=="showhide"){
                arr.push("[url="+$(this).context.href+"]"+$(this).text()+"[/url]");
                console.log($(this).text());
            }
        }
    });
    $('textarea').val(str+arr.join('\n'));
}