diff --git a/accessibility-checker-engine/help-v4/common/help.js b/accessibility-checker-engine/help-v4/common/help.js index 722af28b7..6bf4ebc24 100644 --- a/accessibility-checker-engine/help-v4/common/help.js +++ b/accessibility-checker-engine/help-v4/common/help.js @@ -108,17 +108,7 @@ const valueMap = { } }; -window.addEventListener("DOMContentLoaded", (evt) => { - let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; - groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); - document.querySelector("#groupLabel").innerHTML = groupMsg; - let ruleInfo; - if (window.location.search && window.location.search.length > 0) { - const searchParams = new URLSearchParams(window.location.search); - ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); - } else if (window.location.hash && window.location.hash.length > 0) { - ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); - } +function updateWithRuleInfo(ruleInfo) { if (ruleInfo) { if (ruleInfo.message) { let ruleMessage = ruleInfo.message.replace(/\{(\d+)\}/g, (matchedStr, matchedNum, matchedIndex) => msgArgs[matchedNum]); @@ -141,14 +131,72 @@ window.addEventListener("DOMContentLoaded", (evt) => { let value = ruleInfo.value; const val = valueMap[value[0]][value[1]]; let icon = ""; - if (val === "Violation") icon = ``; - if (val === "Needs review") icon = ``; - if (val === "Recommendation") icon = ``; + if (val === "Violation") icon = ``; + if (val === "Needs review") icon = ``; + if (val === "Recommendation") icon = ``; document.querySelector("#locLevel").innerHTML = `
${icon} ${val}
`; } if (RULE_ID) { document.querySelector("#ruleInfo").innerHTML = `

Rule ID: ${RULE_ID}${ruleInfo.reasonId ? `
Reason ID: ${ruleInfo.reasonId}

` : ""}`; } } +} + +if ("onhashchange" in window) {// does the browser support the hashchange event? + window.onhashchange = function () { + let ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + updateWithRuleInfo(ruleInfo); + } +} + +window.addEventListener("DOMContentLoaded", (evt) => { + let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; + groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); + document.querySelector("#groupLabel").innerHTML = groupMsg; + let ruleInfo; + if (window.location.search && window.location.search.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); + } else if (window.location.hash && window.location.hash.length > 0) { + ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + } + updateWithRuleInfo(ruleInfo); }) diff --git a/rule-server/src/static/archives/2020.04.02/doc/common/help.js b/rule-server/src/static/archives/2020.04.02/doc/common/help.js index 722af28b7..6bf4ebc24 100644 --- a/rule-server/src/static/archives/2020.04.02/doc/common/help.js +++ b/rule-server/src/static/archives/2020.04.02/doc/common/help.js @@ -108,17 +108,7 @@ const valueMap = { } }; -window.addEventListener("DOMContentLoaded", (evt) => { - let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; - groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); - document.querySelector("#groupLabel").innerHTML = groupMsg; - let ruleInfo; - if (window.location.search && window.location.search.length > 0) { - const searchParams = new URLSearchParams(window.location.search); - ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); - } else if (window.location.hash && window.location.hash.length > 0) { - ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); - } +function updateWithRuleInfo(ruleInfo) { if (ruleInfo) { if (ruleInfo.message) { let ruleMessage = ruleInfo.message.replace(/\{(\d+)\}/g, (matchedStr, matchedNum, matchedIndex) => msgArgs[matchedNum]); @@ -141,14 +131,72 @@ window.addEventListener("DOMContentLoaded", (evt) => { let value = ruleInfo.value; const val = valueMap[value[0]][value[1]]; let icon = ""; - if (val === "Violation") icon = ``; - if (val === "Needs review") icon = ``; - if (val === "Recommendation") icon = ``; + if (val === "Violation") icon = ``; + if (val === "Needs review") icon = ``; + if (val === "Recommendation") icon = ``; document.querySelector("#locLevel").innerHTML = `
${icon} ${val}
`; } if (RULE_ID) { document.querySelector("#ruleInfo").innerHTML = `

Rule ID: ${RULE_ID}${ruleInfo.reasonId ? `
Reason ID: ${ruleInfo.reasonId}

` : ""}`; } } +} + +if ("onhashchange" in window) {// does the browser support the hashchange event? + window.onhashchange = function () { + let ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + updateWithRuleInfo(ruleInfo); + } +} + +window.addEventListener("DOMContentLoaded", (evt) => { + let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; + groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); + document.querySelector("#groupLabel").innerHTML = groupMsg; + let ruleInfo; + if (window.location.search && window.location.search.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); + } else if (window.location.hash && window.location.hash.length > 0) { + ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + } + updateWithRuleInfo(ruleInfo); }) diff --git a/rule-server/src/static/archives/2020.05.12/doc/common/help.js b/rule-server/src/static/archives/2020.05.12/doc/common/help.js index 722af28b7..6bf4ebc24 100644 --- a/rule-server/src/static/archives/2020.05.12/doc/common/help.js +++ b/rule-server/src/static/archives/2020.05.12/doc/common/help.js @@ -108,17 +108,7 @@ const valueMap = { } }; -window.addEventListener("DOMContentLoaded", (evt) => { - let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; - groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); - document.querySelector("#groupLabel").innerHTML = groupMsg; - let ruleInfo; - if (window.location.search && window.location.search.length > 0) { - const searchParams = new URLSearchParams(window.location.search); - ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); - } else if (window.location.hash && window.location.hash.length > 0) { - ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); - } +function updateWithRuleInfo(ruleInfo) { if (ruleInfo) { if (ruleInfo.message) { let ruleMessage = ruleInfo.message.replace(/\{(\d+)\}/g, (matchedStr, matchedNum, matchedIndex) => msgArgs[matchedNum]); @@ -141,14 +131,72 @@ window.addEventListener("DOMContentLoaded", (evt) => { let value = ruleInfo.value; const val = valueMap[value[0]][value[1]]; let icon = ""; - if (val === "Violation") icon = ``; - if (val === "Needs review") icon = ``; - if (val === "Recommendation") icon = ``; + if (val === "Violation") icon = ``; + if (val === "Needs review") icon = ``; + if (val === "Recommendation") icon = ``; document.querySelector("#locLevel").innerHTML = `
${icon} ${val}
`; } if (RULE_ID) { document.querySelector("#ruleInfo").innerHTML = `

Rule ID: ${RULE_ID}${ruleInfo.reasonId ? `
Reason ID: ${ruleInfo.reasonId}

` : ""}`; } } +} + +if ("onhashchange" in window) {// does the browser support the hashchange event? + window.onhashchange = function () { + let ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + updateWithRuleInfo(ruleInfo); + } +} + +window.addEventListener("DOMContentLoaded", (evt) => { + let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; + groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); + document.querySelector("#groupLabel").innerHTML = groupMsg; + let ruleInfo; + if (window.location.search && window.location.search.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); + } else if (window.location.hash && window.location.hash.length > 0) { + ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + } + updateWithRuleInfo(ruleInfo); }) diff --git a/rule-server/src/static/archives/2020.06.03/doc/common/help.js b/rule-server/src/static/archives/2020.06.03/doc/common/help.js index 722af28b7..6bf4ebc24 100644 --- a/rule-server/src/static/archives/2020.06.03/doc/common/help.js +++ b/rule-server/src/static/archives/2020.06.03/doc/common/help.js @@ -108,17 +108,7 @@ const valueMap = { } }; -window.addEventListener("DOMContentLoaded", (evt) => { - let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; - groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); - document.querySelector("#groupLabel").innerHTML = groupMsg; - let ruleInfo; - if (window.location.search && window.location.search.length > 0) { - const searchParams = new URLSearchParams(window.location.search); - ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); - } else if (window.location.hash && window.location.hash.length > 0) { - ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); - } +function updateWithRuleInfo(ruleInfo) { if (ruleInfo) { if (ruleInfo.message) { let ruleMessage = ruleInfo.message.replace(/\{(\d+)\}/g, (matchedStr, matchedNum, matchedIndex) => msgArgs[matchedNum]); @@ -141,14 +131,72 @@ window.addEventListener("DOMContentLoaded", (evt) => { let value = ruleInfo.value; const val = valueMap[value[0]][value[1]]; let icon = ""; - if (val === "Violation") icon = ``; - if (val === "Needs review") icon = ``; - if (val === "Recommendation") icon = ``; + if (val === "Violation") icon = ``; + if (val === "Needs review") icon = ``; + if (val === "Recommendation") icon = ``; document.querySelector("#locLevel").innerHTML = `
${icon} ${val}
`; } if (RULE_ID) { document.querySelector("#ruleInfo").innerHTML = `

Rule ID: ${RULE_ID}${ruleInfo.reasonId ? `
Reason ID: ${ruleInfo.reasonId}

` : ""}`; } } +} + +if ("onhashchange" in window) {// does the browser support the hashchange event? + window.onhashchange = function () { + let ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + updateWithRuleInfo(ruleInfo); + } +} + +window.addEventListener("DOMContentLoaded", (evt) => { + let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; + groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); + document.querySelector("#groupLabel").innerHTML = groupMsg; + let ruleInfo; + if (window.location.search && window.location.search.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); + } else if (window.location.hash && window.location.hash.length > 0) { + ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + } + updateWithRuleInfo(ruleInfo); }) diff --git a/rule-server/src/static/archives/2020.06.18/doc/common/help.js b/rule-server/src/static/archives/2020.06.18/doc/common/help.js index 722af28b7..6bf4ebc24 100644 --- a/rule-server/src/static/archives/2020.06.18/doc/common/help.js +++ b/rule-server/src/static/archives/2020.06.18/doc/common/help.js @@ -108,17 +108,7 @@ const valueMap = { } }; -window.addEventListener("DOMContentLoaded", (evt) => { - let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; - groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); - document.querySelector("#groupLabel").innerHTML = groupMsg; - let ruleInfo; - if (window.location.search && window.location.search.length > 0) { - const searchParams = new URLSearchParams(window.location.search); - ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); - } else if (window.location.hash && window.location.hash.length > 0) { - ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); - } +function updateWithRuleInfo(ruleInfo) { if (ruleInfo) { if (ruleInfo.message) { let ruleMessage = ruleInfo.message.replace(/\{(\d+)\}/g, (matchedStr, matchedNum, matchedIndex) => msgArgs[matchedNum]); @@ -141,14 +131,72 @@ window.addEventListener("DOMContentLoaded", (evt) => { let value = ruleInfo.value; const val = valueMap[value[0]][value[1]]; let icon = ""; - if (val === "Violation") icon = ``; - if (val === "Needs review") icon = ``; - if (val === "Recommendation") icon = ``; + if (val === "Violation") icon = ``; + if (val === "Needs review") icon = ``; + if (val === "Recommendation") icon = ``; document.querySelector("#locLevel").innerHTML = `
${icon} ${val}
`; } if (RULE_ID) { document.querySelector("#ruleInfo").innerHTML = `

Rule ID: ${RULE_ID}${ruleInfo.reasonId ? `
Reason ID: ${ruleInfo.reasonId}

` : ""}`; } } +} + +if ("onhashchange" in window) {// does the browser support the hashchange event? + window.onhashchange = function () { + let ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + updateWithRuleInfo(ruleInfo); + } +} + +window.addEventListener("DOMContentLoaded", (evt) => { + let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; + groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); + document.querySelector("#groupLabel").innerHTML = groupMsg; + let ruleInfo; + if (window.location.search && window.location.search.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); + } else if (window.location.hash && window.location.hash.length > 0) { + ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + } + updateWithRuleInfo(ruleInfo); }) diff --git a/rule-server/src/static/archives/2020.08.12/doc/common/help.js b/rule-server/src/static/archives/2020.08.12/doc/common/help.js index 722af28b7..6bf4ebc24 100644 --- a/rule-server/src/static/archives/2020.08.12/doc/common/help.js +++ b/rule-server/src/static/archives/2020.08.12/doc/common/help.js @@ -108,17 +108,7 @@ const valueMap = { } }; -window.addEventListener("DOMContentLoaded", (evt) => { - let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; - groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); - document.querySelector("#groupLabel").innerHTML = groupMsg; - let ruleInfo; - if (window.location.search && window.location.search.length > 0) { - const searchParams = new URLSearchParams(window.location.search); - ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); - } else if (window.location.hash && window.location.hash.length > 0) { - ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); - } +function updateWithRuleInfo(ruleInfo) { if (ruleInfo) { if (ruleInfo.message) { let ruleMessage = ruleInfo.message.replace(/\{(\d+)\}/g, (matchedStr, matchedNum, matchedIndex) => msgArgs[matchedNum]); @@ -141,14 +131,72 @@ window.addEventListener("DOMContentLoaded", (evt) => { let value = ruleInfo.value; const val = valueMap[value[0]][value[1]]; let icon = ""; - if (val === "Violation") icon = ``; - if (val === "Needs review") icon = ``; - if (val === "Recommendation") icon = ``; + if (val === "Violation") icon = ``; + if (val === "Needs review") icon = ``; + if (val === "Recommendation") icon = ``; document.querySelector("#locLevel").innerHTML = `
${icon} ${val}
`; } if (RULE_ID) { document.querySelector("#ruleInfo").innerHTML = `

Rule ID: ${RULE_ID}${ruleInfo.reasonId ? `
Reason ID: ${ruleInfo.reasonId}

` : ""}`; } } +} + +if ("onhashchange" in window) {// does the browser support the hashchange event? + window.onhashchange = function () { + let ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + updateWithRuleInfo(ruleInfo); + } +} + +window.addEventListener("DOMContentLoaded", (evt) => { + let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; + groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); + document.querySelector("#groupLabel").innerHTML = groupMsg; + let ruleInfo; + if (window.location.search && window.location.search.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); + } else if (window.location.hash && window.location.hash.length > 0) { + ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + } + updateWithRuleInfo(ruleInfo); }) diff --git a/rule-server/src/static/archives/2020.10.07/doc/common/help.js b/rule-server/src/static/archives/2020.10.07/doc/common/help.js index 722af28b7..6bf4ebc24 100644 --- a/rule-server/src/static/archives/2020.10.07/doc/common/help.js +++ b/rule-server/src/static/archives/2020.10.07/doc/common/help.js @@ -108,17 +108,7 @@ const valueMap = { } }; -window.addEventListener("DOMContentLoaded", (evt) => { - let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; - groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); - document.querySelector("#groupLabel").innerHTML = groupMsg; - let ruleInfo; - if (window.location.search && window.location.search.length > 0) { - const searchParams = new URLSearchParams(window.location.search); - ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); - } else if (window.location.hash && window.location.hash.length > 0) { - ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); - } +function updateWithRuleInfo(ruleInfo) { if (ruleInfo) { if (ruleInfo.message) { let ruleMessage = ruleInfo.message.replace(/\{(\d+)\}/g, (matchedStr, matchedNum, matchedIndex) => msgArgs[matchedNum]); @@ -141,14 +131,72 @@ window.addEventListener("DOMContentLoaded", (evt) => { let value = ruleInfo.value; const val = valueMap[value[0]][value[1]]; let icon = ""; - if (val === "Violation") icon = ``; - if (val === "Needs review") icon = ``; - if (val === "Recommendation") icon = ``; + if (val === "Violation") icon = ``; + if (val === "Needs review") icon = ``; + if (val === "Recommendation") icon = ``; document.querySelector("#locLevel").innerHTML = `
${icon} ${val}
`; } if (RULE_ID) { document.querySelector("#ruleInfo").innerHTML = `

Rule ID: ${RULE_ID}${ruleInfo.reasonId ? `
Reason ID: ${ruleInfo.reasonId}

` : ""}`; } } +} + +if ("onhashchange" in window) {// does the browser support the hashchange event? + window.onhashchange = function () { + let ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + updateWithRuleInfo(ruleInfo); + } +} + +window.addEventListener("DOMContentLoaded", (evt) => { + let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; + groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); + document.querySelector("#groupLabel").innerHTML = groupMsg; + let ruleInfo; + if (window.location.search && window.location.search.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); + } else if (window.location.hash && window.location.hash.length > 0) { + ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + } + updateWithRuleInfo(ruleInfo); }) diff --git a/rule-server/src/static/archives/2021.02.10/doc/common/help.js b/rule-server/src/static/archives/2021.02.10/doc/common/help.js index 722af28b7..6bf4ebc24 100644 --- a/rule-server/src/static/archives/2021.02.10/doc/common/help.js +++ b/rule-server/src/static/archives/2021.02.10/doc/common/help.js @@ -108,17 +108,7 @@ const valueMap = { } }; -window.addEventListener("DOMContentLoaded", (evt) => { - let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; - groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); - document.querySelector("#groupLabel").innerHTML = groupMsg; - let ruleInfo; - if (window.location.search && window.location.search.length > 0) { - const searchParams = new URLSearchParams(window.location.search); - ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); - } else if (window.location.hash && window.location.hash.length > 0) { - ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); - } +function updateWithRuleInfo(ruleInfo) { if (ruleInfo) { if (ruleInfo.message) { let ruleMessage = ruleInfo.message.replace(/\{(\d+)\}/g, (matchedStr, matchedNum, matchedIndex) => msgArgs[matchedNum]); @@ -141,14 +131,72 @@ window.addEventListener("DOMContentLoaded", (evt) => { let value = ruleInfo.value; const val = valueMap[value[0]][value[1]]; let icon = ""; - if (val === "Violation") icon = ``; - if (val === "Needs review") icon = ``; - if (val === "Recommendation") icon = ``; + if (val === "Violation") icon = ``; + if (val === "Needs review") icon = ``; + if (val === "Recommendation") icon = ``; document.querySelector("#locLevel").innerHTML = `
${icon} ${val}
`; } if (RULE_ID) { document.querySelector("#ruleInfo").innerHTML = `

Rule ID: ${RULE_ID}${ruleInfo.reasonId ? `
Reason ID: ${ruleInfo.reasonId}

` : ""}`; } } +} + +if ("onhashchange" in window) {// does the browser support the hashchange event? + window.onhashchange = function () { + let ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + updateWithRuleInfo(ruleInfo); + } +} + +window.addEventListener("DOMContentLoaded", (evt) => { + let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; + groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); + document.querySelector("#groupLabel").innerHTML = groupMsg; + let ruleInfo; + if (window.location.search && window.location.search.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); + } else if (window.location.hash && window.location.hash.length > 0) { + ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + } + updateWithRuleInfo(ruleInfo); }) diff --git a/rule-server/src/static/archives/2021.04.27/doc/common/help.js b/rule-server/src/static/archives/2021.04.27/doc/common/help.js index 722af28b7..6bf4ebc24 100644 --- a/rule-server/src/static/archives/2021.04.27/doc/common/help.js +++ b/rule-server/src/static/archives/2021.04.27/doc/common/help.js @@ -108,17 +108,7 @@ const valueMap = { } }; -window.addEventListener("DOMContentLoaded", (evt) => { - let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; - groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); - document.querySelector("#groupLabel").innerHTML = groupMsg; - let ruleInfo; - if (window.location.search && window.location.search.length > 0) { - const searchParams = new URLSearchParams(window.location.search); - ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); - } else if (window.location.hash && window.location.hash.length > 0) { - ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); - } +function updateWithRuleInfo(ruleInfo) { if (ruleInfo) { if (ruleInfo.message) { let ruleMessage = ruleInfo.message.replace(/\{(\d+)\}/g, (matchedStr, matchedNum, matchedIndex) => msgArgs[matchedNum]); @@ -141,14 +131,72 @@ window.addEventListener("DOMContentLoaded", (evt) => { let value = ruleInfo.value; const val = valueMap[value[0]][value[1]]; let icon = ""; - if (val === "Violation") icon = ``; - if (val === "Needs review") icon = ``; - if (val === "Recommendation") icon = ``; + if (val === "Violation") icon = ``; + if (val === "Needs review") icon = ``; + if (val === "Recommendation") icon = ``; document.querySelector("#locLevel").innerHTML = `
${icon} ${val}
`; } if (RULE_ID) { document.querySelector("#ruleInfo").innerHTML = `

Rule ID: ${RULE_ID}${ruleInfo.reasonId ? `
Reason ID: ${ruleInfo.reasonId}

` : ""}`; } } +} + +if ("onhashchange" in window) {// does the browser support the hashchange event? + window.onhashchange = function () { + let ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + updateWithRuleInfo(ruleInfo); + } +} + +window.addEventListener("DOMContentLoaded", (evt) => { + let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; + groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); + document.querySelector("#groupLabel").innerHTML = groupMsg; + let ruleInfo; + if (window.location.search && window.location.search.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); + } else if (window.location.hash && window.location.hash.length > 0) { + ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + } + updateWithRuleInfo(ruleInfo); }) diff --git a/rule-server/src/static/archives/2021.06.16/doc/common/help.js b/rule-server/src/static/archives/2021.06.16/doc/common/help.js index 722af28b7..6bf4ebc24 100644 --- a/rule-server/src/static/archives/2021.06.16/doc/common/help.js +++ b/rule-server/src/static/archives/2021.06.16/doc/common/help.js @@ -108,17 +108,7 @@ const valueMap = { } }; -window.addEventListener("DOMContentLoaded", (evt) => { - let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; - groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); - document.querySelector("#groupLabel").innerHTML = groupMsg; - let ruleInfo; - if (window.location.search && window.location.search.length > 0) { - const searchParams = new URLSearchParams(window.location.search); - ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); - } else if (window.location.hash && window.location.hash.length > 0) { - ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); - } +function updateWithRuleInfo(ruleInfo) { if (ruleInfo) { if (ruleInfo.message) { let ruleMessage = ruleInfo.message.replace(/\{(\d+)\}/g, (matchedStr, matchedNum, matchedIndex) => msgArgs[matchedNum]); @@ -141,14 +131,72 @@ window.addEventListener("DOMContentLoaded", (evt) => { let value = ruleInfo.value; const val = valueMap[value[0]][value[1]]; let icon = ""; - if (val === "Violation") icon = ``; - if (val === "Needs review") icon = ``; - if (val === "Recommendation") icon = ``; + if (val === "Violation") icon = ``; + if (val === "Needs review") icon = ``; + if (val === "Recommendation") icon = ``; document.querySelector("#locLevel").innerHTML = `
${icon} ${val}
`; } if (RULE_ID) { document.querySelector("#ruleInfo").innerHTML = `

Rule ID: ${RULE_ID}${ruleInfo.reasonId ? `
Reason ID: ${ruleInfo.reasonId}

` : ""}`; } } +} + +if ("onhashchange" in window) {// does the browser support the hashchange event? + window.onhashchange = function () { + let ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + updateWithRuleInfo(ruleInfo); + } +} + +window.addEventListener("DOMContentLoaded", (evt) => { + let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; + groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); + document.querySelector("#groupLabel").innerHTML = groupMsg; + let ruleInfo; + if (window.location.search && window.location.search.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); + } else if (window.location.hash && window.location.hash.length > 0) { + ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + } + updateWithRuleInfo(ruleInfo); }) diff --git a/rule-server/src/static/archives/2021.07.21/doc/common/help.js b/rule-server/src/static/archives/2021.07.21/doc/common/help.js index 722af28b7..6bf4ebc24 100644 --- a/rule-server/src/static/archives/2021.07.21/doc/common/help.js +++ b/rule-server/src/static/archives/2021.07.21/doc/common/help.js @@ -108,17 +108,7 @@ const valueMap = { } }; -window.addEventListener("DOMContentLoaded", (evt) => { - let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; - groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); - document.querySelector("#groupLabel").innerHTML = groupMsg; - let ruleInfo; - if (window.location.search && window.location.search.length > 0) { - const searchParams = new URLSearchParams(window.location.search); - ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); - } else if (window.location.hash && window.location.hash.length > 0) { - ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); - } +function updateWithRuleInfo(ruleInfo) { if (ruleInfo) { if (ruleInfo.message) { let ruleMessage = ruleInfo.message.replace(/\{(\d+)\}/g, (matchedStr, matchedNum, matchedIndex) => msgArgs[matchedNum]); @@ -141,14 +131,72 @@ window.addEventListener("DOMContentLoaded", (evt) => { let value = ruleInfo.value; const val = valueMap[value[0]][value[1]]; let icon = ""; - if (val === "Violation") icon = ``; - if (val === "Needs review") icon = ``; - if (val === "Recommendation") icon = ``; + if (val === "Violation") icon = ``; + if (val === "Needs review") icon = ``; + if (val === "Recommendation") icon = ``; document.querySelector("#locLevel").innerHTML = `
${icon} ${val}
`; } if (RULE_ID) { document.querySelector("#ruleInfo").innerHTML = `

Rule ID: ${RULE_ID}${ruleInfo.reasonId ? `
Reason ID: ${ruleInfo.reasonId}

` : ""}`; } } +} + +if ("onhashchange" in window) {// does the browser support the hashchange event? + window.onhashchange = function () { + let ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + updateWithRuleInfo(ruleInfo); + } +} + +window.addEventListener("DOMContentLoaded", (evt) => { + let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; + groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); + document.querySelector("#groupLabel").innerHTML = groupMsg; + let ruleInfo; + if (window.location.search && window.location.search.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); + } else if (window.location.hash && window.location.hash.length > 0) { + ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + } + updateWithRuleInfo(ruleInfo); }) diff --git a/rule-server/src/static/archives/2021.08.27/doc/common/help.js b/rule-server/src/static/archives/2021.08.27/doc/common/help.js index 722af28b7..6bf4ebc24 100644 --- a/rule-server/src/static/archives/2021.08.27/doc/common/help.js +++ b/rule-server/src/static/archives/2021.08.27/doc/common/help.js @@ -108,17 +108,7 @@ const valueMap = { } }; -window.addEventListener("DOMContentLoaded", (evt) => { - let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; - groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); - document.querySelector("#groupLabel").innerHTML = groupMsg; - let ruleInfo; - if (window.location.search && window.location.search.length > 0) { - const searchParams = new URLSearchParams(window.location.search); - ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); - } else if (window.location.hash && window.location.hash.length > 0) { - ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); - } +function updateWithRuleInfo(ruleInfo) { if (ruleInfo) { if (ruleInfo.message) { let ruleMessage = ruleInfo.message.replace(/\{(\d+)\}/g, (matchedStr, matchedNum, matchedIndex) => msgArgs[matchedNum]); @@ -141,14 +131,72 @@ window.addEventListener("DOMContentLoaded", (evt) => { let value = ruleInfo.value; const val = valueMap[value[0]][value[1]]; let icon = ""; - if (val === "Violation") icon = ``; - if (val === "Needs review") icon = ``; - if (val === "Recommendation") icon = ``; + if (val === "Violation") icon = ``; + if (val === "Needs review") icon = ``; + if (val === "Recommendation") icon = ``; document.querySelector("#locLevel").innerHTML = `
${icon} ${val}
`; } if (RULE_ID) { document.querySelector("#ruleInfo").innerHTML = `

Rule ID: ${RULE_ID}${ruleInfo.reasonId ? `
Reason ID: ${ruleInfo.reasonId}

` : ""}`; } } +} + +if ("onhashchange" in window) {// does the browser support the hashchange event? + window.onhashchange = function () { + let ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + updateWithRuleInfo(ruleInfo); + } +} + +window.addEventListener("DOMContentLoaded", (evt) => { + let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; + groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); + document.querySelector("#groupLabel").innerHTML = groupMsg; + let ruleInfo; + if (window.location.search && window.location.search.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); + } else if (window.location.hash && window.location.hash.length > 0) { + ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + } + updateWithRuleInfo(ruleInfo); }) diff --git a/rule-server/src/static/archives/2021.10.25/doc/common/help.js b/rule-server/src/static/archives/2021.10.25/doc/common/help.js index 722af28b7..6bf4ebc24 100644 --- a/rule-server/src/static/archives/2021.10.25/doc/common/help.js +++ b/rule-server/src/static/archives/2021.10.25/doc/common/help.js @@ -108,17 +108,7 @@ const valueMap = { } }; -window.addEventListener("DOMContentLoaded", (evt) => { - let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; - groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); - document.querySelector("#groupLabel").innerHTML = groupMsg; - let ruleInfo; - if (window.location.search && window.location.search.length > 0) { - const searchParams = new URLSearchParams(window.location.search); - ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); - } else if (window.location.hash && window.location.hash.length > 0) { - ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); - } +function updateWithRuleInfo(ruleInfo) { if (ruleInfo) { if (ruleInfo.message) { let ruleMessage = ruleInfo.message.replace(/\{(\d+)\}/g, (matchedStr, matchedNum, matchedIndex) => msgArgs[matchedNum]); @@ -141,14 +131,72 @@ window.addEventListener("DOMContentLoaded", (evt) => { let value = ruleInfo.value; const val = valueMap[value[0]][value[1]]; let icon = ""; - if (val === "Violation") icon = ``; - if (val === "Needs review") icon = ``; - if (val === "Recommendation") icon = ``; + if (val === "Violation") icon = ``; + if (val === "Needs review") icon = ``; + if (val === "Recommendation") icon = ``; document.querySelector("#locLevel").innerHTML = `
${icon} ${val}
`; } if (RULE_ID) { document.querySelector("#ruleInfo").innerHTML = `

Rule ID: ${RULE_ID}${ruleInfo.reasonId ? `
Reason ID: ${ruleInfo.reasonId}

` : ""}`; } } +} + +if ("onhashchange" in window) {// does the browser support the hashchange event? + window.onhashchange = function () { + let ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + updateWithRuleInfo(ruleInfo); + } +} + +window.addEventListener("DOMContentLoaded", (evt) => { + let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; + groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); + document.querySelector("#groupLabel").innerHTML = groupMsg; + let ruleInfo; + if (window.location.search && window.location.search.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); + } else if (window.location.hash && window.location.hash.length > 0) { + ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + } + updateWithRuleInfo(ruleInfo); }) diff --git a/rule-server/src/static/archives/2021.11.17/doc/common/help.js b/rule-server/src/static/archives/2021.11.17/doc/common/help.js index 722af28b7..6bf4ebc24 100644 --- a/rule-server/src/static/archives/2021.11.17/doc/common/help.js +++ b/rule-server/src/static/archives/2021.11.17/doc/common/help.js @@ -108,17 +108,7 @@ const valueMap = { } }; -window.addEventListener("DOMContentLoaded", (evt) => { - let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; - groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); - document.querySelector("#groupLabel").innerHTML = groupMsg; - let ruleInfo; - if (window.location.search && window.location.search.length > 0) { - const searchParams = new URLSearchParams(window.location.search); - ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); - } else if (window.location.hash && window.location.hash.length > 0) { - ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); - } +function updateWithRuleInfo(ruleInfo) { if (ruleInfo) { if (ruleInfo.message) { let ruleMessage = ruleInfo.message.replace(/\{(\d+)\}/g, (matchedStr, matchedNum, matchedIndex) => msgArgs[matchedNum]); @@ -141,14 +131,72 @@ window.addEventListener("DOMContentLoaded", (evt) => { let value = ruleInfo.value; const val = valueMap[value[0]][value[1]]; let icon = ""; - if (val === "Violation") icon = ``; - if (val === "Needs review") icon = ``; - if (val === "Recommendation") icon = ``; + if (val === "Violation") icon = ``; + if (val === "Needs review") icon = ``; + if (val === "Recommendation") icon = ``; document.querySelector("#locLevel").innerHTML = `
${icon} ${val}
`; } if (RULE_ID) { document.querySelector("#ruleInfo").innerHTML = `

Rule ID: ${RULE_ID}${ruleInfo.reasonId ? `
Reason ID: ${ruleInfo.reasonId}

` : ""}`; } } +} + +if ("onhashchange" in window) {// does the browser support the hashchange event? + window.onhashchange = function () { + let ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + updateWithRuleInfo(ruleInfo); + } +} + +window.addEventListener("DOMContentLoaded", (evt) => { + let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; + groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); + document.querySelector("#groupLabel").innerHTML = groupMsg; + let ruleInfo; + if (window.location.search && window.location.search.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); + } else if (window.location.hash && window.location.hash.length > 0) { + ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + } + updateWithRuleInfo(ruleInfo); }) diff --git a/rule-server/src/static/archives/2022.02.01/doc/common/help.js b/rule-server/src/static/archives/2022.02.01/doc/common/help.js index 722af28b7..6bf4ebc24 100644 --- a/rule-server/src/static/archives/2022.02.01/doc/common/help.js +++ b/rule-server/src/static/archives/2022.02.01/doc/common/help.js @@ -108,17 +108,7 @@ const valueMap = { } }; -window.addEventListener("DOMContentLoaded", (evt) => { - let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; - groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); - document.querySelector("#groupLabel").innerHTML = groupMsg; - let ruleInfo; - if (window.location.search && window.location.search.length > 0) { - const searchParams = new URLSearchParams(window.location.search); - ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); - } else if (window.location.hash && window.location.hash.length > 0) { - ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); - } +function updateWithRuleInfo(ruleInfo) { if (ruleInfo) { if (ruleInfo.message) { let ruleMessage = ruleInfo.message.replace(/\{(\d+)\}/g, (matchedStr, matchedNum, matchedIndex) => msgArgs[matchedNum]); @@ -141,14 +131,72 @@ window.addEventListener("DOMContentLoaded", (evt) => { let value = ruleInfo.value; const val = valueMap[value[0]][value[1]]; let icon = ""; - if (val === "Violation") icon = ``; - if (val === "Needs review") icon = ``; - if (val === "Recommendation") icon = ``; + if (val === "Violation") icon = ``; + if (val === "Needs review") icon = ``; + if (val === "Recommendation") icon = ``; document.querySelector("#locLevel").innerHTML = `
${icon} ${val}
`; } if (RULE_ID) { document.querySelector("#ruleInfo").innerHTML = `

Rule ID: ${RULE_ID}${ruleInfo.reasonId ? `
Reason ID: ${ruleInfo.reasonId}

` : ""}`; } } +} + +if ("onhashchange" in window) {// does the browser support the hashchange event? + window.onhashchange = function () { + let ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + updateWithRuleInfo(ruleInfo); + } +} + +window.addEventListener("DOMContentLoaded", (evt) => { + let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; + groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); + document.querySelector("#groupLabel").innerHTML = groupMsg; + let ruleInfo; + if (window.location.search && window.location.search.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); + } else if (window.location.hash && window.location.hash.length > 0) { + ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + } + updateWithRuleInfo(ruleInfo); }) diff --git a/rule-server/src/static/archives/2022.03.03/doc/common/help.js b/rule-server/src/static/archives/2022.03.03/doc/common/help.js index 722af28b7..6bf4ebc24 100644 --- a/rule-server/src/static/archives/2022.03.03/doc/common/help.js +++ b/rule-server/src/static/archives/2022.03.03/doc/common/help.js @@ -108,17 +108,7 @@ const valueMap = { } }; -window.addEventListener("DOMContentLoaded", (evt) => { - let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; - groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); - document.querySelector("#groupLabel").innerHTML = groupMsg; - let ruleInfo; - if (window.location.search && window.location.search.length > 0) { - const searchParams = new URLSearchParams(window.location.search); - ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); - } else if (window.location.hash && window.location.hash.length > 0) { - ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); - } +function updateWithRuleInfo(ruleInfo) { if (ruleInfo) { if (ruleInfo.message) { let ruleMessage = ruleInfo.message.replace(/\{(\d+)\}/g, (matchedStr, matchedNum, matchedIndex) => msgArgs[matchedNum]); @@ -141,14 +131,72 @@ window.addEventListener("DOMContentLoaded", (evt) => { let value = ruleInfo.value; const val = valueMap[value[0]][value[1]]; let icon = ""; - if (val === "Violation") icon = ``; - if (val === "Needs review") icon = ``; - if (val === "Recommendation") icon = ``; + if (val === "Violation") icon = ``; + if (val === "Needs review") icon = ``; + if (val === "Recommendation") icon = ``; document.querySelector("#locLevel").innerHTML = `
${icon} ${val}
`; } if (RULE_ID) { document.querySelector("#ruleInfo").innerHTML = `

Rule ID: ${RULE_ID}${ruleInfo.reasonId ? `
Reason ID: ${ruleInfo.reasonId}

` : ""}`; } } +} + +if ("onhashchange" in window) {// does the browser support the hashchange event? + window.onhashchange = function () { + let ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + updateWithRuleInfo(ruleInfo); + } +} + +window.addEventListener("DOMContentLoaded", (evt) => { + let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; + groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); + document.querySelector("#groupLabel").innerHTML = groupMsg; + let ruleInfo; + if (window.location.search && window.location.search.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); + } else if (window.location.hash && window.location.hash.length > 0) { + ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + } + updateWithRuleInfo(ruleInfo); }) diff --git a/rule-server/src/static/archives/2022.03.12/doc/common/help.js b/rule-server/src/static/archives/2022.03.12/doc/common/help.js index 722af28b7..6bf4ebc24 100644 --- a/rule-server/src/static/archives/2022.03.12/doc/common/help.js +++ b/rule-server/src/static/archives/2022.03.12/doc/common/help.js @@ -108,17 +108,7 @@ const valueMap = { } }; -window.addEventListener("DOMContentLoaded", (evt) => { - let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; - groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); - document.querySelector("#groupLabel").innerHTML = groupMsg; - let ruleInfo; - if (window.location.search && window.location.search.length > 0) { - const searchParams = new URLSearchParams(window.location.search); - ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); - } else if (window.location.hash && window.location.hash.length > 0) { - ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); - } +function updateWithRuleInfo(ruleInfo) { if (ruleInfo) { if (ruleInfo.message) { let ruleMessage = ruleInfo.message.replace(/\{(\d+)\}/g, (matchedStr, matchedNum, matchedIndex) => msgArgs[matchedNum]); @@ -141,14 +131,72 @@ window.addEventListener("DOMContentLoaded", (evt) => { let value = ruleInfo.value; const val = valueMap[value[0]][value[1]]; let icon = ""; - if (val === "Violation") icon = ``; - if (val === "Needs review") icon = ``; - if (val === "Recommendation") icon = ``; + if (val === "Violation") icon = ``; + if (val === "Needs review") icon = ``; + if (val === "Recommendation") icon = ``; document.querySelector("#locLevel").innerHTML = `
${icon} ${val}
`; } if (RULE_ID) { document.querySelector("#ruleInfo").innerHTML = `

Rule ID: ${RULE_ID}${ruleInfo.reasonId ? `
Reason ID: ${ruleInfo.reasonId}

` : ""}`; } } +} + +if ("onhashchange" in window) {// does the browser support the hashchange event? + window.onhashchange = function () { + let ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + updateWithRuleInfo(ruleInfo); + } +} + +window.addEventListener("DOMContentLoaded", (evt) => { + let groupMsg = typeof RULE_MESSAGES !== "undefined" && (RULE_MESSAGES["en-US"].group || RULE_MESSAGES["en-US"][0]) || ""; + groupMsg = groupMsg.replace(/&/g, "&").replace(//g, ">"); + document.querySelector("#groupLabel").innerHTML = groupMsg; + let ruleInfo; + if (window.location.search && window.location.search.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + ruleInfo = JSON.parse(decodeURIComponent(searchParams.get("issue"))); + } else if (window.location.hash && window.location.hash.length > 0) { + ruleInfo = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); + } + updateWithRuleInfo(ruleInfo); })