Version Description
- Release 2014-06-16
- Added support for plugins lazy loading images
Download this release
Release Info
Developer | mrsztuczkens |
Plugin | jQuery Pin It Button for Images |
Version | 1.34 |
Comparing to | |
See all releases |
Code changes from version 1.33 to 1.34
- includes/admin/views/admin.php +1 -1
- jquery-pin-it-button-for-images.php +2 -2
- js/script.js +19 -8
- js/script.min.js +1 -1
- readme.txt +8 -1
includes/admin/views/admin.php
CHANGED
@@ -12,7 +12,6 @@ foreach( $settings_tabs as $tab_name => $tab_settings)
|
|
12 |
|
13 |
$tab = false == $tab_found ? 'selection_options' : $tab;
|
14 |
$current_settings = $settings_tabs[ $tab ];
|
15 |
-
//TODO dokończyć pętlę
|
16 |
?>
|
17 |
<div id="icon-plugins" class="icon32"></div>
|
18 |
<h2 class="nav-tab-wrapper">
|
@@ -22,6 +21,7 @@ $current_settings = $settings_tabs[ $tab ];
|
|
22 |
</h2>
|
23 |
|
24 |
<p>
|
|
|
25 |
<a href="http://mrsztuczkens.me/jquery-pin-it-button-for-images-customization/" class="button" target="_blank" rel="nofollow"><b><?php _e( 'Plugin Customization', 'jpibfi' ); ?></b></a>
|
26 |
<a href="http://mrsztuczkens.me/jquery-pin-it-button-for-images-extensions/" class="button" target="_blank" rel="nofollow"><b><?php _e( 'Plugin Extensions', 'jpibfi' ); ?></b></a>
|
27 |
<a href="http://bit.ly/Uw2mEP" class="button" target="_blank" rel="nofollow"><b><?php _e( 'Donate', 'jpibfi' ); ?></b></a>
|
12 |
|
13 |
$tab = false == $tab_found ? 'selection_options' : $tab;
|
14 |
$current_settings = $settings_tabs[ $tab ];
|
|
|
15 |
?>
|
16 |
<div id="icon-plugins" class="icon32"></div>
|
17 |
<h2 class="nav-tab-wrapper">
|
21 |
</h2>
|
22 |
|
23 |
<p>
|
24 |
+
<a href="http://mrsztuczkens.me/how-to-get-the-most-out-of-jpibfi/" class="button" target="_blank" rel="nofollow"><b><?php _e( 'How to Get The Most Out of JPIBFI', 'jpibfi' ); ?></b></a>
|
25 |
<a href="http://mrsztuczkens.me/jquery-pin-it-button-for-images-customization/" class="button" target="_blank" rel="nofollow"><b><?php _e( 'Plugin Customization', 'jpibfi' ); ?></b></a>
|
26 |
<a href="http://mrsztuczkens.me/jquery-pin-it-button-for-images-extensions/" class="button" target="_blank" rel="nofollow"><b><?php _e( 'Plugin Extensions', 'jpibfi' ); ?></b></a>
|
27 |
<a href="http://bit.ly/Uw2mEP" class="button" target="_blank" rel="nofollow"><b><?php _e( 'Donate', 'jpibfi' ); ?></b></a>
|
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.
|
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.
|
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.34
|
8 |
Author URI: http://mrsztuczkens.me/
|
9 |
*/
|
10 |
|
47 |
/* VERSIONING */
|
48 |
//plugin version
|
49 |
if ( ! defined( 'JPIBFI_VERSION' ) )
|
50 |
+
define( 'JPIBFI_VERSION', '1.34' );
|
51 |
|
52 |
//used in versioning css and js files
|
53 |
if ( ! defined( 'JPIBFI_VERSION_MINOR' ) )
|
js/script.js
CHANGED
@@ -55,10 +55,6 @@
|
|
55 |
var imageCount = 0;
|
56 |
$elements.each(function () {
|
57 |
var $image = $(this);
|
58 |
-
if ( this.clientWidth < jpibfi.settings.minImageWidth || this.clientHeight < jpibfi.settings.minImageHeight ) {
|
59 |
-
$image.removeAttr( 'data-jpibfi-indexer' );
|
60 |
-
return;
|
61 |
-
}
|
62 |
if ( jpibfi.settings.mode == 'static' )
|
63 |
jpibfiCreateAndShowOverlayDiv( $image, jpibfi.settings.buttonPosition );
|
64 |
|
@@ -119,10 +115,15 @@
|
|
119 |
jpibfiLog( 'Adding static mode delegates');
|
120 |
|
121 |
$( document).delegate( 'div.pinit-overlay', 'hover', function( event ) {
|
122 |
-
var hover = event.type === 'mouseenter';
|
123 |
var indexer = $(this).data("jpibfi-indexer");
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
$('.pinit-button[data-jpibfi-indexer="' + indexer + '"]').toggle( hover );
|
125 |
-
$
|
126 |
});
|
127 |
|
128 |
} else if ( 'dynamic' == jpibfi.settings.mode ) {
|
@@ -145,8 +146,11 @@
|
|
145 |
|
146 |
$( document ).delegate( 'img[data-jpibfi-indexer]', 'mouseenter', function() {
|
147 |
var $image = $( this );
|
148 |
-
var indexer = $image.data( 'jpibfi-indexer' );
|
149 |
|
|
|
|
|
|
|
|
|
150 |
var $button = $('a.pinit-button[data-jpibfi-indexer="' + indexer + '"]');
|
151 |
|
152 |
if ( $button.length == 0 ) {
|
@@ -216,7 +220,7 @@
|
|
216 |
href: '#',
|
217 |
"class": 'pinit-button',
|
218 |
"data-jpibfi-indexer": indexer,
|
219 |
-
text: "
|
220 |
});
|
221 |
|
222 |
$anchor.click( function(e) {
|
@@ -260,6 +264,13 @@
|
|
260 |
return $anchor;
|
261 |
}
|
262 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
|
264 |
function jpibfiCreateAndShowOverlayDiv( $image, buttonPosition ) {
|
265 |
var position = $image.offset();
|
55 |
var imageCount = 0;
|
56 |
$elements.each(function () {
|
57 |
var $image = $(this);
|
|
|
|
|
|
|
|
|
58 |
if ( jpibfi.settings.mode == 'static' )
|
59 |
jpibfiCreateAndShowOverlayDiv( $image, jpibfi.settings.buttonPosition );
|
60 |
|
115 |
jpibfiLog( 'Adding static mode delegates');
|
116 |
|
117 |
$( document).delegate( 'div.pinit-overlay', 'hover', function( event ) {
|
|
|
118 |
var indexer = $(this).data("jpibfi-indexer");
|
119 |
+
var $image = $('img[data-jpibfi-indexer="' + indexer + '"]');
|
120 |
+
|
121 |
+
if (jpibfiCheckImageSize ( $image ) == false )
|
122 |
+
return;
|
123 |
+
|
124 |
+
var hover = event.type === 'mouseenter';
|
125 |
$('.pinit-button[data-jpibfi-indexer="' + indexer + '"]').toggle( hover );
|
126 |
+
$image.toggleClass( 'pinit-hover', hover );
|
127 |
});
|
128 |
|
129 |
} else if ( 'dynamic' == jpibfi.settings.mode ) {
|
146 |
|
147 |
$( document ).delegate( 'img[data-jpibfi-indexer]', 'mouseenter', function() {
|
148 |
var $image = $( this );
|
|
|
149 |
|
150 |
+
if (jpibfiCheckImageSize ( $image) == false )
|
151 |
+
return;
|
152 |
+
|
153 |
+
var indexer = $image.data( 'jpibfi-indexer' );
|
154 |
var $button = $('a.pinit-button[data-jpibfi-indexer="' + indexer + '"]');
|
155 |
|
156 |
if ( $button.length == 0 ) {
|
220 |
href: '#',
|
221 |
"class": 'pinit-button',
|
222 |
"data-jpibfi-indexer": indexer,
|
223 |
+
text: ""
|
224 |
});
|
225 |
|
226 |
$anchor.click( function(e) {
|
264 |
return $anchor;
|
265 |
}
|
266 |
|
267 |
+
function jpibfiCheckImageSize( $image ) {
|
268 |
+
if ( $image[0].clientWidth < jpibfi.settings.minImageWidth || $image[0].clientHeight < jpibfi.settings.minImageHeight ) {
|
269 |
+
$image.removeAttr( 'data-jpibfi-indexer' );
|
270 |
+
return false;
|
271 |
+
}
|
272 |
+
return true;
|
273 |
+
}
|
274 |
|
275 |
function jpibfiCreateAndShowOverlayDiv( $image, buttonPosition ) {
|
276 |
var position = $image.offset();
|
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:"
|
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){d("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){if(e[0].clientWidth<u.settings.minImageWidth||e[0].clientHeight<u.settings.minImageHeight){e.removeAttr("data-jpibfi-indexer");return false}return true}function l(e,t){var n=e.offset();var r=c(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 c(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(h(t))})}function h(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 p(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 d(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){d(">>addImages");var n=e(t).not(i).not("[data-jpibfi-indexer]").filter(s);n.each(function(){e(this).attr("data-jpibfi-indexer",o);o++});d("Images caught by selectors: "+o);return n};u.prepareImages=function(t){d(">>Add Elements");d("Elements: "+t.length);d("Min width:"+u.settings.minImageWidth);d("Min height:"+u.settings.minImageHeight);var n=0;t.each(function(){var t=e(this);if(u.settings.mode=="static")l(t,u.settings.buttonPosition);n++});d("Images caught after filtering: "+n)};u.removeAllImages=function(){d("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;d(u.settings);d(n);d(r);var l=e(".jpibfi").closest(u.settings.containerSelector).addClass("jpibfi_container");d("Number of containers added: "+l.length);i=p(u.settings.disabledClasses);s=p(u.settings.enabledClasses)||"*";d("Filter selector: "+s);d("Not selector: "+i);if("static"==u.settings.mode){d("Adding static mode delegates");e(document).delegate("div.pinit-overlay","hover",function(t){var n=e(this).data("jpibfi-indexer");var r=e('img[data-jpibfi-indexer="'+n+'"]');if(f(r)==false)return;var i=t.type==="mouseenter";e('.pinit-button[data-jpibfi-indexer="'+n+'"]').toggle(i);r.toggleClass("pinit-hover",i)})}else if("dynamic"==u.settings.mode){d("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);if(f(t)==false)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
@@ -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.
|
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.33 =
|
80 |
* Release 2014-05-18
|
81 |
* Minor changes
|
@@ -206,6 +210,9 @@ Please report them in the plugin's support forum on Wordpress.org.
|
|
206 |
|
207 |
== Upgrade Notice ==
|
208 |
|
|
|
|
|
|
|
209 |
= 1.33 =
|
210 |
Minor addition.
|
211 |
|
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.34
|
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.34 =
|
80 |
+
* Release 2014-06-16
|
81 |
+
* Added support for plugins lazy loading images
|
82 |
+
|
83 |
= 1.33 =
|
84 |
* Release 2014-05-18
|
85 |
* Minor changes
|
210 |
|
211 |
== Upgrade Notice ==
|
212 |
|
213 |
+
= 1.34 =
|
214 |
+
Minor update.
|
215 |
+
|
216 |
= 1.33 =
|
217 |
Minor addition.
|
218 |
|