facebook-photo-selector
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -1145,3 +1145,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
if (_ie && _ie < 10) { | ||
element.addAttribute('hidden'); | ||
element.setAttribute('hidden'); | ||
return; | ||
@@ -1204,3 +1204,3 @@ } | ||
if (_ie && _ie < 10) { | ||
element.addAttribute('hidden'); | ||
element.setAttribute('hidden'); | ||
return; | ||
@@ -1207,0 +1207,0 @@ } |
@@ -1,2 +0,2 @@ | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var s in o)("object"==typeof exports?exports:t)[s]=o[s]}}(this,function(){return function(t){function e(s){if(o[s])return o[s].exports;var n=o[s]={exports:{},id:s,loaded:!1};return t[s].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var o={};return e.m=t,e.c=o,e.p="",e(0)}([function(t,e,o){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var o=0;o<e.length;o++){var s=e[o];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}return function(e,o,s){return o&&t(e.prototype,o),s&&t(e,s),e}}();Object.defineProperty(e,"__esModule",{value:!0}),e.facebookPhotoSelector=void 0;var l=o(1),a=s(l),r=o(2),c=s(r),h=e.facebookPhotoSelector=function(){function t(e){var o=this;n(this,t),this._albums=[],this._photos=[],this._selectedAlbumIds=[],this._selectedPhotoIds=[],this._disabledPhotoIds=[],this.$albums=null,this._settings=c["default"].merge({},this.constructor._defaultSettings,e);var s=this.constructor._HTML;for(var i in this._settings.i18n){var l="{"+i+"}",r=new RegExp(l,"g");s=s.replace(r,this._settings.i18n[i])}var h=document.createElement("div");h.innerHTML=s,document.body.appendChild(h.children[0]),this.$container=document.querySelector(this._settings.containerSelector),this.$albumsContainer=this.$container.querySelector(this._settings.albumsContainerSelector),this.$photosContainer=this.$container.querySelector(this._settings.photosContainerSelector),this.$photosWrapper=this.$container.querySelector(this._settings.photosWrapperSelector),this.$selectedCount=this.$container.querySelector(this._settings.selectedPhotoCountSelector),this.$selectedCountMax=this.$container.querySelector(this._settings.selectedPhotoCountMaxSelector),this.$pageNumber=this.$container.querySelector(this._settings.pageNumberSelector),this.$pageNumberTotal=this.$container.querySelector(this._settings.pageNumberTotalSelector),this.$pagePrev=this.$container.querySelector(this._settings.pagePrevSelector),this.$pageNext=this.$container.querySelector(this._settings.pageNextSelector),this.$backToAlbums=this.$container.querySelector(this._settings.buttonBackToAlbumsSelector),this.$buttonClose=this.$container.querySelector(this._settings.buttonCloseSelector),this.$buttonOK=this.$container.querySelector(this._settings.buttonOKSelector),this.$buttonCancel=this.$container.querySelector(this._settings.buttonCancelSelector),this.$loader=this.$container.querySelector(this._settings.loader),this.$pagination=this.$container.querySelectorAll(this._settings.pagination),this._eventButtonClose=function(t){t.preventDefault(),o.hideAlbumSelector()},this._eventButtonCancel=function(t){t.preventDefault(),o.hideAlbumSelector()},this._eventButtonOK=function(t){t.preventDefault(),o.hideAlbumSelector(),"function"==typeof o._settings.callbackSubmit&&o._settings.callbackSubmit(o._selectedPhotoIds)},this._eventBackToAlbums=function(t){t.preventDefault(),a["default"].show(o.$pagination),a["default"].hide(o.$buttonOK),o.hidePhotoSelector()},this._eventPagePrev=function(t){t.preventDefault();var e=parseInt(o.$pageNumber.textContent,10)-1;1>e||(o._updateAlbumContainer(e),o._updatePaginationButtons(e))},this._eventPageNext=function(t){var e=parseInt(o.$pageNumber.textContent,10)+1;t.preventDefault(),a["default"].hasClass(t.target,o._settings.disabledClass)||(o._updateAlbumContainer(e),o._updatePaginationButtons(e))},this._eventWindowEscape=function(t){27===t.which&&(t.preventDefault(),t.stopPropagation(),o.hideAlbumSelector())}}return i(t,[{key:"setAlbums",value:function(t){t&&0!==t.length&&(t=Array.prototype.slice.call(t),t=t.sort(this._sortPhotos),this._albums=t)}},{key:"getAlbums",value:function(){return this._albums}},{key:"setPhotos",value:function(t){t&&0!==t.length&&(t=Array.prototype.slice.call(t),this._photos=t)}},{key:"getPhotos",value:function(){return this._photos}},{key:"getAlbumById",value:function(t){var e,o;for(t=t.toString(),e=0,o=this._albums.length;o>e;e+=1)if(this._albums[e].id===t)return this._albums[e];return null}},{key:"getPhotoById",value:function(t){if(!t)return null;var e,o;for(t=t.toString(),e=0,o=this._photos.length;o>e;e+=1)if(this._photos[e].id===t)return this._photos[e];return null}},{key:"showAlbumSelector",value:function(t,e){var o,s,n=this;if(this._log("CSPhotoSelector - show Albums"),t=t||"me",!this.$albums)return this._buildAlbumSelector(t,function(){n.showAlbumSelector(t,e)});for(this._bindEvents(),a["default"].removeClass(this.$albums,this._settings.albumSelectedClass),a["default"].removeClass(this.$albums,this._settings.albumDisabledClass),a["default"].removeClass(this.$albums,this._settings.photoFilteredClass),o=0,s=this._albums.length;s>o;o+=1)this._selectedAlbumIds.indexOf(this._albums[o].id)>=0&&a["default"].addClass(this.$albums[o],this._settings.albumSelectedClass),this._disabledPhotoIds.indexOf(this._albums[o].id)>=0&&a["default"].addClass(this.$albums[o],this._settings.albumDisabledClass);this._updateAlbumContainer(1),this._updatePaginationButtons(1),a["default"].fadeIn(this.$container),"function"==typeof e&&e()}},{key:"showPhotoSelector",value:function(t,e){var o,s,n=this;if(this._log("CSPhotoSelector - show Photos"),a["default"].show(this.$loader),!this.$photos||e)return this._buildPhotoSelector(function(){n.showPhotoSelector(t)},e);for(a["default"].removeClass(this.$photos,this._settings.albumSelectedClass),a["default"].removeClass(this.$photos,this._settings.albumDisabledClass),a["default"].removeClass(this.$photos,this._settings.photoFilteredClass),o=0,s=this._photos.length;s>o;o+=1)this._selectedPhotoIds.indexOf(this._photos[o].id)>=0&&a["default"].addClass(this.$photos[o],this._settings.albumSelectedClass),this._disabledPhotoIds.indexOf(this._photos[o].id)>=0&&a["default"].addClass(this.$photos[o],this._settings.albumDisabledClass);this.$selectedCount.textContent=this._selectedPhotoIds.length,this.$selectedCountMax.textContent=this._settings.maxSelection,this._updatePhotosContainer(1),"function"==typeof t&&t()}},{key:"hidePhotoSelector",value:function(){a["default"].slideOutRight(this.$photosWrapper)}},{key:"hideAlbumSelector",value:function(){this._unbindEvents(),a["default"].fadeOut(this.$container)}},{key:"getselectedAlbumIds",value:function(){return this._selectedAlbumIds}},{key:"getselectedPhotoIds",value:function(){return this._selectedPhotoIds}},{key:"setDisabledPhotoIds",value:function(t){this._disabledPhotoIds=t}},{key:"reset",value:function(){this._albums&&0!==this._albums.length&&(a["default"].slideOutRight(this.$photosWrapper),a["default"].hide(this.$buttonOK),this.$albumsContainer.innerHTML="",this.$photosContainer.innerHTML="",this._selectedAlbumIds=[],this._selectedPhotoIds=[],this.$albums=null,this.$selectedCount.textContent="0",this._disabledPhotoIds=[],this._updatePaginationButtons(1))}},{key:"_bindEvents",value:function(){this.$buttonClose.addEventListener("click",this._eventButtonClose),this.$buttonCancel.addEventListener("click",this._eventButtonCancel),this.$buttonOK.addEventListener("click",this._eventButtonOK),this.$backToAlbums.addEventListener("click",this._eventBackToAlbums),this.$pagePrev.addEventListener("click",this._eventPagePrev),this.$pageNext.addEventListener("click",this._eventPageNext),window.addEventListener("keydown",this._eventWindowEscape)}},{key:"_unbindEvents",value:function(){this.$buttonClose.removeEventListener("click",this._eventButtonClose),this.$buttonCancel.removeEventListener("click",this._eventButtonCancel),this.$buttonOK.removeEventListener("click",this._eventButtonOK),this.$backToAlbums.removeEventListener("click",this._eventBackToAlbums),this.$pagePrev.removeEventListener("click",this._eventPagePrev),this.$pageNext.removeEventListener("click",this._eventPageNext),window.removeEventListener("keydown",this._eventWindowEscape)}},{key:"_updateAlbumContainer",value:function(t){var e,o,s=this;e=(t-1)*this._settings.albumsPerPage,o=t*this._settings.albumsPerPage,this.$albumsContainer.innerHTML="";for(var n=e;o>n&&this.$albums[n];n)a["default"].hasClass(this.$albums[n],this._settings.photoFilteredClass)||(this.$albumsContainer.appendChild(this.$albums[n]),n++);[].forEach.call(this.$albumsContainer.children,function(t){t.addEventListener("click",function(e){e.preventDefault(),s._selectAlbum(t)})})}},{key:"_updatePhotosContainer",value:function(t){var e,o,s=this;e=(t-1)*this._settings.photosPerPage,o=t*this._settings.photosPerPage,this.$photosContainer.innerHTML="";for(var n=e;o>n&&this.$photos[n];n)a["default"].hasClass(this.$photos[n],this._settings.photoFilteredClass)||(this.$photosContainer.appendChild(this.$photos[n]),n++);[].forEach.call(this.$photosContainer.children,function(t){t.addEventListener("click",function(e){e.preventDefault(),s._selectPhotos(t)})})}},{key:"_updatePaginationButtons",value:function(t){var e=Math.ceil(this._albums.length/this._settings.albumsPerPage);this.$pageNumber.textContent=t,this.$pageNumberTotal.textContent=e,1===t||1===e?a["default"].addClass(this.$pagePrev,this._settings.disabledClass):a["default"].removeClass(this.$pagePrev,this._settings.disabledClass),t===e||1===e?a["default"].addClass(this.$pageNext,this._settings.disabledClass):a["default"].removeClass(this.$pageNext,this._settings.disabledClass)}},{key:"_selectAlbum",value:function(t){var e,o,s,n;if(e=t.getAttribute("data-id"),!a["default"].hasClass(t,this._settings.albumDisabledClass)){if(a["default"].hasClass(t,this._settings.albumSelectedClass)){for(o=0,s=this._selectedAlbumIds.length;s>o;o+=1)if(this._selectedAlbumIds[o]===e)return this._selectedAlbumIds.splice(o,1),a["default"].removeClass(t,this._settings.albumSelectedClass),this.$selectedCount.textContent=this._selectedAlbumIds.length,"function"==typeof this._settings.callbackAlbumUnselected&&this._settings.callbackAlbumUnselected(e),!1}else this._settings.autoDeselection&&this._selectedAlbumIds.length===this._settings.maxSelection&&(n=this._selectedAlbumIds.splice(0,1),a["default"].removeClass(this.$getAlbumById(n),this._settings.albumSelectedClass),this.$selectedCount.textContent=this._selectedAlbumIds.length),this._selectedAlbumIds.length<this._settings.maxSelection&&(this._selectedAlbumIds.indexOf(e)<0?(this._selectedAlbumIds.push(e),a["default"].addClass(t,this._settings.albumSelectedClass),this.$selectedCount.textContent=this._selectedAlbumIds.length,this._log("CSPhotoSelector - newInstance - _selectAlbum - selected IDs: ",this._selectedAlbumIds),"function"==typeof this._settings.callbackAlbumSelected&&this._settings.callbackAlbumSelected(e)):this._log("CSPhotoSelector - newInstance - _selectAlbum - ID already stored"));this._selectedAlbumIds.length===this._settings.maxSelection&&"function"==typeof this._settings.callbackMaxSelection&&this._settings.callbackMaxSelection()}}},{key:"_selectPhotos",value:function(t){var e,o,s,n;if(e=t.getAttribute("data-id"),!a["default"].hasClass(t,this._settings.albumDisabledClass)){if(a["default"].hasClass(t,this._settings.albumSelectedClass)){for(o=0,s=this._selectedPhotoIds.length;s>o;o+=1)if(this._selectedPhotoIds[o]===e)return this._selectedPhotoIds.splice(o,1),a["default"].removeClass(t,this._settings.albumSelectedClass),this.$selectedCount.textContent=this._selectedPhotoIds.length,"function"==typeof this._settings.callbackPhotoUnselected&&this._settings.callbackPhotoUnselected(e),!1}else this._settings.autoDeselection&&this._selectedPhotoIds.length===this._settings.maxSelection&&(n=this._selectedPhotoIds.splice(0,1),a["default"].removeClass(this.$getPhotoById(n),this._settings.albumSelectedClass),this.$selectedCount.textContent=this._selectedPhotoIds.length),this._selectedPhotoIds.length<this._settings.maxSelection&&(this._selectedPhotoIds.indexOf(e)<0?(this._selectedPhotoIds.push(e),a["default"].addClass(t,this._settings.albumSelectedClass),this.$selectedCount.textContent=this._selectedPhotoIds.length,this._log("CSPhotoSelector - newInstance - selectPhoto - selected IDs: ",this._selectedPhotoIds),"function"==typeof this._settings.callbackPhotoSelected&&this._settings.callbackPhotoSelected(e)):this._log("CSPhotoSelector - newInstance - selectPhoto - ID already stored"));this._selectedPhotoIds.length?a["default"].show(this.$buttonOK):a["default"].hide(this.$buttonOK),this._selectedPhotoIds.length===this._settings.maxSelection&&"function"==typeof this._settings.callbackMaxSelection&&this._settings.callbackMaxSelection()}}},{key:"$getAlbumById",value:function(t){var e,o;for(t=t.toString(),e=0,o=this._albums.length;o>e;e+=1)if(this._albums[e].id===t)return this.$albums[e];return null}},{key:"$getPhotoById",value:function(t){var e,o;for(t=t.toString(),e=0,o=this._photos.length;o>e;e+=1)if(this._photos[e].id===t)return this.$photos[e];return null}},{key:"_buildAlbumSelector",value:function(t,e){var o,s,n=this;return this._log("buildAlbumSelector"),a["default"].show(this.$pagination),FB?(FB.getLoginStatus(function(s){if("connected"!==s.status)return n._log("CSPhotoSelector - buildAlbumSelector - User is not logged in to Facebook"),!1;var i=s.authResponse.accessToken;FB.api("/"+t+"/albums",function(t){return t.data.length?(n.setAlbums(t.data),o(i),"function"==typeof e&&e(),void 0):(alert(n._settings.i18n.permission_error),n._log("CSPhotoSelector - buildAlbumSelector - No albums returned"),!1)})}),o=function(t){var e,o,i=[];for(e=0,o=n._albums.length;o>e;e+=1){var l=s(n._albums[e],t),a=document.createElement("div");a.innerHTML=l,i.push(a.children[0])}n.$albums=i},void(s=function(t,e){return'<a href="#" class="PhotoSelector_album" data-id="'+t.id+'"><div class="PhotoSelector_albumWrap"><div><img src="https://graph.facebook.com/'+t.id+"/picture?type=album&access_token="+e+'" alt="'+n._htmlEntities(t.name)+'" class="PhotoSelector_photoAvatar" /></div></div><div class="PhotoSelector_photoName">'+n._htmlEntities(t.name)+"</div></a>"})):(this._log("The Facebook SDK must be initialised before showing the photo selector"),!1)}},{key:"_buildPhotoSelector",value:function(t,e){var o,s,n=this;this._log("buildPhotoSelector"),FB.api("/"+e+"/photos?fields=id,picture,source,height,width,images&limit=500",function(e){return e.data?(n.setPhotos(e.data),o(),"function"==typeof t&&(t(),a["default"].hide(n.$loader),a["default"].hide(n.$pagination),a["default"].slideInRight(n.$photosWrapper)),void 0):(n._log("CSPhotoSelector - showPhotoSelector - No photos returned"),!1)}),o=function(){var t,o,i=[];for(n._photos.length||n._buildPhotoSelector(null,e),t=0,o=n._photos.length;o>t;t+=1){var l=s(n._photos[t]),a=document.createElement("div");a.innerHTML=l,i.push(a.children[0])}n.$photos=i},s=function(t){return'<a href="#" class="PhotoSelector_photo PhotoSelector_clearfix" data-id="'+t.id+'"><span><img src="'+t.picture+'" alt="" class="PhotoSelector_photoAvatar" /></span></a>'}}},{key:"_sortPhotos",value:function(t,e){return t.upperCaseName===e.upperCaseName?0:t.upperCaseName>e.upperCaseName?1:t.upperCaseName<e.upperCaseName?-1:void 0}},{key:"_log",value:function(){this._settings.debug&&window.console&&console.log(Array.prototype.slice.call(arguments))}},{key:"_htmlEntities",value:function(t){return t?String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):""}}]),t}();h._defaultSettings={debug:!1,maxSelection:1,albumsPerPage:6,photosPerPage:500,autoDeselection:!0,callbackAlbumSelected:null,callbackAlbumUnselected:null,callbackPhotoSelected:null,callbackPhotoUnselected:null,callbackMaxSelection:null,callbackSubmit:null,disabledClass:"PhotoSelector_disabled",albumSelectedClass:"PhotoSelector_photoSelected",albumDisabledClass:"PhotoSelector_photoDisabled",photoFilteredClass:"PhotoSelector_photoFiltered",containerSelector:"#PhotoSelector",albumsContainerSelector:".PhotoSelector_albumContainer",photosContainerSelector:".PhotoSelector_photoContainer",photosWrapperSelector:".PhotoSelector_wrapper",selectedPhotoCountSelector:".PhotoSelector_selectedPhotoCount",selectedPhotoCountMaxSelector:".PhotoSelector_selectedPhotoCountMax",pageNumberSelector:"#PhotoSelector_pageNumber",pageNumberTotalSelector:"#PhotoSelector_pageNumberTotal",pagePrevSelector:"#PhotoSelector_pagePrev",pageNextSelector:"#PhotoSelector_pageNext",buttonBackToAlbumsSelector:"#PhotoSelector_backToAlbums",buttonCloseSelector:"#PhotoSelector_buttonClose",buttonOKSelector:"#PhotoSelector_buttonOK",buttonCancelSelector:"#PhotoSelector_buttonCancel",loader:"#PhotoSelector_loader",pagination:".PhotoSelector_pageNumberContainer, #PhotoSelector_pagePrev, #PhotoSelector_pageNext",i18n:{choose:"Choose from Photos",browse_albums:"Browse your albums until you find a picture you want to use",select_an_album:"Select an album",select_a_photo:"Select a new photo",photos_selected:"photo(s) selected",back_to_albums:"Back to albums",previous:"Previous",next:"Next",page:"Page",OK:"OK",cancel:"Cancel",permission_error:"It looks like we don’t have permission to see the pictures. Please log out and log in again"}},h._HTML='\n<div id="PhotoSelector" hidden>\n <div class="PhotoSelector_dialog">\n <a href="#" id="PhotoSelector_buttonClose">×</a>\n <div class="PhotoSelector_form">\n <div class="PhotoSelector_header">\n <p>{choose}</p>\n </div>\n\n <div class="PhotoSelector_content AlbumSelector_wrapper">\n <p>{browse_albums}</p>\n <div class="PhotoSelector_searchContainer PhotoSelector_clearfix">\n <div class="PhotoSelector_selectedCountContainer">{select_an_album}</div>\n </div>\n <div class="PhotoSelector_photosContainer PhotoSelector_albumContainer"></div>\n </div>\n\n <div class="PhotoSelector_content PhotoSelector_wrapper" hidden>\n <p>{select_a_photo}</p>\n <div class="PhotoSelector_searchContainer PhotoSelector_clearfix">\n <div class="PhotoSelector_selectedCountContainer"><span class="PhotoSelector_selectedPhotoCount">0</span> / <span class="PhotoSelector_selectedPhotoCountMax">0</span> {photos_selected}</div>\n <a href="#" id="PhotoSelector_backToAlbums">{back_to_albums}</a>\n </div>\n <div class="PhotoSelector_photosContainer PhotoSelector_photoContainer"></div>\n </div>\n\n <div id="PhotoSelector_loader" hidden></div>\n\n\n <div class="PhotoSelector_footer PhotoSelector_clearfix">\n <a href="#" id="PhotoSelector_pagePrev" class="PhotoSelector_disabled" hidden>{previous}</a>\n <a href="#" id="PhotoSelector_pageNext" hidden>{next}</a>\n <div class="PhotoSelector_pageNumberContainer" hidden>\n {page} <span id="PhotoSelector_pageNumber">1</span> / <span id="PhotoSelector_pageNumberTotal">1</span>\n </div>\n <a href="#" id="PhotoSelector_buttonOK">{OK}</a>\n <a href="#" id="PhotoSelector_buttonCancel">{cancel}</a>\n </div>\n </div>\n </div>\n</div>\n'},function(t,e){"use strict";function o(t){return"string"==typeof t?document.querySelectorAll(t):t}function s(t,e){if(t)if(t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))for(var n=0;n<t.length;++n)s(t[n],e);else i(t,e)||(t.classList?t.classList.add(e):t.className+=" "+e)}function n(t,e){if(t)if(t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))for(var s=0;s<t.length;++s)n(t[s],e);else t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")}function i(t,e){if(t){if(t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t)){for(var s=!0,n=0;n<t.length;++n)i(t[n],e)||(s=!1);return s}return t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)}}function l(t,e,i){if(t)if(t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))for(var a=0;a<t.length;++a)l(t[a],e,i);else i?s(t,e):n(t,e)}function a(t,e){return t?(t=o(t),(t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))&&(t=t[0]),getComputedStyle(t).getPropertyValue(e)):void 0}function r(t){if(t)if(t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))for(var e=0;e<t.length;++e)r(t[e]);else t.removeAttribute("hidden")}function c(t){if(t)if(t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))for(var e=0;e<t.length;++e)c(t[e]);else t.setAttribute("hidden",!0)}function h(t){if(t){if(p&&10>p)return void t.removeAttribute("hidden");if(b(),t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))for(var e=0;e<t.length;++e)h(t[e]);else{t.removeAttribute("hidden");var i=function l(e){n(e.target,"PSanimated"),n(e.target,"PSfadeIn"),g(t,"AnimationEnd",l)};m(t,"AnimationEnd",i),s(t,"PSanimated"),s(t,"PSfadeIn")}}}function u(t){if(t){if(p&&10>p)return void t.addAttribute("hidden");if(b(),t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))for(var e=0;e<t.length;++e)u(t[e]);else{var i=function l(e){e.target.setAttribute("hidden",!0),n(e.target,"PSanimated"),n(e.target,"PSfadeOut"),g(t,"AnimationEnd",l)};m(t,"AnimationEnd",i),s(t,"PSanimated"),s(t,"PSfadeOut")}}}function d(t){if(t){if(p&&10>p)return void t.removeAttribute("hidden");if(b(),t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))for(var e=0;e<t.length;++e)d(t[e]);else{t.removeAttribute("hidden");var i=function l(e){n(e.target,"PSanimated"),n(e.target,"PSslideInRight"),g(t,"AnimationEnd",l)};m(t,"AnimationEnd",i),s(t,"PSanimated"),s(t,"PSslideInRight")}}}function f(t){if(t){if(p&&10>p)return void t.addAttribute("hidden");if(b(),t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))for(var e=0;e<t.length;++e)f(t[e]);else{var i=function l(e){e.target.setAttribute("hidden",!0),n(e.target,"PSanimated"),n(e.target,"PSslideOutRight"),g(t,"AnimationEnd",l)};m(t,"AnimationEnd",i),s(t,"PSanimated"),s(t,"PSslideOutRight")}}}function _(t,e,o){t.insertRule(e+"{"+o+"}",0)}function b(){if(!v){var t=document.createElement("style");t.appendChild(document.createTextNode("")),document.head.appendChild(t),v=t.sheet,_(v,".PSanimated","\n animation-duration: 0.35s; -webkit-animation-duration: 0.35s;\n animation-fill-mode: both; -webkit-animation-fill-mode: both;\n animation-timing-function: ease-in-out; -webkit-animation-timing-function: ease-in-out;\n ");var e={fadeIn:"\n 0% { opacity: 0; }\n 70% { opacity: 1; }\n 100% { opacity: 1; }\n ",fadeOut:"\n 0% { opacity: 1; }\n 70% { opacity: 0; }\n 100% { opacity: 0; }\n ",slideInRight:"\n from {\n transform: translate3d(100%, 0, 0); -webkit-transform: translate3d(100%, 0, 0);\n visibility: visible;\n }\n to { transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); }\n ",slideOutRight:"\n from { transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n transform: translate3d(100%, 0, 0); -webkit-transform: translate3d(100%, 0, 0);\n }\n "};for(var o in e)_(v,"@-webkit-keyframes PS"+o,e[o]),_(v,"@keyframes PS"+o,e[o]),_(v,".PS"+o,"\n animation-name: PS"+o+"; -webkit-animation-name: PS"+o+";\n ")}}function m(t,e,s){t=o(t);for(var n=0;n<S.length;n++)S[n]||(e=e.toLowerCase()),t.addEventListener(S[n]+e,s,!1)}function g(t,e,s){t=o(t);for(var n=0;n<S.length;n++)S[n]||(e=e.toLowerCase()),t.removeEventListener(S[n]+e,s)}Object.defineProperty(e,"__esModule",{value:!0});var p=/MSIE ([0-9]+)/g.exec(window.navigator.userAgent)?/MSIE ([0-9]+)/g.exec(window.navigator.userAgent)[1]:void 0,v=!1,S=["webkit","moz","MS","o",""];e["default"]={addClass:s,removeClass:n,hasClass:i,toggleClass:l,css:a,show:r,hide:c,fadeIn:h,fadeOut:u,slideInRight:d,slideOutRight:f}},function(t,e){"use strict";function o(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function s(t){t=t||{};for(var e=1;e<arguments.length;e++){var n=arguments[e];if(n)for(var i in n)n.hasOwnProperty(i)&&("object"===o(n[i])?t[i]=s(t[i],n[i]):t[i]=n[i])}return t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={merge:s}}])}); | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var s in o)("object"==typeof exports?exports:t)[s]=o[s]}}(this,function(){return function(t){function e(s){if(o[s])return o[s].exports;var n=o[s]={exports:{},id:s,loaded:!1};return t[s].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var o={};return e.m=t,e.c=o,e.p="",e(0)}([function(t,e,o){"use strict";function s(t){return t&&t.__esModule?t:{"default":t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var o=0;o<e.length;o++){var s=e[o];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}return function(e,o,s){return o&&t(e.prototype,o),s&&t(e,s),e}}();Object.defineProperty(e,"__esModule",{value:!0}),e.facebookPhotoSelector=void 0;var l=o(1),a=s(l),r=o(2),c=s(r),h=e.facebookPhotoSelector=function(){function t(e){var o=this;n(this,t),this._albums=[],this._photos=[],this._selectedAlbumIds=[],this._selectedPhotoIds=[],this._disabledPhotoIds=[],this.$albums=null,this._settings=c["default"].merge({},this.constructor._defaultSettings,e);var s=this.constructor._HTML;for(var i in this._settings.i18n){var l="{"+i+"}",r=new RegExp(l,"g");s=s.replace(r,this._settings.i18n[i])}var h=document.createElement("div");h.innerHTML=s,document.body.appendChild(h.children[0]),this.$container=document.querySelector(this._settings.containerSelector),this.$albumsContainer=this.$container.querySelector(this._settings.albumsContainerSelector),this.$photosContainer=this.$container.querySelector(this._settings.photosContainerSelector),this.$photosWrapper=this.$container.querySelector(this._settings.photosWrapperSelector),this.$selectedCount=this.$container.querySelector(this._settings.selectedPhotoCountSelector),this.$selectedCountMax=this.$container.querySelector(this._settings.selectedPhotoCountMaxSelector),this.$pageNumber=this.$container.querySelector(this._settings.pageNumberSelector),this.$pageNumberTotal=this.$container.querySelector(this._settings.pageNumberTotalSelector),this.$pagePrev=this.$container.querySelector(this._settings.pagePrevSelector),this.$pageNext=this.$container.querySelector(this._settings.pageNextSelector),this.$backToAlbums=this.$container.querySelector(this._settings.buttonBackToAlbumsSelector),this.$buttonClose=this.$container.querySelector(this._settings.buttonCloseSelector),this.$buttonOK=this.$container.querySelector(this._settings.buttonOKSelector),this.$buttonCancel=this.$container.querySelector(this._settings.buttonCancelSelector),this.$loader=this.$container.querySelector(this._settings.loader),this.$pagination=this.$container.querySelectorAll(this._settings.pagination),this._eventButtonClose=function(t){t.preventDefault(),o.hideAlbumSelector()},this._eventButtonCancel=function(t){t.preventDefault(),o.hideAlbumSelector()},this._eventButtonOK=function(t){t.preventDefault(),o.hideAlbumSelector(),"function"==typeof o._settings.callbackSubmit&&o._settings.callbackSubmit(o._selectedPhotoIds)},this._eventBackToAlbums=function(t){t.preventDefault(),a["default"].show(o.$pagination),a["default"].hide(o.$buttonOK),o.hidePhotoSelector()},this._eventPagePrev=function(t){t.preventDefault();var e=parseInt(o.$pageNumber.textContent,10)-1;1>e||(o._updateAlbumContainer(e),o._updatePaginationButtons(e))},this._eventPageNext=function(t){var e=parseInt(o.$pageNumber.textContent,10)+1;t.preventDefault(),a["default"].hasClass(t.target,o._settings.disabledClass)||(o._updateAlbumContainer(e),o._updatePaginationButtons(e))},this._eventWindowEscape=function(t){27===t.which&&(t.preventDefault(),t.stopPropagation(),o.hideAlbumSelector())}}return i(t,[{key:"setAlbums",value:function(t){t&&0!==t.length&&(t=Array.prototype.slice.call(t),t=t.sort(this._sortPhotos),this._albums=t)}},{key:"getAlbums",value:function(){return this._albums}},{key:"setPhotos",value:function(t){t&&0!==t.length&&(t=Array.prototype.slice.call(t),this._photos=t)}},{key:"getPhotos",value:function(){return this._photos}},{key:"getAlbumById",value:function(t){var e,o;for(t=t.toString(),e=0,o=this._albums.length;o>e;e+=1)if(this._albums[e].id===t)return this._albums[e];return null}},{key:"getPhotoById",value:function(t){if(!t)return null;var e,o;for(t=t.toString(),e=0,o=this._photos.length;o>e;e+=1)if(this._photos[e].id===t)return this._photos[e];return null}},{key:"showAlbumSelector",value:function(t,e){var o,s,n=this;if(this._log("CSPhotoSelector - show Albums"),t=t||"me",!this.$albums)return this._buildAlbumSelector(t,function(){n.showAlbumSelector(t,e)});for(this._bindEvents(),a["default"].removeClass(this.$albums,this._settings.albumSelectedClass),a["default"].removeClass(this.$albums,this._settings.albumDisabledClass),a["default"].removeClass(this.$albums,this._settings.photoFilteredClass),o=0,s=this._albums.length;s>o;o+=1)this._selectedAlbumIds.indexOf(this._albums[o].id)>=0&&a["default"].addClass(this.$albums[o],this._settings.albumSelectedClass),this._disabledPhotoIds.indexOf(this._albums[o].id)>=0&&a["default"].addClass(this.$albums[o],this._settings.albumDisabledClass);this._updateAlbumContainer(1),this._updatePaginationButtons(1),a["default"].fadeIn(this.$container),"function"==typeof e&&e()}},{key:"showPhotoSelector",value:function(t,e){var o,s,n=this;if(this._log("CSPhotoSelector - show Photos"),a["default"].show(this.$loader),!this.$photos||e)return this._buildPhotoSelector(function(){n.showPhotoSelector(t)},e);for(a["default"].removeClass(this.$photos,this._settings.albumSelectedClass),a["default"].removeClass(this.$photos,this._settings.albumDisabledClass),a["default"].removeClass(this.$photos,this._settings.photoFilteredClass),o=0,s=this._photos.length;s>o;o+=1)this._selectedPhotoIds.indexOf(this._photos[o].id)>=0&&a["default"].addClass(this.$photos[o],this._settings.albumSelectedClass),this._disabledPhotoIds.indexOf(this._photos[o].id)>=0&&a["default"].addClass(this.$photos[o],this._settings.albumDisabledClass);this.$selectedCount.textContent=this._selectedPhotoIds.length,this.$selectedCountMax.textContent=this._settings.maxSelection,this._updatePhotosContainer(1),"function"==typeof t&&t()}},{key:"hidePhotoSelector",value:function(){a["default"].slideOutRight(this.$photosWrapper)}},{key:"hideAlbumSelector",value:function(){this._unbindEvents(),a["default"].fadeOut(this.$container)}},{key:"getselectedAlbumIds",value:function(){return this._selectedAlbumIds}},{key:"getselectedPhotoIds",value:function(){return this._selectedPhotoIds}},{key:"setDisabledPhotoIds",value:function(t){this._disabledPhotoIds=t}},{key:"reset",value:function(){this._albums&&0!==this._albums.length&&(a["default"].slideOutRight(this.$photosWrapper),a["default"].hide(this.$buttonOK),this.$albumsContainer.innerHTML="",this.$photosContainer.innerHTML="",this._selectedAlbumIds=[],this._selectedPhotoIds=[],this.$albums=null,this.$selectedCount.textContent="0",this._disabledPhotoIds=[],this._updatePaginationButtons(1))}},{key:"_bindEvents",value:function(){this.$buttonClose.addEventListener("click",this._eventButtonClose),this.$buttonCancel.addEventListener("click",this._eventButtonCancel),this.$buttonOK.addEventListener("click",this._eventButtonOK),this.$backToAlbums.addEventListener("click",this._eventBackToAlbums),this.$pagePrev.addEventListener("click",this._eventPagePrev),this.$pageNext.addEventListener("click",this._eventPageNext),window.addEventListener("keydown",this._eventWindowEscape)}},{key:"_unbindEvents",value:function(){this.$buttonClose.removeEventListener("click",this._eventButtonClose),this.$buttonCancel.removeEventListener("click",this._eventButtonCancel),this.$buttonOK.removeEventListener("click",this._eventButtonOK),this.$backToAlbums.removeEventListener("click",this._eventBackToAlbums),this.$pagePrev.removeEventListener("click",this._eventPagePrev),this.$pageNext.removeEventListener("click",this._eventPageNext),window.removeEventListener("keydown",this._eventWindowEscape)}},{key:"_updateAlbumContainer",value:function(t){var e,o,s=this;e=(t-1)*this._settings.albumsPerPage,o=t*this._settings.albumsPerPage,this.$albumsContainer.innerHTML="";for(var n=e;o>n&&this.$albums[n];n)a["default"].hasClass(this.$albums[n],this._settings.photoFilteredClass)||(this.$albumsContainer.appendChild(this.$albums[n]),n++);[].forEach.call(this.$albumsContainer.children,function(t){t.addEventListener("click",function(e){e.preventDefault(),s._selectAlbum(t)})})}},{key:"_updatePhotosContainer",value:function(t){var e,o,s=this;e=(t-1)*this._settings.photosPerPage,o=t*this._settings.photosPerPage,this.$photosContainer.innerHTML="";for(var n=e;o>n&&this.$photos[n];n)a["default"].hasClass(this.$photos[n],this._settings.photoFilteredClass)||(this.$photosContainer.appendChild(this.$photos[n]),n++);[].forEach.call(this.$photosContainer.children,function(t){t.addEventListener("click",function(e){e.preventDefault(),s._selectPhotos(t)})})}},{key:"_updatePaginationButtons",value:function(t){var e=Math.ceil(this._albums.length/this._settings.albumsPerPage);this.$pageNumber.textContent=t,this.$pageNumberTotal.textContent=e,1===t||1===e?a["default"].addClass(this.$pagePrev,this._settings.disabledClass):a["default"].removeClass(this.$pagePrev,this._settings.disabledClass),t===e||1===e?a["default"].addClass(this.$pageNext,this._settings.disabledClass):a["default"].removeClass(this.$pageNext,this._settings.disabledClass)}},{key:"_selectAlbum",value:function(t){var e,o,s,n;if(e=t.getAttribute("data-id"),!a["default"].hasClass(t,this._settings.albumDisabledClass)){if(a["default"].hasClass(t,this._settings.albumSelectedClass)){for(o=0,s=this._selectedAlbumIds.length;s>o;o+=1)if(this._selectedAlbumIds[o]===e)return this._selectedAlbumIds.splice(o,1),a["default"].removeClass(t,this._settings.albumSelectedClass),this.$selectedCount.textContent=this._selectedAlbumIds.length,"function"==typeof this._settings.callbackAlbumUnselected&&this._settings.callbackAlbumUnselected(e),!1}else this._settings.autoDeselection&&this._selectedAlbumIds.length===this._settings.maxSelection&&(n=this._selectedAlbumIds.splice(0,1),a["default"].removeClass(this.$getAlbumById(n),this._settings.albumSelectedClass),this.$selectedCount.textContent=this._selectedAlbumIds.length),this._selectedAlbumIds.length<this._settings.maxSelection&&(this._selectedAlbumIds.indexOf(e)<0?(this._selectedAlbumIds.push(e),a["default"].addClass(t,this._settings.albumSelectedClass),this.$selectedCount.textContent=this._selectedAlbumIds.length,this._log("CSPhotoSelector - newInstance - _selectAlbum - selected IDs: ",this._selectedAlbumIds),"function"==typeof this._settings.callbackAlbumSelected&&this._settings.callbackAlbumSelected(e)):this._log("CSPhotoSelector - newInstance - _selectAlbum - ID already stored"));this._selectedAlbumIds.length===this._settings.maxSelection&&"function"==typeof this._settings.callbackMaxSelection&&this._settings.callbackMaxSelection()}}},{key:"_selectPhotos",value:function(t){var e,o,s,n;if(e=t.getAttribute("data-id"),!a["default"].hasClass(t,this._settings.albumDisabledClass)){if(a["default"].hasClass(t,this._settings.albumSelectedClass)){for(o=0,s=this._selectedPhotoIds.length;s>o;o+=1)if(this._selectedPhotoIds[o]===e)return this._selectedPhotoIds.splice(o,1),a["default"].removeClass(t,this._settings.albumSelectedClass),this.$selectedCount.textContent=this._selectedPhotoIds.length,"function"==typeof this._settings.callbackPhotoUnselected&&this._settings.callbackPhotoUnselected(e),!1}else this._settings.autoDeselection&&this._selectedPhotoIds.length===this._settings.maxSelection&&(n=this._selectedPhotoIds.splice(0,1),a["default"].removeClass(this.$getPhotoById(n),this._settings.albumSelectedClass),this.$selectedCount.textContent=this._selectedPhotoIds.length),this._selectedPhotoIds.length<this._settings.maxSelection&&(this._selectedPhotoIds.indexOf(e)<0?(this._selectedPhotoIds.push(e),a["default"].addClass(t,this._settings.albumSelectedClass),this.$selectedCount.textContent=this._selectedPhotoIds.length,this._log("CSPhotoSelector - newInstance - selectPhoto - selected IDs: ",this._selectedPhotoIds),"function"==typeof this._settings.callbackPhotoSelected&&this._settings.callbackPhotoSelected(e)):this._log("CSPhotoSelector - newInstance - selectPhoto - ID already stored"));this._selectedPhotoIds.length?a["default"].show(this.$buttonOK):a["default"].hide(this.$buttonOK),this._selectedPhotoIds.length===this._settings.maxSelection&&"function"==typeof this._settings.callbackMaxSelection&&this._settings.callbackMaxSelection()}}},{key:"$getAlbumById",value:function(t){var e,o;for(t=t.toString(),e=0,o=this._albums.length;o>e;e+=1)if(this._albums[e].id===t)return this.$albums[e];return null}},{key:"$getPhotoById",value:function(t){var e,o;for(t=t.toString(),e=0,o=this._photos.length;o>e;e+=1)if(this._photos[e].id===t)return this.$photos[e];return null}},{key:"_buildAlbumSelector",value:function(t,e){var o,s,n=this;return this._log("buildAlbumSelector"),a["default"].show(this.$pagination),FB?(FB.getLoginStatus(function(s){if("connected"!==s.status)return n._log("CSPhotoSelector - buildAlbumSelector - User is not logged in to Facebook"),!1;var i=s.authResponse.accessToken;FB.api("/"+t+"/albums",function(t){return t.data.length?(n.setAlbums(t.data),o(i),"function"==typeof e&&e(),void 0):(alert(n._settings.i18n.permission_error),n._log("CSPhotoSelector - buildAlbumSelector - No albums returned"),!1)})}),o=function(t){var e,o,i=[];for(e=0,o=n._albums.length;o>e;e+=1){var l=s(n._albums[e],t),a=document.createElement("div");a.innerHTML=l,i.push(a.children[0])}n.$albums=i},void(s=function(t,e){return'<a href="#" class="PhotoSelector_album" data-id="'+t.id+'"><div class="PhotoSelector_albumWrap"><div><img src="https://graph.facebook.com/'+t.id+"/picture?type=album&access_token="+e+'" alt="'+n._htmlEntities(t.name)+'" class="PhotoSelector_photoAvatar" /></div></div><div class="PhotoSelector_photoName">'+n._htmlEntities(t.name)+"</div></a>"})):(this._log("The Facebook SDK must be initialised before showing the photo selector"),!1)}},{key:"_buildPhotoSelector",value:function(t,e){var o,s,n=this;this._log("buildPhotoSelector"),FB.api("/"+e+"/photos?fields=id,picture,source,height,width,images&limit=500",function(e){return e.data?(n.setPhotos(e.data),o(),"function"==typeof t&&(t(),a["default"].hide(n.$loader),a["default"].hide(n.$pagination),a["default"].slideInRight(n.$photosWrapper)),void 0):(n._log("CSPhotoSelector - showPhotoSelector - No photos returned"),!1)}),o=function(){var t,o,i=[];for(n._photos.length||n._buildPhotoSelector(null,e),t=0,o=n._photos.length;o>t;t+=1){var l=s(n._photos[t]),a=document.createElement("div");a.innerHTML=l,i.push(a.children[0])}n.$photos=i},s=function(t){return'<a href="#" class="PhotoSelector_photo PhotoSelector_clearfix" data-id="'+t.id+'"><span><img src="'+t.picture+'" alt="" class="PhotoSelector_photoAvatar" /></span></a>'}}},{key:"_sortPhotos",value:function(t,e){return t.upperCaseName===e.upperCaseName?0:t.upperCaseName>e.upperCaseName?1:t.upperCaseName<e.upperCaseName?-1:void 0}},{key:"_log",value:function(){this._settings.debug&&window.console&&console.log(Array.prototype.slice.call(arguments))}},{key:"_htmlEntities",value:function(t){return t?String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):""}}]),t}();h._defaultSettings={debug:!1,maxSelection:1,albumsPerPage:6,photosPerPage:500,autoDeselection:!0,callbackAlbumSelected:null,callbackAlbumUnselected:null,callbackPhotoSelected:null,callbackPhotoUnselected:null,callbackMaxSelection:null,callbackSubmit:null,disabledClass:"PhotoSelector_disabled",albumSelectedClass:"PhotoSelector_photoSelected",albumDisabledClass:"PhotoSelector_photoDisabled",photoFilteredClass:"PhotoSelector_photoFiltered",containerSelector:"#PhotoSelector",albumsContainerSelector:".PhotoSelector_albumContainer",photosContainerSelector:".PhotoSelector_photoContainer",photosWrapperSelector:".PhotoSelector_wrapper",selectedPhotoCountSelector:".PhotoSelector_selectedPhotoCount",selectedPhotoCountMaxSelector:".PhotoSelector_selectedPhotoCountMax",pageNumberSelector:"#PhotoSelector_pageNumber",pageNumberTotalSelector:"#PhotoSelector_pageNumberTotal",pagePrevSelector:"#PhotoSelector_pagePrev",pageNextSelector:"#PhotoSelector_pageNext",buttonBackToAlbumsSelector:"#PhotoSelector_backToAlbums",buttonCloseSelector:"#PhotoSelector_buttonClose",buttonOKSelector:"#PhotoSelector_buttonOK",buttonCancelSelector:"#PhotoSelector_buttonCancel",loader:"#PhotoSelector_loader",pagination:".PhotoSelector_pageNumberContainer, #PhotoSelector_pagePrev, #PhotoSelector_pageNext",i18n:{choose:"Choose from Photos",browse_albums:"Browse your albums until you find a picture you want to use",select_an_album:"Select an album",select_a_photo:"Select a new photo",photos_selected:"photo(s) selected",back_to_albums:"Back to albums",previous:"Previous",next:"Next",page:"Page",OK:"OK",cancel:"Cancel",permission_error:"It looks like we don’t have permission to see the pictures. Please log out and log in again"}},h._HTML='\n<div id="PhotoSelector" hidden>\n <div class="PhotoSelector_dialog">\n <a href="#" id="PhotoSelector_buttonClose">×</a>\n <div class="PhotoSelector_form">\n <div class="PhotoSelector_header">\n <p>{choose}</p>\n </div>\n\n <div class="PhotoSelector_content AlbumSelector_wrapper">\n <p>{browse_albums}</p>\n <div class="PhotoSelector_searchContainer PhotoSelector_clearfix">\n <div class="PhotoSelector_selectedCountContainer">{select_an_album}</div>\n </div>\n <div class="PhotoSelector_photosContainer PhotoSelector_albumContainer"></div>\n </div>\n\n <div class="PhotoSelector_content PhotoSelector_wrapper" hidden>\n <p>{select_a_photo}</p>\n <div class="PhotoSelector_searchContainer PhotoSelector_clearfix">\n <div class="PhotoSelector_selectedCountContainer"><span class="PhotoSelector_selectedPhotoCount">0</span> / <span class="PhotoSelector_selectedPhotoCountMax">0</span> {photos_selected}</div>\n <a href="#" id="PhotoSelector_backToAlbums">{back_to_albums}</a>\n </div>\n <div class="PhotoSelector_photosContainer PhotoSelector_photoContainer"></div>\n </div>\n\n <div id="PhotoSelector_loader" hidden></div>\n\n\n <div class="PhotoSelector_footer PhotoSelector_clearfix">\n <a href="#" id="PhotoSelector_pagePrev" class="PhotoSelector_disabled" hidden>{previous}</a>\n <a href="#" id="PhotoSelector_pageNext" hidden>{next}</a>\n <div class="PhotoSelector_pageNumberContainer" hidden>\n {page} <span id="PhotoSelector_pageNumber">1</span> / <span id="PhotoSelector_pageNumberTotal">1</span>\n </div>\n <a href="#" id="PhotoSelector_buttonOK">{OK}</a>\n <a href="#" id="PhotoSelector_buttonCancel">{cancel}</a>\n </div>\n </div>\n </div>\n</div>\n'},function(t,e){"use strict";function o(t){return"string"==typeof t?document.querySelectorAll(t):t}function s(t,e){if(t)if(t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))for(var n=0;n<t.length;++n)s(t[n],e);else i(t,e)||(t.classList?t.classList.add(e):t.className+=" "+e)}function n(t,e){if(t)if(t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))for(var s=0;s<t.length;++s)n(t[s],e);else t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")}function i(t,e){if(t){if(t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t)){for(var s=!0,n=0;n<t.length;++n)i(t[n],e)||(s=!1);return s}return t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)}}function l(t,e,i){if(t)if(t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))for(var a=0;a<t.length;++a)l(t[a],e,i);else i?s(t,e):n(t,e)}function a(t,e){return t?(t=o(t),(t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))&&(t=t[0]),getComputedStyle(t).getPropertyValue(e)):void 0}function r(t){if(t)if(t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))for(var e=0;e<t.length;++e)r(t[e]);else t.removeAttribute("hidden")}function c(t){if(t)if(t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))for(var e=0;e<t.length;++e)c(t[e]);else t.setAttribute("hidden",!0)}function h(t){if(t){if(p&&10>p)return void t.removeAttribute("hidden");if(b(),t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))for(var e=0;e<t.length;++e)h(t[e]);else{t.removeAttribute("hidden");var i=function l(e){n(e.target,"PSanimated"),n(e.target,"PSfadeIn"),g(t,"AnimationEnd",l)};m(t,"AnimationEnd",i),s(t,"PSanimated"),s(t,"PSfadeIn")}}}function u(t){if(t){if(p&&10>p)return void t.setAttribute("hidden");if(b(),t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))for(var e=0;e<t.length;++e)u(t[e]);else{var i=function l(e){e.target.setAttribute("hidden",!0),n(e.target,"PSanimated"),n(e.target,"PSfadeOut"),g(t,"AnimationEnd",l)};m(t,"AnimationEnd",i),s(t,"PSanimated"),s(t,"PSfadeOut")}}}function d(t){if(t){if(p&&10>p)return void t.removeAttribute("hidden");if(b(),t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))for(var e=0;e<t.length;++e)d(t[e]);else{t.removeAttribute("hidden");var i=function l(e){n(e.target,"PSanimated"),n(e.target,"PSslideInRight"),g(t,"AnimationEnd",l)};m(t,"AnimationEnd",i),s(t,"PSanimated"),s(t,"PSslideInRight")}}}function f(t){if(t){if(p&&10>p)return void t.setAttribute("hidden");if(b(),t=o(t),t instanceof NodeList||t instanceof HTMLCollection||Array.isArray(t))for(var e=0;e<t.length;++e)f(t[e]);else{var i=function l(e){e.target.setAttribute("hidden",!0),n(e.target,"PSanimated"),n(e.target,"PSslideOutRight"),g(t,"AnimationEnd",l)};m(t,"AnimationEnd",i),s(t,"PSanimated"),s(t,"PSslideOutRight")}}}function _(t,e,o){t.insertRule(e+"{"+o+"}",0)}function b(){if(!v){var t=document.createElement("style");t.appendChild(document.createTextNode("")),document.head.appendChild(t),v=t.sheet,_(v,".PSanimated","\n animation-duration: 0.35s; -webkit-animation-duration: 0.35s;\n animation-fill-mode: both; -webkit-animation-fill-mode: both;\n animation-timing-function: ease-in-out; -webkit-animation-timing-function: ease-in-out;\n ");var e={fadeIn:"\n 0% { opacity: 0; }\n 70% { opacity: 1; }\n 100% { opacity: 1; }\n ",fadeOut:"\n 0% { opacity: 1; }\n 70% { opacity: 0; }\n 100% { opacity: 0; }\n ",slideInRight:"\n from {\n transform: translate3d(100%, 0, 0); -webkit-transform: translate3d(100%, 0, 0);\n visibility: visible;\n }\n to { transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); }\n ",slideOutRight:"\n from { transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); }\n to {\n visibility: hidden;\n transform: translate3d(100%, 0, 0); -webkit-transform: translate3d(100%, 0, 0);\n }\n "};for(var o in e)_(v,"@-webkit-keyframes PS"+o,e[o]),_(v,"@keyframes PS"+o,e[o]),_(v,".PS"+o,"\n animation-name: PS"+o+"; -webkit-animation-name: PS"+o+";\n ")}}function m(t,e,s){t=o(t);for(var n=0;n<S.length;n++)S[n]||(e=e.toLowerCase()),t.addEventListener(S[n]+e,s,!1)}function g(t,e,s){t=o(t);for(var n=0;n<S.length;n++)S[n]||(e=e.toLowerCase()),t.removeEventListener(S[n]+e,s)}Object.defineProperty(e,"__esModule",{value:!0});var p=/MSIE ([0-9]+)/g.exec(window.navigator.userAgent)?/MSIE ([0-9]+)/g.exec(window.navigator.userAgent)[1]:void 0,v=!1,S=["webkit","moz","MS","o",""];e["default"]={addClass:s,removeClass:n,hasClass:i,toggleClass:l,css:a,show:r,hide:c,fadeIn:h,fadeOut:u,slideInRight:d,slideOutRight:f}},function(t,e){"use strict";function o(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function s(t){t=t||{};for(var e=1;e<arguments.length;e++){var n=arguments[e];if(n)for(var i in n)n.hasOwnProperty(i)&&("object"===o(n[i])?t[i]=s(t[i],n[i]):t[i]=n[i])}return t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={merge:s}}])}); | ||
//# sourceMappingURL=facebook-photo-selector.min.js.map |
{ | ||
"name": "facebook-photo-selector", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "A Vanilla JS plugin to create a Facebook photo selector (based on https://github.com/cshold/jQuery-Facebook-Photo-Selector)", | ||
@@ -5,0 +5,0 @@ "main": "build/facebook-photo-selector.js", |
@@ -150,3 +150,3 @@ function _elize(element) { | ||
if (_ie && _ie < 10) { | ||
element.addAttribute('hidden'); | ||
element.setAttribute('hidden'); | ||
return; | ||
@@ -209,3 +209,3 @@ } | ||
if (_ie && _ie < 10) { | ||
element.addAttribute('hidden'); | ||
element.setAttribute('hidden'); | ||
return; | ||
@@ -212,0 +212,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
235321