MH Timers+

Handy script to keep track of the various MH location timers

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

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