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 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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
        }
    });
})();