hwm_time_restore

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

当前为 2020-12-10 提交的版本,查看 最新版本

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