source: extensions/AMenuManager/js/amm_randomPictPublic.min.js @ 14273

Last change on this file since 14273 was 11036, checked in by grum, 13 years ago

fix bug:2311, bug:2312 (random pict bug)

  • Property svn:executable set to *
File size: 2.1 KB
Line 
1/* file: amm_randomPictPublic.js - v1.0.1 | minified on 2011/05/24 with http://jscompress.com/ */
2function randomPict(opt)
3{var options={fixedHeight:0,pictures:[],showName:'n',showComment:'n',delay:0},properties={vIntervalID:0,vCurrentPict:0,nameDOM:'',commentDOM:'',img:new Image()},init=function(opt)
4{$.extend(options,opt);switch(options.showName)
5{case'o':properties.nameDOM='iammRPicNameO';break;case'u':properties.nameDOM='iammRPicNameU';break;}
6switch(options.showComment)
7{case'o':properties.commentDOM='iammRPicCommentO';break;case'u':properties.commentDOM='iammRPicCommentU';break;}
8if(properties.nameDOM!='')$('#'+properties.nameDOM).css('display','block');if(properties.commentDOM!='')$('#'+properties.commentDOM).css('display','block');if(options.delay>0)properties.vIntervalID=window.setInterval(getNextPicture,options.delay);if(options.fixedHeight>0)$('#irandompicinner').css('height',options.fixedHeight+'px');preloadImages();},preloadImages=function()
9{$(properties.img).bind('load',function()
10{properties.vCurrentPict++;if(properties.vCurrentPict>=options.pictures.length)
11{properties.vCurrentPict=-1;getNextPicture();}
12else
13{properties.img.src=options.pictures[properties.vCurrentPict].thumb;}});properties.img.src=options.pictures[properties.vCurrentPict].thumb;},computePositionTop=function()
14{$("#iamm_ill0").css({top:($('#irandompicinner').innerHeight()-$("#iamm_ill0").innerHeight())/2});},getNextPicture=function()
15{properties.vCurrentPict++;if(properties.vCurrentPict>=options.pictures.length)properties.vCurrentPict=0;$('#iamm_ill0').fadeTo(200,0,function()
16{if(properties.nameDOM!='')$('#'+properties.nameDOM).html(options.pictures[properties.vCurrentPict].name);if(properties.commentDOM!='')$('#'+properties.commentDOM).html(options.pictures[properties.vCurrentPict].comment);$('#iammRPicLink').attr('href',options.pictures[properties.vCurrentPict].link);$('#iammRPicImg').attr('src',options.pictures[properties.vCurrentPict].thumb);computePositionTop();$('#iamm_ill0').fadeTo(200,1);});};init(opt);}
17$(document).ready(function()
18{var rPict;if(typeof randomPictOpt!=='undefined'){rPict=new randomPict(randomPictOpt);}else{$('#mbAMM_randompict').remove();}});
Note: See TracBrowser for help on using the repository browser.