MediaWiki:common.js: Difference between revisions

From WikiROMS
Jump to navigationJump to search
No edit summary   (change visibility)
No edit summary   (change visibility)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
<script type="text/javascript">
 
<!--
var allPageTags = new Array();
var allPageTags = new Array();


Line 12: Line 11:
   var allPageTags=document.getElementsByTagName("*");
   var allPageTags=document.getElementsByTagName("*");
   //Cycle through the tags using a for loop
   //Cycle through the tags using a for loop
   for (i=0; i<allPageTags.length; i++) {
   for (i=0; i<allPageTags.length; i++) {
       if (allPageTags[i].className==class) {
       if (allPageTags[i].className==class) {
Line 20: Line 18:
   }
   }
}
}
//-->
</script>

Revision as of 18:54, 30 October 2007

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

var allPageTags = new Array();

function changeColor(class) {
   var interval = 1000;
   var color1 = "#ff0000"
   var color2 = "#000000";

   //Populate the array with all the page tags
   var allPageTags=document.getElementsByTagName("*");
   //Cycle through the tags using a for loop
   for (i=0; i<allPageTags.length; i++) {
      if (allPageTags[i].className==class) {
         allPageTags[i].style.color = (allPageTags[i].style.color == color1) ? color2 : color1;
         setTimeout("changeColour('" + class + "')", interval);
      }
   }
}