Version Description
- Added new google+ version
- Added fractional time support for cookies
- Removed session start that was causing issues with varnish cache
- Fixed problem with shortcode popup
- Fixed takeover popup bug
- Fixed bug with referral not working fine on certian urls
- Fixed undefined errors php warnings
- Fixed incompatibility with underscores library
Download this release
Release Info
Developer | timersys |
Plugin | Popups – WordPress Popup |
Version | 1.7.1 |
Comparing to | |
See all releases |
Code changes from version 1.7.0.1 to 1.7.1
- README.txt +16 -4
- admin/assets/js/min/admin-min.js +0 -1
- admin/class-social-popup-admin.php +13 -3
- admin/includes/class-spu-notices.php +28 -1
- admin/includes/tinymce-editor.php +7 -19
- admin/views/metaboxes/metabox-help.php +2 -1
- admin/views/metaboxes/metabox-options.php +6 -6
- popups.php +5 -2
- public/assets/js/min/public-min.js +1 -1
- public/assets/js/public.js +34 -34
- public/class-social-popup.php +7 -3
- public/includes/class-spu-rules.php +3 -16
README.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: timersys
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=K4T6L69EV9G2Q
|
4 |
Tags: popup,twitter,google+, facebook,Popups, twitter follow, facebook like, google plus,social boost, social splash, postmatic, mailpoet, facebook popup, scroll popups, popups, wordpress popup, wp popups, cf7, gf, gravity forms, contact form 7, ifs, infusion soft, subscribe, login popup, ajax login popups
|
5 |
Requires at least: 3.6
|
6 |
-
Tested up to: 4.7.
|
7 |
-
Stable tag: 1.7.
|
8 |
Text Domain: popups
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -126,6 +126,9 @@ Enhance your site by letting your users send Social Invitations ([https://timers
|
|
126 |
|
127 |
== Frequently Asked Questions ==
|
128 |
|
|
|
|
|
|
|
129 |
= How can I include a custom link inside of the popup ? =
|
130 |
By default any link you enter will be used as a conversion link. By that we mean that if the link is clicked the popup will be closed as the user already performed the desired action.
|
131 |
To avoid that you can add the class attribute .spu-not-close to the link
|
@@ -152,8 +155,6 @@ You can modify everything with css. If your popup id is 120 you can add some css
|
|
152 |
= Can I give other roles permissions to edit popups ? =
|
153 |
You need to add [this code](https://gist.github.com/timersys/03067ac7594fdce288ca) to your functions.php
|
154 |
|
155 |
-
= How to open a popup by pressing a link or button ? =
|
156 |
-
Check the following gist (https://gist.github.com/timersys/d68690a85aed14a02318)
|
157 |
|
158 |
= How to close the popup is a user clicks on a regular link ? =
|
159 |
To use custom conversions check [this code](https://gist.github.com/timersys/7facec9c80935a0df1c6) . You need to add it in your theme javascript files
|
@@ -195,6 +196,17 @@ If you have cache be sure to enable AJAX mode in the plugin settings page
|
|
195 |
|
196 |
== Changelog ==
|
197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
= 1.7.0.1 =
|
199 |
* Left some debug code on previous release that can cause issues
|
200 |
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=K4T6L69EV9G2Q
|
4 |
Tags: popup,twitter,google+, facebook,Popups, twitter follow, facebook like, google plus,social boost, social splash, postmatic, mailpoet, facebook popup, scroll popups, popups, wordpress popup, wp popups, cf7, gf, gravity forms, contact form 7, ifs, infusion soft, subscribe, login popup, ajax login popups
|
5 |
Requires at least: 3.6
|
6 |
+
Tested up to: 4.7.3
|
7 |
+
Stable tag: 1.7.1
|
8 |
Text Domain: popups
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
126 |
|
127 |
== Frequently Asked Questions ==
|
128 |
|
129 |
+
= How to open a popup by pressing a link or button ? =
|
130 |
+
Check the following gist (https://gist.github.com/timersys/d68690a85aed14a02318)
|
131 |
+
|
132 |
= How can I include a custom link inside of the popup ? =
|
133 |
By default any link you enter will be used as a conversion link. By that we mean that if the link is clicked the popup will be closed as the user already performed the desired action.
|
134 |
To avoid that you can add the class attribute .spu-not-close to the link
|
155 |
= Can I give other roles permissions to edit popups ? =
|
156 |
You need to add [this code](https://gist.github.com/timersys/03067ac7594fdce288ca) to your functions.php
|
157 |
|
|
|
|
|
158 |
|
159 |
= How to close the popup is a user clicks on a regular link ? =
|
160 |
To use custom conversions check [this code](https://gist.github.com/timersys/7facec9c80935a0df1c6) . You need to add it in your theme javascript files
|
196 |
|
197 |
== Changelog ==
|
198 |
|
199 |
+
= 1.7.1 =
|
200 |
+
* Added new google+ version
|
201 |
+
* Added fractional time support for cookies
|
202 |
+
* Removed session start that was causing issues with varnish cache
|
203 |
+
* Fixed problem with shortcode popup
|
204 |
+
* Fixed takeover popup bug
|
205 |
+
* Fixed bug with referral not working fine on certian urls
|
206 |
+
* Fixed undefined errors php warnings
|
207 |
+
* Fixed incompatibility with underscores library
|
208 |
+
|
209 |
+
|
210 |
= 1.7.0.1 =
|
211 |
* Left some debug code on previous release that can cause issues
|
212 |
|
admin/assets/js/min/admin-min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
var spu={rules:null};SPU_ADMIN=function($){function e(e){"percentage"==e||"visible"==e?$("tr.auto_hide").fadeIn("fast"):$("tr.auto_hide").fadeOut("fast"),"manual"==e||"trigger-click"==e||"visible"==e||"exit-intent"==e?$(".spu-trigger-number").fadeOut("fast"):$(".spu-trigger-number").fadeIn("fast")}function t(e,t){return e.val()?parseInt(e.val()):void 0!==t?t+"px":0}function r(e,t){return e.val().length>0?e.wpColorPicker("color"):void 0!==t?t:""}function n(){var e=$("#content_ifr").contents().find("html");e.trigger("spu_tinymce_init"),e.css({background:"#9C9B9B;"}),"undefined"!=typeof spup_js&&""!=$("#spu_optin").val()||(e.find(".spu-fields-container").remove(),e.find("#tinymce").css({padding:"25px","background-color":r($("#spu-background-color")),"border-color":r($("#spu-border-color")),"border-width":t($("#spu-border-width")),"border-style":"solid",width:$("#spu-width").val(),color:r($("#spu-color")),height:"auto","min-width":"200px","max-width":"100%",margin:"8px auto 0;"}))}return $(document).ready(function(){spu.rules.init();var t=$("#spu-appearance input.spu-color-field"),r=$("#spu_optin");!t.length||r.length&&""!=r.val()||t.wpColorPicker({change:n,clear:n}),$("#spu-appearance :input").not(".spu-color-field").change(n),e($("#spu_trigger").val()),$("#spu_trigger").change(function(){e($(this).val())})}),spu.rules={$el:null,init:function(){var e=this;e.$el=$("#spu-rules"),e.$el.on("click",".rules-add-rule",function(){return e.add_rule($(this).closest("tr")),!1}),e.$el.on("click",".rules-remove-rule",function(){return e.remove_rule($(this).closest("tr")),!1}),e.$el.on("click",".rules-add-group",function(){return e.add_group(),!1}),e.$el.on("change",".param select",function(){var e=$(this).closest("tr"),t=e.attr("data-id"),r=e.closest(".rules-group"),n=r.attr("data-id"),s=e.find("td.value"),a={action:"spu/field_group/render_rules",nonce:spu_js.nonce,rule_id:t,group_id:n,value:"",param:$(this).val()},i=$('<div class="spu-loading"><img src="'+spu_js.admin_url+'/images/wpspin_light.gif"/> </div>');s.html(i),$.ajax({url:ajaxurl,data:a,type:"post",dataType:"html",success:function(e){s.html(e)}});var o=e.find("td.operator"),a={action:"spu/field_group/render_operator",nonce:spu_js.nonce,rule_id:t,group_id:n,value:"",param:$(this).val()};o.html(i),$.ajax({url:ajaxurl,data:a,type:"post",dataType:"html",success:function(e){o.html(e)}})})},add_rule:function(e){var t=e.clone(),r=t.attr("data-id"),n="rule_"+(parseInt(r.replace("rule_",""),10)+1);return t.find("[name]").each(function(){$(this).attr("name",$(this).attr("name").replace(r,n)),$(this).attr("id",$(this).attr("id").replace(r,n))}),t.attr("data-id",n),e.after(t),!1},remove_rule:function(e){var t=e.siblings("tr").length;0==t?this.remove_group(e.closest(".rules-group")):e.remove()},add_group:function(){var e=this.$el.find(".rules-group:last"),t=e.clone(),r=t.attr("data-id"),n="group_"+(parseInt(r.replace("group_",""),10)+1);t.find("[name]").each(function(){$(this).attr("name",$(this).attr("name").replace(r,n)),$(this).attr("id",$(this).attr("id").replace(r,n))}),t.attr("data-id",n),t.find("h4").html(spu_js.l10n.or).addClass("rules-or"),t.find("tr:not(:first)").remove(),e.after(t)},remove_group:function(e){e.remove()}},{onTinyMceInit:function(){n()}}}(jQuery),function(e,$){var t,r=function(){$("#spu-custom-css").val(t.getSession().getValue())},n=function(){$("#custom_css").length&&(t=ace.edit("custom_css"),e.safecss_editor=t,t.getSession().setUseWrapMode(!0),t.setShowPrintMargin(!1),t.getSession().setValue($("#spu-custom-css").val()),t.getSession().setMode("ace/mode/css"),jQuery.fn.spin&&$("#custom_css_container").spin(!1),$("#post").submit(r))};return $.browser.msie&&parseInt($.browser.version,10)<=7?($("#custom_css_container").hide(),$("#spu-custom-css").show(),!1):($(e).load(n),void(e.aceSyncCSS=r))}(this,jQuery);
|
|
admin/class-social-popup-admin.php
CHANGED
@@ -113,6 +113,7 @@ class SocialPopup_Admin {
|
|
113 |
//AJAX Actions
|
114 |
add_action('wp_ajax_spu/field_group/render_rules', array( $this->helper, 'ajax_render_rules' ) );
|
115 |
add_action('wp_ajax_spu/field_group/render_operator', array( $this->helper, 'ajax_render_operator' ) );
|
|
|
116 |
|
117 |
//Tinymce
|
118 |
add_filter( 'tiny_mce_before_init', array($this, 'tinymce_init') );
|
@@ -228,7 +229,7 @@ class SocialPopup_Admin {
|
|
228 |
|
229 |
$defaults = apply_filters( 'spu/settings_page/defaults_opts', array(
|
230 |
'aff_link' => '',
|
231 |
-
'ajax_mode' => '
|
232 |
'debug' => '',
|
233 |
'safe' => '',
|
234 |
'shortcodes_style' => '',
|
@@ -744,8 +745,9 @@ class SocialPopup_Admin {
|
|
744 |
}
|
745 |
// Add html for shortcodes popup
|
746 |
if( 'post.php' == $pagenow || 'post-new.php' == $pagenow ) {
|
747 |
-
|
748 |
-
|
|
|
749 |
|
750 |
}
|
751 |
}
|
@@ -945,4 +947,12 @@ class SocialPopup_Admin {
|
|
945 |
|
946 |
}
|
947 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
948 |
}
|
113 |
//AJAX Actions
|
114 |
add_action('wp_ajax_spu/field_group/render_rules', array( $this->helper, 'ajax_render_rules' ) );
|
115 |
add_action('wp_ajax_spu/field_group/render_operator', array( $this->helper, 'ajax_render_operator' ) );
|
116 |
+
add_action('wp_ajax_spu_enable_ajax_notice_handler', array( $this, 'ajax_notice_handler' ) );
|
117 |
|
118 |
//Tinymce
|
119 |
add_filter( 'tiny_mce_before_init', array($this, 'tinymce_init') );
|
229 |
|
230 |
$defaults = apply_filters( 'spu/settings_page/defaults_opts', array(
|
231 |
'aff_link' => '',
|
232 |
+
'ajax_mode' => '0',
|
233 |
'debug' => '',
|
234 |
'safe' => '',
|
235 |
'shortcodes_style' => '',
|
745 |
}
|
746 |
// Add html for shortcodes popup
|
747 |
if( 'post.php' == $pagenow || 'post-new.php' == $pagenow ) {
|
748 |
+
wp_enqueue_script( 'jquery-ui-dialog' );
|
749 |
+
wp_enqueue_style( 'wp-jquery-ui-dialog' );
|
750 |
+
add_action( 'in_admin_footer', array($this, 'add_editor' ),100 );
|
751 |
|
752 |
}
|
753 |
}
|
947 |
|
948 |
}
|
949 |
|
950 |
+
/**
|
951 |
+
* Save into db the dimissed notice
|
952 |
+
* @return [type] [description]
|
953 |
+
*/
|
954 |
+
function ajax_notice_handler() {
|
955 |
+
update_option( 'spu_enabled_cache', TRUE );
|
956 |
+
die();
|
957 |
+
}
|
958 |
}
|
admin/includes/class-spu-notices.php
CHANGED
@@ -34,4 +34,31 @@ class SocialPopup_Notices {
|
|
34 |
</ul>
|
35 |
</div><?php
|
36 |
}
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
</ul>
|
35 |
</div><?php
|
36 |
}
|
37 |
+
|
38 |
+
public function enabled_cache() {
|
39 |
+
?><div class="notice-warning notice is-dismissible spu_enable_ajax">
|
40 |
+
<h3><i class=" dashicons-before dashicons-share-alt"></i>WordPress Popups Plugin</h3>
|
41 |
+
<p>
|
42 |
+
<?php _e('It looks like you are using a Cache plugin. Remember to enable ajax mode to bypass page cache');?>
|
43 |
+
</p>
|
44 |
+
<p>
|
45 |
+
<?php echo sprintf(__('Enable it on the <a href="%s">Settings page</a>'), admin_url('edit.php?post_type=spucpt&page=spu_settings'));?>
|
46 |
+
</p>
|
47 |
+
</div>
|
48 |
+
<script type="text/javascript">
|
49 |
+
jQuery(function($){
|
50 |
+
$( document ).on( 'click', '.spu_enable_ajax .notice-dismiss', function () {
|
51 |
+
|
52 |
+
$.ajax( ajaxurl,
|
53 |
+
{
|
54 |
+
type: 'POST',
|
55 |
+
data: {
|
56 |
+
action: 'spu_enable_ajax_notice_handler'
|
57 |
+
}
|
58 |
+
} );
|
59 |
+
} );
|
60 |
+
});
|
61 |
+
</script>
|
62 |
+
<?php
|
63 |
+
}
|
64 |
+
}
|
admin/includes/tinymce-editor.php
CHANGED
@@ -15,33 +15,21 @@
|
|
15 |
<th><label for="spu_what"><?php _e( 'Choose:', 'spu' ); ?></label></th>
|
16 |
<td>
|
17 |
<select name="spu-post" id="spu-posts">
|
18 |
-
<option value="">
|
19 |
-
<?php _e('Choose one','spu');?>
|
20 |
-
</option>
|
21 |
<?php
|
22 |
-
// WP_Query arguments
|
23 |
-
$args = array(
|
24 |
-
'post_type' => array( 'spucpt' ),
|
25 |
-
'post_status' => array( 'publish' ),
|
26 |
-
'posts_per_page' => '-1',
|
27 |
-
);
|
28 |
|
29 |
-
|
30 |
-
$
|
31 |
|
32 |
// The Loop
|
33 |
-
if ( $
|
34 |
-
|
35 |
-
|
36 |
-
echo '<option value="'.get_the_id().'">'.get_the_title().'</option>"';
|
37 |
}
|
38 |
-
} else {
|
39 |
-
// no posts found
|
40 |
}
|
41 |
|
42 |
-
// Restore original Post Data
|
43 |
-
wp_reset_postdata();
|
44 |
?>
|
|
|
45 |
</td>
|
46 |
</tr>
|
47 |
|
15 |
<th><label for="spu_what"><?php _e( 'Choose:', 'spu' ); ?></label></th>
|
16 |
<td>
|
17 |
<select name="spu-post" id="spu-posts">
|
18 |
+
<option value=""><?php _e('Choose one','spu');?></option>
|
|
|
|
|
19 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
global $wpdb;
|
22 |
+
$popups = $wpdb->get_results( "SELECT post_title, ID FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'spucpt'");
|
23 |
|
24 |
// The Loop
|
25 |
+
if ( $popups ) {
|
26 |
+
foreach( $popups as $po ) {
|
27 |
+
echo '<option value="'.$po->ID.'">'.$po->post_title.'</option>"';
|
|
|
28 |
}
|
|
|
|
|
29 |
}
|
30 |
|
|
|
|
|
31 |
?>
|
32 |
+
</select>
|
33 |
</td>
|
34 |
</tr>
|
35 |
|
admin/views/metaboxes/metabox-help.php
CHANGED
@@ -38,6 +38,7 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
38 |
<a href="go-opts" onclick="jQuery('#go-opts').slideToggle();return false;"><?php _e( 'View Google+ Options', 'popups' );?></a>
|
39 |
<ul id="go-opts" style="display:none;">
|
40 |
<li><b>url:</b> <?php _e( 'Your Google+ url', 'popups' );?></li>
|
|
|
41 |
<li><b>size:</b> <?php _e( 'small, standard, tall <b>Default value:</b> medium', 'popups' );?></li>
|
42 |
<li><b>annotation:</b> <?php _e( 'inline, none <b>Default value:</b> bubble', 'popups' );?></li>
|
43 |
</ul>
|
@@ -62,4 +63,4 @@ if ( !defined( 'ABSPATH' ) ) exit;
|
|
62 |
<li><b>class:</b> <?php _e( 'Pass a custom class to style your button', 'popups' );?></li>
|
63 |
<li><b>text:</b> <?php _e( 'Button label - <b>Default value:</b> Close', 'popups' );?></li>
|
64 |
<li><b>align:</b> <?php _e( 'left, right, center, none - <b>Default value:</b> center', 'popups' );?></li>
|
65 |
-
</ul>
|
38 |
<a href="go-opts" onclick="jQuery('#go-opts').slideToggle();return false;"><?php _e( 'View Google+ Options', 'popups' );?></a>
|
39 |
<ul id="go-opts" style="display:none;">
|
40 |
<li><b>url:</b> <?php _e( 'Your Google+ url', 'popups' );?></li>
|
41 |
+
<li><b>type:</b> g-plusone, g-follow <?php _e( '<b>Default value:</b>', 'popups' );?>g-plusone</li>
|
42 |
<li><b>size:</b> <?php _e( 'small, standard, tall <b>Default value:</b> medium', 'popups' );?></li>
|
43 |
<li><b>annotation:</b> <?php _e( 'inline, none <b>Default value:</b> bubble', 'popups' );?></li>
|
44 |
</ul>
|
63 |
<li><b>class:</b> <?php _e( 'Pass a custom class to style your button', 'popups' );?></li>
|
64 |
<li><b>text:</b> <?php _e( 'Button label - <b>Default value:</b> Close', 'popups' );?></li>
|
65 |
<li><b>align:</b> <?php _e( 'left, right, center, none - <b>Default value:</b> center', 'popups' );?></li>
|
66 |
+
</ul>
|
admin/views/metaboxes/metabox-options.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
if ( !defined( 'ABSPATH' ) ) exit;?>
|
4 |
|
5 |
<table class="form-table">
|
6 |
-
|
7 |
<?php do_action( 'spu/metaboxes/before_display_options', $opts );?>
|
8 |
<tr valign="top">
|
9 |
<th><label for="spu_position"><?php _e( 'Box Position', 'popups' ); ?></label></th>
|
@@ -23,7 +23,7 @@ if ( !defined( 'ABSPATH' ) ) exit;?>
|
|
23 |
<th><label for="spu_trigger"><?php _e( 'Trigger action', 'popups' ); ?></label></th>
|
24 |
<td class="spu-sm">
|
25 |
<select id="spu_trigger" name="spu[trigger]" class="widefat">
|
26 |
-
|
27 |
<option value="seconds" <?php selected($opts['trigger'], 'seconds'); ?>><?php _e( 'seconds after page load', 'popups' ); ?></option>
|
28 |
<option value="percentage" <?php selected($opts['trigger'], 'percentage'); ?>>% <?php _e( 'of page height', 'popups' ); ?></option>
|
29 |
<option value="manual" <?php selected($opts['trigger'], 'manual'); ?>><?php _e( 'Manual Triggering', 'popups' ); ?></option>
|
@@ -54,7 +54,7 @@ if ( !defined( 'ABSPATH' ) ) exit;?>
|
|
54 |
<p class="help"><?php _e( 'Slide will only apply when popup is on the corners', 'popups' ); ?></p>
|
55 |
</td>
|
56 |
</tr>
|
57 |
-
|
58 |
<tr valign="top">
|
59 |
<td colspan="4" style="padding: 0">
|
60 |
<h4><?php _e( 'Cookies', 'popups');?></h4>
|
@@ -64,14 +64,14 @@ if ( !defined( 'ABSPATH' ) ) exit;?>
|
|
64 |
<tr valign="top">
|
65 |
<th><label for="spu_cookie"><?php _e( 'Conversion cookie', 'popups' ); ?></label></th>
|
66 |
<td colspan="3">
|
67 |
-
<input type="number" id="spu_cookie" name="spu[cookie]" min="0"
|
68 |
<p class="help"><?php _e( 'When a user do a conversion like for example a click or form submission, how many days should it stay hidden?', 'popups' ); ?></p>
|
69 |
</td>
|
70 |
</tr>
|
71 |
<tr valign="top">
|
72 |
<th><label for="spu_cookie"><?php _e( 'Closing cookie', 'popups' ); ?></label></th>
|
73 |
<td colspan="3">
|
74 |
-
<input type="number" id="spu_cookie" name="spu[close-cookie]" min="0"
|
75 |
<p class="help"><?php _e( 'After closing the popup, how many days should it stay hidden?', 'popups' ); ?></p>
|
76 |
</td>
|
77 |
</tr>
|
@@ -101,4 +101,4 @@ if ( !defined( 'ABSPATH' ) ) exit;?>
|
|
101 |
</tr>
|
102 |
<?php do_action( 'spu/metaboxes/after_display_options', $opts );?>
|
103 |
</table>
|
104 |
-
<?php wp_nonce_field( 'spu_options', 'spu_options_nonce' ); ?>
|
3 |
if ( !defined( 'ABSPATH' ) ) exit;?>
|
4 |
|
5 |
<table class="form-table">
|
6 |
+
|
7 |
<?php do_action( 'spu/metaboxes/before_display_options', $opts );?>
|
8 |
<tr valign="top">
|
9 |
<th><label for="spu_position"><?php _e( 'Box Position', 'popups' ); ?></label></th>
|
23 |
<th><label for="spu_trigger"><?php _e( 'Trigger action', 'popups' ); ?></label></th>
|
24 |
<td class="spu-sm">
|
25 |
<select id="spu_trigger" name="spu[trigger]" class="widefat">
|
26 |
+
|
27 |
<option value="seconds" <?php selected($opts['trigger'], 'seconds'); ?>><?php _e( 'seconds after page load', 'popups' ); ?></option>
|
28 |
<option value="percentage" <?php selected($opts['trigger'], 'percentage'); ?>>% <?php _e( 'of page height', 'popups' ); ?></option>
|
29 |
<option value="manual" <?php selected($opts['trigger'], 'manual'); ?>><?php _e( 'Manual Triggering', 'popups' ); ?></option>
|
54 |
<p class="help"><?php _e( 'Slide will only apply when popup is on the corners', 'popups' ); ?></p>
|
55 |
</td>
|
56 |
</tr>
|
57 |
+
|
58 |
<tr valign="top">
|
59 |
<td colspan="4" style="padding: 0">
|
60 |
<h4><?php _e( 'Cookies', 'popups');?></h4>
|
64 |
<tr valign="top">
|
65 |
<th><label for="spu_cookie"><?php _e( 'Conversion cookie', 'popups' ); ?></label></th>
|
66 |
<td colspan="3">
|
67 |
+
<input type="number" id="spu_cookie" name="spu[cookie]" min="0" value="<?php echo esc_attr($opts['cookie']); ?>" />
|
68 |
<p class="help"><?php _e( 'When a user do a conversion like for example a click or form submission, how many days should it stay hidden?', 'popups' ); ?></p>
|
69 |
</td>
|
70 |
</tr>
|
71 |
<tr valign="top">
|
72 |
<th><label for="spu_cookie"><?php _e( 'Closing cookie', 'popups' ); ?></label></th>
|
73 |
<td colspan="3">
|
74 |
+
<input type="number" id="spu_cookie" name="spu[close-cookie]" min="0" value="<?php echo isset( $opts['close-cookie'] ) ? esc_attr($opts['close-cookie']) : esc_attr($opts['cookie']); ?>" />
|
75 |
<p class="help"><?php _e( 'After closing the popup, how many days should it stay hidden?', 'popups' ); ?></p>
|
76 |
</td>
|
77 |
</tr>
|
101 |
</tr>
|
102 |
<?php do_action( 'spu/metaboxes/after_display_options', $opts );?>
|
103 |
</table>
|
104 |
+
<?php wp_nonce_field( 'spu_options', 'spu_options_nonce' ); ?>
|
popups.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
* @socialpopup
|
12 |
* Plugin Name: Popups - WordPress Popup
|
13 |
* Plugin URI: http://www.timersys.com/free-plugins/social-popup/
|
14 |
-
* Version: 1.7.
|
15 |
* Description: Most complete free Popups plugin, scroll triggered popups, compatible with social networks, Gravity Forms, Ninja Forms, Contact form 7, Mailpoet, Mailchimp for WP, Postmatic, etc
|
16 |
* Author: Damian Logghe
|
17 |
* Author URI: https://timersys.com
|
@@ -30,7 +30,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
30 |
* Public-Facing Functionality
|
31 |
*----------------------------------------------------------------------------*/
|
32 |
|
33 |
-
define( 'SPU_VERSION' , '1.7.
|
34 |
define( 'SPU_PLUGIN_DIR' , plugin_dir_path(__FILE__) );
|
35 |
define( 'SPU_PLUGIN_URL' , plugin_dir_url(__FILE__) );
|
36 |
define( 'SPU_PLUGIN_HOOK' , basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ) );
|
@@ -74,4 +74,7 @@ if ( is_admin() ) {
|
|
74 |
if( get_option('spu_plugin_updated') && !get_option('spu_rate_plugin') )
|
75 |
add_action( 'admin_notices', array( $spu_notices, 'rate_plugin') );
|
76 |
|
|
|
|
|
|
|
77 |
}
|
11 |
* @socialpopup
|
12 |
* Plugin Name: Popups - WordPress Popup
|
13 |
* Plugin URI: http://www.timersys.com/free-plugins/social-popup/
|
14 |
+
* Version: 1.7.1
|
15 |
* Description: Most complete free Popups plugin, scroll triggered popups, compatible with social networks, Gravity Forms, Ninja Forms, Contact form 7, Mailpoet, Mailchimp for WP, Postmatic, etc
|
16 |
* Author: Damian Logghe
|
17 |
* Author URI: https://timersys.com
|
30 |
* Public-Facing Functionality
|
31 |
*----------------------------------------------------------------------------*/
|
32 |
|
33 |
+
define( 'SPU_VERSION' , '1.7.1' );
|
34 |
define( 'SPU_PLUGIN_DIR' , plugin_dir_path(__FILE__) );
|
35 |
define( 'SPU_PLUGIN_URL' , plugin_dir_url(__FILE__) );
|
36 |
define( 'SPU_PLUGIN_HOOK' , basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ) );
|
74 |
if( get_option('spu_plugin_updated') && !get_option('spu_rate_plugin') )
|
75 |
add_action( 'admin_notices', array( $spu_notices, 'rate_plugin') );
|
76 |
|
77 |
+
if( defined('WP_CACHE') && !get_option('spu_enabled_cache') )
|
78 |
+
add_action( 'admin_notices', array( $spu_notices, 'enabled_cache') );
|
79 |
+
|
80 |
}
|
public/assets/js/min/public-min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(){function t(){}function e(t,e){for(var n=t.length;n--;)if(t[n].listener===e)return n;return-1}function n(t){return function(){return this[t].apply(this,arguments)}}var i=t.prototype,r=this,o=r.EventEmitter;i.getListeners=function(t){var e,n,i=this._getEvents();if("object"==typeof t){e={};for(n in i)i.hasOwnProperty(n)&&t.test(n)&&(e[n]=i[n])}else e=i[t]||(i[t]=[]);return e},i.flattenListeners=function(t){var e,n=[];for(e=0;t.length>e;e+=1)n.push(t[e].listener);return n},i.getListenersAsObject=function(t){var e,n=this.getListeners(t);return n instanceof Array&&(e={},e[t]=n),e||n},i.addListener=function(t,n){var i,r=this.getListenersAsObject(t),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===e(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(t){return this.getListeners(t),this},i.defineEvents=function(t){for(var e=0;t.length>e;e+=1)this.defineEvent(t[e]);return this},i.removeListener=function(t,n){var i,r,o=this.getListenersAsObject(t);for(r in o)o.hasOwnProperty(r)&&(i=e(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},i.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},i.manipulateListeners=function(t,e,n){var i,r,o=t?this.removeListener:this.addListener,s=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(i=n.length;i--;)o.call(this,e,n[i]);else for(i in e)e.hasOwnProperty(i)&&(r=e[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(t){var e,n=typeof t,i=this._getEvents();if("string"===n)delete i[t];else if("object"===n)for(e in i)i.hasOwnProperty(e)&&t.test(e)&&delete i[e];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(t,e){var n,i,r,o,s=this.getListenersAsObject(t);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(t,n.listener),o=n.listener.apply(this,e||[]),o===this._getOnceReturnValue()&&this.removeListener(t,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},i.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return r.EventEmitter=o,t},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return t}):"object"==typeof module&&module.exports?module.exports=t:this.EventEmitter=t}).call(this),function(t){function e(e){var n=t.event;return n.target=n.target||n.srcElement||e,n}var n=document.documentElement,i=function(){};n.addEventListener?i=function(t,e,n){t.addEventListener(e,n,!1)}:n.attachEvent&&(i=function(t,n,i){t[n+i]=i.handleEvent?function(){var n=e(t);i.handleEvent.call(i,n)}:function(){var n=e(t);i.call(t,n)},t.attachEvent("on"+n,t[n+i])});var r=function(){};n.removeEventListener?r=function(t,e,n){t.removeEventListener(e,n,!1)}:n.detachEvent&&(r=function(t,e,n){t.detachEvent("on"+e,t[e+n]);try{delete t[e+n]}catch(i){t[e+n]=void 0}});var o={bind:i,unbind:r};"function"==typeof define&&define.amd?define("eventie/eventie",o):t.eventie=o}(this),function(t,e){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(n,i){return e(t,n,i)}):"object"==typeof exports?module.exports=e(t,require("wolfy87-eventemitter"),require("eventie")):t.imagesLoaded=e(t,t.EventEmitter,t.eventie)}(window,function(t,e,n){function i(t,e){for(var n in e)t[n]=e[n];return t}function r(t){return"[object Array]"===p.call(t)}function o(t){var e=[];if(r(t))e=t;else if("number"==typeof t.length)for(var n=0,i=t.length;i>n;n++)e.push(t[n]);else e.push(t);return e}function s(t,e,n){if(!(this instanceof s))return new s(t,e);"string"==typeof t&&(t=document.querySelectorAll(t)),this.elements=o(t),this.options=i({},this.options),"function"==typeof e?n=e:i(this.options,e),n&&this.on("always",n),this.getImages(),f&&(this.jqDeferred=new f.Deferred);var r=this;setTimeout(function(){r.check()})}function a(t){this.img=t}function u(t){this.src=t,l[t]=this}var f=t.jQuery,c=t.console,d=void 0!==c,p=Object.prototype.toString;s.prototype=new e,s.prototype.options={},s.prototype.getImages=function(){this.images=[];for(var t=0,e=this.elements.length;e>t;t++){var n=this.elements[t];"IMG"===n.nodeName&&this.addImage(n);var i=n.nodeType;if(i&&(1===i||9===i||11===i))for(var r=n.querySelectorAll("img"),o=0,s=r.length;s>o;o++){var a=r[o];this.addImage(a)}}},s.prototype.addImage=function(t){var e=new a(t);this.images.push(e)},s.prototype.check=function(){function t(t,r){return e.options.debug&&d&&c.log("confirm",t,r),e.progress(t),n++,n===i&&e.complete(),!0}var e=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return void this.complete();for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",t),o.check()}},s.prototype.progress=function(t){this.hasAnyBroken=this.hasAnyBroken||!t.isLoaded;var e=this;setTimeout(function(){e.emit("progress",e,t),e.jqDeferred&&e.jqDeferred.notify&&e.jqDeferred.notify(e,t)})},s.prototype.complete=function(){var t=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var e=this;setTimeout(function(){if(e.emit(t,e),e.emit("always",e),e.jqDeferred){var n=e.hasAnyBroken?"reject":"resolve";e.jqDeferred[n](e)}})},f&&(f.fn.imagesLoaded=function(t,e){var n=new s(this,t,e);return n.jqDeferred.promise(f(this))}),a.prototype=new e,a.prototype.check=function(){var t=l[this.img.src]||new u(this.img.src);if(t.isConfirmed)return void this.confirm(t.isLoaded,"cached was confirmed");if(this.img.complete&&void 0!==this.img.naturalWidth)return void this.confirm(0!==this.img.naturalWidth,"naturalWidth");var e=this;t.on("confirm",function(t,n){return e.confirm(t.isLoaded,n),!0}),t.check()},a.prototype.confirm=function(t,e){this.isLoaded=t,this.emit("confirm",this,e)};var l={};return u.prototype=new e,u.prototype.check=function(){if(!this.isChecked){var t=new Image;n.bind(t,"load",this),n.bind(t,"error",this),t.src=this.src,this.isChecked=!0}},u.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},u.prototype.onload=function(t){this.confirm(!0,"onload"),this.unbindProxyEvents(t)},u.prototype.onerror=function(t){this.confirm(!1,"onerror"),this.unbindProxyEvents(t)},u.prototype.confirm=function(t,e){this.isConfirmed=!0,this.isLoaded=t,this.emit("confirm",this,e)},u.prototype.unbindProxyEvents=function(t){n.unbind(t.target,"load",this),n.unbind(t.target,"error",this)},s}),function($){"use strict";function t(t,e,n,i,r){var o={url:spuvar.ajax_url,data:t,cache:!1,type:"POST",dataType:"json",timeout:3e4},r=r||!1,n=n||!1,i=i||!1;e&&(o.url=e),n&&(o.success=n),i&&(o.error=i),r&&(o.dataType=r),$.ajax(o)}function e(t,e,n){if(n){var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3);var r="; expires="+i.toGMTString()}else var r="";document.cookie=t+"="+e+r+"; path=/"}function n(t){for(var e=t+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var r=n[i];" "==r.charAt(0);)r=r.substring(1,r.length);if(0==r.indexOf(e))return r.substring(e.length,r.length)}return null}function i(){try{FB.Event.subscribe("edge.create",function(t,e){var n=$(e).parents(".spu-box").data("box-id");n&&SPU.hide(n,!1,!0)})}catch(t){}l=!0,clearInterval(h)}function r(t){var e=$(t.target).parents(".spu-box").data("box-id");e&&SPU.hide(e,!1,!0)}function o(t){if("on"==t.state){var e=jQuery(".spu-gogl").data("box-id");e&&SPU.hide(e,!1,!0)}}function s(t){if("confirm"==t.type){var e=jQuery(".spu-gogl").data("box-id");e&&SPU.hide(e,!1,!0)}}function a(){if("undefined"!=typeof spuvar_social&&spuvar_social.facebook)try{FB.XFBML.parse()}catch(t){}if("undefined"!=typeof spuvar_social&&spuvar_social.google)try{gapi.plusone.go()}catch(t){}if("undefined"!=typeof spuvar_social&&spuvar_social.twitter)try{twttr.widgets.load()}catch(t){}}function u(){$(".spu-box form").each(function(){var t=$(this).attr("action");t&&$(this).attr("action",t.replace("?spu_action=spu_load",""))}),$.fn.wpcf7InitForm&&$(".spu-box div.wpcf7 > form").wpcf7InitForm()}var f=function(){function i(t){var e=c[t],n=$(window).width(),i=$(window).height(),r=e.outerHeight(),o=e.outerWidth(),s=e.data("width"),a=0,u=i/2-r/2,f="fixed",d=$(document).scrollTop();e.hasClass("spu-centered")&&(n>s&&(a=n/2-o/2),e.css({left:a,position:f,top:u})),r+50>i&&(f="absolute",u=d,e.css({position:f,top:u,bottom:"auto"}))}function r(t){var e=$(t).find(".spu-facebook");if(e.length){var n=e.find(".fb-like > span").width();if(0==n){var i=e.find(".fb-like").data("layout");"box_count"==i?e.append('<style type="text/css"> #'+$(t).attr("id")+" .fb-like iframe, #"+$(t).attr("id")+" .fb_iframe_widget span, #"+$(t).attr("id")+" .fb_iframe_widget{ height: 63px !important;width: 80px !important;}</style>"):"button_count"==i?e.append('<style type="text/css"> #'+$(t).attr("id")+" .fb-like iframe, #"+$(t).attr("id")+" .fb_iframe_widget span, #"+$(t).attr("id")+" .fb_iframe_widget{ height: 20px !important;min-width: 120px !important;}</style>"):e.append('<style type="text/css"> #'+$(t).attr("id")+" .fb-like iframe, #"+$(t).attr("id")+" .fb_iframe_widget span, #"+$(t).attr("id")+" .fb_iframe_widget{ height: 20px !important;width: 80px !important;}</style>")}}}function o(t){var e=t,n=e.data("total");if(n){a();var i=0,r=0,o=e.outerWidth(),s=e.find(".spu-content").width();!spuvar.disable_style&&$(window).width()>o&&(e.find(".spu-shortcode").wrapAll('<div class="spu_shortcodes"/>'),e.find(".spu-shortcode").each(function(){i+=$(this).outerWidth()}),r=s-i-20*n),r>0&&(e.find(".spu-shortcode").each(function(){$(this).css("margin-left",r/2)}),2==n?e.find(".spu-shortcode").last().css("margin-left",0):3==n&&e.find(".spu-shortcode").first().css("margin-left",0))}}function s(t,n,r){var s=c[t],a=$("#spu-bg-"+t),u=s.data("bgopa");if(s.is(":animated"))return!1;if(n===!0&&s.is(":visible")||n===!1&&s.is(":hidden"))return!1;if(n===!1){var f=parseInt(s.data("close-cookie"));r===!0&&(f=parseInt(s.data("cookie"))),f>0&&e("spu_box_"+t,!0,f),s.trigger("spu.box_close",[t])}else setTimeout(function(){o(s)},1500),s.trigger("spu.box_open",[t]),$(window).resize(function(){i(t)}),i(t);var d=s.data("spuanimation"),p=s.data("close-on-conversion");return"fade"===d?n===!0?s.fadeIn("slow"):n===!1&&(p&&r||!r)&&s.fadeOut("slow"):n===!0?s.slideDown("slow"):n===!1&&(p&&r||!r)&&s.slideUp("slow"),n===!0&&u>0?a.fadeIn():n===!1&&(p&&r||!r)&&a.fadeOut(),n}var u=$(window).height(),f=spuvar.is_admin,c=[];return $(".spu-content").children().first().css({"margin-top":0,"padding-top":0}).end().last().css({"margin-bottom":0,"padding-bottom":0}),$(".spu-box").each(function(){spuvar.safe_mode&&$(this).prependTo("body");var e=$(this),i=e.data("trigger"),o=0,a=1===parseInt(e.data("test-mode")),d=e.data("box-id"),p=1===parseInt(e.data("auto-hide")),l=parseInt(e.data("seconds-close")),h=parseInt(e.data("trigger-number"),10),m="percentage"==i?parseInt(e.data("trigger-number"),10)/100:.8,v=m*$(document).height();r(e),e.on("click",'a:not(".spu-close-popup, .flp_wrapper a, .spu-not-close")',function(){s(d,!1,!0)}),$(document).keyup(function(t){27==t.keyCode&&s(d,!1,!1)});var g=navigator.userAgent,y=g.match(/iPad/i)||g.match(/iPhone/i)?"touchstart":"click";$("body").on(y,function(t){void 0!==t.originalEvent&&s(d,!1,!1)}),$("body").on(y,".spu-box,.spu-clickable",function(t){t.stopPropagation()}),e.hide().css("left",""),c[d]=e;var b=function(){o&&clearTimeout(o),o=window.setTimeout(function(){var t=$(window).scrollTop(),e=t+u>=v;e?(p||$(window).unbind("scroll",b),s(d,!0,!1)):s(d,!1,!1)},100)},w=function(){o&&clearTimeout(o),o=window.setTimeout(function(){s(d,!0,!1)},1e3*h)},_=n("spu_box_"+d);if((void 0==_||""==_||f&&a)&&("seconds"==i&&w(),"percentage"==i&&($(window).bind("scroll",b),b()),window.location.hash&&window.location.hash.length>0)){var x=window.location.hash,E;x.substring(1)===e.attr("id")&&setTimeout(function(){s(d,!0,!1)},100)}e.on("click",".spu-close-popup",function(){s(d,!1,!1),"percentage"==i&&$(window).unbind("scroll",b)}),$(document.body).on("click",'a[href="#spu-'+d+'"], .spu-open-'+d,function(t){t.preventDefault(),s(d,!0,!1)}),$('a[href="#spu-'+d+'"], .spu-open-'+d).css("cursor","pointer").addClass("spu-clickable"),e.find(".gform_wrapper form").addClass("gravity-form"),e.find(".mc4wp-form form").addClass("mc4wp-form"),e.find(".newsletter form").addClass("newsletter-form");var L=e.find("form");if(L.length){if(!L.is(".newsletter-form, .wpcf7-form, .gravity-form, .infusion-form, .widget_wysija, .ninja-forms-form")){var j=L.attr("action"),k=new RegExp(spuvar.site_url,"i");j&&j.length&&(k.test(j)||L.addClass("spu-disable-ajax"))}$(".spu-disable-ajax form").length&&$(".spu-disable-ajax form").addClass("spu-disable-ajax"),e.on("submit",'form.spu-disable-ajax:not(".flp_form")',function(){e.trigger("spu.form_submitted",[d]),s(d,!1,!0)}),e.on("submit",'form:not(".newsletter-form, .wpcf7-form, .gravity-form, .infusion-form, .spu-disable-ajax, .widget_wysija, .ninja-forms-form, .flp_form")',function(n){n.preventDefault();var i=!0,r=$(this),o=r.serialize(),a=r.hasClass("mc4wp-form")?spuvar.site_url+"/":r.attr("action"),u=function(t,e,n){console.log("Spu Form error: "+e+" - "+n)},f=function(t){var e=$(t).filter("#spu-"+d).html();$("#spu-"+d).html(e),$("#spu-"+d).find(".mc4wp-form-error").length||setTimeout(function(){s(d,!1,!0)},1e3*spuvar.seconds_confirmation_close)};return t(o,a,f,u,"html"),e.trigger("spu.form_submitted",[d]),i}),$("body").on("mailsent.wpcf7",function(){e.trigger("spu.form_submitted",[d]),s(d,!1,!0)}),$(document).on("gform_confirmation_loaded",function(){e.trigger("spu.form_submitted",[d]),s(d,!1,!0)}),e.on("submit",".infusion-form",function(t){t.preventDefault(),e.trigger("spu.form_submitted",[d]),s(d,!1,!0),this.submit()}),e.on("submit",".newsletter-form",function(t){t.preventDefault(),e.trigger("spu.form_submitted",[d]),s(d,!1,!0),this.submit()}),$("body").on("submitResponse.default",function(){e.trigger("spu.form_submitted",[d]),s(d,!1,!0)})}}),{show:function(t){return s(t,!0,!1)},hide:function(t,e,n){return s(t,!1,n)},request:function(e,n,i,r){return t(e,n,i,r)}}};if(spuvar.ajax_mode){var c={pid:spuvar.pid,referrer:document.referrer,query_string:document.location.search,is_category:spuvar.is_category,is_archive:spuvar.is_archive},d=function(t){$("body").append(t),$(".spu-box").imagesLoaded(function(){window.SPU=f(),u()})},p=function(t,e,n){console.log("Problem loading popups - error: "+e+" - "+n)};t(c,spuvar.ajax_mode_url,d,p,"html")}else $(".spu-box").imagesLoaded(function(){window.SPU=f()});var l=!1,h=setInterval(function(){"undefined"==typeof FB||l||i()},1e3);if("undefined"!=typeof twttr)try{twttr.ready(function(t){t.events.bind("tweet",r),t.events.bind("follow",r)})}catch(m){}}(jQuery);
|
1 |
+
(function(){function t(){}function e(t,e){for(var n=t.length;n--;)if(t[n].listener===e)return n;return-1}function n(t){return function(){return this[t].apply(this,arguments)}}var i=t.prototype,r=this,o=r.EventEmitter;i.getListeners=function(t){var e,n,i=this._getEvents();if("object"==typeof t){e={};for(n in i)i.hasOwnProperty(n)&&t.test(n)&&(e[n]=i[n])}else e=i[t]||(i[t]=[]);return e},i.flattenListeners=function(t){var e,n=[];for(e=0;t.length>e;e+=1)n.push(t[e].listener);return n},i.getListenersAsObject=function(t){var e,n=this.getListeners(t);return n instanceof Array&&(e={},e[t]=n),e||n},i.addListener=function(t,n){var i,r=this.getListenersAsObject(t),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===e(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(t){return this.getListeners(t),this},i.defineEvents=function(t){for(var e=0;t.length>e;e+=1)this.defineEvent(t[e]);return this},i.removeListener=function(t,n){var i,r,o=this.getListenersAsObject(t);for(r in o)o.hasOwnProperty(r)&&(i=e(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},i.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},i.manipulateListeners=function(t,e,n){var i,r,o=t?this.removeListener:this.addListener,s=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(i=n.length;i--;)o.call(this,e,n[i]);else for(i in e)e.hasOwnProperty(i)&&(r=e[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(t){var e,n=typeof t,i=this._getEvents();if("string"===n)delete i[t];else if("object"===n)for(e in i)i.hasOwnProperty(e)&&t.test(e)&&delete i[e];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(t,e){var n,i,r,o,s=this.getListenersAsObject(t);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(t,n.listener),o=n.listener.apply(this,e||[]),o===this._getOnceReturnValue()&&this.removeListener(t,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},i.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},i._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},i._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return r.EventEmitter=o,t},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return t}):"object"==typeof module&&module.exports?module.exports=t:this.EventEmitter=t}).call(this),function(t){function e(e){var n=t.event;return n.target=n.target||n.srcElement||e,n}var n=document.documentElement,i=function(){};n.addEventListener?i=function(t,e,n){t.addEventListener(e,n,!1)}:n.attachEvent&&(i=function(t,n,i){t[n+i]=i.handleEvent?function(){var n=e(t);i.handleEvent.call(i,n)}:function(){var n=e(t);i.call(t,n)},t.attachEvent("on"+n,t[n+i])});var r=function(){};n.removeEventListener?r=function(t,e,n){t.removeEventListener(e,n,!1)}:n.detachEvent&&(r=function(t,e,n){t.detachEvent("on"+e,t[e+n]);try{delete t[e+n]}catch(i){t[e+n]=void 0}});var o={bind:i,unbind:r};"function"==typeof define&&define.amd?define("eventie/eventie",o):t.eventie=o}(this),function(t,e){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(n,i){return e(t,n,i)}):"object"==typeof exports?module.exports=e(t,require("wolfy87-eventemitter"),require("eventie")):t.imagesLoaded=e(t,t.EventEmitter,t.eventie)}(window,function(t,e,n){function i(t,e){for(var n in e)t[n]=e[n];return t}function r(t){return"[object Array]"===p.call(t)}function o(t){var e=[];if(r(t))e=t;else if("number"==typeof t.length)for(var n=0,i=t.length;i>n;n++)e.push(t[n]);else e.push(t);return e}function s(t,e,n){if(!(this instanceof s))return new s(t,e);"string"==typeof t&&(t=document.querySelectorAll(t)),this.elements=o(t),this.options=i({},this.options),"function"==typeof e?n=e:i(this.options,e),n&&this.on("always",n),this.getImages(),f&&(this.jqDeferred=new f.Deferred);var r=this;setTimeout(function(){r.check()})}function a(t){this.img=t}function u(t){this.src=t,l[t]=this}var f=t.jQuery,c=t.console,d=void 0!==c,p=Object.prototype.toString;s.prototype=new e,s.prototype.options={},s.prototype.getImages=function(){this.images=[];for(var t=0,e=this.elements.length;e>t;t++){var n=this.elements[t];"IMG"===n.nodeName&&this.addImage(n);var i=n.nodeType;if(i&&(1===i||9===i||11===i))for(var r=n.querySelectorAll("img"),o=0,s=r.length;s>o;o++){var a=r[o];this.addImage(a)}}},s.prototype.addImage=function(t){var e=new a(t);this.images.push(e)},s.prototype.check=function(){function t(t,r){return e.options.debug&&d&&c.log("confirm",t,r),e.progress(t),n++,n===i&&e.complete(),!0}var e=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return void this.complete();for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",t),o.check()}},s.prototype.progress=function(t){this.hasAnyBroken=this.hasAnyBroken||!t.isLoaded;var e=this;setTimeout(function(){e.emit("progress",e,t),e.jqDeferred&&e.jqDeferred.notify&&e.jqDeferred.notify(e,t)})},s.prototype.complete=function(){var t=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var e=this;setTimeout(function(){if(e.emit(t,e),e.emit("always",e),e.jqDeferred){var n=e.hasAnyBroken?"reject":"resolve";e.jqDeferred[n](e)}})},f&&(f.fn.imagesLoaded=function(t,e){var n=new s(this,t,e);return n.jqDeferred.promise(f(this))}),a.prototype=new e,a.prototype.check=function(){var t=l[this.img.src]||new u(this.img.src);if(t.isConfirmed)return void this.confirm(t.isLoaded,"cached was confirmed");if(this.img.complete&&void 0!==this.img.naturalWidth)return void this.confirm(0!==this.img.naturalWidth,"naturalWidth");var e=this;t.on("confirm",function(t,n){return e.confirm(t.isLoaded,n),!0}),t.check()},a.prototype.confirm=function(t,e){this.isLoaded=t,this.emit("confirm",this,e)};var l={};return u.prototype=new e,u.prototype.check=function(){if(!this.isChecked){var t=new Image;n.bind(t,"load",this),n.bind(t,"error",this),t.src=this.src,this.isChecked=!0}},u.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},u.prototype.onload=function(t){this.confirm(!0,"onload"),this.unbindProxyEvents(t)},u.prototype.onerror=function(t){this.confirm(!1,"onerror"),this.unbindProxyEvents(t)},u.prototype.confirm=function(t,e){this.isConfirmed=!0,this.isLoaded=t,this.emit("confirm",this,e)},u.prototype.unbindProxyEvents=function(t){n.unbind(t.target,"load",this),n.unbind(t.target,"error",this)},s}),function($){"use strict";function t(t,e,n,i,r){var o={url:spuvar.ajax_url,data:t,cache:!1,type:"POST",dataType:"json",timeout:3e4},r=r||!1,n=n||!1,i=i||!1;e&&(o.url=e),n&&(o.success=n),i&&(o.error=i),r&&(o.dataType=r),$.ajax(o)}function e(t,e,n){if(n){var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3);var r="; expires="+i.toGMTString()}else var r="";document.cookie=t+"="+e+r+"; path=/"}function n(t){for(var e=t+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var r=n[i];" "==r.charAt(0);)r=r.substring(1,r.length);if(0==r.indexOf(e))return r.substring(e.length,r.length)}return null}function i(){try{FB.Event.subscribe("edge.create",function(t,e){var n=$(e).parents(".spu-box").data("box-id");n&&SPU.hide(n,!1,!0)})}catch(t){}l=!0,clearInterval(h)}function r(t){var e=$(t.target).parents(".spu-box").data("box-id");e&&SPU.hide(e,!1,!0)}function o(t){if("on"==t.state){var e=jQuery(".spu-gogl").data("box-id");e&&SPU.hide(e,!1,!0)}}function s(t){if("confirm"==t.type){var e=jQuery(".spu-gogl").data("box-id");e&&SPU.hide(e,!1,!0)}}function a(){if("undefined"!=typeof spuvar_social&&spuvar_social.facebook)try{FB.XFBML.parse()}catch(t){}if("undefined"!=typeof spuvar_social&&spuvar_social.google)try{gapi.plusone.go()}catch(t){}if("undefined"!=typeof spuvar_social&&spuvar_social.twitter)try{twttr.widgets.load()}catch(t){}}function u(){$(".spu-box form").each(function(){var t=$(this).attr("action");t&&$(this).attr("action",t.replace("?spu_action=spu_load",""))}),$.fn.wpcf7InitForm&&$(".spu-box div.wpcf7 > form").wpcf7InitForm()}var f=function(){function i(t){var e=c[t],n=$(window).width(),i=$(window).height(),r=e.outerHeight(),o=e.outerWidth(),s=e.data("width"),a=0,u=i/2-r/2,f="fixed",d=$(document).scrollTop();e.hasClass("spu-centered")&&(s<n&&(a=n/2-o/2),e.css({left:a,position:f,top:u})),r+50>i&&(f="absolute",u=d,e.css({position:f,top:u,bottom:"auto"}))}function r(t){var e=$(t).find(".spu-facebook");if(e.length){var n=e.find(".fb-like > span").width();if(0==n){var i=e.find(".fb-like").data("layout");"box_count"==i?e.append('<style type="text/css"> #'+$(t).attr("id")+" .fb-like iframe, #"+$(t).attr("id")+" .fb_iframe_widget span, #"+$(t).attr("id")+" .fb_iframe_widget{ height: 63px !important;width: 80px !important;}</style>"):"button_count"==i?e.append('<style type="text/css"> #'+$(t).attr("id")+" .fb-like iframe, #"+$(t).attr("id")+" .fb_iframe_widget span, #"+$(t).attr("id")+" .fb_iframe_widget{ height: 20px !important;min-width: 120px !important;}</style>"):e.append('<style type="text/css"> #'+$(t).attr("id")+" .fb-like iframe, #"+$(t).attr("id")+" .fb_iframe_widget span, #"+$(t).attr("id")+" .fb_iframe_widget{ height: 20px !important;width: 80px !important;}</style>")}}}function o(t){var e=t,n=e.data("total");if(n){a();var i=0,r=0,o=e.outerWidth(),s=e.find(".spu-content").width();!spuvar.disable_style&&$(window).width()>o&&(e.find(".spu-shortcode").wrapAll('<div class="spu_shortcodes"/>'),e.find(".spu-shortcode").each(function(){i+=$(this).outerWidth()}),r=s-i-20*n),r>0&&(e.find(".spu-shortcode").each(function(){$(this).css("margin-left",r/2)}),2==n?e.find(".spu-shortcode").last().css("margin-left",0):3==n&&e.find(".spu-shortcode").first().css("margin-left",0))}}function s(t,n,r){var s=c[t],a=$("#spu-bg-"+t),u=s.data("bgopa");if(s.is(":animated"))return!1;if(n===!0&&s.is(":visible")||n===!1&&s.is(":hidden"))return!1;if(n===!1){var f=parseFloat(s.data("close-cookie"));r===!0&&(f=parseFloat(s.data("cookie"))),f>0&&e("spu_box_"+t,!0,f),s.trigger("spu.box_close",[t])}else setTimeout(function(){o(s)},1500),s.trigger("spu.box_open",[t]),$(window).resize(function(){i(t)}),i(t);var d=s.data("spuanimation"),p=s.data("close-on-conversion");return"fade"===d?n===!0?s.fadeIn("slow"):n===!1&&(p&&r||!r)&&s.fadeOut("slow"):n===!0?s.slideDown("slow"):n===!1&&(p&&r||!r)&&s.slideUp("slow"),n===!0&&u>0?a.fadeIn():n===!1&&(p&&r||!r)&&a.fadeOut(),n}var u=$(window).height(),f=spuvar.is_admin,c=[];return $(".spu-content").children().first().css({"margin-top":0,"padding-top":0}).end().last().css({"margin-bottom":0,"padding-bottom":0}),$(".spu-box").each(function(){spuvar.safe_mode&&$(this).prependTo("body");var e=$(this),i=e.data("trigger"),o=0,a=1===parseInt(e.data("test-mode")),d=e.data("box-id"),p=1===parseInt(e.data("auto-hide")),l=parseInt(e.data("seconds-close")),h=parseInt(e.data("trigger-number"),10),m="percentage"==i?parseInt(e.data("trigger-number"),10)/100:.8,v=m*$(document).height();r(e),e.on("click",'a:not(".spu-close-popup, .flp_wrapper a, .spu-not-close")',function(){s(d,!1,!0)}),$(document).keyup(function(t){27==t.keyCode&&s(d,!1,!1)});var g=navigator.userAgent,y=g.match(/iPad/i)||g.match(/iPhone/i)?"touchstart":"click";$("body").on(y,function(t){void 0!==t.originalEvent&&s(d,!1,!1)}),$("body").on(y,".spu-box,.spu-clickable",function(t){t.stopPropagation()}),e.hide().css("left",""),c[d]=e;var b=function(){o&&clearTimeout(o),o=window.setTimeout(function(){var t=$(window).scrollTop(),e=t+u>=v;e?(p||$(window).unbind("scroll",b),s(d,!0,!1)):s(d,!1,!1)},100)},w=function(){o&&clearTimeout(o),o=window.setTimeout(function(){s(d,!0,!1)},1e3*h)},_=n("spu_box_"+d);if((void 0==_||""==_||f&&a)&&("seconds"==i&&w(),"percentage"==i&&($(window).bind("scroll",b),b()),window.location.hash&&window.location.hash.length>0)){var x=window.location.hash,E;x.substring(1)===e.attr("id")&&setTimeout(function(){s(d,!0,!1)},100)}e.on("click",".spu-close-popup",function(){s(d,!1,!1),"percentage"==i&&$(window).unbind("scroll",b)}),$(document.body).on("click",'a[href="#spu-'+d+'"], .spu-open-'+d,function(t){t.preventDefault(),s(d,!0,!1)}),$('a[href="#spu-'+d+'"], .spu-open-'+d).css("cursor","pointer").addClass("spu-clickable"),e.find(".gform_wrapper form").addClass("gravity-form"),e.find(".mc4wp-form form").addClass("mc4wp-form"),e.find(".newsletter form").addClass("newsletter-form");var L=e.find("form");if(L.length){if(!L.is(".newsletter-form, .wpcf7-form, .gravity-form, .infusion-form, .widget_wysija, .ninja-forms-form")){var j=L.attr("action"),k=new RegExp(spuvar.site_url,"i");j&&j.length&&(k.test(j)||L.addClass("spu-disable-ajax"))}$(".spu-disable-ajax form").length&&$(".spu-disable-ajax form").addClass("spu-disable-ajax"),e.on("submit",'form.spu-disable-ajax:not(".flp_form")',function(){e.trigger("spu.form_submitted",[d]),s(d,!1,!0)}),e.on("submit",'form:not(".newsletter-form, .wpcf7-form, .gravity-form, .infusion-form, .spu-disable-ajax, .widget_wysija, .ninja-forms-form, .flp_form")',function(n){n.preventDefault();var i=!0,r=$(this),o=r.serialize(),a=r.hasClass("mc4wp-form")?spuvar.site_url+"/":r.attr("action"),u=function(t,e,n){console.log("Spu Form error: "+e+" - "+n)},f=function(t){var e=$(t).filter("#spu-"+d).html();$("#spu-"+d).html(e),$("#spu-"+d).find(".mc4wp-form-error").length||setTimeout(function(){s(d,!1,!0)},1e3*spuvar.seconds_confirmation_close)};return t(o,a,f,u,"html"),e.trigger("spu.form_submitted",[d]),i}),$("body").on("mailsent.wpcf7",function(){e.trigger("spu.form_submitted",[d]),s(d,!1,!0)}),$(document).on("gform_confirmation_loaded",function(){e.trigger("spu.form_submitted",[d]),s(d,!1,!0)}),e.on("submit",".infusion-form",function(t){t.preventDefault(),e.trigger("spu.form_submitted",[d]),s(d,!1,!0),this.submit()}),e.on("submit",".newsletter-form",function(t){t.preventDefault(),e.trigger("spu.form_submitted",[d]),s(d,!1,!0),this.submit()}),$("body").on("submitResponse.default",function(){e.trigger("spu.form_submitted",[d]),s(d,!1,!0)})}}),{show:function(t){return s(t,!0,!1)},hide:function(t,e,n){return s(t,!1,n)},request:function(e,n,i,r){return t(e,n,i,r)}}};if(spuvar.ajax_mode){var c={pid:spuvar.pid,referrer:document.referrer,query_string:document.location.search,is_category:spuvar.is_category,is_archive:spuvar.is_archive},d=function(t){$("body").append(t),$(".spu-box").imagesLoaded(function(){window.SPU=f(),u()})},p=function(t,e,n){console.log("Problem loading popups - error: "+e+" - "+n)};t(c,spuvar.ajax_mode_url,d,p,"html")}else $(".spu-box").imagesLoaded(function(){window.SPU=f()});var l=!1,h=setInterval(function(){"undefined"==typeof FB||l||i()},1e3);if("undefined"!=typeof twttr)try{twttr.ready(function(t){t.events.bind("tweet",r),t.events.bind("follow",r)})}catch(t){}}(jQuery);
|
public/assets/js/public.js
CHANGED
@@ -30,7 +30,7 @@ var SPU_master = function() {
|
|
30 |
if( spuvar.safe_mode ){
|
31 |
|
32 |
$(this).prependTo('body');
|
33 |
-
|
34 |
}
|
35 |
|
36 |
// vars
|
@@ -40,11 +40,11 @@ var SPU_master = function() {
|
|
40 |
var testMode = (parseInt($box.data('test-mode')) === 1);
|
41 |
var id = $box.data('box-id');
|
42 |
var autoHide = (parseInt($box.data('auto-hide')) === 1);
|
43 |
-
var secondsClose = parseInt($box.data('seconds-close'));
|
44 |
var triggerSeconds = parseInt( $box.data('trigger-number'), 10 );
|
45 |
var triggerPercentage = ( triggerMethod == 'percentage' ) ? ( parseInt( $box.data('trigger-number'), 10 ) / 100 ) : 0.8;
|
46 |
var triggerHeight = ( triggerPercentage * $(document).height() );
|
47 |
-
|
48 |
facebookFix( $box );
|
49 |
|
50 |
// Custom links conversion
|
@@ -61,14 +61,14 @@ var SPU_master = function() {
|
|
61 |
//close on ipads // iphones
|
62 |
var ua = navigator.userAgent,
|
63 |
event = (ua.match(/iPad/i) || ua.match(/iPhone/i)) ? "touchstart" : "click";
|
64 |
-
|
65 |
$('body').on(event, function (ev) {
|
66 |
// test that event is user triggered and not programatically
|
67 |
if( ev.originalEvent !== undefined ) {
|
68 |
|
69 |
toggleBox( id, false, false );
|
70 |
-
|
71 |
-
}
|
72 |
});
|
73 |
//not on the box
|
74 |
$('body' ).on(event,'.spu-box,.spu-clickable', function(event) {
|
@@ -82,13 +82,13 @@ var SPU_master = function() {
|
|
82 |
$boxes[id] = $box;
|
83 |
|
84 |
// functions that check % of height
|
85 |
-
var triggerHeightCheck = function()
|
86 |
{
|
87 |
-
if(timer) {
|
88 |
-
clearTimeout(timer);
|
89 |
}
|
90 |
|
91 |
-
timer = window.setTimeout(function() {
|
92 |
var scrollY = $(window).scrollTop();
|
93 |
var triggered = ((scrollY + windowHeight) >= triggerHeight);
|
94 |
|
@@ -108,13 +108,13 @@ var SPU_master = function() {
|
|
108 |
}, 100);
|
109 |
}
|
110 |
// function that show popup after X secs
|
111 |
-
var triggerSecondsCheck = function()
|
112 |
{
|
113 |
-
if(timer) {
|
114 |
-
clearTimeout(timer);
|
115 |
}
|
116 |
|
117 |
-
timer = window.setTimeout(function() {
|
118 |
|
119 |
toggleBox( id, true, false );
|
120 |
|
@@ -125,7 +125,7 @@ var SPU_master = function() {
|
|
125 |
var cookieValue = spuReadCookie( 'spu_box_' + id );
|
126 |
|
127 |
if( ( cookieValue == undefined || cookieValue == '' ) || ( isAdmin && testMode ) ) {
|
128 |
-
|
129 |
if(triggerMethod == 'seconds') {
|
130 |
triggerSecondsCheck();
|
131 |
}
|
@@ -133,7 +133,7 @@ var SPU_master = function() {
|
|
133 |
$(window).bind( 'scroll', triggerHeightCheck );
|
134 |
// init, check box criteria once
|
135 |
triggerHeightCheck();
|
136 |
-
}
|
137 |
|
138 |
// shows the box when hash refers to a box
|
139 |
if(window.location.hash && window.location.hash.length > 0) {
|
@@ -155,19 +155,19 @@ var SPU_master = function() {
|
|
155 |
toggleBox( id, false, false );
|
156 |
|
157 |
if(triggerMethod == 'percentage') {
|
158 |
-
// unbind
|
159 |
$(window).unbind( 'scroll', triggerHeightCheck );
|
160 |
-
}
|
161 |
-
|
162 |
});
|
163 |
-
|
164 |
// add link listener for this box
|
165 |
$(document.body).on('click','a[href="#spu-' + id +'"], .spu-open-' + id ,function(e) {
|
166 |
e.preventDefault();
|
167 |
toggleBox(id, true, false);
|
168 |
});
|
169 |
$('a[href="#spu-' + id +'"], .spu-open-' + id).css('cursor','pointer').addClass('spu-clickable');
|
170 |
-
|
171 |
// add class to the gravity form if they exist within the box
|
172 |
$box.find('.gform_wrapper form').addClass('gravity-form');
|
173 |
// same for mc4wp
|
@@ -302,7 +302,7 @@ var SPU_master = function() {
|
|
302 |
if( (popupHeight + 50) > windowHeight ) {
|
303 |
position = 'absolute';
|
304 |
top = currentScroll;
|
305 |
-
|
306 |
$box.css({
|
307 |
"position": position,
|
308 |
"top": top,
|
@@ -329,14 +329,14 @@ var SPU_master = function() {
|
|
329 |
$fbbox.append('<style type="text/css"> #'+$(box).attr('id')+' .fb-like iframe, #'+$(box).attr('id')+' .fb_iframe_widget span, #'+$(box).attr('id')+' .fb_iframe_widget{ height: 63px !important;width: 80px !important;}</style>');
|
330 |
|
331 |
} else if( $fblayout == 'button_count' ) {
|
332 |
-
|
333 |
$fbbox.append('<style type="text/css"> #'+$(box).attr('id')+' .fb-like iframe, #'+$(box).attr('id')+' .fb_iframe_widget span, #'+$(box).attr('id')+' .fb_iframe_widget{ height: 20px !important;min-width: 120px !important;}</style>');
|
334 |
|
335 |
} else {
|
336 |
-
|
337 |
$fbbox.append('<style type="text/css"> #'+$(box).attr('id')+' .fb-like iframe, #'+$(box).attr('id')+' .fb_iframe_widget span, #'+$(box).attr('id')+' .fb_iframe_widget{ height: 20px !important;width: 80px !important;}</style>');
|
338 |
|
339 |
-
}
|
340 |
}
|
341 |
}
|
342 |
}
|
@@ -412,9 +412,9 @@ var SPU_master = function() {
|
|
412 |
//if we are closing , set cookie
|
413 |
if( show === false) {
|
414 |
// set cookie
|
415 |
-
var days =
|
416 |
if( conversion === true )
|
417 |
-
days =
|
418 |
|
419 |
if( days > 0 ) {
|
420 |
spuCreateCookie( 'spu_box_' + id, true, days );
|
@@ -427,14 +427,14 @@ var SPU_master = function() {
|
|
427 |
$box.trigger('spu.box_open', [id]);
|
428 |
//bind for resize
|
429 |
$(window).resize(function(){
|
430 |
-
|
431 |
fixSize( id );
|
432 |
|
433 |
});
|
434 |
fixSize( id );
|
435 |
-
|
436 |
}
|
437 |
-
|
438 |
// show box
|
439 |
var animation = $box.data('spuanimation'),
|
440 |
conversion_close = $box.data('close-on-conversion');
|
@@ -487,7 +487,7 @@ if( spuvar.ajax_mode ) {
|
|
487 |
is_archive : spuvar.is_archive
|
488 |
}
|
489 |
,success_cb = function(response) {
|
490 |
-
|
491 |
$('body').append(response);
|
492 |
$(".spu-box").imagesLoaded( function() {
|
493 |
window.SPU = SPU_master();
|
@@ -546,7 +546,7 @@ if( spuvar.ajax_mode ) {
|
|
546 |
}
|
547 |
// Make the ajax request.
|
548 |
$.ajax(ajax);
|
549 |
-
|
550 |
}
|
551 |
/**
|
552 |
* Cookie functions
|
@@ -571,7 +571,7 @@ function spuReadCookie(name) {
|
|
571 |
return null;
|
572 |
}
|
573 |
|
574 |
-
/**
|
575 |
* Social Callbacks
|
576 |
*/
|
577 |
var SPUfb = false;
|
@@ -666,4 +666,4 @@ function SPU_reload_forms(){
|
|
666 |
$('.spu-box div.wpcf7 > form').wpcf7InitForm();
|
667 |
}
|
668 |
}
|
669 |
-
})(jQuery);
|
30 |
if( spuvar.safe_mode ){
|
31 |
|
32 |
$(this).prependTo('body');
|
33 |
+
|
34 |
}
|
35 |
|
36 |
// vars
|
40 |
var testMode = (parseInt($box.data('test-mode')) === 1);
|
41 |
var id = $box.data('box-id');
|
42 |
var autoHide = (parseInt($box.data('auto-hide')) === 1);
|
43 |
+
var secondsClose = parseInt($box.data('seconds-close'));
|
44 |
var triggerSeconds = parseInt( $box.data('trigger-number'), 10 );
|
45 |
var triggerPercentage = ( triggerMethod == 'percentage' ) ? ( parseInt( $box.data('trigger-number'), 10 ) / 100 ) : 0.8;
|
46 |
var triggerHeight = ( triggerPercentage * $(document).height() );
|
47 |
+
|
48 |
facebookFix( $box );
|
49 |
|
50 |
// Custom links conversion
|
61 |
//close on ipads // iphones
|
62 |
var ua = navigator.userAgent,
|
63 |
event = (ua.match(/iPad/i) || ua.match(/iPhone/i)) ? "touchstart" : "click";
|
64 |
+
|
65 |
$('body').on(event, function (ev) {
|
66 |
// test that event is user triggered and not programatically
|
67 |
if( ev.originalEvent !== undefined ) {
|
68 |
|
69 |
toggleBox( id, false, false );
|
70 |
+
|
71 |
+
}
|
72 |
});
|
73 |
//not on the box
|
74 |
$('body' ).on(event,'.spu-box,.spu-clickable', function(event) {
|
82 |
$boxes[id] = $box;
|
83 |
|
84 |
// functions that check % of height
|
85 |
+
var triggerHeightCheck = function()
|
86 |
{
|
87 |
+
if(timer) {
|
88 |
+
clearTimeout(timer);
|
89 |
}
|
90 |
|
91 |
+
timer = window.setTimeout(function() {
|
92 |
var scrollY = $(window).scrollTop();
|
93 |
var triggered = ((scrollY + windowHeight) >= triggerHeight);
|
94 |
|
108 |
}, 100);
|
109 |
}
|
110 |
// function that show popup after X secs
|
111 |
+
var triggerSecondsCheck = function()
|
112 |
{
|
113 |
+
if(timer) {
|
114 |
+
clearTimeout(timer);
|
115 |
}
|
116 |
|
117 |
+
timer = window.setTimeout(function() {
|
118 |
|
119 |
toggleBox( id, true, false );
|
120 |
|
125 |
var cookieValue = spuReadCookie( 'spu_box_' + id );
|
126 |
|
127 |
if( ( cookieValue == undefined || cookieValue == '' ) || ( isAdmin && testMode ) ) {
|
128 |
+
|
129 |
if(triggerMethod == 'seconds') {
|
130 |
triggerSecondsCheck();
|
131 |
}
|
133 |
$(window).bind( 'scroll', triggerHeightCheck );
|
134 |
// init, check box criteria once
|
135 |
triggerHeightCheck();
|
136 |
+
}
|
137 |
|
138 |
// shows the box when hash refers to a box
|
139 |
if(window.location.hash && window.location.hash.length > 0) {
|
155 |
toggleBox( id, false, false );
|
156 |
|
157 |
if(triggerMethod == 'percentage') {
|
158 |
+
// unbind
|
159 |
$(window).unbind( 'scroll', triggerHeightCheck );
|
160 |
+
}
|
161 |
+
|
162 |
});
|
163 |
+
|
164 |
// add link listener for this box
|
165 |
$(document.body).on('click','a[href="#spu-' + id +'"], .spu-open-' + id ,function(e) {
|
166 |
e.preventDefault();
|
167 |
toggleBox(id, true, false);
|
168 |
});
|
169 |
$('a[href="#spu-' + id +'"], .spu-open-' + id).css('cursor','pointer').addClass('spu-clickable');
|
170 |
+
|
171 |
// add class to the gravity form if they exist within the box
|
172 |
$box.find('.gform_wrapper form').addClass('gravity-form');
|
173 |
// same for mc4wp
|
302 |
if( (popupHeight + 50) > windowHeight ) {
|
303 |
position = 'absolute';
|
304 |
top = currentScroll;
|
305 |
+
|
306 |
$box.css({
|
307 |
"position": position,
|
308 |
"top": top,
|
329 |
$fbbox.append('<style type="text/css"> #'+$(box).attr('id')+' .fb-like iframe, #'+$(box).attr('id')+' .fb_iframe_widget span, #'+$(box).attr('id')+' .fb_iframe_widget{ height: 63px !important;width: 80px !important;}</style>');
|
330 |
|
331 |
} else if( $fblayout == 'button_count' ) {
|
332 |
+
|
333 |
$fbbox.append('<style type="text/css"> #'+$(box).attr('id')+' .fb-like iframe, #'+$(box).attr('id')+' .fb_iframe_widget span, #'+$(box).attr('id')+' .fb_iframe_widget{ height: 20px !important;min-width: 120px !important;}</style>');
|
334 |
|
335 |
} else {
|
336 |
+
|
337 |
$fbbox.append('<style type="text/css"> #'+$(box).attr('id')+' .fb-like iframe, #'+$(box).attr('id')+' .fb_iframe_widget span, #'+$(box).attr('id')+' .fb_iframe_widget{ height: 20px !important;width: 80px !important;}</style>');
|
338 |
|
339 |
+
}
|
340 |
}
|
341 |
}
|
342 |
}
|
412 |
//if we are closing , set cookie
|
413 |
if( show === false) {
|
414 |
// set cookie
|
415 |
+
var days = parseFloat( $box.data('close-cookie') );
|
416 |
if( conversion === true )
|
417 |
+
days = parseFloat( $box.data('cookie') );
|
418 |
|
419 |
if( days > 0 ) {
|
420 |
spuCreateCookie( 'spu_box_' + id, true, days );
|
427 |
$box.trigger('spu.box_open', [id]);
|
428 |
//bind for resize
|
429 |
$(window).resize(function(){
|
430 |
+
|
431 |
fixSize( id );
|
432 |
|
433 |
});
|
434 |
fixSize( id );
|
435 |
+
|
436 |
}
|
437 |
+
|
438 |
// show box
|
439 |
var animation = $box.data('spuanimation'),
|
440 |
conversion_close = $box.data('close-on-conversion');
|
487 |
is_archive : spuvar.is_archive
|
488 |
}
|
489 |
,success_cb = function(response) {
|
490 |
+
|
491 |
$('body').append(response);
|
492 |
$(".spu-box").imagesLoaded( function() {
|
493 |
window.SPU = SPU_master();
|
546 |
}
|
547 |
// Make the ajax request.
|
548 |
$.ajax(ajax);
|
549 |
+
|
550 |
}
|
551 |
/**
|
552 |
* Cookie functions
|
571 |
return null;
|
572 |
}
|
573 |
|
574 |
+
/**
|
575 |
* Social Callbacks
|
576 |
*/
|
577 |
var SPUfb = false;
|
666 |
$('.spu-box div.wpcf7 > form').wpcf7InitForm();
|
667 |
}
|
668 |
}
|
669 |
+
})(jQuery);
|
public/class-social-popup.php
CHANGED
@@ -357,7 +357,7 @@ class SocialPopup {
|
|
357 |
|
358 |
wp_register_script( 'spu-twitter', '//platform.twitter.com/widgets.js', array('jquery'), self::VERSION, FALSE);
|
359 |
|
360 |
-
wp_register_script( 'spu-google', '//apis.google.com/js/
|
361 |
|
362 |
}
|
363 |
|
@@ -448,7 +448,7 @@ class SocialPopup {
|
|
448 |
global $wpdb,$spuvar_social;
|
449 |
|
450 |
$opts = $this->spu_settings;
|
451 |
-
$spuvar_social =
|
452 |
|
453 |
$handle = 'spu-public';
|
454 |
|
@@ -577,6 +577,7 @@ class SocialPopup {
|
|
577 |
*/
|
578 |
function google_shortcode( $atts, $content ) {
|
579 |
extract( shortcode_atts( array(
|
|
|
580 |
'size' => 'medium', //small standard tall
|
581 |
'annotation' => 'bubble', //inline none
|
582 |
'url' => apply_filters( 'spu/social/gp_url', 'https://plus.google.com/u/0/103508783120806246698/posts' ),
|
@@ -592,8 +593,11 @@ class SocialPopup {
|
|
592 |
if( 'bubble' != $annotation && 'inline' != $annotation && 'none' != $annotation ) {
|
593 |
$annotation = 'bubble';
|
594 |
}
|
|
|
|
|
|
|
595 |
|
596 |
-
return '<div class="spu-google spu-shortcode"><div class="
|
597 |
|
598 |
}
|
599 |
|
357 |
|
358 |
wp_register_script( 'spu-twitter', '//platform.twitter.com/widgets.js', array('jquery'), self::VERSION, FALSE);
|
359 |
|
360 |
+
wp_register_script( 'spu-google', '//apis.google.com/js/platform.js', array('jquery'), self::VERSION, FALSE);
|
361 |
|
362 |
}
|
363 |
|
448 |
global $wpdb,$spuvar_social;
|
449 |
|
450 |
$opts = $this->spu_settings;
|
451 |
+
$spuvar_social = array();
|
452 |
|
453 |
$handle = 'spu-public';
|
454 |
|
577 |
*/
|
578 |
function google_shortcode( $atts, $content ) {
|
579 |
extract( shortcode_atts( array(
|
580 |
+
'type' => 'g-plusone', //small standard tall
|
581 |
'size' => 'medium', //small standard tall
|
582 |
'annotation' => 'bubble', //inline none
|
583 |
'url' => apply_filters( 'spu/social/gp_url', 'https://plus.google.com/u/0/103508783120806246698/posts' ),
|
593 |
if( 'bubble' != $annotation && 'inline' != $annotation && 'none' != $annotation ) {
|
594 |
$annotation = 'bubble';
|
595 |
}
|
596 |
+
if( 'g-plusone' != $type && 'g-follow' != $type ) {
|
597 |
+
$type = 'g-plusone';
|
598 |
+
}
|
599 |
|
600 |
+
return '<div class="spu-google spu-shortcode"><div class="'.$type.'" data-callback="googleCB" data-onendinteraction="closeGoogle" data-recommendations="false" data-annotation="'.$annotation.'" data-size="'.$size.'" data-href="'.$url.'"></div></div>';
|
601 |
|
602 |
}
|
603 |
|
public/includes/class-spu-rules.php
CHANGED
@@ -5,8 +5,6 @@ use Jaybizzle\CrawlerDetect\CrawlerDetect;
|
|
5 |
* Class that will compare rules and determine if popup needs to show
|
6 |
* @since: 2.0
|
7 |
*/
|
8 |
-
if( session_id() == '' )
|
9 |
-
session_start();
|
10 |
class Spu_Rules
|
11 |
{
|
12 |
/**
|
@@ -369,8 +367,8 @@ class Spu_Rules
|
|
369 |
|
370 |
$ref = $this->referrer;
|
371 |
|
372 |
-
$internal = str_replace( array( 'http://','https://' ), '',
|
373 |
-
|
374 |
if( $rule['operator'] == "==" ) {
|
375 |
|
376 |
return !preg_match( '~' . $internal . '~i', $ref );
|
@@ -618,12 +616,6 @@ class Spu_Rules
|
|
618 |
elseif( $rule['value'] == 'top_level') {
|
619 |
|
620 |
|
621 |
-
if( $options['page_parent'] )
|
622 |
-
{
|
623 |
-
$post_parent = $options['page_parent'];
|
624 |
-
}
|
625 |
-
|
626 |
-
|
627 |
if($rule['operator'] == "==")
|
628 |
{
|
629 |
$match = ( $post_parent == 0 );
|
@@ -653,12 +645,7 @@ class Spu_Rules
|
|
653 |
}
|
654 |
elseif( $rule['value'] == 'child') {
|
655 |
|
656 |
-
|
657 |
-
if( $options['page_parent'] )
|
658 |
-
{
|
659 |
-
$post_parent = $options['page_parent'];
|
660 |
-
}
|
661 |
-
|
662 |
|
663 |
if($rule['operator'] == "==")
|
664 |
{
|
5 |
* Class that will compare rules and determine if popup needs to show
|
6 |
* @since: 2.0
|
7 |
*/
|
|
|
|
|
8 |
class Spu_Rules
|
9 |
{
|
10 |
/**
|
367 |
|
368 |
$ref = $this->referrer;
|
369 |
|
370 |
+
$internal = str_replace( array( 'http://','https://' ), '', home_url() );
|
371 |
+
|
372 |
if( $rule['operator'] == "==" ) {
|
373 |
|
374 |
return !preg_match( '~' . $internal . '~i', $ref );
|
616 |
elseif( $rule['value'] == 'top_level') {
|
617 |
|
618 |
|
|
|
|
|
|
|
|
|
|
|
|
|
619 |
if($rule['operator'] == "==")
|
620 |
{
|
621 |
$match = ( $post_parent == 0 );
|
645 |
}
|
646 |
elseif( $rule['value'] == 'child') {
|
647 |
|
648 |
+
|
|
|
|
|
|
|
|
|
|
|
649 |
|
650 |
if($rule['operator'] == "==")
|
651 |
{
|