Version Description
- Fix : Random thumbnails not loading in FireFox
- Update : FooGallery client side 1.1.8
Download this release
Release Info
Developer | bradvin |
Plugin | ![]() |
Version | 1.6.11 |
Comparing to | |
See all releases |
Code changes from version 1.6.7 to 1.6.11
- README.txt +13 -1
- extensions/default-templates/shared/js/foogallery.js +13 -5
- extensions/default-templates/shared/js/foogallery.min.js +3 -3
- extensions/demo-content-generator/class-demo-content-generator.php +4 -2
- foogallery.php +2 -2
- freemius/assets/css/admin/dialog-boxes.css +2 -2
- freemius/assets/scss/_colors.scss +79 -79
- freemius/assets/scss/admin/_buttons.scss +27 -27
- freemius/assets/scss/admin/_subscription-cancellation.scss +29 -29
- freemius/assets/scss/admin/dialog-boxes.scss +9 -9
- freemius/assets/scss/admin/plugin-upgrade-notice.scss +7 -7
- freemius/includes/entities/class-fs-plugin.php +141 -141
- freemius/includes/entities/class-fs-site.php +229 -229
- freemius/includes/managers/class-fs-admin-menu-manager.php +968 -968
- freemius/includes/supplements/fs-essential-functions-1.1.7.1.php +43 -43
- freemius/includes/supplements/fs-essential-functions-2.2.1.php +44 -44
- freemius/languages/freemius-da_DK.po +2434 -2434
- freemius/languages/freemius-en.po +2320 -2320
- freemius/languages/freemius-es_ES.po +2433 -2433
- freemius/languages/freemius-fr_FR.po +2433 -2433
- freemius/languages/freemius-he_IL.po +2434 -2434
- freemius/languages/freemius-it_IT.po +2436 -2436
- freemius/languages/freemius-ja_JP.po +2436 -2436
- freemius/languages/freemius-nl_NL.po +2434 -2434
- freemius/languages/freemius-ru_RU.po +2433 -2433
- freemius/languages/freemius.pot +2317 -2317
- freemius/templates/debug.php +724 -724
- freemius/templates/forms/premium-versions-upgrade-handler.php +204 -204
- freemius/templates/forms/premium-versions-upgrade-metadata.php +44 -44
- freemius/templates/forms/subscription-cancellation.php +276 -276
- gutenberg/class-foogallery-gutenberg.php +4 -0
- includes/admin/class-gallery-metabox-settings-helper.php +1 -1
- includes/admin/class-gallery-metabox-settings.php +28 -0
- js/foogallery.admin.min.js +1 -1
README.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: bradvin, steveush, fooplugins, freemius
|
|
3 |
Donate link: http://fooplugins.com
|
4 |
Tags: gallery, image gallery, photo gallery, responsive, album, media gallery, masonry gallery, portfolio, justified gallery, video gallery, photography, youtube gallery
|
5 |
Requires at least: 3.9
|
6 |
-
Tested up to: 5.0
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -143,9 +143,21 @@ Update now to get all the latest features, bug fixes and improvements!
|
|
143 |
|
144 |
== Changelog ==
|
145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
= 1.6.7 =
|
147 |
* New : added new filter for allowed post types that foogallery can be attached to
|
148 |
* New : added loop setting for image viewer gallery template
|
|
|
149 |
* Fix : Beaver Builder javascript error while editing a page
|
150 |
* Fix : album shortcodes not working in some page builders
|
151 |
* Fix : attach gallery to post when gutenberg block is included
|
3 |
Donate link: http://fooplugins.com
|
4 |
Tags: gallery, image gallery, photo gallery, responsive, album, media gallery, masonry gallery, portfolio, justified gallery, video gallery, photography, youtube gallery
|
5 |
Requires at least: 3.9
|
6 |
+
Tested up to: 5.0.2
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
143 |
|
144 |
== Changelog ==
|
145 |
|
146 |
+
= 1.6.11 =
|
147 |
+
* Fix : Random thumbnails not loading in FireFox
|
148 |
+
* Update : FooGallery client side 1.1.8
|
149 |
+
|
150 |
+
= 1.6.10 =
|
151 |
+
* Fix : Safari bug with lazy loading
|
152 |
+
* Fix : Thumbs not loading with paging
|
153 |
+
* Fix : duplicate caption title in some scenarios
|
154 |
+
* Fix : clicking html in caption was not loading lightbox
|
155 |
+
* Update : FooGallery client side 1.1.7
|
156 |
+
|
157 |
= 1.6.7 =
|
158 |
* New : added new filter for allowed post types that foogallery can be attached to
|
159 |
* New : added loop setting for image viewer gallery template
|
160 |
+
* New : override sorting in shortcode by providing "sort" attribute
|
161 |
* Fix : Beaver Builder javascript error while editing a page
|
162 |
* Fix : album shortcodes not working in some page builders
|
163 |
* Fix : attach gallery to post when gutenberg block is included
|
extensions/default-templates/shared/js/foogallery.js
CHANGED
@@ -5478,7 +5478,7 @@
|
|
5478 |
self.$caption = $("<figcaption/>").attr(attr.elem).on("click.foogallery", {self: self}, self.onCaptionClick);
|
5479 |
attr.inner["class"] = cls.inner;
|
5480 |
var $inner = $("<div/>").attr(attr.inner).appendTo(self.$caption);
|
5481 |
-
var hasTitle = !_is.empty(self.caption), hasDesc = !_is.empty(self.description);
|
5482 |
if (hasTitle || hasDesc) {
|
5483 |
attr.title["class"] = cls.title;
|
5484 |
attr.description["class"] = cls.description;
|
@@ -5683,9 +5683,15 @@
|
|
5683 |
var cls = self.cls, img = self.$image.get(0), placeholder = img.src;
|
5684 |
self.isLoading = true;
|
5685 |
self.$el.removeClass(cls.idle).removeClass(cls.loaded).removeClass(cls.error).addClass(cls.loading);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5686 |
return self._load = $.Deferred(function (def) {
|
5687 |
-
// if Firefox reset to empty src or else the onload and onerror callbacks are executed immediately
|
5688 |
-
if (!_is.undef(window.InstallTrigger)) img.src = "";
|
5689 |
img.onload = function () {
|
5690 |
img.onload = img.onerror = null;
|
5691 |
self.isLoading = false;
|
@@ -5707,7 +5713,9 @@
|
|
5707 |
def.reject(self);
|
5708 |
};
|
5709 |
// set everything in motion by setting the src
|
5710 |
-
|
|
|
|
|
5711 |
}).promise();
|
5712 |
},
|
5713 |
/**
|
@@ -5819,7 +5827,7 @@
|
|
5819 |
*/
|
5820 |
onCaptionClick: function (e) {
|
5821 |
var self = e.data.self;
|
5822 |
-
if
|
5823 |
self.$anchor.get(0).click();
|
5824 |
}
|
5825 |
}
|
5478 |
self.$caption = $("<figcaption/>").attr(attr.elem).on("click.foogallery", {self: self}, self.onCaptionClick);
|
5479 |
attr.inner["class"] = cls.inner;
|
5480 |
var $inner = $("<div/>").attr(attr.inner).appendTo(self.$caption);
|
5481 |
+
var hasTitle = self.showCaptionTitle && !_is.empty(self.caption), hasDesc = self.showCaptionDescription && !_is.empty(self.description);
|
5482 |
if (hasTitle || hasDesc) {
|
5483 |
attr.title["class"] = cls.title;
|
5484 |
attr.description["class"] = cls.description;
|
5683 |
var cls = self.cls, img = self.$image.get(0), placeholder = img.src;
|
5684 |
self.isLoading = true;
|
5685 |
self.$el.removeClass(cls.idle).removeClass(cls.loaded).removeClass(cls.error).addClass(cls.loading);
|
5686 |
+
if (self.isParsed && img.src != self._placeholder && img.complete){
|
5687 |
+
self.isLoading = false;
|
5688 |
+
self.isLoaded = true;
|
5689 |
+
self.$el.removeClass(cls.loading).addClass(cls.loaded);
|
5690 |
+
self.unfix();
|
5691 |
+
self.tmpl.raise("loaded-item", [self]);
|
5692 |
+
return self._load = _fn.resolveWith(self);
|
5693 |
+
}
|
5694 |
return self._load = $.Deferred(function (def) {
|
|
|
|
|
5695 |
img.onload = function () {
|
5696 |
img.onload = img.onerror = null;
|
5697 |
self.isLoading = false;
|
5713 |
def.reject(self);
|
5714 |
};
|
5715 |
// set everything in motion by setting the src
|
5716 |
+
setTimeout(function(){
|
5717 |
+
img.src = self.getThumbUrl();
|
5718 |
+
});
|
5719 |
}).promise();
|
5720 |
},
|
5721 |
/**
|
5827 |
*/
|
5828 |
onCaptionClick: function (e) {
|
5829 |
var self = e.data.self;
|
5830 |
+
if (self.$anchor.length > 0) {
|
5831 |
self.$anchor.get(0).click();
|
5832 |
}
|
5833 |
}
|
extensions/default-templates/shared/js/foogallery.min.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
/*
|
2 |
* FooGallery - The Most Intuitive and Extensible Gallery Creation and Management Tool Ever Created for WordPress
|
3 |
-
* @version 1.1.
|
4 |
* @link
|
5 |
* @copyright Steven Usher & Brad Vincent 2015
|
6 |
* @license Released under the GPLv3 license.
|
7 |
*/
|
8 |
|
9 |
!function(a,b){b.$=a}(jQuery,window.FooGallery=window.FooGallery||{}),function(a){if(!a)return void console.warn("jQuery must be included in the page prior to the FooGallery.utils library.");var b={$:a,version:"0.0.8"};b.versionCompare=function(a,b){function c(a){for(var b=a.split("."),c=0,d=b.length;c<d;c++)b[c]=parseInt(b[c]),isNaN(b[c])&&(b[c]=0);return b}if(!/[\d.]/.test(a)||!/[\d.]/.test(b))return NaN;for(var d=c(a),e=c(b);d.length<e.length;)d.push(0);for(;e.length<d.length;)e.push(0);for(var f=0;f<d.length;++f){if(e.length==f)return 1;if(d[f]!=e[f])return d[f]>e[f]?1:-1}return d.length!=e.length?-1:0},!function(){try{return!!window.FooGallery.utils}catch(a){return!1}}()?window.FooGallery.utils=b:b.versionCompare(b.version,window.FooGallery.utils.version)>0?(console.warn("An older version of FooGallery.utils ("+window.FooGallery.utils.version+") already exists in the page, version "+b.version+" will override it."),window.FooGallery.utils=b):console.warn("A newer version of FooGallery.utils ("+window.FooGallery.utils.version+") already exists in the page, version "+b.version+" will not register itself.")}(jQuery),function(a,b){"0.0.8"===b.version&&(b.is={},b.is.array=function(a){return"[object Array]"===Object.prototype.toString.call(a)},b.is.boolean=function(a){return"[object Boolean]"===Object.prototype.toString.call(a)},b.is.element=function(a){return"object"==typeof HTMLElement?a instanceof HTMLElement:!!a&&"object"==typeof a&&null!==a&&1===a.nodeType&&"string"==typeof a.nodeName},b.is.empty=function(a){if(b.is.undef(a)||null===a)return!0;if(b.is.number(a)&&0==a)return!0;if(b.is.boolean(a)&&!1===a)return!0;if(b.is.string(a)&&0===a.length)return!0;if(b.is.array(a)&&0===a.length)return!0;if(b.is.jq(a)&&0===a.length)return!0;if(b.is.hash(a)){for(var c in a)if(a.hasOwnProperty(c))return!1;return!0}return!1},b.is.error=function(a){return"[object Error]"===Object.prototype.toString.call(a)},b.is.fn=function(a){return a===window.alert||"[object Function]"===Object.prototype.toString.call(a)},b.is.hash=function(a){return b.is.object(a)&&a.constructor===Object&&!a.nodeType&&!a.setInterval},b.is.jq=function(c){return!b.is.undef(a)&&c instanceof a},b.is.number=function(a){return"[object Number]"===Object.prototype.toString.call(a)&&!isNaN(a)},b.is.object=function(a){return"[object Object]"===Object.prototype.toString.call(a)&&!b.is.undef(a)&&null!==a},b.is.promise=function(a){return b.is.object(a)&&b.is.fn(a.then)&&b.is.fn(a.promise)},b.is.size=function(a){return!!(b.is.string(a)&&!b.is.empty(a)||b.is.number(a))&&/^(auto|none|(?:[\d\.]*)+?(?:%|px|mm|q|cm|in|pt|pc|em|ex|ch|rem|vh|vw|vmin|vmax)?)#x2F;.test(a)},b.is.string=function(a){return"[object String]"===Object.prototype.toString.call(a)},b.is.undef=function(a){return void 0===a})}(FooGallery.utils.$,FooGallery.utils),function(a,b,c){if("0.0.8"===b.version){b.fn={};var d=Function.prototype.toString;b.fn.CONTAINS_SUPER=/xyz/.test(d.call(function(){xyz}))?/\b_super\b/:/.*/,b.fn.addOrOverride=function(a,e,f){if(c.object(a)&&c.string(e)&&!c.empty(e)&&c.fn(f)){var g=a[e],h=c.fn(g)&&b.fn.CONTAINS_SUPER.test(d.call(f));a[e]=h?function(a,b){return function(){var c=this._super;this._super=a;var d=b.apply(this,arguments);return this._super=c,d}}(g,f):f}},b.fn.apply=function(a,b){function d(){return a.apply(this,b)}return b=c.array(b)?b:[],d.prototype=a.prototype,new d},b.fn.arg2arr=function(a){return Array.prototype.slice.call(a)},b.fn.check=function(d,e,f,g){function h(a){return function(){return a.apply(d,arguments)}}return f=c.fn(f)?f:a.noop,d=c.object(d)?d:window,e=c.string(e)?b.fn.fetch(e,g):e,h(c.fn(e)?e:f)},b.fn.fetch=function(b,d){return!c.string(b)||c.empty(b)?null:(d=c.object(d)?d:window,a.each(b.split("."),function(a,b){if(!d[b])return!1;d=d[b]}),c.fn(d)?d:null)},b.fn.enqueue=function(d,e,f,g){function h(a,b){try{return n.push(a),b.apply(a,i)}catch(a){return j.reject(a,n),j}}var i=b.fn.arg2arr(arguments),j=a.Deferred(),k=a.Deferred(),l=k.promise(),m=[],n=[],o=!0;return d=i.shift(),e=i.shift(),a.each(d,function(a,d){c.fn(d[e])&&(l=l.then(function(){if(!o){var a=b.fn.arg2arr(arguments);m.push(a)}return o=!1,h(d,d[e])}))}),l.then(function(){if(!o){var a=b.fn.arg2arr(arguments);m.push(a)}o=!1,j.resolve(m)}),l.fail(function(){var a=b.fn.arg2arr(arguments);a.push(n),j.reject.apply(j,a)}),k.resolve(),j.promise()},b.fn.when=function(b){if(!c.array(b)||c.empty(b))return a.when();for(var d=a.Deferred(),e=[],f=b.length,g=0;g<b.length;g++)b[g].then(function(a){e.push(a)}).always(function(){--f||d.resolve(e)});return d.promise()},b.fn.rejectWith=function(c,d){var e=a.Deferred(),f=b.fn.arg2arr(arguments);return e.reject.apply(e,f).promise()},b.fn.resolveWith=function(c,d){var e=a.Deferred(),f=b.fn.arg2arr(arguments);return e.resolve.apply(e,f).promise()},b.fn.resolved=a.Deferred().resolve().promise(),b.fn.rejected=a.Deferred().reject().promise()}}(FooGallery.utils.$,FooGallery.utils,FooGallery.utils.is),function(a,b){if("0.0.8"===a.version){a.url={};var c=document.createElement("a");a.url.parts=function(a){return c.href=a,{hash:c.hash,host:c.host,hostname:c.hostname,href:c.href,origin:c.origin,pathname:c.pathname,port:c.port,protocol:c.protocol,search:c.search}},a.url.full=function(a){return!b.string(a)||b.empty(a)?null:(c.href=a,c.href)},a.url.param=function(a,c,d){if(!b.string(a)||!b.string(c)||b.empty(c))return a;var e,f,g,h;return b.undef(d)?(e=new RegExp("[?|&]"+c+"=([^&;]+?)(&|#|;|$)"),f=e.exec(a)||[,""],g=f[1].replace(/\+/g,"%20"),b.string(g)&&!b.empty(g)?decodeURIComponent(g):null):(""===d||null===d?(e=new RegExp("^([^#]*?)(([^#]*)&)?"+c+"(=[^&#]*)?(&|#|$)"),g=a.replace(e,"$1$3$5").replace(/^([^#]*)((\?)&|\?(#|$))/,"$1$3$4")):(e=new RegExp("([?&])"+c+"[^&]*"),h=c+"="+encodeURIComponent(d),(g=a.replace(e,"$1"+h))!==a||e.test(g)||(g+=(-1!==g.indexOf("?")?"&":"?")+h)),g)}}}(FooGallery.utils,FooGallery.utils.is),function(a,b,c){"0.0.8"===a.version&&(a.str={},a.str.camel=function(a){return b.empty(a)?a:a.toUpperCase()===a?a.toLowerCase():a.replace(/^([A-Z])|[-\s_]+(\w)/g,function(a,c,d){return b.string(d)?d.toUpperCase():c.toLowerCase()})},a.str.contains=function(a,c,d){return!(!b.string(a)||b.empty(a)||!b.string(c)||b.empty(c))&&(c.length<=a.length&&-1!==(d?a.toUpperCase().indexOf(c.toUpperCase()):a.indexOf(c)))},a.str.containsWord=function(a,c,d){if(!b.string(a)||b.empty(a)||!b.string(c)||b.empty(c)||a.length<c.length)return!1;for(var e=a.split(/\W/),f=0,g=e.length;f<g;f++)if(d?e[f].toUpperCase()==c.toUpperCase():e[f]==c)return!0;return!1},a.str.endsWith=function(a,c){return!b.string(a)||b.empty(a)||!b.string(c)||b.empty(c)?a==c:a.slice(a.length-c.length)==c},a.str.escapeRegExp=function(a){return b.empty(a)?a:a.replace(/[.*+?^${}()|[\]\\]/g,"\\amp;")},a.str.fnv1a=function(a){if(!b.string(a)||b.empty(a))return null;var c,d,e=2166136261;for(c=0,d=a.length;c<d;c++)e^=a.charCodeAt(c),e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24);return e>>>0},a.str.from=function(c,d){return!b.string(c)||b.empty(c)||!b.string(d)||b.empty(d)?null:a.str.contains(c,d)?c.substring(c.indexOf(d)+d.length):null},a.str.join=function(d,e,f){if(!b.string(d)||!b.string(e))return null;var g=c.arg2arr(arguments);d=g.shift();var h,i,j=g.shift();for(h=0,i=g.length;h<i;h++)e=g[h],b.empty(e)||(a.str.endsWith(j,d)&&(j=j.slice(0,j.length-d.length)),a.str.startsWith(e,d)&&(e=e.slice(d.length)),j+=d+e);return j},a.str.startsWith=function(a,c){return!b.empty(a)&&!b.empty(c)&&a.slice(0,c.length)==c},a.str.until=function(c,d){return b.empty(c)||b.empty(d)?c:a.str.contains(c,d)?c.substring(0,c.indexOf(d)):c},a.str.format=function(a,d,e){var f=c.arg2arr(arguments);if(a=f.shift(),b.empty(a)||b.empty(f))return a;1===f.length&&(b.array(f[0])||b.object(f[0]))&&(f=f[0]);for(var g in f)a=a.replace(new RegExp("\\{"+g+"\\}","gi"),f[g]);return a})}(FooGallery.utils,FooGallery.utils.is,FooGallery.utils.fn),function(a,b,c,d,e){if("0.0.8"===b.version){b.obj={};var f=function(){};b.obj.create=function(a){if(!c.object(a))throw TypeError("Argument must be an object");f.prototype=a;var b=new f;return f.prototype=null,b},b.obj.extend=function(e,f,g){e=c.object(e)?e:{};var h=d.arg2arr(arguments);return h.shift(),a.each(h,function(a,c){b.obj.merge(e,c)}),e},b.obj.merge=function(a,d){a=c.hash(a)?a:{},d=c.hash(d)?d:{};for(var e in d)d.hasOwnProperty(e)&&(c.hash(d[e])?(a[e]=c.hash(a[e])?a[e]:{},b.obj.merge(a[e],d[e])):c.array(d[e])?a[e]=d[e].slice():a[e]=d[e]);return a},b.obj.mergeValid=function(d,e,f,g){if(!c.hash(f)||!c.hash(e))return d;e=c.hash(e)?e:{},g=c.hash(g)?g:{};var h,i,j;for(h in e)e.hasOwnProperty(h)&&c.fn(e[h])&&(i=c.array(g[h])?g[h]:c.string(g[h])?[g[h]]:[h],a.each(i,function(a,g){if(j=b.obj.prop(f,g),!c.undef(j))return e[h](j)?(b.obj.prop(d,h,j),!1):void 0}));return d},b.obj.prop=function(b,d,f){if(c.object(b)&&!c.empty(d)){var g,h;if(c.undef(f))return e.contains(d,".")?(g=d.split("."),h=g.length-1,a.each(g,function(a,d){if(a===h)f=b[d];else{if(!c.hash(b[d]))return!1;b=b[d]}})):c.undef(b[d])||(f=b[d]),f;e.contains(d,".")?(g=d.split("."),h=g.length-1,a.each(g,function(a,d){a===h?b[d]=f:b=c.hash(b[d])?b[d]:b[d]={}})):c.undef(b[d])||(b[d]=f)}}}}(FooGallery.utils.$,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.fn,FooGallery.utils.str),function(a,b,c){if("0.0.8"===b.version){b.ready=function(a){function c(){try{a.call(window,b.$)}catch(a){console.error(a)}}(Function("/*@cc_on return true@*/")()?"complete"===document.readyState:"loading"!==document.readyState)?c():document.addEventListener("DOMContentLoaded",c,!1)};var d=0;b.uniqueId=function(a,b){var e=a.attr("id");return c.empty(e)&&(b=c.string(b)&&!c.empty(b)?b:"uid-",e=b+ ++d,a.attr("id",e).data("__uniqueId__",!0)),e},b.removeUniqueId=function(a){a.data("__uniqueId__")&&a.removeAttr("id").removeData("__uniqueId__")}}}(FooGallery.utils.$,FooGallery.utils,FooGallery.utils.is),function(a,b,c){if("0.0.8"===b.version){b.transition={};var d=document.createElement("div");b.transition.supported=function(a){var b=a.style;return c.string(b.transition)||c.string(b.WebkitTransition)||c.string(b.MozTransition)||c.string(b.msTransition)||c.string(b.OTransition)}(d),b.transition.end=function(a){var b=a.style;return c.string(b.transition)?"transitionend":c.string(b.WebkitTransition)?"webkitTransitionEnd":c.string(b.MozTransition)?"transitionend":c.string(b.msTransition)?"msTransitionEnd":c.string(b.OTransition)?"oTransitionEnd":null}(d),b.transition.duration=function(a,b){if(b=c.number(b)?b:0,!c.jq(a))return b;var d=a.css("transition-duration");if(/^([\d\.]*)+?(ms|s)#x2F;i.test(d)){var e=d.match(/^([\d\.]*)+?(ms|s)#x2F;i),f=parseFloat(e[1]);return"s"===e[2].toLowerCase()&&(f*=1e3),f}return b},b.transition.start=function(d,e,f,g){var h=a.Deferred();if(d=d.first(),b.transition.supported){var i=d.data("transition_safety");c.hash(i)&&c.number(i.timer)&&(clearTimeout(i.timer),d.removeData("transition_safety").off(b.transition.end+".utils"),i.deferred.reject()),g=c.number(g)?g:b.transition.duration(d)+50,i={deferred:h,timer:setTimeout(function(){d.removeData("transition_safety").off(b.transition.end+".utils"),h.resolve()},g)},d.data("transition_safety",i),d.on(b.transition.end+".utils",function(a){d.is(a.target)&&(clearTimeout(i.timer),d.removeData("transition_safety").off(b.transition.end+".utils"),h.resolve())})}return setTimeout(function(){c.fn(e)?e.apply(d.get(0),[d]):d.toggleClass(e,f),b.transition.supported||h.resolve()},20),h.promise()}}}(FooGallery.utils.$,FooGallery.utils,FooGallery.utils.is),function(a,b,c,d,e){"0.0.8"===b.version&&(b.Class=function(){},b.Class.extend=function(a){function f(){if(!c.fn(this.construct))throw new SyntaxError('FooGallery.utils.Class objects must be constructed with the "new" keyword.');this.construct.apply(this,arguments)}a=c.hash(a)?a:{};var g=d.create(this.prototype);for(var h in a)a.hasOwnProperty(h)&&e.addOrOverride(g,h,a[h]);return g.construct=c.fn(g.construct)?g.construct:function(){},f.prototype=g,f.prototype.constructor=c.fn(g.__ctor__)?g.__ctor__:f,f.extend=b.Class.extend,f.override=b.Class.override,f},b.Class.override=function(a,b){e.addOrOverride(this.prototype,a,b)})}(FooGallery.utils.$,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.obj,FooGallery.utils.fn),function(a,b,c){if("0.0.8"===b.version){b.Bounds=b.Class.extend({construct:function(){var a=this;a.top=0,a.right=0,a.bottom=0,a.left=0,a.width=0,a.height=0},inflate:function(a){var b=this;return c.number(a)&&(b.top-=a,b.right+=a,b.bottom+=a,b.left-=a,b.width+=2*a,b.height+=2*a),b},intersects:function(a){var b=this;return b.left<=a.right&&a.left<=b.right&&b.top<=a.bottom&&a.top<=b.bottom}});var d;b.getViewportBounds=function(c){d||(d=a(window));var e=new b.Bounds;return e.top=d.scrollTop(),e.left=d.scrollLeft(),e.width=d.width(),e.height=d.height(),e.right=e.left+e.width,e.bottom=e.top+e.height,e.inflate(c),e},b.getElementBounds=function(d){c.jq(d)||(d=a(d));var e=new b.Bounds;if(0!==d.length){var f=d.offset();e.top=f.top,e.left=f.left,e.width=d.width(),e.height=d.height()}return e.right=e.left+e.width,e.bottom=e.top+e.height,e}}}(FooGallery.utils.$,FooGallery.utils,FooGallery.utils.is),function(a,b,c,d){"0.0.8"===b.version&&(b.Factory=b.Class.extend({construct:function(){this.registered={}},contains:function(a){return!c.undef(this.registered[a])},load:function(b,e,f){var g,h,i=this,j=d.arg2arr(arguments),k=[],l=[];b=j.shift()||{};for(g in i.registered)if(i.registered.hasOwnProperty(g)){var m=i.registered[g];b.hasOwnProperty(g)&&(h=b[g],c.string(h)&&(h=d.fetch(b[g])),c.fn(h)&&(m={name:g,klass:h,priority:i.registered[g].priority})),k.push(m)}for(g in b)b.hasOwnProperty(g)&&!i.registered.hasOwnProperty(g)&&(h=b[g],c.string(h)&&(h=d.fetch(b[g])),c.fn(h)&&k.push({name:g,klass:h,priority:0}));return k.sort(function(a,b){return b.priority-a.priority}),a.each(k,function(a,b){c.fn(b.klass)&&l.push(d.apply(b.klass,j))}),l},make:function(a,b,e){var f,g=this,h=d.arg2arr(arguments);return a=h.shift(),f=g.registered[a],c.hash(f)&&c.fn(f.klass)?d.apply(f.klass,h):null},names:function(b){b=!!c.boolean(b)&&b;var d,e=[];if(b){var f=[];for(d in this.registered)this.registered.hasOwnProperty(d)&&f.push(this.registered[d]);f.sort(function(a,b){return b.priority-a.priority}),a.each(f,function(a,b){e.push(b.name)})}else for(d in this.registered)this.registered.hasOwnProperty(d)&&e.push(d);return e},register:function(a,b,d){if(!c.string(a)||c.empty(a)||!c.fn(b))return!1;d=c.number(d)?d:0;var e=this.registered[a];return this.registered[a]={name:a,klass:b,priority:c.undef(e)?d:e.priority},!0}}))}(FooGallery.utils.$,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.fn),function(a,b,c){if("0.0.8"===a.version){var d=!1;try{d=!!window.localStorage}catch(a){d=!1}a.Debugger=a.Class.extend({construct:function(a){this.key=a,this.enabled=!!d&&!!localStorage.getItem(this.key)},enable:function(){d&&(this.enabled=!0,localStorage.setItem(this.key,this.enabled))},disable:function(){d&&(this.enabled=!1,localStorage.removeItem(this.key))},log:function(a,c){this.enabled&&console.log.apply(console,b.arg2arr(arguments))},logf:function(a,d,e){if(this.enabled){var f=b.arg2arr(arguments);a=f.shift(),d=f.shift(),f.unshift(c.format(a,d)),this.log.apply(this,f)}}})}}(FooGallery.utils,FooGallery.utils.fn,FooGallery.utils.str),function(a,b,c){"0.0.8"===b.version&&(b.Throttle=b.Class.extend({construct:function(a){this.id=null,this.active=!1,this.idle=c.number(a)?a:0},limit:function(a){if(c.fn(a)){this.clear();var b=this;this.active=!0,this.id=setTimeout(function(){b.active=!1,b.id=null,a()},this.idle)}},clear:function(){c.number(this.id)&&(clearTimeout(this.id),this.active=!1,this.id=null)}}))}(FooGallery.utils.$,FooGallery.utils,FooGallery.utils.is),function(a,b,c,d,e){b.debug=new c.Debugger("__FooGallery__"),c.selectify=function(b){if(d.empty(b))return null;if(d.hash(b)){var e,f={};for(var g in b)b.hasOwnProperty(g)&&(e=c.selectify(b[g]))&&(f[g]=e);return f}return d.string(b)||d.array(b)?(d.string(b)&&(b=[b]),a.map(b,function(a){return d.string(a)?"."+a.split(/\s/g).join("."):null}).join(",")):null},b.emptyImage="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",b.dataTemplate="__FooGallery__",b.dataItem="__FooGalleryItem__",b.init=function(a,c){return b.template.make(a,c).initialize()},b.initAll=function(c){return e.when(a(".foogallery").map(function(a,d){return b.init(c,d)}).get())},b.parseSrc=function(b,c,e,f,g,h){if(!d.string(b))return null;if(!d.string(f))return b;var i=a.map(f.replace(/(\s[\d.]+[whx]),/g,"$1 @,@ ").split(" @,@ "),function(a){return{url:/^\s*(\S*)/.exec(a)[1],w:parseFloat((/\S\s+(\d+)w/.exec(a)||[0,1/0])[1]),h:parseFloat((/\S\s+(\d+)h/.exec(a)||[0,1/0])[1]),x:parseFloat((/\S\s+([\d.]+)x/.exec(a)||[0,1])[1])}});if(!i.length)return b;i.unshift({url:b,w:i[0].w!==1/0&&i[0].h===1/0?c:1/0,h:i[0].h!==1/0&&i[0].w===1/0?e:1/0,x:1});var j,k=window.devicePixelRatio||1,l={w:g*k,h:h*k,x:k};for(j in l)l.hasOwnProperty(j)&&(i=a.grep(i,function(a,b){return function(c){return c[a]>=l[a]||c[a]===b}}(j,Math.max.apply(null,a.map(i,function(a){return a[j]})))));for(j in l)l.hasOwnProperty(j)&&(i=a.grep(i,function(a,b){return function(c){return c[a]===b}}(j,Math.min.apply(null,a.map(i,function(a){return a[j]})))));return i[0].url},a.fn.foogallery=function(c,e){return this.each(function(f,g){if(d.string(c)){var h=a.data(g,b.dataTemplate);if(h instanceof b.Template)switch(c){case"layout":return void h.layout();case"destroy":return void h.destroy()}}else b.template.make(c,g).initialize().then(function(a){d.fn(e)&&e(a)})})}}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.fn),function(a,b,c,d,e){var f="__FooGallerySwipe__",g="ontouchstart"in window,h=window.navigator.msPointerEnabled&&!window.navigator.pointerEnabled&&!g,i=(window.navigator.pointerEnabled||window.navigator.msPointerEnabled)&&!g,j=g||i;b.Swipe=c.Class.extend({construct:function(b,c){var d=this,f=".fgswipe";d.$el=a(b),d.opt=e.extend({threshold:20,allowPageScroll:!1,swipe:a.noop,data:{}},c),d.active=!1,d.startPoint=null,d.endPoint=null,d.events={start:(j?i?h?"MSPointerDown":"pointerdown":"touchstart":"mousedown")+f,move:(j?i?h?"MSPointerMove":"pointermove":"touchmove":"mousemove")+f,end:(j?i?h?"MSPointerUp":"pointerup":"touchend":"mouseup")+f,leave:(j?i?"mouseleave":null:"mouseleave")+f}},init:function(){var a=this;a.$el.on(a.events.start,{self:a},a.onStart),a.$el.on(a.events.move,{self:a},a.onMove),a.$el.on(a.events.end,{self:a},a.onEnd),d.string(a.events.leave)&&a.$el.on(a.events.leave,{self:a},a.onEnd),a.$el.data(f,a)},destroy:function(){var a=this;a.$el.off(a.events.start,a.onStart),a.$el.off(a.events.move,a.onMove),a.$el.off(a.events.end,a.onEnd),d.string(a.events.leave)&&a.$el.off(a.events.leave,a.onEnd),a.$el.removeData(f)},getAngle:function(a,b){var c=Math.atan2(a.x-b.x,a.y-b.y),d=Math.round(180*c/Math.PI);return 360-(d<0?360-Math.abs(d):d)},getDistance:function(a,b){var c=b.x-a.x,d=b.y-a.y;return c*=c,d*=d,Math.sqrt(c+d)},getDirection:function(a,b){var c=this,d=c.getAngle(a,b);return d>337.5||d<=22.5?"N":d>22.5&&d<=67.5?"NE":d>67.5&&d<=112.5?"E":d>112.5&&d<=157.5?"SE":d>157.5&&d<=202.5?"S":d>202.5&&d<=247.5?"SW":d>247.5&&d<=292.5?"W":d>292.5&&d<=337.5?"NW":"NONE"},getPoint:function(a){var b;return j&&!d.empty(b=a.originalEvent.touches||a.touches)?{x:b[0].pageX,y:b[0].pageY}:d.number(a.pageX)&&d.number(a.pageY)?{x:a.pageX,y:a.pageY}:null},getOffset:function(a){var b=this,c=b.$el.offset();return{left:a.x-c.left,top:a.y-c.top}},onStart:function(a){var b=a.data.self,c=b.getPoint(a);d.empty(c)||(b.active=!0,b.startPoint=b.endPoint=c)},onMove:function(a){var b=a.data.self,c=b.getPoint(a);b.active&&!d.empty(c)&&(b.endPoint=c,b.opt.allowPageScroll||a.preventDefault())},onEnd:function(a){var b=a.data.self;if(b.active){b.active=!1;var c={startPoint:b.startPoint,endPoint:b.endPoint,startOffset:b.getOffset(b.startPoint),endOffset:b.getOffset(b.endPoint),angle:b.getAngle(b.startPoint,b.endPoint),distance:b.getDistance(b.startPoint,b.endPoint),direction:b.getDirection(b.startPoint,b.endPoint)};if(b.opt.threshold>0&&c.distance<b.opt.threshold)return;b.opt.swipe.apply(this,[c,b.opt.data]),b.startPoint=null,b.endPoint=null}}}),a.fn.fgswipe=function(c){return this.each(function(){var e=a(this),g=e.data(f);if(g instanceof b.Swipe){if(d.string(c)&&d.fn(g[c]))return void g[c]();g.destroy()}d.hash(c)&&(g=new b.Swipe(this,c),g.init())})}}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.obj),function(a,b,c,d,e,f){b.TemplateFactory=c.Factory.extend({construct:function(){this.registered={}},register:function(a,b,c,e,f,g){var h=this,i=h._super(a,b,g);if(i){var j=h.registered;j[a].opt=d.hash(c)?c:{},j[a].cls=d.hash(e)?e:{},j[a].il8n=d.hash(f)?f:{}}return i},make:function(b,c){c=d.jq(c)?c:a(c),b=f.extend({},b,c.data("foogallery"));var e=this,g=e.type(b,c);return e.contains(g)?(b=e.options(g,b),e._super(g,b,c)):null},type:function(b,e){e=d.jq(e)?e:a(e);var f=this,g=d.hash(b)&&d.hash(b)&&d.string(b.type)&&f.contains(b.type)?b.type:"core";if("core"===g&&e.length>0)for(var h=f.registered,i=f.names(!0),j=0,k=i.length;j<k;j++)if(h.hasOwnProperty(i[j])){var l=i[j],m=h[l].cls;if(d.string(m.container)){var n=c.selectify(m.container);if(e.is(n)){g=i[j];break}}}return g},configure:function(a,b,c,d){var e=this;if(e.contains(a)){var g=e.registered;f.extend(g[a].opt,b),f.extend(g[a].cls,c),f.extend(g[a].il8n,d)}},options:function(a,c){c=f.extend({type:a},c);var e=this,g=e.registered,h=g.core.opt,i=g.core.cls,j=g.core.il8n;return d.hash(c.cls)||(c.cls={}),d.hash(c.il8n)||(c.il8n={}),d.undef(b.filtering)||(c=b.filtering.merge(c)),d.undef(b.paging)||(c=b.paging.merge(c)),"core"!==a&&e.contains(a)?(c=f.extend({},h,g[a].opt,c),c.cls=f.extend({},i,g[a].cls,c.cls),c.il8n=f.extend({},j,g[a].il8n,c.il8n)):(c=f.extend({},h,c),c.cls=f.extend({},i,c.cls),c.il8n=f.extend({},j,c.il8n)),c}}),b.template=new b.TemplateFactory}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.fn,FooGallery.utils.obj),function(a,b,c,d,e){a.PagingFactory=b.Factory.extend({construct:function(){this.registered={}},register:function(a,b,d,e,f,g,h){var i=this,j=i._super(a,b,h);if(j){var k=i.registered;k[a].ctrl=c.fn(d)?d:null,k[a].opt=c.hash(e)?e:{},k[a].cls=c.hash(f)?f:{},k[a].il8n=c.hash(g)?g:{}}return j},type:function(a){var b,d=this;return c.hash(a)&&c.hash(b=a.paging)&&c.string(b.type)&&d.contains(b.type)?b.type:null},merge:function(a){a=e.extend({},a);var b=this,d=b.type(a),f=b.registered,g=f.default.opt,h=f.default.cls,i=f.default.il8n,j=c.hash(a.paging)?a.paging:{},k=c.hash(a.cls)&&c.hash(a.cls.paging)?e.extend({},a.cls.paging):{},l=c.hash(a.il8n)&&c.hash(a.il8n.paging)?e.extend({},a.il8n.paging):{};return c.hash(a.cls)||(a.cls={}),c.hash(a.il8n)||(a.il8n={}),"default"!==d&&b.contains(d)?(a.paging=e.extend({},g,f[d].opt,j,{type:d}),a.cls=e.extend(a.cls,{paging:h},{paging:f[d].cls},{paging:k}),a.il8n=e.extend(a.il8n,{paging:i},{paging:f[d].il8n},{paging:l})):(a.paging=e.extend({},g,j,{type:d}),a.cls=e.extend(a.cls,{paging:h},{paging:k}),a.il8n=e.extend(a.il8n,{paging:i},{paging:l})),a},configure:function(a,b,c,d){var f=this;if(f.contains(a)){var g=f.registered;e.extend(g[a].opt,b),e.extend(g[a].cls,c),e.extend(g[a].il8n,d)}},hasCtrl:function(a){var b=this,d=b.registered[a];return c.hash(d)&&c.fn(d.ctrl)},makeCtrl:function(a,b,d,e){var f=this,g=f.registered[a];return c.hash(g)&&c.fn(g.ctrl)?new g.ctrl(b,d,e):null}}),a.paging=new a.PagingFactory}(FooGallery,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.fn,FooGallery.utils.obj),function(a,b,c,d,e,f){var g=0;b.Template=c.Class.extend({construct:function(e,f){var h=this;h.namespace=".foogallery-"+ ++g,h.$el=d.jq(f)?f:a(f),h.opt=e,h.template=e.template,h.id=h.$el.prop("id")||e.id,h.cls=e.cls,h.il8n=e.il8n,h.sel=c.selectify(h.cls),h.items=b.components.make("items",h),h.pages=d.undef(b.paging)?null:b.paging.make(e.paging.type,h),h.filter=d.undef(b.filtering)?null:b.filtering.make(e.filtering.type,h),h.state=b.components.make("state",h),h._initialize=null,h.initializing=!1,h.initialized=!1,h.destroying=!1,h.destroyed=!1,h._undo={classes:"",style:"",create:!1,children:!1}},initialize:function(f){var g=this;return d.promise(g._initialize)?g._initialize:(f=d.jq(f)?f:a(f),g._initialize=a.Deferred(function(h){if(g.initializing=!0,0===f.length&&0===g.$el.parent().length)return void h.reject("A parent element is required.");0===g.$el.length&&(g.$el=g.create(),g._undo.create=!0),f.length>0&&g.$el.appendTo(f);var i,j=a.Deferred(),k=j.promise();g.$el.length>0&&(i=g.$el.data(b.dataTemplate))instanceof b.Template?k=k.then(function(){return i.destroy().then(function(){g.$el.data(b.dataTemplate,g)})}):g.$el.data(b.dataTemplate,g),k.then(function(){if(g.destroying)return e.rejectWith("destroy in progress");d.empty(g.opt.on)||g.$el.on(g.opt.on),g._undo.classes=g.$el.attr("class"),g._undo.style=g.$el.attr("style"),g.$el.is(g.sel.container)||g.$el.addClass(g.cls.container);var a=c.selectify(g.opt.classes);return null==a||g.$el.is(a)||g.$el.addClass(g.opt.classes),0==g.$el.children().not(g.sel.item.elem).length&&(g.$el.append(g.createChildren()),g._undo.children=!0),g.raise("pre-init").isDefaultPrevented()?e.rejectWith("pre-init default prevented"):void 0}).then(function(){return g.destroying?e.rejectWith("destroy in progress"):g.opt.delay<=0?e.resolved:a.Deferred(function(a){g._delay=setTimeout(function(){g._delay=null,a.resolve()},g.opt.delay)}).promise()}).then(function(){return g.destroying?e.rejectWith("destroy in progress"):g.raise("init").isDefaultPrevented()?e.rejectWith("init default prevented"):g.items.fetch()}).then(function(){if(g.destroying)return e.rejectWith("destroy in progress");if(g.raise("post-init").isDefaultPrevented())return e.rejectWith("post-init default prevented");var b=g.state.parse();g.state.set(d.empty(b)?g.state.initial():b),a(window).on("scroll"+g.namespace,{self:g},g.throttle(g.onWindowScroll,g.opt.throttle)).on("popstate"+g.namespace,{self:g},g.onWindowPopState)}).then(function(){return g.destroying?e.rejectWith("destroy in progress"):(g.raise("first-load"),g.loadAvailable())}).then(function(){if(g.destroying)return e.rejectWith("destroy in progress");g.initializing=!1,g.initialized=!0,g._check(200),g._check(500),g._check(1e3),g._check(2e3),g._check(5e3),g.raise("ready"),h.resolve(g)}).fail(function(a){h.reject(a)}),j.resolve()}).promise().fail(function(a){console.log("initialize failed",g,a),g.destroy()}))},create:function(){var b=this;return a("<div/>",{id:b.id,class:b.cls.container}).addClass(b.opt.classes)},createChildren:function(){return a()},destroy:function(){var b=this;return b.destroyed?e.resolved:(b.destroying=!0,a.Deferred(function(a){b.initializing&&d.promise(b._initialize)?b._initialize.always(function(){b.destroying=!1,b._destroy(),a.resolve()}):(b.destroying=!1,b._destroy(),a.resolve())}).promise())},_destroy:function(){var c=this;c.destroyed||(c.raise("destroy"),a(window).off(c.namespace),c.state.destroy(),c.filter&&c.filter.destroy(),c.pages&&c.pages.destroy(),c.items.destroy(),d.empty(c.opt.on)||c.$el.off(c.opt.on),c.raise("destroyed"),c.$el.removeData(b.dataTemplate),d.empty(c._undo.classes)?c.$el.removeAttr("class"):c.$el.attr("class",c._undo.classes),d.empty(c._undo.style)?c.$el.removeAttr("style"):c.$el.attr("style",c._undo.style),c._undo.children&&c.destroyChildren(),c._undo.create&&c.$el.remove(),c.$el=c.state=c.items=c.pages=null,c.destroyed=!0,c.initializing=!1,c.initialized=!1)},destroyChildren:function(){},getAvailable:function(){return this.pages?this.pages.available():this.items.available()},loadAvailable:function(){return this.items.load(this.getAvailable())},_check:function(a){a=d.number(a)?a:0;var b=this;setTimeout(function(){!b.initialized||b.destroying&&b.destroyed||b.loadAvailable()},a)},raise:function(c,e){if(!d.string(c)||d.empty(c))return null;e=d.array(e)?e:[];var g=this,h=c.split(".")[0],i=f.camel("on-"+h),j=a.Event(h+".foogallery");return e.unshift(g),g.$el.trigger(j,e),b.debug.logf("{id}|{name}:",{id:g.id,name:h},e),d.fn(g[i])&&(e.unshift(j),g[i].apply(g.$el.get(0),e)),j},layout:function(){var a=this;null!==a._initialize&&a.raise("layout")},throttle:function(a,b){var c=Date.now();return function(){if(c+b-Date.now()<0){var d=e.arg2arr(arguments);a.apply(this,d),c=Date.now()}}},onWindowPopState:function(a){var b=a.data.self,c=a.originalEvent.state;d.empty(c)||c.id!==b.id||(b.state.set(c),b.loadAvailable())},onWindowScroll:function(a){a.data.self.loadAvailable()}}),b.template.register("core",b.Template,{id:null,type:"core",classes:"",on:{},lazy:!0,viewport:200,items:[],delay:100,throttle:50,timeout:6e4,srcset:"data-srcset",src:"data-src",template:{}},{container:"foogallery"},{},-100)}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.fn,FooGallery.utils.str),function(a,b){a.Component=b.Class.extend({construct:function(a){this.tmpl=a},destroy:function(){this.tmpl=null}}),a.components=new b.Factory}(FooGallery,FooGallery.utils),function(a,b,c,d){b.State=b.Component.extend({construct:function(a){var b=this;b._super(a),b.apiEnabled=!!window.history&&!!history.replaceState,b.opt=b.tmpl.opt.state,b.enabled=b.opt.enabled,b.pushOrReplace=b.isPushOrReplace(b.opt.pushOrReplace)?b.opt.pushOrReplace:"replace";var c=d.escapeRegExp(b.tmpl.id),e=d.escapeRegExp(b.opt.values),f=d.escapeRegExp(b.opt.pair);b.regex={exists:new RegExp("^#"+c+"\\"+e+".+?"),values:new RegExp("(\\w+)"+f+"([^"+e+"]+)","g")}},destroy:function(){var a=this;a.clear(),a.opt=a.regex={},a._super()},isPushOrReplace:function(b){return-1!==a.inArray(b,["push","replace"])},exists:function(){return this.regex.exists.test(location.hash)&&this.regex.values.test(location.hash)},parse:function(){var b=this,d={};if(b.exists())if(b.enabled){d.id=b.tmpl.id;var e=location.hash.match(b.regex.values);a.each(e,function(e,f){var g=f.split(b.opt.pair);2===g.length&&(d[g[0]]=-1===g[1].indexOf(b.opt.array)?decodeURIComponent(g[1].replace(/\+/g,"%20")):a.map(g[1].split(b.opt.array),function(a){return decodeURIComponent(a.replace(/\+/g,"%20"))}),c.string(d[g[0]])&&!isNaN(d[g[0]])&&(d[g[0]]=parseInt(d[g[0]])))})}else b.apiEnabled?history.replaceState(null,"",location.pathname+location.search):location.hash="#";return d},hashify:function(b){var d=this;if(c.hash(b)){var e=[];return a.each(b,function(b,f){c.empty(f)||"id"===b||(f=c.array(f)?a.map(f,function(a){return encodeURIComponent(a)}).join(d.opt.array):encodeURIComponent(f),e.push(b+d.opt.pair+f))}),e.length>0&&e.unshift("#"+d.tmpl.id),e.join(d.opt.values)}return""},replace:function(a){var b=this;if(b.enabled&&b.apiEnabled){a.id=b.tmpl.id;var d=b.hashify(a),e=c.empty(d);history.replaceState(e?null:a,"",e?location.pathname+location.search:d)}},push:function(a){var b=this;if(b.enabled&&b.apiEnabled){a.id=b.tmpl.id;var d=b.hashify(a),e=c.empty(d);history.pushState(e?null:a,"",e?location.pathname+location.search:d)}},update:function(a,b){var c=this;c.enabled&&c.apiEnabled&&(b=c.isPushOrReplace(b)?b:c.pushOrReplace,c[b](a))},clear:function(){this.exists()&&this.replace({})},initial:function(){var a=this,b=a.tmpl,d={};return b.filter&&!c.empty(b.filter.current)&&(d.f=b.filter.current),b.pages&&b.pages.current>1&&(d.p=b.pages.current),d},get:function(a){var d=this,e=d.tmpl,f={};return a instanceof b.Item&&(f.i=a.id),e.filter&&!c.empty(e.filter.current)&&(f.f=e.filter.current),e.pages&&e.pages.isValid(e.pages.current)&&(f.p=e.pages.current),f},set:function(a){var b=this,d=b.tmpl;if(c.hash(a)){d.items.reset();var e=d.items.get(a.i);if(d.filter){d.filter.rebuild();var f=c.empty(a.f)?[]:a.f;d.filter.set(f,!1)}if(d.pages){d.pages.rebuild();var g=d.pages.number(a.p);e&&!d.pages.contains(g,e)&&(g=d.pages.find(e),g=0!==g?g:1),d.pages.set(g,!c.empty(a),!1,!0),e&&d.pages.contains(g,e)&&e.scrollTo()}else d.items.detach(d.items.all()),d.items.create(d.items.available(),!0),e&&e.scrollTo();c.empty(a.i)||(a.i=null,b.replace(a))}}}),b.template.configure("core",{state:{enabled:!1,pushOrReplace:"replace",values:"/",pair:":",array:"+"}}),b.components.register("state",b.State)
|
10 |
-
}(FooGallery.$,FooGallery,FooGallery.utils.is,FooGallery.utils.str),function(a,b,c,d,e,f){b.Item=b.Component.extend({construct:function(a,b){var c=this;c._super(a),c.cls=a.cls.item,c.il8n=a.il8n.item,c.sel=a.sel.item,c.opt=f.extend({},a.opt.item,b),c.isAttached=!1,c.isCreated=!1,c.isDestroyed=!1,c.isLoading=!1,c.isLoaded=!1,c.isError=!1,c.isParsed=!1,c.$el=null,c.$inner=null,c.$anchor=null,c.$image=null,c.$caption=null,c.type=c.opt.type,c.id=c.opt.id,c.href=c.opt.href,c.src=c.opt.src,c.srcset=c.opt.srcset,c.width=c.opt.width,c.height=c.opt.height,c.title=c.opt.title,c.alt=c.opt.alt,c.caption=d.empty(c.opt.caption)?c.title:c.opt.caption,c.description=d.empty(c.opt.description)?c.alt:c.opt.description,c.attr=c.opt.attr,c.tags=c.opt.tags,c.maxWidth=c.opt.maxWidth,c.maxCaptionLength=c.opt.maxCaptionLength,c.maxDescriptionLength=c.opt.maxDescriptionLength,c.showCaptionTitle=c.opt.showCaptionTitle,c.showCaptionDescription=c.opt.showCaptionDescription,c._thumbUrl=null,c._placeholder=null,c._load=null,c._undo={classes:"",style:"",loader:!1,placeholder:!1}},destroy:function(){var a=this;return a.tmpl.raise("destroy-item",[a]).isDefaultPrevented()||(a.isDestroyed=a.doDestroyItem()),a.isDestroyed&&(a.tmpl.raise("destroyed-item",[a]),a._super()),a.isDestroyed},doDestroyItem:function(){var a=this;return a.isParsed?(a.append(),d.empty(a._undo.classes)?a.$el.removeAttr("class"):a.$el.attr("class",a._undo.classes),d.empty(a._undo.style)?a.$el.removeAttr("style"):a.$el.attr("style",a._undo.style),a._undo.loader&&a.$el.find(a.sel.loader).remove(),a._undo.placeholder&&a.$image.prop("src")==a._placeholder&&a.$image.removeAttr("src")):a.isCreated&&(a.detach(),a.$el.remove()),!0},parse:function(b){var c=this,d=a(b);return!c.tmpl.raise("parse-item",[c,d]).isDefaultPrevented()&&(c.isCreated=d.is(c.sel.elem))&&(c.isParsed=c.doParseItem(d),c.fix()),c.isParsed&&c.tmpl.raise("parsed-item",[c]),c.isParsed},doParseItem:function(c){var e=this,f=e.tmpl.opt,g=e.cls,h=e.sel;return e._undo.classes=c.attr("class")||"",e._undo.style=c.attr("style")||"",e.$el=c.data(b.dataItem,e),e.$inner=e.$el.find(h.inner),e.$anchor=e.$el.find(h.anchor).on("click.foogallery",{self:e},e.onAnchorClick),e.$image=e.$anchor.find(h.image),e.$caption=e.$el.find(h.caption.elem).on("click.foogallery",{self:e},e.onCaptionClick),e.isAttached=e.$el.parent().length>0,e.isLoading=e.$el.is(h.loading),e.isLoaded=e.$el.is(h.loaded),e.isError=e.$el.is(h.error),e.id=e.$anchor.data("id")||e.id,e.tags=e.$anchor.data("tags")||e.tags,e.href=e.$anchor.attr("href")||e.href,e.src=e.$image.attr(f.src)||e.src,e.srcset=e.$image.attr(f.srcset)||e.srcset,e.width=parseInt(e.$image.attr("width"))||e.width,e.height=parseInt(e.$image.attr("height"))||e.height,e.title=e.$image.attr("title")||e.title,e.alt=e.$image.attr("alt")||e.alt,e.caption=e.$anchor.data("title")||e.$anchor.data("captionTitle")||e.caption||e.title,e.description=e.$anchor.data("description")||e.$anchor.data("captionDesc")||e.description||e.alt,d.empty(e.caption)&&(e.caption=a.trim(e.$caption.find(h.caption.title).html())),d.empty(e.description)&&(e.description=a.trim(e.$caption.find(h.caption.description).html())),d.number(e.maxCaptionLength)&&e.maxCaptionLength>0&&!d.empty(e.caption)&&d.string(e.caption)&&e.caption.length>e.maxCaptionLength&&e.$caption.find(h.caption.title).html(e.caption.substr(0,e.maxCaptionLength)+"…"),d.number(e.maxDescriptionLength)&&e.maxDescriptionLength>0&&!d.empty(e.description)&&d.string(e.description)&&e.description.length>e.maxDescriptionLength&&e.$caption.find(h.caption.description).html(e.description.substr(0,e.maxDescriptionLength)+"…"),0===e.$el.find(h.loader).length&&(e.$el.append(a("<div/>",{class:g.loader})),e._undo.loader=!0),d.empty(e.$image.prop("src"))&&(e._placeholder=e.tmpl.items.placeholder(e.width,e.height),e.$image.prop("src",e._placeholder),e._undo.placeholder=!0),!e.isCreated||!e.isAttached||e.isLoading||e.isLoaded||e.isError||e.$el.addClass(g.idle),!0},create:function(){var a=this;if(!a.isCreated&&d.string(a.href)&&d.string(a.src)&&d.number(a.width)&&d.number(a.height)){a.tmpl.raise("create-item",[a]).isDefaultPrevented()||(a.isCreated=a.doCreateItem()),a.isCreated&&a.tmpl.raise("created-item",[a])}return a.isCreated},doCreateItem:function(){var c=this,e=c.tmpl.opt,f=c.cls,g=c.attr;g.elem.class=f.elem+" "+f.idle,g.inner.class=f.inner,g.anchor.class=f.anchor,g.anchor.href=c.href,g.anchor["data-id"]=c.id,g.anchor["data-title"]=c.caption,g.anchor["data-description"]=c.description,d.empty(c.tags)||(g.anchor["data-tags"]=JSON.stringify(c.tags)),g.image.class=f.image,g.image.src=c.tmpl.items.placeholder(c.width,c.height),g.image[e.src]=c.src,g.image[e.srcset]=c.srcset,g.image.width=c.width,g.image.height=c.height,g.image.title=c.title,g.image.alt=c.alt,c.$el=a("<div/>").attr(g.elem).data(b.dataItem,c),c.$inner=a("<figure/>").attr(g.inner).appendTo(c.$el),c.$anchor=a("<a/>").attr(g.anchor).appendTo(c.$inner).on("click.foogallery",{self:c},c.onAnchorClick),c.$image=a("<img/>").attr(g.image).appendTo(c.$anchor),f=c.cls.caption,g=c.attr.caption,g.elem.class=f.elem,c.$caption=a("<figcaption/>").attr(g.elem).on("click.foogallery",{self:c},c.onCaptionClick),g.inner.class=f.inner;var h=a("<div/>").attr(g.inner).appendTo(c.$caption),i=!d.empty(c.caption),j=!d.empty(c.description);if(i||j){if(g.title.class=f.title,g.description.class=f.description,i){var k;k=d.number(c.maxCaptionLength)&&c.maxCaptionLength>0&&d.string(c.caption)&&c.caption.length>c.maxCaptionLength?a("<div/>").attr(g.title).html(c.caption.substr(0,c.maxCaptionLength)+"…"):a("<div/>").attr(g.title).html(c.caption),h.append(k)}if(j){var l;l=d.number(c.maxDescriptionLength)&&c.maxDescriptionLength>0&&d.string(c.description)&&c.description.length>c.maxDescriptionLength?a("<div/>").attr(g.description).html(c.description.substr(0,c.maxDescriptionLength)+"…"):a("<div/>").attr(g.description).html(c.description),h.append(l)}}return c.$caption.appendTo(c.$inner),0===c.$el.find(c.sel.loader).length&&c.$el.append(a("<div/>",{class:c.cls.loader})),!0},append:function(){var a=this;if(a.isCreated&&!a.isAttached){a.tmpl.raise("append-item",[a]).isDefaultPrevented()||(a.tmpl.$el.append(a.$el),a.fix(),a.isAttached=!0),a.isAttached&&a.tmpl.raise("appended-item",[a])}return a.isAttached},detach:function(){var a=this;if(a.isCreated&&a.isAttached){a.tmpl.raise("detach-item",[a]).isDefaultPrevented()||(a.$el.detach(),a.unfix(),a.isAttached=!1),a.isAttached||a.tmpl.raise("detached-item",[a])}return!a.isAttached},load:function(){var b=this;if(d.promise(b._load))return b._load;if(!b.isCreated||!b.isAttached)return e.rejectWith("not created or attached");if(b.tmpl.raise("load-item",[b]).isDefaultPrevented())return e.rejectWith("default prevented");var c=b.cls,f=b.$image.get(0),g=f.src;return b.isLoading=!0,b.$el.removeClass(c.idle).removeClass(c.loaded).removeClass(c.error).addClass(c.loading),b._load=a.Deferred(function(a){d.undef(window.InstallTrigger)||(f.src=""),f.onload=function(){f.onload=f.onerror=null,b.isLoading=!1,b.isLoaded=!0,b.$el.removeClass(c.loading).addClass(c.loaded),b.unfix(),b.tmpl.raise("loaded-item",[b]),a.resolve(b)},f.onerror=function(){f.onload=f.onerror=null,b.isLoading=!1,b.isError=!0,b.$el.removeClass(c.loading).addClass(c.error),d.string(g)&&b.$image.prop("src",g),b.tmpl.raise("error-item",[b]),a.reject(b)},f.src=b.getThumbUrl()}).promise()},fix:function(){var a=this;if(!a.tmpl.raise("fix-item",[a]).isDefaultPrevented()&&a.isCreated&&!a.isLoading&&!a.isLoaded&&!a.isError){var b=a.width,c=a.height;if(!isNaN(b)&&!isNaN(c)){var e=d.fn(a.maxWidth)?a.maxWidth(a):a.$image.width();e<=0&&(e=b);var f=e/b,g=c*f;a.$image.css({width:e,height:g})}}return a},unfix:function(){var a=this;return!a.tmpl.raise("unfix-item",[a]).isDefaultPrevented()&&a.isCreated&&a.$image.css({width:"",height:""}),a},getThumbUrl:function(a){a=!!d.boolean(a)&&a;var c=this;return!a&&d.string(c._thumbUrl)?c._thumbUrl:c._thumbUrl=b.parseSrc(c.src,c.width,c.height,c.srcset,c.$anchor.innerWidth(),c.$anchor.innerHeight())},scrollTo:function(a){var b=this;if(b.isAttached){var d=b.bounds(),e=c.getViewportBounds();switch(a){case"top":d.left+=d.width/2-e.width/2,d.top-=e.height/5;break;default:d.left+=d.width/2-e.width/2,d.top+=d.height/2-e.height/2}window.scrollTo(d.left,d.top)}return b},bounds:function(){return this.isAttached?c.getElementBounds(this.$el):null},intersects:function(a){return!!this.isAttached&&this.bounds().intersects(a)},onAnchorClick:function(a){var b=a.data.self,c=b.tmpl.state.get(b);b.tmpl.state.update(c)},onCaptionClick:function(b){var c=b.data.self;a(b.target).is(c.sel.caption.all)&&c.$anchor.length>0&&c.$anchor.get(0).click()}}),b.template.configure("core",{item:{type:"item",id:"",href:"",src:"",srcset:"",width:0,height:0,title:"",alt:"",caption:"",description:"",tags:[],maxWidth:null,maxCaptionLength:0,maxDescriptionLength:0,showCaptionTitle:!0,showCaptionDescription:!0,attr:{elem:{},inner:{},anchor:{},image:{},caption:{elem:{},inner:{},title:{},description:{}}}}},{item:{elem:"fg-item",inner:"fg-item-inner",anchor:"fg-thumb",image:"fg-image",loader:"fg-loader",idle:"fg-idle",loading:"fg-loading",loaded:"fg-loaded",error:"fg-error",caption:{elem:"fg-caption",inner:"fg-caption-inner",title:"fg-caption-title",description:"fg-caption-desc"}}},{item:{}}),b.components.register("item",b.Item)}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.fn,FooGallery.utils.obj),function(a,b,c,d,e,f){b.Items=b.Component.extend({construct:function(a){var b=this;b._super(a),b.idMap={},b._fetched=null,b._arr=[],b._available=[],b._canvas=document.createElement("canvas");var d=b.tmpl.cls.item.caption;b.tmpl.sel.item.caption.all=c.selectify([d.elem,d.inner,d.title,d.description])},destroy:function(){var b=this,c=b.all(),d=[];c.length>0&&(b.tmpl.raise("destroy-items",[c]),d=a.map(c,function(a){return a.destroy()?a:null}),d.length>0&&b.tmpl.raise("destroyed-items",[d])),b.idMap={},b._canvas=b._fetched=null,b._arr=[],b._available=[],b._super()},fetch:function(b){var c=this;if(!b&&d.promise(c._fetched))return c._fetched;var e=c.tmpl,f=e.sel,g=e.opt.items,h=a.Deferred(),i=c.make(e.$el.find(f.item.elem));return d.empty(g)?(i.push.apply(i,c.make(window[e.id+"-items"])),h.resolve(i)):d.array(g)?(i.push.apply(i,c.make(g)),h.resolve(i)):d.string(g)?a.get(g).then(function(a){i.push.apply(i,c.make(a)),h.resolve(i)},function(a,b,c){console.log("FooGallery: GET items error.",g,a,b,c),h.resolve(i)}):h.resolve(i),h.then(function(a){c.setAll(a)}),c._fetched=h.promise()},all:function(){return this._arr.slice()},count:function(a){return a?this.all().length:this.available().length},available:function(){return this._available.slice()},get:function(a){return!d.empty(a)&&this.idMap[a]?this.idMap[a]:null},setAll:function(a){this._arr=d.array(a)?a:[],this.idMap=this.createIdMap(a),this._available=this.all()},setAvailable:function(a){this._available=d.array(a)?a:[]},reset:function(){this.setAvailable(this.all())},placeholder:function(a,c){return this._canvas&&this._canvas.toDataURL&&d.number(a)&&d.number(c)?(this._canvas.width=a,this._canvas.height=c,this._canvas.toDataURL()):b.emptyImage},loadable:function(b){var e,f=this,g=f.tmpl.opt;return g.lazy&&(e=c.getViewportBounds(g.viewport)),d.array(b)?a.map(b,function(a){return a.isCreated&&a.isAttached&&!a.isLoading&&!a.isLoaded&&!a.isError&&(!g.lazy||g.lazy&&a.intersects(e))?a:null}):[]},creatable:function(c){return d.array(c)?a.map(c,function(a){return a instanceof b.Item&&!a.isCreated?a:null}):[]},appendable:function(c){return d.array(c)?a.map(c,function(a){return a instanceof b.Item&&a.isCreated&&!a.isAttached?a:null}):[]},detachable:function(c){return d.array(c)?a.map(c,function(a){return a instanceof b.Item&&a.isCreated&&a.isAttached?a:null}):[]},jquerify:function(b){return a(a.map(b,function(a){return a.$el.get()}))},make:function(c){var e=this,g=[];if(d.jq(c)||d.array(c)){var h=[],i=a.makeArray(c);if(0===i.length)return g;e.tmpl.raise("make-items",[i]).isDefaultPrevented()||(g=a.map(i,function(a){var c=e.type(a),g=f.extend(d.hash(a)?a:{},{type:c}),i=b.components.make(c,e.tmpl,g);return d.element(a)?i.parse(a)?(h.push(i),i):null:i})),g.length>0&&e.tmpl.raise("made-items",[g]),h.length>0&&e.tmpl.raise("parsed-items",[h])}return g},type:function(c){var e;if(d.hash(c))e=c.type;else if(d.element(c)){var f=a(c),g=this.tmpl.sel.item;e=f.find(g.anchor).data("type")}return d.string(e)&&b.components.contains(e)?e:"item"},create:function(b,c){var e=this,f=[],g=e.creatable(b);if(g.length>0){e.tmpl.raise("create-items",[g]).isDefaultPrevented()||(f=a.map(g,function(a){return a.create()?a:null})),f.length>0&&e.tmpl.raise("created-items",[f])}return d.boolean(c)&&c?e.append(b):f},append:function(b){var c=this,d=[],e=c.appendable(b);if(e.length>0){c.tmpl.raise("append-items",[e]).isDefaultPrevented()||(d=a.map(e,function(a){return a.append()?a:null})),d.length>0&&c.tmpl.raise("appended-items",[d])}return d},detach:function(b){var c=this,d=[],e=c.detachable(b);if(e.length>0){c.tmpl.raise("detach-items",[e]).isDefaultPrevented()||(d=a.map(e,function(a){return a.detach()?a:null})),d.length>0&&c.tmpl.raise("detached-items",[d])}return d},load:function(b){var c=this;if(b=c.loadable(b),b.length>0){if(!c.tmpl.raise("load-items",[b]).isDefaultPrevented()){var d=a.map(b,function(a){return a.load()});return e.when(d).done(function(a){c.tmpl.raise("loaded-items",[a])})}}return e.resolveWith([])},createIdMap:function(b){var c={};return a.each(b,function(a,b){d.empty(b.id)&&(b.id=""+(a+1)),c[b.id]=b}),c}}),b.components.register("items",b.Items)}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.fn,FooGallery.utils.obj),function(a,b,c,d){b.Paging=b.Component.extend({construct:function(a){var b=this;b._super(a),b.opt=b.tmpl.opt.paging,b.cls=b.tmpl.cls.paging,b.il8n=b.tmpl.il8n.paging,b.sel=b.tmpl.sel.paging,b.pushOrReplace=b.opt.pushOrReplace,b.type=b.opt.type,b.theme=b.opt.theme,b.size=b.opt.size,b.position=b.opt.position,b.scrollToTop=b.opt.scrollToTop,b.current=0,b.total=0,b.ctrls=[],b._arr=[]},destroy:function(){var b=this;b._arr.splice(0,b._arr.length),a.each(b.ctrls.splice(0,b.ctrls.length),function(a,b){b.destroy()}),b._super()},build:function(){var a=this,c=a.tmpl.items.available();a.total=a.size>0&&c.length>0?Math.ceil(c.length/a.size):1;for(var d=0;d<a.total;d++)a._arr.push(c.splice(0,a.size));if(a.total>1&&b.paging.hasCtrl(a.type)){var e,f,g=a.position;"both"!==g&&"top"!==g||(e=b.paging.makeCtrl(a.type,a.tmpl,a,"top"),e.create()&&(e.append(),a.ctrls.push(e))),"both"!==g&&"bottom"!==g||(f=b.paging.makeCtrl(a.type,a.tmpl,a,"bottom"),f.create()&&(f.append(),a.ctrls.push(f)))}},rebuild:function(){var b=this;b.current=0,b.total=0,b._arr.splice(0,b._arr.length),a.each(b.ctrls.splice(0,b.ctrls.length),function(a,b){b.destroy()}),b.build()},all:function(){return this._arr.slice()},available:function(){return this.get(this.current)},controls:function(b){var c=this;c.isValid(b)&&a.each(c.ctrls,function(a,c){c.update(b)})},isValid:function(a){return d.number(a)&&a>0&&a<=this.total},number:function(a){return this.isValid(a)?a:0===this.current?1:this.current},create:function(a,b){var c=this;a=c.number(a);var d=a-1;c.tmpl.items.detach(c.tmpl.items.all()),c.tmpl.items.create(c._arr[d],!0),c.current=a},get:function(a){var b=this;return b.isValid(a)?(a=b.number(a),b._arr[a-1]):[]},set:function(a,b,c,e){var f=this;if(f.isValid(a)){var g,h=f.number(a);if(h!==f.current){var i=f.current,j=function(){if(c=!d.boolean(c)||c,e=!!d.boolean(e)&&e,c&&1===f.current&&!f.tmpl.state.exists()&&(g=f.tmpl.state.get(),f.tmpl.state.update(g,f.pushOrReplace)),f.controls(a),f.create(h,e),c&&(g=f.tmpl.state.get(),f.tmpl.state.update(g,f.pushOrReplace)),f.scrollToTop&&d.boolean(b)&&b){var j=f.get(f.current);j.length>0&&j[0].scrollTo("top")}f.tmpl.raise("after-page-change",[f.current,i,e])};return!f.tmpl.raise("before-page-change",[f.current,h,j,e]).isDefaultPrevented()&&(j(),!0)}}return!1},find:function(b){for(var c=this,d=0,e=c._arr.length;d<e;d++)if(-1!==a.inArray(b,c._arr[d]))return d+1;return 0},contains:function(b,c){var d=this.get(b);return-1!==a.inArray(c,d)},first:function(){this.goto(1)},last:function(){this.goto(this._arr.length)},prev:function(){this.goto(this.current-1)},next:function(){this.goto(this.current+1)},goto:function(a){var b=this;b.set(a,!0)&&b.tmpl.loadAvailable()}}),b.PagingControl=b.Component.extend({construct:function(a,b,c){var d=this;d._super(a),d.pages=b,d.position=c,d.$container=null},create:function(){var b=this;return b.$container=a("<nav/>",{class:b.pages.cls.container}).addClass(b.pages.theme),!0},destroy:function(){var a=this;a.$container.remove(),a.$container=null},append:function(){var a=this;"top"===a.position?a.$container.insertBefore(a.tmpl.$el):a.$container.insertAfter(a.tmpl.$el)},update:function(a){}}),b.paging.register("default",b.Paging,null,{type:"none",theme:"fg-light",size:30,pushOrReplace:"push",position:"none",scrollToTop:!0},{container:"fg-paging-container"},null,-100)}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is),function(a,b,c,d){b.Dots=b.Paging.extend({}),b.DotsControl=b.PagingControl.extend({construct:function(b,c,d){this._super(b,c,d),this.$container=a(),this.$list=a(),this.$items=a()},create:function(){for(var b,c=this,d=c.pages.cls,e=c.pages.il8n,f=[],g=a("<ul/>",{class:d.list}),h=0,i=c.pages.total;h<i;h++)f.push(b=c.createItem(h+1,e.page)),g.append(b);return c.$list=g,c.$container=a("<nav/>",{class:d.container}).addClass(c.pages.theme).append(g),c.$items=a(a.map(f,function(a){return a.get()})),!0},append:function(){var a=this;"top"===a.position?a.$container.insertBefore(a.tmpl.$el):a.$container.insertAfter(a.tmpl.$el)},destroy:function(){var b=this,c=b.pages.sel;b.$list.find(c.link).off("click.foogallery",b.onLinkClick),b.$container.remove(),b.$container=a(),b.$list=a(),b.$items=a()},update:function(a){this.setSelected(a-1)},setSelected:function(b){var c=this,e=c.pages.cls,f=c.pages.il8n,g=c.pages.sel;c.$items.filter(g.selected).removeClass(e.selected).each(function(b,c){var e=a(c),f=e.data("label"),h=e.find(g.reader);d.string(f)&&0!==h.length&&h.html(f)}),c.$items.eq(b).addClass(e.selected).each(function(b,c){var e=a(c),h=e.find(g.reader),i=h.html();d.string(i)&&0!==h.length&&(e.data("label",i),h.html(f.current))})},createItem:function(b,c,e,f,g){e=d.string(e)?e:b,c=d.string(c)?c:"";var h=this,i=h.pages.opt,j=h.pages.cls,k=a("<a/>",{class:j.link,href:"#page-"+b}).html(e).on("click.foogallery",{self:h,page:b},h.onLinkClick);d.empty(c)||k.attr("title",c.replace(/\{PAGE}/g,b).replace(/\{LIMIT}/g,i.limit+"")),g=d.string(g)?g:c,d.empty(g)||k.prepend(a("<span/>",{class:j.reader,text:g.replace(/\{PAGE}/g,"").replace(/\{LIMIT}/g,i.limit+"")}));var l=a("<li/>",{class:j.item}).append(k);return f=d.string(f)?f:"",d.empty(f)||l.addClass(f),l},onLinkClick:function(b){b.preventDefault();var c=b.data.self,d=b.data.page,e=c.pages.sel;a(this).closest(e.item).is(e.disabled)||(c.pages.set(d,!0),c.tmpl.loadAvailable())}}),b.paging.register("dots",b.Dots,b.DotsControl,{type:"dots",position:"both",pushOrReplace:"push"},{list:"fg-dots",item:"fg-dot-item",link:"fg-dot-link",disabled:"fg-disabled",selected:"fg-selected",visible:"fg-visible",reader:"fg-sr-only"},{current:"Current page",page:"Page {PAGE}"})}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is),function(a,b,c){b.DefaultTemplate=b.Template.extend({}),b.template.register("default",b.DefaultTemplate,null,{container:"foogallery fg-default"})}(FooGallery.$,FooGallery,FooGallery.utils),function(a,b,c,d){b.MasonryTemplate=b.Template.extend({construct:function(a,b){this._super(a,b),this.masonry=null,this.style=null,this.$columnWidth=null},getStylesheet:function(){var a=this;return null===a.style&&(a.style=document.createElement("style"),a.style.appendChild(document.createTextNode("")),document.head.appendChild(a.style)),a.style.sheet},onPreInit:function(b,c){var e=c.sel,f=c.cls;f.layouts=a.map(f.layout,function(a){return a}).join(" ");for(var g=a.map(f.layout,function(a,b){return{key:b,value:a}}),h=0,i=g.length;h<i;h++)if(c.$el.hasClass(g[h].value)){c.template.layout=g[h].key;break}d.string(f.layout[c.template.layout])||(c.template.layout="col4");var j,k,l="fixed"===c.template.layout;if(c.template.isFitWidth=l,c.template.percentPosition=!l,c.template.transitionDuration=0,c.template.itemSelector=e.item.elem,c.$el.removeClass(f.layouts).addClass(f.layout[c.template.layout]),l||(0===c.$el.find(e.gutterWidth).length&&c.$el.prepend(a("<div/>").addClass(f.gutterWidth)),c.template.gutter=e.gutterWidth),0===c.$el.find(e.columnWidth).length&&c.$el.prepend(a("<div/>").addClass(f.columnWidth)),l&&d.number(c.template.columnWidth)){var m=c.$el.find(e.columnWidth).width(c.template.columnWidth);j=c.getStylesheet(),k="#"+c.id+e.container+" "+e.item.elem+" { width: "+m.outerWidth()+"px; }",j.insertRule(k,0)}c.template.columnWidth=e.columnWidth,l&&d.number(c.template.gutter)&&(j=c.getStylesheet(),k="#"+c.id+e.container+" "+e.item.elem+" { margin-bottom: "+c.template.gutter+"px; }",j.insertRule(k,0)),c.masonry=new Masonry(c.$el.get(0),c.template)},onPostInit:function(a,b){b.masonry.layout()},onFirstLoad:function(a,b){b.masonry.layout()},onReady:function(a,b){b.masonry.layout()},onDestroy:function(a,b){b.$el.find(b.sel.columnWidth).remove(),b.$el.find(b.sel.gutterWidth).remove(),b.style&&b.style.parentNode&&b.style.parentNode.removeChild(b.style)},onDestroyed:function(a,b){b.masonry instanceof Masonry&&b.masonry.destroy()},onLayout:function(a,b){b.masonry.layout()},onParsedItems:function(a,b,c){b.masonry.layout()},onAppendedItems:function(a,b,c){c=b.items.jquerify(c),c=b.masonry.addItems(c),b.masonry.layoutItems(c,!0)},onDetachItem:function(a,b,c){a.isDefaultPrevented()||(a.preventDefault(),b.masonry.remove(c.$el),c.isAttached=!1,c.unfix())},onDetachedItems:function(a,b,c){b.masonry.layout()},onLoadedItems:function(a,b,c){b.masonry.layout()}}),b.template.register("masonry",b.MasonryTemplate,{template:{initLayout:!1,isInitLayout:!1,layout:"col4"}},{container:"foogallery fg-masonry",columnWidth:"fg-column-width",gutterWidth:"fg-gutter-width",layout:{fixed:"fg-masonry-fixed",col2:"fg-masonry-2col",col3:"fg-masonry-3col",col4:"fg-masonry-4col",col5:"fg-masonry-5col"}})}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is),function(a,b,c,d){b.Justified=c.Class.extend({construct:function(c,d){this.$el=a(c),this.options=a.extend(!0,{},b.Justified.defaults,d),this._items=[],this._lastRefresh=0,this._refresh=null},init:function(){var b=this;d.string(b.options.maxRowHeight)&&(b.options.maxRowHeight.indexOf("%")?b.options.maxRowHeight=b.options.rowHeight*(parseInt(b.options.maxRowHeight)/100):b.options.maxRowHeight=parseInt(b.options.maxRowHeight)),a(window).on("resize.justified",{self:b},b.onWindowResize),this._refresh=setInterval(function(){b.refresh()},b.options.refreshInterval)},destroy:function(){this._refresh&&clearInterval(this._refresh),a(window).off("resize.justified"),this.$el.removeAttr("style")},refresh:function(){var a=this.getContainerWidth();a!=this._lastRefresh&&(this.layout(),this._lastRefresh=a)},parse:function(){var b=this,c=b.$el.is(":visible"),d=a("<div/>",{class:b.$el.attr("class")}).css({position:"absolute",top:0,left:-9999,visibility:"hidden",maxWidth:b.getContainerWidth()}).appendTo("body");return b._items=b.$el.find(b.options.itemSelector).removeAttr("style").removeClass("fg-positioned").map(function(b,e){var f=a(e),g=0,h=0;if(c)g=f.outerWidth(),h=f.outerHeight();else{var i=f.clone();i.appendTo(d),g=i.outerWidth(),h=i.outerHeight()}return{index:b,width:g,height:h,top:0,left:0,$item:f}}).get(),d.remove(),b._items},getMaxRowHeight:function(){var a=this;return d.string(a.options.maxRowHeight)&&(a.options.maxRowHeight.indexOf("%")?a.options.maxRowHeight=a.options.rowHeight*(parseInt(a.options.maxRowHeight)/100):a.options.maxRowHeight=parseInt(a.options.maxRowHeight)),d.number(a.options.maxRowHeight)?a.options.maxRowHeight:a.options.rowHeight},getContainerWidth:function(){var a=this;return a.$el.is(":visible")?a.$el.width():a.$el.parents(":visible:first").innerWidth()},layout:function(b,c){b=!!d.boolean(b)&&b,c=!d.boolean(c)||c,(b||0===this._items.length)&&this.parse();var e=this,f=0,g=e.getContainerWidth(),h=e.getMaxRowHeight(),i=e.rows(g,h);a.each(i,function(a,b){b.visible&&(a>0&&(f+=e.options.margins),f+=b.height,e.render(b))}),e.$el.height(f),c&&e.getContainerWidth()<g&&e.layout(!1,!1)},render:function(a){for(var b,c=0,d=a.items.length;c<d;c++)b=a.items[c],a.visible?b.$item.css({width:b.width,height:b.height,top:b.top,left:b.left,display:"",maxHeight:this.options.maxRowHeight>0?this.options.maxRowHeight:""}).addClass("fg-positioned"):b.$item.css("display","none")},justify:function(a,b,c,d){var e=this,f=e.options.margins*(a.items.length-1),g=c-f,h=g/a.width;a.width=a.width*h,a.height=a.height*h,a.top=b,a.height>d&&(a.height=d),a.left=0,a.width<g&&(a.left=(g-a.width)/2),a.width+=f;for(var i,j=a.left,k=0,l=a.items.length;k<l;k++)k>0&&(j+=e.options.margins),i=a.items[k],i.left=j,i.top=b,i.width=i.width*h,i.height=i.height*h,i.height>d&&(i.height=d),j+=i.width;return a.height},position:function(a,b,c,d){var e=this,f=e.options.margins*(a.items.length-1),g=c-f;if(a.top=b,a.left=0,a.width<g)switch(d){case"center":a.left=(g-a.width)/2;break;case"right":a.left=g-a.width}a.width+=f;for(var h,i=a.left,j=0,k=a.items.length;j<k;j++)j>0&&(i+=e.options.margins),h=a.items[j],h.left=i,h.top=b,i+=h.width;return a.height},lastRow:function(a,b,c,d){var e=this,f=e.options.margins*(a.items.length-1),g=c-f,h=a.width/g>e.options.justifyThreshold;switch(e.options.lastRow){case"hide":h?e.justify(a,b,c,d):a.visible=!1;break;case"justify":e.justify(a,b,c,d);break;case"nojustify":h?e.justify(a,b,c,d):e.position(a,b,c,"left");break;case"left":case"center":case"right":h?e.justify(a,b,c,d):e.position(a,b,c,e.options.lastRow)}},items:function(){return a.map(this._items,function(a){return{index:a.index,width:a.width,height:a.height,$item:a.$item,top:a.top,left:a.left}})},rows:function(a,b){function c(){var a={index:++h,visible:!0,width:0,height:e.options.rowHeight,top:0,left:0,items:[]};return g.push(a),a}for(var d,e=this,f=e.items(),g=[],h=-1,i=c(),j=0,k=0,l=0,m=f.length;l<m;l++){if(d=f[l],d.height!=e.options.rowHeight){var n=e.options.rowHeight/d.height;d.height=d.height*n,d.width=d.width*n}k+d.width>a&&l>0&&(g.length>1&&(j+=e.options.margins),j+=e.justify(i,j,a,b),i=c(),k=0),i.items.length>0&&(k+=e.options.margins),k+=d.width,i.width+=d.width,i.items.push(d)}return g.length>1&&(j+=e.options.margins),e.lastRow(i,j,a,b),g},onWindowResize:function(a){a.data.self.layout()}}),b.Justified.defaults={itemSelector:".fg-item",rowHeight:150,maxRowHeight:"200%",margins:0,lastRow:"center",justifyThreshold:.5,refreshInterval:250}}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is),function(a,b,c){b.JustifiedTemplate=b.Template.extend({onPreInit:function(a,c){c.justified=new b.Justified(c.$el.get(0),c.template)},onInit:function(a,b){b.justified.init()},onFirstLoad:function(a,b){b.justified.layout(!0)},onReady:function(a,b){b.justified.layout(!0)},onDestroy:function(a,b){b.justified.destroy()},onLayout:function(a,b){b.justified.layout(!0)},onParsedItems:function(a,b,c){(b.initialized||b.initializing)&&b.justified.layout(!0)},onAppendedItems:function(a,b,c){(b.initialized||b.initializing)&&b.justified.layout(!0)},onDetachedItems:function(a,b,c){b.initialized&&b.justified.layout(!0)}}),b.template.register("justified",b.JustifiedTemplate,null,{container:"foogallery fg-justified"})}(FooGallery.$,FooGallery,FooGallery.utils),function(a,b,c,d){b.Portfolio=c.Class.extend({construct:function(c,d){this.$el=a(c),this.options=a.extend(!0,{},b.Portfolio.defaults,d),this._items=[],this._lastWidth=0},init:function(){var b=this;a(window).on("resize.portfolio",{self:b},b.onWindowResize)},destroy:function(){a(window).off("resize.portfolio"),this.$el.removeAttr("style")},parse:function(){var b=this,c=b.$el.is(":visible"),d=b.getContainerWidth(),e=a("<div/>",{class:b.$el.attr("class")}).css({position:"absolute",top:0,left:-9999,visibility:"hidden",maxWidth:d}).appendTo("body");return b._items=b.$el.find(".fg-item").removeAttr("style").removeClass("fg-positioned").map(function(b,f){var g=a(f),h=g.find(".fg-thumb"),i=g.find(".fg-image"),j=parseFloat(i.attr("width")),k=parseFloat(i.attr("height")),l=d<j?d:j,m=d<j?"auto":k;if(g.find(".fg-caption").css("max-width",l),i.css({width:l,height:m}),c)j=g.outerWidth(),k=g.outerHeight();else{var n=g.clone();n.appendTo(e),j=n.outerWidth(),k=n.outerHeight()}return i.css({width:"",height:""}),{index:b,width:j,height:k,top:0,left:0,$item:g,$thumb:h}}).get(),e.remove(),b._items},round:function(a){return Math.round(2*a)/2},getContainerWidth:function(){var a=this;return a.$el.is(":visible")?a.$el.width():a.$el.parents(":visible:first").innerWidth()},layout:function(a,b){a=!!d.boolean(a)&&a,b=!d.boolean(b)||b;var c=this,e=c.getContainerWidth();0!=c._lastWidth&&Math.abs(e-c._lastWidth)>0&&(a=!0,c._lastWidth=e),(a||0===c._items.length)&&c.parse();for(var f,g=c.rows(e),h=0,i=0,j=g.length;i<j;i++)f=g[i],h=c.position(f,e,h,c.options.align),c.render(f);c.$el.height(h),0==c._lastWidth&&(c._lastWidth=e),b&&c.getContainerWidth()<e&&c.layout(!1,!1)},render:function(a){for(var b,c=0,d=a.items.length;c<d;c++)b=a.items[c],a.visible?b.$item.css({width:b.width,height:a.height,top:b.top,left:b.left,display:""}).addClass("fg-positioned"):b.$item.css("display","none")},position:function(a,b,c,d){var e=this,f=a.items[a.items.length-1],g=b-(f.left+f.width);a.index>0&&(c+=e.options.gutter),a.top=c;for(var h,i=0,j=a.items.length;i<j;i++)h=a.items[i],h.top=c,"center"===d?h.left+=g/2:"right"===d&&(h.left+=g);return c+a.height},items:function(){return a.map(this._items,function(a){return{index:a.index,width:a.width,height:a.height,$item:a.$item,$thumb:a.$thumb,top:a.top,left:a.left}})},rows:function(a){for(var b=this,c=b.items(),d=[],e=c.length>0,f=-1,g=0;e;){f+=1,f>0&&(g+=b.options.gutter);for(var h,i,j,k={index:f,visible:!0,top:g,width:0,height:0,items:[]},l=[],m=0,n=0,o=c.length;n<o&&(i=c[n],!((h=k.width+i.width)>a&&n>0));n++)h>a&&0==n&&(h=a,j=a/i.width,i.width=b.round(i.width*j),i.height=b.round(i.height*j),k.height=i.height),i.top=k.top,n>0&&(m+=b.options.gutter),n!==o-1&&(h+=b.options.gutter),i.left=m,m+=i.width,i.height>k.height&&(k.height=i.height),k.width=h,k.items.push(i),l.push(n);if(0===l.length){e=!1;break}l.sort(function(a,b){return b-a});for(var p=0,q=l.length;p<q;p++)c.splice(l[p],1);d.push(k),e=c.length>0}return d},onWindowResize:function(a){a.data.self.layout()}}),b.Portfolio.defaults={gutter:40,align:"center"}}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is),function(a,b,c){b.PortfolioTemplate=b.Template.extend({construct:function(a,b){this._super(a,b),this.portfolio=null},onPreInit:function(a,c){c.portfolio=new b.Portfolio(c.$el.get(0),c.template)},onInit:function(a,b){b.portfolio.init()},onFirstLoad:function(a,b){b.portfolio.layout(!0)},onReady:function(a,b){b.portfolio.layout(!0)},onDestroy:function(a,b){b.portfolio.destroy()},onLayout:function(a,b){b.portfolio.layout(!0)},onParsedItems:function(a,b,c){(b.initialized||b.initializing)&&b.portfolio.layout(!0)},onAppendedItems:function(a,b,c){(b.initialized||b.initializing)&&b.portfolio.layout(!0)},onDetachedItems:function(a,b,c){b.initialized&&b.portfolio.layout(!0)}}),b.template.register("simple_portfolio",b.PortfolioTemplate,{gutter:40},{container:"foogallery fg-simple_portfolio"})}(FooGallery.$,FooGallery,FooGallery.utils),function(a,b,c,d){b.ImageViewerTemplate=b.Template.extend({construct:function(b,c){this._super(d.extend({},b,{paging:{pushOrReplace:"replace",theme:"fg-light",type:"default",size:1,position:"none",scrollToTop:!1}}),c),this.$inner=a(),this.$current=a(),this.$total=a(),this.$prev=a(),this.$next=a()},createChildren:function(){var b=this;return a("<div/>",{class:b.cls.inner}).append(a("<div/>",{class:b.cls.innerContainer
|
11 |
-
}),a("<div/>",{class:b.cls.controls}).append(a("<div/>",{class:b.cls.prev}).append(a("<span/>",{text:b.il8n.prev})),a("<label/>",{class:b.cls.count,text:b.il8n.count}).prepend(a("<span/>",{class:b.cls.countCurrent,text:"0"})).append(a("<span/>",{class:b.cls.countTotal,text:"0"})),a("<div/>",{class:b.cls.next}).append(a("<span/>",{text:b.il8n.next}))))},destroyChildren:function(){var a=this;a.$el.find(a.sel.inner).remove()},onPreInit:function(a,b){b.$inner=b.$el.find(b.sel.innerContainer),b.$current=b.$el.find(b.sel.countCurrent),b.$total=b.$el.find(b.sel.countTotal),b.$prev=b.$el.find(b.sel.prev),b.$next=b.$el.find(b.sel.next)},onInit:function(a,b){b.template.attachFooBox&&b.$el.on("foobox.previous",{self:b},b.onFooBoxPrev).on("foobox.next",{self:b},b.onFooBoxNext),b.$prev.on("click",{self:b},b.onPrevClick),b.$next.on("click",{self:b},b.onNextClick)},onFirstLoad:function(a,b){b.update()},onDestroy:function(a,b){b.template.attachFooBox&&b.$el.off({"foobox.previous":b.onFooBoxPrev,"foobox.next":b.onFooBoxNext}),b.$prev.off("click",b.onPrevClick),b.$next.off("click",b.onNextClick)},onAppendItem:function(a,b,c){a.preventDefault(),b.$inner.append(c.$el),c.fix(),c.isAttached=!0},onAfterPageChange:function(a,b,c,d,e){e||b.update()},onAfterFilterChange:function(a,b){b.update()},update:function(){this.pages&&(this.$current.text(this.pages.current),this.$total.text(this.pages.total))},prev:function(){this.pages&&(this.template.loop&&1===this.pages.current?this.pages.last():this.pages.prev(),this.update())},next:function(){this.pages&&(this.template.loop&&this.pages.current===this.pages.total?this.pages.first():this.pages.next(),this.update())},onFooBoxPrev:function(a){a.data.self.prev()},onFooBoxNext:function(a){a.data.self.next()},onPrevClick:function(a){a.preventDefault(),a.stopPropagation(),a.data.self.prev()},onNextClick:function(a){a.preventDefault(),a.stopPropagation(),a.data.self.next()}}),b.template.register("image-viewer",b.ImageViewerTemplate,{template:{attachFooBox:!1,loop:!1}},{container:"foogallery fg-image-viewer",inner:"fiv-inner",innerContainer:"fiv-inner-container",controls:"fiv-ctrls",prev:"fiv-prev",next:"fiv-next",count:"fiv-count",countCurrent:"fiv-count-current",countTotal:"fiv-count-total"},{prev:"Prev",next:"Next",count:"of"})}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.obj),function(a,b,c){b.ThumbnailTemplate=b.Template.extend({construct:function(b,d){this._super(c.extend({},b,{filtering:{type:"none"},paging:{type:"none"}}),d),this.$hidden=a()},createChildren:function(){var b=this;return b.$hidden=a("<div/>",{class:b.cls.hidden})},destroyChildren:function(){var a=this;a.$el.find(a.sel.hidden).remove()},onPreInit:function(a,b){b.$hidden=b.$el.find(b.sel.hidden)},onPostInit:function(b,c){for(var d,e=c.items.all().slice(1),f=0,g=e.length;f<g;f++)d=e[f],c.$hidden.append(a("<a/>",{href:d.href,rel:"lightbox["+c.id+"]"}).attr(d.attr.anchor));c.items.setAll(c.items.all().slice(0,1))}}),b.template.register("thumbnail",b.ThumbnailTemplate,null,{container:"foogallery fg-thumbnail",hidden:"fg-st-hidden"})}(FooGallery.$,FooGallery,FooGallery.utils.obj),function(a,b,c,d){b.triggerPostLoad=function(b,c,d,e,f){if("first-load"===b.type||c.initialized&&("after-page-change"===b.type&&!f||"after-filter-change"===b.type))try{a("body").trigger("post-load")}catch(a){console.error(a)}},b.autoDefaults={on:{"first-load.foogallery after-page-change.foogallery after-filter-change.foogallery":b.triggerPostLoad}},b.auto=function(a){b.autoDefaults=d.merge(b.autoDefaults,a)},a(function(){a('[id^="foogallery-gallery-"]:not(.fg-ready)').foogallery(b.autoDefaults)}),c.ready(function(){a('[id^="foogallery-gallery-"].fg-ready').foogallery(b.autoDefaults)})}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.obj);
|
1 |
/*
|
2 |
* FooGallery - The Most Intuitive and Extensible Gallery Creation and Management Tool Ever Created for WordPress
|
3 |
+
* @version 1.1.8
|
4 |
* @link
|
5 |
* @copyright Steven Usher & Brad Vincent 2015
|
6 |
* @license Released under the GPLv3 license.
|
7 |
*/
|
8 |
|
9 |
!function(a,b){b.$=a}(jQuery,window.FooGallery=window.FooGallery||{}),function(a){if(!a)return void console.warn("jQuery must be included in the page prior to the FooGallery.utils library.");var b={$:a,version:"0.0.8"};b.versionCompare=function(a,b){function c(a){for(var b=a.split("."),c=0,d=b.length;c<d;c++)b[c]=parseInt(b[c]),isNaN(b[c])&&(b[c]=0);return b}if(!/[\d.]/.test(a)||!/[\d.]/.test(b))return NaN;for(var d=c(a),e=c(b);d.length<e.length;)d.push(0);for(;e.length<d.length;)e.push(0);for(var f=0;f<d.length;++f){if(e.length==f)return 1;if(d[f]!=e[f])return d[f]>e[f]?1:-1}return d.length!=e.length?-1:0},!function(){try{return!!window.FooGallery.utils}catch(a){return!1}}()?window.FooGallery.utils=b:b.versionCompare(b.version,window.FooGallery.utils.version)>0?(console.warn("An older version of FooGallery.utils ("+window.FooGallery.utils.version+") already exists in the page, version "+b.version+" will override it."),window.FooGallery.utils=b):console.warn("A newer version of FooGallery.utils ("+window.FooGallery.utils.version+") already exists in the page, version "+b.version+" will not register itself.")}(jQuery),function(a,b){"0.0.8"===b.version&&(b.is={},b.is.array=function(a){return"[object Array]"===Object.prototype.toString.call(a)},b.is.boolean=function(a){return"[object Boolean]"===Object.prototype.toString.call(a)},b.is.element=function(a){return"object"==typeof HTMLElement?a instanceof HTMLElement:!!a&&"object"==typeof a&&null!==a&&1===a.nodeType&&"string"==typeof a.nodeName},b.is.empty=function(a){if(b.is.undef(a)||null===a)return!0;if(b.is.number(a)&&0==a)return!0;if(b.is.boolean(a)&&!1===a)return!0;if(b.is.string(a)&&0===a.length)return!0;if(b.is.array(a)&&0===a.length)return!0;if(b.is.jq(a)&&0===a.length)return!0;if(b.is.hash(a)){for(var c in a)if(a.hasOwnProperty(c))return!1;return!0}return!1},b.is.error=function(a){return"[object Error]"===Object.prototype.toString.call(a)},b.is.fn=function(a){return a===window.alert||"[object Function]"===Object.prototype.toString.call(a)},b.is.hash=function(a){return b.is.object(a)&&a.constructor===Object&&!a.nodeType&&!a.setInterval},b.is.jq=function(c){return!b.is.undef(a)&&c instanceof a},b.is.number=function(a){return"[object Number]"===Object.prototype.toString.call(a)&&!isNaN(a)},b.is.object=function(a){return"[object Object]"===Object.prototype.toString.call(a)&&!b.is.undef(a)&&null!==a},b.is.promise=function(a){return b.is.object(a)&&b.is.fn(a.then)&&b.is.fn(a.promise)},b.is.size=function(a){return!!(b.is.string(a)&&!b.is.empty(a)||b.is.number(a))&&/^(auto|none|(?:[\d\.]*)+?(?:%|px|mm|q|cm|in|pt|pc|em|ex|ch|rem|vh|vw|vmin|vmax)?)#x2F;.test(a)},b.is.string=function(a){return"[object String]"===Object.prototype.toString.call(a)},b.is.undef=function(a){return void 0===a})}(FooGallery.utils.$,FooGallery.utils),function(a,b,c){if("0.0.8"===b.version){b.fn={};var d=Function.prototype.toString;b.fn.CONTAINS_SUPER=/xyz/.test(d.call(function(){xyz}))?/\b_super\b/:/.*/,b.fn.addOrOverride=function(a,e,f){if(c.object(a)&&c.string(e)&&!c.empty(e)&&c.fn(f)){var g=a[e],h=c.fn(g)&&b.fn.CONTAINS_SUPER.test(d.call(f));a[e]=h?function(a,b){return function(){var c=this._super;this._super=a;var d=b.apply(this,arguments);return this._super=c,d}}(g,f):f}},b.fn.apply=function(a,b){function d(){return a.apply(this,b)}return b=c.array(b)?b:[],d.prototype=a.prototype,new d},b.fn.arg2arr=function(a){return Array.prototype.slice.call(a)},b.fn.check=function(d,e,f,g){function h(a){return function(){return a.apply(d,arguments)}}return f=c.fn(f)?f:a.noop,d=c.object(d)?d:window,e=c.string(e)?b.fn.fetch(e,g):e,h(c.fn(e)?e:f)},b.fn.fetch=function(b,d){return!c.string(b)||c.empty(b)?null:(d=c.object(d)?d:window,a.each(b.split("."),function(a,b){if(!d[b])return!1;d=d[b]}),c.fn(d)?d:null)},b.fn.enqueue=function(d,e,f,g){function h(a,b){try{return n.push(a),b.apply(a,i)}catch(a){return j.reject(a,n),j}}var i=b.fn.arg2arr(arguments),j=a.Deferred(),k=a.Deferred(),l=k.promise(),m=[],n=[],o=!0;return d=i.shift(),e=i.shift(),a.each(d,function(a,d){c.fn(d[e])&&(l=l.then(function(){if(!o){var a=b.fn.arg2arr(arguments);m.push(a)}return o=!1,h(d,d[e])}))}),l.then(function(){if(!o){var a=b.fn.arg2arr(arguments);m.push(a)}o=!1,j.resolve(m)}),l.fail(function(){var a=b.fn.arg2arr(arguments);a.push(n),j.reject.apply(j,a)}),k.resolve(),j.promise()},b.fn.when=function(b){if(!c.array(b)||c.empty(b))return a.when();for(var d=a.Deferred(),e=[],f=b.length,g=0;g<b.length;g++)b[g].then(function(a){e.push(a)}).always(function(){--f||d.resolve(e)});return d.promise()},b.fn.rejectWith=function(c,d){var e=a.Deferred(),f=b.fn.arg2arr(arguments);return e.reject.apply(e,f).promise()},b.fn.resolveWith=function(c,d){var e=a.Deferred(),f=b.fn.arg2arr(arguments);return e.resolve.apply(e,f).promise()},b.fn.resolved=a.Deferred().resolve().promise(),b.fn.rejected=a.Deferred().reject().promise()}}(FooGallery.utils.$,FooGallery.utils,FooGallery.utils.is),function(a,b){if("0.0.8"===a.version){a.url={};var c=document.createElement("a");a.url.parts=function(a){return c.href=a,{hash:c.hash,host:c.host,hostname:c.hostname,href:c.href,origin:c.origin,pathname:c.pathname,port:c.port,protocol:c.protocol,search:c.search}},a.url.full=function(a){return!b.string(a)||b.empty(a)?null:(c.href=a,c.href)},a.url.param=function(a,c,d){if(!b.string(a)||!b.string(c)||b.empty(c))return a;var e,f,g,h;return b.undef(d)?(e=new RegExp("[?|&]"+c+"=([^&;]+?)(&|#|;|$)"),f=e.exec(a)||[,""],g=f[1].replace(/\+/g,"%20"),b.string(g)&&!b.empty(g)?decodeURIComponent(g):null):(""===d||null===d?(e=new RegExp("^([^#]*?)(([^#]*)&)?"+c+"(=[^&#]*)?(&|#|$)"),g=a.replace(e,"$1$3$5").replace(/^([^#]*)((\?)&|\?(#|$))/,"$1$3$4")):(e=new RegExp("([?&])"+c+"[^&]*"),h=c+"="+encodeURIComponent(d),(g=a.replace(e,"$1"+h))!==a||e.test(g)||(g+=(-1!==g.indexOf("?")?"&":"?")+h)),g)}}}(FooGallery.utils,FooGallery.utils.is),function(a,b,c){"0.0.8"===a.version&&(a.str={},a.str.camel=function(a){return b.empty(a)?a:a.toUpperCase()===a?a.toLowerCase():a.replace(/^([A-Z])|[-\s_]+(\w)/g,function(a,c,d){return b.string(d)?d.toUpperCase():c.toLowerCase()})},a.str.contains=function(a,c,d){return!(!b.string(a)||b.empty(a)||!b.string(c)||b.empty(c))&&(c.length<=a.length&&-1!==(d?a.toUpperCase().indexOf(c.toUpperCase()):a.indexOf(c)))},a.str.containsWord=function(a,c,d){if(!b.string(a)||b.empty(a)||!b.string(c)||b.empty(c)||a.length<c.length)return!1;for(var e=a.split(/\W/),f=0,g=e.length;f<g;f++)if(d?e[f].toUpperCase()==c.toUpperCase():e[f]==c)return!0;return!1},a.str.endsWith=function(a,c){return!b.string(a)||b.empty(a)||!b.string(c)||b.empty(c)?a==c:a.slice(a.length-c.length)==c},a.str.escapeRegExp=function(a){return b.empty(a)?a:a.replace(/[.*+?^${}()|[\]\\]/g,"\\amp;")},a.str.fnv1a=function(a){if(!b.string(a)||b.empty(a))return null;var c,d,e=2166136261;for(c=0,d=a.length;c<d;c++)e^=a.charCodeAt(c),e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24);return e>>>0},a.str.from=function(c,d){return!b.string(c)||b.empty(c)||!b.string(d)||b.empty(d)?null:a.str.contains(c,d)?c.substring(c.indexOf(d)+d.length):null},a.str.join=function(d,e,f){if(!b.string(d)||!b.string(e))return null;var g=c.arg2arr(arguments);d=g.shift();var h,i,j=g.shift();for(h=0,i=g.length;h<i;h++)e=g[h],b.empty(e)||(a.str.endsWith(j,d)&&(j=j.slice(0,j.length-d.length)),a.str.startsWith(e,d)&&(e=e.slice(d.length)),j+=d+e);return j},a.str.startsWith=function(a,c){return!b.empty(a)&&!b.empty(c)&&a.slice(0,c.length)==c},a.str.until=function(c,d){return b.empty(c)||b.empty(d)?c:a.str.contains(c,d)?c.substring(0,c.indexOf(d)):c},a.str.format=function(a,d,e){var f=c.arg2arr(arguments);if(a=f.shift(),b.empty(a)||b.empty(f))return a;1===f.length&&(b.array(f[0])||b.object(f[0]))&&(f=f[0]);for(var g in f)a=a.replace(new RegExp("\\{"+g+"\\}","gi"),f[g]);return a})}(FooGallery.utils,FooGallery.utils.is,FooGallery.utils.fn),function(a,b,c,d,e){if("0.0.8"===b.version){b.obj={};var f=function(){};b.obj.create=function(a){if(!c.object(a))throw TypeError("Argument must be an object");f.prototype=a;var b=new f;return f.prototype=null,b},b.obj.extend=function(e,f,g){e=c.object(e)?e:{};var h=d.arg2arr(arguments);return h.shift(),a.each(h,function(a,c){b.obj.merge(e,c)}),e},b.obj.merge=function(a,d){a=c.hash(a)?a:{},d=c.hash(d)?d:{};for(var e in d)d.hasOwnProperty(e)&&(c.hash(d[e])?(a[e]=c.hash(a[e])?a[e]:{},b.obj.merge(a[e],d[e])):c.array(d[e])?a[e]=d[e].slice():a[e]=d[e]);return a},b.obj.mergeValid=function(d,e,f,g){if(!c.hash(f)||!c.hash(e))return d;e=c.hash(e)?e:{},g=c.hash(g)?g:{};var h,i,j;for(h in e)e.hasOwnProperty(h)&&c.fn(e[h])&&(i=c.array(g[h])?g[h]:c.string(g[h])?[g[h]]:[h],a.each(i,function(a,g){if(j=b.obj.prop(f,g),!c.undef(j))return e[h](j)?(b.obj.prop(d,h,j),!1):void 0}));return d},b.obj.prop=function(b,d,f){if(c.object(b)&&!c.empty(d)){var g,h;if(c.undef(f))return e.contains(d,".")?(g=d.split("."),h=g.length-1,a.each(g,function(a,d){if(a===h)f=b[d];else{if(!c.hash(b[d]))return!1;b=b[d]}})):c.undef(b[d])||(f=b[d]),f;e.contains(d,".")?(g=d.split("."),h=g.length-1,a.each(g,function(a,d){a===h?b[d]=f:b=c.hash(b[d])?b[d]:b[d]={}})):c.undef(b[d])||(b[d]=f)}}}}(FooGallery.utils.$,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.fn,FooGallery.utils.str),function(a,b,c){if("0.0.8"===b.version){b.ready=function(a){function c(){try{a.call(window,b.$)}catch(a){console.error(a)}}(Function("/*@cc_on return true@*/")()?"complete"===document.readyState:"loading"!==document.readyState)?c():document.addEventListener("DOMContentLoaded",c,!1)};var d=0;b.uniqueId=function(a,b){var e=a.attr("id");return c.empty(e)&&(b=c.string(b)&&!c.empty(b)?b:"uid-",e=b+ ++d,a.attr("id",e).data("__uniqueId__",!0)),e},b.removeUniqueId=function(a){a.data("__uniqueId__")&&a.removeAttr("id").removeData("__uniqueId__")}}}(FooGallery.utils.$,FooGallery.utils,FooGallery.utils.is),function(a,b,c){if("0.0.8"===b.version){b.transition={};var d=document.createElement("div");b.transition.supported=function(a){var b=a.style;return c.string(b.transition)||c.string(b.WebkitTransition)||c.string(b.MozTransition)||c.string(b.msTransition)||c.string(b.OTransition)}(d),b.transition.end=function(a){var b=a.style;return c.string(b.transition)?"transitionend":c.string(b.WebkitTransition)?"webkitTransitionEnd":c.string(b.MozTransition)?"transitionend":c.string(b.msTransition)?"msTransitionEnd":c.string(b.OTransition)?"oTransitionEnd":null}(d),b.transition.duration=function(a,b){if(b=c.number(b)?b:0,!c.jq(a))return b;var d=a.css("transition-duration");if(/^([\d\.]*)+?(ms|s)#x2F;i.test(d)){var e=d.match(/^([\d\.]*)+?(ms|s)#x2F;i),f=parseFloat(e[1]);return"s"===e[2].toLowerCase()&&(f*=1e3),f}return b},b.transition.start=function(d,e,f,g){var h=a.Deferred();if(d=d.first(),b.transition.supported){var i=d.data("transition_safety");c.hash(i)&&c.number(i.timer)&&(clearTimeout(i.timer),d.removeData("transition_safety").off(b.transition.end+".utils"),i.deferred.reject()),g=c.number(g)?g:b.transition.duration(d)+50,i={deferred:h,timer:setTimeout(function(){d.removeData("transition_safety").off(b.transition.end+".utils"),h.resolve()},g)},d.data("transition_safety",i),d.on(b.transition.end+".utils",function(a){d.is(a.target)&&(clearTimeout(i.timer),d.removeData("transition_safety").off(b.transition.end+".utils"),h.resolve())})}return setTimeout(function(){c.fn(e)?e.apply(d.get(0),[d]):d.toggleClass(e,f),b.transition.supported||h.resolve()},20),h.promise()}}}(FooGallery.utils.$,FooGallery.utils,FooGallery.utils.is),function(a,b,c,d,e){"0.0.8"===b.version&&(b.Class=function(){},b.Class.extend=function(a){function f(){if(!c.fn(this.construct))throw new SyntaxError('FooGallery.utils.Class objects must be constructed with the "new" keyword.');this.construct.apply(this,arguments)}a=c.hash(a)?a:{};var g=d.create(this.prototype);for(var h in a)a.hasOwnProperty(h)&&e.addOrOverride(g,h,a[h]);return g.construct=c.fn(g.construct)?g.construct:function(){},f.prototype=g,f.prototype.constructor=c.fn(g.__ctor__)?g.__ctor__:f,f.extend=b.Class.extend,f.override=b.Class.override,f},b.Class.override=function(a,b){e.addOrOverride(this.prototype,a,b)})}(FooGallery.utils.$,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.obj,FooGallery.utils.fn),function(a,b,c){if("0.0.8"===b.version){b.Bounds=b.Class.extend({construct:function(){var a=this;a.top=0,a.right=0,a.bottom=0,a.left=0,a.width=0,a.height=0},inflate:function(a){var b=this;return c.number(a)&&(b.top-=a,b.right+=a,b.bottom+=a,b.left-=a,b.width+=2*a,b.height+=2*a),b},intersects:function(a){var b=this;return b.left<=a.right&&a.left<=b.right&&b.top<=a.bottom&&a.top<=b.bottom}});var d;b.getViewportBounds=function(c){d||(d=a(window));var e=new b.Bounds;return e.top=d.scrollTop(),e.left=d.scrollLeft(),e.width=d.width(),e.height=d.height(),e.right=e.left+e.width,e.bottom=e.top+e.height,e.inflate(c),e},b.getElementBounds=function(d){c.jq(d)||(d=a(d));var e=new b.Bounds;if(0!==d.length){var f=d.offset();e.top=f.top,e.left=f.left,e.width=d.width(),e.height=d.height()}return e.right=e.left+e.width,e.bottom=e.top+e.height,e}}}(FooGallery.utils.$,FooGallery.utils,FooGallery.utils.is),function(a,b,c,d){"0.0.8"===b.version&&(b.Factory=b.Class.extend({construct:function(){this.registered={}},contains:function(a){return!c.undef(this.registered[a])},load:function(b,e,f){var g,h,i=this,j=d.arg2arr(arguments),k=[],l=[];b=j.shift()||{};for(g in i.registered)if(i.registered.hasOwnProperty(g)){var m=i.registered[g];b.hasOwnProperty(g)&&(h=b[g],c.string(h)&&(h=d.fetch(b[g])),c.fn(h)&&(m={name:g,klass:h,priority:i.registered[g].priority})),k.push(m)}for(g in b)b.hasOwnProperty(g)&&!i.registered.hasOwnProperty(g)&&(h=b[g],c.string(h)&&(h=d.fetch(b[g])),c.fn(h)&&k.push({name:g,klass:h,priority:0}));return k.sort(function(a,b){return b.priority-a.priority}),a.each(k,function(a,b){c.fn(b.klass)&&l.push(d.apply(b.klass,j))}),l},make:function(a,b,e){var f,g=this,h=d.arg2arr(arguments);return a=h.shift(),f=g.registered[a],c.hash(f)&&c.fn(f.klass)?d.apply(f.klass,h):null},names:function(b){b=!!c.boolean(b)&&b;var d,e=[];if(b){var f=[];for(d in this.registered)this.registered.hasOwnProperty(d)&&f.push(this.registered[d]);f.sort(function(a,b){return b.priority-a.priority}),a.each(f,function(a,b){e.push(b.name)})}else for(d in this.registered)this.registered.hasOwnProperty(d)&&e.push(d);return e},register:function(a,b,d){if(!c.string(a)||c.empty(a)||!c.fn(b))return!1;d=c.number(d)?d:0;var e=this.registered[a];return this.registered[a]={name:a,klass:b,priority:c.undef(e)?d:e.priority},!0}}))}(FooGallery.utils.$,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.fn),function(a,b,c){if("0.0.8"===a.version){var d=!1;try{d=!!window.localStorage}catch(a){d=!1}a.Debugger=a.Class.extend({construct:function(a){this.key=a,this.enabled=!!d&&!!localStorage.getItem(this.key)},enable:function(){d&&(this.enabled=!0,localStorage.setItem(this.key,this.enabled))},disable:function(){d&&(this.enabled=!1,localStorage.removeItem(this.key))},log:function(a,c){this.enabled&&console.log.apply(console,b.arg2arr(arguments))},logf:function(a,d,e){if(this.enabled){var f=b.arg2arr(arguments);a=f.shift(),d=f.shift(),f.unshift(c.format(a,d)),this.log.apply(this,f)}}})}}(FooGallery.utils,FooGallery.utils.fn,FooGallery.utils.str),function(a,b,c){"0.0.8"===b.version&&(b.Throttle=b.Class.extend({construct:function(a){this.id=null,this.active=!1,this.idle=c.number(a)?a:0},limit:function(a){if(c.fn(a)){this.clear();var b=this;this.active=!0,this.id=setTimeout(function(){b.active=!1,b.id=null,a()},this.idle)}},clear:function(){c.number(this.id)&&(clearTimeout(this.id),this.active=!1,this.id=null)}}))}(FooGallery.utils.$,FooGallery.utils,FooGallery.utils.is),function(a,b,c,d,e){b.debug=new c.Debugger("__FooGallery__"),c.selectify=function(b){if(d.empty(b))return null;if(d.hash(b)){var e,f={};for(var g in b)b.hasOwnProperty(g)&&(e=c.selectify(b[g]))&&(f[g]=e);return f}return d.string(b)||d.array(b)?(d.string(b)&&(b=[b]),a.map(b,function(a){return d.string(a)?"."+a.split(/\s/g).join("."):null}).join(",")):null},b.emptyImage="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",b.dataTemplate="__FooGallery__",b.dataItem="__FooGalleryItem__",b.init=function(a,c){return b.template.make(a,c).initialize()},b.initAll=function(c){return e.when(a(".foogallery").map(function(a,d){return b.init(c,d)}).get())},b.parseSrc=function(b,c,e,f,g,h){if(!d.string(b))return null;if(!d.string(f))return b;var i=a.map(f.replace(/(\s[\d.]+[whx]),/g,"$1 @,@ ").split(" @,@ "),function(a){return{url:/^\s*(\S*)/.exec(a)[1],w:parseFloat((/\S\s+(\d+)w/.exec(a)||[0,1/0])[1]),h:parseFloat((/\S\s+(\d+)h/.exec(a)||[0,1/0])[1]),x:parseFloat((/\S\s+([\d.]+)x/.exec(a)||[0,1])[1])}});if(!i.length)return b;i.unshift({url:b,w:i[0].w!==1/0&&i[0].h===1/0?c:1/0,h:i[0].h!==1/0&&i[0].w===1/0?e:1/0,x:1});var j,k=window.devicePixelRatio||1,l={w:g*k,h:h*k,x:k};for(j in l)l.hasOwnProperty(j)&&(i=a.grep(i,function(a,b){return function(c){return c[a]>=l[a]||c[a]===b}}(j,Math.max.apply(null,a.map(i,function(a){return a[j]})))));for(j in l)l.hasOwnProperty(j)&&(i=a.grep(i,function(a,b){return function(c){return c[a]===b}}(j,Math.min.apply(null,a.map(i,function(a){return a[j]})))));return i[0].url},a.fn.foogallery=function(c,e){return this.each(function(f,g){if(d.string(c)){var h=a.data(g,b.dataTemplate);if(h instanceof b.Template)switch(c){case"layout":return void h.layout();case"destroy":return void h.destroy()}}else b.template.make(c,g).initialize().then(function(a){d.fn(e)&&e(a)})})}}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.fn),function(a,b,c,d,e){var f="__FooGallerySwipe__",g="ontouchstart"in window,h=window.navigator.msPointerEnabled&&!window.navigator.pointerEnabled&&!g,i=(window.navigator.pointerEnabled||window.navigator.msPointerEnabled)&&!g,j=g||i;b.Swipe=c.Class.extend({construct:function(b,c){var d=this,f=".fgswipe";d.$el=a(b),d.opt=e.extend({threshold:20,allowPageScroll:!1,swipe:a.noop,data:{}},c),d.active=!1,d.startPoint=null,d.endPoint=null,d.events={start:(j?i?h?"MSPointerDown":"pointerdown":"touchstart":"mousedown")+f,move:(j?i?h?"MSPointerMove":"pointermove":"touchmove":"mousemove")+f,end:(j?i?h?"MSPointerUp":"pointerup":"touchend":"mouseup")+f,leave:(j?i?"mouseleave":null:"mouseleave")+f}},init:function(){var a=this;a.$el.on(a.events.start,{self:a},a.onStart),a.$el.on(a.events.move,{self:a},a.onMove),a.$el.on(a.events.end,{self:a},a.onEnd),d.string(a.events.leave)&&a.$el.on(a.events.leave,{self:a},a.onEnd),a.$el.data(f,a)},destroy:function(){var a=this;a.$el.off(a.events.start,a.onStart),a.$el.off(a.events.move,a.onMove),a.$el.off(a.events.end,a.onEnd),d.string(a.events.leave)&&a.$el.off(a.events.leave,a.onEnd),a.$el.removeData(f)},getAngle:function(a,b){var c=Math.atan2(a.x-b.x,a.y-b.y),d=Math.round(180*c/Math.PI);return 360-(d<0?360-Math.abs(d):d)},getDistance:function(a,b){var c=b.x-a.x,d=b.y-a.y;return c*=c,d*=d,Math.sqrt(c+d)},getDirection:function(a,b){var c=this,d=c.getAngle(a,b);return d>337.5||d<=22.5?"N":d>22.5&&d<=67.5?"NE":d>67.5&&d<=112.5?"E":d>112.5&&d<=157.5?"SE":d>157.5&&d<=202.5?"S":d>202.5&&d<=247.5?"SW":d>247.5&&d<=292.5?"W":d>292.5&&d<=337.5?"NW":"NONE"},getPoint:function(a){var b;return j&&!d.empty(b=a.originalEvent.touches||a.touches)?{x:b[0].pageX,y:b[0].pageY}:d.number(a.pageX)&&d.number(a.pageY)?{x:a.pageX,y:a.pageY}:null},getOffset:function(a){var b=this,c=b.$el.offset();return{left:a.x-c.left,top:a.y-c.top}},onStart:function(a){var b=a.data.self,c=b.getPoint(a);d.empty(c)||(b.active=!0,b.startPoint=b.endPoint=c)},onMove:function(a){var b=a.data.self,c=b.getPoint(a);b.active&&!d.empty(c)&&(b.endPoint=c,b.opt.allowPageScroll||a.preventDefault())},onEnd:function(a){var b=a.data.self;if(b.active){b.active=!1;var c={startPoint:b.startPoint,endPoint:b.endPoint,startOffset:b.getOffset(b.startPoint),endOffset:b.getOffset(b.endPoint),angle:b.getAngle(b.startPoint,b.endPoint),distance:b.getDistance(b.startPoint,b.endPoint),direction:b.getDirection(b.startPoint,b.endPoint)};if(b.opt.threshold>0&&c.distance<b.opt.threshold)return;b.opt.swipe.apply(this,[c,b.opt.data]),b.startPoint=null,b.endPoint=null}}}),a.fn.fgswipe=function(c){return this.each(function(){var e=a(this),g=e.data(f);if(g instanceof b.Swipe){if(d.string(c)&&d.fn(g[c]))return void g[c]();g.destroy()}d.hash(c)&&(g=new b.Swipe(this,c),g.init())})}}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.obj),function(a,b,c,d,e,f){b.TemplateFactory=c.Factory.extend({construct:function(){this.registered={}},register:function(a,b,c,e,f,g){var h=this,i=h._super(a,b,g);if(i){var j=h.registered;j[a].opt=d.hash(c)?c:{},j[a].cls=d.hash(e)?e:{},j[a].il8n=d.hash(f)?f:{}}return i},make:function(b,c){c=d.jq(c)?c:a(c),b=f.extend({},b,c.data("foogallery"));var e=this,g=e.type(b,c);return e.contains(g)?(b=e.options(g,b),e._super(g,b,c)):null},type:function(b,e){e=d.jq(e)?e:a(e);var f=this,g=d.hash(b)&&d.hash(b)&&d.string(b.type)&&f.contains(b.type)?b.type:"core";if("core"===g&&e.length>0)for(var h=f.registered,i=f.names(!0),j=0,k=i.length;j<k;j++)if(h.hasOwnProperty(i[j])){var l=i[j],m=h[l].cls;if(d.string(m.container)){var n=c.selectify(m.container);if(e.is(n)){g=i[j];break}}}return g},configure:function(a,b,c,d){var e=this;if(e.contains(a)){var g=e.registered;f.extend(g[a].opt,b),f.extend(g[a].cls,c),f.extend(g[a].il8n,d)}},options:function(a,c){c=f.extend({type:a},c);var e=this,g=e.registered,h=g.core.opt,i=g.core.cls,j=g.core.il8n;return d.hash(c.cls)||(c.cls={}),d.hash(c.il8n)||(c.il8n={}),d.undef(b.filtering)||(c=b.filtering.merge(c)),d.undef(b.paging)||(c=b.paging.merge(c)),"core"!==a&&e.contains(a)?(c=f.extend({},h,g[a].opt,c),c.cls=f.extend({},i,g[a].cls,c.cls),c.il8n=f.extend({},j,g[a].il8n,c.il8n)):(c=f.extend({},h,c),c.cls=f.extend({},i,c.cls),c.il8n=f.extend({},j,c.il8n)),c}}),b.template=new b.TemplateFactory}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.fn,FooGallery.utils.obj),function(a,b,c,d,e){a.PagingFactory=b.Factory.extend({construct:function(){this.registered={}},register:function(a,b,d,e,f,g,h){var i=this,j=i._super(a,b,h);if(j){var k=i.registered;k[a].ctrl=c.fn(d)?d:null,k[a].opt=c.hash(e)?e:{},k[a].cls=c.hash(f)?f:{},k[a].il8n=c.hash(g)?g:{}}return j},type:function(a){var b,d=this;return c.hash(a)&&c.hash(b=a.paging)&&c.string(b.type)&&d.contains(b.type)?b.type:null},merge:function(a){a=e.extend({},a);var b=this,d=b.type(a),f=b.registered,g=f.default.opt,h=f.default.cls,i=f.default.il8n,j=c.hash(a.paging)?a.paging:{},k=c.hash(a.cls)&&c.hash(a.cls.paging)?e.extend({},a.cls.paging):{},l=c.hash(a.il8n)&&c.hash(a.il8n.paging)?e.extend({},a.il8n.paging):{};return c.hash(a.cls)||(a.cls={}),c.hash(a.il8n)||(a.il8n={}),"default"!==d&&b.contains(d)?(a.paging=e.extend({},g,f[d].opt,j,{type:d}),a.cls=e.extend(a.cls,{paging:h},{paging:f[d].cls},{paging:k}),a.il8n=e.extend(a.il8n,{paging:i},{paging:f[d].il8n},{paging:l})):(a.paging=e.extend({},g,j,{type:d}),a.cls=e.extend(a.cls,{paging:h},{paging:k}),a.il8n=e.extend(a.il8n,{paging:i},{paging:l})),a},configure:function(a,b,c,d){var f=this;if(f.contains(a)){var g=f.registered;e.extend(g[a].opt,b),e.extend(g[a].cls,c),e.extend(g[a].il8n,d)}},hasCtrl:function(a){var b=this,d=b.registered[a];return c.hash(d)&&c.fn(d.ctrl)},makeCtrl:function(a,b,d,e){var f=this,g=f.registered[a];return c.hash(g)&&c.fn(g.ctrl)?new g.ctrl(b,d,e):null}}),a.paging=new a.PagingFactory}(FooGallery,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.fn,FooGallery.utils.obj),function(a,b,c,d,e,f){var g=0;b.Template=c.Class.extend({construct:function(e,f){var h=this;h.namespace=".foogallery-"+ ++g,h.$el=d.jq(f)?f:a(f),h.opt=e,h.template=e.template,h.id=h.$el.prop("id")||e.id,h.cls=e.cls,h.il8n=e.il8n,h.sel=c.selectify(h.cls),h.items=b.components.make("items",h),h.pages=d.undef(b.paging)?null:b.paging.make(e.paging.type,h),h.filter=d.undef(b.filtering)?null:b.filtering.make(e.filtering.type,h),h.state=b.components.make("state",h),h._initialize=null,h.initializing=!1,h.initialized=!1,h.destroying=!1,h.destroyed=!1,h._undo={classes:"",style:"",create:!1,children:!1}},initialize:function(f){var g=this;return d.promise(g._initialize)?g._initialize:(f=d.jq(f)?f:a(f),g._initialize=a.Deferred(function(h){if(g.initializing=!0,0===f.length&&0===g.$el.parent().length)return void h.reject("A parent element is required.");0===g.$el.length&&(g.$el=g.create(),g._undo.create=!0),f.length>0&&g.$el.appendTo(f);var i,j=a.Deferred(),k=j.promise();g.$el.length>0&&(i=g.$el.data(b.dataTemplate))instanceof b.Template?k=k.then(function(){return i.destroy().then(function(){g.$el.data(b.dataTemplate,g)})}):g.$el.data(b.dataTemplate,g),k.then(function(){if(g.destroying)return e.rejectWith("destroy in progress");d.empty(g.opt.on)||g.$el.on(g.opt.on),g._undo.classes=g.$el.attr("class"),g._undo.style=g.$el.attr("style"),g.$el.is(g.sel.container)||g.$el.addClass(g.cls.container);var a=c.selectify(g.opt.classes);return null==a||g.$el.is(a)||g.$el.addClass(g.opt.classes),0==g.$el.children().not(g.sel.item.elem).length&&(g.$el.append(g.createChildren()),g._undo.children=!0),g.raise("pre-init").isDefaultPrevented()?e.rejectWith("pre-init default prevented"):void 0}).then(function(){return g.destroying?e.rejectWith("destroy in progress"):g.opt.delay<=0?e.resolved:a.Deferred(function(a){g._delay=setTimeout(function(){g._delay=null,a.resolve()},g.opt.delay)}).promise()}).then(function(){return g.destroying?e.rejectWith("destroy in progress"):g.raise("init").isDefaultPrevented()?e.rejectWith("init default prevented"):g.items.fetch()}).then(function(){if(g.destroying)return e.rejectWith("destroy in progress");if(g.raise("post-init").isDefaultPrevented())return e.rejectWith("post-init default prevented");var b=g.state.parse();g.state.set(d.empty(b)?g.state.initial():b),a(window).on("scroll"+g.namespace,{self:g},g.throttle(g.onWindowScroll,g.opt.throttle)).on("popstate"+g.namespace,{self:g},g.onWindowPopState)}).then(function(){return g.destroying?e.rejectWith("destroy in progress"):(g.raise("first-load"),g.loadAvailable())}).then(function(){if(g.destroying)return e.rejectWith("destroy in progress");g.initializing=!1,g.initialized=!0,g._check(200),g._check(500),g._check(1e3),g._check(2e3),g._check(5e3),g.raise("ready"),h.resolve(g)}).fail(function(a){h.reject(a)}),j.resolve()}).promise().fail(function(a){console.log("initialize failed",g,a),g.destroy()}))},create:function(){var b=this;return a("<div/>",{id:b.id,class:b.cls.container}).addClass(b.opt.classes)},createChildren:function(){return a()},destroy:function(){var b=this;return b.destroyed?e.resolved:(b.destroying=!0,a.Deferred(function(a){b.initializing&&d.promise(b._initialize)?b._initialize.always(function(){b.destroying=!1,b._destroy(),a.resolve()}):(b.destroying=!1,b._destroy(),a.resolve())}).promise())},_destroy:function(){var c=this;c.destroyed||(c.raise("destroy"),a(window).off(c.namespace),c.state.destroy(),c.filter&&c.filter.destroy(),c.pages&&c.pages.destroy(),c.items.destroy(),d.empty(c.opt.on)||c.$el.off(c.opt.on),c.raise("destroyed"),c.$el.removeData(b.dataTemplate),d.empty(c._undo.classes)?c.$el.removeAttr("class"):c.$el.attr("class",c._undo.classes),d.empty(c._undo.style)?c.$el.removeAttr("style"):c.$el.attr("style",c._undo.style),c._undo.children&&c.destroyChildren(),c._undo.create&&c.$el.remove(),c.$el=c.state=c.items=c.pages=null,c.destroyed=!0,c.initializing=!1,c.initialized=!1)},destroyChildren:function(){},getAvailable:function(){return this.pages?this.pages.available():this.items.available()},loadAvailable:function(){return this.items.load(this.getAvailable())},_check:function(a){a=d.number(a)?a:0;var b=this;setTimeout(function(){!b.initialized||b.destroying&&b.destroyed||b.loadAvailable()},a)},raise:function(c,e){if(!d.string(c)||d.empty(c))return null;e=d.array(e)?e:[];var g=this,h=c.split(".")[0],i=f.camel("on-"+h),j=a.Event(h+".foogallery");return e.unshift(g),g.$el.trigger(j,e),b.debug.logf("{id}|{name}:",{id:g.id,name:h},e),d.fn(g[i])&&(e.unshift(j),g[i].apply(g.$el.get(0),e)),j},layout:function(){var a=this;null!==a._initialize&&a.raise("layout")},throttle:function(a,b){var c=Date.now();return function(){if(c+b-Date.now()<0){var d=e.arg2arr(arguments);a.apply(this,d),c=Date.now()}}},onWindowPopState:function(a){var b=a.data.self,c=a.originalEvent.state;d.empty(c)||c.id!==b.id||(b.state.set(c),b.loadAvailable())},onWindowScroll:function(a){a.data.self.loadAvailable()}}),b.template.register("core",b.Template,{id:null,type:"core",classes:"",on:{},lazy:!0,viewport:200,items:[],delay:100,throttle:50,timeout:6e4,srcset:"data-srcset",src:"data-src",template:{}},{container:"foogallery"},{},-100)}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.fn,FooGallery.utils.str),function(a,b){a.Component=b.Class.extend({construct:function(a){this.tmpl=a},destroy:function(){this.tmpl=null}}),a.components=new b.Factory}(FooGallery,FooGallery.utils),function(a,b,c,d){b.State=b.Component.extend({construct:function(a){var b=this;b._super(a),b.apiEnabled=!!window.history&&!!history.replaceState,b.opt=b.tmpl.opt.state,b.enabled=b.opt.enabled,b.pushOrReplace=b.isPushOrReplace(b.opt.pushOrReplace)?b.opt.pushOrReplace:"replace";var c=d.escapeRegExp(b.tmpl.id),e=d.escapeRegExp(b.opt.values),f=d.escapeRegExp(b.opt.pair);b.regex={exists:new RegExp("^#"+c+"\\"+e+".+?"),values:new RegExp("(\\w+)"+f+"([^"+e+"]+)","g")}},destroy:function(){var a=this;a.clear(),a.opt=a.regex={},a._super()},isPushOrReplace:function(b){return-1!==a.inArray(b,["push","replace"])},exists:function(){return this.regex.exists.test(location.hash)&&this.regex.values.test(location.hash)},parse:function(){var b=this,d={};if(b.exists())if(b.enabled){d.id=b.tmpl.id;var e=location.hash.match(b.regex.values);a.each(e,function(e,f){var g=f.split(b.opt.pair);2===g.length&&(d[g[0]]=-1===g[1].indexOf(b.opt.array)?decodeURIComponent(g[1].replace(/\+/g,"%20")):a.map(g[1].split(b.opt.array),function(a){return decodeURIComponent(a.replace(/\+/g,"%20"))}),c.string(d[g[0]])&&!isNaN(d[g[0]])&&(d[g[0]]=parseInt(d[g[0]])))})}else b.apiEnabled?history.replaceState(null,"",location.pathname+location.search):location.hash="#";return d},hashify:function(b){var d=this;if(c.hash(b)){var e=[];return a.each(b,function(b,f){c.empty(f)||"id"===b||(f=c.array(f)?a.map(f,function(a){return encodeURIComponent(a)}).join(d.opt.array):encodeURIComponent(f),e.push(b+d.opt.pair+f))}),e.length>0&&e.unshift("#"+d.tmpl.id),e.join(d.opt.values)}return""},replace:function(a){var b=this;if(b.enabled&&b.apiEnabled){a.id=b.tmpl.id;var d=b.hashify(a),e=c.empty(d);history.replaceState(e?null:a,"",e?location.pathname+location.search:d)}},push:function(a){var b=this;if(b.enabled&&b.apiEnabled){a.id=b.tmpl.id;var d=b.hashify(a),e=c.empty(d);history.pushState(e?null:a,"",e?location.pathname+location.search:d)}},update:function(a,b){var c=this;c.enabled&&c.apiEnabled&&(b=c.isPushOrReplace(b)?b:c.pushOrReplace,c[b](a))},clear:function(){this.exists()&&this.replace({})},initial:function(){var a=this,b=a.tmpl,d={};return b.filter&&!c.empty(b.filter.current)&&(d.f=b.filter.current),b.pages&&b.pages.current>1&&(d.p=b.pages.current),d},get:function(a){var d=this,e=d.tmpl,f={};return a instanceof b.Item&&(f.i=a.id),e.filter&&!c.empty(e.filter.current)&&(f.f=e.filter.current),e.pages&&e.pages.isValid(e.pages.current)&&(f.p=e.pages.current),f},set:function(a){var b=this,d=b.tmpl;if(c.hash(a)){d.items.reset();var e=d.items.get(a.i);if(d.filter){d.filter.rebuild();var f=c.empty(a.f)?[]:a.f;d.filter.set(f,!1)}if(d.pages){d.pages.rebuild();var g=d.pages.number(a.p);e&&!d.pages.contains(g,e)&&(g=d.pages.find(e),g=0!==g?g:1),d.pages.set(g,!c.empty(a),!1,!0),e&&d.pages.contains(g,e)&&e.scrollTo()}else d.items.detach(d.items.all()),d.items.create(d.items.available(),!0),e&&e.scrollTo();c.empty(a.i)||(a.i=null,b.replace(a))}}}),b.template.configure("core",{state:{enabled:!1,pushOrReplace:"replace",values:"/",pair:":",array:"+"}}),b.components.register("state",b.State)
|
10 |
+
}(FooGallery.$,FooGallery,FooGallery.utils.is,FooGallery.utils.str),function(a,b,c,d,e,f){b.Item=b.Component.extend({construct:function(a,b){var c=this;c._super(a),c.cls=a.cls.item,c.il8n=a.il8n.item,c.sel=a.sel.item,c.opt=f.extend({},a.opt.item,b),c.isAttached=!1,c.isCreated=!1,c.isDestroyed=!1,c.isLoading=!1,c.isLoaded=!1,c.isError=!1,c.isParsed=!1,c.$el=null,c.$inner=null,c.$anchor=null,c.$image=null,c.$caption=null,c.type=c.opt.type,c.id=c.opt.id,c.href=c.opt.href,c.src=c.opt.src,c.srcset=c.opt.srcset,c.width=c.opt.width,c.height=c.opt.height,c.title=c.opt.title,c.alt=c.opt.alt,c.caption=d.empty(c.opt.caption)?c.title:c.opt.caption,c.description=d.empty(c.opt.description)?c.alt:c.opt.description,c.attr=c.opt.attr,c.tags=c.opt.tags,c.maxWidth=c.opt.maxWidth,c.maxCaptionLength=c.opt.maxCaptionLength,c.maxDescriptionLength=c.opt.maxDescriptionLength,c.showCaptionTitle=c.opt.showCaptionTitle,c.showCaptionDescription=c.opt.showCaptionDescription,c._thumbUrl=null,c._placeholder=null,c._load=null,c._undo={classes:"",style:"",loader:!1,placeholder:!1}},destroy:function(){var a=this;return a.tmpl.raise("destroy-item",[a]).isDefaultPrevented()||(a.isDestroyed=a.doDestroyItem()),a.isDestroyed&&(a.tmpl.raise("destroyed-item",[a]),a._super()),a.isDestroyed},doDestroyItem:function(){var a=this;return a.isParsed?(a.append(),d.empty(a._undo.classes)?a.$el.removeAttr("class"):a.$el.attr("class",a._undo.classes),d.empty(a._undo.style)?a.$el.removeAttr("style"):a.$el.attr("style",a._undo.style),a._undo.loader&&a.$el.find(a.sel.loader).remove(),a._undo.placeholder&&a.$image.prop("src")==a._placeholder&&a.$image.removeAttr("src")):a.isCreated&&(a.detach(),a.$el.remove()),!0},parse:function(b){var c=this,d=a(b);return!c.tmpl.raise("parse-item",[c,d]).isDefaultPrevented()&&(c.isCreated=d.is(c.sel.elem))&&(c.isParsed=c.doParseItem(d),c.fix()),c.isParsed&&c.tmpl.raise("parsed-item",[c]),c.isParsed},doParseItem:function(c){var e=this,f=e.tmpl.opt,g=e.cls,h=e.sel;return e._undo.classes=c.attr("class")||"",e._undo.style=c.attr("style")||"",e.$el=c.data(b.dataItem,e),e.$inner=e.$el.find(h.inner),e.$anchor=e.$el.find(h.anchor).on("click.foogallery",{self:e},e.onAnchorClick),e.$image=e.$anchor.find(h.image),e.$caption=e.$el.find(h.caption.elem).on("click.foogallery",{self:e},e.onCaptionClick),e.isAttached=e.$el.parent().length>0,e.isLoading=e.$el.is(h.loading),e.isLoaded=e.$el.is(h.loaded),e.isError=e.$el.is(h.error),e.id=e.$anchor.data("id")||e.id,e.tags=e.$anchor.data("tags")||e.tags,e.href=e.$anchor.attr("href")||e.href,e.src=e.$image.attr(f.src)||e.src,e.srcset=e.$image.attr(f.srcset)||e.srcset,e.width=parseInt(e.$image.attr("width"))||e.width,e.height=parseInt(e.$image.attr("height"))||e.height,e.title=e.$image.attr("title")||e.title,e.alt=e.$image.attr("alt")||e.alt,e.caption=e.$anchor.data("title")||e.$anchor.data("captionTitle")||e.caption||e.title,e.description=e.$anchor.data("description")||e.$anchor.data("captionDesc")||e.description||e.alt,d.empty(e.caption)&&(e.caption=a.trim(e.$caption.find(h.caption.title).html())),d.empty(e.description)&&(e.description=a.trim(e.$caption.find(h.caption.description).html())),d.number(e.maxCaptionLength)&&e.maxCaptionLength>0&&!d.empty(e.caption)&&d.string(e.caption)&&e.caption.length>e.maxCaptionLength&&e.$caption.find(h.caption.title).html(e.caption.substr(0,e.maxCaptionLength)+"…"),d.number(e.maxDescriptionLength)&&e.maxDescriptionLength>0&&!d.empty(e.description)&&d.string(e.description)&&e.description.length>e.maxDescriptionLength&&e.$caption.find(h.caption.description).html(e.description.substr(0,e.maxDescriptionLength)+"…"),0===e.$el.find(h.loader).length&&(e.$el.append(a("<div/>",{class:g.loader})),e._undo.loader=!0),d.empty(e.$image.prop("src"))&&(e._placeholder=e.tmpl.items.placeholder(e.width,e.height),e.$image.prop("src",e._placeholder),e._undo.placeholder=!0),!e.isCreated||!e.isAttached||e.isLoading||e.isLoaded||e.isError||e.$el.addClass(g.idle),!0},create:function(){var a=this;if(!a.isCreated&&d.string(a.href)&&d.string(a.src)&&d.number(a.width)&&d.number(a.height)){a.tmpl.raise("create-item",[a]).isDefaultPrevented()||(a.isCreated=a.doCreateItem()),a.isCreated&&a.tmpl.raise("created-item",[a])}return a.isCreated},doCreateItem:function(){var c=this,e=c.tmpl.opt,f=c.cls,g=c.attr;g.elem.class=f.elem+" "+f.idle,g.inner.class=f.inner,g.anchor.class=f.anchor,g.anchor.href=c.href,g.anchor["data-id"]=c.id,g.anchor["data-title"]=c.caption,g.anchor["data-description"]=c.description,d.empty(c.tags)||(g.anchor["data-tags"]=JSON.stringify(c.tags)),g.image.class=f.image,g.image.src=c.tmpl.items.placeholder(c.width,c.height),g.image[e.src]=c.src,g.image[e.srcset]=c.srcset,g.image.width=c.width,g.image.height=c.height,g.image.title=c.title,g.image.alt=c.alt,c.$el=a("<div/>").attr(g.elem).data(b.dataItem,c),c.$inner=a("<figure/>").attr(g.inner).appendTo(c.$el),c.$anchor=a("<a/>").attr(g.anchor).appendTo(c.$inner).on("click.foogallery",{self:c},c.onAnchorClick),c.$image=a("<img/>").attr(g.image).appendTo(c.$anchor),f=c.cls.caption,g=c.attr.caption,g.elem.class=f.elem,c.$caption=a("<figcaption/>").attr(g.elem).on("click.foogallery",{self:c},c.onCaptionClick),g.inner.class=f.inner;var h=a("<div/>").attr(g.inner).appendTo(c.$caption),i=c.showCaptionTitle&&!d.empty(c.caption),j=c.showCaptionDescription&&!d.empty(c.description);if(i||j){if(g.title.class=f.title,g.description.class=f.description,i){var k;k=d.number(c.maxCaptionLength)&&c.maxCaptionLength>0&&d.string(c.caption)&&c.caption.length>c.maxCaptionLength?a("<div/>").attr(g.title).html(c.caption.substr(0,c.maxCaptionLength)+"…"):a("<div/>").attr(g.title).html(c.caption),h.append(k)}if(j){var l;l=d.number(c.maxDescriptionLength)&&c.maxDescriptionLength>0&&d.string(c.description)&&c.description.length>c.maxDescriptionLength?a("<div/>").attr(g.description).html(c.description.substr(0,c.maxDescriptionLength)+"…"):a("<div/>").attr(g.description).html(c.description),h.append(l)}}return c.$caption.appendTo(c.$inner),0===c.$el.find(c.sel.loader).length&&c.$el.append(a("<div/>",{class:c.cls.loader})),!0},append:function(){var a=this;if(a.isCreated&&!a.isAttached){a.tmpl.raise("append-item",[a]).isDefaultPrevented()||(a.tmpl.$el.append(a.$el),a.fix(),a.isAttached=!0),a.isAttached&&a.tmpl.raise("appended-item",[a])}return a.isAttached},detach:function(){var a=this;if(a.isCreated&&a.isAttached){a.tmpl.raise("detach-item",[a]).isDefaultPrevented()||(a.$el.detach(),a.unfix(),a.isAttached=!1),a.isAttached||a.tmpl.raise("detached-item",[a])}return!a.isAttached},load:function(){var b=this;if(d.promise(b._load))return b._load;if(!b.isCreated||!b.isAttached)return e.rejectWith("not created or attached");if(b.tmpl.raise("load-item",[b]).isDefaultPrevented())return e.rejectWith("default prevented");var c=b.cls,f=b.$image.get(0),g=f.src;return b.isLoading=!0,b.$el.removeClass(c.idle).removeClass(c.loaded).removeClass(c.error).addClass(c.loading),b.isParsed&&f.src!=b._placeholder&&f.complete?(b.isLoading=!1,b.isLoaded=!0,b.$el.removeClass(c.loading).addClass(c.loaded),b.unfix(),b.tmpl.raise("loaded-item",[b]),b._load=e.resolveWith(b)):b._load=a.Deferred(function(a){f.onload=function(){f.onload=f.onerror=null,b.isLoading=!1,b.isLoaded=!0,b.$el.removeClass(c.loading).addClass(c.loaded),b.unfix(),b.tmpl.raise("loaded-item",[b]),a.resolve(b)},f.onerror=function(){f.onload=f.onerror=null,b.isLoading=!1,b.isError=!0,b.$el.removeClass(c.loading).addClass(c.error),d.string(g)&&b.$image.prop("src",g),b.tmpl.raise("error-item",[b]),a.reject(b)},setTimeout(function(){f.src=b.getThumbUrl()})}).promise()},fix:function(){var a=this;if(!a.tmpl.raise("fix-item",[a]).isDefaultPrevented()&&a.isCreated&&!a.isLoading&&!a.isLoaded&&!a.isError){var b=a.width,c=a.height;if(!isNaN(b)&&!isNaN(c)){var e=d.fn(a.maxWidth)?a.maxWidth(a):a.$image.width();e<=0&&(e=b);var f=e/b,g=c*f;a.$image.css({width:e,height:g})}}return a},unfix:function(){var a=this;return!a.tmpl.raise("unfix-item",[a]).isDefaultPrevented()&&a.isCreated&&a.$image.css({width:"",height:""}),a},getThumbUrl:function(a){a=!!d.boolean(a)&&a;var c=this;return!a&&d.string(c._thumbUrl)?c._thumbUrl:c._thumbUrl=b.parseSrc(c.src,c.width,c.height,c.srcset,c.$anchor.innerWidth(),c.$anchor.innerHeight())},scrollTo:function(a){var b=this;if(b.isAttached){var d=b.bounds(),e=c.getViewportBounds();switch(a){case"top":d.left+=d.width/2-e.width/2,d.top-=e.height/5;break;default:d.left+=d.width/2-e.width/2,d.top+=d.height/2-e.height/2}window.scrollTo(d.left,d.top)}return b},bounds:function(){return this.isAttached?c.getElementBounds(this.$el):null},intersects:function(a){return!!this.isAttached&&this.bounds().intersects(a)},onAnchorClick:function(a){var b=a.data.self,c=b.tmpl.state.get(b);b.tmpl.state.update(c)},onCaptionClick:function(a){var b=a.data.self;b.$anchor.length>0&&b.$anchor.get(0).click()}}),b.template.configure("core",{item:{type:"item",id:"",href:"",src:"",srcset:"",width:0,height:0,title:"",alt:"",caption:"",description:"",tags:[],maxWidth:null,maxCaptionLength:0,maxDescriptionLength:0,showCaptionTitle:!0,showCaptionDescription:!0,attr:{elem:{},inner:{},anchor:{},image:{},caption:{elem:{},inner:{},title:{},description:{}}}}},{item:{elem:"fg-item",inner:"fg-item-inner",anchor:"fg-thumb",image:"fg-image",loader:"fg-loader",idle:"fg-idle",loading:"fg-loading",loaded:"fg-loaded",error:"fg-error",caption:{elem:"fg-caption",inner:"fg-caption-inner",title:"fg-caption-title",description:"fg-caption-desc"}}},{item:{}}),b.components.register("item",b.Item)}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.fn,FooGallery.utils.obj),function(a,b,c,d,e,f){b.Items=b.Component.extend({construct:function(a){var b=this;b._super(a),b.idMap={},b._fetched=null,b._arr=[],b._available=[],b._canvas=document.createElement("canvas");var d=b.tmpl.cls.item.caption;b.tmpl.sel.item.caption.all=c.selectify([d.elem,d.inner,d.title,d.description])},destroy:function(){var b=this,c=b.all(),d=[];c.length>0&&(b.tmpl.raise("destroy-items",[c]),d=a.map(c,function(a){return a.destroy()?a:null}),d.length>0&&b.tmpl.raise("destroyed-items",[d])),b.idMap={},b._canvas=b._fetched=null,b._arr=[],b._available=[],b._super()},fetch:function(b){var c=this;if(!b&&d.promise(c._fetched))return c._fetched;var e=c.tmpl,f=e.sel,g=e.opt.items,h=a.Deferred(),i=c.make(e.$el.find(f.item.elem));return d.empty(g)?(i.push.apply(i,c.make(window[e.id+"-items"])),h.resolve(i)):d.array(g)?(i.push.apply(i,c.make(g)),h.resolve(i)):d.string(g)?a.get(g).then(function(a){i.push.apply(i,c.make(a)),h.resolve(i)},function(a,b,c){console.log("FooGallery: GET items error.",g,a,b,c),h.resolve(i)}):h.resolve(i),h.then(function(a){c.setAll(a)}),c._fetched=h.promise()},all:function(){return this._arr.slice()},count:function(a){return a?this.all().length:this.available().length},available:function(){return this._available.slice()},get:function(a){return!d.empty(a)&&this.idMap[a]?this.idMap[a]:null},setAll:function(a){this._arr=d.array(a)?a:[],this.idMap=this.createIdMap(a),this._available=this.all()},setAvailable:function(a){this._available=d.array(a)?a:[]},reset:function(){this.setAvailable(this.all())},placeholder:function(a,c){return this._canvas&&this._canvas.toDataURL&&d.number(a)&&d.number(c)?(this._canvas.width=a,this._canvas.height=c,this._canvas.toDataURL()):b.emptyImage},loadable:function(b){var e,f=this,g=f.tmpl.opt;return g.lazy&&(e=c.getViewportBounds(g.viewport)),d.array(b)?a.map(b,function(a){return a.isCreated&&a.isAttached&&!a.isLoading&&!a.isLoaded&&!a.isError&&(!g.lazy||g.lazy&&a.intersects(e))?a:null}):[]},creatable:function(c){return d.array(c)?a.map(c,function(a){return a instanceof b.Item&&!a.isCreated?a:null}):[]},appendable:function(c){return d.array(c)?a.map(c,function(a){return a instanceof b.Item&&a.isCreated&&!a.isAttached?a:null}):[]},detachable:function(c){return d.array(c)?a.map(c,function(a){return a instanceof b.Item&&a.isCreated&&a.isAttached?a:null}):[]},jquerify:function(b){return a(a.map(b,function(a){return a.$el.get()}))},make:function(c){var e=this,g=[];if(d.jq(c)||d.array(c)){var h=[],i=a.makeArray(c);if(0===i.length)return g;e.tmpl.raise("make-items",[i]).isDefaultPrevented()||(g=a.map(i,function(a){var c=e.type(a),g=f.extend(d.hash(a)?a:{},{type:c}),i=b.components.make(c,e.tmpl,g);return d.element(a)?i.parse(a)?(h.push(i),i):null:i})),g.length>0&&e.tmpl.raise("made-items",[g]),h.length>0&&e.tmpl.raise("parsed-items",[h])}return g},type:function(c){var e;if(d.hash(c))e=c.type;else if(d.element(c)){var f=a(c),g=this.tmpl.sel.item;e=f.find(g.anchor).data("type")}return d.string(e)&&b.components.contains(e)?e:"item"},create:function(b,c){var e=this,f=[],g=e.creatable(b);if(g.length>0){e.tmpl.raise("create-items",[g]).isDefaultPrevented()||(f=a.map(g,function(a){return a.create()?a:null})),f.length>0&&e.tmpl.raise("created-items",[f])}return d.boolean(c)&&c?e.append(b):f},append:function(b){var c=this,d=[],e=c.appendable(b);if(e.length>0){c.tmpl.raise("append-items",[e]).isDefaultPrevented()||(d=a.map(e,function(a){return a.append()?a:null})),d.length>0&&c.tmpl.raise("appended-items",[d])}return d},detach:function(b){var c=this,d=[],e=c.detachable(b);if(e.length>0){c.tmpl.raise("detach-items",[e]).isDefaultPrevented()||(d=a.map(e,function(a){return a.detach()?a:null})),d.length>0&&c.tmpl.raise("detached-items",[d])}return d},load:function(b){var c=this;if(b=c.loadable(b),b.length>0){if(!c.tmpl.raise("load-items",[b]).isDefaultPrevented()){var d=a.map(b,function(a){return a.load()});return e.when(d).done(function(a){c.tmpl.raise("loaded-items",[a])})}}return e.resolveWith([])},createIdMap:function(b){var c={};return a.each(b,function(a,b){d.empty(b.id)&&(b.id=""+(a+1)),c[b.id]=b}),c}}),b.components.register("items",b.Items)}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is,FooGallery.utils.fn,FooGallery.utils.obj),function(a,b,c,d){b.Paging=b.Component.extend({construct:function(a){var b=this;b._super(a),b.opt=b.tmpl.opt.paging,b.cls=b.tmpl.cls.paging,b.il8n=b.tmpl.il8n.paging,b.sel=b.tmpl.sel.paging,b.pushOrReplace=b.opt.pushOrReplace,b.type=b.opt.type,b.theme=b.opt.theme,b.size=b.opt.size,b.position=b.opt.position,b.scrollToTop=b.opt.scrollToTop,b.current=0,b.total=0,b.ctrls=[],b._arr=[]},destroy:function(){var b=this;b._arr.splice(0,b._arr.length),a.each(b.ctrls.splice(0,b.ctrls.length),function(a,b){b.destroy()}),b._super()},build:function(){var a=this,c=a.tmpl.items.available();a.total=a.size>0&&c.length>0?Math.ceil(c.length/a.size):1;for(var d=0;d<a.total;d++)a._arr.push(c.splice(0,a.size));if(a.total>1&&b.paging.hasCtrl(a.type)){var e,f,g=a.position;"both"!==g&&"top"!==g||(e=b.paging.makeCtrl(a.type,a.tmpl,a,"top"),e.create()&&(e.append(),a.ctrls.push(e))),"both"!==g&&"bottom"!==g||(f=b.paging.makeCtrl(a.type,a.tmpl,a,"bottom"),f.create()&&(f.append(),a.ctrls.push(f)))}},rebuild:function(){var b=this;b.current=0,b.total=0,b._arr.splice(0,b._arr.length),a.each(b.ctrls.splice(0,b.ctrls.length),function(a,b){b.destroy()}),b.build()},all:function(){return this._arr.slice()},available:function(){return this.get(this.current)},controls:function(b){var c=this;c.isValid(b)&&a.each(c.ctrls,function(a,c){c.update(b)})},isValid:function(a){return d.number(a)&&a>0&&a<=this.total},number:function(a){return this.isValid(a)?a:0===this.current?1:this.current},create:function(a,b){var c=this;a=c.number(a);var d=a-1;c.tmpl.items.detach(c.tmpl.items.all()),c.tmpl.items.create(c._arr[d],!0),c.current=a},get:function(a){var b=this;return b.isValid(a)?(a=b.number(a),b._arr[a-1]):[]},set:function(a,b,c,e){var f=this;if(f.isValid(a)){var g,h=f.number(a);if(h!==f.current){var i=f.current,j=function(){if(c=!d.boolean(c)||c,e=!!d.boolean(e)&&e,c&&1===f.current&&!f.tmpl.state.exists()&&(g=f.tmpl.state.get(),f.tmpl.state.update(g,f.pushOrReplace)),f.controls(a),f.create(h,e),c&&(g=f.tmpl.state.get(),f.tmpl.state.update(g,f.pushOrReplace)),f.scrollToTop&&d.boolean(b)&&b){var j=f.get(f.current);j.length>0&&j[0].scrollTo("top")}f.tmpl.raise("after-page-change",[f.current,i,e])};return!f.tmpl.raise("before-page-change",[f.current,h,j,e]).isDefaultPrevented()&&(j(),!0)}}return!1},find:function(b){for(var c=this,d=0,e=c._arr.length;d<e;d++)if(-1!==a.inArray(b,c._arr[d]))return d+1;return 0},contains:function(b,c){var d=this.get(b);return-1!==a.inArray(c,d)},first:function(){this.goto(1)},last:function(){this.goto(this._arr.length)},prev:function(){this.goto(this.current-1)},next:function(){this.goto(this.current+1)},goto:function(a){var b=this;b.set(a,!0)&&b.tmpl.loadAvailable()}}),b.PagingControl=b.Component.extend({construct:function(a,b,c){var d=this;d._super(a),d.pages=b,d.position=c,d.$container=null},create:function(){var b=this;return b.$container=a("<nav/>",{class:b.pages.cls.container}).addClass(b.pages.theme),!0},destroy:function(){var a=this;a.$container.remove(),a.$container=null},append:function(){var a=this;"top"===a.position?a.$container.insertBefore(a.tmpl.$el):a.$container.insertAfter(a.tmpl.$el)},update:function(a){}}),b.paging.register("default",b.Paging,null,{type:"none",theme:"fg-light",size:30,pushOrReplace:"push",position:"none",scrollToTop:!0},{container:"fg-paging-container"},null,-100)}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is),function(a,b,c,d){b.Dots=b.Paging.extend({}),b.DotsControl=b.PagingControl.extend({construct:function(b,c,d){this._super(b,c,d),this.$container=a(),this.$list=a(),this.$items=a()},create:function(){for(var b,c=this,d=c.pages.cls,e=c.pages.il8n,f=[],g=a("<ul/>",{class:d.list}),h=0,i=c.pages.total;h<i;h++)f.push(b=c.createItem(h+1,e.page)),g.append(b);return c.$list=g,c.$container=a("<nav/>",{class:d.container}).addClass(c.pages.theme).append(g),c.$items=a(a.map(f,function(a){return a.get()})),!0},append:function(){var a=this;"top"===a.position?a.$container.insertBefore(a.tmpl.$el):a.$container.insertAfter(a.tmpl.$el)},destroy:function(){var b=this,c=b.pages.sel;b.$list.find(c.link).off("click.foogallery",b.onLinkClick),b.$container.remove(),b.$container=a(),b.$list=a(),b.$items=a()},update:function(a){this.setSelected(a-1)},setSelected:function(b){var c=this,e=c.pages.cls,f=c.pages.il8n,g=c.pages.sel;c.$items.filter(g.selected).removeClass(e.selected).each(function(b,c){var e=a(c),f=e.data("label"),h=e.find(g.reader);d.string(f)&&0!==h.length&&h.html(f)}),c.$items.eq(b).addClass(e.selected).each(function(b,c){var e=a(c),h=e.find(g.reader),i=h.html();d.string(i)&&0!==h.length&&(e.data("label",i),h.html(f.current))})},createItem:function(b,c,e,f,g){e=d.string(e)?e:b,c=d.string(c)?c:"";var h=this,i=h.pages.opt,j=h.pages.cls,k=a("<a/>",{class:j.link,href:"#page-"+b}).html(e).on("click.foogallery",{self:h,page:b},h.onLinkClick);d.empty(c)||k.attr("title",c.replace(/\{PAGE}/g,b).replace(/\{LIMIT}/g,i.limit+"")),g=d.string(g)?g:c,d.empty(g)||k.prepend(a("<span/>",{class:j.reader,text:g.replace(/\{PAGE}/g,"").replace(/\{LIMIT}/g,i.limit+"")}));var l=a("<li/>",{class:j.item}).append(k);return f=d.string(f)?f:"",d.empty(f)||l.addClass(f),l},onLinkClick:function(b){b.preventDefault();var c=b.data.self,d=b.data.page,e=c.pages.sel;a(this).closest(e.item).is(e.disabled)||(c.pages.set(d,!0),c.tmpl.loadAvailable())}}),b.paging.register("dots",b.Dots,b.DotsControl,{type:"dots",position:"both",pushOrReplace:"push"},{list:"fg-dots",item:"fg-dot-item",link:"fg-dot-link",disabled:"fg-disabled",selected:"fg-selected",visible:"fg-visible",reader:"fg-sr-only"},{current:"Current page",page:"Page {PAGE}"})}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is),function(a,b,c){b.DefaultTemplate=b.Template.extend({}),b.template.register("default",b.DefaultTemplate,null,{container:"foogallery fg-default"})}(FooGallery.$,FooGallery,FooGallery.utils),function(a,b,c,d){b.MasonryTemplate=b.Template.extend({construct:function(a,b){this._super(a,b),this.masonry=null,this.style=null,this.$columnWidth=null},getStylesheet:function(){var a=this;return null===a.style&&(a.style=document.createElement("style"),a.style.appendChild(document.createTextNode("")),document.head.appendChild(a.style)),a.style.sheet},onPreInit:function(b,c){var e=c.sel,f=c.cls;f.layouts=a.map(f.layout,function(a){return a}).join(" ");for(var g=a.map(f.layout,function(a,b){return{key:b,value:a}}),h=0,i=g.length;h<i;h++)if(c.$el.hasClass(g[h].value)){c.template.layout=g[h].key;break}d.string(f.layout[c.template.layout])||(c.template.layout="col4");var j,k,l="fixed"===c.template.layout;if(c.template.isFitWidth=l,c.template.percentPosition=!l,c.template.transitionDuration=0,c.template.itemSelector=e.item.elem,c.$el.removeClass(f.layouts).addClass(f.layout[c.template.layout]),l||(0===c.$el.find(e.gutterWidth).length&&c.$el.prepend(a("<div/>").addClass(f.gutterWidth)),c.template.gutter=e.gutterWidth),0===c.$el.find(e.columnWidth).length&&c.$el.prepend(a("<div/>").addClass(f.columnWidth)),l&&d.number(c.template.columnWidth)){var m=c.$el.find(e.columnWidth).width(c.template.columnWidth);j=c.getStylesheet(),k="#"+c.id+e.container+" "+e.item.elem+" { width: "+m.outerWidth()+"px; }",j.insertRule(k,0)}c.template.columnWidth=e.columnWidth,l&&d.number(c.template.gutter)&&(j=c.getStylesheet(),k="#"+c.id+e.container+" "+e.item.elem+" { margin-bottom: "+c.template.gutter+"px; }",j.insertRule(k,0)),c.masonry=new Masonry(c.$el.get(0),c.template)},onPostInit:function(a,b){b.masonry.layout()},onFirstLoad:function(a,b){b.masonry.layout()},onReady:function(a,b){b.masonry.layout()},onDestroy:function(a,b){b.$el.find(b.sel.columnWidth).remove(),b.$el.find(b.sel.gutterWidth).remove(),b.style&&b.style.parentNode&&b.style.parentNode.removeChild(b.style)},onDestroyed:function(a,b){b.masonry instanceof Masonry&&b.masonry.destroy()},onLayout:function(a,b){b.masonry.layout()},onParsedItems:function(a,b,c){b.masonry.layout()},onAppendedItems:function(a,b,c){c=b.items.jquerify(c),c=b.masonry.addItems(c),b.masonry.layoutItems(c,!0)},onDetachItem:function(a,b,c){a.isDefaultPrevented()||(a.preventDefault(),b.masonry.remove(c.$el),c.isAttached=!1,c.unfix())},onDetachedItems:function(a,b,c){b.masonry.layout()},onLoadedItems:function(a,b,c){b.masonry.layout()}}),b.template.register("masonry",b.MasonryTemplate,{template:{initLayout:!1,isInitLayout:!1,layout:"col4"}},{container:"foogallery fg-masonry",columnWidth:"fg-column-width",gutterWidth:"fg-gutter-width",layout:{fixed:"fg-masonry-fixed",col2:"fg-masonry-2col",col3:"fg-masonry-3col",col4:"fg-masonry-4col",col5:"fg-masonry-5col"}})}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is),function(a,b,c,d){b.Justified=c.Class.extend({construct:function(c,d){this.$el=a(c),this.options=a.extend(!0,{},b.Justified.defaults,d),this._items=[],this._lastRefresh=0,this._refresh=null},init:function(){var b=this;d.string(b.options.maxRowHeight)&&(b.options.maxRowHeight.indexOf("%")?b.options.maxRowHeight=b.options.rowHeight*(parseInt(b.options.maxRowHeight)/100):b.options.maxRowHeight=parseInt(b.options.maxRowHeight)),a(window).on("resize.justified",{self:b},b.onWindowResize),this._refresh=setInterval(function(){b.refresh()},b.options.refreshInterval)},destroy:function(){this._refresh&&clearInterval(this._refresh),a(window).off("resize.justified"),this.$el.removeAttr("style")},refresh:function(){var a=this.getContainerWidth();a!=this._lastRefresh&&(this.layout(),this._lastRefresh=a)},parse:function(){var b=this,c=b.$el.is(":visible"),d=a("<div/>",{class:b.$el.attr("class")}).css({position:"absolute",top:0,left:-9999,visibility:"hidden",maxWidth:b.getContainerWidth()}).appendTo("body");return b._items=b.$el.find(b.options.itemSelector).removeAttr("style").removeClass("fg-positioned").map(function(b,e){var f=a(e),g=0,h=0;if(c)g=f.outerWidth(),h=f.outerHeight();else{var i=f.clone();i.appendTo(d),g=i.outerWidth(),h=i.outerHeight()}return{index:b,width:g,height:h,top:0,left:0,$item:f}}).get(),d.remove(),b._items},getMaxRowHeight:function(){var a=this;return d.string(a.options.maxRowHeight)&&(a.options.maxRowHeight.indexOf("%")?a.options.maxRowHeight=a.options.rowHeight*(parseInt(a.options.maxRowHeight)/100):a.options.maxRowHeight=parseInt(a.options.maxRowHeight)),d.number(a.options.maxRowHeight)?a.options.maxRowHeight:a.options.rowHeight},getContainerWidth:function(){var a=this;return a.$el.is(":visible")?a.$el.width():a.$el.parents(":visible:first").innerWidth()},layout:function(b,c){b=!!d.boolean(b)&&b,c=!d.boolean(c)||c,(b||0===this._items.length)&&this.parse();var e=this,f=0,g=e.getContainerWidth(),h=e.getMaxRowHeight(),i=e.rows(g,h);a.each(i,function(a,b){b.visible&&(a>0&&(f+=e.options.margins),f+=b.height,e.render(b))}),e.$el.height(f),c&&e.getContainerWidth()<g&&e.layout(!1,!1)},render:function(a){for(var b,c=0,d=a.items.length;c<d;c++)b=a.items[c],a.visible?b.$item.css({width:b.width,height:b.height,top:b.top,left:b.left,display:"",maxHeight:this.options.maxRowHeight>0?this.options.maxRowHeight:""}).addClass("fg-positioned"):b.$item.css("display","none")},justify:function(a,b,c,d){var e=this,f=e.options.margins*(a.items.length-1),g=c-f,h=g/a.width;a.width=a.width*h,a.height=a.height*h,a.top=b,a.height>d&&(a.height=d),a.left=0,a.width<g&&(a.left=(g-a.width)/2),a.width+=f;for(var i,j=a.left,k=0,l=a.items.length;k<l;k++)k>0&&(j+=e.options.margins),i=a.items[k],i.left=j,i.top=b,i.width=i.width*h,i.height=i.height*h,i.height>d&&(i.height=d),j+=i.width;return a.height},position:function(a,b,c,d){var e=this,f=e.options.margins*(a.items.length-1),g=c-f;if(a.top=b,a.left=0,a.width<g)switch(d){case"center":a.left=(g-a.width)/2;break;case"right":a.left=g-a.width}a.width+=f;for(var h,i=a.left,j=0,k=a.items.length;j<k;j++)j>0&&(i+=e.options.margins),h=a.items[j],h.left=i,h.top=b,i+=h.width;return a.height},lastRow:function(a,b,c,d){var e=this,f=e.options.margins*(a.items.length-1),g=c-f,h=a.width/g>e.options.justifyThreshold;switch(e.options.lastRow){case"hide":h?e.justify(a,b,c,d):a.visible=!1;break;case"justify":e.justify(a,b,c,d);break;case"nojustify":h?e.justify(a,b,c,d):e.position(a,b,c,"left");break;case"left":case"center":case"right":h?e.justify(a,b,c,d):e.position(a,b,c,e.options.lastRow)}},items:function(){return a.map(this._items,function(a){return{index:a.index,width:a.width,height:a.height,$item:a.$item,top:a.top,left:a.left}})},rows:function(a,b){function c(){var a={index:++h,visible:!0,width:0,height:e.options.rowHeight,top:0,left:0,items:[]};return g.push(a),a}for(var d,e=this,f=e.items(),g=[],h=-1,i=c(),j=0,k=0,l=0,m=f.length;l<m;l++){if(d=f[l],d.height!=e.options.rowHeight){var n=e.options.rowHeight/d.height;d.height=d.height*n,d.width=d.width*n}k+d.width>a&&l>0&&(g.length>1&&(j+=e.options.margins),j+=e.justify(i,j,a,b),i=c(),k=0),i.items.length>0&&(k+=e.options.margins),k+=d.width,i.width+=d.width,i.items.push(d)}return g.length>1&&(j+=e.options.margins),e.lastRow(i,j,a,b),g},onWindowResize:function(a){a.data.self.layout()}}),b.Justified.defaults={itemSelector:".fg-item",rowHeight:150,maxRowHeight:"200%",margins:0,lastRow:"center",justifyThreshold:.5,refreshInterval:250}}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is),function(a,b,c){b.JustifiedTemplate=b.Template.extend({onPreInit:function(a,c){c.justified=new b.Justified(c.$el.get(0),c.template)},onInit:function(a,b){b.justified.init()},onFirstLoad:function(a,b){b.justified.layout(!0)},onReady:function(a,b){b.justified.layout(!0)},onDestroy:function(a,b){b.justified.destroy()},onLayout:function(a,b){b.justified.layout(!0)},onParsedItems:function(a,b,c){(b.initialized||b.initializing)&&b.justified.layout(!0)},onAppendedItems:function(a,b,c){(b.initialized||b.initializing)&&b.justified.layout(!0)},onDetachedItems:function(a,b,c){b.initialized&&b.justified.layout(!0)}}),b.template.register("justified",b.JustifiedTemplate,null,{container:"foogallery fg-justified"})}(FooGallery.$,FooGallery,FooGallery.utils),function(a,b,c,d){b.Portfolio=c.Class.extend({construct:function(c,d){this.$el=a(c),this.options=a.extend(!0,{},b.Portfolio.defaults,d),this._items=[],this._lastWidth=0},init:function(){var b=this;a(window).on("resize.portfolio",{self:b},b.onWindowResize)},destroy:function(){a(window).off("resize.portfolio"),this.$el.removeAttr("style")},parse:function(){var b=this,c=b.$el.is(":visible"),d=b.getContainerWidth(),e=a("<div/>",{class:b.$el.attr("class")}).css({position:"absolute",top:0,left:-9999,visibility:"hidden",maxWidth:d}).appendTo("body");return b._items=b.$el.find(".fg-item").removeAttr("style").removeClass("fg-positioned").map(function(b,f){var g=a(f),h=g.find(".fg-thumb"),i=g.find(".fg-image"),j=parseFloat(i.attr("width")),k=parseFloat(i.attr("height")),l=d<j?d:j,m=d<j?"auto":k;if(g.find(".fg-caption").css("max-width",l),i.css({width:l,height:m}),c)j=g.outerWidth(),k=g.outerHeight();else{var n=g.clone();n.appendTo(e),j=n.outerWidth(),k=n.outerHeight()}return i.css({width:"",height:""}),{index:b,width:j,height:k,top:0,left:0,$item:g,$thumb:h}}).get(),e.remove(),b._items},round:function(a){return Math.round(2*a)/2},getContainerWidth:function(){var a=this;return a.$el.is(":visible")?a.$el.width():a.$el.parents(":visible:first").innerWidth()},layout:function(a,b){a=!!d.boolean(a)&&a,b=!d.boolean(b)||b;var c=this,e=c.getContainerWidth();0!=c._lastWidth&&Math.abs(e-c._lastWidth)>0&&(a=!0,c._lastWidth=e),(a||0===c._items.length)&&c.parse();for(var f,g=c.rows(e),h=0,i=0,j=g.length;i<j;i++)f=g[i],h=c.position(f,e,h,c.options.align),c.render(f);c.$el.height(h),0==c._lastWidth&&(c._lastWidth=e),b&&c.getContainerWidth()<e&&c.layout(!1,!1)},render:function(a){for(var b,c=0,d=a.items.length;c<d;c++)b=a.items[c],a.visible?b.$item.css({width:b.width,height:a.height,top:b.top,left:b.left,display:""}).addClass("fg-positioned"):b.$item.css("display","none")},position:function(a,b,c,d){var e=this,f=a.items[a.items.length-1],g=b-(f.left+f.width);a.index>0&&(c+=e.options.gutter),a.top=c;for(var h,i=0,j=a.items.length;i<j;i++)h=a.items[i],h.top=c,"center"===d?h.left+=g/2:"right"===d&&(h.left+=g);return c+a.height},items:function(){return a.map(this._items,function(a){return{index:a.index,width:a.width,height:a.height,$item:a.$item,$thumb:a.$thumb,top:a.top,left:a.left}})},rows:function(a){for(var b=this,c=b.items(),d=[],e=c.length>0,f=-1,g=0;e;){f+=1,f>0&&(g+=b.options.gutter);for(var h,i,j,k={index:f,visible:!0,top:g,width:0,height:0,items:[]},l=[],m=0,n=0,o=c.length;n<o&&(i=c[n],!((h=k.width+i.width)>a&&n>0));n++)h>a&&0==n&&(h=a,j=a/i.width,i.width=b.round(i.width*j),i.height=b.round(i.height*j),k.height=i.height),i.top=k.top,n>0&&(m+=b.options.gutter),n!==o-1&&(h+=b.options.gutter),i.left=m,m+=i.width,i.height>k.height&&(k.height=i.height),k.width=h,k.items.push(i),l.push(n);if(0===l.length){e=!1;break}l.sort(function(a,b){return b-a});for(var p=0,q=l.length;p<q;p++)c.splice(l[p],1);d.push(k),e=c.length>0}return d},onWindowResize:function(a){a.data.self.layout()}}),b.Portfolio.defaults={gutter:40,align:"center"}}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.is),function(a,b,c){b.PortfolioTemplate=b.Template.extend({construct:function(a,b){this._super(a,b),this.portfolio=null},onPreInit:function(a,c){c.portfolio=new b.Portfolio(c.$el.get(0),c.template)},onInit:function(a,b){b.portfolio.init()},onFirstLoad:function(a,b){b.portfolio.layout(!0)},onReady:function(a,b){b.portfolio.layout(!0)},onDestroy:function(a,b){b.portfolio.destroy()},onLayout:function(a,b){b.portfolio.layout(!0)},onParsedItems:function(a,b,c){(b.initialized||b.initializing)&&b.portfolio.layout(!0)},onAppendedItems:function(a,b,c){(b.initialized||b.initializing)&&b.portfolio.layout(!0)},onDetachedItems:function(a,b,c){b.initialized&&b.portfolio.layout(!0)}}),b.template.register("simple_portfolio",b.PortfolioTemplate,{gutter:40},{container:"foogallery fg-simple_portfolio"})}(FooGallery.$,FooGallery,FooGallery.utils),function(a,b,c,d){b.ImageViewerTemplate=b.Template.extend({construct:function(b,c){this._super(d.extend({},b,{paging:{pushOrReplace:"replace",theme:"fg-light",type:"default",size:1,position:"none",scrollToTop:!1}}),c),this.$inner=a(),
|
11 |
+
this.$current=a(),this.$total=a(),this.$prev=a(),this.$next=a()},createChildren:function(){var b=this;return a("<div/>",{class:b.cls.inner}).append(a("<div/>",{class:b.cls.innerContainer}),a("<div/>",{class:b.cls.controls}).append(a("<div/>",{class:b.cls.prev}).append(a("<span/>",{text:b.il8n.prev})),a("<label/>",{class:b.cls.count,text:b.il8n.count}).prepend(a("<span/>",{class:b.cls.countCurrent,text:"0"})).append(a("<span/>",{class:b.cls.countTotal,text:"0"})),a("<div/>",{class:b.cls.next}).append(a("<span/>",{text:b.il8n.next}))))},destroyChildren:function(){var a=this;a.$el.find(a.sel.inner).remove()},onPreInit:function(a,b){b.$inner=b.$el.find(b.sel.innerContainer),b.$current=b.$el.find(b.sel.countCurrent),b.$total=b.$el.find(b.sel.countTotal),b.$prev=b.$el.find(b.sel.prev),b.$next=b.$el.find(b.sel.next)},onInit:function(a,b){b.template.attachFooBox&&b.$el.on("foobox.previous",{self:b},b.onFooBoxPrev).on("foobox.next",{self:b},b.onFooBoxNext),b.$prev.on("click",{self:b},b.onPrevClick),b.$next.on("click",{self:b},b.onNextClick)},onFirstLoad:function(a,b){b.update()},onDestroy:function(a,b){b.template.attachFooBox&&b.$el.off({"foobox.previous":b.onFooBoxPrev,"foobox.next":b.onFooBoxNext}),b.$prev.off("click",b.onPrevClick),b.$next.off("click",b.onNextClick)},onAppendItem:function(a,b,c){a.preventDefault(),b.$inner.append(c.$el),c.fix(),c.isAttached=!0},onAfterPageChange:function(a,b,c,d,e){e||b.update()},onAfterFilterChange:function(a,b){b.update()},update:function(){this.pages&&(this.$current.text(this.pages.current),this.$total.text(this.pages.total))},prev:function(){this.pages&&(this.template.loop&&1===this.pages.current?this.pages.last():this.pages.prev(),this.update())},next:function(){this.pages&&(this.template.loop&&this.pages.current===this.pages.total?this.pages.first():this.pages.next(),this.update())},onFooBoxPrev:function(a){a.data.self.prev()},onFooBoxNext:function(a){a.data.self.next()},onPrevClick:function(a){a.preventDefault(),a.stopPropagation(),a.data.self.prev()},onNextClick:function(a){a.preventDefault(),a.stopPropagation(),a.data.self.next()}}),b.template.register("image-viewer",b.ImageViewerTemplate,{template:{attachFooBox:!1,loop:!1}},{container:"foogallery fg-image-viewer",inner:"fiv-inner",innerContainer:"fiv-inner-container",controls:"fiv-ctrls",prev:"fiv-prev",next:"fiv-next",count:"fiv-count",countCurrent:"fiv-count-current",countTotal:"fiv-count-total"},{prev:"Prev",next:"Next",count:"of"})}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.obj),function(a,b,c){b.ThumbnailTemplate=b.Template.extend({construct:function(b,d){this._super(c.extend({},b,{filtering:{type:"none"},paging:{type:"none"}}),d),this.$hidden=a()},createChildren:function(){var b=this;return b.$hidden=a("<div/>",{class:b.cls.hidden})},destroyChildren:function(){var a=this;a.$el.find(a.sel.hidden).remove()},onPreInit:function(a,b){b.$hidden=b.$el.find(b.sel.hidden)},onPostInit:function(b,c){for(var d,e=c.items.all().slice(1),f=0,g=e.length;f<g;f++)d=e[f],c.$hidden.append(a("<a/>",{href:d.href,rel:"lightbox["+c.id+"]"}).attr(d.attr.anchor));c.items.setAll(c.items.all().slice(0,1))}}),b.template.register("thumbnail",b.ThumbnailTemplate,null,{container:"foogallery fg-thumbnail",hidden:"fg-st-hidden"})}(FooGallery.$,FooGallery,FooGallery.utils.obj),function(a,b,c,d){b.triggerPostLoad=function(b,c,d,e,f){if("first-load"===b.type||c.initialized&&("after-page-change"===b.type&&!f||"after-filter-change"===b.type))try{a("body").trigger("post-load")}catch(a){console.error(a)}},b.autoDefaults={on:{"first-load.foogallery after-page-change.foogallery after-filter-change.foogallery":b.triggerPostLoad}},b.auto=function(a){b.autoDefaults=d.merge(b.autoDefaults,a)},a(function(){a('[id^="foogallery-gallery-"]:not(.fg-ready)').foogallery(b.autoDefaults)}),c.ready(function(){a('[id^="foogallery-gallery-"].fg-ready').foogallery(b.autoDefaults)})}(FooGallery.$,FooGallery,FooGallery.utils,FooGallery.utils.obj);
|
extensions/demo-content-generator/class-demo-content-generator.php
CHANGED
@@ -173,8 +173,10 @@ if ( ! class_exists( 'FooGallery_Demo_Content_Generator' ) ) {
|
|
173 |
$attachment_data = wp_generate_attachment_metadata( $attachment_id, $file );
|
174 |
wp_update_attachment_metadata( $attachment_id, $attachment_data );
|
175 |
|
176 |
-
|
177 |
-
|
|
|
|
|
178 |
|
179 |
return $attachment_id;
|
180 |
}
|
173 |
$attachment_data = wp_generate_attachment_metadata( $attachment_id, $file );
|
174 |
wp_update_attachment_metadata( $attachment_id, $attachment_data );
|
175 |
|
176 |
+
if ( defined( 'FOOGALLERY_ATTACHMENT_TAXONOMY_TAG' ) ) {
|
177 |
+
// Save tags
|
178 |
+
wp_set_object_terms( $attachment_id, array_map( 'trim', preg_split( '/,+/', $tags ) ), FOOGALLERY_ATTACHMENT_TAXONOMY_TAG, false );
|
179 |
+
}
|
180 |
|
181 |
return $attachment_id;
|
182 |
}
|
foogallery.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
Plugin Name: FooGallery
|
5 |
Description: FooGallery is the most intuitive and extensible gallery management tool ever created for WordPress
|
6 |
-
Version: 1.6.
|
7 |
Author: FooPlugins
|
8 |
Plugin URI: https://foo.gallery
|
9 |
Author URI: http://fooplugins.com
|
@@ -27,7 +27,7 @@ if ( function_exists( 'foogallery_fs' ) ) {
|
|
27 |
define( 'FOOGALLERY_PATH', plugin_dir_path( __FILE__ ) );
|
28 |
define( 'FOOGALLERY_URL', plugin_dir_url( __FILE__ ) );
|
29 |
define( 'FOOGALLERY_FILE', __FILE__ );
|
30 |
-
define( 'FOOGALLERY_VERSION', '1.6.
|
31 |
define( 'FOOGALLERY_SETTINGS_VERSION', '2' );
|
32 |
require_once FOOGALLERY_PATH . 'includes/constants.php';
|
33 |
// Create a helper function for easy SDK access.
|
3 |
/*
|
4 |
Plugin Name: FooGallery
|
5 |
Description: FooGallery is the most intuitive and extensible gallery management tool ever created for WordPress
|
6 |
+
Version: 1.6.11
|
7 |
Author: FooPlugins
|
8 |
Plugin URI: https://foo.gallery
|
9 |
Author URI: http://fooplugins.com
|
27 |
define( 'FOOGALLERY_PATH', plugin_dir_path( __FILE__ ) );
|
28 |
define( 'FOOGALLERY_URL', plugin_dir_url( __FILE__ ) );
|
29 |
define( 'FOOGALLERY_FILE', __FILE__ );
|
30 |
+
define( 'FOOGALLERY_VERSION', '1.6.11' );
|
31 |
define( 'FOOGALLERY_SETTINGS_VERSION', '2' );
|
32 |
require_once FOOGALLERY_PATH . 'includes/constants.php';
|
33 |
// Create a helper function for easy SDK access.
|
freemius/assets/css/admin/dialog-boxes.css
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
.fs-modal{position:fixed;overflow:auto;height:100%;width:100%;top:0;z-index:100000;display:none;background:rgba(0,0,0,0.6)}.fs-modal .fs-modal-dialog{background:transparent;position:absolute;left:50%;margin-left:-298px;padding-bottom:30px;top:-100%;z-index:100001;width:596px}@media (max-width: 650px){.fs-modal .fs-modal-dialog{margin-left:-50%;box-sizing:border-box;padding-left:10px;padding-right:10px;width:100%}.fs-modal .fs-modal-dialog .fs-modal-panel>h3>strong{font-size:1.3em}}.fs-modal.active{display:block}.fs-modal.active:before{display:block}.fs-modal.active .fs-modal-dialog{top:10%}.fs-modal.fs-success .fs-modal-header{border-bottom-color:#46b450}.fs-modal.fs-success .fs-modal-body{background-color:#f7fff7}.fs-modal.fs-warn .fs-modal-header{border-bottom-color:#ffb900}.fs-modal.fs-warn .fs-modal-body{background-color:#fff8e5}.fs-modal.fs-error .fs-modal-header{border-bottom-color:#dc3232}.fs-modal.fs-error .fs-modal-body{background-color:#ffeaea}.fs-modal .fs-modal-body,.fs-modal .fs-modal-footer{border:0;background:#fefefe;padding:20px}.fs-modal .fs-modal-header{border-bottom:#eeeeee solid 1px;background:#fbfbfb;padding:15px 20px;position:relative;margin-bottom:-10px}.fs-modal .fs-modal-header h4{margin:0;padding:0;text-transform:uppercase;font-size:1.2em;font-weight:bold;color:#cacaca;text-shadow:1px 1px 1px #fff;letter-spacing:0.6px;-webkit-font-smoothing:antialiased}.fs-modal .fs-modal-header .fs-close{position:absolute;right:10px;top:12px;cursor:pointer;color:#bbb;-moz-border-radius:20px;-webkit-border-radius:20px;border-radius:20px;padding:3px;-moz-transition:all 0.2s ease-in-out;-o-transition:all 0.2s ease-in-out;-ms-transition:all 0.2s ease-in-out;-webkit-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out}.fs-modal .fs-modal-header .fs-close:hover{color:#fff;background:#aaa}.fs-modal .fs-modal-header .fs-close .dashicons,.fs-modal .fs-modal-header .fs-close:hover .dashicons{text-decoration:none}.fs-modal .fs-modal-body{border-bottom:0}.fs-modal .fs-modal-body p{font-size:14px}.fs-modal .fs-modal-body h2{font-size:20px;line-height:1.5em}.fs-modal .fs-modal-body>div{margin-top:10px}.fs-modal .fs-modal-body>div h2{font-weight:bold;font-size:20px;margin-top:0}.fs-modal .fs-modal-footer{border-top:#eeeeee solid 1px;text-align:right}.fs-modal .fs-modal-footer>.button{margin:0 7px}.fs-modal .fs-modal-footer>.button:first-child{margin:0}.fs-modal .fs-modal-panel>.notice.inline{margin:0;display:none}.fs-modal .fs-modal-panel:not(.active){display:none}.rtl .fs-modal .fs-modal-header .fs-close{right:auto;left:20px}body.has-fs-modal{overflow:hidden}.fs-modal.fs-modal-deactivation-feedback .reason-input,.fs-modal.fs-modal-deactivation-feedback .internal-message{margin:3px 0 3px 22px}.fs-modal.fs-modal-deactivation-feedback .reason-input input,.fs-modal.fs-modal-deactivation-feedback .reason-input textarea,.fs-modal.fs-modal-deactivation-feedback .internal-message input,.fs-modal.fs-modal-deactivation-feedback .internal-message textarea{width:100%}.fs-modal.fs-modal-deactivation-feedback li.reason.has-internal-message .internal-message{border:1px solid #ccc;padding:7px;display:none}@media (max-width: 650px){.fs-modal.fs-modal-deactivation-feedback li.reason li.reason{margin-bottom:10px}.fs-modal.fs-modal-deactivation-feedback li.reason li.reason .reason-input,.fs-modal.fs-modal-deactivation-feedback li.reason li.reason .internal-message{margin-left:29px}.fs-modal.fs-modal-deactivation-feedback li.reason li.reason label{display:table}.fs-modal.fs-modal-deactivation-feedback li.reason li.reason label>span{display:table-cell;font-size:1.3em}}.fs-modal.fs-modal-deactivation-feedback .anonymous-feedback-label{float:left}.fs-modal.fs-modal-deactivation-feedback .fs-modal-panel{margin-top:0 !important}.fs-modal.fs-modal-deactivation-feedback .fs-modal-panel h3{margin-top:0;line-height:1.5em}#the-list .deactivate>.fs-slug{display:none}.fs-modal.fs-modal-subscription-cancellation .fs-price-increase-warning{color:red;font-weight:bold;padding:0 25px;margin-bottom:0}.fs-modal.fs-modal-subscription-cancellation ul.subscription-actions label input{float:left;top:5px;position:relative}.rtl .fs-modal.fs-modal-subscription-cancellation ul.subscription-actions label input{float:right}.fs-modal.fs-modal-subscription-cancellation ul.subscription-actions label span{display:block;margin-left:24px}.rtl .fs-modal.fs-modal-subscription-cancellation ul.subscription-actions label span{margin-left:0;margin-right:24px}.fs-modal.fs-modal-license-activation .fs-modal-body input.license_key{width:100%}#license_options_container table,#license_options_container table select,#license_options_container table #available_license_key{width:100%}#license_options_container table td:first-child{width:1%}#license_options_container table #other_license_key_container label{position:relative;top:6px;float:left;margin-right:5px}#license_options_container table #other_license_key_container div{overflow:hidden;width:auto;height:30px;display:block;top:2px;position:relative}#license_options_container table #other_license_key_container div input{margin:0}#sites_list_container td{cursor:pointer}#multisite_options_container{margin-top:10px;border:1px solid #ccc;padding:5px}#multisite_options_container a{text-decoration:none}#multisite_options_container a:focus{box-shadow:none}#multisite_options_container a.selected{font-weight:bold}#multisite_options_container.apply-on-all-sites{border:0 none;padding:0}#multisite_options_container.apply-on-all-sites #all_sites_options{border-spacing:0}#multisite_options_container.apply-on-all-sites #all_sites_options td:not(:first-child){display:none}#multisite_options_container #sites_list_container{display:none;overflow:auto}#multisite_options_container #sites_list_container table td{border-top:1px solid #ccc;padding:4px 2px}.fs-modal.fs-modal-license-key-resend .email-address-container{overflow:hidden;padding-right:2px}.fs-modal.fs-modal-license-key-resend.fs-freemium input.email-address{width:300px}.fs-modal.fs-modal-license-key-resend.fs-freemium label{display:block;margin-bottom:10px}.fs-modal.fs-modal-license-key-resend.fs-premium input.email-address{width:100%}.fs-modal.fs-modal-license-key-resend.fs-premium .button-container{float:right;margin-left:7px}@media (max-width: 650px){.fs-modal.fs-modal-license-key-resend.fs-premium .button-container{margin-top:2px}}
|
2 |
-
.rtl .fs-modal.fs-modal-license-key-resend .fs-modal-body .input-container>.email-address-container{padding-left:2px;padding-right:0}.rtl .fs-modal.fs-modal-license-key-resend .fs-modal-body .button-container{float:left;margin-right:7px;margin-left:0}a.show-license-resend-modal{margin-top:4px;display:inline-block}.fs-ajax-loader{position:relative;width:170px;height:20px;margin:auto}.fs-ajax-loader .fs-ajax-loader-bar{position:absolute;top:0;background-color:#0074a3;width:20px;height:20px;-webkit-animation-name:bounce_ajaxLoader;-moz-animation-name:bounce_ajaxLoader;-ms-animation-name:bounce_ajaxLoader;-o-animation-name:bounce_ajaxLoader;animation-name:bounce_ajaxLoader;-webkit-animation-duration:1.5s;-moz-animation-duration:1.5s;-ms-animation-duration:1.5s;-o-animation-duration:1.5s;animation-duration:1.5s;animation-iteration-count:infinite;-o-animation-iteration-count:infinite;-ms-animation-iteration-count:infinite;-webkit-animation-iteration-count:infinite;-moz-animation-iteration-count:infinite;-webkit-animation-direction:normal;-moz-animation-direction:normal;-ms-animation-direction:normal;-o-animation-direction:normal;animation-direction:normal;-moz-transform:0.3;-o-transform:0.3;-ms-transform:0.3;-webkit-transform:0.3;transform:0.3}.fs-ajax-loader .fs-ajax-loader-bar-1{left:0px;animation-delay:0.6s;-o-animation-delay:0.6s;-ms-animation-delay:0.6s;-webkit-animation-delay:0.6s;-moz-animation-delay:0.6s}.fs-ajax-loader .fs-ajax-loader-bar-2{left:19px;animation-delay:0.75s;-o-animation-delay:0.75s;-ms-animation-delay:0.75s;-webkit-animation-delay:0.75s;-moz-animation-delay:0.75s}.fs-ajax-loader .fs-ajax-loader-bar-3{left:38px;animation-delay:0.9s;-o-animation-delay:0.9s;-ms-animation-delay:0.9s;-webkit-animation-delay:0.9s;-moz-animation-delay:0.9s}.fs-ajax-loader .fs-ajax-loader-bar-4{left:57px;animation-delay:1.05s;-o-animation-delay:1.05s;-ms-animation-delay:1.05s;-webkit-animation-delay:1.05s;-moz-animation-delay:1.05s}.fs-ajax-loader .fs-ajax-loader-bar-5{left:76px;animation-delay:1.2s;-o-animation-delay:1.2s;-ms-animation-delay:1.2s;-webkit-animation-delay:1.2s;-moz-animation-delay:1.2s}.fs-ajax-loader .fs-ajax-loader-bar-6{left:95px;animation-delay:1.35s;-o-animation-delay:1.35s;-ms-animation-delay:1.35s;-webkit-animation-delay:1.35s;-moz-animation-delay:1.35s}.fs-ajax-loader .fs-ajax-loader-bar-7{left:114px;animation-delay:1.5s;-o-animation-delay:1.5s;-ms-animation-delay:1.5s;-webkit-animation-delay:1.5s;-moz-animation-delay:1.5s}.fs-ajax-loader .fs-ajax-loader-bar-8{left:133px;animation-delay:1.65s;-o-animation-delay:1.65s;-ms-animation-delay:1.65s;-webkit-animation-delay:1.65s;-moz-animation-delay:1.65s}@-moz-keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}@-ms-keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}@-o-keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}@-webkit-keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}@keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}.fs-modal-auto-install #request-filesystem-credentials-form h2,.fs-modal-auto-install #request-filesystem-credentials-form .request-filesystem-credentials-action-buttons{display:none}.fs-modal-auto-install #request-filesystem-credentials-form input[type=password],.fs-modal-auto-install #request-filesystem-credentials-form input[type=email],.fs-modal-auto-install #request-filesystem-credentials-form input[type=text]{-webkit-appearance:none;padding:10px 10px 5px 10px;width:300px;max-width:100%}.fs-modal-auto-install #request-filesystem-credentials-form>div,.fs-modal-auto-install #request-filesystem-credentials-form label,.fs-modal-auto-install #request-filesystem-credentials-form fieldset{width:300px;max-width:100%;margin:0 auto;display:block}.button-primary.warn{box-shadow:0 1px 0 #d2593c;text-shadow:0 -1px 1px #d2593c,1px 0 1px #d2593c,0 1px 1px #d2593c,-1px 0 1px #d2593c;background:#f56a48;border-color:#ec6544 #d2593c #d2593c}.button-primary.warn:hover{background:#fd6d4a;border-color:#d2593c}.button-primary.warn:focus{box-shadow:0 1px 0 #dd6041,0 0 2px 1px #e4a796}.button-primary.warn:active{background:#dd6041;border-color:#d2593c;box-shadow:inset 0 2px 0 #d2593c}.button-primary.warn.disabled{color:#f5b3a1 !important;background:#e76444 !important;border-color:#d85e40 !important;text-shadow:0 -1px 0 rgba(0,0,0,0.1) !important}
|
1 |
+
.fs-modal{position:fixed;overflow:auto;height:100%;width:100%;top:0;z-index:100000;display:none;background:rgba(0,0,0,0.6)}.fs-modal .fs-modal-dialog{background:transparent;position:absolute;left:50%;margin-left:-298px;padding-bottom:30px;top:-100%;z-index:100001;width:596px}@media (max-width: 650px){.fs-modal .fs-modal-dialog{margin-left:-50%;box-sizing:border-box;padding-left:10px;padding-right:10px;width:100%}.fs-modal .fs-modal-dialog .fs-modal-panel>h3>strong{font-size:1.3em}}.fs-modal.active{display:block}.fs-modal.active:before{display:block}.fs-modal.active .fs-modal-dialog{top:10%}.fs-modal.fs-success .fs-modal-header{border-bottom-color:#46b450}.fs-modal.fs-success .fs-modal-body{background-color:#f7fff7}.fs-modal.fs-warn .fs-modal-header{border-bottom-color:#ffb900}.fs-modal.fs-warn .fs-modal-body{background-color:#fff8e5}.fs-modal.fs-error .fs-modal-header{border-bottom-color:#dc3232}.fs-modal.fs-error .fs-modal-body{background-color:#ffeaea}.fs-modal .fs-modal-body,.fs-modal .fs-modal-footer{border:0;background:#fefefe;padding:20px}.fs-modal .fs-modal-header{border-bottom:#eeeeee solid 1px;background:#fbfbfb;padding:15px 20px;position:relative;margin-bottom:-10px}.fs-modal .fs-modal-header h4{margin:0;padding:0;text-transform:uppercase;font-size:1.2em;font-weight:bold;color:#cacaca;text-shadow:1px 1px 1px #fff;letter-spacing:0.6px;-webkit-font-smoothing:antialiased}.fs-modal .fs-modal-header .fs-close{position:absolute;right:10px;top:12px;cursor:pointer;color:#bbb;-moz-border-radius:20px;-webkit-border-radius:20px;border-radius:20px;padding:3px;-moz-transition:all 0.2s ease-in-out;-o-transition:all 0.2s ease-in-out;-ms-transition:all 0.2s ease-in-out;-webkit-transition:all 0.2s ease-in-out;transition:all 0.2s ease-in-out}.fs-modal .fs-modal-header .fs-close:hover{color:#fff;background:#aaa}.fs-modal .fs-modal-header .fs-close .dashicons,.fs-modal .fs-modal-header .fs-close:hover .dashicons{text-decoration:none}.fs-modal .fs-modal-body{border-bottom:0}.fs-modal .fs-modal-body p{font-size:14px}.fs-modal .fs-modal-body h2{font-size:20px;line-height:1.5em}.fs-modal .fs-modal-body>div{margin-top:10px}.fs-modal .fs-modal-body>div h2{font-weight:bold;font-size:20px;margin-top:0}.fs-modal .fs-modal-footer{border-top:#eeeeee solid 1px;text-align:right}.fs-modal .fs-modal-footer>.button{margin:0 7px}.fs-modal .fs-modal-footer>.button:first-child{margin:0}.fs-modal .fs-modal-panel>.notice.inline{margin:0;display:none}.fs-modal .fs-modal-panel:not(.active){display:none}.rtl .fs-modal .fs-modal-header .fs-close{right:auto;left:20px}body.has-fs-modal{overflow:hidden}.fs-modal.fs-modal-deactivation-feedback .reason-input,.fs-modal.fs-modal-deactivation-feedback .internal-message{margin:3px 0 3px 22px}.fs-modal.fs-modal-deactivation-feedback .reason-input input,.fs-modal.fs-modal-deactivation-feedback .reason-input textarea,.fs-modal.fs-modal-deactivation-feedback .internal-message input,.fs-modal.fs-modal-deactivation-feedback .internal-message textarea{width:100%}.fs-modal.fs-modal-deactivation-feedback li.reason.has-internal-message .internal-message{border:1px solid #ccc;padding:7px;display:none}@media (max-width: 650px){.fs-modal.fs-modal-deactivation-feedback li.reason li.reason{margin-bottom:10px}.fs-modal.fs-modal-deactivation-feedback li.reason li.reason .reason-input,.fs-modal.fs-modal-deactivation-feedback li.reason li.reason .internal-message{margin-left:29px}.fs-modal.fs-modal-deactivation-feedback li.reason li.reason label{display:table}.fs-modal.fs-modal-deactivation-feedback li.reason li.reason label>span{display:table-cell;font-size:1.3em}}.fs-modal.fs-modal-deactivation-feedback .anonymous-feedback-label{float:left}.fs-modal.fs-modal-deactivation-feedback .fs-modal-panel{margin-top:0 !important}.fs-modal.fs-modal-deactivation-feedback .fs-modal-panel h3{margin-top:0;line-height:1.5em}#the-list .deactivate>.fs-slug{display:none}.fs-modal.fs-modal-subscription-cancellation .fs-price-increase-warning{color:red;font-weight:bold;padding:0 25px;margin-bottom:0}.fs-modal.fs-modal-subscription-cancellation ul.subscription-actions label input{float:left;top:5px;position:relative}.rtl .fs-modal.fs-modal-subscription-cancellation ul.subscription-actions label input{float:right}.fs-modal.fs-modal-subscription-cancellation ul.subscription-actions label span{display:block;margin-left:24px}.rtl .fs-modal.fs-modal-subscription-cancellation ul.subscription-actions label span{margin-left:0;margin-right:24px}.fs-modal.fs-modal-license-activation .fs-modal-body input.license_key{width:100%}#license_options_container table,#license_options_container table select,#license_options_container table #available_license_key{width:100%}#license_options_container table td:first-child{width:1%}#license_options_container table #other_license_key_container label{position:relative;top:6px;float:left;margin-right:5px}#license_options_container table #other_license_key_container div{overflow:hidden;width:auto;height:30px;display:block;top:2px;position:relative}#license_options_container table #other_license_key_container div input{margin:0}#sites_list_container td{cursor:pointer}#multisite_options_container{margin-top:10px;border:1px solid #ccc;padding:5px}#multisite_options_container a{text-decoration:none}#multisite_options_container a:focus{box-shadow:none}#multisite_options_container a.selected{font-weight:bold}#multisite_options_container.apply-on-all-sites{border:0 none;padding:0}#multisite_options_container.apply-on-all-sites #all_sites_options{border-spacing:0}#multisite_options_container.apply-on-all-sites #all_sites_options td:not(:first-child){display:none}#multisite_options_container #sites_list_container{display:none;overflow:auto}#multisite_options_container #sites_list_container table td{border-top:1px solid #ccc;padding:4px 2px}.fs-modal.fs-modal-license-key-resend .email-address-container{overflow:hidden;padding-right:2px}.fs-modal.fs-modal-license-key-resend.fs-freemium input.email-address{width:300px}.fs-modal.fs-modal-license-key-resend.fs-freemium label{display:block;margin-bottom:10px}.fs-modal.fs-modal-license-key-resend.fs-premium input.email-address{width:100%}.fs-modal.fs-modal-license-key-resend.fs-premium .button-container{float:right;margin-left:7px}@media (max-width: 650px){.fs-modal.fs-modal-license-key-resend.fs-premium .button-container{margin-top:2px}}
|
2 |
+
.rtl .fs-modal.fs-modal-license-key-resend .fs-modal-body .input-container>.email-address-container{padding-left:2px;padding-right:0}.rtl .fs-modal.fs-modal-license-key-resend .fs-modal-body .button-container{float:left;margin-right:7px;margin-left:0}a.show-license-resend-modal{margin-top:4px;display:inline-block}.fs-ajax-loader{position:relative;width:170px;height:20px;margin:auto}.fs-ajax-loader .fs-ajax-loader-bar{position:absolute;top:0;background-color:#0074a3;width:20px;height:20px;-webkit-animation-name:bounce_ajaxLoader;-moz-animation-name:bounce_ajaxLoader;-ms-animation-name:bounce_ajaxLoader;-o-animation-name:bounce_ajaxLoader;animation-name:bounce_ajaxLoader;-webkit-animation-duration:1.5s;-moz-animation-duration:1.5s;-ms-animation-duration:1.5s;-o-animation-duration:1.5s;animation-duration:1.5s;animation-iteration-count:infinite;-o-animation-iteration-count:infinite;-ms-animation-iteration-count:infinite;-webkit-animation-iteration-count:infinite;-moz-animation-iteration-count:infinite;-webkit-animation-direction:normal;-moz-animation-direction:normal;-ms-animation-direction:normal;-o-animation-direction:normal;animation-direction:normal;-moz-transform:0.3;-o-transform:0.3;-ms-transform:0.3;-webkit-transform:0.3;transform:0.3}.fs-ajax-loader .fs-ajax-loader-bar-1{left:0px;animation-delay:0.6s;-o-animation-delay:0.6s;-ms-animation-delay:0.6s;-webkit-animation-delay:0.6s;-moz-animation-delay:0.6s}.fs-ajax-loader .fs-ajax-loader-bar-2{left:19px;animation-delay:0.75s;-o-animation-delay:0.75s;-ms-animation-delay:0.75s;-webkit-animation-delay:0.75s;-moz-animation-delay:0.75s}.fs-ajax-loader .fs-ajax-loader-bar-3{left:38px;animation-delay:0.9s;-o-animation-delay:0.9s;-ms-animation-delay:0.9s;-webkit-animation-delay:0.9s;-moz-animation-delay:0.9s}.fs-ajax-loader .fs-ajax-loader-bar-4{left:57px;animation-delay:1.05s;-o-animation-delay:1.05s;-ms-animation-delay:1.05s;-webkit-animation-delay:1.05s;-moz-animation-delay:1.05s}.fs-ajax-loader .fs-ajax-loader-bar-5{left:76px;animation-delay:1.2s;-o-animation-delay:1.2s;-ms-animation-delay:1.2s;-webkit-animation-delay:1.2s;-moz-animation-delay:1.2s}.fs-ajax-loader .fs-ajax-loader-bar-6{left:95px;animation-delay:1.35s;-o-animation-delay:1.35s;-ms-animation-delay:1.35s;-webkit-animation-delay:1.35s;-moz-animation-delay:1.35s}.fs-ajax-loader .fs-ajax-loader-bar-7{left:114px;animation-delay:1.5s;-o-animation-delay:1.5s;-ms-animation-delay:1.5s;-webkit-animation-delay:1.5s;-moz-animation-delay:1.5s}.fs-ajax-loader .fs-ajax-loader-bar-8{left:133px;animation-delay:1.65s;-o-animation-delay:1.65s;-ms-animation-delay:1.65s;-webkit-animation-delay:1.65s;-moz-animation-delay:1.65s}@-moz-keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}@-ms-keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}@-o-keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}@-webkit-keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}@keyframes bounce_ajaxLoader{0%{-moz-transform:scale(1);-o-transform:scale(1);-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);background-color:#0074a3}100%{-moz-transform:scale(0.3);-o-transform:scale(0.3);-ms-transform:scale(0.3);-webkit-transform:scale(0.3);transform:scale(0.3);background-color:#fff}}.fs-modal-auto-install #request-filesystem-credentials-form h2,.fs-modal-auto-install #request-filesystem-credentials-form .request-filesystem-credentials-action-buttons{display:none}.fs-modal-auto-install #request-filesystem-credentials-form input[type=password],.fs-modal-auto-install #request-filesystem-credentials-form input[type=email],.fs-modal-auto-install #request-filesystem-credentials-form input[type=text]{-webkit-appearance:none;padding:10px 10px 5px 10px;width:300px;max-width:100%}.fs-modal-auto-install #request-filesystem-credentials-form>div,.fs-modal-auto-install #request-filesystem-credentials-form label,.fs-modal-auto-install #request-filesystem-credentials-form fieldset{width:300px;max-width:100%;margin:0 auto;display:block}.button-primary.warn{box-shadow:0 1px 0 #d2593c;text-shadow:0 -1px 1px #d2593c,1px 0 1px #d2593c,0 1px 1px #d2593c,-1px 0 1px #d2593c;background:#f56a48;border-color:#ec6544 #d2593c #d2593c}.button-primary.warn:hover{background:#fd6d4a;border-color:#d2593c}.button-primary.warn:focus{box-shadow:0 1px 0 #dd6041,0 0 2px 1px #e4a796}.button-primary.warn:active{background:#dd6041;border-color:#d2593c;box-shadow:inset 0 2px 0 #d2593c}.button-primary.warn.disabled{color:#f5b3a1 !important;background:#e76444 !important;border-color:#d85e40 !important;text-shadow:0 -1px 0 rgba(0,0,0,0.1) !important}
|
freemius/assets/scss/_colors.scss
CHANGED
@@ -1,79 +1,79 @@
|
|
1 |
-
$menu-hover-color: #333;
|
2 |
-
$darkest-color: #000;
|
3 |
-
$fms-live-color: #71ae00;
|
4 |
-
$fms-test-color: #f7941d;
|
5 |
-
$fms-link-color: #29abe1;
|
6 |
-
$fms-link-hover-color: darken(#29abe1, 10%);
|
7 |
-
$body-bkg: #111;
|
8 |
-
$special-color: #d3135a;
|
9 |
-
$body-color: #f1f1f1;
|
10 |
-
$fms-white: #f1f1f1;
|
11 |
-
$container-bkg: #222;
|
12 |
-
$container-bkg-odd: #262626;
|
13 |
-
$container-border-color: #333;
|
14 |
-
$table-head-bkg: #333;
|
15 |
-
$table-head-color: #999;
|
16 |
-
$info-color: #999;
|
17 |
-
$error-color: #ff0000;
|
18 |
-
|
19 |
-
$fs-logo-blue-color: #29abe1;
|
20 |
-
$fs-logo-green-color: #71ae00;
|
21 |
-
$fs-logo-magenta-color: #d3135a;
|
22 |
-
|
23 |
-
// WordPress colors.
|
24 |
-
$page-header-bkg: #333;
|
25 |
-
$page-header-color: $fms-white;
|
26 |
-
$text-dark-color: #333;
|
27 |
-
$text-light-color: #666;
|
28 |
-
$text-lightest-color: #999;
|
29 |
-
|
30 |
-
// Notices.
|
31 |
-
$wp-notice-success-color: #f7fff7;
|
32 |
-
$wp-notice-success-dark-color: #46b450;
|
33 |
-
$wp-notice-error-color: #ffeaea;
|
34 |
-
$wp-notice-error-dark-color: #dc3232;
|
35 |
-
$wp-notice-warn-color: #fff8e5;
|
36 |
-
$wp-notice-warn-dark-color: #ffb900;
|
37 |
-
$fs-notice-promotion-border-color: #00a0d2;
|
38 |
-
$fs-notice-promotion-bkg: #f2fcff;
|
39 |
-
|
40 |
-
// WP Buttons.
|
41 |
-
$button-primary-bkg: #6bc406;
|
42 |
-
$button-primary-color: $fms-white;
|
43 |
-
$button-secondary-bkg: #333;
|
44 |
-
$button-secondary-color: $fms-white;
|
45 |
-
$featured-color: #6bc406;
|
46 |
-
$wp-selected-color: #0074a3;
|
47 |
-
$wp-button-alert-border-color: #d2593c;
|
48 |
-
$wp-button-alert-border-top-color: #ec6544;
|
49 |
-
$wp-button-alert-shadow-color: #d2593c;
|
50 |
-
$wp-button-alert-focused-shadow1-color: #dd6041;
|
51 |
-
$wp-button-alert-focused-shadow2-color: #e4a796;
|
52 |
-
$wp-button-alert-background-color: #f56a48;
|
53 |
-
$wp-button-alert-hovered-background-color: #fd6d4a;
|
54 |
-
$wp-button-alert-active-background-color: #dd6041;
|
55 |
-
$wp-button-alert-disabled-color: #f5b3a1;
|
56 |
-
$wp-button-alert-disabled-background-color: #e76444;
|
57 |
-
$wp-button-alert-disabled-border-color: #d85e40;
|
58 |
-
|
59 |
-
$wordpress_color: #01749A;
|
60 |
-
$blogger_color: #ff8100;
|
61 |
-
$wix_color: #fac102;
|
62 |
-
$shopify_color: #80d100;
|
63 |
-
$addthis_color: #fe6d4e;
|
64 |
-
$tumblr_color: #34506b;
|
65 |
-
$zepo_color: #00baf2;
|
66 |
-
$jquery_color: #000919;
|
67 |
-
$javascript_color: #00baf2;
|
68 |
-
$squarespace_color: #000;
|
69 |
-
|
70 |
-
$blog_color: #ff6600;
|
71 |
-
$facebook_color: #3b5998;
|
72 |
-
$twitter_color: #4099ff;
|
73 |
-
$linkedin_color: #4875b4;
|
74 |
-
$youtube_color: #ff3333;
|
75 |
-
$gplus_color: #c63d2d;
|
76 |
-
|
77 |
-
// Tooltip
|
78 |
-
$tooltip-color: #fff;
|
79 |
-
$tooltip-bkg-color: rgba(0,0,0,0.8);
|
1 |
+
$menu-hover-color: #333;
|
2 |
+
$darkest-color: #000;
|
3 |
+
$fms-live-color: #71ae00;
|
4 |
+
$fms-test-color: #f7941d;
|
5 |
+
$fms-link-color: #29abe1;
|
6 |
+
$fms-link-hover-color: darken(#29abe1, 10%);
|
7 |
+
$body-bkg: #111;
|
8 |
+
$special-color: #d3135a;
|
9 |
+
$body-color: #f1f1f1;
|
10 |
+
$fms-white: #f1f1f1;
|
11 |
+
$container-bkg: #222;
|
12 |
+
$container-bkg-odd: #262626;
|
13 |
+
$container-border-color: #333;
|
14 |
+
$table-head-bkg: #333;
|
15 |
+
$table-head-color: #999;
|
16 |
+
$info-color: #999;
|
17 |
+
$error-color: #ff0000;
|
18 |
+
|
19 |
+
$fs-logo-blue-color: #29abe1;
|
20 |
+
$fs-logo-green-color: #71ae00;
|
21 |
+
$fs-logo-magenta-color: #d3135a;
|
22 |
+
|
23 |
+
// WordPress colors.
|
24 |
+
$page-header-bkg: #333;
|
25 |
+
$page-header-color: $fms-white;
|
26 |
+
$text-dark-color: #333;
|
27 |
+
$text-light-color: #666;
|
28 |
+
$text-lightest-color: #999;
|
29 |
+
|
30 |
+
// Notices.
|
31 |
+
$wp-notice-success-color: #f7fff7;
|
32 |
+
$wp-notice-success-dark-color: #46b450;
|
33 |
+
$wp-notice-error-color: #ffeaea;
|
34 |
+
$wp-notice-error-dark-color: #dc3232;
|
35 |
+
$wp-notice-warn-color: #fff8e5;
|
36 |
+
$wp-notice-warn-dark-color: #ffb900;
|
37 |
+
$fs-notice-promotion-border-color: #00a0d2;
|
38 |
+
$fs-notice-promotion-bkg: #f2fcff;
|
39 |
+
|
40 |
+
// WP Buttons.
|
41 |
+
$button-primary-bkg: #6bc406;
|
42 |
+
$button-primary-color: $fms-white;
|
43 |
+
$button-secondary-bkg: #333;
|
44 |
+
$button-secondary-color: $fms-white;
|
45 |
+
$featured-color: #6bc406;
|
46 |
+
$wp-selected-color: #0074a3;
|
47 |
+
$wp-button-alert-border-color: #d2593c;
|
48 |
+
$wp-button-alert-border-top-color: #ec6544;
|
49 |
+
$wp-button-alert-shadow-color: #d2593c;
|
50 |
+
$wp-button-alert-focused-shadow1-color: #dd6041;
|
51 |
+
$wp-button-alert-focused-shadow2-color: #e4a796;
|
52 |
+
$wp-button-alert-background-color: #f56a48;
|
53 |
+
$wp-button-alert-hovered-background-color: #fd6d4a;
|
54 |
+
$wp-button-alert-active-background-color: #dd6041;
|
55 |
+
$wp-button-alert-disabled-color: #f5b3a1;
|
56 |
+
$wp-button-alert-disabled-background-color: #e76444;
|
57 |
+
$wp-button-alert-disabled-border-color: #d85e40;
|
58 |
+
|
59 |
+
$wordpress_color: #01749A;
|
60 |
+
$blogger_color: #ff8100;
|
61 |
+
$wix_color: #fac102;
|
62 |
+
$shopify_color: #80d100;
|
63 |
+
$addthis_color: #fe6d4e;
|
64 |
+
$tumblr_color: #34506b;
|
65 |
+
$zepo_color: #00baf2;
|
66 |
+
$jquery_color: #000919;
|
67 |
+
$javascript_color: #00baf2;
|
68 |
+
$squarespace_color: #000;
|
69 |
+
|
70 |
+
$blog_color: #ff6600;
|
71 |
+
$facebook_color: #3b5998;
|
72 |
+
$twitter_color: #4099ff;
|
73 |
+
$linkedin_color: #4875b4;
|
74 |
+
$youtube_color: #ff3333;
|
75 |
+
$gplus_color: #c63d2d;
|
76 |
+
|
77 |
+
// Tooltip
|
78 |
+
$tooltip-color: #fff;
|
79 |
+
$tooltip-bkg-color: rgba(0,0,0,0.8);
|
freemius/assets/scss/admin/_buttons.scss
CHANGED
@@ -1,28 +1,28 @@
|
|
1 |
-
.button-primary.warn {
|
2 |
-
box-shadow: 0 1px 0 $wp-button-alert-shadow-color;
|
3 |
-
text-shadow: 0 -1px 1px $wp-button-alert-shadow-color, 1px 0 1px $wp-button-alert-shadow-color, 0 1px 1px $wp-button-alert-shadow-color, -1px 0 1px $wp-button-alert-shadow-color;
|
4 |
-
background: $wp-button-alert-background-color;
|
5 |
-
border-color: $wp-button-alert-border-top-color $wp-button-alert-border-color $wp-button-alert-border-color;
|
6 |
-
|
7 |
-
&:hover {
|
8 |
-
background: $wp-button-alert-hovered-background-color;
|
9 |
-
border-color: $wp-button-alert-border-color;
|
10 |
-
}
|
11 |
-
|
12 |
-
&:focus {
|
13 |
-
box-shadow: 0 1px 0 $wp-button-alert-focused-shadow1-color, 0 0 2px 1px $wp-button-alert-focused-shadow2-color;
|
14 |
-
}
|
15 |
-
|
16 |
-
&:active {
|
17 |
-
background: $wp-button-alert-active-background-color;
|
18 |
-
border-color: $wp-button-alert-border-color;
|
19 |
-
box-shadow: inset 0 2px 0 $wp-button-alert-shadow-color;
|
20 |
-
}
|
21 |
-
|
22 |
-
&.disabled {
|
23 |
-
color: $wp-button-alert-disabled-color !important;
|
24 |
-
background: $wp-button-alert-disabled-background-color !important;
|
25 |
-
border-color: $wp-button-alert-disabled-border-color !important;
|
26 |
-
text-shadow: 0 -1px 0 rgba(0,0,0,.1) !important;
|
27 |
-
}
|
28 |
}
|
1 |
+
.button-primary.warn {
|
2 |
+
box-shadow: 0 1px 0 $wp-button-alert-shadow-color;
|
3 |
+
text-shadow: 0 -1px 1px $wp-button-alert-shadow-color, 1px 0 1px $wp-button-alert-shadow-color, 0 1px 1px $wp-button-alert-shadow-color, -1px 0 1px $wp-button-alert-shadow-color;
|
4 |
+
background: $wp-button-alert-background-color;
|
5 |
+
border-color: $wp-button-alert-border-top-color $wp-button-alert-border-color $wp-button-alert-border-color;
|
6 |
+
|
7 |
+
&:hover {
|
8 |
+
background: $wp-button-alert-hovered-background-color;
|
9 |
+
border-color: $wp-button-alert-border-color;
|
10 |
+
}
|
11 |
+
|
12 |
+
&:focus {
|
13 |
+
box-shadow: 0 1px 0 $wp-button-alert-focused-shadow1-color, 0 0 2px 1px $wp-button-alert-focused-shadow2-color;
|
14 |
+
}
|
15 |
+
|
16 |
+
&:active {
|
17 |
+
background: $wp-button-alert-active-background-color;
|
18 |
+
border-color: $wp-button-alert-border-color;
|
19 |
+
box-shadow: inset 0 2px 0 $wp-button-alert-shadow-color;
|
20 |
+
}
|
21 |
+
|
22 |
+
&.disabled {
|
23 |
+
color: $wp-button-alert-disabled-color !important;
|
24 |
+
background: $wp-button-alert-disabled-background-color !important;
|
25 |
+
border-color: $wp-button-alert-disabled-border-color !important;
|
26 |
+
text-shadow: 0 -1px 0 rgba(0,0,0,.1) !important;
|
27 |
+
}
|
28 |
}
|
freemius/assets/scss/admin/_subscription-cancellation.scss
CHANGED
@@ -1,30 +1,30 @@
|
|
1 |
-
.fs-modal.fs-modal-subscription-cancellation {
|
2 |
-
.fs-price-increase-warning {
|
3 |
-
color: red;
|
4 |
-
font-weight: bold;
|
5 |
-
padding: 0 25px;
|
6 |
-
margin-bottom: 0;
|
7 |
-
}
|
8 |
-
|
9 |
-
ul.subscription-actions label {
|
10 |
-
input {
|
11 |
-
float: left;
|
12 |
-
top: 5px;
|
13 |
-
position: relative;
|
14 |
-
|
15 |
-
.rtl & {
|
16 |
-
float: right;
|
17 |
-
}
|
18 |
-
}
|
19 |
-
|
20 |
-
span {
|
21 |
-
display: block;
|
22 |
-
margin-left: 24px;
|
23 |
-
|
24 |
-
.rtl & {
|
25 |
-
margin-left: 0;
|
26 |
-
margin-right: 24px;
|
27 |
-
}
|
28 |
-
}
|
29 |
-
}
|
30 |
}
|
1 |
+
.fs-modal.fs-modal-subscription-cancellation {
|
2 |
+
.fs-price-increase-warning {
|
3 |
+
color: red;
|
4 |
+
font-weight: bold;
|
5 |
+
padding: 0 25px;
|
6 |
+
margin-bottom: 0;
|
7 |
+
}
|
8 |
+
|
9 |
+
ul.subscription-actions label {
|
10 |
+
input {
|
11 |
+
float: left;
|
12 |
+
top: 5px;
|
13 |
+
position: relative;
|
14 |
+
|
15 |
+
.rtl & {
|
16 |
+
float: right;
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
span {
|
21 |
+
display: block;
|
22 |
+
margin-left: 24px;
|
23 |
+
|
24 |
+
.rtl & {
|
25 |
+
margin-left: 0;
|
26 |
+
margin-right: 24px;
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
}
|
freemius/assets/scss/admin/dialog-boxes.scss
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
@import "../start";
|
2 |
-
@import "modal-common";
|
3 |
-
@import "deactivation-feedback";
|
4 |
-
@import "subscription-cancellation";
|
5 |
-
@import "license-activation";
|
6 |
-
@import "multisite-options";
|
7 |
-
@import "license-key-resend";
|
8 |
-
@import "ajax-loader";
|
9 |
-
@import "auto-install";
|
10 |
@import "buttons";
|
1 |
+
@import "../start";
|
2 |
+
@import "modal-common";
|
3 |
+
@import "deactivation-feedback";
|
4 |
+
@import "subscription-cancellation";
|
5 |
+
@import "license-activation";
|
6 |
+
@import "multisite-options";
|
7 |
+
@import "license-key-resend";
|
8 |
+
@import "ajax-loader";
|
9 |
+
@import "auto-install";
|
10 |
@import "buttons";
|
freemius/assets/scss/admin/plugin-upgrade-notice.scss
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
.plugins p.upgrade-notice
|
2 |
-
{
|
3 |
-
border: 0;
|
4 |
-
background-color: #d54e21;
|
5 |
-
padding: 10px;
|
6 |
-
color: #f9f9f9;
|
7 |
-
margin-top: 10px;
|
8 |
}
|
1 |
+
.plugins p.upgrade-notice
|
2 |
+
{
|
3 |
+
border: 0;
|
4 |
+
background-color: #d54e21;
|
5 |
+
padding: 10px;
|
6 |
+
color: #f9f9f9;
|
7 |
+
margin-top: 10px;
|
8 |
}
|
freemius/includes/entities/class-fs-plugin.php
CHANGED
@@ -1,142 +1,142 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_Plugin extends FS_Scope_Entity {
|
14 |
-
/**
|
15 |
-
* @since 1.0.6
|
16 |
-
* @var null|number
|
17 |
-
*/
|
18 |
-
public $parent_plugin_id;
|
19 |
-
/**
|
20 |
-
* @var string
|
21 |
-
*/
|
22 |
-
public $title;
|
23 |
-
/**
|
24 |
-
* @var string
|
25 |
-
*/
|
26 |
-
public $slug;
|
27 |
-
/**
|
28 |
-
* @author Leo Fajardo (@leorw)
|
29 |
-
* @since 2.2.1
|
30 |
-
*
|
31 |
-
* @var string
|
32 |
-
*/
|
33 |
-
public $premium_slug;
|
34 |
-
/**
|
35 |
-
* @since 1.2.2
|
36 |
-
*
|
37 |
-
* @var string 'plugin' or 'theme'
|
38 |
-
*/
|
39 |
-
public $type;
|
40 |
-
/**
|
41 |
-
* @author Leo Fajardo (@leorw)
|
42 |
-
*
|
43 |
-
* @since 1.2.3
|
44 |
-
*
|
45 |
-
* @var string|false false if the module doesn't have an affiliate program or one of the following: 'selected', 'customers', or 'all'.
|
46 |
-
*/
|
47 |
-
public $affiliate_moderation;
|
48 |
-
/**
|
49 |
-
* @var bool Set to true if the free version of the module is hosted on WordPress.org. Defaults to true.
|
50 |
-
*/
|
51 |
-
public $is_wp_org_compliant = true;
|
52 |
-
|
53 |
-
#region Install Specific Properties
|
54 |
-
|
55 |
-
/**
|
56 |
-
* @var string
|
57 |
-
*/
|
58 |
-
public $file;
|
59 |
-
/**
|
60 |
-
* @var string
|
61 |
-
*/
|
62 |
-
public $version;
|
63 |
-
/**
|
64 |
-
* @var bool
|
65 |
-
*/
|
66 |
-
public $auto_update;
|
67 |
-
/**
|
68 |
-
* @var FS_Plugin_Info
|
69 |
-
*/
|
70 |
-
public $info;
|
71 |
-
/**
|
72 |
-
* @since 1.0.9
|
73 |
-
*
|
74 |
-
* @var bool
|
75 |
-
*/
|
76 |
-
public $is_premium;
|
77 |
-
/**
|
78 |
-
* @author Leo Fajardo (@leorw)
|
79 |
-
* @since 2.2.1
|
80 |
-
*
|
81 |
-
* @var string
|
82 |
-
*/
|
83 |
-
public $premium_suffix;
|
84 |
-
/**
|
85 |
-
* @since 1.0.9
|
86 |
-
*
|
87 |
-
* @var bool
|
88 |
-
*/
|
89 |
-
public $is_live;
|
90 |
-
|
91 |
-
const AFFILIATE_MODERATION_CUSTOMERS = 'customers';
|
92 |
-
|
93 |
-
#endregion Install Specific Properties
|
94 |
-
|
95 |
-
/**
|
96 |
-
* @param stdClass|bool $plugin
|
97 |
-
*/
|
98 |
-
function __construct( $plugin = false ) {
|
99 |
-
parent::__construct( $plugin );
|
100 |
-
|
101 |
-
$this->is_premium = false;
|
102 |
-
$this->is_live = true;
|
103 |
-
|
104 |
-
if ( empty( $this->premium_slug ) && ! empty( $plugin->slug ) ) {
|
105 |
-
$this->premium_slug = "{$this->slug}-premium";
|
106 |
-
}
|
107 |
-
|
108 |
-
if ( empty( $this->premium_suffix ) ) {
|
109 |
-
$this->premium_suffix = '(Premium)';
|
110 |
-
}
|
111 |
-
|
112 |
-
if ( isset( $plugin->info ) && is_object( $plugin->info ) ) {
|
113 |
-
$this->info = new FS_Plugin_Info( $plugin->info );
|
114 |
-
}
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Check if plugin is an add-on (has parent).
|
119 |
-
*
|
120 |
-
* @author Vova Feldman (@svovaf)
|
121 |
-
* @since 1.0.6
|
122 |
-
*
|
123 |
-
* @return bool
|
124 |
-
*/
|
125 |
-
function is_addon() {
|
126 |
-
return isset( $this->parent_plugin_id ) && is_numeric( $this->parent_plugin_id );
|
127 |
-
}
|
128 |
-
|
129 |
-
/**
|
130 |
-
* @author Leo Fajardo (@leorw)
|
131 |
-
* @since 1.2.3
|
132 |
-
*
|
133 |
-
* @return bool
|
134 |
-
*/
|
135 |
-
function has_affiliate_program() {
|
136 |
-
return ( ! empty( $this->affiliate_moderation ) );
|
137 |
-
}
|
138 |
-
|
139 |
-
static function get_type() {
|
140 |
-
return 'plugin';
|
141 |
-
}
|
142 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_Plugin extends FS_Scope_Entity {
|
14 |
+
/**
|
15 |
+
* @since 1.0.6
|
16 |
+
* @var null|number
|
17 |
+
*/
|
18 |
+
public $parent_plugin_id;
|
19 |
+
/**
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
+
public $title;
|
23 |
+
/**
|
24 |
+
* @var string
|
25 |
+
*/
|
26 |
+
public $slug;
|
27 |
+
/**
|
28 |
+
* @author Leo Fajardo (@leorw)
|
29 |
+
* @since 2.2.1
|
30 |
+
*
|
31 |
+
* @var string
|
32 |
+
*/
|
33 |
+
public $premium_slug;
|
34 |
+
/**
|
35 |
+
* @since 1.2.2
|
36 |
+
*
|
37 |
+
* @var string 'plugin' or 'theme'
|
38 |
+
*/
|
39 |
+
public $type;
|
40 |
+
/**
|
41 |
+
* @author Leo Fajardo (@leorw)
|
42 |
+
*
|
43 |
+
* @since 1.2.3
|
44 |
+
*
|
45 |
+
* @var string|false false if the module doesn't have an affiliate program or one of the following: 'selected', 'customers', or 'all'.
|
46 |
+
*/
|
47 |
+
public $affiliate_moderation;
|
48 |
+
/**
|
49 |
+
* @var bool Set to true if the free version of the module is hosted on WordPress.org. Defaults to true.
|
50 |
+
*/
|
51 |
+
public $is_wp_org_compliant = true;
|
52 |
+
|
53 |
+
#region Install Specific Properties
|
54 |
+
|
55 |
+
/**
|
56 |
+
* @var string
|
57 |
+
*/
|
58 |
+
public $file;
|
59 |
+
/**
|
60 |
+
* @var string
|
61 |
+
*/
|
62 |
+
public $version;
|
63 |
+
/**
|
64 |
+
* @var bool
|
65 |
+
*/
|
66 |
+
public $auto_update;
|
67 |
+
/**
|
68 |
+
* @var FS_Plugin_Info
|
69 |
+
*/
|
70 |
+
public $info;
|
71 |
+
/**
|
72 |
+
* @since 1.0.9
|
73 |
+
*
|
74 |
+
* @var bool
|
75 |
+
*/
|
76 |
+
public $is_premium;
|
77 |
+
/**
|
78 |
+
* @author Leo Fajardo (@leorw)
|
79 |
+
* @since 2.2.1
|
80 |
+
*
|
81 |
+
* @var string
|
82 |
+
*/
|
83 |
+
public $premium_suffix;
|
84 |
+
/**
|
85 |
+
* @since 1.0.9
|
86 |
+
*
|
87 |
+
* @var bool
|
88 |
+
*/
|
89 |
+
public $is_live;
|
90 |
+
|
91 |
+
const AFFILIATE_MODERATION_CUSTOMERS = 'customers';
|
92 |
+
|
93 |
+
#endregion Install Specific Properties
|
94 |
+
|
95 |
+
/**
|
96 |
+
* @param stdClass|bool $plugin
|
97 |
+
*/
|
98 |
+
function __construct( $plugin = false ) {
|
99 |
+
parent::__construct( $plugin );
|
100 |
+
|
101 |
+
$this->is_premium = false;
|
102 |
+
$this->is_live = true;
|
103 |
+
|
104 |
+
if ( empty( $this->premium_slug ) && ! empty( $plugin->slug ) ) {
|
105 |
+
$this->premium_slug = "{$this->slug}-premium";
|
106 |
+
}
|
107 |
+
|
108 |
+
if ( empty( $this->premium_suffix ) ) {
|
109 |
+
$this->premium_suffix = '(Premium)';
|
110 |
+
}
|
111 |
+
|
112 |
+
if ( isset( $plugin->info ) && is_object( $plugin->info ) ) {
|
113 |
+
$this->info = new FS_Plugin_Info( $plugin->info );
|
114 |
+
}
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Check if plugin is an add-on (has parent).
|
119 |
+
*
|
120 |
+
* @author Vova Feldman (@svovaf)
|
121 |
+
* @since 1.0.6
|
122 |
+
*
|
123 |
+
* @return bool
|
124 |
+
*/
|
125 |
+
function is_addon() {
|
126 |
+
return isset( $this->parent_plugin_id ) && is_numeric( $this->parent_plugin_id );
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* @author Leo Fajardo (@leorw)
|
131 |
+
* @since 1.2.3
|
132 |
+
*
|
133 |
+
* @return bool
|
134 |
+
*/
|
135 |
+
function has_affiliate_program() {
|
136 |
+
return ( ! empty( $this->affiliate_moderation ) );
|
137 |
+
}
|
138 |
+
|
139 |
+
static function get_type() {
|
140 |
+
return 'plugin';
|
141 |
+
}
|
142 |
}
|
freemius/includes/entities/class-fs-site.php
CHANGED
@@ -1,230 +1,230 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.0.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_Site extends FS_Scope_Entity {
|
14 |
-
/**
|
15 |
-
* @var number
|
16 |
-
*/
|
17 |
-
public $site_id;
|
18 |
-
/**
|
19 |
-
* @var number
|
20 |
-
*/
|
21 |
-
public $plugin_id;
|
22 |
-
/**
|
23 |
-
* @var number
|
24 |
-
*/
|
25 |
-
public $user_id;
|
26 |
-
/**
|
27 |
-
* @var string
|
28 |
-
*/
|
29 |
-
public $title;
|
30 |
-
/**
|
31 |
-
* @var string
|
32 |
-
*/
|
33 |
-
public $url;
|
34 |
-
/**
|
35 |
-
* @var string
|
36 |
-
*/
|
37 |
-
public $version;
|
38 |
-
/**
|
39 |
-
* @var string E.g. en-GB
|
40 |
-
*/
|
41 |
-
public $language;
|
42 |
-
/**
|
43 |
-
* @var string E.g. UTF-8
|
44 |
-
*/
|
45 |
-
public $charset;
|
46 |
-
/**
|
47 |
-
* @var string Platform version (e.g WordPress version).
|
48 |
-
*/
|
49 |
-
public $platform_version;
|
50 |
-
/**
|
51 |
-
* Freemius SDK version
|
52 |
-
*
|
53 |
-
* @author Leo Fajardo (@leorw)
|
54 |
-
* @since 1.2.2
|
55 |
-
*
|
56 |
-
* @var string SDK version (e.g.: 1.2.2)
|
57 |
-
*/
|
58 |
-
public $sdk_version;
|
59 |
-
/**
|
60 |
-
* @var string Programming language version (e.g PHP version).
|
61 |
-
*/
|
62 |
-
public $programming_language_version;
|
63 |
-
/**
|
64 |
-
* @var number|null
|
65 |
-
*/
|
66 |
-
public $plan_id;
|
67 |
-
/**
|
68 |
-
* @var number|null
|
69 |
-
*/
|
70 |
-
public $license_id;
|
71 |
-
/**
|
72 |
-
* @var number|null
|
73 |
-
*/
|
74 |
-
public $trial_plan_id;
|
75 |
-
/**
|
76 |
-
* @var string|null
|
77 |
-
*/
|
78 |
-
public $trial_ends;
|
79 |
-
/**
|
80 |
-
* @since 1.0.9
|
81 |
-
*
|
82 |
-
* @var bool
|
83 |
-
*/
|
84 |
-
public $is_premium = false;
|
85 |
-
/**
|
86 |
-
* @author Leo Fajardo (@leorw)
|
87 |
-
*
|
88 |
-
* @since 1.2.1.5
|
89 |
-
*
|
90 |
-
* @var bool
|
91 |
-
*/
|
92 |
-
public $is_disconnected = false;
|
93 |
-
/**
|
94 |
-
* @since 2.0.0
|
95 |
-
*
|
96 |
-
* @var bool
|
97 |
-
*/
|
98 |
-
public $is_active = true;
|
99 |
-
/**
|
100 |
-
* @since 2.0.0
|
101 |
-
*
|
102 |
-
* @var bool
|
103 |
-
*/
|
104 |
-
public $is_uninstalled = false;
|
105 |
-
|
106 |
-
/**
|
107 |
-
* @param stdClass|bool $site
|
108 |
-
*/
|
109 |
-
function __construct( $site = false ) {
|
110 |
-
parent::__construct( $site );
|
111 |
-
|
112 |
-
if ( is_object( $site ) ) {
|
113 |
-
$this->plan_id = $site->plan_id;
|
114 |
-
}
|
115 |
-
|
116 |
-
if ( ! is_bool( $this->is_disconnected ) ) {
|
117 |
-
$this->is_disconnected = false;
|
118 |
-
}
|
119 |
-
}
|
120 |
-
|
121 |
-
static function get_type() {
|
122 |
-
return 'install';
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* @author Vova Feldman (@svovaf)
|
127 |
-
* @since 2.0.0
|
128 |
-
*
|
129 |
-
* @param string $url
|
130 |
-
*
|
131 |
-
* @return bool
|
132 |
-
*/
|
133 |
-
static function is_localhost_by_address( $url ) {
|
134 |
-
if ( false !== strpos( $url, '127.0.0.1' ) ||
|
135 |
-
false !== strpos( $url, 'localhost' )
|
136 |
-
) {
|
137 |
-
return true;
|
138 |
-
}
|
139 |
-
|
140 |
-
if ( ! fs_starts_with( $url, 'http' ) ) {
|
141 |
-
$url = 'http://' . $url;
|
142 |
-
}
|
143 |
-
|
144 |
-
$url_parts = parse_url( $url );
|
145 |
-
|
146 |
-
$subdomain = $url_parts['host'];
|
147 |
-
|
148 |
-
return (
|
149 |
-
// Starts with.
|
150 |
-
fs_starts_with( $subdomain, 'local.' ) ||
|
151 |
-
fs_starts_with( $subdomain, 'dev.' ) ||
|
152 |
-
fs_starts_with( $subdomain, 'test.' ) ||
|
153 |
-
fs_starts_with( $subdomain, 'stage.' ) ||
|
154 |
-
fs_starts_with( $subdomain, 'staging.' ) ||
|
155 |
-
|
156 |
-
// Ends with.
|
157 |
-
fs_ends_with( $subdomain, '.dev' ) ||
|
158 |
-
fs_ends_with( $subdomain, '.test' ) ||
|
159 |
-
fs_ends_with( $subdomain, '.staging' ) ||
|
160 |
-
fs_ends_with( $subdomain, '.local' ) ||
|
161 |
-
fs_ends_with( $subdomain, '.example' ) ||
|
162 |
-
fs_ends_with( $subdomain, '.invalid' ) ||
|
163 |
-
// GoDaddy test/dev.
|
164 |
-
fs_ends_with( $subdomain, '.myftpupload.com' ) ||
|
165 |
-
// ngrok tunneling.
|
166 |
-
fs_ends_with( $subdomain, '.ngrok.io' ) ||
|
167 |
-
// wpsandbox.
|
168 |
-
fs_ends_with( $subdomain, '.wpsandbox.pro' ) ||
|
169 |
-
// SiteGround staging.
|
170 |
-
fs_starts_with( $subdomain, 'staging' ) ||
|
171 |
-
// WPEngine staging.
|
172 |
-
fs_ends_with( $subdomain, '.staging.wpengine.com' ) ||
|
173 |
-
// Pantheon
|
174 |
-
( fs_ends_with($subdomain, 'pantheonsite.io') &&
|
175 |
-
(fs_starts_with($subdomain, 'test-') || fs_starts_with($subdomain, 'dev-'))) ||
|
176 |
-
// Cloudways
|
177 |
-
fs_ends_with( $subdomain, '.cloudwaysapps.com' ) ||
|
178 |
-
// Kinsta
|
179 |
-
(fs_ends_with($subdomain, '.kinsta.com') && fs_starts_with($subdomain, 'staging-'))
|
180 |
-
);
|
181 |
-
}
|
182 |
-
|
183 |
-
function is_localhost() {
|
184 |
-
return ( WP_FS__IS_LOCALHOST_FOR_SERVER || self::is_localhost_by_address( $this->url ) );
|
185 |
-
}
|
186 |
-
|
187 |
-
/**
|
188 |
-
* Check if site in trial.
|
189 |
-
*
|
190 |
-
* @author Vova Feldman (@svovaf)
|
191 |
-
* @since 1.0.9
|
192 |
-
*
|
193 |
-
* @return bool
|
194 |
-
*/
|
195 |
-
function is_trial() {
|
196 |
-
return is_numeric( $this->trial_plan_id ) && ( strtotime( $this->trial_ends ) > WP_FS__SCRIPT_START_TIME );
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Check if user already utilized the trial with the current install.
|
201 |
-
*
|
202 |
-
* @author Vova Feldman (@svovaf)
|
203 |
-
* @since 1.0.9
|
204 |
-
*
|
205 |
-
* @return bool
|
206 |
-
*/
|
207 |
-
function is_trial_utilized() {
|
208 |
-
return is_numeric( $this->trial_plan_id );
|
209 |
-
}
|
210 |
-
|
211 |
-
/**
|
212 |
-
* @author Vova Feldman (@svovaf)
|
213 |
-
* @since 2.0.0
|
214 |
-
*
|
215 |
-
* @return bool
|
216 |
-
*/
|
217 |
-
function is_tracking_allowed() {
|
218 |
-
return ( true !== $this->is_disconnected );
|
219 |
-
}
|
220 |
-
|
221 |
-
/**
|
222 |
-
* @author Vova Feldman (@svovaf)
|
223 |
-
* @since 2.0.0
|
224 |
-
*
|
225 |
-
* @return bool
|
226 |
-
*/
|
227 |
-
function is_tracking_prohibited() {
|
228 |
-
return ! $this->is_tracking_allowed();
|
229 |
-
}
|
230 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.0.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_Site extends FS_Scope_Entity {
|
14 |
+
/**
|
15 |
+
* @var number
|
16 |
+
*/
|
17 |
+
public $site_id;
|
18 |
+
/**
|
19 |
+
* @var number
|
20 |
+
*/
|
21 |
+
public $plugin_id;
|
22 |
+
/**
|
23 |
+
* @var number
|
24 |
+
*/
|
25 |
+
public $user_id;
|
26 |
+
/**
|
27 |
+
* @var string
|
28 |
+
*/
|
29 |
+
public $title;
|
30 |
+
/**
|
31 |
+
* @var string
|
32 |
+
*/
|
33 |
+
public $url;
|
34 |
+
/**
|
35 |
+
* @var string
|
36 |
+
*/
|
37 |
+
public $version;
|
38 |
+
/**
|
39 |
+
* @var string E.g. en-GB
|
40 |
+
*/
|
41 |
+
public $language;
|
42 |
+
/**
|
43 |
+
* @var string E.g. UTF-8
|
44 |
+
*/
|
45 |
+
public $charset;
|
46 |
+
/**
|
47 |
+
* @var string Platform version (e.g WordPress version).
|
48 |
+
*/
|
49 |
+
public $platform_version;
|
50 |
+
/**
|
51 |
+
* Freemius SDK version
|
52 |
+
*
|
53 |
+
* @author Leo Fajardo (@leorw)
|
54 |
+
* @since 1.2.2
|
55 |
+
*
|
56 |
+
* @var string SDK version (e.g.: 1.2.2)
|
57 |
+
*/
|
58 |
+
public $sdk_version;
|
59 |
+
/**
|
60 |
+
* @var string Programming language version (e.g PHP version).
|
61 |
+
*/
|
62 |
+
public $programming_language_version;
|
63 |
+
/**
|
64 |
+
* @var number|null
|
65 |
+
*/
|
66 |
+
public $plan_id;
|
67 |
+
/**
|
68 |
+
* @var number|null
|
69 |
+
*/
|
70 |
+
public $license_id;
|
71 |
+
/**
|
72 |
+
* @var number|null
|
73 |
+
*/
|
74 |
+
public $trial_plan_id;
|
75 |
+
/**
|
76 |
+
* @var string|null
|
77 |
+
*/
|
78 |
+
public $trial_ends;
|
79 |
+
/**
|
80 |
+
* @since 1.0.9
|
81 |
+
*
|
82 |
+
* @var bool
|
83 |
+
*/
|
84 |
+
public $is_premium = false;
|
85 |
+
/**
|
86 |
+
* @author Leo Fajardo (@leorw)
|
87 |
+
*
|
88 |
+
* @since 1.2.1.5
|
89 |
+
*
|
90 |
+
* @var bool
|
91 |
+
*/
|
92 |
+
public $is_disconnected = false;
|
93 |
+
/**
|
94 |
+
* @since 2.0.0
|
95 |
+
*
|
96 |
+
* @var bool
|
97 |
+
*/
|
98 |
+
public $is_active = true;
|
99 |
+
/**
|
100 |
+
* @since 2.0.0
|
101 |
+
*
|
102 |
+
* @var bool
|
103 |
+
*/
|
104 |
+
public $is_uninstalled = false;
|
105 |
+
|
106 |
+
/**
|
107 |
+
* @param stdClass|bool $site
|
108 |
+
*/
|
109 |
+
function __construct( $site = false ) {
|
110 |
+
parent::__construct( $site );
|
111 |
+
|
112 |
+
if ( is_object( $site ) ) {
|
113 |
+
$this->plan_id = $site->plan_id;
|
114 |
+
}
|
115 |
+
|
116 |
+
if ( ! is_bool( $this->is_disconnected ) ) {
|
117 |
+
$this->is_disconnected = false;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
static function get_type() {
|
122 |
+
return 'install';
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* @author Vova Feldman (@svovaf)
|
127 |
+
* @since 2.0.0
|
128 |
+
*
|
129 |
+
* @param string $url
|
130 |
+
*
|
131 |
+
* @return bool
|
132 |
+
*/
|
133 |
+
static function is_localhost_by_address( $url ) {
|
134 |
+
if ( false !== strpos( $url, '127.0.0.1' ) ||
|
135 |
+
false !== strpos( $url, 'localhost' )
|
136 |
+
) {
|
137 |
+
return true;
|
138 |
+
}
|
139 |
+
|
140 |
+
if ( ! fs_starts_with( $url, 'http' ) ) {
|
141 |
+
$url = 'http://' . $url;
|
142 |
+
}
|
143 |
+
|
144 |
+
$url_parts = parse_url( $url );
|
145 |
+
|
146 |
+
$subdomain = $url_parts['host'];
|
147 |
+
|
148 |
+
return (
|
149 |
+
// Starts with.
|
150 |
+
fs_starts_with( $subdomain, 'local.' ) ||
|
151 |
+
fs_starts_with( $subdomain, 'dev.' ) ||
|
152 |
+
fs_starts_with( $subdomain, 'test.' ) ||
|
153 |
+
fs_starts_with( $subdomain, 'stage.' ) ||
|
154 |
+
fs_starts_with( $subdomain, 'staging.' ) ||
|
155 |
+
|
156 |
+
// Ends with.
|
157 |
+
fs_ends_with( $subdomain, '.dev' ) ||
|
158 |
+
fs_ends_with( $subdomain, '.test' ) ||
|
159 |
+
fs_ends_with( $subdomain, '.staging' ) ||
|
160 |
+
fs_ends_with( $subdomain, '.local' ) ||
|
161 |
+
fs_ends_with( $subdomain, '.example' ) ||
|
162 |
+
fs_ends_with( $subdomain, '.invalid' ) ||
|
163 |
+
// GoDaddy test/dev.
|
164 |
+
fs_ends_with( $subdomain, '.myftpupload.com' ) ||
|
165 |
+
// ngrok tunneling.
|
166 |
+
fs_ends_with( $subdomain, '.ngrok.io' ) ||
|
167 |
+
// wpsandbox.
|
168 |
+
fs_ends_with( $subdomain, '.wpsandbox.pro' ) ||
|
169 |
+
// SiteGround staging.
|
170 |
+
fs_starts_with( $subdomain, 'staging' ) ||
|
171 |
+
// WPEngine staging.
|
172 |
+
fs_ends_with( $subdomain, '.staging.wpengine.com' ) ||
|
173 |
+
// Pantheon
|
174 |
+
( fs_ends_with($subdomain, 'pantheonsite.io') &&
|
175 |
+
(fs_starts_with($subdomain, 'test-') || fs_starts_with($subdomain, 'dev-'))) ||
|
176 |
+
// Cloudways
|
177 |
+
fs_ends_with( $subdomain, '.cloudwaysapps.com' ) ||
|
178 |
+
// Kinsta
|
179 |
+
(fs_ends_with($subdomain, '.kinsta.com') && fs_starts_with($subdomain, 'staging-'))
|
180 |
+
);
|
181 |
+
}
|
182 |
+
|
183 |
+
function is_localhost() {
|
184 |
+
return ( WP_FS__IS_LOCALHOST_FOR_SERVER || self::is_localhost_by_address( $this->url ) );
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Check if site in trial.
|
189 |
+
*
|
190 |
+
* @author Vova Feldman (@svovaf)
|
191 |
+
* @since 1.0.9
|
192 |
+
*
|
193 |
+
* @return bool
|
194 |
+
*/
|
195 |
+
function is_trial() {
|
196 |
+
return is_numeric( $this->trial_plan_id ) && ( strtotime( $this->trial_ends ) > WP_FS__SCRIPT_START_TIME );
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Check if user already utilized the trial with the current install.
|
201 |
+
*
|
202 |
+
* @author Vova Feldman (@svovaf)
|
203 |
+
* @since 1.0.9
|
204 |
+
*
|
205 |
+
* @return bool
|
206 |
+
*/
|
207 |
+
function is_trial_utilized() {
|
208 |
+
return is_numeric( $this->trial_plan_id );
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* @author Vova Feldman (@svovaf)
|
213 |
+
* @since 2.0.0
|
214 |
+
*
|
215 |
+
* @return bool
|
216 |
+
*/
|
217 |
+
function is_tracking_allowed() {
|
218 |
+
return ( true !== $this->is_disconnected );
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* @author Vova Feldman (@svovaf)
|
223 |
+
* @since 2.0.0
|
224 |
+
*
|
225 |
+
* @return bool
|
226 |
+
*/
|
227 |
+
function is_tracking_prohibited() {
|
228 |
+
return ! $this->is_tracking_allowed();
|
229 |
+
}
|
230 |
}
|
freemius/includes/managers/class-fs-admin-menu-manager.php
CHANGED
@@ -1,969 +1,969 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* @package Freemius
|
4 |
-
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
-
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
-
* @since 1.1.3
|
7 |
-
*/
|
8 |
-
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
-
exit;
|
11 |
-
}
|
12 |
-
|
13 |
-
class FS_Admin_Menu_Manager {
|
14 |
-
|
15 |
-
#region Properties
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @since 1.2.2
|
19 |
-
*
|
20 |
-
* @var string
|
21 |
-
*/
|
22 |
-
protected $_module_unique_affix;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @since 1.2.2
|
26 |
-
*
|
27 |
-
* @var number
|
28 |
-
*/
|
29 |
-
protected $_module_id;
|
30 |
-
|
31 |
-
/**
|
32 |
-
* @since 1.2.2
|
33 |
-
*
|
34 |
-
* @var string
|
35 |
-
*/
|
36 |
-
protected $_module_type;
|
37 |
-
|
38 |
-
/**
|
39 |
-
* @since 1.0.6
|
40 |
-
*
|
41 |
-
* @var string
|
42 |
-
*/
|
43 |
-
private $_menu_slug;
|
44 |
-
/**
|
45 |
-
* @since 1.1.3
|
46 |
-
*
|
47 |
-
* @var string
|
48 |
-
*/
|
49 |
-
private $_parent_slug;
|
50 |
-
/**
|
51 |
-
* @since 1.1.3
|
52 |
-
*
|
53 |
-
* @var string
|
54 |
-
*/
|
55 |
-
private $_parent_type;
|
56 |
-
/**
|
57 |
-
* @since 1.1.3
|
58 |
-
*
|
59 |
-
* @var string
|
60 |
-
*/
|
61 |
-
private $_type;
|
62 |
-
/**
|
63 |
-
* @since 1.1.3
|
64 |
-
*
|
65 |
-
* @var bool
|
66 |
-
*/
|
67 |
-
private $_is_top_level;
|
68 |
-
/**
|
69 |
-
* @since 1.1.3
|
70 |
-
*
|
71 |
-
* @var bool
|
72 |
-
*/
|
73 |
-
private $_is_override_exact;
|
74 |
-
/**
|
75 |
-
* @since 1.1.3
|
76 |
-
*
|
77 |
-
* @var array<string,bool>
|
78 |
-
*/
|
79 |
-
private $_default_submenu_items;
|
80 |
-
/**
|
81 |
-
* @since 1.1.3
|
82 |
-
*
|
83 |
-
* @var string
|
84 |
-
*/
|
85 |
-
private $_first_time_path;
|
86 |
-
/**
|
87 |
-
* @since 1.2.2
|
88 |
-
*
|
89 |
-
* @var bool
|
90 |
-
*/
|
91 |
-
private $_menu_exists;
|
92 |
-
/**
|
93 |
-
* @since 2.0.0
|
94 |
-
*
|
95 |
-
* @var bool
|
96 |
-
*/
|
97 |
-
private $_network_menu_exists;
|
98 |
-
|
99 |
-
#endregion Properties
|
100 |
-
|
101 |
-
/**
|
102 |
-
* @var FS_Logger
|
103 |
-
*/
|
104 |
-
protected $_logger;
|
105 |
-
|
106 |
-
#region Singleton
|
107 |
-
|
108 |
-
/**
|
109 |
-
* @var FS_Admin_Menu_Manager[]
|
110 |
-
*/
|
111 |
-
private static $_instances = array();
|
112 |
-
|
113 |
-
/**
|
114 |
-
* @param number $module_id
|
115 |
-
* @param string $module_type
|
116 |
-
* @param string $module_unique_affix
|
117 |
-
*
|
118 |
-
* @return FS_Admin_Menu_Manager
|
119 |
-
*/
|
120 |
-
static function instance( $module_id, $module_type, $module_unique_affix ) {
|
121 |
-
$key = 'm_' . $module_id;
|
122 |
-
|
123 |
-
if ( ! isset( self::$_instances[ $key ] ) ) {
|
124 |
-
self::$_instances[ $key ] = new FS_Admin_Menu_Manager( $module_id, $module_type, $module_unique_affix );
|
125 |
-
}
|
126 |
-
|
127 |
-
return self::$_instances[ $key ];
|
128 |
-
}
|
129 |
-
|
130 |
-
protected function __construct( $module_id, $module_type, $module_unique_affix ) {
|
131 |
-
$this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $module_id . '_admin_menu', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
|
132 |
-
|
133 |
-
$this->_module_id = $module_id;
|
134 |
-
$this->_module_type = $module_type;
|
135 |
-
$this->_module_unique_affix = $module_unique_affix;
|
136 |
-
}
|
137 |
-
|
138 |
-
#endregion Singleton
|
139 |
-
|
140 |
-
#region Helpers
|
141 |
-
|
142 |
-
private function get_option( &$options, $key, $default = false ) {
|
143 |
-
return ! empty( $options[ $key ] ) ? $options[ $key ] : $default;
|
144 |
-
}
|
145 |
-
|
146 |
-
private function get_bool_option( &$options, $key, $default = false ) {
|
147 |
-
return isset( $options[ $key ] ) && is_bool( $options[ $key ] ) ? $options[ $key ] : $default;
|
148 |
-
}
|
149 |
-
|
150 |
-
#endregion Helpers
|
151 |
-
|
152 |
-
/**
|
153 |
-
* @param array $menu
|
154 |
-
* @param bool $is_addon
|
155 |
-
*/
|
156 |
-
function init( $menu, $is_addon = false ) {
|
157 |
-
$this->_menu_exists = ( isset( $menu['slug'] ) && ! empty( $menu['slug'] ) );
|
158 |
-
$this->_network_menu_exists = ( ! empty( $menu['network'] ) && true === $menu['network'] );
|
159 |
-
|
160 |
-
$this->_menu_slug = ( $this->_menu_exists ? $menu['slug'] : $this->_module_unique_affix );
|
161 |
-
|
162 |
-
$this->_default_submenu_items = array();
|
163 |
-
// @deprecated
|
164 |
-
$this->_type = 'page';
|
165 |
-
$this->_is_top_level = true;
|
166 |
-
$this->_is_override_exact = false;
|
167 |
-
$this->_parent_slug = false;
|
168 |
-
// @deprecated
|
169 |
-
$this->_parent_type = 'page';
|
170 |
-
|
171 |
-
if ( isset( $menu ) ) {
|
172 |
-
if ( ! $is_addon ) {
|
173 |
-
$this->_default_submenu_items = array(
|
174 |
-
'contact' => $this->get_bool_option( $menu, 'contact', true ),
|
175 |
-
'support' => $this->get_bool_option( $menu, 'support', true ),
|
176 |
-
'affiliation' => $this->get_bool_option( $menu, 'affiliation', true ),
|
177 |
-
'account' => $this->get_bool_option( $menu, 'account', true ),
|
178 |
-
'pricing' => $this->get_bool_option( $menu, 'pricing', true ),
|
179 |
-
'addons' => $this->get_bool_option( $menu, 'addons', true ),
|
180 |
-
);
|
181 |
-
|
182 |
-
// @deprecated
|
183 |
-
$this->_type = $this->get_option( $menu, 'type', 'page' );
|
184 |
-
|
185 |
-
$this->_first_time_path = $this->get_option( $menu, 'first-path', false );
|
186 |
-
if ( ! empty( $this->_first_time_path ) && is_string( $this->_first_time_path ) ) {
|
187 |
-
$this->_first_time_path = admin_url( $this->_first_time_path, 'admin' );
|
188 |
-
}
|
189 |
-
}
|
190 |
-
|
191 |
-
$this->_is_override_exact = $this->get_bool_option( $menu, 'override_exact' );
|
192 |
-
|
193 |
-
if ( isset( $menu['parent'] ) ) {
|
194 |
-
$this->_parent_slug = $this->get_option( $menu['parent'], 'slug' );
|
195 |
-
// @deprecated
|
196 |
-
$this->_parent_type = $this->get_option( $menu['parent'], 'type', 'page' );
|
197 |
-
|
198 |
-
// If parent's slug is different, then it's NOT a top level menu item.
|
199 |
-
$this->_is_top_level = ( $this->_parent_slug === $this->_menu_slug );
|
200 |
-
} else {
|
201 |
-
/**
|
202 |
-
* If no parent then top level if:
|
203 |
-
* - Has custom admin menu ('page')
|
204 |
-
* - CPT menu type ('cpt')
|
205 |
-
*/
|
206 |
-
// $this->_is_top_level = in_array( $this->_type, array(
|
207 |
-
// 'cpt',
|
208 |
-
// 'page'
|
209 |
-
// ) );
|
210 |
-
}
|
211 |
-
}
|
212 |
-
}
|
213 |
-
|
214 |
-
/**
|
215 |
-
* Check if top level menu.
|
216 |
-
*
|
217 |
-
* @author Vova Feldman (@svovaf)
|
218 |
-
* @since 1.1.3
|
219 |
-
*
|
220 |
-
* @return bool False if submenu item.
|
221 |
-
*/
|
222 |
-
function is_top_level() {
|
223 |
-
return $this->_is_top_level;
|
224 |
-
}
|
225 |
-
|
226 |
-
/**
|
227 |
-
* Check if the page should be override on exact URL match.
|
228 |
-
*
|
229 |
-
* @author Vova Feldman (@svovaf)
|
230 |
-
* @since 1.1.3
|
231 |
-
*
|
232 |
-
* @return bool False if submenu item.
|
233 |
-
*/
|
234 |
-
function is_override_exact() {
|
235 |
-
return $this->_is_override_exact;
|
236 |
-
}
|
237 |
-
|
238 |
-
|
239 |
-
/**
|
240 |
-
* Get the path of the page the user should be forwarded to after first activation.
|
241 |
-
*
|
242 |
-
* @author Vova Feldman (@svovaf)
|
243 |
-
* @since 1.1.3
|
244 |
-
*
|
245 |
-
* @return string
|
246 |
-
*/
|
247 |
-
function get_first_time_path() {
|
248 |
-
return $this->_first_time_path;
|
249 |
-
}
|
250 |
-
|
251 |
-
/**
|
252 |
-
* Check if plugin's menu item is part of a custom top level menu.
|
253 |
-
*
|
254 |
-
* @author Vova Feldman (@svovaf)
|
255 |
-
* @since 1.1.3
|
256 |
-
*
|
257 |
-
* @return bool
|
258 |
-
*/
|
259 |
-
function has_custom_parent() {
|
260 |
-
return ! $this->_is_top_level && is_string( $this->_parent_slug );
|
261 |
-
}
|
262 |
-
|
263 |
-
/**
|
264 |
-
* @author Leo Fajardo (@leorw)
|
265 |
-
* @since 1.2.2
|
266 |
-
*
|
267 |
-
* @return bool
|
268 |
-
*/
|
269 |
-
function has_menu() {
|
270 |
-
return $this->_menu_exists;
|
271 |
-
}
|
272 |
-
|
273 |
-
/**
|
274 |
-
* @author Vova Feldman (@svovaf)
|
275 |
-
* @since 2.0.0
|
276 |
-
*
|
277 |
-
* @return bool
|
278 |
-
*/
|
279 |
-
function has_network_menu() {
|
280 |
-
return $this->_network_menu_exists;
|
281 |
-
}
|
282 |
-
|
283 |
-
/**
|
284 |
-
* @author Leo Fajardo (@leorw)
|
285 |
-
*
|
286 |
-
* @param string $menu_slug
|
287 |
-
*
|
288 |
-
* @since 2.1.3
|
289 |
-
*/
|
290 |
-
function set_slug_and_network_menu_exists_flag($menu_slug ) {
|
291 |
-
$this->_menu_slug = $menu_slug;
|
292 |
-
$this->_network_menu_exists = false;
|
293 |
-
}
|
294 |
-
|
295 |
-
/**
|
296 |
-
* @author Vova Feldman (@svovaf)
|
297 |
-
* @since 1.1.3
|
298 |
-
*
|
299 |
-
* @param string $id
|
300 |
-
* @param bool $default
|
301 |
-
* @param bool $ignore_menu_existence Since 1.2.2.7 If true, check if the submenu item visible even if there's no parent menu.
|
302 |
-
*
|
303 |
-
* @return bool
|
304 |
-
*/
|
305 |
-
function is_submenu_item_visible( $id, $default = true, $ignore_menu_existence = false ) {
|
306 |
-
if ( ! $ignore_menu_existence && ! $this->has_menu() ) {
|
307 |
-
return false;
|
308 |
-
}
|
309 |
-
|
310 |
-
return fs_apply_filter(
|
311 |
-
$this->_module_unique_affix,
|
312 |
-
'is_submenu_visible',
|
313 |
-
$this->get_bool_option( $this->_default_submenu_items, $id, $default ),
|
314 |
-
$id
|
315 |
-
);
|
316 |
-
}
|
317 |
-
|
318 |
-
/**
|
319 |
-
* Calculates admin settings menu slug.
|
320 |
-
* If plugin's menu slug is a file (e.g. CPT), uses plugin's slug as the menu slug.
|
321 |
-
*
|
322 |
-
* @author Vova Feldman (@svovaf)
|
323 |
-
* @since 1.1.3
|
324 |
-
*
|
325 |
-
* @param string $page
|
326 |
-
*
|
327 |
-
* @return string
|
328 |
-
*/
|
329 |
-
function get_slug( $page = '' ) {
|
330 |
-
return ( ( false === strpos( $this->_menu_slug, '.php?' ) ) ?
|
331 |
-
$this->_menu_slug :
|
332 |
-
$this->_module_unique_affix ) . ( empty( $page ) ? '' : ( '-' . $page ) );
|
333 |
-
}
|
334 |
-
|
335 |
-
/**
|
336 |
-
* @author Vova Feldman (@svovaf)
|
337 |
-
* @since 1.1.3
|
338 |
-
*
|
339 |
-
* @return string
|
340 |
-
*/
|
341 |
-
function get_parent_slug() {
|
342 |
-
return $this->_parent_slug;
|
343 |
-
}
|
344 |
-
|
345 |
-
/**
|
346 |
-
* @author Vova Feldman (@svovaf)
|
347 |
-
* @since 1.1.3
|
348 |
-
*
|
349 |
-
* @return string
|
350 |
-
*/
|
351 |
-
function get_type() {
|
352 |
-
return $this->_type;
|
353 |
-
}
|
354 |
-
|
355 |
-
/**
|
356 |
-
* @author Vova Feldman (@svovaf)
|
357 |
-
* @since 1.1.3
|
358 |
-
*
|
359 |
-
* @return bool
|
360 |
-
*/
|
361 |
-
function is_cpt() {
|
362 |
-
return ( 0 === strpos( $this->_menu_slug, 'edit.php?post_type=' ) ||
|
363 |
-
// Back compatibility.
|
364 |
-
'cpt' === $this->_type
|
365 |
-
);
|
366 |
-
}
|
367 |
-
|
368 |
-
/**
|
369 |
-
* @author Vova Feldman (@svovaf)
|
370 |
-
* @since 1.1.3
|
371 |
-
*
|
372 |
-
* @return string
|
373 |
-
*/
|
374 |
-
function get_parent_type() {
|
375 |
-
return $this->_parent_type;
|
376 |
-
}
|
377 |
-
|
378 |
-
/**
|
379 |
-
* @author Vova Feldman (@svovaf)
|
380 |
-
* @since 1.1.3
|
381 |
-
*
|
382 |
-
* @return string
|
383 |
-
*/
|
384 |
-
function get_raw_slug() {
|
385 |
-
return $this->_menu_slug;
|
386 |
-
}
|
387 |
-
|
388 |
-
/**
|
389 |
-
* Get plugin's original menu slug.
|
390 |
-
*
|
391 |
-
* @author Vova Feldman (@svovaf)
|
392 |
-
* @since 1.1.3
|
393 |
-
*
|
394 |
-
* @return string
|
395 |
-
*/
|
396 |
-
function get_original_menu_slug() {
|
397 |
-
if ( 'cpt' === $this->_type ) {
|
398 |
-
return add_query_arg( array(
|
399 |
-
'post_type' => $this->_menu_slug
|
400 |
-
), 'edit.php' );
|
401 |
-
}
|
402 |
-
|
403 |
-
if ( false === strpos( $this->_menu_slug, '.php?' ) ) {
|
404 |
-
return $this->_menu_slug;
|
405 |
-
} else {
|
406 |
-
return $this->_module_unique_affix;
|
407 |
-
}
|
408 |
-
}
|
409 |
-
|
410 |
-
/**
|
411 |
-
* @author Vova Feldman (@svovaf)
|
412 |
-
* @since 1.1.3
|
413 |
-
*
|
414 |
-
* @return string
|
415 |
-
*/
|
416 |
-
function get_top_level_menu_slug() {
|
417 |
-
return $this->has_custom_parent() ?
|
418 |
-
$this->get_parent_slug() :
|
419 |
-
$this->get_raw_slug();
|
420 |
-
}
|
421 |
-
|
422 |
-
/**
|
423 |
-
* Is user on plugin's admin activation page.
|
424 |
-
*
|
425 |
-
* @author Vova Feldman (@svovaf)
|
426 |
-
* @since 1.0.8
|
427 |
-
*
|
428 |
-
* @return bool
|
429 |
-
*/
|
430 |
-
function is_main_settings_page() {
|
431 |
-
if ( $this->_menu_exists &&
|
432 |
-
( fs_is_plugin_page( $this->_menu_slug ) || fs_is_plugin_page( $this->_module_unique_affix ) )
|
433 |
-
) {
|
434 |
-
/**
|
435 |
-
* Module has a settings menu and the context page is the main settings page, so assume it's in
|
436 |
-
* activation (doesn't really check if already opted-in/skipped or not).
|
437 |
-
*
|
438 |
-
* @since 1.2.2
|
439 |
-
*/
|
440 |
-
return true;
|
441 |
-
}
|
442 |
-
|
443 |
-
global $pagenow;
|
444 |
-
if ( ( WP_FS__MODULE_TYPE_THEME === $this->_module_type ) && Freemius::is_themes_page() ) {
|
445 |
-
/**
|
446 |
-
* In activation only when show_optin query string param is given.
|
447 |
-
*
|
448 |
-
* @since 1.2.2
|
449 |
-
*/
|
450 |
-
return fs_request_get_bool( $this->_module_unique_affix . '_show_optin' );
|
451 |
-
}
|
452 |
-
|
453 |
-
return false;
|
454 |
-
}
|
455 |
-
|
456 |
-
#region Submenu Override
|
457 |
-
|
458 |
-
/**
|
459 |
-
* Override submenu's action.
|
460 |
-
*
|
461 |
-
* @author Vova Feldman (@svovaf)
|
462 |
-
* @since 1.1.0
|
463 |
-
*
|
464 |
-
* @param string $parent_slug
|
465 |
-
* @param string $menu_slug
|
466 |
-
* @param callable $function
|
467 |
-
*
|
468 |
-
* @return false|string If submenu exist, will return the hook name.
|
469 |
-
*/
|
470 |
-
function override_submenu_action( $parent_slug, $menu_slug, $function ) {
|
471 |
-
global $submenu;
|
472 |
-
|
473 |
-
$menu_slug = plugin_basename( $menu_slug );
|
474 |
-
$parent_slug = plugin_basename( $parent_slug );
|
475 |
-
|
476 |
-
if ( ! isset( $submenu[ $parent_slug ] ) ) {
|
477 |
-
// Parent menu not exist.
|
478 |
-
return false;
|
479 |
-
}
|
480 |
-
|
481 |
-
$found_submenu_item = false;
|
482 |
-
foreach ( $submenu[ $parent_slug ] as $submenu_item ) {
|
483 |
-
if ( $menu_slug === $submenu_item[2] ) {
|
484 |
-
$found_submenu_item = $submenu_item;
|
485 |
-
break;
|
486 |
-
}
|
487 |
-
}
|
488 |
-
|
489 |
-
if ( false === $found_submenu_item ) {
|
490 |
-
// Submenu item not found.
|
491 |
-
return false;
|
492 |
-
}
|
493 |
-
|
494 |
-
// Remove current function.
|
495 |
-
$hookname = get_plugin_page_hookname( $menu_slug, $parent_slug );
|
496 |
-
remove_all_actions( $hookname );
|
497 |
-
|
498 |
-
// Attach new action.
|
499 |
-
add_action( $hookname, $function );
|
500 |
-
|
501 |
-
return $hookname;
|
502 |
-
}
|
503 |
-
|
504 |
-
#endregion Submenu Override
|
505 |
-
|
506 |
-
#region Top level menu Override
|
507 |
-
|
508 |
-
/**
|
509 |
-
* Find plugin's admin dashboard main menu item.
|
510 |
-
*
|
511 |
-
* @author Vova Feldman (@svovaf)
|
512 |
-
* @since 1.0.2
|
513 |
-
*
|
514 |
-
* @return string[]|false
|
515 |
-
*/
|
516 |
-
private function find_top_level_menu() {
|
517 |
-
global $menu;
|
518 |
-
|
519 |
-
$position = - 1;
|
520 |
-
$found_menu = false;
|
521 |
-
|
522 |
-
$menu_slug = $this->get_raw_slug();
|
523 |
-
|
524 |
-
$hook_name = get_plugin_page_hookname( $menu_slug, '' );
|
525 |
-
foreach ( $menu as $pos => $m ) {
|
526 |
-
if ( $menu_slug === $m[2] ) {
|
527 |
-
$position = $pos;
|
528 |
-
$found_menu = $m;
|
529 |
-
break;
|
530 |
-
}
|
531 |
-
}
|
532 |
-
|
533 |
-
if ( false === $found_menu ) {
|
534 |
-
return false;
|
535 |
-
}
|
536 |
-
|
537 |
-
return array(
|
538 |
-
'menu' => $found_menu,
|
539 |
-
'position' => $position,
|
540 |
-
'hook_name' => $hook_name
|
541 |
-
);
|
542 |
-
}
|
543 |
-
|
544 |
-
/**
|
545 |
-
* Find plugin's admin dashboard main submenu item.
|
546 |
-
*
|
547 |
-
* @author Vova Feldman (@svovaf)
|
548 |
-
* @since 1.2.1.6
|
549 |
-
*
|
550 |
-
* @return array|false
|
551 |
-
*/
|
552 |
-
private function find_main_submenu() {
|
553 |
-
global $submenu;
|
554 |
-
|
555 |
-
$top_level_menu_slug = $this->get_top_level_menu_slug();
|
556 |
-
|
557 |
-
if ( ! isset( $submenu[ $top_level_menu_slug ] ) ) {
|
558 |
-
return false;
|
559 |
-
}
|
560 |
-
|
561 |
-
$submenu_slug = $this->get_raw_slug();
|
562 |
-
|
563 |
-
$position = - 1;
|
564 |
-
$found_submenu = false;
|
565 |
-
|
566 |
-
$hook_name = get_plugin_page_hookname( $submenu_slug, '' );
|
567 |
-
|
568 |
-
foreach ( $submenu[ $top_level_menu_slug ] as $pos => $sub ) {
|
569 |
-
if ( $submenu_slug === $sub[2] ) {
|
570 |
-
$position = $pos;
|
571 |
-
$found_submenu = $sub;
|
572 |
-
}
|
573 |
-
}
|
574 |
-
|
575 |
-
if ( false === $found_submenu ) {
|
576 |
-
return false;
|
577 |
-
}
|
578 |
-
|
579 |
-
return array(
|
580 |
-
'menu' => $found_submenu,
|
581 |
-
'parent_slug' => $top_level_menu_slug,
|
582 |
-
'position' => $position,
|
583 |
-
'hook_name' => $hook_name
|
584 |
-
);
|
585 |
-
}
|
586 |
-
|
587 |
-
/**
|
588 |
-
* Remove all sub-menu items.
|
589 |
-
*
|
590 |
-
* @author Vova Feldman (@svovaf)
|
591 |
-
* @since 1.0.7
|
592 |
-
*
|
593 |
-
* @return bool If submenu with plugin's menu slug was found.
|
594 |
-
*/
|
595 |
-
private function remove_all_submenu_items() {
|
596 |
-
global $submenu;
|
597 |
-
|
598 |
-
$menu_slug = $this->get_raw_slug();
|
599 |
-
|
600 |
-
if ( ! isset( $submenu[ $menu_slug ] ) ) {
|
601 |
-
return false;
|
602 |
-
}
|
603 |
-
|
604 |
-
/**
|
605 |
-
* This method is NOT executed for WordPress.org themes.
|
606 |
-
* Since we maintain only one version of the SDK we added this small
|
607 |
-
* hack to avoid the error from Theme Check since it's a false-positive.
|
608 |
-
*
|
609 |
-
* @author Vova Feldman (@svovaf)
|
610 |
-
* @since 1.2.2.7
|
611 |
-
*/
|
612 |
-
$submenu_ref = &$submenu;
|
613 |
-
$submenu_ref[ $menu_slug ] = array();
|
614 |
-
|
615 |
-
return true;
|
616 |
-
}
|
617 |
-
|
618 |
-
/**
|
619 |
-
*
|
620 |
-
* @author Vova Feldman (@svovaf)
|
621 |
-
* @since 1.0.9
|
622 |
-
*
|
623 |
-
* @param bool $remove_top_level_menu
|
624 |
-
*
|
625 |
-
* @return false|array[string]mixed
|
626 |
-
*/
|
627 |
-
function remove_menu_item( $remove_top_level_menu = false ) {
|
628 |
-
$this->_logger->entrance();
|
629 |
-
|
630 |
-
// Find main menu item.
|
631 |
-
$top_level_menu = $this->find_top_level_menu();
|
632 |
-
|
633 |
-
if ( false === $top_level_menu ) {
|
634 |
-
return false;
|
635 |
-
}
|
636 |
-
|
637 |
-
// Remove it with its actions.
|
638 |
-
remove_all_actions( $top_level_menu['hook_name'] );
|
639 |
-
|
640 |
-
// Remove all submenu items.
|
641 |
-
$this->remove_all_submenu_items();
|
642 |
-
|
643 |
-
if ( $remove_top_level_menu ) {
|
644 |
-
global $menu;
|
645 |
-
unset( $menu[ $top_level_menu['position'] ] );
|
646 |
-
}
|
647 |
-
|
648 |
-
return $top_level_menu;
|
649 |
-
}
|
650 |
-
|
651 |
-
/**
|
652 |
-
* Get module's main admin setting page URL.
|
653 |
-
*
|
654 |
-
* @todo This method was only tested for wp.org compliant themes with a submenu item. Need to test for plugins with top level, submenu, and CPT top level, menu items.
|
655 |
-
*
|
656 |
-
* @author Vova Feldman (@svovaf)
|
657 |
-
* @since 1.2.2.7
|
658 |
-
*
|
659 |
-
* @return string
|
660 |
-
*/
|
661 |
-
function main_menu_url() {
|
662 |
-
$this->_logger->entrance();
|
663 |
-
|
664 |
-
if ( $this->_is_top_level ) {
|
665 |
-
$menu = $this->find_top_level_menu();
|
666 |
-
} else {
|
667 |
-
$menu = $this->find_main_submenu();
|
668 |
-
}
|
669 |
-
|
670 |
-
$parent_slug = isset( $menu['parent_slug'] ) ?
|
671 |
-
$menu['parent_slug'] :
|
672 |
-
'admin.php';
|
673 |
-
|
674 |
-
return admin_url( $parent_slug . '?page=' . $menu['menu'][2] );
|
675 |
-
}
|
676 |
-
|
677 |
-
/**
|
678 |
-
* @author Vova Feldman (@svovaf)
|
679 |
-
* @since 1.1.4
|
680 |
-
*
|
681 |
-
* @param callable $function
|
682 |
-
*
|
683 |
-
* @return false|array[string]mixed
|
684 |
-
*/
|
685 |
-
function override_menu_item( $function ) {
|
686 |
-
$found_menu = $this->remove_menu_item();
|
687 |
-
|
688 |
-
if ( false === $found_menu ) {
|
689 |
-
return false;
|
690 |
-
}
|
691 |
-
|
692 |
-
if ( ! $this->is_top_level() || ! $this->is_cpt() ) {
|
693 |
-
$menu_slug = plugin_basename( $this->get_slug() );
|
694 |
-
|
695 |
-
$hookname = get_plugin_page_hookname( $menu_slug, '' );
|
696 |
-
|
697 |
-
// Override menu action.
|
698 |
-
add_action( $hookname, $function );
|
699 |
-
} else {
|
700 |
-
global $menu;
|
701 |
-
|
702 |
-
// Remove original CPT menu.
|
703 |
-
unset( $menu[ $found_menu['position'] ] );
|
704 |
-
|
705 |
-
// Create new top-level menu action.
|
706 |
-
$hookname = self::add_page(
|
707 |
-
$found_menu['menu'][3],
|
708 |
-
$found_menu['menu'][0],
|
709 |
-
'manage_options',
|
710 |
-
$this->get_slug(),
|
711 |
-
$function,
|
712 |
-
$found_menu['menu'][6],
|
713 |
-
$found_menu['position']
|
714 |
-
);
|
715 |
-
}
|
716 |
-
|
717 |
-
return $hookname;
|
718 |
-
}
|
719 |
-
|
720 |
-
/**
|
721 |
-
* Adds a counter to the module's top level menu item.
|
722 |
-
*
|
723 |
-
* @author Vova Feldman (@svovaf)
|
724 |
-
* @since 1.2.1.5
|
725 |
-
*
|
726 |
-
* @param int $counter
|
727 |
-
* @param string $class
|
728 |
-
*/
|
729 |
-
function add_counter_to_menu_item( $counter = 1, $class = '' ) {
|
730 |
-
global $menu, $submenu;
|
731 |
-
|
732 |
-
$mask = '%s <span class="update-plugins %s count-%3$s" aria-hidden="true"><span>%3$s<span class="screen-reader-text">%3$s notifications</span></span></span>';
|
733 |
-
|
734 |
-
/**
|
735 |
-
* This method is NOT executed for WordPress.org themes.
|
736 |
-
* Since we maintain only one version of the SDK we added this small
|
737 |
-
* hack to avoid the error from Theme Check since it's a false-positive.
|
738 |
-
*
|
739 |
-
* @author Vova Feldman (@svovaf)
|
740 |
-
* @since 1.2.2.7
|
741 |
-
*/
|
742 |
-
$menu_ref = &$menu;
|
743 |
-
$submenu_ref = &$submenu;
|
744 |
-
|
745 |
-
if ( $this->_is_top_level ) {
|
746 |
-
// Find main menu item.
|
747 |
-
$found_menu = $this->find_top_level_menu();
|
748 |
-
|
749 |
-
if ( false !== $found_menu ) {
|
750 |
-
// Override menu label.
|
751 |
-
$menu_ref[ $found_menu['position'] ][0] = sprintf(
|
752 |
-
$mask,
|
753 |
-
$found_menu['menu'][0],
|
754 |
-
$class,
|
755 |
-
$counter
|
756 |
-
);
|
757 |
-
}
|
758 |
-
} else {
|
759 |
-
$found_submenu = $this->find_main_submenu();
|
760 |
-
|
761 |
-
if ( false !== $found_submenu ) {
|
762 |
-
// Override menu label.
|
763 |
-
$submenu_ref[ $found_submenu['parent_slug'] ][ $found_submenu['position'] ][0] = sprintf(
|
764 |
-
$mask,
|
765 |
-
$found_submenu['menu'][0],
|
766 |
-
$class,
|
767 |
-
$counter
|
768 |
-
);
|
769 |
-
}
|
770 |
-
}
|
771 |
-
}
|
772 |
-
|
773 |
-
#endregion Top level menu Override
|
774 |
-
|
775 |
-
/**
|
776 |
-
* Add a top-level menu page.
|
777 |
-
*
|
778 |
-
* Note for WordPress.org Theme/Plugin reviewer:
|
779 |
-
*
|
780 |
-
* This is a replication of `add_menu_page()` to avoid Theme Check warning.
|
781 |
-
*
|
782 |
-
* Why?
|
783 |
-
* ====
|
784 |
-
* Freemius is an SDK for plugin and theme developers. Since the core
|
785 |
-
* of the SDK is relevant both for plugins and themes, for obvious reasons,
|
786 |
-
* we only develop and maintain one code base.
|
787 |
-
*
|
788 |
-
* This method will not run for wp.org themes (only plugins) since theme
|
789 |
-
* admin settings/options are now only allowed in the customizer.
|
790 |
-
*
|
791 |
-
* If you have any questions or need clarifications, please don't hesitate
|
792 |
-
* pinging me on slack, my username is @svovaf.
|
793 |
-
*
|
794 |
-
* @author Vova Feldman (@svovaf)
|
795 |
-
* @since 1.2.2
|
796 |
-
*
|
797 |
-
* @param string $page_title The text to be displayed in the title tags of the page when the menu is
|
798 |
-
* selected.
|
799 |
-
* @param string $menu_title The text to be used for the menu.
|
800 |
-
* @param string $capability The capability required for this menu to be displayed to the user.
|
801 |
-
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
|
802 |
-
* @param callable|string $function The function to be called to output the content for this page.
|
803 |
-
* @param string $icon_url The URL to the icon to be used for this menu.
|
804 |
-
* * Pass a base64-encoded SVG using a data URI, which will be colored to
|
805 |
-
* match the color scheme. This should begin with
|
806 |
-
* 'data:image/svg+xml;base64,'.
|
807 |
-
* * Pass the name of a Dashicons helper class to use a font icon,
|
808 |
-
* e.g. 'dashicons-chart-pie'.
|
809 |
-
* * Pass 'none' to leave div.wp-menu-image empty so an icon can be added
|
810 |
-
* via CSS.
|
811 |
-
* @param int $position The position in the menu order this one should appear.
|
812 |
-
*
|
813 |
-
* @return string The resulting page's hook_suffix.
|
814 |
-
*/
|
815 |
-
static function add_page(
|
816 |
-
$page_title,
|
817 |
-
$menu_title,
|
818 |
-
$capability,
|
819 |
-
$menu_slug,
|
820 |
-
$function = '',
|
821 |
-
$icon_url = '',
|
822 |
-
$position = null
|
823 |
-
) {
|
824 |
-
$fn = 'add_menu' . '_page';
|
825 |
-
|
826 |
-
return $fn(
|
827 |
-
$page_title,
|
828 |
-
$menu_title,
|
829 |
-
$capability,
|
830 |
-
$menu_slug,
|
831 |
-
$function,
|
832 |
-
$icon_url,
|
833 |
-
$position
|
834 |
-
);
|
835 |
-
}
|
836 |
-
|
837 |
-
/**
|
838 |
-
* Add page and update menu instance settings.
|
839 |
-
*
|
840 |
-
* @author Vova Feldman (@svovaf)
|
841 |
-
* @since 2.0.0
|
842 |
-
*
|
843 |
-
* @param string $page_title
|
844 |
-
* @param string $menu_title
|
845 |
-
* @param string $capability
|
846 |
-
* @param string $menu_slug
|
847 |
-
* @param callable|string $function
|
848 |
-
* @param string $icon_url
|
849 |
-
* @param int|null $position
|
850 |
-
*
|
851 |
-
* @return string
|
852 |
-
*/
|
853 |
-
function add_page_and_update(
|
854 |
-
$page_title,
|
855 |
-
$menu_title,
|
856 |
-
$capability,
|
857 |
-
$menu_slug,
|
858 |
-
$function = '',
|
859 |
-
$icon_url = '',
|
860 |
-
$position = null
|
861 |
-
) {
|
862 |
-
$this->_menu_slug = $menu_slug;
|
863 |
-
$this->_is_top_level = true;
|
864 |
-
$this->_menu_exists = true;
|
865 |
-
$this->_network_menu_exists = true;
|
866 |
-
|
867 |
-
return self::add_page(
|
868 |
-
$page_title,
|
869 |
-
$menu_title,
|
870 |
-
$capability,
|
871 |
-
$menu_slug,
|
872 |
-
$function,
|
873 |
-
$icon_url,
|
874 |
-
$position
|
875 |
-
);
|
876 |
-
}
|
877 |
-
|
878 |
-
/**
|
879 |
-
* Add a submenu page.
|
880 |
-
*
|
881 |
-
* Note for WordPress.org Theme/Plugin reviewer:
|
882 |
-
*
|
883 |
-
* This is a replication of `add_submenu_page()` to avoid Theme Check warning.
|
884 |
-
*
|
885 |
-
* Why?
|
886 |
-
* ====
|
887 |
-
* Freemius is an SDK for plugin and theme developers. Since the core
|
888 |
-
* of the SDK is relevant both for plugins and themes, for obvious reasons,
|
889 |
-
* we only develop and maintain one code base.
|
890 |
-
*
|
891 |
-
* This method will not run for wp.org themes (only plugins) since theme
|
892 |
-
* admin settings/options are now only allowed in the customizer.
|
893 |
-
*
|
894 |
-
* If you have any questions or need clarifications, please don't hesitate
|
895 |
-
* pinging me on slack, my username is @svovaf.
|
896 |
-
*
|
897 |
-
* @author Vova Feldman (@svovaf)
|
898 |
-
* @since 1.2.2
|
899 |
-
*
|
900 |
-
* @param string $parent_slug The slug name for the parent menu (or the file name of a standard
|
901 |
-
* WordPress admin page).
|
902 |
-
* @param string $page_title The text to be displayed in the title tags of the page when the menu is
|
903 |
-
* selected.
|
904 |
-
* @param string $menu_title The text to be used for the menu.
|
905 |
-
* @param string $capability The capability required for this menu to be displayed to the user.
|
906 |
-
* @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu).
|
907 |
-
* @param callable|string $function The function to be called to output the content for this page.
|
908 |
-
*
|
909 |
-
* @return false|string The resulting page's hook_suffix, or false if the user does not have the capability
|
910 |
-
* required.
|
911 |
-
*/
|
912 |
-
static function add_subpage(
|
913 |
-
$parent_slug,
|
914 |
-
$page_title,
|
915 |
-
$menu_title,
|
916 |
-
$capability,
|
917 |
-
$menu_slug,
|
918 |
-
$function = ''
|
919 |
-
) {
|
920 |
-
$fn = 'add_submenu' . '_page';
|
921 |
-
|
922 |
-
return $fn( $parent_slug,
|
923 |
-
$page_title,
|
924 |
-
$menu_title,
|
925 |
-
$capability,
|
926 |
-
$menu_slug,
|
927 |
-
$function
|
928 |
-
);
|
929 |
-
}
|
930 |
-
|
931 |
-
/**
|
932 |
-
* Add sub page and update menu instance settings.
|
933 |
-
*
|
934 |
-
* @author Vova Feldman (@svovaf)
|
935 |
-
* @since 2.0.0
|
936 |
-
*
|
937 |
-
* @param string $parent_slug
|
938 |
-
* @param string $page_title
|
939 |
-
* @param string $menu_title
|
940 |
-
* @param string $capability
|
941 |
-
* @param string $menu_slug
|
942 |
-
* @param callable|string $function
|
943 |
-
*
|
944 |
-
* @return string
|
945 |
-
*/
|
946 |
-
function add_subpage_and_update(
|
947 |
-
$parent_slug,
|
948 |
-
$page_title,
|
949 |
-
$menu_title,
|
950 |
-
$capability,
|
951 |
-
$menu_slug,
|
952 |
-
$function = ''
|
953 |
-
) {
|
954 |
-
$this->_menu_slug = $menu_slug;
|
955 |
-
$this->_parent_slug = $parent_slug;
|
956 |
-
$this->_is_top_level = false;
|
957 |
-
$this->_menu_exists = true;
|
958 |
-
$this->_network_menu_exists = true;
|
959 |
-
|
960 |
-
return self::add_subpage(
|
961 |
-
$parent_slug,
|
962 |
-
$page_title,
|
963 |
-
$menu_title,
|
964 |
-
$capability,
|
965 |
-
$menu_slug,
|
966 |
-
$function
|
967 |
-
);
|
968 |
-
}
|
969 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package Freemius
|
4 |
+
* @copyright Copyright (c) 2015, Freemius, Inc.
|
5 |
+
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
|
6 |
+
* @since 1.1.3
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit;
|
11 |
+
}
|
12 |
+
|
13 |
+
class FS_Admin_Menu_Manager {
|
14 |
+
|
15 |
+
#region Properties
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @since 1.2.2
|
19 |
+
*
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
+
protected $_module_unique_affix;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @since 1.2.2
|
26 |
+
*
|
27 |
+
* @var number
|
28 |
+
*/
|
29 |
+
protected $_module_id;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @since 1.2.2
|
33 |
+
*
|
34 |
+
* @var string
|
35 |
+
*/
|
36 |
+
protected $_module_type;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @since 1.0.6
|
40 |
+
*
|
41 |
+
* @var string
|
42 |
+
*/
|
43 |
+
private $_menu_slug;
|
44 |
+
/**
|
45 |
+
* @since 1.1.3
|
46 |
+
*
|
47 |
+
* @var string
|
48 |
+
*/
|
49 |
+
private $_parent_slug;
|
50 |
+
/**
|
51 |
+
* @since 1.1.3
|
52 |
+
*
|
53 |
+
* @var string
|
54 |
+
*/
|
55 |
+
private $_parent_type;
|
56 |
+
/**
|
57 |
+
* @since 1.1.3
|
58 |
+
*
|
59 |
+
* @var string
|
60 |
+
*/
|
61 |
+
private $_type;
|
62 |
+
/**
|
63 |
+
* @since 1.1.3
|
64 |
+
*
|
65 |
+
* @var bool
|
66 |
+
*/
|
67 |
+
private $_is_top_level;
|
68 |
+
/**
|
69 |
+
* @since 1.1.3
|
70 |
+
*
|
71 |
+
* @var bool
|
72 |
+
*/
|
73 |
+
private $_is_override_exact;
|
74 |
+
/**
|
75 |
+
* @since 1.1.3
|
76 |
+
*
|
77 |
+
* @var array<string,bool>
|
78 |
+
*/
|
79 |
+
private $_default_submenu_items;
|
80 |
+
/**
|
81 |
+
* @since 1.1.3
|
82 |
+
*
|
83 |
+
* @var string
|
84 |
+
*/
|
85 |
+
private $_first_time_path;
|
86 |
+
/**
|
87 |
+
* @since 1.2.2
|
88 |
+
*
|
89 |
+
* @var bool
|
90 |
+
*/
|
91 |
+
private $_menu_exists;
|
92 |
+
/**
|
93 |
+
* @since 2.0.0
|
94 |
+
*
|
95 |
+
* @var bool
|
96 |
+
*/
|
97 |
+
private $_network_menu_exists;
|
98 |
+
|
99 |
+
#endregion Properties
|
100 |
+
|
101 |
+
/**
|
102 |
+
* @var FS_Logger
|
103 |
+
*/
|
104 |
+
protected $_logger;
|
105 |
+
|
106 |
+
#region Singleton
|
107 |
+
|
108 |
+
/**
|
109 |
+
* @var FS_Admin_Menu_Manager[]
|
110 |
+
*/
|
111 |
+
private static $_instances = array();
|
112 |
+
|
113 |
+
/**
|
114 |
+
* @param number $module_id
|
115 |
+
* @param string $module_type
|
116 |
+
* @param string $module_unique_affix
|
117 |
+
*
|
118 |
+
* @return FS_Admin_Menu_Manager
|
119 |
+
*/
|
120 |
+
static function instance( $module_id, $module_type, $module_unique_affix ) {
|
121 |
+
$key = 'm_' . $module_id;
|
122 |
+
|
123 |
+
if ( ! isset( self::$_instances[ $key ] ) ) {
|
124 |
+
self::$_instances[ $key ] = new FS_Admin_Menu_Manager( $module_id, $module_type, $module_unique_affix );
|
125 |
+
}
|
126 |
+
|
127 |
+
return self::$_instances[ $key ];
|
128 |
+
}
|
129 |
+
|
130 |
+
protected function __construct( $module_id, $module_type, $module_unique_affix ) {
|
131 |
+
$this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $module_id . '_admin_menu', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
|
132 |
+
|
133 |
+
$this->_module_id = $module_id;
|
134 |
+
$this->_module_type = $module_type;
|
135 |
+
$this->_module_unique_affix = $module_unique_affix;
|
136 |
+
}
|
137 |
+
|
138 |
+
#endregion Singleton
|
139 |
+
|
140 |
+
#region Helpers
|
141 |
+
|
142 |
+
private function get_option( &$options, $key, $default = false ) {
|
143 |
+
return ! empty( $options[ $key ] ) ? $options[ $key ] : $default;
|
144 |
+
}
|
145 |
+
|
146 |
+
private function get_bool_option( &$options, $key, $default = false ) {
|
147 |
+
return isset( $options[ $key ] ) && is_bool( $options[ $key ] ) ? $options[ $key ] : $default;
|
148 |
+
}
|
149 |
+
|
150 |
+
#endregion Helpers
|
151 |
+
|
152 |
+
/**
|
153 |
+
* @param array $menu
|
154 |
+
* @param bool $is_addon
|
155 |
+
*/
|
156 |
+
function init( $menu, $is_addon = false ) {
|
157 |
+
$this->_menu_exists = ( isset( $menu['slug'] ) && ! empty( $menu['slug'] ) );
|
158 |
+
$this->_network_menu_exists = ( ! empty( $menu['network'] ) && true === $menu['network'] );
|
159 |
+
|
160 |
+
$this->_menu_slug = ( $this->_menu_exists ? $menu['slug'] : $this->_module_unique_affix );
|
161 |
+
|
162 |
+
$this->_default_submenu_items = array();
|
163 |
+
// @deprecated
|
164 |
+
$this->_type = 'page';
|
165 |
+
$this->_is_top_level = true;
|
166 |
+
$this->_is_override_exact = false;
|
167 |
+
$this->_parent_slug = false;
|
168 |
+
// @deprecated
|
169 |
+
$this->_parent_type = 'page';
|
170 |
+
|
171 |
+
if ( isset( $menu ) ) {
|
172 |
+
if ( ! $is_addon ) {
|
173 |
+
$this->_default_submenu_items = array(
|
174 |
+
'contact' => $this->get_bool_option( $menu, 'contact', true ),
|
175 |
+
'support' => $this->get_bool_option( $menu, 'support', true ),
|
176 |
+
'affiliation' => $this->get_bool_option( $menu, 'affiliation', true ),
|
177 |
+
'account' => $this->get_bool_option( $menu, 'account', true ),
|
178 |
+
'pricing' => $this->get_bool_option( $menu, 'pricing', true ),
|
179 |
+
'addons' => $this->get_bool_option( $menu, 'addons', true ),
|
180 |
+
);
|
181 |
+
|
182 |
+
// @deprecated
|
183 |
+
$this->_type = $this->get_option( $menu, 'type', 'page' );
|
184 |
+
|
185 |
+
$this->_first_time_path = $this->get_option( $menu, 'first-path', false );
|
186 |
+
if ( ! empty( $this->_first_time_path ) && is_string( $this->_first_time_path ) ) {
|
187 |
+
$this->_first_time_path = admin_url( $this->_first_time_path, 'admin' );
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
$this->_is_override_exact = $this->get_bool_option( $menu, 'override_exact' );
|
192 |
+
|
193 |
+
if ( isset( $menu['parent'] ) ) {
|
194 |
+
$this->_parent_slug = $this->get_option( $menu['parent'], 'slug' );
|
195 |
+
// @deprecated
|
196 |
+
$this->_parent_type = $this->get_option( $menu['parent'], 'type', 'page' );
|
197 |
+
|
198 |
+
// If parent's slug is different, then it's NOT a top level menu item.
|
199 |
+
$this->_is_top_level = ( $this->_parent_slug === $this->_menu_slug );
|
200 |
+
} else {
|
201 |
+
/**
|
202 |
+
* If no parent then top level if:
|
203 |
+
* - Has custom admin menu ('page')
|
204 |
+
* - CPT menu type ('cpt')
|
205 |
+
*/
|
206 |
+
// $this->_is_top_level = in_array( $this->_type, array(
|
207 |
+
// 'cpt',
|
208 |
+
// 'page'
|
209 |
+
// ) );
|
210 |
+
}
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Check if top level menu.
|
216 |
+
*
|
217 |
+
* @author Vova Feldman (@svovaf)
|
218 |
+
* @since 1.1.3
|
219 |
+
*
|
220 |
+
* @return bool False if submenu item.
|
221 |
+
*/
|
222 |
+
function is_top_level() {
|
223 |
+
return $this->_is_top_level;
|
224 |
+
}
|
225 |
+
|
226 |
+
/**
|
227 |
+
* Check if the page should be override on exact URL match.
|
228 |
+
*
|
229 |
+
* @author Vova Feldman (@svovaf)
|
230 |
+
* @since 1.1.3
|
231 |
+
*
|
232 |
+
* @return bool False if submenu item.
|
233 |
+
*/
|
234 |
+
function is_override_exact() {
|
235 |
+
return $this->_is_override_exact;
|
236 |
+
}
|
237 |
+
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Get the path of the page the user should be forwarded to after first activation.
|
241 |
+
*
|
242 |
+
* @author Vova Feldman (@svovaf)
|
243 |
+
* @since 1.1.3
|
244 |
+
*
|
245 |
+
* @return string
|
246 |
+
*/
|
247 |
+
function get_first_time_path() {
|
248 |
+
return $this->_first_time_path;
|
249 |
+
}
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Check if plugin's menu item is part of a custom top level menu.
|
253 |
+
*
|
254 |
+
* @author Vova Feldman (@svovaf)
|
255 |
+
* @since 1.1.3
|
256 |
+
*
|
257 |
+
* @return bool
|
258 |
+
*/
|
259 |
+
function has_custom_parent() {
|
260 |
+
return ! $this->_is_top_level && is_string( $this->_parent_slug );
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* @author Leo Fajardo (@leorw)
|
265 |
+
* @since 1.2.2
|
266 |
+
*
|
267 |
+
* @return bool
|
268 |
+
*/
|
269 |
+
function has_menu() {
|
270 |
+
return $this->_menu_exists;
|
271 |
+
}
|
272 |
+
|
273 |
+
/**
|
274 |
+
* @author Vova Feldman (@svovaf)
|
275 |
+
* @since 2.0.0
|
276 |
+
*
|
277 |
+
* @return bool
|
278 |
+
*/
|
279 |
+
function has_network_menu() {
|
280 |
+
return $this->_network_menu_exists;
|
281 |
+
}
|
282 |
+
|
283 |
+
/**
|
284 |
+
* @author Leo Fajardo (@leorw)
|
285 |
+
*
|
286 |
+
* @param string $menu_slug
|
287 |
+
*
|
288 |
+
* @since 2.1.3
|
289 |
+
*/
|
290 |
+
function set_slug_and_network_menu_exists_flag($menu_slug ) {
|
291 |
+
$this->_menu_slug = $menu_slug;
|
292 |
+
$this->_network_menu_exists = false;
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* @author Vova Feldman (@svovaf)
|
297 |
+
* @since 1.1.3
|
298 |
+
*
|
299 |
+
* @param string $id
|
300 |
+
* @param bool $default
|
301 |
+
* @param bool $ignore_menu_existence Since 1.2.2.7 If true, check if the submenu item visible even if there's no parent menu.
|
302 |
+
*
|
303 |
+
* @return bool
|
304 |
+
*/
|
305 |
+
function is_submenu_item_visible( $id, $default = true, $ignore_menu_existence = false ) {
|
306 |
+
if ( ! $ignore_menu_existence && ! $this->has_menu() ) {
|
307 |
+
return false;
|
308 |
+
}
|
309 |
+
|
310 |
+
return fs_apply_filter(
|
311 |
+
$this->_module_unique_affix,
|
312 |
+
'is_submenu_visible',
|
313 |
+
$this->get_bool_option( $this->_default_submenu_items, $id, $default ),
|
314 |
+
$id
|
315 |
+
);
|
316 |
+
}
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Calculates admin settings menu slug.
|
320 |
+
* If plugin's menu slug is a file (e.g. CPT), uses plugin's slug as the menu slug.
|
321 |
+
*
|
322 |
+
* @author Vova Feldman (@svovaf)
|
323 |
+
* @since 1.1.3
|
324 |
+
*
|
325 |
+
* @param string $page
|
326 |
+
*
|
327 |
+
* @return string
|
328 |
+
*/
|
329 |
+
|