Version Description
- Fix for path traversal vulnerability - credit to Wilfried Bcard of Synacktiv (https://synacktiv.com)
- Fix for block rearrangement issues
- Few minor bug fixes, cosmetic changes and code improvements
Download this release
Release Info
Developer | spacetime |
Plugin | Ad Inserter – WordPress Ads Management with AdSense Header Integration |
Version | 2.4.20 |
Comparing to | |
See all releases |
Code changes from version 2.4.19 to 2.4.20
- ad-inserter.php +114 -27
- class.php +74 -21
- constants.php +5 -1
- css/ai-settings.css +15 -4
- includes/js/ai-adb.js +27 -132
- includes/js/ai-adb.min.js +6 -17
- includes/js/ai-cookie.js +266 -0
- includes/js/ai-cookie.min.js +12 -0
- includes/js/ai-insert.js +5 -3
- includes/js/ai-insert.min.js +6 -10
- js/ad-inserter.js +1 -1
- readme.txt +23 -1
- settings.php +52 -21
ad-inserter.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
/*
|
4 |
Plugin Name: Ad Inserter
|
5 |
-
Version: 2.4.
|
6 |
Description: Ad management with many advanced advertising features to insert ads at optimal positions
|
7 |
Author: Igor Funa
|
8 |
Author URI: http://igorfuna.com/
|
@@ -15,6 +15,13 @@ Domain Path: /languages
|
|
15 |
|
16 |
Change Log
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
Ad Inserter 2.4.19 - 2019-06-18
|
19 |
- Added support for taxonomy for Yoast primary category
|
20 |
- Layout changes to accomodate longer translated texts
|
@@ -1764,6 +1771,8 @@ function ai_wp_enqueue_scripts_hook () {
|
|
1764 |
// TEST
|
1765 |
// wp_deregister_script('jquery');
|
1766 |
|
|
|
|
|
1767 |
$footer_inline_scripts =
|
1768 |
get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW ||
|
1769 |
get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT ||
|
@@ -1776,7 +1785,7 @@ function ai_wp_enqueue_scripts_hook () {
|
|
1776 |
$ai_wp_data [AI_HTML_ELEMENT_SELECTION] ||
|
1777 |
$ai_wp_data [AI_LAZY_LOADING] ||
|
1778 |
$ai_wp_data [AI_CLIENT_SIDE_INSERTION] ||
|
1779 |
-
|
1780 |
|
1781 |
if ($footer_inline_scripts ||
|
1782 |
($ai_wp_data [AI_WP_DEBUGGING] & (AI_DEBUG_POSITIONS | AI_DEBUG_BLOCKS)) != 0 ||
|
@@ -1805,7 +1814,11 @@ function ai_wp_enqueue_scripts_hook () {
|
|
1805 |
wp_add_inline_script ('ai-jquery-js', 'ai_debugging = true;');
|
1806 |
}
|
1807 |
|
1808 |
-
if (!get_disable_js_code () && $ai_wp_data [
|
|
|
|
|
|
|
|
|
1809 |
wp_add_inline_script ('ai-jquery-js', ai_get_js ('ai-insert', false));
|
1810 |
}
|
1811 |
|
@@ -1870,6 +1883,7 @@ function add_head_inline_styles () {
|
|
1870 |
echo ".ai-close-show {display: block;}\n";
|
1871 |
echo ".ai-close-left {right: unset; left: -10px;}\n";
|
1872 |
echo ".ai-close-bottom {top: unset; bottom: -11px;}\n";
|
|
|
1873 |
}
|
1874 |
|
1875 |
// Before alignment CSS to not override alignment margin
|
@@ -2133,19 +2147,18 @@ function add_footer_inline_scripts () {
|
|
2133 |
|
2134 |
if (get_disable_js_code ()) return;
|
2135 |
|
2136 |
-
|
2137 |
|
2138 |
-
|
2139 |
-
|
2140 |
-
|
2141 |
-
|
2142 |
-
|
2143 |
-
|
2144 |
-
|
2145 |
-
|
2146 |
-
|
2147 |
-
|
2148 |
-
}
|
2149 |
}
|
2150 |
}
|
2151 |
|
@@ -2162,7 +2175,7 @@ function add_footer_inline_scripts () {
|
|
2162 |
$ai_wp_data [AI_HTML_ELEMENT_SELECTION] ||
|
2163 |
$ai_wp_data [AI_LAZY_LOADING] ||
|
2164 |
$ai_wp_data [AI_CLIENT_SIDE_INSERTION] ||
|
2165 |
-
|
2166 |
|
2167 |
// if (($footer_inline_scripts || $ai_wp_data [AI_CLIENT_SIDE_INSERTION]) && !wp_script_is ('jquery', 'done')) {
|
2168 |
if ($footer_inline_scripts && !wp_script_is ('jquery', 'done')) {
|
@@ -2212,13 +2225,11 @@ function add_footer_inline_scripts () {
|
|
2212 |
}
|
2213 |
|
2214 |
if ($ai_wp_data [AI_CLIENT_SIDE_INSERTION] && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
2215 |
-
echo 'setTimeout (function() {Array.prototype.forEach.call (document.querySelectorAll (".ai-viewports"), function (element, index) {
|
2216 |
}
|
2217 |
|
2218 |
-
if (
|
2219 |
-
if (
|
2220 |
-
if (!function_exists ('add_footer_inline_scripts_2')) echo ai_replace_js_data (ai_adb_code ());
|
2221 |
-
}
|
2222 |
}
|
2223 |
|
2224 |
if (function_exists ('add_footer_inline_scripts_2')) {
|
@@ -2258,7 +2269,9 @@ function ai_admin_notice_hook () {
|
|
2258 |
if (function_exists ('ai_admin_notices')) ai_admin_notices (); else {
|
2259 |
if (/*$hook_suffix == $ai_settings_page &&*/ is_super_admin () && !wp_is_mobile () && isset ($ai_wp_data [AI_DAYS_SINCE_INSTAL])) {
|
2260 |
|
2261 |
-
|
|
|
|
|
2262 |
|
2263 |
$notice_option = get_option ('ai-notice-review');
|
2264 |
|
@@ -4763,14 +4776,22 @@ function ai_ajax_backend () {
|
|
4763 |
}
|
4764 |
|
4765 |
elseif (isset ($_GET ["image"])) {
|
|
|
4766 |
header ("Content-Type: image/png");
|
4767 |
-
header ("Content-Length: " . filesize (AD_INSERTER_PLUGIN_DIR.'images/'.$
|
4768 |
-
readfile (AD_INSERTER_PLUGIN_DIR.'images/'.$
|
4769 |
}
|
4770 |
elseif (isset ($_GET ["css"])) {
|
|
|
4771 |
header ("Content-Type: text/css");
|
4772 |
-
header ("Content-Length: " . filesize (AD_INSERTER_PLUGIN_DIR.''.$
|
4773 |
-
readfile (AD_INSERTER_PLUGIN_DIR.$
|
|
|
|
|
|
|
|
|
|
|
|
|
4774 |
}
|
4775 |
|
4776 |
elseif (isset ($_GET ["rating"])) {
|
@@ -7569,6 +7590,72 @@ function check_referer_list ($referers, $white_list) {
|
|
7569 |
return !$return;
|
7570 |
}
|
7571 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7572 |
function get_paragraph_start_positions ($content, $multibyte, $paragraph_end_positions, $paragraph_start_strings, &$paragraph_positions, &$active_paragraph_positions) {
|
7573 |
foreach ($paragraph_start_strings as $paragraph_start_string) {
|
7574 |
if (trim ($paragraph_start_string) == '') continue;
|
@@ -7969,7 +8056,7 @@ if (function_exists ('ai_system_output_check')) $ai_system_output = ai_system_ou
|
|
7969 |
//}
|
7970 |
|
7971 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0 || $ai_system_output) {
|
7972 |
-
add_action ('shutdown', 'ai_shutdown_hook');
|
7973 |
}
|
7974 |
|
7975 |
add_action ('widgets_init', 'ai_widgets_init_hook');
|
2 |
|
3 |
/*
|
4 |
Plugin Name: Ad Inserter
|
5 |
+
Version: 2.4.20
|
6 |
Description: Ad management with many advanced advertising features to insert ads at optimal positions
|
7 |
Author: Igor Funa
|
8 |
Author URI: http://igorfuna.com/
|
15 |
|
16 |
Change Log
|
17 |
|
18 |
+
Ad Inserter 2.4.20 - 2019-07-09
|
19 |
+
- Fix for path traversal vulnerability - credit to Wilfried B�card of Synacktiv (https://synacktiv.com)
|
20 |
+
- Fix for block rearrangement issues
|
21 |
+
- Added experimental support to remember closed ad for specified time period (Pro only)
|
22 |
+
- Added experimental support to automatically close ad after specified time period (Pro only)
|
23 |
+
- Few minor bug fixes, cosmetic changes and code improvements
|
24 |
+
|
25 |
Ad Inserter 2.4.19 - 2019-06-18
|
26 |
- Added support for taxonomy for Yoast primary category
|
27 |
- Layout changes to accomodate longer translated texts
|
1771 |
// TEST
|
1772 |
// wp_deregister_script('jquery');
|
1773 |
|
1774 |
+
$adb_code = defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION && $ai_wp_data [AI_ADB_DETECTION] && !isset ($ai_wp_data [AI_ADB_SHORTCODE_DISABLED]);
|
1775 |
+
|
1776 |
$footer_inline_scripts =
|
1777 |
get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_SHOW ||
|
1778 |
get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_CLIENT_SIDE_INSERT ||
|
1785 |
$ai_wp_data [AI_HTML_ELEMENT_SELECTION] ||
|
1786 |
$ai_wp_data [AI_LAZY_LOADING] ||
|
1787 |
$ai_wp_data [AI_CLIENT_SIDE_INSERTION] ||
|
1788 |
+
$adb_code;
|
1789 |
|
1790 |
if ($footer_inline_scripts ||
|
1791 |
($ai_wp_data [AI_WP_DEBUGGING] & (AI_DEBUG_POSITIONS | AI_DEBUG_BLOCKS)) != 0 ||
|
1814 |
wp_add_inline_script ('ai-jquery-js', 'ai_debugging = true;');
|
1815 |
}
|
1816 |
|
1817 |
+
if (!get_disable_js_code () && (($ai_wp_data [AI_CLOSE_BUTTONS] && !$ai_wp_data [AI_CODE_FOR_IFRAME]) || $adb_code)) {
|
1818 |
+
wp_add_inline_script ('ai-jquery-js', ai_get_js ('ai-cookie', false));
|
1819 |
+
}
|
1820 |
+
|
1821 |
+
if (!get_disable_js_code () && ($ai_wp_data [AI_CLIENT_SIDE_INSERTION] || $ai_wp_data [AI_CLOSE_BUTTONS]) && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
1822 |
wp_add_inline_script ('ai-jquery-js', ai_get_js ('ai-insert', false));
|
1823 |
}
|
1824 |
|
1883 |
echo ".ai-close-show {display: block;}\n";
|
1884 |
echo ".ai-close-left {right: unset; left: -10px;}\n";
|
1885 |
echo ".ai-close-bottom {top: unset; bottom: -11px;}\n";
|
1886 |
+
echo ".ai-close-none {visibility: hidden;}\n";
|
1887 |
}
|
1888 |
|
1889 |
// Before alignment CSS to not override alignment margin
|
2147 |
|
2148 |
if (get_disable_js_code ()) return;
|
2149 |
|
2150 |
+
$adb_code = defined ('AI_ADBLOCKING_DETECTION') && AI_ADBLOCKING_DETECTION && $ai_wp_data [AI_ADB_DETECTION] && !isset ($ai_wp_data [AI_ADB_SHORTCODE_DISABLED]);
|
2151 |
|
2152 |
+
if ($adb_code) {
|
2153 |
+
if (function_exists ('add_footer_inline_scripts_1')) add_footer_inline_scripts_1 (); else {
|
2154 |
+
echo '<!-- Code for ad blocking detection -->', "\n";
|
2155 |
+
echo '<!--noptimize-->', "\n";
|
2156 |
+
echo '<div id="banner-advert-container" class="ad-inserter chitika-ad" style="position:absolute; z-index: -10; height: 1px; width: 1px; top: -1px; left: -1px;"><img id="adsense" class="SponsorAds adsense" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"></div>', "\n";
|
2157 |
+
echo '<script async src="https://www.google-analytics.com/analytics.js"></script>', "\n";
|
2158 |
+
echo '<script async src="//contextual.media.net/dmedianet.js"></script>', "\n";
|
2159 |
+
echo "<script type='text/javascript' src='", plugins_url ('js/ads.js', __FILE__ ), "?ver=", AD_INSERTER_VERSION, "'></script>\n";
|
2160 |
+
echo "<script type='text/javascript' src='", plugins_url ('js/sponsors.js', __FILE__ ), "?ver=", AD_INSERTER_VERSION, "'></script>\n";
|
2161 |
+
echo '<!--/noptimize-->', "\n";
|
|
|
2162 |
}
|
2163 |
}
|
2164 |
|
2175 |
$ai_wp_data [AI_HTML_ELEMENT_SELECTION] ||
|
2176 |
$ai_wp_data [AI_LAZY_LOADING] ||
|
2177 |
$ai_wp_data [AI_CLIENT_SIDE_INSERTION] ||
|
2178 |
+
$adb_code;
|
2179 |
|
2180 |
// if (($footer_inline_scripts || $ai_wp_data [AI_CLIENT_SIDE_INSERTION]) && !wp_script_is ('jquery', 'done')) {
|
2181 |
if ($footer_inline_scripts && !wp_script_is ('jquery', 'done')) {
|
2225 |
}
|
2226 |
|
2227 |
if ($ai_wp_data [AI_CLIENT_SIDE_INSERTION] && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
2228 |
+
echo 'setTimeout (function() {Array.prototype.forEach.call (document.querySelectorAll (".ai-viewports"), function (element, index) {ai_insert_code (element);});}, 10);', PHP_EOL;
|
2229 |
}
|
2230 |
|
2231 |
+
if ($adb_code) {
|
2232 |
+
if (!function_exists ('add_footer_inline_scripts_2')) echo ai_replace_js_data (ai_adb_code ());
|
|
|
|
|
2233 |
}
|
2234 |
|
2235 |
if (function_exists ('add_footer_inline_scripts_2')) {
|
2269 |
if (function_exists ('ai_admin_notices')) ai_admin_notices (); else {
|
2270 |
if (/*$hook_suffix == $ai_settings_page &&*/ is_super_admin () && !wp_is_mobile () && isset ($ai_wp_data [AI_DAYS_SINCE_INSTAL])) {
|
2271 |
|
2272 |
+
if (isset ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS])) {
|
2273 |
+
$used_blocks = count (unserialize ($ai_db_options_extract [AI_EXTRACT_USED_BLOCKS]));
|
2274 |
+
} else $used_blocks = 0;
|
2275 |
|
2276 |
$notice_option = get_option ('ai-notice-review');
|
2277 |
|
4776 |
}
|
4777 |
|
4778 |
elseif (isset ($_GET ["image"])) {
|
4779 |
+
$filename = sanitize_file_name ($_GET ["image"]);
|
4780 |
header ("Content-Type: image/png");
|
4781 |
+
header ("Content-Length: " . filesize (AD_INSERTER_PLUGIN_DIR.'images/'.$filename));
|
4782 |
+
readfile (AD_INSERTER_PLUGIN_DIR.'images/'.$filename);
|
4783 |
}
|
4784 |
elseif (isset ($_GET ["css"])) {
|
4785 |
+
$filename = sanitize_file_name ($_GET ["css"]);
|
4786 |
header ("Content-Type: text/css");
|
4787 |
+
header ("Content-Length: " . filesize (AD_INSERTER_PLUGIN_DIR.'css/'.$filename));
|
4788 |
+
readfile (AD_INSERTER_PLUGIN_DIR.'css/'.$filename);
|
4789 |
+
}
|
4790 |
+
elseif (isset ($_GET ["js"])) {
|
4791 |
+
$filename = sanitize_file_name ($_GET ["js"]);
|
4792 |
+
header ("Content-Type: application/javascript");
|
4793 |
+
header ("Content-Length: " . filesize (AD_INSERTER_PLUGIN_DIR.'js/'.$filename));
|
4794 |
+
readfile (AD_INSERTER_PLUGIN_DIR.'js/'.$filename);
|
4795 |
}
|
4796 |
|
4797 |
elseif (isset ($_GET ["rating"])) {
|
7590 |
return !$return;
|
7591 |
}
|
7592 |
|
7593 |
+
function ai_check_block ($block) {
|
7594 |
+
$ai_cookie_name = 'aiBLOCKS';
|
7595 |
+
|
7596 |
+
if (isset ($_COOKIE [$ai_cookie_name])) {
|
7597 |
+
$ai_cookie = json_decode (stripslashes ($_COOKIE [$ai_cookie_name]));
|
7598 |
+
if ($ai_cookie != null) {
|
7599 |
+
if (isset ($ai_cookie->$block) && is_object ($ai_cookie->$block)) {
|
7600 |
+
|
7601 |
+
foreach ($ai_cookie->$block as $property => $value) {
|
7602 |
+
switch ($property) {
|
7603 |
+
case 'x':
|
7604 |
+
$closed_for = $value - time ();
|
7605 |
+
|
7606 |
+
if ($closed_for > 0) {
|
7607 |
+
return false;
|
7608 |
+
} else {
|
7609 |
+
ai_set_cookie ($block, 'x', '');
|
7610 |
+
}
|
7611 |
+
break;
|
7612 |
+
}
|
7613 |
+
}
|
7614 |
+
}
|
7615 |
+
}
|
7616 |
+
}
|
7617 |
+
|
7618 |
+
return true;
|
7619 |
+
}
|
7620 |
+
|
7621 |
+
function ai_set_cookie ($block, $property, $value) {
|
7622 |
+
$ai_cookie_name = 'aiBLOCKS';
|
7623 |
+
|
7624 |
+
if (isset ($_COOKIE ['aiBLOCKS'])) {
|
7625 |
+
$ai_cookie = json_decode (stripslashes ($_COOKIE [$ai_cookie_name]));
|
7626 |
+
} else $ai_cookie = new stdClass();
|
7627 |
+
|
7628 |
+
// print_r ($ai_cookie);
|
7629 |
+
|
7630 |
+
if ($value == '') {
|
7631 |
+
if (isset ($ai_cookie->$block) && is_object ($ai_cookie->$block)) {
|
7632 |
+
unset ($ai_cookie->$block->$property);
|
7633 |
+
$ai_cookie_array = (array) $ai_cookie->$block;
|
7634 |
+
if (empty ($ai_cookie_array)) {
|
7635 |
+
unset ($ai_cookie->$block);
|
7636 |
+
}
|
7637 |
+
}
|
7638 |
+
} else {
|
7639 |
+
if (!isset ($ai_cookie->$block)) {
|
7640 |
+
$ai_cookie->$block = new stdClass();
|
7641 |
+
}
|
7642 |
+
$ai_cookie->$block->$property = $value;
|
7643 |
+
}
|
7644 |
+
|
7645 |
+
$ai_cookie_array = (array) $ai_cookie;
|
7646 |
+
if (empty ($ai_cookie_array)) {
|
7647 |
+
unset ($_COOKIE [$ai_cookie_name]);
|
7648 |
+
setcookie ($ai_cookie_name, null, - 1, '/');
|
7649 |
+
} else {
|
7650 |
+
$_COOKIE [$ai_cookie_name] = addslashes (json_encode ($ai_cookie));
|
7651 |
+
setcookie ($ai_cookie_name, $_COOKIE [$ai_cookie_name], 365, '/');
|
7652 |
+
}
|
7653 |
+
|
7654 |
+
// if (isset ($_COOKIE [$ai_cookie_name])) {
|
7655 |
+
// print_r ($_COOKIE [$ai_cookie_name]);
|
7656 |
+
// } else echo "NO COOKIE <br />";
|
7657 |
+
}
|
7658 |
+
|
7659 |
function get_paragraph_start_positions ($content, $multibyte, $paragraph_end_positions, $paragraph_start_strings, &$paragraph_positions, &$active_paragraph_positions) {
|
7660 |
foreach ($paragraph_start_strings as $paragraph_start_string) {
|
7661 |
if (trim ($paragraph_start_string) == '') continue;
|
8056 |
//}
|
8057 |
|
8058 |
if (($ai_wp_data [AI_WP_DEBUGGING] & AI_DEBUG_PROCESSING) != 0 || $ai_system_output) {
|
8059 |
+
add_action ('shutdown', 'ai_shutdown_hook', 0);
|
8060 |
}
|
8061 |
|
8062 |
add_action ('widgets_init', 'ai_widgets_init_hook');
|
class.php
CHANGED
@@ -9,8 +9,8 @@ abstract class ai_BaseCodeBlock {
|
|
9 |
var $fallback;
|
10 |
var $client_side_list_detection;
|
11 |
var $w3tc_code;
|
12 |
-
var $
|
13 |
-
var $
|
14 |
var $needs_class;
|
15 |
var $code_version;
|
16 |
var $version_name;
|
@@ -57,8 +57,8 @@ abstract class ai_BaseCodeBlock {
|
|
57 |
$this->fallback = 0;
|
58 |
$this->client_side_list_detection = false;
|
59 |
$this->w3tc_code = '';
|
60 |
-
$this->
|
61 |
-
$this->
|
62 |
$this->needs_class = false;
|
63 |
$this->code_version = 0;
|
64 |
$this->version_name = '';
|
@@ -622,6 +622,9 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
622 |
$this->wp_options [AI_OPTION_DETECT_CLIENT_SIDE] = AI_DISABLED;
|
623 |
$this->wp_options [AI_OPTION_CLIENT_SIDE_ACTION] = DEFAULT_CLIENT_SIDE_ACTION;
|
624 |
$this->wp_options [AI_OPTION_CLOSE_BUTTON] = DEFAULT_CLOSE_BUTTON;
|
|
|
|
|
|
|
625 |
for ($viewport = 1; $viewport <= 6; $viewport ++) {
|
626 |
$this->wp_options [AI_OPTION_DETECT_VIEWPORT . '_' . $viewport] = AI_DISABLED;
|
627 |
}
|
@@ -2148,10 +2151,14 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2148 |
$additional_code .= $this->ai_getAdLabel ();
|
2149 |
}
|
2150 |
|
|
|
|
|
|
|
|
|
2151 |
if (!$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
2152 |
$alignment_type = $this->get_alignment_type ();
|
2153 |
-
if ($force_close_button || ($
|
2154 |
-
switch ($
|
2155 |
case AI_CLOSE_TOP_RIGHT:
|
2156 |
$button_class = 'ai-close-button';
|
2157 |
break;
|
@@ -2165,11 +2172,26 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2165 |
$button_class = 'ai-close-button ai-close-bottom ai-close-left';
|
2166 |
break;
|
2167 |
default:
|
2168 |
-
$button_class = 'ai-close-button';
|
2169 |
break;
|
2170 |
}
|
2171 |
|
2172 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2173 |
}
|
2174 |
}
|
2175 |
|
@@ -2733,6 +2755,23 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2733 |
break;
|
2734 |
}
|
2735 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2736 |
}
|
2737 |
}
|
2738 |
|
@@ -2806,7 +2845,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2806 |
$additional_block_style = '';
|
2807 |
}
|
2808 |
|
2809 |
-
if ($this->get_close_button () && !$ai_wp_data [AI_WP_AMP_PAGE] && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
2810 |
$classes [] = 'ai-close';
|
2811 |
}
|
2812 |
|
@@ -2869,8 +2908,8 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2869 |
|
2870 |
$this->w3tc_code .= ' $ai_code = str_replace (\'[#AI_DATA#]\', base64_encode ("[' . $this->number . ',$ai_index]"), base64_decode (\''.base64_encode ($wrapper_before).'\')) . $ai_code . base64_decode (\''.base64_encode ($wrapper_after).'\');';
|
2871 |
|
2872 |
-
if ($this->
|
2873 |
-
$this->w3tc_code = $this->
|
2874 |
}
|
2875 |
|
2876 |
$code = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
@@ -2892,17 +2931,19 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2892 |
|
2893 |
$wrapper_after = "</div>\n";
|
2894 |
|
2895 |
-
|
2896 |
-
|
|
|
|
|
2897 |
|
2898 |
$code2 = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
2899 |
-
$code2 .= $this->
|
2900 |
$code2 .= '<!-- /mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
2901 |
|
2902 |
$code = str_replace ("[#AI_CODE2#]", $code2, $code);
|
2903 |
}
|
2904 |
|
2905 |
-
$code = $
|
2906 |
}
|
2907 |
|
2908 |
return $code;
|
@@ -2991,7 +3032,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
2991 |
|
2992 |
$serverside_insertion_code = "<div class='ai-viewports $viewport_classes' data-code='[#AI_CODE#]' data-block='{$this->number}'></div>\n";
|
2993 |
if (!get_disable_js_code ())
|
2994 |
-
$serverside_insertion_code .= "<script>var
|
2995 |
}
|
2996 |
elseif ($viewports_insertion && $html_element_insertion) {
|
2997 |
$this->counters = '<span class="ai-selector-counter"></span>';
|
@@ -3002,7 +3043,7 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
3002 |
$serverside_insertion_code = "<div class='ai-viewports $viewport_classes' data-insertion='$insertion' data-selector='$selector' data-code='[#AI_CODE#]' data-block='{$this->number}'></div>\n";
|
3003 |
if (!get_disable_js_code () && $this->get_html_element_insertion () == AI_HTML_INSERTION_CLIENT_SIDE)
|
3004 |
// Try to insert it immediately. If the code is server-side inserted before the HTML element, it will be client-side inserted after DOM ready (remaining .ai-viewports)
|
3005 |
-
$serverside_insertion_code .= "<script>var
|
3006 |
}
|
3007 |
else { // only HTML element insertion
|
3008 |
$this->counters = '<span class="ai-selector-counter"></span>';
|
@@ -3055,12 +3096,12 @@ abstract class ai_CodeBlock extends ai_BaseCodeBlock {
|
|
3055 |
$serverside_insertion_code .= '<!-- /mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
3056 |
|
3057 |
} else {
|
3058 |
-
if ($this->
|
3059 |
-
$this->
|
3060 |
-
$this->
|
3061 |
|
3062 |
$serverside_insertion_code = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
3063 |
-
$serverside_insertion_code .= $this->
|
3064 |
$serverside_insertion_code .= '<!-- /mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
3065 |
} else
|
3066 |
|
@@ -3108,6 +3149,18 @@ echo '</body>
|
|
3108 |
return $option;
|
3109 |
}
|
3110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3111 |
public function get_horizontal_margin (){
|
3112 |
$option = isset ($this->wp_options [AI_OPTION_HORIZONTAL_MARGIN]) ? $this->wp_options [AI_OPTION_HORIZONTAL_MARGIN] : DEFAULT_HORIZONTAL_MARGIN;
|
3113 |
return $option;
|
9 |
var $fallback;
|
10 |
var $client_side_list_detection;
|
11 |
var $w3tc_code;
|
12 |
+
var $w3tc_fallback_code;
|
13 |
+
var $before_w3tc_fallback_code;
|
14 |
var $needs_class;
|
15 |
var $code_version;
|
16 |
var $version_name;
|
57 |
$this->fallback = 0;
|
58 |
$this->client_side_list_detection = false;
|
59 |
$this->w3tc_code = '';
|
60 |
+
$this->w3tc_fallback_code = '';
|
61 |
+
$this->before_w3tc_fallback_code = '';
|
62 |
$this->needs_class = false;
|
63 |
$this->code_version = 0;
|
64 |
$this->version_name = '';
|
622 |
$this->wp_options [AI_OPTION_DETECT_CLIENT_SIDE] = AI_DISABLED;
|
623 |
$this->wp_options [AI_OPTION_CLIENT_SIDE_ACTION] = DEFAULT_CLIENT_SIDE_ACTION;
|
624 |
$this->wp_options [AI_OPTION_CLOSE_BUTTON] = DEFAULT_CLOSE_BUTTON;
|
625 |
+
$this->wp_options [AI_OPTION_AUTO_CLOSE_TIME] = DEFAULT_AUTO_CLOSE_TIME;
|
626 |
+
$this->wp_options [AI_OPTION_STAY_CLOSED_TIME] = DEFAULT_STAY_CLOSED_TIME;
|
627 |
+
|
628 |
for ($viewport = 1; $viewport <= 6; $viewport ++) {
|
629 |
$this->wp_options [AI_OPTION_DETECT_VIEWPORT . '_' . $viewport] = AI_DISABLED;
|
630 |
}
|
2151 |
$additional_code .= $this->ai_getAdLabel ();
|
2152 |
}
|
2153 |
|
2154 |
+
$close_button = $this->get_close_button ();
|
2155 |
+
$auto_close_time = $this->get_auto_close_time ();
|
2156 |
+
$stay_closed_time = $this->get_stay_closed_time ();
|
2157 |
+
|
2158 |
if (!$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
2159 |
$alignment_type = $this->get_alignment_type ();
|
2160 |
+
if ($force_close_button || (($close_button != AI_CLOSE_NONE || $auto_close_time) && !$ai_wp_data [AI_WP_AMP_PAGE] && $alignment_type != AI_ALIGNMENT_NO_WRAPPING)) {
|
2161 |
+
switch ($close_button) {
|
2162 |
case AI_CLOSE_TOP_RIGHT:
|
2163 |
$button_class = 'ai-close-button';
|
2164 |
break;
|
2172 |
$button_class = 'ai-close-button ai-close-bottom ai-close-left';
|
2173 |
break;
|
2174 |
default:
|
2175 |
+
$button_class = 'ai-close-button ai-close-none';
|
2176 |
break;
|
2177 |
}
|
2178 |
|
2179 |
+
$timeout_code = '';
|
2180 |
+
if ($auto_close_time = $this->get_auto_close_time ()) {
|
2181 |
+
$timeout_code = " data-ai-close-timeout='{$auto_close_time}'";
|
2182 |
+
}
|
2183 |
+
|
2184 |
+
$closed_code = '';
|
2185 |
+
if ($stay_closed_time = $this->get_stay_closed_time ()) {
|
2186 |
+
$closed_code = " data-ai-closed-time='{$stay_closed_time}'";
|
2187 |
+
}
|
2188 |
+
|
2189 |
+
$closed_block_code = '';
|
2190 |
+
if ($closed_code != '' || $timeout_code != '') {
|
2191 |
+
$closed_block_code = " data-ai-block='{$this->number}'";
|
2192 |
+
}
|
2193 |
+
|
2194 |
+
$additional_code .= "<span class='$button_class'{$timeout_code}{$closed_code}{$closed_block_code}></span>\n";
|
2195 |
}
|
2196 |
}
|
2197 |
|
2755 |
break;
|
2756 |
}
|
2757 |
}
|
2758 |
+
|
2759 |
+
if ($this->get_stay_closed_time ()) {
|
2760 |
+
// Check for cookie
|
2761 |
+
if (get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC && !defined ('AI_NO_W3TC')) {
|
2762 |
+
if ($this->w3tc_code == '') $this->w3tc_code = '$ai_code = base64_decode (\''.base64_encode ($processed_code).'\'); $ai_index = 0; $ai_enabled = true;';
|
2763 |
+
|
2764 |
+
$this->w3tc_code .= 'if ($ai_enabled) $ai_enabled = ai_check_block (' . $this->number . ');';
|
2765 |
+
|
2766 |
+
$processed_code = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
2767 |
+
$processed_code .= $this->w3tc_code . ' if ($ai_enabled) echo $ai_code;';
|
2768 |
+
$processed_code .= '<!-- /mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
2769 |
+
} else {
|
2770 |
+
$processed_code = "<div class='ai-client-check' data-code='".base64_encode ($processed_code)."' data-block='{$this->number}'></div>\n";
|
2771 |
+
if (!get_disable_js_code ())
|
2772 |
+
$processed_code .= "<script>if (ai_check_block ({$this->number})) {var ai_block_div = document.getElementsByClassName ('ai-client-check'); ai_insert_code (ai_block_div [ai_block_div.length - 1]);}</script>\n";
|
2773 |
+
}
|
2774 |
+
}
|
2775 |
}
|
2776 |
}
|
2777 |
|
2845 |
$additional_block_style = '';
|
2846 |
}
|
2847 |
|
2848 |
+
if (($this->get_close_button () || $this->get_auto_close_time ()) && !$ai_wp_data [AI_WP_AMP_PAGE] && !$ai_wp_data [AI_CODE_FOR_IFRAME]) {
|
2849 |
$classes [] = 'ai-close';
|
2850 |
}
|
2851 |
|
2908 |
|
2909 |
$this->w3tc_code .= ' $ai_code = str_replace (\'[#AI_DATA#]\', base64_encode ("[' . $this->number . ',$ai_index]"), base64_decode (\''.base64_encode ($wrapper_before).'\')) . $ai_code . base64_decode (\''.base64_encode ($wrapper_after).'\');';
|
2910 |
|
2911 |
+
if ($this->w3tc_fallback_code != '' ) {
|
2912 |
+
$this->w3tc_code = $this->w3tc_fallback_code . ' $ai_code2 = $ai_enabled ? $ai_code : "";' . $this->w3tc_code . ' $ai_code = str_replace ("[#AI_CODE2#]", $ai_code2, $ai_code);';
|
2913 |
}
|
2914 |
|
2915 |
$code = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
2931 |
|
2932 |
$wrapper_after = "</div>\n";
|
2933 |
|
2934 |
+
$wrapped_code = $wrapper_before . $code . $wrapper_after;
|
2935 |
+
|
2936 |
+
if ($this->w3tc_fallback_code != '' ) {
|
2937 |
+
$this->before_w3tc_fallback_code = $wrapped_code;
|
2938 |
|
2939 |
$code2 = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
2940 |
+
$code2 .= $this->w3tc_fallback_code .' if ($ai_enabled) echo $ai_code;';
|
2941 |
$code2 .= '<!-- /mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
2942 |
|
2943 |
$code = str_replace ("[#AI_CODE2#]", $code2, $code);
|
2944 |
}
|
2945 |
|
2946 |
+
$code = $wrapped_code;
|
2947 |
}
|
2948 |
|
2949 |
return $code;
|
3032 |
|
3033 |
$serverside_insertion_code = "<div class='ai-viewports $viewport_classes' data-code='[#AI_CODE#]' data-block='{$this->number}'></div>\n";
|
3034 |
if (!get_disable_js_code ())
|
3035 |
+
$serverside_insertion_code .= "<script>var ai_block_div = document.getElementsByClassName ('ai-viewports'); ai_insert_code (ai_block_div [ai_block_div.length - 1]);</script>\n";
|
3036 |
}
|
3037 |
elseif ($viewports_insertion && $html_element_insertion) {
|
3038 |
$this->counters = '<span class="ai-selector-counter"></span>';
|
3043 |
$serverside_insertion_code = "<div class='ai-viewports $viewport_classes' data-insertion='$insertion' data-selector='$selector' data-code='[#AI_CODE#]' data-block='{$this->number}'></div>\n";
|
3044 |
if (!get_disable_js_code () && $this->get_html_element_insertion () == AI_HTML_INSERTION_CLIENT_SIDE)
|
3045 |
// Try to insert it immediately. If the code is server-side inserted before the HTML element, it will be client-side inserted after DOM ready (remaining .ai-viewports)
|
3046 |
+
$serverside_insertion_code .= "<script>var ai_block_div = document.getElementsByClassName ('ai-viewports'); ai_insert_code (ai_block_div [ai_block_div.length - 1]);</script>\n";
|
3047 |
}
|
3048 |
else { // only HTML element insertion
|
3049 |
$this->counters = '<span class="ai-selector-counter"></span>';
|
3096 |
$serverside_insertion_code .= '<!-- /mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
3097 |
|
3098 |
} else {
|
3099 |
+
if ($this->w3tc_fallback_code != '' && get_dynamic_blocks () == AI_DYNAMIC_BLOCKS_SERVER_SIDE_W3TC && !defined ('AI_NO_W3TC')) {
|
3100 |
+
$this->w3tc_fallback_code .= ' $ai_code = str_replace ("[#AI_CODE2#]", $ai_enabled ? $ai_code : "", base64_decode ("'. base64_encode ($this->before_w3tc_fallback_code) . '"));';
|
3101 |
+
$this->w3tc_fallback_code .= ' $ai_code = str_replace ("[#AI_CODE#]", base64_encode ($ai_code), base64_decode ("'. base64_encode ($serverside_insertion_code) . '"));';
|
3102 |
|
3103 |
$serverside_insertion_code = '<!-- mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
3104 |
+
$serverside_insertion_code .= $this->w3tc_fallback_code .' echo $ai_code;';
|
3105 |
$serverside_insertion_code .= '<!-- /mfunc '.W3TC_DYNAMIC_SECURITY.' -->';
|
3106 |
} else
|
3107 |
|
3149 |
return $option;
|
3150 |
}
|
3151 |
|
3152 |
+
public function get_auto_close_time () {
|
3153 |
+
$option = isset ($this->wp_options [AI_OPTION_AUTO_CLOSE_TIME]) ? $this->wp_options [AI_OPTION_AUTO_CLOSE_TIME] : DEFAULT_AUTO_CLOSE_TIME;
|
3154 |
+
if ($option == '0') $option = '';
|
3155 |
+
return $option;
|
3156 |
+
}
|
3157 |
+
|
3158 |
+
public function get_stay_closed_time () {
|
3159 |
+
$option = isset ($this->wp_options [AI_OPTION_STAY_CLOSED_TIME]) ? $this->wp_options [AI_OPTION_STAY_CLOSED_TIME] : DEFAULT_STAY_CLOSED_TIME;
|
3160 |
+
if ($option == '0') $option = '';
|
3161 |
+
return $option;
|
3162 |
+
}
|
3163 |
+
|
3164 |
public function get_horizontal_margin (){
|
3165 |
$option = isset ($this->wp_options [AI_OPTION_HORIZONTAL_MARGIN]) ? $this->wp_options [AI_OPTION_HORIZONTAL_MARGIN] : DEFAULT_HORIZONTAL_MARGIN;
|
3166 |
return $option;
|
constants.php
CHANGED
@@ -29,7 +29,7 @@ if (!defined( 'AD_INSERTER_NAME'))
|
|
29 |
define ('AD_INSERTER_NAME', 'Ad Inserter');
|
30 |
|
31 |
if (!defined( 'AD_INSERTER_VERSION'))
|
32 |
-
define ('AD_INSERTER_VERSION', '2.4.
|
33 |
|
34 |
if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
|
35 |
define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
|
@@ -152,6 +152,8 @@ define ('AI_OPTION_DETECT_VIEWPORT', 'detect_viewport');
|
|
152 |
define ('AI_OPTION_ADB_BLOCK_ACTION', 'adb-block-action');
|
153 |
define ('AI_OPTION_ADB_BLOCK_REPLACEMENT', 'adb-block-replacement');
|
154 |
define ('AI_OPTION_CLOSE_BUTTON', 'close-button');
|
|
|
|
|
155 |
define ('AI_OPTION_HORIZONTAL_MARGIN', 'horizontal-margin');
|
156 |
define ('AI_OPTION_VERTICAL_MARGIN', 'vertical-margin');
|
157 |
define ('AI_OPTION_ANIMATION', 'animation');
|
@@ -752,6 +754,8 @@ define ('DEFAULT_DISABLE_CACHING', AI_DISABLE_CACHING_ENABLED);
|
|
752 |
define ('DEFAULT_GEO_DB', AI_GEO_DB_WEBNET77);
|
753 |
define ('DEFAULT_GEO_DB_UPDATES', AI_DISABLED);
|
754 |
define ('DEFAULT_CLOSE_BUTTON', AI_CLOSE_NONE);
|
|
|
|
|
755 |
define ('DEFAULT_SERVER_SIDE_INSERTION', AI_AUTOMATIC_INSERTION_FOOTER);
|
756 |
define ('DEFAULT_HTML_ELEMENT_INSERTION', AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY);
|
757 |
define ('DEFAULT_INSIDE_ELEMENT', AI_HTML_PREPEND_CONTENT);
|
29 |
define ('AD_INSERTER_NAME', 'Ad Inserter');
|
30 |
|
31 |
if (!defined( 'AD_INSERTER_VERSION'))
|
32 |
+
define ('AD_INSERTER_VERSION', '2.4.20');
|
33 |
|
34 |
if (!defined ('AD_INSERTER_PLUGIN_BASENAME'))
|
35 |
define ('AD_INSERTER_PLUGIN_BASENAME', plugin_basename (__FILE__));
|
152 |
define ('AI_OPTION_ADB_BLOCK_ACTION', 'adb-block-action');
|
153 |
define ('AI_OPTION_ADB_BLOCK_REPLACEMENT', 'adb-block-replacement');
|
154 |
define ('AI_OPTION_CLOSE_BUTTON', 'close-button');
|
155 |
+
define ('AI_OPTION_AUTO_CLOSE_TIME', 'auto-close-time');
|
156 |
+
define ('AI_OPTION_STAY_CLOSED_TIME', 'stay-closed-time');
|
157 |
define ('AI_OPTION_HORIZONTAL_MARGIN', 'horizontal-margin');
|
158 |
define ('AI_OPTION_VERTICAL_MARGIN', 'vertical-margin');
|
159 |
define ('AI_OPTION_ANIMATION', 'animation');
|
754 |
define ('DEFAULT_GEO_DB', AI_GEO_DB_WEBNET77);
|
755 |
define ('DEFAULT_GEO_DB_UPDATES', AI_DISABLED);
|
756 |
define ('DEFAULT_CLOSE_BUTTON', AI_CLOSE_NONE);
|
757 |
+
define ('DEFAULT_AUTO_CLOSE_TIME', '');
|
758 |
+
define ('DEFAULT_STAY_CLOSED_TIME', '');
|
759 |
define ('DEFAULT_SERVER_SIDE_INSERTION', AI_AUTOMATIC_INSERTION_FOOTER);
|
760 |
define ('DEFAULT_HTML_ELEMENT_INSERTION', AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY);
|
761 |
define ('DEFAULT_INSIDE_ELEMENT', AI_HTML_PREPEND_CONTENT);
|
css/ai-settings.css
CHANGED
@@ -1,14 +1,24 @@
|
|
1 |
#ai-data {
|
2 |
-
font-family: "2.4.
|
3 |
}
|
4 |
|
5 |
#blocked-warning {
|
6 |
display: none;
|
7 |
}
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
.ui-widget, .ai-form td {
|
10 |
-
|
11 |
-
|
12 |
}
|
13 |
|
14 |
.ai-form .ui-widget {
|
@@ -311,7 +321,7 @@ div.ai-tooltip .version {
|
|
311 |
|
312 |
#ai-plugin-settings-tabs li a {
|
313 |
padding: .5em 0.4em;
|
314 |
-
font-size:
|
315 |
/* max-width: 83px;*/
|
316 |
/* overflow: hidden;*/
|
317 |
/* text-overflow: ellipsis;*/
|
@@ -353,6 +363,7 @@ textarea.simple-editor.small {
|
|
353 |
|
354 |
.ms-container .ms-selectable, .ms-container .ms-selection {
|
355 |
width: 47%;
|
|
|
356 |
}
|
357 |
|
358 |
.ms-container .ms-selectable li.ms-elem-selectable, .ms-container .ms-selection li.ms-elem-selection {
|
1 |
#ai-data {
|
2 |
+
font-family: "2.4.20"; /* Used for version number of the file */
|
3 |
}
|
4 |
|
5 |
#blocked-warning {
|
6 |
display: none;
|
7 |
}
|
8 |
|
9 |
+
hr {
|
10 |
+
border: 0;
|
11 |
+
border-top: 1px solid #ddd;
|
12 |
+
border-bottom: 1px solid #fafafa;
|
13 |
+
display: block;
|
14 |
+
unicode-bidi: isolate;
|
15 |
+
margin: 0.5em 0;
|
16 |
+
overflow: hidden;
|
17 |
+
}
|
18 |
+
|
19 |
.ui-widget, .ai-form td {
|
20 |
+
font-family: Arial,Verdana,sans-serif;
|
21 |
+
font-size: 12px!important;
|
22 |
}
|
23 |
|
24 |
.ai-form .ui-widget {
|
321 |
|
322 |
#ai-plugin-settings-tabs li a {
|
323 |
padding: .5em 0.4em;
|
324 |
+
font-size: 11.4px;
|
325 |
/* max-width: 83px;*/
|
326 |
/* overflow: hidden;*/
|
327 |
/* text-overflow: ellipsis;*/
|
363 |
|
364 |
.ms-container .ms-selectable, .ms-container .ms-selection {
|
365 |
width: 47%;
|
366 |
+
max-width: 340px;
|
367 |
}
|
368 |
|
369 |
.ms-container .ms-selectable li.ms-elem-selectable, .ms-container .ms-selection li.ms-elem-selection {
|
includes/js/ai-adb.js
CHANGED
@@ -223,24 +223,27 @@ var ai_adb_detected = function(n) {
|
|
223 |
});
|
224 |
|
225 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING action check");
|
226 |
-
//
|
227 |
|
228 |
if (ai_adb_page_views != 0) {
|
229 |
var ai_adb_page_view_counter = 1;
|
230 |
-
var cookie = $.cookie (ai_adb_pgv_cookie_name);
|
|
|
231 |
if (typeof cookie != "undefined") ai_adb_page_view_counter = parseInt (cookie) + 1;
|
232 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING page views cookie:", cookie, "- page view:", ai_adb_page_view_counter);
|
233 |
if (ai_adb_page_view_counter < ai_adb_page_views) {
|
234 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING", ai_adb_page_views, "page views not reached, no action");
|
235 |
var d1 = ai_adb_page_view_counter;
|
236 |
var AI_ADB_STATUS_MESSAGE=1;
|
237 |
-
$.cookie (ai_adb_pgv_cookie_name, ai_adb_page_view_counter, {expires: 365, path: "/"});
|
|
|
238 |
return;
|
239 |
}
|
240 |
}
|
241 |
|
242 |
if (ai_adb_message_cookie_lifetime != 0 && (ai_adb_action != 1 || !ai_adb_message_undismissible)) {
|
243 |
-
var cookie = $.cookie (ai_adb_act_cookie_name);
|
|
|
244 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING cookie:", cookie);
|
245 |
if (typeof cookie != "undefined" && cookie == "AI_CONST_AI_ADB_COOKIE_VALUE") {
|
246 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING valid cookie detected, no action");
|
@@ -249,8 +252,11 @@ var ai_adb_detected = function(n) {
|
|
249 |
}
|
250 |
|
251 |
else if (ai_adb_debugging) console.log ("AI AD BLOCKING invalid cookie");
|
252 |
-
$.cookie (ai_adb_act_cookie_name, "AI_CONST_AI_ADB_COOKIE_VALUE", {expires: ai_adb_message_cookie_lifetime, path: "/"});
|
253 |
-
|
|
|
|
|
|
|
254 |
|
255 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING action", ai_adb_action);
|
256 |
|
@@ -283,7 +289,7 @@ var ai_adb_detected = function(n) {
|
|
283 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING MESSAGE click detection installed");
|
284 |
|
285 |
} else {
|
286 |
-
//
|
287 |
}
|
288 |
|
289 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING MESSAGE");
|
@@ -301,11 +307,13 @@ var ai_adb_detected = function(n) {
|
|
301 |
}
|
302 |
|
303 |
if (redirect) {
|
304 |
-
var cookie = $.cookie (ai_adb_page_redirection_cookie_name);
|
|
|
305 |
if (typeof cookie == "undefined") {
|
306 |
var date = new Date();
|
307 |
date.setTime (date.getTime() + (10 * 1000));
|
308 |
-
$.cookie (ai_adb_page_redirection_cookie_name, window.location.href, {expires: date, path: "/" });
|
|
|
309 |
|
310 |
window.location.replace (ai_adb_redirection_url)
|
311 |
} else {
|
@@ -314,7 +322,8 @@ var ai_adb_detected = function(n) {
|
|
314 |
}
|
315 |
} else {
|
316 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING already on page", window.location.href);
|
317 |
-
jQuery.removeCookie (ai_adb_page_redirection_cookie_name, {path: "/"});
|
|
|
318 |
}
|
319 |
}
|
320 |
break;
|
@@ -347,10 +356,12 @@ var ai_adb_undetected = function(n) {
|
|
347 |
// }
|
348 |
|
349 |
// if (redirected_page) {
|
350 |
-
// var cookie = jQuery.cookie (ai_adb_page_redirection_cookie_name);
|
|
|
351 |
// if (typeof cookie != "undefined" && cookie.toLowerCase().substring (0, 4) == "http") {
|
352 |
// if (ai_adb_debugging) console.log ("AI AD BLOCKING returning to", cookie);
|
353 |
-
// jQuery.removeCookie (ai_adb_page_redirection_cookie_name, {path: "/"});
|
|
|
354 |
// window.location.replace (cookie);
|
355 |
// }
|
356 |
// }
|
@@ -376,8 +387,10 @@ jQuery (document).ready (function ($) {
|
|
376 |
$(window).ready (function () {
|
377 |
|
378 |
$("#ai-adb-bar").click (function () {
|
379 |
-
$.removeCookie (ai_adb_act_cookie_name, {path: "/" });
|
380 |
-
$.removeCookie (ai_adb_pgv_cookie_name, {path: "/" });
|
|
|
|
|
381 |
var AI_ADB_STATUS_MESSAGE=5;
|
382 |
var ai_dummy = 0; // Do not remove - to keep semicolon above
|
383 |
});
|
@@ -453,121 +466,3 @@ jQuery (window).on ('load', function () {
|
|
453 |
}
|
454 |
});
|
455 |
|
456 |
-
/*!
|
457 |
-
* jQuery Cookie Plugin v1.4.1
|
458 |
-
* https://github.com/carhartl/jquery-cookie
|
459 |
-
*
|
460 |
-
* Copyright 2013 Klaus Hartl
|
461 |
-
* Released under the MIT license
|
462 |
-
*/
|
463 |
-
(function (factory) {
|
464 |
-
if (typeof define === "function" && define.amd) {
|
465 |
-
// AMD
|
466 |
-
define(["jquery"], factory);
|
467 |
-
} else if (typeof exports === "object") {
|
468 |
-
// CommonJS
|
469 |
-
factory(require("jquery"));
|
470 |
-
} else {
|
471 |
-
// Browser globals
|
472 |
-
factory(jQuery);
|
473 |
-
}
|
474 |
-
}(function ($) {
|
475 |
-
|
476 |
-
var pluses = /\+/g;
|
477 |
-
|
478 |
-
function encode(s) {
|
479 |
-
return config.raw ? s : encodeURIComponent(s);
|
480 |
-
}
|
481 |
-
|
482 |
-
function decode(s) {
|
483 |
-
return config.raw ? s : decodeURIComponent(s);
|
484 |
-
}
|
485 |
-
|
486 |
-
function stringifyCookieValue(value) {
|
487 |
-
return encode(config.json ? JSON.stringify(value) : String(value));
|
488 |
-
}
|
489 |
-
|
490 |
-
function parseCookieValue(s) {
|
491 |
-
if (s.indexOf('"') === 0) {
|
492 |
-
// This is a quoted cookie as according to RFC2068, unescape...
|
493 |
-
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
494 |
-
}
|
495 |
-
|
496 |
-
try {
|
497 |
-
// Replace server-side written pluses with spaces.
|
498 |
-
// If we can\'t decode the cookie, ignore it, it\'s unusable.
|
499 |
-
// If we can\'t parse the cookie, ignore it, it\'s unusable.
|
500 |
-
s = decodeURIComponent(s.replace(pluses, " "));
|
501 |
-
return config.json ? JSON.parse(s) : s;
|
502 |
-
} catch(e) {}
|
503 |
-
}
|
504 |
-
|
505 |
-
function read(s, converter) {
|
506 |
-
var value = config.raw ? s : parseCookieValue(s);
|
507 |
-
return $.isFunction(converter) ? converter(value) : value;
|
508 |
-
}
|
509 |
-
|
510 |
-
var config = $.cookie = function (key, value, options) {
|
511 |
-
|
512 |
-
// Write
|
513 |
-
|
514 |
-
if (value !== undefined && !$.isFunction(value)) {
|
515 |
-
options = $.extend({}, config.defaults, options);
|
516 |
-
|
517 |
-
if (typeof options.expires === "number") {
|
518 |
-
var days = options.expires, t = options.expires = new Date();
|
519 |
-
t.setTime(+t + days * 864e+5);
|
520 |
-
}
|
521 |
-
|
522 |
-
return (document.cookie = [
|
523 |
-
encode(key), "=", stringifyCookieValue(value),
|
524 |
-
options.expires ? "; expires=" + options.expires.toUTCString() : "", // use expires attribute, max-age is not supported by IE
|
525 |
-
options.path ? "; path=" + options.path : "",
|
526 |
-
options.domain ? "; domain=" + options.domain : "",
|
527 |
-
options.secure ? "; secure" : ""
|
528 |
-
].join(""));
|
529 |
-
}
|
530 |
-
|
531 |
-
// Read
|
532 |
-
|
533 |
-
var result = key ? undefined : {};
|
534 |
-
|
535 |
-
// To prevent the for loop in the first place assign an empty array
|
536 |
-
// in case there are no cookies at all. Also prevents odd result when
|
537 |
-
// calling $.cookie().
|
538 |
-
var cookies = document.cookie ? document.cookie.split("; ") : [];
|
539 |
-
|
540 |
-
for (var i = 0, l = cookies.length; i < l; i++) {
|
541 |
-
var parts = cookies[i].split("=");
|
542 |
-
var name = decode(parts.shift());
|
543 |
-
var cookie = parts.join("=");
|
544 |
-
|
545 |
-
if (key && key === name) {
|
546 |
-
// If second argument (value) is a function it\'s a converter...
|
547 |
-
result = read(cookie, value);
|
548 |
-
break;
|
549 |
-
}
|
550 |
-
|
551 |
-
// Prevent storing a cookie that we couldn\'t decode.
|
552 |
-
if (!key && (cookie = read(cookie)) !== undefined) {
|
553 |
-
result[name] = cookie;
|
554 |
-
}
|
555 |
-
}
|
556 |
-
|
557 |
-
return result;
|
558 |
-
};
|
559 |
-
|
560 |
-
config.defaults = {};
|
561 |
-
|
562 |
-
$.removeCookie = function (key, options) {
|
563 |
-
if ($.cookie(key) === undefined) {
|
564 |
-
return false;
|
565 |
-
}
|
566 |
-
|
567 |
-
// Must not alter options, thus extending a fresh object...
|
568 |
-
$.cookie(key, "", $.extend({}, options, { expires: -1 }));
|
569 |
-
return !$.cookie(key);
|
570 |
-
};
|
571 |
-
|
572 |
-
}));
|
573 |
-
|
223 |
});
|
224 |
|
225 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING action check");
|
226 |
+
// AiCookies.remove (ai_adb_pgv_cookie_name, {path: "/" });
|
227 |
|
228 |
if (ai_adb_page_views != 0) {
|
229 |
var ai_adb_page_view_counter = 1;
|
230 |
+
// var cookie = $.cookie (ai_adb_pgv_cookie_name);
|
231 |
+
var cookie = AiCookies.get (ai_adb_pgv_cookie_name);
|
232 |
if (typeof cookie != "undefined") ai_adb_page_view_counter = parseInt (cookie) + 1;
|
233 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING page views cookie:", cookie, "- page view:", ai_adb_page_view_counter);
|
234 |
if (ai_adb_page_view_counter < ai_adb_page_views) {
|
235 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING", ai_adb_page_views, "page views not reached, no action");
|
236 |
var d1 = ai_adb_page_view_counter;
|
237 |
var AI_ADB_STATUS_MESSAGE=1;
|
238 |
+
// $.cookie (ai_adb_pgv_cookie_name, ai_adb_page_view_counter, {expires: 365, path: "/"});
|
239 |
+
AiCookies.set (ai_adb_pgv_cookie_name, ai_adb_page_view_counter, {expires: 365, path: "/"});
|
240 |
return;
|
241 |
}
|
242 |
}
|
243 |
|
244 |
if (ai_adb_message_cookie_lifetime != 0 && (ai_adb_action != 1 || !ai_adb_message_undismissible)) {
|
245 |
+
// var cookie = $.cookie (ai_adb_act_cookie_name);
|
246 |
+
var cookie = AiCookies.get (ai_adb_act_cookie_name);
|
247 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING cookie:", cookie);
|
248 |
if (typeof cookie != "undefined" && cookie == "AI_CONST_AI_ADB_COOKIE_VALUE") {
|
249 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING valid cookie detected, no action");
|
252 |
}
|
253 |
|
254 |
else if (ai_adb_debugging) console.log ("AI AD BLOCKING invalid cookie");
|
255 |
+
// $.cookie (ai_adb_act_cookie_name, "AI_CONST_AI_ADB_COOKIE_VALUE", {expires: ai_adb_message_cookie_lifetime, path: "/"});
|
256 |
+
AiCookies.set (ai_adb_act_cookie_name, "AI_CONST_AI_ADB_COOKIE_VALUE", {expires: ai_adb_message_cookie_lifetime, path: "/"});
|
257 |
+
} else
|
258 |
+
// $.removeCookie (ai_adb_act_cookie_name, {path: "/" });
|
259 |
+
AiCookies.remove (ai_adb_act_cookie_name, {path: "/" });
|
260 |
|
261 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING action", ai_adb_action);
|
262 |
|
289 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING MESSAGE click detection installed");
|
290 |
|
291 |
} else {
|
292 |
+
// AiCookies.remove (ai_adb_act_cookie_name, {path: "/" });
|
293 |
}
|
294 |
|
295 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING MESSAGE");
|
307 |
}
|
308 |
|
309 |
if (redirect) {
|
310 |
+
// var cookie = $.cookie (ai_adb_page_redirection_cookie_name);
|
311 |
+
var cookie = AiCookies.get (ai_adb_page_redirection_cookie_name);
|
312 |
if (typeof cookie == "undefined") {
|
313 |
var date = new Date();
|
314 |
date.setTime (date.getTime() + (10 * 1000));
|
315 |
+
// $.cookie (ai_adb_page_redirection_cookie_name, window.location.href, {expires: date, path: "/" });
|
316 |
+
AiCookies.set (ai_adb_page_redirection_cookie_name, window.location.href, {expires: date, path: "/" });
|
317 |
|
318 |
window.location.replace (ai_adb_redirection_url)
|
319 |
} else {
|
322 |
}
|
323 |
} else {
|
324 |
if (ai_adb_debugging) console.log ("AI AD BLOCKING already on page", window.location.href);
|
325 |
+
// jQuery.removeCookie (ai_adb_page_redirection_cookie_name, {path: "/"});
|
326 |
+
AiCookies.remove (ai_adb_page_redirection_cookie_name, {path: "/"});
|
327 |
}
|
328 |
}
|
329 |
break;
|
356 |
// }
|
357 |
|
358 |
// if (redirected_page) {
|
359 |
+
// //var cookie = jQuery.cookie (ai_adb_page_redirection_cookie_name);
|
360 |
+
// var cookie = AiCookies.get (ai_adb_page_redirection_cookie_name);
|
361 |
// if (typeof cookie != "undefined" && cookie.toLowerCase().substring (0, 4) == "http") {
|
362 |
// if (ai_adb_debugging) console.log ("AI AD BLOCKING returning to", cookie);
|
363 |
+
// //jQuery.removeCookie (ai_adb_page_redirection_cookie_name, {path: "/"});
|
364 |
+
// AiCookies.remove (ai_adb_page_redirection_cookie_name, {path: "/"});
|
365 |
// window.location.replace (cookie);
|
366 |
// }
|
367 |
// }
|
387 |
$(window).ready (function () {
|
388 |
|
389 |
$("#ai-adb-bar").click (function () {
|
390 |
+
// $.removeCookie (ai_adb_act_cookie_name, {path: "/" });
|
391 |
+
// $.removeCookie (ai_adb_pgv_cookie_name, {path: "/" });
|
392 |
+
AiCookies.remove (ai_adb_act_cookie_name, {path: "/" });
|
393 |
+
AiCookies.remove (ai_adb_pgv_cookie_name, {path: "/" });
|
394 |
var AI_ADB_STATUS_MESSAGE=5;
|
395 |
var ai_dummy = 0; // Do not remove - to keep semicolon above
|
396 |
});
|
466 |
}
|
467 |
});
|
468 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/js/ai-adb.min.js
CHANGED
@@ -1,10 +1,3 @@
|
|
1 |
-
/*
|
2 |
-
jQuery Cookie Plugin v1.4.1
|
3 |
-
https://github.com/carhartl/jquery-cookie
|
4 |
-
|
5 |
-
Copyright 2013 Klaus Hartl
|
6 |
-
Released under the MIT license
|
7 |
-
*/
|
8 |
function b64e(str){return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,function toSolidBytes(match,p1){return String.fromCharCode("0x"+p1)}))}function b64d(str){return decodeURIComponent(atob(str).split("").map(function(c){return"%"+("00"+c.charCodeAt(0).toString(16)).slice(-2)}).join(""))}var ai_adb=false;var ai_adb_debugging=typeof ai_debugging!=="undefined";var ai_adb_active=false;var ai_adb_counter=0;var ai_adb_overlay=AI_ADB_OVERLAY_WINDOW;var ai_adb_message_window=AI_ADB_MESSAGE_WINDOW;
|
9 |
var ai_adb_message_undismissible=AI_FUNCB_GET_UNDISMISSIBLE_MESSAGE;var ai_adb_act_cookie_name="aiADB";var ai_adb_pgv_cookie_name="aiADB_PV";var ai_adb_page_redirection_cookie_name="aiADB_PR";var ai_adb_message_cookie_lifetime=AI_FUNCT_GET_NO_ACTION_PERIOD;var ai_adb_action=AI_FUNC_GET_ADB_ACTION;var ai_adb_page_views=AI_FUNCT_GET_DELAY_ACTION;var ai_adb_selectors="AI_ADB_SELECTORS";var ai_adb_redirection_url="AI_ADB_REDIRECTION_PAGE";
|
10 |
function ai_adb_process_content(){(function($){if(ai_adb_debugging)console.log("");if(ai_adb_debugging)console.log("AI AD BLOCKING CONTENT PROCESSING");$(".AI_ADB_CONTENT_CSS_BEGIN_CLASS").each(function(){var ai_adb_parent=$(this).parent();if(ai_adb_debugging)console.log("AI AD BLOCKING parent",ai_adb_parent.prop("tagName"),'id="'+ai_adb_parent.attr("id")+'"','class="'+ai_adb_parent.attr("class")+'"');var ai_adb_css=$(this).data("css");if(typeof ai_adb_css=="undefined")ai_adb_css="display: none !important;";
|
@@ -18,20 +11,16 @@ ai_adb_detection_type=function(n){switch(n){case 0:return"0 debugging";break;cas
|
|
18 |
var ai_adb_detected=function(n){if(ai_adb_debugging&&n==0)console.log("");if(ai_adb_debugging)console.log("AI AD BLOCKING DETECTED",ai_adb_detection_type(n));if(!ai_adb_active){ai_adb_active=true;(function($){$(window).ready(function(){if(ai_adb_debugging)console.log("AI AD BLOCKING block actions");$(".ai-adb-hide").each(function(){$(this).css({"display":"none","visibility":"hidden"});var wrapping_div=$(this).closest("div[data-ai]");if(typeof wrapping_div.data("ai")!="undefined"){var data=JSON.parse(b64d(wrapping_div.data("ai")));
|
19 |
if(typeof data!=="undefined"&&data.constructor===Array){data[1]="";wrapping_div.data("ai",b64e(JSON.stringify(data)))}}if(ai_adb_debugging){var debug_info=$(this).data("ai-debug");console.log("AI AD BLOCKING HIDE",typeof debug_info!="undefined"?debug_info:"")}});$(".ai-adb-show").each(function(){$(this).css({"display":"block","visibility":"visible"});var tracking_data=$(this).data("ai-tracking");if(typeof tracking_data!="undefined"){var wrapping_div=$(this).closest("div[data-ai]");if(typeof wrapping_div.data("ai")!=
|
20 |
"undefined"){if($(this).hasClass("ai-no-tracking")){var data=JSON.parse(b64d(wrapping_div.data("ai")));if(typeof data!=="undefined"&&data.constructor===Array){data[1]="";tracking_data=b64e(JSON.stringify(data))}}wrapping_div.data("ai",tracking_data)}}if(ai_adb_debugging){var debug_info=$(this).data("ai-debug");console.log("AI AD BLOCKING SHOW",typeof debug_info!="undefined"?debug_info:"")}});setTimeout(ai_adb_process_content,10)});if(ai_adb_debugging)console.log("AI AD BLOCKING action check");if(ai_adb_page_views!=
|
21 |
-
0){var ai_adb_page_view_counter=1;var cookie
|
22 |
-
ai_adb_page_view_counter,{expires:365,path:"/"});return}}if(ai_adb_message_cookie_lifetime!=0&&(ai_adb_action!=1||!ai_adb_message_undismissible)){var cookie
|
23 |
-
|
24 |
"pointer");ai_adb_message_window.click(function(){$(this).remove();ai_adb_overlay.remove()}).css("cursor","pointer");window.onkeydown=function(event){if(event.keyCode===27){ai_adb_overlay.click();ai_adb_message_window.click()}};if(ai_adb_debugging)console.log("AI AD BLOCKING MESSAGE click detection installed")}else;if(ai_adb_debugging)console.log("AI AD BLOCKING MESSAGE");$("body").prepend(ai_adb_overlay).prepend(ai_adb_message_window);break;case 2:if(ai_adb_redirection_url!=""){if(ai_adb_debugging)console.log("AI AD BLOCKING REDIRECTION to",
|
25 |
-
ai_adb_redirection_url);var redirect=true;if(ai_adb_redirection_url.toLowerCase().substring(0,4)=="http"){if(window.location.href==ai_adb_redirection_url)var redirect=false}else if(window.location.pathname==ai_adb_redirection_url)var redirect=false;if(redirect){var cookie
|
26 |
-
cookie)}else{if(ai_adb_debugging)console.log("AI AD BLOCKING already on page",window.location.href);
|
27 |
var ai_adb_undetected=function(n){ai_adb_counter++;if(ai_adb_debugging&&n==1)console.log("");if(ai_adb_debugging)console.log("AI AD BLOCKING not detected:","("+ai_adb_counter+")",ai_adb_detection_type(n));if(!ai_adb_active&&ai_adb_counter==4){if(ai_adb_debugging)console.log("AI AD BLOCKING NOT DETECTED");var AI_ADB_STATUS_MESSAGE=4;var ai_dummy=0}};if(AI_DBG_AI_DEBUG_AD_BLOCKING)jQuery(document).ready(function(){ai_adb_detected(0)});
|
28 |
if(!document.getElementById("AI_CONST_AI_ADB_1_NAME"))jQuery(document).ready(function(){if(!ai_adb_active||ai_adb_debugging)ai_adb_detected(1)});else jQuery(document).ready(function(){ai_adb_undetected(1)});if(typeof window.AI_CONST_AI_ADB_2_NAME=="undefined")jQuery(document).ready(function(){if(!ai_adb_active||ai_adb_debugging)ai_adb_detected(2)});else jQuery(document).ready(function(){ai_adb_undetected(2)});
|
29 |
-
jQuery(document).ready(function($){$(window).ready(function(){$("#ai-adb-bar").click(function(){
|
30 |
ai_adb_debugging)&&ai_adb_selectors!=""){var ai_adb_el_counter=0;var ai_adb_el_zero=0;var ai_adb_selector=ai_adb_selectors.split(",");$.each(ai_adb_selector,function(i){ai_adb_selector[i]=ai_adb_selector[i].trim();if(ai_adb_debugging)console.log("AI AD BLOCKING selector",ai_adb_selector[i]);if($(ai_adb_selector[i]).length!=0)$(ai_adb_selector[i]).each(function(n){var outer_height=$(this).outerHeight();if(ai_adb_debugging)console.log('AI AD BLOCKING element id="'+$(this).attr("id")+'" class="'+$(this).attr("class")+
|
31 |
'" heights:',$(this).outerHeight(),$(this).innerHeight(),$(this).height());var ai_attributes=$(this).find(".ai-attributes");if(ai_attributes.length)ai_attributes.each(function(){if(ai_adb_debugging)console.log("AI AD BLOCKING attributes height:",$(this).outerHeight());if(outer_height>=$(this).outerHeight())outer_height-=$(this).outerHeight()});if(ai_adb_debugging)console.log("AI AD BLOCKING effective height:",outer_height);ai_adb_el_counter++;if(outer_height===0){$(document).ready(function(){if(!ai_adb_active||
|
32 |
ai_adb_debugging)ai_adb_detected(4)});ai_adb_el_zero++;if(!ai_adb_debugging)return false}})});if(ai_adb_el_counter!=0&&ai_adb_el_zero==0)$(document).ready(function(){ai_adb_undetected(4)})}})});
|
33 |
jQuery(window).on("load",function(){if(ai_adb_debugging)console.log("AI AD BLOCKING window load");if(!(typeof ga=="function"&&ga.toString().length>30))jQuery(document).ready(function(){if(!ai_adb_active||ai_adb_debugging)ai_adb_detected(5)});else jQuery(document).ready(function(){ai_adb_undetected(5)});if(!(typeof _mNDetails=="object"&&JSON.stringify(_mNDetails).length>400))jQuery(document).ready(function(){if(!ai_adb_active||ai_adb_debugging)ai_adb_detected(6)});else jQuery(document).ready(function(){ai_adb_undetected(6)})});
|
34 |
-
(function(factory){if(typeof define==="function"&&define.amd)define(["jquery"],factory);else if(typeof exports==="object")factory(require("jquery"));else factory(jQuery)})(function($){var pluses=/\+/g;function encode(s){return config.raw?s:encodeURIComponent(s)}function decode(s){return config.raw?s:decodeURIComponent(s)}function stringifyCookieValue(value){return encode(config.json?JSON.stringify(value):String(value))}function parseCookieValue(s){if(s.indexOf('"')===0)s=s.slice(1,-1).replace(/\\"/g,
|
35 |
-
'"').replace(/\\\\/g,"\\");try{s=decodeURIComponent(s.replace(pluses," "));return config.json?JSON.parse(s):s}catch(e){}}function read(s,converter){var value=config.raw?s:parseCookieValue(s);return $.isFunction(converter)?converter(value):value}var config=$.cookie=function(key,value,options){if(value!==undefined&&!$.isFunction(value)){options=$.extend({},config.defaults,options);if(typeof options.expires==="number"){var days=options.expires,t=options.expires=new Date;t.setTime(+t+days*864E5)}return document.cookie=
|
36 |
-
[encode(key),"=",stringifyCookieValue(value),options.expires?"; expires="+options.expires.toUTCString():"",options.path?"; path="+options.path:"",options.domain?"; domain="+options.domain:"",options.secure?"; secure":""].join("")}var result=key?undefined:{};var cookies=document.cookie?document.cookie.split("; "):[];for(var i=0,l=cookies.length;i<l;i++){var parts=cookies[i].split("=");var name=decode(parts.shift());var cookie=parts.join("=");if(key&&key===name){result=read(cookie,value);break}if(!key&&
|
37 |
-
(cookie=read(cookie))!==undefined)result[name]=cookie}return result};config.defaults={};$.removeCookie=function(key,options){if($.cookie(key)===undefined)return false;$.cookie(key,"",$.extend({},options,{expires:-1}));return!$.cookie(key)}});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
function b64e(str){return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,function toSolidBytes(match,p1){return String.fromCharCode("0x"+p1)}))}function b64d(str){return decodeURIComponent(atob(str).split("").map(function(c){return"%"+("00"+c.charCodeAt(0).toString(16)).slice(-2)}).join(""))}var ai_adb=false;var ai_adb_debugging=typeof ai_debugging!=="undefined";var ai_adb_active=false;var ai_adb_counter=0;var ai_adb_overlay=AI_ADB_OVERLAY_WINDOW;var ai_adb_message_window=AI_ADB_MESSAGE_WINDOW;
|
2 |
var ai_adb_message_undismissible=AI_FUNCB_GET_UNDISMISSIBLE_MESSAGE;var ai_adb_act_cookie_name="aiADB";var ai_adb_pgv_cookie_name="aiADB_PV";var ai_adb_page_redirection_cookie_name="aiADB_PR";var ai_adb_message_cookie_lifetime=AI_FUNCT_GET_NO_ACTION_PERIOD;var ai_adb_action=AI_FUNC_GET_ADB_ACTION;var ai_adb_page_views=AI_FUNCT_GET_DELAY_ACTION;var ai_adb_selectors="AI_ADB_SELECTORS";var ai_adb_redirection_url="AI_ADB_REDIRECTION_PAGE";
|
3 |
function ai_adb_process_content(){(function($){if(ai_adb_debugging)console.log("");if(ai_adb_debugging)console.log("AI AD BLOCKING CONTENT PROCESSING");$(".AI_ADB_CONTENT_CSS_BEGIN_CLASS").each(function(){var ai_adb_parent=$(this).parent();if(ai_adb_debugging)console.log("AI AD BLOCKING parent",ai_adb_parent.prop("tagName"),'id="'+ai_adb_parent.attr("id")+'"','class="'+ai_adb_parent.attr("class")+'"');var ai_adb_css=$(this).data("css");if(typeof ai_adb_css=="undefined")ai_adb_css="display: none !important;";
|
11 |
var ai_adb_detected=function(n){if(ai_adb_debugging&&n==0)console.log("");if(ai_adb_debugging)console.log("AI AD BLOCKING DETECTED",ai_adb_detection_type(n));if(!ai_adb_active){ai_adb_active=true;(function($){$(window).ready(function(){if(ai_adb_debugging)console.log("AI AD BLOCKING block actions");$(".ai-adb-hide").each(function(){$(this).css({"display":"none","visibility":"hidden"});var wrapping_div=$(this).closest("div[data-ai]");if(typeof wrapping_div.data("ai")!="undefined"){var data=JSON.parse(b64d(wrapping_div.data("ai")));
|
12 |
if(typeof data!=="undefined"&&data.constructor===Array){data[1]="";wrapping_div.data("ai",b64e(JSON.stringify(data)))}}if(ai_adb_debugging){var debug_info=$(this).data("ai-debug");console.log("AI AD BLOCKING HIDE",typeof debug_info!="undefined"?debug_info:"")}});$(".ai-adb-show").each(function(){$(this).css({"display":"block","visibility":"visible"});var tracking_data=$(this).data("ai-tracking");if(typeof tracking_data!="undefined"){var wrapping_div=$(this).closest("div[data-ai]");if(typeof wrapping_div.data("ai")!=
|
13 |
"undefined"){if($(this).hasClass("ai-no-tracking")){var data=JSON.parse(b64d(wrapping_div.data("ai")));if(typeof data!=="undefined"&&data.constructor===Array){data[1]="";tracking_data=b64e(JSON.stringify(data))}}wrapping_div.data("ai",tracking_data)}}if(ai_adb_debugging){var debug_info=$(this).data("ai-debug");console.log("AI AD BLOCKING SHOW",typeof debug_info!="undefined"?debug_info:"")}});setTimeout(ai_adb_process_content,10)});if(ai_adb_debugging)console.log("AI AD BLOCKING action check");if(ai_adb_page_views!=
|
14 |
+
0){var ai_adb_page_view_counter=1;var cookie=AiCookies.get(ai_adb_pgv_cookie_name);if(typeof cookie!="undefined")ai_adb_page_view_counter=parseInt(cookie)+1;if(ai_adb_debugging)console.log("AI AD BLOCKING page views cookie:",cookie,"- page view:",ai_adb_page_view_counter);if(ai_adb_page_view_counter<ai_adb_page_views){if(ai_adb_debugging)console.log("AI AD BLOCKING",ai_adb_page_views,"page views not reached, no action");var d1=ai_adb_page_view_counter;var AI_ADB_STATUS_MESSAGE=1;AiCookies.set(ai_adb_pgv_cookie_name,
|
15 |
+
ai_adb_page_view_counter,{expires:365,path:"/"});return}}if(ai_adb_message_cookie_lifetime!=0&&(ai_adb_action!=1||!ai_adb_message_undismissible)){var cookie=AiCookies.get(ai_adb_act_cookie_name);if(ai_adb_debugging)console.log("AI AD BLOCKING cookie:",cookie);if(typeof cookie!="undefined"&&cookie=="AI_CONST_AI_ADB_COOKIE_VALUE"){if(ai_adb_debugging)console.log("AI AD BLOCKING valid cookie detected, no action");var AI_ADB_STATUS_MESSAGE=2;return}else if(ai_adb_debugging)console.log("AI AD BLOCKING invalid cookie");
|
16 |
+
AiCookies.set(ai_adb_act_cookie_name,"AI_CONST_AI_ADB_COOKIE_VALUE",{expires:ai_adb_message_cookie_lifetime,path:"/"})}else AiCookies.remove(ai_adb_act_cookie_name,{path:"/"});if(ai_adb_debugging)console.log("AI AD BLOCKING action",ai_adb_action);if(ai_adb_action==0){var AI_ADB_STATUS_MESSAGE=6;var ai_dummy=0}else{var AI_ADB_STATUS_MESSAGE=3;var ai_dummy=0}switch(ai_adb_action){case 1:if(!ai_adb_message_undismissible){ai_adb_overlay.click(function(){$(this).remove();ai_adb_message_window.remove()}).css("cursor",
|
17 |
"pointer");ai_adb_message_window.click(function(){$(this).remove();ai_adb_overlay.remove()}).css("cursor","pointer");window.onkeydown=function(event){if(event.keyCode===27){ai_adb_overlay.click();ai_adb_message_window.click()}};if(ai_adb_debugging)console.log("AI AD BLOCKING MESSAGE click detection installed")}else;if(ai_adb_debugging)console.log("AI AD BLOCKING MESSAGE");$("body").prepend(ai_adb_overlay).prepend(ai_adb_message_window);break;case 2:if(ai_adb_redirection_url!=""){if(ai_adb_debugging)console.log("AI AD BLOCKING REDIRECTION to",
|
18 |
+
ai_adb_redirection_url);var redirect=true;if(ai_adb_redirection_url.toLowerCase().substring(0,4)=="http"){if(window.location.href==ai_adb_redirection_url)var redirect=false}else if(window.location.pathname==ai_adb_redirection_url)var redirect=false;if(redirect){var cookie=AiCookies.get(ai_adb_page_redirection_cookie_name);if(typeof cookie=="undefined"){var date=new Date;date.setTime(date.getTime()+10*1E3);AiCookies.set(ai_adb_page_redirection_cookie_name,window.location.href,{expires:date,path:"/"});
|
19 |
+
window.location.replace(ai_adb_redirection_url)}else if(ai_adb_debugging)console.log("AI AD BLOCKING no redirection, cookie:",cookie)}else{if(ai_adb_debugging)console.log("AI AD BLOCKING already on page",window.location.href);AiCookies.remove(ai_adb_page_redirection_cookie_name,{path:"/"})}}break}})(jQuery);ai_adb=true}};
|
20 |
var ai_adb_undetected=function(n){ai_adb_counter++;if(ai_adb_debugging&&n==1)console.log("");if(ai_adb_debugging)console.log("AI AD BLOCKING not detected:","("+ai_adb_counter+")",ai_adb_detection_type(n));if(!ai_adb_active&&ai_adb_counter==4){if(ai_adb_debugging)console.log("AI AD BLOCKING NOT DETECTED");var AI_ADB_STATUS_MESSAGE=4;var ai_dummy=0}};if(AI_DBG_AI_DEBUG_AD_BLOCKING)jQuery(document).ready(function(){ai_adb_detected(0)});
|
21 |
if(!document.getElementById("AI_CONST_AI_ADB_1_NAME"))jQuery(document).ready(function(){if(!ai_adb_active||ai_adb_debugging)ai_adb_detected(1)});else jQuery(document).ready(function(){ai_adb_undetected(1)});if(typeof window.AI_CONST_AI_ADB_2_NAME=="undefined")jQuery(document).ready(function(){if(!ai_adb_active||ai_adb_debugging)ai_adb_detected(2)});else jQuery(document).ready(function(){ai_adb_undetected(2)});
|
22 |
+
jQuery(document).ready(function($){$(window).ready(function(){$("#ai-adb-bar").click(function(){AiCookies.remove(ai_adb_act_cookie_name,{path:"/"});AiCookies.remove(ai_adb_pgv_cookie_name,{path:"/"});var AI_ADB_STATUS_MESSAGE=5;var ai_dummy=0});if($("#banner-advert-container img").length>0){if($("#banner-advert-container img").outerHeight()===0)$(document).ready(function(){if(!ai_adb_active||ai_adb_debugging)ai_adb_detected(3)});else $(document).ready(function(){ai_adb_undetected(3)});$("#banner-advert-container img").remove()}if((!ai_adb_active||
|
23 |
ai_adb_debugging)&&ai_adb_selectors!=""){var ai_adb_el_counter=0;var ai_adb_el_zero=0;var ai_adb_selector=ai_adb_selectors.split(",");$.each(ai_adb_selector,function(i){ai_adb_selector[i]=ai_adb_selector[i].trim();if(ai_adb_debugging)console.log("AI AD BLOCKING selector",ai_adb_selector[i]);if($(ai_adb_selector[i]).length!=0)$(ai_adb_selector[i]).each(function(n){var outer_height=$(this).outerHeight();if(ai_adb_debugging)console.log('AI AD BLOCKING element id="'+$(this).attr("id")+'" class="'+$(this).attr("class")+
|
24 |
'" heights:',$(this).outerHeight(),$(this).innerHeight(),$(this).height());var ai_attributes=$(this).find(".ai-attributes");if(ai_attributes.length)ai_attributes.each(function(){if(ai_adb_debugging)console.log("AI AD BLOCKING attributes height:",$(this).outerHeight());if(outer_height>=$(this).outerHeight())outer_height-=$(this).outerHeight()});if(ai_adb_debugging)console.log("AI AD BLOCKING effective height:",outer_height);ai_adb_el_counter++;if(outer_height===0){$(document).ready(function(){if(!ai_adb_active||
|
25 |
ai_adb_debugging)ai_adb_detected(4)});ai_adb_el_zero++;if(!ai_adb_debugging)return false}})});if(ai_adb_el_counter!=0&&ai_adb_el_zero==0)$(document).ready(function(){ai_adb_undetected(4)})}})});
|
26 |
jQuery(window).on("load",function(){if(ai_adb_debugging)console.log("AI AD BLOCKING window load");if(!(typeof ga=="function"&&ga.toString().length>30))jQuery(document).ready(function(){if(!ai_adb_active||ai_adb_debugging)ai_adb_detected(5)});else jQuery(document).ready(function(){ai_adb_undetected(5)});if(!(typeof _mNDetails=="object"&&JSON.stringify(_mNDetails).length>400))jQuery(document).ready(function(){if(!ai_adb_active||ai_adb_debugging)ai_adb_detected(6)});else jQuery(document).ready(function(){ai_adb_undetected(6)})});
|
|
|
|
|
|
|
|
includes/js/ai-cookie.js
ADDED
@@ -0,0 +1,266 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* JavaScript Cookie v2.2.0
|
3 |
+
* https://github.com/js-cookie/js-cookie
|
4 |
+
*
|
5 |
+
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
6 |
+
* Released under the MIT license
|
7 |
+
*/
|
8 |
+
;(function (factory) {
|
9 |
+
var registeredInModuleLoader;
|
10 |
+
if (typeof define === 'function' && define.amd) {
|
11 |
+
define(factory);
|
12 |
+
registeredInModuleLoader = true;
|
13 |
+
}
|
14 |
+
if (typeof exports === 'object') {
|
15 |
+
module.exports = factory();
|
16 |
+
registeredInModuleLoader = true;
|
17 |
+
}
|
18 |
+
if (!registeredInModuleLoader) {
|
19 |
+
var OldCookies = window.Cookies;
|
20 |
+
var api = window.Cookies = factory();
|
21 |
+
api.noConflict = function () {
|
22 |
+
window.Cookies = OldCookies;
|
23 |
+
return api;
|
24 |
+
};
|
25 |
+
}
|
26 |
+
}(function () {
|
27 |
+
function extend () {
|
28 |
+
var i = 0;
|
29 |
+
var result = {};
|
30 |
+
for (; i < arguments.length; i++) {
|
31 |
+
var attributes = arguments[ i ];
|
32 |
+
for (var key in attributes) {
|
33 |
+
result[key] = attributes[key];
|
34 |
+
}
|
35 |
+
}
|
36 |
+
return result;
|
37 |
+
}
|
38 |
+
|
39 |
+
function decode (s) {
|
40 |
+
return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);
|
41 |
+
}
|
42 |
+
|
43 |
+
function init (converter) {
|
44 |
+
function api() {}
|
45 |
+
|
46 |
+
function set (key, value, attributes) {
|
47 |
+
if (typeof document === 'undefined') {
|
48 |
+
return;
|
49 |
+
}
|
50 |
+
|
51 |
+
attributes = extend({
|
52 |
+
path: '/'
|
53 |
+
}, api.defaults, attributes);
|
54 |
+
|
55 |
+
if (typeof attributes.expires === 'number') {
|
56 |
+
attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);
|
57 |
+
}
|
58 |
+
|
59 |
+
// We're using "expires" because "max-age" is not supported by IE
|
60 |
+
attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
|
61 |
+
|
62 |
+
try {
|
63 |
+
var result = JSON.stringify(value);
|
64 |
+
if (/^[\{\[]/.test(result)) {
|
65 |
+
value = result;
|
66 |
+
}
|
67 |
+
} catch (e) {}
|
68 |
+
|
69 |
+
value = converter.write ?
|
70 |
+
converter.write(value, key) :
|
71 |
+
encodeURIComponent(String(value))
|
72 |
+
.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
|
73 |
+
|
74 |
+
key = encodeURIComponent(String(key))
|
75 |
+
.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)
|
76 |
+
.replace(/[\(\)]/g, escape);
|
77 |
+
|
78 |
+
var stringifiedAttributes = '';
|
79 |
+
for (var attributeName in attributes) {
|
80 |
+
if (!attributes[attributeName]) {
|
81 |
+
continue;
|
82 |
+
}
|
83 |
+
stringifiedAttributes += '; ' + attributeName;
|
84 |
+
if (attributes[attributeName] === true) {
|
85 |
+
continue;
|
86 |
+
}
|
87 |
+
|
88 |
+
// Considers RFC 6265 section 5.2:
|
89 |
+
// ...
|
90 |
+
// 3. If the remaining unparsed-attributes contains a %x3B (";")
|
91 |
+
// character:
|
92 |
+
// Consume the characters of the unparsed-attributes up to,
|
93 |
+
// not including, the first %x3B (";") character.
|
94 |
+
// ...
|
95 |
+
stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
|
96 |
+
}
|
97 |
+
|
98 |
+
return (document.cookie = key + '=' + value + stringifiedAttributes);
|
99 |
+
}
|
100 |
+
|
101 |
+
function get (key, json) {
|
102 |
+
if (typeof document === 'undefined') {
|
103 |
+
return;
|
104 |
+
}
|
105 |
+
|
106 |
+
var jar = {};
|
107 |
+
// To prevent the for loop in the first place assign an empty array
|
108 |
+
// in case there are no cookies at all.
|
109 |
+
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
110 |
+
var i = 0;
|
111 |
+
|
112 |
+
for (; i < cookies.length; i++) {
|
113 |
+
var parts = cookies[i].split('=');
|
114 |
+
var cookie = parts.slice(1).join('=');
|
115 |
+
|
116 |
+
if (!json && cookie.charAt(0) === '"') {
|
117 |
+
cookie = cookie.slice(1, -1);
|
118 |
+
}
|
119 |
+
|
120 |
+
try {
|
121 |
+
var name = decode(parts[0]);
|
122 |
+
cookie = (converter.read || converter)(cookie, name) ||
|
123 |
+
decode(cookie);
|
124 |
+
|
125 |
+
if (json) {
|
126 |
+
try {
|
127 |
+
cookie = JSON.parse(cookie);
|
128 |
+
} catch (e) {}
|
129 |
+
}
|
130 |
+
|
131 |
+
jar[name] = cookie;
|
132 |
+
|
133 |
+
if (key === name) {
|
134 |
+
break;
|
135 |
+
}
|
136 |
+
} catch (e) {}
|
137 |
+
}
|
138 |
+
|
139 |
+
return key ? jar[key] : jar;
|
140 |
+
}
|
141 |
+
|
142 |
+
api.set = set;
|
143 |
+
api.get = function (key) {
|
144 |
+
return get(key, false /* read as raw */);
|
145 |
+
};
|
146 |
+
api.getJSON = function (key) {
|
147 |
+
return get(key, true /* read as json */);
|
148 |
+
};
|
149 |
+
api.remove = function (key, attributes) {
|
150 |
+
set(key, '', extend(attributes, {
|
151 |
+
expires: -1
|
152 |
+
}));
|
153 |
+
};
|
154 |
+
|
155 |
+
api.defaults = {};
|
156 |
+
|
157 |
+
api.withConverter = init;
|
158 |
+
|
159 |
+
return api;
|
160 |
+
}
|
161 |
+
|
162 |
+
return init(function () {});
|
163 |
+
}));
|
164 |
+
|
165 |
+
|
166 |
+
|
167 |
+
AiCookies = Cookies.noConflict();
|
168 |
+
|
169 |
+
|
170 |
+
function ai_check_block (block) {
|
171 |
+
var ai_debug = typeof ai_debugging !== 'undefined'; // 1
|
172 |
+
// var ai_debug = false;
|
173 |
+
|
174 |
+
var ai_cookie_name = 'aiBLOCKS';
|
175 |
+
var ai_cookie = AiCookies.getJSON (ai_cookie_name);
|
176 |
+
|
177 |
+
if (ai_cookie == null) {
|
178 |
+
ai_cookie = {};
|
179 |
+
}
|
180 |
+
|
181 |
+
if (ai_cookie.hasOwnProperty (block)) {
|
182 |
+
for (var cookie_block_property in ai_cookie [block]) {
|
183 |
+
if (cookie_block_property == 'x') {
|
184 |
+
var date = new Date();
|
185 |
+
var closed_for = ai_cookie [block][cookie_block_property] - Math.round (date.getTime() / 1000);
|
186 |
+
if (closed_for > 0) {
|
187 |
+
if (ai_debug) console.log ('');
|
188 |
+
if (ai_debug) console.log ('AI COOKIE block', block, 'closed for', closed_for, 's =', closed_for / 3600 / 24, 'days');
|
189 |
+
|
190 |
+
return false;
|
191 |
+
} else ai_set_cookie (block, 'x', '');
|
192 |
+
}
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
return true;
|
197 |
+
}
|
198 |
+
|
199 |
+
function ai_set_cookie (block, property, value) {
|
200 |
+
|
201 |
+
function isEmpty (obj) {
|
202 |
+
for (var key in obj) {
|
203 |
+
if (obj.hasOwnProperty (key))
|
204 |
+
return false;
|
205 |
+
}
|
206 |
+
return true;
|
207 |
+
}
|
208 |
+
|
209 |
+
var ai_debug = typeof ai_debugging !== 'undefined'; // 2
|
210 |
+
// var ai_debug = false;
|
211 |
+
|
212 |
+
if (ai_debug) console.log ('AI COOKIE block:', block, 'property:', property, 'value:', value);
|
213 |
+
|
214 |
+
var ai_cookie_name = 'aiBLOCKS';
|
215 |
+
var ai_cookie = AiCookies.getJSON (ai_cookie_name);
|
216 |
+
|
217 |
+
if (ai_cookie == null) {
|
218 |
+
ai_cookie = {};
|
219 |
+
|
220 |
+
if (ai_debug) console.log ('AI COOKIE NOT PRESENT');
|
221 |
+
}
|
222 |
+
|
223 |
+
if (ai_debug) console.log ('AI COOKIE OLD', ai_cookie);
|
224 |
+
|
225 |
+
if (value === '') {
|
226 |
+
if (ai_cookie.hasOwnProperty (block)) {
|
227 |
+
delete ai_cookie [block][property];
|
228 |
+
if (isEmpty (ai_cookie [block])) {
|
229 |
+
delete ai_cookie [block];
|
230 |
+
}
|
231 |
+
}
|
232 |
+
} else {
|
233 |
+
if (!ai_cookie.hasOwnProperty (block)) {
|
234 |
+
ai_cookie [block] = {};
|
235 |
+
}
|
236 |
+
ai_cookie [block][property] = value;
|
237 |
+
}
|
238 |
+
|
239 |
+
if (Object.keys (ai_cookie).length === 0 && ai_cookie.constructor === Object) {
|
240 |
+
AiCookies.remove (ai_cookie_name);
|
241 |
+
|
242 |
+
if (ai_debug) console.log ('AI COOKIE REMOVED');
|
243 |
+
} else {
|
244 |
+
AiCookies.set (ai_cookie_name, ai_cookie, {expires: 365, path: '/'});
|
245 |
+
}
|
246 |
+
|
247 |
+
if (ai_debug) {
|
248 |
+
var ai_cookie_test = AiCookies.getJSON (ai_cookie_name);
|
249 |
+
if (typeof (ai_cookie_test) != 'undefined') {
|
250 |
+
console.log ('AI COOKIE NEW', ai_cookie_test);
|
251 |
+
|
252 |
+
console.log ('AI COOKIE DATA:');
|
253 |
+
for (var cookie_block in ai_cookie_test) {
|
254 |
+
for (var cookie_block_property in ai_cookie_test [cookie_block]) {
|
255 |
+
if (cookie_block_property == 'x') {
|
256 |
+
var date = new Date();
|
257 |
+
var closed_for = ai_cookie_test [cookie_block][cookie_block_property] - Math.round (date.getTime() / 1000);
|
258 |
+
console.log (' BLOCK', cookie_block, 'closed for', closed_for, 's =', closed_for / 3600 / 24, 'days');
|
259 |
+
} else
|
260 |
+
console.log (' ?:', cookie_block, ':', cookie_block_property, ai_cookie_test [cookie_block][cookie_block_property]);
|
261 |
+
}
|
262 |
+
}
|
263 |
+
} else console.log ('AI COOKIE NOT PRESENT');
|
264 |
+
}
|
265 |
+
}
|
266 |
+
|
includes/js/ai-cookie.min.js
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
JavaScript Cookie v2.2.0
|
3 |
+
https://github.com/js-cookie/js-cookie
|
4 |
+
|
5 |
+
Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
6 |
+
Released under the MIT license
|
7 |
+
*/
|
8 |
+
(function(c){if("function"===typeof define&&define.amd){define(c);var b=!0}"object"===typeof exports&&(module.exports=c(),b=!0);if(!b){var d=window.Cookies,a=window.Cookies=c();a.noConflict=function(){window.Cookies=d;return a}}})(function(){function c(){for(var c=0,a={};c<arguments.length;c++){var b=arguments[c],g;for(g in b)a[g]=b[g]}return a}function b(d){function a(){}function f(b,h,e){if("undefined"!==typeof document){e=c({path:"/"},a.defaults,e);"number"===typeof e.expires&&(e.expires=new Date(1*
|
9 |
+
new Date+864E5*e.expires));e.expires=e.expires?e.expires.toUTCString():"";try{var k=JSON.stringify(h);/^[\{\[]/.test(k)&&(h=k)}catch(p){}h=d.write?d.write(h,b):encodeURIComponent(String(h)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent);b=encodeURIComponent(String(b)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);k="";for(var m in e)e[m]&&(k+="; "+m,!0!==e[m]&&(k+="="+e[m].split(";")[0]));return document.cookie=b+"="+h+k}}
|
10 |
+
function g(a,b){if("undefined"!==typeof document){for(var c={},k=document.cookie?document.cookie.split("; "):[],h=0;h<k.length;h++){var f=k[h].split("="),l=f.slice(1).join("=");b||'"'!==l.charAt(0)||(l=l.slice(1,-1));try{var g=f[0].replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent);l=(d.read||d)(l,g)||l.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent);if(b)try{l=JSON.parse(l)}catch(n){}c[g]=l;if(a===g)break}catch(n){}}return a?c[a]:c}}a.set=f;a.get=function(a){return g(a,!1)};a.getJSON=function(a){return g(a,
|
11 |
+
!0)};a.remove=function(a,b){f(a,"",c(b,{expires:-1}))};a.defaults={};a.withConverter=b;return a}return b(function(){})});AiCookies=Cookies.noConflict();function ai_check_client(c){var b=AiCookies.getJSON("aiBLOCKS");null==b&&(b={});if(b.hasOwnProperty(c))for(var d in b[c])if("x"==d){if(0<b[c][d]-Math.round((new Date).getTime()/1E3))return!1;ai_set_cookie(c,"x","")}return!0}
|
12 |
+
function ai_set_cookie(c,b,d){var a=AiCookies.getJSON("aiBLOCKS");null==a&&(a={});if(""===d){if(a.hasOwnProperty(c)){delete a[c][b];a:{b=a[c];for(f in b)if(b.hasOwnProperty(f)){var f=!1;break a}f=!0}f&&delete a[c]}}else a.hasOwnProperty(c)||(a[c]={}),a[c][b]=d;0===Object.keys(a).length&&a.constructor===Object?AiCookies.remove("aiBLOCKS"):AiCookies.set("aiBLOCKS",a,{expires:365,path:"/"})};
|
includes/js/ai-insert.js
CHANGED
@@ -4,7 +4,8 @@ function ai_insert (insertion, selector, insertion_code) {
|
|
4 |
} else var elements = document.querySelectorAll (selector);
|
5 |
|
6 |
Array.prototype.forEach.call (elements, function (element, index) {
|
7 |
-
var ai_debug = typeof ai_debugging !== 'undefined';
|
|
|
8 |
|
9 |
if (element.hasAttribute ('id')) {
|
10 |
selector_string = '#' + element.getAttribute ('id');
|
@@ -74,7 +75,7 @@ function ai_insert (insertion, selector, insertion_code) {
|
|
74 |
});
|
75 |
}
|
76 |
|
77 |
-
function
|
78 |
|
79 |
function hasClass (element, cls) {
|
80 |
if (element == null) return false;
|
@@ -97,7 +98,8 @@ function ai_insert_viewport (element) {
|
|
97 |
element.className = element.className.replace (new RegExp ('(^|\\b)' + cls.split (' ').join ('|') + '(\\b|$)', 'gi'), ' ');
|
98 |
}
|
99 |
|
100 |
-
var ai_debug = typeof ai_debugging !== 'undefined';
|
|
|
101 |
|
102 |
if (ai_debug) console.log ('AI VIEWPORT INSERTION class:', element.getAttribute ('class'));
|
103 |
|
4 |
} else var elements = document.querySelectorAll (selector);
|
5 |
|
6 |
Array.prototype.forEach.call (elements, function (element, index) {
|
7 |
+
var ai_debug = typeof ai_debugging !== 'undefined'; // 1
|
8 |
+
// var ai_debug = false;
|
9 |
|
10 |
if (element.hasAttribute ('id')) {
|
11 |
selector_string = '#' + element.getAttribute ('id');
|
75 |
});
|
76 |
}
|
77 |
|
78 |
+
function ai_insert_code (element) {
|
79 |
|
80 |
function hasClass (element, cls) {
|
81 |
if (element == null) return false;
|
98 |
element.className = element.className.replace (new RegExp ('(^|\\b)' + cls.split (' ').join ('|') + '(\\b|$)', 'gi'), ' ');
|
99 |
}
|
100 |
|
101 |
+
var ai_debug = typeof ai_debugging !== 'undefined'; // 2
|
102 |
+
// var ai_debug = false;
|
103 |
|
104 |
if (ai_debug) console.log ('AI VIEWPORT INSERTION class:', element.getAttribute ('class'));
|
105 |
|
includes/js/ai-insert.min.js
CHANGED
@@ -1,10 +1,6 @@
|
|
1 |
-
function ai_insert(
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
insertion,selector
|
6 |
-
function
|
7 |
-
cls.split(" ").join("|")+"(\\b|$)","gi")," ")}var ai_debug=typeof ai_debugging!=="undefined";if(ai_debug)console.log("AI VIEWPORT INSERTION class:",element.getAttribute("class"));var visible=!!(element.offsetWidth||element.offsetHeight||element.getClientRects().length);var block=element.getAttribute("data-block");if(visible){var insertion_code=element.getAttribute("data-code");var insertion_type=element.getAttribute("data-insertion");var selector=element.getAttribute("data-selector");if(insertion_code!=
|
8 |
-
null)if(insertion_type!=null&&selector!=null){var selector_exists=document.querySelectorAll(selector).length;if(ai_debug)console.log("AI VIEWPORT VISIBLE: block",block,insertion_type,selector,selector_exists?"":"NOT FOUND");if(selector_exists){ai_insert(insertion_type,selector,b64d(insertion_code));removeClass(element,"ai-viewports")}}else{if(ai_debug)console.log("AI VIEWPORT VISIBLE: block",block);var range=document.createRange();var fragment=range.createContextualFragment(b64d(insertion_code));
|
9 |
-
element.parentNode.insertBefore(fragment,element.nextSibling);removeClass(element,"ai-viewports")}}else{if(ai_debug)console.log("AI VIEWPORT NOT VISIBLE: block",block);var debug_bar=element.previousElementSibling;if(hasClass(debug_bar,"ai-debug-bar")&&hasClass(debug_bar,"ai-debug-script")){removeClass(debug_bar,"ai-debug-script");addClass(debug_bar,"ai-debug-viewport-invisible")}removeClass(element,"ai-viewports")}}
|
10 |
-
function b64e(str){return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,function toSolidBytes(match,p1){return String.fromCharCode("0x"+p1)}))}function b64d(str){return decodeURIComponent(atob(str).split("").map(function(c){return"%"+("00"+c.charCodeAt(0).toString(16)).slice(-2)}).join(""))};
|
1 |
+
function ai_insert(a,f,h){var e=-1!=f.indexOf(":eq")?jQuery(f):document.querySelectorAll(f);Array.prototype.forEach.call(e,function(b,e){selector_string=b.hasAttribute("id")?"#"+b.getAttribute("id"):b.hasAttribute("class")?"."+b.getAttribute("class").replace(RegExp(" ","g"),"."):"";var d=document.createElement("div");d.innerHTML=h;var c=d.getElementsByClassName("ai-selector-counter")[0];null!=c&&(c.innerText=e+1);c=d.getElementsByClassName("ai-debug-name ai-main")[0];if(null!=c){var g="";"before"==
|
2 |
+
a?g=ai_front.insertion_before:"after"==a?g=ai_front.insertion_after:"prepend"==a?g=ai_front.insertion_prepend:"append"==a?g=ai_front.insertion_append:"replace-content"==a?g=ai_front.insertion_replace_content:"replace-element"==a&&(g=ai_front.insertion_replace_element);c.innerText=g+" "+f+" ("+b.tagName.toLowerCase()+selector_string+")"}c=document.createRange().createContextualFragment(d.innerHTML);"before"==a?b.parentNode.insertBefore(c,b):"after"==a?b.parentNode.insertBefore(c,b.nextSibling):"prepend"==
|
3 |
+
a?b.insertBefore(c,b.firstChild):"append"==a?b.insertBefore(c,null):"replace-content"==a?b.innerHTML=d.innerHTML:"replace-element"==a&&(b.parentNode.insertBefore(c,b),b.parentNode.removeChild(b))})}
|
4 |
+
function ai_insert_code(a){function f(a,b){return null==a?!1:a.classList?a.classList.contains(b):-1<(" "+a.className+" ").indexOf(" "+b+" ")}function h(a,b){null!=a&&(a.classList?a.classList.add(b):a.className+=" "+b)}function e(a,b){null!=a&&(a.classList?a.classList.remove(b):a.className=a.className.replace(new RegExp("(^|\\b)"+b.split(" ").join("|")+"(\\b|$)","gi")," "))}var b=!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length);a.getAttribute("data-block");if(b){b=a.getAttribute("data-code");
|
5 |
+
var k=a.getAttribute("data-insertion"),d=a.getAttribute("data-selector");null!=b&&(null!=k&&null!=d?document.querySelectorAll(d).length&&(ai_insert(k,d,b64d(b)),e(a,"ai-viewports")):(b=document.createRange().createContextualFragment(b64d(b)),a.parentNode.insertBefore(b,a.nextSibling),e(a,"ai-viewports")))}else b=a.previousElementSibling,f(b,"ai-debug-bar")&&f(b,"ai-debug-script")&&(e(b,"ai-debug-script"),h(b,"ai-debug-viewport-invisible")),e(a,"ai-viewports")}
|
6 |
+
function b64e(a){return btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,function(a,h){return String.fromCharCode("0x"+h)}))}function b64d(a){return decodeURIComponent(atob(a).split("").map(function(a){return"%"+("00"+a.charCodeAt(0).toString(16)).slice(-2)}).join(""))};
|
|
|
|
|
|
|
|
js/ad-inserter.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
var javascript_version = "2.4.
|
2 |
var ignore_key = true;
|
3 |
var start = 1;
|
4 |
var end = 16;
|
1 |
+
var javascript_version = "2.4.20";
|
2 |
var ignore_key = true;
|
3 |
var start = 1;
|
4 |
var end = 16;
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Tags: ads, adsense, ad rotation, ad manager, amp, amazon, ad blocking detection,
|
|
6 |
Requires at least: 4.0
|
7 |
Tested up to: 5.2
|
8 |
Requires PHP: 5.6
|
9 |
-
Stable tag: 2.4.
|
10 |
License: GPLv3
|
11 |
|
12 |
Manage ads: Google AdSense, Media.net, Amazon banners, ad rotation, sticky widgets, AMP ads, DFP, PHP, tracking, AdSense header and footer code
|
@@ -22,6 +22,18 @@ This plugin is more than AdSense plugin or plugin for ads. It provides many adva
|
|
22 |
**Insert ads where other plugins fail**.
|
23 |
It's all about the [settings](https://adinserter.pro/documentation).
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
**Features** - check [documentation](https://adinserter.pro/documentation/features) for the complete list
|
26 |
|
27 |
* [AdSense integration](https://adinserter.pro/documentation/adsense-ads)
|
@@ -301,6 +313,11 @@ If you are not happy to reveal this information and you have opted in, simply di
|
|
301 |
|
302 |
== Changelog ==
|
303 |
|
|
|
|
|
|
|
|
|
|
|
304 |
= 2.4.19 =
|
305 |
- Added support for taxonomy for Yoast primary category
|
306 |
- Layout changes to accomodate longer translated texts
|
@@ -425,6 +442,11 @@ For the changelog of earlier versions, please refer to the separate changelog.tx
|
|
425 |
|
426 |
== Upgrade Notice ==
|
427 |
|
|
|
|
|
|
|
|
|
|
|
428 |
= 2.4.19 =
|
429 |
Added support for taxonomy for Yoast primary category;
|
430 |
Layout changes to accomodate longer translated texts;
|
6 |
Requires at least: 4.0
|
7 |
Tested up to: 5.2
|
8 |
Requires PHP: 5.6
|
9 |
+
Stable tag: 2.4.20
|
10 |
License: GPLv3
|
11 |
|
12 |
Manage ads: Google AdSense, Media.net, Amazon banners, ad rotation, sticky widgets, AMP ads, DFP, PHP, tracking, AdSense header and footer code
|
22 |
**Insert ads where other plugins fail**.
|
23 |
It's all about the [settings](https://adinserter.pro/documentation).
|
24 |
|
25 |
+
|
26 |
+
[Plugin reviews](https://wordpress.org/support/topic/wow-684/):
|
27 |
+
|
28 |
+
> I've been using another ad placement manager for a couple years and just recently started using Ad Inserter.
|
29 |
+
>
|
30 |
+
> I'm blown AWAY with the power and flexibility of it.
|
31 |
+
>
|
32 |
+
> I can HIGHLY recommend this plugin to anyone looking for an easy way to manage ads within WordPress.
|
33 |
+
>
|
34 |
+
> Difficult to choose, but certainly top 3 plugins I've ever used in WordPress, ever.
|
35 |
+
|
36 |
+
|
37 |
**Features** - check [documentation](https://adinserter.pro/documentation/features) for the complete list
|
38 |
|
39 |
* [AdSense integration](https://adinserter.pro/documentation/adsense-ads)
|
313 |
|
314 |
== Changelog ==
|
315 |
|
316 |
+
= 2.4.20 =
|
317 |
+
- Fix for path traversal vulnerability - credit to Wilfried B�card of Synacktiv (https://synacktiv.com)
|
318 |
+
- Fix for block rearrangement issues
|
319 |
+
- Few minor bug fixes, cosmetic changes and code improvements
|
320 |
+
|
321 |
= 2.4.19 =
|
322 |
- Added support for taxonomy for Yoast primary category
|
323 |
- Layout changes to accomodate longer translated texts
|
442 |
|
443 |
== Upgrade Notice ==
|
444 |
|
445 |
+
= 2.4.20 =
|
446 |
+
Fix for path traversal vulnerability;
|
447 |
+
Fix for block rearrangement issues;
|
448 |
+
Few minor bug fixes, cosmetic changes and code improvements
|
449 |
+
|
450 |
= 2.4.19 =
|
451 |
Added support for taxonomy for Yoast primary category;
|
452 |
Layout changes to accomodate longer translated texts;
|
settings.php
CHANGED
@@ -529,7 +529,7 @@ function generate_settings_form (){
|
|
529 |
|
530 |
$adb_block_action_active = $obj->get_adb_block_action () != AI_ADB_BLOCK_ACTION_DO_NOTHING;
|
531 |
|
532 |
-
$display_options = $obj->get_show_label () || $obj->get_lazy_loading () || $obj->get_close_button () || $obj->get_iframe ();
|
533 |
|
534 |
$show_misc =
|
535 |
$insertion_options ||
|
@@ -1915,14 +1915,13 @@ function generate_settings_form (){
|
|
1915 |
<label for="show-label-<?php echo $block; ?>"><?php _e ('Ad label', 'ad-inserter'); ?></label>
|
1916 |
</td>
|
1917 |
<?php if (function_exists ('ai_display_lazy')) ai_display_lazy ($block, $obj, $default, 'lazy-loading-'.$block, AI_OPTION_CLOSE_BUTTON . WP_FORM_FIELD_POSTFIX . $block); ?>
|
1918 |
-
<td>
|
1919 |
-
<?php if (function_exists ('ai_display_close')) ai_display_close ($block, $obj, $default, 'close-button-'.$block, AI_OPTION_CLOSE_BUTTON . WP_FORM_FIELD_POSTFIX . $block); ?>
|
1920 |
-
</td>
|
1921 |
</tr>
|
1922 |
</tbody>
|
1923 |
</table>
|
1924 |
</div>
|
1925 |
|
|
|
|
|
1926 |
<?php if (function_exists ('ai_iframes')) ai_iframes ($block, $obj, $default); ?>
|
1927 |
</div>
|
1928 |
|
@@ -2960,11 +2959,30 @@ function generate_settings_form (){
|
|
2960 |
}
|
2961 |
|
2962 |
function replace_blocked_js (js_src) {
|
2963 |
-
var js_selector = 'script[src*="'+js_src+'"]';
|
2964 |
-
if (jQuery (js_selector).length) {
|
2965 |
-
var js = jQuery(js_selector);
|
2966 |
-
|
2967 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2968 |
}
|
2969 |
|
2970 |
jQuery("#blocked-warning.warning-enabled").show ();
|
@@ -3007,22 +3025,30 @@ function generate_settings_form (){
|
|
3007 |
if (blocking_counter >= 2) {
|
3008 |
var message = 'Ad blocking test: ' + blocking_counter + ' images not loaded';
|
3009 |
console.log ('AI AD BLOCKING:', blocking_counter, 'images not loaded');
|
3010 |
-
|
3011 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3012 |
|
3013 |
// replace_blocked_image ('ai-loading', 'loading.gif', 'block'); // new ids not used in js
|
3014 |
// replace_blocked_image ('ai-loading-2', 'loading.gif', 'block');
|
3015 |
|
3016 |
-
|
3017 |
-
|
3018 |
-
|
3019 |
-
|
3020 |
-
|
3021 |
-
|
3022 |
-
|
3023 |
// replace_blocked_css ('puc-debug-bar-style-v4-css', 'includes/update-checker/css/puc-debug-bar.css');
|
3024 |
|
3025 |
-
// replace_blocked_js ('
|
3026 |
}
|
3027 |
}
|
3028 |
</script>
|
@@ -3522,7 +3548,7 @@ function code_block_list () {
|
|
3522 |
$blocks_new = json_decode ($_GET ["blocks-new"]);
|
3523 |
|
3524 |
if (!empty ($blocks_org) && count ($blocks_org) == count ($blocks_new)) {
|
3525 |
-
//
|
3526 |
$current_options = get_option (AI_OPTION_NAME);
|
3527 |
$new_options = $current_options;
|
3528 |
|
@@ -3530,13 +3556,18 @@ function code_block_list () {
|
|
3530 |
foreach ($blocks_org as $index => $block) {
|
3531 |
$new_block = $blocks_new [$index];
|
3532 |
if ($block >= 1 && $block <= 96 && $new_block >= 1 && $new_block <= 96) {
|
3533 |
-
|
|
|
|
|
|
|
|
|
3534 |
} else $error = true;
|
3535 |
}
|
3536 |
|
3537 |
if (!$error) {
|
3538 |
// Update AI_OPTION_FALLBACK and AI_OPTION_ADB_BLOCK_REPLACEMENT
|
3539 |
for ($block = 1; $block <= 96; $block ++) {
|
|
|
3540 |
if (isset ($new_options [$block][AI_OPTION_FALLBACK])) {
|
3541 |
$ai_option_fallback = $new_options [$block][AI_OPTION_FALLBACK];
|
3542 |
if ($ai_option_fallback != '')
|
529 |
|
530 |
$adb_block_action_active = $obj->get_adb_block_action () != AI_ADB_BLOCK_ACTION_DO_NOTHING;
|
531 |
|
532 |
+
$display_options = $obj->get_show_label () || $obj->get_lazy_loading () || $obj->get_close_button () || $obj->get_auto_close_time () || $obj->get_stay_closed_time () || $obj->get_iframe ();
|
533 |
|
534 |
$show_misc =
|
535 |
$insertion_options ||
|
1915 |
<label for="show-label-<?php echo $block; ?>"><?php _e ('Ad label', 'ad-inserter'); ?></label>
|
1916 |
</td>
|
1917 |
<?php if (function_exists ('ai_display_lazy')) ai_display_lazy ($block, $obj, $default, 'lazy-loading-'.$block, AI_OPTION_CLOSE_BUTTON . WP_FORM_FIELD_POSTFIX . $block); ?>
|
|
|
|
|
|
|
1918 |
</tr>
|
1919 |
</tbody>
|
1920 |
</table>
|
1921 |
</div>
|
1922 |
|
1923 |
+
<?php if (function_exists ('ai_close_button')) ai_close_button ($block, $obj, $default); ?>
|
1924 |
+
|
1925 |
<?php if (function_exists ('ai_iframes')) ai_iframes ($block, $obj, $default); ?>
|
1926 |
</div>
|
1927 |
|
2959 |
}
|
2960 |
|
2961 |
function replace_blocked_js (js_src) {
|
2962 |
+
// var js_selector = 'script[src*="'+js_src+'"]';
|
2963 |
+
// if (jQuery (js_selector).length) {
|
2964 |
+
// var js = jQuery(js_selector);
|
2965 |
+
// console.log ('src', ajaxurl+'?action=ai_ajax_backend&js=' + js_src + '&ai_check=<?php echo wp_create_nonce ('adinserter_data'); ?>');
|
2966 |
+
// js.after (js.clone ().attr ('src', ajaxurl+'?action=ai_ajax_backend&js=' + js_src + '&ai_check=<?php echo wp_create_nonce ('adinserter_data'); ?>'));
|
2967 |
+
// }
|
2968 |
+
|
2969 |
+
var script = ajaxurl+'?action=ai_ajax_backend&js=' + js_src + '&ai_check=<?php echo wp_create_nonce ('adinserter_data'); ?>';
|
2970 |
+
jQuery.getScript (script, function (data, textStatus, jqxhr) {
|
2971 |
+
// console.log( data ); // Data returned
|
2972 |
+
// console.log( textStatus ); // Success
|
2973 |
+
// console.log( jqxhr.status ); // 200
|
2974 |
+
// console.log( "Load was performed." );
|
2975 |
+
// }).fail(function( jqxhr, settings, exception ) {
|
2976 |
+
// console.log ('FAIL');
|
2977 |
+
// console.log( jqxhr ); // Data returned
|
2978 |
+
// console.log( settings ); // Success
|
2979 |
+
// console.log( exception ); // 200
|
2980 |
+
});
|
2981 |
+
}
|
2982 |
+
|
2983 |
+
function show_warining () {
|
2984 |
+
jQuery("#blocked-warning").attr ('title', message).show ();
|
2985 |
+
jQuery("#blocked-warning .blocked-warning-text").css ('color', '#00f');
|
2986 |
}
|
2987 |
|
2988 |
jQuery("#blocked-warning.warning-enabled").show ();
|
3025 |
if (blocking_counter >= 2) {
|
3026 |
var message = 'Ad blocking test: ' + blocking_counter + ' images not loaded';
|
3027 |
console.log ('AI AD BLOCKING:', blocking_counter, 'images not loaded');
|
3028 |
+
|
3029 |
+
show_warining ();
|
3030 |
+
|
3031 |
+
setTimeout (function() {
|
3032 |
+
show_warining ();
|
3033 |
+
}, 2000);
|
3034 |
+
|
3035 |
+
setTimeout (function() {
|
3036 |
+
show_warining ();
|
3037 |
+
}, 5000);
|
3038 |
|
3039 |
// replace_blocked_image ('ai-loading', 'loading.gif', 'block'); // new ids not used in js
|
3040 |
// replace_blocked_image ('ai-loading-2', 'loading.gif', 'block');
|
3041 |
|
3042 |
+
replace_blocked_css ('ai-admin-css', 'ai-settings.css');
|
3043 |
+
replace_blocked_css ('ai-admin-jquery-ui-css', 'jquery-ui-1.10.3.custom.min.css');
|
3044 |
+
replace_blocked_css ('ai-admin-flags-css', 'flags.css');
|
3045 |
+
replace_blocked_css ('ai-admin-multi-select-css', 'multi-select.css');
|
3046 |
+
replace_blocked_css ('ai-image-picker-css', 'image-picker.css');
|
3047 |
+
replace_blocked_css ('ai-combobox-css-css', 'jquery.scombobox.min.css');
|
3048 |
+
replace_blocked_css ('ai-admin-gen-css', 'ai-admin.css');
|
3049 |
// replace_blocked_css ('puc-debug-bar-style-v4-css', 'includes/update-checker/css/puc-debug-bar.css');
|
3050 |
|
3051 |
+
// replace_blocked_js ('ad-inserter.js');
|
3052 |
}
|
3053 |
}
|
3054 |
</script>
|
3548 |
$blocks_new = json_decode ($_GET ["blocks-new"]);
|
3549 |
|
3550 |
if (!empty ($blocks_org) && count ($blocks_org) == count ($blocks_new)) {
|
3551 |
+
// Update widgets
|
3552 |
$current_options = get_option (AI_OPTION_NAME);
|
3553 |
$new_options = $current_options;
|
3554 |
|
3556 |
foreach ($blocks_org as $index => $block) {
|
3557 |
$new_block = $blocks_new [$index];
|
3558 |
if ($block >= 1 && $block <= 96 && $new_block >= 1 && $new_block <= 96) {
|
3559 |
+
if (isset ($current_options [$new_block])) {
|
3560 |
+
$new_options [$block] = $current_options [$new_block];
|
3561 |
+
} else {
|
3562 |
+
unset ($new_options [$block]);
|
3563 |
+
}
|
3564 |
} else $error = true;
|
3565 |
}
|
3566 |
|
3567 |
if (!$error) {
|
3568 |
// Update AI_OPTION_FALLBACK and AI_OPTION_ADB_BLOCK_REPLACEMENT
|
3569 |
for ($block = 1; $block <= 96; $block ++) {
|
3570 |
+
|
3571 |
if (isset ($new_options [$block][AI_OPTION_FALLBACK])) {
|
3572 |
$ai_option_fallback = $new_options [$block][AI_OPTION_FALLBACK];
|
3573 |
if ($ai_option_fallback != '')
|