hwm_time_restore

Таймеры гильдии рабочих, воров, наёмников, рейнджеров, охотников, кузнецов, лидеров, стражей, восстановления здоровья и маны

当前为 2023-02-01 提交的版本,查看 最新版本

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