jQuery Pin It Button for Images - Version 0.9.99

Version Description

Major source code changes with almost no changes in terms of features. This version can be considered a "test" one. After fixing bugs (if there are any - please report) version 1.0.0 will be published.

Download this release

Release Info

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

Code changes from version 0.9.95 to 0.9.99

images/point-five.png DELETED
Binary file
images/transparency/0.png DELETED
Binary file
images/transparency/0_1.png DELETED
Binary file
images/transparency/0_3.png DELETED
Binary file
images/transparency/0_4.png DELETED
Binary file
images/transparency/0_5.png DELETED
Binary file
images/transparency/0_6.png DELETED
Binary file
images/transparency/0_7.png DELETED
Binary file
images/transparency/0_8.png DELETED
Binary file
images/transparency/0_9.png DELETED
Binary file
images/transparency/1.png DELETED
Binary file
jpibfi-admin.php CHANGED
@@ -56,9 +56,7 @@ function jpibfi_print_admin_page() {
56
 
57
  //rewrite settings that came from the POST request
58
  $dev_options['image_selector'] = sanitize_text_field( $_POST['image_selector'] );
59
- $dev_options['compatibility_mode'] = $_POST['compatibility_mode'] == '1' ? '1' : '0';
60
- $dev_options['transparency_value'] =
61
- $dev_options['compatibility_mode'] == '0' ? $_POST['standard_transparency'] : $_POST['compatibility_transparency'];
62
  $dev_options['disabled_classes'] = $_POST['disabled_classes'];
63
  $dev_options['enabled_classes'] = $_POST['enabled_classes'];
64
  $dev_options['description_option'] = $_POST['description_option'];
@@ -73,8 +71,7 @@ function jpibfi_print_admin_page() {
73
  $dev_options['use_post_url'] = isset( $_POST['use_post_url'] ) ? "1" : "0";
74
  $dev_options['button_position'] = $_POST['button_position'];
75
 
76
- if ( $dev_options['compatibility_mode'] == '0' )
77
- $errors['transparency_value'] = ! is_numeric( $dev_options['transparency_value'] ) || ( $dev_options['transparency_value'] < 0.0 ) || ( $dev_options['transparency_value'] > 1.0 );
78
 
79
  $advanced_dev_options['on_home'] = isset( $_POST['on_home'] ) ? '1' : '0';
80
  $advanced_dev_options['on_page'] = isset( $_POST['on_page'] ) ? '1' : '0';
@@ -235,31 +232,12 @@ function jpibfi_print_admin_page() {
235
  </td>
236
  </tr>
237
  <tr>
238
- <th scope="row"><label for="compatibility_mode">Transparency</label></th>
239
  <td>
240
- <select name="compatibility_mode" id="compatibility_mode">
241
- <option value="0" <?php selected( "0", $dev_options['compatibility_mode'] ); ?>>Standard mode</option>
242
- <option value="1" <?php selected( "1", $dev_options['compatibility_mode'] ); ?>>IE7 Compatibility mode</option>
243
- </select>
244
-
245
- <p id="standard_mode_transparency" <?php echo jpibfi_conditional( "1" == $dev_options['compatibility_mode'], "style='display:none'" );?>>
246
  <label for="standard_transparency">Choose transparency (between 0.00 and 1.00)</label><br />
247
  <input type="number" min="0" max="1" step="0.01" id="standard_transparency" name="standard_transparency"
248
  value="<?php echo $dev_options['transparency_value'];?>" <?php jpibfi_conditional( $errors["transparency_value"], "class='error-border'" ); ?>/>
249
- </p>
250
-
251
- <p id="compatibility_mode_transparency" <?php jpibfi_conditional( "0" == $dev_options['compatibility_mode'], "style='display:none'" ); ?>>
252
- <label for="compatibility_transparency">Choose transparency</label><br />
253
- <select name="compatibility_transparency" id="compatibility_transparency">
254
- <?php for ( $i = 0; $i <= 1; $i += 0.1 ): ?>
255
- <option value="<?php echo $i;?>" <?php selected( round( $i, 1 ), round( $dev_options['transparency_value'], 1 ) ); ?>>
256
- <?php echo $i;?>
257
- </option>
258
- <?php endfor; ?>
259
- </select>
260
- </p>
261
- <p class="description">If you want the plugin to work properly on IE7, meaning the image will become
262
- transparent on hover, you need to use IE7 Compatibility mode.</p>
263
  </td>
264
  </tr>
265
  <tr>
56
 
57
  //rewrite settings that came from the POST request
58
  $dev_options['image_selector'] = sanitize_text_field( $_POST['image_selector'] );
59
+ $dev_options['transparency_value'] = $_POST['standard_transparency'];
 
 
60
  $dev_options['disabled_classes'] = $_POST['disabled_classes'];
61
  $dev_options['enabled_classes'] = $_POST['enabled_classes'];
62
  $dev_options['description_option'] = $_POST['description_option'];
71
  $dev_options['use_post_url'] = isset( $_POST['use_post_url'] ) ? "1" : "0";
72
  $dev_options['button_position'] = $_POST['button_position'];
73
 
74
+ $errors['transparency_value'] = ! is_numeric( $dev_options['transparency_value'] ) || ( $dev_options['transparency_value'] < 0.0 ) || ( $dev_options['transparency_value'] > 1.0 );
 
75
 
76
  $advanced_dev_options['on_home'] = isset( $_POST['on_home'] ) ? '1' : '0';
77
  $advanced_dev_options['on_page'] = isset( $_POST['on_page'] ) ? '1' : '0';
232
  </td>
233
  </tr>
234
  <tr>
235
+ <th scope="row"><label for="standard_transparency">Transparency</label></th>
236
  <td>
 
 
 
 
 
 
237
  <label for="standard_transparency">Choose transparency (between 0.00 and 1.00)</label><br />
238
  <input type="number" min="0" max="1" step="0.01" id="standard_transparency" name="standard_transparency"
239
  value="<?php echo $dev_options['transparency_value'];?>" <?php jpibfi_conditional( $errors["transparency_value"], "class='error-border'" ); ?>/>
240
+ <p class="description">This setting sets the transparency of the layer covering the image..</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  </td>
242
  </tr>
243
  <tr>
jquery-pin-it-button-for-images.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: jQuery Pin It Button For Images
4
  Plugin URI: http://wordpress.org/extend/plugins/jquery-pin-it-button-for-images/
5
  Description: Highlights images on hover and adds a "Pin It" button over them for easy pinning.
6
  Author: Marcin Skrzypiec
7
- Version: 0.9.95
8
  Author URI: http://profiles.wordpress.org/mrsztuczkens
9
  */
10
 
@@ -26,7 +26,6 @@ function jpibfi_get_basic_options() {
26
  'disabled_classes' => 'nopin;wp-smiley',
27
  'description_option' => 1,
28
  'enabled_classes' => '',
29
- 'compatibility_mode' => '0',
30
  'transparency_value' => '0.5',
31
  'use_custom_image' => '0',
32
  'custom_image_url' => '',
@@ -63,8 +62,7 @@ function jpibfi_get_basic_options() {
63
  else
64
  $changes_in_db = true;
65
  break;
66
- case "compatibility_mode": //0 or 1 values
67
- case "use_custom_image":
68
  case "use_post_url":
69
  if ( strcmp( $option, '0' ) != 0 && strcmp( $option, '1' ) != 0 ) //invalid value in database
70
  $changes_in_db = true;
@@ -176,7 +174,7 @@ function jpibfi_add_plugin() {
176
  return $advanced_settings['on_single'] == "1" ? jpibfi_add_plugin_to_post( $post->ID ) : false;
177
  else if ( is_page() )
178
  return $advanced_settings['on_page'] == "1" ? jpibfi_add_plugin_to_post( $post->ID ) : false;
179
- else if ( is_category() || is_archive() )
180
  return $advanced_settings['on_category'] == "1";
181
  else if ( jpibfi_is_blog_page() )
182
  return $advanced_settings['on_blog'] == "1";
@@ -193,6 +191,7 @@ function jpibfi_init_plugin() {
193
  function jpibfi_add_plugin_scripts() {
194
  if ( ! ( jpibfi_add_plugin() ) )
195
  return;
 
196
  wp_enqueue_script( 'jquery-pin-it-button-script', plugins_url( '/js/script.min.js', __FILE__ ), array( 'jquery' ), JPIBFI_VERSION, false );
197
 
198
  $dev_options = jpibfi_get_basic_options();
@@ -207,9 +206,6 @@ function jpibfi_add_plugin_scripts() {
207
  'site_title' => get_bloginfo( 'name', 'display' )
208
  );
209
  wp_localize_script( 'jquery-pin-it-button-script', 'jpibfi_options', $parameters_array );
210
-
211
- wp_register_style( 'jquery-pin-it-button-style', plugins_url( '/css/style.css', __FILE__ ), array(), JPIBFI_VERSION, 'all' );
212
- wp_enqueue_style( 'jquery-pin-it-button-style' );
213
  }
214
 
215
  function jpibfi_print_header_style_action() {
@@ -220,13 +216,6 @@ function jpibfi_print_header_style_action() {
220
 
221
  $button_css = jpibfi_get_button_css();
222
 
223
- if ( $dev_options['compatibility_mode'] == '0' )
224
- $css = 'background-color: rgba(255, 255, 255, ' . $dev_options['transparency_value'] . ');';
225
- else
226
- $css = "background: url('" .
227
- plugins_url( '/images/transparency/' .
228
- str_replace( '.', '_', $dev_options['transparency_value'] ) . '.png', __FILE__ ) . "') repeat;";
229
-
230
  if ( $dev_options['use_custom_image'] == "1" ) {
231
  $width = $dev_options['custom_image_width'];
232
  $height = $dev_options['custom_image_height'];
@@ -238,15 +227,42 @@ function jpibfi_print_header_style_action() {
238
  $url = JPIBFI_IMAGE_URL;
239
  }
240
 
 
 
 
 
 
 
 
241
  ?>
242
- <style type="text/css">
243
- .pinit .pinit-overlay { <?php echo $css; ?> }
 
 
 
 
 
 
 
 
 
 
244
 
245
- .pinit .pinit-overlay a {
 
 
 
 
 
 
 
246
  <?php
247
  printf( 'width:%spx; height:%spx; background:transparent url("%s") no-repeat 0 0;', $width, $height, $url );
248
  echo $button_css;
249
  ?>
 
 
 
250
  }
251
  </style>
252
  <?php
@@ -292,9 +308,6 @@ function jpibfi_add_admin_site_scripts() {
292
  'min_image_width' => '0'
293
  );
294
  wp_localize_script('jquery-pin-it-button-script', 'jpibfi_options', $parameters_array);
295
-
296
- wp_register_style( 'jquery-pin-it-button-style', plugins_url( '/css/style.css', __FILE__ ), array(), JPIBFI_VERSION, 'all' );
297
- wp_enqueue_style( 'jquery-pin-it-button-style' );
298
  }
299
 
300
  function jpibfi_print_admin_page_action() {
4
  Plugin URI: http://wordpress.org/extend/plugins/jquery-pin-it-button-for-images/
5
  Description: Highlights images on hover and adds a "Pin It" button over them for easy pinning.
6
  Author: Marcin Skrzypiec
7
+ Version: 0.9.99
8
  Author URI: http://profiles.wordpress.org/mrsztuczkens
9
  */
10
 
26
  'disabled_classes' => 'nopin;wp-smiley',
27
  'description_option' => 1,
28
  'enabled_classes' => '',
 
29
  'transparency_value' => '0.5',
30
  'use_custom_image' => '0',
31
  'custom_image_url' => '',
62
  else
63
  $changes_in_db = true;
64
  break;
65
+ case "use_custom_image": //0 or 1 values
 
66
  case "use_post_url":
67
  if ( strcmp( $option, '0' ) != 0 && strcmp( $option, '1' ) != 0 ) //invalid value in database
68
  $changes_in_db = true;
174
  return $advanced_settings['on_single'] == "1" ? jpibfi_add_plugin_to_post( $post->ID ) : false;
175
  else if ( is_page() )
176
  return $advanced_settings['on_page'] == "1" ? jpibfi_add_plugin_to_post( $post->ID ) : false;
177
+ else if ( is_category() || is_archive() || is_search() )
178
  return $advanced_settings['on_category'] == "1";
179
  else if ( jpibfi_is_blog_page() )
180
  return $advanced_settings['on_blog'] == "1";
191
  function jpibfi_add_plugin_scripts() {
192
  if ( ! ( jpibfi_add_plugin() ) )
193
  return;
194
+
195
  wp_enqueue_script( 'jquery-pin-it-button-script', plugins_url( '/js/script.min.js', __FILE__ ), array( 'jquery' ), JPIBFI_VERSION, false );
196
 
197
  $dev_options = jpibfi_get_basic_options();
206
  'site_title' => get_bloginfo( 'name', 'display' )
207
  );
208
  wp_localize_script( 'jquery-pin-it-button-script', 'jpibfi_options', $parameters_array );
 
 
 
209
  }
210
 
211
  function jpibfi_print_header_style_action() {
216
 
217
  $button_css = jpibfi_get_button_css();
218
 
 
 
 
 
 
 
 
219
  if ( $dev_options['use_custom_image'] == "1" ) {
220
  $width = $dev_options['custom_image_width'];
221
  $height = $dev_options['custom_image_height'];
227
  $url = JPIBFI_IMAGE_URL;
228
  }
229
 
230
+ $transparencyDec = floatval( $dev_options['transparency_value'] ); //I need to convert 0.0..1.0 value to 0..255
231
+ $transparencyDec = (int)( $transparencyDec * 255 );
232
+ $transparencyHex = dechex( (int) $transparencyDec );
233
+ if ( strlen( $transparencyHex) == 1 )
234
+ $transparencyHex = "0" . $transparencyHex;
235
+ $transparencyHex = "#" . $transparencyHex . "ffffff";
236
+
237
  ?>
238
+ <!--[if lt IE 9]>
239
+ <style type="text/css">
240
+ .pinit-overlay {
241
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='<?php echo $transparencyHex; ?>',endColorstr='<?php echo $transparencyHex; ?>');
242
+ background:transparent;
243
+ zoom: 1;
244
+ }
245
+ </style>
246
+ <script type="text/javascript">
247
+ var jpibfi_is_ie8 = true;
248
+ </script>
249
+ <![endif]-->
250
 
251
+ <style type="text/css">
252
+ .pinit-overlay {
253
+ background-color: rgba(255, 255, 255, <?php echo $dev_options['transparency_value']; ?>);
254
+ position:absolute;
255
+ z-index:200;
256
+ display:none;
257
+ }
258
+ .pinit-overlay a {
259
  <?php
260
  printf( 'width:%spx; height:%spx; background:transparent url("%s") no-repeat 0 0;', $width, $height, $url );
261
  echo $button_css;
262
  ?>
263
+ position:absolute;
264
+ display:block;
265
+ text-indent:-9999em;
266
  }
267
  </style>
268
  <?php
308
  'min_image_width' => '0'
309
  );
310
  wp_localize_script('jquery-pin-it-button-script', 'jpibfi_options', $parameters_array);
 
 
 
311
  }
312
 
313
  function jpibfi_print_admin_page_action() {
js/admin.js CHANGED
@@ -21,33 +21,30 @@ jQuery(document).ready(function($) {
21
  }
22
  }
23
 
24
- if ($('#compatibility_mode').val() == '0')
25
- {
26
- var value = parseFloat($('#standard_transparency').val());
27
- var regExp = /^((\d+(\.\d+)?)|(\.\d+))\s*$/;
28
 
29
- if (!regExp.test($('#standard_transparency').val()) || isNaN(value) || value < 0 || value > 1) {
30
- $('#standard_transparency').addClass('error-border');
31
- $("#standard_transparency_error").show();
32
- error = true;
33
- } else {
34
- $('#standard_transparency').removeClass('error-border');
35
- $("#standard_transparency_error").hide();
36
- }
37
- }
38
-
39
- var number_values = ['#custom_image_width', '#custom_image_height', '#min_image_width', '#min_image_height']
40
- for (var i = 0; i < number_values.length; i++) {
41
- var field = $(number_values[i]);
42
- if ( !contains_number_larger_or_equal_to_zero(field.val()) ) {
43
- field.addClass('error-border');
44
- $(number_values[i] + "_error").show();
45
- error = true;
46
- } else {
47
- field.removeClass('error-border');
48
- $(number_values[i] + "_error").hide();
49
- }
50
- }
51
 
52
  if (error) {
53
  e.preventDefault();
@@ -56,18 +53,6 @@ jQuery(document).ready(function($) {
56
 
57
  });
58
 
59
- $('#compatibility_mode').change( function() {
60
- if ($(this).val() == '0') {
61
- $('#standard_mode_transparency').show();
62
- $('#compatibility_mode_transparency').hide();
63
- }
64
- else {
65
- $('#standard_mode_transparency').hide();
66
- $('#compatibility_mode_transparency').show();
67
- }
68
-
69
- });
70
-
71
  $("#custom_button_css").prop('disabled', $('#button_position').val() != "5");
72
 
73
  $('#button_position').change( function() {
21
  }
22
  }
23
 
24
+ var value = parseFloat($('#standard_transparency').val());
25
+ var regExp = /^((\d+(\.\d+)?)|(\.\d+))\s*$/;
 
 
26
 
27
+ if (!regExp.test($('#standard_transparency').val()) || isNaN(value) || value < 0 || value > 1) {
28
+ $('#standard_transparency').addClass('error-border');
29
+ $("#standard_transparency_error").show();
30
+ error = true;
31
+ } else {
32
+ $('#standard_transparency').removeClass('error-border');
33
+ $("#standard_transparency_error").hide();
34
+ }
35
+
36
+ var number_values = ['#custom_image_width', '#custom_image_height', '#min_image_width', '#min_image_height']
37
+ for (var i = 0; i < number_values.length; i++) {
38
+ var field = $(number_values[i]);
39
+ if ( !contains_number_larger_or_equal_to_zero(field.val()) ) {
40
+ field.addClass('error-border');
41
+ $(number_values[i] + "_error").show();
42
+ error = true;
43
+ } else {
44
+ field.removeClass('error-border');
45
+ $(number_values[i] + "_error").hide();
46
+ }
47
+ }
 
48
 
49
  if (error) {
50
  e.preventDefault();
53
 
54
  });
55
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  $("#custom_button_css").prop('disabled', $('#button_position').val() != "5");
57
 
58
  $('#button_position').change( function() {
js/script.js CHANGED
@@ -25,14 +25,15 @@
25
 
26
  //check if the image has a discriminator class, if has, then return
27
  if ( discriminatorClasses[0].length > 0 ) {
28
- for (var discriminatorClass in discriminatorClasses) {
29
- if (e.hasClass(discriminatorClasses[discriminatorClass]))
30
  return;
31
  }
32
  }
33
  //check allowed classes
34
  if ( allowedClasses[0].length > 0 ) {
35
  var hasAllowedClass = false;
 
36
  for (var z = 0; ( z < allowedClasses.length ) && !hasAllowedClass; z++ )
37
  hasAllowedClass = e.hasClass(allowedClasses[z]);
38
 
@@ -46,9 +47,6 @@
46
 
47
  function jpibfiAddElements() {
48
 
49
- //selector = selector ? selector : "img[data-indexer]";
50
- var wpclasses = ['alignnone', 'alignright', 'alignleft'];
51
-
52
  $("img[data-indexer]").each(function () {
53
  var $image = $(this);
54
 
@@ -84,57 +82,69 @@
84
  var indexer = $image.attr("data-indexer"),
85
  bookmark = 'http://pinterest.com/pin/create/bookmarklet/?url=' + encodeURI(bookmarkUrl) + '&is_video=' + encodeURI('false') + '&description=' + encodeURIComponent(bookmarkDescription);
86
 
87
- $image.wrap('<div class="pinit" data-indexer="' + indexer + '"/>');
88
- $image.after('<span class="pinit-overlay" data-indexer= "' + indexer + '"><a class="pinit-button" href="' + bookmark + '" data-indexer= "' + indexer + '">Pin It</a></span>');
89
 
90
- var $overlay = $('.pinit-overlay[data-indexer="' + indexer + '"]')
91
  .css({
92
- height :this.clientHeight + 'px',
93
- width :this.clientWidth + 'px',
94
- 'margin-right' :$image.css('margin-right'),
95
- 'margin-left' :$image.css('margin-left'),
96
- 'margin-top' :$image.css('margin-top'),
97
- 'margin-bottom':$image.css('margin-bottom')
98
  });
 
99
 
100
- for (var i in wpclasses) {
101
- if ( $image.hasClass(wpclasses[i]) ) {
102
- $('.pinit[data-indexer="' + indexer + '"]').addClass(wpclasses[i]);
103
- $overlay.addClass(wpclasses[i]);
104
- }
105
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
- if ($image.hasClass('aligncenter')) {
108
- $('.pinit[data-indexer="' + indexer + '"]')
109
- .addClass('aligncenter');
110
 
111
- $overlay.css({
112
- 'margin-left' :"auto",
113
- 'margin-right':"auto",
114
- left :0,
115
- right :0
116
- })
 
 
 
 
 
 
 
 
 
117
  }
118
 
119
- $('.pinit .pinit-button').click( function () {
120
- var index = $(this).attr("data-indexer");
121
- var $image = $('img[data-indexer="' + index+ '"]');
122
- var imageUrl = $(this).attr('href') + "&media=" + encodeURI ( $image.data('media') ? $image.data('media') : $image[0].src );
123
- window.open(imageUrl, 'Pinterest', 'width=632,height=253,status=0,toolbar=0,menubar=0,location=1,scrollbars=1');
124
- return false;
125
- });
126
-
127
- $('.pinit').mouseenter(function () {
128
- $(this).children('.pinit-overlay').fadeIn(200);
129
- }).mouseleave(function () {
130
- $(this).children('.pinit-overlay').fadeOut(200);
131
- });
132
- })
133
- };
134
 
135
  function jpibfiRemoveElements() {
136
- $("span.pinit-overlay").remove();
137
- $("img[data-indexer]").unwrap();
138
  }
139
 
140
  $(window).load( jpibfiAddElements );
25
 
26
  //check if the image has a discriminator class, if has, then return
27
  if ( discriminatorClasses[0].length > 0 ) {
28
+ for (var index in discriminatorClasses) {
29
+ if (e.hasClass(discriminatorClasses[index]))
30
  return;
31
  }
32
  }
33
  //check allowed classes
34
  if ( allowedClasses[0].length > 0 ) {
35
  var hasAllowedClass = false;
36
+
37
  for (var z = 0; ( z < allowedClasses.length ) && !hasAllowedClass; z++ )
38
  hasAllowedClass = e.hasClass(allowedClasses[z]);
39
 
47
 
48
  function jpibfiAddElements() {
49
 
 
 
 
50
  $("img[data-indexer]").each(function () {
51
  var $image = $(this);
52
 
82
  var indexer = $image.attr("data-indexer"),
83
  bookmark = 'http://pinterest.com/pin/create/bookmarklet/?url=' + encodeURI(bookmarkUrl) + '&is_video=' + encodeURI('false') + '&description=' + encodeURIComponent(bookmarkDescription);
84
 
85
+ $image.after('<div class="pinit-overlay" data-indexer= "' + indexer + '"><a class="pinit-button" href="' + bookmark + '" data-indexer= "' + indexer + '">Pin It</a></div>');
 
86
 
87
+ $('.pinit-overlay[data-indexer="' + indexer + '"]')
88
  .css({
89
+ height: this.clientHeight + 'px',
90
+ width: this.clientWidth + 'px'
 
 
 
 
91
  });
92
+ });
93
 
94
+ $('.pinit-button').click( function () {
95
+ var index = $(this).attr("data-indexer");
96
+ var $image = $('img[data-indexer="' + index+ '"]');
97
+ var imageUrl = $(this).attr('href') + "&media=" + encodeURI ( $image.data('media') ? $image.data('media') : $image[0].src );
98
+ window.open(imageUrl, 'Pinterest', 'width=632,height=253,status=0,toolbar=0,menubar=0,location=1,scrollbars=1');
99
+ return false;
100
+ });
101
+
102
+ $('img[data-indexer]').mouseenter( function () {
103
+ var indexer = $(this).attr("data-indexer");
104
+ var position = $(this).offset();
105
+
106
+ $("div[data-indexer='" + indexer + "']")
107
+ .show()
108
+ .offset({ left: position.left, top: position.top });
109
+ });
110
+
111
+ //events work quite differently on IE8 than on more modern browsers, therefore (unfortunately) this piece of code is required
112
+ var isIE8 = typeof jpibfi_is_ie8 !== "undefined" && jpibfi_is_ie8;
113
+
114
+ if ( !isIE8 ) {
115
+
116
+ //for modern browsers, we can simply hide the div on mouseleave event an everything is alright
117
+ $('div[data-indexer]').mouseleave(function () { $(this).hide(); } );
118
 
119
+ } else {
 
 
120
 
121
+ //on IE8, we need to follow events on the image and the Pin it button
122
+
123
+ //sets 100ms timeout, after which the overlay hides
124
+ function setHideTimeout(currentObject) {
125
+ var idx = $(currentObject).attr('data-indexer');
126
+ var $div = $("div[data-indexer='" + idx + "']");
127
+ var timeoutId = setTimeout(function(){ $div.hide(); }, 100 );
128
+ $div.data('timeoutId', timeoutId);
129
+ }
130
+
131
+ //cancels overlay hiding
132
+ function clearHideTimeout(currentObject) {
133
+ var idx = $(currentObject).attr('data-indexer');
134
+ var $div = $("div[data-indexer='" + idx + "']");
135
+ clearTimeout($div.data('timeoutId'));
136
  }
137
 
138
+ //we need to watch carefully the image and the pinit button
139
+ $('img[data-indexer]').hover( function () { clearHideTimeout(this); }, function() { setHideTimeout(this); } );
140
+
141
+ $('.pinit-button').hover( function () { clearHideTimeout(this); }, function() { setHideTimeout(this); } );
142
+
143
+ }
144
+ }
 
 
 
 
 
 
 
 
145
 
146
  function jpibfiRemoveElements() {
147
+ $("div.pinit-overlay").remove();
 
148
  }
149
 
150
  $(window).load( jpibfiAddElements );
js/script.min.js CHANGED
@@ -1 +1 @@
1
- (function(e){e(document).ready(function(){function i(){var n=["alignnone","alignright","alignleft"];e("img[data-indexer]").each(function(){var r=e(this);if(this.clientWidth<t.minImageWidth||this.clientHeight<t.minImageHeight){r.removeAttr("data-indexer");return}var i="";if(t.usePostUrl){var s=r.closest("div.jpibfi_container").children("input.jpibfi").first();if(s.length!=0)i=s.attr("data-jpibfi-url")}if(i.length==0)i=t.pageUrl;var u;switch(t.descriptionOption){case"3":u=r.attr("title")?r.attr("title"):r.attr("alt");break;case"2":u=t.pageDescription;break;case"4":u=t.siteTitle;break}if(!u)u=t.pageTitle;var a=r.attr("data-indexer"),f="http://pinterest.com/pin/create/bookmarklet/?url="+encodeURI(i)+"&is_video="+encodeURI("false")+"&description="+encodeURIComponent(u);r.wrap('<div class="pinit" data-indexer="'+a+'"/>');r.after('<span class="pinit-overlay" data-indexer= "'+a+'"><a class="pinit-button" href="'+f+'" data-indexer= "'+a+'">Pin It</a></span>');var l=e('.pinit-overlay[data-indexer="'+a+'"]').css({height:this.clientHeight+"px",width:this.clientWidth+"px","margin-right":r.css("margin-right"),"margin-left":r.css("margin-left"),"margin-top":r.css("margin-top"),"margin-bottom":r.css("margin-bottom")});for(var c in n){if(r.hasClass(n[c])){e('.pinit[data-indexer="'+a+'"]').addClass(n[c]);l.addClass(n[c])}}if(r.hasClass("aligncenter")){e('.pinit[data-indexer="'+a+'"]').addClass("aligncenter");l.css({"margin-left":"auto","margin-right":"auto",left:0,right:0})}e(".pinit .pinit-button").click(function(){var t=e(this).attr("data-indexer");var n=e('img[data-indexer="'+t+'"]');var r=e(this).attr("href")+"&media="+encodeURI(n.data("media")?n.data("media"):n[0].src);window.open(r,"Pinterest","width=632,height=253,status=0,toolbar=0,menubar=0,location=1,scrollbars=1");return false});e(".pinit").mouseenter(function(){e(this).children(".pinit-overlay").fadeIn(200)}).mouseleave(function(){e(this).children(".pinit-overlay").fadeOut(200)})})}function s(){e("span.pinit-overlay").remove();e("img[data-indexer]").unwrap()}var t={pageUrl:document.URL,pageTitle:document.title,pageDescription:e('meta[name="description"]').attr("content"),siteTitle:jpibfi_options.site_title,imageSelector:jpibfi_options.image_selector,disabledClasses:jpibfi_options.disabled_classes,enabledClasses:jpibfi_options.enabled_classes,descriptionOption:jpibfi_options.description_option,usePostUrl:jpibfi_options.use_post_url=="1",minImageHeight:jpibfi_options.min_image_height,minImageWidth:jpibfi_options.min_image_width};var n=t.disabledClasses.split(";");var r=t.enabledClasses.split(";");e(".jpibfi").closest("div").addClass("jpibfi_container");e(t.imageSelector).each(function(t){var i=e(this);if(n[0].length>0){for(var s in n){if(i.hasClass(n[s]))return}}if(r[0].length>0){var o=false;for(var u=0;u<r.length&&!o;u++)o=i.hasClass(r[u]);if(!o)return}i.attr("data-indexer",t)});e(window).load(i);e(window).resize(function(){s();i()})})})(jQuery)
1
+ (function(e){e(document).ready(function(){function i(){e("img[data-indexer]").each(function(){var n=e(this);if(this.clientWidth<t.minImageWidth||this.clientHeight<t.minImageHeight){n.removeAttr("data-indexer");return}var r="";if(t.usePostUrl){var i=n.closest("div.jpibfi_container").children("input.jpibfi").first();if(i.length!=0)r=i.attr("data-jpibfi-url")}if(r.length==0)r=t.pageUrl;var s;switch(t.descriptionOption){case"3":s=n.attr("title")?n.attr("title"):n.attr("alt");break;case"2":s=t.pageDescription;break;case"4":s=t.siteTitle;break}if(!s)s=t.pageTitle;var u=n.attr("data-indexer"),a="http://pinterest.com/pin/create/bookmarklet/?url="+encodeURI(r)+"&is_video="+encodeURI("false")+"&description="+encodeURIComponent(s);n.after('<div class="pinit-overlay" data-indexer= "'+u+'"><a class="pinit-button" href="'+a+'" data-indexer= "'+u+'">Pin It</a></div>');e('.pinit-overlay[data-indexer="'+u+'"]').css({height:this.clientHeight+"px",width:this.clientWidth+"px"})});e(".pinit-button").click(function(){var t=e(this).attr("data-indexer");var n=e('img[data-indexer="'+t+'"]');var r=e(this).attr("href")+"&media="+encodeURI(n.data("media")?n.data("media"):n[0].src);window.open(r,"Pinterest","width=632,height=253,status=0,toolbar=0,menubar=0,location=1,scrollbars=1");return false});e("img[data-indexer]").mouseenter(function(){var t=e(this).attr("data-indexer");var n=e(this).offset();e("div[data-indexer='"+t+"']").show().offset({left:n.left,top:n.top})});var n=typeof jpibfi_is_ie8!=="undefined"&&jpibfi_is_ie8;if(!n){e("div[data-indexer]").mouseleave(function(){e(this).hide()})}else{function r(t){var n=e(t).attr("data-indexer");var r=e("div[data-indexer='"+n+"']");var i=setTimeout(function(){r.hide()},100);r.data("timeoutId",i)}function i(t){var n=e(t).attr("data-indexer");var r=e("div[data-indexer='"+n+"']");clearTimeout(r.data("timeoutId"))}e("img[data-indexer]").hover(function(){i(this)},function(){r(this)});e(".pinit-button").hover(function(){i(this)},function(){r(this)})}}function s(){e("div.pinit-overlay").remove()}var t={pageUrl:document.URL,pageTitle:document.title,pageDescription:e('meta[name="description"]').attr("content"),siteTitle:jpibfi_options.site_title,imageSelector:jpibfi_options.image_selector,disabledClasses:jpibfi_options.disabled_classes,enabledClasses:jpibfi_options.enabled_classes,descriptionOption:jpibfi_options.description_option,usePostUrl:jpibfi_options.use_post_url=="1",minImageHeight:jpibfi_options.min_image_height,minImageWidth:jpibfi_options.min_image_width};var n=t.disabledClasses.split(";");var r=t.enabledClasses.split(";");e(".jpibfi").closest("div").addClass("jpibfi_container");e(t.imageSelector).each(function(t){var i=e(this);if(n[0].length>0){for(var s in n){if(i.hasClass(n[s]))return}}if(r[0].length>0){var o=false;for(var u=0;u<r.length&&!o;u++)o=i.hasClass(r[u]);if(!o)return}i.attr("data-indexer",t)});e(window).load(i);e(window).resize(function(){s();i()})})})(jQuery)
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mrsztuczkens, redearthdesign
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.5.1
7
- Stable tag: 0.9.9
8
  License: GPLv2 or later
9
 
10
  Highlights images on hover and adds a Pinterest "Pin It" button over them for easy pinning.
@@ -69,6 +69,10 @@ Please report them in the plugin's support forum on Wordpress.org.
69
 
70
  == Changelog ==
71
 
 
 
 
 
72
  = 0.9.95 =
73
  * Released 2013-04-28
74
  * Bug fixed: issue with pinning images with hashtags in their title/alt
@@ -127,6 +131,9 @@ Please report them in the plugin's support forum on Wordpress.org.
127
 
128
  == Upgrade Notice ==
129
 
 
 
 
130
  = 0.9.95 =
131
  Minor bug fixed and one new feature (setting the position of the "Pin it" button) added.
132
 
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.5.2
7
+ Stable tag: 0.9.95
8
  License: GPLv2 or later
9
 
10
  Highlights images on hover and adds a Pinterest "Pin It" button over them for easy pinning.
69
 
70
  == Changelog ==
71
 
72
+ = 0.0.99 =
73
+ * Released 2013-07-18
74
+ * Major changes in source code (mostly JavaScript), but little changes in features (few minor bugs/issues should be fixed)
75
+
76
  = 0.9.95 =
77
  * Released 2013-04-28
78
  * Bug fixed: issue with pinning images with hashtags in their title/alt
131
 
132
  == Upgrade Notice ==
133
 
134
+ = 0.9.99 =
135
+ Major source code changes with almost no changes in terms of features. This version can be considered a "test" one. After fixing bugs (if there are any - please report) version 1.0.0 will be published.
136
+
137
  = 0.9.95 =
138
  Minor bug fixed and one new feature (setting the position of the "Pin it" button) added.
139