ManageHoard

Adds buttons to select all but 1 for selling/converting and for selecting all Swipp/Baldwin items for sending to vault.

当前为 2016-05-28 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         ManageHoard
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Adds buttons to select all but 1 for selling/converting and for selecting all Swipp/Baldwin items for sending to vault.
// @author       Fantazjor
// @match        http://flightrising.com/main.php?p=hoard*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    $( "#btn1" ).remove();
    $( "#btn2" ).remove();

    var rcss1="style='position:fixed;display:block;top:0;z-index:9999;background:rgba(3,169,244,0.8);width:100px;height:40px;left:0;'";
    var rcss2="style='position:fixed;display:block;top:0;z-index:9999;background:rgba(3,169,244,0.8);width:100px;height:40px;left:110px;'";
    var r1= $('<input id="btn1" '+rcss1+' type="button" value="All But 1"/>');
    var r2= $('<input id="btn2" '+rcss2+' type="button" value="All Special"/>');
    $("body").append(r1);
    $("body").append(r2);

    $( '#btn1' ).click(function() {
        $( "span select" ).each(function( index ) {
            if ( $( this ).val() == "1" ) { } else {
                var v = $( this ).attr('name');
                var a = v.replace("v","a");
                var val = $( this ).val();
                var rel = $( this ).parent().find("a.clue").attr('rel');
                var img = $( this ).parent().find("img");
                var ibg = img.css( "background-color" );

                var tab = "trinket";
                if (rel.search("food")>-1) {	tab = "food"; }
                else if (rel.search("equipment")>-1) { tab = "equipment"; }
                else if (rel.search("familiar")>-1) { tab = "familiar"; }
                else if (rel.search("battle_items")>-1) { tab = "battle_items"; }
                else if (rel.search("skins")>-1) { tab = "skins"; }
                else { tab = "trinket"; }

                var itm = parseInt(rel.replace("includes/itemajax.php?id=","").replace("&tab="+tab,""));
                var inp = $("[name='" + a + "']");

                console.log( a + " " + itm + " " + val );
                if (ibg == "rgba(0, 0, 0, 0)") {
                    if (itm > 4469 && itm < 4554) { } else {
                        $( this ).val(val - 1);
                        $( this ).css( "outline", "4px solid red" );
                        inp[0].checked = true;
                    }
                }
            }
        });
        console.log( "done" );
        //alert("done");
    });

    $( "#btn2" ).click(function() {
        $( "select" ).each(function( index ) {
            var v = $( this ).attr('name');
            var a = v.replace("v","a");
            var img = $( this ).parent().find("img");
            var ibg = img.css( "background-color" );
            var inp = $("[name='" + a + "']");
            if (ibg != "rgba(0, 0, 0, 0)") {
                inp[0].checked = true;
            }
        });
        console.log( "done" );
        //alert("done");
    });

    //keyboard shortcuts
    $("html").keyup(function(event){
        if(event.keyCode == 37){
            $("#invent div:first a:first").click();//left arrow inv page
        }else if(event.keyCode == 39){
            $("#invent div:first a:last").click();//right arrow inv page
        }else if(event.keyCode == 13){
            $("#yes").click();//yes with enter
        }else if(event.keyCode == 9){
            $find(".ui-dialog-content #no").click();//no with tab
            $find(".ui-dialog-content #ret").click();//return with tab
        }
    });
})();