HWM arts hard

Текущая прочность

  1. // ==UserScript==
  2. // @name HWM arts hard
  3. // @description Текущая прочность
  4. // @namespace перф
  5. // @version 1.1
  6. // @encoding utf-8
  7. // @include http://www.heroeswm.ru/home.php
  8. // @include http://qrator.heroeswm.ru/home.php
  9. // @include http://178.248.235.15/home.php
  10. // @include http://209.200.152.144/home.php
  11. // @include http://173.231.37.114/home.php
  12. // @include http://www.lordswm.com/home.php
  13. // @include http://www.heroeswm.ru/pl_info.php?*
  14. // @include http://qrator.heroeswm.ru/pl_info.php?*
  15. // @include http://178.248.235.15/pl_info.php?*
  16. // @include http://209.200.152.144/pl_info.php?*
  17. // @include http://173.231.37.114/pl_info.php?*
  18. // @include http://www.lordswm.com/pl_info.php?*
  19. // @include http://www.heroeswm.ru/inventory.php
  20. // @include http://qrator.heroeswm.ru/inventory.php
  21. // @include http://178.248.235.15/inventory.php
  22. // @include http://209.200.152.144/inventory.php
  23. // @include http://173.231.37.114/inventory.php
  24. // @include http://www.lordswm.com/inventory.php
  25. // @include http://www.heroeswm.ru/inventory.php#
  26. // @include http://qrator.heroeswm.ru/inventory.php#
  27. // @include http://178.248.235.15/inventory.php#
  28. // @include http://209.200.152.144/inventory.php#
  29. // @include http://173.231.37.114/inventory.php#
  30. // @include http://www.lordswm.com/inventory.php#
  31. // @include http://www.heroeswm.ru/sklad_info.php?*
  32. // @include http://178.248.235.15/sklad_info.php?*
  33. // @include http://209.200.152.144/sklad_info.php?*
  34. // @include http://173.231.37.114/sklad_info.php?*
  35. // @include http://www.lordswm.com/sklad_info.php?*
  36.  
  37. // ==/UserScript==
  38.  
  39. /* История версий:
  40. [1.1] 29.09.2015 [+] добавляет ID артефакта в Инвентаре, если находит.
  41. */
  42.  
  43. var url = location.href ;
  44. var item_hard_regexp = /: (\d+)\/(\d+)/;
  45. var item_name_regexp = /uid=(\d+)/
  46. var text_new_begin = '<div style="font-size: 9px; padding: 1px; border-color: #eecd59; border-width: 0px; border-style: solid; margin-top: 2px; margin-left: 4px; background-color: #ffffff; position: absolute">';
  47. var text_new_begin5 = '<div style="color: #FF0033; font-size: 9px; padding: 1px; border-color: #eecd59; border-width: 0px; border-style: solid; margin-top: 2px; margin-left: 4px; background-color: #FFF; position: absolute">';
  48. //var text_new_begin5 = '<div style="font-size: 9px; padding: 1px; border-color: #eecd59; border-width: 0px; border-style: solid; margin-top: 2px; margin-left: 4px; background-color: #FF9080; position: absolute">';
  49. var text_new_end = '</div>';
  50.  
  51. if(url.indexOf('/pl_info.php') >= 0)
  52. HardBySlot();
  53.  
  54. if(url.indexOf('/home.php') >= 0)
  55. HardByInfo();
  56.  
  57. if(url.indexOf('/sklad_info.php') >= 0)
  58. HardByInfo();
  59.  
  60. if(url.indexOf('/inventory.php') >= 0) {
  61. if((typeof arts_c) != 'undefined') {
  62. // FF4+, Opera
  63. HardBySlot();
  64. HardByJS();
  65. }
  66. else {
  67. // FF3-, Chrome
  68. // HardByDocument();
  69. document.body.setAttribute('onload',
  70. ' function getI(xpath,elem){return document.evaluate(xpath,(!elem?document:elem),null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);}; '+
  71. ' var text_new_begin = \'<div style="font-size: 9px; padding: 1px; border-color: \#eecd59; border-width: 0px; border-style: solid; margin-top: 2px; margin-left: 4px; background-color: \#FFF; position: absolute">\'; '+
  72. ' var text_new_end = \'</div>\'; '+
  73. ' var item_hard_regexp = /: (\\d+)\\/(\\d+)/; '+
  74. ' var dreses = getI( "//div[contains(@id, \'slot\')]" ); '+
  75. ' for( var i = 0; i < dreses.snapshotLength; i++ ) { '+
  76. ' var dress = dreses.snapshotItem(i); '+
  77. ' var hard = item_hard_regexp.exec(dress.innerHTML); '+
  78. ' if(hard) '+
  79. ' dress.innerHTML = text_new_begin + String(hard[1]) + text_new_end + dress.innerHTML; '+
  80. ' } '+
  81. ' for(var i = 0; i < arts_c; i++) { '+
  82. ' if(arts_fd_none[i]) { '+
  83. ' hard = item_hard_regexp.exec(arts_fd_none[i]); '+
  84. ' if(hard){ '+
  85. ' if(arts_fud[i]) { '+
  86. ' arts_fud[i] = text_new_begin + String(hard[1]) + text_new_end + arts_fud[i]; '+
  87. ' } '+
  88. ' if(arts_fd_ok[i]) { '+
  89. ' arts_fd_ok[i] = text_new_begin + String(hard[1]) + text_new_end + arts_fd_ok[i]; '+
  90. ' } '+
  91. ' if(arts_fd_none[i]) { '+
  92. ' arts_fd_none[i] = text_new_begin + String(hard[1]) + text_new_end + arts_fd_none[i]; '+
  93. ' } '+
  94. ' } '+
  95. ' } '+
  96. ' } '+
  97. ' show_c(); '+
  98. ' ');
  99. }
  100. }
  101.  
  102. function HardBySlot() {
  103. var dreses = getI( "//div[contains(@id, 'slot')]" );
  104. for( var i = 0; i < dreses.snapshotLength; i++ ) {
  105. var dress = dreses.snapshotItem(i);
  106. hard = item_hard_regexp.exec(dress.innerHTML);
  107. if(hard)
  108. dress.innerHTML = hardHTML(hard[1]) + dress.innerHTML;
  109. }
  110. }
  111.  
  112. function HardByInfo() {
  113. var dreses = getI( "//a[contains(@href, 'art_info.php?id=')]" );
  114. var elo = '' ;
  115. for( var i = 0; i < dreses.snapshotLength; i++ ) {
  116. var dress = dreses.snapshotItem(i);
  117.  
  118. an = item_name_regexp.exec( dress.href ) ;
  119. if( an )
  120. {
  121. if( elo == an[1] )
  122. continue
  123. else
  124. elo = an[1]
  125. }
  126. hard = item_hard_regexp.exec(dress.parentNode.innerHTML);
  127. if(hard)
  128. dress.parentNode.innerHTML = hardHTML(hard[1]) + dress.parentNode.innerHTML;
  129. }
  130. }
  131.  
  132. function HardByJS() {
  133. for(var i = 0; i < arts_c; i++) {
  134. if(arts_fd_none[i]) {
  135. hard = item_hard_regexp.exec(arts_fd_none[i]);
  136. // alert (arts_id[i]);
  137. if(arts_id[i]) {arts1[i]= '<i style="font-size:10px">&nbsp;&nbsp;ID:'+ arts_id[i] + '</i>' + arts1[i]}
  138. if(hard){
  139. if(arts_fud[i]) {
  140. arts_fud[i] = hardHTML(hard[1]) + arts_fud[i];
  141. }
  142. if(arts_fd_ok[i]) {
  143. arts_fd_ok[i] = hardHTML(hard[1]) + arts_fd_ok[i];
  144. }
  145. if(arts_fd_none[i]) {
  146. arts_fd_none[i] = hardHTML(hard[1]) + arts_fd_none[i];
  147. }
  148. }
  149. }
  150. }
  151. show_c();
  152. }
  153.  
  154. function HardByDocument() {
  155. var text = String(document.documentElement.innerHTML);
  156. alert(text);
  157. var pos = 0;
  158. var pos_id = 0;
  159. var pos_begin = 0;
  160. var pos_end = 0;
  161. while(true) {
  162. pos_id = text.indexOf('/i/artifacts/', pos);
  163. if(pos_id < 0)
  164. break;
  165. if(text.charAt(pos_id - 1) == 'c') {
  166. /*<img border="0" title="............" src=""http://....*/
  167. pos_begin = text.lastIndexOf('<img', pos_id );
  168. pos_end = pos_id;
  169. }
  170. else {
  171. /*<table border="0" cellpadding="0" cellspacing="0" background=....*/
  172. pos_begin = text.lastIndexOf('<table', pos_id );
  173. pos_end = text.indexOf('</a>', pos_id );
  174. }
  175. hard = item_hard_regexp.exec(text.substring(pos_begin, pos_end));
  176. if(hard) {
  177. text = text.substring(0, pos_begin) + hardHTML(hard[1]) + text.substring(pos_begin);
  178. }
  179. pos = pos_end + text_new_begin.length + text_new_end.length + 5;
  180. }
  181. document.documentElement.innerHTML = text;
  182. }
  183.  
  184. function getI(xpath,elem){return document.evaluate(xpath,(!elem?document:elem),null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);}
  185.  
  186. function hardHTML(hard1){
  187. if ( hard1 > 5 ) { return text_new_begin + String(hard1) + text_new_end; } else { return text_new_begin5 + String(hard1) + text_new_end; }
  188. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址