Versioning - Denial toggle fix

This commit is contained in:
Jay Wood
2015-12-14 10:27:07 -05:00
parent 035733ea04
commit 4ba10274a9
7 changed files with 44 additions and 17 deletions

View File

@ -7,7 +7,7 @@
[![Issues](https://img.shields.io/github/issues/JayWood/content-warning-v3.svg)](https://github.com/JayWood/content-warning-v3/issues) [![Issues](https://img.shields.io/github/issues/JayWood/content-warning-v3.svg)](https://github.com/JayWood/content-warning-v3/issues)
**Current Version:** 3.6.7 **Current Version:** 3.6.7
**Tested Up To:** 4.3 **Tested Up To:** 4.4
**Author:** [Jay Wood](http://github.com/JayWood) **Author:** [Jay Wood](http://github.com/JayWood)
**Author URI:** http://plugish.com **Author URI:** http://plugish.com
**License:** GPLv2+ **License:** GPLv2+
@ -79,7 +79,14 @@ Please do not contact me with questions like this. If you cannot be descriptive
## Changelog ## Changelog
### 3.6. ### 3.6.7
* Fixed conditional being too strict [#34](https://github.com/JayWood/content-warning-v3/issues/34)
* Fixed plugin homepage link [#31](https://github.com/JayWood/content-warning-v3/issues/31)
* Removed uninstall hook for now - Options API needs to be updated
* Fixed denial toggle to actually remove denial text if it was once on, but now off.
### 3.6.6
* Fixed CSS issues for background images and css overrides6 * Fixed CSS issues for background images and css overrides6
### 3.6.5 ### 3.6.5

View File

@ -166,14 +166,15 @@ class CWV3 {
wp_enqueue_style( 'cwv3_css' ); wp_enqueue_style( 'cwv3_css' );
wp_enqueue_script( 'cwv3_js' ); wp_enqueue_script( 'cwv3_js' );
$cookie_death = get_option( 'cwv3_death', 1 ); $cookie_death = get_option( 'cwv3_death', 1 );
$de = get_option( 'cwv3_denial', 'enabled' );
$localized_data = array( $localized_data = array(
'opacity' => get_option( 'cwv3_bg_opacity', 0.85 ), 'opacity' => get_option( 'cwv3_bg_opacity', 0.85 ),
'cookie_path' => SITECOOKIEPATH, 'cookie_path' => SITECOOKIEPATH,
'cookie_name' => $this->get_cookie_name(), 'cookie_name' => $this->get_cookie_name(),
'cookie_time' => intval( $cookie_death ) > 365 ? 365 : intval( $cookie_death ), 'cookie_time' => intval( $cookie_death ) > 365 ? 365 : intval( $cookie_death ),
// Max at one year if it's over 365 days. // Max at one year if it's over 365 days.
'denial_enabled' => get_option( 'cwv3_denial', 'enabled' ), 'denial_enabled' => is_array( $de ) && ! empty( $de ) ? true : false,
'denial_method' => get_option( 'cwv3_method', 'redirect' ), 'denial_method' => get_option( 'cwv3_method', 'redirect' ),
'redirect_url' => esc_js( get_option( 'cwv3_exit_link', '#' ) ), 'redirect_url' => esc_js( get_option( 'cwv3_exit_link', '#' ) ),
); );

View File

@ -9,16 +9,16 @@
/* Main CWV3 Dialog */ /* Main CWV3 Dialog */
.cwv3_dialog { .cwv3_dialog {
border: 3px solid #cccccc; border: 3px solid #CCCCCC;
background: white; background: #FFFFFF;
max-width: 60%; max-width: 60%;
max-height: 90%; max-height: 90%;
position: fixed; position: fixed;
top: 25%; top: 25%;
left: 25%; left: 25%;
-webkit-box-shadow: 2px 11px 48px black; -webkit-box-shadow: 2px 11px 48px #000;
-moz-box-shadow: 2px 11px 48px black; -moz-box-shadow: 2px 11px 48px #000;
box-shadow: 2px 11px 48px black; box-shadow: 2px 11px 48px #000;
overflow: hidden; overflow: hidden;
z-index: 99999; z-index: 99999;
} }
@ -29,10 +29,10 @@
height: 100%; height: 100%;
} }
.cwv3_dialog .cwv3_title { .cwv3_dialog .cwv3_title {
color: white; color: #FFFFFF;
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
background: red; background: #FF0000;
margin-bottom: 0.25em; margin-bottom: 0.25em;
} }
.cwv3_dialog .cwv3_content { .cwv3_dialog .cwv3_content {
@ -52,7 +52,7 @@
display: block; display: block;
width: 100%; width: 100%;
text-align: center; text-align: center;
color: white; color: #FFFFFF;
font-weight: bold; font-weight: bold;
text-decoration: none; text-decoration: none;
padding: .35em 0; padding: .35em 0;
@ -65,11 +65,13 @@
float: right; float: right;
} }
.cwv3_dialog .cwv3_btns .cwv3_exit a { .cwv3_dialog .cwv3_btns .cwv3_exit a {
background-color: red; background-color: #FF0000;
} }
.cwv3_dialog .cwv3_btns .cwv3_enter { .cwv3_dialog .cwv3_btns .cwv3_enter {
float: left; float: left;
} }
.cwv3_dialog .cwv3_btns .cwv3_enter a { .cwv3_dialog .cwv3_btns .cwv3_enter a {
background-color: #00cc33; background-color: #00CC33;
} }
/*# sourceMappingURL=cwv3.css.map */

2
css/cwv3.min.css vendored
View File

@ -1 +1 @@
.cwv3.dialog-overlay{position:fixed;top:0;left:0;width:100%;height:100%;z-index:99998}.cwv3_dialog{border:3px solid #ccc;background:#fff;max-width:60%;max-height:90%;position:fixed;top:25%;left:25%;-webkit-box-shadow:2px 11px 48px #000;-moz-box-shadow:2px 11px 48px #000;box-shadow:2px 11px 48px #000;overflow:hidden;z-index:99999}.cwv3_dialog div{padding:.25em}.cwv3_dialog .cwv3.auth,.cwv3_dialog .cwv3.denied{height:100%}.cwv3_dialog .cwv3_title{color:#fff;font-weight:700;text-align:center;background:red;margin-bottom:.25em}.cwv3_dialog .cwv3_content{height:80%;max-height:700px;padding:0 .75em;overflow:auto;margin-bottom:.25em}.cwv3_dialog .cwv3_btns{background:rgba(50,50,50,.5);bottom:0;overflow:hidden;padding:.45em .75em}.cwv3_dialog .cwv3_btns a{display:block;width:100%;text-align:center;color:#fff;font-weight:700;text-decoration:none;padding:.35em 0}.cwv3_dialog .cwv3_btns div{width:30%;display:inline-block}.cwv3_dialog .cwv3_btns .cwv3_exit{float:right}.cwv3_dialog .cwv3_btns .cwv3_exit a{background-color:red}.cwv3_dialog .cwv3_btns .cwv3_enter{float:left}.cwv3_dialog .cwv3_btns .cwv3_enter a{background-color:#0c3} .cwv3.dialog-overlay{position:fixed;top:0;left:0;width:100%;height:100%;z-index:99998}.cwv3_dialog{border:3px solid #CCC;background:#FFF;max-width:60%;max-height:90%;position:fixed;top:25%;left:25%;-webkit-box-shadow:2px 11px 48px #000;-moz-box-shadow:2px 11px 48px #000;box-shadow:2px 11px 48px #000;overflow:hidden;z-index:99999}.cwv3_dialog div{padding:.25em}.cwv3_dialog .cwv3.auth,.cwv3_dialog .cwv3.denied{height:100%}.cwv3_dialog .cwv3_title{color:#FFF;font-weight:700;text-align:center;background:red;margin-bottom:.25em}.cwv3_dialog .cwv3_content{height:80%;max-height:700px;padding:0 .75em;overflow:auto;margin-bottom:.25em}.cwv3_dialog .cwv3_btns{background:rgba(50,50,50,.5);bottom:0;overflow:hidden;padding:.45em .75em}.cwv3_dialog .cwv3_btns a{display:block;width:100%;text-align:center;color:#FFF;font-weight:700;text-decoration:none;padding:.35em 0}.cwv3_dialog .cwv3_btns div{width:30%;display:inline-block}.cwv3_dialog .cwv3_btns .cwv3_exit{float:right}.cwv3_dialog .cwv3_btns .cwv3_exit a{background-color:red}.cwv3_dialog .cwv3_btns .cwv3_enter{float:left}.cwv3_dialog .cwv3_btns .cwv3_enter a{background-color:#0C3}

View File

@ -126,6 +126,17 @@ window.cwv3 = ( function( window, document, $ ){
}; };
app.dialog_switch = function(){ app.dialog_switch = function(){
if ( 'denied' === app.cookie_data && ! cwv3_params.denial_enabled ) {
var cookie_data = {
expires : parseInt( cwv3_params.cookie_time ),
path : cwv3_params.cookie_path,
};
window.console.log( $.removeCookie( app.cookie_name, cookie_data ) );
app.cookie_data = undefined;
}
if( 'denied' === app.cookie_data ){ if( 'denied' === app.cookie_data ){
app.$auth.remove(); // Remove the main dialog app.$auth.remove(); // Remove the main dialog
if( 'redirect' === cwv3_params.denial_method && '' !== cwv3_params.denial_enabled ){ if( 'redirect' === cwv3_params.denial_method && '' !== cwv3_params.denial_enabled ){

2
js/cwv3.min.js vendored
View File

@ -1 +1 @@
window.cwv3=function(window,document,$){var app={};return app.cache=function(){app.$dialog=$(".cwv3_dialog"),app.$content=app.$dialog.find(".cwv3_content"),app.$auth=app.$dialog.find(".cwv3.auth"),app.$denial=app.$dialog.find(".cwv3.denied"),app.$exit=app.$dialog.find(".cwv3_exit"),app.$enter=app.$dialog.find(".cwv3_enter"),app.$buttons=app.$dialog.find(".cwv3_btns"),app.$title=app.$dialog.find(".cwv3_title"),app.$overlay=$(".cwv3.dialog-overlay"),app.cookie_name=""!==cwv3_params.cookie_name?"cwv3_cookie_"+cwv3_params.cookie_name:!1,app.redirect_url=""===cwv3_params.redirect_url||"#"===cwv3_params.redirect_url?"http://google.com":cwv3_params.redirect_url,app.cookie_data=$.cookie(app.cookie_name),app.diag={max_percent_width:50,max_percent_height:50},app.timeout=""},app.init=function(){app.cache(),$("body").on("click",".cwv3_enter",app.enter_handler),$("body").on("click",".cwv3_exit",app.exit_handler),$(window).resize(function(){clearTimeout(app.timeout),app.timeout=setTimeout(app.center_dialog,500)}),app.cookie_name&&app.dialog_switch()},app.center_dialog=function(){app.$content.css({height:""});var diag={x:app.$dialog.width(),y:app.$dialog.height()},vp={x:window.innerWidth,y:window.innerHeight},diag_pos={left:.5*(vp.x-diag.x),top:.5*(vp.y-diag.y)},content_height=app.$dialog.height()-10-app.$buttons.outerHeight(!0)-app.$title.outerHeight(!0);app.$content.animate({height:content_height},250,"swing",function(){app.$dialog.animate(diag_pos,250,"swing",app.cache)})},app.enter_handler=function(evt){evt.preventDefault(),app.set_cookie("enter");var $enter_url=app.$enter.find("a").attr("href");"#"===$enter_url||""===$enter_url?app.close_handler():window.location.replace($enter_url)},app.exit_handler=function(evt){evt.preventDefault(),"denied"!==app.cookie_data&&app.set_cookie("exit");var $exit_url=app.$exit.find("a").attr("href");"#"===$exit_url||""===$exit_url?window.location.replace("http://google.com"):window.location.replace($exit_url)},app.set_cookie=function(method){method="exit"===method?"denied":!0;var cookie_data={expires:parseInt(cwv3_params.cookie_time),path:cwv3_params.cookie_path};0===cookie_data.expires&&(cookie_data.expires=null),$.cookie(app.cookie_name,method,cookie_data)},app.log=function(){window.console&&window.console.log(Array.prototype.slice.call(arguments))},app.close_handler=function(){app.$dialog.fadeOut(100,function(){app.$overlay.fadeOut(100)})},app.dialog_switch=function(){"denied"===app.cookie_data?(app.$auth.remove(),"redirect"===cwv3_params.denial_method&&""!==cwv3_params.denial_enabled?window.location.replace(app.redirect_url):app.show_popup()):void 0===app.cookie_data&&(app.$denial.remove(),app.show_popup())},app.show_popup=function(){app.$overlay.fadeIn(200,function(){app.$dialog.fadeIn(100,function(){app.center_dialog()})})},$(document).ready(app.init),app}(window,document,jQuery); window.cwv3=function(window,document,$){var app={};return app.cache=function(){app.$dialog=$(".cwv3_dialog"),app.$content=app.$dialog.find(".cwv3_content"),app.$auth=app.$dialog.find(".cwv3.auth"),app.$denial=app.$dialog.find(".cwv3.denied"),app.$exit=app.$dialog.find(".cwv3_exit"),app.$enter=app.$dialog.find(".cwv3_enter"),app.$buttons=app.$dialog.find(".cwv3_btns"),app.$title=app.$dialog.find(".cwv3_title"),app.$overlay=$(".cwv3.dialog-overlay"),app.cookie_name=""!==cwv3_params.cookie_name?"cwv3_cookie_"+cwv3_params.cookie_name:!1,app.redirect_url=""===cwv3_params.redirect_url||"#"===cwv3_params.redirect_url?"http://google.com":cwv3_params.redirect_url,app.cookie_data=$.cookie(app.cookie_name),app.diag={max_percent_width:50,max_percent_height:50},app.timeout=""},app.init=function(){app.cache(),$("body").on("click",".cwv3_enter",app.enter_handler),$("body").on("click",".cwv3_exit",app.exit_handler),$(window).resize(function(){clearTimeout(app.timeout),app.timeout=setTimeout(app.center_dialog,500)}),app.cookie_name&&app.dialog_switch()},app.center_dialog=function(){app.$content.css({height:""});var diag={x:app.$dialog.width(),y:app.$dialog.height()},vp={x:window.innerWidth,y:window.innerHeight},diag_pos={left:.5*(vp.x-diag.x),top:.5*(vp.y-diag.y)},content_height=app.$dialog.height()-10-app.$buttons.outerHeight(!0)-app.$title.outerHeight(!0);app.$content.animate({height:content_height},250,"swing",function(){app.$dialog.animate(diag_pos,250,"swing",app.cache)})},app.enter_handler=function(evt){evt.preventDefault(),app.set_cookie("enter");var $enter_url=app.$enter.find("a").attr("href");"#"===$enter_url||""===$enter_url?app.close_handler():window.location.replace($enter_url)},app.exit_handler=function(evt){evt.preventDefault(),"denied"!==app.cookie_data&&app.set_cookie("exit");var $exit_url=app.$exit.find("a").attr("href");"#"===$exit_url||""===$exit_url?window.location.replace("http://google.com"):window.location.replace($exit_url)},app.set_cookie=function(method){method="exit"===method?"denied":!0;var cookie_data={expires:parseInt(cwv3_params.cookie_time),path:cwv3_params.cookie_path};0===cookie_data.expires&&(cookie_data.expires=null),$.cookie(app.cookie_name,method,cookie_data)},app.log=function(){window.console&&window.console.log(Array.prototype.slice.call(arguments))},app.close_handler=function(){app.$dialog.fadeOut(100,function(){app.$overlay.fadeOut(100)})},app.dialog_switch=function(){if("denied"===app.cookie_data&&!cwv3_params.denial_enabled){var cookie_data={expires:parseInt(cwv3_params.cookie_time),path:cwv3_params.cookie_path};window.console.log($.removeCookie(app.cookie_name,cookie_data)),app.cookie_data=void 0}"denied"===app.cookie_data?(app.$auth.remove(),"redirect"===cwv3_params.denial_method&&""!==cwv3_params.denial_enabled?window.location.replace(app.redirect_url):app.show_popup()):void 0===app.cookie_data&&(app.$denial.remove(),app.show_popup())},app.show_popup=function(){app.$overlay.fadeIn(200,function(){app.$dialog.fadeIn(100,function(){app.center_dialog()})})},$(document).ready(app.init),app}(window,document,jQuery);

View File

@ -3,7 +3,7 @@ Contributors: Phyrax
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=U5M6JBDKGF3EJ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=U5M6JBDKGF3EJ
Tags: warning, message, lading page, front page, enter page, adult content, consent, age verification, validation Tags: warning, message, lading page, front page, enter page, adult content, consent, age verification, validation
Requires at least: 3.5 Requires at least: 3.5
Tested up to: 4.3 Tested up to: 4.4
Stable tag: 3.6.7 Stable tag: 3.6.7
A plugin that provides a warning box with a ton more options completely re-written from the ground up. A plugin that provides a warning box with a ton more options completely re-written from the ground up.
@ -99,6 +99,12 @@ Please do not contact me with questions like this. If you cannot be descriptive
== Changelog == == Changelog ==
= 3.6.7 =
* Fixed conditional being too strict [#34](https://github.com/JayWood/content-warning-v3/issues/34)
* Fixed plugin homepage link [#31](https://github.com/JayWood/content-warning-v3/issues/31)
* Removed uninstall hook for now - Options API needs to be updated
* Fixed denial toggle to actually remove denial text if it was once on, but now off.
= 3.6.6 = = 3.6.6 =
* Fixed CSS issues for background images and css overrides * Fixed CSS issues for background images and css overrides