Difference between revisions of "MediaWiki:Common.js"

From Networks of Care
Jump to navigation Jump to search
Line 3: Line 3:
  
  
<script> //getting random coordinates for the pages
+
/*getting random coordinates for the pages*/
  
 
var coordinates = [];
 
var coordinates = [];
Line 13: Line 13:
 
document.getElementById("coordinate0").innerHTML =coordinates[0];
 
document.getElementById("coordinate0").innerHTML =coordinates[0];
 
document.getElementById("coordinate1").innerHTML =coordinates[1];
 
document.getElementById("coordinate1").innerHTML =coordinates[1];
 
</script>
 

Revision as of 14:31, 30 March 2020

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



/*getting random coordinates for the pages*/

var coordinates = [];
while(coordinates.length < 2){
    var r = Math.floor(Math.random() * 1500) + 1;
    if(coordinates.indexOf(r) === -1) coordinates.push(r);
}

document.getElementById("coordinate0").innerHTML =coordinates[0];
document.getElementById("coordinate1").innerHTML =coordinates[1];