MediaWiki:Common.js: Difference between revisions

From Wiki Grepolis EN
Jump to navigation
No edit summary
No edit summary
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */


var jQueryScriptOutputted = false;
  count = 0;
function initJQuery() {
function slideshow() {
   
    //if the jQuery object isn't available
slides = ['one','two','three','four'];
    if (typeof(jQuery) == 'undefined') {
document.getElementById('slideshow').innerHTML = slides[count];
   
count++;
   
if (count == slides.length)
        if (! jQueryScriptOutputted) {
{
            //only output the script once..
count = 0;
            jQueryScriptOutputted = true;
}
           
setInterval(slideshow(), 1000);
            //output the script (load it from google api)
}
            document.write("<scr" + "ipt type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js\"></scr" + "ipt>");
slideshow();
 
        }
        setTimeout("initJQuery()", 50);
    } else {
                       
        $(function() {  
            count = 0;
            function slideshow() {
               
                slides = ['one','two','three','four'];
                document.getElementById('slideshow').innerHTML = slides[count];
                count++;
                if (count == (slides.length))
                {
                    count = 0;
                }
                setInterval(slideshow(), 1000);
            }
            slideshow();
               
        });
    }
           
}
initJQuery();

Revision as of 20:15, 25 April 2011


 count = 0;
 function slideshow() {
	 
	 slides = ['one','two','three','four'];
	 document.getElementById('slideshow').innerHTML = slides[count];
	 count++;
	 if (count == slides.length)
	 {
		 count = 0;
	 }
	 setInterval(slideshow(), 1000);
 }
 slideshow();