Your IP : 216.73.216.247


Current Path : /home/nicholsonsmith/public_html/plugins/system/mojoomdisclaimer/
Upload File :
Current File : /home/nicholsonsmith/public_html/plugins/system/mojoomdisclaimer/mojoomdisclaimer.js

/**
 * MOJoomDisclaimer Extension for Joomla By MO'WebCreation
 * 
 * 
 * @copyright	Copyright (C) 2014 MO'WebCreation. Mickaël Gerard André Outhier.  All rights reserved.
 * @license		GNU General Public License version 2. Please check the "read me" file provided in the package
 * 
 * @Website 	http://www.mo-web-creation.com/
 * @Support 	https://github.com/MOWebCreation
 *
 */
 
if(!jQuery) {
	alert('MOJoomDisclaimer need jQuery');
}

jQuery(document).ready(function(){

	if(window.MODisclaimer.token == false && window.MODisclaimer.disclaimtype == 1){
		
		//Disclaimer loaded in page
		jQuery('#mo-disclaimer-links').on('click', 'a#mo-disclaim-enter', function(){
			document.location.href = window.MODisclaimer.url;
			return false;
		});
		jQuery('#mo-disclaimer-links').on('click', 'a#mo-disclaim-exit', function(){
			document.location.href = window.MODisclaimer.exitUrl;
			return false;
		});
		
		
	} else if(window.MODisclaimer.token == false && window.MODisclaimer.disclaimtype == 0){
		
		/*** Disclaimer loaded in a modal popup **/
		jQuery('#sbox-btn-close').css('display', 'none');
		
		if(window.MODisclaimer.rwd == 1) {
			//Responsive modal
			var winWidth = jQuery(window).width();
			var winHeight = jQuery(window).height();
			
			if(winWidth >= 900) {//screen
				jQuery('body').css('overflow', 'hidden');
				var modalSize = {x: 900, y: 600};
				var modalOpen = null;
			}
			
			if(winWidth < 900 && winWidth >= 700) {//pad and landscape display
				jQuery('body').css('overflow', 'hidden');
				var modalSize = {x: 500, y: 300};
				var modalOpen = null;
			}
			
			if(winWidth < 500) {//handset
				var modalSize = {x: winWidth, y: winHeight};
				var modalOpen = function(){
					$('sbox-window').setStyle('top', 0);
					$('sbox-window').setStyle('height', winHeight);
					$('sbox-window').setStyle('border-radius', 0);
				}
			}
			
		} else { var modalSize = {x: 600, y: 450} }
		
		SqueezeBox.initialize({
			closable: false,
			overlayOpacity: window.MODisclaimer.overlay,
			size: modalSize,
			onOpen: modalOpen
		});
		
		SqueezeBox.open($('mo-disclaim-modal-inner'), {handler: 'adopt'});
		
		jQuery('#mo-disclaimer-links').on('click', 'a#mo-disclaim-enter', function(){
			document.location.href = window.MODisclaimer.url;
			return false;
		});
		jQuery('#mo-disclaimer-links').on('click', 'a#mo-disclaim-exit', function(){
			document.location.href = window.MODisclaimer.exitUrl;
			return false;
		});
	}	
});