Advertisement
Meshy

Untitled

Oct 21st, 2017
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 76.22 KB | None | 0 0
  1. // ==UserScript==
  2. // @name hwm_time_restore
  3. // @author Demin
  4. // @namespace Demin_92571
  5. // @description Таймеры гильдии рабочих, воров, наёмников, рейнджеров, охотников, кузнецов, восстановления здоровья и маны (by Demin & перф)
  6. // @homepage https://greasyfork.org/users/1602-demin
  7. // @icon http://i.imgur.com/LZJFLgt.png
  8. // @version 5.8
  9. // @encoding utf-8
  10. // @include http://www.heroeswm.ru/*
  11. // @include http://qrator.heroeswm.ru/*
  12. // @include http://178.248.235.15/*
  13. // @include http://www.lordswm.com/*
  14. // @include https://greasyfork.org/*
  15. // @exclude */rightcol.php*
  16. // @exclude */ch_box.php*
  17. // @exclude */chat*
  18. // @exclude */ticker.html*
  19. // @exclude */frames*
  20. // @exclude */brd.php*
  21. // @grant GM_deleteValue
  22. // @grant GM_getValue
  23. // @grant GM_listValues
  24. // @grant GM_setValue
  25. // @grant GM_addStyle
  26. // @grant GM_log
  27. // @grant GM_openInTab
  28. // ==/UserScript==
  29.  
  30. // (c) 2010-2015, demin ( http://www.heroeswm.ru/pl_info.php?id=15091 )
  31. // (c) 2008-2009, xo4yxa
  32. // (c) 2017, перф. 10.10.2017 v.5.8: *вместо nick привзяка к id_payler из рекордов охоты; изменение алгоритма получения уровня здоровья.
  33.  
  34. (function() {
  35.  
  36. var version = '5.8';
  37.  
  38.  
  39. if (typeof GM_deleteValue != 'function') {
  40. this.GM_getValue=function (key,def) {return localStorage[key] || def;};
  41. this.GM_setValue=function (key,value) {return localStorage[key]=value;};
  42. this.GM_deleteValue=function (key) {return delete localStorage[key];};
  43. }
  44.  
  45.  
  46. var script_num = 92571;
  47. var script_name = "hwm_time_restore: Таймеры гильдии рабочих, воров, наёмников, рейнджеров, охотников, кузнецов, восстановления здоровья и маны (by Demin)";
  48. // see down
  49.  
  50. var url_cur = location.href;
  51. var url = 'http://'+location.hostname+'/';
  52.  
  53.  
  54. if ( url.match('greasyfork') ) {
  55. // remove banners // class = ad, ad-note, ad-content
  56. var google_del = document.querySelectorAll("div[id='script-show-info-ad']");
  57. if ( google_del.length > 0 ) {
  58. for ( var i=google_del.length; i--; ) {
  59. // google_del[i].style.display = 'none';
  60. google_del[i].parentNode.removeChild(google_del[i]);
  61. }
  62. }
  63. return;
  64. } else { update_n(version,script_num,script_name); }
  65.  
  66.  
  67. // pers v boju
  68. if ( location.pathname=='/war.php' && /warlog\|0/.exec(document.querySelector("html").innerHTML) ) {
  69. GM_setValue( "92571_hwm_war_unload_"+location.hostname, 'true' );
  70. }
  71.  
  72. var nick = "92571_";
  73. var army_percent = 0;
  74. var vh = document.getElementById('heart')
  75. if (vh) {
  76. if (vh.parentNode.innerHTML.match(/var heart=(\d+);/)) {army_percent = RegExp.$1}
  77. }
  78. if (document.body.innerHTML.match (/pl_hunter_stat\.php\?id=(\d+)/)) { nick = "92571_" + RegExp.$1 + "_"; }
  79.  
  80. // link to img http://dcdn.heroeswm.ru/i/top/line/lpart.jpg i/top_ny_rus/line/lpart_.jpg i/top_ny_eng/line/
  81. var img_link = document.querySelector("img[src*='i/top'][src*='/line/t_end']");
  82.  
  83.  
  84. var b = document.querySelector("body");
  85. var x1 = document.querySelector("img[src*='i/top'][src*='/dragon__left']");
  86. var x2 = document.querySelector("img[src*='i/top'][src*='/dragon__right']");
  87.  
  88.  
  89. if ( b && img_link && nick && x1 ) {
  90.  
  91. //nick = encodeURIComponent(nick);
  92.  
  93. var _i = /(\S*\/line\/)/.exec(img_link.src)[1];
  94. var _i_ = '';
  95. // if new year
  96. if ( document.querySelector("img[src*='i/top_ny']") ) { _i_ = '_'; }
  97.  
  98. var time_cur = new Date().getTime();
  99. var time = { h: 0, m: 0, w: 0, gn: 0, gv: 0, go: 0, sm: 0 }
  100.  
  101.  
  102. var hwmtimerestore = GM_getValue( nick+"hwmtimerestore" );
  103. if ( !hwmtimerestore ) hwmtimerestore = '{"hwm_time_health_alert":"no", "hwm_time_work_alert":"yes", "hwm_time_work_end_yes":"yes", "hwm_time_work_end":"1300000000000", "hwm_time_work_trudogolik":"0", "hwm_time_sm_alert":"yes", "hwm_time_sm_end_yes":"yes", "hwm_time_sm_end":"1300000000000", "hwm_time_gn_alert":"yes", "hwm_time_gn_end_yes":"yes", "hwm_time_gn_end":"1300000000000", "hwm_time_go_alert":"yes", "hwm_time_go_end_yes":"yes", "hwm_time_go_end":"1300000000000", "hwm_map_hunter":"false", "hwm_time_gv_alert":"yes", "hwm_time_gv_end_yes":"yes", "hwm_time_gv_end":"1300000000000", "hwm_map_thief_ambush":"false", "hwm_time_percent_faster":"1", "hwm_time_percent_prem":"1", "hwm_time_percent_prem_exp":"1300000000000", "hwm_time_percent_prem_title":"", "hwm_time_percent_lic_mo":"1", "hwm_time_percent_lic_mo_exp":"1300000000000", "hwm_time_percent_lic_mo_title":"", "hwm_gv_or_gre":"0", "hwm_gre_check":"0", "hwm_time_work_trudogolik_show":"1", "hwm_time_work_trudogolik_off":"0", "hwm_gr_show_check":"1", "hwm_gk_show_check":"1", "hwm_gn_show_check":"1", "hwm_go_show_check":"1", "hwm_gv_show_check":"1", "hwm_go_timer_hide":"1", "object_id":""}';
  104. hwmtimerestore = JSON.parse( hwmtimerestore );
  105. //alert( GM_getValue( nick+"hwmtimerestore" ) );
  106.  
  107.  
  108. // + txt
  109.  
  110. if ( url.match('lordswm') ) {
  111.  
  112. var health_alert_ty = 'Army restore alarm on';
  113. var health_alert_tn = 'Alarm once at army restore';
  114.  
  115. var work_alert_ty = 'Workshift alarm on';
  116. var work_alert_tn = 'Alarm off';
  117.  
  118. var sm_alert_ty = 'Blacksmith alarm on';
  119.  
  120. var gn_alert_ty = 'Mercenaries Guild alarm on';
  121.  
  122. var regexp_timegn0 = /Come back in (\d+) minutes\./;
  123. var regexp_timegn1 = /\. Time left: (\d+) minutes\./;
  124. var regexp_timegn2 = /ou have (\d+) minutes left/;
  125. var regexp_timegn3 = /\. Time left: (\d+) minutes\./;
  126. var regexp_timegn4 = /still have (\d+) minutes/;
  127. var regexp_timegn5 = /you still have \d+ attempts and (\d+) minutes/;
  128.  
  129. var regexp_gn_rep = /Reputation: <b>([\d\.]+)/;
  130.  
  131. var go_alert_ty = 'Hunters Guild alarm on';
  132. var regexp_go_timer = 'Next hunt available in';
  133.  
  134. var gv_alert_ty = 'Thieves Guild alarm on';
  135.  
  136. var gre_alert_ty = 'Rangers Guild alarm on';
  137.  
  138. var regexp_timegre = /Come in (\d+) min/;
  139.  
  140. var time_home = /You may enroll again in (\d+) min/;
  141. var time_home2 = / since (\d+):(\d+)<\/td>/;
  142.  
  143. var alert_health = 'Troops ready: 100%';
  144. var alert_work = 'LG: You may enroll again';
  145. var alert_sm = 'BS: Blacksmith works are finished';
  146. var alert_gn = 'MG: Mercenaries Guild has a quest for you';
  147. var alert_go = 'HG: You notice traces ...';
  148. var alert_gv = 'TG: You may set an ambush';
  149. var alert_gre = 'RG: Rangers Guild has a quest for you';
  150.  
  151. var gr_t = 'LG';
  152. var gr_title = '';
  153. var gk_t = 'BS';
  154. var gk_title = 'To Blacksmith';
  155. var gn_t = 'MG';
  156. var gn_title = 'To Mercenaries\' Guild';
  157. var go_t = 'HG';
  158. var go_title = 'To Hunters\' Guild';
  159. var gv_t = 'TG';
  160. var gv_title = 'To Thieves\' Guild';
  161. var gre_t = 'RG';
  162. var gre_title = 'To Rangers Guild post';
  163. var mana_title = 'Settings';
  164.  
  165. var work_obj_do = 'You have successfully enrolled';
  166. var work_unemployed = 'You are currently unemployed';
  167. var regexp_map_go = 'During the journey you have access to the';
  168. var go_title_lic = 'The license expires ';
  169. var alert_go_lic_exp = 'HG: Hunter license has expired';
  170. var alert_prem_exp = 'Abu-Bakir\'s Charm has expired';
  171.  
  172. var workaholic_penalty = 'Workaholic penalty';
  173. var workaholic_penalty_regexp = 'workaholic penalty';
  174.  
  175. var regexp_sm = /Completion time: (\d+)-(\d+) (\d+):(\d+)/;
  176.  
  177. } else {
  178.  
  179. var health_alert_ty = '\u0411\u0443\u0434\u0435\u0442 \u043F\u0440\u0435\u0434\u0443\u043F\u0440\u0435\u0436\u0434\u0435\u043D\u0438\u0435 \u043E \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0438 \u0430\u0440\u043C\u0438\u0438';
  180. var health_alert_tn = '\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0435\u0434\u0438\u043D\u043E\u0440\u0430\u0437\u043E\u0432\u043E \u043F\u0440\u0435\u0434\u0443\u043F\u0440\u0435\u0436\u0434\u0435\u043D\u0438\u0435 \u043E \u0432\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u0438 \u0430\u0440\u043C\u0438\u0438';
  181.  
  182. var work_alert_ty = '\u0411\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u043e \u043a\u043e\u043d\u0446\u0435 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u0447\u0430\u0441\u0430';
  183. var work_alert_tn = '\u041d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f';
  184.  
  185. var sm_alert_ty = '\u0411\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0440\u0430\u0431\u043e\u0442 \u0432 \u041a\u0443\u0437\u043d\u0438\u0446\u0435';
  186.  
  187. var gn_alert_ty = '\u0411\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0413\u0438\u043b\u044c\u0434\u0438\u0438 \u041d\u0430\u0435\u043c\u043d\u0438\u043a\u043e\u0432';
  188.  
  189. var regexp_timegn0 = /\u041f\u0440\u0438\u0445\u043e\u0434\u0438 \u0447\u0435\u0440\u0435\u0437 (\d+) \u043c\u0438\u043d/;
  190. var regexp_timegn1 = /\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u0438: (\d+) \u043c\u0438\u043d\u0443\u0442/;
  191. var regexp_timegn2 = /\u0442\u0435\u0431\u044f \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c (\d+) \u043c\u0438\u043d\u0443\u0442/;
  192. var regexp_timegn3 = /\u0443 \u0442\u0435\u0431\u044f \u0435\u0449\u0435 \u0435\u0441\u0442\u044c (\d+) \u043c\u0438\u043d\u0443\u0442/;
  193. var regexp_timegn4 = /\. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c (\d+) \u043c\u0438\u043d\u0443\u0442\./;
  194. var regexp_timegn5 = /\u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \d+ \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0438 (\d+) \u043c\u0438\u043d\u0443\u0442/;
  195. var regexp_gn_rep = /\u0420\u0435\u043F\u0443\u0442\u0430\u0446\u0438\u044F: <b>([\d\.]+)/;
  196.  
  197. var go_alert_ty = '\u0411\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0413\u0438\u043b\u044c\u0434\u0438\u0438 \u041e\u0445\u043e\u0442\u043d\u0438\u043a\u043e\u0432';
  198. var regexp_go_timer = '\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0430\u044F \u043E\u0445\u043E\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0447\u0435\u0440\u0435\u0437';
  199.  
  200. var gv_alert_ty = '\u0411\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0413\u0438\u043b\u044c\u0434\u0438\u0438 \u0412\u043e\u0440\u043e\u0432';
  201.  
  202. var gre_alert_ty = '\u0411\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0413\u0438\u043b\u044c\u0434\u0438\u0438 \u0420\u0435\u0439\u043D\u0434\u0436\u0435\u0440\u043E\u0432';
  203.  
  204. var regexp_timegre = /\u043f\u0440\u0438\u0445\u043e\u0434\u0438 \u0447\u0435\u0440\u0435\u0437 (\d+) \u043c\u0438\u043d/;
  205.  
  206. var time_home = /\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0441\u0442\u0440\u043e\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 (\d+)/;
  207. var time_home2 = / \u0441 (\d+):(\d+)<\/td>/;
  208.  
  209. var alert_health = '\u0413\u043E\u0442\u043E\u0432\u043D\u043E\u0441\u0442\u044C \u0430\u0440\u043C\u0438\u0438: 100%';
  210. var alert_work = '\u0413\u0420: \u041f\u043e\u0440\u0430 \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443';
  211. var alert_sm = '\u0413\u041a: \u0420\u0430\u0431\u043e\u0442\u0430 \u0432 \u041a\u0443\u0437\u043d\u0438\u0446\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430';
  212. var alert_gn = '\u0413\u041d: \u0414\u043b\u044f \u0412\u0430\u0441 \u0435\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0432 \u0413\u0438\u043b\u044c\u0434\u0438\u0438 \u041d\u0430\u0435\u043c\u043d\u0438\u043a\u043e\u0432';
  213. var alert_go = '\u0413\u041e: \u0412\u044B \u0443\u0432\u0438\u0434\u0435\u043B\u0438 \u0441\u043B\u0435\u0434\u044B ...';
  214. var alert_gv = '\u0413\u0412: \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0437\u0430\u0441\u0430\u0434\u0443';
  215. var alert_gre = '\u0413\u0420\u0436: \u0415\u0441\u0442\u044C \u0437\u0430\u0434\u0430\u043D\u0438\u0435 \u0432 \u0413\u0438\u043B\u044C\u0434\u0438\u0438 \u0420\u0435\u0439\u043D\u0434\u0436\u0435\u0440\u043E\u0432';
  216.  
  217. var gr_t = '\u0413\u0420';
  218. var gr_title = '';
  219. var gk_t = '\u0413\u041a';
  220. var gk_title = '\u0412 \u041a\u0443\u0437\u043d\u0438\u0446\u0443';
  221. var gn_t = '\u0413\u041d';
  222. var gn_title = '\u0412 \u0437\u0434\u0430\u043d\u0438\u0435 \u0413\u0438\u043b\u044c\u0434\u0438\u0438 \u041d\u0430\u0435\u043c\u043d\u0438\u043a\u043e\u0432';
  223. var go_t = '\u0413\u041e';
  224. var go_title = '\u0412 \u0437\u0434\u0430\u043d\u0438\u0435 \u0413\u0438\u043b\u044c\u0434\u0438\u0438 \u041e\u0445\u043e\u0442\u043d\u0438\u043a\u043e\u0432';
  225. var gv_t = '\u0413\u0412';
  226. var gv_title = '\u0412 \u0437\u0434\u0430\u043d\u0438\u0435 \u0413\u0438\u043b\u044c\u0434\u0438\u0438 \u0412\u043e\u0440\u043e\u0432';
  227. var gre_t = '\u0413\u0420\u0436';
  228. var gre_title = '\u0412 \u0437\u0434\u0430\u043d\u0438\u0435 \u0413\u0438\u043b\u044c\u0434\u0438\u0438 \u0420\u0435\u0439\u043D\u0434\u0436\u0435\u0440\u043E\u0432';
  229. var mana_title = 'Настройки';
  230.  
  231. var work_obj_do = '\u0412\u044b \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443';
  232. var work_unemployed = '\u0412\u044B \u043D\u0438\u0433\u0434\u0435 \u043D\u0435 \u0440\u0430\u0431\u043E\u0442\u0430\u0435\u0442\u0435';
  233. var regexp_map_go = '\u0412\u043E \u0432\u0440\u0435\u043C\u044F \u043F\u0443\u0442\u0438 \u0412\u0430\u043C \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B';
  234. var go_title_lic = '\u041B\u0438\u0446\u0435\u043D\u0437\u0438\u044F \u0438\u0441\u0442\u0435\u043A\u0430\u0435\u0442 ';
  235. var alert_go_lic_exp = '\u0413\u041e: \u041B\u0438\u0446\u0435\u043D\u0437\u0438\u044F \u043E\u0445\u043E\u0442\u043D\u0438\u043A\u0430 \u0438\u0441\u0442\u0435\u043A\u043B\u0430';
  236. var alert_prem_exp = '\u0411\u043B\u0430\u0433\u043E\u0441\u043B\u043E\u0432\u0435\u043D\u0438\u0435 \u0410\u0431\u0443-\u0411\u0435\u043A\u0440\u0430 \u0438\u0441\u0442\u0435\u043A\u043B\u043E';
  237.  
  238. var workaholic_penalty = '\u0428\u0442\u0440\u0430\u0444 \u0442\u0440\u0443\u0434\u043E\u0433\u043E\u043B\u0438\u043A\u0430';
  239. var workaholic_penalty_regexp = '\u0448\u0442\u0440\u0430\u0444 \u0442\u0440\u0443\u0434\u043E\u0433\u043E\u043B\u0438\u043A\u0430';
  240.  
  241. var regexp_sm = /\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u0438\u0435 \u0440\u0430\u0431\u043E\u0442\u044B: (\d+)-(\d+) (\d+):(\d+)/;
  242.  
  243. }
  244.  
  245. var regexp_time_server = /(\d+):(\d+), \d+ online/;
  246. var regexp_time_server2 = /(\d+):(\d+):(\d+), \d+ online/;
  247. var regexp_lic_mo = /(\d+)-(\d+)-(\d+) (\d+):(\d+)/;
  248. var regexp_prem = /(\d+)-(\d+)-(\d+) (\d+):(\d+)/;
  249.  
  250. var sm_alert_tn = work_alert_tn;
  251. var gn_alert_tn = work_alert_tn;
  252. var go_alert_tn = work_alert_tn;
  253. var gv_alert_tn = work_alert_tn;
  254. var gre_alert_tn = work_alert_tn;
  255. var gv_tit = '/thief_guild.php';
  256. var gre_tit = '/ranger_guild.php';
  257.  
  258. // - txt
  259.  
  260.  
  261. if ( hwmtimerestore["hwm_gv_or_gre"] == '1' ) {
  262. alert_gv = alert_gre;
  263. gv_alert_ty = gre_alert_ty;
  264. gv_alert_tn = gre_alert_tn;
  265. gv_t = gre_t;
  266. gv_title = gre_title;
  267. gv_tit = gre_tit;
  268. }
  269.  
  270.  
  271. if ( hwmtimerestore["hwm_time_percent_lic_mo_title"] ) {
  272.  
  273. if ( Number( hwmtimerestore["hwm_time_percent_lic_mo_exp"] ) > time_cur )
  274. {
  275. go_title += '\n' + go_title_lic + hwmtimerestore["hwm_time_percent_lic_mo_title"];
  276. }
  277. else
  278. {
  279. // licenzija ohotnika istekla
  280. setTimeout(function() { prompt( alert_go_lic_exp ); }, 300);
  281.  
  282. hwmtimerestore["hwm_time_percent_lic_mo"] = '1';
  283. hwmtimerestore["hwm_time_percent_lic_mo_exp"] = '1300000000000';
  284. hwmtimerestore["hwm_time_percent_lic_mo_title"] = '';
  285. }
  286. }
  287.  
  288.  
  289. var d = document.createElement('div');
  290. d.setAttribute('style', 'position: absolute; margin: -26px 0px 0px -43px; text-align: center;');
  291. d.innerHTML =
  292. '<style>' +
  293. '.hwm_tb * {font-size: 11px; color: #f5c137;}' +
  294. '.hwm_tb_cell {border-collapse: collapse; background-color: #6b6b69;}' +
  295. '.hwm_tb_cell TD {padding: 0px;}' +
  296. '.cell_t {height: 3px; background: url('+_i+'t_top_bkg'+_i_+'.jpg);}' +
  297. '.cell_c {white-space: nowrap; height: 18px; background: url('+_i+'t_com_bkg'+_i_+'.jpg); font-weight: bold;}' +
  298. '.cell_b {height: 5px; background: url('+_i+'t_bot_bkg'+_i_+'.jpg); text-align: center;}' +
  299. '.cell_b IMG {width: 17px; height: 5px;}' +
  300. '</style>' +
  301.  
  302. '<table cellpadding=0 cellspacing=0 align="center" class="hwm_tb" width=' + ( x2.getBoundingClientRect().left - x1.getBoundingClientRect().left + 124 ) + 'px>' +
  303. '<tr height=26>' +
  304. '<td>' +
  305.  
  306. '<table width="100%" cellpadding=0 cellspacing=0 style="background: url('+_i+'t_bkg'+_i_+'.jpg);">' +
  307. '<tr valign=middle align=center>' +
  308.  
  309. '<td width=5 style="overflow: hidden;"><img src="'+_i+'t_end'+_i_+'.jpg" alt="" width=9 height=26 style="margin:0px 0px 0px -4px;"></td>' +
  310.  
  311. '<td width=44>' +
  312. '<table class="hwm_tb_cell">' +
  313. '<tr><td class="cell_t"></td></tr>' +
  314. '<tr>' +
  315. '<td class="cell_c" style="cursor:pointer" id="pers_h">00:00</td>' +
  316. '</tr>' +
  317. '<tr><td class="cell_b"><img src="'+_i+'t_center'+_i_+'.jpg"></td></tr>' +
  318. '</table>' +
  319. '</td>' +
  320.  
  321. '<td width=9><img src="'+_i+'t_end'+_i_+'.jpg" alt="" width=9 height=26></td>' +
  322.  
  323. '<td id="gr_show1">' +
  324. '<table class="hwm_tb_cell">' +
  325. '<tr><td class="cell_t"></td></tr>' +
  326. '<tr>' +
  327. '<td class="cell_c"><span style="cursor:pointer" id="a_pers_w">'+gr_t+'</span>: <a href="javascript:void(0);" title="'+gr_title+'" style="text-decoration: none;" id="pers_w">00:00</a></td>' +
  328. '</tr>' +
  329. '<tr><td class="cell_b"><img src="'+_i+'t_center'+_i_+'.jpg"></td></tr>' +
  330. '</table>' +
  331. '</td>' +
  332.  
  333. '<td id="gr_show2" width=9><img src="'+_i+'t_end'+_i_+'.jpg" alt="" width=9 height=26></td>' +
  334.  
  335. '<td id="gk_show1">' +
  336. '<table class="hwm_tb_cell">' +
  337. '<tr><td class="cell_t"></td></tr>' +
  338. '<tr>' +
  339. '<td class="cell_c"><span style="cursor:pointer" id="a_pers_sm">'+gk_t+'</span>: <a href="/mod_workbench.php?type=repair" title="'+gk_title+'" style="text-decoration: none;" id="pers_sm">00:00</a></td>' +
  340. '</tr>' +
  341. '<tr><td class="cell_b"><img src="'+_i+'t_center'+_i_+'.jpg"></td></tr>' +
  342. '</table>' +
  343. '</td>' +
  344.  
  345. '<td id="gk_show2" width=9><img src="'+_i+'t_end'+_i_+'.jpg" alt="" width=9 height=26></td>' +
  346.  
  347. '<td id="gn_show1">' +
  348. '<table class="hwm_tb_cell">' +
  349. '<tr><td class="cell_t"></td></tr>' +
  350. '<tr>' +
  351. '<td class="cell_c"><span style="cursor:pointer" id="a_pers_gn">'+gn_t+'</span>: <a href="/mercenary_guild.php" title="'+gn_title+'" style="text-decoration: none;" id="pers_gn">00:00</a></td>' +
  352. '</tr>' +
  353. '<tr><td class="cell_b"><img src="'+_i+'t_center'+_i_+'.jpg"></td></tr>' +
  354. '</table>' +
  355. '</td>' +
  356.  
  357. '<td id="gn_show2" width=9><img src="'+_i+'t_end'+_i_+'.jpg" alt="" width=9 height=26></td>' +
  358.  
  359. '<td id="go_show1">' +
  360. '<table class="hwm_tb_cell">' +
  361. '<tr><td class="cell_t"></td></tr>' +
  362. '<tr>' +
  363. '<td class="cell_c"><span style="cursor:pointer" id="a_pers_go">'+go_t+'</span>: <a href="/hunter_guild.php" title="'+go_title+'" style="text-decoration: none;" id="pers_go">00:00</a>' +
  364. '</td>' +
  365. '</tr>' +
  366. '<tr><td class="cell_b"><img src="'+_i+'t_center'+_i_+'.jpg"></td></tr>' +
  367. '</table>' +
  368. '</td>' +
  369.  
  370. '<td id="go_show2" width=9><img src="'+_i+'t_end'+_i_+'.jpg" alt="" width=9 height=26></td>' +
  371.  
  372. '<td id="gv_show1">' +
  373. '<table class="hwm_tb_cell">' +
  374. '<tr><td class="cell_t"></td></tr>' +
  375. '<tr>' +
  376. '<td class="cell_c"><span style="cursor:pointer" id="a_pers_gv">'+gv_t+'</span>: <a href="'+gv_tit+'" title="'+gv_title+'" style="text-decoration: none;" id="pers_gv">00:00</a></td>' +
  377. '</tr>' +
  378. '<tr><td class="cell_b"><img src="'+_i+'t_center'+_i_+'.jpg"></td></tr>' +
  379. '</table>' +
  380. '</td>' +
  381.  
  382. '<td id="gv_show2" width=9><img src="'+_i+'t_end'+_i_+'.jpg" alt="" width=9 height=26></td>' +
  383.  
  384. '<td width=44>' +
  385. '<table class="hwm_tb_cell">' +
  386. '<tr><td class="cell_t"></td></tr>' +
  387. '<tr>' +
  388. '<td class="cell_c" style="cursor:pointer" id="pers_m" title="'+mana_title+'">00:00</td>' +
  389. '</tr>' +
  390. '<tr><td class="cell_b"><img src="'+_i+'t_center'+_i_+'.jpg"></td></tr>' +
  391. '</table>' +
  392. '</td>' +
  393.  
  394. '<td width=5 style="overflow: hidden;"><img src="'+_i+'t_end'+_i_+'.jpg" alt="" width=9 height=26 style="margin:0px -4px 0px 0px;"></td>' +
  395.  
  396. '</tr>' +
  397. '</table>' +
  398.  
  399. '</td>' +
  400. '</tr>' +
  401. '</table>';
  402.  
  403.  
  404. if ( hwmtimerestore["hwm_gr_show_check"] == '0' ) { d.querySelector("#gr_show1").style.display = d.querySelector("#gr_show2").style.display = 'none'; }
  405. if ( hwmtimerestore["hwm_gk_show_check"] == '0' ) { d.querySelector("#gk_show1").style.display = d.querySelector("#gk_show2").style.display = 'none'; }
  406. if ( hwmtimerestore["hwm_gn_show_check"] == '0' ) { d.querySelector("#gn_show1").style.display = d.querySelector("#gn_show2").style.display = 'none'; }
  407. if ( hwmtimerestore["hwm_go_show_check"] == '0' ) { d.querySelector("#go_show1").style.display = d.querySelector("#go_show2").style.display = 'none'; }
  408. if ( hwmtimerestore["hwm_gv_show_check"] == '0' ) { d.querySelector("#gv_show1").style.display = d.querySelector("#gv_show2").style.display = 'none'; }
  409.  
  410.  
  411. x1.parentNode.appendChild(d);
  412.  
  413. addEvent( $("pers_m"), "click", settings );
  414.  
  415.  
  416. if ( hwmtimerestore["object_id"] ) {
  417. setTimeout(function() { $("pers_w").href = "object-info.php?id=" + hwmtimerestore["object_id"]; }, 300);
  418. }
  419.  
  420.  
  421. // vychislenie vremeni servera (s podderzkoj scripta time_seconds)
  422. if ( t_server = regexp_time_server2.exec( b.innerHTML ) ) {
  423.  
  424. var time_server = new Date( 0, 0, 0, Number(t_server[1]), Number(t_server[2]), Number(t_server[3]) );
  425.  
  426. } else if ( t_server = regexp_time_server.exec( b.innerHTML ) ) {
  427.  
  428. var time_server = new Date( 0, 0, 0, Number(t_server[1]), Number(t_server[2]), 0 );
  429.  
  430. }
  431.  
  432.  
  433. if ( location.pathname=='/home.php' && document.querySelector("img[src$='i/s_defence.gif']") ) {
  434.  
  435. // podhvatyvanie vremeni okonchaniya raboty s home.php i ego proverka
  436. if ( time_home_time = time_home.exec( b.innerHTML ) ) {
  437.  
  438. var t_gr = Number( time_home_time[1] ) * 60000; // in milli seconds
  439. var t_gr_temp = t_gr - Math.abs( Number( hwmtimerestore["hwm_time_work_end"] ) - time_cur );
  440.  
  441. } else if ( ( time_home_time = time_home2.exec( b.innerHTML ) ) && time_server ) {
  442. var t_gr = new Date( 0, 0, 0, Number(time_home_time[1]), Number(time_home_time[2]), 0 );
  443.  
  444. // example: 18:00 - 18:20 = - 20 min uze rabotau; -20 min + 60 min = 40 min ostalos'
  445. if ( time_server < t_gr ) {
  446. t_gr = t_gr - time_server + 60*60000 - 24*60*60000; // in milli seconds
  447. } else {
  448. t_gr = t_gr - time_server + 60*60000; // in milli seconds
  449. }
  450. var t_gr_temp = t_gr - Math.abs( Number( hwmtimerestore["hwm_time_work_end"] ) - time_cur );
  451. }
  452.  
  453. if ( t_gr_temp && Math.abs( t_gr_temp ) > 70000 ) {
  454. hwmtimerestore["hwm_time_work_end"] = '' + ( time_cur + t_gr );
  455. hwmtimerestore["hwm_time_work_end_yes"] = 'no';
  456. }
  457.  
  458. if ( b.innerHTML.match( work_unemployed ) ) {
  459. hwmtimerestore["hwm_time_work_end"] = '1300000000000';
  460. hwmtimerestore["hwm_time_work_end_yes"] = 'yes';
  461. }
  462.  
  463. // detect premium akkaunt
  464. if ( img_star_prem = document.querySelector("img[src$='i/star.gif']") ) {
  465.  
  466. img_star_prem.align = "absmiddle";
  467. hwmtimerestore["hwm_time_percent_prem"] = '' + ( 70 / 100 );
  468.  
  469. var time_zone = 3 + new Date().getTimezoneOffset()/60;
  470. if ( new Date(2011,0,11).getTimezoneOffset() != new Date(2011,6,3).getTimezoneOffset() ) time_zone += 1;
  471. // get date
  472. var time_server_day = new Date( Date.parse( new Date() ) + time_zone*60*60*1000 );
  473. time_server_day = Date.parse( new Date( time_server_day.getFullYear(), time_server_day.getMonth(), time_server_day.getDate(), time_server.getHours(), time_server.getMinutes(), time_server.getSeconds() ) );
  474.  
  475. if ( time_prem = regexp_prem.exec( img_star_prem.title ) )
  476. {
  477. if ( url.match('lordswm') ) {
  478. // 2013-05-31 23:25
  479. time_prem = Date.parse( new Date( Number(time_prem[1]), Number(time_prem[2])-1, Number(time_prem[3]), Number(time_prem[4]), Number(time_prem[5]) ) );
  480. } else {
  481. // 31-05-13 23:25
  482. time_prem = Date.parse( new Date( Number(time_prem[3])+2000, Number(time_prem[2])-1, Number(time_prem[1]), Number(time_prem[4]), Number(time_prem[5]) ) );
  483. }
  484. hwmtimerestore["hwm_time_percent_prem_exp"] = '' + ( time_cur + time_prem - time_server_day );
  485. hwmtimerestore["hwm_time_percent_prem_title"] = img_star_prem.title;
  486. }
  487.  
  488. } else {
  489.  
  490. hwmtimerestore["hwm_time_percent_prem"] = '1';
  491. hwmtimerestore["hwm_time_percent_prem_exp"] = '1300000000000';
  492.  
  493. if ( hwmtimerestore["hwm_time_percent_prem_title"] ) {
  494. // premium istek
  495. setTimeout(function() { prompt( alert_prem_exp ); }, 300);
  496. hwmtimerestore["hwm_time_percent_prem_title"] = '';
  497. }
  498. }
  499. }
  500.  
  501.  
  502. if ( hwmtimerestore["hwm_time_percent_prem_title"] ) {
  503. if ( Number( hwmtimerestore["hwm_time_percent_prem_exp"] ) > time_cur )
  504. {
  505. gr_title = hwmtimerestore["hwm_time_percent_prem_title"];
  506. $('pers_w').title = gr_title;
  507. }
  508. else
  509. {
  510. // premium istek
  511. setTimeout(function() { prompt( alert_prem_exp ); }, 300);
  512.  
  513. hwmtimerestore["hwm_time_percent_prem"] = '1';
  514. hwmtimerestore["hwm_time_percent_prem_exp"] = '1300000000000';
  515. hwmtimerestore["hwm_time_percent_prem_title"] = '';
  516. }
  517. }
  518.  
  519.  
  520. if ( location.pathname=='/hunter_guild.php' && time_server && ( form_f2 = document.querySelector("form[name='f2']") ) )
  521. {
  522. while ( form_f2.tagName != 'TR' ) { form_f2 = form_f2.parentNode; }
  523.  
  524. if ( regexp_lic_mo.exec( form_f2.innerHTML ) )
  525. {
  526. if ( !form_f2.querySelector("input[type='submit'][onclick*='confirm']") )
  527. {
  528. // licenzija MO
  529. hwmtimerestore["hwm_time_percent_lic_mo"] = '' + ( 50 / 100 );
  530. }
  531. else
  532. {
  533. // licenzija O
  534. hwmtimerestore["hwm_time_percent_lic_mo"] = '' + ( 75 / 100 );
  535. }
  536.  
  537. var time_zone = 3 + new Date().getTimezoneOffset()/60;
  538. if ( new Date(2011,0,11).getTimezoneOffset() != new Date(2011,6,3).getTimezoneOffset() ) time_zone += 1;
  539. // get date
  540. var time_server_day = new Date( Date.parse( new Date() ) + time_zone*60*60*1000 );
  541. time_server_day = Date.parse( new Date( time_server_day.getFullYear(), time_server_day.getMonth(), time_server_day.getDate(), time_server.getHours(), time_server.getMinutes(), time_server.getSeconds() ) );
  542.  
  543. form_f2 = form_f2.querySelectorAll("td");
  544. var time_lic_mo_max = 0;
  545.  
  546. for ( var i=form_f2.length; i--; ) {
  547. if ( form_f2[i].innerHTML.indexOf("<td")!=-1 ) { continue; }
  548. if ( time_lic_mo = regexp_lic_mo.exec( form_f2[i].innerHTML ) )
  549. {
  550. if ( url.match('lordswm') ) {
  551. // Expiration date 05-31-13 23:25
  552. var time_lic_exp = Date.parse( new Date( Number(time_lic_mo[3])+2000, Number(time_lic_mo[1])-1, Number(time_lic_mo[2]), Number(time_lic_mo[4]), Number(time_lic_mo[5]) ) );
  553. } else {
  554. // 31-05-13 23:25
  555. var time_lic_exp = Date.parse( new Date( Number(time_lic_mo[3])+2000, Number(time_lic_mo[2])-1, Number(time_lic_mo[1]), Number(time_lic_mo[4]), Number(time_lic_mo[5]) ) );
  556. }
  557. if ( time_lic_exp > time_lic_mo_max )
  558. {
  559. time_lic_mo_max = time_lic_exp;
  560. hwmtimerestore["hwm_time_percent_lic_mo_exp"] = '' + ( time_cur + time_lic_mo_max - time_server_day );
  561. hwmtimerestore["hwm_time_percent_lic_mo_title"] = time_lic_mo[0];
  562. }
  563. }
  564. }
  565. }
  566. else
  567. {
  568. hwmtimerestore["hwm_time_percent_lic_mo"] = '1';
  569. hwmtimerestore["hwm_time_percent_lic_mo_exp"] = '1300000000000';
  570. hwmtimerestore["hwm_time_percent_lic_mo_title"] = '';
  571. }
  572. }
  573.  
  574.  
  575. // +++ algoritm okonchaniya boya
  576. if ( GM_getValue( "92571_hwm_war_unload_"+location.hostname, "false" ) == "true" )
  577. {
  578. var alt = "a";
  579. var bselect_link = document.querySelector("a[href='bselect.php']");
  580. if ( !bselect_link ) { bselect_link = document.querySelector("a[href='plstats.php']"); }
  581. if ( bselect_link && bselect_link.parentNode.innerHTML.indexOf("#ff0000")==-1 ) {
  582. GM_deleteValue( "92571_hwm_war_unload_"+location.hostname );
  583. alt += "11";
  584.  
  585. if ( hwmtimerestore["hwm_map_thief_ambush"] == "true" ) {
  586. alt += "2";
  587. hwmtimerestore["hwm_map_thief_ambush"] = 'false';
  588. if ( army_percent < 100 ) {
  589. alt += "33";
  590. hwmtimerestore["hwm_time_gv_end"] = '' + ( time_cur + 60*60000 * hwmtimerestore["hwm_time_percent_faster"] * hwmtimerestore["hwm_time_percent_prem"] );
  591. hwmtimerestore["hwm_time_gv_end_yes"] = 'no';
  592. } else {
  593. alt += "44";
  594. hwmtimerestore["hwm_time_gv_end"] = '1300000000000';
  595. hwmtimerestore["hwm_time_gv_end_yes"] = 'yes';
  596. }
  597. }
  598.  
  599. if ( hwmtimerestore["hwm_map_hunter"] == "true" ) {
  600. alt += "56";
  601. hwmtimerestore["hwm_map_hunter"] = 'false';
  602. hwmtimerestore["hwm_time_go_end_yes"] = 'no';
  603. if ( time_server && time_server.getHours() < 8 ) {
  604. hwmtimerestore["hwm_time_go_end"] = '' + ( time_cur + 20*60000 * hwmtimerestore["hwm_time_percent_faster"] * hwmtimerestore["hwm_time_percent_prem"] * hwmtimerestore["hwm_time_percent_lic_mo"] );
  605. } else {
  606. hwmtimerestore["hwm_time_go_end"] = '' + ( time_cur + 40*60000 * hwmtimerestore["hwm_time_percent_faster"] * hwmtimerestore["hwm_time_percent_prem"] * hwmtimerestore["hwm_time_percent_lic_mo"] );
  607. }
  608. }
  609.  
  610. if ( army_percent == 100 ) {
  611. alt += "7";
  612. hwmtimerestore["hwm_time_work_trudogolik"] = '0';
  613. }
  614. }
  615. //if ( alt != "a" ) { setTimeout(function() { alert( alt ); }, 500); }
  616. }
  617.  
  618. // --- algoritm okonchaniya boya
  619.  
  620.  
  621. if ( location.pathname=='/object_do.php' )
  622. {
  623. if ( b.innerHTML.match( work_obj_do ) )
  624. {
  625. hwmtimerestore["hwm_time_work_end"] = '' + ( time_cur + 60*60000 );
  626. hwmtimerestore["hwm_time_work_end_yes"] = 'no';
  627.  
  628. hwmtimerestore["hwm_time_work_trudogolik"] = '' + ( Number( hwmtimerestore["hwm_time_work_trudogolik"] ) + 1 );
  629.  
  630. var object_id = /id=(\d+)/.exec( url_cur );
  631. if ( object_id ) { hwmtimerestore["object_id"] = '' + object_id[1]; }
  632. }
  633. }
  634.  
  635.  
  636. if ( location.pathname=='/object-info.php' )
  637. {
  638. var parent_trud = document.querySelector("a[href*='objectworkers.php']");
  639. if ( parent_trud )
  640. {
  641. if ( url.match('lordswm') )
  642. {
  643. var workaholic_text1 = ' approximately through ';
  644. var workaholic_text2 = ' enrollments.';
  645. var workaholic_text3 = '';
  646. var workaholic_text1_replace = ' <font color="red">enabled</font> approximately ';
  647.  
  648. var uze_ustroen = 'You are already employed\.';
  649. var uze_ustroen2 = 'Less than one hour passed since last enrollment\. Please wait\.';
  650. var uze_ustroen3 = 'No vacancies\.';
  651. } else {
  652. var workaholic_text1 = ' \u043F\u0440\u0438\u043C\u0435\u0440\u043D\u043E \u0447\u0435\u0440\u0435\u0437 ';
  653. var workaholic_text2 = ' \u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432';
  654. var workaholic_text3 = ' \u043D\u0430 \u0440\u0430\u0431\u043E\u0442\u0443.';
  655. var workaholic_text1_replace = ' <font color="red">\u0430\u043A\u0442\u0438\u0432\u0435\u043D</font> \u043F\u0440\u0438\u043C\u0435\u0440\u043D\u043E ';
  656.  
  657. var uze_ustroen = '\u0412\u044B \u0443\u0436\u0435 \u0443\u0441\u0442\u0440\u043E\u0435\u043D\u044B\.';
  658. var uze_ustroen2 = '\u041F\u0440\u043E\u0448\u043B\u043E \u043C\u0435\u043D\u044C\u0448\u0435 \u0447\u0430\u0441\u0430 \u0441 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u0433\u043E \u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0430 \u043D\u0430 \u0440\u0430\u0431\u043E\u0442\u0443\. \u0416\u0434\u0438\u0442\u0435\.';
  659. var uze_ustroen3 = '\u041D\u0435\u0442 \u0440\u0430\u0431\u043E\u0447\u0438\u0445 \u043C\u0435\u0441\u0442\.';
  660. }
  661. var regexp_workaholic = new RegExp('\\*\\&nbsp;0\\.(\\d) '+workaholic_penalty_regexp);
  662.  
  663. // otrabotano smen
  664. var workaholic_WORK = Number( hwmtimerestore["hwm_time_work_trudogolik"] );
  665.  
  666. if ( regexp_workaholic.exec( b.innerHTML ) )
  667. {
  668. var regexp_workaholic = Number(regexp_workaholic.exec( b.innerHTML )[1]);
  669.  
  670. if ( regexp_workaholic == 8 )
  671. {
  672. workaholic_WORK = 11;
  673. } else if ( regexp_workaholic == 6 )
  674. {
  675. workaholic_WORK = 12;
  676. } else if ( regexp_workaholic == 4 )
  677. {
  678. workaholic_WORK = 13;
  679. } else if ( regexp_workaholic == 2 )
  680. {
  681. workaholic_WORK = 14;
  682. } else if ( regexp_workaholic == 1 && workaholic_WORK < 15 )
  683. {
  684. workaholic_WORK = 15;
  685. }
  686.  
  687. hwmtimerestore["hwm_time_work_trudogolik"] = '' + workaholic_WORK;
  688.  
  689. } else if ( workaholic_WORK > 10 ) {
  690.  
  691. workaholic_WORK = 10;
  692. hwmtimerestore["hwm_time_work_trudogolik"] = '' + workaholic_WORK;
  693. }
  694.  
  695. var add_trud = document.createElement('span');
  696.  
  697. if ( workaholic_WORK == 9 || workaholic_WORK == 10 )
  698. {
  699. // vydelit' zvetom
  700. add_trud.setAttribute('style', 'color:red; font-weight:bold;');
  701. } else if ( workaholic_WORK > 10 )
  702. {
  703. workaholic_text1 = workaholic_text1_replace;
  704. }
  705.  
  706. // ostalos' rabotat'
  707. var workaholic_ENROLL = Math.abs( 11 - workaholic_WORK );
  708.  
  709. if ( workaholic_WORK > 14 )
  710. {
  711. workaholic_ENROLL = workaholic_ENROLL + '+';
  712. }
  713.  
  714. // pravil'noe okonchanie slov
  715. if ( !url.match('lordswm') ) {
  716. if ( workaholic_WORK == 9 || workaholic_WORK == 8 || workaholic_WORK == 7 ) {
  717. workaholic_text2 += '\u0430';
  718. } else if ( workaholic_WORK == 10 ) {
  719. workaholic_text2 += '\u043E';
  720. }
  721. }
  722.  
  723. if ( hwmtimerestore["hwm_time_work_trudogolik_off"] == '0' ) {
  724. if ( hwmtimerestore["hwm_time_work_trudogolik_show"] == '1' && workaholic_WORK != 9 && workaholic_WORK != 10 ) {} else {
  725.  
  726. add_trud.innerHTML = workaholic_penalty + workaholic_text1 + workaholic_ENROLL + workaholic_text2 + workaholic_text3;
  727.  
  728. parent_trud = parent_trud.parentNode.previousSibling.previousSibling;
  729. parent_trud.parentNode.insertBefore(add_trud, parent_trud);
  730. }
  731. }
  732.  
  733. // replace uze ustroen
  734. parent_trud = document.querySelector("a[href*='objectworkers.php']").parentNode.parentNode;
  735. if ( ( time_cur > Number( hwmtimerestore["hwm_time_work_end"] ) ) && ( parent_trud.innerHTML.match(uze_ustroen) || ( uze_ustroen = parent_trud.innerHTML.match(uze_ustroen2) ) || ( uze_ustroen = parent_trud.innerHTML.match(uze_ustroen3) ) ) ) {
  736. parent_trud.innerHTML = parent_trud.innerHTML.replace(uze_ustroen, '<style>@-webkit-keyframes blink {80% {opacity:0.0;}} @-moz-keyframes blink {80% {opacity:0.0;}} @-o-keyframes blink {80% {opacity:0.0;}} @keyframes blink {80% {opacity:0.0;}}</style><font color=blue style="-webkit-animation: blink 1s steps(1,end) 0s infinite; -moz-animation: blink 1s steps(1,end) 0s infinite; -o-animation: blink 1s steps(1,end) 0s infinite; animation: blink 1s steps(1,end) 0s infinite"><b>'+uze_ustroen+'</b></font>');
  737. }
  738.  
  739. }
  740. }
  741.  
  742.  
  743. if ( workaholic_WORK = hwmtimerestore["hwm_time_work_trudogolik"] )
  744. {
  745. if ( gr_title ) gr_title += '\n';
  746. gr_title += workaholic_penalty + ": " + ( 11 - Number( workaholic_WORK ) );
  747. var title_gr = $('pers_w');
  748. title_gr.title = gr_title;
  749. if ( hwmtimerestore["hwm_time_work_trudogolik_off"] == '0' && workaholic_WORK > 10 ) title_gr.style.color = '#ff9c00';
  750. }
  751.  
  752.  
  753. if ( location.pathname=='/mercenary_guild.php' )
  754. {
  755. if ( document.querySelector("a[href^='/mercenary_guild.php?action=accept']") )
  756. {
  757. hwmtimerestore["hwm_time_gn_end"] = '1300000000000';
  758. hwmtimerestore["hwm_time_gn_end_yes"] = 'yes';
  759. }
  760.  
  761. else if ( ( time_gn = regexp_timegn0.exec( b.innerHTML ) ) || ( time_gn = regexp_timegn1.exec( b.innerHTML ) ) || ( time_gn = regexp_timegn2.exec( b.innerHTML ) ) || ( time_gn = regexp_timegn3.exec( b.innerHTML ) ) || ( time_gn = regexp_timegn4.exec( b.innerHTML ) ) || ( time_gn = regexp_timegn5.exec( b.innerHTML ) ) )
  762. {
  763. time_gn = Number( time_gn[1] );
  764. if ( regexp_timegn0.exec( b.innerHTML ) && ( time_gn==19 || time_gn==13 ) ) time_gn++;
  765. time_gn = time_gn * 60000; // in milli seconds
  766.  
  767. var time_gn_temp = time_gn - Math.abs( Number( hwmtimerestore["hwm_time_gn_end"] ) - time_cur );
  768.  
  769. if ( Math.abs( time_gn_temp ) > 70000 )
  770. {
  771. var reputation_gn = regexp_gn_rep.exec( b.innerHTML );
  772. reputation_gn = ( 40 - Number( reputation_gn[1] ) * 2 ) * hwmtimerestore["hwm_time_percent_faster"] * hwmtimerestore["hwm_time_percent_prem"] * 60000; // in milli seconds
  773.  
  774. time_gn_temp = time_gn - reputation_gn;
  775.  
  776. if ( Math.abs( time_gn_temp ) > 70000 ) {
  777. hwmtimerestore["hwm_time_gn_end"] = '' + ( time_cur + time_gn );
  778. hwmtimerestore["hwm_time_gn_end_yes"] = 'no';
  779. } else {
  780. hwmtimerestore["hwm_time_gn_end"] = '' + ( time_cur + reputation_gn );
  781. hwmtimerestore["hwm_time_gn_end_yes"] = 'no';
  782. }
  783. }
  784. }
  785.  
  786. //hwmtimerestore["grandma"] = '1';
  787. if ( b.innerHTML.match('Вы получаете') || b.innerHTML.match('You receive') ) {
  788. flash_heart = document.querySelector("object > param[value*='mercenary.swf']");
  789. if ( flash_heart ) {
  790. var rand_f;
  791. if ( new Date().getHours() == 23 ) {
  792. rand_f = "d8EWAZm.jpg";
  793. } else if ( hwmtimerestore["grandma"] ) {
  794. var img_win = new Array("3xVyD9G.jpg", "rdc2phi.jpg", "4Sz0fZh.jpg", "EeSup0D.jpg", "cfqFars.jpg", "HCuDAHi.jpg", "pYaFMyE.jpg");
  795. rand_f = Math.floor(Math.random() * img_win.length);
  796. rand_f = img_win[rand_f];
  797. }
  798.  
  799. if ( rand_f ) {
  800. flash_heart.parentNode.style.display = 'none';
  801. var add_el = document.createElement('img');
  802. add_el.height = "150";
  803. add_el.width = "150";
  804. add_el.src = "http://i.imgur.com/" + rand_f;
  805. flash_heart.parentNode.parentNode.appendChild(add_el);
  806. }
  807. }
  808. }
  809. }
  810.  
  811.  
  812. if ( location.pathname=='/ranger_guild.php' )
  813. {
  814. if ( document.querySelector("a[href^='ranger_guild.php?action=accept']") )
  815. {
  816. hwmtimerestore["hwm_map_thief_ambush"] = 'false';
  817. hwmtimerestore["hwm_time_gv_end"] = '1300000000000';
  818. hwmtimerestore["hwm_time_gv_end_yes"] = 'yes';
  819. hwmtimerestore["hwm_gv_or_gre"] = '1';
  820. }
  821.  
  822. if ( time_gv = regexp_timegre.exec( b.innerHTML ) )
  823. {
  824. time_gv = Number( time_gv[1] ) * 60000; // in milli seconds
  825. var time_gv_temp = time_gv - Math.abs( Number( hwmtimerestore["hwm_time_gv_end"] ) - time_cur );
  826.  
  827. if ( Math.abs( time_gv_temp ) > 70000 ) {
  828. hwmtimerestore["hwm_map_thief_ambush"] = 'false';
  829. hwmtimerestore["hwm_time_gv_end"] = '' + ( time_cur + time_gv );
  830. hwmtimerestore["hwm_time_gv_end_yes"] = 'no';
  831. hwmtimerestore["hwm_gv_or_gre"] = '1';
  832. }
  833. }
  834. }
  835.  
  836. if ( location.pathname=='/ranger_list.php' )
  837. {
  838. var link_ranger_attack = document.querySelectorAll("a[href^='ranger_attack.php?join']");
  839. if ( link_ranger_attack.length > 0 )
  840. {
  841. hwmtimerestore["hwm_map_thief_ambush"] = 'false';
  842. hwmtimerestore["hwm_time_gv_end"] = '1300000000000';
  843. hwmtimerestore["hwm_time_gv_end_yes"] = 'yes';
  844. hwmtimerestore["hwm_gv_or_gre"] = '1';
  845.  
  846. for ( var i=link_ranger_attack.length; i--; ) {
  847.  
  848. addEvent
  849. (
  850. link_ranger_attack[i],
  851. "click",
  852. function( event )
  853. {
  854. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  855. hwmtimerestore["hwm_map_thief_ambush"] = 'true';
  856. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  857. }
  858. );
  859. }
  860. }
  861. }
  862.  
  863.  
  864. if ( location.pathname=='/mod_workbench.php' && time_server )
  865. {
  866. if ( regexp_sm.exec( b.innerHTML ) ) {
  867.  
  868. var time_zone = 3 + new Date().getTimezoneOffset()/60;
  869. if ( new Date(2011,0,11).getTimezoneOffset() != new Date(2011,6,3).getTimezoneOffset() ) time_zone += 1;
  870. // get date
  871. var time_server_day = new Date( Date.parse( new Date() ) + time_zone*60*60*1000 );
  872. time_server_day = Date.parse( new Date( 0, time_server_day.getMonth(), time_server_day.getDate(), time_server.getHours(), time_server.getMinutes(), time_server.getSeconds() ) );
  873.  
  874. var all_td_mod = document.querySelectorAll("td");
  875. var t_sm_mass = [];
  876.  
  877. for ( var i=all_td_mod.length; i--; ) {
  878. if ( all_td_mod[i].innerHTML.indexOf("<td")!=-1 ) { continue; }
  879. if ( time_sm = regexp_sm.exec( all_td_mod[i].innerHTML ) ) {
  880. // 31-06 17:43
  881. time_sm = Date.parse( new Date( 0, Number(time_sm[2])-1, Number(time_sm[1]), Number(time_sm[3]), Number(time_sm[4]), 0 ) );
  882. t_sm_mass.push( time_sm - time_server_day );
  883. }
  884. }
  885.  
  886. t_sm_mass.sort( function(a, b) { return a - b; } );
  887.  
  888. hwmtimerestore["hwm_time_sm_end"] = '' + ( time_cur + t_sm_mass[0] + 60000 );
  889. hwmtimerestore["hwm_time_sm_end_yes"] = 'no';
  890.  
  891. } else {
  892.  
  893. hwmtimerestore["hwm_time_sm_end"] = '1300000000000';
  894. hwmtimerestore["hwm_time_sm_end_yes"] = 'yes';
  895. }
  896. }
  897.  
  898.  
  899. if ( location.pathname=='/map.php' ) {
  900.  
  901. var thief_ambush_cancel = document.querySelector("a[href^='thief_ambush_cancel.php']");
  902. if ( thief_ambush_cancel ) {
  903. hwmtimerestore["hwm_map_thief_ambush"] = 'true';
  904. hwmtimerestore["hwm_time_gv_end"] = '1300000000000';
  905. hwmtimerestore["hwm_time_gv_end_yes"] = 'yes';
  906. hwmtimerestore["hwm_gv_or_gre"] = '0';
  907.  
  908. addEvent
  909. (
  910. thief_ambush_cancel,
  911. "click",
  912. function( event )
  913. {
  914. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  915. hwmtimerestore["hwm_map_thief_ambush"] = 'false';
  916. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  917. }
  918. );
  919. }
  920.  
  921. if ( document.querySelector("a[href='ecostat.php']") ) {
  922. if ( hwmtimerestore["hwm_gv_or_gre"] == '0' && !thief_ambush_cancel ) {
  923. hwmtimerestore["hwm_map_thief_ambush"] = 'false';
  924. }
  925. if ( hwmtimerestore["hwm_gv_or_gre"] == '1' && !document.querySelector("a[href='ranger_guild.php']") ) {
  926. hwmtimerestore["hwm_map_thief_ambush"] = 'false';
  927. }
  928. }
  929.  
  930. var form_thief_ambush = document.querySelector("form[action='thief_ambush.php']");
  931. if ( form_thief_ambush ) {
  932. hwmtimerestore["hwm_map_thief_ambush"] = 'false';
  933. hwmtimerestore["hwm_time_gv_end"] = '1300000000000';
  934. hwmtimerestore["hwm_time_gv_end_yes"] = 'yes';
  935. hwmtimerestore["hwm_gv_or_gre"] = '0';
  936.  
  937. var input_form_thief_ambush = form_thief_ambush.querySelector("input[type='submit']");
  938.  
  939. addEvent
  940. (
  941. input_form_thief_ambush,
  942. "click",
  943. function( event )
  944. {
  945. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  946. hwmtimerestore["hwm_map_thief_ambush"] = 'true';
  947. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  948. }
  949. );
  950. }
  951.  
  952. var form_ranger_attack = document.querySelector("form[action='ranger_attack.php']");
  953. if ( form_ranger_attack ) {
  954. hwmtimerestore["hwm_map_thief_ambush"] = 'false';
  955. hwmtimerestore["hwm_time_gv_end"] = '1300000000000';
  956. hwmtimerestore["hwm_time_gv_end_yes"] = 'yes';
  957. hwmtimerestore["hwm_gv_or_gre"] = '1';
  958.  
  959. var input_form_ranger_attack = form_ranger_attack.querySelector("input[type='submit']");
  960.  
  961. addEvent
  962. (
  963. input_form_ranger_attack,
  964. "click",
  965. function( event )
  966. {
  967. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  968. hwmtimerestore["hwm_map_thief_ambush"] = 'true';
  969. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  970. }
  971. );
  972.  
  973. if ( hwmtimerestore["hwm_gre_check"] == '1' )
  974. {
  975. hwmtimerestore["hwm_map_thief_ambush"] = 'true';
  976. setTimeout(function() { form_ranger_attack.submit(); }, 500);
  977. }
  978. }
  979.  
  980. var temp_nl = document.querySelectorAll("img[src*='map/nl']");
  981. if ( temp_nl.length > 0 && !document.querySelector("img[src*='css/loading.gif']") ) {
  982. hwmtimerestore["hwm_map_hunter"] ='false';
  983. hwmtimerestore["hwm_time_go_end"] = '1310000000000';
  984. hwmtimerestore["hwm_time_go_end_yes"] = 'yes';
  985.  
  986. for ( var i=temp_nl.length, temp_parent, temp_child; i--; ) {
  987. temp_parent = temp_nl[i];
  988. while ( temp_parent.tagName != 'TR' ) { temp_parent = temp_parent.parentNode; }
  989. if ( temp_parent.parentNode.querySelector("a[href^='map.php?action=skip']") ) break;
  990. temp_parent = temp_parent.nextSibling;
  991. temp_child = temp_parent.firstChild.innerHTML;
  992. temp_parent.innerHTML = '<td colspan="2" align="left" width="100%"><table border="0" width="100%"><tbody><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td align="center">'+temp_child+'</td><td align="right" valign="top"><a href="map.php?action=skip">'+( url.match('lordswm') ? "Pass by " : "Пройти мимо" )+'</a>&nbsp;</td></tr></tbody></table></td>';
  993. }
  994. }
  995.  
  996. if ( b.innerHTML.match( regexp_go_timer ) && ( delta2 = /Delta2 = (\d+)/.exec( b.innerHTML ) ) ) {
  997. hwmtimerestore["hwm_map_hunter"] = 'false';
  998. hwmtimerestore["hwm_time_go_end"] = '' + ( time_cur + delta2[1]*1000 );
  999. hwmtimerestore["hwm_time_go_end_yes"] = 'no';
  1000.  
  1001. //+ Copyright (c) demin ( http://www.heroeswm.ru/pl_info.php?id=15091 )
  1002.  
  1003. if ( hwmtimerestore["hwm_go_timer_hide"] == '1' ) {
  1004. function inj_314() {
  1005. window["Refresh2"] = function () {}
  1006. var temp_314 = document.getElementById('next_ht');
  1007. while ( temp_314.tagName != 'TABLE' ) { temp_314 = temp_314.parentNode; }
  1008. temp_314.parentNode.removeChild( temp_314.previousSibling );
  1009. temp_314.parentNode.removeChild( temp_314.previousSibling );
  1010. temp_314.parentNode.removeChild( temp_314 );
  1011. }
  1012.  
  1013. var elem = document.createElement('script');
  1014. elem.type = "text/javascript";
  1015. elem.innerHTML = inj_314.toString()+"inj_314()";
  1016. document.querySelector("head").appendChild(elem);
  1017. }
  1018.  
  1019. //- Copyright (c)
  1020.  
  1021. }
  1022.  
  1023. var go_link_action_attack = document.querySelectorAll("a[href^='map.php?action=attack']");
  1024. for ( var i=go_link_action_attack.length; i--; ) {
  1025.  
  1026. addEvent
  1027. (
  1028. go_link_action_attack[i],
  1029. "click",
  1030. function( event )
  1031. {
  1032. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1033. hwmtimerestore["hwm_map_hunter"] = 'true';
  1034. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1035. }
  1036. );
  1037. }
  1038.  
  1039. var go_link_action_skip = document.querySelectorAll("a[href^='map.php?action=skip']");
  1040. for ( var i=go_link_action_skip.length; i--; ) {
  1041.  
  1042. addEvent
  1043. (
  1044. go_link_action_skip[i],
  1045. "click",
  1046. function( event )
  1047. {
  1048. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1049. hwmtimerestore["hwm_time_go_end_yes"] = 'no';
  1050. var time_cur_now = new Date().getTime();
  1051.  
  1052. if ( time_server && ( new Date( time_server.getTime() + time_cur_now - time_cur ).getHours() ) < 8 )
  1053. {
  1054. hwmtimerestore["hwm_time_go_end"] = '' + ( time_cur_now + 10*60000 * hwmtimerestore["hwm_time_percent_faster"] * hwmtimerestore["hwm_time_percent_prem"] * hwmtimerestore["hwm_time_percent_lic_mo"] + 1000 );
  1055. } else {
  1056. hwmtimerestore["hwm_time_go_end"] = '' + ( time_cur_now + 20*60000 * hwmtimerestore["hwm_time_percent_faster"] * hwmtimerestore["hwm_time_percent_prem"] * hwmtimerestore["hwm_time_percent_lic_mo"] + 1000 );
  1057. }
  1058.  
  1059. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1060. }
  1061. );
  1062. }
  1063.  
  1064. var go_link_help = document.querySelectorAll("a[onclick^='return print_friends']");
  1065. for ( var i=go_link_help.length; i--; ) {
  1066.  
  1067. addEvent
  1068. (
  1069. go_link_help[i],
  1070. "click",
  1071. function( event )
  1072. {
  1073. setTimeout(function() { go_link_help_click(); }, 200);
  1074. }
  1075. );
  1076. }
  1077.  
  1078. if ( b.innerHTML.match( regexp_map_go ) && hwmtimerestore["hwm_time_go_end"] == '1310000000000' ) {
  1079. hwmtimerestore["hwm_time_go_end_yes"] = 'no';
  1080. var time_cur_now = new Date().getTime();
  1081.  
  1082. if ( time_server && ( new Date( time_server.getTime() + time_cur_now - time_cur ).getHours() ) < 8 )
  1083. {
  1084. hwmtimerestore["hwm_time_go_end"] = '' + ( time_cur_now + 10*60000 * hwmtimerestore["hwm_time_percent_faster"] * hwmtimerestore["hwm_time_percent_prem"] * hwmtimerestore["hwm_time_percent_lic_mo"] + 1000 );
  1085. } else {
  1086. hwmtimerestore["hwm_time_go_end"] = '' + ( time_cur_now + 20*60000 * hwmtimerestore["hwm_time_percent_faster"] * hwmtimerestore["hwm_time_percent_prem"] * hwmtimerestore["hwm_time_percent_lic_mo"] + 1000 );
  1087. }
  1088. }
  1089.  
  1090.  
  1091. }
  1092.  
  1093.  
  1094. //==================================================================
  1095.  
  1096.  
  1097. var title_hl = $('pers_h');
  1098. addEvent
  1099. (
  1100. title_hl,
  1101. "click",
  1102. function( event )
  1103. {
  1104. if ( hwmtimerestore["hwm_time_health_alert"] == 'yes' )
  1105. {
  1106. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1107. hwmtimerestore["hwm_time_health_alert"] = 'no';
  1108. title_hl.style.color = '#f5c137';
  1109. title_hl.title = health_alert_tn;
  1110. } else
  1111. {
  1112. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1113. hwmtimerestore["hwm_time_health_alert"] = 'yes';
  1114. title_hl.style.color = '#ff9c00';
  1115. title_hl.title = health_alert_ty;
  1116. }
  1117. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1118. }
  1119. );
  1120.  
  1121. if ( hwmtimerestore["hwm_time_health_alert"] == 'yes' )
  1122. {
  1123. title_hl.style.color = '#ff9c00';
  1124. title_hl.title = health_alert_ty;
  1125. } else
  1126. {
  1127. title_hl.title = health_alert_tn;
  1128. }
  1129.  
  1130. var title_gr = $('a_pers_w');
  1131. addEvent
  1132. (
  1133. title_gr,
  1134. "click",
  1135. function( event )
  1136. {
  1137. if ( hwmtimerestore["hwm_time_work_alert"] == 'yes' )
  1138. {
  1139. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1140. hwmtimerestore["hwm_time_work_alert"] = 'no';
  1141. title_gr.style.color = '#f5c137';
  1142. title_gr.title = work_alert_tn;
  1143. } else
  1144. {
  1145. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1146. hwmtimerestore["hwm_time_work_alert"] = 'yes';
  1147. title_gr.style.color = '#FF0000';
  1148. title_gr.title = work_alert_ty;
  1149. }
  1150. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1151. }
  1152. );
  1153.  
  1154. if ( hwmtimerestore["hwm_time_work_alert"] == 'yes' )
  1155. {
  1156. title_gr.style.color = '#FF0000';
  1157. title_gr.title = work_alert_ty;
  1158. } else
  1159. {
  1160. title_gr.title = work_alert_tn;
  1161. }
  1162.  
  1163. var title_sm = $('a_pers_sm');
  1164. addEvent
  1165. (
  1166. title_sm,
  1167. "click",
  1168. function( event )
  1169. {
  1170. if ( hwmtimerestore["hwm_time_sm_alert"] == 'yes' )
  1171. {
  1172. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1173. hwmtimerestore["hwm_time_sm_alert"] = 'no';
  1174. title_sm.style.color = '#f5c137';
  1175. title_sm.title = sm_alert_tn;
  1176. } else
  1177. {
  1178. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1179. hwmtimerestore["hwm_time_sm_alert"] = 'yes';
  1180. title_sm.style.color = '#FF0000';
  1181. title_sm.title = sm_alert_ty;
  1182. }
  1183. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1184. }
  1185. );
  1186.  
  1187. if ( hwmtimerestore["hwm_time_sm_alert"] == 'yes' )
  1188. {
  1189. title_sm.style.color = '#FF0000';
  1190. title_sm.title = sm_alert_ty;
  1191. } else
  1192. {
  1193. title_sm.title = sm_alert_tn;
  1194. }
  1195.  
  1196. var title_gn = $('a_pers_gn');
  1197. addEvent
  1198. (
  1199. title_gn,
  1200. "click",
  1201. function( event )
  1202. {
  1203. if ( hwmtimerestore["hwm_time_gn_alert"] == 'yes' )
  1204. {
  1205. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1206. hwmtimerestore["hwm_time_gn_alert"] = 'no';
  1207. title_gn.style.color = '#f5c137';
  1208. title_gn.title = gn_alert_tn;
  1209. } else
  1210. {
  1211. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1212. hwmtimerestore["hwm_time_gn_alert"] = 'yes';
  1213. title_gn.style.color = '#FF0000';
  1214. title_gn.title = gn_alert_ty;
  1215. }
  1216. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1217. }
  1218. );
  1219.  
  1220. if ( hwmtimerestore["hwm_time_gn_alert"] == 'yes' )
  1221. {
  1222. title_gn.style.color = '#FF0000';
  1223. title_gn.title = gn_alert_ty;
  1224. } else
  1225. {
  1226. title_gn.title = gn_alert_tn;
  1227. }
  1228.  
  1229. var title_go = $('a_pers_go');
  1230. addEvent
  1231. (
  1232. title_go,
  1233. "click",
  1234. function( event )
  1235. {
  1236. if ( hwmtimerestore["hwm_time_go_alert"] == 'yes' )
  1237. {
  1238. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1239. hwmtimerestore["hwm_time_go_alert"] = 'no';
  1240. title_go.style.color = '#f5c137';
  1241. title_go.title = go_alert_tn;
  1242. } else
  1243. {
  1244. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1245. hwmtimerestore["hwm_time_go_alert"] = 'yes';
  1246. title_go.style.color = '#FF0000';
  1247. title_go.title = go_alert_ty;
  1248. }
  1249. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1250. }
  1251. );
  1252.  
  1253. if ( hwmtimerestore["hwm_time_go_alert"] == 'yes' )
  1254. {
  1255. title_go.style.color = '#FF0000';
  1256. title_go.title = go_alert_ty;
  1257. } else
  1258. {
  1259. title_go.title = go_alert_tn;
  1260. }
  1261.  
  1262. var title_gv = $('a_pers_gv');
  1263. addEvent
  1264. (
  1265. title_gv,
  1266. "click",
  1267. function( event )
  1268. {
  1269. if ( hwmtimerestore["hwm_time_gv_alert"] == 'yes' )
  1270. {
  1271. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1272. hwmtimerestore["hwm_time_gv_alert"] = 'no';
  1273. title_gv.style.color = '#f5c137';
  1274. title_gv.title = gv_alert_tn;
  1275. } else
  1276. {
  1277. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1278. hwmtimerestore["hwm_time_gv_alert"] = 'yes';
  1279. title_gv.style.color = '#FF0000';
  1280. title_gv.title = gv_alert_ty;
  1281. }
  1282. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1283. }
  1284. );
  1285.  
  1286. if ( hwmtimerestore["hwm_time_gv_alert"] == 'yes' )
  1287. {
  1288. title_gv.style.color = '#FF0000';
  1289. title_gv.title = gv_alert_ty;
  1290. } else
  1291. {
  1292. title_gv.title = gv_alert_tn;
  1293. }
  1294.  
  1295.  
  1296. //==================================================================
  1297.  
  1298. if (vh) {
  1299. if (vh.parentNode.innerHTML.match(/var time_heart=(\d+);/)) {
  1300. var heart_scale = RegExp.$1;
  1301. var time_l = Math.floor( ( heart_scale * 1000 / 100 ) * ( 100 - army_percent ) );
  1302. time.h = Math.floor( time_l / 1000 );
  1303. if ( army_percent < 100 ) showtime( 'h' );
  1304. }
  1305. }
  1306.  
  1307. /*var vs = document.querySelector("object > param[value*='heart.swf']");
  1308. if ( vs ) vs = vs.parentNode.querySelector("param[name='FlashVars']");
  1309. if ( vs ) {
  1310. vs = vs.value.split('|');
  1311. var cur = vs[0].split('=')[1];
  1312. var time_l = Math.floor( ( vs[1] * 1000 / 100 ) * ( 100 - cur ) );
  1313. time.h = Math.floor( time_l / 1000 );
  1314. if ( cur < 100 && vs[2] > 0 ) showtime( 'h' );
  1315. }
  1316.  
  1317. var vs = document.querySelector("object > param[value*='mana.swf']");
  1318. if ( vs ) vs = vs.parentNode.querySelector("param[name='FlashVars']");
  1319. if ( vs ) {
  1320. vs = vs.value.split('|');
  1321. var cur = vs[0].split('=')[1];
  1322. var time_l = Math.floor( ( ( vs[1] / 100 ) * vs[2] * 1000 / 100 ) * ( 100 - cur ) );
  1323. time.m = Math.floor( time_l / 1000 );
  1324. if ( cur < 100 && vs[2] > 0 ) showtime( 'm' );
  1325. }*/
  1326.  
  1327.  
  1328. if ( time_cur < ( time_work_end = Number( hwmtimerestore["hwm_time_work_end"] ) ) )
  1329. {
  1330. time.w = Math.floor( ( time_work_end - time_cur ) / 1000 );
  1331. if ( time.w < 3601 ) { showtime( 'w' ); } else { hwmtimerestore["hwm_time_work_end"] = '1300000000000'; hwmtimerestore["hwm_time_work_end_yes"] = 'yes'; }
  1332. } else { hwmtimerestore["hwm_time_work_end"] = '1300000000000'; hwmtimerestore["hwm_time_work_end_yes"] = 'yes'; }
  1333.  
  1334.  
  1335. if ( time_cur < ( time_sm_end = Number( hwmtimerestore["hwm_time_sm_end"] ) ) )
  1336. {
  1337. time.sm = Math.floor( ( time_sm_end - time_cur ) / 1000 );
  1338. showtime( 'sm' );
  1339. } else { hwmtimerestore["hwm_time_sm_end"] = '1300000000000'; hwmtimerestore["hwm_time_sm_end_yes"] = 'yes'; }
  1340.  
  1341.  
  1342. if ( time_cur < ( time_gn_end = Number( hwmtimerestore["hwm_time_gn_end"] ) ) )
  1343. {
  1344. time.gn = Math.floor( ( time_gn_end - time_cur ) / 1000 );
  1345. if ( time.gn < 54000 ) { showtime( 'gn' ); } else { hwmtimerestore["hwm_time_gn_end"] = '1300000000000'; hwmtimerestore["hwm_time_gn_end_yes"] = 'yes'; }
  1346. } else { hwmtimerestore["hwm_time_gn_end"] = '1300000000000'; hwmtimerestore["hwm_time_gn_end_yes"] = 'yes'; }
  1347.  
  1348.  
  1349. if ( time_cur < ( time_go_end = Number( hwmtimerestore["hwm_time_go_end"] ) ) )
  1350. {
  1351. time.go = Math.floor( ( time_go_end - time_cur ) / 1000 );
  1352. if ( time.go < 2401 ) { showtime( 'go' ); } else { hwmtimerestore["hwm_time_go_end"] = '1300000000000'; hwmtimerestore["hwm_time_go_end_yes"] = 'yes'; }
  1353. }// else { hwmtimerestore["hwm_time_go_end"] = '1300000000000'; hwmtimerestore["hwm_time_go_end_yes"] = 'yes'; }
  1354.  
  1355.  
  1356. if ( time_cur < ( time_gv_end = Number( hwmtimerestore["hwm_time_gv_end"] ) ) )
  1357. {
  1358. time.gv = Math.floor( ( time_gv_end - time_cur ) / 1000 );
  1359. if ( time.gv < 3601 ) { showtime( 'gv' ); } else { hwmtimerestore["hwm_time_gv_end"] = '1300000000000'; hwmtimerestore["hwm_time_gv_end_yes"] = 'yes'; }
  1360. } else { hwmtimerestore["hwm_time_gv_end"] = '1300000000000'; hwmtimerestore["hwm_time_gv_end_yes"] = 'yes'; }
  1361.  
  1362.  
  1363. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1364.  
  1365.  
  1366. }
  1367.  
  1368.  
  1369. function showtime( t )
  1370. {
  1371. var el = $( 'pers_' + t );
  1372. if ( t == 'h' )
  1373. {
  1374. var ct = --time.h;
  1375. } else if ( t == 'm' )
  1376. {
  1377. var ct = --time.m;
  1378. } else if ( t == 'w' )
  1379. {
  1380. var ct = --time.w;
  1381. } else if ( t == 'gn' )
  1382. {
  1383. var ct = --time.gn;
  1384. } else if ( t == 'go' )
  1385. {
  1386. var ct = --time.go;
  1387. } else if ( t == 'sm' )
  1388. {
  1389. var ct = --time.sm;
  1390. } else if ( t == 'gv' )
  1391. {
  1392. var ct = --time.gv;
  1393. }
  1394. var dd = Math.floor( ct / 86400 );
  1395. var dh = Math.floor( ( ct - dd * 86400 ) / 3600 );
  1396. var dm = Math.floor( ( ct - dd * 86400 - dh * 3600 ) / 60 );
  1397. var ds = ct % 60;
  1398. el.innerHTML = ( dd == 0 ? '' : ( (dd < 10) ? '0' : '' ) + dd + ':' ) + ( dd == 0 && dh == 0 ? '' : ( (dh < 10) ? '0' : '' ) + dh + ':' ) + ( (dm < 10) ? '0' : '' ) + dm + ':' + ( (ds < 10) ? '0' : '') + ds;
  1399.  
  1400. if ( ct == 0 )
  1401. {
  1402. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1403.  
  1404. if ( t == 'h' )
  1405. {
  1406. title_hl.style.color = '#f5c137';
  1407. title_hl.title = health_alert_tn;
  1408. if ( hwmtimerestore["hwm_time_health_alert"] == 'yes' )
  1409. {
  1410. hwmtimerestore["hwm_time_health_alert"] = 'no';
  1411. setTimeout(function() { alert( alert_health ); }, 100);
  1412. }
  1413. }
  1414. if ( t == 'w' && hwmtimerestore["hwm_time_work_end_yes"] != 'yes' && hwmtimerestore["hwm_time_work_alert"] == 'yes' )
  1415. {
  1416. hwmtimerestore["hwm_time_work_end_yes"] = 'yes';
  1417. setTimeout(function() { alert( alert_work ); }, 100);
  1418. }
  1419. if ( t == 'sm' && hwmtimerestore["hwm_time_sm_end_yes"] != 'yes' && hwmtimerestore["hwm_time_sm_alert"] == 'yes' )
  1420. {
  1421. hwmtimerestore["hwm_time_sm_end_yes"] = 'yes';
  1422. setTimeout(function() { alert( alert_sm ); }, 100);
  1423. }
  1424. if ( t == 'gn' && hwmtimerestore["hwm_time_gn_end_yes"] != 'yes' && hwmtimerestore["hwm_time_gn_alert"] == 'yes' )
  1425. {
  1426. hwmtimerestore["hwm_time_gn_end_yes"] = 'yes';
  1427. setTimeout(function() { alert( alert_gn ); }, 100);
  1428. }
  1429. if ( t == 'go' && hwmtimerestore["hwm_time_go_end_yes"] != 'yes' && hwmtimerestore["hwm_time_go_alert"] == 'yes' )
  1430. {
  1431. hwmtimerestore["hwm_time_go_end_yes"] = 'yes';
  1432. setTimeout(function() { alert( alert_go ); }, 100);
  1433. }
  1434. if ( t == 'gv' && hwmtimerestore["hwm_time_gv_end_yes"] != 'yes' && hwmtimerestore["hwm_time_gv_alert"] == 'yes' )
  1435. {
  1436. hwmtimerestore["hwm_time_gv_end_yes"] = 'yes';
  1437. setTimeout(function() { alert( alert_gv ); }, 100);
  1438. }
  1439.  
  1440. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1441. return;
  1442. }
  1443. if ( ct < 0 )
  1444. {
  1445. el.innerHTML = '00:00';
  1446. return;
  1447. }
  1448. setTimeout( function() { showtime( t ) }, 999 );
  1449. }
  1450.  
  1451. function settings_close()
  1452. {
  1453. var bg = $('bgOverlay');
  1454. var bgc = $('bgCenter');
  1455. bg.parentNode.removeChild(bg);
  1456. bgc.parentNode.removeChild(bgc);
  1457. }
  1458.  
  1459. function settings()
  1460. {
  1461. var bg = $('bgOverlay');
  1462. var bgc = $('bgCenter');
  1463. var bg_height = ScrollHeight();
  1464.  
  1465. if ( !bg )
  1466. {
  1467. bg = document.createElement('div');
  1468. document.body.appendChild( bg );
  1469.  
  1470. bgc = document.createElement('div');
  1471. document.body.appendChild( bgc );
  1472. }
  1473.  
  1474. bg.id = 'bgOverlay';
  1475. bg.style.position = 'absolute';
  1476. bg.style.left = '0px';
  1477. bg.style.width = '100%';
  1478. bg.style.background = "#000000";
  1479. bg.style.opacity = "0.5";
  1480. bg.style.zIndex = "1100";
  1481.  
  1482. bgc.id = 'bgCenter';
  1483. bgc.style.position = 'absolute';
  1484. bgc.style.left = ( ( ClientWidth() - 650 ) / 2 ) + 'px';
  1485. bgc.style.width = '650px';
  1486. bgc.style.background = "#F6F3EA";
  1487. bgc.style.zIndex = "1105";
  1488.  
  1489. addEvent(bg, "click", settings_close);
  1490.  
  1491. if ( url.match('lordswm') ) {
  1492.  
  1493. var st_start = 'All settings adjustments will apply after page is reloaded';
  1494. var st_null_timers = 'Reset all timers';
  1495. var st_clear_data = 'Delete other user settings';
  1496. var st_gv_n_time = 'Set TG/RG timer for once to';
  1497. var st_gv_n_time2 = 'minutes';
  1498. var st_percent_faster = 'Quests HG, MG, TG, RG more often';
  1499. var st_percent_faster2 = 'percent';
  1500. var st_gre_check = 'Immediately initiate Rangers\' guild battle on arrival';
  1501. var st_show_timers = 'Show timers:';
  1502. var st_author = 'Script author';
  1503. var st_predupr_pa = '<b>Abu-Bakir\'s Charm</b> is detected automatically';
  1504. var st_work_trudogolik_show = 'Notify about workaholic penalty only 2 workshifts away';
  1505. var st_work_trudogolik_off = 'Turn off all notifications on workaholic penalty';
  1506. var st_predupr_go_lic = '<b>Hunter license</b> is detected automatically in Hunters\' Guild';
  1507. var st_go_timer_hide = 'Hide';
  1508.  
  1509. } else {
  1510.  
  1511. var st_start = '\u0412\u0441\u0435 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u0431\u0443\u0434\u0443\u0442 \u0432\u0438\u0434\u043D\u044B \u043F\u043E\u0441\u043B\u0435 \u043F\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B';
  1512. var st_null_timers = '\u041E\u0431\u043D\u0443\u043B\u0438\u0442\u044C \u0432\u0441\u0435 \u0442\u0430\u0439\u043C\u0435\u0440\u044B';
  1513. var st_clear_data = '\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0434\u0440. \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u0435\u0439';
  1514. var st_gv_n_time = '\u0415\u0434\u0438\u043D\u043E\u0440\u0430\u0437\u043E\u0432\u043E \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0442\u0430\u0439\u043C\u0435\u0440 \u0413\u0412/\u0413\u0420\u0436 \u0440\u0430\u0432\u043D\u044B\u043C';
  1515. var st_gv_n_time2 = '\u043C\u0438\u043D\u0443\u0442';
  1516. var st_percent_faster = '\u0417\u0430\u0434\u0430\u043D\u0438\u044F \u0413\u041E, \u0413\u041D, \u0413\u0412, \u0413\u0420\u0436 \u0447\u0430\u0449\u0435 \u043D\u0430';
  1517. var st_percent_faster2 = '\u043F\u0440\u043E\u0446\u0435\u043D\u0442\u043E\u0432';
  1518. var st_gre_check = '\u041F\u043E \u043F\u0440\u0438\u0431\u044B\u0442\u0438\u0438 \u0432\u0441\u0442\u0443\u043F\u0430\u0442\u044C \u0432 \u0431\u043E\u0438 \u0413\u0438\u043B\u044C\u0434\u0438\u0438 \u0420\u0435\u0439\u043D\u0434\u0436\u0435\u0440\u043E\u0432';
  1519. var st_show_timers = '\u041E\u0442\u043E\u0431\u0440\u0430\u0436\u0430\u0442\u044C \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0435 \u0442\u0430\u0439\u043C\u0435\u0440\u044B:';
  1520. var st_author = '\u0410\u0432\u0442\u043E\u0440 \u0441\u043A\u0440\u0438\u043F\u0442\u0430';
  1521. var st_predupr_pa = '<b>\u0411\u043B\u0430\u0433\u043E\u0441\u043B\u043E\u0432\u0435\u043D\u0438\u0435 \u0410\u0431\u0443-\u0411\u0435\u043A\u0440\u0430</b> \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u044F\u0435\u0442\u0441\u044F \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438';
  1522. var st_work_trudogolik_show = '\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u0448\u0442\u0440\u0430\u0444 \u0442\u0440\u0443\u0434\u043E\u0433\u043E\u043B\u0438\u043A\u0430 \u0442\u043E\u043B\u044C\u043A\u043E \u0437\u0430 2 \u0447\u0430\u0441\u0430';
  1523. var st_work_trudogolik_off = '\u041E\u0442\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0432\u0441\u0435 \u0443\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u044F \u043E \u0448\u0442\u0440\u0430\u0444\u0435 \u0442\u0440\u0443\u0434\u043E\u0433\u043E\u043B\u0438\u043A\u0430';
  1524. var st_predupr_go_lic = '<b>\u041B\u0438\u0446\u0435\u043D\u0437\u0438\u044F \u043E\u0445\u043E\u0442\u043D\u0438\u043A\u0430</b> \u043E\u043F\u0440\u0435\u0434\u0435\u043B\u044F\u0435\u0442\u0441\u044F \u0430\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438 \u0432 \u0413\u0438\u043B\u044C\u0434\u0438\u0438 \u041E\u0445\u043E\u0442\u043D\u0438\u043A\u043E\u0432';
  1525. var st_go_timer_hide = '\u0421\u043A\u0440\u044B\u0432\u0430\u0442\u044C';
  1526.  
  1527. }
  1528.  
  1529. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1530.  
  1531. bgc.innerHTML = '<div style="border:1px solid #abc;padding:5px;margin:2px;"><div style="float:right;border:1px solid #abc;width:15px;height:15px;text-align:center;cursor:pointer;" id="bt_close_tr" title="Close">x</div><table>'+
  1532. '<tr><td>'+st_start+'<br><br></td></tr>'+
  1533.  
  1534. '<tr><td>'+st_show_timers+'&nbsp;&nbsp;'+gr_t+':<input type=checkbox '+(hwmtimerestore["hwm_gr_show_check"]=="1"?"checked":"")+' id=hwm_gr_show_check_id title="">'+
  1535. '&nbsp;&nbsp;'+gk_t+':<input type=checkbox '+(hwmtimerestore["hwm_gk_show_check"]=="1"?"checked":"")+' id=hwm_gk_show_check_id title="">'+
  1536. '&nbsp;&nbsp;'+gn_t+':<input type=checkbox '+(hwmtimerestore["hwm_gn_show_check"]=="1"?"checked":"")+' id=hwm_gn_show_check_id title="">'+
  1537. '&nbsp;&nbsp;'+go_t+':<input type=checkbox '+(hwmtimerestore["hwm_go_show_check"]=="1"?"checked":"")+' id=hwm_go_show_check_id title="">'+
  1538. '&nbsp;&nbsp;'+gv_t+' ('+gre_t+')'+':<input type=checkbox '+(hwmtimerestore["hwm_gv_show_check"]=="1"?"checked":"")+' id=hwm_gv_show_check_id title=""><br><br></td></tr>'+
  1539.  
  1540. '<tr><td>'+st_gre_check+': <input type=checkbox '+(hwmtimerestore["hwm_gre_check"]=="1"?"checked":"")+' id=hwm_gre_check_id title=""></td></tr>'+
  1541. '<tr><td>'+st_go_timer_hide+' "<i>'+regexp_go_timer+' ..</i>": <input type=checkbox '+(hwmtimerestore["hwm_go_timer_hide"]=="1"?"checked":"")+' id=hwm_go_timer_hide_id title=""><br><br></td></tr>'+
  1542.  
  1543. '<tr><td>'+st_work_trudogolik_off+': <input type=checkbox '+(hwmtimerestore["hwm_time_work_trudogolik_off"]=="1"?"checked":"")+' id=hwm_trudogolik_off_id title=""></td></tr>'+
  1544. '<tr><td>'+st_work_trudogolik_show+': <input type=checkbox '+(hwmtimerestore["hwm_time_work_trudogolik_show"]=="1"?"checked":"")+' id=hwm_trudogolik_show_id title=""><br><br></td></tr>'+
  1545.  
  1546. '<tr><td>'+st_predupr_pa+'</td></tr>'+
  1547.  
  1548. '<tr><td>'+st_predupr_go_lic+'</td></tr>'+
  1549.  
  1550. '<tr><td>'+st_percent_faster+' <input id="gv_n_percent" value="'+
  1551. ( 100 - hwmtimerestore["hwm_time_percent_faster"] * 100 )+
  1552. '" size="1" maxlength="2"> <b>'+st_percent_faster2+'</b> <input type="submit" id="gv_n_percent_ok" value="ok"></td></tr>'+
  1553.  
  1554. '<tr><td>'+st_gv_n_time+' <input id="gv_n_time" value="'+
  1555. ( 60 * hwmtimerestore["hwm_time_percent_faster"] * hwmtimerestore["hwm_time_percent_prem"] )+
  1556. '" size="1" maxlength="2"> '+st_gv_n_time2+' <input type="submit" id="gv_n_time_ok" value="ok"><br><br></td></tr>'+
  1557.  
  1558. '<tr><td><input type="submit" id="null_tr_id" disabled value="'+st_null_timers+'"> <input type="submit" id="clear_data_id" disabled value="'+st_clear_data+'"></td></tr>'+
  1559.  
  1560. '</table><table width=100%>'+
  1561. '<tr><td style="text-align:right">'+st_author+': <a href="pl_info.php?id=15091">Demin</a> <a href="javascript:void(0);" id="open_transfer_id">?</a></td></tr>'+
  1562. '</table></div>';
  1563.  
  1564. addEvent($("bt_close_tr"), "click", settings_close);
  1565. addEvent($("null_tr_id"), "click", null_tr);
  1566. addEvent($("clear_data_id"), "click", clear_data);
  1567. addEvent($("gv_n_time_ok"), "click", gv_n_time_f);
  1568. addEvent($("gv_n_percent_ok"), "click", gv_n_percent_f);
  1569. addEvent($("hwm_gre_check_id"), "click", check_gre_f);
  1570. addEvent($("hwm_trudogolik_show_id"), "click", hwm_trudogolik_show_f);
  1571. addEvent($("hwm_trudogolik_off_id"), "click", hwm_trudogolik_off_f);
  1572. addEvent($("hwm_go_timer_hide_id"), "click", hwm_go_timer_hide_f);
  1573.  
  1574. addEvent($("hwm_gr_show_check_id"), "click", hwm_gr_show_check_id_f);
  1575. addEvent($("hwm_gk_show_check_id"), "click", hwm_gk_show_check_id_f);
  1576. addEvent($("hwm_gn_show_check_id"), "click", hwm_gn_show_check_id_f);
  1577. addEvent($("hwm_go_show_check_id"), "click", hwm_go_show_check_id_f);
  1578. addEvent($("hwm_gv_show_check_id"), "click", hwm_gv_show_check_id_f);
  1579. addEvent($("open_transfer_id"), "click", open_transfer_f);
  1580.  
  1581. bg.style.top = '0px';
  1582. bg.style.height = bg_height + 'px';
  1583. bgc.style.top = ( window.pageYOffset + 150 ) + 'px';
  1584. bg.style.display = '';
  1585. bgc.style.display = '';
  1586. }
  1587.  
  1588. function gv_n_time_f()
  1589. {
  1590. if ( Number( $("gv_n_time").value ) >= 0 ) {
  1591. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1592. hwmtimerestore["hwm_time_gv_end"] = '' + ( (new Date()).getTime() + $("gv_n_time").value * 60000 );
  1593. hwmtimerestore["hwm_time_gv_end_yes"] = 'no';
  1594. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1595. }
  1596. }
  1597.  
  1598. function gv_n_percent_f()
  1599. {
  1600. if ( Number( $("gv_n_percent").value ) >= 0 ) {
  1601. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1602. hwmtimerestore["hwm_time_percent_faster"] = '' + ( ( 100 - $("gv_n_percent").value )/100 );
  1603. $("gv_n_time").value = ( 60 * hwmtimerestore["hwm_time_percent_faster"] * hwmtimerestore["hwm_time_percent_prem"] );
  1604. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1605. }
  1606. }
  1607.  
  1608. function go_link_help_click()
  1609. {
  1610. var form_go_link_help = document.querySelectorAll("form[action='/map.php']");
  1611.  
  1612. for ( var i=form_go_link_help.length; i--; ) {
  1613. var input_form_go_link_help = form_go_link_help[i].querySelector("input[type='submit']");
  1614.  
  1615. addEvent
  1616. (
  1617. input_form_go_link_help,
  1618. "click",
  1619. function( event )
  1620. {
  1621. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1622. hwmtimerestore["hwm_map_hunter"] = 'true';
  1623. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1624. }
  1625. );
  1626. }
  1627. }
  1628.  
  1629. function null_tr()
  1630. {
  1631. // udalit' svoi nastrojki
  1632. if ( typeof GM_listValues != 'function' ) {
  1633. GM_listValues=function () {
  1634. var values = [];
  1635. for (var i=0; i<localStorage.length; i++) {
  1636. values.push(localStorage.key(i));
  1637. }
  1638. return values;
  1639. }
  1640. }
  1641. var clear_d = GM_listValues();
  1642. var clear_d_len = clear_d.length;
  1643. alert(clear_d);
  1644. for (var i=clear_d_len; i--;) {
  1645. if ( clear_d[i].match(nick) ) {
  1646. GM_deleteValue(clear_d[i]);
  1647. }
  1648. }
  1649. }
  1650.  
  1651. function clear_data()
  1652. {
  1653. // udalit' nastrojki drugih uzerov
  1654. if ( typeof GM_listValues != 'function' ) {
  1655. GM_listValues=function () {
  1656. var values = [];
  1657. for (var i=0; i<localStorage.length; i++) {
  1658. values.push(localStorage.key(i));
  1659. }
  1660. return values;
  1661. }
  1662. }
  1663. var clear_d = GM_listValues();
  1664. var clear_d_len = clear_d.length;
  1665. alert(clear_d);
  1666. for (var i=clear_d_len; i--;) {
  1667. if ( !clear_d[i].match(nick) ) {
  1668. GM_deleteValue(clear_d[i]);
  1669. }
  1670. }
  1671. }
  1672.  
  1673. function check_gre_f()
  1674. {
  1675. if ( $('hwm_gre_check_id').checked == true ) {
  1676. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1677. hwmtimerestore["hwm_gre_check"] = '1';
  1678. } else {
  1679. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1680. hwmtimerestore["hwm_gre_check"] = '0';
  1681. }
  1682. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1683. }
  1684.  
  1685. function hwm_trudogolik_show_f()
  1686. {
  1687. if ( $('hwm_trudogolik_show_id').checked == true ) {
  1688. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1689. hwmtimerestore["hwm_time_work_trudogolik_show"] = '1';
  1690. } else {
  1691. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1692. hwmtimerestore["hwm_time_work_trudogolik_show"] = '0';
  1693. }
  1694. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1695. }
  1696.  
  1697. function hwm_trudogolik_off_f()
  1698. {
  1699. if ( $('hwm_trudogolik_off_id').checked == true ) {
  1700. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1701. hwmtimerestore["hwm_time_work_trudogolik_off"] = '1';
  1702. } else {
  1703. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1704. hwmtimerestore["hwm_time_work_trudogolik_off"] = '0';
  1705. }
  1706. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1707. }
  1708.  
  1709. function hwm_go_timer_hide_f()
  1710. {
  1711. if ( $('hwm_go_timer_hide_id').checked == true ) {
  1712. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1713. hwmtimerestore["hwm_go_timer_hide"] = '1';
  1714. } else {
  1715. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1716. hwmtimerestore["hwm_go_timer_hide"] = '0';
  1717. }
  1718. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1719. }
  1720.  
  1721. // +++++++++++++++++++++++++++++++++++
  1722.  
  1723. function hwm_gr_show_check_id_f()
  1724. {
  1725. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1726. if ( $('hwm_gr_show_check_id').checked == true ) {
  1727. hwmtimerestore["hwm_gr_show_check"] = '1';
  1728. $("gr_show1").style.display = $("gr_show2").style.display = '';
  1729. } else {
  1730. hwmtimerestore["hwm_gr_show_check"] = '0';
  1731. var title_gr = $('a_pers_w');
  1732. hwmtimerestore["hwm_time_work_alert"] = 'no';
  1733. title_gr.style.color = '#f5c137';
  1734. title_gr.title = work_alert_tn;
  1735. $("gr_show1").style.display = $("gr_show2").style.display = 'none';
  1736. }
  1737. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1738. }
  1739.  
  1740. function hwm_gk_show_check_id_f()
  1741. {
  1742. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1743. if ( $('hwm_gk_show_check_id').checked == true ) {
  1744. hwmtimerestore["hwm_gk_show_check"] = '1';
  1745. $("gk_show1").style.display = $("gk_show2").style.display = '';
  1746. } else {
  1747. hwmtimerestore["hwm_gk_show_check"] = '0';
  1748. var title_sm = $('a_pers_sm');
  1749. hwmtimerestore["hwm_time_sm_alert"] = 'no';
  1750. title_sm.style.color = '#f5c137';
  1751. title_sm.title = sm_alert_tn;
  1752. $("gk_show1").style.display = $("gk_show2").style.display = 'none';
  1753. }
  1754. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1755. }
  1756.  
  1757. function hwm_gn_show_check_id_f()
  1758. {
  1759. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1760. if ( $('hwm_gn_show_check_id').checked == true ) {
  1761. hwmtimerestore["hwm_gn_show_check"] = '1';
  1762. $("gn_show1").style.display = $("gn_show2").style.display = '';
  1763. } else {
  1764. hwmtimerestore["hwm_gn_show_check"] = '0';
  1765. var title_gn = $('a_pers_gn');
  1766. hwmtimerestore["hwm_time_gn_alert"] = 'no';
  1767. title_gn.style.color = '#f5c137';
  1768. title_gn.title = gn_alert_tn;
  1769. $("gn_show1").style.display = $("gn_show2").style.display = 'none';
  1770. }
  1771. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1772. }
  1773.  
  1774. function hwm_go_show_check_id_f()
  1775. {
  1776. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1777. if ( $('hwm_go_show_check_id').checked == true ) {
  1778. hwmtimerestore["hwm_go_show_check"] = '1';
  1779. $("go_show1").style.display = $("go_show2").style.display = '';
  1780. } else {
  1781. hwmtimerestore["hwm_go_show_check"] = '0';
  1782. var title_go = $('a_pers_go');
  1783. hwmtimerestore["hwm_time_go_alert"] = 'no';
  1784. title_go.style.color = '#f5c137';
  1785. title_go.title = go_alert_tn;
  1786. $("go_show1").style.display = $("go_show2").style.display = 'none';
  1787. }
  1788. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1789. }
  1790.  
  1791. function hwm_gv_show_check_id_f()
  1792. {
  1793. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1794. if ( $('hwm_gv_show_check_id').checked == true ) {
  1795. hwmtimerestore["hwm_gv_show_check"] = '1';
  1796. $("gv_show1").style.display = $("gv_show2").style.display = '';
  1797. } else {
  1798. hwmtimerestore["hwm_gv_show_check"] = '0';
  1799. var title_gv = $('a_pers_gv');
  1800. hwmtimerestore["hwm_time_gv_alert"] = 'no';
  1801. title_gv.style.color = '#f5c137';
  1802. title_gv.title = gv_alert_tn;
  1803. $("gv_show1").style.display = $("gv_show2").style.display = 'none';
  1804. }
  1805. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1806. }
  1807.  
  1808. // -----------------------------------
  1809.  
  1810. function open_transfer_f()
  1811. {
  1812. if ( location.href.match('lordswm') )
  1813. {
  1814. window.location = "transfer.php?nick=demin&shortcomment=Transferred 10000 Gold 5 Diamonds";
  1815. } else {
  1816. window.location = "transfer.php?nick=demin&shortcomment=%CF%E5%F0%E5%E4%E0%ED%EE%2010000%20%C7%EE%EB%EE%F2%EE%205%20%C1%F0%E8%EB%EB%E8%E0%ED%F2%FB";
  1817. }
  1818. }
  1819.  
  1820. function ClientHeight() {
  1821. return document.compatMode=='CSS1Compat' && document.documentElement?document.documentElement.clientHeight:document.body.clientHeight;
  1822. }
  1823.  
  1824. function ClientWidth() {
  1825. return document.compatMode=='CSS1Compat' && document.documentElement?document.documentElement.clientWidth:document.body.clientWidth;
  1826. }
  1827.  
  1828. function ScrollHeight() {
  1829. return Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);
  1830. }
  1831.  
  1832. function $(id) { return document.querySelector("#"+id); }
  1833.  
  1834. function addEvent(elem, evType, fn) {
  1835. if (elem.addEventListener) {
  1836. elem.addEventListener(evType, fn, false);
  1837. }
  1838. else if (elem.attachEvent) {
  1839. elem.attachEvent("on" + evType, fn);
  1840. }
  1841. else {
  1842. elem["on" + evType] = fn;
  1843. }
  1844. }
  1845.  
  1846. 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)}}}
  1847.  
  1848. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement