mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 01:26:11 -08:00
Custom Device Properties v0.1 #876
This commit is contained in:
@@ -171,7 +171,7 @@ function cacheSettings()
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Get a setting value by key
|
||||
// Get a setting options value by key
|
||||
function getSettingOptions (key) {
|
||||
|
||||
// handle initial load to make sure everything is set-up and cached
|
||||
@@ -353,6 +353,30 @@ function getLangCode() {
|
||||
// String utilities
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// ----------------------------------------------------
|
||||
/**
|
||||
* Replaces double quotes within single-quoted strings, then converts all single quotes to double quotes,
|
||||
* while preserving the intended structure.
|
||||
*
|
||||
* @param {string} inputString - The input string to process.
|
||||
* @returns {string} - The processed string with transformations applied.
|
||||
*/
|
||||
function processQuotes(inputString) {
|
||||
// Step 1: Replace double quotes within single-quoted strings
|
||||
let tempString = inputString.replace(/'([^']*?)'/g, (match, p1) => {
|
||||
const escapedContent = p1.replace(/"/g, '_escaped_double_quote_'); // Temporarily replace double quotes
|
||||
return `'${escapedContent}'`;
|
||||
});
|
||||
|
||||
// Step 2: Replace all single quotes with double quotes
|
||||
tempString = tempString.replace(/'/g, '"');
|
||||
|
||||
// Step 3: Restore escaped double quotes
|
||||
const processedString = tempString.replace(/_escaped_double_quote_/g, "'");
|
||||
|
||||
return processedString;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------
|
||||
function jsonSyntaxHighlight(json) {
|
||||
if (typeof json != 'string') {
|
||||
|
||||
Reference in New Issue
Block a user