Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 80 additions & 43 deletions MerlinAU.asp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<script language="JavaScript" type="text/javascript">

/**----------------------------**/
/** Last Modified: 2025-Feb-12 **/
/** Last Modified: 2025-Feb-18 **/
/** Intended for 1.4.0 Release **/
/**----------------------------**/

Expand Down Expand Up @@ -952,39 +952,39 @@ function PrefixCustomSettings (settings, prefix)
}

// Function to handle the visibility of the ROG and TUF F/W Build Type rows
function handleROGFWBuildTypeVisibility()
function handleROGFWBuildTypeVisibility()
{
// Get the router model from the hidden input
var firmwareProductModelElement = document.getElementById('firmwareProductModelID');
var routerModel = firmwareProductModelElement ? firmwareProductModelElement.textContent.trim() : '';

// ROG Model Check //
var isROGModel = routerModel.includes('GT-');
var hasROGFWBuildType = custom_settings.hasOwnProperty('ROGBuild');
var rogFWBuildRow = document.getElementById('rogFWBuildRow');

if (!isROGModel || !hasROGFWBuildType)
{ // Hide //
if (rogFWBuildRow) { rogFWBuildRow.style.display = 'none'; }
}
else
{ // Show //
if (rogFWBuildRow) { rogFWBuildRow.style.display = ''; }
}
// Get the router model from the hidden input //
var firmwareProductModelElement = document.getElementById('firmwareProductModelID');
var routerModel = firmwareProductModelElement ? firmwareProductModelElement.textContent.trim() : '';

// ROG Model Check //
var isROGModel = routerModel.includes('GT-');
var hasROGFWBuildType = custom_settings.hasOwnProperty('ROGBuild');
var rogFWBuildRow = document.getElementById('rogFWBuildRow');

if (!isROGModel || !hasROGFWBuildType)
{ // Hide //
if (rogFWBuildRow) { rogFWBuildRow.style.display = 'none'; }
}
else
{ // Show //
if (rogFWBuildRow) { rogFWBuildRow.style.display = ''; }
}

// TUF Model Check //
var isTUFModel = routerModel.includes('TUF-');
var hasTUFWBuildType = custom_settings.hasOwnProperty('TUFBuild');
var tufFWBuildRow = document.getElementById('tuffFWBuildRow');
// TUF Model Check //
var isTUFModel = routerModel.includes('TUF-');
var hasTUFWBuildType = custom_settings.hasOwnProperty('TUFBuild');
var tufFWBuildRow = document.getElementById('tuffFWBuildRow');

if (!isTUFModel || !hasTUFWBuildType)
{ // Hide //
if (tufFWBuildRow) { tufFWBuildRow.style.display = 'none'; }
}
else
{ // Show //
if (tufFWBuildRow) { tufFWBuildRow.style.display = ''; }
}
if (!isTUFModel || !hasTUFWBuildType)
{ // Hide //
if (tufFWBuildRow) { tufFWBuildRow.style.display = 'none'; }
}
else
{ // Show //
if (tufFWBuildRow) { tufFWBuildRow.style.display = ''; }
}
}

/**-------------------------------------**/
Expand Down Expand Up @@ -1926,27 +1926,56 @@ function updateTUFROGAvailText()
}
}

function handleTUFROGChange(selectElem)
/**-------------------------------------**/
/** Added by Martinski W. [2025-Feb-18] **/
/**-------------------------------------**/
const ROG_BuildTypeMsg = 'The ROG build type preference will apply only if a compatible ROG firmware image is available. Otherwise, the Pure Non-ROG build will be used instead.';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving the split messaging!

const TUF_BuildTypeMsg = 'The TUF build type preference will apply only if a compatible TUF firmware image is available. Otherwise, the Pure Non-TUF build will be used instead.';

function ShowBuildTypeHint (formField, buildType)
{
// If user picks TUF or ROG, pop up alert //
if (selectElem.value === 'TUF' || selectElem.value === 'ROG')
{
alert("The TUF/ROG build will apply only if a corresponding TUF or ROG firmware image is available. Otherwise, the Pure build will be used.");
}
let showBuildMsg = false, buildTypeMsg = '';
if (buildType === 'ROG')
{
showBuildMsg = true;
buildTypeMsg = ROG_BuildTypeMsg;
}
else if (buildType === 'TUF')
{
showBuildMsg = true;
buildTypeMsg = TUF_BuildTypeMsg;
}
if (showBuildMsg)
{
$(formField)[0].onmouseout = nd;
return overlib(buildTypeMsg,0,0);
}
}

/**----------------------------------------**/
/** Modified by Martinski W. [2025-Feb-18] **/
/**----------------------------------------**/
function handleTUFROGChange (selectElem)
{
if (selectElem.id === 'rogFWBuildType')
{
let rogMsgSpan = document.getElementById('rogFWBuildTypeAvailMsg');
if (selectElem.value === 'ROG')
{ rogMsgSpan.style.display = 'inline-block'; }
{
alert(ROG_BuildTypeMsg);
rogMsgSpan.style.display = 'inline-block';
}
else
{ rogMsgSpan.style.display = 'none'; }
}
else if (selectElem.id === 'tuffFWBuildType')
{
let tufMsgSpan = document.getElementById('tuffFWBuildTypeAvailMsg');
if (selectElem.value === 'TUF')
{ tufMsgSpan.style.display = 'inline-block'; }
{
alert(TUF_BuildTypeMsg);
tufMsgSpan.style.display = 'inline-block';
}
else
{ tufMsgSpan.style.display = 'none'; }
}
Expand Down Expand Up @@ -2351,28 +2380,36 @@ function initializeCollapsibleSections()
</td>
</tr>
<tr id="rogFWBuildRow">
<td style="text-align: left;"><label for="rogFWBuildType">ROG F/W Build Type</label></td>
<td style="text-align: left;">
<label for="rogFWBuildType">
<a class="hintstyle" href="javascript:void(0);" onclick="ShowBuildTypeHint(this,'ROG');">F/W Build Type Preference</a>
</label>
</td>
<td>
<select id="rogFWBuildType" name="rogFWBuildType" style="width: 20%;" onchange="handleTUFROGChange(this)">
<option value="ROG">ROG</option>
<option value="Pure">Pure</option>
</select>
<span id="rogFWBuildTypeAvailMsg"
style="margin-left:10px; display:none; font-size:12px; font-weight:bolder;">
Note: Only if available
NOTE: Applies only if available
</span>
</td>
</tr>
<tr id="tuffFWBuildRow">
<td style="text-align: left;"><label for="tuffFWBuildType">TUF F/W Build Type</label></td>
<td style="text-align: left;">
<label for="tuffFWBuildType">
<a class="hintstyle" href="javascript:void(0);" onclick="ShowBuildTypeHint(this,'TUF');">F/W Build Type Preference</a>
</label>
</td>
<td>
<select id="tuffFWBuildType" name="tuffFWBuildType" style="width: 20%;" onchange="handleTUFROGChange(this)">
<option value="TUF">TUF</option>
<option value="Pure">Pure</option>
</select>
<span id="tuffFWBuildTypeAvailMsg"
style="margin-left:10px; display:none; font-size:12px; font-weight:bolder;">
Note: Only if available
NOTE: Applies only if available
</span>
</td>
</tr>
Expand Down
Loading