Version Description
- Release 2016-03-15
- Few minor fixes
Download this release
Release Info
Developer | mrsztuczkens |
Plugin | jQuery Pin It Button for Images |
Version | 1.51 |
Comparing to | |
See all releases |
Code changes from version 1.50 to 1.51
- includes/admin/class-jpibfi-admin.php +1 -1
- jquery-pin-it-button-for-images.php +2 -2
- js/jpibfi.js +1 -1
- readme.txt +8 -1
includes/admin/class-jpibfi-admin.php
CHANGED
@@ -32,7 +32,7 @@ class JPIBFI_Admin {
|
|
32 |
$this->admin_screen_hook = add_options_page(
|
33 |
$name,
|
34 |
$name,
|
35 |
-
'
|
36 |
'jpibfi_settings',
|
37 |
array( $this, 'print_admin_page' )
|
38 |
);
|
32 |
$this->admin_screen_hook = add_options_page(
|
33 |
$name,
|
34 |
$name,
|
35 |
+
'manage_options',
|
36 |
'jpibfi_settings',
|
37 |
array( $this, 'print_admin_page' )
|
38 |
);
|
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:1.
|
10 |
Author URI: http://mrsztuczkens.me/
|
11 |
*/
|
12 |
|
@@ -42,7 +42,7 @@ if ( ! class_exists( 'jQuery_Pin_It_Button_For_Images' ) ) :
|
|
42 |
private function includes() {
|
43 |
|
44 |
require_once(plugin_dir_path(__FILE__) . 'includes/class-jpibfi-globals.php');
|
45 |
-
JPIBFI_Globals::init(__FILE__, '1.
|
46 |
|
47 |
$files = array(
|
48 |
'includes/admin/class-jpibfi-admin-utilities.php',
|
6 |
Text Domain: jquery-pin-it-button-for-images
|
7 |
Domain Path: /languages
|
8 |
Author: Marcin Skrzypiec
|
9 |
+
Version:1.51
|
10 |
Author URI: http://mrsztuczkens.me/
|
11 |
*/
|
12 |
|
42 |
private function includes() {
|
43 |
|
44 |
require_once(plugin_dir_path(__FILE__) . 'includes/class-jpibfi-globals.php');
|
45 |
+
JPIBFI_Globals::init(__FILE__, '1.51', 'a');
|
46 |
|
47 |
$files = array(
|
48 |
'includes/admin/class-jpibfi-admin-utilities.php',
|
js/jpibfi.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var jpibfi;!function(jpibfi){!function(ButtonPosition){ButtonPosition[ButtonPosition.TopLeft=0]="TopLeft",ButtonPosition[ButtonPosition.TopRight=1]="TopRight",ButtonPosition[ButtonPosition.BottomLeft=2]="BottomLeft",ButtonPosition[ButtonPosition.BottomRight=3]="BottomRight",ButtonPosition[ButtonPosition.Middle=4]="Middle"}(jpibfi.ButtonPosition||(jpibfi.ButtonPosition={}));jpibfi.ButtonPosition;!function(ShowButton){ShowButton[ShowButton.Hover=0]="Hover",ShowButton[ShowButton.AlwaysTouch=1]="AlwaysTouch",ShowButton[ShowButton.Always=2]="Always"}(jpibfi.ShowButton||(jpibfi.ShowButton={}));jpibfi.ShowButton}(jpibfi||(jpibfi={}));var jpibfi;!function(jpibfi){var PinButtonGenerator=function(){function PinButtonGenerator($,settings,logger){this.$=$,this.settings=settings,this.logger=logger}return PinButtonGenerator.prototype.cancelHide=function($button){clearTimeout($button.data("jpibfi-timeoutId"))},PinButtonGenerator.prototype.hide=function($button,callback){void 0===callback&&(callback=function(){});var timeoutId=($button.data("jpibfi-indexer"),setTimeout(function(){$button.remove(),callback.call(null,null)},100));$button.data("jpibfi-timeoutId",timeoutId)},PinButtonGenerator.prototype.generateForImage=function($image){var indexer=$image.data("jpibfi-indexer"),$anchor=this.$("<a/>",{href:"#","class":"pinit-button","data-jpibfi-indexer":indexer,text:""}),that=this;$anchor.click(function(){var $this=that.$(this);that.logger.logString("Pin In button clicked");var index=that.$(this).data("jpibfi-indexer"),$image=that.$('img[data-jpibfi-indexer="'+index+'"]'),bookmarkDescription="",descriptionForUrl="",bookmarkUrl="";if(that.settings.usePostUrl){var $inputWithData=$image.closest(".jpibfi_container").find("input.jpibfi").first();$inputWithData.length&&(descriptionForUrl=$inputWithData.data("jpibfi-description"),bookmarkUrl=$inputWithData.data("jpibfi-url"))}bookmarkUrl=bookmarkUrl||that.settings.pageUrl,3==that.settings.descriptionOption?bookmarkDescription=$image.attr("title")||$image.attr("alt"):2==that.settings.descriptionOption?bookmarkDescription=descriptionForUrl||that.settings.pageDescription:4==that.settings.descriptionOption?bookmarkDescription=that.settings.siteTitle:5==that.settings.descriptionOption?bookmarkDescription=$image.data("jpibfi-description"):6==that.settings.descriptionOption&&(bookmarkDescription=$image.attr("alt")),bookmarkDescription=bookmarkDescription||descriptionForUrl||that.settings.pageTitle;var imageUrl="http://pinterest.com/pin/create/bookmarklet/?is_video="+encodeURIComponent("false")+"&url="+encodeURIComponent(bookmarkUrl)+"&media="+encodeURIComponent(that.getImageUrl($image))+"&description="+encodeURIComponent(bookmarkDescription);return that.settings.isTouchDevice?($this.attr("href",imageUrl).attr("target","_blank"),!0):(window.open(imageUrl,"_blank","width=632,height=253,status=0,toolbar=0,menubar=0,location=1,scrollbars=1"),!1)});var position=that.calculateButtonPosition($image);return $image.after($anchor),$anchor.show().offset({left:position.left,top:position.top}),$anchor},PinButtonGenerator.prototype.getImageUrl=function($elem){var defaultUrl=this.$.fn.prop&&$elem.prop("src")||$elem.attr("src");return this.settings.pinLinkedImages?this.getLinkedImageUrl($elem)||defaultUrl:defaultUrl},PinButtonGenerator.prototype.getLinkedImageUrl=function($element){var $parent=$element.parents("a").first();if($parent.length){var href=$parent.attr("href"),useUrl=!!href&&this.fileExtensionAllowed(this.getFileExtension(href),this.settings.pinLinkedImagesExtensions);if(useUrl)return href}return null},PinButtonGenerator.prototype.getFileExtension=function(url){var parts=url.split(".");return 1==parts.length?"":parts.pop().split(/\#|\?/)[0]},PinButtonGenerator.prototype.fileExtensionAllowed=function(extension,listOfExtensions){if(!listOfExtensions.length)return!0;for(var extensions=listOfExtensions.split(","),i=0;i<extensions.length;i++)if(extensions[i]==extension)return!0;return!1},PinButtonGenerator.prototype.urlInCurrentDomain=function(url){var currentDomain=document.domain.replace(/^www./,"");return-1!=url.indexOf(currentDomain)},PinButtonGenerator.prototype.calculateButtonPosition=function($image){var position=$image.offset(),imageDimensions={width:$image.get(0).clientWidth,height:$image.get(0).clientHeight};switch(this.settings.buttonPosition){case jpibfi.ButtonPosition.TopLeft:position.left+=this.settings.buttonMarginLeft,position.top+=this.settings.buttonMarginTop;break;case jpibfi.ButtonPosition.TopRight:position.top+=this.settings.buttonMarginTop,position.left=position.left+imageDimensions.width-this.settings.buttonMarginRight-this.settings.pinImageWidth;break;case jpibfi.ButtonPosition.BottomLeft:position.left+=this.settings.buttonMarginLeft,position.top=position.top+imageDimensions.height-this.settings.buttonMarginBottom-this.settings.pinImageHeight;break;case jpibfi.ButtonPosition.BottomRight:position.left=position.left+imageDimensions.width-this.settings.buttonMarginRight-this.settings.pinImageWidth,position.top=position.top+imageDimensions.height-this.settings.buttonMarginBottom-this.settings.pinImageHeight;break;case jpibfi.ButtonPosition.Middle:position.left=Math.round(position.left+imageDimensions.width/2-this.settings.pinImageWidth/2),position.top=Math.round(position.top+imageDimensions.height/2-this.settings.pinImageHeight/2)}return position},PinButtonGenerator}();jpibfi.PinButtonGenerator=PinButtonGenerator}(jpibfi||(jpibfi={}));var jpibfi;!function(jpibfi){var Logger=function(){function Logger(printLog){this._printLog=printLog&&"undefined"!=typeof console&&"undefined"!=typeof console.log,this._jsonStringifyExists="undefined"!=typeof JSON&&"function"==typeof JSON.stringify}return Logger.prototype._logObject=function(obj){var out="";for(var p in obj)out+=p+": "+obj[p]+"\n";console.log("jpibfi debug: "+out)},Logger.prototype.logString=function(message){this._printLog&&console.log("jpibfi debug: "+message)},Logger.prototype.logObject=function(obj){this._printLog&&(this._jsonStringifyExists?console.log("jpibfi debugz: "+JSON.stringify(obj,null,4)):this._logObject(obj))},Logger}();jpibfi.Logger=Logger}(jpibfi||(jpibfi={}));var jpibfi;!function(jpibfi){var Settings=function(){function Settings(settings){this.filterSelector="*",this.notSelector="",this.buttonMarginTop=parseInt(settings.buttonMarginTop),this.buttonMarginRight=parseInt(settings.buttonMarginRight),this.buttonMarginBottom=parseInt(settings.buttonMarginBottom),this.buttonMarginLeft=parseInt(settings.buttonMarginLeft),this.buttonPosition=settings.hasOwnProperty("buttonPosition")?parseInt(settings.buttonPosition):4,this.debug=settings.hasOwnProperty("debug")?"1"==settings.debug:!1,this.descriptionOption=settings.hasOwnProperty("descriptionOption")?parseInt(settings.descriptionOption):1,this.imageSelector=settings.imageSelector,this.isTouchDevice="ontouchstart"in window||navigator.hasOwnProperty("maxTouchPoints"),this.minImageWidth=settings.hasOwnProperty("minImageWidth")?parseInt(settings.minImageWidth):0,this.minImageHeight=settings.hasOwnProperty("minImageHeight")?parseInt(settings.minImageHeight):0,this.showButton=settings.hasOwnProperty("showButton")?this.parseShowButtonSettings(settings.showButton):jpibfi.ShowButton.Hover,this.pageDescription=settings.pageDescription,this.pageTitle=settings.pageTitle,this.pageUrl=settings.pageUrl,this.pinImageHeight=parseInt(settings.pinImageHeight),this.pinImageWidth=parseInt(settings.pinImageWidth),this.pinLinkedImages=1==settings.pinLinkedImages,this.pinLinkedImagesExtensions=settings.pinLinkedImagesExtensions,this.retinaFriendly=settings.hasOwnProperty("retinaFriendly")?1==settings.retinaFriendly:!1,this.siteTitle=settings.siteTitle,this.usePostUrl=settings.hasOwnProperty("usePostUrl")?settings.usePostUrl:!0,this.containerSelector=settings.containerSelector,this.notSelector=settings.hasOwnProperty("disabledClasses")?this.createSelectorFromList(settings.disabledClasses):"",this.filterSelector=settings.hasOwnProperty("enabledClasses")?this.createSelectorFromList(settings.enabledClasses)||"*":"*",this.adjustPinImageSize()}return Settings.prototype.adjustPinImageSize=function(){this.retinaFriendly&&(this.pinImageHeight=Math.ceil(this.pinImageHeight/2),this.pinImageWidth=Math.ceil(this.pinImageWidth/2))},Settings.prototype.createSelectorFromList=function(classes){for(var arrayOfClasses=classes.split(";"),selector="",i=0;i<arrayOfClasses.length;i++)arrayOfClasses[i]&&(selector+="."+arrayOfClasses[i]+",");return selector?selector.substr(0,selector.length-1):selector},Settings.prototype.parseShowButtonSettings=function(showButton){switch(showButton){case"always":return jpibfi.ShowButton.Always;case"always_touch":return jpibfi.ShowButton.AlwaysTouch;case"hover":default:return jpibfi.ShowButton.Hover}},Settings}();jpibfi.Settings=Settings}(jpibfi||(jpibfi={}));var jpibfi;!function(jpibfi){"use strict";var Hover=function(){function Hover($,settings,logger,buttonGenerator){this.$=$,this.settings=settings,this.logger=logger,this.buttonGenerator=buttonGenerator,this._indexer=0,this.ignoreAttributeName="data-jpibfi-ignore",this.ignoreAttributeSelector="["+this.ignoreAttributeName+"]",this.indexerAttributeName="data-jpibfi-indexer",this.indexerAttributeSelector="["+this.indexerAttributeName+"]"}return Hover.prototype.init=function(){var that=this;this.$(document).delegate(that.settings.imageSelector,"mouseenter",function(){var $image=that.$(this);if(!$image.is(that.ignoreAttributeSelector)){var ignoreImage=$image.is(that.settings.notSelector)||$image.is(that.settings.filterSelector)===!1||$image[0].clientWidth<that.settings.minImageWidth||$image[0].clientHeight<that.settings.minImageHeight;if(ignoreImage)return $image.attr(that.ignoreAttributeName,1..toString());var indexer=$image.attr(that.indexerAttributeName);indexer||(indexer=(that._indexer++).toString(),$image.attr(that.indexerAttributeName,indexer));var $button=that.$('a.pinit-button[data-jpibfi-indexer="'+indexer+'"]');if(1==$button.length)that.buttonGenerator.cancelHide($button);else{var $anchor=that.buttonGenerator.generateForImage($image);null!=$anchor&&($anchor.mouseenter(function(){that.buttonGenerator.cancelHide(that.$(this))}),$anchor.mouseleave(function(){that.buttonGenerator.hide(that.$(this),function(){$image.removeClass("pinit-hover")})}),$image.addClass("pinit-hover"))}}}),that.$(document).delegate(that.settings.imageSelector,"mouseleave",function(){var $image=that.$(this),indexer=$image.attr(that.indexerAttributeName);if(indexer){var $button=that.$('a.pinit-button[data-jpibfi-indexer="'+indexer+'"]');that.buttonGenerator.hide($button,function(){$image.removeClass("pinit-hover")})}})},Hover}();jpibfi.Hover=Hover}(jpibfi||(jpibfi={}));var jpibfi;!function(jpibfi){"use strict";var Plugin=function(){function Plugin($,options){this.$=$,this.settings=new jpibfi.Settings(this.$.extend({pageUrl:document.URL,pageTitle:document.title,pageDescription:$('meta[name="description"]').attr("content")||""},options)),this.logger=new jpibfi.Logger(this.settings.debug),this.logger.logObject(this.settings),this.buttonGenerator=new jpibfi.PinButtonGenerator(this.$,this.settings,this.logger)}return Plugin.prototype.init=function(){var _this=this;this.addContainers(),this.$(document).scroll(function(){return _this.addContainers()}),this.$(document).ajaxSuccess(function(){return _this.addContainers()});var hover=new jpibfi.Hover(this.$,this.settings,this.logger,this.buttonGenerator);hover.init()},Plugin.prototype.addContainers=function(){var $containers=this.$(".jpibfi").not(".jpibfi-ignore");0!=$containers.length&&($containers.closest(this.settings.containerSelector).addClass("jpibfi_container"),$containers.addClass("jpibfi-ignore"))},Plugin}();!function($){$(document).ready(function(){var plugin=new Plugin($,jpibfi_options);plugin.init()})}(jQuery)}(jpibfi||(jpibfi={}));
|
1 |
+
var jpibfi;!function(jpibfi){!function(ButtonPosition){ButtonPosition[ButtonPosition.TopLeft=0]="TopLeft",ButtonPosition[ButtonPosition.TopRight=1]="TopRight",ButtonPosition[ButtonPosition.BottomLeft=2]="BottomLeft",ButtonPosition[ButtonPosition.BottomRight=3]="BottomRight",ButtonPosition[ButtonPosition.Middle=4]="Middle"}(jpibfi.ButtonPosition||(jpibfi.ButtonPosition={}));jpibfi.ButtonPosition;!function(ShowButton){ShowButton[ShowButton.Hover=0]="Hover",ShowButton[ShowButton.AlwaysTouch=1]="AlwaysTouch",ShowButton[ShowButton.Always=2]="Always"}(jpibfi.ShowButton||(jpibfi.ShowButton={}));jpibfi.ShowButton}(jpibfi||(jpibfi={}));var jpibfi;!function(jpibfi){var PinButtonGenerator=function(){function PinButtonGenerator($,settings,logger){this.$=$,this.settings=settings,this.logger=logger}return PinButtonGenerator.prototype.cancelHide=function($button){clearTimeout($button.data("jpibfi-timeoutId"))},PinButtonGenerator.prototype.hide=function($button,callback){void 0===callback&&(callback=function(){});var timeoutId=($button.data("jpibfi-indexer"),setTimeout(function(){$button.remove(),callback.call(null,null)},100));$button.data("jpibfi-timeoutId",timeoutId)},PinButtonGenerator.prototype.generateForImage=function($image){var indexer=$image.data("jpibfi-indexer"),$anchor=this.$("<a/>",{href:"#","class":"pinit-button","data-jpibfi-indexer":indexer,text:""}),that=this;$anchor.click(function(){var $this=that.$(this);that.logger.logString("Pin In button clicked");var index=that.$(this).data("jpibfi-indexer"),$image=that.$('img[data-jpibfi-indexer="'+index+'"]'),bookmarkDescription="",descriptionForUrl="",bookmarkUrl="";if(that.settings.usePostUrl){var $inputWithData=$image.closest(".jpibfi_container").find("input.jpibfi").first();$inputWithData.length&&(descriptionForUrl=$inputWithData.data("jpibfi-description"),bookmarkUrl=$inputWithData.data("jpibfi-url"))}bookmarkUrl=bookmarkUrl||that.settings.pageUrl,3==that.settings.descriptionOption?bookmarkDescription=$image.attr("title")||$image.attr("alt"):2==that.settings.descriptionOption?bookmarkDescription=descriptionForUrl||that.settings.pageDescription:4==that.settings.descriptionOption?bookmarkDescription=that.settings.siteTitle:5==that.settings.descriptionOption?bookmarkDescription=$image.data("jpibfi-description"):6==that.settings.descriptionOption&&(bookmarkDescription=$image.attr("alt")),bookmarkDescription=bookmarkDescription||descriptionForUrl||that.settings.pageTitle;var imageUrl="http://pinterest.com/pin/create/bookmarklet/?is_video="+encodeURIComponent("false")+"&url="+encodeURIComponent(bookmarkUrl)+"&media="+encodeURIComponent(that.getImageUrl($image))+"&description="+encodeURIComponent(bookmarkDescription);return that.settings.isTouchDevice?($this.attr("href",imageUrl).attr("target","_blank"),!0):(window.open(imageUrl,"_blank","width=632,height=253,status=0,toolbar=0,menubar=0,location=1,scrollbars=1"),!1)});var position=that.calculateButtonPosition($image);return $image.after($anchor),$anchor.css("visibility","hidden").show().offset({left:position.left,top:position.top}).css("visibility","visible"),$anchor},PinButtonGenerator.prototype.getImageUrl=function($elem){var defaultUrl=this.$.fn.prop&&$elem.prop("src")||$elem.attr("src");return this.settings.pinLinkedImages?this.getLinkedImageUrl($elem)||defaultUrl:defaultUrl},PinButtonGenerator.prototype.getLinkedImageUrl=function($element){var $parent=$element.parents("a").first();if($parent.length){var href=$parent.attr("href"),useUrl=!!href&&this.fileExtensionAllowed(this.getFileExtension(href),this.settings.pinLinkedImagesExtensions);if(useUrl)return href}return null},PinButtonGenerator.prototype.getFileExtension=function(url){var parts=url.split(".");return 1==parts.length?"":parts.pop().split(/\#|\?/)[0]},PinButtonGenerator.prototype.fileExtensionAllowed=function(extension,listOfExtensions){if(!listOfExtensions.length)return!0;for(var extensions=listOfExtensions.split(","),i=0;i<extensions.length;i++)if(extensions[i]==extension)return!0;return!1},PinButtonGenerator.prototype.urlInCurrentDomain=function(url){var currentDomain=document.domain.replace(/^www./,"");return-1!=url.indexOf(currentDomain)},PinButtonGenerator.prototype.calculateButtonPosition=function($image){var position=$image.offset(),imageDimensions={width:$image.get(0).clientWidth,height:$image.get(0).clientHeight};switch(this.settings.buttonPosition){case jpibfi.ButtonPosition.TopLeft:position.left+=this.settings.buttonMarginLeft,position.top+=this.settings.buttonMarginTop;break;case jpibfi.ButtonPosition.TopRight:position.top+=this.settings.buttonMarginTop,position.left=position.left+imageDimensions.width-this.settings.buttonMarginRight-this.settings.pinImageWidth;break;case jpibfi.ButtonPosition.BottomLeft:position.left+=this.settings.buttonMarginLeft,position.top=position.top+imageDimensions.height-this.settings.buttonMarginBottom-this.settings.pinImageHeight;break;case jpibfi.ButtonPosition.BottomRight:position.left=position.left+imageDimensions.width-this.settings.buttonMarginRight-this.settings.pinImageWidth,position.top=position.top+imageDimensions.height-this.settings.buttonMarginBottom-this.settings.pinImageHeight;break;case jpibfi.ButtonPosition.Middle:position.left=Math.round(position.left+imageDimensions.width/2-this.settings.pinImageWidth/2),position.top=Math.round(position.top+imageDimensions.height/2-this.settings.pinImageHeight/2)}return position},PinButtonGenerator}();jpibfi.PinButtonGenerator=PinButtonGenerator}(jpibfi||(jpibfi={}));var jpibfi;!function(jpibfi){var Logger=function(){function Logger(printLog){this._printLog=printLog&&"undefined"!=typeof console&&"undefined"!=typeof console.log,this._jsonStringifyExists="undefined"!=typeof JSON&&"function"==typeof JSON.stringify}return Logger.prototype._logObject=function(obj){var out="";for(var p in obj)out+=p+": "+obj[p]+"\n";console.log("jpibfi debug: "+out)},Logger.prototype.logString=function(message){this._printLog&&console.log("jpibfi debug: "+message)},Logger.prototype.logObject=function(obj){this._printLog&&(this._jsonStringifyExists?console.log("jpibfi debugz: "+JSON.stringify(obj,null,4)):this._logObject(obj))},Logger}();jpibfi.Logger=Logger}(jpibfi||(jpibfi={}));var jpibfi;!function(jpibfi){var Settings=function(){function Settings(settings){this.filterSelector="*",this.notSelector="",this.buttonMarginTop=parseInt(settings.buttonMarginTop),this.buttonMarginRight=parseInt(settings.buttonMarginRight),this.buttonMarginBottom=parseInt(settings.buttonMarginBottom),this.buttonMarginLeft=parseInt(settings.buttonMarginLeft),this.buttonPosition=settings.hasOwnProperty("buttonPosition")?parseInt(settings.buttonPosition):4,this.debug=settings.hasOwnProperty("debug")?"1"==settings.debug:!1,this.descriptionOption=settings.hasOwnProperty("descriptionOption")?parseInt(settings.descriptionOption):1,this.imageSelector=settings.imageSelector,this.isTouchDevice="ontouchstart"in window||navigator.hasOwnProperty("maxTouchPoints"),this.minImageWidth=settings.hasOwnProperty("minImageWidth")?parseInt(settings.minImageWidth):0,this.minImageHeight=settings.hasOwnProperty("minImageHeight")?parseInt(settings.minImageHeight):0,this.showButton=settings.hasOwnProperty("showButton")?this.parseShowButtonSettings(settings.showButton):jpibfi.ShowButton.Hover,this.pageDescription=settings.pageDescription,this.pageTitle=settings.pageTitle,this.pageUrl=settings.pageUrl,this.pinImageHeight=parseInt(settings.pinImageHeight),this.pinImageWidth=parseInt(settings.pinImageWidth),this.pinLinkedImages=1==settings.pinLinkedImages,this.pinLinkedImagesExtensions=settings.pinLinkedImagesExtensions,this.retinaFriendly=settings.hasOwnProperty("retinaFriendly")?1==settings.retinaFriendly:!1,this.siteTitle=settings.siteTitle,this.usePostUrl=settings.hasOwnProperty("usePostUrl")?settings.usePostUrl:!0,this.containerSelector=settings.containerSelector,this.notSelector=settings.hasOwnProperty("disabledClasses")?this.createSelectorFromList(settings.disabledClasses):"",this.filterSelector=settings.hasOwnProperty("enabledClasses")?this.createSelectorFromList(settings.enabledClasses)||"*":"*",this.adjustPinImageSize()}return Settings.prototype.adjustPinImageSize=function(){this.retinaFriendly&&(this.pinImageHeight=Math.ceil(this.pinImageHeight/2),this.pinImageWidth=Math.ceil(this.pinImageWidth/2))},Settings.prototype.createSelectorFromList=function(classes){for(var arrayOfClasses=classes.split(";"),selector="",i=0;i<arrayOfClasses.length;i++)arrayOfClasses[i]&&(selector+="."+arrayOfClasses[i]+",");return selector?selector.substr(0,selector.length-1):selector},Settings.prototype.parseShowButtonSettings=function(showButton){switch(showButton){case"always":return jpibfi.ShowButton.Always;case"always_touch":return jpibfi.ShowButton.AlwaysTouch;case"hover":default:return jpibfi.ShowButton.Hover}},Settings}();jpibfi.Settings=Settings}(jpibfi||(jpibfi={}));var jpibfi;!function(jpibfi){"use strict";var Hover=function(){function Hover($,settings,logger,buttonGenerator){this.$=$,this.settings=settings,this.logger=logger,this.buttonGenerator=buttonGenerator,this._indexer=0,this.ignoreAttributeName="data-jpibfi-ignore",this.ignoreAttributeSelector="["+this.ignoreAttributeName+"]",this.indexerAttributeName="data-jpibfi-indexer",this.indexerAttributeSelector="["+this.indexerAttributeName+"]"}return Hover.prototype.init=function(){var that=this;this.$(document).delegate(that.settings.imageSelector,"mouseenter",function(){var $image=that.$(this);if(!$image.is(that.ignoreAttributeSelector)){var ignoreImage=$image.is(that.settings.notSelector)||$image.is(that.settings.filterSelector)===!1||$image[0].clientWidth<that.settings.minImageWidth||$image[0].clientHeight<that.settings.minImageHeight;if(ignoreImage)return $image.attr(that.ignoreAttributeName,1..toString());var indexer=$image.attr(that.indexerAttributeName);indexer||(indexer=(that._indexer++).toString(),$image.attr(that.indexerAttributeName,indexer));var $button=that.$('a.pinit-button[data-jpibfi-indexer="'+indexer+'"]');if(1==$button.length)that.buttonGenerator.cancelHide($button);else{var $anchor=that.buttonGenerator.generateForImage($image);null!=$anchor&&($anchor.mouseenter(function(){that.buttonGenerator.cancelHide(that.$(this))}),$anchor.mouseleave(function(){that.buttonGenerator.hide(that.$(this),function(){$image.removeClass("pinit-hover")})}),$image.addClass("pinit-hover"))}}}),that.$(document).delegate(that.settings.imageSelector,"mouseleave",function(){var $image=that.$(this),indexer=$image.attr(that.indexerAttributeName);if(indexer){var $button=that.$('a.pinit-button[data-jpibfi-indexer="'+indexer+'"]');that.buttonGenerator.hide($button,function(){$image.removeClass("pinit-hover")})}})},Hover}();jpibfi.Hover=Hover}(jpibfi||(jpibfi={}));var jpibfi;!function(jpibfi){"use strict";var Plugin=function(){function Plugin($,options){this.$=$,this.settings=new jpibfi.Settings(this.$.extend({pageUrl:document.URL,pageTitle:document.title,pageDescription:$('meta[name="description"]').attr("content")||""},options)),this.logger=new jpibfi.Logger(this.settings.debug),this.logger.logObject(this.settings),this.buttonGenerator=new jpibfi.PinButtonGenerator(this.$,this.settings,this.logger)}return Plugin.prototype.init=function(){var _this=this;this.addContainers(),this.$(document).scroll(function(){return _this.addContainers()}),this.$(document).ajaxSuccess(function(){return _this.addContainers()});var hover=new jpibfi.Hover(this.$,this.settings,this.logger,this.buttonGenerator);hover.init()},Plugin.prototype.addContainers=function(){var $containers=this.$(".jpibfi").not(".jpibfi-ignore");0!=$containers.length&&($containers.closest(this.settings.containerSelector).addClass("jpibfi_container"),$containers.addClass("jpibfi-ignore"))},Plugin}();!function($){$(document).ready(function(){var plugin=new Plugin($,jpibfi_options);plugin.init()})}(jQuery)}(jpibfi||(jpibfi={}));
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ 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: 4.4.2
|
6 |
-
Stable tag: 1.
|
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,10 @@ Please report them in the plugin's support forum on Wordpress.org.
|
|
68 |
|
69 |
== Changelog ==
|
70 |
|
|
|
|
|
|
|
|
|
71 |
= 1.50 =
|
72 |
* Release 2016-03-13
|
73 |
* Feature: Support for infinite scroll-like plugins
|
@@ -232,6 +236,9 @@ Please report them in the plugin's support forum on Wordpress.org.
|
|
232 |
|
233 |
== Upgrade Notice ==
|
234 |
|
|
|
|
|
|
|
235 |
= 1.50 =
|
236 |
Added support for infinite scroll-like plugins and merged Pin Full Images into the plugin.
|
237 |
|
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: 4.4.2
|
6 |
+
Stable tag: 1.51
|
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 |
+
= 1.51 =
|
72 |
+
* Release 2016-03-15
|
73 |
+
* Few minor fixes
|
74 |
+
|
75 |
= 1.50 =
|
76 |
* Release 2016-03-13
|
77 |
* Feature: Support for infinite scroll-like plugins
|
236 |
|
237 |
== Upgrade Notice ==
|
238 |
|
239 |
+
= 1.51 =
|
240 |
+
* Few minor fixes
|
241 |
+
|
242 |
= 1.50 =
|
243 |
Added support for infinite scroll-like plugins and merged Pin Full Images into the plugin.
|
244 |
|