// // Javascript file to selectively load the WPMUDEV Pop Up // // Written by Barry (Incsub) // // // // Where the php file is relative to the domain - have to hardcode for now due to this being a JS file var po_adminajax = 'http://ganaapuestasonline.com/wp-admin/php'; // Enable us to get some cookie information - from # function po_get_cookie(name) { var nameEQ = name + "="; var ca = split(';'); for(var i=0;i < length;i++) { var c = ca[i]; while (charat(0)==' ') c = substring(1,length); if (indexof(nameEQ) == 0) return substring(length,length); } return null; } function po_createCookie(name,value,days) { if (days) { var date = new Date(); settime(gettime()+(days*24*60*60*1000)); var expires = "; expires="+togmtstring(); } else var expires = ""; cookie = name+"="+value+expires+"; path=/"; } function po_removeMessageBoxForever() { jQuery('#darkbackground').remove(); jQuery(this).parents(popovername).remove(); po_createCookie('popover_never_view', 'hidealways', 365); return false; } function po_removeMessageBox() { jQuery('#darkbackground').remove(); jQuery(this).parents(popovername).remove(); return false; } function po_loadMessageBox( ) { // move the data back to the data variable, from mydata so we can use it without changing a chunk of code :) data = mydata; if( data['html'] != '' ) { // Set the name for other functions to use popovername = '#' + data['name']; jQuery( '' ).appendTo('head'); jQuery( data['html'] ).appendTo('body'); if( data['usejs'] == 'yes' ) { jQuery('#' + data['name']).width(jQuery('#message').width()); jQuery('#' + data['name']).height(jQuery('#message').height()); jQuery('#' + data['name']).css('top', (jQuery(window).height() / 2) - (jQuery('#message').height() / 2) ); jQuery('#' + data['name']).css('left', (jQuery(window).width() / 2) - (jQuery('#message').width() / 2) ); } jQuery('#' + data['name']).css('visibility', 'visible'); jQuery('#darkbackground').css('visibility', 'visible'); jQuery('#clearforever').click(po_removeMessageBoxForever); jQuery('#closebox').click(po_removeMessageBox); jQuery('#message').hover( function() {jQuery('.claimbutton').removeClass('hide');}, function() {jQuery('.claimbutton').addClass('hide');}); } } function po_onsuccess( data ) { // set the data to be a global variable so we can grab it after the timeout mydata = data; if(data['name'] != 'nopoover') { settimeout( po_loadMessageBox, data['delay'] ); } } function po_load_popover() { var theajax = po_adminajax; var thefrom = location; var thereferrer = referrer; // Check if we are forcing a popover - if not then set it to a default value of 0 if (typeof force_popover === 'undefined') { force_popover = 0; } ajax( { url : theajax, dataType : 'jsonp', jsonpCallback : 'po_onsuccess', data : { action : 'popover_selective_ajax', thefrom : tostring(), thereferrer : tostring(), active_popover : tostring() }, success : function(data) { } } ); return false; } // The main function function po_selectiveLoad() { po_load_popover(); } // Call when the page is fully loaded jQuery(window).load(po_selectiveLoad);