MH Timers+

Handy script to keep track of the various MH location timers

当前为 2019-09-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name MH Timers+
  3. // @author Warden Slayer - Warden Slayer#2302
  4. // @namespace https://greasyfork.org/en/users/227259-wardenslayer
  5. // @version 1.4
  6. // @description Handy script to keep track of the various MH location timers
  7. // @include https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js
  8. // @include http://www.mousehuntgame.com/*
  9. // @include https://www.mousehuntgame.com/*
  10. // @grant GM_setClipboard
  11. // ==/UserScript==
  12. $(document).ready(function() {
  13. buildTimerBox();
  14. buildControlPanels();
  15. buildTinkerPanel();
  16. startTimers();
  17. });
  18.  
  19. function buildTimerBox() {
  20. if ($(".timerBox").length > 0) return;
  21. if ($(".accordion").length > 0) return;
  22. var container = $("#mousehuntContainer");
  23. var accordion = document.createElement("div");
  24. accordion.classList.add("accordion");
  25. $(accordion).css({
  26. 'background-image': "url('https://www.toptal.com/designers/subtlepatterns/patterns/interlaced.png')",
  27. 'width': '98%',
  28. 'height': '15px',
  29. 'padding': '5px',
  30. 'border': '2px solid black',
  31. 'cursor': 'pointer'
  32. });
  33. var accordionPrompt = document.createElement("div");
  34. accordionPrompt.classList.add("accordionPrompt");
  35. var accordionTitle = document.createElement("div");
  36. accordionTitle.classList.add("accordionTitle");
  37. $(accordionTitle).text("MouseHunt Timers+").css({
  38. 'float': 'left',
  39. 'padding': '1px 0',
  40. 'font-size': '12px',
  41. 'font-weight': 'bold'
  42. })
  43. $(accordionPrompt).text("Click to Hide").css({
  44. 'float': 'right',
  45. 'padding': '1px 0',
  46. 'font-size': '11px',
  47. 'font-weight': 'bold'
  48. })
  49. accordion.appendChild(accordionTitle)
  50. accordion.appendChild(accordionPrompt)
  51. var timerBox = document.createElement("div");
  52. if (localStorage.getItem('HideTimers') == "Y") {
  53. timerBox.classList.add("timerBox")
  54. timerBox.classList.add("hide");
  55. $(accordionPrompt).text("Click to Show")
  56. } else {
  57. timerBox.classList.add("timerBox");
  58. }
  59. $(timerBox).css({
  60. 'background-image': "url('https://www.toptal.com/designers/subtlepatterns/patterns/interlaced.png')"
  61. });
  62. $(timerBox).css({
  63. 'height': 150 + "px",
  64. 'padding': 2 + "px"
  65. });
  66. let forbiddenGrove = buildForbiddenGrove();
  67. if (localStorage.getItem('RemindGrove') == null) {
  68. localStorage.setItem('RemindGrove', 'N')
  69. }
  70. let balacksCove = buildBalacksCove();
  71. if (localStorage.getItem('RemindCove') == null) {
  72. localStorage.setItem('RemindCove', 'N')
  73. }
  74. let seasonalGarden = buildSeasonalGarden();
  75. if (localStorage.getItem('RemindGarden') == null) {
  76. localStorage.setItem('RemindGarden', 'N')
  77. }
  78. let toxicSpill = buildToxicSpill();
  79. if (localStorage.getItem('RemindSpill') == null) {
  80. localStorage.setItem('RemindSpill', 'N')
  81. }
  82. timerBox.appendChild(forbiddenGrove)
  83. timerBox.appendChild(balacksCove)
  84. timerBox.appendChild(seasonalGarden)
  85. timerBox.appendChild(toxicSpill)
  86. $(forbiddenGrove).css({
  87. 'float': 'left'
  88. })
  89. $(balacksCove).css({
  90. 'float': 'left',
  91. 'marginLeft': 1 + "px"
  92. })
  93. $(seasonalGarden).css({
  94. 'float': 'left',
  95. 'marginLeft': 1 + "px"
  96. })
  97. $(toxicSpill).css({
  98. 'float': 'left',
  99. 'marginLeft': 1 + "px"
  100. })
  101. //LAST
  102. container.prepend(timerBox)
  103. container.prepend(accordion)
  104.  
  105. }
  106. $(document).on('click', '.accordion', function() {
  107. if (localStorage.getItem('HideTimers') == "Y") {
  108. //show
  109. $('.timerBox').removeClass("hide")
  110. $('.accordionPrompt').text("Click to Hide")
  111. localStorage.setItem('HideTimers', "N")
  112. } else {
  113. //hide
  114. $('.timerBox').find('*').removeClass("hide")
  115. $('.timerBox').addClass("hide")
  116. $('.accordionPrompt').text("Click to Show")
  117. $('.tinkerPanel').addClass("hide");
  118. $('.tinkerButton').text("Tinker");
  119. localStorage.setItem('HideTimers', "Y")
  120. }
  121. })
  122.  
  123. function buildControlPanels() {
  124. var timerBox = $(".timerBox");
  125. //FG
  126. const remindGrove = localStorage.getItem('RemindGrove');
  127. var forbiddenGroveControlPanel = document.createElement("div");
  128. forbiddenGroveControlPanel.classList.add("forbiddenGroveControlPanel");
  129. var forbiddenGroveButton = document.createElement("button");
  130. forbiddenGroveButton.id = "forbiddenGroveButton";
  131. forbiddenGroveButton.innerText = "Travel";
  132. forbiddenGroveButton.addEventListener("click", travelToGrove);
  133. forbiddenGroveControlPanel.appendChild(forbiddenGroveButton);
  134. $(forbiddenGroveControlPanel).css({
  135. 'float': 'left',
  136. 'width': '21.5%',
  137. 'marginTop': 10 + "px"
  138. })
  139. $(forbiddenGroveButton).css({
  140. 'width': '75px',
  141. 'float': 'left',
  142. 'marginRight': 5 + "px"
  143. })
  144. var forbiddenGroveCb = document.createElement('input');
  145. forbiddenGroveCb.type = "checkbox";
  146. forbiddenGroveCb.name = "forbiddenGroveCb";
  147. forbiddenGroveCb.value = "value";
  148. forbiddenGroveCb.id = "forbiddenGroveCb";
  149. if (remindGrove.search("N") < 0) {
  150. forbiddenGroveCb.checked = "Yes";
  151. } else {
  152. forbiddenGroveCb.checked = "";
  153. }
  154. var forbiddenGroveCbLabel = document.createElement('label')
  155. forbiddenGroveCbLabel.htmlFor = "forbiddenGroveCbLabel";
  156. forbiddenGroveCbLabel.appendChild(document.createTextNode('Remind '));
  157. forbiddenGroveControlPanel.appendChild(forbiddenGroveCbLabel);
  158. forbiddenGroveControlPanel.appendChild(forbiddenGroveCb)
  159. $(forbiddenGroveCbLabel).css({
  160. 'float': 'left',
  161. 'fontSize': "14px",
  162. 'width': '45px',
  163. })
  164. $(forbiddenGroveCb).css({
  165. 'float': 'left',
  166. 'width': '20px'
  167. })
  168. timerBox.append(forbiddenGroveControlPanel);
  169. //BC
  170. const remindCove = localStorage.getItem('RemindCove');
  171. var balacksCoveControlPanel = document.createElement("div");
  172. balacksCoveControlPanel.classList.add("balacksCoveControlPanel");
  173. var balacksCoveButton = document.createElement("button");
  174. balacksCoveButton.id = "balacksCoveButton";
  175. balacksCoveButton.innerText = "Travel";
  176. balacksCoveButton.addEventListener("click", travelToCove);
  177. balacksCoveControlPanel.appendChild(balacksCoveButton);
  178. $(balacksCoveControlPanel).css({
  179. 'float': 'left',
  180. 'width': '25%',
  181. 'marginLeft': 5 + "px",
  182. 'marginTop': 10 + "px"
  183. })
  184. $(balacksCoveButton).css({
  185. 'width': '75px',
  186. 'float': 'left',
  187. 'marginRight': 5 + "px"
  188. })
  189. var balacksCoveCb = document.createElement('input');
  190. balacksCoveCb.type = "checkbox";
  191. balacksCoveCb.name = "balacksCoveCb";
  192. balacksCoveCb.value = "value";
  193. balacksCoveCb.id = "balacksCoveCb";
  194. if (remindCove.search("N") < 0) {
  195. balacksCoveCb.checked = "Yes";
  196. } else {
  197. balacksCoveCb.checked = "";
  198. }
  199. var balacksCoveCbLabel = document.createElement('label')
  200. balacksCoveCbLabel.htmlFor = "balacksCoveCbLabel";
  201. balacksCoveCbLabel.appendChild(document.createTextNode('Remind '));
  202. balacksCoveControlPanel.appendChild(balacksCoveCbLabel);
  203. balacksCoveControlPanel.appendChild(balacksCoveCb)
  204. $(balacksCoveCbLabel).css({
  205. 'float': 'left',
  206. 'fontSize': "14px",
  207. 'width': '45px',
  208. })
  209. $(balacksCoveCb).css({
  210. 'float': 'left',
  211. 'width': '20px'
  212. })
  213. timerBox.append(balacksCoveControlPanel);
  214. //SG
  215. const remindGarden = localStorage.getItem('RemindGarden');
  216. var seasonalGardenControlPanel = document.createElement("div");
  217. seasonalGardenControlPanel.classList.add("seasonalGardenControlPanel");
  218. var seasonalGardenButton = document.createElement("button");
  219. seasonalGardenButton.id = "seasonalGardenButton";
  220. seasonalGardenButton.innerText = "Travel";
  221. seasonalGardenButton.addEventListener("click", travelToGarden);
  222. seasonalGardenControlPanel.appendChild(seasonalGardenButton);
  223. $(seasonalGardenControlPanel).css({
  224. 'float': 'left',
  225. 'width': '24%',
  226. 'marginLeft': 5 + "px",
  227. 'marginTop': 10 + "px"
  228. })
  229. $(seasonalGardenButton).css({
  230. 'width': '75px',
  231. 'float': 'left',
  232. 'marginRight': 5 + "px"
  233. })
  234. var seasonalGardenCb = document.createElement('input');
  235. seasonalGardenCb.type = "checkbox";
  236. seasonalGardenCb.name = "seasonalGardenCb";
  237. seasonalGardenCb.value = "value";
  238. seasonalGardenCb.id = "seasonalGardenCb";
  239. if (remindGarden.search("N") < 0) {
  240. seasonalGardenCb.checked = "Yes";
  241. } else {
  242. seasonalGardenCb.checked = "";
  243. }
  244. var seasonalGardenCbLabel = document.createElement('label')
  245. seasonalGardenCbLabel.htmlFor = "seasonalGardenCbLabel";
  246. seasonalGardenCbLabel.appendChild(document.createTextNode('Remind '));
  247. seasonalGardenControlPanel.appendChild(seasonalGardenCbLabel);
  248. seasonalGardenControlPanel.appendChild(seasonalGardenCb)
  249. $(seasonalGardenCbLabel).css({
  250. 'float': 'left',
  251. 'fontSize': "14px",
  252. 'width': '45px',
  253. })
  254. $(seasonalGardenCb).css({
  255. 'float': 'left',
  256. 'width': '20px'
  257. })
  258. timerBox.append(seasonalGardenControlPanel);
  259. //TS
  260. const remindSpill = localStorage.getItem('RemindSpill');
  261. var toxicSpillControlPanel = document.createElement("div");
  262. toxicSpillControlPanel.classList.add("toxicSpillControlPanel");
  263. var toxicSpillButton = document.createElement("button");
  264. toxicSpillButton.id = "toxicSpillButton";
  265. toxicSpillButton.innerText = "Travel";
  266. toxicSpillButton.addEventListener("click", travelToSpill);
  267. toxicSpillControlPanel.appendChild(toxicSpillButton);
  268. $(toxicSpillControlPanel).css({
  269. 'float': 'left',
  270. 'width': '26%',
  271. 'marginLeft': 10 + "px",
  272. 'marginTop': 10 + "px"
  273. })
  274. $(toxicSpillButton).css({
  275. 'width': '75px',
  276. 'float': 'left',
  277. 'marginRight': 5 + "px"
  278. })
  279. var toxicSpillCb = document.createElement('input');
  280. toxicSpillCb.type = "checkbox";
  281. toxicSpillCb.name = "toxicSpillCb";
  282. toxicSpillCb.value = "value";
  283. toxicSpillCb.id = "toxicSpillCb";
  284. if (remindSpill.search("N") < 0) {
  285. toxicSpillCb.checked = "Yes";
  286. } else {
  287. toxicSpillCb.checked = "";
  288. }
  289. var toxicSpillCbLabel = document.createElement('label')
  290. toxicSpillCbLabel.htmlFor = "toxicSpillCbLabel";
  291. toxicSpillCbLabel.appendChild(document.createTextNode('Remind '));
  292. toxicSpillControlPanel.appendChild(toxicSpillCbLabel);
  293. toxicSpillControlPanel.appendChild(toxicSpillCb)
  294. $(toxicSpillCbLabel).css({
  295. 'float': 'left',
  296. 'fontSize': "14px",
  297. 'width': '45px',
  298. })
  299. $(toxicSpillCb).css({
  300. 'float': 'left',
  301. 'width': '20px'
  302. })
  303. //tinker button
  304. var tinkerButton = document.createElement("div");
  305. tinkerButton.classList.add("tinkerButton");
  306. $(tinkerButton).text("Tinker");
  307. toxicSpillControlPanel.appendChild(tinkerButton);
  308. $(tinkerButton).css({
  309. 'width': '30px',
  310. 'float': 'right',
  311. 'padding': 3 + 'px',
  312. 'color': 'rgb(4, 44, 202)',
  313. 'marginRight': 5 + "px"
  314. })
  315. timerBox.append(toxicSpillControlPanel);
  316. }
  317.  
  318. $('.tinkerButton').mouseover(function() {
  319. $('.tinkerButton').attr('title', 'Tinker Menu');
  320. $('.tinkerButton').css('cursor', 'pointer');
  321. });
  322. $(document).on('click', '.tinkerButton', function() {
  323. var fg = $('.forbiddenGrove');
  324. var bc = $('.balacksCove');
  325. var sg = $('.seasonalGarden');
  326. var ts = $('.toxicSpill');
  327. var tp = $('.tinkerPanel');
  328. if (fg.hasClass("hide")) {
  329. //show
  330. fg.removeClass("hide");
  331. bc.removeClass("hide");
  332. sg.removeClass("hide");
  333. ts.removeClass("hide");
  334. tp.addClass("hide");
  335. $('.tinkerButton').text("Tinker");
  336. } else {
  337. //hide
  338. fg.addClass("hide");
  339. bc.addClass("hide");
  340. sg.addClass("hide");
  341. ts.addClass("hide");
  342. tp.removeClass("hide");
  343. $('.tinkerButton').text("Close");
  344. }
  345. });
  346.  
  347. function buildTinkerPanel() {
  348. var timerBox = $(".timerBox");
  349. var tinkerPanel = document.createElement("div");
  350. tinkerPanel.classList.add("tinkerPanel");
  351. tinkerPanel.classList.add("hide");
  352. $(tinkerPanel).css({
  353. 'height': '70%',
  354. 'width': '99%',
  355. 'float': 'left',
  356. 'padding': 2 + "px",
  357. 'background-image': "url('https://www.toptal.com/designers/subtlepatterns/patterns/interlaced.png')",
  358. 'border': '1px solid black'
  359. });
  360. //FG Options
  361. const remindGrove = localStorage.getItem('RemindGrove');
  362. var forbiddenGroveOptions = document.createElement("div");
  363. forbiddenGroveOptions.classList.add("forbiddenGroveOptions");
  364. var forbiddenGroveOptionsLabel = document.createElement("div");
  365. forbiddenGroveOptionsLabel.classList.add("forbiddenGroveOptionsLabel");
  366. var forbiddenGroveOptionsLabelText = document.createTextNode("Forbidden Grove");
  367. forbiddenGroveOptionsLabel.appendChild(forbiddenGroveOptionsLabelText);
  368. forbiddenGroveOptions.appendChild(forbiddenGroveOptionsLabel);
  369. $(forbiddenGroveOptions).css({
  370. 'float': 'left',
  371. 'width': '12%',
  372. })
  373. $(forbiddenGroveOptionsLabel).css({
  374. 'float': 'left',
  375. 'width': '100%',
  376. 'font-weight': 700,
  377. "marginRight": "5px"
  378. })
  379. var forbiddenGroveOpenCb = document.createElement('input');
  380. forbiddenGroveOpenCb.type = "checkbox";
  381. forbiddenGroveOpenCb.name = "forbiddenGroveOpenCb";
  382. forbiddenGroveOpenCb.value = "value";
  383. forbiddenGroveOpenCb.id = "forbiddenGroveOpenCb";
  384. if (remindGrove.search("O") >= 0) {
  385. forbiddenGroveOpenCb.checked = "Yes";
  386. } else {
  387. forbiddenGroveOpenCb.checked = "";
  388. }
  389. var forbiddenGroveOpenCbLabel = document.createElement('label')
  390. forbiddenGroveOpenCbLabel.htmlFor = "forbiddenGroveOpenCbLabel";
  391. forbiddenGroveOpenCbLabel.appendChild(document.createTextNode('Open'));
  392. $(forbiddenGroveOpenCbLabel).css({
  393. 'float': 'left',
  394. 'width': '30px',
  395. 'padding': '1px'
  396. })
  397. $(forbiddenGroveOpenCb).css({
  398. 'float': 'left',
  399. 'width': '20px'
  400. })
  401. forbiddenGroveOptions.appendChild(forbiddenGroveOpenCbLabel);
  402. forbiddenGroveOptions.appendChild(forbiddenGroveOpenCb);
  403. //
  404. var forbiddenGroveCloseCb = document.createElement('input');
  405. forbiddenGroveCloseCb.type = "checkbox";
  406. forbiddenGroveCloseCb.name = "forbiddenGroveCloseCb";
  407. forbiddenGroveCloseCb.value = "value";
  408. forbiddenGroveCloseCb.id = "forbiddenGroveCloseCb";
  409. if (remindGrove.search("C") >= 0) {
  410. forbiddenGroveCloseCb.checked = "Yes";
  411. } else {
  412. forbiddenGroveCloseCb.checked = "";
  413. }
  414. var forbiddenGroveCloseCbLabel = document.createElement('label')
  415. forbiddenGroveCloseCbLabel.htmlFor = "forbiddenGroveCloseCbLabel";
  416. forbiddenGroveCloseCbLabel.appendChild(document.createTextNode('Closed'));
  417. $(forbiddenGroveCloseCbLabel).css({
  418. 'float': 'left',
  419. 'width': '30px',
  420. 'padding': '1px'
  421. })
  422. $(forbiddenGroveCloseCb).css({
  423. 'float': 'left',
  424. 'width': '20px'
  425. })
  426. forbiddenGroveOptions.appendChild(forbiddenGroveCloseCbLabel);
  427. forbiddenGroveOptions.appendChild(forbiddenGroveCloseCb);
  428. //BC Options
  429. const remindCove = localStorage.getItem('RemindCove');
  430. var balacksCoveOptions = document.createElement("div");
  431. balacksCoveOptions.classList.add("balacksCoveOptions");
  432. var balacksCoveOptionsLabel = document.createElement("div");
  433. balacksCoveOptionsLabel.classList.add("balacksCoveOptionsLabel");
  434. var balacksCoveOptionsLabelText = document.createTextNode("Balack's Cove");
  435. balacksCoveOptionsLabel.appendChild(balacksCoveOptionsLabelText);
  436. balacksCoveOptions.appendChild(balacksCoveOptionsLabel);
  437. $(balacksCoveOptions).css({
  438. 'float': 'left',
  439. 'width': '12%',
  440. })
  441. $(balacksCoveOptionsLabel).css({
  442. 'float': 'left',
  443. 'width': '100%',
  444. 'font-weight': 700,
  445. "marginRight": "5px"
  446. })
  447. var balacksCoveLowCb = document.createElement('input');
  448. balacksCoveLowCb.type = "checkbox";
  449. balacksCoveLowCb.name = "balacksCoveLowCb";
  450. balacksCoveLowCb.value = "value";
  451. balacksCoveLowCb.id = "balacksCoveLowCb";
  452. if ((remindCove.search("L") >= 0) && (remindCove.search("N") < 0)) {
  453. balacksCoveLowCb.checked = "Yes";
  454. } else {
  455. balacksCoveLowCb.checked = "";
  456. }
  457. var balacksCoveLowCbLabel = document.createElement('label')
  458. balacksCoveLowCbLabel.htmlFor = "balacksCoveLowCbLabel";
  459. balacksCoveLowCbLabel.appendChild(document.createTextNode('Low'));
  460. $(balacksCoveLowCbLabel).css({
  461. 'float': 'left',
  462. 'width': '30px',
  463. 'padding': '1px'
  464. })
  465. $(balacksCoveLowCb).css({
  466. 'float': 'left',
  467. 'width': '20px'
  468. })
  469. balacksCoveOptions.appendChild(balacksCoveLowCbLabel);
  470. balacksCoveOptions.appendChild(balacksCoveLowCb);
  471. //
  472. var balacksCoveMidCb = document.createElement('input');
  473. balacksCoveMidCb.type = "checkbox";
  474. balacksCoveMidCb.name = "balacksCoveMidCb";
  475. balacksCoveMidCb.value = "value";
  476. balacksCoveMidCb.id = "balacksCoveMidCb";
  477. if (remindCove.search("M") >= 0) {
  478. balacksCoveMidCb.checked = "Yes";
  479. } else {
  480. balacksCoveMidCb.checked = "";
  481. }
  482. var balacksCoveMidCbLabel = document.createElement('label')
  483. balacksCoveMidCbLabel.htmlFor = "balacksCoveMidCbLabel";
  484. balacksCoveMidCbLabel.appendChild(document.createTextNode('Mid'));
  485. $(balacksCoveMidCbLabel).css({
  486. 'float': 'left',
  487. 'width': '30px',
  488. 'padding': '1px'
  489. })
  490. $(balacksCoveMidCb).css({
  491. 'float': 'left',
  492. 'width': '20px'
  493. })
  494. balacksCoveOptions.appendChild(balacksCoveMidCbLabel);
  495. balacksCoveOptions.appendChild(balacksCoveMidCb);
  496. //
  497. var balacksCoveHighCb = document.createElement('input');
  498. balacksCoveHighCb.type = "checkbox";
  499. balacksCoveHighCb.name = "balacksCoveHighCb";
  500. balacksCoveHighCb.value = "value";
  501. balacksCoveHighCb.id = "balacksCoveHighCb";
  502. if (remindCove.search("H") >= 0) {
  503. balacksCoveHighCb.checked = "Yes";
  504. } else {
  505. balacksCoveHighCb.checked = "";
  506. }
  507. var balacksCoveHighCbLabel = document.createElement('label')
  508. balacksCoveHighCbLabel.htmlFor = "balacksCoveHighCbLabel";
  509. balacksCoveHighCbLabel.appendChild(document.createTextNode('High'));
  510. $(balacksCoveHighCbLabel).css({
  511. 'float': 'left',
  512. 'width': '30px',
  513. 'padding': '1px'
  514. })
  515. $(balacksCoveHighCb).css({
  516. 'float': 'left',
  517. 'width': '20px'
  518. })
  519. balacksCoveOptions.appendChild(balacksCoveHighCbLabel);
  520. balacksCoveOptions.appendChild(balacksCoveHighCb);
  521. //SG Options
  522. const remindGarden = localStorage.getItem('RemindGarden');
  523. var seasonalGardenOptions = document.createElement("div");
  524. seasonalGardenOptions.classList.add("seasonalGardenOptions");
  525. var seasonalGardenOptionsLabel = document.createElement("div");
  526. seasonalGardenOptionsLabel.classList.add("seasonalGardenOptionsLabel");
  527. var seasonalGardenOptionsLabelText = document.createTextNode("Seasonal Garden");
  528. seasonalGardenOptionsLabel.appendChild(seasonalGardenOptionsLabelText);
  529. seasonalGardenOptions.appendChild(seasonalGardenOptionsLabel);
  530. $(seasonalGardenOptions).css({
  531. 'float': 'left',
  532. 'width': '13%',
  533. })
  534. $(seasonalGardenOptionsLabel).css({
  535. 'float': 'left',
  536. 'width': '100%',
  537. 'font-weight': 700,
  538. "marginRight": "5px"
  539. })
  540. var seasonalGardenFallCb = document.createElement('input');
  541. seasonalGardenFallCb.type = "checkbox";
  542. seasonalGardenFallCb.name = "seasonalGardenFallCb";
  543. seasonalGardenFallCb.value = "value";
  544. seasonalGardenFallCb.id = "seasonalGardenFallCb";
  545. if (remindGarden.search("F") >= 0) {
  546. seasonalGardenFallCb.checked = "Yes";
  547. } else {
  548. seasonalGardenFallCb.checked = "";
  549. }
  550. var seasonalGardenFallCbLabel = document.createElement('label')
  551. seasonalGardenFallCbLabel.htmlFor = "seasonalGardenFallCbLabel";
  552. seasonalGardenFallCbLabel.appendChild(document.createTextNode('Fall'));
  553. $(seasonalGardenFallCbLabel).css({
  554. 'float': 'left',
  555. 'width': '40px',
  556. 'padding': '1px',
  557. })
  558. $(seasonalGardenFallCb).css({
  559. 'float': 'left',
  560. 'width': '20px',
  561. "marginRight": "25px"
  562. })
  563. seasonalGardenOptions.appendChild(seasonalGardenFallCbLabel);
  564. seasonalGardenOptions.appendChild(seasonalGardenFallCb);
  565. //
  566. var seasonalGardenWinterCb = document.createElement('input');
  567. seasonalGardenWinterCb.type = "checkbox";
  568. seasonalGardenWinterCb.name = "seasonalGardenWinterCb";
  569. seasonalGardenWinterCb.value = "value";
  570. seasonalGardenWinterCb.id = "seasonalGardenWinterCb";
  571. if (remindGarden.search("W") >= 0) {
  572. seasonalGardenWinterCb.checked = "Yes";
  573. } else {
  574. seasonalGardenWinterCb.checked = "";
  575. }
  576. var seasonalGardenWinterCbLabel = document.createElement('label')
  577. seasonalGardenWinterCbLabel.htmlFor = "seasonalGardenWinterCbLabel";
  578. seasonalGardenWinterCbLabel.appendChild(document.createTextNode('Winter'));
  579. $(seasonalGardenWinterCbLabel).css({
  580. 'float': 'left',
  581. 'width': '40px',
  582. 'padding': '1px'
  583. })
  584. $(seasonalGardenWinterCb).css({
  585. 'float': 'left',
  586. 'width': '20px',
  587. "marginRight": "25px"
  588. })
  589. seasonalGardenOptions.appendChild(seasonalGardenWinterCbLabel);
  590. seasonalGardenOptions.appendChild(seasonalGardenWinterCb);
  591. //
  592. var seasonalGardenSpringCb = document.createElement('input');
  593. seasonalGardenSpringCb.type = "checkbox";
  594. seasonalGardenSpringCb.name = "seasonalGardenSpringCb";
  595. seasonalGardenSpringCb.value = "value";
  596. seasonalGardenSpringCb.id = "seasonalGardenSpringCb";
  597. if (remindGarden.search("S") >= 0) {
  598. seasonalGardenSpringCb.checked = "Yes";
  599. } else {
  600. seasonalGardenSpringCb.checked = "";
  601. }
  602. var seasonalGardenSpringCbLabel = document.createElement('label')
  603. seasonalGardenSpringCbLabel.htmlFor = "seasonalGardenSpringCbLabel";
  604. seasonalGardenSpringCbLabel.appendChild(document.createTextNode('Spring'));
  605. $(seasonalGardenSpringCbLabel).css({
  606. 'float': 'left',
  607. 'width': '40px',
  608. 'padding': '1px'
  609. })
  610. $(seasonalGardenSpringCb).css({
  611. 'float': 'left',
  612. 'width': '20px',
  613. "marginRight": "25px"
  614. })
  615. seasonalGardenOptions.appendChild(seasonalGardenSpringCbLabel);
  616. seasonalGardenOptions.appendChild(seasonalGardenSpringCb);
  617. //
  618. var seasonalGardenSummerCb = document.createElement('input');
  619. seasonalGardenSummerCb.type = "checkbox";
  620. seasonalGardenSummerCb.name = "seasonalGardenSummerCb";
  621. seasonalGardenSummerCb.value = "value";
  622. seasonalGardenSummerCb.id = "seasonalGardenSummerCb";
  623. if (remindGarden.search("R") >= 0) {
  624. seasonalGardenSummerCb.checked = "Yes";
  625. } else {
  626. seasonalGardenSummerCb.checked = "";
  627. }
  628. var seasonalGardenSummerCbLabel = document.createElement('label')
  629. seasonalGardenSummerCbLabel.htmlFor = "seasonalGardenSummerCbLabel";
  630. seasonalGardenSummerCbLabel.appendChild(document.createTextNode('Summer'));
  631. $(seasonalGardenSummerCbLabel).css({
  632. 'float': 'left',
  633. 'width': '40px',
  634. 'padding': '1px'
  635. })
  636. $(seasonalGardenSummerCb).css({
  637. 'float': 'left',
  638. 'width': '20px',
  639. "marginRight": "25px"
  640. })
  641. seasonalGardenOptions.appendChild(seasonalGardenSummerCbLabel);
  642. seasonalGardenOptions.appendChild(seasonalGardenSummerCb);
  643. //TS Options
  644. const remindSpill = localStorage.getItem('RemindSpill');
  645. var toxicSpillOptions = document.createElement("div");
  646. toxicSpillOptions.classList.add("toxicSpillOptions");
  647. var toxicSpillOptionsLabel = document.createElement("div");
  648. toxicSpillOptionsLabel.classList.add("toxicSpillOptionsLabel");
  649. var toxicSpillOptionsLabelText = document.createTextNode("Toxic Spill");
  650. toxicSpillOptionsLabel.appendChild(toxicSpillOptionsLabelText);
  651. toxicSpillOptions.appendChild(toxicSpillOptionsLabel);
  652. $(toxicSpillOptions).css({
  653. 'float': 'left',
  654. 'width': '18%',
  655. 'marginLeft': '10px',
  656. })
  657. $(toxicSpillOptionsLabel).css({
  658. 'float': 'left',
  659. 'width': '100%',
  660. 'font-weight': 700,
  661. })
  662. var toxicSpillHeroCb = document.createElement('input');
  663. toxicSpillHeroCb.type = "checkbox";
  664. toxicSpillHeroCb.name = "toxicSpillHeroCb";
  665. toxicSpillHeroCb.value = "value";
  666. toxicSpillHeroCb.id = "toxicSpillHeroCb";
  667. if (remindSpill.search("H") >= 0) {
  668. toxicSpillHeroCb.checked = "Yes";
  669. } else {
  670. toxicSpillHeroCb.checked = "";
  671. }
  672. var toxicSpillHeroCbLabel = document.createElement('label')
  673. toxicSpillHeroCbLabel.htmlFor = "toxicSpillHeroCbLabel";
  674. toxicSpillHeroCbLabel.appendChild(document.createTextNode('Hero'));
  675. $(toxicSpillHeroCbLabel).css({
  676. 'float': 'left',
  677. 'width': '35px',
  678. 'padding': '1px',
  679. })
  680. $(toxicSpillHeroCb).css({
  681. 'float': 'left',
  682. 'width': '20px',
  683. "marginRight": "5px"
  684. })
  685. toxicSpillOptions.appendChild(toxicSpillHeroCbLabel);
  686. toxicSpillOptions.appendChild(toxicSpillHeroCb);
  687. //
  688. var toxicSpillKnightCb = document.createElement('input');
  689. toxicSpillKnightCb.type = "checkbox";
  690. toxicSpillKnightCb.name = "toxicSpillKnightCb";
  691. toxicSpillKnightCb.value = "value";
  692. toxicSpillKnightCb.id = "toxicSpillKnightCb";
  693. if (remindSpill.search("K") >= 0) {
  694. toxicSpillKnightCb.checked = "Yes";
  695. } else {
  696. toxicSpillKnightCb.checked = "";
  697. }
  698. var toxicSpillKnightCbLabel = document.createElement('label')
  699. toxicSpillKnightCbLabel.htmlFor = "toxicSpillKnightCbLabel";
  700. toxicSpillKnightCbLabel.appendChild(document.createTextNode('Knight'));
  701. $(toxicSpillKnightCbLabel).css({
  702. 'float': 'left',
  703. 'width': '35px',
  704. 'padding': '1px',
  705. })
  706. $(toxicSpillKnightCb).css({
  707. 'float': 'left',
  708. 'width': '20px',
  709. "marginRight": "5px"
  710. })
  711. toxicSpillOptions.appendChild(toxicSpillKnightCbLabel);
  712. toxicSpillOptions.appendChild(toxicSpillKnightCb);
  713. //
  714. var toxicSpillLordCb = document.createElement('input');
  715. toxicSpillLordCb.type = "checkbox";
  716. toxicSpillLordCb.name = "toxicSpillLordCb";
  717. toxicSpillLordCb.value = "value";
  718. toxicSpillLordCb.id = "toxicSpillLordCb";
  719. if (remindSpill.search("L") >= 0) {
  720. toxicSpillLordCb.checked = "Yes";
  721. } else {
  722. toxicSpillLordCb.checked = "";
  723. }
  724. var toxicSpillLordCbLabel = document.createElement('label')
  725. toxicSpillLordCbLabel.htmlFor = "toxicSpillLordCbLabel";
  726. toxicSpillLordCbLabel.appendChild(document.createTextNode('Lord'));
  727. $(toxicSpillLordCbLabel).css({
  728. 'float': 'left',
  729. 'width': '35px',
  730. 'padding': '1px',
  731. })
  732. $(toxicSpillLordCb).css({
  733. 'float': 'left',
  734. 'width': '20px',
  735. "marginRight": "5px"
  736. })
  737. toxicSpillOptions.appendChild(toxicSpillLordCbLabel);
  738. toxicSpillOptions.appendChild(toxicSpillLordCb);
  739. //
  740. var toxicSpillBaronCb = document.createElement('input');
  741. toxicSpillBaronCb.type = "checkbox";
  742. toxicSpillBaronCb.name = "toxicSpillBaronCb";
  743. toxicSpillBaronCb.value = "value";
  744. toxicSpillBaronCb.id = "toxicSpillBaronCb";
  745. if (remindSpill.search("B") >= 0) {
  746. toxicSpillBaronCb.checked = "Yes";
  747. } else {
  748. toxicSpillBaronCb.checked = "";
  749. }
  750. var toxicSpillBaronCbLabel = document.createElement('label')
  751. toxicSpillBaronCbLabel.htmlFor = "toxicSpillBaronCbLabel";
  752. toxicSpillBaronCbLabel.appendChild(document.createTextNode('Baron'));
  753. $(toxicSpillBaronCbLabel).css({
  754. 'float': 'left',
  755. 'width': '35px',
  756. 'padding': '1px',
  757. })
  758. $(toxicSpillBaronCb).css({
  759. 'float': 'left',
  760. 'width': '20px',
  761. "marginRight": "5px"
  762. })
  763. toxicSpillOptions.appendChild(toxicSpillBaronCbLabel);
  764. toxicSpillOptions.appendChild(toxicSpillBaronCb);
  765. //
  766. var toxicSpillCountCb = document.createElement('input');
  767. toxicSpillCountCb.type = "checkbox";
  768. toxicSpillCountCb.name = "toxicSpillCountCb";
  769. toxicSpillCountCb.value = "value";
  770. toxicSpillCountCb.id = "toxicSpillCountCb";
  771. if (remindSpill.search("C") >= 0) {
  772. toxicSpillCountCb.checked = "Yes";
  773. } else {
  774. toxicSpillCountCb.checked = "";
  775. }
  776. var toxicSpillCountCbLabel = document.createElement('label')
  777. toxicSpillCountCbLabel.htmlFor = "toxicSpillCountCbLabel";
  778. toxicSpillCountCbLabel.appendChild(document.createTextNode('Count'));
  779. $(toxicSpillCountCbLabel).css({
  780. 'float': 'left',
  781. 'width': '35px',
  782. 'padding': '1px',
  783. })
  784. $(toxicSpillCountCb).css({
  785. 'float': 'left',
  786. 'width': '20px',
  787. "marginRight": "5px"
  788. })
  789. toxicSpillOptions.appendChild(toxicSpillCountCbLabel);
  790. toxicSpillOptions.appendChild(toxicSpillCountCb);
  791. //
  792. var toxicSpillDukeCb = document.createElement('input');
  793. toxicSpillDukeCb.type = "checkbox";
  794. toxicSpillDukeCb.name = "toxicSpillDukeCb";
  795. toxicSpillDukeCb.value = "value";
  796. toxicSpillDukeCb.id = "toxicSpillDukeCb";
  797. if (remindSpill.search("D") >= 0) {
  798. toxicSpillDukeCb.checked = "Yes";
  799. } else {
  800. toxicSpillDukeCb.checked = "";
  801. }
  802. var toxicSpillDukeCbLabel = document.createElement('label')
  803. toxicSpillDukeCbLabel.htmlFor = "toxicSpillDukeCbLabel";
  804. toxicSpillDukeCbLabel.appendChild(document.createTextNode('Duke'));
  805. $(toxicSpillDukeCbLabel).css({
  806. 'float': 'left',
  807. 'width': '35px',
  808. 'padding': '1px',
  809. })
  810. $(toxicSpillDukeCb).css({
  811. 'float': 'left',
  812. 'width': '20px',
  813. "marginRight": "5px"
  814. })
  815. toxicSpillOptions.appendChild(toxicSpillDukeCbLabel);
  816. toxicSpillOptions.appendChild(toxicSpillDukeCb);
  817. //
  818. var toxicSpillGrandDukeCb = document.createElement('input');
  819. toxicSpillGrandDukeCb.type = "checkbox";
  820. toxicSpillGrandDukeCb.name = "toxicSpillGrandDukeCb";
  821. toxicSpillGrandDukeCb.value = "value";
  822. toxicSpillGrandDukeCb.id = "toxicSpillGrandDukeCb";
  823. if (remindSpill.search("G") >= 0) {
  824. toxicSpillGrandDukeCb.checked = "Yes";
  825. } else {
  826. toxicSpillGrandDukeCb.checked = "";
  827. }
  828. var toxicSpillGrandDukeCbLabel = document.createElement('label')
  829. toxicSpillGrandDukeCbLabel.htmlFor = "toxicSpillGrandDukeCbLabel";
  830. toxicSpillGrandDukeCbLabel.appendChild(document.createTextNode('GDuke'));
  831. $(toxicSpillGrandDukeCbLabel).css({
  832. 'float': 'left',
  833. 'width': '35px',
  834. 'padding': '1px',
  835. })
  836. $(toxicSpillGrandDukeCb).css({
  837. 'float': 'left',
  838. 'width': '20px',
  839. "marginRight": "5px"
  840. })
  841. toxicSpillOptions.appendChild(toxicSpillGrandDukeCbLabel);
  842. toxicSpillOptions.appendChild(toxicSpillGrandDukeCb);
  843. //
  844. var toxicSpillArchdukeCb = document.createElement('input');
  845. toxicSpillArchdukeCb.type = "checkbox";
  846. toxicSpillArchdukeCb.name = "toxicSpillArchdukeCb";
  847. toxicSpillArchdukeCb.value = "value";
  848. toxicSpillArchdukeCb.id = "toxicSpillArchdukeCb";
  849. if (remindSpill.search("A") >= 0) {
  850. toxicSpillArchdukeCb.checked = "Yes";
  851. } else {
  852. toxicSpillArchdukeCb.checked = "";
  853. }
  854. var toxicSpillArchdukeCbLabel = document.createElement('label')
  855. toxicSpillArchdukeCbLabel.htmlFor = "toxicSpillArchdukeCbLabel";
  856. toxicSpillArchdukeCbLabel.appendChild(document.createTextNode('ADuke'));
  857. $(toxicSpillArchdukeCbLabel).css({
  858. 'float': 'left',
  859. 'width': '35px',
  860. 'padding': '1px',
  861. })
  862. $(toxicSpillArchdukeCb).css({
  863. 'float': 'left',
  864. 'width': '20px',
  865. "marginRight": "5px"
  866. })
  867. toxicSpillOptions.appendChild(toxicSpillArchdukeCbLabel);
  868. toxicSpillOptions.appendChild(toxicSpillArchdukeCb);
  869. //
  870. //Timer Options
  871. var timerOptions = document.createElement("div");
  872. timerOptions.classList.add("timerOptions");
  873. var timerOptionsLabel = document.createElement("div");
  874. timerOptionsLabel.classList.add("timerOptionsLabel");
  875. var timerOptionsLabelText = document.createTextNode("Timer Options");
  876. timerOptionsLabel.appendChild(timerOptionsLabelText);
  877. timerOptions.appendChild(timerOptionsLabel);
  878. $(timerOptions).css({
  879. 'float': 'left',
  880. 'width': '40%',
  881. 'marginLeft': '25px',
  882. })
  883. $(timerOptionsLabel).css({
  884. 'float': 'left',
  885. 'width': '100%',
  886. 'font-weight': 700,
  887. "marginRight": "5px",
  888. })
  889. var timerOptionsUpdate = document.createElement("div");
  890. timerOptionsUpdate.classList.add("timerOptionsUpdate");
  891. var timerOptionsUpdateLabel = document.createElement("div");
  892. timerOptionsUpdateLabel.classList.add("timerOptionsUpdateLabel");
  893. var timerOptionsUpdateLabelText = document.createTextNode('Update Interval (min)');
  894. $(timerOptionsUpdate).css({
  895. 'float': 'left',
  896. 'width': '100%',
  897. 'vertical-align': 'middle',
  898. 'margin-bottom': '3px'
  899. })
  900. $(timerOptionsUpdateLabel).css({
  901. 'float': 'left',
  902. 'width': '40%',
  903. 'vertical-align': 'middle',
  904. })
  905. timerOptionsUpdateLabel.appendChild(timerOptionsUpdateLabelText);
  906. timerOptionsUpdate.appendChild(timerOptionsUpdateLabel)
  907. //Timer Interval
  908. var updateInterval = localStorage.getItem('UpdateInterval');
  909. var timerOptionsUpdateRadioA = document.createElement('input');
  910. timerOptionsUpdateRadioA.type = "radio";
  911. timerOptionsUpdateRadioA.name = "timerOptionsUpdateRadioA";
  912. timerOptionsUpdateRadioA.value = "value";
  913. timerOptionsUpdateRadioA.id = "timerOptionsUpdateRadioA";
  914. if (updateInterval == 1) {
  915. timerOptionsUpdateRadioA.checked = true;
  916. }
  917. var timerOptionsUpdateRadioALabel = document.createElement('label')
  918. timerOptionsUpdateRadioALabel.htmlFor = "timerOptionsUpdateRadioLabel";
  919. timerOptionsUpdateRadioALabel.appendChild(document.createTextNode('1'));
  920. $(timerOptionsUpdateRadioALabel).css({
  921. 'float': 'left',
  922. 'width': '10px',
  923. 'vertical-align': 'middle'
  924. })
  925. $(timerOptionsUpdateRadioA).css({
  926. 'float': 'left',
  927. 'width': '15px',
  928. 'vertical-align': 'middle'
  929. })
  930. timerOptionsUpdate.appendChild(timerOptionsUpdateRadioA);
  931. timerOptionsUpdate.appendChild(timerOptionsUpdateRadioALabel);
  932. //
  933. var timerOptionsUpdateRadioB = document.createElement('input');
  934. timerOptionsUpdateRadioB.type = "radio";
  935. timerOptionsUpdateRadioB.name = "timerOptionsUpdateRadioB";
  936. timerOptionsUpdateRadioB.value = "value";
  937. timerOptionsUpdateRadioB.id = "timerOptionsUpdateRadioB";
  938. if ((updateInterval == null) || (updateInterval == 5)) {
  939. timerOptionsUpdateRadioB.checked = true;
  940. }
  941. var timerOptionsUpdateRadioBLabel = document.createElement('label')
  942. timerOptionsUpdateRadioBLabel.htmlFor = "timerOptionsUpdateRadioBLabel";
  943. timerOptionsUpdateRadioBLabel.appendChild(document.createTextNode('5'));
  944. $(timerOptionsUpdateRadioBLabel).css({
  945. 'float': 'left',
  946. 'width': '10px',
  947. 'vertical-align': 'middle'
  948. })
  949. $(timerOptionsUpdateRadioB).css({
  950. 'float': 'left',
  951. 'width': '15px',
  952. 'vertical-align': 'middle'
  953. })
  954. timerOptionsUpdate.appendChild(timerOptionsUpdateRadioB);
  955. timerOptionsUpdate.appendChild(timerOptionsUpdateRadioBLabel);
  956. //
  957. var timerOptionsUpdateRadioC = document.createElement('input');
  958. timerOptionsUpdateRadioC.type = "radio";
  959. timerOptionsUpdateRadioC.name = "timerOptionsUpdateRadioC";
  960. timerOptionsUpdateRadioC.value = "value";
  961. timerOptionsUpdateRadioC.id = "timerOptionsUpdateRadioC";
  962. if (updateInterval == 15) {
  963. timerOptionsUpdateRadioC.checked = true;
  964. }
  965. var timerOptionsUpdateRadioCLabel = document.createElement('label')
  966. timerOptionsUpdateRadioCLabel.htmlFor = "timerOptionsUpdateRadioCLabel";
  967. timerOptionsUpdateRadioCLabel.appendChild(document.createTextNode('15'));
  968. $(timerOptionsUpdateRadioCLabel).css({
  969. 'float': 'left',
  970. 'width': '10px',
  971. 'vertical-align': 'middle'
  972. })
  973. $(timerOptionsUpdateRadioC).css({
  974. 'float': 'left',
  975. 'width': '15px',
  976. 'vertical-align': 'middle'
  977. })
  978. timerOptionsUpdate.appendChild(timerOptionsUpdateRadioC);
  979. timerOptionsUpdate.appendChild(timerOptionsUpdateRadioCLabel);
  980. timerOptions.appendChild(timerOptionsUpdate);
  981. //Reminder Window
  982. var remindInterval = localStorage.getItem('RemindInterval');
  983. var timerOptionsWindow = document.createElement("div");
  984. timerOptionsWindow.classList.add("timerOptionsWindow");
  985. var timerOptionsWindowLabel = document.createElement("div");
  986. timerOptionsWindowLabel.classList.add("timerOptionsWindowLabel");
  987. var timerOptionsWindowLabelText = document.createTextNode('Remind Me Within (min)');
  988. $(timerOptionsWindow).css({
  989. 'float': 'left',
  990. 'width': '100%',
  991. 'vertical-align': 'middle',
  992. 'margin-bottom': '3px'
  993. })
  994. $(timerOptionsWindowLabel).css({
  995. 'float': 'left',
  996. 'width': '40%',
  997. 'vertical-align': 'middle'
  998. })
  999. timerOptionsWindowLabel.appendChild(timerOptionsWindowLabelText);
  1000. timerOptionsWindow.appendChild(timerOptionsWindowLabel);
  1001. var timerOptionsWindowRadioA = document.createElement('input');
  1002. timerOptionsWindowRadioA.type = "radio";
  1003. timerOptionsWindowRadioA.name = "timerOptionsWindowRadioA";
  1004. timerOptionsWindowRadioA.value = "value";
  1005. timerOptionsWindowRadioA.id = "timerOptionsWindowRadioA";
  1006. if (remindInterval == 5) {
  1007. timerOptionsWindowRadioA.checked = true;
  1008. }
  1009. var timerOptionsWindowRadioALabel = document.createElement('label')
  1010. timerOptionsWindowRadioALabel.htmlFor = "timerOptionsWindowRadioALabel";
  1011. timerOptionsWindowRadioALabel.appendChild(document.createTextNode('5'));
  1012. $(timerOptionsWindowRadioALabel).css({
  1013. 'float': 'left',
  1014. 'width': '10px',
  1015. 'vertical-align': 'middle'
  1016. })
  1017. $(timerOptionsWindowRadioA).css({
  1018. 'float': 'left',
  1019. 'width': '15px',
  1020. 'vertical-align': 'middle'
  1021. })
  1022. timerOptionsWindow.appendChild(timerOptionsWindowRadioA);
  1023. timerOptionsWindow.appendChild(timerOptionsWindowRadioALabel);
  1024. //
  1025. var timerOptionsWindowRadioB = document.createElement('input');
  1026. timerOptionsWindowRadioB.type = "radio";
  1027. timerOptionsWindowRadioB.name = "timerOptionsWindowRadioB";
  1028. timerOptionsWindowRadioB.value = "value";
  1029. timerOptionsWindowRadioB.id = "timerOptionsWindowRadioB";
  1030. if ((remindInterval == null) || (remindInterval == 10)) {
  1031. timerOptionsWindowRadioB.checked = true;
  1032. }
  1033. var timerOptionsWindowRadioBLabel = document.createElement('label')
  1034. timerOptionsWindowRadioBLabel.htmlFor = "timerOptionsWindowRadioBLabel";
  1035. timerOptionsWindowRadioBLabel.appendChild(document.createTextNode('10'));
  1036. $(timerOptionsWindowRadioBLabel).css({
  1037. 'float': 'left',
  1038. 'width': '10px',
  1039. 'vertical-align': 'middle'
  1040. })
  1041. $(timerOptionsWindowRadioB).css({
  1042. 'float': 'left',
  1043. 'width': '15px',
  1044. 'vertical-align': 'middle'
  1045. })
  1046. timerOptionsWindow.appendChild(timerOptionsWindowRadioB);
  1047. timerOptionsWindow.appendChild(timerOptionsWindowRadioBLabel);
  1048. //
  1049. var timerOptionsWindowRadioC = document.createElement('input');
  1050. timerOptionsWindowRadioC.type = "radio";
  1051. timerOptionsWindowRadioC.name = "timerOptionsWindowRadioC";
  1052. timerOptionsWindowRadioC.value = "value";
  1053. timerOptionsWindowRadioC.id = "timerOptionsWindowRadioC";
  1054. if (remindInterval == 15) {
  1055. timerOptionsWindowRadioC.checked = true;
  1056. }
  1057. var timerOptionsWindowRadioCLabel = document.createElement('label')
  1058. timerOptionsWindowRadioCLabel.htmlFor = "timerOptionsWindowRadioCLabel";
  1059. timerOptionsWindowRadioCLabel.appendChild(document.createTextNode('15'));
  1060. $(timerOptionsWindowRadioCLabel).css({
  1061. 'float': 'left',
  1062. 'width': '10px',
  1063. 'vertical-align': 'middle'
  1064. })
  1065. $(timerOptionsWindowRadioC).css({
  1066. 'float': 'left',
  1067. 'width': '15px',
  1068. 'vertical-align': 'middle'
  1069. })
  1070. timerOptionsWindow.appendChild(timerOptionsWindowRadioC);
  1071. timerOptionsWindow.appendChild(timerOptionsWindowRadioCLabel);
  1072. timerOptions.appendChild(timerOptionsWindow);
  1073. //Other Options
  1074. const killSwitch = localStorage.getItem('KillSwitch')
  1075. var killSwitchCB = document.createElement('input');
  1076. killSwitchCB.type = "checkbox";
  1077. killSwitchCB.name = "killSwitchCB";
  1078. killSwitchCB.value = "value";
  1079. killSwitchCB.id = "killSwitchCB";
  1080. if (killSwitch == "Y") {
  1081. killSwitchCB.checked = "Yes";
  1082. } else {
  1083. killSwitchCB.checked = "";
  1084. }
  1085. var killSwitchCBLabel = document.createElement('label')
  1086. killSwitchCBLabel.htmlFor = "killSwitchCBLabel";
  1087. killSwitchCBLabel.appendChild(document.createTextNode('Remind Me Only Once'));
  1088. $(killSwitchCBLabel).css({
  1089. 'float': 'left',
  1090. 'width': '118px',
  1091. 'padding': '1px',
  1092. })
  1093. $(killSwitchCB).css({
  1094. 'float': 'left',
  1095. 'width': '20px',
  1096. "marginRight": "100px"
  1097. })
  1098. timerOptions.appendChild(killSwitchCBLabel);
  1099. timerOptions.appendChild(killSwitchCB);
  1100. //
  1101. const disarm = localStorage.getItem('DAT')
  1102. var disarmCB = document.createElement('input');
  1103. disarmCB.type = "checkbox";
  1104. disarmCB.name = "disarmCB";
  1105. disarmCB.value = "value";
  1106. disarmCB.id = "disarmCB";
  1107. if (disarm == "Y") {
  1108. disarmCB.checked = "Yes";
  1109. } else {
  1110. disarmCB.checked = "";
  1111. }
  1112. var disarmCBLabel = document.createElement('label')
  1113. disarmCBLabel.htmlFor = "disarmCBLabel";
  1114. disarmCBLabel.appendChild(document.createTextNode('Disarm Bait After Travel'));
  1115. $(disarmCBLabel).css({
  1116. 'float': 'left',
  1117. 'width': '118px',
  1118. 'padding': '1px',
  1119. })
  1120. $(disarmCB).css({
  1121. 'float': 'left',
  1122. 'width': '20px',
  1123. "marginRight": "5px"
  1124. })
  1125. timerOptions.appendChild(disarmCBLabel);
  1126. timerOptions.appendChild(disarmCB);
  1127. //Panic Button
  1128. var panicButton = document.createElement("button");
  1129. panicButton.id = "panicButton";
  1130. panicButton.innerText = "Travel Back";
  1131. panicButton.addEventListener("click", travelBack);
  1132. timerOptions.appendChild(panicButton);
  1133. $(panicButton).css({
  1134. 'width': '100px',
  1135. 'float': 'left',
  1136. 'marginRight': 5 + "px",
  1137. 'marginLeft': 35 + "px"
  1138. })
  1139. //
  1140. tinkerPanel.appendChild(forbiddenGroveOptions);
  1141. tinkerPanel.appendChild(balacksCoveOptions);
  1142. tinkerPanel.appendChild(seasonalGardenOptions);
  1143. tinkerPanel.appendChild(toxicSpillOptions);
  1144. tinkerPanel.appendChild(timerOptions);
  1145. //Last
  1146. timerBox.prepend(tinkerPanel)
  1147. }
  1148. $(document).on('click', '#timerOptionsUpdateRadioA', function() {
  1149. $('#timerOptionsUpdateRadioB').prop("checked", false);
  1150. $('#timerOptionsUpdateRadioC').prop("checked", false);
  1151. localStorage.setItem('UpdateInterval', 1)
  1152. })
  1153. $(document).on('click', '#timerOptionsUpdateRadioB', function() {
  1154. $('#timerOptionsUpdateRadioA').prop("checked", false);
  1155. $('#timerOptionsUpdateRadioC').prop("checked", false);
  1156. localStorage.setItem('UpdateInterval', 5)
  1157. })
  1158. $(document).on('click', '#timerOptionsUpdateRadioC', function() {
  1159. $('#timerOptionsUpdateRadioA').prop("checked", false);
  1160. $('#timerOptionsUpdateRadioB').prop("checked", false);
  1161. localStorage.setItem('UpdateInterval', 15)
  1162. })
  1163. $(document).on('click', '#timerOptionsWindowRadioA', function() {
  1164. $('#timerOptionsWindowRadioB').prop("checked", false);
  1165. $('#timerOptionsWindowRadioC').prop("checked", false);
  1166. localStorage.setItem('RemindInterval', 5)
  1167. })
  1168. $(document).on('click', '#timerOptionsWindowRadioB', function() {
  1169. $('#timerOptionsWindowRadioA').prop("checked", false);
  1170. $('#timerOptionsWindowRadioC').prop("checked", false);
  1171. localStorage.setItem('RemindInterval', 10)
  1172. })
  1173. $(document).on('click', '#timerOptionsWindowRadioC', function() {
  1174. $('#timerOptionsWindowRadioA').prop("checked", false);
  1175. $('#timerOptionsWindowRadioB').prop("checked", false);
  1176. localStorage.setItem('RemindInterval', 15)
  1177. })
  1178. $(document).on('change', '#killSwitchCB', function() {
  1179. if (this.checked) {
  1180. this.checked = "Yes";
  1181. localStorage.setItem('KillSwitch', 'Y')
  1182. } else {
  1183. this.checked = "";
  1184. localStorage.setItem('KillSwitch', 'N')
  1185. }
  1186. })
  1187. $(document).on('change', '#disarmCB', function() {
  1188. if (this.checked) {
  1189. this.checked = "Yes";
  1190. localStorage.setItem('DAT', 'Y')
  1191. } else {
  1192. this.checked = "";
  1193. localStorage.setItem('DAT', 'N')
  1194. }
  1195. })
  1196.  
  1197.  
  1198. //===================================== Timers ======================================
  1199. //
  1200. //
  1201. //===================================================================================
  1202. function startTimers() {
  1203. localStorage.setItem("mainTimer", 0);
  1204. runTimers();
  1205. }
  1206.  
  1207. function runTimers() {
  1208. updateText();
  1209. var myTimer = "";
  1210. const updateInterval = parseInt(localStorage.getItem('UpdateInterval'), 10)
  1211. if (updateInterval == null) {
  1212. myTimer = setInterval(updateText, 60000);
  1213. } else {
  1214. myTimer = setInterval(updateText, updateInterval * 60000);
  1215. }
  1216. }
  1217.  
  1218. function updateText() {
  1219. if ($(".forbiddenGrove").length > 0) updateForbiddenGroveTimer();
  1220. if ($(".balacksCove").length > 0) updateBalacksCoveTimer();
  1221. if ($(".seasonalGarden").length > 0) updateSeasonalGardenTimer();
  1222. if ($(".toxicSpill").length > 0) updateToxicSpillTimer();
  1223. }
  1224. //===================================== Forbidden Grove ======================================
  1225. function buildForbiddenGrove() {
  1226. if ($(".forbiddenGrove").length > 0) return;
  1227. var timerBox = $(".timerBox");
  1228. var forbiddenGrove = document.createElement("div");
  1229. forbiddenGrove.classList.add("forbiddenGrove");
  1230. $(forbiddenGrove).css({
  1231. 'border': '1px solid black',
  1232. 'width': '21%',
  1233. 'height': '70%',
  1234. 'padding': 2 + "px"
  1235. });
  1236. //Header
  1237. var forbiddenGroveHeader = document.createElement("div");
  1238. forbiddenGroveHeader.classList.add("forbiddenGroveHeader");
  1239. var forbiddenGroveHeaderLabel = document.createElement("div");
  1240. forbiddenGroveHeaderLabel.classList.add("forbiddenGroveHeaderLabel");
  1241. var forbiddenGroveHeaderLabelText = document.createTextNode("Forbidden Grove is:");
  1242. forbiddenGroveHeaderLabel.appendChild(forbiddenGroveHeaderLabelText);
  1243. var forbiddenGroveHeaderValue = document.createElement("div");
  1244. forbiddenGroveHeaderValue.classList.add("forbiddenGroveHeaderValue");
  1245. var forbiddenGroveHeaderValueText = document.createTextNode("Open");
  1246. forbiddenGroveHeaderValue.appendChild(forbiddenGroveHeaderValueText);
  1247. $(forbiddenGroveHeaderLabel).css({
  1248. 'float': 'left',
  1249. 'font-weight': 700,
  1250. "marginRight": "5px"
  1251. })
  1252. $(forbiddenGroveHeaderValue).css({
  1253. "marginLeft": "100px"
  1254. });
  1255. forbiddenGroveHeader.appendChild(forbiddenGroveHeaderLabel);
  1256. forbiddenGroveHeader.appendChild(forbiddenGroveHeaderValue);
  1257. //Close
  1258. var forbiddenGroveCloses = document.createElement("div");
  1259. forbiddenGroveCloses.classList.add("forbiddenGroveCloses");
  1260. var forbiddenGroveClosesLabel = document.createElement("div");
  1261. forbiddenGroveClosesLabel.classList.add("forbiddenGroveClosesLabel");
  1262. var forbiddenGroveClosesLabelText = document.createTextNode("Closes in:");
  1263. forbiddenGroveClosesLabel.appendChild(forbiddenGroveClosesLabelText);
  1264. var forbiddenGroveClosesValue = document.createElement("div");
  1265. forbiddenGroveClosesValue.classList.add("forbiddenGroveClosesValue");
  1266. var forbiddenGroveClosesValueText = document.createTextNode("?");
  1267. forbiddenGroveClosesValue.appendChild(forbiddenGroveClosesValueText);
  1268. $(forbiddenGroveClosesLabel).css({
  1269. 'float': 'left',
  1270. 'font-weight': 700,
  1271. "marginRight": "5px"
  1272. })
  1273. forbiddenGroveCloses.appendChild(forbiddenGroveClosesLabel);
  1274. forbiddenGroveCloses.appendChild(forbiddenGroveClosesValue);
  1275. //Open
  1276. var forbiddenGroveOpens = document.createElement("div");
  1277. forbiddenGroveOpens.classList.add("forbiddenGroveOpens");
  1278. var forbiddenGroveOpensLabel = document.createElement("div");
  1279. forbiddenGroveOpensLabel.classList.add("forbiddenGroveOpensLabel");
  1280. var forbiddenGroveOpensLabelText = document.createTextNode("Opens in:");
  1281. forbiddenGroveOpensLabel.appendChild(forbiddenGroveOpensLabelText);
  1282. var forbiddenGroveOpensValue = document.createElement("div");
  1283. forbiddenGroveOpensValue.classList.add("forbiddenGroveOpensValue");
  1284. var forbiddenGroveOpensValueText = document.createTextNode("??");
  1285. forbiddenGroveOpensValue.appendChild(forbiddenGroveOpensValueText);
  1286. $(forbiddenGroveOpensLabel).css({
  1287. 'float': 'left',
  1288. 'font-weight': 700,
  1289. "marginRight": "5px"
  1290. })
  1291. forbiddenGroveOpens.appendChild(forbiddenGroveOpensLabel);
  1292. forbiddenGroveOpens.appendChild(forbiddenGroveOpensValue);
  1293.  
  1294. //Append
  1295. forbiddenGrove.appendChild(forbiddenGroveHeader);
  1296. forbiddenGrove.appendChild(forbiddenGroveCloses);
  1297. forbiddenGrove.appendChild(forbiddenGroveOpens);
  1298. return forbiddenGrove;
  1299. }
  1300.  
  1301. function updateForbiddenGroveTimer() {
  1302. if ($(".forbiddenGrove").length < 1) return;
  1303. const remind = localStorage.getItem('RemindGrove');
  1304. const remindInterval = parseInt(localStorage.getItem('RemindInterval'), 10);
  1305. var forbiddenGrove = $(".forbiddenGrove");
  1306. var firstGroveOpen = 1285704000;
  1307. var now = todayNow();
  1308. let timePassedHours = (now - firstGroveOpen) / 3600;
  1309. var rotaionLenght = 20;
  1310. var rotationsExact = timePassedHours / rotaionLenght;
  1311. var rotationsInteger = Math.trunc(rotationsExact);
  1312. var partialrotation = (rotationsExact - rotationsInteger) * rotaionLenght;
  1313. if (partialrotation < 16) {
  1314. //Open
  1315. $(".forbiddenGroveHeaderValue").text(" OPEN");
  1316. $(".forbiddenGroveHeaderValue").css({
  1317. 'color': 'green'
  1318. })
  1319. var timeCloses = (16 - partialrotation).toPrecision(4);
  1320. var closesHours = Math.trunc(timeCloses);
  1321. var closesMinutes = Math.ceil((timeCloses - closesHours) * 60);
  1322. $(".forbiddenGroveClosesValue").text(formatOutput(0, closesHours, closesMinutes));
  1323. $(".forbiddenGroveClosesValue").css({
  1324. 'float': 'right'
  1325. }),
  1326. $(".forbiddenGroveOpensLabel").text("Opens Again in:");
  1327. $(".forbiddenGroveOpensValue").text(formatOutput(0, (closesHours + 4), closesMinutes));
  1328. $(".forbiddenGroveOpensValue").css({
  1329. 'float': 'right'
  1330. }),
  1331. forbiddenGrove.append($(".forbiddenGroveOpens"))
  1332. if ((closesHours == 0) && (closesMinutes <= remindInterval) && (remind.search('C') >= 0) && (remind.search('N') < 0)) {
  1333. if (confirm('The forbidden grove is closing soon, travel there now?') == true) {
  1334. travelToGrove("skip");
  1335. }
  1336. if (localStorage.getItem('KillSwitch') == 'Y') {
  1337. $("#forbiddenGroveCb").click();
  1338. }
  1339. }
  1340. } else {
  1341. //Closed
  1342. $(".forbiddenGroveHeaderValue").text("CLOSED")
  1343. $(".forbiddenGroveHeaderValue").css({
  1344. 'color': 'red'
  1345. })
  1346. var timeOpens = (rotaionLenght - partialrotation).toPrecision(4);
  1347. var opensHours = Math.trunc(timeOpens);
  1348. var opensMinutes = Math.ceil((timeOpens - opensHours) * 60);
  1349. $(".forbiddenGroveOpensValue").text(formatOutput(0, opensHours, opensMinutes));
  1350. $(".forbiddenGroveOpensValue").css({
  1351. 'float': 'right'
  1352. }),
  1353. $(".forbiddenGroveClosesLabel").text("Next Close in:");
  1354. $(".forbiddenGroveClosesValue").text(formatOutput(0, (opensHours + 16), opensMinutes));
  1355. $(".forbiddenGroveClosesValue").css({
  1356. 'float': 'right'
  1357. }),
  1358. forbiddenGrove.append($(".forbiddenGroveCloses"))
  1359. if ((opensHours == 0) && (opensMinutes <= remindInterval) && (remind.search('O') >= 0) && (remind.search('N') < 0)) {
  1360. alert('The forbidden grove is opening soon')
  1361. if (localStorage.getItem('KillSwitch') == 'Y') {
  1362. $("#forbiddenGroveCb").click();
  1363. }
  1364. }
  1365. }
  1366. }
  1367. $(document).on('change', '#forbiddenGroveCb', function() {
  1368. if (this.checked) {
  1369. this.checked = "Yes";
  1370. } else {
  1371. this.checked = "";
  1372. }
  1373. remindGrove(this.name, this.checked);
  1374. })
  1375.  
  1376. $(document).on('change', '#forbiddenGroveOpenCb', function() {
  1377. if (this.checked) {
  1378. this.checked = "Yes";
  1379. } else {
  1380. this.checked = "";
  1381. }
  1382. remindGrove(this.name, this.checked);
  1383. })
  1384.  
  1385. $(document).on('change', '#forbiddenGroveCloseCb', function() {
  1386. if (this.checked) {
  1387. this.checked = "Yes";
  1388. } else {
  1389. this.checked = "";
  1390. }
  1391. remindGrove(this.name, this.checked);
  1392. })
  1393.  
  1394. //if master checked and no other - remind all
  1395. //if master not checked - no reminder
  1396. //if master checked and 1 or more checked - remind the ones checked.
  1397. // N none
  1398. // O open
  1399. // C closed
  1400. function remindGrove(cb, checked) {
  1401. var main = $('#forbiddenGroveCb');
  1402. var open = $('#forbiddenGroveOpenCb');
  1403. var closed = $('#forbiddenGroveCloseCb');
  1404. const mName = main.prop("name");
  1405. const oName = open.prop("name");
  1406. const cName = closed.prop("name");;
  1407. const mChecked = main.prop("checked");
  1408. const oChecked = open.prop("checked");
  1409. const cChecked = closed.prop("checked");
  1410. //-----------------------------------------------------------------------
  1411. var remindGrove = localStorage.getItem('RemindGrove')
  1412. var remindNone = remindGrove.search("N");
  1413. var remindOpen = remindGrove.search("O");
  1414. var remindClosed = remindGrove.search("C");
  1415. //main was checked
  1416. if ((cb == mName) && (checked == true)) {
  1417. if ((oChecked == false) && (cChecked == false)) {
  1418. remindGrove = "CO";
  1419. } else if ((oChecked == true) && (cChecked == true)) {
  1420. remindGrove = "CO";
  1421. } else if ((oChecked == true) && (cChecked == false)) {
  1422. remindGrove = remindGrove.replace("N", "");
  1423. if (remindOpen < 0) {
  1424. remindGrove = remindGrove.concat("O");
  1425. }
  1426. } else if ((oChecked == false) && (cChecked == true)) {
  1427. remindGrove = remindGrove.replace("N", "");
  1428. if (remindClosed < 0) {
  1429. remindGrove = remindGrove.concat("C");
  1430. }
  1431. }
  1432. //main was unchecked
  1433. } else if ((cb == mName) && (checked == false)) {
  1434. if ((oChecked == false) && (cChecked == false)) {
  1435. remindGrove = 'N';
  1436. } else if (remindNone < 0) {
  1437. remindGrove = remindGrove.concat("N");
  1438. }
  1439. //open was checked
  1440. } else if ((cb == oName) && (checked == true)) {
  1441. if (mChecked == false) {
  1442. if (remindOpen < 0) {
  1443. remindGrove = remindGrove.concat("O");
  1444. }
  1445. } else if (cChecked == true) {
  1446. remindGrove = remindGrove.replace("N", "");
  1447. if (remindOpen < 0) {
  1448. remindGrove = remindGrove.concat("O");
  1449. }
  1450. } else {
  1451. remindGrove = "O";
  1452. }
  1453. //open was unchecked
  1454. } else if ((cb == oName) && (checked == false)) {
  1455. if (mChecked == false) {
  1456. if (remindOpen >= 0) {
  1457. remindGrove = remindGrove.replace("O", "");
  1458. }
  1459. } else if (cChecked == true) {
  1460. if (remindOpen >= 0) {
  1461. remindGrove = remindGrove.replace("O", "");
  1462. }
  1463. } else if ((oChecked == false) && (cChecked == false)) {
  1464. remindGrove = "CO";
  1465. }
  1466. //closed was checked
  1467. } else if ((cb == cName) && (checked == true)) {
  1468. if (mChecked == false) {
  1469. if (remindClosed < 0) {
  1470. remindGrove = remindGrove.concat("C");
  1471. }
  1472. } else if (oChecked == true) {
  1473. remindGrove = remindGrove.replace("N", "");
  1474. if (remindClosed < 0) {
  1475. remindGrove = remindGrove.concat("C");
  1476. }
  1477. } else {
  1478. remindGrove = "C";
  1479. }
  1480. //closed was unchecked
  1481. } else if ((cb == cName) && (checked == false)) {
  1482. if (mChecked == false) {
  1483. if (remindClosed >= 0) {
  1484. remindGrove = remindGrove.replace("C", "");
  1485. }
  1486. } else if (oChecked == true) {
  1487. if (remindClosed >= 0) {
  1488. remindGrove = remindGrove.replace("C", "");
  1489. }
  1490. } else if ((oChecked == false) && (cChecked == false)) {
  1491. remindGrove = "CO";
  1492. }
  1493. }
  1494. localStorage.setItem('RemindGrove', remindGrove)
  1495. }
  1496.  
  1497. //====================================== Balacks's Cove ======================================
  1498. function buildBalacksCove() {
  1499. if ($(".balacksCove").length > 0) return;
  1500. var timerBox = $(".timerBox");
  1501. var balacksCove = document.createElement("div");
  1502. balacksCove.classList.add("balacksCove");
  1503. $(balacksCove).css({
  1504. 'border': '1px solid black',
  1505. 'width': '25%',
  1506. 'height': '70%',
  1507. 'padding': 2 + "px"
  1508. });
  1509. //Header
  1510. var balacksCoveHeader = document.createElement("div");
  1511. balacksCoveHeader.classList.add("balacksCoveHeader");
  1512. var balacksCoveHeaderLabel = document.createElement("div");
  1513. balacksCoveHeaderLabel.classList.add("balacksCoveHeaderLabel");
  1514. var balacksCoveHeaderLabelText = document.createTextNode("Balack's Cove Tide is:");
  1515. balacksCoveHeaderLabel.appendChild(balacksCoveHeaderLabelText);
  1516. var balacksCoveHeaderValue = document.createElement("div");
  1517. balacksCoveHeaderValue.classList.add("balacksCoveHeaderValue");
  1518. var balacksCoveHeaderValueText = document.createTextNode("Low");
  1519. balacksCoveHeaderValue.appendChild(balacksCoveHeaderValueText);
  1520. $(balacksCoveHeaderLabel).css({
  1521. 'float': 'left',
  1522. 'font-weight': 700,
  1523. "marginRight": "5px"
  1524. })
  1525. $(balacksCoveHeaderValue).css({
  1526. "marginLeft": "100px"
  1527. });
  1528. balacksCoveHeader.appendChild(balacksCoveHeaderLabel);
  1529. balacksCoveHeader.appendChild(balacksCoveHeaderValue);
  1530. //Low
  1531. var balacksCoveLow = document.createElement("div");
  1532. balacksCoveLow.classList.add("balacksCoveLow");
  1533. var balacksCoveLowLabel = document.createElement("div");
  1534. balacksCoveLowLabel.classList.add("balacksCoveLowLabel");
  1535. var balacksCoveLowLabelText = document.createTextNode("Low Tide in:");
  1536. balacksCoveLowLabel.appendChild(balacksCoveLowLabelText);
  1537. var balacksCoveLowValue = document.createElement("div");
  1538. balacksCoveLowValue.classList.add("balacksCoveLowValue");
  1539. var balacksCoveLowValueText = document.createTextNode("?");
  1540. balacksCoveLowValue.appendChild(balacksCoveLowValueText);
  1541. $(balacksCoveLowLabel).css({
  1542. 'float': 'left',
  1543. 'width': '100px',
  1544. 'font-weight': 700,
  1545. "marginRight": "5px"
  1546. })
  1547. balacksCoveLow.appendChild(balacksCoveLowLabel);
  1548. balacksCoveLow.appendChild(balacksCoveLowValue);
  1549. //Medium
  1550. var balacksCoveMid = document.createElement("div");
  1551. balacksCoveMid.classList.add("balacksCoveMid");
  1552. var balacksCoveMidLabel = document.createElement("div");
  1553. balacksCoveMidLabel.classList.add("balacksCoveMidLabel");
  1554. var balacksCoveMidLabelText = document.createTextNode("Mid Tide in:");
  1555. balacksCoveMidLabel.appendChild(balacksCoveMidLabelText);
  1556. var balacksCoveMidValue = document.createElement("div");
  1557. balacksCoveMidValue.classList.add("balacksCoveMidValue");
  1558. var balacksCoveMidValueText = document.createTextNode("??");
  1559. balacksCoveMidValue.appendChild(balacksCoveMidValueText);
  1560. $(balacksCoveMidLabel).css({
  1561. 'float': 'left',
  1562. 'width': '100px',
  1563. 'font-weight': 700,
  1564. "marginRight": "5px"
  1565. })
  1566. balacksCoveMid.appendChild(balacksCoveMidLabel);
  1567. balacksCoveMid.appendChild(balacksCoveMidValue);
  1568. //High
  1569. var balacksCoveHigh = document.createElement("div");
  1570. balacksCoveHigh.classList.add("balacksCoveHigh");
  1571. var balacksCoveHighLabel = document.createElement("div");
  1572. balacksCoveHighLabel.classList.add("balacksCoveHighLabel");
  1573. var balacksCoveHighLabelText = document.createTextNode("High Tide in:");
  1574. balacksCoveHighLabel.appendChild(balacksCoveHighLabelText);
  1575. var balacksCoveHighValue = document.createElement("div");
  1576. balacksCoveHighValue.classList.add("balacksCoveHighValue");
  1577. var balacksCoveHighValueText = document.createTextNode("??");
  1578. balacksCoveHighValue.appendChild(balacksCoveHighValueText);
  1579. $(balacksCoveHighLabel).css({
  1580. 'float': 'left',
  1581. 'width': '100px',
  1582. 'font-weight': 700,
  1583. "marginRight": "5px"
  1584. })
  1585. balacksCoveHigh.appendChild(balacksCoveHighLabel);
  1586. balacksCoveHigh.appendChild(balacksCoveHighValue);
  1587. //Append
  1588. balacksCove.appendChild(balacksCoveHeader);
  1589. balacksCove.appendChild(balacksCoveLow);
  1590. balacksCove.appendChild(balacksCoveMid);
  1591. balacksCove.appendChild(balacksCoveHigh);
  1592. return balacksCove;
  1593. }
  1594.  
  1595. function updateBalacksCoveTimer() {
  1596. if ($(".balacksCove").length < 1) return;
  1597. const remind = localStorage.getItem('RemindCove');
  1598. const remindInterval = parseInt(localStorage.getItem('RemindInterval'), 10);
  1599. var balacksCove = $(".balacksCove");
  1600. var firstCoveLow = 1294680060;
  1601. var now = todayNow();
  1602. let timePassedHours = (now - firstCoveLow) / 3600;
  1603. var rotaionLenght = 18.6666666666666666666666666666666666666667;
  1604. var rotationsExact = timePassedHours / rotaionLenght;
  1605. var rotationsInteger = Math.trunc(rotationsExact);
  1606. var partialrotation = (rotationsExact - rotationsInteger) * rotaionLenght;
  1607. if (partialrotation < 16) {
  1608. //Low
  1609. $(".balacksCoveHeaderValue").text("LOW");
  1610. $(".balacksCoveHeaderValue").css({
  1611. 'color': 'green'
  1612. })
  1613. var timeMid = (16 - partialrotation).toPrecision(4);
  1614. var midHours = Math.trunc(timeMid);
  1615. var midMinutes = Math.ceil((timeMid - midHours) * 60);
  1616. $(".balacksCoveMidValue").text(formatOutput(0, midHours, midMinutes));
  1617. $(".balacksCoveMidLabel").text("Mid-Flooding in:")
  1618. $(".balacksCoveHighValue").text(formatOutput(0, (midHours + 1), midMinutes));
  1619. $(".balacksCoveLowLabel").text("Low Again in:");
  1620. $(".balacksCoveMidValue").css({
  1621. 'float': 'right'
  1622. })
  1623. $(".balacksCoveHighValue").css({
  1624. 'float': 'right'
  1625. })
  1626. $(".balacksCoveLowValue").css({
  1627. 'float': 'right'
  1628. })
  1629. var lowHours = midHours + 2;
  1630. var lowMinutes = midMinutes + 40;
  1631. if (lowMinutes >= 60) {
  1632. lowMinutes = lowMinutes - 60;
  1633. lowHours++;
  1634. }
  1635. $(".balacksCoveLowValue").text(formatOutput(0, lowHours, lowMinutes));
  1636. balacksCove.append($(".balacksCoveLow"))
  1637. if ((midHours == 0) && (midMinutes <= remindInterval) && (remind.search('M') >= 0) && (remind.search('N') < 0)) {
  1638. if (confirm('It will be mid tide soon, travel there now?') == true) {
  1639. travelToCove("skip");
  1640. }
  1641. if (localStorage.getItem('KillSwitch') == 'Y') {
  1642. $("#balacksCoveCb").click();
  1643. }
  1644. }
  1645. } else if ((partialrotation >= 16) && (partialrotation < 17)) {
  1646. //Mid (flooding)
  1647. $(".balacksCoveHeaderValue").text("MID-Flooding");
  1648. $(".balacksCoveHeaderValue").css({
  1649. 'color': 'orange'
  1650. })
  1651. var timeHigh = (17 - partialrotation).toPrecision(4);
  1652. var highHours = Math.trunc(timeHigh);
  1653. var highMinutes = Math.ceil((timeHigh - highHours) * 60);
  1654. $(".balacksCoveHighValue").text(formatOutput(0, highHours, highMinutes));
  1655. $(".balacksCoveMidLabel").text("Mid-Ebbing in:")
  1656. var midHours = highHours;
  1657. var midMinutes = highMinutes + 40;
  1658. if (midMinutes >= 60) {
  1659. midMinutes = midMinutes - 60;
  1660. midHours++;
  1661. }
  1662. $(".balacksCoveMidValue").text(formatOutput(0, midHours, midMinutes));
  1663. $(".balacksCoveLowLabel").text("Low Tide in:");
  1664. $(".balacksCoveLowValue").text(formatOutput(0, (midHours + 1), midMinutes));
  1665. $(".balacksCoveMidValue").css({
  1666. 'float': 'right'
  1667. })
  1668. $(".balacksCoveHighValue").css({
  1669. 'float': 'right'
  1670. })
  1671. $(".balacksCoveLowValue").css({
  1672. 'float': 'right'
  1673. })
  1674. balacksCove.append($(".balacksCoveMid"))
  1675. balacksCove.append($(".balacksCoveLow"))
  1676. if ((highHours == 0) && (highMinutes <= remindInterval) && (remind.search('H') >= 0) && (remind.search('N') < 0)) {
  1677. if (confirm('It will be high tide soon, travel there now?') == true) {
  1678. travelToCove("skip");
  1679. }
  1680. if (localStorage.getItem('KillSwitch') == 'Y') {
  1681. $("#balacksCoveCb").click();
  1682. }
  1683. }
  1684. } else if ((partialrotation >= 17) && (partialrotation < 17.6666666667)) {
  1685. //High
  1686. $(".balacksCoveHeaderValue").text("HIGH");
  1687. $(".balacksCoveHeaderValue").css({
  1688. 'color': 'red'
  1689. })
  1690. var timeMid = (17.6666666667 - partialrotation).toPrecision(4);
  1691. var midHours = Math.trunc(timeMid);
  1692. var midMinutes = Math.ceil((timeMid - midHours) * 60);
  1693. $(".balacksCoveMidValue").text(formatOutput(0, midHours, midMinutes));
  1694. $(".balacksCoveMidLabel").text("Mid-Ebbing in:")
  1695. $(".balacksCoveLowLabel").text("Low Tide in:")
  1696. $(".balacksCoveLowValue").text(formatOutput(0, (midHours + 1), midMinutes));
  1697. $(".balacksCoveMidValue").css({
  1698. 'float': 'right'
  1699. })
  1700. $(".balacksCoveLowValue").css({
  1701. 'float': 'right'
  1702. })
  1703. $(".balacksCoveHigh").hide();
  1704. balacksCove.append($(".balacksCoveLow"))
  1705. if ((midHours == 0) && (midMinutes <= remindInterval) && (remind.search('M') >= 0) && (remind.search('N') < 0)) {
  1706. if (confirm('It will be mid tide soon, travel there now?') == true) {
  1707. travelToCove("skip");
  1708. }
  1709. if (localStorage.getItem('KillSwitch') == 'Y') {
  1710. $("#balacksCoveCb").click();
  1711. }
  1712. }
  1713. } else if (partialrotation >= 17.6666666667) {
  1714. //Mid (ebbing)
  1715. $(".balacksCoveHeaderValue").text("MID-Ebbing");
  1716. $(".balacksCoveHeaderValue").css({
  1717. 'color': 'orange'
  1718. })
  1719. var timeLow = (rotaionLenght - partialrotation).toPrecision(4);
  1720. var lowHours = Math.trunc(timeLow);
  1721. var lowMinutes = Math.ceil((timeLow - lowHours) * 60);
  1722. $(".balacksCoveLowLabel").text("Low Tide in:")
  1723. $(".balacksCoveLowValue").text(formatOutput(0, lowHours, lowMinutes));
  1724. $(".balacksCoveMidLabel").text("Mid-Filling in:")
  1725. $(".balacksCoveMidValue").text(formatOutput(0, lowHours + 16, lowMinutes));
  1726. $(".balacksCoveHighLabel").text("High Tide in:");
  1727. $(".balacksCoveHighValue").text(formatOutput(0, lowHours + 17, lowMinutes));
  1728. $(".balacksCoveMidValue").css({
  1729. 'float': 'right'
  1730. })
  1731. $(".balacksCoveHighValue").css({
  1732. 'float': 'right'
  1733. })
  1734. $(".balacksCoveLowValue").css({
  1735. 'float': 'right'
  1736. })
  1737. balacksCove.append($(".balacksCoveHigh").show())
  1738. if ((lowHours == 0) && (lowMinutes <= remindInterval) && (remind.search('L') >= 0) && (remind.search('N') < 0)) {
  1739. if (confirm('It will be low tide soon, travel there now?') == true) {
  1740. travelToCove("skip");
  1741. }
  1742. if (localStorage.getItem('KillSwitch') == 'Y') {
  1743. $("#balacksCoveCb").click();
  1744. }
  1745. }
  1746. }
  1747. }
  1748. $(document).on('change', '#balacksCoveCb', function() {
  1749. if (this.checked) {
  1750. this.checked = "Yes";
  1751. } else {
  1752. this.checked = "";
  1753. }
  1754. remindCove(this.name, this.checked);
  1755. })
  1756.  
  1757. $(document).on('change', '#balacksCoveLowCb', function() {
  1758. if (this.checked) {
  1759. this.checked = "Yes";
  1760. } else {
  1761. this.checked = "";
  1762. }
  1763. remindCove(this.name, this.checked);
  1764. })
  1765.  
  1766. $(document).on('change', '#balacksCoveMidCb', function() {
  1767. if (this.checked) {
  1768. this.checked = "Yes";
  1769. } else {
  1770. this.checked = "";
  1771. }
  1772. remindCove(this.name, this.checked);
  1773. })
  1774.  
  1775. $(document).on('change', '#balacksCoveHighCb', function() {
  1776. if (this.checked) {
  1777. this.checked = "Yes";
  1778. } else {
  1779. this.checked = "";
  1780. }
  1781. remindCove(this.name, this.checked);
  1782. })
  1783. //if master checked and no other - remind all
  1784. //if master not checked - no reminder
  1785. //if master checked and 1 or more checked - remind the ones checked.
  1786. // N none
  1787. // L low
  1788. // M mid
  1789. // H high
  1790. function remindCove(cb, checked) {
  1791. var main = $('#balacksCoveCb');
  1792. var low = $('#balacksCoveLowCb');
  1793. var mid = $('#balacksCoveMidCb');
  1794. var high = $('#balacksCoveHighCb');
  1795. const mainName = main.prop("name");
  1796. const lName = low.prop("name");
  1797. const mName = mid.prop("name");
  1798. const hName = high.prop("name");
  1799. const mainChecked = main.prop("checked");
  1800. const lChecked = low.prop("checked");
  1801. const mChecked = mid.prop("checked");
  1802. const hChecked = high.prop("checked");
  1803. var remindCove = localStorage.getItem('RemindCove')
  1804. var remindNone = remindCove.search("N");
  1805. var remindLow = remindCove.search("L");
  1806. var remindMid = remindCove.search("M");
  1807. var remindHigh = remindCove.search("H");
  1808. //main was checked
  1809. if ((cb == mainName) && (checked == true)) {
  1810. if ((lChecked == false) && (mChecked == false) && (hChecked == false)) {
  1811. remindCove = "LMH";
  1812. } else if ((lChecked == true) && (mChecked == true) && (hChecked == true)) {
  1813. remindCove = "LMH";
  1814. } else if ((lChecked == true) && (mChecked == false) && (hChecked == false)) {
  1815. remindCove = remindCove.replace("N", "");
  1816. if (remindLow < 0) {
  1817. remindCove = remindCove.concat("L");
  1818. }
  1819. } else if ((lChecked == false) && (mChecked == true) && (hChecked == false)) {
  1820. remindCove = remindCove.replace("N", "");
  1821. if (remindMid < 0) {
  1822. remindCove = remindCove.concat("M");
  1823. }
  1824. } else if ((lChecked == false) && (mChecked == false) && (hChecked == true)) {
  1825. remindCove = remindCove.replace("N", "");
  1826. if (remindHigh < 0) {
  1827. remindCove = remindCove.concat("H");
  1828. }
  1829. } else if ((lChecked == true) && (mChecked == true) && (hChecked == false)) {
  1830. remindCove = remindCove.replace("N", "");
  1831. if (remindLow < 0) {
  1832. remindCove = remindCove.concat("L");
  1833. }
  1834. if (remindMid < 0) {
  1835. remindCove = remindCove.concat("M");
  1836. }
  1837. } else if ((lChecked == true) && (mChecked == false) && (hChecked == true)) {
  1838. remindCove = remindCove.replace("N", "");
  1839. if (remindLow < 0) {
  1840. remindCove = remindCove.concat("L");
  1841. }
  1842. if (remindHigh < 0) {
  1843. remindCove = remindCove.concat("H");
  1844. }
  1845. } else if ((lChecked == false) && (mChecked == true) && (hChecked == true)) {
  1846. remindCove = remindCove.replace("N", "");
  1847. if (remindMid < 0) {
  1848. remindCove = remindCove.concat("M");
  1849. }
  1850. if (remindHigh < 0) {
  1851. remindCove = remindCove.concat("H");
  1852. }
  1853. }
  1854. //main was unchecked
  1855. } else if ((cb == mainName) && (checked == false)) {
  1856. if ((lChecked == false) && (mChecked == false) && (hChecked == false)) {
  1857. remindCove = 'N';
  1858. } else if (remindNone < 0) {
  1859. remindCove = remindCove.concat("N");
  1860. }
  1861. //low was checked
  1862. } else if ((cb == lName) && (checked == true)) {
  1863. if (mainChecked == false) {
  1864. if (remindLow < 0) {
  1865. remindCove = remindCove.concat("L");
  1866. }
  1867. } else if ((mChecked == true) || (hChecked == true)) {
  1868. remindCove = remindCove.replace("N", "");
  1869. if (remindLow < 0) {
  1870. remindCove = remindCove.concat("L");
  1871. }
  1872. } else {
  1873. remindCove = "L";
  1874. }
  1875. //low was unchecked
  1876. } else if ((cb == lName) && (checked == false)) {
  1877. if (mainChecked == false) {
  1878. if (remindLow >= 0) {
  1879. remindCove = remindCove.replace("L", "");
  1880. }
  1881. } else if ((mChecked == true) || (hChecked == true)) {
  1882. if (remindLow >= 0) {
  1883. remindCove = remindCove.replace("L", "");
  1884. }
  1885. } else if ((mChecked == false) && (hChecked == false)) {
  1886. remindCove = "LMH";
  1887. }
  1888. //mid was checked
  1889. } else if ((cb == mName) && (checked == true)) {
  1890. if (mainChecked == false) {
  1891. if (remindMid < 0) {
  1892. remindCove = remindCove.concat("M");
  1893. }
  1894. } else if ((lChecked == true) || (hChecked == true)) {
  1895. remindCove = remindCove.replace("N", "");
  1896. if (remindMid < 0) {
  1897. remindCove = remindCove.concat("M");
  1898. }
  1899. } else {
  1900. remindCove = "M";
  1901. }
  1902. //mid was unchecked
  1903. } else if ((cb == mName) && (checked == false)) {
  1904. if (mainChecked == false) {
  1905. if (remindMid >= 0) {
  1906. remindCove = remindCove.replace("M", "");
  1907. }
  1908. } else if ((lChecked == true) || (hChecked == true)) {
  1909. if (remindMid >= 0) {
  1910. remindCove = remindCove.replace("M", "");
  1911. }
  1912. } else if ((lChecked == false) && (hChecked == false)) {
  1913. remindCove = "LMH";
  1914. }
  1915. //high was checked
  1916. } else if ((cb == hName) && (checked == true)) {
  1917. if (mainChecked == false) {
  1918. if (remindHigh < 0) {
  1919. remindCove = remindCove.concat("H");
  1920. }
  1921. } else if ((lChecked == true) || (mChecked == true)) {
  1922. remindCove = remindCove.replace("N", "");
  1923. if (remindHigh < 0) {
  1924. remindCove = remindCove.concat("H");
  1925. }
  1926. } else {
  1927. remindCove = "H";
  1928. }
  1929. //high was unchecked
  1930. } else if ((cb == hName) && (checked == false)) {
  1931. if (mainChecked == false) {
  1932. if (remindHigh >= 0) {
  1933. remindCove = remindCove.replace("H", "");
  1934. }
  1935. } else if ((lChecked == true) || (mChecked == true)) {
  1936. if (remindHigh >= 0) {
  1937. remindCove = remindCove.replace("H", "");
  1938. }
  1939. } else if ((lChecked == false) && (mChecked == false)) {
  1940. remindCove = "LMH";
  1941. }
  1942. }
  1943. localStorage.setItem('RemindCove', remindCove)
  1944. }
  1945. //====================================== Seasonal Garden ======================================
  1946. function buildSeasonalGarden() {
  1947. if ($(".seasonalGarden").length > 0) return;
  1948. var timerBox = $(".timerBox");
  1949. var seasonalGarden = document.createElement("div");
  1950. seasonalGarden.classList.add("seasonalGarden");
  1951. $(seasonalGarden).css({
  1952. 'border': '1px solid black',
  1953. 'width': '24%',
  1954. 'height': '70%',
  1955. 'padding': 2 + "px"
  1956. });
  1957. //Header
  1958. var seasonalGardenHeader = document.createElement("div");
  1959. seasonalGardenHeader.classList.add("seasonalGardenHeader");
  1960. var seasonalGardenHeaderLabel = document.createElement("div");
  1961. seasonalGardenHeaderLabel.classList.add("seasonalGardenHeaderLabel");
  1962. var seasonalGardenHeaderLabelText = document.createTextNode("Current Garden Season:");
  1963. seasonalGardenHeaderLabel.appendChild(seasonalGardenHeaderLabelText);
  1964. var seasonalGardenHeaderValue = document.createElement("div");
  1965. seasonalGardenHeaderValue.classList.add("seasonalGardenHeaderValue");
  1966. var seasonalGardenHeaderValueText = document.createTextNode("FALL");
  1967. seasonalGardenHeaderValue.appendChild(seasonalGardenHeaderValueText);
  1968. $(seasonalGardenHeaderLabel).css({
  1969. 'float': 'left',
  1970. 'font-weight': 700,
  1971. "marginRight": "5px"
  1972. })
  1973. $(seasonalGardenHeaderValue).css({
  1974. "marginLeft": "100px"
  1975. });
  1976. seasonalGardenHeader.appendChild(seasonalGardenHeaderLabel);
  1977. seasonalGardenHeader.appendChild(seasonalGardenHeaderValue);
  1978. //Fall
  1979. var seasonalGardenFall = document.createElement("div");
  1980. seasonalGardenFall.classList.add("seasonalGardenFall");
  1981. var seasonalGardenFallLabel = document.createElement("div");
  1982. seasonalGardenFallLabel.classList.add("seasonalGardenFallLabel");
  1983. var seasonalGardenFallLabelText = document.createTextNode("Fall in:");
  1984. seasonalGardenFallLabel.appendChild(seasonalGardenFallLabelText);
  1985. var seasonalGardenFallValue = document.createElement("div");
  1986. seasonalGardenFallValue.classList.add("seasonalGardenFallValue");
  1987. var seasonalGardenFallValueText = document.createTextNode("?");
  1988. seasonalGardenFallValue.appendChild(seasonalGardenFallValueText);
  1989. $(seasonalGardenFallLabel).css({
  1990. 'float': 'left',
  1991. 'width': '100px',
  1992. 'font-weight': 700,
  1993. "marginRight": "5px"
  1994. })
  1995. seasonalGardenFall.appendChild(seasonalGardenFallLabel);
  1996. seasonalGardenFall.appendChild(seasonalGardenFallValue);
  1997. //Winter
  1998. var seasonalGardenWinter = document.createElement("div");
  1999. seasonalGardenWinter.classList.add("seasonalGardenWinter");
  2000. var seasonalGardenWinterLabel = document.createElement("div");
  2001. seasonalGardenWinterLabel.classList.add("seasonalGardenWinterLabel");
  2002. var seasonalGardenWinterLabelText = document.createTextNode("Winter in:");
  2003. seasonalGardenWinterLabel.appendChild(seasonalGardenWinterLabelText);
  2004. var seasonalGardenWinterValue = document.createElement("div");
  2005. seasonalGardenWinterValue.classList.add("seasonalGardenWinterValue");
  2006. var seasonalGardenWinterValueText = document.createTextNode("?");
  2007. seasonalGardenWinterValue.appendChild(seasonalGardenWinterValueText);
  2008. $(seasonalGardenWinterLabel).css({
  2009. 'float': 'left',
  2010. 'width': '100px',
  2011. 'font-weight': 700,
  2012. "marginRight": "5px"
  2013. })
  2014. seasonalGardenWinter.appendChild(seasonalGardenWinterLabel);
  2015. seasonalGardenWinter.appendChild(seasonalGardenWinterValue);
  2016. //Spring
  2017. var seasonalGardenSpring = document.createElement("div");
  2018. seasonalGardenSpring.classList.add("seasonalGardenSpring");
  2019. var seasonalGardenSpringLabel = document.createElement("div");
  2020. seasonalGardenSpringLabel.classList.add("seasonalGardenSpringLabel");
  2021. var seasonalGardenSpringLabelText = document.createTextNode("Spring in:");
  2022. seasonalGardenSpringLabel.appendChild(seasonalGardenSpringLabelText);
  2023. var seasonalGardenSpringValue = document.createElement("div");
  2024. seasonalGardenSpringValue.classList.add("seasonalGardenSpringValue");
  2025. var seasonalGardenSpringValueText = document.createTextNode("?");
  2026. seasonalGardenSpringValue.appendChild(seasonalGardenSpringValueText);
  2027. $(seasonalGardenSpringLabel).css({
  2028. 'float': 'left',
  2029. 'width': '100px',
  2030. 'font-weight': 700,
  2031. "marginRight": "5px"
  2032. })
  2033. seasonalGardenSpring.appendChild(seasonalGardenSpringLabel);
  2034. seasonalGardenSpring.appendChild(seasonalGardenSpringValue);
  2035. //Summer
  2036. var seasonalGardenSummer = document.createElement("div");
  2037. seasonalGardenSummer.classList.add("seasonalGardenSummer");
  2038. var seasonalGardenSummerLabel = document.createElement("div");
  2039. seasonalGardenSummerLabel.classList.add("seasonalGardenSummerLabel");
  2040. var seasonalGardenSummerLabelText = document.createTextNode("Summer in:");
  2041. seasonalGardenSummerLabel.appendChild(seasonalGardenSummerLabelText);
  2042. var seasonalGardenSummerValue = document.createElement("div");
  2043. seasonalGardenSummerValue.classList.add("seasonalGardenSummerValue");
  2044. var seasonalGardenSummerValueText = document.createTextNode("?");
  2045. seasonalGardenSummerValue.appendChild(seasonalGardenSummerValueText);
  2046. $(seasonalGardenSummerLabel).css({
  2047. 'float': 'left',
  2048. 'width': '100px',
  2049. 'font-weight': 700,
  2050. "marginRight": "5px"
  2051. })
  2052. seasonalGardenSummer.appendChild(seasonalGardenSummerLabel);
  2053. seasonalGardenSummer.appendChild(seasonalGardenSummerValue);
  2054. //Append
  2055. seasonalGarden.appendChild(seasonalGardenHeader);
  2056. seasonalGarden.appendChild(seasonalGardenFall);
  2057. seasonalGarden.appendChild(seasonalGardenWinter);
  2058. seasonalGarden.appendChild(seasonalGardenSpring);
  2059. seasonalGarden.appendChild(seasonalGardenSummer);
  2060. return seasonalGarden;
  2061. }
  2062.  
  2063. function updateSeasonalGardenTimer() {
  2064. if ($(".seasonalGarden").length < 1) return;
  2065. var seasonalGarden = $(".seasonalGarden");
  2066. const remind = localStorage.getItem('RemindGarden');
  2067. const remindInterval = parseInt(localStorage.getItem('RemindInterval'), 10);
  2068. var firstFall = 288000;
  2069. var now = todayNow();
  2070. let timePassedHours = (now - firstFall) / 3600;
  2071. var rotaionLenght = 320;
  2072. var rotationsExact = timePassedHours / rotaionLenght;
  2073. var rotationsInteger = Math.trunc(rotationsExact);
  2074. var partialrotation = (rotationsExact - rotationsInteger) * rotaionLenght;
  2075. var fallObj = new season(0, 0, 0);
  2076. var winterObj = new season(0, 0, 0);
  2077. var springObj = new season(0, 0, 0);
  2078. var summerObj = new season(0, 0, 0);
  2079. if (partialrotation < 80) {
  2080. //Summer
  2081. $(".seasonalGardenHeaderValue").text("SUMMER");
  2082. $(".seasonalGardenHeaderValue").css({
  2083. 'color': 'red'
  2084. })
  2085. var timeFall = (80 - partialrotation).toPrecision(4);
  2086. fallObj.hours = Math.floor(timeFall);
  2087. fallObj.minutes = Math.ceil((timeFall - fallObj.hours) * 60);
  2088. fallObj = convertToDyHrMn(0, fallObj.hours, fallObj.minutes);
  2089. winterObj = convertToDyHrMn(fallObj.days + 3, fallObj.hours + 8, fallObj.minutes);
  2090. springObj = convertToDyHrMn(winterObj.days + 3, winterObj.hours + 8, winterObj.minutes)
  2091. summerObj = convertToDyHrMn(springObj.days + 3, springObj.hours + 8, springObj.minutes);
  2092. $(".seasonalGardenFallLabel").text("Fall in:")
  2093. $(".seasonalGardenWinterLabel").text("Winter in:")
  2094. $(".seasonalGardenSpringLabel").text("Spring in:")
  2095. $(".seasonalGardenSummerLabel").text("Next Summer in:")
  2096. seasonalGarden.append($(".seasonalGardenFall"));
  2097. seasonalGarden.append($(".seasonalGardenWinter"));
  2098. seasonalGarden.append($(".seasonalGardenSpring"));
  2099. seasonalGarden.append($(".seasonalGardenSummer"));
  2100. if ((fallObj.hours == 0) && (fallObj.minutes <= remindInterval) && (remind.search('F') >= 0) && (remind.search('N') < 0)) {
  2101. if (confirm('It will be fall in the garden soon, travel there now?') == true) {
  2102. travelToGarden("skip");
  2103. }
  2104. if (localStorage.getItem('KillSwitch') == 'Y') {
  2105. $("#seasonalGardenCb").click();
  2106. }
  2107. }
  2108. } else if ((partialrotation >= 80) && (partialrotation < 160)) {
  2109. //Fall
  2110. $(".seasonalGardenHeaderValue").text("FALL");
  2111. $(".seasonalGardenHeaderValue").css({
  2112. 'color': 'orange'
  2113. })
  2114. var timeWinter = (160 - partialrotation).toPrecision(4);
  2115. winterObj.hours = Math.floor(timeWinter);
  2116. winterObj.minutes = Math.ceil((timeWinter - winterObj.hours) * 60);
  2117. winterObj = convertToDyHrMn(0, winterObj.hours, winterObj.minutes);
  2118. springObj = convertToDyHrMn(winterObj.days + 3, winterObj.hours + 8, winterObj.minutes)
  2119. summerObj = convertToDyHrMn(springObj.days + 3, springObj.hours + 8, springObj.minutes)
  2120. fallObj = convertToDyHrMn(summerObj.days + 3, summerObj.hours + 8, summerObj.minutes);
  2121. $(".seasonalGardenFallLabel").text("Next Fall in:")
  2122. $(".seasonalGardenWinterLabel").text("Winter in:")
  2123. $(".seasonalGardenSpringLabel").text("Spring in:")
  2124. $(".seasonalGardenSummerLabel").text("Summer in:")
  2125. seasonalGarden.append($(".seasonalGardenWinter"));
  2126. seasonalGarden.append($(".seasonalGardenSpring"));
  2127. seasonalGarden.append($(".seasonalGardenSummer"));
  2128. seasonalGarden.append($(".seasonalGardenFall"));
  2129. if ((winterObj.hours == 0) && (winterObj.minutes <= remindInterval) && (remind.search('W') >= 0) && (remind.search('N') < 0)) {
  2130. if (confirm('It will be winter in the garden soon, travel there now?') == true) {
  2131. travelToGarden("skip");
  2132. }
  2133. if (localStorage.getItem('KillSwitch') == 'Y') {
  2134. $("#seasonalGardenCb").click();
  2135. }
  2136. }
  2137. } else if ((partialrotation >= 160) && (partialrotation < 240)) {
  2138. //Winter
  2139. $(".seasonalGardenHeaderValue").text("WINTER");
  2140. $(".seasonalGardenHeaderValue").css({
  2141. 'color': 'blue'
  2142. })
  2143. var timeSpring = (240 - partialrotation).toPrecision(4);
  2144. springObj.hours = Math.floor(timeSpring);
  2145. springObj.minutes = Math.ceil((timeSpring - springObj.hours) * 60);
  2146. springObj = convertToDyHrMn(0, springObj.hours, springObj.minutes)
  2147. summerObj = convertToDyHrMn(springObj.days + 3, springObj.hours + 8, springObj.minutes);
  2148. fallObj = convertToDyHrMn(summerObj.days + 3, summerObj.hours + 8, summerObj.minutes);
  2149. winterObj = convertToDyHrMn(fallObj.days + 3, fallObj.hours + 8, fallObj.minutes);
  2150. $(".seasonalGardenFallLabel").text("Fall in:")
  2151. $(".seasonalGardenWinterLabel").text("Next Winter in:")
  2152. $(".seasonalGardenSpringLabel").text("Spring in:")
  2153. $(".seasonalGardenSummerLabel").text("Summer in:")
  2154. seasonalGarden.append($(".seasonalGardenSpring"));
  2155. seasonalGarden.append($(".seasonalGardenSummer"));
  2156. seasonalGarden.append($(".seasonalGardenFall"));
  2157. seasonalGarden.append($(".seasonalGardenWinter"));
  2158. if ((springObj.hours == 0) && (springObj.minutes <= remindInterval) && (remind.search('S') >= 0) && (remind.search('N') < 0)) {
  2159. if (confirm('It will be spring in the garden soon, travel there now?') == true) {
  2160. travelToGarden("skip");
  2161. }
  2162. if (localStorage.getItem('KillSwitch') == 'Y') {
  2163. $("#seasonalGardenCb").click();
  2164. }
  2165. }
  2166. } else {
  2167. //Spring
  2168. $(".seasonalGardenHeaderValue").text("SPRING");
  2169. $(".seasonalGardenHeaderValue").css({
  2170. 'color': 'green'
  2171. })
  2172. var timeSummer = (320 - partialrotation).toPrecision(4);
  2173. summerObj.hours = Math.floor(timeSummer);
  2174. summerObj.minutes = Math.ceil((timeSummer - summerObj.hours) * 60);
  2175. summerObj = convertToDyHrMn(0, summerObj.hours, summerObj.minutes)
  2176. fallObj = convertToDyHrMn(summerObj.days + 3, summerObj.hours + 8, summerObj.minutes);
  2177. winterObj = convertToDyHrMn(fallObj.days + 3, fallObj.hours + 8, fallObj.minutes);
  2178. springObj = convertToDyHrMn(winterObj.days + 3, winterObj.hours + 8, winterObj.minutes);
  2179. $(".seasonalGardenFallLabel").text("Fall in:")
  2180. $(".seasonalGardenWinterLabel").text("Winter in:")
  2181. $(".seasonalGardenSpringLabel").text("Next Spring in:")
  2182. $(".seasonalGardenSummerLabel").text("Summer in:")
  2183. seasonalGarden.append($(".seasonalGardenSummer"));
  2184. seasonalGarden.append($(".seasonalGardenFall"));
  2185. seasonalGarden.append($(".seasonalGardenWinter"));
  2186. seasonalGarden.append($(".seasonalGardenSpring"));
  2187. if ((summerObj.hours == 0) && (summerObj.minutes <= remindInterval) && (remind.search('R') >= 0) && (remind.search('N') < 0)) {
  2188. if (confirm('It will be summer in the garden soon, travel there now?') == true) {
  2189. travelToGarden("skip");
  2190. }
  2191. if (localStorage.getItem('KillSwitch') == 'Y') {
  2192. $("#seasonalGardenCb").click();
  2193. }
  2194. }
  2195. }
  2196. $(".seasonalGardenFallValue").text(formatOutput(fallObj.days, fallObj.hours, fallObj.minutes));
  2197. $(".seasonalGardenWinterValue").text(formatOutput(winterObj.days, winterObj.hours, winterObj.minutes));
  2198. $(".seasonalGardenSpringValue").text(formatOutput(springObj.days, springObj.hours, springObj.minutes));
  2199. $(".seasonalGardenSummerValue").text(formatOutput(summerObj.days, summerObj.hours, summerObj.minutes));
  2200. $(".seasonalGardenFallValue").css({
  2201. 'float': 'right'
  2202. })
  2203. $(".seasonalGardenWinterValue").css({
  2204. 'float': 'right'
  2205. })
  2206. $(".seasonalGardenSpringValue").css({
  2207. 'float': 'right'
  2208. })
  2209. $(".seasonalGardenSummerValue").css({
  2210. 'float': 'right'
  2211. })
  2212. }
  2213.  
  2214. function season(days, hours, minutes) {
  2215. this.days = days;
  2216. this.hours = hours;
  2217. this.minutes = minutes;
  2218. }
  2219. $(document).on('change', '#seasonalGardenCb', function() {
  2220. if (this.checked) {
  2221. this.checked = "Yes";
  2222. } else {
  2223. this.checked = "";
  2224. }
  2225. remindGarden(this.name, this.checked);
  2226. })
  2227.  
  2228. $(document).on('change', '#seasonalGardenFallCb', function() {
  2229. if (this.checked) {
  2230. this.checked = "Yes";
  2231. } else {
  2232. this.checked = "";
  2233. }
  2234. remindGarden(this.name, this.checked);
  2235. })
  2236.  
  2237. $(document).on('change', '#seasonalGardenWinterCb', function() {
  2238. if (this.checked) {
  2239. this.checked = "Yes";
  2240. } else {
  2241. this.checked = "";
  2242. }
  2243. remindGarden(this.name, this.checked);
  2244. })
  2245.  
  2246. $(document).on('change', '#seasonalGardenSpringCb', function() {
  2247. if (this.checked) {
  2248. this.checked = "Yes";
  2249. } else {
  2250. this.checked = "";
  2251. }
  2252. remindGarden(this.name, this.checked);
  2253. })
  2254. $(document).on('change', '#seasonalGardenSummerCb', function() {
  2255. if (this.checked) {
  2256. this.checked = "Yes";
  2257. } else {
  2258. this.checked = "";
  2259. }
  2260. remindGarden(this.name, this.checked);
  2261. })
  2262. //if master checked and no other - remind all
  2263. //if master not checked - no reminder
  2264. //if master checked and 1 or more checked - remind the ones checked.
  2265. // N none
  2266. // F Fall
  2267. // W Winter
  2268. // S Spring
  2269. // R Summer
  2270. function remindGarden(cb, checked) {
  2271. var main = $('#seasonalGardenCb');
  2272. var fall = $('#seasonalGardenFallCb');
  2273. var winter = $('#seasonalGardenWinterCb');
  2274. var spring = $('#seasonalGardenSpringCb');
  2275. var summer = $('#seasonalGardenSummerCb');
  2276. const mainName = main.prop("name");
  2277. const fName = fall.prop("name");
  2278. const wName = winter.prop("name");
  2279. const sName = spring.prop("name");
  2280. const rName = summer.prop("name");
  2281. const mainChecked = main.prop("checked");
  2282. const fChecked = fall.prop("checked");
  2283. const wChecked = winter.prop("checked");
  2284. const sChecked = spring.prop("checked");
  2285. const rChecked = summer.prop("checked");
  2286. var remindGarden = localStorage.getItem('RemindGarden')
  2287. var remindNone = remindGarden.search("N");
  2288. var remindFall = remindGarden.search("F");
  2289. var remindWinter = remindGarden.search("W");
  2290. var remindSpring = remindGarden.search("S");
  2291. var remindSummer = remindGarden.search("R");
  2292. //main was checked
  2293. if ((cb == mainName) && (checked == true)) {
  2294. if ((fChecked == false) && (wChecked == false) && (sChecked == false) && (rChecked == false)) {
  2295. remindGarden = "FWSR";
  2296. } else if ((fChecked == true) && (wChecked == true) && (sChecked == true) && (rChecked == true)) {
  2297. remindGarden = "FWSR";
  2298. } else {
  2299. remindGarden = remindGarden.replace("N", "");
  2300. if ((fChecked == true) && (remindFall < 0)) {
  2301. remindGarden = remindGarden.concat("F");
  2302. }
  2303. if ((wChecked == true) && (remindWinter < 0)) {
  2304. remindGarden = remindGarden.concat("W");
  2305. }
  2306. if ((sChecked == true) && (remindSpring < 0)) {
  2307. remindGarden = remindGarden.concat("S");
  2308. }
  2309. if ((rChecked == true) && (remindSummer < 0)) {
  2310. remindGarden = remindGarden.concat("R");
  2311. }
  2312. }
  2313. //main was unchecked
  2314. } else if ((cb == mainName) && (checked == false)) {
  2315. if ((fChecked == false) && (wChecked == false) && (sChecked == false) && (rChecked == false)) {
  2316. remindGarden = 'N';
  2317. } else if (remindNone < 0) {
  2318. remindGarden = remindGarden.concat("N");
  2319. }
  2320. //fall was checked
  2321. } else if ((cb == fName) && (checked == true)) {
  2322. if (mainChecked == false) {
  2323. if (remindFall < 0) {
  2324. remindGarden = remindGarden.concat("F");
  2325. }
  2326. } else if ((wChecked == true) || (sChecked == true) || (rChecked == true)) {
  2327. remindGarden = remindGarden.replace("N", "");
  2328. if (remindFall < 0) {
  2329. remindGarden = remindGarden.concat("F");
  2330. }
  2331. } else {
  2332. remindGarden = "F";
  2333. }
  2334. //fall was unchecked
  2335. } else if ((cb == fName) && (checked == false)) {
  2336. if (mainChecked == false) {
  2337. if (remindFall >= 0) {
  2338. remindGarden = remindGarden.replace("F", "");
  2339. }
  2340. } else if ((wChecked == false) && (sChecked == false) && (rChecked == false)) {
  2341. remindGarden = "FWSR";
  2342. } else {
  2343. if (remindFall >= 0) {
  2344. remindGarden = remindGarden.replace("F", "");
  2345. }
  2346. }
  2347. //winter was checked
  2348. } else if ((cb == wName) && (checked == true)) {
  2349. if (mainChecked == false) {
  2350. if (remindWinter < 0) {
  2351. remindGarden = remindGarden.concat("W");
  2352. }
  2353. } else if ((fChecked == true) || (sChecked == true) || (rChecked == true)) {
  2354. remindGarden = remindGarden.replace("N", "");
  2355. if (remindWinter < 0) {
  2356. remindGarden = remindGarden.concat("W");
  2357. }
  2358. } else {
  2359. remindGarden = "W";
  2360. }
  2361. //winter was unchecked
  2362. } else if ((cb == wName) && (checked == false)) {
  2363. if (mainChecked == false) {
  2364. if (remindWinter >= 0) {
  2365. remindGarden = remindGarden.replace("W", "");
  2366. }
  2367. } else if ((fChecked == false) && (sChecked == false) && (rChecked == false)) {
  2368. remindGarden = "FWSR";
  2369. } else {
  2370. if (remindWinter >= 0) {
  2371. remindGarden = remindGarden.replace("F", "");
  2372. }
  2373. }
  2374. //spring was checked
  2375. } else if ((cb == sName) && (checked == true)) {
  2376. if (mainChecked == false) {
  2377. if (remindSpring < 0) {
  2378. remindGarden = remindGarden.concat("S");
  2379. }
  2380. } else if ((fChecked == true) || (wChecked == true) || (rChecked == true)) {
  2381. remindGarden = remindGarden.replace("N", "");
  2382. if (remindSpring < 0) {
  2383. remindGarden = remindGarden.concat("S");
  2384. }
  2385. } else {
  2386. remindGarden = "S";
  2387. }
  2388. //Spring was unchecked
  2389. } else if ((cb == sName) && (checked == false)) {
  2390. if (mainChecked == false) {
  2391. if (remindSpring >= 0) {
  2392. remindGarden = remindGarden.replace("S", "");
  2393. }
  2394. } else if ((fChecked == false) && (wChecked == false) && (rChecked == false)) {
  2395. remindGarden = "FWSR";
  2396. } else {
  2397. if (remindSpring >= 0) {
  2398. remindGarden = remindGarden.replace("S", "");
  2399. }
  2400. }
  2401. //summer was checked
  2402. } else if ((cb == rName) && (checked == true)) {
  2403. if (mainChecked == false) {
  2404. if (remindSummer < 0) {
  2405. remindGarden = remindGarden.concat("R");
  2406. }
  2407. } else if ((fChecked == true) || (wChecked == true) || (sChecked == true)) {
  2408. remindGarden = remindGarden.replace("N", "");
  2409. if (remindSpring < 0) {
  2410. remindGarden = remindGarden.concat("R");
  2411. }
  2412. } else {
  2413. remindGarden = "R";
  2414. }
  2415. //summer was unchecked
  2416. } else if ((cb == rName) && (checked == false)) {
  2417. if (mainChecked == false) {
  2418. if (remindSummer >= 0) {
  2419. remindGarden = remindGarden.replace("R", "");
  2420. }
  2421. } else if ((fChecked == false) && (wChecked == false) && (sChecked == false)) {
  2422. remindGarden = "FWSR";
  2423. } else {
  2424. if (remindSummer >= 0) {
  2425. remindGarden = remindGarden.replace("R", "");
  2426. }
  2427. }
  2428. }
  2429. localStorage.setItem('RemindGarden', remindGarden)
  2430. }
  2431. //====================================== Toxic Spill ======================================
  2432. function buildToxicSpill() {
  2433. if ($(".toxicSpill").length > 0) return;
  2434. var timerBox = $(".timerBox");
  2435. var toxicSpill = document.createElement("div");
  2436. toxicSpill.classList.add("toxicSpill");
  2437. $(toxicSpill).css({
  2438. 'border': '1px solid black',
  2439. 'width': '26%',
  2440. 'height': '70%',
  2441. 'padding': 2 + "px"
  2442. });
  2443. //Header
  2444. var toxicSpillHeader = document.createElement("div");
  2445. toxicSpillHeader.classList.add("toxicSpillHeader");
  2446. var toxicSpillHeaderLabel = document.createElement("div");
  2447. toxicSpillHeaderLabel.classList.add("toxicSpillHeaderLabel");
  2448. var toxicSpillHeaderLabelText = document.createTextNode("Current Spill Level:");
  2449. toxicSpillHeaderLabel.appendChild(toxicSpillHeaderLabelText);
  2450. var toxicSpillHeaderValue = document.createElement("div");
  2451. toxicSpillHeaderValue.classList.add("toxicSpillHeaderValue");
  2452. var toxicSpillHeaderValueText = document.createTextNode("Archduke");
  2453. toxicSpillHeaderValue.appendChild(toxicSpillHeaderValueText);
  2454. $(toxicSpillHeaderLabel).css({
  2455. 'float': 'left',
  2456. 'font-weight': 700,
  2457. "marginRight": "5px"
  2458. })
  2459. $(toxicSpillHeaderValue).css({
  2460. "marginLeft": "100px"
  2461. });
  2462. toxicSpillHeader.appendChild(toxicSpillHeaderLabel);
  2463. toxicSpillHeader.appendChild(toxicSpillHeaderValue);
  2464. //Hero
  2465. var toxicSpillHero = document.createElement("div");
  2466. toxicSpillHero.classList.add("toxicSpillHero");
  2467. var toxicSpillHeroLabel = document.createElement("div");
  2468. toxicSpillHeroLabel.classList.add("toxicSpillHeroLabel");
  2469. var toxicSpillHeroLabelText = document.createTextNode("Hero in:");
  2470. toxicSpillHeroLabel.appendChild(toxicSpillHeroLabelText);
  2471. var toxicSpillHeroValue = document.createElement("div");
  2472. toxicSpillHeroValue.classList.add("toxicSpillHeroValue");
  2473. var toxicSpillHeroValueText = document.createTextNode("?");
  2474. toxicSpillHeroValue.appendChild(toxicSpillHeroValueText);
  2475. $(toxicSpillHeroLabel).css({
  2476. 'float': 'left',
  2477. 'width': '100px',
  2478. 'font-weight': 700,
  2479. "marginRight": "5px"
  2480. })
  2481. toxicSpillHero.appendChild(toxicSpillHeroLabel);
  2482. toxicSpillHero.appendChild(toxicSpillHeroValue);
  2483. //Knight
  2484. var toxicSpillKnight = document.createElement("div");
  2485. toxicSpillKnight.classList.add("toxicSpillKnight");
  2486. var toxicSpillKnightLabel = document.createElement("div");
  2487. toxicSpillKnightLabel.classList.add("toxicSpillKnightLabel");
  2488. var toxicSpillKnightLabelText = document.createTextNode("Knight in:");
  2489. toxicSpillKnightLabel.appendChild(toxicSpillKnightLabelText);
  2490. var toxicSpillKnightValue = document.createElement("div");
  2491. toxicSpillKnightValue.classList.add("toxicSpillKnightValue");
  2492. var toxicSpillKnightValueText = document.createTextNode("?");
  2493. toxicSpillKnightValue.appendChild(toxicSpillKnightValueText);
  2494. $(toxicSpillKnightLabel).css({
  2495. 'float': 'left',
  2496. 'width': '100px',
  2497. 'font-weight': 700,
  2498. "marginRight": "5px"
  2499. })
  2500. toxicSpillKnight.appendChild(toxicSpillKnightLabel);
  2501. toxicSpillKnight.appendChild(toxicSpillKnightValue);
  2502. //Lord
  2503. var toxicSpillLord = document.createElement("div");
  2504. toxicSpillLord.classList.add("toxicSpillLord");
  2505. var toxicSpillLordLabel = document.createElement("div");
  2506. toxicSpillLordLabel.classList.add("toxicSpillLordLabel");
  2507. var toxicSpillLordLabelText = document.createTextNode("Lord in:");
  2508. toxicSpillLordLabel.appendChild(toxicSpillLordLabelText);
  2509. var toxicSpillLordValue = document.createElement("div");
  2510. toxicSpillLordValue.classList.add("toxicSpillLordValue");
  2511. var toxicSpillLordValueText = document.createTextNode("?");
  2512. toxicSpillLordValue.appendChild(toxicSpillLordValueText);
  2513. $(toxicSpillLordLabel).css({
  2514. 'float': 'left',
  2515. 'width': '100px',
  2516. 'font-weight': 700,
  2517. "marginRight": "5px"
  2518. })
  2519. toxicSpillLord.appendChild(toxicSpillLordLabel);
  2520. toxicSpillLord.appendChild(toxicSpillLordValue);
  2521. //Baron
  2522. var toxicSpillBaron = document.createElement("div");
  2523. toxicSpillBaron.classList.add("toxicSpillBaron");
  2524. var toxicSpillBaronLabel = document.createElement("div");
  2525. toxicSpillBaronLabel.classList.add("toxicSpillBaronLabel");
  2526. var toxicSpillBaronLabelText = document.createTextNode("Baron in:");
  2527. toxicSpillBaronLabel.appendChild(toxicSpillBaronLabelText);
  2528. var toxicSpillBaronValue = document.createElement("div");
  2529. toxicSpillBaronValue.classList.add("toxicSpillBaronValue");
  2530. var toxicSpillBaronValueText = document.createTextNode("?");
  2531. toxicSpillBaronValue.appendChild(toxicSpillBaronValueText);
  2532. $(toxicSpillBaronLabel).css({
  2533. 'float': 'left',
  2534. 'width': '100px',
  2535. 'font-weight': 700,
  2536. "marginRight": "5px"
  2537. })
  2538. toxicSpillBaron.appendChild(toxicSpillBaronLabel);
  2539. toxicSpillBaron.appendChild(toxicSpillBaronValue);
  2540. //Count
  2541. var toxicSpillCount = document.createElement("div");
  2542. toxicSpillCount.classList.add("toxicSpillCount");
  2543. var toxicSpillCountLabel = document.createElement("div");
  2544. toxicSpillCountLabel.classList.add("toxicSpillCountLabel");
  2545. var toxicSpillCountLabelText = document.createTextNode("Count in:");
  2546. toxicSpillCountLabel.appendChild(toxicSpillCountLabelText);
  2547. var toxicSpillCountValue = document.createElement("div");
  2548. toxicSpillCountValue.classList.add("toxicSpillCountValue");
  2549. var toxicSpillCountValueText = document.createTextNode("?");
  2550. toxicSpillCountValue.appendChild(toxicSpillCountValueText);
  2551. $(toxicSpillCountLabel).css({
  2552. 'float': 'left',
  2553. 'width': '100px',
  2554. 'font-weight': 700,
  2555. "marginRight": "5px"
  2556. })
  2557. toxicSpillCount.appendChild(toxicSpillCountLabel);
  2558. toxicSpillCount.appendChild(toxicSpillCountValue);
  2559. //Duke
  2560. var toxicSpillDuke = document.createElement("div");
  2561. toxicSpillDuke.classList.add("toxicSpillDuke");
  2562. var toxicSpillDukeLabel = document.createElement("div");
  2563. toxicSpillDukeLabel.classList.add("toxicSpillDukeLabel");
  2564. var toxicSpillDukeLabelText = document.createTextNode("Duke in:");
  2565. toxicSpillDukeLabel.appendChild(toxicSpillDukeLabelText);
  2566. var toxicSpillDukeValue = document.createElement("div");
  2567. toxicSpillDukeValue.classList.add("toxicSpillDukeValue");
  2568. var toxicSpillDukeValueText = document.createTextNode("?");
  2569. toxicSpillDukeValue.appendChild(toxicSpillDukeValueText);
  2570. $(toxicSpillDukeLabel).css({
  2571. 'float': 'left',
  2572. 'width': '100px',
  2573. 'font-weight': 700,
  2574. "marginRight": "5px"
  2575. })
  2576. toxicSpillDuke.appendChild(toxicSpillDukeLabel);
  2577. toxicSpillDuke.appendChild(toxicSpillDukeValue);
  2578. //Grand Duke
  2579. var toxicSpillGrandDuke = document.createElement("div");
  2580. toxicSpillGrandDuke.classList.add("toxicSpillGrandDuke");
  2581. var toxicSpillGrandDukeLabel = document.createElement("div");
  2582. toxicSpillGrandDukeLabel.classList.add("toxicSpillGrandDukeLabel");
  2583. var toxicSpillGrandDukeLabelText = document.createTextNode("Grand Duke in:");
  2584. toxicSpillGrandDukeLabel.appendChild(toxicSpillGrandDukeLabelText);
  2585. var toxicSpillGrandDukeValue = document.createElement("div");
  2586. toxicSpillGrandDukeValue.classList.add("toxicSpillGrandDukeValue");
  2587. var toxicSpillGrandDukeValueText = document.createTextNode("?");
  2588. toxicSpillGrandDukeValue.appendChild(toxicSpillGrandDukeValueText);
  2589. $(toxicSpillGrandDukeLabel).css({
  2590. 'float': 'left',
  2591. 'width': '100px',
  2592. 'font-weight': 700,
  2593. "marginRight": "5px"
  2594. })
  2595. toxicSpillGrandDuke.appendChild(toxicSpillGrandDukeLabel);
  2596. toxicSpillGrandDuke.appendChild(toxicSpillGrandDukeValue);
  2597. //Archduke
  2598. var toxicSpillArchduke = document.createElement("div");
  2599. toxicSpillArchduke.classList.add("toxicSpillArchduke");
  2600. var toxicSpillArchdukeLabel = document.createElement("div");
  2601. toxicSpillArchdukeLabel.classList.add("toxicSpillArchdukeLabel");
  2602. var toxicSpillArchdukeLabelText = document.createTextNode("Archduke in:");
  2603. toxicSpillArchdukeLabel.appendChild(toxicSpillArchdukeLabelText);
  2604. var toxicSpillArchdukeValue = document.createElement("div");
  2605. toxicSpillArchdukeValue.classList.add("toxicSpillArchdukeValue");
  2606. var toxicSpillArchdukeValueText = document.createTextNode("?");
  2607. toxicSpillArchdukeValue.appendChild(toxicSpillArchdukeValueText);
  2608. $(toxicSpillArchdukeLabel).css({
  2609. 'float': 'left',
  2610. 'width': '100px',
  2611. 'font-weight': 700,
  2612. "marginRight": "5px"
  2613. })
  2614. toxicSpillArchduke.appendChild(toxicSpillArchdukeLabel);
  2615. toxicSpillArchduke.appendChild(toxicSpillArchdukeValue);
  2616. //Append
  2617. toxicSpill.appendChild(toxicSpillHeader);
  2618. toxicSpill.appendChild(toxicSpillHero);
  2619. toxicSpill.appendChild(toxicSpillKnight);
  2620. toxicSpill.appendChild(toxicSpillLord);
  2621. toxicSpill.appendChild(toxicSpillBaron);
  2622. toxicSpill.appendChild(toxicSpillCount);
  2623. toxicSpill.appendChild(toxicSpillDuke);
  2624. toxicSpill.appendChild(toxicSpillGrandDuke);
  2625. toxicSpill.appendChild(toxicSpillArchduke);
  2626. return toxicSpill;
  2627. }
  2628.  
  2629. function updateToxicSpillTimer() {
  2630. if ($(".toxicSpill").length < 1) return;
  2631. var toxicSpill = $(".toxicSpill");
  2632. const remind = localStorage.getItem('RemindSpill');
  2633. const remindInterval = parseInt(localStorage.getItem('RemindInterval'), 10);
  2634. $(".toxicSpill").children().show();
  2635. var firstHero = 1503597600;
  2636. var now = todayNow();
  2637. let timePassedHours = (now - firstHero) / 3600;
  2638. var rotaionLenght = 302;
  2639. var rotationsExact = timePassedHours / rotaionLenght;
  2640. var rotationsInteger = Math.floor(rotationsExact);
  2641. var partialrotation = (rotationsExact - rotationsInteger) * rotaionLenght;
  2642. var heroObj = new season(0, 0, 0);
  2643. var knightObj = new season(0, 0, 0);
  2644. var lordObj = new season(0, 0, 0);
  2645. var baronObj = new season(0, 0, 0);
  2646. var countObj = new season(0, 0, 0);
  2647. var dukeObj = new season(0, 0, 0);
  2648. var granddukeObj = new season(0, 0, 0);
  2649. var archdukeObj = new season(0, 0, 0);
  2650. if (partialrotation < 15) {
  2651. //Hero Rising
  2652. $(".toxicSpillHeaderValue").text("HERO-RISING");
  2653. $(".toxicSpillHeaderValue").css({
  2654. 'color': 'red'
  2655. });
  2656. var timeKnight = (15 - partialrotation).toPrecision(4);
  2657. knightObj.hours = Math.floor(timeKnight);
  2658. knightObj.minutes = Math.ceil((timeKnight - knightObj.hours) * 60);
  2659. knightObj = convertToDyHrMn(0, knightObj.hours, knightObj.minutes);
  2660. lordObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  2661. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  2662. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  2663. dukeObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  2664. $(".toxicSpillKnightLabel").text("Knight in:");
  2665. $(".toxicSpillLordLabel").text("Lord in:");
  2666. $(".toxicSpillBaronLabel").text("Baron in:");
  2667. $(".toxicSpillCountLabel").text("Count in:");
  2668. $(".toxicSpillDukeLabel").text("Duke in:");
  2669. toxicSpill.append($(".toxicSpillKnight"));
  2670. toxicSpill.append($(".toxicSpillLord"));
  2671. toxicSpill.append($(".toxicSpillBaron"));
  2672. toxicSpill.append($(".toxicSpillCount"));
  2673. toxicSpill.append($(".toxicSpillDuke"));
  2674. $(".toxicSpillHero").hide();
  2675. $(".toxicSpillGrandDuke").hide();
  2676. $(".toxicSpillArchduke").hide();
  2677. if ((knightObj.hours == 0) && (knightObj.minutes <= remindInterval) && (remind.search('K') >= 0) && (remind.search('N') < 0)) {
  2678. if (confirm('It will be Knight level soon at the toxic spill, travel there now?') == true) {
  2679. travelToSpill("skip");
  2680. }
  2681. if (localStorage.getItem('KillSwitch') == 'Y') {
  2682. $("#toxicSpillCb").click();
  2683. }
  2684. }
  2685. } else if (partialrotation >= 15 && partialrotation < 31) {
  2686. //Knight Rising
  2687. $(".toxicSpillHeaderValue").text("KNIGHT-RISING");
  2688. $(".toxicSpillHeaderValue").css({
  2689. 'color': 'red'
  2690. });
  2691. var timeLord = (31 - partialrotation).toPrecision(4);
  2692. lordObj.hours = Math.floor(timeLord);
  2693. lordObj.minutes = Math.ceil((timeLord - lordObj.hours) * 60);
  2694. lordObj = convertToDyHrMn(0, lordObj.hours, lordObj.minutes);
  2695. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  2696. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  2697. dukeObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  2698. granddukeObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours, dukeObj.minutes);
  2699. $(".toxicSpillLordLabel").text("Lord in:");
  2700. $(".toxicSpillBaronLabel").text("Baron in:");
  2701. $(".toxicSpillCountLabel").text("Count in:");
  2702. $(".toxicSpillDukeLabel").text("Duke in:");
  2703. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  2704. toxicSpill.append($(".toxicSpillLord"));
  2705. toxicSpill.append($(".toxicSpillBaron"));
  2706. toxicSpill.append($(".toxicSpillCount"));
  2707. toxicSpill.append($(".toxicSpillDuke"));
  2708. toxicSpill.append($(".toxicSpillGrandDuke"));
  2709. $(".toxicSpillHero").hide();
  2710. $(".toxicSpillKnight").hide();
  2711. $(".toxicSpillArchduke").hide();
  2712. if ((lordObj.hours == 0) && (lordObj.minutes <= remindInterval) && (remind.search('L') >= 0) && (remind.search('N') < 0)) {
  2713. if (confirm('It will be Lord level soon at the toxic spill, travel there now?') == true) {
  2714. travelToSpill("skip");
  2715. }
  2716. if (localStorage.getItem('KillSwitch') == 'Y') {
  2717. $("#toxicSpillCb").click();
  2718. }
  2719. }
  2720. } else if (partialrotation >= 31 && partialrotation < 49) {
  2721. //Lord Rising
  2722. $(".toxicSpillHeaderValue").text("LORD-RISING");
  2723. $(".toxicSpillHeaderValue").css({
  2724. 'color': 'red'
  2725. });
  2726. var timeBaron = (49 - partialrotation).toPrecision(4);
  2727. baronObj.hours = Math.floor(timeBaron);
  2728. baronObj.minutes = Math.ceil((timeBaron - baronObj.hours) * 60);
  2729. baronObj = convertToDyHrMn(0, baronObj.hours, baronObj.minutes);
  2730. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  2731. dukeObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  2732. granddukeObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours, dukeObj.minutes);
  2733. archdukeObj = convertToDyHrMn(granddukeObj.days + 1, granddukeObj.hours, granddukeObj.minutes);
  2734. $(".toxicSpillBaronLabel").text("Baron in:");
  2735. $(".toxicSpillCountLabel").text("Count in:");
  2736. $(".toxicSpillDukeLabel").text("Duke in:");
  2737. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  2738. $(".toxicSpillArchdukeLabel").text("Archduke in:");
  2739. toxicSpill.append($(".toxicSpillBaron"));
  2740. toxicSpill.append($(".toxicSpillCount"));
  2741. toxicSpill.append($(".toxicSpillDuke"));
  2742. toxicSpill.append($(".toxicSpillGrandDuke"));
  2743. toxicSpill.append($(".toxicSpillArchduke"));
  2744. $(".toxicSpillHero").hide();
  2745. $(".toxicSpillKnight").hide();
  2746. $(".toxicSpillLord").hide();
  2747. if ((baronObj.hours == 0) && (baronObj.minutes <= remindInterval) && (remind.search('B') >= 0) && (remind.search('N') < 0)) {
  2748. if (confirm('It will be Baron level soon at the toxic spill, travel there now?') == true) {
  2749. travelToSpill("skip");
  2750. }
  2751. if (localStorage.getItem('KillSwitch') == 'Y') {
  2752. $("#toxicSpillCb").click();
  2753. }
  2754. }
  2755. } else if (partialrotation >= 49 && partialrotation < 67) {
  2756. //Baron Rising
  2757. $(".toxicSpillHeaderValue").text("BARON-RISING");
  2758. $(".toxicSpillHeaderValue").css({
  2759. 'color': 'red'
  2760. });
  2761. var timeCount = (67 - partialrotation).toPrecision(4);
  2762. countObj.hours = Math.floor(timeCount);
  2763. countObj.minutes = Math.ceil((timeCount - countObj.hours) * 60);
  2764. countObj = convertToDyHrMn(0, countObj.hours, countObj.minutes);
  2765. dukeObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  2766. granddukeObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours, dukeObj.minutes);
  2767. archdukeObj = convertToDyHrMn(granddukeObj.days + 1, granddukeObj.hours, granddukeObj.minutes);
  2768. baronObj = convertToDyHrMn(archdukeObj.days + 4, archdukeObj.hours, archdukeObj.minutes);
  2769. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  2770. $(".toxicSpillArchdukeLabel").text("Archduke in:");
  2771. $(".toxicSpillDukeLabel").text("Duke in:");
  2772. $(".toxicSpillCountLabel").text("Count in:");
  2773. $(".toxicSpillBaronLabel").text("Baron Falling in:");
  2774. toxicSpill.append($(".toxicSpillCount"));
  2775. toxicSpill.append($(".toxicSpillDuke"));
  2776. toxicSpill.append($(".toxicSpillGrandDuke"));
  2777. toxicSpill.append($(".toxicSpillArchduke"));
  2778. toxicSpill.append($(".toxicSpillBaron"));
  2779. $(".toxicSpillHero").hide();
  2780. $(".toxicSpillKnight").hide();
  2781. $(".toxicSpillLord").hide();
  2782. if ((countObj.hours == 0) && (countObj.minutes <= remindInterval) && (remind.search('C') >= 0) && (remind.search('N') < 0)) {
  2783. if (confirm('It will be Count level soon at the toxic spill, travel there now?') == true) {
  2784. travelToSpill("skip");
  2785. }
  2786. if (localStorage.getItem('KillSwitch') == 'Y') {
  2787. $("#toxicSpillCb").click();
  2788. }
  2789. }
  2790. } else if (partialrotation >= 67 && partialrotation < 91) {
  2791. //Count Rising
  2792. $(".toxicSpillHeaderValue").text("COUNT-RISING");
  2793. $(".toxicSpillHeaderValue").css({
  2794. 'color': 'red'
  2795. });
  2796. var timeDuke = (91 - partialrotation).toPrecision(4);
  2797. dukeObj.hours = Math.floor(timeDuke);
  2798. dukeObj.minutes = Math.ceil((timeDuke - dukeObj.hours) * 60);
  2799. dukeObj = convertToDyHrMn(0, dukeObj.hours, dukeObj.minutes);
  2800. granddukeObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours, dukeObj.minutes);
  2801. archdukeObj = convertToDyHrMn(granddukeObj.days + 1, granddukeObj.hours, granddukeObj.minutes);
  2802. countObj = convertToDyHrMn(archdukeObj.days + 3, archdukeObj.hours, archdukeObj.minutes);
  2803. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  2804. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  2805. $(".toxicSpillArchdukeLabel").text("Archduke in:");
  2806. $(".toxicSpillDukeLabel").text("Duke in:");
  2807. $(".toxicSpillCountLabel").text("Count Falling in:");
  2808. $(".toxicSpillBaronLabel").text("Baron in:");
  2809. toxicSpill.append($(".toxicSpillDuke"));
  2810. toxicSpill.append($(".toxicSpillGrandDuke"));
  2811. toxicSpill.append($(".toxicSpillArchduke"));
  2812. toxicSpill.append($(".toxicSpillCount"));
  2813. toxicSpill.append($(".toxicSpillBaron"));
  2814. $(".toxicSpillHero").hide();
  2815. $(".toxicSpillKnight").hide();
  2816. $(".toxicSpillLord").hide();
  2817. if ((dukeObj.hours == 0) && (dukeObj.minutes <= remindInterval) && (remind.search('D') >= 0) && (remind.search('N') < 0)) {
  2818. if (confirm('It will be Duke level soon at the toxic spill, travel there now?') == true) {
  2819. travelToSpill("skip");
  2820. }
  2821. if (localStorage.getItem('KillSwitch') == 'Y') {
  2822. $("#toxicSpillCb").click();
  2823. }
  2824. }
  2825. } else if (partialrotation >= 91 && partialrotation < 115) {
  2826. //Duke Rising
  2827. $(".toxicSpillHeaderValue").text("DUKE-RISING");
  2828. $(".toxicSpillHeaderValue").css({
  2829. 'color': 'red'
  2830. });
  2831. var timeGrandDuke = (115 - partialrotation).toPrecision(4);
  2832. granddukeObj.hours = Math.floor(timeGrandDuke);
  2833. granddukeObj.minutes = Math.ceil((timeGrandDuke - granddukeObj.hours) * 60);
  2834. granddukeObj = convertToDyHrMn(0, granddukeObj.hours, granddukeObj.minutes);
  2835. archdukeObj = convertToDyHrMn(granddukeObj.days + 1, granddukeObj.hours, granddukeObj.minutes);
  2836. dukeObj = convertToDyHrMn(archdukeObj.days + 2, archdukeObj.hours, archdukeObj.minutes);
  2837. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  2838. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  2839. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  2840. $(".toxicSpillArchdukeLabel").text("Archduke in:");
  2841. $(".toxicSpillDukeLabel").text("Duke Falling in:");
  2842. $(".toxicSpillCountLabel").text("Count in:");
  2843. $(".toxicSpillBaronLabel").text("Baron in:");
  2844. toxicSpill.append($(".toxicSpillGrandDuke"));
  2845. toxicSpill.append($(".toxicSpillArchduke"));
  2846. toxicSpill.append($(".toxicSpillDuke"));
  2847. toxicSpill.append($(".toxicSpillCount"));
  2848. toxicSpill.append($(".toxicSpillBaron"));
  2849. $(".toxicSpillHero").hide();
  2850. $(".toxicSpillKnight").hide();
  2851. $(".toxicSpillLord").hide();
  2852. if ((granddukeObj.hours == 0) && (granddukeObj.minutes <= remindInterval) && (remind.search('G') >= 0) && (remind.search('N') < 0)) {
  2853. if (confirm('It will be Grand Duke level soon at the toxic spill, travel there now?') == true) {
  2854. travelToSpill("skip");
  2855. }
  2856. if (localStorage.getItem('KillSwitch') == 'Y') {
  2857. $("#toxicSpillCb").click();
  2858. }
  2859. }
  2860. } else if (partialrotation >= 115 && partialrotation < 139) {
  2861. //Grand Duke Rising
  2862. $(".toxicSpillHeaderValue").text("GD-RISING");
  2863. $(".toxicSpillHeaderValue").css({
  2864. 'color': 'red'
  2865. });
  2866. var timeArchduke = (139 - partialrotation).toPrecision(4);
  2867. archdukeObj.hours = Math.floor(timeArchduke);
  2868. archdukeObj.minutes = Math.ceil((timeArchduke - archdukeObj.hours) * 60);
  2869. archdukeObj = convertToDyHrMn(0, archdukeObj.hours, archdukeObj.minutes);
  2870. granddukeObj = convertToDyHrMn(archdukeObj.days, archdukeObj.hours + 24, archdukeObj.minutes);
  2871. dukeObj = convertToDyHrMn(0, granddukeObj.hours + 24, granddukeObj.minutes);
  2872. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  2873. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  2874. $(".toxicSpillArchdukeLabel").text("Archduke in:");
  2875. $(".toxicSpillGrandDukeLabel").text("GD Falling in:");
  2876. $(".toxicSpillDukeLabel").text("Duke in:");
  2877. $(".toxicSpillCountLabel").text("Count in:");
  2878. $(".toxicSpillBaronLabel").text("Baron in:");
  2879. toxicSpill.append($(".toxicSpillArchduke"));
  2880. toxicSpill.append($(".toxicSpillGrandDuke"));
  2881. toxicSpill.append($(".toxicSpillDuke"));
  2882. toxicSpill.append($(".toxicSpillCount"));
  2883. toxicSpill.append($(".toxicSpillBaron"));
  2884. $(".toxicSpillHero").hide();
  2885. $(".toxicSpillKnight").hide();
  2886. $(".toxicSpillLord").hide();
  2887. if ((granddukeObj.hours == 0) && (granddukeObj.minutes <= remindInterval) && (remind.search('A') >= 0) && (remind.search('N') < 0)) {
  2888. if (confirm('It will be Archduke level soon at the toxic spill, travel there now?') == true) {
  2889. travelToSpill("skip");
  2890. }
  2891. if (localStorage.getItem('KillSwitch') == 'Y') {
  2892. $("#toxicSpillCb").click();
  2893. }
  2894. }
  2895. } else if (partialrotation >= 139 && partialrotation < 151) {
  2896. //Archduke Rising
  2897. $(".toxicSpillHeaderValue").text("AD-RISING");
  2898. $(".toxicSpillHeaderValue").css({
  2899. 'color': 'red'
  2900. });
  2901. var timeArchduke = (151 - partialrotation).toPrecision(4);
  2902. archdukeObj.hours = Math.floor(timeArchduke);
  2903. archdukeObj.minutes = Math.ceil((timeArchduke - archdukeObj.hours) * 60);
  2904. archdukeObj = convertToDyHrMn(0, archdukeObj.hours, archdukeObj.minutes);
  2905. granddukeObj = convertToDyHrMn(archdukeObj.days, archdukeObj.hours + 12, archdukeObj.minutes);
  2906. dukeObj = convertToDyHrMn(0, granddukeObj.hours + 24, granddukeObj.minutes);
  2907. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  2908. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  2909. $(".toxicSpillArchdukeLabel").text("AD Falling in:");
  2910. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  2911. $(".toxicSpillDukeLabel").text("Duke in:");
  2912. $(".toxicSpillCountLabel").text("Count in:");
  2913. $(".toxicSpillBaronLabel").text("Baron in:");
  2914. toxicSpill.append($(".toxicSpillArchduke"));
  2915. toxicSpill.append($(".toxicSpillGrandDuke"));
  2916. toxicSpill.append($(".toxicSpillDuke"));
  2917. toxicSpill.append($(".toxicSpillCount"));
  2918. toxicSpill.append($(".toxicSpillBaron"));
  2919. $(".toxicSpillHero").hide();
  2920. $(".toxicSpillKnight").hide();
  2921. $(".toxicSpillLord").hide();
  2922. } else if (partialrotation >= 151 && partialrotation < 163) {
  2923. //Archduke Falling
  2924. $(".toxicSpillHeaderValue").text("AD-FALLING");
  2925. $(".toxicSpillHeaderValue").css({
  2926. 'color': 'green'
  2927. });
  2928. var timeGDuke = (163 - partialrotation).toPrecision(4);
  2929. granddukeObj.hours = Math.floor(timeGDuke);
  2930. granddukeObj.minutes = Math.ceil((timeGDuke - granddukeObj.hours) * 60);
  2931. granddukeObj = convertToDyHrMn(0, granddukeObj.hours, granddukeObj.minutes);
  2932. dukeObj = convertToDyHrMn(0, granddukeObj.hours + 24, granddukeObj.minutes);
  2933. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  2934. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  2935. lordObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  2936. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  2937. $(".toxicSpillDukeLabel").text("Duke in:");
  2938. $(".toxicSpillCountLabel").text("Count in:");
  2939. $(".toxicSpillBaronLabel").text("Baron in:");
  2940. $(".toxicSpillLordLabel").text("Lord in:");
  2941. toxicSpill.append($(".toxicSpillGrandDuke"));
  2942. toxicSpill.append($(".toxicSpillDuke"));
  2943. toxicSpill.append($(".toxicSpillCount"));
  2944. toxicSpill.append($(".toxicSpillBaron"));
  2945. toxicSpill.append($(".toxicSpillLord"));
  2946. $(".toxicSpillHero").hide();
  2947. $(".toxicSpillKnight").hide();
  2948. $(".toxicSpillArchduke").hide();
  2949. if ((granddukeObj.hours == 0) && (granddukeObj.minutes <= remindInterval) && (remind.search('G') >= 0) && (remind.search('N') < 0)) {
  2950. if (confirm('It will be Grand Duke level soon at the toxic spill, travel there now?') == true) {
  2951. travelToSpill("skip");
  2952. }
  2953. if (localStorage.getItem('KillSwitch') == 'Y') {
  2954. $("#toxicSpillCb").click();
  2955. }
  2956. }
  2957. } else if (partialrotation >= 163 && partialrotation < 187) {
  2958. //Grand Duke Falling
  2959. $(".toxicSpillHeaderValue").text("GD-FALLING");
  2960. $(".toxicSpillHeaderValue").css({
  2961. 'color': 'green'
  2962. });
  2963. var timeDuke = (187 - partialrotation).toPrecision(4);
  2964. dukeObj.hours = Math.floor(timeDuke);
  2965. dukeObj.minutes = Math.ceil((timeDuke - dukeObj.hours) * 60);
  2966. dukeObj = convertToDyHrMn(0, dukeObj.hours, dukeObj.minutes);
  2967. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  2968. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  2969. lordObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  2970. knightObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  2971. $(".toxicSpillDukeLabel").text("Duke in:");
  2972. $(".toxicSpillCountLabel").text("Count in:");
  2973. $(".toxicSpillBaronLabel").text("Baron in:");
  2974. $(".toxicSpillLordLabel").text("Lord in:");
  2975. $(".toxicSpillKnightLabel").text("Knight in:");
  2976. toxicSpill.append($(".toxicSpillDuke"));
  2977. toxicSpill.append($(".toxicSpillCount"));
  2978. toxicSpill.append($(".toxicSpillBaron"));
  2979. toxicSpill.append($(".toxicSpillLord"));
  2980. toxicSpill.append($(".toxicSpillKnight"));
  2981. $(".toxicSpillHero").hide();
  2982. $(".toxicSpillGrandDuke").hide();
  2983. $(".toxicSpillArchduke").hide();
  2984. if ((dukeObj.hours == 0) && (dukeObj.minutes <= remindInterval) && (remind.search('D') >= 0) && (remind.search('N') < 0)) {
  2985. if (confirm('It will be Duke level soon at the toxic spill, travel there now?') == true) {
  2986. travelToSpill("skip");
  2987. }
  2988. if (localStorage.getItem('KillSwitch') == 'Y') {
  2989. $("#toxicSpillCb").click();
  2990. }
  2991. }
  2992. } else if (partialrotation >= 187 && partialrotation < 211) {
  2993. //Duke Falling
  2994. $(".toxicSpillHeaderValue").text("DUKE-FALLING");
  2995. $(".toxicSpillHeaderValue").css({
  2996. 'color': 'green'
  2997. });
  2998. var timeCount = (211 - partialrotation).toPrecision(4);
  2999. countObj.hours = Math.floor(timeCount);
  3000. countObj.minutes = Math.ceil((timeCount - countObj.hours) * 60);
  3001. countObj = convertToDyHrMn(0, countObj.hours, countObj.minutes);
  3002. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  3003. lordObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  3004. knightObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  3005. heroObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  3006. $(".toxicSpillCountLabel").text("Count in:");
  3007. $(".toxicSpillBaronLabel").text("Baron in:");
  3008. $(".toxicSpillLordLabel").text("Lord in:");
  3009. $(".toxicSpillKnightLabel").text("Knight in:");
  3010. $(".toxicSpillHeroLabel").text("Hero in:");
  3011. toxicSpill.append($(".toxicSpillCount"));
  3012. toxicSpill.append($(".toxicSpillBaron"));
  3013. toxicSpill.append($(".toxicSpillLord"));
  3014. toxicSpill.append($(".toxicSpillKnight"));
  3015. toxicSpill.append($(".toxicSpillHero"));
  3016. $(".toxicSpillDuke").hide();
  3017. $(".toxicSpillGrandDuke").hide();
  3018. $(".toxicSpillArchduke").hide();
  3019. if ((countObj.hours == 0) && (countObj.minutes <= remindInterval) && (remind.search('C') >= 0) && (remind.search('N') < 0)) {
  3020. if (confirm('It will be Count level soon at the toxic spill, travel there now?') == true) {
  3021. travelToSpill("skip");
  3022. }
  3023. if (localStorage.getItem('KillSwitch') == 'Y') {
  3024. $("#toxicSpillCb").click();
  3025. }
  3026. }
  3027. } else if (partialrotation >= 211 && partialrotation < 235) {
  3028. //Count Falling
  3029. $(".toxicSpillHeaderValue").text("COUNT-FALLING");
  3030. $(".toxicSpillHeaderValue").css({
  3031. 'color': 'green'
  3032. });
  3033. var timeBaron = (235 - partialrotation).toPrecision(4);
  3034. baronObj.hours = Math.floor(timeBaron);
  3035. baronObj.minutes = Math.ceil((timeBaron - baronObj.hours) * 60);
  3036. baronObj = convertToDyHrMn(0, baronObj.hours, baronObj.minutes);
  3037. lordObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  3038. knightObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  3039. heroObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  3040. countObj = convertToDyHrMn(heroObj.days + 3, heroObj.hours + 10, heroObj.minutes);
  3041. $(".toxicSpillBaronLabel").text("Baron in:");
  3042. $(".toxicSpillLordLabel").text("Lord in:");
  3043. $(".toxicSpillKnightLabel").text("Knight in:");
  3044. $(".toxicSpillHeroLabel").text("Hero in:");
  3045. $(".toxicSpillCountLabel").text("Count Rising in:");
  3046. toxicSpill.append($(".toxicSpillBaron"));
  3047. toxicSpill.append($(".toxicSpillLord"));
  3048. toxicSpill.append($(".toxicSpillKnight"));
  3049. toxicSpill.append($(".toxicSpillHero"));
  3050. toxicSpill.append($(".toxicSpillCount"));
  3051. $(".toxicSpillDuke").hide();
  3052. $(".toxicSpillGrandDuke").hide();
  3053. $(".toxicSpillArchduke").hide();
  3054. if ((baronObj.hours == 0) && (baronObj.minutes <= remindInterval) && (remind.search('B') >= 0) && (remind.search('N') < 0)) {
  3055. if (confirm('It will be Baron level soon at the toxic spill, travel there now?') == true) {
  3056. travelToSpill("skip");
  3057. }
  3058. if (localStorage.getItem('KillSwitch') == 'Y') {
  3059. $("#toxicSpillCb").click();
  3060. }
  3061. }
  3062. } else if (partialrotation >= 235 && partialrotation < 253) {
  3063. //Baron Falling
  3064. $(".toxicSpillHeaderValue").text("BARON-FALLING");
  3065. $(".toxicSpillHeaderValue").css({
  3066. 'color': 'green'
  3067. });
  3068. var timeLord = (253 - partialrotation).toPrecision(4);
  3069. lordObj.hours = Math.floor(timeLord);
  3070. lordObj.minutes = Math.ceil((timeLord - lordObj.hours) * 60);
  3071. lordObj = convertToDyHrMn(0, lordObj.hours, lordObj.minutes);
  3072. knightObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  3073. heroObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  3074. baronObj = convertToDyHrMn(heroObj.days + 2, heroObj.hours + 16, heroObj.minutes);
  3075. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  3076. $(".toxicSpillCountLabel").text("Count in:");
  3077. $(".toxicSpillBaronLabel").text("Baron Rising in:");
  3078. $(".toxicSpillLordLabel").text("Lord in:");
  3079. $(".toxicSpillKnightLabel").text("Knight in:");
  3080. $(".toxicSpillHeroLabel").text("Hero in:");
  3081. toxicSpill.append($(".toxicSpillLord"));
  3082. toxicSpill.append($(".toxicSpillKnight"));
  3083. toxicSpill.append($(".toxicSpillHero"));
  3084. toxicSpill.append($(".toxicSpillBaron"));
  3085. toxicSpill.append($(".toxicSpillCount"));
  3086. $(".toxicSpillDuke").hide();
  3087. $(".toxicSpillGrandDuke").hide();
  3088. $(".toxicSpillArchduke").hide();
  3089. if ((lordObj.hours == 0) && (lordObj.minutes <= remindInterval) && (remind.search('L') >= 0) && (remind.search('N') < 0)) {
  3090. if (confirm('It will be Lord level soon at the toxic spill, travel there now?') == true) {
  3091. travelToSpill("skip");
  3092. }
  3093. if (localStorage.getItem('KillSwitch') == 'Y') {
  3094. $("#toxicSpillCb").click();
  3095. }
  3096. }
  3097. } else if (partialrotation >= 253 && partialrotation < 271) {
  3098. //Lord Falling
  3099. $(".toxicSpillHeaderValue").text("LORD-FALLING");
  3100. $(".toxicSpillHeaderValue").css({
  3101. 'color': 'green'
  3102. });
  3103. var timeKnight = (271 - partialrotation).toPrecision(4);
  3104. knightObj.hours = Math.floor(timeKnight);
  3105. knightObj.minutes = Math.ceil((timeKnight - knightObj.hours) * 60);
  3106. knightObj = convertToDyHrMn(0, knightObj.hours, knightObj.minutes);
  3107. heroObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  3108. lordObj = convertToDyHrMn(heroObj.days + 1, heroObj.hours + 22, heroObj.minutes);
  3109. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  3110. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  3111. $(".toxicSpillCountLabel").text("Count in:");
  3112. $(".toxicSpillBaronLabel").text("Baron in:");
  3113. $(".toxicSpillLordLabel").text("Lord Rising in:");
  3114. $(".toxicSpillKnightLabel").text("Knight in:");
  3115. $(".toxicSpillHeroLabel").text("Hero in:");
  3116. toxicSpill.append($(".toxicSpillKnight"));
  3117. toxicSpill.append($(".toxicSpillHero"));
  3118. toxicSpill.append($(".toxicSpillLord"));
  3119. toxicSpill.append($(".toxicSpillBaron"));
  3120. toxicSpill.append($(".toxicSpillCount"));
  3121. $(".toxicSpillDuke").hide();
  3122. $(".toxicSpillGrandDuke").hide();
  3123. $(".toxicSpillArchduke").hide();
  3124. if ((knightObj.hours == 0) && (knightObj.minutes <= remindInterval) && (remind.search('K') >= 0) && (remind.search('N') < 0)) {
  3125. if (confirm('It will be Knight level soon at the toxic spill, travel there now?') == true) {
  3126. travelToSpill("skip");
  3127. }
  3128. if (localStorage.getItem('KillSwitch') == 'Y') {
  3129. $("#toxicSpillCb").click();
  3130. }
  3131. }
  3132. } else if (partialrotation >= 271 && partialrotation < 287) {
  3133. //Knight Falling
  3134. $(".toxicSpillHeaderValue").text("KNIGHT-FALLING");
  3135. $(".toxicSpillHeaderValue").css({
  3136. 'color': 'green'
  3137. });
  3138. var timeHero = (287 - partialrotation).toPrecision(4);
  3139. heroObj.hours = Math.floor(timeHero);
  3140. heroObj.minutes = Math.ceil((timeHero - heroObj.hours) * 60);
  3141. heroObj = convertToDyHrMn(0, heroObj.hours, heroObj.minutes);
  3142. knightObj = convertToDyHrMn(heroObj.days + 1, heroObj.hours + 6, heroObj.minutes);
  3143. lordObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  3144. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  3145. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  3146. $(".toxicSpillCountLabel").text("Count in:");
  3147. $(".toxicSpillBaronLabel").text("Baron in:");
  3148. $(".toxicSpillLordLabel").text("Lord in:");
  3149. $(".toxicSpillKnightLabel").text("Knight Rising in:");
  3150. $(".toxicSpillHeroLabel").text("Hero in:");
  3151. toxicSpill.append($(".toxicSpillHero"));
  3152. toxicSpill.append($(".toxicSpillKnight"));
  3153. toxicSpill.append($(".toxicSpillLord"));
  3154. toxicSpill.append($(".toxicSpillBaron"));
  3155. toxicSpill.append($(".toxicSpillCount"));
  3156. $(".toxicSpillDuke").hide();
  3157. $(".toxicSpillGrandDuke").hide();
  3158. $(".toxicSpillArchduke").hide();
  3159. if ((heroObj.hours == 0) && (heroObj.minutes <= remindInterval) && (remind.search('H') >= 0) && (remind.search('N') < 0)) {
  3160. if (confirm('It will be Hero level soon at the toxic spill, travel there now?') == true) {
  3161. travelToSpill("skip");
  3162. }
  3163. if (localStorage.getItem('KillSwitch') == 'Y') {
  3164. $("#toxicSpillCb").click();
  3165. }
  3166. }
  3167. } else if (partialrotation >= 287 && partialrotation < 302) {
  3168. //Hero Falling
  3169. $(".toxicSpillHeaderValue").text("HERO-FALLING");
  3170. $(".toxicSpillHeaderValue").css({
  3171. 'color': 'green'
  3172. });
  3173. var timeHero = (302 - partialrotation).toPrecision(4);
  3174. heroObj.hours = Math.floor(timeHero);
  3175. heroObj.minutes = Math.ceil((timeHero - heroObj.hours) * 60);
  3176. heroObj = convertToDyHrMn(0, heroObj.hours, heroObj.minutes);
  3177. knightObj = convertToDyHrMn(heroObj.days, heroObj.hours + 15, heroObj.minutes);
  3178. lordObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  3179. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  3180. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  3181. $(".toxicSpillCountLabel").text("Count in:");
  3182. $(".toxicSpillBaronLabel").text("Baron in:");
  3183. $(".toxicSpillLordLabel").text("Lord in:");
  3184. $(".toxicSpillKnightLabel").text("Knight in:");
  3185. $(".toxicSpillHeroLabel").text("Hero Rising in:");
  3186. toxicSpill.append($(".toxicSpillHero"));
  3187. toxicSpill.append($(".toxicSpillKnight"));
  3188. toxicSpill.append($(".toxicSpillLord"));
  3189. toxicSpill.append($(".toxicSpillBaron"));
  3190. toxicSpill.append($(".toxicSpillCount"));
  3191. $(".toxicSpillDuke").hide();
  3192. $(".toxicSpillGrandDuke").hide();
  3193. $(".toxicSpillArchduke").hide();
  3194. } else {
  3195. //WTF are we?
  3196. }
  3197. $(".toxicSpillArchdukeValue").text(formatOutput(archdukeObj.days, archdukeObj.hours, archdukeObj.minutes));
  3198. $(".toxicSpillGrandDukeValue").text(formatOutput(granddukeObj.days, granddukeObj.hours, granddukeObj.minutes));
  3199. $(".toxicSpillDukeValue").text(formatOutput(dukeObj.days, dukeObj.hours, dukeObj.minutes));
  3200. $(".toxicSpillCountValue").text(formatOutput(countObj.days, countObj.hours, countObj.minutes));
  3201. $(".toxicSpillBaronValue").text(formatOutput(baronObj.days, baronObj.hours, baronObj.minutes));
  3202. $(".toxicSpillLordValue").text(formatOutput(lordObj.days, lordObj.hours, lordObj.minutes));
  3203. $(".toxicSpillKnightValue").text(formatOutput(knightObj.days, knightObj.hours, knightObj.minutes));
  3204. $(".toxicSpillHeroValue").text(formatOutput(heroObj.days, heroObj.hours, heroObj.minutes));
  3205. //https://mhwiki.hitgrab.com/wiki/index.php/Toxic_Spill#Pollution_Levels
  3206. $(".toxicSpillArchdukeValue").css({
  3207. 'float': 'right'
  3208. })
  3209. $(".toxicSpillGrandDukeValue").css({
  3210. 'float': 'right'
  3211. })
  3212. $(".toxicSpillDukeValue").css({
  3213. 'float': 'right'
  3214. })
  3215. $(".toxicSpillCountValue").css({
  3216. 'float': 'right'
  3217. })
  3218. $(".toxicSpillBaronValue").css({
  3219. 'float': 'right'
  3220. })
  3221. $(".toxicSpillLordValue").css({
  3222. 'float': 'right'
  3223. })
  3224. $(".toxicSpillKnightValue").css({
  3225. 'float': 'right'
  3226. })
  3227. $(".toxicSpillHeroValue").css({
  3228. 'float': 'right'
  3229. })
  3230. }
  3231.  
  3232. function spillLevel(days, hours, minutes) {
  3233. this.days = days;
  3234. this.hours = hours;
  3235. this.minutes = minutes;
  3236. }
  3237. $(document).on('change', '#toxicSpillCb', function() {
  3238. if (this.checked) {
  3239. this.checked = "Yes";
  3240. } else {
  3241. this.checked = "";
  3242. }
  3243. remindSpill(this.name, this.checked);
  3244. })
  3245.  
  3246. $(document).on('change', '#toxicSpillHeroCb', function() {
  3247. if (this.checked) {
  3248. this.checked = "Yes";
  3249. } else {
  3250. this.checked = "";
  3251. }
  3252. remindSpill(this.name, this.checked);
  3253. })
  3254.  
  3255. $(document).on('change', '#toxicSpillKnightCb', function() {
  3256. if (this.checked) {
  3257. this.checked = "Yes";
  3258. } else {
  3259. this.checked = "";
  3260. }
  3261. remindSpill(this.name, this.checked);
  3262. })
  3263.  
  3264. $(document).on('change', '#toxicSpillLordCb', function() {
  3265. if (this.checked) {
  3266. this.checked = "Yes";
  3267. } else {
  3268. this.checked = "";
  3269. }
  3270. remindSpill(this.name, this.checked);
  3271. })
  3272. $(document).on('change', '#toxicSpillBaronCb', function() {
  3273. if (this.checked) {
  3274. this.checked = "Yes";
  3275. } else {
  3276. this.checked = "";
  3277. }
  3278. remindSpill(this.name, this.checked);
  3279. })
  3280. $(document).on('change', '#toxicSpillCountCb', function() {
  3281. if (this.checked) {
  3282. this.checked = "Yes";
  3283. } else {
  3284. this.checked = "";
  3285. }
  3286. remindSpill(this.name, this.checked);
  3287. })
  3288. $(document).on('change', '#toxicSpillDukeCb', function() {
  3289. if (this.checked) {
  3290. this.checked = "Yes";
  3291. } else {
  3292. this.checked = "";
  3293. }
  3294. remindSpill(this.name, this.checked);
  3295. })
  3296. $(document).on('change', '#toxicSpillGrandDukeCb', function() {
  3297. if (this.checked) {
  3298. this.checked = "Yes";
  3299. } else {
  3300. this.checked = "";
  3301. }
  3302. remindSpill(this.name, this.checked);
  3303. })
  3304. $(document).on('change', '#toxicSpillArchdukeCb', function() {
  3305. if (this.checked) {
  3306. this.checked = "Yes";
  3307. } else {
  3308. this.checked = "";
  3309. }
  3310. remindSpill(this.name, this.checked);
  3311. })
  3312. //if master checked and no other - remind all
  3313. //if master not checked - no reminder
  3314. //if master checked and 1 or more checked - remind the ones checked.
  3315. // N none
  3316. // H Hero
  3317. // K Knight
  3318. // L Lord
  3319. // B Baron
  3320. // C Count
  3321. // D Duke
  3322. // G Grand Duke
  3323. // A Archduke
  3324. function remindSpill(cb, checked) {
  3325. var main = $('#toxicSpillCb');
  3326. var hero = $('#toxicSpillHeroCb');
  3327. var knight = $('#toxicSpillKnightCb');
  3328. var lord = $('#toxicSpillLordCb');
  3329. var baron = $('#toxicSpillBaronCb');
  3330. var count = $('#toxicSpillCountCb');
  3331. var duke = $('#toxicSpillDukeCb');
  3332. var gduke = $('#toxicSpillGrandDukeCb');
  3333. var aduke = $('#toxicSpillArchdukeCb');
  3334. const mainName = main.prop("name");
  3335. const hName = hero.prop("name");
  3336. const kName = knight.prop("name");
  3337. const lName = lord.prop("name");
  3338. const bName = baron.prop("name");
  3339. const cName = count.prop("name");
  3340. const dName = duke.prop("name");
  3341. const gName = gduke.prop("name");
  3342. const aName = aduke.prop("name");
  3343. const mainChecked = main.prop("checked");
  3344. const hChecked = hero.prop("checked");
  3345. const kChecked = knight.prop("checked");
  3346. const lChecked = lord.prop("checked");
  3347. const bChecked = baron.prop("checked");
  3348. const cChecked = count.prop("checked");
  3349. const dChecked = duke.prop("checked");
  3350. const gChecked = gduke.prop("checked");
  3351. const aChecked = aduke.prop("checked");
  3352. var remindSpill = localStorage.getItem('RemindSpill')
  3353. var remindNone = remindSpill.search("N");
  3354. var remindHero = remindSpill.search("H");
  3355. var remindKnight = remindSpill.search("K");
  3356. var remindLord = remindSpill.search("L");
  3357. var remindBaron = remindSpill.search("B");
  3358. var remindCount = remindSpill.search("C");
  3359. var remindDuke = remindSpill.search("D");
  3360. var remindGduke = remindSpill.search("G");
  3361. var remindAduke = remindSpill.search("A");
  3362. //main was checked
  3363. if ((cb == mainName) && (checked == true)) {
  3364. if ((hChecked == false) && (kChecked == false) && (lChecked == false) && (bChecked == false) && (cChecked == false) && (dChecked == false) && (gChecked == false) && (aChecked == false)) {
  3365. remindSpill = "HKLBCDGA";
  3366. } else if ((hChecked == true) && (kChecked == true) && (lChecked == true) && (bChecked == true) && (cChecked == true) && (dChecked == true) && (gChecked == true) && (aChecked == true)) {
  3367. remindSpill = "HKLBCDGA";
  3368. } else {
  3369. remindSpill = remindSpill.replace("N", "");
  3370. if ((hChecked == true) && (remindHero < 0)) {
  3371. remindSpill = remindSpill.concat("H");
  3372. }
  3373. if ((kChecked == true) && (remindKnight < 0)) {
  3374. remindSpill = remindSpill.concat("K");
  3375. }
  3376. if ((lChecked == true) && (remindLord < 0)) {
  3377. remindSpill = remindSpill.concat("L");
  3378. }
  3379. if ((bChecked == true) && (remindBaron < 0)) {
  3380. remindSpill = remindSpill.concat("B");
  3381. }
  3382. if ((cChecked == true) && (remindCount < 0)) {
  3383. remindSpill = remindSpill.concat("C");
  3384. }
  3385. if ((dChecked == true) && (remindDuke < 0)) {
  3386. remindSpill = remindSpill.concat("G");
  3387. }
  3388. if ((gChecked == true) && (remindGduke < 0)) {
  3389. remindSpill = remindSpill.concat("G");
  3390. }
  3391. if ((aChecked == true) && (remindAduke < 0)) {
  3392. remindSpill = remindSpill.concat("A");
  3393. }
  3394. }
  3395. //main was unchecked
  3396. } else if ((cb == mainName) && (checked == false)) {
  3397. if ((hChecked == false) && (kChecked == false) && (lChecked == false) && (bChecked == false) && (cChecked == false) && (dChecked == false) && (gChecked == false) && (aChecked == false)) {
  3398. remindSpill = 'N';
  3399. } else if (remindNone < 0) {
  3400. remindSpill = remindSpill.concat("N");
  3401. }
  3402. //hero was checked
  3403. } else if ((cb == hName) && (checked == true)) {
  3404. if (mainChecked == false) {
  3405. if (remindHero < 0) {
  3406. remindSpill = remindSpill.concat("H");
  3407. }
  3408. } else if ((kChecked == true) || (lChecked == true) || (bChecked == true) || (cChecked == true) || (dChecked == true) || (gChecked == true) || (aChecked == true)) {
  3409. remindSpill = remindSpill.replace("N", "");
  3410. if (remindHero < 0) {
  3411. remindSpill = remindSpill.concat("H");
  3412. }
  3413. } else {
  3414. remindSpill = "H";
  3415. }
  3416. //hero was unchecked
  3417. } else if ((cb == hName) && (checked == false)) {
  3418. if (mainChecked == false) {
  3419. if (remindHero >= 0) {
  3420. remindSpill = remindSpill.replace("H", "");
  3421. }
  3422. } else if ((kChecked == false) && (lChecked == false) && (bChecked == false) && (cChecked == false) && (dChecked == false) && (gChecked == false) && (aChecked == false)) {
  3423. remindSpill = "HKLBCDGA";
  3424. } else {
  3425. if (remindHero >= 0) {
  3426. remindSpill = remindSpill.replace("H", "");
  3427. }
  3428. }
  3429. //knight was checked
  3430. } else if ((cb == kName) && (checked == true)) {
  3431. if (mainChecked == false) {
  3432. if (remindKnight < 0) {
  3433. remindSpill = remindSpill.concat("K");
  3434. }
  3435. } else if ((hChecked == true) || (lChecked == true) || (bChecked == true) || (cChecked == true) || (dChecked == true) || (gChecked == true) || (aChecked == true)) {
  3436. remindSpill = remindSpill.replace("N", "");
  3437. if (remindKnight < 0) {
  3438. remindSpill = remindSpill.concat("K");
  3439. }
  3440. } else {
  3441. remindSpill = "K";
  3442. }
  3443. //knight was unchecked
  3444. } else if ((cb == kName) && (checked == false)) {
  3445. if (mainChecked == false) {
  3446. if (remindKnight >= 0) {
  3447. remindSpill = remindSpill.replace("K", "");
  3448. }
  3449. } else if ((hChecked == false) && (lChecked == false) && (bChecked == false) && (cChecked == false) && (dChecked == false) && (gChecked == false) && (aChecked == false)) {
  3450. remindSpill = "HKLBCDGA";
  3451. } else {
  3452. if (remindKnight >= 0) {
  3453. remindSpill = remindSpill.replace("K", "");
  3454. }
  3455. }
  3456. //lord was checked
  3457. } else if ((cb == lName) && (checked == true)) {
  3458. if (mainChecked == false) {
  3459. if (remindLord < 0) {
  3460. remindSpill = remindSpill.concat("L");
  3461. }
  3462. } else if ((hChecked == true) || (kChecked == true) || (bChecked == true) || (cChecked == true) || (dChecked == true) || (gChecked == true) || (aChecked == true)) {
  3463. remindSpill = remindSpill.replace("N", "");
  3464. if (remindLord < 0) {
  3465. remindSpill = remindSpill.concat("L");
  3466. }
  3467. } else {
  3468. remindSpill = "L";
  3469. }
  3470. //lord was unchecked
  3471. } else if ((cb == lName) && (checked == false)) {
  3472. if (mainChecked == false) {
  3473. if (remindLord >= 0) {
  3474. remindSpill = remindSpill.replace("L", "");
  3475. }
  3476. } else if ((hChecked == false) && (kChecked == false) && (bChecked == false) && (cChecked == false) && (dChecked == false) && (gChecked == false) && (aChecked == false)) {
  3477. remindSpill = "HKLBCDGA";
  3478. } else {
  3479. if (remindLord >= 0) {
  3480. remindSpill = remindSpill.replace("L", "");
  3481. }
  3482. }
  3483. //baron was checked
  3484. } else if ((cb == bName) && (checked == true)) {
  3485. if (mainChecked == false) {
  3486. if (remindBaron < 0) {
  3487. remindSpill = remindSpill.concat("B");
  3488. }
  3489. } else if ((hChecked == true) || (kChecked == true) || (lChecked == true) || (cChecked == true) || (dChecked == true) || (gChecked == true) || (aChecked == true)) {
  3490. remindSpill = remindSpill.replace("N", "");
  3491. if (remindBaron < 0) {
  3492. remindSpill = remindSpill.concat("B");
  3493. }
  3494. } else {
  3495. remindSpill = "B";
  3496. }
  3497. //baron was unchecked
  3498. } else if ((cb == bName) && (checked == false)) {
  3499. if (mainChecked == false) {
  3500. if (remindBaron >= 0) {
  3501. remindSpill = remindSpill.replace("B", "");
  3502. }
  3503. } else if ((hChecked == false) && (kChecked == false) && (lChecked == false) && (cChecked == false) && (dChecked == false) && (gChecked == false) && (aChecked == false)) {
  3504. remindSpill = "HKLBCDGA";
  3505. } else {
  3506. if (remindBaron >= 0) {
  3507. remindSpill = remindSpill.replace("B", "");
  3508. }
  3509. }
  3510. //count was checked
  3511. } else if ((cb == cName) && (checked == true)) {
  3512. if (mainChecked == false) {
  3513. if (remindCount < 0) {
  3514. remindSpill = remindSpill.concat("C");
  3515. }
  3516. } else if ((hChecked == true) || (kChecked == true) || (lChecked == true) || (bChecked == true) || (dChecked == true) || (gChecked == true) || (aChecked == true)) {
  3517. remindSpill = remindSpill.replace("N", "");
  3518. if (remindCount < 0) {
  3519. remindSpill = remindSpill.concat("C");
  3520. }
  3521. } else {
  3522. remindSpill = "C";
  3523. }
  3524. //count was unchecked
  3525. } else if ((cb == cName) && (checked == false)) {
  3526. if (mainChecked == false) {
  3527. if (remindCount >= 0) {
  3528. remindSpill = remindSpill.replace("C", "");
  3529. }
  3530. } else if ((hChecked == false) && (kChecked == false) && (lChecked == false) && (bChecked == false) && (dChecked == false) && (gChecked == false) && (aChecked == false)) {
  3531. remindSpill = "HKLBCDGA";
  3532. } else {
  3533. if (remindCount >= 0) {
  3534. remindSpill = remindSpill.replace("C", "");
  3535. }
  3536. }
  3537. //duke was checked
  3538. } else if ((cb == dName) && (checked == true)) {
  3539. if (mainChecked == false) {
  3540. if (remindDuke < 0) {
  3541. remindSpill = remindSpill.concat("D");
  3542. }
  3543. } else if ((hChecked == true) || (kChecked == true) || (lChecked == true) || (bChecked == true) || (cChecked == true) || (gChecked == true) || (aChecked == true)) {
  3544. remindSpill = remindSpill.replace("N", "");
  3545. if (remindDuke < 0) {
  3546. remindSpill = remindSpill.concat("D");
  3547. }
  3548. } else {
  3549. remindSpill = "D";
  3550. }
  3551. //duke was unchecked
  3552. } else if ((cb == dName) && (checked == false)) {
  3553. if (mainChecked == false) {
  3554. if (remindDuke >= 0) {
  3555. remindSpill = remindSpill.replace("D", "");
  3556. }
  3557. } else if ((hChecked == false) && (kChecked == false) && (lChecked == false) && (bChecked == false) && (cChecked == false) && (gChecked == false) && (aChecked == false)) {
  3558. remindSpill = "HKLBCDGA";
  3559. } else {
  3560. if (remindDuke >= 0) {
  3561. remindSpill = remindSpill.replace("D", "");
  3562. }
  3563. }
  3564. //grand duke was checked
  3565. } else if ((cb == gName) && (checked == true)) {
  3566. if (mainChecked == false) {
  3567. if (remindGduke < 0) {
  3568. remindSpill = remindSpill.concat("G");
  3569. }
  3570. } else if ((hChecked == true) || (kChecked == true) || (lChecked == true) || (bChecked == true) || (cChecked == true) || (dChecked == true) || (aChecked == true)) {
  3571. remindSpill = remindSpill.replace("N", "");
  3572. if (remindGduke < 0) {
  3573. remindSpill = remindSpill.concat("G");
  3574. }
  3575. } else {
  3576. remindSpill = "G";
  3577. }
  3578. //grand duke was unchecked
  3579. } else if ((cb == gName) && (checked == false)) {
  3580. if (mainChecked == false) {
  3581. if (remindGduke >= 0) {
  3582. remindSpill = remindSpill.replace("G", "");
  3583. }
  3584. } else if ((hChecked == false) && (kChecked == false) && (lChecked == false) && (bChecked == false) && (cChecked == false) && (dChecked == false) && (aChecked == false)) {
  3585. remindSpill = "HKLBCDGA";
  3586. } else {
  3587. if (remindGduke >= 0) {
  3588. remindSpill = remindSpill.replace("G", "");
  3589. }
  3590. }
  3591. //archduke was checked
  3592. } else if ((cb == aName) && (checked == true)) {
  3593. if (mainChecked == false) {
  3594. if (remindAduke < 0) {
  3595. remindSpill = remindSpill.concat("A");
  3596. }
  3597. } else if ((hChecked == true) || (kChecked == true) || (lChecked == true) || (bChecked == true) || (cChecked == true) || (dChecked == true) || (gChecked == true)) {
  3598. remindSpill = remindSpill.replace("N", "");
  3599. if (remindGduke < 0) {
  3600. remindSpill = remindSpill.concat("A");
  3601. }
  3602. } else {
  3603. remindSpill = "G";
  3604. }
  3605. //archduke was unchecked
  3606. } else if ((cb == gName) && (checked == false)) {
  3607. if (mainChecked == false) {
  3608. if (remindGduke >= 0) {
  3609. remindSpill = remindSpill.replace("A", "");
  3610. }
  3611. } else if ((hChecked == false) && (kChecked == false) && (lChecked == false) && (bChecked == false) && (cChecked == false) && (dChecked == false) && (gChecked == false)) {
  3612. remindSpill = "HKLBCDGA";
  3613. } else {
  3614. if (remindAduke >= 0) {
  3615. remindSpill = remindSpill.replace("A", "");
  3616. }
  3617. }
  3618. }
  3619. localStorage.setItem('RemindSpill', remindSpill)
  3620. }
  3621.  
  3622. //============================================================================================
  3623. function todayNow() {
  3624. var today = new Date();
  3625. var todayEpoch = today.getTime() / 1000.0;
  3626. return todayEpoch;
  3627. }
  3628.  
  3629. function convertToDyHrMn(days, hours, minutes) {
  3630. if (minutes == 60) {
  3631. hours++;
  3632. minutes = 0;
  3633. }
  3634. if (hours >= 24) {
  3635. var daysExact = hours / 24;
  3636. var daysTrunc = Math.floor(daysExact);
  3637. var partialDays = daysExact - daysTrunc;
  3638. hours = Math.round(partialDays * 24);
  3639. days = daysTrunc + days;
  3640. }
  3641. return {
  3642. days,
  3643. hours,
  3644. minutes
  3645. }
  3646. }
  3647.  
  3648. function formatOutput(days, hours, minutes) {
  3649. var dayStr = "";
  3650. var hourStr = "";
  3651. var minuteStr = "";
  3652. if (days > 0) {
  3653. dayStr = days + "d";
  3654. }
  3655. if (hours > 0) {
  3656. hourStr = hours + "h";
  3657. }
  3658. if (minutes > 0) {
  3659. minuteStr = minutes + "m";
  3660. }
  3661. return dayStr + " " + hourStr + " " + minuteStr;
  3662. }
  3663.  
  3664. function travelToGrove(skip) {
  3665. const disarm = localStorage.getItem('DAT');
  3666. var origin = $('#hudLocationContent').attr('class').replace("hudLocationContent ", "");
  3667. if ($('#hudLocationContent').hasClass('hudLocationContent forbidden_grove') == true) {
  3668. //Do nothing you are already there
  3669. } else if ($(".forbiddenGroveHeaderValue").text() == "CLOSED") {
  3670. alert('The Forbiddengrove is closed now, you cannot travel there right now')
  3671. } else if (skip == "skip") {
  3672. localStorage.setItem('TravelOrigin', origin);
  3673. app.pages.TravelPage.travel("forbidden_grove");
  3674. if (disarm == "Y") {
  3675. hg.utils.TrapControl.disarmBait().go()
  3676. }
  3677. } else if (confirm('Travel to the Forbidden Grove now?') == true) {
  3678. localStorage.setItem('TravelOrigin', origin);
  3679. app.pages.TravelPage.travel("forbidden_grove");
  3680. if (disarm == "Y") {
  3681. hg.utils.TrapControl.disarmBait().go()
  3682. }
  3683. }
  3684. }
  3685.  
  3686. function travelToCove(skip) {
  3687. const disarm = localStorage.getItem('DAT');
  3688. var origin = $('#hudLocationContent').attr('class').replace("hudLocationContent ", "");
  3689. if ($('#hudLocationContent').hasClass('hudLocationContent balacks_cove') == true) {
  3690. //Do nothing, you are already there
  3691. } else if (skip == "skip") {
  3692. localStorage.setItem('TravelOrigin', origin);
  3693. app.pages.TravelPage.travel("balacks_cove");
  3694. if (disarm == "Y") {
  3695. hg.utils.TrapControl.disarmBait().go()
  3696. }
  3697. } else if (confirm("Travel to Balack's Cove now?") == true) {
  3698. localStorage.setItem('TravelOrigin', origin);
  3699. app.pages.TravelPage.travel("balacks_cove");
  3700. if (disarm == "Y") {
  3701. hg.utils.TrapControl.disarmBait().go()
  3702. }
  3703. }
  3704. }
  3705.  
  3706. function travelToGarden(skip) {
  3707. const disarm = localStorage.getItem('DAT');
  3708. var origin = $('#hudLocationContent').attr('class').replace("hudLocationContent ", "");
  3709. if ($('#hudLocationContent').hasClass('hudLocationContent seasonal_garden') == true) {
  3710. //Do nothing, you are already there
  3711. } else if (skip == "skip") {
  3712. localStorage.setItem('TravelOrigin', origin);
  3713. app.pages.TravelPage.travel("seasonal_garden");
  3714. if (disarm == "Y") {
  3715. hg.utils.TrapControl.disarmBait().go()
  3716. }
  3717. } else if (confirm("Travel to the Seasonal Garden now?") == true) {
  3718. localStorage.setItem('TravelOrigin', origin);
  3719. app.pages.TravelPage.travel("seasonal_garden");
  3720. if (disarm == "Y") {
  3721. hg.utils.TrapControl.disarmBait().go()
  3722. }
  3723. }
  3724. }
  3725.  
  3726. function travelToSpill(skip) {
  3727. const disarm = localStorage.getItem('DAT');
  3728. var origin = $('#hudLocationContent').attr('class').replace("hudLocationContent ", "");
  3729. if ($('#hudLocationContent').hasClass('hudLocationContent pollution_outbreak') == true) {
  3730. //Do nothing, you are already there
  3731. } else if (skip == "skip") {
  3732. localStorage.setItem('TravelOrigin', origin);
  3733. app.pages.TravelPage.travel("pollution_outbreak");
  3734. if (disarm == "Y") {
  3735. hg.utils.TrapControl.disarmBait().go()
  3736. }
  3737. } else if (confirm("Travel to the Toxic Spill now?") == true) {
  3738. localStorage.setItem('TravelOrigin', origin);
  3739. app.pages.TravelPage.travel("pollution_outbreak");
  3740. if (disarm == "Y") {
  3741. hg.utils.TrapControl.disarmBait().go()
  3742. }
  3743. }
  3744. }
  3745.  
  3746. function travelBack(skip) {
  3747. const disarm = localStorage.getItem('DAT');
  3748. var origin = localStorage.getItem('TravelOrigin');
  3749. if ($('#hudLocationContent').hasClass(origin) == true) {
  3750. // //Do nothing, you are already there
  3751. } else if (skip == "skip") {
  3752. app.pages.TravelPage.travel(origin);
  3753. if (disarm == "Y") {
  3754. hg.utils.TrapControl.disarmBait().go()
  3755. }
  3756. } else if (confirm("Travel back to the " + origin + "?") == true) {
  3757. app.pages.TravelPage.travel(origin);
  3758. if (disarm == "Y") {
  3759. hg.utils.TrapControl.disarmBait().go()
  3760. }
  3761. }
  3762. }