mirror of
https://github.com/a2nt/meta-lightbox.git
synced 2024-10-22 17:05:53 +02:00
Minor updates
This commit is contained in:
parent
953d9d17ff
commit
f4cff931b7
@ -2,6 +2,12 @@
|
|||||||
// http://eslint.org/docs/rules/
|
// http://eslint.org/docs/rules/
|
||||||
"extends": "eslint:recommended",
|
"extends": "eslint:recommended",
|
||||||
|
|
||||||
|
"settings": {
|
||||||
|
"react": {
|
||||||
|
"version": "detect"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
"env": {
|
"env": {
|
||||||
"browser": true, // browser global variables.
|
"browser": true, // browser global variables.
|
||||||
"node": true, // Node.js global variables and Node.js-specific rules.
|
"node": true, // Node.js global variables and Node.js-specific rules.
|
||||||
|
1
dist/css/main.css
vendored
1
dist/css/main.css
vendored
@ -1 +0,0 @@
|
|||||||
.meta-lightbox-overlay{position:fixed;top:0;left:0;z-index:99998;width:100%;height:100%;overflow:hidden;visibility:hidden;opacity:0;-webkit-box-sizing:border-box;box-sizing:border-box}.meta-lightbox-overlay.meta-lightbox-open{visibility:visible;opacity:1}.meta-lightbox-wrap{position:absolute;top:10%;bottom:10%;left:10%;right:10%}.meta-lightbox-content{width:100%;height:100%}.meta-lightbox-content .meta-lightbox-zoom-wrapper{display:block;height:100%;width:100%}.meta-lightbox-content .meta-lightbox-zoom-wrapper:after{color:#fff;font:normal normal normal 14px/1 FontAwesome;content:"\f00e";position:absolute;bottom:1em;right:1em;text-shadow:1px 1px 1px #000}.meta-lightbox-title-wrap{position:absolute;bottom:0;left:0;width:100%;z-index:99999;text-align:center}.meta-lightbox-nav{display:none}.meta-lightbox-prev{position:absolute;top:50%;left:0}.meta-lightbox-next{position:absolute;top:50%;right:0}.meta-lightbox-close{position:absolute;top:2%;right:2%}.meta-lightbox-image{text-align:center}.meta-lightbox-image img{max-width:100%;max-height:100%;width:auto;height:auto;vertical-align:middle}.meta-lightbox-content iframe{width:100%;height:100%}.meta-lightbox-ajax,.meta-lightbox-inline{max-height:100%;overflow:auto}.meta-lightbox-error{display:table;text-align:center;width:100%;height:100%;color:#fff;text-shadow:0 1px 1px #000}.meta-lightbox-error p{display:table-cell;vertical-align:middle}.meta-lightbox-notouch .meta-lightbox-effect-fade,.meta-lightbox-notouch .meta-lightbox-effect-fadeScale,.meta-lightbox-notouch .meta-lightbox-effect-fall,.meta-lightbox-notouch .meta-lightbox-effect-slideDown,.meta-lightbox-notouch .meta-lightbox-effect-slideLeft,.meta-lightbox-notouch .meta-lightbox-effect-slideRight,.meta-lightbox-notouch .meta-lightbox-effect-slideUp{-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.meta-lightbox-effect-fadeScale .meta-lightbox-wrap{-webkit-transition:all .3s;transition:all .3s;-webkit-transform:scale(.7);transform:scale(.7)}.meta-lightbox-effect-fadeScale.meta-lightbox-open .meta-lightbox-wrap{-webkit-transform:scale(1);transform:scale(1)}.meta-lightbox-effect-slideDown .meta-lightbox-wrap,.meta-lightbox-effect-slideLeft .meta-lightbox-wrap,.meta-lightbox-effect-slideRight .meta-lightbox-wrap,.meta-lightbox-effect-slideUp .meta-lightbox-wrap{-webkit-transition:all .3s cubic-bezier(.25,.5,.5,.9);transition:all .3s cubic-bezier(.25,.5,.5,.9)}.meta-lightbox-effect-slideLeft .meta-lightbox-wrap{-webkit-transform:translateX(-10%);transform:translateX(-10%)}.meta-lightbox-effect-slideRight .meta-lightbox-wrap{-webkit-transform:translateX(10%);transform:translateX(10%)}.meta-lightbox-effect-slideLeft.meta-lightbox-open .meta-lightbox-wrap,.meta-lightbox-effect-slideRight.meta-lightbox-open .meta-lightbox-wrap{-webkit-transform:translateX(0);transform:translateX(0)}.meta-lightbox-effect-slideDown .meta-lightbox-wrap{-webkit-transform:translateY(-10%);transform:translateY(-10%)}.meta-lightbox-effect-slideUp .meta-lightbox-wrap{-webkit-transform:translateY(10%);transform:translateY(10%)}.meta-lightbox-effect-slideDown.meta-lightbox-open .meta-lightbox-wrap,.meta-lightbox-effect-slideUp.meta-lightbox-open .meta-lightbox-wrap{-webkit-transform:translateY(0);transform:translateY(0)}.meta-lightbox-body-effect-fall .meta-lightbox-effect-fall{-webkit-perspective:1000px;perspective:1000px}.meta-lightbox-effect-fall .meta-lightbox-wrap{-webkit-transition:all .3s ease-out;transition:all .3s ease-out;-webkit-transform:translateZ(300px);transform:translateZ(300px)}.meta-lightbox-effect-fall.meta-lightbox-open .meta-lightbox-wrap{-webkit-transform:translateZ(0);transform:translateZ(0)}.meta-lightbox-theme-default.meta-lightbox-overlay{background:#666;background:rgba(0,0,0,.6)}.meta-lightbox-theme-default .meta-lightbox-nav{top:10%;width:8%;height:80%;background-repeat:no-repeat;background-position:50% 50%;opacity:.5;color:#fff;font-size:3em;text-decoration:none;text-shadow:1px 1px 0 #000}.meta-lightbox-theme-default .meta-lightbox-nav .fa{position:absolute;top:50%;left:50%;margin-top:-1em;margin-left:-.2em}.meta-lightbox-theme-default .meta-lightbox-nav:hover{color:#007bff;opacity:1;background-color:rgba(0,0,0,.5)}.meta-lightbox-theme-default .meta-lightbox-close{display:block;opacity:.5;color:#fff;text-decoration:none;font-size:2em;text-shadow:1px 1px 0 #000;text-align:center;width:1.2em;height:1.2em}.meta-lightbox-theme-default .meta-lightbox-close:focus{color:#007bff;opacity:1;background-color:rgba(0,0,0,.5)}.meta-lightbox-theme-default .meta-lightbox-title{background:#000;color:#fff;padding:7px 15px}.meta-lightbox-theme-default .meta-lightbox-ajax,.meta-lightbox-theme-default .meta-lightbox-inline{background:#fff;padding:2em;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.4);box-shadow:0 1px 1px rgba(0,0,0,.4)}@media (max-width:576px){.meta-lightbox-wrap{top:5px!important;bottom:5px;left:5px;right:5px}.meta-lightbox-theme-default .meta-lightbox-nav{height:100%;opacity:1;font-size:2em}.meta-lightbox-theme-default .meta-lightbox-nav .fa{margin-left:-.4em}.meta-lightbox-theme-default .meta-lightbox-close{opacity:1}}
|
|
3
dist/index.html
vendored
3
dist/index.html
vendored
@ -1,3 +0,0 @@
|
|||||||
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="description" content=""><meta name="author" content=""><link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"><link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.0/css/all.css"><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script><title>Meta-lightbox Demo</title><style>.wrapper {
|
|
||||||
padding: 2rem;
|
|
||||||
}</style><link href="css/main.css" rel="stylesheet"></head><body><div class="wrapper"><h1>Meta-lightbox Demo</h1><p><a href="../src/img/photo1.png" data-toggle="lightbox" data-lightbox-gallery="demo" data-title="That's first link">Click me to start</a></p><p><a href="../src/img/photo2.jpg" data-toggle="lightbox" data-lightbox-gallery="demo">Use data-toggle="lightbox" attribute to attach lightbox action and href to specify URL.</a></p><p><a href="../src/img/photo1.png" data-toggle="lightbox" data-lightbox-gallery="demo" data-title="Use data-title attribute to specify lightbox title">Use data-lightbox-gallery="YOUR_GALLERY_NAME" to group ligthboxes and use next/prev arrows</a></p><p data-toggle="lightbox" data-href="https://youtu.be/GgnClrx8N2k" data-lightbox-gallery="demo" data-title="Yes you can link vimeo and youtube videos as long as AJAX content">You can use data-href attribute to specify link and attach lightbox to another element</p><p><b>Note:</b> You can add jquery-zoom plugin and lighbox will zoom photos on hover.</p></div><script src="js/index.js"></script></body></html>
|
|
2
dist/js/index.js
vendored
2
dist/js/index.js
vendored
@ -1,2 +0,0 @@
|
|||||||
/*! For license information please see index.js.LICENSE */
|
|
||||||
!function(t){var e={};function o(i){if(e[i])return e[i].exports;var a=e[i]={i:i,l:!1,exports:{}};return t[i].call(a.exports,a,a.exports,o),a.l=!0,a.exports}o.m=t,o.c=e,o.d=function(t,e,i){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(o.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)o.d(i,a,function(e){return t[e]}.bind(null,a));return i},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s="./src/js/index.js")}({"./src/js/index.js":function(t,e,o){"use strict";o.r(e);o("./src/scss/index.scss"),o("./src/js/meta-lightbox.js")},"./src/js/meta-lightbox.js":function(t,e){var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(t,e,i){var a="metaLightbox",n={effect:"fade",theme:"default",keyboardNav:!0,clickOverlayToClose:!0,onInit:function(){},beforeShowLightbox:function(){},afterShowLightbox:function(t){},beforeHideLightbox:function(){},afterHideLightbox:function(){},onPrev:function(t){},onNext:function(t){},errorMessage:"The requested content cannot be loaded. Please try again later."};function l(e,o){this.options=t.extend({},n,o),this._defaults=n,this._name=a,this.init()}l.prototype={init:function(){var e=this,o=t("html");this.ajaxLoaded=!1,i.MetaLightbox=this,o.hasClass("meta-lightbox-notouch")||o.addClass("meta-lightbox-notouch"),"ontouchstart"in i&&o.removeClass("meta-lightbox-notouch"),t(i).on("click",'[data-toggle="lightbox"],[data-lightbox-gallery]',(function(t){return t.preventDefault(),t.stopPropagation(),e.showLightbox(this),!1})),this.options.keyboardNav&&t("body").off("keyup").on("keyup",(function(o){var i=o.keyCode?o.keyCode:o.which;27===i&&e.destructLightbox(),37===i&&t(".meta-lightbox-prev").trigger("click"),39===i&&t(".meta-lightbox-next").trigger("click")})),this.options.onInit.call(this)},showLightbox:function(e){this.el=e,this.$el=t(this.el);var o,i,a,n,l=this;this.options.beforeShowLightbox.call(this),(o=this.constructLightbox())&&(i=o.find(".meta-lightbox-content"))&&(a=this.$el,t("body").addClass("meta-lightbox-body-effect-"+this.options.effect),this.processContent(i,a),this.$el.data("lightbox-gallery")&&(1===(n=t('[data-lightbox-gallery="'+this.$el.data("lightbox-gallery")+'"]')).length?t(".meta-lightbox-nav").hide():t(".meta-lightbox-nav").show(),t(".meta-lightbox-prev").off("click").on("click",(function(e){e.preventDefault();var o=n.index(a);a=n.eq(o-1),t(a).length||(a=n.last()),l.processContent(i,a),l.options.onPrev.call(this,[a])})),t(".meta-lightbox-next").off("click").on("click",(function(e){e.preventDefault();var o=n.index(a);a=n.eq(o+1),t(a).length||(a=n.first()),l.processContent(i,a),l.options.onNext.call(this,[a])}))),setTimeout((function(){o.addClass("meta-lightbox-open"),l.options.afterShowLightbox.call(this,[o])}),1))},processContent:function(a,n){var l,s,r,h,c,g,d=this;href=n.attr("href"),href||(href=n.data("href")),a.html("").addClass("meta-lightbox-loading"),this.isHidpi()&&n.data("lightbox-hidpi")&&(href=n.data("lightbox-hidpi")),null!=href.match(/\.(jpeg|jpg|gif|png)$/i)?((l=t("<img>",{src:href})).on("load",(function(){var o=t('<div class="meta-lightbox-image"></div>'),i=t(".meta-lightbox-content"),n=t('<span class="meta-lightbox-zoom-wrapper"></span>');n.append(l),o.append(n),o.css({"line-height":i.height()+"px",height:i.height()+"px"}),t(e).resize((function(){o.css({"line-height":i.height()+"px",height:i.height()+"px"})})),void 0!==n.zoom&&n.zoom(),a.html(o).removeClass("meta-lightbox-loading"),d.contentLoaded()})),l.on("error",(function(){var e=t('<div class="meta-lightbox-error"><p>'+d.options.errorMessage+"</p></div>");a.html(e).removeClass("meta-lightbox-loading"),d.contentLoaded()})),n.data("title")?d.setTitle(n.data("title")):n.attr("title")?d.setTitle(n.attr("title")):t(".meta-lightbox-title-wrap").html(""),"function"==typeof ga&&ga("send","event","meta","Image Click",href)):(s=href.match(/(youtube|youtube-nocookie|youtu|vimeo)\.(com|be)\/(watch\?v=([\w-]+)|([\w-]+))/))?(r="",h="meta-lightbox-video","youtube"==s[1]&&(r="https://www.youtube.com/embed/"+s[4],h="meta-lightbox-youtube"),"youtu"==s[1]&&(r="https://www.youtube.com/embed/"+s[3],h="meta-lightbox-youtube"),"youtube-nocookie"==s[1]&&(r="https://www.youtube-nocookie.com/embed/"+s[4],h="nivo-lightbox-youtube"),"vimeo"==s[1]&&(r="https://player.vimeo.com/video/"+s[3],h="meta-lightbox-vimeo"),r&&(c=t("<iframe>",{src:r,class:h,frameborder:0,vspace:0,hspace:0,scrolling:"auto"}),a.html(c),c.on("load",(function(){a.removeClass("meta-lightbox-loading"),d.contentLoaded()}))),n.data("title")?d.setTitle(n.data("title")):n.attr("title")?d.setTitle(n.attr("title")):t(".meta-lightbox-title-wrap").html(""),"function"==typeof ga&&ga("send","event","meta","Video Click",s)):"#"==href.substring(0,1)?(t(href).length?((g=t('<div class="meta-lightbox-inline" />')).append(t(href).clone().show()),g.outerHeight()<a.height()&&g.css({position:"relative",top:"50%","margin-top":-g.outerHeight()/2+"px"}),t(e).resize((function(){g.outerHeight()<a.height()&&g.css({position:"relative",top:"50%","margin-top":-g.outerHeight()/2+"px"})})),a.html(g).removeClass("meta-lightbox-loading"),d.contentLoaded()):(g=t('<div class="meta-lightbox-error"><p>'+d.options.errorMessage+"</p></div>"),a.html(g).removeClass("meta-lightbox-loading"),d.contentLoaded()),t(".meta-lightbox-title-wrap").html(""),"function"==typeof ga&&ga("send","event","meta","inline HTML click",href)):t.ajax({sync:!1,async:!0,url:href,dataType:"html",method:"GET",cache:!1,statusCode:{404:function(){console.log("page not found"),e.location.href=url},302:function(){console.log("redirect 302"),e.location.href=url}},error:function(e){console.log("AJAX request failure."+e.statusText);var o=t('<div class="meta-lightbox-error"><p>'+d.options.errorMessage+"</p></div>");a.html(o).removeClass("meta-lightbox-loading"),d.contentLoaded(),"function"==typeof ga&&ga("send","event","error","AJAX ERROR",e.statusText)},success:function(n,l,s){try{var r=t.parseJSON(n);if("object"===(void 0===r?"undefined":o(r))){if("object"===o(r.regions)&&"undefinded"!=typeof r.regions.LayoutAjax)(g=t('<div class="meta-lightbox-ajax" />')).html(r.regions.LayoutAjax),a.html(g).removeClass("meta-lightbox-loading");var h=s.getResponseHeader("X-Title"),c=s.getResponseHeader("X-Link");h&&h.length&&c&&c.length&&c!==e.location.href&&c.substring(0,c.indexOf("#"))!==e.location.href.replace(t("base").attr("href"),"/")&&(t(".meta-lightbox-ajax").data("curr-title",i.title),t(".meta-lightbox-ajax").data("curr-link",e.location.href),void 0!==e.localStorage&&"/"!==c&&e.localStorage.setItem("current-page",c),i.URL!==c&&i.URL!==t("base").attr("href")+c&&i.URL!==t("base").attr("href")+"/"+c&&e.history.pushState({title:h,page:c,ajax:"true"},h,c),t(".meta-lightbox-title-wrap").html(""),"function"==typeof ga&&(ga("set",{page:c.replace(t("base").attr("href"),""),title:h}),ga("send","pageview")))}}catch(e){var g;(g=t('<div class="meta-lightbox-ajax" />')).append(n),a.html(g).removeClass("meta-lightbox-loading")}g.outerHeight()<a.height()&&g.css({position:"relative",top:"50%","margin-top":-g.outerHeight()/2+"px"}),t(e).resize((function(){g.outerHeight()<a.height()&&g.css({position:"relative",top:"50%","margin-top":-g.outerHeight()/2+"px"})})),setTimeout((function(){t(e).resize(),e.imagesLoaded().then((function(){t(e).resize()}))}),500),d.contentLoaded()}})},setTitle:function(e){var o=t("<div>",{class:"meta-lightbox-title"});o.text(e),t(".meta-lightbox-title-wrap").html(o)},contentLoaded:function(){setTimeout((function(){t(e).trigger("meta-lightbox-loaded")}),1),setTimeout((function(){t("body").addClass("meta-lightbox-body-effect-fade")}),600)},constructLightbox:function(){var e=this,o=t("<div>",{class:"meta-lightbox-overlay meta-lightbox-theme-"+this.options.theme+" meta-lightbox-effect-"+this.options.effect}),i=t("<div>",{class:"meta-lightbox-wrap"}),a=t("<div>",{class:"meta-lightbox-content"}),n=t('<a href="#" class="meta-lightbox-nav meta-lightbox-prev"><i class="fa fa-chevron-left"></i> <span class="sr-only">Previous</span></a><a href="#" class="meta-lightbox-nav meta-lightbox-next"><i class="fa fa-chevron-right"></i> <span class="sr-only">Next</span></a>'),l=t('<a href="#" class="meta-lightbox-close fa fa-times" title="Close"><span class="sr-only">Close</span></a>'),s=t("<div>",{class:"meta-lightbox-title-wrap"}),r=t(".meta-lightbox-overlay");return r.length?r:(i.append(a),i.append(s),o.append(i),o.append(n),o.append(l),t("body").append(o),e.options.clickOverlayToClose&&o.on("click",(function(o){var i=t(o.target);(i.hasClass("meta-lightbox-zoom-wrapper")||i.hasClass("meta-lightbox-content")||i.hasClass("meta-lightbox-wrap")||i.hasClass("meta-lightbox-image")||i.hasClass("meta-lightbox-overlay"))&&e.destructLightbox()})),l.on("click",(function(t){t.preventDefault(),e.destructLightbox()})),o)},destructLightbox:function(){var o=t(".meta-lightbox-overlay");this.options.beforeHideLightbox.call(this);var a=t(".meta-lightbox-ajax").data("curr-title"),n=t(".meta-lightbox-ajax").data("curr-link");a&&n&&(void 0!==e.localStorage&&"/"!==n&&e.localStorage.setItem("current-page",n),i.URL!==n&&i.URL!==t("base").attr("href")+n&&i.URL!==t("base").attr("href")+"/"+n&&e.history.replaceState({title:a,page:n,ajax:"true"},a,n)),o.removeClass("meta-lightbox-open"),t(".meta-lightbox-nav").hide(),t("body").removeClass("meta-lightbox-body-effect-"+this.options.effect),t(".meta-lightbox-content .meta-lightbox-zoom-wrapper").trigger("zoom.destroy"),t(".meta-lightbox-prev").off("click"),t(".meta-lightbox-next").off("click"),t(".meta-lightbox-content").empty(),t("body").removeClass("meta-lightbox-body-effect-fade"),this.options.afterHideLightbox.call(this)},isHidpi:function(){return e.devicePixelRatio>1||e.matchMedia&&e.matchMedia("(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx)").matches}},t.fn[a]=function(e){return this.each((function(){t.data(this,a)||t.data(this,a,new l(this,e))}))},t(i).metaLightbox()}(jQuery,this,document)},"./src/scss/index.scss":function(t,e){}});
|
|
1
dist/js/index.js.LICENSE
vendored
1
dist/js/index.js.LICENSE
vendored
@ -1 +0,0 @@
|
|||||||
/*@cc_on!@*/
|
|
Loading…
Reference in New Issue
Block a user