jQuery Pin It Button for Images - Version 1.33

Version Description

  • Release 2014-05-18
  • Minor changes
Download this release

Release Info

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

Code changes from version 1.32 to 1.33

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.32
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.32' );
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.33
8
Author URI: http://mrsztuczkens.me/
9
*/
10
47
/* VERSIONING */
48
//plugin version
49
if ( ! defined( 'JPIBFI_VERSION' ) )
50
+ define( 'JPIBFI_VERSION', '1.33' );
51
52
//used in versioning css and js files
53
if ( ! defined( 'JPIBFI_VERSION_MINOR' ) )
js/script.js CHANGED
@@ -350,7 +350,9 @@
350
$(document).ready( function() {
351
jpibfi.init( jpibfi_options );
352
353
jpibfi.addImages( jpibfi_options.imageSelector );
354
355
$(window).load( function() {
356
jpibfi.prepareImages( $('img[data-jpibfi-indexer]') );
350
$(document).ready( function() {
351
jpibfi.init( jpibfi_options );
352
353
+ $(document).trigger('jpibfi_beforeAddImages', {});
354
jpibfi.addImages( jpibfi_options.imageSelector );
355
+ $(document).trigger('jpibfi_afterAddImages', {});
356
357
$(window).load( function() {
358
jpibfi.prepareImages( $('img[data-jpibfi-indexer]') );
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:"Pin It"});n.click(function(t){p("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");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,t){var n=e.offset();var r=l(e,t);e.after(r);r.css({height:e.get(0).clientHeight+"px",width:e.get(0).clientWidth+"px"}).show().offset({left:n.left,top:n.top});return r}function l(e,t){var n=e.data("jpibfi-indexer");return jQuery("<div/>",{"class":"pinit-overlay","data-jpibfi-indexer":n,title:e.attr("title")||"",html:a(n).addClass(c(t))})}function c(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 h(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 p(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(e){return e.data("media")||e.attr("src")};u.addImages=function(t){p(">>addImages");var n=e(t).not(i).not("[data-jpibfi-indexer]").filter(s);n.each(function(){e(this).attr("data-jpibfi-indexer",o);o++});p("Images caught by selectors: "+o);return n};u.prepareImages=function(t){p(">>Add Elements");p("Elements: "+t.length);p("Min width:"+u.settings.minImageWidth);p("Min height:"+u.settings.minImageHeight);var n=0;t.each(function(){var t=e(this);if(this.clientWidth<u.settings.minImageWidth||this.clientHeight<u.settings.minImageHeight){t.removeAttr("data-jpibfi-indexer");return}if(u.settings.mode=="static")f(t,u.settings.buttonPosition);n++});p("Images caught after filtering: "+n)};u.removeAllImages=function(){p("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;p(u.settings);p(n);p(r);var f=e(".jpibfi").closest(u.settings.containerSelector).addClass("jpibfi_container");p("Number of containers added: "+f.length);i=h(u.settings.disabledClasses);s=h(u.settings.enabledClasses)||"*";p("Filter selector: "+s);p("Not selector: "+i);if("static"==u.settings.mode){p("Adding static mode delegates");e(document).delegate("div.pinit-overlay","hover",function(t){var n=t.type==="mouseenter";var r=e(this).data("jpibfi-indexer");e('.pinit-button[data-jpibfi-indexer="'+r+'"]').toggle(n);e('img[data-jpibfi-indexer="'+r+'"]').toggleClass("pinit-hover",n)})}else if("dynamic"==u.settings.mode){p("Adding dynamic mode delegates");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);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 f={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+f.width-r.right-n.width;break;case"2":o.left+=r.left;o.top=o.top+f.height-r.bottom-n.height;break;case"3":o.left=o.left+f.width-r.right-n.width;o.top=o.top+f.height-r.bottom-n.height;break;case"4":o.left=Math.round(o.left+f.width/2-n.width/2);o.top=Math.round(o.top+f.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);jpibfi.addImages(jpibfi_options.imageSelector);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:"Pin It"});n.click(function(t){p("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");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,t){var n=e.offset();var r=l(e,t);e.after(r);r.css({height:e.get(0).clientHeight+"px",width:e.get(0).clientWidth+"px"}).show().offset({left:n.left,top:n.top});return r}function l(e,t){var n=e.data("jpibfi-indexer");return jQuery("<div/>",{"class":"pinit-overlay","data-jpibfi-indexer":n,title:e.attr("title")||"",html:a(n).addClass(c(t))})}function c(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 h(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 p(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(e){return e.data("media")||e.attr("src")};u.addImages=function(t){p(">>addImages");var n=e(t).not(i).not("[data-jpibfi-indexer]").filter(s);n.each(function(){e(this).attr("data-jpibfi-indexer",o);o++});p("Images caught by selectors: "+o);return n};u.prepareImages=function(t){p(">>Add Elements");p("Elements: "+t.length);p("Min width:"+u.settings.minImageWidth);p("Min height:"+u.settings.minImageHeight);var n=0;t.each(function(){var t=e(this);if(this.clientWidth<u.settings.minImageWidth||this.clientHeight<u.settings.minImageHeight){t.removeAttr("data-jpibfi-indexer");return}if(u.settings.mode=="static")f(t,u.settings.buttonPosition);n++});p("Images caught after filtering: "+n)};u.removeAllImages=function(){p("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;p(u.settings);p(n);p(r);var f=e(".jpibfi").closest(u.settings.containerSelector).addClass("jpibfi_container");p("Number of containers added: "+f.length);i=h(u.settings.disabledClasses);s=h(u.settings.enabledClasses)||"*";p("Filter selector: "+s);p("Not selector: "+i);if("static"==u.settings.mode){p("Adding static mode delegates");e(document).delegate("div.pinit-overlay","hover",function(t){var n=t.type==="mouseenter";var r=e(this).data("jpibfi-indexer");e('.pinit-button[data-jpibfi-indexer="'+r+'"]').toggle(n);e('img[data-jpibfi-indexer="'+r+'"]').toggleClass("pinit-hover",n)})}else if("dynamic"==u.settings.mode){p("Adding dynamic mode delegates");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);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 f={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+f.width-r.right-n.width;break;case"2":o.left+=r.left;o.top=o.top+f.height-r.bottom-n.height;break;case"3":o.left=o.left+f.width-r.right-n.width;o.top=o.top+f.height-r.bottom-n.height;break;case"4":o.left=Math.round(o.left+f.width/2-n.width/2);o.top=Math.round(o.top+f.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
@@ -4,7 +4,7 @@ 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.32
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.32 =
80
* Release 2014-05-04
81
* Minor fix
@@ -202,6 +206,9 @@ Please report them in the plugin's support forum on Wordpress.org.
202
203
== Upgrade Notice ==
204
205
= 1.32 =
206
Minor fix.
207
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.33
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.33 =
80
+ * Release 2014-05-18
81
+ * Minor changes
82
+
83
= 1.32 =
84
* Release 2014-05-04
85
* Minor fix
206
207
== Upgrade Notice ==
208
209
+ = 1.33 =
210
+ Minor addition.
211
+
212
= 1.32 =
213
Minor fix.
214