hwm_time_restore

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

当前为 2022-12-08 提交的版本,查看 最新版本

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