Update 'RestoolsBBWatchReloaded.js'

This commit is contained in:
2023-06-15 17:06:08 +02:00
parent 73583be671
commit ca6e5a485f

View File

@@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name IITC plugin: ResTools BB Watch Reloaded // @name IITC plugin: ResTools BB Watch Reloaded
// @namespace https://git.martinvylet.cz/vykend/ResTools-BB-Watch-Reloaded // @namespace https://git.martinvylet.cz/vykend/ResTools-BB-Watch-Reloaded
// @version 0.5 // @version 0.5.1
// @description Scan window for BBs on ornamented portals, then check results // @description Scan window for BBs on ornamented portals, then check results
// @author vikend // @author vikend
// @icon // @icon
@@ -85,8 +85,8 @@ function wrapper(plugin_info)
const timezoneOffsetHours = window.plugin.restoolsBBWatchReloaded.timezone; // Assuming the offset is stored in hours const timezoneOffsetHours = window.plugin.restoolsBBWatchReloaded.timezone; // Assuming the offset is stored in hours
const offsetMilliseconds = timezoneOffsetHours * 60 * 60 * 1000; // Convert offset to milliseconds const offsetMilliseconds = timezoneOffsetHours * 60 * 60 * 1000; // Convert offset to milliseconds
const currentTimeWithOffset = new Date(currentTime.getTime() + offsetMilliseconds); const currentTimeWithOffset = new Date(currentTime.getTime() + offsetMilliseconds);
const currentTimeString = currentTimeWithOffset.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }); const currentTimeString = currentTimeWithOffset.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false });
const currentTimePlus5Minutes = (new Date(currentTimeWithOffset.getTime() + 5 * 60000)).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }); const currentTimePlus5Minutes = (new Date(currentTimeWithOffset.getTime() + 5 * 60000)).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false });
let currentWave = 0; let currentWave = 0;
let battleOver = false; let battleOver = false;
@@ -154,7 +154,7 @@ function wrapper(plugin_info)
console.log("BBWatchReloaded: According to timetable anomaly haven't started yet, skipping"); console.log("BBWatchReloaded: According to timetable anomaly haven't started yet, skipping");
return; return;
} }
if (waveNo > 7) { if (waveNo >= 7) {
console.log("BBWatchReloaded: According to timetable anomaly already ended, skipping"); console.log("BBWatchReloaded: According to timetable anomaly already ended, skipping");
return; return;
} }
@@ -282,7 +282,7 @@ function wrapper(plugin_info)
let htmlBegin = ` let htmlBegin = `
<div class="restoolsBBWatchReloadedDialog"> <div class="restoolsBBWatchReloadedDialog">
<a onclick="window.plugin.restoolsBBWatchReloaded.openPreferences()" title="Settings">Settings</a> <a onclick="window.plugin.restoolsBBWatchReloaded.openPreferences()" title="Settings">Settings</a>
<table class="styled-table"> <table class="styled-table">
<thead> <thead>
<tr> <tr>
@@ -345,7 +345,7 @@ function wrapper(plugin_info)
} }
window.plugin.restoolsBBWatchReloaded.openPreferences = function() { window.plugin.restoolsBBWatchReloaded.openPreferences = function() {
var html = var html =
'<div>' + '<div>' +
'<table>'; '<table>';
@@ -358,7 +358,7 @@ function wrapper(plugin_info)
'<input id="timezone_input" size="10" type="number" value="'+ window.plugin.restoolsBBWatchReloaded.timezone + '"/>' + '<input id="timezone_input" size="10" type="number" value="'+ window.plugin.restoolsBBWatchReloaded.timezone + '"/>' +
'</td>' + '</td>' +
'</tr>' ; '</tr>' ;
html += html +=
'</table>' + '</table>' +
'</div>' + '</div>' +
@@ -377,7 +377,7 @@ function wrapper(plugin_info)
window.plugin.restoolsBBWatchReloaded.timezone = $('#timezone_input').val(); window.plugin.restoolsBBWatchReloaded.timezone = $('#timezone_input').val();
localStorage['window.plugin.restoolsBBWatchReloaded.timezone'] = JSON.stringify(window.plugin.restoolsBBWatchReloaded.timezone); localStorage['window.plugin.restoolsBBWatchReloaded.timezone'] = JSON.stringify(window.plugin.restoolsBBWatchReloaded.timezone);
}; };
// --- SETUP --- // --- SETUP ---