Recompile and finalize javascript
This commit is contained in:
parent
0247af52e8
commit
2cdae72f65
@ -7,6 +7,7 @@ window.cwv3 = ( function( window, document, $ ){
|
||||
var app = {};
|
||||
|
||||
app.cache = function(){
|
||||
app.$body = $( 'body' );
|
||||
app.$dialog = $('.cwv3_dialog');
|
||||
app.$content = app.$dialog.find( '.cwv3_content' );
|
||||
app.$auth = app.$dialog.find( '.cwv3.auth' );
|
||||
@ -30,8 +31,8 @@ window.cwv3 = ( function( window, document, $ ){
|
||||
app.cache();
|
||||
|
||||
// Register handlers
|
||||
$( 'body' ).on( 'click', '.cwv3_enter', app.enter_handler );
|
||||
$( 'body' ).on( 'click', '.cwv3_exit', app.exit_handler );
|
||||
app.$body.on( 'click', '.cwv3_enter', app.enter_handler );
|
||||
app.$body.on( 'click', '.cwv3_exit', app.exit_handler );
|
||||
|
||||
// Don't resize EVERY time, set it to an interval of half a second
|
||||
$( window ).resize( function(){
|
||||
|
2
js/cwv3.min.js
vendored
2
js/cwv3.min.js
vendored
@ -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(){if("denied"===app.cookie_data&&!cwv3_params.denial_enabled){var cookie_data={expires:parseInt(cwv3_params.cookie_time),path:cwv3_params.cookie_path};$.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&&null!==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.$body=$("body"),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(),app.$body.on("click",".cwv3_enter",app.enter_handler),app.$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};$.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&&null!==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);
|
Loading…
x
Reference in New Issue
Block a user