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