MH Timers+

Handy script to keep track of the various MH location timers

当前为 2019-08-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.5
  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. startTimers();
  17. });
  18.  
  19. function buildTimerBox() {
  20. if ($(".timerBox").length > 0) return;
  21. if ($(".accordion").length > 0) return;
  22. var container = $("#mousehuntContainer");
  23. var accordion = document.createElement("div");
  24. accordion.classList.add("accordion");
  25. $(accordion).css({
  26. 'background-image': "url('https://www.toptal.com/designers/subtlepatterns/patterns/interlaced.png')",
  27. 'width': '98%',
  28. 'height': '15px',
  29. 'padding': '5px',
  30. 'border': '2px solid black',
  31. });
  32. var accordionPrompt = document.createElement("div");
  33. accordionPrompt.classList.add("accordionPrompt");
  34. var accordionTitle = document.createElement("div");
  35. accordionTitle.classList.add("accordionTitle");
  36. $(accordionTitle).text("Mousehunt Timers+").css({
  37. 'float': 'left',
  38. 'padding': '1px 0',
  39. 'font-size': '12px',
  40. 'font-weight': 'bold'
  41. })
  42. $(accordionPrompt).text("Click to Hide").css({
  43. 'float': 'right',
  44. 'padding': '1px 0',
  45. 'font-size': '11px',
  46. 'font-weight': 'bold'
  47. })
  48. accordion.appendChild(accordionTitle)
  49. accordion.appendChild(accordionPrompt)
  50. var timerBox = document.createElement("div");
  51. if (localStorage.getItem('HideTimers') == "Y") {
  52. timerBox.classList.add("timerBox")
  53. timerBox.classList.add("hide");
  54. $(accordionPrompt).text("Click to Show")
  55. } else {
  56. timerBox.classList.add("timerBox");
  57. }
  58. $(timerBox).css({
  59. 'background-image': "url('https://www.toptal.com/designers/subtlepatterns/patterns/interlaced.png')"
  60. });
  61. $(timerBox).css({
  62. 'height': 112 + "px",
  63. 'padding': 2 + "px"
  64. });
  65. let forbiddenGrove = buildForbiddenGrove();
  66. let balacksCove = buildBalacksCove();
  67. let seasonalGarden = buildSeasonalGarden();
  68. let toxicSpill = buildToxicSpill();
  69. timerBox.appendChild(forbiddenGrove)
  70. timerBox.appendChild(balacksCove)
  71. timerBox.appendChild(seasonalGarden)
  72. timerBox.appendChild(toxicSpill)
  73. $(forbiddenGrove).css({
  74. 'float': 'left'
  75. })
  76. $(balacksCove).css({
  77. 'float': 'left',
  78. 'marginLeft': 1 + "px"
  79. })
  80. $(seasonalGarden).css({
  81. 'float': 'left',
  82. 'marginLeft': 1 + "px"
  83. })
  84. $(toxicSpill).css({
  85. 'float': 'left',
  86. 'marginLeft': 1 + "px"
  87. })
  88. //LAST
  89. container.prepend(timerBox)
  90. container.prepend(accordion)
  91.  
  92. }
  93. $(document).on('click', '.accordion', function() {
  94. if (localStorage.getItem('HideTimers') == "Y") {
  95. //show
  96. $('.timerBox').removeClass("hide")
  97. $('.accordionPrompt').text("Click to Hide")
  98. localStorage.setItem('HideTimers', "N")
  99. } else {
  100. //hide
  101. $('.timerBox').addClass("hide")
  102. $('.accordionPrompt').text("Click to Show")
  103. localStorage.setItem('HideTimers', "Y")
  104. }
  105. })
  106.  
  107. function buildControlPanels() {
  108. var timerBox = $(".timerBox");
  109. //FG
  110. var forbiddenGroveControlPanel = document.createElement("div");
  111. forbiddenGroveControlPanel.classList.add("forbiddenGroveControlPanel");
  112. var forbiddenGroveButton = document.createElement("button");
  113. forbiddenGroveButton.id = "forbiddenGroveButton";
  114. forbiddenGroveButton.innerText = "Travel";
  115. forbiddenGroveButton.addEventListener("click", travelToGrove);
  116. forbiddenGroveControlPanel.appendChild(forbiddenGroveButton);
  117. $(forbiddenGroveControlPanel).css({
  118. 'float': 'left',
  119. 'width': '21.5%'
  120. })
  121. $(forbiddenGroveButton).css({
  122. 'width': '75px',
  123. 'float': 'left',
  124. 'marginRight': 5 + "px"
  125. })
  126. var forbiddenGroveCb = document.createElement('input');
  127. forbiddenGroveCb.type = "checkbox";
  128. forbiddenGroveCb.name = "forbiddenGroveCb";
  129. forbiddenGroveCb.value = "value";
  130. forbiddenGroveCb.id = "forbiddenGroveCb";
  131. if (localStorage.getItem('RemindGrove') == "Y") {
  132. forbiddenGroveCb.checked = "Yes";
  133. } else {
  134. forbiddenGroveCb.checked = "";
  135. }
  136. var forbiddenGroveCbLabel = document.createElement('label')
  137. forbiddenGroveCbLabel.htmlFor = "forbiddenGroveCbLabel";
  138. forbiddenGroveCbLabel.appendChild(document.createTextNode('Remind '));
  139. forbiddenGroveControlPanel.appendChild(forbiddenGroveCbLabel);
  140. forbiddenGroveControlPanel.appendChild(forbiddenGroveCb)
  141. $(forbiddenGroveCbLabel).css({
  142. 'float': 'left',
  143. 'fontSize': "14px",
  144. 'width': '45px',
  145. })
  146. $(forbiddenGroveCb).css({
  147. 'float': 'left',
  148. 'width': '20px'
  149. })
  150. timerBox.append(forbiddenGroveControlPanel);
  151. //BC
  152. var balacksCoveControlPanel = document.createElement("div");
  153. balacksCoveControlPanel.classList.add("balacksCoveControlPanel");
  154. var balacksCoveButton = document.createElement("button");
  155. balacksCoveButton.id = "balacksCoveButton";
  156. balacksCoveButton.innerText = "Travel";
  157. balacksCoveButton.addEventListener("click", travelToCove);
  158. balacksCoveControlPanel.appendChild(balacksCoveButton);
  159. $(balacksCoveControlPanel).css({
  160. 'float': 'left',
  161. 'width': '25%',
  162. 'marginLeft': 5 + "px"
  163. })
  164. $(balacksCoveButton).css({
  165. 'width': '75px',
  166. 'float': 'left',
  167. 'marginRight': 5 + "px"
  168. })
  169. var balacksCoveCb = document.createElement('input');
  170. balacksCoveCb.type = "checkbox";
  171. balacksCoveCb.name = "balacksCoveCb";
  172. balacksCoveCb.value = "value";
  173. balacksCoveCb.id = "balacksCoveCb";
  174. if (localStorage.getItem('RemindCove') == "Y") {
  175. balacksCoveCb.checked = "Yes";
  176. } else {
  177. balacksCoveCb.checked = "";
  178. }
  179. var balacksCoveCbLabel = document.createElement('label')
  180. balacksCoveCbLabel.htmlFor = "balacksCoveCbLabel";
  181. balacksCoveCbLabel.appendChild(document.createTextNode('Remind '));
  182. balacksCoveControlPanel.appendChild(balacksCoveCbLabel);
  183. balacksCoveControlPanel.appendChild(balacksCoveCb)
  184. $(balacksCoveCbLabel).css({
  185. 'float': 'left',
  186. 'fontSize': "14px",
  187. 'width': '45px',
  188. })
  189. $(balacksCoveCb).css({
  190. 'float': 'left',
  191. 'width': '20px'
  192. })
  193. timerBox.append(balacksCoveControlPanel);
  194. //SG
  195. var seasonalGardenControlPanel = document.createElement("div");
  196. seasonalGardenControlPanel.classList.add("seasonalGardenControlPanel");
  197. var seasonalGardenButton = document.createElement("button");
  198. seasonalGardenButton.id = "seasonalGardenButton";
  199. seasonalGardenButton.innerText = "Travel";
  200. seasonalGardenButton.addEventListener("click", travelToGarden);
  201. seasonalGardenControlPanel.appendChild(seasonalGardenButton);
  202. $(seasonalGardenControlPanel).css({
  203. 'float': 'left',
  204. 'width': '24%',
  205. 'marginLeft': 5 + "px"
  206. })
  207. $(seasonalGardenButton).css({
  208. 'width': '75px',
  209. 'float': 'left',
  210. 'marginRight': 5 + "px"
  211. })
  212. var seasonalGardenCb = document.createElement('input');
  213. seasonalGardenCb.type = "checkbox";
  214. seasonalGardenCb.name = "seasonalGardenCb";
  215. seasonalGardenCb.value = "value";
  216. seasonalGardenCb.id = "seasonalGardenCb";
  217. if (localStorage.getItem('RemindGarden') == "Y") {
  218. seasonalGardenCb.checked = "Yes";
  219. } else {
  220. seasonalGardenCb.checked = "";
  221. }
  222. var seasonalGardenCbLabel = document.createElement('label')
  223. seasonalGardenCbLabel.htmlFor = "seasonalGardenCbLabel";
  224. seasonalGardenCbLabel.appendChild(document.createTextNode('Remind '));
  225. seasonalGardenControlPanel.appendChild(seasonalGardenCbLabel);
  226. seasonalGardenControlPanel.appendChild(seasonalGardenCb)
  227. $(seasonalGardenCbLabel).css({
  228. 'float': 'left',
  229. 'fontSize': "14px",
  230. 'width': '45px',
  231. })
  232. $(seasonalGardenCb).css({
  233. 'float': 'left',
  234. 'width': '20px'
  235. })
  236. timerBox.append(seasonalGardenControlPanel);
  237. //TS
  238. var toxicSpillControlPanel = document.createElement("div");
  239. toxicSpillControlPanel.classList.add("toxicSpillControlPanel");
  240. var toxicSpillButton = document.createElement("button");
  241. toxicSpillButton.id = "toxicSpillButton";
  242. toxicSpillButton.innerText = "Travel";
  243. toxicSpillButton.addEventListener("click", travelToSpill);
  244. toxicSpillControlPanel.appendChild(toxicSpillButton);
  245. $(toxicSpillControlPanel).css({
  246. 'float': 'left',
  247. 'width': '24%',
  248. 'marginLeft': 10 + "px"
  249. })
  250. $(toxicSpillButton).css({
  251. 'width': '75px',
  252. 'float': 'left',
  253. 'marginRight': 5 + "px"
  254. })
  255. var toxicSpillCb = document.createElement('input');
  256. toxicSpillCb.type = "checkbox";
  257. toxicSpillCb.name = "toxicSpillCb";
  258. toxicSpillCb.value = "value";
  259. toxicSpillCb.id = "toxicSpillCb";
  260. if (localStorage.getItem('RemindSpill') == "Y") {
  261. toxicSpillCb.checked = "Yes";
  262. } else {
  263. toxicSpillCb.checked = "";
  264. }
  265. var toxicSpillCbLabel = document.createElement('label')
  266. toxicSpillCbLabel.htmlFor = "toxicSpillCbLabel";
  267. toxicSpillCbLabel.appendChild(document.createTextNode('Remind '));
  268. toxicSpillControlPanel.appendChild(toxicSpillCbLabel);
  269. toxicSpillControlPanel.appendChild(toxicSpillCb)
  270. $(toxicSpillCbLabel).css({
  271. 'float': 'left',
  272. 'fontSize': "14px",
  273. 'width': '45px',
  274. })
  275. $(toxicSpillCb).css({
  276. 'float': 'left',
  277. 'width': '20px'
  278. })
  279. timerBox.append(toxicSpillControlPanel);
  280. }
  281.  
  282. function startTimers() {
  283. localStorage.setItem("mainTimer", 0);
  284. runTimers();
  285. }
  286.  
  287. function runTimers() {
  288. updateText();
  289. var myTimer = setInterval(updateText, 60000);
  290. }
  291.  
  292. function updateText() {
  293. if ($(".forbiddenGrove").length > 0) updateForbiddenGroveTimer();
  294. if ($(".balacksCove").length > 0) updateBalacksCoveTimer();
  295. if ($(".seasonalGarden").length > 0) updateSeasonalGardenTimer();
  296. if ($(".toxicSpill").length > 0) updateToxicSpillTimer();
  297. }
  298. //===================================== Forbidden Grove ======================================
  299. function buildForbiddenGrove() {
  300. if ($(".forbiddenGrove").length > 0) return;
  301. var timerBox = $(".timerBox");
  302. var forbiddenGrove = document.createElement("div");
  303. forbiddenGrove.classList.add("forbiddenGrove");
  304. $(forbiddenGrove).css({
  305. 'border': '1px solid black',
  306. 'width': '21%',
  307. 'height': '75%',
  308. 'padding': 2 + "px"
  309. });
  310. //Header
  311. var forbiddenGroveHeader = document.createElement("div");
  312. forbiddenGroveHeader.classList.add("forbiddenGroveHeader");
  313. var forbiddenGroveHeaderLabel = document.createElement("div");
  314. forbiddenGroveHeaderLabel.classList.add("forbiddenGroveHeaderLabel");
  315. var forbiddenGroveHeaderLabelText = document.createTextNode("Forbidden Grove is:");
  316. forbiddenGroveHeaderLabel.appendChild(forbiddenGroveHeaderLabelText);
  317. var forbiddenGroveHeaderValue = document.createElement("div");
  318. forbiddenGroveHeaderValue.classList.add("forbiddenGroveHeaderValue");
  319. var forbiddenGroveHeaderValueText = document.createTextNode("Open");
  320. forbiddenGroveHeaderValue.appendChild(forbiddenGroveHeaderValueText);
  321. $(forbiddenGroveHeaderLabel).css({
  322. 'float': 'left',
  323. 'font-weight': 700,
  324. "marginRight": "5px"
  325. })
  326. $(forbiddenGroveHeaderValue).css({
  327. "marginLeft": "100px"
  328. });
  329. forbiddenGroveHeader.appendChild(forbiddenGroveHeaderLabel);
  330. forbiddenGroveHeader.appendChild(forbiddenGroveHeaderValue);
  331. //Close
  332. var forbiddenGroveCloses = document.createElement("div");
  333. forbiddenGroveCloses.classList.add("forbiddenGroveCloses");
  334. var forbiddenGroveClosesLabel = document.createElement("div");
  335. forbiddenGroveClosesLabel.classList.add("forbiddenGroveClosesLabel");
  336. var forbiddenGroveClosesLabelText = document.createTextNode("Closes in:");
  337. forbiddenGroveClosesLabel.appendChild(forbiddenGroveClosesLabelText);
  338. var forbiddenGroveClosesValue = document.createElement("div");
  339. forbiddenGroveClosesValue.classList.add("forbiddenGroveClosesValue");
  340. var forbiddenGroveClosesValueText = document.createTextNode("?");
  341. forbiddenGroveClosesValue.appendChild(forbiddenGroveClosesValueText);
  342. $(forbiddenGroveClosesLabel).css({
  343. 'float': 'left',
  344. 'font-weight': 700,
  345. "marginRight": "5px"
  346. })
  347. forbiddenGroveCloses.appendChild(forbiddenGroveClosesLabel);
  348. forbiddenGroveCloses.appendChild(forbiddenGroveClosesValue);
  349. //Open
  350. var forbiddenGroveOpens = document.createElement("div");
  351. forbiddenGroveOpens.classList.add("forbiddenGroveOpens");
  352. var forbiddenGroveOpensLabel = document.createElement("div");
  353. forbiddenGroveOpensLabel.classList.add("forbiddenGroveOpensLabel");
  354. var forbiddenGroveOpensLabelText = document.createTextNode("Opens in:");
  355. forbiddenGroveOpensLabel.appendChild(forbiddenGroveOpensLabelText);
  356. var forbiddenGroveOpensValue = document.createElement("div");
  357. forbiddenGroveOpensValue.classList.add("forbiddenGroveOpensValue");
  358. var forbiddenGroveOpensValueText = document.createTextNode("??");
  359. forbiddenGroveOpensValue.appendChild(forbiddenGroveOpensValueText);
  360. $(forbiddenGroveOpensLabel).css({
  361. 'float': 'left',
  362. 'font-weight': 700,
  363. "marginRight": "5px"
  364. })
  365. forbiddenGroveOpens.appendChild(forbiddenGroveOpensLabel);
  366. forbiddenGroveOpens.appendChild(forbiddenGroveOpensValue);
  367.  
  368. //Append
  369. forbiddenGrove.appendChild(forbiddenGroveHeader);
  370. forbiddenGrove.appendChild(forbiddenGroveCloses);
  371. forbiddenGrove.appendChild(forbiddenGroveOpens);
  372. return forbiddenGrove;
  373. }
  374.  
  375. function updateForbiddenGroveTimer() {
  376. if ($(".forbiddenGrove").length < 1) return;
  377. var forbiddenGrove = $(".forbiddenGrove");
  378. var firstGroveOpen = 1285704000;
  379. var now = todayNow();
  380. let timePassedHours = (now - firstGroveOpen) / 3600;
  381. var rotaionLenght = 20;
  382. var rotationsExact = timePassedHours / rotaionLenght;
  383. var rotationsInteger = Math.trunc(rotationsExact);
  384. var partialrotation = (rotationsExact - rotationsInteger) * rotaionLenght;
  385. if (partialrotation < 16) {
  386. //Open
  387. $(".forbiddenGroveHeaderValue").text(" OPEN");
  388. $(".forbiddenGroveHeaderValue").css({
  389. 'color': 'green'
  390. })
  391. var timeCloses = (16 - partialrotation).toPrecision(4);
  392. var closesHours = Math.trunc(timeCloses);
  393. var closesMinutes = Math.ceil((timeCloses - closesHours) * 60);
  394. $(".forbiddenGroveClosesValue").text(formatOutput(0, closesHours, closesMinutes));
  395. $(".forbiddenGroveClosesValue").css({
  396. 'float': 'right'
  397. }),
  398. $(".forbiddenGroveOpensLabel").text("Opens Again in:");
  399. $(".forbiddenGroveOpensValue").text(formatOutput(0, (closesHours + 4), closesMinutes));
  400. $(".forbiddenGroveOpensValue").css({
  401. 'float': 'right'
  402. }),
  403. forbiddenGrove.append($(".forbiddenGroveOpens"))
  404. if ((closesHours == 0) && (closesMinutes <= 15) && (localStorage.getItem('RemindGrove') == "Y")) {
  405. if (confirm('The forbidden grove is closing soon, travel there now?') == true) {
  406. travelToGrove("skip");
  407. }
  408. localStorage.setItem('RemindGrove', "N")
  409. $("#forbiddenGroveCb").prop('checked', false)
  410. }
  411. } else {
  412. //Closed
  413. $(".forbiddenGroveHeaderValue").text("CLOSED")
  414. $(".forbiddenGroveHeaderValue").css({
  415. 'color': 'red'
  416. })
  417. var timeOpens = (rotaionLenght - partialrotation).toPrecision(4);
  418. var opensHours = Math.trunc(timeOpens);
  419. var opensMinutes = Math.ceil((timeOpens - opensHours) * 60);
  420. $(".forbiddenGroveOpensValue").text(formatOutput(0, opensHours, opensMinutes));
  421. $(".forbiddenGroveOpensValue").css({
  422. 'float': 'right'
  423. }),
  424. $(".forbiddenGroveClosesLabel").text("Next Close in:");
  425. $(".forbiddenGroveClosesValue").text(formatOutput(0, (opensHours + 16), opensMinutes));
  426. $(".forbiddenGroveClosesValue").css({
  427. 'float': 'right'
  428. }),
  429. forbiddenGrove.append($(".forbiddenGroveCloses"))
  430. if ((opensHours == 0) && (opensMinutes <= 15) && (localStorage.getItem('RemindGrove') == "Y")) {
  431. alert('The forbidden grove is opening soon')
  432. localStorage.setItem('RemindGrove', "N")
  433. $("#forbiddenGroveCb").prop('checked', false)
  434. }
  435. }
  436. }
  437. $(document).on('change', '#forbiddenGroveCb', function() {
  438. if (this.checked) {
  439. localStorage.setItem('RemindGrove', "Y")
  440. this.checked = "Yes";
  441. } else {
  442. localStorage.setItem('RemindGrove', "N")
  443. this.checked = "";
  444. }
  445. })
  446.  
  447. //====================================== Balacks's Cove ======================================
  448. function buildBalacksCove() {
  449. if ($(".balacksCove").length > 0) return;
  450. var timerBox = $(".timerBox");
  451. var balacksCove = document.createElement("div");
  452. balacksCove.classList.add("balacksCove");
  453. $(balacksCove).css({
  454. 'border': '1px solid black',
  455. 'width': '25%',
  456. 'height': '75%',
  457. 'padding': 2 + "px"
  458. });
  459. //Header
  460. var balacksCoveHeader = document.createElement("div");
  461. balacksCoveHeader.classList.add("balacksCoveHeader");
  462. var balacksCoveHeaderLabel = document.createElement("div");
  463. balacksCoveHeaderLabel.classList.add("balacksCoveHeaderLabel");
  464. var balacksCoveHeaderLabelText = document.createTextNode("Balack's Cove Tide is:");
  465. balacksCoveHeaderLabel.appendChild(balacksCoveHeaderLabelText);
  466. var balacksCoveHeaderValue = document.createElement("div");
  467. balacksCoveHeaderValue.classList.add("balacksCoveHeaderValue");
  468. var balacksCoveHeaderValueText = document.createTextNode("Low");
  469. balacksCoveHeaderValue.appendChild(balacksCoveHeaderValueText);
  470. $(balacksCoveHeaderLabel).css({
  471. 'float': 'left',
  472. 'font-weight': 700,
  473. "marginRight": "5px"
  474. })
  475. $(balacksCoveHeaderValue).css({
  476. "marginLeft": "100px"
  477. });
  478. balacksCoveHeader.appendChild(balacksCoveHeaderLabel);
  479. balacksCoveHeader.appendChild(balacksCoveHeaderValue);
  480. //Low
  481. var balacksCoveLow = document.createElement("div");
  482. balacksCoveLow.classList.add("balacksCoveLow");
  483. var balacksCoveLowLabel = document.createElement("div");
  484. balacksCoveLowLabel.classList.add("balacksCoveLowLabel");
  485. var balacksCoveLowLabelText = document.createTextNode("Low Tide in:");
  486. balacksCoveLowLabel.appendChild(balacksCoveLowLabelText);
  487. var balacksCoveLowValue = document.createElement("div");
  488. balacksCoveLowValue.classList.add("balacksCoveLowValue");
  489. var balacksCoveLowValueText = document.createTextNode("?");
  490. balacksCoveLowValue.appendChild(balacksCoveLowValueText);
  491. $(balacksCoveLowLabel).css({
  492. 'float': 'left',
  493. 'width': '100px',
  494. 'font-weight': 700,
  495. "marginRight": "5px"
  496. })
  497. balacksCoveLow.appendChild(balacksCoveLowLabel);
  498. balacksCoveLow.appendChild(balacksCoveLowValue);
  499. //Medium
  500. var balacksCoveMid = document.createElement("div");
  501. balacksCoveMid.classList.add("balacksCoveMid");
  502. var balacksCoveMidLabel = document.createElement("div");
  503. balacksCoveMidLabel.classList.add("balacksCoveMidLabel");
  504. var balacksCoveMidLabelText = document.createTextNode("Mid Tide in:");
  505. balacksCoveMidLabel.appendChild(balacksCoveMidLabelText);
  506. var balacksCoveMidValue = document.createElement("div");
  507. balacksCoveMidValue.classList.add("balacksCoveMidValue");
  508. var balacksCoveMidValueText = document.createTextNode("??");
  509. balacksCoveMidValue.appendChild(balacksCoveMidValueText);
  510. $(balacksCoveMidLabel).css({
  511. 'float': 'left',
  512. 'width': '100px',
  513. 'font-weight': 700,
  514. "marginRight": "5px"
  515. })
  516. balacksCoveMid.appendChild(balacksCoveMidLabel);
  517. balacksCoveMid.appendChild(balacksCoveMidValue);
  518. //High
  519. var balacksCoveHigh = document.createElement("div");
  520. balacksCoveHigh.classList.add("balacksCoveHigh");
  521. var balacksCoveHighLabel = document.createElement("div");
  522. balacksCoveHighLabel.classList.add("balacksCoveHighLabel");
  523. var balacksCoveHighLabelText = document.createTextNode("High Tide in:");
  524. balacksCoveHighLabel.appendChild(balacksCoveHighLabelText);
  525. var balacksCoveHighValue = document.createElement("div");
  526. balacksCoveHighValue.classList.add("balacksCoveHighValue");
  527. var balacksCoveHighValueText = document.createTextNode("??");
  528. balacksCoveHighValue.appendChild(balacksCoveHighValueText);
  529. $(balacksCoveHighLabel).css({
  530. 'float': 'left',
  531. 'width': '100px',
  532. 'font-weight': 700,
  533. "marginRight": "5px"
  534. })
  535. balacksCoveHigh.appendChild(balacksCoveHighLabel);
  536. balacksCoveHigh.appendChild(balacksCoveHighValue);
  537. //Append
  538. balacksCove.appendChild(balacksCoveHeader);
  539. balacksCove.appendChild(balacksCoveLow);
  540. balacksCove.appendChild(balacksCoveMid);
  541. balacksCove.appendChild(balacksCoveHigh);
  542. return balacksCove;
  543. }
  544.  
  545. function updateBalacksCoveTimer() {
  546. if ($(".balacksCove").length < 1) return;
  547. var balacksCove = $(".balacksCove");
  548. var firstCoveLow = 1294680060;
  549. var now = todayNow();
  550. let timePassedHours = (now - firstCoveLow) / 3600;
  551. var rotaionLenght = 18.6666666666666666666666666666666666666667;
  552. var rotationsExact = timePassedHours / rotaionLenght;
  553. var rotationsInteger = Math.trunc(rotationsExact);
  554. var partialrotation = (rotationsExact - rotationsInteger) * rotaionLenght;
  555. if (partialrotation < 16) {
  556. //Low
  557. $(".balacksCoveHeaderValue").text("LOW");
  558. $(".balacksCoveHeaderValue").css({
  559. 'color': 'green'
  560. })
  561. var timeMid = (16 - partialrotation).toPrecision(4);
  562. var midHours = Math.trunc(timeMid);
  563. var midMinutes = Math.ceil((timeMid - midHours) * 60);
  564. $(".balacksCoveMidValue").text(formatOutput(0, midHours, midMinutes));
  565. $(".balacksCoveMidLabel").text("Mid-Flooding in:")
  566. $(".balacksCoveHighValue").text(formatOutput(0, (midHours + 1), midMinutes));
  567. $(".balacksCoveLowLabel").text("Low Again in:");
  568. $(".balacksCoveMidValue").css({
  569. 'float': 'right'
  570. })
  571. $(".balacksCoveHighValue").css({
  572. 'float': 'right'
  573. })
  574. $(".balacksCoveLowValue").css({
  575. 'float': 'right'
  576. })
  577. var lowHours = midHours + 2;
  578. var lowMinutes = midMinutes + 40;
  579. if (lowMinutes >= 60) {
  580. lowMinutes = lowMinutes - 60;
  581. lowHours++;
  582. }
  583. $(".balacksCoveLowValue").text(formatOutput(0, lowHours, lowMinutes));
  584. balacksCove.append($(".balacksCoveLow"))
  585. if ((midHours == 0) && (midMinutes <= 15) && (localStorage.getItem('RemindCove') == "Y")) {
  586. if (confirm('It will be mid tide soon, travel there now?') == true) {
  587. travelToCove("skip");
  588. }
  589. localStorage.setItem('RemindCove', "N")
  590. $("#balacksCoveCb").prop('checked', false)
  591. }
  592. } else if ((partialrotation >= 16) && (partialrotation < 17)) {
  593. //Mid (flooding)
  594. $(".balacksCoveHeaderValue").text("MID-Flooding");
  595. $(".balacksCoveHeaderValue").css({
  596. 'color': 'orange'
  597. })
  598. var timeHigh = (17 - partialrotation).toPrecision(4);
  599. var highHours = Math.trunc(timeHigh);
  600. var highMinutes = Math.ceil((timeHigh - highHours) * 60);
  601. $(".balacksCoveHighValue").text(formatOutput(0, highHours, highMinutes));
  602. $(".balacksCoveMidLabel").text("Mid-Ebbing in:")
  603. var midHours = highHours;
  604. var midMinutes = highMinutes + 40;
  605. if (midMinutes >= 60) {
  606. midMinutes = midMinutes - 60;
  607. midHours++;
  608. }
  609. $(".balacksCoveMidValue").text(formatOutput(0, midHours, midMinutes));
  610. $(".balacksCoveLowLabel").text("Low Tide in:");
  611. $(".balacksCoveLowValue").text(formatOutput(0, (midHours + 1), midMinutes));
  612. $(".balacksCoveMidValue").css({
  613. 'float': 'right'
  614. })
  615. $(".balacksCoveHighValue").css({
  616. 'float': 'right'
  617. })
  618. $(".balacksCoveLowValue").css({
  619. 'float': 'right'
  620. })
  621. balacksCove.append($(".balacksCoveMid"))
  622. balacksCove.append($(".balacksCoveLow"))
  623. if ((highHours == 0) && (highMinutes <= 15) && (localStorage.getItem('RemindCove') == "Y")) {
  624. if (confirm('It will be high tide soon, travel there now?') == true) {
  625. travelToCove("skip");
  626. }
  627. localStorage.setItem('RemindCove', "N")
  628. $("#balacksCoveCb").prop('checked', false)
  629. }
  630. } else if ((partialrotation >= 17) && (partialrotation < 17.6666666667)) {
  631. //High
  632. $(".balacksCoveHeaderValue").text("HIGH");
  633. $(".balacksCoveHeaderValue").css({
  634. 'color': 'red'
  635. })
  636. var timeMid = (17.6666666667 - partialrotation).toPrecision(4);
  637. var midHours = Math.trunc(timeMid);
  638. var midMinutes = Math.ceil((timeMid - midHours) * 60);
  639. $(".balacksCoveMidValue").text(formatOutput(0, midHours, midMinutes));
  640. $(".balacksCoveMidLabel").text("Mid-Ebbing in:")
  641. $(".balacksCoveLowLabel").text("Low Tide in:")
  642. $(".balacksCoveLowValue").text(formatOutput(0, (midHours + 1), midMinutes));
  643. $(".balacksCoveMidValue").css({
  644. 'float': 'right'
  645. })
  646. $(".balacksCoveLowValue").css({
  647. 'float': 'right'
  648. })
  649. $(".balacksCoveHigh").hide();
  650. balacksCove.append($(".balacksCoveLow"))
  651. if ((midHours == 0) && (midMinutes <= 15) && (localStorage.getItem('RemindCove') == "Y")) {
  652. if (confirm('It will be mid tide soon, travel there now?') == true) {
  653. travelToCove("skip");
  654. }
  655. localStorage.setItem('RemindCove', "N")
  656. $("#balacksCoveCb").prop('checked', false)
  657. }
  658. } else if (partialrotation >= 17.6666666667) {
  659. //Mid (ebbing)
  660. $(".balacksCoveHeaderValue").text("MID-Ebbing");
  661. $(".balacksCoveHeaderValue").css({
  662. 'color': 'orange'
  663. })
  664. var timeLow = (rotaionLenght - partialrotation).toPrecision(4);
  665. var lowHours = Math.trunc(timeLow);
  666. var lowMinutes = Math.ceil((timeLow - lowHours) * 60);
  667. $(".balacksCoveLowLabel").text("Low Tide in:")
  668. $(".balacksCoveLowValue").text(formatOutput(0, lowHours, lowMinutes));
  669. $(".balacksCoveMidLabel").text("Mid-Filling in:")
  670. $(".balacksCoveMidValue").text(formatOutput(0, lowHours + 16, lowMinutes));
  671. $(".balacksCoveHighLabel").text("High Tide in:");
  672. $(".balacksCoveHighValue").text(formatOutput(0, lowHours + 17, lowMinutes));
  673. $(".balacksCoveMidValue").css({
  674. 'float': 'right'
  675. })
  676. $(".balacksCoveHighValue").css({
  677. 'float': 'right'
  678. })
  679. $(".balacksCoveLowValue").css({
  680. 'float': 'right'
  681. })
  682. balacksCove.append($(".balacksCoveHigh").show())
  683. if ((lowHours == 0) && (lowMinutes <= 15) && (localStorage.getItem('RemindCove') == "Y")) {
  684. if (confirm('It will be low tide soon, travel there now?') == true) {
  685. travelToCove("skip");
  686. }
  687. localStorage.setItem('RemindCove', "N")
  688. $("#balacksCoveCb").prop('checked', false)
  689. }
  690. }
  691. }
  692.  
  693. $(document).on('change', '#balacksCoveCb', function() {
  694. if (this.checked) {
  695. localStorage.setItem('RemindCove', "Y")
  696. this.checked = "Yes";
  697. } else {
  698. localStorage.setItem('RemindCove', "N")
  699. this.checked = "";
  700. }
  701. })
  702. //====================================== Seasonal Garden ======================================
  703. function buildSeasonalGarden() {
  704. if ($(".seasonalGarden").length > 0) return;
  705. var timerBox = $(".timerBox");
  706. var seasonalGarden = document.createElement("div");
  707. seasonalGarden.classList.add("seasonalGarden");
  708. $(seasonalGarden).css({
  709. 'border': '1px solid black',
  710. 'width': '24%',
  711. 'height': '75%',
  712. 'padding': 2 + "px"
  713. });
  714. //Header
  715. var seasonalGardenHeader = document.createElement("div");
  716. seasonalGardenHeader.classList.add("seasonalGardenHeader");
  717. var seasonalGardenHeaderLabel = document.createElement("div");
  718. seasonalGardenHeaderLabel.classList.add("seasonalGardenHeaderLabel");
  719. var seasonalGardenHeaderLabelText = document.createTextNode("Current Garden Season:");
  720. seasonalGardenHeaderLabel.appendChild(seasonalGardenHeaderLabelText);
  721. var seasonalGardenHeaderValue = document.createElement("div");
  722. seasonalGardenHeaderValue.classList.add("seasonalGardenHeaderValue");
  723. var seasonalGardenHeaderValueText = document.createTextNode("FALL");
  724. seasonalGardenHeaderValue.appendChild(seasonalGardenHeaderValueText);
  725. $(seasonalGardenHeaderLabel).css({
  726. 'float': 'left',
  727. 'font-weight': 700,
  728. "marginRight": "5px"
  729. })
  730. $(seasonalGardenHeaderValue).css({
  731. "marginLeft": "100px"
  732. });
  733. seasonalGardenHeader.appendChild(seasonalGardenHeaderLabel);
  734. seasonalGardenHeader.appendChild(seasonalGardenHeaderValue);
  735. //Fall
  736. var seasonalGardenFall = document.createElement("div");
  737. seasonalGardenFall.classList.add("seasonalGardenFall");
  738. var seasonalGardenFallLabel = document.createElement("div");
  739. seasonalGardenFallLabel.classList.add("seasonalGardenFallLabel");
  740. var seasonalGardenFallLabelText = document.createTextNode("Fall in:");
  741. seasonalGardenFallLabel.appendChild(seasonalGardenFallLabelText);
  742. var seasonalGardenFallValue = document.createElement("div");
  743. seasonalGardenFallValue.classList.add("seasonalGardenFallValue");
  744. var seasonalGardenFallValueText = document.createTextNode("?");
  745. seasonalGardenFallValue.appendChild(seasonalGardenFallValueText);
  746. $(seasonalGardenFallLabel).css({
  747. 'float': 'left',
  748. 'width': '100px',
  749. 'font-weight': 700,
  750. "marginRight": "5px"
  751. })
  752. seasonalGardenFall.appendChild(seasonalGardenFallLabel);
  753. seasonalGardenFall.appendChild(seasonalGardenFallValue);
  754. //Winter
  755. var seasonalGardenWinter = document.createElement("div");
  756. seasonalGardenWinter.classList.add("seasonalGardenWinter");
  757. var seasonalGardenWinterLabel = document.createElement("div");
  758. seasonalGardenWinterLabel.classList.add("seasonalGardenWinterLabel");
  759. var seasonalGardenWinterLabelText = document.createTextNode("Winter in:");
  760. seasonalGardenWinterLabel.appendChild(seasonalGardenWinterLabelText);
  761. var seasonalGardenWinterValue = document.createElement("div");
  762. seasonalGardenWinterValue.classList.add("seasonalGardenWinterValue");
  763. var seasonalGardenWinterValueText = document.createTextNode("?");
  764. seasonalGardenWinterValue.appendChild(seasonalGardenWinterValueText);
  765. $(seasonalGardenWinterLabel).css({
  766. 'float': 'left',
  767. 'width': '100px',
  768. 'font-weight': 700,
  769. "marginRight": "5px"
  770. })
  771. seasonalGardenWinter.appendChild(seasonalGardenWinterLabel);
  772. seasonalGardenWinter.appendChild(seasonalGardenWinterValue);
  773. //Spring
  774. var seasonalGardenSpring = document.createElement("div");
  775. seasonalGardenSpring.classList.add("seasonalGardenSpring");
  776. var seasonalGardenSpringLabel = document.createElement("div");
  777. seasonalGardenSpringLabel.classList.add("seasonalGardenSpringLabel");
  778. var seasonalGardenSpringLabelText = document.createTextNode("Spring in:");
  779. seasonalGardenSpringLabel.appendChild(seasonalGardenSpringLabelText);
  780. var seasonalGardenSpringValue = document.createElement("div");
  781. seasonalGardenSpringValue.classList.add("seasonalGardenSpringValue");
  782. var seasonalGardenSpringValueText = document.createTextNode("?");
  783. seasonalGardenSpringValue.appendChild(seasonalGardenSpringValueText);
  784. $(seasonalGardenSpringLabel).css({
  785. 'float': 'left',
  786. 'width': '100px',
  787. 'font-weight': 700,
  788. "marginRight": "5px"
  789. })
  790. seasonalGardenSpring.appendChild(seasonalGardenSpringLabel);
  791. seasonalGardenSpring.appendChild(seasonalGardenSpringValue);
  792. //Summer
  793. var seasonalGardenSummer = document.createElement("div");
  794. seasonalGardenSummer.classList.add("seasonalGardenSummer");
  795. var seasonalGardenSummerLabel = document.createElement("div");
  796. seasonalGardenSummerLabel.classList.add("seasonalGardenSummerLabel");
  797. var seasonalGardenSummerLabelText = document.createTextNode("Summer in:");
  798. seasonalGardenSummerLabel.appendChild(seasonalGardenSummerLabelText);
  799. var seasonalGardenSummerValue = document.createElement("div");
  800. seasonalGardenSummerValue.classList.add("seasonalGardenSummerValue");
  801. var seasonalGardenSummerValueText = document.createTextNode("?");
  802. seasonalGardenSummerValue.appendChild(seasonalGardenSummerValueText);
  803. $(seasonalGardenSummerLabel).css({
  804. 'float': 'left',
  805. 'width': '100px',
  806. 'font-weight': 700,
  807. "marginRight": "5px"
  808. })
  809. seasonalGardenSummer.appendChild(seasonalGardenSummerLabel);
  810. seasonalGardenSummer.appendChild(seasonalGardenSummerValue);
  811. //Append
  812. seasonalGarden.appendChild(seasonalGardenHeader);
  813. seasonalGarden.appendChild(seasonalGardenFall);
  814. seasonalGarden.appendChild(seasonalGardenWinter);
  815. seasonalGarden.appendChild(seasonalGardenSpring);
  816. seasonalGarden.appendChild(seasonalGardenSummer);
  817. return seasonalGarden;
  818. }
  819.  
  820. function updateSeasonalGardenTimer() {
  821. if ($(".seasonalGarden").length < 1) return;
  822. var seasonalGarden = $(".seasonalGarden");
  823. var firstFall = 288000;
  824. var now = todayNow();
  825. let timePassedHours = (now - firstFall) / 3600;
  826. var rotaionLenght = 320;
  827. var rotationsExact = timePassedHours / rotaionLenght;
  828. var rotationsInteger = Math.trunc(rotationsExact);
  829. var partialrotation = (rotationsExact - rotationsInteger) * rotaionLenght;
  830. var fallObj = new season(0, 0, 0);
  831. var winterObj = new season(0, 0, 0);
  832. var springObj = new season(0, 0, 0);
  833. var summerObj = new season(0, 0, 0);
  834. if (partialrotation < 80) {
  835. //Summer
  836. $(".seasonalGardenHeaderValue").text("SUMMER");
  837. $(".seasonalGardenHeaderValue").css({
  838. 'color': 'red'
  839. })
  840. var timeFall = (80 - partialrotation).toPrecision(4);
  841. fallObj.hours = Math.floor(timeFall);
  842. fallObj.minutes = Math.ceil((timeFall - fallObj.hours) * 60);
  843. fallObj = convertToDyHrMn(0, fallObj.hours, fallObj.minutes);
  844. winterObj = convertToDyHrMn(fallObj.days + 3, fallObj.hours + 8, fallObj.minutes);
  845. springObj = convertToDyHrMn(winterObj.days + 3, winterObj.hours + 8, winterObj.minutes)
  846. summerObj = convertToDyHrMn(springObj.days + 3, springObj.hours + 8, springObj.minutes);
  847. $(".seasonalGardenFallLabel").text("Next Summer in:")
  848. $(".seasonalGardenWinterLabel").text("Winter in:")
  849. $(".seasonalGardenSpringLabel").text("Spring in:")
  850. $(".seasonalGardenSummerLabel").text("Summer in:")
  851. seasonalGarden.append($(".seasonalGardenFall"));
  852. seasonalGarden.append($(".seasonalGardenWinter"));
  853. seasonalGarden.append($(".seasonalGardenSpring"));
  854. seasonalGarden.append($(".seasonalGardenSummer"));
  855. if ((fallObj.hours == 0) && (fallObj.minutes <= 15) && (localStorage.getItem('RemindGarden') == "Y")) {
  856. if (confirm('It will be fall in the garden soon, travel there now?') == true) {
  857. travelToGarden("skip");
  858. }
  859. localStorage.setItem('RemindGarden', "N")
  860. $("#seasonalGardenCb").prop('checked', false)
  861. }
  862. } else if ((partialrotation >= 80) && (partialrotation < 160)) {
  863. //Fall
  864. $(".seasonalGardenHeaderValue").text("FALL");
  865. $(".seasonalGardenHeaderValue").css({
  866. 'color': 'orange'
  867. })
  868. var timeWinter = (160 - partialrotation).toPrecision(4);
  869. winterObj.hours = Math.floor(timeWinter);
  870. winterObj.minutes = Math.ceil((timeWinter - winterObj.hours) * 60);
  871. winterObj = convertToDyHrMn(0, winterObj.hours, winterObj.minutes);
  872. springObj = convertToDyHrMn(winterObj.days + 3, winterObj.hours + 8, winterObj.minutes)
  873. summerObj = convertToDyHrMn(springObj.days + 3, springObj.hours + 8, springObj.minutes)
  874. fallObj = convertToDyHrMn(summerObj.days + 3, summerObj.hours + 8, summerObj.minutes);
  875. $(".seasonalGardenFallLabel").text("Next Fall in:")
  876. $(".seasonalGardenWinterLabel").text("Winter in:")
  877. $(".seasonalGardenSpringLabel").text("Spring in:")
  878. $(".seasonalGardenSummerLabel").text("Summer in:")
  879. seasonalGarden.append($(".seasonalGardenWinter"));
  880. seasonalGarden.append($(".seasonalGardenSpring"));
  881. seasonalGarden.append($(".seasonalGardenSummer"));
  882. seasonalGarden.append($(".seasonalGardenFall"));
  883. if ((winterObj.hours == 0) && (winterObj.minutes <= 15) && (localStorage.getItem('RemindGarden') == "Y")) {
  884. if (confirm('It will be winter in the garden soon, travel there now?') == true) {
  885. travelToGarden("skip");
  886. }
  887. localStorage.setItem('RemindGarden', "N")
  888. $("#seasonalGardenCb").prop('checked', false)
  889. }
  890. } else if ((partialrotation >= 160) && (partialrotation < 240)) {
  891. //Winter
  892. $(".seasonalGardenHeaderValue").text("WINTER");
  893. $(".seasonalGardenHeaderValue").css({
  894. 'color': 'blue'
  895. })
  896. var timeSpring = (240 - partialrotation).toPrecision(4);
  897. springObj.hours = Math.floor(timeSpring);
  898. springObj.minutes = Math.ceil((timeSpring - springObj.hours) * 60);
  899. springObj = convertToDyHrMn(0, springObj.hours, springObj.minutes)
  900. summerObj = convertToDyHrMn(springObj.days + 3, springObj.hours + 8, springObj.minutes);
  901. fallObj = convertToDyHrMn(summerObj.days + 3, summerObj.hours + 8, summerObj.minutes);
  902. winterObj = convertToDyHrMn(fallObj.days + 3, fallObj.hours + 8, fallObj.minutes);
  903. $(".seasonalGardenFallLabel").text("Fall in:")
  904. $(".seasonalGardenWinterLabel").text("Next Winter in:")
  905. $(".seasonalGardenSpringLabel").text("Spring in:")
  906. $(".seasonalGardenSummerLabel").text("Summer in:")
  907. seasonalGarden.append($(".seasonalGardenSpring"));
  908. seasonalGarden.append($(".seasonalGardenSummer"));
  909. seasonalGarden.append($(".seasonalGardenFall"));
  910. seasonalGarden.append($(".seasonalGardenWinter"));
  911. if ((springObj.hours == 0) && (springObj.minutes <= 15) && (localStorage.getItem('RemindGarden') == "Y")) {
  912. if (confirm('It will be spring in the garden soon, travel there now?') == true) {
  913. travelToGarden("skip");
  914. }
  915. localStorage.setItem('RemindGarden', "N")
  916. $("#seasonalGardenCb").prop('checked', false)
  917. }
  918. } else {
  919. //Spring
  920. $(".seasonalGardenHeaderValue").text("SPRING");
  921. $(".seasonalGardenHeaderValue").css({
  922. 'color': 'green'
  923. })
  924. var timeSummer = (320 - partialrotation).toPrecision(4);
  925. summerObj.hours = Math.floor(timeSummer);
  926. summerObj.minutes = Math.ceil((timeSummer - summerObj.hours) * 60);
  927. summerObj = convertToDyHrMn(0, summerObj.hours, summerObj.minutes)
  928. fallObj = convertToDyHrMn(summerObj.days + 3, summerObj.hours + 8, summerObj.minutes);
  929. winterObj = convertToDyHrMn(fallObj.days + 3, fallObj.hours + 8, fallObj.minutes);
  930. springObj = convertToDyHrMn(winterObj.days + 3, winterObj.hours + 8, winterObj.minutes);
  931. $(".seasonalGardenFallLabel").text("Fall in:")
  932. $(".seasonalGardenWinterLabel").text("Winter in:")
  933. $(".seasonalGardenSpringLabel").text("Next Spring in:")
  934. $(".seasonalGardenSummerLabel").text("Summer in:")
  935. seasonalGarden.append($(".seasonalGardenSummer"));
  936. seasonalGarden.append($(".seasonalGardenFall"));
  937. seasonalGarden.append($(".seasonalGardenWinter"));
  938. seasonalGarden.append($(".seasonalGardenSpring"));
  939. if ((summerObj.hours == 0) && (summerObj.minutes <= 15) && (localStorage.getItem('RemindGarden') == "Y")) {
  940. if (confirm('It will be summer in the garden soon, travel there now?') == true) {
  941. travelToGarden("skip");
  942. }
  943. localStorage.setItem('RemindGarden', "N")
  944. $("#seasonalGardenCb").prop('checked', false)
  945. }
  946. }
  947. $(".seasonalGardenFallValue").text(formatOutput(fallObj.days, fallObj.hours, fallObj.minutes));
  948. $(".seasonalGardenWinterValue").text(formatOutput(winterObj.days, winterObj.hours, winterObj.minutes));
  949. $(".seasonalGardenSpringValue").text(formatOutput(springObj.days, springObj.hours, springObj.minutes));
  950. $(".seasonalGardenSummerValue").text(formatOutput(summerObj.days, summerObj.hours, summerObj.minutes));
  951. $(".seasonalGardenFallValue").css({
  952. 'float': 'right'
  953. })
  954. $(".seasonalGardenWinterValue").css({
  955. 'float': 'right'
  956. })
  957. $(".seasonalGardenSpringValue").css({
  958. 'float': 'right'
  959. })
  960. $(".seasonalGardenSummerValue").css({
  961. 'float': 'right'
  962. })
  963. }
  964.  
  965. function season(days, hours, minutes) {
  966. this.days = days;
  967. this.hours = hours;
  968. this.minutes = minutes;
  969. }
  970. $(document).on('change', '#seasonalGardenCb', function() {
  971. if (this.checked) {
  972. localStorage.setItem('RemindGarden', "Y")
  973. this.checked = "Yes";
  974. } else {
  975. localStorage.setItem('RemindGarden', "N")
  976. this.checked = "";
  977. }
  978. })
  979. //====================================== Toxic Spill ======================================
  980. function buildToxicSpill() {
  981. if ($(".toxicSpill").length > 0) return;
  982. var timerBox = $(".timerBox");
  983. var toxicSpill = document.createElement("div");
  984. toxicSpill.classList.add("toxicSpill");
  985. $(toxicSpill).css({
  986. 'border': '1px solid black',
  987. 'width': '26%',
  988. 'height': '75%',
  989. 'padding': 2 + "px"
  990. });
  991. //Header
  992. var toxicSpillHeader = document.createElement("div");
  993. toxicSpillHeader.classList.add("toxicSpillHeader");
  994. var toxicSpillHeaderLabel = document.createElement("div");
  995. toxicSpillHeaderLabel.classList.add("toxicSpillHeaderLabel");
  996. var toxicSpillHeaderLabelText = document.createTextNode("Current Spill Level:");
  997. toxicSpillHeaderLabel.appendChild(toxicSpillHeaderLabelText);
  998. var toxicSpillHeaderValue = document.createElement("div");
  999. toxicSpillHeaderValue.classList.add("toxicSpillHeaderValue");
  1000. var toxicSpillHeaderValueText = document.createTextNode("Archduke");
  1001. toxicSpillHeaderValue.appendChild(toxicSpillHeaderValueText);
  1002. $(toxicSpillHeaderLabel).css({
  1003. 'float': 'left',
  1004. 'font-weight': 700,
  1005. "marginRight": "5px"
  1006. })
  1007. $(toxicSpillHeaderValue).css({
  1008. "marginLeft": "100px"
  1009. });
  1010. toxicSpillHeader.appendChild(toxicSpillHeaderLabel);
  1011. toxicSpillHeader.appendChild(toxicSpillHeaderValue);
  1012. //Hero
  1013. var toxicSpillHero = document.createElement("div");
  1014. toxicSpillHero.classList.add("toxicSpillHero");
  1015. var toxicSpillHeroLabel = document.createElement("div");
  1016. toxicSpillHeroLabel.classList.add("toxicSpillHeroLabel");
  1017. var toxicSpillHeroLabelText = document.createTextNode("Hero in:");
  1018. toxicSpillHeroLabel.appendChild(toxicSpillHeroLabelText);
  1019. var toxicSpillHeroValue = document.createElement("div");
  1020. toxicSpillHeroValue.classList.add("toxicSpillHeroValue");
  1021. var toxicSpillHeroValueText = document.createTextNode("?");
  1022. toxicSpillHeroValue.appendChild(toxicSpillHeroValueText);
  1023. $(toxicSpillHeroLabel).css({
  1024. 'float': 'left',
  1025. 'width': '100px',
  1026. 'font-weight': 700,
  1027. "marginRight": "5px"
  1028. })
  1029. toxicSpillHero.appendChild(toxicSpillHeroLabel);
  1030. toxicSpillHero.appendChild(toxicSpillHeroValue);
  1031. //Knight
  1032. var toxicSpillKnight = document.createElement("div");
  1033. toxicSpillKnight.classList.add("toxicSpillKnight");
  1034. var toxicSpillKnightLabel = document.createElement("div");
  1035. toxicSpillKnightLabel.classList.add("toxicSpillKnightLabel");
  1036. var toxicSpillKnightLabelText = document.createTextNode("Knight in:");
  1037. toxicSpillKnightLabel.appendChild(toxicSpillKnightLabelText);
  1038. var toxicSpillKnightValue = document.createElement("div");
  1039. toxicSpillKnightValue.classList.add("toxicSpillKnightValue");
  1040. var toxicSpillKnightValueText = document.createTextNode("?");
  1041. toxicSpillKnightValue.appendChild(toxicSpillKnightValueText);
  1042. $(toxicSpillKnightLabel).css({
  1043. 'float': 'left',
  1044. 'width': '100px',
  1045. 'font-weight': 700,
  1046. "marginRight": "5px"
  1047. })
  1048. toxicSpillKnight.appendChild(toxicSpillKnightLabel);
  1049. toxicSpillKnight.appendChild(toxicSpillKnightValue);
  1050. //Lord
  1051. var toxicSpillLord = document.createElement("div");
  1052. toxicSpillLord.classList.add("toxicSpillLord");
  1053. var toxicSpillLordLabel = document.createElement("div");
  1054. toxicSpillLordLabel.classList.add("toxicSpillLordLabel");
  1055. var toxicSpillLordLabelText = document.createTextNode("Lord in:");
  1056. toxicSpillLordLabel.appendChild(toxicSpillLordLabelText);
  1057. var toxicSpillLordValue = document.createElement("div");
  1058. toxicSpillLordValue.classList.add("toxicSpillLordValue");
  1059. var toxicSpillLordValueText = document.createTextNode("?");
  1060. toxicSpillLordValue.appendChild(toxicSpillLordValueText);
  1061. $(toxicSpillLordLabel).css({
  1062. 'float': 'left',
  1063. 'width': '100px',
  1064. 'font-weight': 700,
  1065. "marginRight": "5px"
  1066. })
  1067. toxicSpillLord.appendChild(toxicSpillLordLabel);
  1068. toxicSpillLord.appendChild(toxicSpillLordValue);
  1069. //Baron
  1070. var toxicSpillBaron = document.createElement("div");
  1071. toxicSpillBaron.classList.add("toxicSpillBaron");
  1072. var toxicSpillBaronLabel = document.createElement("div");
  1073. toxicSpillBaronLabel.classList.add("toxicSpillBaronLabel");
  1074. var toxicSpillBaronLabelText = document.createTextNode("Baron in:");
  1075. toxicSpillBaronLabel.appendChild(toxicSpillBaronLabelText);
  1076. var toxicSpillBaronValue = document.createElement("div");
  1077. toxicSpillBaronValue.classList.add("toxicSpillBaronValue");
  1078. var toxicSpillBaronValueText = document.createTextNode("?");
  1079. toxicSpillBaronValue.appendChild(toxicSpillBaronValueText);
  1080. $(toxicSpillBaronLabel).css({
  1081. 'float': 'left',
  1082. 'width': '100px',
  1083. 'font-weight': 700,
  1084. "marginRight": "5px"
  1085. })
  1086. toxicSpillBaron.appendChild(toxicSpillBaronLabel);
  1087. toxicSpillBaron.appendChild(toxicSpillBaronValue);
  1088. //Count
  1089. var toxicSpillCount = document.createElement("div");
  1090. toxicSpillCount.classList.add("toxicSpillCount");
  1091. var toxicSpillCountLabel = document.createElement("div");
  1092. toxicSpillCountLabel.classList.add("toxicSpillCountLabel");
  1093. var toxicSpillCountLabelText = document.createTextNode("Count in:");
  1094. toxicSpillCountLabel.appendChild(toxicSpillCountLabelText);
  1095. var toxicSpillCountValue = document.createElement("div");
  1096. toxicSpillCountValue.classList.add("toxicSpillCountValue");
  1097. var toxicSpillCountValueText = document.createTextNode("?");
  1098. toxicSpillCountValue.appendChild(toxicSpillCountValueText);
  1099. $(toxicSpillCountLabel).css({
  1100. 'float': 'left',
  1101. 'width': '100px',
  1102. 'font-weight': 700,
  1103. "marginRight": "5px"
  1104. })
  1105. toxicSpillCount.appendChild(toxicSpillCountLabel);
  1106. toxicSpillCount.appendChild(toxicSpillCountValue);
  1107. //Duke
  1108. var toxicSpillDuke = document.createElement("div");
  1109. toxicSpillDuke.classList.add("toxicSpillDuke");
  1110. var toxicSpillDukeLabel = document.createElement("div");
  1111. toxicSpillDukeLabel.classList.add("toxicSpillDukeLabel");
  1112. var toxicSpillDukeLabelText = document.createTextNode("Duke in:");
  1113. toxicSpillDukeLabel.appendChild(toxicSpillDukeLabelText);
  1114. var toxicSpillDukeValue = document.createElement("div");
  1115. toxicSpillDukeValue.classList.add("toxicSpillDukeValue");
  1116. var toxicSpillDukeValueText = document.createTextNode("?");
  1117. toxicSpillDukeValue.appendChild(toxicSpillDukeValueText);
  1118. $(toxicSpillDukeLabel).css({
  1119. 'float': 'left',
  1120. 'width': '100px',
  1121. 'font-weight': 700,
  1122. "marginRight": "5px"
  1123. })
  1124. toxicSpillDuke.appendChild(toxicSpillDukeLabel);
  1125. toxicSpillDuke.appendChild(toxicSpillDukeValue);
  1126. //Grand Duke
  1127. var toxicSpillGrandDuke = document.createElement("div");
  1128. toxicSpillGrandDuke.classList.add("toxicSpillGrandDuke");
  1129. var toxicSpillGrandDukeLabel = document.createElement("div");
  1130. toxicSpillGrandDukeLabel.classList.add("toxicSpillGrandDukeLabel");
  1131. var toxicSpillGrandDukeLabelText = document.createTextNode("Grand Duke in:");
  1132. toxicSpillGrandDukeLabel.appendChild(toxicSpillGrandDukeLabelText);
  1133. var toxicSpillGrandDukeValue = document.createElement("div");
  1134. toxicSpillGrandDukeValue.classList.add("toxicSpillGrandDukeValue");
  1135. var toxicSpillGrandDukeValueText = document.createTextNode("?");
  1136. toxicSpillGrandDukeValue.appendChild(toxicSpillGrandDukeValueText);
  1137. $(toxicSpillGrandDukeLabel).css({
  1138. 'float': 'left',
  1139. 'width': '100px',
  1140. 'font-weight': 700,
  1141. "marginRight": "5px"
  1142. })
  1143. toxicSpillGrandDuke.appendChild(toxicSpillGrandDukeLabel);
  1144. toxicSpillGrandDuke.appendChild(toxicSpillGrandDukeValue);
  1145. //Archduke
  1146. var toxicSpillArchduke = document.createElement("div");
  1147. toxicSpillArchduke.classList.add("toxicSpillArchduke");
  1148. var toxicSpillArchdukeLabel = document.createElement("div");
  1149. toxicSpillArchdukeLabel.classList.add("toxicSpillArchdukeLabel");
  1150. var toxicSpillArchdukeLabelText = document.createTextNode("Archduke in:");
  1151. toxicSpillArchdukeLabel.appendChild(toxicSpillArchdukeLabelText);
  1152. var toxicSpillArchdukeValue = document.createElement("div");
  1153. toxicSpillArchdukeValue.classList.add("toxicSpillArchdukeValue");
  1154. var toxicSpillArchdukeValueText = document.createTextNode("?");
  1155. toxicSpillArchdukeValue.appendChild(toxicSpillArchdukeValueText);
  1156. $(toxicSpillArchdukeLabel).css({
  1157. 'float': 'left',
  1158. 'width': '100px',
  1159. 'font-weight': 700,
  1160. "marginRight": "5px"
  1161. })
  1162. toxicSpillArchduke.appendChild(toxicSpillArchdukeLabel);
  1163. toxicSpillArchduke.appendChild(toxicSpillArchdukeValue);
  1164. //Append
  1165. toxicSpill.appendChild(toxicSpillHeader);
  1166. toxicSpill.appendChild(toxicSpillHero);
  1167. toxicSpill.appendChild(toxicSpillKnight);
  1168. toxicSpill.appendChild(toxicSpillLord);
  1169. toxicSpill.appendChild(toxicSpillBaron);
  1170. toxicSpill.appendChild(toxicSpillCount);
  1171. toxicSpill.appendChild(toxicSpillDuke);
  1172. toxicSpill.appendChild(toxicSpillGrandDuke);
  1173. toxicSpill.appendChild(toxicSpillArchduke);
  1174. return toxicSpill;
  1175. }
  1176.  
  1177. function updateToxicSpillTimer() {
  1178. if ($(".toxicSpill").length < 1) return;
  1179. var toxicSpill = $(".toxicSpill");
  1180. $(".toxicSpill").children().show();
  1181. var firstHero = 1503597600;
  1182. var now = todayNow();
  1183. let timePassedHours = (now - firstHero) / 3600;
  1184. var rotaionLenght = 302;
  1185. var rotationsExact = timePassedHours / rotaionLenght;
  1186. var rotationsInteger = Math.floor(rotationsExact);
  1187. var partialrotation = (rotationsExact - rotationsInteger) * rotaionLenght;
  1188. var heroObj = new season(0, 0, 0);
  1189. var knightObj = new season(0, 0, 0);
  1190. var lordObj = new season(0, 0, 0);
  1191. var baronObj = new season(0, 0, 0);
  1192. var countObj = new season(0, 0, 0);
  1193. var dukeObj = new season(0, 0, 0);
  1194. var granddukeObj = new season(0, 0, 0);
  1195. var archdukeObj = new season(0, 0, 0);
  1196. if (partialrotation < 15) {
  1197. //Hero Rising
  1198. $(".toxicSpillHeaderValue").text("HERO-RISING");
  1199. $(".toxicSpillHeaderValue").css({
  1200. 'color': 'red'
  1201. });
  1202. var timeKnight = (15 - partialrotation).toPrecision(4);
  1203. knightObj.hours = Math.floor(timeKnight);
  1204. knightObj.minutes = Math.ceil((timeKnight - knightObj.hours) * 60);
  1205. knightObj = convertToDyHrMn(0, knightObj.hours, knightObj.minutes);
  1206. lordObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1207. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1208. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1209. dukeObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1210. $(".toxicSpillKnightLabel").text("Knight in:");
  1211. $(".toxicSpillLordLabel").text("Lord in:");
  1212. $(".toxicSpillBaronLabel").text("Baron in:");
  1213. $(".toxicSpillCountLabel").text("Count in:");
  1214. $(".toxicSpillDukeLabel").text("Duke in:");
  1215. toxicSpill.append($(".toxicSpillKnight"));
  1216. toxicSpill.append($(".toxicSpillLord"));
  1217. toxicSpill.append($(".toxicSpillBaron"));
  1218. toxicSpill.append($(".toxicSpillCount"));
  1219. toxicSpill.append($(".toxicSpillDuke"));
  1220. $(".toxicSpillHero").hide();
  1221. $(".toxicSpillGrandDuke").hide();
  1222. $(".toxicSpillArchduke").hide();
  1223. if ((knightObj.hours == 0) && (knightObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1224. if (confirm('It will be Knight level soon at the toxic spill, travel there now?') == true) {
  1225. travelToSpill("skip");
  1226. }
  1227. localStorage.setItem('RemindSpill', "N")
  1228. $("#toxicSpillCb").prop('checked', false)
  1229. }
  1230. } else if (partialrotation >= 15 && partialrotation < 31) {
  1231. //Knight Rising
  1232. $(".toxicSpillHeaderValue").text("KNIGHT-RISING");
  1233. $(".toxicSpillHeaderValue").css({
  1234. 'color': 'red'
  1235. });
  1236. var timeLord = (31 - partialrotation).toPrecision(4);
  1237. lordObj.hours = Math.floor(timeLord);
  1238. lordObj.minutes = Math.ceil((timeLord - lordObj.hours) * 60);
  1239. lordObj = convertToDyHrMn(0, lordObj.hours, lordObj.minutes);
  1240. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1241. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1242. dukeObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1243. granddukeObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours, dukeObj.minutes);
  1244. $(".toxicSpillLordLabel").text("Lord in:");
  1245. $(".toxicSpillBaronLabel").text("Baron in:");
  1246. $(".toxicSpillCountLabel").text("Count in:");
  1247. $(".toxicSpillDukeLabel").text("Duke in:");
  1248. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1249. toxicSpill.append($(".toxicSpillLord"));
  1250. toxicSpill.append($(".toxicSpillBaron"));
  1251. toxicSpill.append($(".toxicSpillCount"));
  1252. toxicSpill.append($(".toxicSpillDuke"));
  1253. toxicSpill.append($(".toxicSpillGrandDuke"));
  1254. $(".toxicSpillHero").hide();
  1255. $(".toxicSpillKnight").hide();
  1256. $(".toxicSpillArchduke").hide();
  1257. if ((lordObj.hours == 0) && (lordObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1258. if (confirm('It will be Lord level soon at the toxic spill, travel there now?') == true) {
  1259. travelToSpill("skip");
  1260. }
  1261. localStorage.setItem('RemindSpill', "N")
  1262. $("#toxicSpillCb").prop('checked', false)
  1263. }
  1264. } else if (partialrotation >= 31 && partialrotation < 49) {
  1265. //Lord Rising
  1266. $(".toxicSpillHeaderValue").text("LORD-RISING");
  1267. $(".toxicSpillHeaderValue").css({
  1268. 'color': 'red'
  1269. });
  1270. var timeBaron = (49 - partialrotation).toPrecision(4);
  1271. baronObj.hours = Math.floor(timeBaron);
  1272. baronObj.minutes = Math.ceil((timeBaron - baronObj.hours) * 60);
  1273. baronObj = convertToDyHrMn(0, baronObj.hours, baronObj.minutes);
  1274. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1275. dukeObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1276. granddukeObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours, dukeObj.minutes);
  1277. archdukeObj = convertToDyHrMn(granddukeObj.days + 1, granddukeObj.hours, granddukeObj.minutes);
  1278. $(".toxicSpillBaronLabel").text("Baron in:");
  1279. $(".toxicSpillCountLabel").text("Count in:");
  1280. $(".toxicSpillDukeLabel").text("Duke in:");
  1281. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1282. $(".toxicSpillArchdukeLabel").text("Archduke in:");
  1283. toxicSpill.append($(".toxicSpillBaron"));
  1284. toxicSpill.append($(".toxicSpillCount"));
  1285. toxicSpill.append($(".toxicSpillDuke"));
  1286. toxicSpill.append($(".toxicSpillGrandDuke"));
  1287. toxicSpill.append($(".toxicSpillArchduke"));
  1288. $(".toxicSpillHero").hide();
  1289. $(".toxicSpillKnight").hide();
  1290. $(".toxicSpillLord").hide();
  1291. if ((baronObj.hours == 0) && (baronObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1292. if (confirm('It will be Baron level soon at the toxic spill, travel there now?') == true) {
  1293. travelToSpill("skip");
  1294. }
  1295. localStorage.setItem('RemindSpill', "N")
  1296. $("#toxicSpillCb").prop('checked', false)
  1297. }
  1298. } else if (partialrotation >= 49 && partialrotation < 67) {
  1299. //Baron Rising
  1300. $(".toxicSpillHeaderValue").text("BARON-RISING");
  1301. $(".toxicSpillHeaderValue").css({
  1302. 'color': 'red'
  1303. });
  1304. var timeCount = (67 - partialrotation).toPrecision(4);
  1305. countObj.hours = Math.floor(timeCount);
  1306. countObj.minutes = Math.ceil((timeCount - countObj.hours) * 60);
  1307. countObj = convertToDyHrMn(0, countObj.hours, countObj.minutes);
  1308. dukeObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1309. granddukeObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours, dukeObj.minutes);
  1310. archdukeObj = convertToDyHrMn(granddukeObj.days + 1, granddukeObj.hours, granddukeObj.minutes);
  1311. baronObj = convertToDyHrMn(archdukeObj.days + 4, archdukeObj.hours, archdukeObj.minutes);
  1312. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1313. $(".toxicSpillArchdukeLabel").text("Archduke in:");
  1314. $(".toxicSpillDukeLabel").text("Duke in:");
  1315. $(".toxicSpillCountLabel").text("Count in:");
  1316. $(".toxicSpillBaronLabel").text("Baron Falling in:");
  1317. toxicSpill.append($(".toxicSpillCount"));
  1318. toxicSpill.append($(".toxicSpillDuke"));
  1319. toxicSpill.append($(".toxicSpillGrandDuke"));
  1320. toxicSpill.append($(".toxicSpillArchduke"));
  1321. toxicSpill.append($(".toxicSpillBaron"));
  1322. $(".toxicSpillHero").hide();
  1323. $(".toxicSpillKnight").hide();
  1324. $(".toxicSpillLord").hide();
  1325. if ((countObj.hours == 0) && (countObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1326. if (confirm('It will be Count level soon at the toxic spill, travel there now?') == true) {
  1327. travelToSpill("skip");
  1328. }
  1329. localStorage.setItem('RemindSpill', "N")
  1330. $("#toxicSpillCb").prop('checked', false)
  1331. }
  1332. } else if (partialrotation >= 67 && partialrotation < 91) {
  1333. //Count Rising
  1334. $(".toxicSpillHeaderValue").text("COUNT-RISING");
  1335. $(".toxicSpillHeaderValue").css({
  1336. 'color': 'red'
  1337. });
  1338. var timeDuke = (91 - partialrotation).toPrecision(4);
  1339. dukeObj.hours = Math.floor(timeDuke);
  1340. dukeObj.minutes = Math.ceil((timeDuke - dukeObj.hours) * 60);
  1341. dukeObj = convertToDyHrMn(0, dukeObj.hours, dukeObj.minutes);
  1342. granddukeObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours, dukeObj.minutes);
  1343. archdukeObj = convertToDyHrMn(granddukeObj.days + 1, granddukeObj.hours, granddukeObj.minutes);
  1344. countObj = convertToDyHrMn(archdukeObj.days + 3, archdukeObj.hours, archdukeObj.minutes);
  1345. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1346. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1347. $(".toxicSpillArchdukeLabel").text("Archduke in:");
  1348. $(".toxicSpillDukeLabel").text("Duke in:");
  1349. $(".toxicSpillCountLabel").text("Count Falling in:");
  1350. $(".toxicSpillBaronLabel").text("Baron in:");
  1351. toxicSpill.append($(".toxicSpillDuke"));
  1352. toxicSpill.append($(".toxicSpillGrandDuke"));
  1353. toxicSpill.append($(".toxicSpillArchduke"));
  1354. toxicSpill.append($(".toxicSpillCount"));
  1355. toxicSpill.append($(".toxicSpillBaron"));
  1356. $(".toxicSpillHero").hide();
  1357. $(".toxicSpillKnight").hide();
  1358. $(".toxicSpillLord").hide();
  1359. if ((dukeObj.hours == 0) && (dukeObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1360. if (confirm('It will be Duke level soon at the toxic spill, travel there now?') == true) {
  1361. travelToSpill("skip");
  1362. }
  1363. localStorage.setItem('RemindSpill', "N")
  1364. $("#toxicSpillCb").prop('checked', false)
  1365. }
  1366. } else if (partialrotation >= 91 && partialrotation < 115) {
  1367. //Duke Rising
  1368. $(".toxicSpillHeaderValue").text("DUKE-RISING");
  1369. $(".toxicSpillHeaderValue").css({
  1370. 'color': 'red'
  1371. });
  1372. var timeGrandDuke = (115 - partialrotation).toPrecision(4);
  1373. granddukeObj.hours = Math.floor(timeGrandDuke);
  1374. granddukeObj.minutes = Math.ceil((timeGrandDuke - granddukeObj.hours) * 60);
  1375. granddukeObj = convertToDyHrMn(0, granddukeObj.hours, granddukeObj.minutes);
  1376. archdukeObj = convertToDyHrMn(granddukeObj.days + 1, granddukeObj.hours, granddukeObj.minutes);
  1377. dukeObj = convertToDyHrMn(archdukeObj.days + 2, archdukeObj.hours, archdukeObj.minutes);
  1378. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  1379. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1380. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1381. $(".toxicSpillArchdukeLabel").text("Archduke in:");
  1382. $(".toxicSpillDukeLabel").text("Duke Falling in:");
  1383. $(".toxicSpillCountLabel").text("Count in:");
  1384. $(".toxicSpillBaronLabel").text("Baron in:");
  1385. toxicSpill.append($(".toxicSpillGrandDuke"));
  1386. toxicSpill.append($(".toxicSpillArchduke"));
  1387. toxicSpill.append($(".toxicSpillDuke"));
  1388. toxicSpill.append($(".toxicSpillCount"));
  1389. toxicSpill.append($(".toxicSpillBaron"));
  1390. $(".toxicSpillHero").hide();
  1391. $(".toxicSpillKnight").hide();
  1392. $(".toxicSpillLord").hide();
  1393. if ((granddukeObj.hours == 0) && (granddukeObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1394. if (confirm('It will be Grand Duke level soon at the toxic spill, travel there now?') == true) {
  1395. travelToSpill("skip");
  1396. }
  1397. localStorage.setItem('RemindSpill', "N")
  1398. $("#toxicSpillCb").prop('checked', false)
  1399. }
  1400. } else if (partialrotation >= 115 && partialrotation < 139) {
  1401. //Grand Duke Rising
  1402. $(".toxicSpillHeaderValue").text("GD-RISING");
  1403. $(".toxicSpillHeaderValue").css({
  1404. 'color': 'red'
  1405. });
  1406. var timeArchduke = (139 - partialrotation).toPrecision(4);
  1407. archdukeObj.hours = Math.floor(timeArchduke);
  1408. archdukeObj.minutes = Math.ceil((timeArchduke - archdukeObj.hours) * 60);
  1409. archdukeObj = convertToDyHrMn(0, archdukeObj.hours, archdukeObj.minutes);
  1410. granddukeObj = convertToDyHrMn(archdukeObj.days, archdukeObj.hours + 24, archdukeObj.minutes);
  1411. dukeObj = convertToDyHrMn(0, granddukeObj.hours + 24, granddukeObj.minutes);
  1412. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  1413. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1414. $(".toxicSpillArchdukeLabel").text("Archduke in:");
  1415. $(".toxicSpillGrandDukeLabel").text("GD Falling in:");
  1416. $(".toxicSpillDukeLabel").text("Duke in:");
  1417. $(".toxicSpillCountLabel").text("Count in:");
  1418. $(".toxicSpillBaronLabel").text("Baron in:");
  1419. toxicSpill.append($(".toxicSpillArchduke"));
  1420. toxicSpill.append($(".toxicSpillGrandDuke"));
  1421. toxicSpill.append($(".toxicSpillDuke"));
  1422. toxicSpill.append($(".toxicSpillCount"));
  1423. toxicSpill.append($(".toxicSpillBaron"));
  1424. $(".toxicSpillHero").hide();
  1425. $(".toxicSpillKnight").hide();
  1426. $(".toxicSpillLord").hide();
  1427. if ((granddukeObj.hours == 0) && (granddukeObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1428. if (confirm('It will be Grand Duke level soon at the toxic spill, travel there now?') == true) {
  1429. travelToSpill("skip");
  1430. }
  1431. localStorage.setItem('RemindSpill', "N")
  1432. $("#toxicSpillCb").prop('checked', false)
  1433. }
  1434. } else if (partialrotation >= 139 && partialrotation < 151) {
  1435. //Archduke Rising
  1436. $(".toxicSpillHeaderValue").text("AD-RISING");
  1437. $(".toxicSpillHeaderValue").css({
  1438. 'color': 'red'
  1439. });
  1440. var timeArchduke = (151 - partialrotation).toPrecision(4);
  1441. archdukeObj.hours = Math.floor(timeArchduke);
  1442. archdukeObj.minutes = Math.ceil((timeArchduke - archdukeObj.hours) * 60);
  1443. archdukeObj = convertToDyHrMn(0, archdukeObj.hours, archdukeObj.minutes);
  1444. granddukeObj = convertToDyHrMn(archdukeObj.days, archdukeObj.hours + 12, archdukeObj.minutes);
  1445. dukeObj = convertToDyHrMn(0, granddukeObj.hours + 24, granddukeObj.minutes);
  1446. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  1447. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1448. $(".toxicSpillArchdukeLabel").text("AD Falling in:");
  1449. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1450. $(".toxicSpillDukeLabel").text("Duke in:");
  1451. $(".toxicSpillCountLabel").text("Count in:");
  1452. $(".toxicSpillBaronLabel").text("Baron in:");
  1453. toxicSpill.append($(".toxicSpillArchduke"));
  1454. toxicSpill.append($(".toxicSpillGrandDuke"));
  1455. toxicSpill.append($(".toxicSpillDuke"));
  1456. toxicSpill.append($(".toxicSpillCount"));
  1457. toxicSpill.append($(".toxicSpillBaron"));
  1458. $(".toxicSpillHero").hide();
  1459. $(".toxicSpillKnight").hide();
  1460. $(".toxicSpillLord").hide();
  1461. } else if (partialrotation >= 151 && partialrotation < 163) {
  1462. //Archduke Falling
  1463. $(".toxicSpillHeaderValue").text("AD-FALLING");
  1464. $(".toxicSpillHeaderValue").css({
  1465. 'color': 'green'
  1466. });
  1467. var timeGDuke = (163 - partialrotation).toPrecision(4);
  1468. granddukeObj.hours = Math.floor(timeGDuke);
  1469. granddukeObj.minutes = Math.ceil((timeGDuke - granddukeObj.hours) * 60);
  1470. granddukeObj = convertToDyHrMn(0, granddukeObj.hours, granddukeObj.minutes);
  1471. dukeObj = convertToDyHrMn(0, granddukeObj.hours + 24, granddukeObj.minutes);
  1472. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  1473. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1474. lordObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1475. $(".toxicSpillGrandDukeLabel").text("Grand Duke in:");
  1476. $(".toxicSpillDukeLabel").text("Duke in:");
  1477. $(".toxicSpillCountLabel").text("Count in:");
  1478. $(".toxicSpillBaronLabel").text("Baron in:");
  1479. $(".toxicSpillLordLabel").text("Lord in:");
  1480. toxicSpill.append($(".toxicSpillGrandDuke"));
  1481. toxicSpill.append($(".toxicSpillDuke"));
  1482. toxicSpill.append($(".toxicSpillCount"));
  1483. toxicSpill.append($(".toxicSpillBaron"));
  1484. toxicSpill.append($(".toxicSpillLord"));
  1485. $(".toxicSpillHero").hide();
  1486. $(".toxicSpillKnight").hide();
  1487. $(".toxicSpillArchduke").hide();
  1488. if ((granddukeObj.hours == 0) && (granddukeObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1489. if (confirm('It will be Grand Duke level soon at the toxic spill, travel there now?') == true) {
  1490. travelToSpill("skip");
  1491. }
  1492. localStorage.setItem('RemindSpill', "N")
  1493. $("#toxicSpillCb").prop('checked', false)
  1494. }
  1495. } else if (partialrotation >= 163 && partialrotation < 187) {
  1496. //Grand Duke Falling
  1497. $(".toxicSpillHeaderValue").text("GD-FALLING");
  1498. $(".toxicSpillHeaderValue").css({
  1499. 'color': 'green'
  1500. });
  1501. var timeDuke = (187 - partialrotation).toPrecision(4);
  1502. dukeObj.hours = Math.floor(timeDuke);
  1503. dukeObj.minutes = Math.ceil((timeDuke - dukeObj.hours) * 60);
  1504. dukeObj = convertToDyHrMn(0, dukeObj.hours, dukeObj.minutes);
  1505. countObj = convertToDyHrMn(dukeObj.days + 1, dukeObj.hours + 10, dukeObj.minutes);
  1506. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1507. lordObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1508. knightObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1509. $(".toxicSpillDukeLabel").text("Duke in:");
  1510. $(".toxicSpillCountLabel").text("Count in:");
  1511. $(".toxicSpillBaronLabel").text("Baron in:");
  1512. $(".toxicSpillLordLabel").text("Lord in:");
  1513. $(".toxicSpillKnightLabel").text("Knight in:");
  1514. toxicSpill.append($(".toxicSpillDuke"));
  1515. toxicSpill.append($(".toxicSpillCount"));
  1516. toxicSpill.append($(".toxicSpillBaron"));
  1517. toxicSpill.append($(".toxicSpillLord"));
  1518. toxicSpill.append($(".toxicSpillKnight"));
  1519. $(".toxicSpillHero").hide();
  1520. $(".toxicSpillGrandDuke").hide();
  1521. $(".toxicSpillArchduke").hide();
  1522. if ((dukeObj.hours == 0) && (dukeObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1523. if (confirm('It will be Duke level soon at the toxic spill, travel there now?') == true) {
  1524. travelToSpill("skip");
  1525. }
  1526. localStorage.setItem('RemindSpill', "N")
  1527. $("#toxicSpillCb").prop('checked', false)
  1528. }
  1529. } else if (partialrotation >= 187 && partialrotation < 211) {
  1530. //Duke Falling
  1531. $(".toxicSpillHeaderValue").text("DUKE-FALLING");
  1532. $(".toxicSpillHeaderValue").css({
  1533. 'color': 'green'
  1534. });
  1535. var timeCount = (211 - partialrotation).toPrecision(4);
  1536. countObj.hours = Math.floor(timeCount);
  1537. countObj.minutes = Math.ceil((timeCount - countObj.hours) * 60);
  1538. countObj = convertToDyHrMn(0, countObj.hours, countObj.minutes);
  1539. baronObj = convertToDyHrMn(countObj.days + 1, countObj.hours, countObj.minutes);
  1540. lordObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1541. knightObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1542. heroObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1543. $(".toxicSpillCountLabel").text("Count in:");
  1544. $(".toxicSpillBaronLabel").text("Baron in:");
  1545. $(".toxicSpillLordLabel").text("Lord in:");
  1546. $(".toxicSpillKnightLabel").text("Knight in:");
  1547. $(".toxicSpillHeroLabel").text("Hero in:");
  1548. toxicSpill.append($(".toxicSpillCount"));
  1549. toxicSpill.append($(".toxicSpillBaron"));
  1550. toxicSpill.append($(".toxicSpillLord"));
  1551. toxicSpill.append($(".toxicSpillKnight"));
  1552. toxicSpill.append($(".toxicSpillHero"));
  1553. $(".toxicSpillDuke").hide();
  1554. $(".toxicSpillGrandDuke").hide();
  1555. $(".toxicSpillArchduke").hide();
  1556. if ((countObj.hours == 0) && (countObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1557. if (confirm('It will be Count level soon at the toxic spill, travel there now?') == true) {
  1558. travelToSpill("skip");
  1559. }
  1560. localStorage.setItem('RemindSpill', "N")
  1561. $("#toxicSpillCb").prop('checked', false)
  1562. }
  1563. } else if (partialrotation >= 211 && partialrotation < 235) {
  1564. //Count Falling
  1565. $(".toxicSpillHeaderValue").text("COUNT-FALLING");
  1566. $(".toxicSpillHeaderValue").css({
  1567. 'color': 'green'
  1568. });
  1569. var timeBaron = (235 - partialrotation).toPrecision(4);
  1570. baronObj.hours = Math.floor(timeBaron);
  1571. baronObj.minutes = Math.ceil((timeBaron - baronObj.hours) * 60);
  1572. baronObj = convertToDyHrMn(0, baronObj.hours, baronObj.minutes);
  1573. lordObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1574. knightObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1575. heroObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1576. countObj = convertToDyHrMn(heroObj.days + 3, heroObj.hours + 10, heroObj.minutes);
  1577. $(".toxicSpillBaronLabel").text("Baron in:");
  1578. $(".toxicSpillLordLabel").text("Lord in:");
  1579. $(".toxicSpillKnightLabel").text("Knight in:");
  1580. $(".toxicSpillHeroLabel").text("Hero in:");
  1581. $(".toxicSpillCountLabel").text("Count Rising in:");
  1582. toxicSpill.append($(".toxicSpillBaron"));
  1583. toxicSpill.append($(".toxicSpillLord"));
  1584. toxicSpill.append($(".toxicSpillKnight"));
  1585. toxicSpill.append($(".toxicSpillHero"));
  1586. toxicSpill.append($(".toxicSpillCount"));
  1587. $(".toxicSpillDuke").hide();
  1588. $(".toxicSpillGrandDuke").hide();
  1589. $(".toxicSpillArchduke").hide();
  1590. if ((baronObj.hours == 0) && (baronObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1591. if (confirm('It will be Baron level soon at the toxic spill, travel there now?') == true) {
  1592. travelToSpill("skip");
  1593. }
  1594. localStorage.setItem('RemindSpill', "N")
  1595. $("#toxicSpillCb").prop('checked', false)
  1596. }
  1597. } else if (partialrotation >= 235 && partialrotation < 253) {
  1598. //Baron Falling
  1599. $(".toxicSpillHeaderValue").text("BARON-FALLING");
  1600. $(".toxicSpillHeaderValue").css({
  1601. 'color': 'green'
  1602. });
  1603. var timeLord = (253 - partialrotation).toPrecision(4);
  1604. lordObj.hours = Math.floor(timeLord);
  1605. lordObj.minutes = Math.ceil((timeLord - lordObj.hours) * 60);
  1606. lordObj = convertToDyHrMn(0, lordObj.hours, lordObj.minutes);
  1607. knightObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1608. heroObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1609. baronObj = convertToDyHrMn(heroObj.days + 2, heroObj.hours + 16, heroObj.minutes);
  1610. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1611. $(".toxicSpillCountLabel").text("Count in:");
  1612. $(".toxicSpillBaronLabel").text("Baron Rising in:");
  1613. $(".toxicSpillLordLabel").text("Lord in:");
  1614. $(".toxicSpillKnightLabel").text("Knight in:");
  1615. $(".toxicSpillHeroLabel").text("Hero in:");
  1616. toxicSpill.append($(".toxicSpillLord"));
  1617. toxicSpill.append($(".toxicSpillKnight"));
  1618. toxicSpill.append($(".toxicSpillHero"));
  1619. toxicSpill.append($(".toxicSpillBaron"));
  1620. toxicSpill.append($(".toxicSpillCount"));
  1621. $(".toxicSpillDuke").hide();
  1622. $(".toxicSpillGrandDuke").hide();
  1623. $(".toxicSpillArchduke").hide();
  1624. if ((lordObj.hours == 0) && (lordObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1625. if (confirm('It will be Lord level soon at the toxic spill, travel there now?') == true) {
  1626. travelToSpill("skip");
  1627. }
  1628. localStorage.setItem('RemindSpill', "N")
  1629. $("#toxicSpillCb").prop('checked', false)
  1630. }
  1631. } else if (partialrotation >= 253 && partialrotation < 271) {
  1632. //Lord Falling
  1633. $(".toxicSpillHeaderValue").text("LORD-FALLING");
  1634. $(".toxicSpillHeaderValue").css({
  1635. 'color': 'green'
  1636. });
  1637. var timeKnight = (271 - partialrotation).toPrecision(4);
  1638. knightObj.hours = Math.floor(timeKnight);
  1639. knightObj.minutes = Math.ceil((timeKnight - knightObj.hours) * 60);
  1640. knightObj = convertToDyHrMn(0, knightObj.hours, knightObj.minutes);
  1641. heroObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1642. lordObj = convertToDyHrMn(heroObj.days + 1, heroObj.hours + 22, heroObj.minutes);
  1643. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1644. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1645. $(".toxicSpillCountLabel").text("Count in:");
  1646. $(".toxicSpillBaronLabel").text("Baron in:");
  1647. $(".toxicSpillLordLabel").text("Lord Rising in:");
  1648. $(".toxicSpillKnightLabel").text("Knight in:");
  1649. $(".toxicSpillHeroLabel").text("Hero in:");
  1650. toxicSpill.append($(".toxicSpillKnight"));
  1651. toxicSpill.append($(".toxicSpillHero"));
  1652. toxicSpill.append($(".toxicSpillLord"));
  1653. toxicSpill.append($(".toxicSpillBaron"));
  1654. toxicSpill.append($(".toxicSpillCount"));
  1655. $(".toxicSpillDuke").hide();
  1656. $(".toxicSpillGrandDuke").hide();
  1657. $(".toxicSpillArchduke").hide();
  1658. if ((knightObj.hours == 0) && (knightObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1659. if (confirm('It will be Knight level soon at the toxic spill, travel there now?') == true) {
  1660. travelToSpill("skip");
  1661. }
  1662. localStorage.setItem('RemindSpill', "N")
  1663. $("#toxicSpillCb").prop('checked', false)
  1664. }
  1665. } else if (partialrotation >= 271 && partialrotation < 287) {
  1666. //Knight Falling
  1667. $(".toxicSpillHeaderValue").text("KNIGHT-FALLING");
  1668. $(".toxicSpillHeaderValue").css({
  1669. 'color': 'green'
  1670. });
  1671. var timeHero = (287 - partialrotation).toPrecision(4);
  1672. heroObj.hours = Math.floor(timeHero);
  1673. heroObj.minutes = Math.ceil((timeHero - heroObj.hours) * 60);
  1674. heroObj = convertToDyHrMn(0, heroObj.hours, heroObj.minutes);
  1675. knightObj = convertToDyHrMn(heroObj.days + 1, heroObj.hours + 6, heroObj.minutes);
  1676. lordObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1677. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1678. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1679. $(".toxicSpillCountLabel").text("Count in:");
  1680. $(".toxicSpillBaronLabel").text("Baron in:");
  1681. $(".toxicSpillLordLabel").text("Lord in:");
  1682. $(".toxicSpillKnightLabel").text("Knight Rising in:");
  1683. $(".toxicSpillHeroLabel").text("Hero in:");
  1684. toxicSpill.append($(".toxicSpillHero"));
  1685. toxicSpill.append($(".toxicSpillKnight"));
  1686. toxicSpill.append($(".toxicSpillLord"));
  1687. toxicSpill.append($(".toxicSpillBaron"));
  1688. toxicSpill.append($(".toxicSpillCount"));
  1689. $(".toxicSpillDuke").hide();
  1690. $(".toxicSpillGrandDuke").hide();
  1691. $(".toxicSpillArchduke").hide();
  1692. if ((heroObj.hours == 0) && (heroObj.minutes <= 15) && (localStorage.getItem('RemindSpill') == "Y")) {
  1693. if (confirm('It will be Hero level soon at the toxic spill, travel there now?') == true) {
  1694. travelToSpill("skip");
  1695. }
  1696. localStorage.setItem('RemindSpill', "N")
  1697. $("#toxicSpillCb").prop('checked', false)
  1698. }
  1699. } else if (partialrotation >= 287 && partialrotation < 302) {
  1700. //Hero Falling
  1701. $(".toxicSpillHeaderValue").text("HERO-FALLING");
  1702. $(".toxicSpillHeaderValue").css({
  1703. 'color': 'green'
  1704. });
  1705. var timeHero = (302 - partialrotation).toPrecision(4);
  1706. heroObj.hours = Math.floor(timeHero);
  1707. heroObj.minutes = Math.ceil((timeHero - heroObj.hours) * 60);
  1708. heroObj = convertToDyHrMn(0, heroObj.hours, heroObj.minutes);
  1709. knightObj = convertToDyHrMn(heroObj.days, heroObj.hours + 15, heroObj.minutes);
  1710. lordObj = convertToDyHrMn(knightObj.days, knightObj.hours + 16, knightObj.minutes);
  1711. baronObj = convertToDyHrMn(lordObj.days, lordObj.hours + 18, lordObj.minutes);
  1712. countObj = convertToDyHrMn(baronObj.days, baronObj.hours + 18, baronObj.minutes);
  1713. $(".toxicSpillCountLabel").text("Count in:");
  1714. $(".toxicSpillBaronLabel").text("Baron in:");
  1715. $(".toxicSpillLordLabel").text("Lord in:");
  1716. $(".toxicSpillKnightLabel").text("Knight in:");
  1717. $(".toxicSpillHeroLabel").text("Hero Rising in:");
  1718. toxicSpill.append($(".toxicSpillHero"));
  1719. toxicSpill.append($(".toxicSpillKnight"));
  1720. toxicSpill.append($(".toxicSpillLord"));
  1721. toxicSpill.append($(".toxicSpillBaron"));
  1722. toxicSpill.append($(".toxicSpillCount"));
  1723. $(".toxicSpillDuke").hide();
  1724. $(".toxicSpillGrandDuke").hide();
  1725. $(".toxicSpillArchduke").hide();
  1726. } else {
  1727. //WTF are we?
  1728. }
  1729. $(".toxicSpillArchdukeValue").text(formatOutput(archdukeObj.days, archdukeObj.hours, archdukeObj.minutes));
  1730. $(".toxicSpillGrandDukeValue").text(formatOutput(granddukeObj.days, granddukeObj.hours, granddukeObj.minutes));
  1731. $(".toxicSpillDukeValue").text(formatOutput(dukeObj.days, dukeObj.hours, dukeObj.minutes));
  1732. $(".toxicSpillCountValue").text(formatOutput(countObj.days, countObj.hours, countObj.minutes));
  1733. $(".toxicSpillBaronValue").text(formatOutput(baronObj.days, baronObj.hours, baronObj.minutes));
  1734. $(".toxicSpillLordValue").text(formatOutput(lordObj.days, lordObj.hours, lordObj.minutes));
  1735. $(".toxicSpillKnightValue").text(formatOutput(knightObj.days, knightObj.hours, knightObj.minutes));
  1736. $(".toxicSpillHeroValue").text(formatOutput(heroObj.days, heroObj.hours, heroObj.minutes));
  1737. //https://mhwiki.hitgrab.com/wiki/index.php/Toxic_Spill#Pollution_Levels
  1738. $(".toxicSpillArchdukeValue").css({
  1739. 'float': 'right'
  1740. })
  1741. $(".toxicSpillGrandDukeValue").css({
  1742. 'float': 'right'
  1743. })
  1744. $(".toxicSpillDukeValue").css({
  1745. 'float': 'right'
  1746. })
  1747. $(".toxicSpillCountValue").css({
  1748. 'float': 'right'
  1749. })
  1750. $(".toxicSpillBaronValue").css({
  1751. 'float': 'right'
  1752. })
  1753. $(".toxicSpillLordValue").css({
  1754. 'float': 'right'
  1755. })
  1756. $(".toxicSpillKnightValue").css({
  1757. 'float': 'right'
  1758. })
  1759. $(".toxicSpillHeroValue").css({
  1760. 'float': 'right'
  1761. })
  1762. }
  1763.  
  1764. function spillLevel(days, hours, minutes) {
  1765. this.days = days;
  1766. this.hours = hours;
  1767. this.minutes = minutes;
  1768. }
  1769.  
  1770. $(document).on('change', '#toxicSpillCb', function() {
  1771. if (this.checked) {
  1772. localStorage.setItem('RemindSpill', "Y")
  1773. this.checked = "Yes";
  1774. } else {
  1775. localStorage.setItem('RemindSpill', "N")
  1776. this.checked = "";
  1777. }
  1778. })
  1779. //============================================================================================
  1780. function todayNow() {
  1781. var today = new Date();
  1782. var todayEpoch = today.getTime() / 1000.0;
  1783. return todayEpoch;
  1784. }
  1785.  
  1786. function convertToDyHrMn(days, hours, minutes) {
  1787. if (hours >= 24) {
  1788. var daysExact = hours / 24;
  1789. var daysTrunc = Math.floor(daysExact);
  1790. var partialDays = daysExact - daysTrunc;
  1791. hours = Math.floor(partialDays * 24);
  1792. days = daysTrunc + days;
  1793. }
  1794. return {
  1795. days,
  1796. hours,
  1797. minutes
  1798. }
  1799. }
  1800.  
  1801. function formatOutput(days, hours, minutes) {
  1802. var dayStr = "";
  1803. var hourStr = "";
  1804. var minuteStr = "";
  1805. if (days > 0) {
  1806. dayStr = days + "d";
  1807. }
  1808. if (hours > 0) {
  1809. hourStr = hours + "h";
  1810. }
  1811. if (minutes > 0) {
  1812. minuteStr = minutes + "m";
  1813. }
  1814. return dayStr + " " + hourStr + " " + minuteStr;
  1815. }
  1816.  
  1817. function travelToGrove(skip) {
  1818. if ($('#hudLocationContent').hasClass('hudLocationContent forbidden_grove') == true) {
  1819. //Do nothing you are already there
  1820. } else if ($(".forbiddenGroveHeaderValue").text() == "CLOSED") {
  1821. alert('The Forbiddengrove is closed now, you cannot travel there right now')
  1822. } else if (skip == "skip") {
  1823. app.pages.TravelPage.travel("forbidden_grove");
  1824. } else if (confirm('Travel to the Forbidden Grove now?') == true) {
  1825. app.pages.TravelPage.travel("forbidden_grove");
  1826. }
  1827. }
  1828.  
  1829. function travelToCove(skip) {
  1830. if ($('#hudLocationContent').hasClass('hudLocationContent balacks_cove') == true) {
  1831. //Do nothing, you are already there
  1832. } else if (skip == "skip") {
  1833. app.pages.TravelPage.travel("balacks_cove");
  1834. } else if (confirm("Travel to Balack's Cove now?") == true) {
  1835. app.pages.TravelPage.travel("balacks_cove");
  1836. }
  1837. }
  1838.  
  1839. function travelToGarden(skip) {
  1840. if ($('#hudLocationContent').hasClass('hudLocationContent seasonal_garden') == true) {
  1841. //Do nothing, you are already there
  1842. } else if (skip == "skip") {
  1843. app.pages.TravelPage.travel("seasonal_garden");
  1844. } else if (confirm("Travel to the Seasonal Garden now?") == true) {
  1845. app.pages.TravelPage.travel("seasonal_garden");
  1846. }
  1847. }
  1848.  
  1849. function travelToSpill(skip) {
  1850. if ($('#hudLocationContent').hasClass('hudLocationContent pollution_outbreak') == true) {
  1851. //Do nothing, you are already there
  1852. } else if (skip == "skip") {
  1853. app.pages.TravelPage.travel("pollution_outbreak");
  1854. } else if (confirm("Travel to the Toxic Spill now?") == true) {
  1855. app.pages.TravelPage.travel("pollution_outbreak");
  1856. }
  1857. }