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

  1. // ==UserScript==
  2. // @name ManageHoard
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description Adds buttons to select all but 1 for selling/converting and for selecting all Swipp/Baldwin items for sending to vault.
  6. // @author Fantazjor
  7. // @match http://flightrising.com/main.php?p=hoard*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. $( "#btn1" ).remove();
  15. $( "#btn2" ).remove();
  16.  
  17. 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;'";
  18. 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;'";
  19. var r1= $('<input id="btn1" '+rcss1+' type="button" value="All But 1"/>');
  20. var r2= $('<input id="btn2" '+rcss2+' type="button" value="All Special"/>');
  21. $("body").append(r1);
  22. $("body").append(r2);
  23.  
  24. $( '#btn1' ).click(function() {
  25. $( "span select" ).each(function( index ) {
  26. if ( $( this ).val() == "1" ) { } else {
  27. var v = $( this ).attr('name');
  28. var a = v.replace("v","a");
  29. var val = $( this ).val();
  30. var rel = $( this ).parent().find("a.clue").attr('rel');
  31. var img = $( this ).parent().find("img");
  32. var ibg = img.css( "background-color" );
  33.  
  34. var tab = "trinket";
  35. if (rel.search("food")>-1) { tab = "food"; }
  36. else if (rel.search("equipment")>-1) { tab = "equipment"; }
  37. else if (rel.search("familiar")>-1) { tab = "familiar"; }
  38. else if (rel.search("battle_items")>-1) { tab = "battle_items"; }
  39. else if (rel.search("skins")>-1) { tab = "skins"; }
  40. else { tab = "trinket"; }
  41.  
  42. var itm = parseInt(rel.replace("includes/itemajax.php?id=","").replace("&tab="+tab,""));
  43. var inp = $("[name='" + a + "']");
  44.  
  45. console.log( a + " " + itm + " " + val );
  46. if (ibg == "rgba(0, 0, 0, 0)") {
  47. if (itm > 4469 && itm < 4554) { } else {
  48. $( this ).val(val - 1);
  49. $( this ).css( "outline", "4px solid red" );
  50. inp[0].checked = true;
  51. }
  52. }
  53. }
  54. });
  55. console.log( "done" );
  56. //alert("done");
  57. });
  58.  
  59. $( "#btn2" ).click(function() {
  60. $( "select" ).each(function( index ) {
  61. var v = $( this ).attr('name');
  62. var a = v.replace("v","a");
  63. var img = $( this ).parent().find("img");
  64. var ibg = img.css( "background-color" );
  65. var inp = $("[name='" + a + "']");
  66. if (ibg != "rgba(0, 0, 0, 0)") {
  67. inp[0].checked = true;
  68. }
  69. });
  70. console.log( "done" );
  71. //alert("done");
  72. });
  73.  
  74. //keyboard shortcuts
  75. $("html").keyup(function(event){
  76. if(event.keyCode == 37){
  77. $("#invent div:first a:first").click();//left arrow inv page
  78. }else if(event.keyCode == 39){
  79. $("#invent div:first a:last").click();//right arrow inv page
  80. }else if(event.keyCode == 13){
  81. $("#yes").click();//yes with enter
  82. }else if(event.keyCode == 9){
  83. $find(".ui-dialog-content #no").click();//no with tab
  84. $find(".ui-dialog-content #ret").click();//return with tab
  85. }
  86. });
  87. })();