hwm_time_restore

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

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

  1. // ==UserScript==
  2. // @name hwm_time_restore
  3. // @author Demin
  4. // @namespace Demin_92571
  5. // @description Таймеры гильдии рабочих, воров, наёмников, рейнджеров, охотников, кузнецов, лидеров, стражей, восстановления здоровья и маны
  6. // @homepage https://greasyfork.org/en/users/38514
  7. // @icon http://i.imgur.com/LZJFLgt.png
  8. // @version 6.4.3
  9. // @encoding utf-8
  10. // @include /^https{0,1}:\/\/((www|qrator|my)\.(heroeswm|lordswm)\.(ru|com)|178\.248\.235\.15)\/.+/
  11. // @exclude /^https{0,1}:\/\/((www|qrator|my)\.(heroeswm|lordswm)\.(ru|com)|178\.248\.235\.15)\/(login|cgame|campaign|frames|chat|ch ato nline|ch_box|chat_line|ticker|chatpost|rightcol|brd|frames)\.php.*/
  12. // @include /.*my\.lordswm\.com.*/
  13. // @exclude /.*my\.lordswm\.com(login|cgame|campaign|war|frames)\.php.*/
  14. // @exclude */rightcol.php*
  15. // @exclude */ch_box.php*
  16. // @exclude */chat*
  17. // @exclude */ticker.html*
  18. // @exclude */frames*
  19. // @exclude */brd.php*
  20. // @grant GM_deleteValue
  21. // @grant GM_getValue
  22. // @grant GM_listValues
  23. // @grant GM_setValue
  24. // @grant GM_addStyle
  25. // @grant GM_log
  26. // @grant GM_openInTab
  27. // ==/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. /* for ( var i=temp_nl.length, temp_parent, temp_child; i--; ) {
  1109. temp_parent = temp_nl[i];
  1110. while ( temp_parent.tagName != 'TR' ) { temp_parent = temp_parent.parentNode; }
  1111. if ( temp_parent.parentNode.querySelector("a[href^='map.php?action=skip']") ) break;
  1112. temp_parent = temp_parent.nextSibling;
  1113. temp_child = temp_parent.firstChild.innerHTML;
  1114. temp_parent.innerHTML = '<td colspan="2" align="left" width="100%"><table border="0" width="100%"><tbody><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td align="center">'+temp_child+'</td><td align="right" valign="top"><a href="map.php?action=skip">'+( url.match('lordswm') ? "Pass by " : "Пройти мимо" )+'</a>&nbsp;</td></tr></tbody></table></td>';
  1115. } */
  1116. }
  1117.  
  1118. //var hunt_block_div = document.getElementById('map_hunt_block_div');
  1119. //alert (hunt_block_div.innerHTML);
  1120. if ( b.innerHTML.match( regexp_go_timer ) && ( delta2 = /MapHunterDelta = (\d+)/.exec( b.innerHTML ) ) ) {
  1121. hwmtimerestore["hwm_map_hunter"] = 'false';
  1122. hwmtimerestore["hwm_time_go_end"] = '' + ( time_cur + delta2[1]*1000 );
  1123. hwmtimerestore["hwm_time_go_end_yes"] = 'no';
  1124.  
  1125. //+ Copyright (c) demin ( http://www.heroeswm.ru/pl_info.php?id=15091 )
  1126.  
  1127. if ( hwmtimerestore["hwm_go_timer_hide"] == '1' ) {
  1128. function inj_314() {
  1129. window["Refresh2"] = function () {}
  1130. var temp_314 = document.getElementById('next_ht');
  1131. while ( temp_314.tagName != 'TABLE' ) { temp_314 = temp_314.parentNode; }
  1132. temp_314.parentNode.removeChild( temp_314.previousSibling );
  1133. temp_314.parentNode.removeChild( temp_314.previousSibling );
  1134. temp_314.parentNode.removeChild( temp_314 );
  1135. }
  1136.  
  1137. var elem = document.createElement('script');
  1138. elem.type = "text/javascript";
  1139. elem.innerHTML = inj_314.toString()+"inj_314()";
  1140. document.querySelector("head").appendChild(elem);
  1141. }
  1142.  
  1143. //- Copyright (c)
  1144.  
  1145. }
  1146.  
  1147. var go_link_action_attack = document.querySelectorAll("a[href^='map.php?action=attack']");
  1148. for ( var i=go_link_action_attack.length; i--; ) {
  1149.  
  1150. addEvent
  1151. (
  1152. go_link_action_attack[i],
  1153. "click",
  1154. function( event )
  1155. {
  1156. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1157. hwmtimerestore["hwm_map_hunter"] = 'true';
  1158. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1159. }
  1160. );
  1161. }
  1162.  
  1163. var go_link_action_skip = document.querySelectorAll("a[href^='map.php?action=skip']");
  1164. for ( var i=go_link_action_skip.length; i--; ) {
  1165.  
  1166. addEvent
  1167. (
  1168. go_link_action_skip[i],
  1169. "click",
  1170. function( event )
  1171. {
  1172. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1173. hwmtimerestore["hwm_time_go_end_yes"] = 'no';
  1174. var time_cur_now = new Date().getTime();
  1175.  
  1176. if ( time_server && ( new Date( time_server.getTime() + time_cur_now - time_cur ).getHours() ) < 8 )
  1177. {
  1178. 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 );
  1179. } else {
  1180. 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 );
  1181. }
  1182.  
  1183. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1184. }
  1185. );
  1186. }
  1187.  
  1188. var go_link_help = document.querySelectorAll("a[onclick^='return print_friends']");
  1189. for ( var i=go_link_help.length; i--; ) {
  1190.  
  1191. addEvent
  1192. (
  1193. go_link_help[i],
  1194. "click",
  1195. function( event )
  1196. {
  1197. setTimeout(function() { go_link_help_click(); }, 200);
  1198. }
  1199. );
  1200. }
  1201.  
  1202. if ( b.innerHTML.match( regexp_map_go ) && hwmtimerestore["hwm_time_go_end"] == '1310000000000' ) {
  1203. hwmtimerestore["hwm_time_go_end_yes"] = 'no';
  1204. var time_cur_now = new Date().getTime();
  1205.  
  1206. if ( time_server && ( new Date( time_server.getTime() + time_cur_now - time_cur ).getHours() ) < 8 )
  1207. {
  1208. 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 );
  1209. } else {
  1210. 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 );
  1211. }
  1212. }
  1213.  
  1214.  
  1215. }
  1216.  
  1217. if (location.pathname === '/leader_guild.php'){
  1218. var glTasksRegExp = (!url.match("lordswm")) ? /Доступно\sзаданий:\s(\d\sиз\s\d)/ : /Challenges\savailable:\s(\d\sof\s\d)/,
  1219. glTasksMatch = documentInnerHTML.match(glTasksRegExp),
  1220. glTasksAvailable = (glTasksMatch) ? parseInt(glTasksMatch[1].split(" ")[0]) : "?",
  1221. glTasksTotal = (glTasksMatch) ? parseInt(glTasksMatch[1].split(" ")[2]) : "?",
  1222. glTimeCurrentMatch = documentInnerHTML.match(/var\sDelta2\s=\s(\d+);/),
  1223. glTimeCurrent = (glTimeCurrentMatch) ? parseInt(glTimeCurrentMatch[1]) : "?",
  1224. glTimeEnd = (glTasksAvailable !== "?" && glTasksTotal !== "?" && glTimeCurrent !== "?") ? (time_cur + glTimeCurrent*1000 + (glTasksTotal-glTasksAvailable-1)*10800000).toString() : "1300000000000",
  1225. glSpecialCompleted = (!url.match("lordswm")) ? documentInnerHTML.indexOf("Опасная цель устранена") !== -1 : documentInnerHTML.indexOf("Dangerous target eliminated") !== -1,
  1226. glSpecialDateOnServer = getCurrentFullDateOnServer();
  1227. hwmtimerestore["hwm_time_gl_end"] = glTimeEnd;
  1228. hwmtimerestore["hwm_gl_special_completed"] = glSpecialCompleted;
  1229. hwmtimerestore["hwm_gl_special_date_on_server"] = glSpecialDateOnServer;
  1230.  
  1231. if (glTasksAvailable < glTasksTotal){hwmtimerestore["hwm_time_gl_end_yes"] = 'no';}
  1232. GM_setValue(nick + "hwmtimerestore", JSON.stringify(hwmtimerestore));
  1233. }
  1234.  
  1235. if (location.pathname === '/task_guild.php'){
  1236. var starsGainedArr = document.querySelectorAll("img[src*='/i/zvezda.png']"),
  1237. starsLeftArr = document.querySelectorAll("img[src*='/i/zvezda_empty.png']"),
  1238. starsGained = (starsGainedArr) ? starsGainedArr.length : 0,
  1239. starsLeft = (starsLeftArr) ? starsLeftArr.length : 0,
  1240. starsTotal = starsGained + starsLeft,
  1241. currentTasksDateOnServer = getCurrentFullDateOnServer(),
  1242. allTasksDoneText = (!url.match("lordswm")) ? "Ты отлично поработал" : "Excellent work";
  1243. if (documentInnerHTML.indexOf(allTasksDoneText) !== -1){starsTotal = starsGained;}
  1244.  
  1245. hwmtimerestore["hwm_gs_stars_gained"] = starsGained.toString();
  1246. hwmtimerestore["hwm_gs_stars_total"] = starsTotal.toString();
  1247. hwmtimerestore["hwm_gs_current_gs_tasks_date_on_server"] = currentTasksDateOnServer;
  1248. GM_setValue(nick + "hwmtimerestore", JSON.stringify(hwmtimerestore));
  1249. }
  1250.  
  1251.  
  1252. //==================================================================
  1253.  
  1254.  
  1255. var title_hl = $('pers_h');
  1256. addEvent
  1257. (
  1258. title_hl,
  1259. "click",
  1260. function( event )
  1261. {
  1262. if ( hwmtimerestore["hwm_time_health_alert"] == 'yes' )
  1263. {
  1264. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1265. hwmtimerestore["hwm_time_health_alert"] = 'no';
  1266. title_hl.style.color = '#f5c137';
  1267. title_hl.title = health_alert_tn;
  1268. } else
  1269. {
  1270. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1271. hwmtimerestore["hwm_time_health_alert"] = 'yes';
  1272. title_hl.style.color = '#ff9c00';
  1273. title_hl.title = health_alert_ty;
  1274. }
  1275. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1276. }
  1277. );
  1278.  
  1279. if ( hwmtimerestore["hwm_time_health_alert"] == 'yes' )
  1280. {
  1281. title_hl.style.color = '#ff9c00';
  1282. title_hl.title = health_alert_ty;
  1283. } else
  1284. {
  1285. title_hl.title = health_alert_tn;
  1286. }
  1287.  
  1288. var title_gr = $('a_pers_w');
  1289. addEvent
  1290. (
  1291. title_gr,
  1292. "click",
  1293. function( event )
  1294. {
  1295. if ( hwmtimerestore["hwm_time_work_alert"] == 'yes' )
  1296. {
  1297. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1298. hwmtimerestore["hwm_time_work_alert"] = 'no';
  1299. title_gr.style.color = '#f5c137';
  1300. title_gr.title = work_alert_tn;
  1301. } else
  1302. {
  1303. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1304. hwmtimerestore["hwm_time_work_alert"] = 'yes';
  1305. title_gr.style.color = '#FF0000';
  1306. title_gr.title = work_alert_ty;
  1307. }
  1308. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1309. }
  1310. );
  1311.  
  1312. if ( hwmtimerestore["hwm_time_work_alert"] == 'yes' )
  1313. {
  1314. title_gr.style.color = '#FF0000';
  1315. title_gr.title = work_alert_ty;
  1316. } else
  1317. {
  1318. title_gr.title = work_alert_tn;
  1319. }
  1320.  
  1321. var title_sm = $('a_pers_sm');
  1322. addEvent
  1323. (
  1324. title_sm,
  1325. "click",
  1326. function( event )
  1327. {
  1328. if ( hwmtimerestore["hwm_time_sm_alert"] == 'yes' )
  1329. {
  1330. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1331. hwmtimerestore["hwm_time_sm_alert"] = 'no';
  1332. title_sm.style.color = '#f5c137';
  1333. title_sm.title = sm_alert_tn;
  1334. } else
  1335. {
  1336. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1337. hwmtimerestore["hwm_time_sm_alert"] = 'yes';
  1338. title_sm.style.color = '#FF0000';
  1339. title_sm.title = sm_alert_ty;
  1340. }
  1341. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1342. }
  1343. );
  1344.  
  1345. if ( hwmtimerestore["hwm_time_sm_alert"] == 'yes' )
  1346. {
  1347. title_sm.style.color = '#FF0000';
  1348. title_sm.title = sm_alert_ty;
  1349. } else
  1350. {
  1351. title_sm.title = sm_alert_tn;
  1352. }
  1353.  
  1354. var title_gn = $('a_pers_gn');
  1355. addEvent
  1356. (
  1357. title_gn,
  1358. "click",
  1359. function( event )
  1360. {
  1361. if ( hwmtimerestore["hwm_time_gn_alert"] == 'yes' )
  1362. {
  1363. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1364. hwmtimerestore["hwm_time_gn_alert"] = 'no';
  1365. title_gn.style.color = '#f5c137';
  1366. title_gn.title = gn_alert_tn;
  1367. } else
  1368. {
  1369. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1370. hwmtimerestore["hwm_time_gn_alert"] = 'yes';
  1371. title_gn.style.color = '#FF0000';
  1372. title_gn.title = gn_alert_ty;
  1373. }
  1374. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1375. }
  1376. );
  1377.  
  1378. if ( hwmtimerestore["hwm_time_gn_alert"] == 'yes' )
  1379. {
  1380. title_gn.style.color = '#FF0000';
  1381. title_gn.title = gn_alert_ty;
  1382. } else
  1383. {
  1384. title_gn.title = gn_alert_tn;
  1385. }
  1386.  
  1387. var title_go = $('a_pers_go');
  1388. addEvent
  1389. (
  1390. title_go,
  1391. "click",
  1392. function( event )
  1393. {
  1394. if ( hwmtimerestore["hwm_time_go_alert"] == 'yes' )
  1395. {
  1396. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1397. hwmtimerestore["hwm_time_go_alert"] = 'no';
  1398. title_go.style.color = '#f5c137';
  1399. title_go.title = go_alert_tn;
  1400. } else
  1401. {
  1402. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1403. hwmtimerestore["hwm_time_go_alert"] = 'yes';
  1404. title_go.style.color = '#FF0000';
  1405. title_go.title = go_alert_ty;
  1406. }
  1407. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1408. }
  1409. );
  1410.  
  1411. if ( hwmtimerestore["hwm_time_go_alert"] == 'yes' )
  1412. {
  1413. title_go.style.color = '#FF0000';
  1414. title_go.title = go_alert_ty;
  1415. } else
  1416. {
  1417. title_go.title = go_alert_tn;
  1418. }
  1419.  
  1420. var title_gv = $('a_pers_gv');
  1421. addEvent
  1422. (
  1423. title_gv,
  1424. "click",
  1425. function( event )
  1426. {
  1427. if ( hwmtimerestore["hwm_time_gv_alert"] == 'yes' )
  1428. {
  1429. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1430. hwmtimerestore["hwm_time_gv_alert"] = 'no';
  1431. title_gv.style.color = '#f5c137';
  1432. title_gv.title = gv_alert_tn;
  1433. } else
  1434. {
  1435. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1436. hwmtimerestore["hwm_time_gv_alert"] = 'yes';
  1437. title_gv.style.color = '#FF0000';
  1438. title_gv.title = gv_alert_ty;
  1439. }
  1440. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1441. }
  1442. );
  1443.  
  1444. if ( hwmtimerestore["hwm_time_gv_alert"] == 'yes' )
  1445. {
  1446. title_gv.style.color = '#FF0000';
  1447. title_gv.title = gv_alert_ty;
  1448. } else
  1449. {
  1450. title_gv.title = gv_alert_tn;
  1451. }
  1452.  
  1453. var title_gl = $('a_pers_gl');
  1454. addEvent
  1455. (
  1456. title_gl,
  1457. "click",
  1458. function( event )
  1459. {
  1460. if ( hwmtimerestore["hwm_time_gl_alert"] == 'yes' )
  1461. {
  1462. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1463. hwmtimerestore["hwm_time_gl_alert"] = 'no';
  1464. title_gl.style.color = '#f5c137';
  1465. title_gl.title = gl_alert_tn;
  1466. } else
  1467. {
  1468. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1469. hwmtimerestore["hwm_time_gl_alert"] = 'yes';
  1470. title_gl.style.color = '#FF0000';
  1471. title_gl.title = gl_alert_ty;
  1472. }
  1473. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1474. }
  1475. );
  1476.  
  1477. if ( hwmtimerestore["hwm_time_gl_alert"] == 'yes' )
  1478. {
  1479. title_gl.style.color = '#FF0000';
  1480. title_gl.title = gl_alert_ty;
  1481. } else
  1482. {
  1483. title_gl.title = gl_alert_tn;
  1484. }
  1485.  
  1486. //==================================================================
  1487.  
  1488. if (vh) {
  1489. if (vh.parentNode.innerHTML.match(/var time_heart=(\d+);/)) {
  1490. var heart_scale = RegExp.$1;
  1491. var time_l = Math.floor( ( heart_scale * 1000 / 100 ) * ( 100 - army_percent ) );
  1492. time.h = Math.floor( time_l / 1000 );
  1493. if ( army_percent < 100 ) showtime( 'h' );
  1494. }
  1495. }
  1496.  
  1497. /*var vs = document.querySelector("object > param[value*='heart.swf']");
  1498. if ( vs ) vs = vs.parentNode.querySelector("param[name='FlashVars']");
  1499. if ( vs ) {
  1500. vs = vs.value.split('|');
  1501. var cur = vs[0].split('=')[1];
  1502. var time_l = Math.floor( ( vs[1] * 1000 / 100 ) * ( 100 - cur ) );
  1503. time.h = Math.floor( time_l / 1000 );
  1504. if ( cur < 100 && vs[2] > 0 ) showtime( 'h' );
  1505. }
  1506.  
  1507. var vs = document.querySelector("object > param[value*='mana.swf']");
  1508. if ( vs ) vs = vs.parentNode.querySelector("param[name='FlashVars']");
  1509. if ( vs ) {
  1510. vs = vs.value.split('|');
  1511. var cur = vs[0].split('=')[1];
  1512. var time_l = Math.floor( ( ( vs[1] / 100 ) * vs[2] * 1000 / 100 ) * ( 100 - cur ) );
  1513. time.m = Math.floor( time_l / 1000 );
  1514. if ( cur < 100 && vs[2] > 0 ) showtime( 'm' );
  1515. }*/
  1516.  
  1517.  
  1518. if ( time_cur < ( time_work_end = Number( hwmtimerestore["hwm_time_work_end"] ) ) )
  1519. {
  1520. time.w = Math.floor( ( time_work_end - time_cur ) / 1000 );
  1521. if ( time.w < 3601 ) { showtime( 'w' ); } else { hwmtimerestore["hwm_time_work_end"] = '1300000000000'; hwmtimerestore["hwm_time_work_end_yes"] = 'yes'; }
  1522. } else { hwmtimerestore["hwm_time_work_end"] = '1300000000000'; hwmtimerestore["hwm_time_work_end_yes"] = 'yes'; }
  1523.  
  1524.  
  1525. if ( time_cur < ( time_sm_end = Number( hwmtimerestore["hwm_time_sm_end"] ) ) )
  1526. {
  1527. time.sm = Math.floor( ( time_sm_end - time_cur ) / 1000 );
  1528. showtime( 'sm' );
  1529. } else { hwmtimerestore["hwm_time_sm_end"] = '1300000000000'; hwmtimerestore["hwm_time_sm_end_yes"] = 'yes'; }
  1530.  
  1531.  
  1532. if ( time_cur < ( time_gn_end = Number( hwmtimerestore["hwm_time_gn_end"] ) ) )
  1533. {
  1534. time.gn = Math.floor( ( time_gn_end - time_cur ) / 1000 );
  1535. if ( time.gn < 54000 ) { showtime( 'gn' ); } else { hwmtimerestore["hwm_time_gn_end"] = '1300000000000'; hwmtimerestore["hwm_time_gn_end_yes"] = 'yes'; }
  1536. } else { hwmtimerestore["hwm_time_gn_end"] = '1300000000000'; hwmtimerestore["hwm_time_gn_end_yes"] = 'yes'; }
  1537.  
  1538.  
  1539. if ( time_cur < ( time_go_end = Number( hwmtimerestore["hwm_time_go_end"] ) ) )
  1540. {
  1541. time.go = Math.floor( ( time_go_end - time_cur ) / 1000 );
  1542. if ( time.go < 2401 ) { showtime( 'go' ); } else { hwmtimerestore["hwm_time_go_end"] = '1300000000000'; hwmtimerestore["hwm_time_go_end_yes"] = 'yes'; }
  1543. }// else { hwmtimerestore["hwm_time_go_end"] = '1300000000000'; hwmtimerestore["hwm_time_go_end_yes"] = 'yes'; }
  1544.  
  1545.  
  1546. if ( time_cur < ( time_gv_end = Number( hwmtimerestore["hwm_time_gv_end"] ) ) )
  1547. {
  1548. time.gv = Math.floor( ( time_gv_end - time_cur ) / 1000 );
  1549. if ( time.gv < 3601 ) { showtime( 'gv' ); } else { hwmtimerestore["hwm_time_gv_end"] = '1300000000000'; hwmtimerestore["hwm_time_gv_end_yes"] = 'yes'; }
  1550. } else { hwmtimerestore["hwm_time_gv_end"] = '1300000000000'; hwmtimerestore["hwm_time_gv_end_yes"] = 'yes'; }
  1551.  
  1552.  
  1553. if ( time_cur < ( time_gl_end = Number( hwmtimerestore["hwm_time_gl_end"] )) )
  1554. {
  1555. time.gl = Math.floor( ( time_gl_end - time_cur ) / 1000 );
  1556. if ( time.gl < 64800 ) { showtime( 'gl' ); } else { hwmtimerestore["hwm_time_gl_end"] = '1300000000000'; hwmtimerestore["hwm_time_gl_end_yes"] = 'no';}
  1557. } else { hwmtimerestore["hwm_time_gl_end"] = '1300000000000'; hwmtimerestore["hwm_time_gl_end_yes"] = 'no';}
  1558.  
  1559. var pers_gl_special = $('pers_gl_special');
  1560. if (hwmtimerestore["hwm_gl_special_completed"]){ // если спецзадание выполнено
  1561. if (hwmtimerestore["hwm_gl_special_date_on_server"] !== getCurrentFullDateOnServer()){ // если данные о спецзадании невалидны по времени, обнуляем
  1562. hwmtimerestore["hwm_gl_special_completed"] = "false";
  1563. } else{ // иначе показываем выполнение
  1564. pers_gl_special.innerText = "(+)";
  1565. }
  1566. }
  1567.  
  1568. if (hwmtimerestore["hwm_gs_stars_total"]){ // если данные о звёздах вообще есть
  1569. if (hwmtimerestore["hwm_gs_current_gs_tasks_date_on_server"] !== getCurrentFullDateOnServer()){ // если данные о звёздах невалидны по времени, обнуляем
  1570. hwmtimerestore["hwm_gs_stars_gained"] = "0";
  1571. }
  1572. // вне зависимости от валидности полученных звёзд показываем счётчк с последним запомненным кол-вом звёзд всего
  1573. $("pers_gs").innerText = hwmtimerestore["hwm_gs_stars_gained"] + "/" + hwmtimerestore["hwm_gs_stars_total"];
  1574. }
  1575.  
  1576.  
  1577. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1578. }
  1579.  
  1580.  
  1581. function showtime( t )
  1582. {
  1583. //UPD. recalculate dateTime every loop cycle
  1584. var time_cur = new Date().getTime();
  1585. time.w = Math.floor( ( Number( hwmtimerestore["hwm_time_work_end"] ) - time_cur ) / 1000 );
  1586. time.sm = Math.floor( ( Number( hwmtimerestore["hwm_time_sm_end"] ) - time_cur ) / 1000 );
  1587. time.gn = Math.floor( ( Number( hwmtimerestore["hwm_time_gn_end"] ) - time_cur ) / 1000 );
  1588. time.go = Math.floor( ( Number( hwmtimerestore["hwm_time_go_end"] ) - time_cur ) / 1000 );
  1589. time.gv = Math.floor( ( Number( hwmtimerestore["hwm_time_gv_end"] ) - time_cur ) / 1000 );
  1590. time.gl = Math.floor( ( Number( hwmtimerestore["hwm_time_gl_end"] ) - time_cur ) / 1000 );
  1591. //End. recalculate dateTime
  1592.  
  1593. var el = $( 'pers_' + t ),
  1594. ct_gl_correction = 0;
  1595. if ( t == 'h' )
  1596. {
  1597. var ct = --time.h;
  1598. } else if ( t == 'm' )
  1599. {
  1600. var ct = --time.m;
  1601. } else if ( t == 'w' )
  1602. {
  1603. var ct = --time.w;
  1604. } else if ( t == 'gn' )
  1605. {
  1606. var ct = --time.gn;
  1607. } else if ( t == 'go' )
  1608. {
  1609. var ct = --time.go;
  1610. } else if ( t == 'sm' )
  1611. {
  1612. var ct = --time.sm;
  1613. } else if ( t == 'gv' )
  1614. {
  1615. var ct = --time.gv;
  1616. } else if ( t == 'gl' )
  1617. {
  1618. var ct = --time.gl;
  1619. ct_gl_correction = parseInt(hwmtimerestore["hwm_time_gl_alert_mins_before"])*60;
  1620. }
  1621. var dd = Math.floor( ct / 86400 );
  1622. var dh = Math.floor( ( ct - dd * 86400 ) / 3600 );
  1623. var dm = Math.floor( ( ct - dd * 86400 - dh * 3600 ) / 60 );
  1624. var ds = ct % 60;
  1625. el.innerHTML = ( dd == 0 ? '' : ( (dd < 10) ? '0' : '' ) + dd + ':' ) + ( dd == 0 && dh == 0 ? '' : ( (dh < 10) ? '0' : '' ) + dh + ':' ) + ( (dm < 10) ? '0' : '' ) + dm + ':' + ( (ds < 10) ? '0' : '') + ds;
  1626.  
  1627. if ( ct == 0 || (ct_gl_correction > 0 && ct < ct_gl_correction))
  1628. {
  1629. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1630.  
  1631. if ( t == 'h' )
  1632. {
  1633. title_hl.style.color = '#f5c137';
  1634. title_hl.title = health_alert_tn;
  1635. if ( hwmtimerestore["hwm_time_health_alert"] == 'yes' )
  1636. {
  1637. hwmtimerestore["hwm_time_health_alert"] = 'no';
  1638. setTimeout(function() { alert( alert_health ); }, 100);
  1639. }
  1640. }
  1641. if ( t == 'w' && hwmtimerestore["hwm_time_work_end_yes"] != 'yes' && hwmtimerestore["hwm_time_work_alert"] == 'yes' )
  1642. {
  1643. hwmtimerestore["hwm_time_work_end_yes"] = 'yes';
  1644. new Audio('https://www.soundjay.com/phone/telephone-ring-03a.mp3').play();
  1645. setTimeout(function() { alert( alert_work ); }, 100);
  1646. }
  1647. if ( t == 'sm' && hwmtimerestore["hwm_time_sm_end_yes"] != 'yes' && hwmtimerestore["hwm_time_sm_alert"] == 'yes' )
  1648. {
  1649. hwmtimerestore["hwm_time_sm_end_yes"] = 'yes';
  1650. new Audio('https://www.soundjay.com/phone/telephone-ring-03a.mp3').play();
  1651. setTimeout(function() { alert( alert_sm ); }, 100);
  1652. }
  1653. if ( t == 'gn' && hwmtimerestore["hwm_time_gn_end_yes"] != 'yes' && hwmtimerestore["hwm_time_gn_alert"] == 'yes' )
  1654. {
  1655. hwmtimerestore["hwm_time_gn_end_yes"] = 'yes';
  1656. new Audio('https://www.soundjay.com/phone/telephone-ring-03a.mp3').play();
  1657. setTimeout(function() { alert( alert_gn ); }, 100);
  1658. }
  1659. if ( t == 'go' && hwmtimerestore["hwm_time_go_end_yes"] != 'yes' && hwmtimerestore["hwm_time_go_alert"] == 'yes' )
  1660. {
  1661. hwmtimerestore["hwm_time_go_end_yes"] = 'yes';
  1662. new Audio('https://www.soundjay.com/phone/telephone-ring-03a.mp3').play();
  1663. setTimeout(function() { alert( alert_go ); }, 100);
  1664. }
  1665. if ( t == 'gv' && hwmtimerestore["hwm_time_gv_end_yes"] != 'yes' && hwmtimerestore["hwm_time_gv_alert"] == 'yes' )
  1666. {
  1667. hwmtimerestore["hwm_time_gv_end_yes"] = 'no';
  1668. new Audio('https://www.soundjay.com/phone/telephone-ring-03a.mp3').play();
  1669. setTimeout(function() { alert( alert_gv ); }, 100);
  1670. }
  1671.  
  1672. if ( t == 'gl' && hwmtimerestore["hwm_time_gl_end_yes"] != 'yes' && hwmtimerestore["hwm_time_gl_alert"] == 'yes' )
  1673. {
  1674. hwmtimerestore["hwm_time_gl_end_yes"] = 'yes';
  1675. new Audio('https://www.soundjay.com/phone/telephone-ring-03a.mp3').play();
  1676. setTimeout(function() { alert( alert_gl ); }, 100);
  1677. }
  1678.  
  1679. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1680. if (!(ct_gl_correction > 0 && ct < ct_gl_correction)){return;}
  1681. }
  1682. if ( ct < 0 )
  1683. {
  1684. el.innerHTML = '00:00';
  1685. return;
  1686. }
  1687. setTimeout( function() { showtime( t ) }, 999 );
  1688. }
  1689.  
  1690. function settings_close()
  1691. {
  1692. var bg = $('bgOverlay');
  1693. var bgc = $('bgCenter');
  1694. bg.parentNode.removeChild(bg);
  1695. bgc.parentNode.removeChild(bgc);
  1696. }
  1697.  
  1698. function settings()
  1699. {
  1700. var bg = $('bgOverlay');
  1701. var bgc = $('bgCenter');
  1702. var bg_height = ScrollHeight();
  1703.  
  1704. if ( !bg )
  1705. {
  1706. bg = document.createElement('div');
  1707. document.body.appendChild( bg );
  1708.  
  1709. bgc = document.createElement('div');
  1710. document.body.appendChild( bgc );
  1711. }
  1712.  
  1713. bg.id = 'bgOverlay';
  1714. bg.style.position = 'absolute';
  1715. bg.style.left = '0px';
  1716. bg.style.width = '100%';
  1717. bg.style.background = "#000000";
  1718. bg.style.opacity = "0.5";
  1719. bg.style.zIndex = "1100";
  1720.  
  1721. bgc.id = 'bgCenter';
  1722. bgc.style.position = 'absolute';
  1723. bgc.style.left = ( ( ClientWidth() - 650 ) / 2 ) + 'px';
  1724. bgc.style.width = '650px';
  1725. bgc.style.background = "#F6F3EA";
  1726. bgc.style.zIndex = "1105";
  1727.  
  1728. addEvent(bg, "click", settings_close);
  1729.  
  1730. if ( url.match('lordswm') ) {
  1731.  
  1732. var st_start = 'All settings adjustments will apply after page is reloaded';
  1733. var st_null_timers = 'Reset all timers';
  1734. var st_clear_data = 'Delete other user settings';
  1735. var st_gv_n_time = 'Set TG/RG timer for once to';
  1736. var st_gv_n_time2 = 'minutes';
  1737. var st_percent_faster = 'Quests HG, MG, TG, RG more often';
  1738. var st_percent_faster2 = 'percent';
  1739. var gl_alert_mins_before = 'Notify about all LeG tasks availability';
  1740. var gl_alert_mins_before2 = 'minutes before';
  1741. var st_gre_check = 'Immediately initiate Rangers\' guild battle on arrival';
  1742. var st_show_timers = 'Show timers:';
  1743. var st_author = 'Script author';
  1744. var st_predupr_pa = '<b>Abu-Bakir\'s Charm</b> is detected automatically';
  1745. var st_work_trudogolik_show = 'Notify about workaholic penalty only 2 workshifts away';
  1746. var st_work_trudogolik_off = 'Turn off all notifications on workaholic penalty';
  1747. var st_predupr_go_lic = '<b>Hunter license</b> is detected automatically in Hunters\' Guild';
  1748. var st_go_timer_hide = 'Hide';
  1749.  
  1750. } else {
  1751.  
  1752. 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';
  1753. var st_null_timers = '\u041E\u0431\u043D\u0443\u043B\u0438\u0442\u044C \u0432\u0441\u0435 \u0442\u0430\u0439\u043C\u0435\u0440\u044B';
  1754. 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';
  1755. 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';
  1756. var st_gv_n_time2 = '\u043C\u0438\u043D\u0443\u0442';
  1757. 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';
  1758. var st_percent_faster2 = '\u043F\u0440\u043E\u0446\u0435\u043D\u0442\u043E\u0432';
  1759. var gl_alert_mins_before = 'Уведомлять о доступности всех заданий ГЛ за';
  1760. var gl_alert_mins_before2 = 'минут';
  1761. 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';
  1762. 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:';
  1763. var st_author = '\u0410\u0432\u0442\u043E\u0440 \u0441\u043A\u0440\u0438\u043F\u0442\u0430';
  1764. 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';
  1765. 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';
  1766. 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';
  1767. 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';
  1768. var st_go_timer_hide = '\u0421\u043A\u0440\u044B\u0432\u0430\u0442\u044C';
  1769.  
  1770. }
  1771.  
  1772. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1773.  
  1774. 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>'+
  1775. '<tr><td>'+st_start+'<br><br></td></tr>'+
  1776.  
  1777. '<tr><td>'+st_show_timers+
  1778. '&nbsp;&nbsp;'+gr_t+':<input type=checkbox '+(hwmtimerestore["hwm_gr_show_check"]!=="0"?"checked":"")+' id=hwm_gr_show_check_id title="">'+
  1779. '&nbsp;&nbsp;'+gk_t+':<input type=checkbox '+(hwmtimerestore["hwm_gk_show_check"]!=="0"?"checked":"")+' id=hwm_gk_show_check_id title="">'+
  1780. '&nbsp;&nbsp;'+gn_t+':<input type=checkbox '+(hwmtimerestore["hwm_gn_show_check"]!=="0"?"checked":"")+' id=hwm_gn_show_check_id title="">'+
  1781. '&nbsp;&nbsp;'+go_t+':<input type=checkbox '+(hwmtimerestore["hwm_go_show_check"]!=="0"?"checked":"")+' id=hwm_go_show_check_id title="">'+
  1782. '&nbsp;&nbsp;'+gv_t+' ('+gre_t+')'+':<input type=checkbox '+(hwmtimerestore["hwm_gv_show_check"]=="1"?"checked":"")+' id=hwm_gv_show_check_id title="">' +
  1783. '&nbsp;&nbsp;'+gl_t+':<input type=checkbox '+(hwmtimerestore["hwm_gl_show_check"]!=="0"?"checked":"")+' id=hwm_gl_show_check_id title="">'+
  1784. '&nbsp;&nbsp;'+gs_t+':<input type=checkbox '+(hwmtimerestore["hwm_gs_show_check"]!=="0"?"checked":"")+' id=hwm_gs_show_check_id title="">'+
  1785. '<br><br></td></tr>'+
  1786.  
  1787. '<tr><td>'+st_gre_check+': <input type=checkbox '+(hwmtimerestore["hwm_gre_check"]=="1"?"checked":"")+' id=hwm_gre_check_id title=""></td></tr>'+
  1788. '<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>'+
  1789.  
  1790. '<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>'+
  1791. '<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>'+
  1792.  
  1793. '<tr><td>'+st_predupr_pa+'</td></tr>'+
  1794.  
  1795. '<tr><td>'+st_predupr_go_lic+'</td></tr>'+
  1796.  
  1797. '<tr><td>'+st_percent_faster+' <input id="gv_n_percent" value="'+
  1798. ( 100 - hwmtimerestore["hwm_time_percent_faster"] * 100 )+
  1799. '" size="1" maxlength="2"> <b>'+st_percent_faster2+'</b> <input type="submit" id="gv_n_percent_ok" value="ok"></td></tr>'+
  1800.  
  1801. '<tr><td>'+st_gv_n_time+' <input id="gv_n_time" value="'+
  1802. ( 60 * hwmtimerestore["hwm_time_percent_faster"] * hwmtimerestore["hwm_time_percent_prem"] )+
  1803. '" size="1" maxlength="2"> '+st_gv_n_time2+' <input type="submit" id="gv_n_time_ok" value="ok"></td></tr>'+
  1804.  
  1805. '<tr><td>'+gl_alert_mins_before+' <input id="gl_alert_mins_before" value="'+
  1806. ( hwmtimerestore["hwm_time_gl_alert_mins_before"] )+
  1807. '" size="1" maxlength="2"> '+gl_alert_mins_before2+' <input type="submit" id="gl_alert_mins_before_ok" value="ok"><br><br></td></tr>'+
  1808.  
  1809. '<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>'+
  1810.  
  1811. '</table><table width=100%>'+
  1812. '<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>'+
  1813. '</table></div>';
  1814.  
  1815. addEvent($("bt_close_tr"), "click", settings_close);
  1816. addEvent($("null_tr_id"), "click", null_tr);
  1817. addEvent($("clear_data_id"), "click", clear_data);
  1818. addEvent($("gv_n_time_ok"), "click", gv_n_time_f);
  1819. addEvent($("gv_n_percent_ok"), "click", gv_n_percent_f);
  1820. addEvent($("gl_alert_mins_before_ok"), "click", gl_alert_mins_before_f);
  1821. addEvent($("hwm_gre_check_id"), "click", check_gre_f);
  1822. addEvent($("hwm_trudogolik_show_id"), "click", hwm_trudogolik_show_f);
  1823. addEvent($("hwm_trudogolik_off_id"), "click", hwm_trudogolik_off_f);
  1824. addEvent($("hwm_go_timer_hide_id"), "click", hwm_go_timer_hide_f);
  1825.  
  1826. addEvent($("hwm_gr_show_check_id"), "click", hwm_gr_show_check_id_f);
  1827. addEvent($("hwm_gk_show_check_id"), "click", hwm_gk_show_check_id_f);
  1828. addEvent($("hwm_gn_show_check_id"), "click", hwm_gn_show_check_id_f);
  1829. addEvent($("hwm_go_show_check_id"), "click", hwm_go_show_check_id_f);
  1830. addEvent($("hwm_gv_show_check_id"), "click", hwm_gv_show_check_id_f);
  1831. addEvent($("hwm_gl_show_check_id"), "click", hwm_gl_show_check_id_f);
  1832. addEvent($("hwm_gs_show_check_id"), "click", hwm_gs_show_check_id_f);
  1833. addEvent($("open_transfer_id"), "click", open_transfer_f);
  1834.  
  1835. bg.style.top = '0px';
  1836. bg.style.height = bg_height + 'px';
  1837. bgc.style.top = ( window.pageYOffset + 150 ) + 'px';
  1838. bg.style.display = '';
  1839. bgc.style.display = '';
  1840. }
  1841.  
  1842. function gv_n_time_f()
  1843. {
  1844. if ( Number( $("gv_n_time").value ) >= 0 ) {
  1845. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1846. hwmtimerestore["hwm_time_gv_end"] = '' + ( (new Date()).getTime() + $("gv_n_time").value * 60000 );
  1847. hwmtimerestore["hwm_time_gv_end_yes"] = 'no';
  1848. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1849. }
  1850. }
  1851.  
  1852. function gv_n_percent_f()
  1853. {
  1854. if ( Number( $("gv_n_percent").value ) >= 0 ) {
  1855. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1856. hwmtimerestore["hwm_time_percent_faster"] = '' + ( ( 100 - $("gv_n_percent").value )/100 );
  1857. $("gv_n_time").value = ( 60 * hwmtimerestore["hwm_time_percent_faster"] * hwmtimerestore["hwm_time_percent_prem"] );
  1858. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1859. }
  1860. }
  1861.  
  1862. function gl_alert_mins_before_f()
  1863. {
  1864. if ( Number( $("gl_alert_mins_before").value ) >= 0 ) {
  1865. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1866. hwmtimerestore["hwm_time_gl_alert_mins_before"] = $("gl_alert_mins_before").value;
  1867. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1868. }
  1869. }
  1870.  
  1871. function go_link_help_click()
  1872. {
  1873. var form_go_link_help = document.querySelectorAll("form[action='/map.php']");
  1874.  
  1875. for ( var i=form_go_link_help.length; i--; ) {
  1876. var input_form_go_link_help = form_go_link_help[i].querySelector("input[type='submit']");
  1877.  
  1878. addEvent
  1879. (
  1880. input_form_go_link_help,
  1881. "click",
  1882. function( event )
  1883. {
  1884. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1885. hwmtimerestore["hwm_map_hunter"] = 'true';
  1886. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1887. }
  1888. );
  1889. }
  1890. }
  1891.  
  1892. function null_tr()
  1893. {
  1894. // udalit' svoi nastrojki
  1895. if ( typeof GM_listValues != 'function' ) {
  1896. GM_listValues=function () {
  1897. var values = [];
  1898. for (var i=0; i<localStorage.length; i++) {
  1899. values.push(localStorage.key(i));
  1900. }
  1901. return values;
  1902. }
  1903. }
  1904. var clear_d = GM_listValues();
  1905. var clear_d_len = clear_d.length;
  1906. alert(clear_d);
  1907. for (var i=clear_d_len; i--;) {
  1908. if ( clear_d[i].match(nick) ) {
  1909. GM_deleteValue(clear_d[i]);
  1910. }
  1911. }
  1912. }
  1913.  
  1914. function clear_data()
  1915. {
  1916. // udalit' nastrojki drugih uzerov
  1917. if ( typeof GM_listValues != 'function' ) {
  1918. GM_listValues=function () {
  1919. var values = [];
  1920. for (var i=0; i<localStorage.length; i++) {
  1921. values.push(localStorage.key(i));
  1922. }
  1923. return values;
  1924. }
  1925. }
  1926. var clear_d = GM_listValues();
  1927. var clear_d_len = clear_d.length;
  1928. alert(clear_d);
  1929. for (var i=clear_d_len; i--;) {
  1930. if ( !clear_d[i].match(nick) ) {
  1931. GM_deleteValue(clear_d[i]);
  1932. }
  1933. }
  1934. }
  1935.  
  1936. function check_gre_f()
  1937. {
  1938. if ( $('hwm_gre_check_id').checked == true ) {
  1939. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1940. hwmtimerestore["hwm_gre_check"] = '1';
  1941. } else {
  1942. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1943. hwmtimerestore["hwm_gre_check"] = '0';
  1944. }
  1945. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1946. }
  1947.  
  1948. function hwm_trudogolik_show_f()
  1949. {
  1950. if ( $('hwm_trudogolik_show_id').checked == true ) {
  1951. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1952. hwmtimerestore["hwm_time_work_trudogolik_show"] = '1';
  1953. } else {
  1954. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1955. hwmtimerestore["hwm_time_work_trudogolik_show"] = '0';
  1956. }
  1957. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1958. }
  1959.  
  1960. function hwm_trudogolik_off_f()
  1961. {
  1962. if ( $('hwm_trudogolik_off_id').checked == true ) {
  1963. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1964. hwmtimerestore["hwm_time_work_trudogolik_off"] = '1';
  1965. } else {
  1966. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1967. hwmtimerestore["hwm_time_work_trudogolik_off"] = '0';
  1968. }
  1969. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1970. }
  1971.  
  1972. function hwm_go_timer_hide_f()
  1973. {
  1974. if ( $('hwm_go_timer_hide_id').checked == true ) {
  1975. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1976. hwmtimerestore["hwm_go_timer_hide"] = '1';
  1977. } else {
  1978. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1979. hwmtimerestore["hwm_go_timer_hide"] = '0';
  1980. }
  1981. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  1982. }
  1983.  
  1984. // +++++++++++++++++++++++++++++++++++
  1985.  
  1986. function hwm_gr_show_check_id_f()
  1987. {
  1988. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  1989. if ( $('hwm_gr_show_check_id').checked == true ) {
  1990. hwmtimerestore["hwm_gr_show_check"] = '1';
  1991. $("gr_show1").style.display = $("gr_show2").style.display = '';
  1992. } else {
  1993. hwmtimerestore["hwm_gr_show_check"] = '0';
  1994. var title_gr = $('a_pers_w');
  1995. hwmtimerestore["hwm_time_work_alert"] = 'no';
  1996. title_gr.style.color = '#f5c137';
  1997. title_gr.title = work_alert_tn;
  1998. $("gr_show1").style.display = $("gr_show2").style.display = 'none';
  1999. }
  2000. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  2001. }
  2002.  
  2003. function hwm_gk_show_check_id_f()
  2004. {
  2005. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  2006. if ( $('hwm_gk_show_check_id').checked == true ) {
  2007. hwmtimerestore["hwm_gk_show_check"] = '1';
  2008. $("gk_show1").style.display = $("gk_show2").style.display = '';
  2009. } else {
  2010. hwmtimerestore["hwm_gk_show_check"] = '0';
  2011. var title_sm = $('a_pers_sm');
  2012. hwmtimerestore["hwm_time_sm_alert"] = 'no';
  2013. title_sm.style.color = '#f5c137';
  2014. title_sm.title = sm_alert_tn;
  2015. $("gk_show1").style.display = $("gk_show2").style.display = 'none';
  2016. }
  2017. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  2018. }
  2019.  
  2020. function hwm_gn_show_check_id_f()
  2021. {
  2022. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  2023. if ( $('hwm_gn_show_check_id').checked == true ) {
  2024. hwmtimerestore["hwm_gn_show_check"] = '1';
  2025. $("gn_show1").style.display = $("gn_show2").style.display = '';
  2026. } else {
  2027. hwmtimerestore["hwm_gn_show_check"] = '0';
  2028. var title_gn = $('a_pers_gn');
  2029. hwmtimerestore["hwm_time_gn_alert"] = 'no';
  2030. title_gn.style.color = '#f5c137';
  2031. title_gn.title = gn_alert_tn;
  2032. $("gn_show1").style.display = $("gn_show2").style.display = 'none';
  2033. }
  2034. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  2035. }
  2036.  
  2037. function hwm_go_show_check_id_f()
  2038. {
  2039. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  2040. if ( $('hwm_go_show_check_id').checked == true ) {
  2041. hwmtimerestore["hwm_go_show_check"] = '1';
  2042. $("go_show1").style.display = $("go_show2").style.display = '';
  2043. } else {
  2044. hwmtimerestore["hwm_go_show_check"] = '0';
  2045. var title_go = $('a_pers_go');
  2046. hwmtimerestore["hwm_time_go_alert"] = 'no';
  2047. title_go.style.color = '#f5c137';
  2048. title_go.title = go_alert_tn;
  2049. $("go_show1").style.display = $("go_show2").style.display = 'none';
  2050. }
  2051. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  2052. }
  2053.  
  2054. function hwm_gv_show_check_id_f()
  2055. {
  2056. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  2057. if ( $('hwm_gv_show_check_id').checked == true ) {
  2058. hwmtimerestore["hwm_gv_show_check"] = '1';
  2059. $("gv_show1").style.display = $("gv_show2").style.display = '';
  2060. } else {
  2061. hwmtimerestore["hwm_gv_show_check"] = '0';
  2062. var title_gv = $('a_pers_gv');
  2063. hwmtimerestore["hwm_time_gv_alert"] = 'no';
  2064. title_gv.style.color = '#f5c137';
  2065. title_gv.title = gv_alert_tn;
  2066. $("gv_show1").style.display = $("gv_show2").style.display = 'none';
  2067. }
  2068. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  2069. }
  2070. function hwm_gl_show_check_id_f()
  2071. {
  2072. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  2073. if ( $('hwm_gl_show_check_id').checked == true ) {
  2074. hwmtimerestore["hwm_gl_show_check"] = '1';
  2075. $("gl_show1").style.display = $("gl_show2").style.display = '';
  2076. } else {
  2077. hwmtimerestore["hwm_gl_show_check"] = '0';
  2078. var title_gl = $('a_pers_gl');
  2079. hwmtimerestore["hwm_time_gl_alert"] = 'no';
  2080. title_gl.style.color = '#f5c137';
  2081. title_gl.title = gl_alert_tn;
  2082. $("gl_show1").style.display = $("gl_show2").style.display = 'none';
  2083. }
  2084. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  2085. }
  2086. function hwm_gs_show_check_id_f()
  2087. {
  2088. hwmtimerestore = JSON.parse( GM_getValue( nick+"hwmtimerestore", '{}' ) );
  2089. if ( $('hwm_gs_show_check_id').checked == true ) {
  2090. hwmtimerestore["hwm_gs_show_check"] = '1';
  2091. $("gs_show1").style.display = $("gs_show2").style.display = '';
  2092. } else {
  2093. hwmtimerestore["hwm_gs_show_check"] = '0';
  2094. var title_gs = $('a_pers_gs');
  2095. title_gs.style.color = '#f5c137';
  2096. $("gs_show1").style.display = $("gs_show2").style.display = 'none';
  2097. }
  2098. GM_setValue( nick+"hwmtimerestore", JSON.stringify(hwmtimerestore) );
  2099. }
  2100. function addLeadingZero(string){ // Вставляет ведущий ноль в строку с элементом даты/времени, если в ней только 1 цифра
  2101. string = string.toString();
  2102. if (string.length === 1){string = "0" + string;}
  2103. return string;
  2104. }
  2105. function getCurrentFullDateOnServer(){ // Возвращает текущую дату на сервере в формате строки yyyymmdd (полный год, месяц 1-12, дата 1-31)
  2106. var currentMoment = new Date(),
  2107. currentMomentOnServer = new Date(Date.now() + currentMoment.getTimezoneOffset()*60000 + 10800000),
  2108. currentFullDateOnServer =
  2109. currentMomentOnServer.getFullYear().toString() +
  2110. addLeadingZero((currentMomentOnServer.getMonth() + 1).toString()) +
  2111. addLeadingZero(currentMomentOnServer.getDate().toString());
  2112. return currentFullDateOnServer;
  2113. }
  2114. function setupObserver(target, config, callback){ // Привязка к target observer'а с параметрами config и вызовом callback при срабатывании c передачей observer внутрь
  2115. var observer = new MutationObserver(function(mutations){
  2116. mutations.forEach(function(mutation){callback.apply(observer);});
  2117. });
  2118. observer.observe(target, config);
  2119. }
  2120.  
  2121. // -----------------------------------
  2122.  
  2123. function open_transfer_f()
  2124. {
  2125. if ( location.href.match('lordswm') )
  2126. {
  2127. window.location = "transfer.php?nick=demin&shortcomment=Transferred 10000 Gold 5 Diamonds";
  2128. } else {
  2129. 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";
  2130. }
  2131. }
  2132.  
  2133. function ClientHeight() {
  2134. return document.compatMode=='CSS1Compat' && document.documentElement?document.documentElement.clientHeight:document.body.clientHeight;
  2135. }
  2136.  
  2137. function ClientWidth() {
  2138. return document.compatMode=='CSS1Compat' && document.documentElement?document.documentElement.clientWidth:document.body.clientWidth;
  2139. }
  2140.  
  2141. function ScrollHeight() {
  2142. return Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);
  2143. }
  2144.  
  2145. function $(id) { return document.querySelector("#"+id); }
  2146.  
  2147. function addEvent(elem, evType, fn) {
  2148. if (elem.addEventListener) {
  2149. elem.addEventListener(evType, fn, false);
  2150. }
  2151. else if (elem.attachEvent) {
  2152. elem.attachEvent("on" + evType, fn);
  2153. }
  2154. else {
  2155. elem["on" + evType] = fn;
  2156. }
  2157. }
  2158.  
  2159. })();