Skip to content

Instantly share code, notes, and snippets.

@daltonrooney
Created August 9, 2011 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daltonrooney/1134705 to your computer and use it in GitHub Desktop.
Save daltonrooney/1134705 to your computer and use it in GitHub Desktop.
PSP custom
(function(a){a.fn.touchwipe=function(c){var b={min_move_x:20,min_move_y:20,wipeLeft:function(){},wipeRight:function(){},wipeUp:function(){},wipeDown:function(){},preventDefaultEvents:true};if(c){a.extend(b,c)}this.each(function(){var e;var d;var i=false;function h(){this.removeEventListener("touchmove",f);e=null;i=false}function f(m){if(b.preventDefaultEvents){m.preventDefault()}if(i){var j=m.touches[0].pageX;var n=m.touches[0].pageY;var l=e-j;var k=d-n;if(Math.abs(l)>=b.min_move_x){h();if(l>0){b.wipeLeft()
}else{b.wipeRight()}}else{if(Math.abs(k)>=b.min_move_y){h();if(k>0){b.wipeDown()}else{b.wipeUp()}}}}}function g(j){if(j.touches.length==1){e=j.touches[0].pageX;d=j.touches[0].pageY;i=true;this.addEventListener("touchmove",f,false)}}if("ontouchstart" in document.documentElement){this.addEventListener("touchstart",g,false)}});return this}})(jQuery);jQuery(document).ready(function(g){var f,d,b,a,e;currSlide=new Array();tabSlide=new Array();f=portfolioSlideshowOptions.psLoader;d=portfolioSlideshowOptions.psHash;
b=portfolioSlideshowOptions.psFancyBox;a=portfolioSlideshowOptions.psInfoTxt;if(jQuery.browser.msie&&parseInt(jQuery.browser.version)<8){ie=true}else{ie=false}if(b===true){function c(k,j,h,i){return'<div id="image-caption">'+(k&&k.length?"<b>"+k+"</b>":"")+" Image "+(h+1)+" of "+j.length+"</div>"}g("a.fancybox, .gallery-item 'a[href$='.gif'], .gallery-item 'a[href$='.jpg'], .gallery-item 'a[href$='.png'], .gallery-item 'a[href$='.jpeg']").fancybox({titlePosition:"inside",titleFormat:c})}if(f===true){g(".slideshow-wrapper").delay(1000).queue(function(){g(".portfolio-slideshow, .slideshow-nav, .pager").css("visibility","visible");
g(this).removeClass("showloader")})}g("div[id^=portfolio-slideshow]").each(function(){var h=this.id.match(/portfolio-slideshow(\d+)/)[1];if(ie===true){g("#slideshow-wrapper"+h).addClass("ie")}g("#scrollable"+h).scrollable({keyboard:false}).navigator({navi:"#carouselnav"+h,naviItem:"a"});g("#slideshow-wrapper"+h+" a.show").click(function(){g(this).hide();g("#slideshow-wrapper"+h+" a.hide").addClass("active");g("#slideshow-wrapper"+h+" .pscarousel").fadeIn("fast")});g("#slideshow-wrapper"+h+" a.hide").click(function(){g(this).removeClass("active");
g("#slideshow-wrapper"+h+" a.show").show();g("#slideshow-wrapper"+h+" .pscarousel").fadeOut("fast")});g(function(){var l=0,n=window.location.hash;if(/\d+/.exec(n)){l=/\d+/.exec(n)[0];l=(parseInt(l)||1)-1}if(psPagerStyle[h]==="thumbs"){g.fn.cycle.updateActivePagerLink=function(q,r){g(q).find("img").removeClass("activeSlide").filter("#pager"+h+" img:eq("+r+")").addClass("activeSlide")}}else{g.fn.cycle.updateActivePagerLink=function(q,r){g(q).find("a").removeClass("activeSlide").filter("#pager"+h+" a:eq("+r+")").addClass("activeSlide")
}}function o(){g("#portfolio-slideshow"+h).cycle({fx:psTrans[h],speed:psSpeed[h],timeout:psTimeout[h],random:psRandom[h],nowrap:psNoWrap[h],next:"#slideshow-wrapper"+h+" a.slideshow-next, #slideshow-wrapper"+h+" #psnext"+h,startingSlide:l,prev:"#slideshow-wrapper"+h+" a.slideshow-prev , #slideshow-wrapper"+h+" #psprev"+h,before:p,after:i,end:k,slideExpr:".slideshow-content",manualTrump:true,slideResize:false,containerResize:false,pager:"#pager"+h,cleartypeNoBg:true,pagerAnchorBuilder:j})}function m(){g("#portfolio-slideshow"+h).cycle({fx:psTrans[h],speed:psSpeed[h],timeout:psTimeout[h],random:psRandom[h],nowrap:psNoWrap[h],next:"#slideshow-wrapper"+h+" a.slideshow-next, #psnext"+h,startingSlide:l,prev:"#slideshow-wrapper"+h+" a.slideshow-prev, #psprev"+h,before:p,after:i,slideExpr:".slideshow-content",end:k,manualTrump:true,slideResize:false,containerResize:false,pager:"#pager"+h+" .numbers",cleartypeNoBg:true})
}if(psPagerStyle[h]==="numbers"){m()}else{o()}if(psAutoplay[h]===false){g("#portfolio-slideshow"+h).cycle("pause")}else{if(psAudio[h]===true){g("#portfolio-slideshow"+h).delay(1000).queue(function(){g("#portfolio-slideshow"+h).cycle("resume");g("#slideshow-nav"+h+" a.play").fadeOut(100,function(){g("#slideshow-nav"+h+" a.pause").fadeIn(10)});g("#portfolio-slideshow"+h).parent().nextAll(".haiku-text-player:first").jPlayer("play")})}else{g("#slideshow-nav"+h+" a.play").fadeOut(100,function(){g("#slideshow-nav"+h+" a.pause").fadeIn(10)
})}}g("#slideshow-nav"+h+" a.pause").click(function(){g(this).fadeOut(100,function(){g("#slideshow-nav"+h+" a.play").fadeIn(10)});if(psAudio[h]===true){g(this).parent().parent().nextAll(".haiku-text-player:first").jPlayer("pause")}g("#portfolio-slideshow"+h).cycle("pause")});g("#slideshow-nav"+h+" a.play").click(function(){g("#portfolio-slideshow"+h).cycle("resume");g(this).fadeOut(100,function(){g("#slideshow-nav"+h+" a.pause").fadeIn(10)});if(psAudio[h]===true){g(this).parent().parent().nextAll(".haiku-text-player:first").jPlayer("play")
}});g("#slideshow-nav"+h+" a.restart").click(function(){g("#pager"+h+" .numbers").empty();g(this).fadeOut(100,function(){g("#slideshow-nav"+h+" a.pause").fadeIn(10)});if(psAudio[h]===true){g(this).parent().parent().nextAll(".haiku-text-player:first").jPlayer("play")}if(psPagerStyle[h]==="numbers"){m()}else{o()}});g(window).resize(function(){g("#portfolio-slideshow"+h).css("width","").css("height","");var q,r;q=g("#portfolio-slideshow"+h).find(".slideshow-content").eq(currSlide[h]).outerHeight();r=g("#portfolio-slideshow"+h).find(".slideshow-content").eq(currSlide[h]).width();
g("#portfolio-slideshow"+h).css("height",q).css("width",r)});g("#slideshow-wrapper"+h+".hover .slideshow-content").hover(function(){g("#portfolio-slideshow"+h+" .slideshow-meta").fadeTo("fast",1)},function(){g("#portfolio-slideshow"+h+" .slideshow-meta").fadeTo("fast",0)});g(document).keydown(function(q){if(q.which==37){g("#psprev"+h).click()}else{if(q.which==39){g("#psnext"+h).click()}}});g("#portfolio-slideshow"+h+" .slideshow-content img").touchwipe({wipeLeft:function(){g("#psnext"+h).click()},wipeRight:function(){g("#psprev"+h).click()
}});function j(r,q){if(psPagerStyle[h]==="thumbs"){return"#pager"+h+" img:eq("+(r)+")"}if(psPagerStyle[h]==="bullets"){return"#pager"+h+" a:eq("+(r)+")"}}function p(u,r,s){tabSlide[h]=s.nextSlide+1;var v=Math.ceil(((tabSlide[h])/psCarouselSize[h])-1);g("#carouselnav"+h+" a").eq(v).click();var q,t;q=g(this).height();t=g(r).width();g("#portfolio-slideshow"+h).height(q).width(t)}function i(v,s,t){currSlide[h]=t.currSlide;var q,u;q=g(this).height();u=g(s).width();if(ie===true){g("#portfolio-slideshow"+h).height(q).width(u)
}if(psNoWrap[h]===true){if(t.currSlide===0){g("#slideshow-nav"+h+" .slideshow-prev, #slideshow-nav"+h+" .sep").addClass("inactive")}else{g("#slideshow-nav"+h+" .slideshow-prev, #slideshow-nav"+h+" .sep").removeClass("inactive")}if(t.currSlide===t.slideCount-1){g("#slideshow-nav"+h+" .slideshow-next, #slideshow-nav"+h+" .sep").addClass("inactive")}else{g("#slideshow-nav"+h+" .slideshow-next").removeClass("inactive")}}if(d===true){window.location.hash=t.currSlide+1}var r=(t.currSlide+1)+" "+a+" "+t.slideCount;
g(".slideshow-info"+h).html(r)}function k(){g("#slideshow-nav"+h+" .slideshow-next, #slideshow-nav"+h+" .sep").addClass("inactive");g("#slideshow-nav"+h+" a.pause").hide();g("#slideshow-nav"+h+" a.play").hide();g("#slideshow-nav"+h+" a.restart").show()}})})});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment