Version Description
- Release 2016-03-08
- Lots of backend enhancements
Download this release
Release Info
Developer | mrsztuczkens |
Plugin | jQuery Pin It Button for Images |
Version | 1.42 |
Comparing to | |
See all releases |
Code changes from version 1.41 to 1.42
- css/admin.css +20 -0
- css/style.css +0 -16
- gulpfile.js +0 -58
- includes/admin/class-jpibfi-admin.php +37 -22
- includes/admin/class-jpibfi-advanced-options.php +14 -10
- includes/admin/class-jpibfi-options.php +23 -0
- includes/admin/class-jpibfi-selection-options.php +27 -24
- includes/admin/class-jpibfi-visual-options.php +63 -33
- includes/admin/views/notice.php +3 -0
- includes/class-jpibfi-globals.php +41 -0
- includes/public/class-jpibfi-client-utilities.php +9 -9
- includes/public/class-jpibfi-client.php +35 -53
- jquery-pin-it-button-for-images.php +28 -111
- js/admin.js +17 -0
- js/jpibfi-min.js +0 -1
- js/jpibfi.js +1 -274
- js/src/client/button-generator.ts +0 -85
- js/src/client/button-position.ts +0 -9
- js/src/client/logger.ts +0 -39
- js/src/client/main.ts +0 -125
- js/src/client/settings.ts +0 -63
- js/src/client/utils.ts +0 -26
- js/upload-button-new.js +1 -1
- languages/jquery-pin-it-button-for-images.pot +109 -77
- package.json +0 -21
- readme.txt +8 -1
- tsconfig.json +0 -18
- tsd.json +0 -12
css/admin.css
CHANGED
@@ -3,11 +3,31 @@
|
|
3 |
display:block;
|
4 |
}
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
.jpibfi-error-message {
|
7 |
font-weight: bold;
|
8 |
color: red;
|
9 |
}
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
input[type="checkbox"] ~ label {
|
12 |
padding-left: 5px;
|
13 |
}
|
3 |
display:block;
|
4 |
}
|
5 |
|
6 |
+
#show_button_error {
|
7 |
+
background-color: white;
|
8 |
+
border-left: 5px solid #dc3232;
|
9 |
+
margin: 7px 0;
|
10 |
+
padding: 5px 0 5px 12px;
|
11 |
+
box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
|
12 |
+
display: none;
|
13 |
+
}
|
14 |
+
|
15 |
.jpibfi-error-message {
|
16 |
font-weight: bold;
|
17 |
color: red;
|
18 |
}
|
19 |
|
20 |
+
.jpibfi-pro-notice p {
|
21 |
+
font-size: 1.3em;
|
22 |
+
font-weight: 600;
|
23 |
+
color: #23282d;
|
24 |
+
margin: 0.8em 0;
|
25 |
+
}
|
26 |
+
|
27 |
+
.jpibfi-pro-notice a {
|
28 |
+
color: orange;
|
29 |
+
}
|
30 |
+
|
31 |
input[type="checkbox"] ~ label {
|
32 |
padding-left: 5px;
|
33 |
}
|
css/style.css
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
.pinit-overlay {
|
2 |
-
background-color: transparent;
|
3 |
-
position:absolute;
|
4 |
-
z-index:200;
|
5 |
-
display:none;
|
6 |
-
border-width: 0 0;
|
7 |
-
padding: 0 0;
|
8 |
-
margin: 0 0;
|
9 |
-
box-shadow: none;
|
10 |
-
overflow: visible;
|
11 |
-
}
|
12 |
-
a.pinit-button {
|
13 |
-
position:absolute;
|
14 |
-
display:none;
|
15 |
-
text-indent:-9999em !important;
|
16 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gulpfile.js
DELETED
@@ -1,58 +0,0 @@
|
|
1 |
-
var gulp = require('gulp'),
|
2 |
-
gutil = require('gulp-util'),
|
3 |
-
ts = require('gulp-typescript'),
|
4 |
-
wpPot = require('gulp-wp-pot'),
|
5 |
-
sort = require('gulp-sort'),
|
6 |
-
del = require('del'),
|
7 |
-
minify = require('gulp-minify');
|
8 |
-
|
9 |
-
var tsProjectClient = ts.createProject('tsconfig.json');
|
10 |
-
|
11 |
-
var gulpConfig = {
|
12 |
-
repoDirectory: 'D:/dev/jpibfi/trunk'
|
13 |
-
};
|
14 |
-
|
15 |
-
gulp.task('ts', function () {
|
16 |
-
var tsResultClient = tsProjectClient.src()
|
17 |
-
.pipe(ts(tsProjectClient)).js
|
18 |
-
.pipe(minify())
|
19 |
-
.pipe(gulp.dest(''));
|
20 |
-
return tsResultClient;
|
21 |
-
});
|
22 |
-
|
23 |
-
gulp.task('pot', function () {
|
24 |
-
return gulp.src('**/*.php')
|
25 |
-
.pipe(sort())
|
26 |
-
.pipe(wpPot({
|
27 |
-
domain: 'jquery-pin-it-button-for-images',
|
28 |
-
destFile: 'jquery-pin-it-button-for-images.pot',
|
29 |
-
package: 'jquery-pin-it-button-for-images',
|
30 |
-
team: 'Marcin Skrzypiec'
|
31 |
-
}))
|
32 |
-
.pipe(gulp.dest('languages'));
|
33 |
-
});
|
34 |
-
|
35 |
-
gulp.task('watch', function (cb) {
|
36 |
-
gulp.watch('js/src/**/*.ts', ['ts']);
|
37 |
-
});
|
38 |
-
|
39 |
-
gulp.task('clean-repo', function () {
|
40 |
-
return del.sync([
|
41 |
-
gulpConfig.repoDirectory,
|
42 |
-
], {
|
43 |
-
force: true
|
44 |
-
});
|
45 |
-
});
|
46 |
-
|
47 |
-
gulp.task('copy-to-repo', function () {
|
48 |
-
gulp
|
49 |
-
.src([
|
50 |
-
'./**/*.*',
|
51 |
-
'!./node_modules/**',
|
52 |
-
'!./typings/**'
|
53 |
-
],
|
54 |
-
{ dot: true })
|
55 |
-
.pipe(gulp.dest(gulpConfig.repoDirectory));
|
56 |
-
});
|
57 |
-
|
58 |
-
gulp.task('repo', ['clean-repo', 'copy-to-repo']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/admin/class-jpibfi-admin.php
CHANGED
@@ -10,6 +10,7 @@ class JPIBFI_Admin {
|
|
10 |
add_action( 'admin_menu', array( $this, 'print_admin_page_action') );
|
11 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
|
12 |
add_action( 'save_post', array( $this, 'save_meta_data' ) );
|
|
|
13 |
}
|
14 |
|
15 |
public static function get_instance() {
|
@@ -22,13 +23,16 @@ class JPIBFI_Admin {
|
|
22 |
}
|
23 |
|
24 |
public function print_admin_page_action() {
|
|
|
|
|
|
|
25 |
$this->admin_screen_hook = add_submenu_page(
|
26 |
'options-general.php',
|
27 |
-
|
28 |
-
|
29 |
-
'administrator',
|
30 |
-
'jpibfi_settings',
|
31 |
-
array( $this, 'print_admin_page' )
|
32 |
);
|
33 |
|
34 |
add_action( 'admin_print_styles-' . $this->admin_screen_hook, array( $this, 'add_admin_site_scripts') );
|
@@ -37,16 +41,19 @@ class JPIBFI_Admin {
|
|
37 |
/* Adds admin scripts */
|
38 |
public function add_admin_site_scripts() {
|
39 |
|
40 |
-
wp_register_style( 'jquery-pin-it-button-admin-style',
|
41 |
wp_enqueue_style( 'jquery-pin-it-button-admin-style' );
|
42 |
|
43 |
-
|
|
|
|
|
|
|
44 |
|
45 |
if ( function_exists( "wp_enqueue_media") ) {
|
46 |
wp_enqueue_media();
|
47 |
-
wp_enqueue_script( 'jpibfi-upload-new',
|
48 |
} else {
|
49 |
-
wp_enqueue_script( 'jpibfi-upload-old',
|
50 |
}
|
51 |
}
|
52 |
|
@@ -76,13 +83,13 @@ class JPIBFI_Admin {
|
|
76 |
|
77 |
include_once( 'views/admin.php' );
|
78 |
//cumbersome, but needed for error management to work properly in WP 3.3
|
79 |
-
delete_option(
|
80 |
-
delete_option(
|
81 |
}
|
82 |
|
83 |
/* Meta box for each post and page */
|
84 |
public function add_meta_box() {
|
85 |
-
/* TODO check if has permissions
|
86 |
$post_types = array("post", "page");
|
87 |
foreach($post_types as $pt){
|
88 |
add_meta_box(
|
@@ -101,7 +108,7 @@ class JPIBFI_Admin {
|
|
101 |
|
102 |
wp_nonce_field( plugin_basename( __FILE__ ), 'jpibfi_nonce' );
|
103 |
|
104 |
-
$post_meta = get_post_meta( $post->ID,
|
105 |
$checked = isset( $post_meta ) && isset( $post_meta['jpibfi_disable_for_post'] ) && $post_meta['jpibfi_disable_for_post'] == '1';
|
106 |
|
107 |
echo '<input type="checkbox" id="jpibfi_disable_for_post" name="jpibfi_disable_for_post" value="1"' . checked( $checked, true, false ) . '>';
|
@@ -110,26 +117,34 @@ class JPIBFI_Admin {
|
|
110 |
|
111 |
public function save_meta_data( $post_id ) {
|
112 |
|
113 |
-
//check user's permissions
|
114 |
-
if ( ! current_user_can( 'edit_post', $post_id ) )
|
115 |
-
return;
|
116 |
-
// check if this isn't an auto save
|
117 |
-
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
118 |
return;
|
|
|
119 |
// security check = updating possible only using post edit form
|
120 |
if ( !isset( $_POST['jpibfi_nonce'] ) || ! wp_verify_nonce( $_POST['jpibfi_nonce'], plugin_basename( __FILE__ ) ) )
|
121 |
return;
|
122 |
|
123 |
$post_meta = array( 'jpibfi_disable_for_post' => '0' );
|
124 |
// now store data in custom fields based on checkboxes selected
|
125 |
-
$post_meta['jpibfi_disable_for_post'] =
|
126 |
-
isset( $_POST['jpibfi_disable_for_post'] ) && $_POST['jpibfi_disable_for_post'] == '1' ? '1' : '0';
|
127 |
|
128 |
if ( $post_meta['jpibfi_disable_for_post'] == '1' )
|
129 |
-
update_post_meta( $post_id,
|
130 |
else
|
131 |
-
delete_post_meta( $post_id,
|
132 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
}
|
134 |
|
135 |
add_action( 'plugins_loaded', array( 'JPIBFI_Admin', 'get_instance' ) );
|
10 |
add_action( 'admin_menu', array( $this, 'print_admin_page_action') );
|
11 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
|
12 |
add_action( 'save_post', array( $this, 'save_meta_data' ) );
|
13 |
+
add_action( 'admin_notices', array( $this, 'show_admin_notice') );
|
14 |
}
|
15 |
|
16 |
public static function get_instance() {
|
23 |
}
|
24 |
|
25 |
public function print_admin_page_action() {
|
26 |
+
|
27 |
+
$name = 'jQuery Pin It Button For Images Lite';
|
28 |
+
|
29 |
$this->admin_screen_hook = add_submenu_page(
|
30 |
'options-general.php',
|
31 |
+
$name,
|
32 |
+
$name,
|
33 |
+
'administrator',
|
34 |
+
'jpibfi_settings',
|
35 |
+
array( $this, 'print_admin_page' )
|
36 |
);
|
37 |
|
38 |
add_action( 'admin_print_styles-' . $this->admin_screen_hook, array( $this, 'add_admin_site_scripts') );
|
41 |
/* Adds admin scripts */
|
42 |
public function add_admin_site_scripts() {
|
43 |
|
44 |
+
wp_register_style( 'jquery-pin-it-button-admin-style', JPIBFI_Globals::get_plugin_url() . 'css/admin.css', array(), JPIBFI_Globals::get_file_version(), 'all' );
|
45 |
wp_enqueue_style( 'jquery-pin-it-button-admin-style' );
|
46 |
|
47 |
+
$settings = array();
|
48 |
+
$settings['version'] = 'lite';
|
49 |
+
wp_enqueue_script( 'jquery-pin-it-button-admin-script', JPIBFI_Globals::get_plugin_url() . 'js/admin.js', array( 'jquery' ), JPIBFI_Globals::get_file_version(), false );
|
50 |
+
wp_localize_script('jquery-pin-it-button-admin-script', 'jpibfiAdminSettings', $settings);
|
51 |
|
52 |
if ( function_exists( "wp_enqueue_media") ) {
|
53 |
wp_enqueue_media();
|
54 |
+
wp_enqueue_script( 'jpibfi-upload-new', JPIBFI_Globals::get_plugin_url() . 'js/upload-button-new.js', array(), JPIBFI_Globals::get_file_version(), false );
|
55 |
} else {
|
56 |
+
wp_enqueue_script( 'jpibfi-upload-old', JPIBFI_Globals::get_plugin_url() . 'js/upload-button-old.js', array('thickbox', 'media-upload' ), JPIBFI_Globals::get_file_version(), false );
|
57 |
}
|
58 |
}
|
59 |
|
83 |
|
84 |
include_once( 'views/admin.php' );
|
85 |
//cumbersome, but needed for error management to work properly in WP 3.3
|
86 |
+
delete_option( JPIBFI_Selection_Options::get_instance()->get_option_name() . '_errors' );
|
87 |
+
delete_option( JPIBFI_Visual_Options::get_instance()->get_option_name() . '_errors' );
|
88 |
}
|
89 |
|
90 |
/* Meta box for each post and page */
|
91 |
public function add_meta_box() {
|
92 |
+
/* TODO check if has permissions*/
|
93 |
$post_types = array("post", "page");
|
94 |
foreach($post_types as $pt){
|
95 |
add_meta_box(
|
108 |
|
109 |
wp_nonce_field( plugin_basename( __FILE__ ), 'jpibfi_nonce' );
|
110 |
|
111 |
+
$post_meta = get_post_meta( $post->ID, 'jpibfi_meta', true );
|
112 |
$checked = isset( $post_meta ) && isset( $post_meta['jpibfi_disable_for_post'] ) && $post_meta['jpibfi_disable_for_post'] == '1';
|
113 |
|
114 |
echo '<input type="checkbox" id="jpibfi_disable_for_post" name="jpibfi_disable_for_post" value="1"' . checked( $checked, true, false ) . '>';
|
117 |
|
118 |
public function save_meta_data( $post_id ) {
|
119 |
|
120 |
+
//check user's permissions and autosave
|
121 |
+
if ( ! current_user_can( 'edit_post', $post_id ) || (defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE) )
|
|
|
|
|
|
|
122 |
return;
|
123 |
+
|
124 |
// security check = updating possible only using post edit form
|
125 |
if ( !isset( $_POST['jpibfi_nonce'] ) || ! wp_verify_nonce( $_POST['jpibfi_nonce'], plugin_basename( __FILE__ ) ) )
|
126 |
return;
|
127 |
|
128 |
$post_meta = array( 'jpibfi_disable_for_post' => '0' );
|
129 |
// now store data in custom fields based on checkboxes selected
|
130 |
+
$post_meta['jpibfi_disable_for_post'] = isset( $_POST['jpibfi_disable_for_post'] ) && $_POST['jpibfi_disable_for_post'] == '1' ? '1' : '0';
|
|
|
131 |
|
132 |
if ( $post_meta['jpibfi_disable_for_post'] == '1' )
|
133 |
+
update_post_meta( $post_id, 'jpibfi_meta', $post_meta );
|
134 |
else
|
135 |
+
delete_post_meta( $post_id, 'jpibfi_meta' );
|
136 |
}
|
137 |
+
function show_admin_notice() {
|
138 |
+
global $hook_suffix;
|
139 |
+
if ( $this->admin_screen_hook == $hook_suffix ) {
|
140 |
+
?>
|
141 |
+
<div class="updated jpibfi-pro-notice">
|
142 |
+
<p><?php echo sprintf(__('jQuery Pin It Button for Images Pro is coming soon. Click <a target="_blank" href="%s">here</a> to learn more.', 'jquery-pin-it-button-for-images'), 'http://mrsztuczkens.me/jpibfi-pro/'); ?></p>
|
143 |
+
</div>
|
144 |
+
<?php
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
}
|
149 |
|
150 |
add_action( 'plugins_loaded', array( 'JPIBFI_Admin', 'get_instance' ) );
|
includes/admin/class-jpibfi-advanced-options.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class JPIBFI_Advanced_Options {
|
4 |
|
5 |
protected static $instance = null;
|
6 |
|
@@ -19,14 +19,18 @@ class JPIBFI_Advanced_Options {
|
|
19 |
return self::$instance;
|
20 |
}
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
30 |
|
31 |
/* Defines selection options section and adds all required fields */
|
32 |
public function initialize_advanced_options() {
|
@@ -91,11 +95,11 @@ class JPIBFI_Advanced_Options {
|
|
91 |
}
|
92 |
|
93 |
private function get_advanced_options() {
|
94 |
-
|
95 |
|
96 |
if ( null == $this->admin_advanced_options ) {
|
97 |
//cumbersome, but works in WP 3.3
|
98 |
-
$options = get_option(
|
99 |
$this->admin_advanced_options = false == $options ? $jpibfi_adanced_options : $options;
|
100 |
}
|
101 |
|
1 |
<?php
|
2 |
|
3 |
+
class JPIBFI_Advanced_Options extends JPIBFI_Options {
|
4 |
|
5 |
protected static $instance = null;
|
6 |
|
19 |
return self::$instance;
|
20 |
}
|
21 |
|
22 |
+
function get_default_options(){
|
23 |
+
$defaults = array(
|
24 |
+
'debug' => '0',
|
25 |
+
'container_selector' => 'div'
|
26 |
+
);
|
27 |
|
28 |
+
return apply_filters( 'jpibfi_default_advanced_options', $defaults );
|
29 |
+
}
|
30 |
+
|
31 |
+
function get_option_name(){
|
32 |
+
return 'jpibfi_advanced_options';
|
33 |
+
}
|
34 |
|
35 |
/* Defines selection options section and adds all required fields */
|
36 |
public function initialize_advanced_options() {
|
95 |
}
|
96 |
|
97 |
private function get_advanced_options() {
|
98 |
+
$jpibfi_adanced_options = JPIBFI_Advanced_Options::get_instance()->get_options();
|
99 |
|
100 |
if ( null == $this->admin_advanced_options ) {
|
101 |
//cumbersome, but works in WP 3.3
|
102 |
+
$options = get_option( $this->get_option_name() . '_errors' );
|
103 |
$this->admin_advanced_options = false == $options ? $jpibfi_adanced_options : $options;
|
104 |
}
|
105 |
|
includes/admin/class-jpibfi-options.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if (!class_exists('JPIBFI_Options')){
|
4 |
+
|
5 |
+
abstract class JPIBFI_Options {
|
6 |
+
|
7 |
+
protected abstract function get_option_name();
|
8 |
+
protected abstract function get_default_options();
|
9 |
+
|
10 |
+
private function get_db_options(){
|
11 |
+
$db_options = get_option($this->get_option_name());
|
12 |
+
return $db_options;
|
13 |
+
}
|
14 |
+
|
15 |
+
public function get_options(){
|
16 |
+
$db_options = $this->get_db_options();
|
17 |
+
$db_options = $db_options != false ? $db_options : array();
|
18 |
+
$defaults = $this->get_default_options();
|
19 |
+
$merged = array_merge($defaults, $db_options);
|
20 |
+
return $merged;
|
21 |
+
}
|
22 |
+
}
|
23 |
+
}
|
includes/admin/class-jpibfi-selection-options.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class JPIBFI_Selection_Options {
|
4 |
|
5 |
protected static $instance = null;
|
6 |
|
@@ -19,25 +19,28 @@ class JPIBFI_Selection_Options {
|
|
19 |
return self::$instance;
|
20 |
}
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
'enabled_classes' => '',
|
28 |
'min_image_height' => '0',
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
41 |
return array(
|
42 |
'show_on_home',
|
43 |
'show_on_single',
|
@@ -241,7 +244,7 @@ class JPIBFI_Selection_Options {
|
|
241 |
}
|
242 |
|
243 |
public function sanitize_selection_options( $input ) {
|
244 |
-
|
245 |
|
246 |
foreach( $input as $key => $value ) {
|
247 |
switch($key) {
|
@@ -294,23 +297,23 @@ class JPIBFI_Selection_Options {
|
|
294 |
|
295 |
if ( count( $errors ) > 0 ) {
|
296 |
|
297 |
-
update_option(
|
298 |
return $jpibfi_selection_options;
|
299 |
|
300 |
} else {
|
301 |
|
302 |
-
delete_option(
|
303 |
return $input;
|
304 |
|
305 |
}
|
306 |
}
|
307 |
|
308 |
private function get_selection_options() {
|
309 |
-
|
310 |
|
311 |
if ( null == $this->admin_selection_options ) {
|
312 |
//cumbersome, but works in WP 3.3
|
313 |
-
$options = get_option(
|
314 |
$this->admin_selection_options = false == $options ? $jpibfi_selection_options : $options;
|
315 |
}
|
316 |
|
1 |
<?php
|
2 |
|
3 |
+
class JPIBFI_Selection_Options extends JPIBFI_Options {
|
4 |
|
5 |
protected static $instance = null;
|
6 |
|
19 |
return self::$instance;
|
20 |
}
|
21 |
|
22 |
+
function get_default_options(){
|
23 |
+
$defaults = array(
|
24 |
+
'image_selector' => '.jpibfi_container img',
|
25 |
+
'disabled_classes' => 'nopin;wp-smiley',
|
26 |
+
'enabled_classes' => '',
|
|
|
27 |
'min_image_height' => '0',
|
28 |
+
'min_image_width' => '0',
|
29 |
+
'show_on_home' => '1',
|
30 |
+
'show_on_single' => '1',
|
31 |
+
'show_on_page' => '1',
|
32 |
+
'show_on_category' => '1',
|
33 |
+
'show_on_blog' => '1'
|
34 |
+
);
|
35 |
+
|
36 |
+
return apply_filters('jpibfi_default_selection_options', $defaults);
|
37 |
+
}
|
38 |
+
|
39 |
+
function get_option_name(){
|
40 |
+
return 'jpibfi_selection_options';
|
41 |
+
}
|
42 |
+
|
43 |
+
private function get_checkbox_settings(){
|
44 |
return array(
|
45 |
'show_on_home',
|
46 |
'show_on_single',
|
244 |
}
|
245 |
|
246 |
public function sanitize_selection_options( $input ) {
|
247 |
+
$jpibfi_selection_options = $this->get_options();
|
248 |
|
249 |
foreach( $input as $key => $value ) {
|
250 |
switch($key) {
|
297 |
|
298 |
if ( count( $errors ) > 0 ) {
|
299 |
|
300 |
+
update_option( $this->get_option_name() . '_errors', $input );
|
301 |
return $jpibfi_selection_options;
|
302 |
|
303 |
} else {
|
304 |
|
305 |
+
delete_option( $this->get_option_name() . '_errors' );
|
306 |
return $input;
|
307 |
|
308 |
}
|
309 |
}
|
310 |
|
311 |
private function get_selection_options() {
|
312 |
+
$jpibfi_selection_options = $this->get_options();
|
313 |
|
314 |
if ( null == $this->admin_selection_options ) {
|
315 |
//cumbersome, but works in WP 3.3
|
316 |
+
$options = get_option( $this->get_option_name() . '_errors' );
|
317 |
$this->admin_selection_options = false == $options ? $jpibfi_selection_options : $options;
|
318 |
}
|
319 |
|
includes/admin/class-jpibfi-visual-options.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
class JPIBFI_Visual_Options {
|
4 |
protected static $instance = null;
|
5 |
|
6 |
protected $admin_visual_options = null;
|
@@ -15,43 +15,45 @@ class JPIBFI_Visual_Options {
|
|
15 |
if ( null == self::$instance ) {
|
16 |
self::$instance = new self;
|
17 |
}
|
18 |
-
|
19 |
return self::$instance;
|
20 |
}
|
21 |
|
22 |
private function get_visual_options() {
|
23 |
-
|
24 |
|
25 |
if ( null == $this->admin_visual_options ) {
|
26 |
//cumbersome, but works in WP 3.3
|
27 |
-
$options = get_option(
|
28 |
-
$this->admin_visual_options = false == $options ? $
|
29 |
}
|
30 |
|
31 |
return $this->admin_visual_options;
|
32 |
}
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
55 |
|
56 |
function get_checkbox_settings() {
|
57 |
return array(
|
@@ -64,7 +66,6 @@ class JPIBFI_Visual_Options {
|
|
64 |
/* Defines visual options section and defines all required fields */
|
65 |
public function initialize_visual_options() {
|
66 |
|
67 |
-
// First, we register a section.
|
68 |
add_settings_section(
|
69 |
'visual_options_section', // ID used to identify this section and with which to register options
|
70 |
__( 'Visual', 'jquery-pin-it-button-for-images' ), // Title to be displayed on the administration page
|
@@ -72,7 +73,17 @@ class JPIBFI_Visual_Options {
|
|
72 |
'jpibfi_visual_options' // Page on which to add this section of options
|
73 |
);
|
74 |
|
75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
add_settings_field(
|
77 |
'description_option',
|
78 |
__( 'Description source', 'jquery-pin-it-button-for-images' ),
|
@@ -159,17 +170,33 @@ class JPIBFI_Visual_Options {
|
|
159 |
'jpibfi_visual_options',
|
160 |
array( $this, 'sanitize_visual_options' )
|
161 |
);
|
162 |
-
|
163 |
}
|
164 |
|
165 |
public function visual_options_callback() {
|
166 |
echo '<p>' . __('How it should look like', 'jquery-pin-it-button-for-images') . '</p>';
|
167 |
}
|
168 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
public function description_option_callback( $args ) {
|
170 |
$options = $this->get_visual_options();
|
171 |
|
172 |
-
|
173 |
$description_option = $options[ 'description_option' ];
|
174 |
?>
|
175 |
|
@@ -310,7 +337,7 @@ class JPIBFI_Visual_Options {
|
|
310 |
}
|
311 |
|
312 |
public function sanitize_visual_options( $input ) {
|
313 |
-
|
314 |
|
315 |
foreach( $input as $key => $value ) {
|
316 |
|
@@ -344,6 +371,9 @@ class JPIBFI_Visual_Options {
|
|
344 |
}
|
345 |
}
|
346 |
|
|
|
|
|
|
|
347 |
$checkbox_settings = $this->get_checkbox_settings();
|
348 |
foreach($checkbox_settings as $setting_name){
|
349 |
if (false == array_key_exists( $setting_name, $input) )
|
@@ -354,12 +384,12 @@ class JPIBFI_Visual_Options {
|
|
354 |
|
355 |
if ( count( $errors ) > 0 ) {
|
356 |
|
357 |
-
update_option(
|
358 |
return $jpibfi_visual_options;
|
359 |
|
360 |
} else {
|
361 |
|
362 |
-
delete_option(
|
363 |
return $input;
|
364 |
|
365 |
}
|
1 |
<?php
|
2 |
|
3 |
+
class JPIBFI_Visual_Options extends JPIBFI_Options {
|
4 |
protected static $instance = null;
|
5 |
|
6 |
protected $admin_visual_options = null;
|
15 |
if ( null == self::$instance ) {
|
16 |
self::$instance = new self;
|
17 |
}
|
|
|
18 |
return self::$instance;
|
19 |
}
|
20 |
|
21 |
private function get_visual_options() {
|
22 |
+
$db_options = $this->get_options();
|
23 |
|
24 |
if ( null == $this->admin_visual_options ) {
|
25 |
//cumbersome, but works in WP 3.3
|
26 |
+
$options = get_option( $this->get_option_name() . '_errors' );
|
27 |
+
$this->admin_visual_options = false == $options ? $db_options : $options;
|
28 |
}
|
29 |
|
30 |
return $this->admin_visual_options;
|
31 |
}
|
32 |
|
33 |
+
function get_default_options(){
|
34 |
+
$defaults = array(
|
35 |
+
'transparency_value' => '0.5',
|
36 |
+
'description_option' => '1',
|
37 |
+
'use_custom_image' => '0',
|
38 |
+
'custom_image_url' => '',
|
39 |
+
'custom_image_height' => '0',
|
40 |
+
'custom_image_width' => '0',
|
41 |
+
'use_post_url' => '0',
|
42 |
+
'button_position' => '0',
|
43 |
+
'button_margin_top' => '20',
|
44 |
+
'button_margin_right' => '20',
|
45 |
+
'button_margin_bottom' => '20',
|
46 |
+
'button_margin_left' => '20',
|
47 |
+
'retina_friendly' => '0',
|
48 |
+
'show_button' => 'hover'
|
49 |
+
);
|
50 |
+
|
51 |
+
return apply_filters( 'jpibfi_default_visual_options', $defaults );
|
52 |
+
}
|
53 |
+
|
54 |
+
function get_option_name(){
|
55 |
+
return 'jpibfi_visual_options';
|
56 |
+
}
|
57 |
|
58 |
function get_checkbox_settings() {
|
59 |
return array(
|
66 |
/* Defines visual options section and defines all required fields */
|
67 |
public function initialize_visual_options() {
|
68 |
|
|
|
69 |
add_settings_section(
|
70 |
'visual_options_section', // ID used to identify this section and with which to register options
|
71 |
__( 'Visual', 'jquery-pin-it-button-for-images' ), // Title to be displayed on the administration page
|
73 |
'jpibfi_visual_options' // Page on which to add this section of options
|
74 |
);
|
75 |
|
76 |
+
add_settings_field(
|
77 |
+
'show_button',
|
78 |
+
__( 'Show button', 'jquery-pin-it-button-for-images' ),
|
79 |
+
array( $this, 'show_button_callback' ),
|
80 |
+
'jpibfi_visual_options',
|
81 |
+
'visual_options_section',
|
82 |
+
array(
|
83 |
+
__( 'When the "Pin it" button should be visible.', 'jquery-pin-it-button-for-images' ),
|
84 |
+
)
|
85 |
+
);
|
86 |
+
|
87 |
add_settings_field(
|
88 |
'description_option',
|
89 |
__( 'Description source', 'jquery-pin-it-button-for-images' ),
|
170 |
'jpibfi_visual_options',
|
171 |
array( $this, 'sanitize_visual_options' )
|
172 |
);
|
|
|
173 |
}
|
174 |
|
175 |
public function visual_options_callback() {
|
176 |
echo '<p>' . __('How it should look like', 'jquery-pin-it-button-for-images') . '</p>';
|
177 |
}
|
178 |
|
179 |
+
public function show_button_callback($args){
|
180 |
+
$options = $this->get_visual_options();
|
181 |
+
$show_button = 'hover';
|
182 |
+
?>
|
183 |
+
<select id="show_button" name="jpibfi_visual_options[show_button]">
|
184 |
+
<option value="hover" <?php selected ( "hover", $show_button ); ?>><?php _e( 'On hover', 'jquery-pin-it-button-for-images' ); ?></option>
|
185 |
+
<option value="always_touch" <?php selected ( "always_touch", $show_button ); ?>><?php _e( 'Always on touch devices', 'jquery-pin-it-button-for-images' ); ?></option>
|
186 |
+
<option value="always" <?php selected ( "always", $show_button ); ?>><?php _e( 'Always', 'jquery-pin-it-button-for-images' ); ?></option>
|
187 |
+
</select>
|
188 |
+
<?php
|
189 |
+
?>
|
190 |
+
<div id="show_button_error">
|
191 |
+
<p><strong><?php echo sprintf(__('This feature is disabled in this version of the plugin. Consider buying <a target="_blank" href="%s">the PRO version</a>.', 'jquery-pin-it-button-for-images'), 'http://mrsztuczkens.me/jpibfi-pro/'); ?></strong></p>
|
192 |
+
</div>
|
193 |
+
<?php
|
194 |
+
echo JPIBFI_Admin_Utilities::create_description( $args[0] );
|
195 |
+
}
|
196 |
+
|
197 |
public function description_option_callback( $args ) {
|
198 |
$options = $this->get_visual_options();
|
199 |
|
|
|
200 |
$description_option = $options[ 'description_option' ];
|
201 |
?>
|
202 |
|
337 |
}
|
338 |
|
339 |
public function sanitize_visual_options( $input ) {
|
340 |
+
$jpibfi_visual_options = $this->get_options();
|
341 |
|
342 |
foreach( $input as $key => $value ) {
|
343 |
|
371 |
}
|
372 |
}
|
373 |
|
374 |
+
$defaults = $this->get_default_options();
|
375 |
+
$input['show_button'] = $defaults['show_button'];
|
376 |
+
|
377 |
$checkbox_settings = $this->get_checkbox_settings();
|
378 |
foreach($checkbox_settings as $setting_name){
|
379 |
if (false == array_key_exists( $setting_name, $input) )
|
384 |
|
385 |
if ( count( $errors ) > 0 ) {
|
386 |
|
387 |
+
update_option( $this->get_option_name() . '_errors', $input );
|
388 |
return $jpibfi_visual_options;
|
389 |
|
390 |
} else {
|
391 |
|
392 |
+
delete_option( $this->get_option_name() . '_errors' );
|
393 |
return $input;
|
394 |
|
395 |
}
|
includes/admin/views/notice.php
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<div class="updated">
|
2 |
+
<p><?php _e('<strong>jQuery Pin It Button for Images Pro</strong> is coming soon.', 'jquery-pin-it-button-for-images'); ?></p>
|
3 |
+
</div>
|
includes/class-jpibfi-globals.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Stores basic plugin info like all the urls and directories needed
|
5 |
+
*/
|
6 |
+
class JPIBFI_Globals {
|
7 |
+
|
8 |
+
private static $plugin_dir;
|
9 |
+
private static $plugin_file;
|
10 |
+
private static $plugin_url;
|
11 |
+
private static $version;
|
12 |
+
private static $version_minor;
|
13 |
+
|
14 |
+
public static function init( $plugin_file, $version, $version_minor ){
|
15 |
+
self::$plugin_file = $plugin_file;
|
16 |
+
self::$plugin_dir = plugin_dir_path( self::$plugin_file );
|
17 |
+
self::$plugin_url = plugin_dir_url( self::$plugin_file );
|
18 |
+
self::$version = $version;
|
19 |
+
self::$version_minor = $version_minor;
|
20 |
+
}
|
21 |
+
|
22 |
+
public static function get_plugin_dir() {
|
23 |
+
return self::$plugin_dir;
|
24 |
+
}
|
25 |
+
|
26 |
+
public static function get_plugin_file() {
|
27 |
+
return self::$plugin_file;
|
28 |
+
}
|
29 |
+
|
30 |
+
public static function get_plugin_url() {
|
31 |
+
return self::$plugin_url;
|
32 |
+
}
|
33 |
+
|
34 |
+
public static function get_version() {
|
35 |
+
return self::$version;
|
36 |
+
}
|
37 |
+
|
38 |
+
public static function get_file_version(){
|
39 |
+
return self::$version . self::$version_minor;
|
40 |
+
}
|
41 |
+
}
|
includes/public/class-jpibfi-client-utilities.php
CHANGED
@@ -76,27 +76,27 @@ class JPIBFI_Client_Utilities {
|
|
76 |
/* True if plugin should be added to the current post/page */
|
77 |
public static function add_jpibfi() {
|
78 |
global $post;
|
79 |
-
|
80 |
|
81 |
if ( is_front_page() )
|
82 |
-
return
|
83 |
else if ( is_single() )
|
84 |
-
return
|
85 |
else if ( is_page() )
|
86 |
-
return
|
87 |
else if ( is_category() || is_archive() || is_search() )
|
88 |
-
return
|
89 |
else if ( self::is_blog_page() )
|
90 |
-
return
|
91 |
return true;
|
92 |
}
|
93 |
|
94 |
/* Checks if the plugin wasn't deactivated in the given post/page */
|
95 |
private static function add_plugin_to_post( $post_id ) {
|
96 |
-
$post_meta = get_post_meta( $post_id,
|
97 |
return empty( $post_meta )
|
98 |
-
|
99 |
-
|
100 |
}
|
101 |
|
102 |
/* function copied from https://gist.github.com/wesbos/1189639 */
|
76 |
/* True if plugin should be added to the current post/page */
|
77 |
public static function add_jpibfi() {
|
78 |
global $post;
|
79 |
+
$jpibfi_selection_options = JPIBFI_Selection_Options::get_instance()->get_options();
|
80 |
|
81 |
if ( is_front_page() )
|
82 |
+
return $jpibfi_selection_options['show_on_home'] == "1";
|
83 |
else if ( is_single() )
|
84 |
+
return $jpibfi_selection_options['show_on_single'] == "1" ? self::add_plugin_to_post( $post->ID ) : false;
|
85 |
else if ( is_page() )
|
86 |
+
return $jpibfi_selection_options['show_on_page'] == "1" ? self::add_plugin_to_post( $post->ID ) : false;
|
87 |
else if ( is_category() || is_archive() || is_search() )
|
88 |
+
return $jpibfi_selection_options['show_on_category'] == "1";
|
89 |
else if ( self::is_blog_page() )
|
90 |
+
return $jpibfi_selection_options['show_on_blog'] == "1";
|
91 |
return true;
|
92 |
}
|
93 |
|
94 |
/* Checks if the plugin wasn't deactivated in the given post/page */
|
95 |
private static function add_plugin_to_post( $post_id ) {
|
96 |
+
$post_meta = get_post_meta( $post_id, 'jpibfi_meta', true );
|
97 |
return empty( $post_meta )
|
98 |
+
|| false == array_key_exists( 'jpibfi_disable_for_post', $post_meta )
|
99 |
+
|| '1' != $post_meta['jpibfi_disable_for_post'];
|
100 |
}
|
101 |
|
102 |
/* function copied from https://gist.github.com/wesbos/1189639 */
|
includes/public/class-jpibfi-client.php
CHANGED
@@ -3,11 +3,11 @@
|
|
3 |
class JPIBFI_Client {
|
4 |
|
5 |
protected static $instance = null;
|
|
|
|
|
6 |
|
7 |
private function __construct() {
|
8 |
-
$this->setup_constants();
|
9 |
add_action( 'wp_enqueue_scripts', array( $this, 'add_plugin_scripts' ) );
|
10 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'add_plugin_styles' ) );
|
11 |
add_action( 'wp_head', array( $this, 'print_header_style' ) );
|
12 |
add_filter( "the_content", array( $this, 'prepare_the_content' ), 9999 );
|
13 |
add_filter( "the_excerpt", array( $this, 'prepare_the_content' ), 9999 );
|
@@ -22,92 +22,70 @@ class JPIBFI_Client {
|
|
22 |
return self::$instance;
|
23 |
}
|
24 |
|
25 |
-
private function setup_constants() {
|
26 |
-
if ( ! defined( 'JPIBFI_IMAGE_WIDTH' ) )
|
27 |
-
define( 'JPIBFI_IMAGE_WIDTH', 65 );
|
28 |
-
|
29 |
-
if ( ! defined( 'JPIBFI_IMAGE_HEIGHT' ) )
|
30 |
-
define( 'JPIBFI_IMAGE_HEIGHT', 41 );
|
31 |
-
}
|
32 |
-
|
33 |
-
//Adds all necessary styles
|
34 |
-
public function add_plugin_styles() {
|
35 |
-
if ( ! ( JPIBFI_Client_Utilities::add_jpibfi() ) )
|
36 |
-
return;
|
37 |
-
|
38 |
-
wp_register_style( 'jquery-pin-it-button-style', JPIBFI_STYLE_URL . 'style.css', array(), JPIBFI_VERSION . JPIBFI_VERSION_MINOR, 'all' );
|
39 |
-
wp_enqueue_style( 'jquery-pin-it-button-style' );
|
40 |
-
}
|
41 |
-
|
42 |
//Adds all necessary scripts
|
43 |
public function add_plugin_scripts() {
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
|
48 |
if ( ! ( JPIBFI_Client_Utilities::add_jpibfi() ) )
|
49 |
return;
|
50 |
-
wp_enqueue_script( 'jquery-pin-it-button-script',
|
51 |
|
52 |
-
$use_custom_image =
|
53 |
|
54 |
$parameters_array = array(
|
55 |
-
'imageSelector'
|
56 |
'disabledClasses' => $jpibfi_selection_options['disabled_classes'],
|
57 |
'enabledClasses' => $jpibfi_selection_options['enabled_classes'],
|
58 |
'descriptionOption' => $jpibfi_visual_options['description_option'],
|
59 |
-
'usePostUrl'
|
60 |
'minImageHeight' => $jpibfi_selection_options['min_image_height'],
|
61 |
'minImageWidth' => $jpibfi_selection_options['min_image_width'],
|
62 |
-
'siteTitle'
|
63 |
-
'buttonPosition'
|
64 |
-
'debug'
|
65 |
'containerSelector' => $jpibfi_adanced_options[ 'container_selector'],
|
66 |
-
'pinImageHeight' => $use_custom_image ? $jpibfi_visual_options['custom_image_height'] :
|
67 |
-
'pinImageWidth' => $use_custom_image ? $jpibfi_visual_options['custom_image_width'] :
|
68 |
'buttonMarginTop' => $jpibfi_visual_options[ 'button_margin_top' ],
|
69 |
-
'buttonMarginBottom'
|
70 |
-
'buttonMarginLeft'=> $jpibfi_visual_options[ 'button_margin_left' ],
|
71 |
'buttonMarginRight' => $jpibfi_visual_options[ 'button_margin_right' ],
|
72 |
-
'retinaFriendly'
|
|
|
73 |
);
|
74 |
|
75 |
wp_localize_script( 'jquery-pin-it-button-script', 'jpibfi_options', apply_filters( 'jpibfi_javascript_parameters', $parameters_array ) );
|
76 |
}
|
77 |
|
78 |
public function print_header_style() {
|
79 |
-
|
80 |
|
81 |
if ( ! ( JPIBFI_Client_Utilities::add_jpibfi() ) )
|
82 |
return;
|
83 |
|
84 |
-
$use_custom_image =
|
85 |
|
86 |
-
$width = $use_custom_image ? $jpibfi_visual_options['custom_image_width'] :
|
87 |
-
$height = $use_custom_image ? $jpibfi_visual_options['custom_image_height'] :
|
88 |
|
89 |
-
if (
|
90 |
$width = floor( $width / 2 );
|
91 |
$height = floor ( $height / 2 );
|
92 |
}
|
93 |
|
94 |
-
$url = $use_custom_image ? $jpibfi_visual_options['custom_image_url'] :
|
95 |
-
|
96 |
?>
|
97 |
-
<!--[if lt IE 9]>
|
98 |
-
<style type="text/css">
|
99 |
-
.pinit-overlay {
|
100 |
-
background-image: url( '<?php echo JPIBFI_PLUGIN_URL . 'images/transparency_0.png'; ?>' ) !important;
|
101 |
-
}
|
102 |
-
</style>
|
103 |
-
<![endif]-->
|
104 |
-
|
105 |
<style type="text/css">
|
106 |
a.pinit-button {
|
|
|
|
|
107 |
width: <?php echo $width; ?>px !important;
|
108 |
height: <?php echo $height; ?>px !important;
|
109 |
background: transparent url('<?php echo $url; ?>') no-repeat 0 0 !important;
|
110 |
-
background-size: <?php echo $width; ?>px <?php echo $height; ?>px !important
|
111 |
}
|
112 |
|
113 |
img.pinit-hover {
|
@@ -115,7 +93,10 @@ class JPIBFI_Client {
|
|
115 |
filter:alpha(opacity=<?php echo (1 - $jpibfi_visual_options['transparency_value']) * 100; ?>) !important; /* For IE8 and earlier */
|
116 |
}
|
117 |
</style>
|
118 |
-
|
|
|
|
|
|
|
119 |
}
|
120 |
|
121 |
/*
|
@@ -126,10 +107,11 @@ class JPIBFI_Client {
|
|
126 |
if ( ! JPIBFI_Client_Utilities::add_jpibfi() )
|
127 |
return $content;
|
128 |
|
|
|
|
|
129 |
global $post;
|
130 |
-
global $jpibfi_visual_options;
|
131 |
|
132 |
-
$add_attributes = false == is_singular() &&
|
133 |
|
134 |
$attributes_html = '';
|
135 |
|
3 |
class JPIBFI_Client {
|
4 |
|
5 |
protected static $instance = null;
|
6 |
+
private $image_width = 65;
|
7 |
+
private $image_height = 41;
|
8 |
|
9 |
private function __construct() {
|
|
|
10 |
add_action( 'wp_enqueue_scripts', array( $this, 'add_plugin_scripts' ) );
|
|
|
11 |
add_action( 'wp_head', array( $this, 'print_header_style' ) );
|
12 |
add_filter( "the_content", array( $this, 'prepare_the_content' ), 9999 );
|
13 |
add_filter( "the_excerpt", array( $this, 'prepare_the_content' ), 9999 );
|
22 |
return self::$instance;
|
23 |
}
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
//Adds all necessary scripts
|
26 |
public function add_plugin_scripts() {
|
27 |
+
$jpibfi_adanced_options = JPIBFI_Advanced_Options::get_instance()->get_options();
|
28 |
+
$jpibfi_selection_options = JPIBFI_Selection_Options::get_instance()->get_options();
|
29 |
+
$jpibfi_visual_options = JPIBFI_Visual_Options::get_instance()->get_options();
|
30 |
|
31 |
if ( ! ( JPIBFI_Client_Utilities::add_jpibfi() ) )
|
32 |
return;
|
33 |
+
wp_enqueue_script( 'jquery-pin-it-button-script', JPIBFI_Globals::get_plugin_url() . 'js/jpibfi.js', array( 'jquery' ), JPIBFI_Globals::get_file_version(), false );
|
34 |
|
35 |
+
$use_custom_image = $jpibfi_visual_options[ 'use_custom_image' ] == "1";
|
36 |
|
37 |
$parameters_array = array(
|
38 |
+
'imageSelector' => $jpibfi_selection_options['image_selector'],
|
39 |
'disabledClasses' => $jpibfi_selection_options['disabled_classes'],
|
40 |
'enabledClasses' => $jpibfi_selection_options['enabled_classes'],
|
41 |
'descriptionOption' => $jpibfi_visual_options['description_option'],
|
42 |
+
'usePostUrl' => $jpibfi_visual_options['use_post_url'],
|
43 |
'minImageHeight' => $jpibfi_selection_options['min_image_height'],
|
44 |
'minImageWidth' => $jpibfi_selection_options['min_image_width'],
|
45 |
+
'siteTitle' => get_bloginfo( 'name', 'display' ),
|
46 |
+
'buttonPosition' => $jpibfi_visual_options[ 'button_position' ],
|
47 |
+
'debug' => $jpibfi_adanced_options[ 'debug'],
|
48 |
'containerSelector' => $jpibfi_adanced_options[ 'container_selector'],
|
49 |
+
'pinImageHeight' => $use_custom_image ? $jpibfi_visual_options['custom_image_height'] : $this->image_height,
|
50 |
+
'pinImageWidth' => $use_custom_image ? $jpibfi_visual_options['custom_image_width'] : $this->image_width,
|
51 |
'buttonMarginTop' => $jpibfi_visual_options[ 'button_margin_top' ],
|
52 |
+
'buttonMarginBottom'=> $jpibfi_visual_options[ 'button_margin_bottom' ],
|
53 |
+
'buttonMarginLeft' => $jpibfi_visual_options[ 'button_margin_left' ],
|
54 |
'buttonMarginRight' => $jpibfi_visual_options[ 'button_margin_right' ],
|
55 |
+
'retinaFriendly' => $jpibfi_visual_options[ 'retina_friendly' ] == '1' ? '1' : '0',
|
56 |
+
'showButton' => $jpibfi_visual_options['show_button']
|
57 |
);
|
58 |
|
59 |
wp_localize_script( 'jquery-pin-it-button-script', 'jpibfi_options', apply_filters( 'jpibfi_javascript_parameters', $parameters_array ) );
|
60 |
}
|
61 |
|
62 |
public function print_header_style() {
|
63 |
+
$jpibfi_visual_options = JPIBFI_Visual_Options::get_instance()->get_options();
|
64 |
|
65 |
if ( ! ( JPIBFI_Client_Utilities::add_jpibfi() ) )
|
66 |
return;
|
67 |
|
68 |
+
$use_custom_image = $jpibfi_visual_options[ 'use_custom_image' ] == "1";
|
69 |
|
70 |
+
$width = $use_custom_image ? $jpibfi_visual_options['custom_image_width'] : $this->image_width;
|
71 |
+
$height = $use_custom_image ? $jpibfi_visual_options['custom_image_height'] : $this->image_height;
|
72 |
|
73 |
+
if ( $jpibfi_visual_options[ 'retina_friendly' ] == '1' ){
|
74 |
$width = floor( $width / 2 );
|
75 |
$height = floor ( $height / 2 );
|
76 |
}
|
77 |
|
78 |
+
$url = $use_custom_image ? $jpibfi_visual_options['custom_image_url'] : JPIBFI_Globals::get_plugin_url() . 'images/pinit-button.png';
|
79 |
+
ob_start();
|
80 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
<style type="text/css">
|
82 |
a.pinit-button {
|
83 |
+
position:absolute;
|
84 |
+
text-indent:-9999em !important;
|
85 |
width: <?php echo $width; ?>px !important;
|
86 |
height: <?php echo $height; ?>px !important;
|
87 |
background: transparent url('<?php echo $url; ?>') no-repeat 0 0 !important;
|
88 |
+
background-size: <?php echo $width; ?>px <?php echo $height; ?>px !important;
|
89 |
}
|
90 |
|
91 |
img.pinit-hover {
|
93 |
filter:alpha(opacity=<?php echo (1 - $jpibfi_visual_options['transparency_value']) * 100; ?>) !important; /* For IE8 and earlier */
|
94 |
}
|
95 |
</style>
|
96 |
+
|
97 |
+
<?php
|
98 |
+
$what = "\\x00-\\x20";
|
99 |
+
echo trim( preg_replace( "/[".$what."]+/" , ' ' , ob_get_clean() ) , $what );
|
100 |
}
|
101 |
|
102 |
/*
|
107 |
if ( ! JPIBFI_Client_Utilities::add_jpibfi() )
|
108 |
return $content;
|
109 |
|
110 |
+
$jpibfi_visual_options = JPIBFI_Visual_Options::get_instance()->get_options();
|
111 |
+
|
112 |
global $post;
|
|
|
113 |
|
114 |
+
$add_attributes = false == is_singular() && '1' == $jpibfi_visual_options[ 'use_post_url' ];
|
115 |
|
116 |
$attributes_html = '';
|
117 |
|
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:
|
10 |
Author URI: http://mrsztuczkens.me/
|
11 |
*/
|
12 |
|
@@ -14,16 +14,14 @@ Author URI: http://mrsztuczkens.me/
|
|
14 |
if ( ! defined( 'WPINC' ) ) {
|
15 |
die;
|
16 |
}
|
|
|
17 |
if ( ! class_exists( 'jQuery_Pin_It_Button_For_Images' ) ) :
|
18 |
|
19 |
-
/* Main JPIBFI Class */
|
20 |
final class jQuery_Pin_It_Button_For_Images {
|
21 |
-
/** Singleton *************************************************************/
|
22 |
|
23 |
private static $instance;
|
24 |
|
25 |
private function __construct() {
|
26 |
-
$this->setup_constants();
|
27 |
$this->includes();
|
28 |
$this->load_textdomain();
|
29 |
|
@@ -41,84 +39,27 @@ if ( ! class_exists( 'jQuery_Pin_It_Button_For_Images' ) ) :
|
|
41 |
return self::$instance;
|
42 |
}
|
43 |
|
44 |
-
/**
|
45 |
-
* Setup plugin constants
|
46 |
-
*/
|
47 |
-
private function setup_constants() {
|
48 |
-
|
49 |
-
/* VERSIONING */
|
50 |
-
//plugin version
|
51 |
-
if ( ! defined( 'JPIBFI_VERSION' ) )
|
52 |
-
define( 'JPIBFI_VERSION', '1.41' );
|
53 |
-
|
54 |
-
//used in versioning css and js files
|
55 |
-
if ( ! defined( 'JPIBFI_VERSION_MINOR' ) )
|
56 |
-
define( 'JPIBFI_VERSION_MINOR', 'a' );
|
57 |
-
|
58 |
-
/* OPTIONS IN DATABASE */
|
59 |
-
//metadata for each post
|
60 |
-
if ( ! defined( 'JPIBFI_METADATA' ) )
|
61 |
-
define( 'JPIBFI_METADATA', 'jpibfi_meta' );
|
62 |
-
|
63 |
-
//used in error handling
|
64 |
-
if ( ! defined( 'JPIBFI_UPDATE_OPTIONS' ) )
|
65 |
-
define( 'JPIBFI_UPDATE_OPTIONS', 'jpibfi_update_options' );
|
66 |
-
|
67 |
-
if ( ! defined( 'JPIBFI_SELECTION_OPTIONS' ) )
|
68 |
-
define( 'JPIBFI_SELECTION_OPTIONS', 'jpibfi_selection_options' );
|
69 |
-
|
70 |
-
if ( ! defined( 'JPIBFI_VISUAL_OPTIONS' ) )
|
71 |
-
define( 'JPIBFI_VISUAL_OPTIONS', 'jpibfi_visual_options' );
|
72 |
-
|
73 |
-
if ( ! defined( 'JPIBFI_ADVANCED_OPTIONS' ) )
|
74 |
-
define( 'JPIBFI_ADVANCED_OPTIONS', 'jpibfi_advanced_options' );
|
75 |
-
|
76 |
-
if ( ! defined( 'JPIBFI_VERSION_OPTION' ) )
|
77 |
-
define( 'JPIBFI_VERSION_OPTION', 'jpibfi_version' );
|
78 |
-
|
79 |
-
/* FOLDERS */
|
80 |
-
// Plugin Folder Path
|
81 |
-
if ( ! defined( 'JPIBFI_PLUGIN_DIR' ) )
|
82 |
-
define( 'JPIBFI_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
83 |
-
|
84 |
-
// Plugin Folder URL
|
85 |
-
if ( ! defined( 'JPIBFI_PLUGIN_URL' ) )
|
86 |
-
define( 'JPIBFI_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
87 |
-
|
88 |
-
// Plugin Root File
|
89 |
-
if ( ! defined( 'JPIBFI_PLUGIN_FILE' ) )
|
90 |
-
define( 'JPIBFI_PLUGIN_FILE', __FILE__ );
|
91 |
-
|
92 |
-
if ( ! defined( 'JPIBFI_STYLE_URL' ) )
|
93 |
-
define( 'JPIBFI_STYLE_URL', JPIBFI_PLUGIN_URL . 'css/' );
|
94 |
-
|
95 |
-
if ( ! defined( 'JPIBFI_SCRIPT_URL' ) )
|
96 |
-
define( 'JPIBFI_SCRIPT_URL', JPIBFI_PLUGIN_URL . 'js/' );
|
97 |
-
}
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Include required files
|
101 |
-
*/
|
102 |
private function includes() {
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
|
|
118 |
}
|
119 |
|
120 |
public function load_textdomain() {
|
121 |
-
load_plugin_textdomain( 'jquery-pin-it-button-for-images', FALSE, dirname( plugin_basename(
|
122 |
}
|
123 |
|
124 |
public function plugin_settings_filter( $links ) {
|
@@ -129,43 +70,19 @@ if ( ! class_exists( 'jQuery_Pin_It_Button_For_Images' ) ) :
|
|
129 |
|
130 |
/* Function updates DB if it detects new version of the plugin */
|
131 |
public function update_plugin() {
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
$option = get_option( JPIBFI_SELECTION_OPTIONS );
|
141 |
-
self::update_option_fields( $option, JPIBFI_Selection_Options::default_selection_options(), JPIBFI_SELECTION_OPTIONS );
|
142 |
-
|
143 |
-
$option = get_option( JPIBFI_ADVANCED_OPTIONS );
|
144 |
-
self::update_option_fields( $option, JPIBFI_ADVANCED_OPTIONS::default_advanced_options(), JPIBFI_ADVANCED_OPTIONS );
|
145 |
-
|
146 |
-
//update the version of the plugin stored in option
|
147 |
-
update_option( JPIBFI_VERSION_OPTION, JPIBFI_VERSION );
|
148 |
-
//update not needed anymore
|
149 |
-
update_option( JPIBFI_UPDATE_OPTIONS, false);
|
150 |
}
|
151 |
}
|
152 |
-
|
153 |
-
/* Function makes sure that option has all needed fields by checking with defaults */
|
154 |
-
public static function update_option_fields( $option, $default_option, $option_name ) {
|
155 |
-
|
156 |
-
if ( false == $option )
|
157 |
-
$option = array();
|
158 |
-
|
159 |
-
$new_option = array_merge($default_option, $option);
|
160 |
-
update_option( $option_name, $new_option );
|
161 |
-
}
|
162 |
}
|
163 |
|
164 |
endif; // End if class_exists check
|
165 |
|
166 |
|
167 |
-
|
168 |
-
return jQuery_Pin_It_Button_For_Images::instance();
|
169 |
-
}
|
170 |
-
|
171 |
-
JPIBFI();
|
6 |
Text Domain: jquery-pin-it-button-for-images
|
7 |
Domain Path: /languages
|
8 |
Author: Marcin Skrzypiec
|
9 |
+
Version:1.42
|
10 |
Author URI: http://mrsztuczkens.me/
|
11 |
*/
|
12 |
|
14 |
if ( ! defined( 'WPINC' ) ) {
|
15 |
die;
|
16 |
}
|
17 |
+
|
18 |
if ( ! class_exists( 'jQuery_Pin_It_Button_For_Images' ) ) :
|
19 |
|
|
|
20 |
final class jQuery_Pin_It_Button_For_Images {
|
|
|
21 |
|
22 |
private static $instance;
|
23 |
|
24 |
private function __construct() {
|
|
|
25 |
$this->includes();
|
26 |
$this->load_textdomain();
|
27 |
|
39 |
return self::$instance;
|
40 |
}
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
private function includes() {
|
43 |
+
|
44 |
+
require_once(plugin_dir_path(__FILE__) . 'includes/class-jpibfi-globals.php');
|
45 |
+
JPIBFI_Globals::init(__FILE__, '1.42', 'a');
|
46 |
+
|
47 |
+
$files = array(
|
48 |
+
'includes/admin/class-jpibfi-admin-utilities.php',
|
49 |
+
'includes/admin/class-jpibfi-options.php',
|
50 |
+
'includes/admin/class-jpibfi-selection-options.php',
|
51 |
+
'includes/admin/class-jpibfi-advanced-options.php',
|
52 |
+
'includes/admin/class-jpibfi-visual-options.php',
|
53 |
+
'includes/admin/class-jpibfi-admin.php',
|
54 |
+
'includes/public/class-jpibfi-client-utilities.php',
|
55 |
+
'includes/public/class-jpibfi-client.php'
|
56 |
+
);
|
57 |
+
foreach($files as $file)
|
58 |
+
require_once JPIBFI_Globals::get_plugin_dir() .$file;
|
59 |
}
|
60 |
|
61 |
public function load_textdomain() {
|
62 |
+
load_plugin_textdomain( 'jquery-pin-it-button-for-images', FALSE, dirname( plugin_basename( JPIBFI_Globals::get_plugin_file() ) ) . '/languages/' );
|
63 |
}
|
64 |
|
65 |
public function plugin_settings_filter( $links ) {
|
70 |
|
71 |
/* Function updates DB if it detects new version of the plugin */
|
72 |
public function update_plugin() {
|
73 |
+
$version_option = 'jpibfi_version';
|
74 |
+
$update_option = 'jpibfi_update_options';
|
75 |
+
|
76 |
+
$jpibfi_v = JPIBFI_Globals::get_version();
|
77 |
+
$version = get_option( $version_option );
|
78 |
+
if ( false == $version || (float)$version < (float)$jpibfi_v || get_option( $update_option ) ) {
|
79 |
+
update_option( $version_option, $jpibfi_v);
|
80 |
+
update_option( $update_option, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
}
|
82 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
}
|
84 |
|
85 |
endif; // End if class_exists check
|
86 |
|
87 |
|
88 |
+
$JPIBFI = jQuery_Pin_It_Button_For_Images::instance();
|
|
|
|
|
|
|
|
js/admin.js
CHANGED
@@ -106,6 +106,17 @@
|
|
106 |
|
107 |
var disabledClassesModule = guiModule(),
|
108 |
enabledClassesModule = guiModule();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
$(document).ready(function ($) {
|
111 |
|
@@ -129,5 +140,11 @@
|
|
129 |
});
|
130 |
return false;
|
131 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
});
|
133 |
})(jQuery);
|
106 |
|
107 |
var disabledClassesModule = guiModule(),
|
108 |
enabledClassesModule = guiModule();
|
109 |
+
|
110 |
+
var settings = (function(){
|
111 |
+
var settings = {
|
112 |
+
version: 'lite'
|
113 |
+
};
|
114 |
+
|
115 |
+
if (window.jpibfiAdminSettings){
|
116 |
+
$.extend(settings, window.jpibfiAdminSettings);
|
117 |
+
}
|
118 |
+
return settings;
|
119 |
+
})();
|
120 |
|
121 |
$(document).ready(function ($) {
|
122 |
|
140 |
});
|
141 |
return false;
|
142 |
});
|
143 |
+
|
144 |
+
if ($('#show_button_error').length > 0){
|
145 |
+
$('#show_button').change(function(e){
|
146 |
+
$('#show_button_error').toggle($(this).val() != 'hover');
|
147 |
+
});
|
148 |
+
}
|
149 |
});
|
150 |
})(jQuery);
|
js/jpibfi-min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
var jpibfi;!function(t){!function(t){t[t.TopLeft=0]="TopLeft",t[t.TopRight=1]="TopRight",t[t.BottomLeft=2]="BottomLeft",t[t.BottomRight=3]="BottomRight",t[t.Middle=4]="Middle"}(t.ButtonPosition||(t.ButtonPosition={}));t.ButtonPosition}(jpibfi||(jpibfi={}));var jpibfi;!function(t){var i=jQuery,e=function(){function e(t,i){this._settings=t,this._logger=i}return e.prototype.getImageUrl=function(t){return i.fn.prop&&t.prop("src")||t.attr("src")},e.prototype.generate=function(e){var n=jQuery("<a/>",{href:"#","class":"pinit-button","data-jpibfi-indexer":e,text:""}),o=this;return n.click(function(){o._logger.logString("Pin In button clicked");var t=i(this).data("jpibfi-indexer"),e=i('img[data-jpibfi-indexer="'+t+'"]'),n="",s="",r="";if(o._settings.usePostUrl){var a=e.closest(".jpibfi_container").find("input.jpibfi").first();a.length&&(s=a.data("jpibfi-description"),r=a.data("jpibfi-url"))}r=r||o._settings.pageUrl,3==o._settings.descriptionOption?n=e.attr("title")||e.attr("alt"):2==o._settings.descriptionOption?n=s||o._settings.pageDescription:4==o._settings.descriptionOption?n=o._settings.siteTitle:5==o._settings.descriptionOption?n=e.data("jpibfi-description"):6==o._settings.descriptionOption&&(n=e.attr("alt")),n=n||s||o._settings.pageTitle;var g="http://pinterest.com/pin/create/bookmarklet/?is_video="+encodeURIComponent("false")+"&url="+encodeURIComponent(r)+"&media="+encodeURIComponent(o.getImageUrl(e))+"&description="+encodeURIComponent(n);return window.open(g,"Pinterest","width=632,height=253,status=0,toolbar=0,menubar=0,location=1,scrollbars=1"),!1}),n.mouseenter(function(){var t=i(this);clearTimeout(t.data("jpibfi-timeoutId"))}),n.mouseleave(function(){var e=i(this);t.Utils.startHide(e)}),n},e}();t.PinButtonGenerator=e}(jpibfi||(jpibfi={}));var jpibfi;!function(t){var i=function(){function t(t){this._printLog=t&&"undefined"!=typeof console&&"undefined"!=typeof console.log,this._jsonStringifyExists="undefined"!=typeof JSON&&"function"==typeof JSON.stringify}return t.prototype._logObject=function(t){var i="";for(var e in t)i+=e+": "+t[e]+"\n";console.log("jpibfi debug: "+i)},t.prototype.logString=function(t){this._printLog&&console.log("jpibfi debug: "+t)},t.prototype.logObject=function(t){this._printLog&&(this._jsonStringifyExists?console.log("jpibfi debugz: "+JSON.stringify(t,null,4)):this._logObject(t))},t}();t.Logger=i}(jpibfi||(jpibfi={}));var jpibfi;!function(t){var i=function(){function i(i){this.filterSelector="*",this.notSelector="",this.buttonMarginTop=parseInt(i.buttonMarginTop),this.buttonMarginRight=parseInt(i.buttonMarginRight),this.buttonMarginBottom=parseInt(i.buttonMarginBottom),this.buttonMarginLeft=parseInt(i.buttonMarginLeft),this.buttonPosition=i.hasOwnProperty("buttonPosition")?parseInt(i.buttonPosition):4,this.debug=i.hasOwnProperty("debug")?"1"==i.debug:!1,this.descriptionOption=i.hasOwnProperty("descriptionOption")?parseInt(i.descriptionOption):1,this.imageSelector=i.imageSelector,this.minImageWidth=i.hasOwnProperty("minImageWidth")?parseInt(i.minImageWidth):0,this.minImageHeight=i.hasOwnProperty("minImageHeight")?parseInt(i.minImageHeight):0,this.pageDescription=i.pageDescription,this.pageTitle=i.pageTitle,this.pageUrl=i.pageUrl,this.pinImageHeight=parseInt(i.pinImageHeight),this.pinImageWidth=parseInt(i.pinImageWidth),this.retinaFriendly=i.hasOwnProperty("retinaFriendly")?1==i.retinaFriendly:!1,this.siteTitle=i.siteTitle,this.usePostUrl=i.hasOwnProperty("usePostUrl")?i.usePostUrl:!0,this.containerSelector=i.containerSelector,this.notSelector=i.hasOwnProperty("disabledClasses")?t.Utils.createSelectorFromList(i.disabledClasses):"",this.filterSelector=i.hasOwnProperty("enabledClasses")?t.Utils.createSelectorFromList(i.enabledClasses)||"*":"*",this.adjustPinImageSize()}return i.prototype.adjustPinImageSize=function(){this.retinaFriendly&&(this.pinImageHeight=Math.ceil(this.pinImageHeight/2),this.pinImageWidth=Math.ceil(this.pinImageWidth/2))},i}();t.Settings=i}(jpibfi||(jpibfi={}));var jpibfi;!function(t){var i=jQuery,e=function(){function t(){}return t.createSelectorFromList=function(t){for(var i=t.split(";"),e="",n=0;n<i.length;n++)i[n]&&(e+="."+i[n]+",");return e?e.substr(0,e.length-1):e},t.startHide=function(t){var e=setTimeout(function(){t.remove(),i('img[data-jpibfi-indexer="'+t.data("jpibfi-indexer")+'"]').removeClass("pinit-hover")},100);t.data("jpibfi-timeoutId",e)},t}();t.Utils=e}(jpibfi||(jpibfi={}));var jpibfi;!function(t){"use strict";var i=jQuery,e=function(){function e(e){this._indexer=0,this._settings=new t.Settings(i.extend({pageUrl:document.URL,pageTitle:document.title,pageDescription:i('meta[name="description"]').attr("content")||""},e)),this._logger=new t.Logger(this._settings.debug),this._buttonGenerator=new t.PinButtonGenerator(this._settings,this._logger),this._logger.logObject(this._settings)}return e.prototype.addImages=function(){this._logger.logString(">>addImages");var t=i(this._settings.imageSelector).not(this._settings.notSelector).not("[data-jpibfi-indexer]").filter(this._settings.filterSelector),e=this;t.each(function(){i(this).attr("data-jpibfi-indexer",e._indexer++)}),this._logger.logString("Images caught by selectors: "+this._indexer)},e.prototype.init=function(){var t=i(".jpibfi").closest(this._settings.containerSelector).addClass("jpibfi_container");this._logger.logString("Number of containers added: "+t.length),this.initImageDelegates(),i(document).trigger("jpibfi_beforeAddImages",{}),this.addImages(),i(document).trigger("jpibfi_afterAddImages",{})},e.prototype.initImageDelegates=function(){var e=this;i(document).delegate("img[data-jpibfi-indexer]","mouseenter",function(){var n=i(this);if(n[0].clientWidth<e._settings.minImageWidth||n[0].clientHeight<e._settings.minImageHeight)return void n.removeAttr("data-jpibfi-indexer");var o=n.data("jpibfi-indexer"),s=i('a.pinit-button[data-jpibfi-indexer="'+o+'"]');if(1==s.length)clearTimeout(s.data("jpibfi-timeoutId"));else{s=e._buttonGenerator.generate(o);var r=n.offset(),a={width:n.get(0).clientWidth,height:n.get(0).clientHeight};switch(e._settings.buttonPosition){case t.ButtonPosition.TopLeft:r.left+=e._settings.buttonMarginLeft,r.top+=e._settings.buttonMarginTop;break;case t.ButtonPosition.TopRight:r.top+=e._settings.buttonMarginTop,r.left=r.left+a.width-e._settings.buttonMarginRight-e._settings.pinImageWidth;break;case t.ButtonPosition.BottomLeft:r.left+=e._settings.buttonMarginLeft,r.top=r.top+a.height-e._settings.buttonMarginBottom-e._settings.pinImageHeight;break;case t.ButtonPosition.BottomRight:r.left=r.left+a.width-e._settings.buttonMarginRight-e._settings.pinImageWidth,r.top=r.top+a.height-e._settings.buttonMarginBottom-e._settings.pinImageHeight;break;case t.ButtonPosition.Middle:r.left=Math.round(r.left+a.width/2-e._settings.pinImageWidth/2),r.top=Math.round(r.top+a.height/2-e._settings.pinImageHeight/2)}n.after(s),s.show().offset({left:r.left,top:r.top})}n.addClass("pinit-hover")}),i(document).delegate("img[data-jpibfi-indexer]","mouseleave",function(){var e=i(this).data("jpibfi-indexer"),n=i('a.pinit-button[data-jpibfi-indexer="'+e+'"]');t.Utils.startHide(n)})},e}();!function(){i(document).ready(function(){var t=new e(jpibfi_options);t.init()})}()}(jpibfi||(jpibfi={}));
|
|
js/jpibfi.js
CHANGED
@@ -1,274 +1 @@
|
|
1 |
-
var jpibfi;
|
2 |
-
(function (jpibfi) {
|
3 |
-
(function (ButtonPosition) {
|
4 |
-
ButtonPosition[ButtonPosition["TopLeft"] = 0] = "TopLeft";
|
5 |
-
ButtonPosition[ButtonPosition["TopRight"] = 1] = "TopRight";
|
6 |
-
ButtonPosition[ButtonPosition["BottomLeft"] = 2] = "BottomLeft";
|
7 |
-
ButtonPosition[ButtonPosition["BottomRight"] = 3] = "BottomRight";
|
8 |
-
ButtonPosition[ButtonPosition["Middle"] = 4] = "Middle";
|
9 |
-
})(jpibfi.ButtonPosition || (jpibfi.ButtonPosition = {}));
|
10 |
-
var ButtonPosition = jpibfi.ButtonPosition;
|
11 |
-
})(jpibfi || (jpibfi = {}));
|
12 |
-
var jpibfi;
|
13 |
-
(function (jpibfi) {
|
14 |
-
var $ = jQuery;
|
15 |
-
var PinButtonGenerator = (function () {
|
16 |
-
function PinButtonGenerator(settings, logger) {
|
17 |
-
this._settings = settings;
|
18 |
-
this._logger = logger;
|
19 |
-
}
|
20 |
-
PinButtonGenerator.prototype.getImageUrl = function ($elem) {
|
21 |
-
return ($.fn.prop && $elem.prop('src')) || $elem.attr('src');
|
22 |
-
};
|
23 |
-
PinButtonGenerator.prototype.generate = function (indexer) {
|
24 |
-
var $anchor = jQuery('<a/>', {
|
25 |
-
href: '#',
|
26 |
-
"class": 'pinit-button',
|
27 |
-
"data-jpibfi-indexer": indexer,
|
28 |
-
text: ""
|
29 |
-
});
|
30 |
-
var that = this;
|
31 |
-
$anchor.click(function () {
|
32 |
-
that._logger.logString('Pin In button clicked');
|
33 |
-
var index = $(this).data("jpibfi-indexer");
|
34 |
-
var $image = $('img[data-jpibfi-indexer="' + index + '"]');
|
35 |
-
//Bookmark description is created on click because sometimes it's lazy loaded
|
36 |
-
var bookmarkDescription = "", descriptionForUrl = "", bookmarkUrl = "";
|
37 |
-
//if usePostUrl feature is active, we need to get the data
|
38 |
-
if (that._settings.usePostUrl) {
|
39 |
-
var $inputWithData = $image.closest(".jpibfi_container").find("input.jpibfi").first();
|
40 |
-
if ($inputWithData.length) {
|
41 |
-
descriptionForUrl = $inputWithData.data("jpibfi-description");
|
42 |
-
bookmarkUrl = $inputWithData.data("jpibfi-url");
|
43 |
-
}
|
44 |
-
}
|
45 |
-
bookmarkUrl = bookmarkUrl || that._settings.pageUrl;
|
46 |
-
if (that._settings.descriptionOption == 3)
|
47 |
-
bookmarkDescription = $image.attr('title') || $image.attr('alt');
|
48 |
-
else if (that._settings.descriptionOption == 2)
|
49 |
-
bookmarkDescription = descriptionForUrl || that._settings.pageDescription;
|
50 |
-
else if (that._settings.descriptionOption == 4)
|
51 |
-
bookmarkDescription = that._settings.siteTitle;
|
52 |
-
else if (that._settings.descriptionOption == 5)
|
53 |
-
bookmarkDescription = $image.data('jpibfi-description');
|
54 |
-
else if (that._settings.descriptionOption == 6)
|
55 |
-
bookmarkDescription = $image.attr('alt');
|
56 |
-
bookmarkDescription = bookmarkDescription || (descriptionForUrl || that._settings.pageTitle);
|
57 |
-
var imageUrl = 'http://pinterest.com/pin/create/bookmarklet/?is_video=' + encodeURIComponent('false')
|
58 |
-
+ "&url=" + encodeURIComponent(bookmarkUrl) + "&media=" + encodeURIComponent(that.getImageUrl($image))
|
59 |
-
+ '&description=' + encodeURIComponent(bookmarkDescription);
|
60 |
-
window.open(imageUrl, 'Pinterest', 'width=632,height=253,status=0,toolbar=0,menubar=0,location=1,scrollbars=1');
|
61 |
-
return false;
|
62 |
-
});
|
63 |
-
$anchor.mouseenter(function () {
|
64 |
-
var $button = $(this);
|
65 |
-
clearTimeout($button.data('jpibfi-timeoutId'));
|
66 |
-
});
|
67 |
-
$anchor.mouseleave(function () {
|
68 |
-
var $button = $(this);
|
69 |
-
jpibfi.Utils.startHide($button);
|
70 |
-
});
|
71 |
-
return $anchor;
|
72 |
-
};
|
73 |
-
return PinButtonGenerator;
|
74 |
-
})();
|
75 |
-
jpibfi.PinButtonGenerator = PinButtonGenerator;
|
76 |
-
})(jpibfi || (jpibfi = {}));
|
77 |
-
var jpibfi;
|
78 |
-
(function (jpibfi) {
|
79 |
-
var Logger = (function () {
|
80 |
-
function Logger(printLog) {
|
81 |
-
this._printLog = printLog && typeof console !== 'undefined' && typeof console.log !== 'undefined';
|
82 |
-
this._jsonStringifyExists = typeof JSON !== 'undefined' && typeof JSON.stringify === 'function';
|
83 |
-
}
|
84 |
-
Logger.prototype._logObject = function (obj) {
|
85 |
-
var out = '';
|
86 |
-
for (var p in obj)
|
87 |
-
out += p + ': ' + obj[p] + '\n';
|
88 |
-
console.log('jpibfi debug: ' + out);
|
89 |
-
};
|
90 |
-
Logger.prototype.logString = function (message) {
|
91 |
-
if (!this._printLog)
|
92 |
-
return;
|
93 |
-
console.log('jpibfi debug: ' + message);
|
94 |
-
};
|
95 |
-
Logger.prototype.logObject = function (obj) {
|
96 |
-
if (!this._printLog)
|
97 |
-
return;
|
98 |
-
if (this._jsonStringifyExists)
|
99 |
-
console.log('jpibfi debugz: ' + JSON.stringify(obj, null, 4));
|
100 |
-
else
|
101 |
-
this._logObject(obj);
|
102 |
-
};
|
103 |
-
return Logger;
|
104 |
-
})();
|
105 |
-
jpibfi.Logger = Logger;
|
106 |
-
})(jpibfi || (jpibfi = {}));
|
107 |
-
var jpibfi;
|
108 |
-
(function (jpibfi) {
|
109 |
-
var Settings = (function () {
|
110 |
-
function Settings(settings) {
|
111 |
-
this.filterSelector = '*';
|
112 |
-
this.notSelector = '';
|
113 |
-
this.buttonMarginTop = parseInt(settings.buttonMarginTop);
|
114 |
-
this.buttonMarginRight = parseInt(settings.buttonMarginRight);
|
115 |
-
this.buttonMarginBottom = parseInt(settings.buttonMarginBottom);
|
116 |
-
this.buttonMarginLeft = parseInt(settings.buttonMarginLeft);
|
117 |
-
this.buttonPosition = settings.hasOwnProperty('buttonPosition') ? parseInt(settings.buttonPosition) : 4;
|
118 |
-
this.debug = settings.hasOwnProperty('debug') ? settings.debug == '1' : false;
|
119 |
-
this.descriptionOption = settings.hasOwnProperty('descriptionOption') ? parseInt(settings.descriptionOption) : 1;
|
120 |
-
this.imageSelector = settings.imageSelector;
|
121 |
-
this.minImageWidth = settings.hasOwnProperty('minImageWidth') ? parseInt(settings.minImageWidth) : 0;
|
122 |
-
this.minImageHeight = settings.hasOwnProperty('minImageHeight') ? parseInt(settings.minImageHeight) : 0;
|
123 |
-
this.pageDescription = settings.pageDescription;
|
124 |
-
this.pageTitle = settings.pageTitle;
|
125 |
-
this.pageUrl = settings.pageUrl;
|
126 |
-
this.pinImageHeight = parseInt(settings.pinImageHeight);
|
127 |
-
this.pinImageWidth = parseInt(settings.pinImageWidth);
|
128 |
-
this.retinaFriendly = settings.hasOwnProperty('retinaFriendly') ? settings.retinaFriendly == 1 : false;
|
129 |
-
this.siteTitle = settings.siteTitle;
|
130 |
-
this.usePostUrl = settings.hasOwnProperty('usePostUrl') ? settings.usePostUrl : true;
|
131 |
-
/* SELECTORS*/
|
132 |
-
this.containerSelector = settings.containerSelector;
|
133 |
-
this.notSelector = settings.hasOwnProperty('disabledClasses') ? jpibfi.Utils.createSelectorFromList(settings.disabledClasses) : '';
|
134 |
-
this.filterSelector = settings.hasOwnProperty('enabledClasses') ? jpibfi.Utils.createSelectorFromList(settings.enabledClasses) || "*" : '*';
|
135 |
-
this.adjustPinImageSize();
|
136 |
-
}
|
137 |
-
Settings.prototype.adjustPinImageSize = function () {
|
138 |
-
if (this.retinaFriendly) {
|
139 |
-
this.pinImageHeight = Math.ceil(this.pinImageHeight / 2);
|
140 |
-
this.pinImageWidth = Math.ceil(this.pinImageWidth / 2);
|
141 |
-
}
|
142 |
-
};
|
143 |
-
return Settings;
|
144 |
-
})();
|
145 |
-
jpibfi.Settings = Settings;
|
146 |
-
})(jpibfi || (jpibfi = {}));
|
147 |
-
var jpibfi;
|
148 |
-
(function (jpibfi) {
|
149 |
-
var $ = jQuery;
|
150 |
-
var Utils = (function () {
|
151 |
-
function Utils() {
|
152 |
-
}
|
153 |
-
Utils.createSelectorFromList = function (classes) {
|
154 |
-
var arrayOfClasses = classes.split(';');
|
155 |
-
var selector = "";
|
156 |
-
for (var i = 0; i < arrayOfClasses.length; i++) {
|
157 |
-
if (arrayOfClasses[i])
|
158 |
-
selector += '.' + arrayOfClasses[i] + ',';
|
159 |
-
}
|
160 |
-
return selector ? selector.substr(0, selector.length - 1) : selector;
|
161 |
-
};
|
162 |
-
Utils.startHide = function ($button) {
|
163 |
-
var timeoutId = setTimeout(function () {
|
164 |
-
$button.remove();
|
165 |
-
$('img[data-jpibfi-indexer="' + $button.data('jpibfi-indexer') + '"]').removeClass('pinit-hover');
|
166 |
-
}, 100);
|
167 |
-
$button.data('jpibfi-timeoutId', timeoutId);
|
168 |
-
};
|
169 |
-
return Utils;
|
170 |
-
})();
|
171 |
-
jpibfi.Utils = Utils;
|
172 |
-
})(jpibfi || (jpibfi = {}));
|
173 |
-
var jpibfi;
|
174 |
-
(function (jpibfi) {
|
175 |
-
"use strict";
|
176 |
-
var $ = jQuery;
|
177 |
-
var Plugin = (function () {
|
178 |
-
function Plugin(options) {
|
179 |
-
this._indexer = 0;
|
180 |
-
this._settings = new jpibfi.Settings($.extend({
|
181 |
-
pageUrl: document.URL,
|
182 |
-
pageTitle: document.title,
|
183 |
-
pageDescription: $('meta[name="description"]').attr('content') || "",
|
184 |
-
}, options));
|
185 |
-
this._logger = new jpibfi.Logger(this._settings.debug);
|
186 |
-
this._buttonGenerator = new jpibfi.PinButtonGenerator(this._settings, this._logger);
|
187 |
-
this._logger.logObject(this._settings);
|
188 |
-
}
|
189 |
-
Plugin.prototype.addImages = function () {
|
190 |
-
this._logger.logString('>>addImages');
|
191 |
-
var $elements = $(this._settings.imageSelector)
|
192 |
-
.not(this._settings.notSelector)
|
193 |
-
.not('[data-jpibfi-indexer]')
|
194 |
-
.filter(this._settings.filterSelector);
|
195 |
-
var that = this;
|
196 |
-
$elements.each(function () { $(this).attr('data-jpibfi-indexer', that._indexer++); });
|
197 |
-
this._logger.logString('Images caught by selectors: ' + this._indexer);
|
198 |
-
};
|
199 |
-
;
|
200 |
-
Plugin.prototype.init = function () {
|
201 |
-
var $containers = $('.jpibfi').closest(this._settings.containerSelector).addClass('jpibfi_container');
|
202 |
-
this._logger.logString('Number of containers added: ' + $containers.length);
|
203 |
-
this.initImageDelegates();
|
204 |
-
$(document).trigger('jpibfi_beforeAddImages', {});
|
205 |
-
this.addImages();
|
206 |
-
$(document).trigger('jpibfi_afterAddImages', {});
|
207 |
-
};
|
208 |
-
Plugin.prototype.initImageDelegates = function () {
|
209 |
-
var that = this;
|
210 |
-
$(document).delegate('img[data-jpibfi-indexer]', 'mouseenter', function () {
|
211 |
-
var $image = $(this);
|
212 |
-
if ($image[0].clientWidth < that._settings.minImageWidth || $image[0].clientHeight < that._settings.minImageHeight) {
|
213 |
-
$image.removeAttr('data-jpibfi-indexer');
|
214 |
-
return;
|
215 |
-
}
|
216 |
-
var indexer = $image.data('jpibfi-indexer');
|
217 |
-
var $button = $('a.pinit-button[data-jpibfi-indexer="' + indexer + '"]');
|
218 |
-
//button doesn't exist so we need to create it
|
219 |
-
if ($button.length == 1) {
|
220 |
-
//button exists, we need to clear the timeout that has to remove it
|
221 |
-
clearTimeout($button.data('jpibfi-timeoutId'));
|
222 |
-
}
|
223 |
-
else {
|
224 |
-
$button = that._buttonGenerator.generate(indexer);
|
225 |
-
var position = $image.offset();
|
226 |
-
var imageDimensions = {
|
227 |
-
width: $image.get(0).clientWidth,
|
228 |
-
height: $image.get(0).clientHeight
|
229 |
-
};
|
230 |
-
switch (that._settings.buttonPosition) {
|
231 |
-
case jpibfi.ButtonPosition.TopLeft:
|
232 |
-
position.left += that._settings.buttonMarginLeft;
|
233 |
-
position.top += that._settings.buttonMarginTop;
|
234 |
-
break;
|
235 |
-
case jpibfi.ButtonPosition.TopRight:
|
236 |
-
position.top += that._settings.buttonMarginTop;
|
237 |
-
position.left = position.left + imageDimensions.width - that._settings.buttonMarginRight - that._settings.pinImageWidth;
|
238 |
-
break;
|
239 |
-
case jpibfi.ButtonPosition.BottomLeft:
|
240 |
-
position.left += that._settings.buttonMarginLeft;
|
241 |
-
position.top = position.top + imageDimensions.height - that._settings.buttonMarginBottom - that._settings.pinImageHeight;
|
242 |
-
break;
|
243 |
-
case jpibfi.ButtonPosition.BottomRight:
|
244 |
-
position.left = position.left + imageDimensions.width - that._settings.buttonMarginRight - that._settings.pinImageWidth;
|
245 |
-
position.top = position.top + imageDimensions.height - that._settings.buttonMarginBottom - that._settings.pinImageHeight;
|
246 |
-
break;
|
247 |
-
case jpibfi.ButtonPosition.Middle:
|
248 |
-
position.left = Math.round(position.left + imageDimensions.width / 2 - that._settings.pinImageWidth / 2);
|
249 |
-
position.top = Math.round(position.top + imageDimensions.height / 2 - that._settings.pinImageHeight / 2);
|
250 |
-
break;
|
251 |
-
}
|
252 |
-
$image.after($button);
|
253 |
-
$button
|
254 |
-
.show()
|
255 |
-
.offset({ left: position.left, top: position.top });
|
256 |
-
}
|
257 |
-
$image.addClass('pinit-hover');
|
258 |
-
});
|
259 |
-
$(document).delegate('img[data-jpibfi-indexer]', 'mouseleave', function () {
|
260 |
-
var indexer = $(this).data("jpibfi-indexer");
|
261 |
-
var $button = $('a.pinit-button[data-jpibfi-indexer="' + indexer + '"]');
|
262 |
-
jpibfi.Utils.startHide($button);
|
263 |
-
});
|
264 |
-
};
|
265 |
-
return Plugin;
|
266 |
-
})();
|
267 |
-
(function () {
|
268 |
-
"use strict";
|
269 |
-
$(document).ready(function () {
|
270 |
-
var plugin = new Plugin(jpibfi_options);
|
271 |
-
plugin.init();
|
272 |
-
});
|
273 |
-
})();
|
274 |
-
})(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.getImageUrl=function($elem){return this.$.fn.prop&&$elem.prop("src")||$elem.attr("src")},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(){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 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.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.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.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}return Hover.prototype.addImages=function(){this.logger.logString(">>addImages");var $elements=this.$(this.settings.imageSelector).not(this.settings.notSelector).not("[data-jpibfi-indexer]").not("[data-jpibfi-ignore]").filter(this.settings.filterSelector),that=this;$elements.each(function(){that.$(this).attr("data-jpibfi-indexer",(that._indexer++).toString())}),this.logger.logString("Images caught by selectors: "+this._indexer)},Hover.prototype.init=function(){this.initImageDelegates(),this.$(document).trigger("jpibfi_beforeAddImages",{}),this.addImages(),this.$(document).trigger("jpibfi_afterAddImages",{})},Hover.prototype.initImageDelegates=function(){var that=this;this.$(document).delegate("img[data-jpibfi-indexer]","mouseenter",function(){var $image=that.$(this);if($image[0].clientWidth<that.settings.minImageWidth||$image[0].clientHeight<that.settings.minImageHeight)return void $image.removeAttr("data-jpibfi-indexer").attr("data-jpibfi-ignore",1..toString());var indexer=$image.data("jpibfi-indexer"),$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("img[data-jpibfi-indexer]","mouseleave",function(){var $image=that.$(this),indexer=$image.data("jpibfi-indexer"),$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 hover=(this.$(".jpibfi").closest(this.settings.containerSelector).addClass("jpibfi_container"),new jpibfi.Hover(this.$,this.settings,this.logger,this.buttonGenerator));hover.init()},Plugin.prototype.isTouchDevice=function(){return"ontouchstart"in window||navigator.hasOwnProperty("maxTouchPoints")},Plugin}();!function($){$(document).ready(function(){var plugin=new Plugin($,jpibfi_options);plugin.init()})}(jQuery)}(jpibfi||(jpibfi={}));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/src/client/button-generator.ts
DELETED
@@ -1,85 +0,0 @@
|
|
1 |
-
module jpibfi {
|
2 |
-
var $ = jQuery;
|
3 |
-
|
4 |
-
export class PinButtonGenerator {
|
5 |
-
|
6 |
-
private _indexer: number;
|
7 |
-
private _settings: Settings;
|
8 |
-
private _logger: ILogger;
|
9 |
-
|
10 |
-
constructor(settings: Settings, logger: ILogger) {
|
11 |
-
this._settings = settings;
|
12 |
-
this._logger = logger;
|
13 |
-
}
|
14 |
-
|
15 |
-
private getImageUrl($elem) : string {
|
16 |
-
return ($.fn.prop && $elem.prop('src')) || $elem.attr('src');
|
17 |
-
}
|
18 |
-
|
19 |
-
generate(indexer: number): JQuery {
|
20 |
-
var $anchor = jQuery('<a/>', {
|
21 |
-
href: '#',
|
22 |
-
"class": 'pinit-button',
|
23 |
-
"data-jpibfi-indexer": indexer,
|
24 |
-
text: ""
|
25 |
-
});
|
26 |
-
|
27 |
-
var that = this;
|
28 |
-
$anchor.click(function(){
|
29 |
-
that._logger.logString('Pin In button clicked');
|
30 |
-
|
31 |
-
var index = $(this).data("jpibfi-indexer");
|
32 |
-
var $image = $('img[data-jpibfi-indexer="' + index + '"]');
|
33 |
-
|
34 |
-
//Bookmark description is created on click because sometimes it's lazy loaded
|
35 |
-
var bookmarkDescription = "",
|
36 |
-
descriptionForUrl = "",
|
37 |
-
bookmarkUrl = "";
|
38 |
-
|
39 |
-
//if usePostUrl feature is active, we need to get the data
|
40 |
-
if (that._settings.usePostUrl) {
|
41 |
-
var $inputWithData = $image.closest(".jpibfi_container").find("input.jpibfi").first();
|
42 |
-
|
43 |
-
if ($inputWithData.length) {
|
44 |
-
descriptionForUrl = $inputWithData.data("jpibfi-description");
|
45 |
-
bookmarkUrl = $inputWithData.data("jpibfi-url");
|
46 |
-
}
|
47 |
-
}
|
48 |
-
bookmarkUrl = bookmarkUrl || that._settings.pageUrl;
|
49 |
-
|
50 |
-
if (that._settings.descriptionOption == 3)
|
51 |
-
bookmarkDescription = $image.attr('title') || $image.attr('alt');
|
52 |
-
else if (that._settings.descriptionOption == 2)
|
53 |
-
bookmarkDescription = descriptionForUrl || that._settings.pageDescription;
|
54 |
-
else if (that._settings.descriptionOption == 4)
|
55 |
-
bookmarkDescription = that._settings.siteTitle;
|
56 |
-
else if (that._settings.descriptionOption == 5)
|
57 |
-
bookmarkDescription = $image.data('jpibfi-description');
|
58 |
-
else if (that._settings.descriptionOption == 6)
|
59 |
-
bookmarkDescription = $image.attr('alt');
|
60 |
-
|
61 |
-
bookmarkDescription = bookmarkDescription || (descriptionForUrl || that._settings.pageTitle);
|
62 |
-
|
63 |
-
var imageUrl = 'http://pinterest.com/pin/create/bookmarklet/?is_video=' + encodeURIComponent('false')
|
64 |
-
+ "&url=" + encodeURIComponent(bookmarkUrl) + "&media=" + encodeURIComponent(that.getImageUrl($image))
|
65 |
-
+ '&description=' + encodeURIComponent(bookmarkDescription);
|
66 |
-
|
67 |
-
window.open(imageUrl, 'Pinterest', 'width=632,height=253,status=0,toolbar=0,menubar=0,location=1,scrollbars=1');
|
68 |
-
return false;
|
69 |
-
});
|
70 |
-
|
71 |
-
$anchor.mouseenter(function() {
|
72 |
-
var $button = $(this);
|
73 |
-
clearTimeout($button.data('jpibfi-timeoutId'));
|
74 |
-
});
|
75 |
-
|
76 |
-
$anchor.mouseleave(function() {
|
77 |
-
var $button = $(this);
|
78 |
-
Utils.startHide($button);
|
79 |
-
});
|
80 |
-
|
81 |
-
return $anchor;
|
82 |
-
}
|
83 |
-
|
84 |
-
}
|
85 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/src/client/button-position.ts
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
module jpibfi {
|
2 |
-
export enum ButtonPosition {
|
3 |
-
TopLeft,
|
4 |
-
TopRight,
|
5 |
-
BottomLeft,
|
6 |
-
BottomRight,
|
7 |
-
Middle
|
8 |
-
}
|
9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/src/client/logger.ts
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
module jpibfi {
|
2 |
-
export interface ILogger {
|
3 |
-
logString(msg: string): void;
|
4 |
-
logObject(obj: Object): void;
|
5 |
-
}
|
6 |
-
|
7 |
-
export class Logger implements ILogger {
|
8 |
-
private _printLog: boolean;
|
9 |
-
private _jsonStringifyExists: boolean;
|
10 |
-
|
11 |
-
private _logObject(obj: Object) {
|
12 |
-
var out = '';
|
13 |
-
for (var p in obj)
|
14 |
-
out += p + ': ' + obj[p] + '\n';
|
15 |
-
console.log('jpibfi debug: ' + out);
|
16 |
-
}
|
17 |
-
|
18 |
-
constructor(printLog: boolean) {
|
19 |
-
this._printLog = printLog && typeof console !== 'undefined' && typeof console.log !== 'undefined';
|
20 |
-
this._jsonStringifyExists = typeof JSON !== 'undefined' && typeof JSON.stringify === 'function';
|
21 |
-
}
|
22 |
-
|
23 |
-
logString(message: string) {
|
24 |
-
if (!this._printLog)
|
25 |
-
return;
|
26 |
-
console.log('jpibfi debug: ' + message);
|
27 |
-
}
|
28 |
-
|
29 |
-
logObject(obj: Object) {
|
30 |
-
if (!this._printLog)
|
31 |
-
return;
|
32 |
-
if (this._jsonStringifyExists)
|
33 |
-
console.log('jpibfi debugz: ' + JSON.stringify(obj, null, 4));
|
34 |
-
else
|
35 |
-
this._logObject(obj);
|
36 |
-
}
|
37 |
-
}
|
38 |
-
|
39 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/src/client/main.ts
DELETED
@@ -1,125 +0,0 @@
|
|
1 |
-
module jpibfi {
|
2 |
-
"use strict";
|
3 |
-
|
4 |
-
declare var jpibfi_options: any;
|
5 |
-
var $ = jQuery;
|
6 |
-
|
7 |
-
class Plugin {
|
8 |
-
|
9 |
-
private _buttonGenerator: PinButtonGenerator;
|
10 |
-
private _indexer: number = 0;
|
11 |
-
private _logger: Logger;
|
12 |
-
private _settings: Settings;
|
13 |
-
|
14 |
-
constructor(options: any) {
|
15 |
-
|
16 |
-
this._settings = new Settings($.extend({
|
17 |
-
pageUrl: document.URL,
|
18 |
-
pageTitle: document.title,
|
19 |
-
pageDescription: $('meta[name="description"]').attr('content') || "",
|
20 |
-
}, options));
|
21 |
-
this._logger = new Logger(this._settings.debug);
|
22 |
-
this._buttonGenerator = new PinButtonGenerator(this._settings, this._logger);
|
23 |
-
|
24 |
-
this._logger.logObject(this._settings);
|
25 |
-
}
|
26 |
-
|
27 |
-
addImages() {
|
28 |
-
this._logger.logString('>>addImages');
|
29 |
-
|
30 |
-
var $elements = $(this._settings.imageSelector)
|
31 |
-
.not(this._settings.notSelector)
|
32 |
-
.not('[data-jpibfi-indexer]')
|
33 |
-
.filter(this._settings.filterSelector);
|
34 |
-
var that = this;
|
35 |
-
$elements.each(function() { $(this).attr('data-jpibfi-indexer', that._indexer++); });
|
36 |
-
this._logger.logString('Images caught by selectors: ' + this._indexer);
|
37 |
-
};
|
38 |
-
|
39 |
-
init() {
|
40 |
-
|
41 |
-
var $containers = $('.jpibfi').closest(this._settings.containerSelector).addClass('jpibfi_container');
|
42 |
-
this._logger.logString('Number of containers added: ' + $containers.length);
|
43 |
-
|
44 |
-
this.initImageDelegates();
|
45 |
-
|
46 |
-
$(document).trigger('jpibfi_beforeAddImages', {});
|
47 |
-
this.addImages();
|
48 |
-
$(document).trigger('jpibfi_afterAddImages', {});
|
49 |
-
}
|
50 |
-
|
51 |
-
initImageDelegates() {
|
52 |
-
var that = this;
|
53 |
-
$(document).delegate('img[data-jpibfi-indexer]', 'mouseenter', function() {
|
54 |
-
var $image = $(this);
|
55 |
-
|
56 |
-
if ($image[0].clientWidth < that._settings.minImageWidth || $image[0].clientHeight < that._settings.minImageHeight) {
|
57 |
-
$image.removeAttr('data-jpibfi-indexer');
|
58 |
-
return;
|
59 |
-
}
|
60 |
-
|
61 |
-
var indexer = $image.data('jpibfi-indexer');
|
62 |
-
var $button = $('a.pinit-button[data-jpibfi-indexer="' + indexer + '"]');
|
63 |
-
|
64 |
-
//button doesn't exist so we need to create it
|
65 |
-
if ($button.length == 1){
|
66 |
-
//button exists, we need to clear the timeout that has to remove it
|
67 |
-
clearTimeout($button.data('jpibfi-timeoutId'));
|
68 |
-
} else {
|
69 |
-
|
70 |
-
$button = that._buttonGenerator.generate(indexer);
|
71 |
-
|
72 |
-
var position = $image.offset();
|
73 |
-
var imageDimensions = {
|
74 |
-
width: $image.get(0).clientWidth,
|
75 |
-
height: $image.get(0).clientHeight
|
76 |
-
};
|
77 |
-
|
78 |
-
switch (that._settings.buttonPosition) {
|
79 |
-
case ButtonPosition.TopLeft:
|
80 |
-
position.left += that._settings.buttonMarginLeft;
|
81 |
-
position.top += that._settings.buttonMarginTop;
|
82 |
-
break;
|
83 |
-
case ButtonPosition.TopRight:
|
84 |
-
position.top += that._settings.buttonMarginTop;
|
85 |
-
position.left = position.left + imageDimensions.width - that._settings.buttonMarginRight - that._settings.pinImageWidth;
|
86 |
-
break;
|
87 |
-
case ButtonPosition.BottomLeft:
|
88 |
-
position.left += that._settings.buttonMarginLeft;
|
89 |
-
position.top = position.top + imageDimensions.height - that._settings.buttonMarginBottom - that._settings.pinImageHeight;
|
90 |
-
break;
|
91 |
-
case ButtonPosition.BottomRight:
|
92 |
-
position.left = position.left + imageDimensions.width - that._settings.buttonMarginRight - that._settings.pinImageWidth;
|
93 |
-
position.top = position.top + imageDimensions.height - that._settings.buttonMarginBottom - that._settings.pinImageHeight;
|
94 |
-
break;
|
95 |
-
case ButtonPosition.Middle:
|
96 |
-
position.left = Math.round(position.left + imageDimensions.width / 2 - that._settings.pinImageWidth / 2);
|
97 |
-
position.top = Math.round(position.top + imageDimensions.height / 2 - that._settings.pinImageHeight / 2);
|
98 |
-
break;
|
99 |
-
}
|
100 |
-
|
101 |
-
$image.after($button);
|
102 |
-
$button
|
103 |
-
.show()
|
104 |
-
.offset({ left: position.left, top: position.top });
|
105 |
-
}
|
106 |
-
$image.addClass('pinit-hover');
|
107 |
-
});
|
108 |
-
|
109 |
-
$(document).delegate('img[data-jpibfi-indexer]', 'mouseleave', function() {
|
110 |
-
var indexer = $(this).data("jpibfi-indexer");
|
111 |
-
var $button = $('a.pinit-button[data-jpibfi-indexer="' + indexer + '"]');
|
112 |
-
Utils.startHide($button);
|
113 |
-
});
|
114 |
-
}
|
115 |
-
}
|
116 |
-
|
117 |
-
(function() {
|
118 |
-
"use strict";
|
119 |
-
|
120 |
-
$(document).ready(function() {
|
121 |
-
var plugin = new Plugin(jpibfi_options);
|
122 |
-
plugin.init();
|
123 |
-
});
|
124 |
-
})();
|
125 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/src/client/settings.ts
DELETED
@@ -1,63 +0,0 @@
|
|
1 |
-
module jpibfi {
|
2 |
-
export class Settings {
|
3 |
-
/* MARGINS */
|
4 |
-
buttonMarginTop: number;
|
5 |
-
buttonMarginRight: number;
|
6 |
-
buttonMarginBottom: number;
|
7 |
-
buttonMarginLeft: number;
|
8 |
-
buttonPosition: ButtonPosition;
|
9 |
-
debug: boolean;
|
10 |
-
descriptionOption: number;
|
11 |
-
imageSelector: string;
|
12 |
-
minImageWidth: number;
|
13 |
-
minImageHeight: number;
|
14 |
-
pageDescription: string;
|
15 |
-
pageTitle: string;
|
16 |
-
pageUrl: string;
|
17 |
-
pinImageHeight: number;
|
18 |
-
pinImageWidth: number;
|
19 |
-
retinaFriendly: boolean;
|
20 |
-
siteTitle: string;
|
21 |
-
usePostUrl: boolean;
|
22 |
-
/* SELECTORS */
|
23 |
-
containerSelector: string;
|
24 |
-
filterSelector: string = '*';
|
25 |
-
notSelector: string = '';
|
26 |
-
|
27 |
-
constructor(settings: any) {
|
28 |
-
this.buttonMarginTop = parseInt(settings.buttonMarginTop);
|
29 |
-
this.buttonMarginRight = parseInt(settings.buttonMarginRight);
|
30 |
-
this.buttonMarginBottom = parseInt(settings.buttonMarginBottom);
|
31 |
-
this.buttonMarginLeft = parseInt(settings.buttonMarginLeft);
|
32 |
-
this.buttonPosition = settings.hasOwnProperty('buttonPosition') ? parseInt(settings.buttonPosition) : 4;
|
33 |
-
this.debug = settings.hasOwnProperty('debug') ? settings.debug == '1' : false;
|
34 |
-
this.descriptionOption = settings.hasOwnProperty('descriptionOption') ? parseInt(settings.descriptionOption) : 1;
|
35 |
-
this.imageSelector = settings.imageSelector;
|
36 |
-
this.minImageWidth = settings.hasOwnProperty('minImageWidth') ? parseInt(settings.minImageWidth) : 0;
|
37 |
-
this.minImageHeight = settings.hasOwnProperty('minImageHeight') ? parseInt(settings.minImageHeight) : 0;
|
38 |
-
this.pageDescription = settings.pageDescription;
|
39 |
-
this.pageTitle = settings.pageTitle;
|
40 |
-
this.pageUrl = settings.pageUrl;
|
41 |
-
this.pinImageHeight = parseInt(settings.pinImageHeight);
|
42 |
-
this.pinImageWidth = parseInt(settings.pinImageWidth);
|
43 |
-
this.retinaFriendly = settings.hasOwnProperty('retinaFriendly') ? settings.retinaFriendly == 1 : false;
|
44 |
-
this.siteTitle = settings.siteTitle;
|
45 |
-
this.usePostUrl = settings.hasOwnProperty('usePostUrl') ? settings.usePostUrl : true;
|
46 |
-
|
47 |
-
/* SELECTORS*/
|
48 |
-
this.containerSelector = settings.containerSelector;
|
49 |
-
this.notSelector = settings.hasOwnProperty('disabledClasses') ? Utils.createSelectorFromList(settings.disabledClasses) : '';
|
50 |
-
this.filterSelector = settings.hasOwnProperty('enabledClasses') ? Utils.createSelectorFromList(settings.enabledClasses) || "*" : '*';
|
51 |
-
|
52 |
-
this.adjustPinImageSize();
|
53 |
-
}
|
54 |
-
|
55 |
-
private adjustPinImageSize() {
|
56 |
-
if (this.retinaFriendly) {
|
57 |
-
this.pinImageHeight = Math.ceil(this.pinImageHeight / 2);
|
58 |
-
this.pinImageWidth = Math.ceil(this.pinImageWidth / 2);
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
}
|
63 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/src/client/utils.ts
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
module jpibfi {
|
2 |
-
var $ = jQuery;
|
3 |
-
|
4 |
-
export class Utils {
|
5 |
-
static createSelectorFromList(classes: string): string {
|
6 |
-
|
7 |
-
var arrayOfClasses = classes.split(';');
|
8 |
-
var selector = "";
|
9 |
-
|
10 |
-
for (var i = 0; i < arrayOfClasses.length; i++) {
|
11 |
-
if (arrayOfClasses[i])
|
12 |
-
selector += '.' + arrayOfClasses[i] + ',';
|
13 |
-
}
|
14 |
-
|
15 |
-
return selector ? selector.substr(0, selector.length - 1) : selector;
|
16 |
-
}
|
17 |
-
|
18 |
-
static startHide($button: JQuery) {
|
19 |
-
var timeoutId = setTimeout(function() {
|
20 |
-
$button.remove();
|
21 |
-
$('img[data-jpibfi-indexer="' + $button.data('jpibfi-indexer') + '"]').removeClass('pinit-hover');
|
22 |
-
}, 100);
|
23 |
-
$button.data('jpibfi-timeoutId', timeoutId);
|
24 |
-
}
|
25 |
-
}
|
26 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/upload-button-new.js
CHANGED
@@ -35,4 +35,4 @@ jQuery(document).ready(function($) {
|
|
35 |
file_frame.open();
|
36 |
});
|
37 |
|
38 |
-
});
|
35 |
file_frame.open();
|
36 |
});
|
37 |
|
38 |
+
});
|
languages/jquery-pin-it-button-for-images.pot
CHANGED
@@ -15,315 +15,343 @@ msgstr ""
|
|
15 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
16 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n\n"
|
17 |
|
18 |
-
#: includes\admin\class-jpibfi-admin.php:
|
19 |
msgid "Selection"
|
20 |
msgstr ""
|
21 |
|
22 |
-
#: includes\admin\class-jpibfi-admin.php:
|
23 |
msgid "Visual"
|
24 |
msgstr ""
|
25 |
|
26 |
-
#: includes\admin\class-jpibfi-admin.php:
|
27 |
msgid "Advanced"
|
28 |
msgstr ""
|
29 |
|
30 |
-
#: includes\admin\class-jpibfi-admin.php:
|
31 |
msgid "Settings"
|
32 |
msgstr ""
|
33 |
|
34 |
-
#: includes\admin\class-jpibfi-admin.php:
|
35 |
msgid "Disable \"Pin it\" button for this post (works only on single pages/posts)"
|
36 |
msgstr ""
|
37 |
|
38 |
-
#: includes\admin\class-jpibfi-
|
|
|
|
|
|
|
|
|
39 |
msgid "Advanced Settings"
|
40 |
msgstr ""
|
41 |
|
42 |
-
#: includes\admin\class-jpibfi-advanced-options.php:
|
43 |
msgid "Debug"
|
44 |
msgstr ""
|
45 |
|
46 |
-
#: includes\admin\class-jpibfi-advanced-options.php:
|
47 |
msgid "Use debug mode only if you are experiencing some issues with the plugin and you are reporting them to the developer of the plugin"
|
48 |
msgstr ""
|
49 |
|
50 |
-
#: includes\admin\class-jpibfi-advanced-options.php:
|
51 |
msgid "Container selector"
|
52 |
msgstr ""
|
53 |
|
54 |
-
#: includes\admin\class-jpibfi-advanced-options.php:
|
55 |
msgid "This is the selector used to find the container that holds the entire single post. It looks for an element that is a parent of the content of the post. Usually it's a div or article element. This setting is important to making \"Use post url\" visual setting work properly."
|
56 |
msgstr ""
|
57 |
|
58 |
-
#: includes\admin\class-jpibfi-advanced-options.php:
|
59 |
msgid "Advanced settings"
|
60 |
msgstr ""
|
61 |
|
62 |
-
#: includes\admin\class-jpibfi-advanced-options.php:
|
63 |
msgid "Enable debug mode"
|
64 |
msgstr ""
|
65 |
|
66 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
67 |
msgid "Image selector"
|
68 |
msgstr ""
|
69 |
|
70 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
71 |
msgid "jQuery selector for all the images that should have the \"Pin it\" button. Set the value to %s if you want the \"Pin it\" button to appear only on images in content or %s to appear on all images on site (including sidebar, header and footer). If you know a thing or two about jQuery, you might use your own selector. %sClick here%s to read about jQuery selectors."
|
72 |
msgstr ""
|
73 |
|
74 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
75 |
msgid "Disabled classes"
|
76 |
msgstr ""
|
77 |
|
78 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
79 |
msgid "Pictures with these CSS classes won't show the \"Pin it\" button. Please separate multiple classes with semicolons. Spaces are not accepted."
|
80 |
msgstr ""
|
81 |
|
82 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
83 |
msgid "Enabled classes"
|
84 |
msgstr ""
|
85 |
|
86 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
87 |
msgid "Only pictures with these CSS classes will show the \"Pin it\" button. Please separate multiple classes with semicolons. If this field is empty, images with any (besides disabled ones) classes will show the Pin It button."
|
88 |
msgstr ""
|
89 |
|
90 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
91 |
msgid "On which pages the \"Pin it\" button should be shown"
|
92 |
msgstr ""
|
93 |
|
94 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
95 |
msgid "Check on which pages you want the Pinterest button to show up."
|
96 |
msgstr ""
|
97 |
|
98 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
99 |
msgid "Minimum resolution that should trigger the \"Pin it\" button to show up"
|
100 |
msgstr ""
|
101 |
|
102 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
103 |
msgid "If you'd like the \"Pin it\" button to not show up on small images (e.g. social media icons), just set the appropriate values above. The default values cause the \"Pin it\" button to show on every eligible image."
|
104 |
msgstr ""
|
105 |
|
106 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
107 |
msgid "Which images can be pinned"
|
108 |
msgstr ""
|
109 |
|
110 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
111 |
msgid "No classes added."
|
112 |
msgstr ""
|
113 |
|
114 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
115 |
msgid "Class name"
|
116 |
msgstr ""
|
117 |
|
118 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
119 |
msgid "Add"
|
120 |
msgstr ""
|
121 |
|
122 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
123 |
msgid "Home page"
|
124 |
msgstr ""
|
125 |
|
126 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
127 |
msgid "Pages"
|
128 |
msgstr ""
|
129 |
|
130 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
131 |
msgid "Single posts"
|
132 |
msgstr ""
|
133 |
|
134 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
135 |
msgid "Category and archive pages"
|
136 |
msgstr ""
|
137 |
|
138 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
139 |
msgid "Blog pages"
|
140 |
msgstr ""
|
141 |
|
142 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
143 |
msgid "Height"
|
144 |
msgstr ""
|
145 |
|
146 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
147 |
msgid "Width"
|
148 |
msgstr ""
|
149 |
|
150 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
151 |
msgid "the given value doesn't meet the requirements. Please correct it and try again."
|
152 |
msgstr ""
|
153 |
|
154 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
155 |
msgid "Minimum image height"
|
156 |
msgstr ""
|
157 |
|
158 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
159 |
msgid "Minimum image width"
|
160 |
msgstr ""
|
161 |
|
162 |
-
#: includes\admin\class-jpibfi-selection-options.php:
|
163 |
msgid "value must be a number greater or equal to %d."
|
164 |
msgstr ""
|
165 |
|
166 |
#: includes\admin\class-jpibfi-visual-options.php:155
|
167 |
-
msgid "
|
168 |
msgstr ""
|
169 |
|
170 |
#: includes\admin\class-jpibfi-visual-options.php:165
|
171 |
-
msgid "
|
172 |
msgstr ""
|
173 |
|
174 |
#: includes\admin\class-jpibfi-visual-options.php:177
|
175 |
-
msgid "
|
176 |
msgstr ""
|
177 |
|
178 |
#: includes\admin\class-jpibfi-visual-options.php:187
|
179 |
-
msgid "
|
180 |
msgstr ""
|
181 |
|
182 |
#: includes\admin\class-jpibfi-visual-options.php:199
|
183 |
-
msgid "
|
184 |
msgstr ""
|
185 |
|
186 |
#: includes\admin\class-jpibfi-visual-options.php:209
|
187 |
-
msgid "
|
188 |
msgstr ""
|
189 |
|
190 |
#: includes\admin\class-jpibfi-visual-options.php:221
|
191 |
-
msgid "
|
192 |
msgstr ""
|
193 |
|
194 |
#: includes\admin\class-jpibfi-visual-options.php:231
|
195 |
-
msgid "
|
196 |
msgstr ""
|
197 |
|
198 |
#: includes\admin\class-jpibfi-visual-options.php:243
|
199 |
-
msgid "\"Pin
|
200 |
msgstr ""
|
201 |
|
202 |
#: includes\admin\class-jpibfi-visual-options.php:253
|
203 |
-
msgid "
|
204 |
msgstr ""
|
205 |
|
206 |
#: includes\admin\class-jpibfi-visual-options.php:265
|
207 |
-
msgid "\"Pin it\" button
|
208 |
msgstr ""
|
209 |
|
210 |
#: includes\admin\class-jpibfi-visual-options.php:275
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
msgid "Margins are used to adjust the position of the \"Pin it\" button, but not all margins are used on all button positions. Here is an example. If you're using the \"%s\" position, the button's position will be affected only by top and left margins. Bottom and right margins affect \"%s\" position, etc. The \"%s\" position does not use any margins at all."
|
212 |
msgstr ""
|
213 |
|
214 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
215 |
msgid "Top left"
|
216 |
msgstr ""
|
217 |
|
218 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
219 |
msgid "Bottom right"
|
220 |
msgstr ""
|
221 |
|
222 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
223 |
msgid "Middle"
|
224 |
msgstr ""
|
225 |
|
226 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
227 |
msgid "Retina friendly"
|
228 |
msgstr ""
|
229 |
|
230 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
231 |
msgid "Please note that checking this option will result in rendering the \"Pin it\" button half of its normal size (if you use a 80x60 image, the button will be 40x30). When uploading a custom \"Pin it\" button (the default one is too small), please make sure both width and height are even numbers (i.e. divisible by two) when using this option."
|
232 |
msgstr ""
|
233 |
|
234 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
235 |
msgid "How it should look like"
|
236 |
msgstr ""
|
237 |
|
238 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
msgid "Page title"
|
240 |
msgstr ""
|
241 |
|
242 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
243 |
msgid "Page description"
|
244 |
msgstr ""
|
245 |
|
246 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
247 |
msgid "Picture title or (if title not available) alt attribute"
|
248 |
msgstr ""
|
249 |
|
250 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
251 |
msgid "Site title (Settings->General)"
|
252 |
msgstr ""
|
253 |
|
254 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
255 |
msgid "Image description"
|
256 |
msgstr ""
|
257 |
|
258 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
259 |
msgid "Image alt attribute"
|
260 |
msgstr ""
|
261 |
|
262 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
263 |
msgid "Always link to individual post page"
|
264 |
msgstr ""
|
265 |
|
266 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
267 |
msgid "Choose transparency (between %.02f and %.02f)"
|
268 |
msgstr ""
|
269 |
|
270 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
271 |
msgid "Use custom image"
|
272 |
msgstr ""
|
273 |
|
274 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
275 |
msgid "Upload an image using media library"
|
276 |
msgstr ""
|
277 |
|
278 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
279 |
msgid "URL address of the image"
|
280 |
msgstr ""
|
281 |
|
282 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
283 |
msgid "Custom Pin It button preview"
|
284 |
msgstr ""
|
285 |
|
286 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
287 |
msgid "Refresh preview"
|
288 |
msgstr ""
|
289 |
|
290 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
291 |
msgid "Top right"
|
292 |
msgstr ""
|
293 |
|
294 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
295 |
msgid "Bottom left"
|
296 |
msgstr ""
|
297 |
|
298 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
299 |
msgid "Top"
|
300 |
msgstr ""
|
301 |
|
302 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
303 |
msgid "Bottom"
|
304 |
msgstr ""
|
305 |
|
306 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
307 |
msgid "Left"
|
308 |
msgstr ""
|
309 |
|
310 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
311 |
msgid "Right"
|
312 |
msgstr ""
|
313 |
|
314 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
315 |
msgid "Optimize for high pixel density displays"
|
316 |
msgstr ""
|
317 |
|
318 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
319 |
msgid "Transparency value must be a number between %.02d and %.02f."
|
320 |
msgstr ""
|
321 |
|
322 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
323 |
msgid "Custom image height"
|
324 |
msgstr ""
|
325 |
|
326 |
-
#: includes\admin\class-jpibfi-visual-options.php:
|
327 |
msgid "Custom image width"
|
328 |
msgstr ""
|
329 |
|
@@ -338,3 +366,7 @@ msgstr ""
|
|
338 |
#: includes\admin\views\admin.php:49
|
339 |
msgid "Support forum"
|
340 |
msgstr ""
|
|
|
|
|
|
|
|
15 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
16 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n\n"
|
17 |
|
18 |
+
#: includes\admin\class-jpibfi-admin.php:133, includes\admin\class-jpibfi-selection-options.php:121
|
19 |
msgid "Selection"
|
20 |
msgstr ""
|
21 |
|
22 |
+
#: includes\admin\class-jpibfi-admin.php:143, includes\admin\class-jpibfi-visual-options.php:141
|
23 |
msgid "Visual"
|
24 |
msgstr ""
|
25 |
|
26 |
+
#: includes\admin\class-jpibfi-admin.php:153
|
27 |
msgid "Advanced"
|
28 |
msgstr ""
|
29 |
|
30 |
+
#: includes\admin\class-jpibfi-admin.php:193, jquery-pin-it-button-for-images.php:131
|
31 |
msgid "Settings"
|
32 |
msgstr ""
|
33 |
|
34 |
+
#: includes\admin\class-jpibfi-admin.php:229
|
35 |
msgid "Disable \"Pin it\" button for this post (works only on single pages/posts)"
|
36 |
msgstr ""
|
37 |
|
38 |
+
#: includes\admin\class-jpibfi-admin.php:283
|
39 |
+
msgid "jQuery Pin It Button for Images Pro is coming soon. Click <a target=\"_blank\" href=\"%s\">here</a> to learn more."
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: includes\admin\class-jpibfi-advanced-options.php:81
|
43 |
msgid "Advanced Settings"
|
44 |
msgstr ""
|
45 |
|
46 |
+
#: includes\admin\class-jpibfi-advanced-options.php:97
|
47 |
msgid "Debug"
|
48 |
msgstr ""
|
49 |
|
50 |
+
#: includes\admin\class-jpibfi-advanced-options.php:107
|
51 |
msgid "Use debug mode only if you are experiencing some issues with the plugin and you are reporting them to the developer of the plugin"
|
52 |
msgstr ""
|
53 |
|
54 |
+
#: includes\admin\class-jpibfi-advanced-options.php:119
|
55 |
msgid "Container selector"
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: includes\admin\class-jpibfi-advanced-options.php:129
|
59 |
msgid "This is the selector used to find the container that holds the entire single post. It looks for an element that is a parent of the content of the post. Usually it's a div or article element. This setting is important to making \"Use post url\" visual setting work properly."
|
60 |
msgstr ""
|
61 |
|
62 |
+
#: includes\admin\class-jpibfi-advanced-options.php:151
|
63 |
msgid "Advanced settings"
|
64 |
msgstr ""
|
65 |
|
66 |
+
#: includes\admin\class-jpibfi-advanced-options.php:167
|
67 |
msgid "Enable debug mode"
|
68 |
msgstr ""
|
69 |
|
70 |
+
#: includes\admin\class-jpibfi-selection-options.php:137
|
71 |
msgid "Image selector"
|
72 |
msgstr ""
|
73 |
|
74 |
+
#: includes\admin\class-jpibfi-selection-options.php:147
|
75 |
msgid "jQuery selector for all the images that should have the \"Pin it\" button. Set the value to %s if you want the \"Pin it\" button to appear only on images in content or %s to appear on all images on site (including sidebar, header and footer). If you know a thing or two about jQuery, you might use your own selector. %sClick here%s to read about jQuery selectors."
|
76 |
msgstr ""
|
77 |
|
78 |
+
#: includes\admin\class-jpibfi-selection-options.php:169, includes\admin\class-jpibfi-selection-options.php:513
|
79 |
msgid "Disabled classes"
|
80 |
msgstr ""
|
81 |
|
82 |
+
#: includes\admin\class-jpibfi-selection-options.php:179
|
83 |
msgid "Pictures with these CSS classes won't show the \"Pin it\" button. Please separate multiple classes with semicolons. Spaces are not accepted."
|
84 |
msgstr ""
|
85 |
|
86 |
+
#: includes\admin\class-jpibfi-selection-options.php:191, includes\admin\class-jpibfi-selection-options.php:517
|
87 |
msgid "Enabled classes"
|
88 |
msgstr ""
|
89 |
|
90 |
+
#: includes\admin\class-jpibfi-selection-options.php:201
|
91 |
msgid "Only pictures with these CSS classes will show the \"Pin it\" button. Please separate multiple classes with semicolons. If this field is empty, images with any (besides disabled ones) classes will show the Pin It button."
|
92 |
msgstr ""
|
93 |
|
94 |
+
#: includes\admin\class-jpibfi-selection-options.php:213
|
95 |
msgid "On which pages the \"Pin it\" button should be shown"
|
96 |
msgstr ""
|
97 |
|
98 |
+
#: includes\admin\class-jpibfi-selection-options.php:223
|
99 |
msgid "Check on which pages you want the Pinterest button to show up."
|
100 |
msgstr ""
|
101 |
|
102 |
+
#: includes\admin\class-jpibfi-selection-options.php:235
|
103 |
msgid "Minimum resolution that should trigger the \"Pin it\" button to show up"
|
104 |
msgstr ""
|
105 |
|
106 |
+
#: includes\admin\class-jpibfi-selection-options.php:245
|
107 |
msgid "If you'd like the \"Pin it\" button to not show up on small images (e.g. social media icons), just set the appropriate values above. The default values cause the \"Pin it\" button to show on every eligible image."
|
108 |
msgstr ""
|
109 |
|
110 |
+
#: includes\admin\class-jpibfi-selection-options.php:269
|
111 |
msgid "Which images can be pinned"
|
112 |
msgstr ""
|
113 |
|
114 |
+
#: includes\admin\class-jpibfi-selection-options.php:309, includes\admin\class-jpibfi-selection-options.php:357
|
115 |
msgid "No classes added."
|
116 |
msgstr ""
|
117 |
|
118 |
+
#: includes\admin\class-jpibfi-selection-options.php:317, includes\admin\class-jpibfi-selection-options.php:365
|
119 |
msgid "Class name"
|
120 |
msgstr ""
|
121 |
|
122 |
+
#: includes\admin\class-jpibfi-selection-options.php:323, includes\admin\class-jpibfi-selection-options.php:371
|
123 |
msgid "Add"
|
124 |
msgstr ""
|
125 |
|
126 |
+
#: includes\admin\class-jpibfi-selection-options.php:411
|
127 |
msgid "Home page"
|
128 |
msgstr ""
|
129 |
|
130 |
+
#: includes\admin\class-jpibfi-selection-options.php:415
|
131 |
msgid "Pages"
|
132 |
msgstr ""
|
133 |
|
134 |
+
#: includes\admin\class-jpibfi-selection-options.php:419
|
135 |
msgid "Single posts"
|
136 |
msgstr ""
|
137 |
|
138 |
+
#: includes\admin\class-jpibfi-selection-options.php:423
|
139 |
msgid "Category and archive pages"
|
140 |
msgstr ""
|
141 |
|
142 |
+
#: includes\admin\class-jpibfi-selection-options.php:427
|
143 |
msgid "Blog pages"
|
144 |
msgstr ""
|
145 |
|
146 |
+
#: includes\admin\class-jpibfi-selection-options.php:455, includes\admin\class-jpibfi-visual-options.php:521
|
147 |
msgid "Height"
|
148 |
msgstr ""
|
149 |
|
150 |
+
#: includes\admin\class-jpibfi-selection-options.php:469, includes\admin\class-jpibfi-visual-options.php:535
|
151 |
msgid "Width"
|
152 |
msgstr ""
|
153 |
|
154 |
+
#: includes\admin\class-jpibfi-selection-options.php:527
|
155 |
msgid "the given value doesn't meet the requirements. Please correct it and try again."
|
156 |
msgstr ""
|
157 |
|
158 |
+
#: includes\admin\class-jpibfi-selection-options.php:547
|
159 |
msgid "Minimum image height"
|
160 |
msgstr ""
|
161 |
|
162 |
+
#: includes\admin\class-jpibfi-selection-options.php:551
|
163 |
msgid "Minimum image width"
|
164 |
msgstr ""
|
165 |
|
166 |
+
#: includes\admin\class-jpibfi-selection-options.php:561, includes\admin\class-jpibfi-visual-options.php:733
|
167 |
msgid "value must be a number greater or equal to %d."
|
168 |
msgstr ""
|
169 |
|
170 |
#: includes\admin\class-jpibfi-visual-options.php:155
|
171 |
+
msgid "Show button"
|
172 |
msgstr ""
|
173 |
|
174 |
#: includes\admin\class-jpibfi-visual-options.php:165
|
175 |
+
msgid "When the \"Pin it\" button should be visible."
|
176 |
msgstr ""
|
177 |
|
178 |
#: includes\admin\class-jpibfi-visual-options.php:177
|
179 |
+
msgid "Description source"
|
180 |
msgstr ""
|
181 |
|
182 |
#: includes\admin\class-jpibfi-visual-options.php:187
|
183 |
+
msgid "From where the Pinterest message should be taken. Please note that \"Image description\" works properly only for images that were added to your Media Library."
|
184 |
msgstr ""
|
185 |
|
186 |
#: includes\admin\class-jpibfi-visual-options.php:199
|
187 |
+
msgid "Linked page"
|
188 |
msgstr ""
|
189 |
|
190 |
#: includes\admin\class-jpibfi-visual-options.php:209
|
191 |
+
msgid "When checked, the link on Pinterest will always point to the individual page with the image and title of this individual page will be used if you've selected Title as the description source, even when the image was pinned on an archive page, category page or homepage. If false, the link will point to the URL the user is currently on."
|
192 |
msgstr ""
|
193 |
|
194 |
#: includes\admin\class-jpibfi-visual-options.php:221
|
195 |
+
msgid "Transparency value"
|
196 |
msgstr ""
|
197 |
|
198 |
#: includes\admin\class-jpibfi-visual-options.php:231
|
199 |
+
msgid "This setting sets the transparency of the image."
|
200 |
msgstr ""
|
201 |
|
202 |
#: includes\admin\class-jpibfi-visual-options.php:243
|
203 |
+
msgid "Custom \"Pin It\" button"
|
204 |
msgstr ""
|
205 |
|
206 |
#: includes\admin\class-jpibfi-visual-options.php:253
|
207 |
+
msgid "Check the <b>Use custom image</b> checkbox, specify image's URL, height and width to use your own Pinterest button design. You can just upload an image using Wordpress media library if you wish."
|
208 |
msgstr ""
|
209 |
|
210 |
#: includes\admin\class-jpibfi-visual-options.php:265
|
211 |
+
msgid "\"Pin it\" button position"
|
212 |
msgstr ""
|
213 |
|
214 |
#: includes\admin\class-jpibfi-visual-options.php:275
|
215 |
+
msgid "Where the \"Pin it\" button should appear on the image."
|
216 |
+
msgstr ""
|
217 |
+
|
218 |
+
#: includes\admin\class-jpibfi-visual-options.php:287
|
219 |
+
msgid "\"Pin it\" button margins"
|
220 |
+
msgstr ""
|
221 |
+
|
222 |
+
#: includes\admin\class-jpibfi-visual-options.php:297
|
223 |
msgid "Margins are used to adjust the position of the \"Pin it\" button, but not all margins are used on all button positions. Here is an example. If you're using the \"%s\" position, the button's position will be affected only by top and left margins. Bottom and right margins affect \"%s\" position, etc. The \"%s\" position does not use any margins at all."
|
224 |
msgstr ""
|
225 |
|
226 |
+
#: includes\admin\class-jpibfi-visual-options.php:299, includes\admin\class-jpibfi-visual-options.php:581
|
227 |
msgid "Top left"
|
228 |
msgstr ""
|
229 |
|
230 |
+
#: includes\admin\class-jpibfi-visual-options.php:301, includes\admin\class-jpibfi-visual-options.php:587
|
231 |
msgid "Bottom right"
|
232 |
msgstr ""
|
233 |
|
234 |
+
#: includes\admin\class-jpibfi-visual-options.php:303, includes\admin\class-jpibfi-visual-options.php:589
|
235 |
msgid "Middle"
|
236 |
msgstr ""
|
237 |
|
238 |
+
#: includes\admin\class-jpibfi-visual-options.php:317
|
239 |
msgid "Retina friendly"
|
240 |
msgstr ""
|
241 |
|
242 |
+
#: includes\admin\class-jpibfi-visual-options.php:327
|
243 |
msgid "Please note that checking this option will result in rendering the \"Pin it\" button half of its normal size (if you use a 80x60 image, the button will be 40x30). When uploading a custom \"Pin it\" button (the default one is too small), please make sure both width and height are even numbers (i.e. divisible by two) when using this option."
|
244 |
msgstr ""
|
245 |
|
246 |
+
#: includes\admin\class-jpibfi-visual-options.php:351
|
247 |
msgid "How it should look like"
|
248 |
msgstr ""
|
249 |
|
250 |
+
#: includes\admin\class-jpibfi-visual-options.php:367
|
251 |
+
msgid "On hover"
|
252 |
+
msgstr ""
|
253 |
+
|
254 |
+
#: includes\admin\class-jpibfi-visual-options.php:369
|
255 |
+
msgid "Always on touch devices"
|
256 |
+
msgstr ""
|
257 |
+
|
258 |
+
#: includes\admin\class-jpibfi-visual-options.php:371
|
259 |
+
msgid "Always"
|
260 |
+
msgstr ""
|
261 |
+
|
262 |
+
#: includes\admin\class-jpibfi-visual-options.php:381
|
263 |
+
msgid "This feature is disabled in this version of the plugin. Consider buying <a target=\"_blank\" href=\"%s\">the PRO version</a>."
|
264 |
+
msgstr ""
|
265 |
+
|
266 |
+
#: includes\admin\class-jpibfi-visual-options.php:407
|
267 |
msgid "Page title"
|
268 |
msgstr ""
|
269 |
|
270 |
+
#: includes\admin\class-jpibfi-visual-options.php:409
|
271 |
msgid "Page description"
|
272 |
msgstr ""
|
273 |
|
274 |
+
#: includes\admin\class-jpibfi-visual-options.php:411
|
275 |
msgid "Picture title or (if title not available) alt attribute"
|
276 |
msgstr ""
|
277 |
|
278 |
+
#: includes\admin\class-jpibfi-visual-options.php:413
|
279 |
msgid "Site title (Settings->General)"
|
280 |
msgstr ""
|
281 |
|
282 |
+
#: includes\admin\class-jpibfi-visual-options.php:415
|
283 |
msgid "Image description"
|
284 |
msgstr ""
|
285 |
|
286 |
+
#: includes\admin\class-jpibfi-visual-options.php:417
|
287 |
msgid "Image alt attribute"
|
288 |
msgstr ""
|
289 |
|
290 |
+
#: includes\admin\class-jpibfi-visual-options.php:443
|
291 |
msgid "Always link to individual post page"
|
292 |
msgstr ""
|
293 |
|
294 |
+
#: includes\admin\class-jpibfi-visual-options.php:463
|
295 |
msgid "Choose transparency (between %.02f and %.02f)"
|
296 |
msgstr ""
|
297 |
|
298 |
+
#: includes\admin\class-jpibfi-visual-options.php:499
|
299 |
msgid "Use custom image"
|
300 |
msgstr ""
|
301 |
|
302 |
+
#: includes\admin\class-jpibfi-visual-options.php:505
|
303 |
msgid "Upload an image using media library"
|
304 |
msgstr ""
|
305 |
|
306 |
+
#: includes\admin\class-jpibfi-visual-options.php:511
|
307 |
msgid "URL address of the image"
|
308 |
msgstr ""
|
309 |
|
310 |
+
#: includes\admin\class-jpibfi-visual-options.php:549
|
311 |
msgid "Custom Pin It button preview"
|
312 |
msgstr ""
|
313 |
|
314 |
+
#: includes\admin\class-jpibfi-visual-options.php:557
|
315 |
msgid "Refresh preview"
|
316 |
msgstr ""
|
317 |
|
318 |
+
#: includes\admin\class-jpibfi-visual-options.php:583
|
319 |
msgid "Top right"
|
320 |
msgstr ""
|
321 |
|
322 |
+
#: includes\admin\class-jpibfi-visual-options.php:585
|
323 |
msgid "Bottom left"
|
324 |
msgstr ""
|
325 |
|
326 |
+
#: includes\admin\class-jpibfi-visual-options.php:629
|
327 |
msgid "Top"
|
328 |
msgstr ""
|
329 |
|
330 |
+
#: includes\admin\class-jpibfi-visual-options.php:633
|
331 |
msgid "Bottom"
|
332 |
msgstr ""
|
333 |
|
334 |
+
#: includes\admin\class-jpibfi-visual-options.php:637
|
335 |
msgid "Left"
|
336 |
msgstr ""
|
337 |
|
338 |
+
#: includes\admin\class-jpibfi-visual-options.php:641
|
339 |
msgid "Right"
|
340 |
msgstr ""
|
341 |
|
342 |
+
#: includes\admin\class-jpibfi-visual-options.php:667
|
343 |
msgid "Optimize for high pixel density displays"
|
344 |
msgstr ""
|
345 |
|
346 |
+
#: includes\admin\class-jpibfi-visual-options.php:701
|
347 |
msgid "Transparency value must be a number between %.02d and %.02f."
|
348 |
msgstr ""
|
349 |
|
350 |
+
#: includes\admin\class-jpibfi-visual-options.php:717
|
351 |
msgid "Custom image height"
|
352 |
msgstr ""
|
353 |
|
354 |
+
#: includes\admin\class-jpibfi-visual-options.php:721
|
355 |
msgid "Custom image width"
|
356 |
msgstr ""
|
357 |
|
366 |
#: includes\admin\views\admin.php:49
|
367 |
msgid "Support forum"
|
368 |
msgstr ""
|
369 |
+
|
370 |
+
#: includes\admin\views\notice.php:3
|
371 |
+
msgid "<strong>jQuery Pin It Button for Images Pro</strong> is coming soon."
|
372 |
+
msgstr ""
|
package.json
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "jquery-pin-it-button-for-images",
|
3 |
-
"version": "1.40",
|
4 |
-
"description": "=== jQuery Pin It Button For Images ===",
|
5 |
-
"main": "index.js",
|
6 |
-
"scripts": {
|
7 |
-
"test": "echo \"Error: no test specified\" && exit 1"
|
8 |
-
},
|
9 |
-
"author": "",
|
10 |
-
"license": "GPLv2 or later",
|
11 |
-
"devDependencies": {
|
12 |
-
"del": "^2.2.0",
|
13 |
-
"gulp": "^3.9.0",
|
14 |
-
"gulp-minify": "0.0.5",
|
15 |
-
"gulp-sort": "^1.1.1",
|
16 |
-
"gulp-typescript": "^2.10.0",
|
17 |
-
"gulp-util": "^3.0.7",
|
18 |
-
"gulp-watch": "^4.3.5",
|
19 |
-
"gulp-wp-pot": "^1.1.1"
|
20 |
-
}
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
@@ -75,6 +75,10 @@ Please report them in the plugin's support forum on Wordpress.org.
|
|
75 |
|
76 |
== Changelog ==
|
77 |
|
|
|
|
|
|
|
|
|
78 |
= 1.41 =
|
79 |
* Release 2016-02-12
|
80 |
* Syntax error for older versions of PHP fixed
|
@@ -230,6 +234,9 @@ Please report them in the plugin's support forum on Wordpress.org.
|
|
230 |
|
231 |
== Upgrade Notice ==
|
232 |
|
|
|
|
|
|
|
233 |
= 1.41 =
|
234 |
Syntax error for older versions of PHP fixed.
|
235 |
|
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.42
|
7 |
License: GPLv2 or later
|
8 |
|
9 |
Highlights images on hover and adds a Pinterest "Pin It" button over them for easy pinning.
|
75 |
|
76 |
== Changelog ==
|
77 |
|
78 |
+
= 1.42 =
|
79 |
+
* Release 2016-03-08
|
80 |
+
* Lots of backend enhancements
|
81 |
+
|
82 |
= 1.41 =
|
83 |
* Release 2016-02-12
|
84 |
* Syntax error for older versions of PHP fixed
|
234 |
|
235 |
== Upgrade Notice ==
|
236 |
|
237 |
+
= 1.42 =
|
238 |
+
Minor code improvements.
|
239 |
+
|
240 |
= 1.41 =
|
241 |
Syntax error for older versions of PHP fixed.
|
242 |
|
tsconfig.json
DELETED
@@ -1,18 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"compilerOptions": {
|
3 |
-
"sourceMap": true,
|
4 |
-
"target": "es5",
|
5 |
-
"outFile": "js/jpibfi.js"
|
6 |
-
},
|
7 |
-
"files": [
|
8 |
-
"js/src/client/button-position.ts",
|
9 |
-
"js/src/client/button-generator.ts",
|
10 |
-
"js/src/client/logger.ts",
|
11 |
-
"js/src/client/settings.ts",
|
12 |
-
"js/src/client/utils.ts",
|
13 |
-
"js/src/client/main.ts",
|
14 |
-
|
15 |
-
"typings/jquery/jquery.d.ts",
|
16 |
-
"typings/tsd.d.ts"
|
17 |
-
]
|
18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tsd.json
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"version": "v4",
|
3 |
-
"repo": "borisyankov/DefinitelyTyped",
|
4 |
-
"ref": "master",
|
5 |
-
"path": "typings",
|
6 |
-
"bundle": "typings/tsd.d.ts",
|
7 |
-
"installed": {
|
8 |
-
"jquery/jquery.d.ts": {
|
9 |
-
"commit": "717a5fdb079f8dd7c19f1b22f7f656dd990f0ccf"
|
10 |
-
}
|
11 |
-
}
|
12 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|