HWM - Resourses as images Style Mod

Заменяет текстовое описание ресурсов на изображения

  1. // ==UserScript==
  2. // @name HWM - Resourses as images Style Mod
  3. // @namespace Resourses as images
  4. // @author code: Dinozon2, ElMarado; style: sw.East
  5. // @collaborator sw.East
  6. // @version 0.21.4
  7. // @description Заменяет текстовое описание ресурсов на изображения
  8. // @icon http://i.imgur.com/GScgZzY.jpg
  9. // @include https://www.heroeswm.*/pl_info.php*
  10. // @include *//178.248.235.15/pl_info.php*
  11. // @include *//*.lordswm.*/pl_info.php*
  12. // @grant GM_addStyle
  13. // @copyright 2013-2018, sw.East (https://www.heroeswm.ru/pl_info.php?id=3541252)
  14. // @license MIT
  15. // ==/UserScript==
  16.  
  17.  
  18. // 0.21.2-0.21.4 - Отображение картинок и ссылок на рынок для частей имперских артов
  19. // 0.21.1 - fix. Отображение картинок для частей имперских артов
  20.  
  21. /** === Style === */
  22. GM_addStyle ( `
  23.  
  24. #box{
  25. width: 93%;
  26. height: 100%;
  27. margin: 0 5px 0 10px;
  28. }
  29. #amount_slot{
  30. overflow: hidden;
  31. float: right;
  32. width: 48px;
  33. height: 48px;
  34. margin: 5px 5px 5px 0;
  35. padding: 0;
  36. border: 3px solid #fff;
  37. box-shadow: 0px 0px 5px #aaa;
  38. z-index: 1;
  39. }
  40. #amount_slot img {
  41. display: block;
  42. width: 42px;
  43. height: 42px;
  44. margin: 3px 0 0 3px;
  45. padding: 0;
  46. }
  47. #amount_slot a img {
  48. -webkit-transition: all 0.2s linear;
  49. -moz-transition: all 0.2s linear;
  50. -ms-transition: all 0.2s linear;
  51. -o-transition: all 0.2s linear;
  52. transition: all 0.2s linear;
  53. }
  54. #amount_slot:hover a img {
  55. -webkit-transform: scale(1.20,1.20);
  56. -moz-transform: scale(1.20,1.20);
  57. -ms-transform: scale(1.20,1.205);
  58. -o-transform: scale(1.20,1.20);
  59. transform: scale(1.20,1.20);
  60. opacity:1;
  61. }
  62. #amount_slot a{
  63. text-decoration: none;
  64. }
  65. .amount_wrap {
  66. position: absolute;
  67. min-width:14px;
  68. height: 13px;
  69. margin: -48px 0 0 -3px;
  70. padding:0 1px 1px;
  71. color:#fff;
  72. border:2px solid #fff;
  73. background:#222;
  74. -webkit-box-shadow: 1px 1px 1px #aaa;
  75. -moz-box-shadow: 1px 1px 1px #aaa;
  76. box-shadow: 1px 1px 1px #aaa;
  77. z-index: 15;
  78. font-size: 10px;
  79. text-align: center;
  80. text-decoration: none !important;
  81. text-shadow: 1px 1px 1px rgba(0,0,0, 0.8);
  82. cursor: pointer;
  83. opacity:.7;
  84. -webkit-transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;
  85. -moz-transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;
  86. -ms-transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;
  87. -o-transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;
  88. transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;
  89. }
  90.  
  91. ` );
  92. /* Style End */
  93.  
  94.  
  95. var HTMLOut='<div id="box">';
  96.  
  97. var ElementsArray = [];
  98. ElementsArray['Кожа']= 'https://i.imgur.com/Xn82L25.png';
  99. ElementsArray['Сталь']= 'https://i.imgur.com/hwThTJE.png';
  100. ElementsArray['Никель']= 'https://i.imgur.com/6lHniay.png';
  101. ElementsArray['Волшебный порошок']= 'https://i.imgur.com/IuqF7rI.png';
  102. ElementsArray['Мифриловая руда']= 'https://i.imgur.com/dv6rzKn.png';
  103. ElementsArray['Обсидиан']= 'https://i.imgur.com/4yOWbK8.png';
  104. ElementsArray['Мифрил']= 'https://i.imgur.com/1Y1Z7Mq.png';
  105. ElementsArray['Орихалк']= 'https://i.imgur.com/qRGZzCs.png';
  106. ElementsArray['осколок метеорита']= 'meteorit';
  107. ElementsArray['абразив']= 'abrasive';
  108. ElementsArray['змеиный яд']= 'snake_poison';
  109. ElementsArray['клык тигра']= 'tiger_tusk';
  110. ElementsArray['ледяной кристалл']= 'ice_crystal';
  111. ElementsArray['лунный камень']= 'moon_stone';
  112. ElementsArray['огненный кристалл']= 'fire_crystal';
  113. ElementsArray['цветок ведьм']= 'witch_flower';
  114. ElementsArray['цветок ветров']= 'wind_flower';
  115. ElementsArray['цветок папоротника']= 'fern_flower';
  116. ElementsArray['ядовитый гриб']= 'badgrib';
  117. ElementsArray['Имперский арбалет']= 'part_imp_crossbow';
  118. ElementsArray['Имперские сапоги']= 'part_imp_boots';
  119. ElementsArray['Имперский щит']= 'part_imp_shield';
  120. ElementsArray['Имперский шлем']= 'part_imp_helmet';
  121. ElementsArray['Имперский амулет']= 'part_imp_amul';
  122. ElementsArray['Имперский доспех']= 'part_imp_armor';
  123. ElementsArray['Имперский меч']= 'part_imp_sword';
  124. ElementsArray['Части редкого отряда']= 'https://dcdn.heroeswm.ru/i/army_html/q_sign.png';
  125. ElementsArray['Части очень редкого отряда']= 'https://dcdn.heroeswm.ru/i/army_html/q_sign.png';
  126.  
  127. var a = document.body.getElementsByClassName("wb");
  128.  
  129. for (var i = 0, length = a.length; i < length; i++) {
  130. if (i in a) {
  131. // Находим блок с элементами
  132. if (a[i].innerHTML.indexOf('&nbsp;&nbsp;&nbsp;&nbsp;<b>') + 1){
  133. // создаем массив из строк:
  134. var text=a[i].innerHTML;
  135. console.log(a[i]);
  136. var arr = text.split('<br>');
  137. // очищаем строку от мусора
  138. for (var k=0,len=arr.length;k<len;k++) {
  139. if (k==Math.round((len-1)/2)) {HTMLOut = HTMLOut+'<div id="top">';}
  140. var line=arr[k];
  141.  
  142. line=line.replace('&nbsp;&nbsp;&nbsp;&nbsp;', '');
  143. line=line.replace('<b>', '');
  144. line=line.replace('</b>', '');
  145. var res = line.split(':');
  146.  
  147. // res[0] - название элемента
  148. // res[1] - количество
  149.  
  150. if (res[1]>0) {
  151.  
  152. // фикс ширины
  153. if (res[1]>9999) var w_length = 39;
  154. else if (res[1]>999) var w_length = 31;
  155. else if (res[1]>99) var w_length = 24;
  156. else var w_length = 13;
  157.  
  158. if (res[0].indexOf('\u0418\u043c\u043f\u0435\u0440') !=-1) { //обработка имперских артов }
  159. if(ElementsArray[res[0]].length<25){
  160.  
  161. HTMLOut = HTMLOut + '<div id="amount_slot">'+
  162. '<a href="/auction.php?cat=part&sort=0&art_type='+ElementsArray[res[0]]+'"> '+
  163. '<img src="/i/artifacts/parts/'+ElementsArray[res[0]]+'.png" alt="'+line+'" title="'+line+'">'+
  164. '</a>'+
  165. '<div class="amount_wrap" style="width:'+w_length+'px">'+res[1]+'</div>'+
  166. '</div>';
  167. } else {
  168. HTMLOut = HTMLOut + '<div id="amount_slot">'+
  169. '<a href="#"> '+
  170. '<img src="'+ElementsArray[res[0]]+'" alt="'+line+'" title="'+line+'">'+
  171. '</a>'+
  172. '<div class="amount_wrap" style="width:'+w_length+'px">'+res[1]+'</div>'+
  173. '</div>';
  174. }
  175. } else {
  176. if(ElementsArray[res[0]].length>25){
  177. HTMLOut = HTMLOut + '<div id="amount_slot">'+
  178. '<a href="#"> '+
  179. '<img src="'+ElementsArray[res[0]]+'" alt="'+line+'" title="'+line+'">'+
  180. '</a>'+
  181. '<div class="amount_wrap" style="width:'+w_length+'px">'+res[1]+'</div>'+
  182. '</div>';
  183. } else {
  184. HTMLOut = HTMLOut + '<div id="amount_slot">'+
  185. '<a href="/auction.php?cat=elements&sort=0&art_type='+ElementsArray[res[0]]+'"> '+
  186. '<img src="/i/'+ElementsArray[res[0]]+'.gif" alt="'+line+'" title="'+line+'"> '+
  187. '</a>'+
  188. '<div class="amount_wrap" style="width:'+w_length+'px">'+res[1]+'</div>'+
  189. '</div>';
  190. }
  191. }
  192. }
  193. }
  194.  
  195. HTMLOut = HTMLOut+'</div>';
  196. // Выводим на страницу
  197. a[i].innerHTML = HTMLOut;
  198. }
  199. }
  200. }

QingJ © 2025

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