jQuery Pin It Button for Images - Version 1.38

Version Description

  • Release 2014-09-16
  • Fixed issue with positioning the button when Retina display active
Download this release

Release Info

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

Code changes from version 1.37 to 1.38

includes/public/class-jpibfi-client.php CHANGED
@@ -68,7 +68,8 @@ class JPIBFI_Client {
68
  'buttonMarginTop' => $jpibfi_visual_options[ 'button_margin_top' ],
69
  'buttonMarginBottom' => $jpibfi_visual_options[ 'button_margin_bottom' ],
70
  'buttonMarginLeft'=> $jpibfi_visual_options[ 'button_margin_left' ],
71
- 'buttonMarginRight' => $jpibfi_visual_options[ 'button_margin_right' ]
 
72
  );
73
 
74
  wp_localize_script( 'jquery-pin-it-button-script', 'jpibfi_options', apply_filters( 'jpibfi_javascript_parameters', $parameters_array ) );
68
  'buttonMarginTop' => $jpibfi_visual_options[ 'button_margin_top' ],
69
  'buttonMarginBottom' => $jpibfi_visual_options[ 'button_margin_bottom' ],
70
  'buttonMarginLeft'=> $jpibfi_visual_options[ 'button_margin_left' ],
71
+ 'buttonMarginRight' => $jpibfi_visual_options[ 'button_margin_right' ],
72
+ 'retinaFriendly' => ( isset( $jpibfi_visual_options[ 'retina_friendly' ] ) && $jpibfi_visual_options[ 'retina_friendly' ] == '1' ) ? '1' : '0'
73
  );
74
 
75
  wp_localize_script( 'jquery-pin-it-button-script', 'jpibfi_options', apply_filters( 'jpibfi_javascript_parameters', $parameters_array ) );
jquery-pin-it-button-for-images.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: jQuery Pin It Button For Images
4
  Plugin URI: http://mrsztuczkens.me/jpibfi/
5
  Description: Highlights images on hover and adds a "Pin It" button over them for easy pinning.
6
  Author: Marcin Skrzypiec
7
- Version: 1.37
8
  Author URI: http://mrsztuczkens.me/
9
  */
10
 
@@ -47,7 +47,7 @@ if ( ! class_exists( 'jQuery_Pin_It_Button_For_Images' ) ) :
47
  /* VERSIONING */
48
  //plugin version
49
  if ( ! defined( 'JPIBFI_VERSION' ) )
50
- define( 'JPIBFI_VERSION', '1.37' );
51
 
52
  //used in versioning css and js files
53
  if ( ! defined( 'JPIBFI_VERSION_MINOR' ) )
4
  Plugin URI: http://mrsztuczkens.me/jpibfi/
5
  Description: Highlights images on hover and adds a "Pin It" button over them for easy pinning.
6
  Author: Marcin Skrzypiec
7
+ Version: 1.38
8
  Author URI: http://mrsztuczkens.me/
9
  */
10
 
47
  /* VERSIONING */
48
  //plugin version
49
  if ( ! defined( 'JPIBFI_VERSION' ) )
50
+ define( 'JPIBFI_VERSION', '1.38' );
51
 
52
  //used in versioning css and js files
53
  if ( ! defined( 'JPIBFI_VERSION_MINOR' ) )
js/script.js CHANGED
@@ -78,6 +78,12 @@
78
  width: parseInt( jpibfi_options.pinImageWidth )
79
  }
80
 
 
 
 
 
 
 
81
  pinButtonMargins = {
82
  top: parseInt( jpibfi_options.buttonMarginTop ),
83
  right: parseInt( jpibfi_options.buttonMarginRight ),
78
  width: parseInt( jpibfi_options.pinImageWidth )
79
  }
80
 
81
+ //adjust button size if retina active
82
+ if (jpibfi.settings.retinaFriendly == 1){
83
+ pinButtonDimensions.height = pinButtonDimensions.height/2;
84
+ pinButtonDimensions.width = pinButtonDimensions.width/2;
85
+ }
86
+
87
  pinButtonMargins = {
88
  top: parseInt( jpibfi_options.buttonMarginTop ),
89
  right: parseInt( jpibfi_options.buttonMarginRight ),
js/script.min.js CHANGED
@@ -1 +1 @@
1
- (function(e){"use strict";window.jpibfi=function(){function a(t){var n=jQuery("<a/>",{href:"#","class":"pinit-button","data-jpibfi-indexer":t,text:""});n.click(function(t){h("Pin In button clicked");var n=e(this).data("jpibfi-indexer");var r=e('img[data-jpibfi-indexer="'+n+'"]');var i="",s="",o="";if(u.settings.usePostUrl){var a=r.closest(".jpibfi_container").find("input.jpibfi").first();if(a.length){s=a.data("jpibfi-description");o=a.data("jpibfi-url")}}o=o||u.settings.pageUrl;if(u.settings.descriptionOption==3)i=r.attr("title")||r.attr("alt");else if(u.settings.descriptionOption==2)i=s||u.settings.pageDescription;else if(u.settings.descriptionOption==4)i=u.settings.siteTitle;else if(u.settings.descriptionOption==5)i=r.data("jpibfi-description");else if(u.settings.descriptionOption==6)i=r.attr("alt");i=i||s||u.settings.pageTitle;var f="http://pinterest.com/pin/create/bookmarklet/?is_video="+encodeURIComponent("false")+"&url="+encodeURIComponent(o)+"&media="+encodeURIComponent(u.fn.getImageUrl(r))+"&description="+encodeURIComponent(i);window.open(f,"Pinterest","width=632,height=253,status=0,toolbar=0,menubar=0,location=1,scrollbars=1");return false});return n}function f(e){if(e[0].clientWidth<u.settings.minImageWidth||e[0].clientHeight<u.settings.minImageHeight)return false;return true}function l(e){switch(e){case"0":return"pinit-top-left";case"1":return"pinit-top-right";case"2":return"pinit-bottom-left";case"3":return"pinit-bottom-right";case"4":return"pinit-middle";default:return""}}function c(e){var t=e.split(";");var n="";for(var r=0;r<t.length;r++){if(t[r])n+="."+t[r]+","}if(n)n=n.substr(0,n.length-1);return n}function h(e){if(t&&console&&console.log){if("string"==typeof e||e instanceof String){console.log("jpibfi debug: "+e)}else if("object"==typeof e&&typeof JSON!=="undefined"&&typeof JSON.stringify==="function"){console.log("jpibfi debug: "+JSON.stringify(e,null,4))}else if("object"==typeof e){var n="";for(var r in e)n+=r+": "+e[r]+"\n";console.log("jpibfi debug: "+n)}}}var t=false;var n={};var r={};var i="";var s="*";var o=0;var u={};u.settings={};u.fn={};u.fn.getImageUrl=function(t){return e.fn.prop&&t.prop("src")||t.attr("src")};u.addImages=function(t){h(">>addImages");var n=e(t).not(i).not("[data-jpibfi-indexer]").filter(s);n.each(function(){e(this).attr("data-jpibfi-indexer",o);o++});h("Images caught by selectors: "+o);return n};u.prepareImages=function(e){h(">>Add Elements");h("Elements: "+e.length);h("Min width:"+u.settings.minImageWidth);h("Min height:"+u.settings.minImageHeight);var t=0;e.each(function(){t++});h("Images caught after filtering: "+t)};u.removeAllImages=function(){h("Remove Elements called");e("div.pinit-overlay").remove()};u.init=function(o){u.settings={pageUrl:document.URL,pageTitle:document.title,pageDescription:e('meta[name="description"]').attr("content")||""};u.settings=e.extend(u.settings,o);n={height:parseInt(o.pinImageHeight),width:parseInt(o.pinImageWidth)};r={top:parseInt(o.buttonMarginTop),right:parseInt(o.buttonMarginRight),bottom:parseInt(o.buttonMarginBottom),left:parseInt(o.buttonMarginLeft)};t="1"==o.debug;h(u.settings);h(n);h(r);var l=e(".jpibfi").closest(u.settings.containerSelector).addClass("jpibfi_container");h("Number of containers added: "+l.length);i=c(u.settings.disabledClasses);s=c(u.settings.enabledClasses)||"*";h("Filter selector: "+s);h("Not selector: "+i);e(document).delegate("a.pinit-button","mouseenter",function(){var t=e(this);clearTimeout(t.data("jpibfi-timeoutId"))});e(document).delegate("a.pinit-button","mouseleave",function(){var t=e(this);var n=setTimeout(function(){t.remove();e('img[data-jpibfi-indexer="'+t.data("jpibfi-indexer")+'"]').removeClass("pinit-hover")},100);t.data("jpibfi-timeoutId",n)});e(document).delegate("img[data-jpibfi-indexer]","mouseenter",function(){var t=e(this);if(f(t)==false){t.removeAttr("data-jpibfi-indexer");return}var i=t.data("jpibfi-indexer");var s=e('a.pinit-button[data-jpibfi-indexer="'+i+'"]');if(s.length==0){s=a(i);var o=t.offset();var l={width:t.get(0).clientWidth,height:t.get(0).clientHeight};switch(u.settings.buttonPosition){case"0":o.left+=r.left;o.top+=r.top;break;case"1":o.top+=r.top;o.left=o.left+l.width-r.right-n.width;break;case"2":o.left+=r.left;o.top=o.top+l.height-r.bottom-n.height;break;case"3":o.left=o.left+l.width-r.right-n.width;o.top=o.top+l.height-r.bottom-n.height;break;case"4":o.left=Math.round(o.left+l.width/2-n.width/2);o.top=Math.round(o.top+l.height/2-n.height/2);break}t.after(s);s.show().offset({left:o.left,top:o.top})}else{clearTimeout(s.data("jpibfi-timeoutId"))}t.addClass("pinit-hover")});e(document).delegate("img[data-jpibfi-indexer]","mouseleave",function(){var t=e(this).data("jpibfi-indexer");var n=e('a.pinit-button[data-jpibfi-indexer="'+t+'"]');var r=setTimeout(function(){n.remove();e('img[data-jpibfi-indexer="'+n.data("jpibfi-indexer")+'"]').removeClass("pinit-hover")},100);n.data("jpibfi-timeoutId",r)})};return u;}()})(jQuery);(function(e){"use strict";e(document).ready(function(){jpibfi.init(jpibfi_options);e(document).trigger("jpibfi_beforeAddImages",{});jpibfi.addImages(jpibfi_options.imageSelector);e(document).trigger("jpibfi_afterAddImages",{});e(window).load(function(){jpibfi.prepareImages(e("img[data-jpibfi-indexer]"))});e(window).resize(function(){jpibfi.removeAllImages();jpibfi.prepareImages(e("img[data-jpibfi-indexer]"))})})})(jQuery)
1
+ (function(e){"use strict";window.jpibfi=function(){function a(t){var n=jQuery("<a/>",{href:"#","class":"pinit-button","data-jpibfi-indexer":t,text:""});n.click(function(t){h("Pin In button clicked");var n=e(this).data("jpibfi-indexer");var r=e('img[data-jpibfi-indexer="'+n+'"]');var i="",s="",o="";if(u.settings.usePostUrl){var a=r.closest(".jpibfi_container").find("input.jpibfi").first();if(a.length){s=a.data("jpibfi-description");o=a.data("jpibfi-url")}}o=o||u.settings.pageUrl;if(u.settings.descriptionOption==3)i=r.attr("title")||r.attr("alt");else if(u.settings.descriptionOption==2)i=s||u.settings.pageDescription;else if(u.settings.descriptionOption==4)i=u.settings.siteTitle;else if(u.settings.descriptionOption==5)i=r.data("jpibfi-description");else if(u.settings.descriptionOption==6)i=r.attr("alt");i=i||s||u.settings.pageTitle;var f="http://pinterest.com/pin/create/bookmarklet/?is_video="+encodeURIComponent("false")+"&url="+encodeURIComponent(o)+"&media="+encodeURIComponent(u.fn.getImageUrl(r))+"&description="+encodeURIComponent(i);window.open(f,"Pinterest","width=632,height=253,status=0,toolbar=0,menubar=0,location=1,scrollbars=1");return false});return n}function f(e){if(e[0].clientWidth<u.settings.minImageWidth||e[0].clientHeight<u.settings.minImageHeight)return false;return true}function l(e){switch(e){case"0":return"pinit-top-left";case"1":return"pinit-top-right";case"2":return"pinit-bottom-left";case"3":return"pinit-bottom-right";case"4":return"pinit-middle";default:return""}}function c(e){var t=e.split(";");var n="";for(var r=0;r<t.length;r++){if(t[r])n+="."+t[r]+","}if(n)n=n.substr(0,n.length-1);return n}function h(e){if(t&&console&&console.log){if("string"==typeof e||e instanceof String){console.log("jpibfi debug: "+e)}else if("object"==typeof e&&typeof JSON!=="undefined"&&typeof JSON.stringify==="function"){console.log("jpibfi debug: "+JSON.stringify(e,null,4))}else if("object"==typeof e){var n="";for(var r in e)n+=r+": "+e[r]+"\n";console.log("jpibfi debug: "+n)}}}var t=false;var n={};var r={};var i="";var s="*";var o=0;var u={};u.settings={};u.fn={};u.fn.getImageUrl=function(t){return e.fn.prop&&t.prop("src")||t.attr("src")};u.addImages=function(t){h(">>addImages");var n=e(t).not(i).not("[data-jpibfi-indexer]").filter(s);n.each(function(){e(this).attr("data-jpibfi-indexer",o);o++});h("Images caught by selectors: "+o);return n};u.prepareImages=function(e){h(">>Add Elements");h("Elements: "+e.length);h("Min width:"+u.settings.minImageWidth);h("Min height:"+u.settings.minImageHeight);var t=0;e.each(function(){t++});h("Images caught after filtering: "+t)};u.removeAllImages=function(){h("Remove Elements called");e("div.pinit-overlay").remove()};u.init=function(o){u.settings={pageUrl:document.URL,pageTitle:document.title,pageDescription:e('meta[name="description"]').attr("content")||""};u.settings=e.extend(u.settings,o);n={height:parseInt(o.pinImageHeight),width:parseInt(o.pinImageWidth)};if(u.settings.retinaFriendly==1){n.height=n.height/2;n.width=n.width/2}r={top:parseInt(o.buttonMarginTop),right:parseInt(o.buttonMarginRight),bottom:parseInt(o.buttonMarginBottom),left:parseInt(o.buttonMarginLeft)};t="1"==o.debug;h(u.settings);h(n);h(r);var l=e(".jpibfi").closest(u.settings.containerSelector).addClass("jpibfi_container");h("Number of containers added: "+l.length);i=c(u.settings.disabledClasses);s=c(u.settings.enabledClasses)||"*";h("Filter selector: "+s);h("Not selector: "+i);e(document).delegate("a.pinit-button","mouseenter",function(){var t=e(this);clearTimeout(t.data("jpibfi-timeoutId"))});e(document).delegate("a.pinit-button","mouseleave",function(){var t=e(this);var n=setTimeout(function(){t.remove();e('img[data-jpibfi-indexer="'+t.data("jpibfi-indexer")+'"]').removeClass("pinit-hover")},100);t.data("jpibfi-timeoutId",n)});e(document).delegate("img[data-jpibfi-indexer]","mouseenter",function(){var t=e(this);if(f(t)==false){t.removeAttr("data-jpibfi-indexer");return}var i=t.data("jpibfi-indexer");var s=e('a.pinit-button[data-jpibfi-indexer="'+i+'"]');if(s.length==0){s=a(i);var o=t.offset();var l={width:t.get(0).clientWidth,height:t.get(0).clientHeight};switch(u.settings.buttonPosition){case"0":o.left+=r.left;o.top+=r.top;break;case"1":o.top+=r.top;o.left=o.left+l.width-r.right-n.width;break;case"2":o.left+=r.left;o.top=o.top+l.height-r.bottom-n.height;break;case"3":o.left=o.left+l.width-r.right-n.width;o.top=o.top+l.height-r.bottom-n.height;break;case"4":o.left=Math.round(o.left+l.width/2-n.width/2);o.top=Math.round(o.top+l.height/2-n.height/2);break}t.after(s);s.show().offset({left:o.left,top:o.top})}else{clearTimeout(s.data("jpibfi-timeoutId"))}t.addClass("pinit-hover")});e(document).delegate("img[data-jpibfi-indexer]","mouseleave",function(){var t=e(this).data("jpibfi-indexer");var n=e('a.pinit-button[data-jpibfi-indexer="'+t+'"]');var r=setTimeout(function(){n.remove();e('img[data-jpibfi-indexer="'+n.data("jpibfi-indexer")+'"]').removeClass("pinit-hover")},100);n.data("jpibfi-timeoutId",r)})};return u;}()})(jQuery);(function(e){"use strict";e(document).ready(function(){jpibfi.init(jpibfi_options);e(document).trigger("jpibfi_beforeAddImages",{});jpibfi.addImages(jpibfi_options.imageSelector);e(document).trigger("jpibfi_afterAddImages",{});e(window).load(function(){jpibfi.prepareImages(e("img[data-jpibfi-indexer]"))});e(window).resize(function(){jpibfi.removeAllImages();jpibfi.prepareImages(e("img[data-jpibfi-indexer]"))})})})(jQuery)
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mrsztuczkens, redearthdesign, brocheafoin, robertark
3
  Donate link: http://bit.ly/Uw2mEP
4
  Tags: pinterest, pin it, button, image, images, pinit, social media, hover, click, photo, photos
5
  Requires at least: 3.3.0
6
- Tested up to: 3.9
7
- Stable tag: 1.37
8
  License: GPLv2 or later
9
 
10
  Highlights images on hover and adds a Pinterest "Pin It" button over them for easy pinning.
@@ -76,6 +76,10 @@ Please report them in the plugin's support forum on Wordpress.org.
76
 
77
  == Changelog ==
78
 
 
 
 
 
79
  = 1.37 =
80
  * Release 2014-08-05
81
  * Additional option in the description source setting
@@ -219,6 +223,9 @@ Please report them in the plugin's support forum on Wordpress.org.
219
 
220
  == Upgrade Notice ==
221
 
 
 
 
222
  = 1.37 =
223
  Additional setting in the description source setting. Small bug fix.
224
 
3
  Donate link: http://bit.ly/Uw2mEP
4
  Tags: pinterest, pin it, button, image, images, pinit, social media, hover, click, photo, photos
5
  Requires at least: 3.3.0
6
+ Tested up to: 4.0
7
+ Stable tag: 1.38
8
  License: GPLv2 or later
9
 
10
  Highlights images on hover and adds a Pinterest "Pin It" button over them for easy pinning.
76
 
77
  == Changelog ==
78
 
79
+ = 1.38 =
80
+ * Release 2014-09-16
81
+ * Fixed issue with positioning the button when Retina display active
82
+
83
  = 1.37 =
84
  * Release 2014-08-05
85
  * Additional option in the description source setting
223
 
224
  == Upgrade Notice ==
225
 
226
+ = 1.38 =
227
+ Fixed issue with positioning the button when Retina display active.
228
+
229
  = 1.37 =
230
  Additional setting in the description source setting. Small bug fix.
231