hwm_adv_fast_map

HWM mod - Rasshirennoe vypadajushhee menju (by Demin)

  1. // ==UserScript==
  2. // @name hwm_adv_fast_map
  3. // @namespace Demin (remastered by Prince_of Dark)
  4. // @description HWM mod - Rasshirennoe vypadajushhee menju (by Demin)
  5. // @homepage http://userscripts.org/scripts/show/172172
  6. // @version 1.2.2
  7. // @include http://*heroeswm.ru/*
  8. // @include http://178.248.235.15/*
  9. // @include http://209.200.152.144/*
  10. // @include http://*lordswm.com/*
  11. // @exclude */rightcol.php*
  12. // @exclude */ch_box.php*
  13. // @exclude */chat*
  14. // @exclude */ticker.html*
  15. // @exclude */frames*
  16. // @exclude */brd.php*
  17. // ==/UserScript==
  18.  
  19. // (c) 2013, demin ( http://www.heroeswm.ru/pl_info.php?id=15091 )
  20. // (c) 2008, LazyGreg
  21.  
  22. (function() {
  23.  
  24. var version = '1.2';
  25.  
  26.  
  27. if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported")>-1)) {
  28. this.GM_getValue=function (key,def) {
  29. return localStorage[key] || def;
  30. };
  31. this.GM_setValue=function (key,value) {
  32. return localStorage[key]=value;
  33. };
  34. this.GM_deleteValue=function (key) {
  35. return delete localStorage[key];
  36. };
  37. }
  38.  
  39.  
  40. var script_num = 172172;
  41. var script_name = "HWM mod - Rasshirennoe vypadajushhee menju (by Demin)";
  42. update_n(version,script_num,script_name);
  43.  
  44.  
  45. var pers_id = document.querySelector("li * a[href^='pl_hunter_stat.php?id=']");
  46. if ( pers_id ) {
  47. pers_id = /id=(\d+)/.exec( pers_id )[1];
  48.  
  49.  
  50. // ============== PERSONAL LINKS (replaces Chat menu) ================
  51.  
  52. var replace_chat = false;
  53. //replace_chat = true; // uncomment this line to have chat replaced
  54.  
  55. var map_change = document.querySelector("li * a[href='map.php']")
  56. //if ( map_change ) { setTimeout(function() { map_change.href = 'map.php?st=sh'; }, 500) } // uncomment this line to have map link replaced
  57.  
  58. var my_links = []; // REPLACE CHAT MENU
  59. // Insert ANY number of your links below
  60. // better to write them in english or in "translit"
  61. // russian letters must be converted to unicode codes. Here's an utility:
  62. // http://static.bobrdobr.ru/store/spuntik/cache/1785ad2ca55f214df4bb297318b250bd.html
  63.  
  64. my_links.push('<a href="pl_info.php?id=15091">Link_1</a>');
  65. my_links.push('<a href="pl_info.php?id=15091">Link_2</a>');
  66. my_links.push('<a href="pl_info.php?id=15091">Link_3</a>');
  67. // etc.
  68.  
  69. // ===================================================================
  70. var Empire_cap = 'Empire Capital';
  71. var river = 'East River';
  72. var lake = 'Tiger`s Lake';
  73. var wood = 'Rogue`s Wood';
  74. var dale = 'Wolf`s Dale';
  75. var camp = 'Peasful Camp';
  76. var lowlands = 'Lizard`s Lowland';
  77. var green = 'Green Wood';
  78. var nest = 'Eagle`s Nest';
  79. var portal = 'Portal`s Ruins';
  80. var caves = 'Dragon`s Caves';
  81. var spring = 'Shining Spring';
  82. var city = 'Sunny City';
  83. var mines = 'Magma Mines';
  84. var mountain = 'Bear Mountain';
  85. var trees = 'Fairy Trees';
  86. var port = 'Port City';
  87. var coast = 'Mythril Coast';
  88. var wall = 'Great Wall';
  89. var valley = 'Titan`s Valley';
  90. var village = 'Fishing Village';
  91. var castle = 'Kingdom Castle';
  92. var steppe = 'Ungovernable Steppe';
  93. var arbor = 'Sublime Arbor';
  94. var garden = 'Crystal Garden';
  95. var wilderness = 'The Wilderness';
  96. var island = 'East Island';
  97.  
  98. // =================== USER VARIABLES ================================
  99. var map_last = [];
  100. map_last.push('<hr>');
  101. map_last.push('<a href="move_sector.php?id=1">' + Empire_cap + '</a>');
  102. map_last.push('<a href="move_sector.php?id=2">' + river + '</a>');
  103. map_last.push('<a href="move_sector.php?id=3">' + lake + '</a>');
  104. map_last.push('<a href="move_sector.php?id=4">' + wood + '</a>');
  105. map_last.push('<a href="move_sector.php?id=5">' + dale + '</a>');
  106. map_last.push('<a href="move_sector.php?id=6">' + camp + '</a>');
  107. map_last.push('<a href="move_sector.php?id=7">' + lowlands + '</a>');
  108. map_last.push('<a href="move_sector.php?id=8">' + green + '</a>');
  109. map_last.push('<a href="move_sector.php?id=9">' + nest + '</a>');
  110. map_last.push('<a href="move_sector.php?id=10">' + portal + '</a>');
  111. map_last.push('<a href="move_sector.php?id=11">' + caves + '</a>');
  112. map_last.push('<a href="move_sector.php?id=12">' + spring + '</a>');
  113. map_last.push('<a href="move_sector.php?id=13">' + city + '</a>');
  114. map_last.push('<a href="move_sector.php?id=14">' + mines + '</a>');
  115. map_last.push('<a href="move_sector.php?id=15">' + mountain + '</a>');
  116. map_last.push('<a href="move_sector.php?id=16">' + trees + '</a>');
  117. map_last.push('<a href="move_sector.php?id=17">' + port + '</a>');
  118. map_last.push('<a href="move_sector.php?id=18">' + coast + '</a>');
  119. map_last.push('<a href="move_sector.php?id=19">' + wall + '</a>');
  120. map_last.push('<a href="move_sector.php?id=20">' + valley + '</a>');
  121. map_last.push('<a href="move_sector.php?id=21">' + village + '</a>');
  122. map_last.push('<a href="move_sector.php?id=22">' + castle + '</a>');
  123. map_last.push('<a href="move_sector.php?id=23">' + steppe + '</a>');
  124. map_last.push('<a href="move_sector.php?id=24">' + garden + '</a>');
  125. map_last.push('<a href="move_sector.php?id=26">' + wilderness + '</a>');
  126. map_last.push('<a href="move_sector.php?id=27">' + arbor + '</a>');
  127. map_last.push('<a href="forum_thread.php?id=25">' + island + '</a>');
  128.  
  129. //map_last.push('<a href="house_info.php?id=222">\u0414\u043E\u043C</a>');
  130.  
  131. // ===================================================================
  132.  
  133.  
  134. var all_li_subnav, elm, par, next_elm, timer;
  135.  
  136. // pers - market
  137. all_li_subnav = document.querySelector("li * a[href='auction.php']");
  138. if ( all_li_subnav ) {
  139.  
  140. addEvent( all_li_subnav, "mouseover", function() { if ( timer != false ) timer = setTimeout(function() {
  141. timer = false;
  142. all_li_subnav = document.querySelector("li * a[href='auction.php']");
  143. par = all_li_subnav.parentNode;
  144. next_elm = all_li_subnav.nextSibling;
  145.  
  146. for ( var i=0; i<pers_market.length; i++ ) {
  147. elm = document.createElement('li');
  148. elm.innerHTML = pers_market[i];
  149. par.insertBefore(elm, next_elm);
  150. }
  151. }, 500) } );
  152.  
  153. addEvent( all_li_subnav, "mouseout", function() { if ( timer ) clearTimeout(timer); } );
  154.  
  155. }
  156.  
  157. // map - last
  158. all_li_subnav = document.querySelector("li * a[href^='map.php?'][href*='st=hs']");
  159. if ( all_li_subnav ) {
  160. par = all_li_subnav.parentNode;
  161. next_elm = all_li_subnav.nextSibling;
  162.  
  163. for ( var i=0; i<map_last.length; i++ ) {
  164. elm = document.createElement('li');
  165. elm.innerHTML = map_last[i];
  166. par.insertBefore(elm, next_elm);
  167. }
  168. }
  169.  
  170.  
  171.  
  172. // replaceChatMenu - my_links
  173. if ( replace_chat && my_links.length>0 ) {
  174.  
  175. all_li_subnav = document.querySelector("li * a[href='frames.php']");
  176. if ( all_li_subnav ) {
  177. all_li_subnav.parentNode.innerHTML = '<font color="f5c137">&nbsp;<b>Links</b>&nbsp;</font>';
  178.  
  179. all_li_subnav = document.querySelectorAll("li * a[href^='frames.php']");
  180. for ( var i=1; i<all_li_subnav.length; i++ ) {
  181. par = all_li_subnav[i].parentNode;
  182. par.parentNode.removeChild(par);
  183. }
  184.  
  185. var remove_par = all_li_subnav[0].parentNode;
  186.  
  187. par = remove_par.parentNode;
  188. next_elm = remove_par.nextSibling;
  189.  
  190. for ( var i=0; i<my_links.length; i++ ) {
  191. elm = document.createElement('li');
  192. elm.innerHTML = my_links[i];
  193. par.insertBefore(elm, next_elm);
  194. }
  195.  
  196. remove_par.parentNode.removeChild(remove_par);
  197. }
  198. }
  199.  
  200.  
  201. }
  202.  
  203.  
  204. function $(id) { return document.querySelector("#"+id); }
  205.  
  206. function addEvent(elem, evType, fn) {
  207. if (elem.addEventListener) {
  208. elem.addEventListener(evType, fn, false);
  209. }
  210. else if (elem.attachEvent) {
  211. elem.attachEvent("on" + evType, fn);
  212. }
  213. else {
  214. elem["on" + evType] = fn;
  215. }
  216. }
  217.  
  218. function update_n(a,b,c,d,e){if(e){e++}else{e=1;d=(Number(GM_getValue('last_update_script','0'))||0)}if(e>3){return}var f=new Date().getTime();var g=$('update_demin_script');if(g){if((d+86400000<f)||(d>f)){g=g.innerHTML;if(/100000=1.1/.exec(g)){var h=new RegExp(b+'=(\\d+\\.\\d+)').exec(g);if(a&&h){if(Number(h[1])>Number(a))setTimeout(function(){if(confirm('\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u043E \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0435 \u0441\u043A\u0440\u0438\u043F\u0442\u0430: "'+c+'".\n\u0423\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 \u0441\u0435\u0439\u0447\u0430\u0441?\n\nThere is an update available for the script: "'+c+'".\nWould you like install the script now?')){window.open('http://userscripts.org/scripts/show/'+b,'_blank');window.location='http://userscripts.org/scripts/source/'+b+'.user.js'}},500)}GM_setValue('last_update_script',''+f)}else{setTimeout(function(){update_n(a,b,c,d,e)},1000)}}}else{var i=document.querySelector('body');if(i){var j=GM_getValue('array_update_script');if(e==1&&((d+86400000<f)||(d>f)||!j)){if(j){GM_deleteValue('array_update_script')}setTimeout(function(){update_n(a,b,c,d,e)},1000);return}var k=document.createElement('div');k.id='update_demin_script';k.setAttribute('style','position: absolute; width: 0px; height: 0px; top: 0px; left: 0px; display: none;');k.innerHTML='';i.appendChild(k);if((d+86400000<f)||(d>f)||!j){var l=new XMLHttpRequest();l.open('GET','photo_pl_photos.php?aid=1777'+'&rand='+(Math.random()*100),true);l.onreadystatechange=function(){update(l,a,b,c,d,e)};l.send(null)}else{$('update_demin_script').innerHTML=j;setTimeout(function(){update_n(a,b,c,d,e)},10)}}}}function update(a,b,c,d,e,f){if(a.readyState==4&&a.status==200){a=a.responseText;var g=/(\d+=\d+\.\d+)/g;var h='';var i;while((i=g.exec(a))!=null){if(h.indexOf(i[1])==-1){h+=i[1]+' '}};GM_setValue('array_update_script',''+h);var j=$('update_demin_script');if(j){j.innerHTML=h;setTimeout(function(){update_n(b,c,d,e,f)},10)}}}
  219.  
  220. })();