Template:Appeal/FY2324 E3 XH/en: Difference between revisions

Content deleted Content added
No edit summary
Prevent XSS attack using .textContent
 
(11 intermediate revisions by the same user not shown)
Line 42:
<div class="appeal-layout">
<div class="appeal-text">
<p class="headline">Support<span id="donor-greeting">S</span>upport Wikipedia, your daily source of trusted knowledge.</p>
<p class="paragraph">Your support matters! Sustain this great fountain of knowledge built by people, for people. Keep Wikipedia thriving.</p>
</div>
</div>
<script>
// Get the URL parameters from the current URL
const urlParams = new URLSearchParams(window.location.search);
const fnameValuefirstName = urlParams.get("fname");
 
if (firstName){
// Check if the "fname" parameter exists
if(firstName !== 'Wikimedia Supporter'){
if (urlParams.has("fname")) {
const capitalizedName = firstName.charAt(0).toUpperCase() + firstName.slice(1); //Capitalize name
// If it exists, assign its value to a variable
document.getElementById('donor-greeting').textContent = `${capitalizedName}, s`;
const fnameValue = urlParams.get("fname");
} else { }
console.log("fname parameter exists, and its value is: " + fnameValue);
} else {
console.log("fname parameter does not exist in the URL.");
}
</script>