1 | /* file: amm_randomPictPublic.js - v1.0.1 | minified on 2011/05/24 with http://jscompress.com/ */ |
---|
2 | function 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;} |
---|
6 | switch(options.showComment) |
---|
7 | {case'o':properties.commentDOM='iammRPicCommentO';break;case'u':properties.commentDOM='iammRPicCommentU';break;} |
---|
8 | if(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();} |
---|
12 | else |
---|
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();}}); |
---|