Personal tools

Difference between revisions of "Template:Loading"

From referenceTSS

Jump to: navigation, search
m
 
(5 intermediate revisions by 2 users not shown)
Line 9: Line 9:
 
var cTotalFrames=18;
 
var cTotalFrames=18;
 
var cFrameWidth=55;
 
var cFrameWidth=55;
var cImageSrc='/resource_browser/images/LoaderGifs/sprites.gif'; //default but optional with Template  
+
var cImageSrc='/reftss/images/LoaderGifs/sprites.gif'; //default but optional with Template  
 
 
 
var cImageTimeout=false;
 
var cImageTimeout=false;
Line 48: Line 48:
 
cPreloaderTimeout=setTimeout('continueAnimation()', SECONDS_BETWEEN_FRAMES*1000);
 
cPreloaderTimeout=setTimeout('continueAnimation()', SECONDS_BETWEEN_FRAMES*1000);
 
}
 
}
 +
 +
function stopAnimation(){//stops animation
 +
clearTimeout(cPreloaderTimeout);
 +
cPreloaderTimeout=false;
 +
}
 +
 +
function imageLoader(s, fun)//Pre-loads the sprites image
 +
{
 +
clearTimeout(cImageTimeout);
 +
cImageTimeout=0;
 +
genImage = new Image();
 +
genImage.onload=function (){cImageTimeout=setTimeout(fun, 0)};
 +
genImage.onerror=new Function('alert(\'Could not load the image\')');
 +
genImage.src=s;
 +
}
 +
 +
//The following code starts the animation
 +
new imageLoader(cImageSrc, 'startAnimation()');
 +
 +
$(document).ready(function() {
 +
 +
//var loading_image="</html>{{{loadingimage}}}<html>";
 +
 +
$(document).on("click", "a", function() {
 +
    //this == the link that was clicked
 +
    var href = $(this).attr("href");
 +
    if(href!=null){
 +
    var url=String(href);
 +
    if(String(href).indexOf("resource_browser")!=-1){
 +
      if(String(href).length>2){
 +
              toggle_visibility('loader');
 +
   
 +
      }else{
 +
      }
 +
    }else{
 +
    }
 +
}else{
 +
}
 +
});
 +
 +
function toggle_visibility(id) {
 +
        var thelist = $('.hiddeable');
 +
    for (var i = 0; i < thelist.length; i++) {
 +
    thelist[i].style.display = 'none';
 +
    }
 +
    var e = $('#loader')[0];
 +
    if(e.style.display == 'block') {
 +
    e.style.display = 'none';
 +
    } else {
 +
    e.style.display = 'block';
 +
    }
 +
    }
 +
});
 
</script>
 
</script>
 
</html>
 
</html>

Latest revision as of 10:29, 13 September 2021