You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
8.1 KiB
1 lines
8.1 KiB
(function(c){var b=function(){if(!("id" in arguments.callee)){arguments.callee.id=0}return"ugallery_"+arguments.callee.id++};var a=function(d){if(!("cache" in arguments.callee)){arguments.callee.cache={}}if(!(d in arguments.callee.cache)){arguments.callee.cache[d]=new Image();arguments.callee.cache[d].src=d}};c.fn.ugallery=function(f){var e={fade_duration:1200,forward_btn:"right.gif",backward_btn:"left.gif",controls_vpos:150,animate_controls:true,control_fade_duration:300,controls_fade_from:0.2,controls_fade_to:0.7,player:true,play_btn:"play.png",stop_btn:"stop.png",play_vpos:-1,hide_controls:true,show_duration:5000,autostart:false,hide_playbtn_on_mout:true,desc_pos:"top",desc_bg_color:"#000",desc_bg_opacity:0.6,desc_align:"right",desc_height:20,desc_custom_class:null,desc_custom_callback:null,counter_enabled:false,counter_pos:"top",counter_align:"left",counter_custom_class:null,counter_custom_callback:null,counter_height:-1,show_thumb:false,thumb_position:"right",thumb_bg:"filmv.gif",thumb_img_width:90,thumb_img_height:60,thumb_pnl_width:130,thumb_pnl_opacity:0.6,thumb_img_opacity:0.2,thumb_img_fade_from:0.4,thumb_img_fade_to:1};var d=c.extend(e,f);return this.each(function(){var g=c(this);var h=g.find("a");var G="#"+g.attr("id");var H=b();var R=b();var l=b();var m=b();var E=b();var P=b();var B=b();var K=b();var r=b();var x=b();var v=b();var I=g.find("div.collection img");var w=b();var t,s;var y;var z=function(){c(G+" .view_pointer_0").removeClass("view_pointer_0");c(G+" .view_pointer_next").removeClass("view_pointer_next");c(G+" .view_pointer_prev").removeClass("view_pointer_prev")};var A=function(){for(var S=0;S<h.length;S++){if(c(h[S]).hasClass("view_pointer_0")){return S}}return -1};var J=function(){var S=A();return c(h[(S==0?h.length-1:S-1)])};var q=function(){var S=A();return c(h[(S==(h.length-1)?0:S+1)])};var M=function(S){z();c(h[S]).addClass("view_pointer_0");c(h[S==0?h.length-1:S-1]).addClass("view_pointer_prev");c(h[S==(h.length-1)?0:S+1]).addClass("view_pointer_next")};var k=function(){a(c(G+" .view_pointer_next").attr("href"));a(c(G+" .view_pointer_prev").attr("href"))};var p=function(V){var U=this;if("mutex" in U&&U.mutex){return}U.mutex=true;var T=c("#"+H).css("opacity")==0?("#"+H):("#"+R);var S=T=="#"+H?("#"+R):("#"+H);c(T).attr("src",c(V).attr("href"));c(S).animate({opacity:0},d.fade_duration/2,function(){c(T).animate({opacity:1},d.fade_duration/2,function(){U.mutex=false})})};var O=function(S){p(S?G+" .view_pointer_next":G+" .view_pointer_prev");var T=h.length;var U=S?1:T-1;M((A()+U)%h.length);Q();if(d.counter_enabled){C()}k()};var Q=function(){var S=c(G+" .view_pointer_0").attr("title");c("#"+K).text(S);if(d.desc_custom_callback){d.desc_custom_callback(A())}};var C=function(){var S=A()+1;var T=h.length;c("#"+v).text(S+"/"+T);if(d.counter_custom_callback){d.counter_custom_callback(S-1)}};var i=false;var D=function(){i=!i;if(i){c("#"+E).css("display","none");c("#"+P).css("display","block");O(true);setTimeout(N,d.show_duration);j(false)}else{c("#"+E).css("display","block");c("#"+P).css("display","none");j(true)}};var N=function(){if(i){O(true);setTimeout(N,d.show_duration);j(false)}else{j(true)}};var j=function(S){var T=S?"block":"none";c("#"+m+",#"+l).css("display",T)};var L=function(){c(G).css("height",g.css("height"));g.prepend('<div class="viewport"></div>');c(G+" div.viewport").css({width:g.css("width"),height:g.css("height"),position:"absolute",left:0,top:0});c(G+" div.viewport").prepend('<img id="'+H+'" class="aniview" />\n<img id="'+R+'" class="aniview" />\n<img id="'+m+'" src="'+d.forward_btn+'" />\n<img id="'+l+'" src="'+d.backward_btn+'" />\n<img id="'+E+'" src="'+d.play_btn+'" />\n<img id="'+P+'" src="'+d.stop_btn+'" />\n<div id="'+B+'" class="ug_desc_outer"><div id="'+K+'" class="ug_desc_inner'+(d.desc_custom_class?(" "+d.desc_custom_class):"")+'"></div></div>\n<div id="'+r+'" class="ug_desc_black"></div>\n<div id="'+x+'" class="ug_counter_outer"><div id="'+v+'" class="ug_counter_inner'+(d.counter_custom_class?(" "+d.counter_custom_class):"")+'"></div></div>\n');c("#"+H+",#"+R).css({position:"absolute",top:0,left:0});c("#"+R).css("opacity",0);c("#"+m).css({position:"absolute",right:0,top:d.controls_vpos,"z-index":2,opacity:d.controls_fade_from,cursor:"pointer"});c("#"+l).css({position:"absolute",left:0,top:d.controls_vpos,"z-index":2,opacity:d.controls_fade_from,cursor:"pointer"});if(d.play_vpos==-1){d.play_vpos=d.controls_vpos-5}if(d.counter_height==-1){d.counter_height=d.desc_height}c("#"+E+",#"+P).css({position:"absolute",display:"none",left:(g.width()/2-28),top:d.play_vpos,"z-index":2,opacity:d.controls_fade_from,cursor:"pointer"});c("#"+r).css({position:"absolute",width:g.width(),height:d.desc_height,"z-index":4,"background-color":d.desc_bg_color,opacity:d.desc_bg_opacity});c("#"+B).css({position:"absolute",width:g.width(),height:d.desc_height,"z-index":5,"text-align":d.desc_align});c("#"+K).css({margin:3});switch(d.desc_pos){case"top":c("#"+B).css({left:0,top:-d.desc_height-2});c("#"+r).css("display","none");break;case"top-inside":c("#"+B+",#"+r).css({left:0,top:0});break;case"bottom":c("#"+B).css({left:0,bottom:-d.desc_height-2});c("#"+r).css("display","none");break;case"bottom-inside":c("#"+B+",#"+r).css({left:0,bottom:0});break}if(d.counter_enabled){c("#"+x).css({position:"absolute",width:g.width(),height:d.counter_height,"z-index":5,"text-align":d.counter_align});c("#"+v).css({margin:3})}switch(d.counter_pos){case"top":c("#"+x).css({left:0,top:-d.counter_height-2});break;case"top-inside":c("#"+x).css({left:0,top:0});break;case"bottom":c("#"+x).css({left:0,bottom:-d.counter_height-2});break;case"bottom-inside":c("#"+x).css({left:0,bottom:0});break}if(d.player){c("#"+E).css("display","block")}if(d.animate_controls){c("#"+m+",#"+l+",#"+E+",#"+P).hover(function(T){c(this).animate({opacity:d.controls_fade_to},d.controls_fade_duration,function(){})},function(T){c(this).animate({opacity:d.controls_fade_from},d.controls_fade_duration,function(){})})}M(0);Q();if(d.counter_enabled){C()}k();c("#"+H).attr("src",c(G+" .view_pointer_0").attr("href"));if(d.show_thumb){t=(d.thumb_pnl_width-d.thumb_img_width)/2;s=12;c(G).prepend('<div class="thumbs"></div>');c(G+" div.thumbs").css("overflow","hidden");switch(d.thumb_position){case"right":c(G+" .thumbs").css({position:"absolute",left:g.css("width")+1,width:d.thumb_pnl_width,height:g.css("height")});break;case"left":c(G+" .thumbs").css({position:"absolute",left:0,width:d.thumb_pnl_width,height:g.css("height")});c(G+" div.viewport").css({left:d.thumb_pnl_width+1});break}c(G+" .thumbs").append('<div id="'+w+'" class="thumb_panel"></div>\n');y=I.length*(d.thumb_img_height+s)+s;c("#"+w).css({"background-image":"url("+d.thumb_bg+")",height:y,opacity:d.thumb_pnl_opacity,border:d.thumb_border_style});var S=s;I.each(function(){c(this).attr("title",c(this).parent().attr("href"));c(this).css({left:t,top:S,opacity:d.thumb_img_opacity});c(this).hover(function(){c(this).css("opacity",d.thumb_img_fade_to)},function(){c(this).css("opacity",d.thumb_img_fade_from)});c("#"+w).append(this);S+=(s+d.thumb_img_height)})}}();var o=-1,n=-1;var F=function(V){if(o!=-1&&n!=-1){var T=c(G+" .thumbs").width();var S=c(G+" .thumbs").height();var U=(n*2*7)/S-7;if(U>3||U<-3){c("#"+w).css("top",function(Y,X){return parseFloat(X)-U})}var W=parseFloat(c("#"+w).css("top"));if(W>0){c("#"+w).css("top",0)}if(W<-y+S){c("#"+w).css("top",-y+S)}}};c("#"+m).click(function(){O(true)});c("#"+l).click(function(){O(false)});c("#"+E+",#"+P).click(function(){if(d.player){D()}});if(d.player&&d.autostart){i=!i;c("#"+E).css("display","none");c("#"+P).css("display","block");setTimeout(N,d.show_duration);j(false)}if(d.hide_playbtn_on_mout){c("#"+E+",#"+P).css("top","-1000px");c(G).mouseout(function(){c("#"+E+",#"+P).css("top","-1000px")});c(G).mouseover(function(){c("#"+E+",#"+P).css("top",d.play_vpos)})}var u;c(G+" .thumbs").mousemove(function(S){o=S.pageX-c(G+" .thumbs").offset().left;n=S.pageY-c(G+" .thumbs").offset().top});c(G+" .thumbs").hover(function(S){u=setInterval(function(){F(S)},20)},function(){clearInterval(u);o=-1;n=-1});c("#"+w+" img").click(function(){z();c(G+" div.collection a[href="+c(this).attr("title")+"]").addClass("view_pointer_0");M(A());p(G+" .view_pointer_0");k()})})}})(jQuery);
|