hwm_time_restore

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

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