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