Skip to content

Instantly share code, notes, and snippets.

@jasonfroderman
Created June 27, 2014 21:37
Show Gist options
  • Select an option

  • Save jasonfroderman/3fb4cb876666634d4a53 to your computer and use it in GitHub Desktop.

Select an option

Save jasonfroderman/3fb4cb876666634d4a53 to your computer and use it in GitHub Desktop.
!function(e){Galleria.addTheme({name:"azur",author:"Galleria",css:"galleria.azur.css",defaults:{transition:"fade",transitionSpeed:500,imageCrop:true,thumbCrop:"height",idleMode:"hover",idleSpeed:500,fullscreenTransition:false,_locale:{show_captions:"Show captions",hide_captions:"Hide captions",play:"Play slideshow",pause:"Pause slideshow",enter_fullscreen:"Enter fullscreen",exit_fullscreen:"Exit fullscreen",next:"Next image",prev:"Previous image",showing_image:"Showing image %s of %s"},_toggleCaption:true,_showCaption:true,_showTooltip:true},init:function(t){Galleria.requires(1.33,"This version of Azur theme requires Galleria version 1.3.3 or later");this.addElement("bar","fullscreen","play","progress").append({stage:"progress",container:"bar",bar:["fullscreen","play","thumbnails-container"]}).prependChild("stage","info").appendChild("container","tooltip");var i=this,a=window.document,n=t._locale,o="getContext"in a.createElement("canvas");!function(){if(!o){i.addElement("progressbar").appendChild("progress","progressbar");i.$("progress").addClass("nocanvas");var t=i.$("progress").width();i.bind("progress",function(e){i.$("progressbar").width(e.percent/100*t)});return}var n=24,s=a.createElement("canvas"),r=s.getContext("2d"),l=function(e){return e*(Math.PI/180)},c=function(e,t){r.strokeStyle=t||"#000";r.lineWidth=3;r.clearRect(0,0,n,n);r.beginPath();r.arc(n/2,n/2,n/2-2,l(-90),l(e-90),false);r.stroke();r.closePath()};s.width=n;s.height=n;e(s).css({zIndex:1e4,position:"absolute",right:10,top:10}).appendTo(i.get("container"));i.bind("progress",function(t){e(s).fadeIn(200);c(t.percent*3.6,"rgba(255,255,255,.7)")});i.bind("pause",function(){e(s).fadeOut(200,function(){r.clearRect(0,0,n,n)})})}();!function(){var t=function(){var e="RequestAnimationFrame";return window.requestAnimationFrame||window["webkit"+e]||window["moz"+e]||window["o"+e]||window["ms"+e]||function(e){window.setTimeout(e,1e3/60)}}();if(!o){i.$("loader").addClass("nocanvas");return}var n=a.createElement("canvas"),s=n.getContext("2d"),r=Math,l=function(e,t,i){var a=i?-2:2;e.translate(t/a,t/a)},c=28;e(n).hide().appendTo(i.get("loader")).fadeIn(500);var d=function(e,t){var i=48,a=28,n;e.clearRect(0,0,i,i);e.lineWidth=1.5;for(var o=0;o<a;o++){n=o+t>=a?o-a+t:o+t;e.strokeStyle="rgba(255,255,255,"+r.max(0,n/a)+")";e.lineWidth=1;e.beginPath();e.moveTo(i/2,i/2-16);e.lineTo(i/2,0);e.stroke();l(e,i,false);e.rotate(360/a*r.PI/180);l(e,i,true)}e.save();l(e,i,false);e.rotate(-1*(360/a/8)*r.PI/180);l(e,i,true)};!function p(){t(p);d(s,c);c=c===0?28:c-1}()}();var s=Galleria.IE<9?{bottom:-100}:{bottom:-50,opacity:0},r=Galleria.IE<9?{top:-20}:{opacity:0,top:-20};this.bind("play",function(){this.$("play").addClass("pause");if(!o){this.$("progress").show()}}).bind("pause",function(){this.$("play").removeClass("pause");if(!o){this.$("progress").hide()}}).bind("loadstart",function(e){if(!e.cached){this.$("loader").show()}}).bind("loadfinish",function(e){if(o){this.$("loader").fadeOut(100)}else{this.$("loader").hide()}});this.addIdleState(this.get("info"),s,Galleria.IE<9?{}:{opacity:1},true).addIdleState(this.get("image-nav-left"),{opacity:0,left:0},{opacity:1},true).addIdleState(this.get("image-nav-right"),{opacity:0,right:0},{opacity:1},true).addIdleState(this.get("counter"),r,Galleria.IE<9?{}:{opacity:.9},true);this.$("fullscreen").on("click:fast",function(e){e.preventDefault();i.toggleFullscreen()});this.$("play").on("click:fast",function(e){e.preventDefault();i.playToggle()});if(t._toggleCaption){this.$("info").addClass("toggler");this.addElement("captionopen").appendChild("stage","captionopen");this.addElement("captionclose").appendChild("info","captionclose");this.$("captionopen").on("click:fast",function(){i.$("info").addClass("open");e(this).hide()}).html(n.show_captions);this.bind("loadstart",function(){this.$("captionopen").toggle(!i.$("info").hasClass("open")&&this.hasInfo())});this.$("captionclose").on("click:fast",function(){i.$("info").removeClass("open");if(i.hasInfo()){i.$("captionopen").show()}}).html("&#215;");if(t._showCaption){this.$("captionopen").trigger("click:fast")}}if(t._showTooltip){this.bindTooltip({fullscreen:function(){return i.isFullscreen()?n.exit_fullscreen:n.enter_fullscreen},play:function(){return i.isPlaying()?n.pause:n.play},captionclose:n.hide_captions,"image-nav-right":n.next,"image-nav-left":n.prev,counter:function(){return n.showing_image.replace(/\%s/,i.getIndex()+1).replace(/\%s/,i.getDataLength())}})}}})}(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment