jQuery Pin It Button for Images - Version 3.0.5

Version Description

  • Released 2019-09-15
  • Improvements to how enabled and disabled classes work
  • Fixed button sizing for Gutenberg galleries
Download this release

Release Info

Developer mrsztuczkens
Plugin Icon wp plugin jQuery Pin It Button for Images
Version 3.0.5
Comparing to
See all releases

Code changes from version 3.0.4 to 3.0.5

jquery-pin-it-button-for-images.php CHANGED
@@ -6,7 +6,7 @@ Description: Highlights images on hover and adds a "Pin It" button over them for
6
Text Domain: jquery-pin-it-button-for-images
7
Domain Path: /languages
8
Author: Marcin Skrzypiec
9
- Version:3.0.4
10
Author URI: https://highfiveplugins.com/
11
*/
12
@@ -18,7 +18,7 @@ if ( !class_exists( 'jQuery_Pin_It_Button_For_Images' ) ) {
18
final class jQuery_Pin_It_Button_For_Images {
19
20
function __construct() {
21
- $version = '3.0.4';
22
require_once plugin_dir_path(__FILE__) . 'includes/jpibfi.php';
23
new JPIBFI(__FILE__, $version);
24
}
6
Text Domain: jquery-pin-it-button-for-images
7
Domain Path: /languages
8
Author: Marcin Skrzypiec
9
+ Version:3.0.5
10
Author URI: https://highfiveplugins.com/
11
*/
12
18
final class jQuery_Pin_It_Button_For_Images {
19
20
function __construct() {
21
+ $version = '3.0.5';
22
require_once plugin_dir_path(__FILE__) . 'includes/jpibfi.php';
23
new JPIBFI(__FILE__, $version);
24
}
js/jpibfi.client.js CHANGED
@@ -1 +1 @@
1
- !function(){function t(e,i,n){function r(s,a){if(!i[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=i[s]={exports:{}};e[s][0].call(l.exports,function(t){var i=e[s][1][t];return r(i||t)},l,l.exports,t,e,i,n)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;s<n.length;s++)r(n[s]);return r}return t}()({1:[function(t,e,i){"use strict";i.__esModule=!0;var n=t("./css-helper"),r=55/64,o=51/73,s=41/64,a=36/54,u=.7,c=.7,l=function(t,e){var i=t*a;switch(e){case"pushpin":return i*c;case"thumb-tack":return i*u;default:return i}},p=function(t,e){switch(e){case"circle":return{"margin-top":-.5*t+"px","margin-left":-.5*t*r+"px"};case"plain":return{"margin-top":-.46875*t+"px","margin-left":-.5*t*o+"px"};case"thumb-tack":return{"margin-top":-29.5/64*t+"px","margin-left":-.5*t*s+"px"};case"pushpin":case"pinterest2":return{"margin-top":-.5*t+"px","margin-left":-.5*t+"px"}}};i.createCssRulesForDefaultButton=function(t,e){var i=l(t.height,e),r={height:t.height+"px",width:t.width+"px","font-size":i+"px"},o=p(i,e);n.addMediaQueryRule("a.pinit-button span",0,r),n.addMediaQueryRule("a.pinit-button span:before",0,o)},i.createCssRulesForCustomButton=function(t){var e={height:t.height+"px",width:t.width+"px"},i={"background-size":t.width+"px "+t.height+"px !important",height:t.height+"px",width:t.width+"px"};n.addMediaQueryRule("a.pinit-button",0,e),n.addMediaQueryRule("a.pinit-button span",0,i)}},{"./css-helper":2}],2:[function(t,e,i){"use strict";i.__esModule=!0;var n,r;!function(t){t[t.xsm=0]="xsm",t[t.sm=576]="sm",t[t.md=768]="md",t[t.lg=992]="lg",t[t.xlg=1200]="xlg"}(r=i.Breakpoints||(i.Breakpoints={})),i.BreakpointsList=Object.keys(r).filter(function(t){return"number"==typeof r[t]}).map(function(t){return Number(r[t])}),i.getCurrentBreakpoint=function(){for(var t=window.innerWidth,e=i.BreakpointsList.length-1;e>=0;e--)if(t>=i.BreakpointsList[e])return i.BreakpointsList[e];return r.xsm};var o=(n={},n[r.xsm]={width:50,height:50},n[r.sm]={width:60,height:60},n[r.md]={width:80,height:80},n[r.lg]={width:110,height:110},n[r.xlg]={width:1e3,height:1e3},n),s=function(t,e){var i="string"==typeof e?e:Object.keys(e).map(function(t){return t+":"+("content"===t?"'"+e[t]+"'":e[t])}).join(";");return t+" {"+i+"}"},a=function(t,e){return"@media (min-width: "+t+"px){ "+e+" }"},u=function(t){var e=document.createElement("style"),i=document.head.appendChild(e).sheet;i.insertRule(t,i.cssRules.length)};i.addCssRule=function(t,e){u(s(t,e))},i.addMediaQueryRule=function(t,e,i){var n=s(t,i),r=e>0?a(e,n):n;u(r)};var c=function(t,e){var i=Math.min(1,e.width/t.width),n=Math.min(1,e.height/t.height);return Math.min(i,n)};i.calculateSizeForBreakpoint=function(t,e){var i=o[e],n=c(t,i);return{height:t.height*n,width:t.width*n}}},{}],3:[function(t,e,i){"use strict";i.__esModule=!0;var n=function(){function t(t){var e=(void 0===t?{}:t).siteTitle,i=void 0===e?"":e;this.desc_funcs={img_title:function(t){return t.attr("title")||t.attr("data-jpibfi-title")},img_alt:function(t){return t.attr("alt")||t.attr("data-jpibfi-alt")},post_title:function(t){return t.attr("data-jpibfi-post-title")},post_excerpt:function(t){return t.attr("data-jpibfi-post-excerpt")},img_description:function(t){return t.attr("data-jpibfi-description")},img_caption:function(t){return t.attr("data-jpibfi-caption")},site_title:function(){return i},data_pin_description:function(t){return t.attr("data-pin-description")}}}return t.prototype.getDescription=function(t,e){for(var i="",n=0;n<e.length&&!i;n++)i=this.desc_funcs[e[n]](t);return i||""},t}();i["default"]=n},{}],4:[function(t,e,i){"use strict";i.__esModule=!0;var n;!function(t){t[t.Width=0]="Width",t[t.PixelDensity=1]="PixelDensity"}(n||(n={}));var r=/(.+)\s+(\d{1,4})w\s*/i,o=/(.*)\s+(\d{1,3}(\.\d{0,2})?)x\s*/i,s={Url:1,WidthDescriptor:2},a=function(t){if(0!==t.length)return t.some(function(t){return null!==r.exec(t)})?n.Width:t.some(function(t){return null!==o.exec(t)})?n.PixelDensity:void 0},u=function(t,e){if(e!==n.PixelDensity){var i=t.map(function(t){return r.exec(t)}).filter(function(t){return!!t}).map(function(t){return{url:t[s.Url].trim(),width:Number(t[s.WidthDescriptor])}});if(0!==i.length)return i.reduce(function(t,e){return t.width>e.width?t:e},i[0])}};i.getWidestImageUrlFromSrcset=function(t){var e=t.prop?t.prop("srcset"):t.attr("srcset");if(e&&0!==e.length)try{var i=e.split(","),n=a(i),r=u(i,n);return void 0!==r?r.url:void 0}catch(o){return void(console&&console.error&&console.error(o))}}},{}],5:[function(t,e,i){"use strict";i.__esModule=!0;var n=function(){function t(t){var e=this;this.flags={},this.pluginName=t;var i="undefined"!=typeof console&&"undefined"!=typeof console.log,n="undefined"!=typeof JSON&&"function"==typeof JSON.stringify;i?(this.logString=function(t){e.log(t)},this.logObject=n?function(t){e.log(JSON.stringify(t,null,4))}:function(t){return e.simplelogObject(t)}):(this.logString=function(){},this.logObject=function(){});var r=this.getQueryParams(document.location.search);Object.keys(r).forEach(function(i){var n=i.replace(t+"_","");e.setFlag(n,r[i])})}return t.prototype.getFlag=function(t){return void 0!==this.flags[t]&&this.flags[t]},t.prototype.getQueryParams=function(t){t=t.split("+").join(" ");for(var e,i={},n=/[?&]?([^=]+)=([^&]*)/g;e=n.exec(t);)i[decodeURIComponent(e[1])]=decodeURIComponent(e[2]);return i},t.prototype.log=function(t){this.getFlag("print")&&console.log(this.pluginName+" debug: "+t)},t.prototype.setFlag=function(t,e){void 0===e&&(e=!0),this.flags[t]=e},t.prototype.simplelogObject=function(t){if(this.getFlag("print")){var e=Object.keys(t).filter(function(e){return t.hasOwnPrototype(e)}).map(function(e){return e+": "+t[e]+"\n"}).join();this.log(e)}},t}();i["default"]=n},{}],6:[function(t,e,i){"use strict";i.__esModule=!0;var n=t("./link-generator"),r=function(){function t(t,e){this.$=t,this.settings=e,this.linkGenerator=new n["default"](e),this.$element=this.$("<a />",{target:"_blank","class":"pinit-button "+e.pin_image});var i="default"===e.pin_image?"jpibfi-icon-"+e.pin_image_icon:"";this.$element.html('<span class="'+i+'"></span>'),"default"===e.pin_image&&this.$element.addClass("jpibfi-button-"+e.pin_image_button)}return t.prototype.createButton=function(t){var e=this.linkGenerator.generate(t);if(e)return this.$element.clone(!1).attr("href",e).click(function(t){t.preventDefault(),t.stopPropagation(),"#"!==t.currentTarget.href.slice(-1)&&window.open(t.currentTarget.href,"mw"+t.timeStamp,"left=20,top=20,width=600,height=500,toolbar=1,resizable=0")})},t.prototype.getSize=function(){var t={height:this.settings.pinImageHeight,width:this.settings.pinImageWidth};return t},t}();i["default"]=r},{"./link-generator":9}],7:[function(t,e,i){"use strict";i.__esModule=!0;var n=function(){function t(t){var e=this;this.settings=t,this.disabledClasses=this.createClassList(t.disabled_classes),this.enabledClasses=this.createClassList(t.enabled_classes),this.updateSizeConstraints(),window.addEventListener("resize",function(){return e.updateSizeConstraints()},!1)}return t.prototype.createClassList=function(t){return void 0===t&&(t=""),t.split(";").filter(function(t){return!!t})},t.prototype.imageEligible=function(t){return(0===this.enabledClasses.length||this.enabledClasses.some(function(e){return t.hasClass(e)}))&&!this.disabledClasses.some(function(e){return t.hasClass(e)})&&this.imageSizeIsOk(t)},t.prototype.imageSizeIsOk=function(t){var e=t[0].clientWidth,i=t[0].clientHeight;return e>=this.minWidth&&i>=this.minHeight},t.prototype.updateSizeConstraints=function(){this.minWidth=window.outerWidth<768?this.settings.min_image_width_small:this.settings.min_image_width,this.minHeight=window.outerWidth<768?this.settings.min_image_height_small:this.settings.min_image_height},t}();i["default"]=n},{}],8:[function(t,e,i){"use strict";i.__esModule=!0;var n=t("./show-on-hover-strategy"),r=function(){function t(t,e,i){this.settings=e,this.$=t,this.logger=i}return t.prototype.init=function(){this.showStrategy=this.getStrategy(),this.showStrategy.start()},t.prototype.getStrategy=function(){var t=null;return new(t=n["default"])(this.$,this.settings,this.logger)},t}();i["default"]=r},{"./show-on-hover-strategy":11}],9:[function(t,e,i){"use strict";i.__esModule=!0;var n=t("../common/description-helper");t("../common/srcset-helper");i.getExtension=function(t){void 0===t&&(t="");var e=t.replace(/^https?\:\/\/[^\/?#]+(?:[\/?#]|$)/i,""),i=e.split(".");if(1===i.length)return"";var n=i[i.length-1],r=n.replace(/\?.*/i,"").toLowerCase();return r};var r=function(t){return["","html","php"].indexOf(t)!==-1},o=function(t){var e=window.location&&window.location.hostname||"",i=e.replace("www.","");return t.indexOf(i)>=0},s=function(){function t(t){this.descriptionHelper=new n["default"]({siteTitle:t.siteTitle}),this.description_option=t.description_option,this.supportSrcset=t.support_srcset,this.pinLinkedUrl=t.pin_linked_url}return t.prototype.getDescription=function(t){return this.descriptionHelper.getDescription(t,this.description_option)},t.prototype.getImage=function(t,e){var n=t.attr("data-pin-media")||t.attr("data-jpibfi-src")||t.prop("src");if(n){if(!e)return n;var r=i.getExtension(n);return e.extension===r?e.href:n}},t.prototype.getUrl=function(t,e){return t.attr("data-pin-url")?t.attr("data-pin-url"):this.pinLinkedUrl&&e&&o(e.href)&&r(e.extension)?e.href:t.attr("data-jpibfi-post-url")||window.location.href},t.prototype.generate=function(t){var e=t.closest("a[href]"),n=void 0;1===e.length&&(n={extension:i.getExtension(e.prop("href")),href:e.prop("href")});var r=this.getImage(t,n);if(void 0!==r){var o=encodeURIComponent(r),s=encodeURIComponent(this.getDescription(t)),a=encodeURIComponent(this.getUrl(t,n));return"https://pinterest.com/pin/create/bookmarklet/?is_video=false&url="+a+"&media="+o+"&description="+s}},t}();i["default"]=s},{"../common/description-helper":3,"../common/srcset-helper":4}],10:[function(t,e,i){"use strict";i.__esModule=!0;var n=function(t,e,i,n){return t.top+n.top},r=function(t,e,i,n){return t.left+n.left},o=function(t,e,i,n){return e.top-i.height-n.bottom},s=function(t,e,i,n){return e.left-n.right-i.width},a=function(t,e,i){return t.top+((e.top-t.top)/2-i.height/2)},u=function(t,e,i){return t.left+((e.left-t.left)/2-i.width/2)},c=function(){function t(t,e){this.topF=t,this.leftF=e}return t.prototype.calculate=function(t,e,i,n){return{top:this.topF(t,e,i,n),left:this.leftF(t,e,i,n)}},t}(),l=function(t){switch(t){case"top-left":return new c(n,r);case"top-right":return new c(n,s);case"bottom-left":return new c(o,r);case"bottom-right":return new c(o,s);default:return new c(a,u)}},p=function(){function t(t,e){this.margins=e,this.positionCalculator=l(t)}return t.prototype.calculatePosition=function(t,e,i){return this.positionCalculator.calculate(t,e,i,this.margins)},t}();i["default"]=p},{}],11:[function(t,e,i){"use strict";var n=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();i.__esModule=!0;var r=t("./show-strategy"),o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.init=function(){this.addContainers()},e.prototype.start=function(){var t=this;this.init();var e="data-jpibfi-timeout",i=0,n=function(e){return t.$("a.pinit-button["+t.indexerAttr+'="'+e+'"]')},r=this;r.$(document).delegate(this.settings.image_selector,"mouseenter",function(){var t=r.$(this);if(r.imageFilter.imageEligible(t)){var o=t.attr(r.indexerAttr);o||(o=i++,t.attr(r.indexerAttr,o));var s=n(o);if(0===s.length){var a=r.buttonGenerator.createButton(t);if(!a)return;t.addClass("pinit-hover");var u=r.buttonGenerator.getSize(),c=t.offset(),l={top:c.top+t[0].clientHeight,left:c.left+t[0].clientWidth},p=r.positioner.calculatePosition(c,l,u);t.after(a),a.attr(r.indexerAttr,o).css("visibility","hidden").show().offset(p).css("visibility","visible").hover(function(){return clearTimeout(a.attr(e))},function(){return a.attr(e,setTimeout(function(){t.removeClass("pinit-hover"),a.remove()},100))})}else clearTimeout(s.attr(e))}}),r.$(document).delegate(this.settings.image_selector,"mouseleave",function(){if(!r.logger.getFlag("prevent_hide")){var t=r.$(this),i=t.attr(r.indexerAttr);if(i){var o=n(i);o.attr(e,setTimeout(function(){t.removeClass("pinit-hover"),o.remove()},100))}}})},e}(r["default"]);i["default"]=o},{"./show-strategy":12}],12:[function(t,e,i){"use strict";i.__esModule=!0;var n=t("./image-filter"),r=t("./button-generator"),o=t("./positioner"),s=t("../common/css-generator"),a=function(){function t(t,e,i){this.$=t,this.settings=e,this.logger=i,this.imageFilter=new n["default"](e),this.buttonGenerator=new r["default"](t,e);var a={left:e.button_margin_left,top:e.button_margin_top,right:e.button_margin_right,bottom:e.button_margin_bottom};this.positioner=new o["default"](e.button_position,a),this.indexerAttr="data-jpibfi-indexer";var u=this.settings,c=u.pin_image,l=u.pin_image_icon,p=u.pinImageHeight,f=u.pinImageWidth,h=(u.scale_pin_image,{width:f,height:p});switch(c){case"custom":case"old_default":var d=s.createCssRulesForCustomButton;d(h);break;case"default":var d=s.createCssRulesForDefaultButton;d(h,l)}}return t.prototype.addContainers=function(){var t=this.$(".jpibfi"),e=t.closest("div, article");e=e.length?e:t.parent(),e.addClass("jpibfi_container")},t}();i["default"]=a},{"../common/css-generator":1,"./button-generator":6,"./image-filter":7,"./positioner":10}],13:[function(t,e,i){"use strict";i.__esModule=!0;var n=t("./settings"),r=t("./debugger"),o=t("./hover");!function(t){var e=function(){var e=window.jpibfi_options,i=new n["default"](t.extend({pageUrl:document.URL,pageTitle:document.title,pageDescription:t('meta[name="description"]').attr("content")||""},e.hover)),s=new r["default"]("jpibfi");window.jpibfi_debugger=s;var a=new o["default"](t,i,s);a.init()};t(document).ready(e)}(window.jQuery)},{"./debugger":5,"./hover":8,"./settings":14}],14:[function(t,e,i){"use strict";i.__esModule=!0;var n=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]}),this.isTouchDevice="ontouchstart"in window||{}.hasOwnProperty.call(navigator,"maxTouchPoints")}return t}();i["default"]=n},{}]},{},[13]);
1
+ !function(){function t(e,i,n){function r(s,a){if(!i[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=i[s]={exports:{}};e[s][0].call(l.exports,function(t){var i=e[s][1][t];return r(i||t)},l,l.exports,t,e,i,n)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;s<n.length;s++)r(n[s]);return r}return t}()({1:[function(t,e,i){"use strict";var n=function(){return n=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++){e=arguments[i];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},n.apply(this,arguments)};i.__esModule=!0;var r=t("./css-helper"),o=55/64,s=51/73,a=41/64,u=36/54,c=.7,l=.7,p=function(t,e){var i=t*u;switch(e){case"pushpin":return i*l;case"thumb-tack":return i*c;default:return i}},f=function(t,e){switch(e){case"circle":return{"margin-top":-.5*t+"px","margin-left":-.5*t*o+"px"};case"plain":return{"margin-top":-.46875*t+"px","margin-left":-.5*t*s+"px"};case"thumb-tack":return{"margin-top":-29.5/64*t+"px","margin-left":-.5*t*a+"px"};case"pushpin":case"pinterest2":return{"margin-top":-.5*t+"px","margin-left":-.5*t+"px"}}},h=function(t,e,i){var o=p(t.height,e),s={height:t.height+"px !important",width:t.width+"px !important"},a=n({},s,{"font-size":o+"px"}),u=f(o,e);r.addMediaQueryRule("a.pinit-button",i,s),r.addMediaQueryRule("a.pinit-button span",i,a),r.addMediaQueryRule("a.pinit-button span:before",i,u)};i.createCssRulesForDefaultButton=function(t,e){h(t,e,0)};var d=function(t,e){var i={height:t.height+"px !important",width:t.width+"px !important"},o=n({},i,{"background-size":t.width+"px "+t.height+"px !important"});r.addMediaQueryRule("a.pinit-button",e,i),r.addMediaQueryRule("a.pinit-button span",e,o)};i.createCssRulesForCustomButton=function(t){d(t,0)}},{"./css-helper":2}],2:[function(t,e,i){"use strict";i.__esModule=!0;var n,r;!function(t){t[t.xsm=0]="xsm",t[t.sm=576]="sm",t[t.md=768]="md",t[t.lg=992]="lg",t[t.xlg=1200]="xlg"}(r=i.Breakpoints||(i.Breakpoints={})),i.BreakpointsList=Object.keys(r).filter(function(t){return"number"==typeof r[t]}).map(function(t){return Number(r[t])}),i.getCurrentBreakpoint=function(){for(var t=window.innerWidth,e=i.BreakpointsList.length-1;e>=0;e--)if(t>=i.BreakpointsList[e])return i.BreakpointsList[e];return r.xsm};var o=(n={},n[r.xsm]={width:50,height:50},n[r.sm]={width:60,height:60},n[r.md]={width:80,height:80},n[r.lg]={width:110,height:110},n[r.xlg]={width:1e3,height:1e3},n),s=function(t,e){var i="string"==typeof e?e:Object.keys(e).map(function(t){return t+":"+("content"===t?"'"+e[t]+"'":e[t])}).join(";");return t+" {"+i+"}"},a=function(t,e){return"@media (min-width: "+t+"px){ "+e+" }"},u=function(t){var e=document.createElement("style"),i=document.head.appendChild(e).sheet;i.insertRule(t,i.cssRules.length)};i.addCssRule=function(t,e){u(s(t,e))},i.addMediaQueryRule=function(t,e,i){var n=s(t,i),r=e>0?a(e,n):n;u(r)};var c=function(t,e){var i=Math.min(1,e.width/t.width),n=Math.min(1,e.height/t.height);return Math.min(i,n)};i.calculateSizeForBreakpoint=function(t,e){var i=o[e],n=c(t,i);return{height:t.height*n,width:t.width*n}}},{}],3:[function(t,e,i){"use strict";i.__esModule=!0;var n=function(){function t(t){var e=(void 0===t?{}:t).siteTitle,i=void 0===e?"":e;this.desc_funcs={img_title:function(t){return t.attr("title")||t.attr("data-jpibfi-title")},img_alt:function(t){return t.attr("alt")||t.attr("data-jpibfi-alt")},post_title:function(t){return t.attr("data-jpibfi-post-title")},post_excerpt:function(t){return t.attr("data-jpibfi-post-excerpt")},img_description:function(t){return t.attr("data-jpibfi-description")},img_caption:function(t){return t.attr("data-jpibfi-caption")},site_title:function(){return i},data_pin_description:function(t){return t.attr("data-pin-description")}}}return t.prototype.getDescription=function(t,e){for(var i="",n=0;n<e.length&&!i;n++)i=this.desc_funcs[e[n]](t);return i||""},t}();i["default"]=n},{}],4:[function(t,e,i){"use strict";i.__esModule=!0;var n;!function(t){t[t.Width=0]="Width",t[t.PixelDensity=1]="PixelDensity"}(n||(n={}));var r=/(.+)\s+(\d{1,4})w\s*/i,o=/(.*)\s+(\d{1,3}(\.\d{0,2})?)x\s*/i,s={Url:1,WidthDescriptor:2},a=function(t){if(0!==t.length)return t.some(function(t){return null!==r.exec(t)})?n.Width:t.some(function(t){return null!==o.exec(t)})?n.PixelDensity:void 0},u=function(t,e){if(e!==n.PixelDensity){var i=t.map(function(t){return r.exec(t)}).filter(function(t){return!!t}).map(function(t){return{url:t[s.Url].trim(),width:Number(t[s.WidthDescriptor])}});if(0!==i.length)return i.reduce(function(t,e){return t.width>e.width?t:e},i[0])}};i.getWidestImageUrlFromSrcset=function(t){var e=t.prop?t.prop("srcset"):t.attr("srcset");if(e&&0!==e.length)try{var i=e.split(","),n=a(i),r=u(i,n);return void 0!==r?r.url:void 0}catch(o){return void(console&&console.error&&console.error(o))}}},{}],5:[function(t,e,i){"use strict";i.__esModule=!0;var n=function(){function t(t){var e=this;this.flags={},this.pluginName=t;var i="undefined"!=typeof console&&"undefined"!=typeof console.log,n="undefined"!=typeof JSON&&"function"==typeof JSON.stringify;i?(this.logString=function(t){e.log(t)},this.logObject=n?function(t){e.log(JSON.stringify(t,null,4))}:function(t){return e.simplelogObject(t)}):(this.logString=function(){},this.logObject=function(){});var r=this.getQueryParams(document.location.search);Object.keys(r).forEach(function(i){var n=i.replace(t+"_","");e.setFlag(n,r[i])})}return t.prototype.getFlag=function(t){return void 0!==this.flags[t]&&this.flags[t]},t.prototype.getQueryParams=function(t){t=t.split("+").join(" ");for(var e,i={},n=/[?&]?([^=]+)=([^&]*)/g;e=n.exec(t);)i[decodeURIComponent(e[1])]=decodeURIComponent(e[2]);return i},t.prototype.log=function(t){this.getFlag("print")&&console.log(this.pluginName+" debug: "+t)},t.prototype.setFlag=function(t,e){void 0===e&&(e=!0),this.flags[t]=e},t.prototype.simplelogObject=function(t){if(this.getFlag("print")){var e=Object.keys(t).filter(function(e){return t.hasOwnPrototype(e)}).map(function(e){return e+": "+t[e]+"\n"}).join();this.log(e)}},t}();i["default"]=n},{}],6:[function(t,e,i){"use strict";i.__esModule=!0;var n=t("./link-generator"),r=function(){function t(t,e){this.$=t,this.settings=e,this.linkGenerator=new n["default"](e),this.$element=this.$("<a />",{target:"_blank","class":"pinit-button "+e.pin_image});var i="default"===e.pin_image?"jpibfi-icon-"+e.pin_image_icon:"";this.$element.html('<span class="'+i+'"></span>'),"default"===e.pin_image&&this.$element.addClass("jpibfi-button-"+e.pin_image_button)}return t.prototype.createButton=function(t){var e=this.linkGenerator.generate(t);if(e)return this.$element.clone(!1).attr("href",e).click(function(t){t.preventDefault(),t.stopPropagation(),"#"!==t.currentTarget.href.slice(-1)&&window.open(t.currentTarget.href,"mw"+t.timeStamp,"left=20,top=20,width=600,height=500,toolbar=1,resizable=0")})},t.prototype.getSize=function(){var t={height:this.settings.pinImageHeight,width:this.settings.pinImageWidth};return t},t}();i["default"]=r},{"./link-generator":9}],7:[function(t,e,i){"use strict";i.__esModule=!0;var n=function(){function t(t){var e=this;this.settings=t,this.disabledClasses=this.createClassList(t.disabled_classes),this.enabledClasses=this.createClassList(t.enabled_classes),this.updateSizeConstraints(),window.addEventListener("resize",function(){return e.updateSizeConstraints()},!1)}return t.prototype.createClassList=function(t){return void 0===t&&(t=""),t.split(";").filter(function(t){return!!t})},t.prototype.imageEligible=function(t){return this.imageSizeIsOk(t)&&(0===this.enabledClasses.length||this.enabledClasses.some(function(e){return t.hasClass(e)||t.parents("."+e).length>0}))&&!this.disabledClasses.some(function(e){return t.hasClass(e)||t.parents("."+e).length>0})},t.prototype.imageSizeIsOk=function(t){var e=t[0].clientWidth,i=t[0].clientHeight;return e>=this.minWidth&&i>=this.minHeight},t.prototype.updateSizeConstraints=function(){this.minWidth=window.outerWidth<768?this.settings.min_image_width_small:this.settings.min_image_width,this.minHeight=window.outerWidth<768?this.settings.min_image_height_small:this.settings.min_image_height},t}();i["default"]=n},{}],8:[function(t,e,i){"use strict";i.__esModule=!0;var n=t("./show-on-hover-strategy"),r=function(){function t(t,e,i){this.settings=e,this.$=t,this.logger=i}return t.prototype.init=function(){this.showStrategy=this.getStrategy(),this.showStrategy.start()},t.prototype.getStrategy=function(){var t=null;return new(t=n["default"])(this.$,this.settings,this.logger)},t}();i["default"]=r},{"./show-on-hover-strategy":11}],9:[function(t,e,i){"use strict";i.__esModule=!0;var n=t("../common/description-helper");t("../common/srcset-helper");i.getExtension=function(t){void 0===t&&(t="");var e=t.replace(/^https?\:\/\/[^\/?#]+(?:[\/?#]|$)/i,""),i=e.split(".");if(1===i.length)return"";var n=i[i.length-1],r=n.replace(/\?.*/i,"").toLowerCase();return r};var r=function(t){return["","html","php"].indexOf(t)!==-1},o=function(t){var e=window.location&&window.location.hostname||"",i=e.replace("www.","");return t.indexOf(i)>=0},s=function(){function t(t){this.descriptionHelper=new n["default"]({siteTitle:t.siteTitle}),this.description_option=t.description_option,this.supportSrcset=t.support_srcset,this.pinLinkedUrl=t.pin_linked_url}return t.prototype.getDescription=function(t){return this.descriptionHelper.getDescription(t,this.description_option)},t.prototype.getImage=function(t,e){var n=t.attr("data-pin-media")||t.attr("data-jpibfi-src")||t.prop("src");if(n){if(!e)return n;var r=i.getExtension(n);return e.extension===r?e.href:n}},t.prototype.getUrl=function(t,e){return t.attr("data-pin-url")?t.attr("data-pin-url"):this.pinLinkedUrl&&e&&o(e.href)&&r(e.extension)?e.href:t.attr("data-jpibfi-post-url")||window.location.href},t.prototype.generate=function(t){var e=t.closest("a[href]"),n=void 0;1===e.length&&(n={extension:i.getExtension(e.prop("href")),href:e.prop("href")});var r=this.getImage(t,n);if(void 0!==r){var o=encodeURIComponent(r),s=encodeURIComponent(this.getDescription(t)),a=encodeURIComponent(this.getUrl(t,n));return"https://pinterest.com/pin/create/bookmarklet/?is_video=false&url="+a+"&media="+o+"&description="+s}},t}();i["default"]=s},{"../common/description-helper":3,"../common/srcset-helper":4}],10:[function(t,e,i){"use strict";i.__esModule=!0;var n=function(t,e,i,n){return t.top+n.top},r=function(t,e,i,n){return t.left+n.left},o=function(t,e,i,n){return e.top-i.height-n.bottom},s=function(t,e,i,n){return e.left-n.right-i.width},a=function(t,e,i){return t.top+((e.top-t.top)/2-i.height/2)},u=function(t,e,i){return t.left+((e.left-t.left)/2-i.width/2)},c=function(){function t(t,e){this.topF=t,this.leftF=e}return t.prototype.calculate=function(t,e,i,n){return{top:this.topF(t,e,i,n),left:this.leftF(t,e,i,n)}},t}(),l=function(t){switch(t){case"top-left":return new c(n,r);case"top-right":return new c(n,s);case"bottom-left":return new c(o,r);case"bottom-right":return new c(o,s);default:return new c(a,u)}},p=function(){function t(t,e){this.margins=e,this.positionCalculator=l(t)}return t.prototype.calculatePosition=function(t,e,i){return this.positionCalculator.calculate(t,e,i,this.margins)},t}();i["default"]=p},{}],11:[function(t,e,i){"use strict";var n=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();i.__esModule=!0;var r=t("./show-strategy"),o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.init=function(){this.addContainers()},e.prototype.start=function(){var t=this;this.init();var e="data-jpibfi-timeout",i=0,n=function(e){return t.$("a.pinit-button["+t.indexerAttr+'="'+e+'"]')},r=this;r.$(document).delegate(this.settings.image_selector,"mouseenter",function(){var t=r.$(this);if(r.imageFilter.imageEligible(t)){var o=t.attr(r.indexerAttr);o||(o=i++,t.attr(r.indexerAttr,o));var s=n(o);if(0===s.length){var a=r.buttonGenerator.createButton(t);if(!a)return;t.addClass("pinit-hover");var u=r.buttonGenerator.getSize(),c=t.offset(),l={top:c.top+t[0].clientHeight,left:c.left+t[0].clientWidth},p=r.positioner.calculatePosition(c,l,u);t.after(a),a.attr(r.indexerAttr,o).css("visibility","hidden").show().offset(p).css("visibility","visible").hover(function(){return clearTimeout(a.attr(e))},function(){return a.attr(e,setTimeout(function(){t.removeClass("pinit-hover"),a.remove()},100))})}else clearTimeout(s.attr(e))}}),r.$(document).delegate(this.settings.image_selector,"mouseleave",function(){if(!r.logger.getFlag("prevent_hide")){var t=r.$(this),i=t.attr(r.indexerAttr);if(i){var o=n(i);o.attr(e,setTimeout(function(){t.removeClass("pinit-hover"),o.remove()},100))}}})},e}(r["default"]);i["default"]=o},{"./show-strategy":12}],12:[function(t,e,i){"use strict";i.__esModule=!0;var n=t("./image-filter"),r=t("./button-generator"),o=t("./positioner"),s=t("../common/css-generator"),a=function(){function t(t,e,i){this.$=t,this.settings=e,this.logger=i,this.imageFilter=new n["default"](e),this.buttonGenerator=new r["default"](t,e);var a={left:e.button_margin_left,top:e.button_margin_top,right:e.button_margin_right,bottom:e.button_margin_bottom};this.positioner=new o["default"](e.button_position,a),this.indexerAttr="data-jpibfi-indexer";var u=this.settings,c=u.pin_image,l=u.pin_image_icon,p=u.pinImageHeight,f=u.pinImageWidth,h=(u.scale_pin_image,{width:f,height:p});switch(c){case"custom":case"old_default":var d=s.createCssRulesForCustomButton;d(h);break;case"default":var d=s.createCssRulesForDefaultButton;d(h,l)}}return t.prototype.addContainers=function(){var t=this.$(".jpibfi"),e=t.closest("div, article");e=e.length?e:t.parent(),e.addClass("jpibfi_container")},t}();i["default"]=a},{"../common/css-generator":1,"./button-generator":6,"./image-filter":7,"./positioner":10}],13:[function(t,e,i){"use strict";i.__esModule=!0;var n=t("./settings"),r=t("./debugger"),o=t("./hover");!function(t){var e=function(){var e=window.jpibfi_options,i=new n["default"](t.extend({pageUrl:document.URL,pageTitle:document.title,pageDescription:t('meta[name="description"]').attr("content")||""},e.hover)),s=new r["default"]("jpibfi");window.jpibfi_debugger=s;var a=new o["default"](t,i,s);a.init()};t(document).ready(e)}(window.jQuery)},{"./debugger":5,"./hover":8,"./settings":14}],14:[function(t,e,i){"use strict";i.__esModule=!0;var n=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]}),this.isTouchDevice="ontouchstart"in window||{}.hasOwnProperty.call(navigator,"maxTouchPoints")}return t}();i["default"]=n},{}]},{},[13]);
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
Contributors: mrsztuczkens, redearthdesign, brocheafoin, robertark
3
Tags: pinterest, pin it, button, image, images, pinit, social media, hover, click, photo, photos
4
Requires at least: 3.3.0
5
- Tested up to: 5.1.0
6
- Stable tag: 3.0.4
7
License: GPLv2 or later
8
9
Highlights images on hover and adds a Pinterest "Pin It" button over them for easy pinning.
@@ -68,6 +68,11 @@ Please report them in the plugin's support forum on Wordpress.org.
68
69
== Changelog ==
70
71
= 3.0.4 =
72
* Released 2019-02-25
73
* Removed advertisement link
@@ -385,6 +390,9 @@ Please report them in the plugin's support forum on Wordpress.org.
385
386
== Upgrade Notice ==
387
388
= 3.0.4 =
389
* Remove advertisement link
390
2
Contributors: mrsztuczkens, redearthdesign, brocheafoin, robertark
3
Tags: pinterest, pin it, button, image, images, pinit, social media, hover, click, photo, photos
4
Requires at least: 3.3.0
5
+ Tested up to: 5.2.3
6
+ Stable tag: 3.0.5
7
License: GPLv2 or later
8
9
Highlights images on hover and adds a Pinterest "Pin It" button over them for easy pinning.
68
69
== Changelog ==
70
71
+ = 3.0.5 =
72
+ * Released 2019-09-15
73
+ * Improvements to how enabled and disabled classes work
74
+ * Fixed button sizing for Gutenberg galleries
75
+
76
= 3.0.4 =
77
* Released 2019-02-25
78
* Removed advertisement link
390
391
== Upgrade Notice ==
392
393
+ = 3.0.5 =
394
+ * Improvements to how enabled and disabled classes work and fFixed button sizing for Gutenberg galleries
395
+
396
= 3.0.4 =
397
* Remove advertisement link
398