Skip to content

Commit 6d9fe46

Browse files
Update MerlinAU.asp
Code improvements to address the "Warnings" from the latest Linter tool report.
1 parent 0c7ebd7 commit 6d9fe46

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

MerlinAU.asp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ var custom_settings = {};
3939
var shared_custom_settings = {};
4040
var ajax_custom_settings = {};
4141
let isFormSubmitting = false;
42+
let FW_NewUpdateVersAvailable = '';
4243
4344
// Define color formatting //
4445
const CYANct = "<span style='color:cyan;'>";
@@ -1145,11 +1146,10 @@ function InitializeFields()
11451146
var fwUpdateAvailableElement = document.getElementById('fwUpdateAvailable');
11461147
var fwVersionInstalledElement = document.getElementById('fwVersionInstalled');
11471148
1148-
var isFwUpdateAvailable = false; // Initialize the flag
1149-
1149+
var isFwUpdateAvailable = false; // Initialize the flag //
11501150
if (fwUpdateAvailableElement && fwVersionInstalledElement)
11511151
{
1152-
var fwUpdateAvailable = FW_New_Update_Available
1152+
var fwUpdateAvailable = FW_NewUpdateVersAvailable;
11531153
var fwVersionInstalled = fwVersionInstalledElement.textContent.trim();
11541154
11551155
// Convert both to numeric forms //
@@ -1252,7 +1252,7 @@ function InitializeFields()
12521252
}
12531253
12541254
/**----------------------------------------**/
1255-
/** Modified by Martinski W. [2025-Jan-18] **/
1255+
/** Modified by Martinski W. [2025-Jan-26] **/
12561256
/**----------------------------------------**/
12571257
function GetConfigSettings()
12581258
{
@@ -1266,19 +1266,19 @@ function GetConfigSettings()
12661266
},
12671267
success: function(data)
12681268
{
1269-
// Tokenize the data while respecting quoted values
1270-
var tokenList = tokenize(data);
1269+
// Tokenize the data while respecting quoted values //
1270+
var tokenList = Tokenize(data);
12711271
1272-
for (var i = 0; i < tokenList.length; i++)
1272+
for (var indx = 0; indx < tokenList.length; indx++)
12731273
{
1274-
var token = tokenList[i];
1274+
var tokenStr = tokenList[indx];
12751275
1276-
if (token.includes('='))
1276+
if (tokenStr.includes('='))
12771277
{
12781278
// Handle "key=value" format //
1279-
var splitIndex = token.indexOf('=');
1280-
var key = token.substring(0, splitIndex).trim();
1281-
var value = token.substring(splitIndex + 1).trim();
1279+
var splitIndex = tokenStr.indexOf('=');
1280+
var key = tokenStr.substring(0, splitIndex).trim();
1281+
var value = tokenStr.substring(splitIndex + 1).trim();
12821282
12831283
// Remove surrounding quotes if present
12841284
if (value.startsWith('"') && value.endsWith('"'))
@@ -1289,26 +1289,25 @@ function GetConfigSettings()
12891289
else
12901290
{
12911291
// Handle "key value" format //
1292-
var key = token.trim();
1292+
var key = tokenStr.trim();
12931293
var value = '';
12941294
12951295
// Ensure there's a next token for the value //
1296-
if (i + 1 < tokenList.length)
1296+
if (indx + 1 < tokenList.length)
12971297
{
1298-
value = tokenList[i + 1].trim();
1298+
value = tokenList[indx + 1].trim();
12991299
13001300
// Remove surrounding quotes if present //
13011301
if (value.startsWith('"') && value.endsWith('"'))
13021302
{ value = value.substring(1, value.length - 1); }
13031303
13041304
AssignAjaxSetting(key, value);
1305-
i++; // Skip the next token as it's already processed
1305+
indx++; // Skip next token as it's already processed //
13061306
}
13071307
else
13081308
{ console.warn(`No value found for key: ${key}`); }
13091309
}
13101310
}
1311-
13121311
console.log("AJAX Custom Settings Loaded:", ajax_custom_settings);
13131312
13141313
// Merge both server and AJAX settings //
@@ -1322,11 +1321,11 @@ function GetConfigSettings()
13221321
});
13231322
}
13241323
1325-
// Helper function to tokenize the input string, respecting quoted substrings //
1326-
function tokenize(input)
1324+
// Tokenize input string, respecting quoted substrings //
1325+
function Tokenize(inputStr)
13271326
{
13281327
var regex = /(?:[^\s"]+|"[^"]*")+/g;
1329-
return input.match(regex) || [];
1328+
return inputStr.match(regex) || [];
13301329
}
13311330
13321331
/**----------------------------------------**/
@@ -1366,7 +1365,7 @@ function AssignAjaxSetting(key, value)
13661365
break;
13671366
13681367
case keyUpper === 'FW_NEW_UPDATE_NOTIFICATION_VERS':
1369-
FW_New_Update_Available = value.trim();
1368+
FW_NewUpdateVersAvailable = value.trim();
13701369
break;
13711370
13721371
case keyUpper === 'FW_NEW_UPDATE_EMAIL_CC_ADDRESS':
@@ -1796,7 +1795,7 @@ function getFirstNonEmptyValue(ids)
17961795
/** Modified by Martinski W. [2025-Jan-05] **/
17971796
/**----------------------------------------**/
17981797
// Function to format and display the Router IDs //
1799-
function formatRouterIDs()
1798+
function FormatRouterIDs()
18001799
{
18011800
// Define the order of NVRAM keys to search for Model ID and Product ID
18021801
var modelKeys = ["nvram_odmpid", "nvram_wps_modelnum", "nvram_model", "nvram_build_name"];
@@ -1840,7 +1839,7 @@ function stripHTML(html)
18401839
/** Modified by Martinski W. [2025-Jan-05] **/
18411840
/**----------------------------------------**/
18421841
// Function to format the Firmware Version Installed //
1843-
function formatFirmwareVersion()
1842+
function FormatFirmwareVersion()
18441843
{
18451844
var fwVersionElement = document.getElementById('fwVersionInstalled');
18461845
if (fwVersionElement)
@@ -1866,9 +1865,10 @@ function formatFirmwareVersion()
18661865
}
18671866
18681867
// Modify the existing DOMContentLoaded event listener to include the new function
1869-
document.addEventListener("DOMContentLoaded", function() {
1870-
formatRouterIDs();
1871-
formatFirmwareVersion(); // Call the new formatting function
1868+
document.addEventListener("DOMContentLoaded", function()
1869+
{
1870+
FormatRouterIDs();
1871+
FormatFirmwareVersion();
18721872
});
18731873
18741874
function initializeCollapsibleSections()

0 commit comments

Comments
 (0)