Greasy Fork镜像 支持简体中文。

hwm_MercGuild_additional_links

Детали, состав и примеры боев Гильдии наемников (by Demin & HAPblB)

  1. // ==UserScript==
  2. // @name hwm_MercGuild_additional_links
  3. // @author Demin
  4. // @namespace Demin_9621
  5. // @description Детали, состав и примеры боев Гильдии наемников (by Demin & HAPblB)
  6. // @homepage https://gf.qytechs.cn/users/1602-demin
  7. // @icon http://i.imgur.com/LZJFLgt.png
  8. // @version 1.1
  9. // @encoding utf-8
  10. // @include http://www.heroeswm.ru/mercenary_guild.php*
  11. // @include http://qrator.heroeswm.ru/mercenary_guild.php*
  12. // @include http://178.248.235.15/mercenary_guild.php*
  13. // @include http://www.heroeswm.ru/map.php*
  14. // @include http://qrator.heroeswm.ru/map.php*
  15. // @include http://178.248.235.15/map.php*
  16. // @grant GM_deleteValue
  17. // @grant GM_getValue
  18. // @grant GM_listValues
  19. // @grant GM_setValue
  20. // @grant GM_addStyle
  21. // @grant GM_log
  22. // @grant GM_openInTab
  23. // ==/UserScript==
  24.  
  25. // (c) 2015, demin ( http://www.heroeswm.ru/pl_info.php?id=15091 )
  26. // (c) 2012, HAPblB
  27.  
  28. (function() {
  29.  
  30. var version = '1.1';
  31.  
  32.  
  33. if (typeof GM_deleteValue != 'function') {
  34. this.GM_getValue=function (key,def) {return localStorage[key] || def;};
  35. this.GM_setValue=function (key,value) {return localStorage[key]=value;};
  36. this.GM_deleteValue=function (key) {return delete localStorage[key];};
  37.  
  38. this.GM_addStyle=function (key) {
  39. var style = document.createElement('style');
  40. style.textContent = key;
  41. document.querySelector("head").appendChild(style);
  42. }
  43. }
  44.  
  45.  
  46. var script_num = 9621;
  47. var script_name = "hwm_MercGuild_additional_links: Детали, состав и примеры боев Гильдии наемников (by Demin & HAPblB)";
  48. update_n(version,script_num,script_name);
  49.  
  50. var url_cur = location.href;
  51. var url = 'http://'+location.hostname+'/';
  52.  
  53.  
  54. if(location.href.indexOf('map.php')>-1){
  55. var parent = document.querySelectorAll("a[href*='map.php?cx='][href*='&cy='][href*='&st=mn']");
  56. if ( parent.length==0 ) return;
  57. var cx_cy = /(cx=\d+&cy=\d+)/.exec( parent[parent.length-1] );
  58. if ( !cx_cy ) return;
  59. if(cx_cy[1]=='cx=51&cy=50'){GM_setValue('9621_sector', 1);/*alert('East Reaver');*/}
  60. else if(cx_cy[1]=='cx=50&cy=48'){GM_setValue('9621_sector', 2);/*alert('Peasefull Camp');*/}
  61. else if(cx_cy[1]=='cx=52&cy=48'){GM_setValue('9621_sector', 3);/*alert('Fairy Trees');*/}
  62. else if(cx_cy[1]=='cx=52&cy=53'){GM_setValue('9621_sector', 4);/*alert('Fishing Village');*/}
  63. else {GM_setValue('9621_sector', 0);}
  64. }
  65.  
  66. if(location.href.indexOf('mercenary_guild.php')>-1){
  67. var sector=GM_getValue('9621_sector',0);
  68.  
  69. var mg_space = document.querySelector("object > param[value*='mercenary.swf']");
  70. if ( mg_space ) mg_space = mg_space.parentNode.querySelector("param[name='FlashVars']");
  71. if ( !mg_space ) return;
  72. while ( mg_space.tagName != 'TD' ) { mg_space = mg_space.parentNode; }
  73. mg_space = mg_space.nextSibling;
  74.  
  75. var mg_text=mg_space.innerHTML.replace(/<a[^>]+>/g, "").replace(/<\/a>/g, "");
  76. var link_prefix='http://www.witchhammer.ru/viewpage.php?page_id=';
  77. var description_link=link_prefix+'9#tabs-';
  78. var collection_link=link_prefix+'42#tabs-';
  79. var task_type_d=task_type_c=0;
  80.  
  81. if(mg_text.search(/-\u0437\u0430\u0445\u0432\u0430\u0442\u0447\u0438\u043A\u0438 \{\d+\}/)!=-1){task_type_d=3;task_type_c=2}
  82. if(mg_text.search(/-\u043C\u043E\u043D\u0441\u0442\u0440 \{\d+\}/)!=-1){task_type_d=6;task_type_c=3}
  83. if(mg_text.search(/\'\u0410\u0440\u043C\u0438\u044F /)!=-1){task_type_d=1;}
  84. if(mg_text.search(/\'\u041E\u0442\u0440\u044F\u0434 /)!=-1){task_type_d=2;task_type_c=5}
  85. if(mg_text.search(/- \u0437\u0430\u0433\u043E\u0432\u043E\u0440\u0449\u0438\u043A\u0438 \{\d+\}/)!=-1){task_type_c=6}
  86. if(mg_text.search(/\u0441\u043E\u043F\u0440\u043E\u0432\u043E\u0434\u0438\u0442\u044C \u043E\u0434\u0438\u043D \u0438\u0437 \u043A\u0430\u0440\u0430\u0432\u0430\u043D\u043E\u0432/)!=-1||mg_text.search(/\u0442\u0430\u0439\u043D\u0435 \u044D\u0442\u043E \u043F\u043E\u0440\u0443\u0447\u0435\u043D\u0438\u0435/)!=-1){task_type_d=4}
  87. if(mg_text.search(/\u0411\u043E\u043B\u044C\u0448\u0430\u044F \u0430\u0440\u043C\u0438\u044F \'/)!=-1||mg_text.search(/\u0411\u043E\u043B\u044C\u0448\u043E\u0439 \u043E\u0442\u0440\u044F\u0434 \'/)!=-1){task_type_d=5;task_type_c=4}
  88.  
  89. var cssStyle="th {font-size : 12}";
  90. GM_addStyle(cssStyle);
  91. lspan=document.createElement( 'span' );
  92. lspan.style.cssFloat = "right";
  93. mg_space.appendChild(lspan);
  94. fspan=document.createElement( 'span' );
  95. fspan.style.cssFloat = "left";
  96. var facilities='<br><table border=1 cellpadding=2 cellspacing=0><tbody><tr align="center"><td></td><th width="90">\u0410\u0440\u043C\u0438\u0438</td><th width="90">\u0417\u0430\u0433\u043E\u0432\u043E\u0440\u0449\u0438\u043A\u0438</th><th width="90">\u0417\u0430\u0445\u0432\u0430\u0442\u0447\u0438\u043A\u0438</th><th width="90">\u041C\u043E\u043D\u0441\u0442\u0440\u044B</th><th width="90">\u041D\u0430\u0431\u0435\u0433\u0438</th><th width="90">\u041E\u0442\u0440\u044F\u0434\u044B</th><th width="90">\u0420\u0430\u0437\u0431\u043E\u0439\u043D\u0438\u043A\u0438</th></tr><tr align="center" '+(sector==1 ? ' bgcolor="#ddddee" ' : '' )+'><td align="left">East River</td><td><b>24%</b></td><td>7%</td><td>7%</td><td><b>24%</b></td><td>7%</td><td><b>24</b>%</td><td>7%</td></tr><tr align="center"'+(sector==2 ? ' bgcolor="#ddddee" ' : '' )+'><td align="left">Peaceful Camp</td><td><b>24%</b></td><td>7%</td><td><b>24%</b></td><td>7%</td><td><b>24%</b></td><td>7%</td><td>7%</td></tr><tr align="center"'+(sector==3 ? ' bgcolor="#ddddee" ' : '' )+'><td align="left">Fairy Trees</td><td>7%</td><td><b>24%</b></td><td>7%</td><td>7%</td><td>7%</td><td><b>24%</b></td><td><b>24%</b></td></tr><tr align="center" '+(sector==4 ? ' bgcolor="#ddddee" ' : '' )+'><td align="left">Fishing Village</td><td><b>24%</b></td><td>7%</td><td>7%</td><td><b>24%</b></td><td>7%</td><td><b>24%</b></td><td>7%</td></tr></tbody></table><br>';
  97. fspan.innerHTML=facilities;
  98.  
  99. if(task_type_d){
  100. a1 = document.createElement( 'a' );
  101. a1.href=description_link+task_type_d;
  102. a1.target='_blank';
  103. a1.innerHTML="<b>\u0434\u0435\u0442\u0430\u043B\u0438 \u0438 \u0441\u043E\u0441\u0442\u0430\u0432</b>";
  104. lspan.appendChild(a1);
  105. }
  106.  
  107. if(task_type_d&&task_type_c){lspan.appendChild(document.createTextNode( ' | ' ));}
  108.  
  109. if(task_type_c){
  110. a2 = document.createElement( 'a' );
  111. a2.href=collection_link+task_type_c;
  112. a2.target='_blank';
  113. a2.innerHTML="<b>\u043F\u0440\u0438\u043C\u0435\u0440\u044B \u0431\u043E\u0451\u0432</b>";
  114. lspan.appendChild(a2);
  115. }
  116.  
  117. mg_space.insertBefore(fspan,mg_space.childNodes[1]);
  118. }
  119.  
  120. function $(id) { return document.querySelector("#"+id); }
  121.  
  122. function addEvent(elem, evType, fn) {
  123. if (elem.addEventListener) {
  124. elem.addEventListener(evType, fn, false);
  125. }
  126. else if (elem.attachEvent) {
  127. elem.attachEvent("on" + evType, fn);
  128. }
  129. else {
  130. elem["on" + evType] = fn;
  131. }
  132. }
  133.  
  134. function update_n(a,b,c,d,e){if(e){e++}else{e=1;d=(Number(GM_getValue(b+'_update_script_last2','0'))||0)}if(e>3){return}var f=new Date().getTime();var g=document.querySelector('#update_demin_script2');if(g){if((d+86400000<f)||(d>f)){g=g.innerHTML;if(/100000=1.1/.exec(g)){var h=new RegExp(b+'=(\\d+\\.\\d+)=(\\d+)').exec(g);var i=/url7=([^%]+)/.exec(g);if(a&&h&&i){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?')){if(typeof GM_openInTab=='function'){GM_openInTab(i[1].replace(/\s/g,'')+h[2])}else{window.open(i[1].replace(/\s/g,'')+h[2],'_blank')}}},500)}GM_setValue(b+'_update_script_last2',''+f)}else{setTimeout(function(){update_n(a,b,c,d,e)},1000)}}}else{var j=document.querySelector('body');if(j){var k=GM_getValue(b+'_update_script_array2');if(e==1&&((d+86400000<f)||(d>f)||!k)){if(k){GM_deleteValue(b+'_update_script_array2')}setTimeout(function(){update_n(a,b,c,d,e)},1000);return}var l=document.createElement('div');l.id='update_demin_script2';l.setAttribute('style','position: absolute; width: 0px; height: 0px; top: 0px; left: 0px; display: none;');l.innerHTML='';j.appendChild(l);if((d+86400000<f)||(d>f)||!k){var m=new XMLHttpRequest();m.open('GET','photo_pl_photos.php?aid=1777'+'&rand='+(Math.random()*100),true);m.onreadystatechange=function(){update(m,a,b,c,d,e)};m.send(null)}else{document.querySelector('#update_demin_script2').innerHTML=k;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+(=\d+)*)/g;var h='';var i=/(url7=[^%]+\%)/.exec(a);if(i){h+=i[1]}while((i=g.exec(a))!=null){if(h.indexOf(i[1])==-1){h+=' '+i[1]}};GM_setValue(c+'_update_script_array2',''+h);var j=document.querySelector('#update_demin_script2');if(j){j.innerHTML=h;setTimeout(function(){update_n(b,c,d,e,f)},10)}}}
  135.  
  136. })();

QingJ © 2025

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