Difference between revisions of "MediaWiki:Common.js"

From mispar
Jump to: navigation, search
Line 6: Line 6:
 
found = re.exec(window.location.href);
 
found = re.exec(window.location.href);
 
if (found) {
 
if (found) {
     console.log(found[1]);
+
    var id = found[1];
 +
     console.log(id);
 
     var elem = document.getElementById(id);
 
     var elem = document.getElementById(id);
 
     if (elem) {
 
     if (elem) {

Revision as of 21:54, 4 March 2022

/* Any JavaScript here will be loaded for all users on every page load. */


const re = /#(.*)$/;

found = re.exec(window.location.href);
if (found) {
    var id = found[1];
    console.log(id);
    var elem = document.getElementById(id);
    if (elem) {
        elem = style.backgroundColor = 'yellow';
    }
}