Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Minification of new changes. And some JS tidy up, too.

  • Loading branch information...
commit 66a1f6534e7e12e355dab9eaa308fbaf59869912 1 parent 75f7644
@matthewowen authored
Showing with 32 additions and 28 deletions.
  1. +25 −26 jesl/jesl.js
  2. +1 −1  jesl/jesl.min.css
  3. +6 −1 jesl/jesl.min.js
View
51 jesl/jesl.js
@@ -10,37 +10,36 @@ function jekyllSlideshow() {
},
switchImage: function (img) {
- var that = this;
- var newImg = $(img).clone().attr('src', $(img).attr('data-fullimage'))
+ var that = this, newImg = $(img).clone().attr('src', $(img).attr('data-fullimage'));
// when the image loads, align the lightbox
newImg.load(function () {
// change which image is shown in the lightbox
$('.jesl-box .image')
- .fadeOut(300, function(){
+ .fadeOut(300, function () {
$(this).html(newImg);
- $('.jesl-box .image').fadeIn(400, function(){
+ $('.jesl-box .image').fadeIn(400, function () {
// set the dimensions of the holder based on img width
$('.jesl-box')
- .animate({
- width: $('.jesl-box img').width(),
- height: $('.jesl-box img').height(),
- marginTop: (-$('.jesl-box img').height() / 2),
- marginLeft: (-$('.jesl-box img').width() / 2)
- }, 300, function(){
+ .animate({
+ width: $('.jesl-box img').width(),
+ height: $('.jesl-box img').height(),
+ marginTop: (-$('.jesl-box img').height() / 2),
+ marginLeft: (-$('.jesl-box img').width() / 2)
+ }, 300, function () {
// display the correct scroll arrows
- if ($(img).parent().prev().length) {
- $('.jesl-scroller.left').fadeIn(300);
- } else {
- $('.jesl-scroller.left').fadeOut(300);
- }
- if ($(img).parent().next().length) {
- $('.jesl-scroller.right').fadeIn(300);
- } else {
- $('.jesl-scroller.right').fadeOut(300);
- }
- });
+ if ($(img).parent().prev().length) {
+ $('.jesl-scroller.left').fadeIn(300);
+ } else {
+ $('.jesl-scroller.left').fadeOut(300);
+ }
+ if ($(img).parent().next().length) {
+ $('.jesl-scroller.right').fadeIn(300);
+ } else {
+ $('.jesl-scroller.right').fadeOut(300);
+ }
+ });
});
- })
+ });
});
// remember the current image
this.current = img;
@@ -60,15 +59,15 @@ function jekyllSlideshow() {
showLightbox: function () {
// show the lightbox
- $('.jesl-modal-overlay').fadeIn('fast', function(){
- $('.jesl-box').fadeIn('fast');
+ $('.jesl-modal-overlay').fadeIn('fast', function () {
+ $('.jesl-box').fadeIn(300);
});
},
hideLightbox: function () {
// hide the lightbox
- $('.jesl-box').fadeOut('fast', function(){
- $('.jesl-modal-overlay').fadeOut('fast');
+ $('.jesl-box').fadeOut(300, function () {
+ $('.jesl-modal-overlay').fadeOut(300);
});
},
View
2  jesl/jesl.min.css
@@ -1 +1 @@
-.jesl-modal-overlay{position:fixed;top:0;right:0;bottom:0;left:0;height:100%;width:100%;margin:0;padding:0;background:black;opacity:.75;filter:alpha(opacity=75);-moz-opacity:.75;z-index:50}.jesl-box{position:fixed;top:50%;left:50%;padding:0;z-index:55}.jesl-close-button{position:absolute;right:0;top:0;height:40px;width:40px;background:url('img/close-button.png') no-repeat;opacity:.5;-moz-transition:opacity .5s;-webkit-transition:opacity .5s;-o-transition:opacity .5s;transition:opacity .5s;z-index:66}.jesl-scroller{position:absolute;top:50%;margin-top:-50px;height:100px;width:30px;opacity:.5;-moz-transition:opacity .5s;-webkit-transition:opacity .5s;-o-transition:opacity .5s;transition:opacity .5s;z-index:66}.jesl-scroller:hover,.jesl-close-button:hover{opacity:1}.jesl-scroller.right{background:url('img/right-arrow.png') no-repeat;right:0}.jesl-scroller.left{background:url('img/left-arrow.png') no-repeat;left:0}.jesl-scroller-thumbs li{cursor:pointer}.jesl-scroller-thumbs li{display:inline-block;padding:0 4px 0 0}
+.jesl-modal-overlay{position:fixed;top:0;right:0;bottom:0;left:0;height:100%;width:100%;margin:0;padding:0;background:black;opacity:.75;filter:alpha(opacity=75);-moz-opacity:.75;z-index:50}.jesl-box{position:fixed;top:50%;left:50%;padding:0;z-index:55;overflow:hidden;height:0;width:0}.jesl-close-button{position:absolute;right:0;top:0;height:40px;width:40px;background:url('img/close-button.png') no-repeat;opacity:.5;-moz-transition:opacity .5s;-webkit-transition:opacity .5s;-o-transition:opacity .5s;transition:opacity .5s;z-index:66}.jesl-scroller{position:absolute;top:50%;margin-top:-50px;height:100px;width:30px;opacity:.5;-moz-transition:opacity .5s;-webkit-transition:opacity .5s;-o-transition:opacity .5s;transition:opacity .5s;z-index:66;display:none}.jesl-scroller:hover,.jesl-close-button:hover{opacity:1}.jesl-scroller.right{background:url('img/right-arrow.png') no-repeat;right:0}.jesl-scroller.left{background:url('img/left-arrow.png') no-repeat;left:0}.jesl-scroller-thumbs li{cursor:pointer}.jesl-scroller-thumbs li{display:inline-block;padding:0 4px 0 0}
View
7 jesl/jesl.min.js
@@ -1 +1,6 @@
-function jekyllSlideshow(){var a={findImagesInLists:function(){var b;$("ul:has(li:has(img[data-fullimage]))").addClass("jesl-scroller-thumbs");b=$("ul li img");return b},switchImage:function(b){var c=this;$(".jesl-box .image").html($(b).clone().attr("src",$(b).attr("data-fullimage")));$(".jesl-box .image img").load(function(){$(".jesl-box").css("marginTop",-$(".jesl-box img").height()/2).css("marginLeft",-$(".jesl-box img").width()/2)});this.current=b;if($(b).parent().prev().length){$(".jesl-scroller.left").css("display","block")}else{$(".jesl-scroller.left").css("display","none")}if($(b).parent().next().length){$(".jesl-scroller.right").css("display","block")}else{$(".jesl-scroller.right").css("display","none")}},scrollGallery:function(c){var b=this.current;if(b){if(c==="left"&&$(b).parent().prev().length){this.switchImage($(b).parent().prev().children()[0])}else{if(c==="right"&&$(b).parent().next().length){this.switchImage($(b).parent().next().children()[0])}}}},showLightbox:function(){$(".jesl-modal-overlay").css("display","block");$(".jesl-box").css("display","block")},hideLightbox:function(){$(".jesl-modal-overlay").css("display","none");$(".jesl-box").css("display","none")},init:function(){var b=this;$("body").append($('<div class="jesl-modal-overlay"></div>').hide().click(function(){b.hideLightbox()})).append($($('<div class="jesl-box"></div>').append($('<div class="jesl-close-button"></div>').click(function(){b.hideLightbox()})).append($('<div class="jesl-scroller left"></div>').click(function(){b.scrollGallery("left")})).append($('<div class="jesl-scroller right"></div>').click(function(){b.scrollGallery("right")})).append($('<div class="image"></div>')).hide()));this.findImagesInLists().click(function(){b.switchImage(this);b.showLightbox()});$(document).keydown(function(c){if(c.keyCode===27){b.hideLightbox()}if(c.keyCode===37){b.scrollGallery("left")}if(c.keyCode===39){b.scrollGallery("right")}})}};a.init()}$(document).ready(function(){jekyllSlideshow()});
+
+function jekyllSlideshow(){'use strict';var jesl={findImagesInLists:function(){var i;$('ul:has(li:has(img[data-fullimage]))').addClass('jesl-scroller-thumbs');i=$('ul li img');return i;},switchImage:function(img){var that=this,newImg=$(img).clone().attr('src',$(img).attr('data-fullimage'));newImg.load(function(){$('.jesl-box .image').fadeOut(300,function(){$(this).html(newImg);$('.jesl-box .image').fadeIn(400,function(){$('.jesl-box').animate({width:$('.jesl-box img').width(),height:$('.jesl-box img').height(),marginTop:(-$('.jesl-box img').height()/2),marginLeft:(-$('.jesl-box img').width()/2)},300,function(){if($(img).parent().prev().length){$('.jesl-scroller.left').fadeIn(300);}else{$('.jesl-scroller.left').fadeOut(300);}
+if($(img).parent().next().length){$('.jesl-scroller.right').fadeIn(300);}else{$('.jesl-scroller.right').fadeOut(300);}});});});});this.current=img;},scrollGallery:function(dir){var img=this.current;if(img){if(dir==='left'&&$(img).parent().prev().length){this.switchImage($(img).parent().prev().children()[0]);}else if(dir==='right'&&$(img).parent().next().length){this.switchImage($(img).parent().next().children()[0]);}}},showLightbox:function(){$('.jesl-modal-overlay').fadeIn('fast',function(){$('.jesl-box').fadeIn(300);});},hideLightbox:function(){$('.jesl-box').fadeOut(300,function(){$('.jesl-modal-overlay').fadeOut(300);});},init:function(){var that=this;$('body').append($('<div class="jesl-modal-overlay"></div>').hide().click(function(){that.hideLightbox();})).append($($('<div class="jesl-box"></div>').append($('<div class="jesl-close-button"></div>').click(function(){that.hideLightbox();})).append($('<div class="jesl-scroller left"></div>').click(function(){that.scrollGallery('left');})).append($('<div class="jesl-scroller right"></div>').click(function(){that.scrollGallery('right');})).append($('<div class="image"></div>')).hide()));this.findImagesInLists().click(function(){that.switchImage(this);that.showLightbox();});$(document).keydown(function(e){if(e.keyCode===27){that.hideLightbox();}
+if(e.keyCode===37){that.scrollGallery('left');}
+if(e.keyCode===39){that.scrollGallery('right');}});}};jesl.init();}
+$(document).ready(function(){'use strict';jekyllSlideshow();});
Please sign in to comment.
Something went wrong with that request. Please try again.