Browse Source

Wait for images to load to populate EXIF data

Closes #16
master
Christopher Schäpers 4 weeks ago
parent
commit
f032cb975c
2 changed files with 6 additions and 4 deletions
  1. +5
    -3
      assets/js/main.js
  2. +1
    -1
      assets/js/main.min.js

+ 5
- 3
assets/js/main.js View File

@@ -253,9 +253,11 @@
$image.trigger('click');
});

// EXIF data
EXIF.getData($image_img[0], function () {
exifDatas[$image_img.data('name')] = getExifDataMarkup(this);
// Fill exif data, when image is loaded
$image_img[0].addEventListener("load", function() {
EXIF.getData($image_img[0], function () {
exifDatas[$image_img.data('name')] = getExifDataMarkup(this);
});
});

});

+ 1
- 1
assets/js/main.min.js View File

@@ -1 +1 @@
!function(e){skel.breakpoints({xlarge:"(max-width: 1680px)",large:"(max-width: 1280px)",medium:"(max-width: 980px)",small:"(max-width: 736px)",xsmall:"(max-width: 480px)"}),e(function(){var o,a=e(window),n=e("body");e("#wrapper");(skel.vars.IEVersion<12&&n.addClass("ie"),skel.vars.mobile&&n.addClass("touch"),skel.canUse("transition"))&&(n.addClass("loading"),a.on("load",function(){window.setTimeout(function(){n.removeClass("loading")},100)}),a.on("resize",function(){window.clearTimeout(o),n.addClass("resizing"),o=window.setTimeout(function(){n.removeClass("resizing")},100)}));a.scrollTop(0),e("form").placeholder();var i=e(".panel");i.each(function(){var o=e(this),a=e('[href="#'+o.attr("id")+'"]');e('<div class="closer" />').appendTo(o).on("click",function(e){o.trigger("---hide")}),o.on("click",function(e){e.stopPropagation()}).on("---toggle",function(){o.hasClass("active")?o.triggerHandler("---hide"):o.triggerHandler("---show")}).on("---show",function(){n.hasClass("content-active")&&i.trigger("---hide"),o.addClass("active"),a.addClass("active"),n.addClass("content-active")}).on("---hide",function(){o.removeClass("active"),a.removeClass("active"),n.removeClass("content-active")}),a.removeAttr("href").css("cursor","pointer").on("click",function(e){e.preventDefault(),e.stopPropagation(),o.trigger("---toggle")})}),n.on("click",function(e){n.hasClass("content-active")&&(e.preventDefault(),e.stopPropagation(),i.trigger("---hide"))}),a.on("keyup",function(e){27==e.keyCode&&n.hasClass("content-active")&&(e.preventDefault(),e.stopPropagation(),i.trigger("---hide"))}),e("#header").find("a").each(function(){var o=e(this),a=o.attr("href");a&&"#"!=a.charAt(0)&&o.removeAttr("href").css("cursor","pointer").on("click",function(e){e.preventDefault(),e.stopPropagation(),window.location.href=a})}),e("#footer").find(".copyright").each(function(){var o=e(this),a=o.parent(),n=a.parent().children().last();skel.on("+medium",function(){o.appendTo(n)}).on("-medium",function(){o.appendTo(a)})});var t=e("#main"),r={};function s(o){var a=e("#main").data("exif-display"),n="";for(var i in a){var t=a[i],r=EXIF.getTag(o,t.tag);void 0!==r&&(n+='<i class="fa fa-'+t.icon+'" aria-hidden="true"></i> '+r+"&nbsp;&nbsp;")}return n}t.children(".thumb").each(function(){var o,a=e(this),n=a.find(".image"),i=n.children("img");0!=n.length&&(n.css("background-image","url("+i.attr("src")+")"),(o=i.data("position"))&&n.css("background-position",o),i.hide(),skel.vars.IEVersion<11&&a.css("cursor","pointer").on("click",function(){n.trigger("click")}),EXIF.getData(i[0],function(){r[i.data("name")]=s(this)}))}),t.poptrox({baseZIndex:2e4,caption:function(e){var o=e.children("img"),a=r[o.data("name")];return void 0===a&&EXIF.getData(o[0],function(){a=r[o.data("name")]=s(this)}),void 0!==a?"<p>"+a+"</p>":" "},fadeSpeed:300,onPopupClose:function(){n.removeClass("modal-active")},onPopupOpen:function(){n.addClass("modal-active")},overlayOpacity:0,popupCloserText:"",popupHeight:150,popupLoaderText:"",popupSpeed:300,popupWidth:150,selector:".thumb > a.image",usePopupCaption:!0,usePopupCloser:!0,usePopupDefaultStyling:!1,usePopupForceClose:!0,usePopupLoader:!0,usePopupNav:!0,windowMargin:50}),skel.on("-xsmall",function(){t[0]._poptrox.windowMargin=50}).on("+xsmall",function(){t[0]._poptrox.windowMargin=0})})}(jQuery);
!function(e){skel.breakpoints({xlarge:"(max-width: 1680px)",large:"(max-width: 1280px)",medium:"(max-width: 980px)",small:"(max-width: 736px)",xsmall:"(max-width: 480px)"}),e(function(){var o,n=e(window),a=e("body");e("#wrapper");(skel.vars.IEVersion<12&&a.addClass("ie"),skel.vars.mobile&&a.addClass("touch"),skel.canUse("transition"))&&(a.addClass("loading"),n.on("load",function(){window.setTimeout(function(){a.removeClass("loading")},100)}),n.on("resize",function(){window.clearTimeout(o),a.addClass("resizing"),o=window.setTimeout(function(){a.removeClass("resizing")},100)}));n.scrollTop(0),e("form").placeholder();var i=e(".panel");i.each(function(){var o=e(this),n=e('[href="#'+o.attr("id")+'"]');e('<div class="closer" />').appendTo(o).on("click",function(e){o.trigger("---hide")}),o.on("click",function(e){e.stopPropagation()}).on("---toggle",function(){o.hasClass("active")?o.triggerHandler("---hide"):o.triggerHandler("---show")}).on("---show",function(){a.hasClass("content-active")&&i.trigger("---hide"),o.addClass("active"),n.addClass("active"),a.addClass("content-active")}).on("---hide",function(){o.removeClass("active"),n.removeClass("active"),a.removeClass("content-active")}),n.removeAttr("href").css("cursor","pointer").on("click",function(e){e.preventDefault(),e.stopPropagation(),o.trigger("---toggle")})}),a.on("click",function(e){a.hasClass("content-active")&&(e.preventDefault(),e.stopPropagation(),i.trigger("---hide"))}),n.on("keyup",function(e){27==e.keyCode&&a.hasClass("content-active")&&(e.preventDefault(),e.stopPropagation(),i.trigger("---hide"))}),e("#header").find("a").each(function(){var o=e(this),n=o.attr("href");n&&"#"!=n.charAt(0)&&o.removeAttr("href").css("cursor","pointer").on("click",function(e){e.preventDefault(),e.stopPropagation(),window.location.href=n})}),e("#footer").find(".copyright").each(function(){var o=e(this),n=o.parent(),a=n.parent().children().last();skel.on("+medium",function(){o.appendTo(a)}).on("-medium",function(){o.appendTo(n)})});var t=e("#main"),r={};function s(o){var n=e("#main").data("exif-display"),a="";for(var i in n){var t=n[i],r=EXIF.getTag(o,t.tag);void 0!==r&&(a+='<i class="fa fa-'+t.icon+'" aria-hidden="true"></i> '+r+"&nbsp;&nbsp;")}return a}t.children(".thumb").each(function(){var o,n=e(this),a=n.find(".image"),i=a.children("img");0!=a.length&&(a.css("background-image","url("+i.attr("src")+")"),(o=i.data("position"))&&a.css("background-position",o),i.hide(),skel.vars.IEVersion<11&&n.css("cursor","pointer").on("click",function(){a.trigger("click")}),i[0].addEventListener("load",function(){EXIF.getData(i[0],function(){r[i.data("name")]=s(this)})}))}),t.poptrox({baseZIndex:2e4,caption:function(e){var o=e.children("img"),n=r[o.data("name")];return void 0===n&&EXIF.getData(o[0],function(){n=r[o.data("name")]=s(this)}),void 0!==n?"<p>"+n+"</p>":" "},fadeSpeed:300,onPopupClose:function(){a.removeClass("modal-active")},onPopupOpen:function(){a.addClass("modal-active")},overlayOpacity:0,popupCloserText:"",popupHeight:150,popupLoaderText:"",popupSpeed:300,popupWidth:150,selector:".thumb > a.image",usePopupCaption:!0,usePopupCloser:!0,usePopupDefaultStyling:!1,usePopupForceClose:!0,usePopupLoader:!0,usePopupNav:!0,windowMargin:50}),skel.on("-xsmall",function(){t[0]._poptrox.windowMargin=50}).on("+xsmall",function(){t[0]._poptrox.windowMargin=0})})}(jQuery);

Loading…
Cancel
Save