Remove ALL references to colorbox

This commit is contained in:
Jay Wood
2014-11-17 10:17:11 -05:00
parent acef3d8b6f
commit 8bb32ebea6
4 changed files with 32 additions and 27 deletions

View File

@ -37,16 +37,12 @@ class CWV3 {
public function register_frontend_data() { public function register_frontend_data() {
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
// Colorbox w/ MIT License
wp_register_style( 'colorbox', plugins_url( 'js/colorbox.1.5.14/colorbox.css', dirname( __FILE__ ) ), '', '1.5.10', 'ALL' ); // Keeping old css version
wp_register_script( 'colorbox_js', plugins_url( "js/colorbox.1.5.14/jquery.colorbox{$min}.js", dirname( __FILE__ ) ), array( 'jquery' ), '1.5.14', true );
// Jquery Cookie // Jquery Cookie
wp_register_script( 'jquery_cookie', plugins_url( "js/jquery_cookie{$min}.js", dirname( __FILE__ ) ), array( 'jquery' ), '1.4.1', true ); wp_register_script( 'jquery_cookie', plugins_url( "js/jquery_cookie{$min}.js", dirname( __FILE__ ) ), array( 'jquery' ), '1.4.1', true );
// Main data // Main data
wp_register_script( 'cwv3_js', plugins_url( "js/cwv3{$min}.js", dirname( __FILE__ ) ), array( 'colorbox_js', 'jquery_cookie' ), '3.6.0', true ); wp_register_script( 'cwv3_js', plugins_url( "js/cwv3{$min}.js", dirname( __FILE__ ) ), array( 'jquery_cookie' ), '3.6.0', true );
wp_register_style( 'cwv3_css', plugins_url( "css/cwv3{$min}.css", dirname( __FILE__ ) ), array( 'colorbox' ), '1.0' ); wp_register_style( 'cwv3_css', plugins_url( "css/cwv3{$min}.css", dirname( __FILE__ ) ), '', '1.0' );
} }
public function get_cookie_name(){ public function get_cookie_name(){

View File

@ -62,6 +62,7 @@ function cwv3_get_js_dialog(){
ob_start(); ob_start();
?> ?>
<!-- CWV3 JS Dialog -->
<div id="cwv3_dialog" class="cwv3_dialog js"> <div id="cwv3_dialog" class="cwv3_dialog js">
<div class="cwv3 auth"> <div class="cwv3 auth">
<div class="cwv3_title"><?php echo esc_attr( $cwv3_title ); ?></div> <div class="cwv3_title"><?php echo esc_attr( $cwv3_title ); ?></div>
@ -85,6 +86,7 @@ function cwv3_get_js_dialog(){
</div> </div>
</div> </div>
</div> </div>
<!-- END CWV3 JS Dialog -->
<?php <?php
$dialog_output = ob_get_clean(); $dialog_output = ob_get_clean();
return apply_filters( 'cwv3_js_dialog_output', $dialog_output ); return apply_filters( 'cwv3_js_dialog_output', $dialog_output );

View File

@ -5,10 +5,14 @@ window.cwv3 = ( function( window, document, $ ){
app.cache = function(){ app.cache = function(){
app.$dialog = $('.cwv3_dialog'); app.$dialog = $('.cwv3_dialog');
app.$auth = app.$dialog.find( '.cwv3.auth' ); app.$auth = app.$dialog.find( '.cwv3.auth' );
app.$denial = app.$dialog.find( '.cwv3.denied' ); app.$denial = app.$dialog.find( '.cwv3.denied' );
app.$exit = app.$dialog.find( '.cwv3_exit' ); app.$exit = app.$dialog.find( '.cwv3_exit' );
app.$enter = app.$dialog.find( '.cwv3_enter' ); app.$enter = app.$dialog.find( '.cwv3_enter' );
app.cookie_name = ( '' !== cwv3_params.cookie_name ) ? 'cwv3_cookie_' + cwv3_params.cookie_name : false;
app.redirect_url = ( '' === cwv3_params.redirect_url || '#' === cwv3_params.redirect_url ) ? 'http://google.com' : cwv3_params.redirect_url;
$.colorbox.resize();
}; };
app.init = function(){ app.init = function(){
@ -18,7 +22,11 @@ window.cwv3 = ( function( window, document, $ ){
$( 'body' ).on( 'click', '.cwv3_enter', app.enter_handler ); $( 'body' ).on( 'click', '.cwv3_enter', app.enter_handler );
$( 'body' ).on( 'click', '.cwv3_exit', app.exit_handler ); $( 'body' ).on( 'click', '.cwv3_exit', app.exit_handler );
var cookie_name = 'cwv3_cookie_' + cwv3_params.id; if( app.cookie_name ){
// We need to set a cookie, so show the dialog.
app.show_popup();
}
}; };
@ -36,21 +44,20 @@ window.cwv3 = ( function( window, document, $ ){
// Set the cookie // Set the cookie
}; };
app.show_colorbox = function(){ app.show_popup = function(){
// Here we show colorbox
$.colorbox({ };
scrolling : false,
overlayClose : false, app.dialog_switch = function(){
escKey : false, var cookie_data = $.cookie( app.cookie_name );
inline : true, if( 'denied' === cookie_data ){
href : '#cwv3_dialog', //app.$auth.remove(); // Remove the main dialog
loop : false, if( 'redirect' === cwv3_params.denial_method ){
className : 'cwv3_dialog', window.location.replace( app.redirect_url );
opacity : cwv3_params.opacity, }
onLoad : function(){ } else if( undefined === cookie_data ){
$('#cboxClose').remove(); // app.$denial.remove(); // Remove the denied box instead.
}, }
});
}; };
$( document ).ready( app.init ); $( document ).ready( app.init );
@ -107,4 +114,4 @@ jQuery(document).ready(function($) {
} }
});*/ }); */

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.$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.init=function(){app.cache(),$("body").on("click",".cwv3_enter",app.enter_handler),$("body").on("click",".cwv3_exit",app.exit_handler)},app.enter_handler=function(evt){evt.preventDefault()},app.exit_handler=function(evt){evt.preventDefault()},app.set_cookie=function(){},app.show_colorbox=function(){$.colorbox({scrolling:!1,overlayClose:!1,escKey:!1,inline:!0,href:"#cwv3_dialog",loop:!1,className:"cwv3_dialog",opacity:cwv3_params.opacity,onLoad:function(){$("#cboxClose").remove()}})},$(document).ready(app.init),app}(window,document,jQuery); window.cwv3=function(window,document,$){var app={};return app.cache=function(){app.$dialog=$(".cwv3_dialog"),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.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,$.colorbox.resize()},app.init=function(){app.cache(),$("body").on("click",".cwv3_enter",app.enter_handler),$("body").on("click",".cwv3_exit",app.exit_handler),app.cookie_name&&app.show_popup()},app.enter_handler=function(evt){evt.preventDefault()},app.exit_handler=function(evt){evt.preventDefault()},app.set_cookie=function(){},app.show_popup=function(){},app.dialog_switch=function(){var cookie_data=$.cookie(app.cookie_name);"denied"===cookie_data&&"redirect"===cwv3_params.denial_method&&window.location.replace(app.redirect_url)},$(document).ready(app.init),app}(window,document,jQuery);