diff --git a/angular-photoswipe.js b/angular-photoswipe.js index 1063c05..647cb38 100644 --- a/angular-photoswipe.js +++ b/angular-photoswipe.js @@ -43,6 +43,7 @@ scope.start = function () { scope.open = true; + scope.options = {}; startGallery(); }; @@ -52,7 +53,7 @@ if (angular.isUndefined(scope.options.getThumbBoundsFn) && angular.isDefined(scope.slideSelector)) { - scope.options = angular.merge({}, { + scope.options = angular.merge(scope.options, { getThumbBoundsFn: function(index) { var thumbnail = document.querySelectorAll(scope.slideSelector)[index]; diff --git a/angular-photoswipe.min.js b/angular-photoswipe.min.js index ac60105..3219019 100644 --- a/angular-photoswipe.min.js +++ b/angular-photoswipe.min.js @@ -1,8 +1,8 @@ /* ng-photoswipe v0.2.0 - (c) 2016 Massimiliano Sartoretto + (c) 2018 Massimiliano Sartoretto License: MIT */ -"format amd";!function(){"use strict";function a(a){function b(b,c,d){function e(e,f){e.template=e.template||"views/ng-photoswipe.html",c.get(e.template,{cache:d}).then(function(c){var d=a.element(c.data);f.append(b(d)(e))}),e.start=function(){e.open=!0,g()};var g=function(){var b=document.querySelectorAll(".pswp")[0];a.isUndefined(e.options.getThumbBoundsFn)&&a.isDefined(e.slideSelector)&&(e.options=a.merge({},{getThumbBoundsFn:function(a){var b=document.querySelectorAll(e.slideSelector)[a],c=window.pageYOffset||document.documentElement.scrollTop,d=b.getBoundingClientRect();return{x:d.left,y:d.top+c,w:d.width}}},e.options)),e.gallery=new PhotoSwipe(b,PhotoSwipeUI_Default||!1,e.slides,e.options),e.gallery.init(),e.item=e.gallery.currItem,e.gallery.listen("destroy",function(){e.safeApply(function(){(e.onClose||a.noop)()})}),e.gallery.listen("afterChange",function(){e.safeApply(function(){e.item=e.gallery.currItem})})};e.$watch("open",function(a,b){a!=b?a&&g():!a&&e.gallery&&(e.gallery.close(),e.gallery=null)}),e.safeApply=function(a){var b=this.$root.$$phase;"$apply"==b||"$digest"==b?a&&"function"==typeof a&&a():this.$apply(a)},e.$on("destroy",function(){e.gallery=null})}return{restrict:"AE",replace:!0,scope:{open:"=",options:"=",slides:"=",slideSelector:"@",template:"@",onClose:"&"},link:e}}return b.$inject=["$compile","$http","$templateCache"],a.module("ngPhotoswipe",[]).directive("ngPhotoswipe",b)}"function"==typeof define&&define.amd?define(["angular","photoswipe"],a):"undefined"!=typeof module&&module&&module.exports?(a(angular,require("photoswipe")),module.exports="ngPhotoswipe"):a(angular,("undefined"!=typeof global?global:window).Photoswipe)}(),angular.module("ngPhotoswipe").run(["$templateCache",function(a){"use strict";a.put("views/ng-photoswipe.html",'
')}]); +"format amd";!function(){"use strict";function a(a){function b(b,c,d){function e(e,f){e.template=e.template||"views/ng-photoswipe.html",c.get(e.template,{cache:d}).then(function(c){var d=a.element(c.data);f.append(b(d)(e))}),e.start=function(){e.open=!0,e.options={},g()};var g=function(){var b=document.querySelectorAll(".pswp")[0];a.isUndefined(e.options.getThumbBoundsFn)&&a.isDefined(e.slideSelector)&&(e.options=a.merge(e.options,{getThumbBoundsFn:function(a){var b=document.querySelectorAll(e.slideSelector)[a],c=window.pageYOffset||document.documentElement.scrollTop,d=b.getBoundingClientRect();return{x:d.left,y:d.top+c,w:d.width}}},e.options)),e.gallery=new PhotoSwipe(b,PhotoSwipeUI_Default||!1,e.slides,e.options),e.gallery.init(),e.item=e.gallery.currItem,e.gallery.listen("destroy",function(){e.safeApply(function(){(e.onClose||a.noop)()})}),e.gallery.listen("afterChange",function(){e.safeApply(function(){e.item=e.gallery.currItem})})};e.$watch("open",function(a,b){a!=b?a&&g():!a&&e.gallery&&(e.gallery.close(),e.gallery=null)}),e.safeApply=function(a){var b=this.$root.$$phase;"$apply"==b||"$digest"==b?a&&"function"==typeof a&&a():this.$apply(a)},e.$on("destroy",function(){e.gallery=null})}return{restrict:"AE",replace:!0,scope:{open:"=",options:"=",slides:"=",slideSelector:"@",template:"@",onClose:"&"},link:e}}return b.$inject=["$compile","$http","$templateCache"],a.module("ngPhotoswipe",[]).directive("ngPhotoswipe",b)}"function"==typeof define&&define.amd?define(["angular","photoswipe"],a):"undefined"!=typeof module&&module&&module.exports?(a(angular,require("photoswipe")),module.exports="ngPhotoswipe"):a(angular,("undefined"!=typeof global?global:window).Photoswipe)}(),angular.module("ngPhotoswipe").run(["$templateCache",function(a){"use strict";a.put("views/ng-photoswipe.html",'
')}]); //# sourceMappingURL=angular-photoswipe.min.js.map \ No newline at end of file diff --git a/angular-photoswipe.min.js.map b/angular-photoswipe.min.js.map index 074db12..187e84c 100644 --- a/angular-photoswipe.min.js.map +++ b/angular-photoswipe.min.js.map @@ -1 +1 @@ -{"version":3,"file":"angular-photoswipe.min.js","sources":["angular-photoswipe.annotated.js","templates.js"],"names":["ngPhotoswipe","angular","ngPhotoswipeDirective","$compile","$http","$templateCache","linkFn","scope","iElement","template","get","cache","success","html","element","append","start","open","startGallery","pswpElement","document","querySelectorAll","isUndefined","options","getThumbBoundsFn","isDefined","slideSelector","merge","index","thumbnail","pageYScroll","window","pageYOffset","documentElement","scrollTop","rect","getBoundingClientRect","x","left","y","top","w","width","gallery","PhotoSwipe","PhotoSwipeUI_Default","slides","init","item","currItem","listen","safeApply","onClose","noop","$watch","nVal","oVal","close","fn","phase","this","$root","$$phase","$apply","$on","restrict","replace","link","$inject","module","directive","define","amd","exports","require","global","Photoswipe","run","put"],"mappings":";;;;;;AAMA,cAGA,WACE,YAEA,SAASA,GAAaC,GAOpB,QAASC,GAAsBC,EAAUC,EAAOC,GAe9C,QAASC,GAAOC,EAAOC,GACrBD,EAAME,SAAWF,EAAME,UAAY,2BAEnCL,EACGM,IAAIH,EAAME,UAAYE,MAAON,IAC7BO,QAAQ,SAASC,GAChB,GAAIJ,GAAWR,EAAQa,QAAQD,EAC/BL,GAASO,OAAOZ,EAASM,GAAUF,MAGvCA,EAAMS,MAAQ,WACZT,EAAMU,MAAO,EACbC,IAGF,IAAIA,GAAe,WACjB,GAAIC,GAAcC,SAASC,iBAAiB,SAAS,EAEjDpB,GAAQqB,YAAYf,EAAMgB,QAAQC,mBAClCvB,EAAQ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OAAOC,IAC3CD,QAAQ,UAAW,cAAevE,GACN,mBAAXqE,SAA0BA,QAAUA,OAAOI,SAC5DzE,EAAaC,QAASyE,QAAQ,eAC9BL,OAAOI,QAAU,gBAEjBzE,EAAaC,SAA4B,mBAAX0E,QAAyBA,OAAS5C,QAAQ6C,eCvH1E3E,QAAQoE,OAAO,gBAAgBQ,KAAK,iBAAkB,SAASxE,GAC7D,YAEAA,GAAeyE,IAAI,2BACjB"} \ No newline at end of file +{"version":3,"file":"angular-photoswipe.min.js","sources":["angular-photoswipe.annotated.js","templates.js"],"names":["ngPhotoswipe","angular","ngPhotoswipeDirective","$compile","$http","$templateCache","linkFn","scope","iElement","template","get","cache","then","result","element","data","append","start","open","options","startGallery","pswpElement","document","querySelectorAll","isUndefined","getThumbBoundsFn","isDefined","slideSelector","merge","index","thumbnail","pageYScroll","window","pageYOffset","documentElement","scrollTop","rect","getBoundingClientRect","x","left","y","top","w","width","gallery","PhotoSwipe","PhotoSwipeUI_Default","slides","init","item","currItem","listen","safeApply","onClose","noop","$watch","nVal","oVal","close","fn","phase","this","$root","$$phase","$apply","$on","restrict","replace","link","$inject","module","directive","define","amd","exports","require","global","Photoswipe","run","put"],"mappings":";;;;;;AAMA,cAGA,WACE,YAEA,SAASA,GAAaC,GAOpB,QAASC,GAAsBC,EAAUC,EAAOC,GAe9C,QAASC,GAAOC,EAAOC,GACrBD,EAAME,SAAWF,EAAME,UAAY,2BAEnCL,EACGM,IAAIH,EAAME,UAAYE,MAAON,IAC7BO,KAAK,SAASC,GACb,GAAIJ,GAAWR,EAAQa,QAAQD,EAAOE,KACtCP,GAASQ,OAAOb,EAASM,GAAUF,MAGvCA,EAAMU,MAAQ,WACZV,EAAMW,MAAO,EACbX,EAAMY,WACNC,IAGF,IAAIA,GAAe,WACjB,GAAIC,GAAcC,SAASC,iBAAiB,SAAS,EAEjDtB,GAAQuB,YAAYjB,EAAMY,QAAQM,mBAClCxB,EAAQyB,UAAUnB,EAAMoB,iBAE1BpB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