hwm_map_wars_stat

Статистика по боям за территорию: золото на каждого героя, победные и проигранные бои, % потери сектора и пр. (by Demin)

当前为 2014-09-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name hwm_map_wars_stat
  3. // @author Demin
  4. // @namespace Demin
  5. // @description Статистика по боям за территорию: золото на каждого героя, победные и проигранные бои, % потери сектора и пр. (by Demin)
  6. // @homepage https://greasyfork.org/users/1602-demin
  7. // @icon http://i.imgur.com/LZJFLgt.png
  8. // @version 2.6
  9. // @encoding utf-8
  10. // @include http://*heroeswm.ru/*
  11. // @include http://178.248.235.15/*
  12. // @include http://209.200.152.144/*
  13. // @include http://*lordswm.com/*
  14. // @grant GM_deleteValue
  15. // @grant GM_getValue
  16. // @grant GM_listValues
  17. // @grant GM_setValue
  18. // @grant GM_addStyle
  19. // @grant GM_log
  20. // @grant GM_openInTab
  21. // ==/UserScript==
  22.  
  23. // (c) 2013, demin ( http://www.heroeswm.ru/pl_info.php?id=15091 )
  24.  
  25. var version = '2.6';
  26.  
  27. var script_num = 124668;
  28. var script_name = 'HWM mod - Roulette delete by Demin';
  29. var string_upd = /124668=(\d+\.\d+)/;
  30.  
  31. var url_cur = location.href;
  32. var url = 'http://'+location.hostname+'/';
  33.  
  34. try {
  35.  
  36. if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported")>-1)) {
  37. this.GM_getValue=function (key,def) {
  38. return localStorage[key] || def;
  39. };
  40. this.GM_setValue=function (key,value) {
  41. return localStorage[key]=value;
  42. };
  43. this.GM_deleteValue=function (key) {
  44. return delete localStorage[key];
  45. };
  46. }
  47.  
  48. if ( (tag('body'))[0] ) {
  49.  
  50. var dfv = '<b>\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436</b>';
  51. var regexp_roul = / \u0438 <a href=.?roulette\.php.?>\u0440\u0443\u043B\u0435\u0442\u043A\u0430<\/a>/;
  52. var regexp_r = /<td bgcolor=.?#005C11.?>/;
  53. var regexp_r2 = /\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 \u0438\u0433\u0440\u044B/;
  54. var regexp_r3 = /\u0418\u0433\u0440\u0430: /;
  55. if (url.match('lordswm')) {
  56. dfv = '<b>Character</b>';
  57. regexp_roul = / and <a href=.?roulette\.php.?>roulette<\/a>/;
  58. regexp_r2 = /Last spins/;
  59. regexp_r3 = /Last spin time: /;
  60. }
  61.  
  62. // chat
  63. if ( location.pathname=='/chat_line.php' ) {
  64. var all_a = tag('option');
  65. var a_len = all_a.length;
  66. for (var i=a_len; i--;) {
  67. var a_i = all_a[i];
  68. if ( a_i.innerHTML.match(/\u0420\u0443\u043B\u0435\u0442\u043A\u0430/) || a_i.innerHTML.match(/Roulette/) ) {
  69. a_i.parentNode.removeChild(a_i);
  70. }
  71. }
  72. }
  73.  
  74. // menu
  75. var all_a = tag('li');
  76. var a_len = all_a.length;
  77. for (var i=a_len; i--;) {
  78. var a_i = all_a[i];
  79. if ( ( a_i.innerHTML.match(/frames\.php\?room=4/) && !a_i.innerHTML.match(/<b>/) ) || a_i.innerHTML.match(/inforoul\.php/) || a_i.innerHTML.match(/allroul\.php/) ) {
  80. a_i.parentNode.removeChild(a_i);
  81. }
  82. }
  83. var all_a = tag('a');
  84. var a_len = all_a.length;
  85. for (var i=a_len; i--;) {
  86. var a_i = all_a[i];
  87. if ( a_i.href.match(/roulette\.php/) && a_i.innerHTML.match(/<b>.+<\/b>/) ) {
  88. a_i.href = 'home.php';
  89. a_i.innerHTML = dfv;
  90. }
  91. }
  92.  
  93. // map
  94. var all_a = tag('center');
  95. var a_len = all_a.length;
  96. for (var i=a_len; i--;) {
  97. var a_i = all_a[i].innerHTML;
  98. if ( a_i.indexOf("<center")!=-1 ) {continue;}
  99. if ( a_i.match(regexp_roul) ) {
  100. a_i = a_i.replace(regexp_roul, '');
  101. break;
  102. }
  103. }
  104.  
  105. // roul
  106. if ( location.pathname=='/roulette.php' ) {
  107. var all_a = tag('table');
  108. var a_len = all_a.length;
  109. for (var i=a_len; i--;) {
  110. if ( regexp_r.exec(all_a[i].innerHTML) ) {
  111. if ( !regexp_r.exec(all_a[i+1].innerHTML) ) {
  112. all_a[i-1].style.display = 'none';
  113. break;
  114. }
  115. }
  116. }
  117. }
  118. if ( location.pathname=='/allroul.php' ) {
  119. var all_a = tag('table');
  120. var a_len = all_a.length;
  121. for (var i=a_len; i--;) {
  122. if ( regexp_r2.exec(all_a[i].innerHTML) ) {
  123. if ( !regexp_r2.exec(all_a[i+1].innerHTML) ) {
  124. all_a[i].style.display = 'none';
  125. break;
  126. }
  127. }
  128. }
  129. }
  130. if ( location.pathname=='/inforoul.php' ) {
  131. var all_a = tag('table');
  132. var a_len = all_a.length;
  133. for (var i=a_len; i--;) {
  134. if ( regexp_r3.exec(all_a[i].innerHTML) ) {
  135. if ( !regexp_r3.exec(all_a[i+1].innerHTML) ) {
  136. all_a[i].style.display = 'none';
  137. break;
  138. }
  139. }
  140. }
  141. }
  142.  
  143. }
  144.  
  145. } finally {
  146. if ( location.pathname=='/roulette.php' || location.pathname=='/inforoul.php' || location.pathname=='/allroul.php' || ( location.pathname=='/frames.php' && location.search && location.search.match(/room=4/) ) )
  147. {
  148. setTimeout(function() { window.location=url+'home.php'; }, 300);
  149. setTimeout(function() { window.location=url+'home.php'; }, 5000);
  150. }
  151.  
  152. update_n()
  153. }
  154.  
  155. function $( id ) { return document.getElementById( id ); }
  156.  
  157. function tag( id ) { return document.getElementsByTagName( id ); }
  158.  
  159. function addEvent(elem, evType, fn) {
  160. if (elem.addEventListener) {
  161. elem.addEventListener(evType, fn, false);
  162. }
  163. else if (elem.attachEvent) {
  164. elem.attachEvent("on" + evType, fn)
  165. }
  166. else {
  167. elem["on" + evType] = fn
  168. }
  169. }
  170.  
  171. function createXMLHttpReq(rndm)
  172. {
  173. var objXMLHttpReq;
  174. if (window.XMLHttpRequest)
  175. {
  176. // Real browsers ;)
  177. //
  178. objXMLHttpReq = new XMLHttpRequest();
  179. }
  180. else if (window.ActiveXObject)
  181. {
  182. // IE
  183. //
  184. objXMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
  185. }
  186. return objXMLHttpReq;
  187. }
  188.  
  189. function update_n() {
  190. if ( (parseInt(GM_getValue('last_update', '0')) + 86400000 <= (new Date().getTime())) || (parseInt(GM_getValue('last_update', '0')) > (new Date().getTime())) ) {
  191. var objXMLHttpReqUpd = createXMLHttpReq(Math.random()* 1000000);
  192. objXMLHttpReqUpd.open('GET', url + 'photo_pl_photos.php?aid=1777' + '&rand=' + (Math.random()* 1000000), true);
  193. objXMLHttpReqUpd.onreadystatechange = function() { update(objXMLHttpReqUpd); }
  194. objXMLHttpReqUpd.send(null);
  195. }
  196. }
  197. function update(obj) {
  198. if (obj.readyState == 4 && obj.status == 200) {
  199. var update_text1 = '\n\n\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u043E \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 Greasemonkey \u0441\u043A\u0440\u0438\u043F\u0442\u0430 "';
  200. var update_text2 = '".\n\u0425\u043E\u0442\u0438\u0442\u0435 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u043D\u0443\u044E \u0432\u0435\u0440\u0441\u0438\u044E?';
  201. var remote_version, rt;rt=obj.responseText;GM_setValue('last_update', ''+new Date().getTime());remote_version=string_upd.exec(rt)[1];if(version!=-1){if (remote_version > version) setTimeout(function() { if(confirm('There is an update available for the Greasemonkey script "'+script_name+'".\nWould you like to go to the install page now?'+update_text1+script_name+update_text2)){window.open('http://userscripts.org/scripts/show/'+script_num, '_blank')} }, 100) }}
  202. }