hwm_roulette_delete

HWM mod - Roulette delete by Demin

当前为 2014-08-16 提交的版本,查看 最新版本

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