CLI_ACCEPT_COOKIE_NAME=(typeof CLI_ACCEPT_COOKIE_NAME!=='undefined' ? CLI_ACCEPT_COOKIE_NAME:'viewed_cookie_policy');
CLI_PREFERNCE_COOKIE=(typeof CLI_PREFERNCE_COOKIE!=='undefined' ? CLI_PREFERNCE_COOKIE:'CookieLawInfoConsent');
CLI_ACCEPT_COOKIE_EXPIRE=(typeof CLI_ACCEPT_COOKIE_EXPIRE!=='undefined' ? CLI_ACCEPT_COOKIE_EXPIRE:365);
CLI_COOKIEBAR_AS_POPUP=(typeof CLI_COOKIEBAR_AS_POPUP!=='undefined' ? CLI_COOKIEBAR_AS_POPUP:false);
var CLI_Cookie={
set: function (name, value, days){
var secure="";
if(true===Boolean(Cli_Data.secure_cookies) ) secure=";secure";
var domain=(Cli_Data.cookieDomain!=='' ? ";domain=" + Cli_Data.cookieDomain:'');
var date=new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires=";expires=" + date.toGMTString();
if(days < 1){
this.eraseCookie(name,expires);
}else{
document.cookie=name + "=" + value + secure + expires + domain + ";path=/";
}},
read: function (name){
var nameEQ=name + "=";
var ca=document.cookie.split(';');
for (var i=0; i < ca.length; i++){
var c=ca[i];
while (c.charAt(0)==' '){
c=c.substring(1, c.length);
}
if(c.indexOf(nameEQ)===0){
return c.substring(nameEQ.length, c.length);
}}
return null;
},
erase: function (name){
this.set(name, "", -10);
},
eraseCookie: function(name, expires, index){
if(this.cookieExist(name)===false){
return false;
}
var _hostname=window.location.hostname;
var value="";
if(typeof index==='undefined'){
index=0;
}
if(index===0){
_hostname=_hostname.substring(_hostname.lastIndexOf(".", _hostname.lastIndexOf(".")-1));
}
else if(index===1){
_hostname=(Cli_Data.cookieDomain!=='' ? Cli_Data.cookieDomain:'');
}
else if(index===2){
if(_hostname.indexOf("www")!=1){
_hostname=_hostname.replace('www','');
}}
index=index + 1;
document.cookie=name + "=" + value + expires + ";domain="+ _hostname + ";path=/";
if(index <=2){
this.eraseCookie(name, expires, index);
}},
exists: function (name){
return (this.read(name)!==null);
},
getallcookies:function(){
var pairs=document.cookie.split(";");
var cookieslist={};
for (var i=0; i < pairs.length; i++){
var pair=pairs[i].split("=");
cookieslist[(pair[0] + '').trim()]=unescape(pair[1]);
}
return cookieslist;
},
cookieExist: function(name){
cookie_pattern=new RegExp("^(.*;)?\\s*"+name+"\\s*=\\s*[^;]+(.*)?$");
if(!document.cookie.match(cookie_pattern)){
return false;
}
return true;
}}
var CLI=
{
bar_config:{},
consent:{},
allowedCategories:[],
showagain_config:{},
set:function(args){
if(typeof JSON.parse!=="function"){
console.log("CookieLawInfo requires JSON.parse but your browser doesn't support it");
return;
}
if(typeof args.settings!=='object'){
this.settings=JSON.parse(args.settings);
}else{
this.settings=args.settings;
}
this.bar_elm=jQuery(this.settings.notify_div_id);
this.showagain_elm=jQuery(this.settings.showagain_div_id);
this.banner_heading=jQuery('#wt-cli-cookie-banner-title');
this.main_button=jQuery('.cli-plugin-main-button');
this.main_link=jQuery('.cli-plugin-main-link');
this.reject_link=jQuery('.cookie_action_close_header_reject');
this.settings_link=jQuery('.cli_settings_button');
this.delete_link=jQuery(".cookielawinfo-cookie-delete");
this.accept_all_button=jQuery('.wt-cli-accept-all-btn');
if(this.settings.cookie_bar_as=='popup'){
CLI_COOKIEBAR_AS_POPUP=true;
}
this.mayBeSetPreferenceCookie();
this.cliRenewConsent();
this.configBar();
this.toggleBar();
this.attachDelete();
this.attachEvents();
this.configButtons();
this.addStyleAttribute();
this.settingsPopUp();
this.cookieLawInfoRunCallBacks();
this.acceptPageNavigation();
var cli_hidebar_on_readmore=this.hideBarInReadMoreLink();
if(this.settings.scroll_close===true&&cli_hidebar_on_readmore===false){
window.addEventListener("scroll",CLI.closeOnScroll, false);
}},
hideBarInReadMoreLink:function(){
if(CLI.settings.button_2_hidebar===true&&this.main_link.length>0&&this.main_link.hasClass('cli-minimize-bar')){
jQuery('.wt-cli-cookie-bar-container').addClass('wt-cli-hide-bar');
this.hideHeader();
this.showagain_elm.slideDown(this.settings.animate_speed_show);
return true;
}
return false;
},
settingsPopUp:function(){
jQuery(document).on('click keypress','.cli_settings_button',function(e){
var key=e.which;
e.preventDefault();
if(key===1||key===13){
if(CLI.settings.cookie_setting_popup==true){
jQuery('#cliSettingsPopup').addClass("cli-show").css({'opacity':0}).animate({'opacity':1});
jQuery('#cliSettingsPopup').removeClass('cli-blowup cli-out').addClass("cli-blowup");
jQuery('#cliSettingsPopup').attr('aria-hidden', false);
jQuery('body').addClass("cli-modal-open");
jQuery(".cli-settings-overlay").addClass("cli-show");
jQuery("#cookie-law-info-bar").css({'opacity':.1});
jQuery("#cliModalClose").focus();
if(!jQuery('.cli-settings-mobile').is(':visible')){
jQuery('#cliSettingsPopup').find('.cli-nav-link:eq(0)').click();
}}else{
jQuery('#cookie-law-info-bar .cli-tab-container').slideToggle(CLI.settings.animate_speed_show);
}}
});
jQuery('#cliModalClose').click(function(){
CLI.settingsPopUpClose();
});
jQuery('#cliModalClose').keydown(function(e){
var key=e.which
if(key===9){
if(e.shiftKey===true){
e.preventDefault()
jQuery('#wt-cli-privacy-save-btn').focus()
}}
});
document.addEventListener('keydown', function(e){
var key=e.which;
if(key===27&&jQuery('#cliSettingsPopup').hasClass('cli-show')){
CLI.settingsPopUpClose();
}});
jQuery("#cliSettingsPopup").click(function(e){
if(!(document.getElementsByClassName('cli-modal-dialog')[0].contains(e.target))){
CLI.settingsPopUpClose();
}});
jQuery('.cli_enable_all_btn').click(function(){
var cli_toggle_btn=jQuery(this);
var enable_text=cli_toggle_btn.attr('data-enable-text');
var disable_text=cli_toggle_btn.attr('data-disable-text');
if(cli_toggle_btn.hasClass('cli-enabled')){
CLI.disableAllCookies();
cli_toggle_btn.html(enable_text);
}else{
CLI.enableAllCookies();
cli_toggle_btn.html(disable_text);
}
jQuery(this).toggleClass('cli-enabled');
});
this.settingsTabbedAccordion();
this.toggleUserPreferenceCheckBox();
this.privacyReadmore();
},
settingsTabbedAccordion:function(){
jQuery(document).on('click keypress','.cli-tab-header',function(e){
if(!(jQuery(e.target).hasClass('cli-slider')||jQuery(e.target).hasClass('cli-user-preference-checkbox'))){
var key=e.which;
e.preventDefault();
if(key===1||key===13){
var currentElement=jQuery(this);
var tabLink=currentElement.closest('.cli-tab-header').find('.cli-nav-link');
if(currentElement.hasClass("cli-tab-active")){
currentElement.removeClass("cli-tab-active");
currentElement.siblings(".cli-tab-content").slideUp(200);
tabLink.attr('aria-expanded', false);
}else{
jQuery(".cli-tab-header").removeClass("cli-tab-active");
currentElement.addClass("cli-tab-active");
jQuery(".cli-tab-content").slideUp(200);
currentElement.siblings(".cli-tab-content").slideDown(200);
tabLink.attr('aria-expanded', true);
}}
}});
},
settingsPopUpClose:function(){
jQuery('#cliSettingsPopup').removeClass('cli-show');
jQuery('#cliSettingsPopup').addClass('cli-out');
jQuery('#cliSettingsPopup').attr('aria-hidden', true);
jQuery('body').removeClass("cli-modal-open");
jQuery(".cli-settings-overlay").removeClass("cli-show");
jQuery("#cookie-law-info-bar").css({'opacity':1});
jQuery("#cookie-law-info-bar .cli_settings_button").focus();
},
toggleUserPreferenceCheckBox:function(){
jQuery('.cli-user-preference-checkbox').each(function(){
var categoryCookie='cookielawinfo-'+jQuery(this).attr('data-id');
var categoryCookieValue=CLI_Cookie.read(categoryCookie);
if(categoryCookieValue==null){
if(jQuery(this).is(':checked')){
CLI_Cookie.set(categoryCookie,'yes',CLI_ACCEPT_COOKIE_EXPIRE);
}else{
CLI_Cookie.set(categoryCookie,'no',CLI_ACCEPT_COOKIE_EXPIRE);
}}else{
if(categoryCookieValue=="yes"){
jQuery(this).prop("checked",true);
}else{
jQuery(this).prop("checked",false);
}}
});
jQuery('.cli-user-preference-checkbox').click(function(){
var dataID=jQuery(this).attr('data-id');
var currentToggleElm=jQuery('.cli-user-preference-checkbox[data-id='+dataID+']');
if(jQuery(this).is(':checked')){
CLI_Cookie.set('cookielawinfo-'+dataID,'yes',CLI_ACCEPT_COOKIE_EXPIRE);
currentToggleElm.prop('checked',true);
}else{
CLI_Cookie.set('cookielawinfo-'+dataID,'no',CLI_ACCEPT_COOKIE_EXPIRE);
currentToggleElm.prop('checked',false);
}
CLI.checkCategories();
CLI.generate_user_preference_cookie();
CLI.generateConsent();
});
},
attachEvents:function(){
jQuery(document).on('click keypress','.wt-cli-privacy-btn',function(e){
var key=e.which;
e.preventDefault();
if(key===1||key===13){
var action=jQuery(this).attr('data-cli-action');
if(action==='accept_all'){
CLI.enableAllCookies();
}
CLI.accept_close();
CLI.saveLog('accept');
CLI.settingsPopUpClose();
}});
jQuery('.wt-cli-privacy-overview-actions').find('a').last().keydown(function(e){
var key=e.which
if(key===9){
if(e.shiftKey===false){
e.preventDefault()
jQuery('#cliModalClose').focus()
}}
});
jQuery(document).on('click keypress','.cli_action_button',function(e){
var key=e.which;
e.preventDefault();
if(key===1||key===13){
var elm=jQuery(this);
var button_action=elm.attr('data-cli_action');
var open_link=elm[0].hasAttribute("href")&&elm.attr("href").charAt(0)!=='#' ? true:false;
var new_window=false;
if(button_action=='accept'){
if(e.originalEvent!==undefined){
if(CLI.settings.accept_all==true){
CLI.enableAllCookies();
}}else{
CLI.settingsPopUpClose();
}
CLI.accept_close();
new_window=CLI.settings.button_1_new_win ? true:false;
}
else if(button_action=='accept_all'){
CLI.enableAllCookies();
CLI.accept_close();
new_window=CLI.settings.button_7_new_win ? true:false;
}
else if(button_action=='reject'){
CLI.disableAllCookies();
CLI.reject_close();
new_window=CLI.settings.button_3_new_win ? true:false;
}
CLI.saveLog(button_action);
if(open_link){
if(new_window){
window.open(elm.attr("href"),'_blank');
}else{
window.location.href=elm.attr("href");
}}
}});
jQuery(document).on('click','.cli_cookie_close_button',function(e){
e.preventDefault();
var elm=jQuery(this);
var button_action=elm.attr('data-cli_action');
if(CLI.settings.accept_all==true){
CLI.enableAllCookies();
}
CLI.accept_close();
CLI.saveLog(button_action);
});
},
saveLog:function(button_action){
if(CLI.settings.logging_on){
var ccpaOptedOut=cliBlocker.ccpaOptedOut();
cookies=CLI_Cookie.getallcookies();
cookies.ccpaOptout=ccpaOptedOut;
jQuery.ajax({
url: log_object.ajax_url,
type: 'POST',
data:{
action: 'wt_log_visitor_action',
wt_clicked_button_id: '',
wt_user_action:button_action,
cookie_list:cookies
},
success:function (response){
}});
}},
attachDelete:function(){
this.delete_link.click(function (){
CLI_Cookie.erase(CLI_ACCEPT_COOKIE_NAME);
for(var k in Cli_Data.nn_cookie_ids){
CLI_Cookie.erase(Cli_Data.nn_cookie_ids[k]);
}
CLI.generate_user_preference_cookie();
CLI.generateConsent();
window.location.reload();
return false;
});
},
configButtons:function(){
this.main_button.css('color',this.settings.button_1_link_colour);
if(this.settings.button_1_as_button){
this.main_button.css('background-color',this.settings.button_1_button_colour);
this.main_button.hover(function (){
jQuery(this).css('background-color',CLI.settings.button_1_button_hover);
},function (){
jQuery(this).css('background-color',CLI.settings.button_1_button_colour);
});
}
this.main_link.css('color',this.settings.button_2_link_colour);
if(this.settings.button_2_as_button){
this.main_link.css('background-color',this.settings.button_2_button_colour);
this.main_link.hover(function (){
jQuery(this).css('background-color',CLI.settings.button_2_button_hover);
},function (){
jQuery(this).css('background-color',CLI.settings.button_2_button_colour);
});
}
this.reject_link.css('color',this.settings.button_3_link_colour);
if(this.settings.button_3_as_button){
this.reject_link.css('background-color',this.settings.button_3_button_colour);
this.reject_link.hover(function (){
jQuery(this).css('background-color',CLI.settings.button_3_button_hover);
},function (){
jQuery(this).css('background-color',CLI.settings.button_3_button_colour);
});
}
this.settings_link.css('color',this.settings.button_4_link_colour);
if(this.settings.button_4_as_button){
this.settings_link.css('background-color',this.settings.button_4_button_colour);
this.settings_link.hover(function (){
jQuery(this).css('background-color',CLI.settings.button_4_button_hover);
},function (){
jQuery(this).css('background-color',CLI.settings.button_4_button_colour);
});
}
this.accept_all_button.css('color',this.settings.button_7_link_colour);
if(this.settings.button_7_as_button){
this.accept_all_button.css('background-color',this.settings.button_7_button_colour);
this.accept_all_button.hover(function (){
jQuery(this).css('background-color',CLI.settings.button_7_button_hover);
},function (){
jQuery(this).css('background-color',CLI.settings.button_7_button_colour);
});
}},
toggleBar:function(){
if(CLI_COOKIEBAR_AS_POPUP){
this.barAsPopUp(1);
}
if(CLI.settings.cookie_bar_as=='widget'){
this.barAsWidget(1);
}
if(this.settings.show_once_yn){
setTimeout(function(){
if(!CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)){
CLI.close_header();
}},CLI.settings.show_once);
}
this.showagain_elm.on('click keypress', function (e){
var key=e.which;
if(key===1||key===13){
e.preventDefault();
CLI.showagain_elm.slideUp(CLI.settings.animate_speed_hide, function(){
CLI.bar_elm.slideDown(CLI.settings.animate_speed_show);
CLI.refocusElement();
if(CLI_COOKIEBAR_AS_POPUP){
CLI.showPopupOverlay();
}});
}});
},
configShowAgain:function(){
this.showagain_config={
'background-color': this.settings.background,
'color':this.settings.text,
'position': 'fixed',
'font-family': this.settings.font_family
};
if(this.settings.border_on){
var border_to_hide='border-' + this.settings.notify_position_vertical;
this.showagain_config['border']='1px solid ' + this.l1hs(this.settings.border);
this.showagain_config[border_to_hide]='none';
}
var cli_win=jQuery(window);
var cli_winw=cli_win.width();
var showagain_x_pos=this.settings.showagain_x_position;
if(cli_winw<300){
showagain_x_pos=10;
this.showagain_config.width=cli_winw-20;
}else{
this.showagain_config.width='auto';
}
var cli_defw=cli_winw>400 ? 500:cli_winw-20;
if(CLI_COOKIEBAR_AS_POPUP){
var sa_pos=this.settings.popup_showagain_position;
var sa_pos_arr=sa_pos.split('-');
if(sa_pos_arr[1]=='left'){
this.showagain_config.left=showagain_x_pos;
}else if(sa_pos_arr[1]=='right'){
this.showagain_config.right=showagain_x_pos;
}
if(sa_pos_arr[0]=='top'){
this.showagain_config.top=0;
}else if(sa_pos_arr[0]=='bottom'){
this.showagain_config.bottom=0;
}
this.bar_config['position']='fixed';
}else if(this.settings.cookie_bar_as=='widget'){
this.showagain_config.bottom=0;
if(this.settings.widget_position=='left'){
this.showagain_config.left=showagain_x_pos;
}else if(this.settings.widget_position=='right'){
this.showagain_config.right=showagain_x_pos;
}}else{
if(this.settings.notify_position_vertical=="top"){
this.showagain_config.top='0';
}
else if(this.settings.notify_position_vertical=="bottom"){
this.bar_config['position']='fixed';
this.bar_config['bottom']='0';
this.showagain_config.bottom='0';
}
if(this.settings.notify_position_horizontal=="left"){
this.showagain_config.left=showagain_x_pos;
}else if(this.settings.notify_position_horizontal=="right"){
this.showagain_config.right=showagain_x_pos;
}}
this.showagain_elm.css(this.showagain_config);
},
configBar:function(){
var templateID='';
this.bar_config={
'background-color':this.settings.background,
'color':this.settings.text,
'font-family':this.settings.font_family
};
if(jQuery(".wt-cli-template")[0]){
var templateElm=jQuery(".wt-cli-template");
var templateClasses=templateElm.attr('class');
var templateClasses=templateClasses.split(" ");
var matchingID=templateClasses.filter(function (value){
return value.match(/\bcli-style/);
});
templateID=matchingID[0];
this.bar_elm.attr('data-template-id',templateID);
}
if(jQuery(".wt-cli-category-widget")[0]){
this.bar_elm.addClass('wt-cli-category-widget-active');
}
if(this.settings.cookie_setting_popup===false){
this.barPopupStyle();
}
if(this.settings.notify_position_vertical=="top"){
this.bar_config['top']='0';
if(this.settings.header_fix===true){
this.bar_config['position']='fixed';
}}else{
this.bar_config['bottom']='0';
}
this.configShowAgain();
this.bar_elm.css(this.bar_config).hide();
},
l1hs:function(str){
if(str.charAt(0)=="#"){
str=str.substring(1, str.length);
}else{
return "#" + str;
}
return this.l1hs(str);
},
close_header:function(){
CLI_Cookie.set(CLI_ACCEPT_COOKIE_NAME,'yes',CLI_ACCEPT_COOKIE_EXPIRE);
if(CLI.settings.accept_all==true){
CLI.enableAllCookies();
}
CLI.accept_close();
this.hideHeader();
CLI.saveLog('accept');
},
accept_close:function(){
this.hidePopupOverlay();
CLI_Cookie.set(CLI_ACCEPT_COOKIE_NAME,'yes',CLI_ACCEPT_COOKIE_EXPIRE);
if(this.settings.notify_animate_hide){
this.bar_elm.slideUp(this.settings.animate_speed_hide,cliBlocker.runScripts);
}else{
this.bar_elm.hide(0,cliBlocker.runScripts);
}
if(this.settings.showagain_tab){
this.showagain_elm.slideDown(this.settings.animate_speed_show);
}
this.generate_user_preference_cookie();
this.generateConsent();
CLI.cookieLawInfoRunCallBacks();
if(this.settings.accept_close_reload===true){
this.reload_current_page();
}
return false;
},
reject_close:function(){
this.hidePopupOverlay();
for(var k in Cli_Data.nn_cookie_ids){
CLI_Cookie.erase(Cli_Data.nn_cookie_ids[k]);
}
CLI_Cookie.set(CLI_ACCEPT_COOKIE_NAME,'no',CLI_ACCEPT_COOKIE_EXPIRE);
if(this.settings.notify_animate_hide){
this.bar_elm.slideUp(this.settings.animate_speed_hide,cliBlocker.runScripts);
}else{
this.bar_elm.hide(0,cliBlocker.runScripts);
}
if(this.settings.showagain_tab){
this.showagain_elm.slideDown(this.settings.animate_speed_show);
}
this.generate_user_preference_cookie();
CLI.generateConsent();
if(this.settings.reject_close_reload===true){
this.reload_current_page();
}
return false;
},
generate_user_preference_cookie:function(){
var cli_user_preference_arr=new Array();
var cli_user_preference_val='';
if(CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)){
cli_user_preference_arr.push('cli-'+CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME));
}
jQuery('.cli-user-preference-checkbox').each(function(){
if(jQuery(this).is(':checked')){
cli_user_preference_arr.push(jQuery(this).attr('data-id')+'-yes');
}else{
cli_user_preference_arr.push(jQuery(this).attr('data-id')+'-no');
}});
if(cli_user_preference_arr.length>0){
cli_user_preference_val=Cli_Data.current_lang+'-'+cli_user_preference_arr.join('-');
}
CLI_Cookie.set('cli_user_preference',cli_user_preference_val,CLI_ACCEPT_COOKIE_EXPIRE);
},
isBase64:function(str){
if(str===''||str.trim()===''){ return false; }
try {
return btoa(atob(str))==str;
} catch (err){
return false;
}},
generateConsent:function(){
var preferenceCookie=CLI_Cookie.read(CLI_PREFERNCE_COOKIE);
cliConsent={};
if(preferenceCookie!==null){
if(CLI.isBase64(preferenceCookie)){
cliConsent=window.atob(preferenceCookie);
}else{
cliConsent=decodeURIComponent(preferenceCookie);
}
cliConsent=JSON.parse(cliConsent);
}
cliConsent.ver=Cli_Data.consentVersion;
categories=[];
jQuery('.cli-user-preference-checkbox').each(function(){
categoryVal='';
cli_chkbox_data_id=jQuery(this).attr('data-id');
cli_chkbox_data_id=cli_chkbox_data_id.replace('checkbox-','');
if(jQuery(this).is(':checked')){
categoryVal='true';
}else{
categoryVal='false';
}
cliConsent[cli_chkbox_data_id]=categoryVal;
});
cliConsent=JSON.stringify(cliConsent);
cliConsent=window.btoa(cliConsent);
CLI_Cookie.set(CLI_PREFERNCE_COOKIE,cliConsent,CLI_ACCEPT_COOKIE_EXPIRE);
},
cliRenewConsent:function(){
var preferenceCookie=CLI_Cookie.read(CLI_PREFERNCE_COOKIE);
if(preferenceCookie!==null){
if(CLI.isBase64(preferenceCookie)){
cliConsent=window.atob(preferenceCookie);
}else{
cliConsent=decodeURIComponent(preferenceCookie);
}
cliConsent=JSON.parse(cliConsent);
consentCurrentVersion=parseInt(cliConsent.ver);
consentRenewVersion=parseInt(Cli_Data.consentVersion);
if(typeof(cliConsent.ver)!=='undefined'){
if(cliConsent.ver!==Cli_Data.consentVersion){
CLI_Cookie.erase(CLI_ACCEPT_COOKIE_NAME);
CLI_Cookie.erase(CLI_PREFERNCE_COOKIE);
CLI_Cookie.erase('cli_user_preference');
for(var k in Cli_Data.nn_cookie_ids){
CLI_Cookie.erase(Cli_Data.nn_cookie_ids[k]);
}}
}}
},
reload_current_page:function(){
window.location.reload();
},
add_clear_cache_url_query:function(){
var cli_rand=new Date().getTime()/1000;
var cli_url=window.location.href;
var cli_hash_arr=cli_url.split('#');
var cli_urlparts=cli_hash_arr[0].split('?');
if(cli_urlparts.length>=2){
var cli_url_arr=cli_urlparts[1].split('&');
cli_url_temp_arr=new Array();
for(var cli_i=0; cli_i<cli_url_arr.length; cli_i++){
var cli_temp_url_arr=cli_url_arr[cli_i].split('=');
if(cli_temp_url_arr[0]=='cli_action'){
}else{
cli_url_temp_arr.push(cli_url_arr[cli_i]);
}}
cli_urlparts[1]=cli_url_temp_arr.join('&');
cli_url=cli_urlparts.join('?')+(cli_url_temp_arr.length>0 ? '&': '')+'cli_action=';
}else{
cli_url=cli_hash_arr[0]+'?cli_action=';
}
cli_url+=cli_rand;
if(cli_hash_arr.length>1){
cli_url+='#'+cli_hash_arr[1];
}
return cli_url;
},
closeOnScroll:function(){
if(window.pageYOffset > 100&&!CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)){
if(CLI.settings.accept_all==true){
CLI.enableAllCookies();
}
CLI.accept_close();
CLI.saveLog('accept');
if(CLI.settings.scroll_close_reload===true){
window.location.reload();
}
window.removeEventListener("scroll",CLI.closeOnScroll,false);
}},
displayHeader:function(){
if(this.settings.notify_animate_show){
this.bar_elm.slideDown(this.settings.animate_speed_show);
}else{
this.bar_elm.show();
CLI.refocusElement();
}
this.showagain_elm.hide();
if(CLI_COOKIEBAR_AS_POPUP){
this.showPopupOverlay();
}},
hideHeader:function(){
if(this.settings.showagain_tab){
if(this.settings.notify_animate_show){
this.showagain_elm.slideDown(this.settings.animate_speed_show);
}else{
this.showagain_elm.show();
}}else{
this.showagain_elm.hide();
}
this.bar_elm.slideUp(this.settings.animate_speed_show);
this.hidePopupOverlay();
},
hidePopupOverlay:function(){
jQuery('body').removeClass("cli-barmodal-open");
jQuery(".cli-popupbar-overlay").removeClass("cli-show");
},
showPopupOverlay:function(){
if(this.bar_elm.length){
if(this.settings.popup_overlay){
if(!(this.main_link.hasClass('cli-minimize-bar'))){
jQuery('body').addClass("cli-barmodal-open");
jQuery(".cli-popupbar-overlay").addClass("cli-show");
}}
}},
barAsWidget:function(a){
var cli_elm=this.bar_elm;
cli_elm.attr('data-cli-type','widget');
var cli_win=jQuery(window);
var cli_winh=cli_win.height()-40;
var cli_winw=cli_win.width();
var cli_defw=cli_winw>465 ? 445:cli_winw-60;
cli_elm.css({
'width':cli_defw,'height':'auto','max-height':cli_winh,'overflow':'auto','position':'fixed','box-shadow':'rgba(0,0,0,.5) 0px 5px 10px','box-sizing':'border-box'
});
if(this.settings.widget_position=='left'){
cli_elm.css({
'left':'30px','right':'auto','bottom':'30px','top':'auto'
});
}else{
cli_elm.css({
'left':'auto','right':'30px','bottom':'30px','top':'auto'
});
}
if(a){
this.setResize();
}},
barAsPopUp:function(a){
if(typeof cookie_law_info_bar_as_popup==='function'){
return false;
}
var cli_elm=this.bar_elm;
cli_elm.attr('data-cli-type','popup');
var cli_win=jQuery(window);
var cli_winh=cli_win.height();
var cli_defh=cli_winh > 500 ? 500:cli_winh;
var cli_winw=cli_win.width();
var cli_defw=cli_winw>700 ? 500:cli_winw-20;
cli_elm.css({
'width':cli_defw,'height':'auto','max-height':cli_defh,'bottom':'','top':'50%','left':'50%','transform':'translate(-50%, -50%)','overflow':'auto'
});
if(a){
this.setResize();
}},
setResize:function(){
var resizeTmr=null;
jQuery(window).resize(function(){
clearTimeout(resizeTmr);
resizeTmr=setTimeout(function(){
if(CLI_COOKIEBAR_AS_POPUP){
CLI.barAsPopUp();
}
if(CLI.settings.cookie_bar_as=='widget'){
CLI.barAsWidget();
}
CLI.configShowAgain();
},500);
});
},
isValidHex:function(color){
if(!color||typeof color!=='string') return false;
if(color.substring(0, 1)==='#') color=color.substring(1);
switch(color.length){
case 3: return /^[0-9A-F]{3}$/i.test(color);
case 6: return /^[0-9A-F]{6}$/i.test(color);
case 8: return /^[0-9A-F]{8}$/i.test(color);
default: return false;
}
return false;
},
ColorLuminance:function(hex, lum){
hex=String(hex).replace(/[^0-9a-f]/gi, '');
if(hex.length < 6){
hex=hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];
}
lum=lum||0;
var rgb="#", c, i;
for (i=0; i < 3; i++){
c=parseInt(hex.substr(i*2,2), 16);
c=Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);
rgb +=("00"+c).substr(c.length);
}
return rgb;
},
rgb2hex:function(rgb){
rgb=rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
return (rgb&&rgb.length===4) ? "#" +
("0" + parseInt(rgb[1],10).toString(16)).slice(-2) +
("0" + parseInt(rgb[2],10).toString(16)).slice(-2) +
("0" + parseInt(rgb[3],10).toString(16)).slice(-2):'';
},
lightOrDark:function(color){
var r, g, b, hsp;
if(color.match(/^rgb/)){
color=color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);
r=color[1];
g=color[2];
b=color[3];
}else{
color=+("0x" + color.slice(1).replace(color.length < 5&&/./g, '$&$&'));
r=color >> 16;
g=color >> 8 & 255;
b=color & 255;
}
hsp=Math.sqrt(0.299 * (r * r) +
0.587 * (g * g) +
0.114 * (b * b)
);
if(hsp>127.5){
return 'light';
}else{
return 'dark';
}},
barPopupStyle:function(){
var acceptBtn=jQuery('.cli_action_button[data-cli_action=accept]');
var primaryColor=this.settings.button_1_button_colour;
var primaryLinkColor=this.settings.button_1_link_colour;
var barColor=this.settings.background;
var extractedStyle='';
var primaryBtnStyle=this.settings.button_1_style;
Object.keys(primaryBtnStyle).forEach(function(element){
extractedStyle+=primaryBtnStyle[element][0]+':'+primaryBtnStyle[element][1]+';';
});
var shadeColor;
if(!CLI.isValidHex(barColor)){
barColor=CLI.rgb2hex(barColor);
}
if(barColor=="#000000"){
shadeColor='#191919';
}else{
var intensity=CLI.lightOrDark(barColor);
if(intensity=='light'){
shadeColor=CLI.ColorLuminance(barColor, -0.05);
}else{
shadeColor=CLI.ColorLuminance(barColor, 0.4);
}}
jQuery("<style>")
.prop("type", "text/css")
.html("\
#cookie-law-info-bar .cli-switch input:checked + .cli-slider{\
background-color: "+primaryColor+";\
}\
#cookie-law-info-bar  .cli-tab-header{\
background-color: "+shadeColor+"\
}\
#cookie-law-info-bar .cli-switch .cli-slider:before{\
background-color: "+barColor+";\
}\
#cookie-law-info-bar .cli-tab-footer .cli-btn{\
background-color:"+primaryColor+";"+extractedStyle+"\
}\
").appendTo("head");
},
enableAllCookies:function(){
jQuery('.cli-user-preference-checkbox').each(function(){
var cli_chkbox_elm=jQuery(this);
var cli_chkbox_data_id=cli_chkbox_elm.attr('data-id');
if(cli_chkbox_data_id!='checkbox-necessary'){
cli_chkbox_elm.prop('checked',true);
CLI_Cookie.set('cookielawinfo-'+cli_chkbox_data_id,'yes',CLI_ACCEPT_COOKIE_EXPIRE);
}});
},
disableAllCookies:function(){
jQuery('.cli-user-preference-checkbox').each(function(){
var cli_chkbox_elm=jQuery(this);
var cli_chkbox_data_id=cli_chkbox_elm.attr('data-id');
cliCategorySlug=cli_chkbox_data_id.replace('checkbox-','');
if(Cli_Data.strictlyEnabled.indexOf(cliCategorySlug)===-1){
cli_chkbox_elm.prop('checked',false);
CLI_Cookie.set('cookielawinfo-'+cli_chkbox_data_id,'no',CLI_ACCEPT_COOKIE_EXPIRE);
}});
},
privacyReadmore:function(){
var originalHtml='';
Trunc={
addReadmore:function(textBlock){
if(textBlock.html().length > Cli_Data.privacy_length){
jQuery('.cli-privacy-readmore').show();
}else{
jQuery('.cli-privacy-readmore').hide();
}},
truncateText:function(textBlock){
var strippedText=jQuery('<div />').html(textBlock.html());
strippedText.find('table').remove();
textBlock.html(strippedText.html());
currentText=textBlock.text();
if(currentText.trim().length > Cli_Data.privacy_length){
var newStr=currentText.substring(0, Cli_Data.privacy_length);
textBlock.empty().html(newStr).append('...');
}},
replaceText: function(textBlock, original){
return textBlock.html(original);
}};
jQuery('.cli-privacy-content .cli-privacy-content-text').each(function (){
var el=jQuery(this);
var clone=el.clone();
originalHtml=clone.html();
Trunc.addReadmore(el);
Trunc.truncateText(el);
});
jQuery(document).on('click keypress','a.cli-privacy-readmore',function(e){
var key=e.which;
e.preventDefault();
if(key===1||key===13){
var currentElement=jQuery(this);
var privacyElement=currentElement.closest('.cli-privacy-overview');
var privacyContent=privacyElement.find('.cli-privacy-content-text');
if(privacyElement.hasClass('cli-collapsed')){
Trunc.truncateText(privacyContent);
privacyElement.removeClass('cli-collapsed');
privacyContent.css('height', '100%');
}else{
privacyElement.addClass('cli-collapsed');
Trunc.replaceText(privacyContent, originalHtml);
}}
});
},
checkCategories:function(){
var cliAllowedCategories=[];
var cli_categories={};
jQuery('.cli-user-preference-checkbox').each(function(){	var status=false;
cli_chkbox_elm=jQuery(this);
cli_chkbox_data_id=cli_chkbox_elm.attr('data-id');
cli_chkbox_data_id=cli_chkbox_data_id.replace('checkbox-','');
cli_chkbox_data_id_trimmed=cli_chkbox_data_id.replace('-','_')
if(jQuery(cli_chkbox_elm).is(':checked')){
status=true;
cliAllowedCategories.push(cli_chkbox_data_id);
}
cli_categories[cli_chkbox_data_id_trimmed]=status;
});
CLI.allowedCategories=cliAllowedCategories;
CLI.consent=cli_categories;
},
cookieLawInfoRunCallBacks:function(){
this.checkCategories();
if(CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)=='yes'){
if("function"==typeof CookieLawInfo_Accept_Callback){
CookieLawInfo_Accept_Callback();
}}
},
addStyleAttribute:function(){
var bar=this.bar_elm;
var styleClass='';
if(jQuery(bar).find('.cli-bar-container').length > 0){
styleClass=jQuery('.cli-bar-container').attr('class');
styleClass=jQuery.trim(styleClass.replace('cli-bar-container',''));
jQuery(bar).attr('data-cli-style',styleClass);
}},
getParameterByName: function(name, url){
if(!url) url=window.location.href;
name=name.replace(/[\[\]]/g, '\\$&');
var regex=new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results=regex.exec(url);
if(!results) return null;
if(!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
},
acceptPageNavigation: function(){
if(Boolean(this.settings.accept_close_page_navigation)===true&&!CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)){
jQuery(document).on('click','a', function (){
var href=jQuery(this).attr('href');
if(href!==undefined){
CLI.close_header();
}});
}},
refocusElement: function(){
if(this.banner_heading.length > 0){
this.banner_heading.focus();
}else{
this.bar_elm.find('a').first().focus();
}},
mayBeSetPreferenceCookie: function(){
if(CLI.getParameterByName('cli_bypass')==="1"){
CLI.generateConsent();
}}
}
var cliBlocker =
{
blockingStatus: true,
geoIP: false,
scriptsLoaded: false,
ccpaEnabled:false,
ccpaRegionBased:false,
ccpaApplicable:false,
ccpaBarEnabled: false,
cliShowBar: true ,
isBypassEnabled: CLI.getParameterByName('cli_bypass'),
checkPluginStatus:function(callbackA , callbackB){
cliBlocker.ccpaEnabled=Boolean(Cli_Data.ccpaEnabled);
cliBlocker.ccpaRegionBased=Boolean(Cli_Data.ccpaRegionBased);
cliBlocker.ccpaBarEnabled=Boolean(Cli_Data.ccpaBarEnabled);
if(cliBlocker.ccpaEnabled===true){
cliBlocker.ccpaApplicable=true;
if(Cli_Data.ccpaType==='ccpa'){
cliBlocker.blockingStatus=false;
cliBlocker.cliShowBar=false;
if(cliBlocker.ccpaBarEnabled===true){
cliBlocker.cliShowBar=true;
cliBlocker.blockingStatus=true;
}}
}
if(Cli_Data.geoIP==='enabled'||(cliBlocker.ccpaEnabled===true&&cliBlocker.ccpaRegionBased===true) ){
if(Boolean(Cli_Data.use_custom_geolocation_api)===true){
cliBlocker.tryCustomGeoLocationService(callbackA, callbackB);
}else{
jQuery.getJSON('https://ipapi.co/json/', function(data){
cliBlocker.geolocationHandler(data, callbackA, callbackB);
}).fail(function(){
cliBlocker.tryCustomGeoLocationService(callbackA, callbackB);
});
}}else{
if(cliBlocker.isBypassEnabled==="1"){
cliBlocker.blockingStatus=false;
}
callbackA();
callbackB();
}},
tryCustomGeoLocationService: function(callbackA, callbackB){
jQuery.getJSON(Cli_Data.custom_geolocation_api, function(data){
cliBlocker.geolocationHandler(data, callbackA, callbackB);
});
},
geolocationHandler:function(data, callbackA, callbackB){
var euCountries=Cli_Data.eu_countries;
if((data.in_eu===false)&&(euCountries.indexOf(data.country)===-1)){
if(Cli_Data.geoIP==='enabled'){
cliBlocker.blockingStatus=false;
cliBlocker.cliShowBar=false;
}else{
if(Cli_Data.ccpaType!=='ccpa'){
cliBlocker.blockingStatus=true;
cliBlocker.cliShowBar=true;
}}
}else{
jQuery('body').addClass('wt-cli-geoip-on wt-cli-eu-country');
}
if(cliBlocker.ccpaEnabled===true){
if(cliBlocker.ccpaRegionBased===true&&data.region_code!=='CA'){
cliBlocker.ccpaApplicable=false;
if(Cli_Data.ccpaType==='ccpa'){
cliBlocker.cliShowBar=false;
cliBlocker.blockingStatus=false;
}
jQuery('.wt-cli-ccpa-opt-out,.wt-cli-ccpa-checkbox,.wt-cli-ccpa-element').remove();
}else{
cliBlocker.ccpaApplicable=true;
if(cliBlocker.ccpaBarEnabled===true){
cliBlocker.cliShowBar=true;
}}
}
if(cliBlocker.blockingStatus===false){
if("function"==typeof CookieLawInfo_Accept_Callback){
CookieLawInfo_Accept_Callback();
}
jQuery('body').addClass('wt-cli-geoip-on wt-cli-non-eu-country');
CLI.hidePopupOverlay();
if(cliBlocker.ccpaApplicable!==true){
cliBlocker.removeAllPreferenceCookies();
jQuery('.wt-cli-geoip-on.wt-cli-non-eu-country').find('.wt-cli-element').remove();
}}
callbackA();
callbackB();
},
cookieBar: function(){
if(cliBlocker.cliShowBar===false){
jQuery('.wt-cli-cookie-bar-container').remove();
}else{
jQuery('.wt-cli-cookie-bar-container').show();
if(!CLI_Cookie.exists(CLI_ACCEPT_COOKIE_NAME)){
CLI.displayHeader();
}else{
CLI.hideHeader();
}}
},
removeAllPreferenceCookies:function(){
cliPreferenceCookies=Cli_Data.cookielist;
for (var key in cliPreferenceCookies){
CLI_Cookie.erase('cookielawinfo-checkbox-'+key);
}},
removeCookieByCategory:function(){
if(cliBlocker.blockingStatus===true){
if(CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)!==null){
var non_necessary_cookies=Cli_Data.non_necessary_cookies;
for (var key in non_necessary_cookies){
currentCategory=key;
if(CLI.allowedCategories.indexOf(currentCategory)===-1){
var nonNecessaryCookies=non_necessary_cookies[currentCategory];
for(var i=0; i < nonNecessaryCookies.length; i++){
if(CLI_Cookie.read(nonNecessaryCookies[i])!==null){
CLI_Cookie.erase(nonNecessaryCookies[i]);
}}
}}
}}
},
runScripts:function(){
srcReplaceableElms=['iframe','IFRAME','EMBED','embed','OBJECT','object','IMG','img','SOURCE','source'];
var genericFuncs =
{
renderByElement: function(callback){
cliScriptFuncs.renderScripts();
cliHtmlElmFuncs.renderSrcElement();
callback();
cliBlocker.scriptsLoaded=true;
},
reviewConsent:function(){
jQuery(document).on('click','.cli_manage_current_consent,.wt-cli-manage-consent-link',function(){
CLI.bar_elm.slideDown(CLI.settings.animate_speed_show);
});
}};
var cliScriptFuncs =
{
scriptsDone:function(){
if(Boolean(Cli_Data.triggerDomRefresh)===true){
var DOMContentLoadedEvent=document.createEvent('Event')
DOMContentLoadedEvent.initEvent('DOMContentLoaded', true, true)
window.document.dispatchEvent(DOMContentLoadedEvent)
}},
seq :function(arr, callback, index){
if(typeof index==='undefined'){
index=0
}
arr[index](function (){
index++
if(index===arr.length){
callback()
}else{
cliScriptFuncs.seq(arr, callback, index)
}})
},
insertScript:function($script,callback){
var s='';
var allowedAttributes=[
'data-cli-class',
'data-cli-label',
'data-cli-placeholder',
'data-cli-script-type',
'data-cli-src'
];
var scriptType=$script.getAttribute('data-cli-script-type');
var elementPosition=$script.getAttribute('data-cli-element-position');
var isBlock=$script.getAttribute('data-cli-block');
var blockIfCCPA=$script.getAttribute('data-cli-block-if-ccpa-optout');
var s=document.createElement('script');
var ccpaOptedOut=cliBlocker.ccpaOptedOut();
s.type='text/plain';
if($script.async){
s.async=$script.async;
}
if($script.defer){
s.defer=$script.defer;
}
if($script.src){
s.onload=callback
s.onerror=callback
s.src=$script.src
}else{
s.textContent=$script.innerText
}
if($script.hasAttribute('data-cli-id')){
s.id=$script.getAttribute('data-cli-id');
}
var attrs=jQuery($script).prop("attributes");
for (var ii=0; ii < attrs.length; ++ii){
if(attrs[ii].nodeName==='id'&&s.id)
continue;
s.setAttribute(attrs[ii].nodeName,attrs[ii].value);
}
if(cliBlocker.blockingStatus===true){
if((CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)=='yes'&&CLI.allowedCategories.indexOf(scriptType)!==-1)||(CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)==null&&isBlock==='false')){
s.setAttribute('data-cli-consent','accepted');
s.type='text/javascript';
}
if(Cli_Data.ccpaType==='ccpa'&&blockIfCCPA!=='true'){
s.type='text/javascript';
}}else{
s.type='text/javascript';
}
if(cliBlocker.ccpaApplicable===true&&blockIfCCPA==='true'){
if(ccpaOptedOut===true||CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)==null){
s.type='text/plain';
}}
if($script.type!=s.type){
$script.parentNode.insertBefore(s,$script);
if(!$script.src){
callback()
}
$script.parentNode.removeChild($script);
}else{
callback();
}},
renderScripts:function(){
var $scripts=document.querySelectorAll('script[data-cli-class="cli-blocker-script"]');
if($scripts.length > 0){
var runList=[]
var typeAttr
Array.prototype.forEach.call($scripts, function ($script){
typeAttr=$script.getAttribute('type')
var elmType=$script.tagName;
runList.push(function (callback){
cliScriptFuncs.insertScript($script, callback)
})
})
cliScriptFuncs.seq(runList, cliScriptFuncs.scriptsDone);
}}
};
var cliHtmlElmFuncs={
renderSrcElement: function(){
var blockingElms=document.querySelectorAll('[data-cli-class="cli-blocker-script"]');
var ccpaOptedOut=cliBlocker.ccpaOptedOut();
for (var i=0; i < blockingElms.length; i++){
var currentElm=blockingElms[i];
var elmType=currentElm.tagName;
if(srcReplaceableElms.indexOf(elmType)!==-1){
var elmCategory=currentElm.getAttribute('data-cli-script-type');
var isBlock=currentElm.getAttribute('data-cli-block');
var blockIfCCPA=currentElm.getAttribute('data-cli-block-if-ccpa-optout');
if(cliBlocker.blockingStatus===true){
if((CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)=='yes'&&CLI.allowedCategories.indexOf(elmCategory)!==-1)||(CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)==null&&isBlock==='false')){
if(cliBlocker.ccpaApplicable==true&&blockIfCCPA==='true'&&ccpaOptedOut===true){
this.addPlaceholder(currentElm);
}else{
this.replaceSrc(currentElm);
}}else{
if(Cli_Data.ccpaType==='ccpa'&&blockIfCCPA!=='true'){
this.replaceSrc(currentElm);
}else{
this.addPlaceholder(currentElm);
}}
}else{
if(cliBlocker.ccpaApplicable==true&&blockIfCCPA==='true'){
if(ccpaOptedOut===true||CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)==null){
this.addPlaceholder(currentElm);
}else{
this.replaceSrc(currentElm);
}}else{
this.replaceSrc(currentElm);
}}
}}
},
addPlaceholder:function(htmlElm){
if(jQuery(htmlElm).prev('.wt-cli-iframe-placeholder').length===0){
var htmlElemName=htmlElm.getAttribute('data-cli-label');
var htmlElemType=htmlElm.getAttribute('data-cli-placeholder');
var htmlElemWidth=htmlElm.getAttribute('width');
var htmlElemHeight=htmlElm.getAttribute('height');
if(htmlElemWidth==null){
htmlElemWidth=htmlElm.offsetWidth;
}
if(htmlElemHeight==null){
htmlElemHeight=htmlElm.offsetHeight;
}
pixelPattern=/px/;
htmlElemWidth=((pixelPattern.test(htmlElemWidth)) ? htmlElemWidth:htmlElemWidth+'px');
htmlElemHeight=((pixelPattern.test(htmlElemHeight)) ? htmlElemHeight:htmlElemHeight+'px');
var addPlaceholder='<div style="width:'+htmlElemWidth+'; height:'+htmlElemHeight+';" class="wt-cli-iframe-placeholder"><div class="wt-cli-inner-text">'+htmlElemType+'</div></div>';
addPlaceholder.width=htmlElemWidth;
addPlaceholder.height=htmlElemHeight;
if(htmlElm.tagName!=='IMG'){
jQuery(addPlaceholder).insertBefore(htmlElm);
}
htmlElm.removeAttribute('src');
htmlElm.style.display='none';
}},
replaceSrc: function(htmlElm){
if(!htmlElm.hasAttribute('src')){
var htmlElemSrc=htmlElm.getAttribute('data-cli-src');
htmlElm.setAttribute('src',htmlElemSrc);
if(jQuery(htmlElm).prev('.wt-cli-iframe-placeholder').length > 0){
jQuery(htmlElm).prev('.wt-cli-iframe-placeholder').remove();
}
htmlElm.style.display='block';
}}
};
genericFuncs.reviewConsent();
genericFuncs.renderByElement(cliBlocker.removeCookieByCategory);
},
ccpaOptedOut: function (){
var ccpaOptedOut=false;
var preferenceCookie=CLI_Cookie.read(CLI_PREFERNCE_COOKIE);
if(preferenceCookie!==null){
if(CLI.isBase64(preferenceCookie)){
cliConsent=window.atob(preferenceCookie);
}else{
cliConsent=decodeURIComponent(preferenceCookie);
}
cliConsent=JSON.parse(cliConsent);
if(typeof cliConsent.ccpaOptout!=='undefined'){
ccpaOptedOut=cliConsent.ccpaOptout;
}}
return ccpaOptedOut;
}}
jQuery(document).ready(function(){
if(typeof cli_cookiebar_settings!='undefined'){
CLI.set({
settings:cli_cookiebar_settings
});
cliBlocker.checkPluginStatus(cliBlocker.cookieBar,cliBlocker.runScripts);
}else{
var data={
action: 'cli_get_settings_json',
};
jQuery.ajax({
url: Cli_Data.ajax_url,
data: data,
dataType: 'json',
type: 'GET',
success: function (response){
CLI.set({
settings:response
});
cliBlocker.checkPluginStatus(cliBlocker.cookieBar,cliBlocker.runScripts);
}});
}});
(function($){
var target, O;
function isWithinElement(x, y, el){
if(x > el.offset().left&&x < el.offset().left + el.width() &&
y > el.offset().top&&y < el.offset().top + el.height()){
return true;
}else{
return false;
}}
function Wrapper(){
this.el;
this.css_width;
this.css_height;
this.width;
this.height;
}
Wrapper.prototype.init=function(){
this.el=target.el;
this.css_width=(O.width=='auto') ? '100%':O.width;
this.css_height=(O.height=='auto') ? '100%':O.height;
this.css();
this.width=this.el.width();
this.height=this.el.height();
}
Wrapper.prototype.css=function(){
var base=this;
base.el.css({
"width":base.css_width,
"height":base.css_height,
"overflow":'hidden',
"position":'relative'
});
}
Wrapper.prototype.refresh=function(){
this.width=this.el.width();
this.height=this.el.height();
target.container.mox=(O.image.width*target.container.z - this.width)*(-1);
target.container.moy=(O.image.height*target.container.z - this.height)*(-1);
if(typeof window.innerWidth!='undefined'){
target.fullscreen.viewportWidth=window.innerWidth;
target.fullscreen.viewportHeight=window.innerHeight;
}}
function Container(){
this.el;
this.ox;
this.oy;
this.oox;
this.ooy;
this.mox;
this.moy;
this.z;
this.mz;
this.w;
this.h;
this.cw;
this.ch;
}
Container.prototype.init=function(){
this.ox=0;
this.oy=0;
this.oox=0;
this.ooy=0;
this.mox=(O.image.width - target.wrapper.width)*(-1);
this.moy=(O.image.height - target.wrapper.height)*(-1);
this.z=O.zoom.initial;
this.mz=O.zoom.max;
this.w=O.image.width;
this.h=O.image.height;
this.cw=this.w;
this.ch=this.h;
target.wrapper.el.wrapInner('<div class="ncl-container" />');
this.el=target.wrapper.el.find('.ncl-container');
target.container.css();
target.container.center();
target.container.get_focal_point();
target.container.zoom_zoom_init();
}
Container.prototype.css=function(){
this.el.css({
"width":O.image.width,
"height":O.image.height
});
},
Container.prototype.drag_init=function(e){
this.el.stop();
this.refresh();
this.sx=e.pageX;
this.sy=e.pageY;
this.iox=this.ox;
this.ioy=this.oy;
this.left=target.container.ox;
this.top=target.container.oy;
this.deltax=0;
this.deltay=0;
this.inertiaDuration=2000;
},
Container.prototype.drag_drag=function(e){
this.ox=this.iox + e.pageX - this.sx;
this.oy=this.ioy + e.pageY - this.sy;
this.deltax=this.ox - this.left;
this.deltay=this.oy - this.top;
if(!target.fullscreen.is_fullscreen){
this.left=(this.ox < target.container.mox) ? target.container.mox:(this.ox > 0) ? 0:this.ox;
this.top=(this.oy < target.container.moy) ? target.container.moy:(this.oy > 0) ? 0:this.oy;
}else{
this.left=this.ox;
this.top=this.oy;
}
target.container.el.css({
"left":this.left,
"top":this.top
});
},
Container.prototype.drag_finish=function(e){
this.ox=this.el.position().left;
this.oy=this.el.position().top;
if(O.animations.inertia){
this.apply_inertia(this.get_focal_point, this.deltax, this.deltay);
}else{
this.get_focal_point();
}}
Container.prototype.zoom_zoom_init=function(){
this.cw=this.w;
this.ch=this.h;
},
Container.prototype.zoom_zoom_at=function(factor){
this.cw=this.w*factor;
this.ch=this.h*factor;
this.z=factor;
this.el.css({
"width":this.cw,
"height":this.ch
});
this.zoom_refresh();
target.locations.refresh();
}
Container.prototype.zoom_zoom_in=function(){
var factor=(target.container.z + 1 > O.zoom.max) ? O.zoom.max:this.z + 1;
this.cw=this.w*factor;
this.ch=this.h*factor;
this.z=factor;
this.z=this.z;
this.cw=this.cw;
this.ch=this.ch;
this.mox=(this.cw - target.wrapper.width)*(-1);
this.moy=(this.ch - target.wrapper.height)*(-1);
var l=-(this.focal_point.x - target.wrapper.width/2) - this.focal_point.x*(this.z - 1);
var t=-(this.focal_point.y - target.wrapper.height/2) - this.focal_point.y*(this.z - 1);
if(!target.fullscreen.is_fullscreen){
var left=(l < this.mox) ? this.mox:(l > 0) ? 0:l;
var top=(t < this.moy) ? this.moy:(t > 0) ? 0:t;
}else{
var left=l;
var top=t;
}
this.el.css({ "width":this.cw, "height":this.ch, "left":left, "top":top });
target.locations.refresh();
target.navigation.update();
}
Container.prototype.zoom_zoom_out=function(){
var factor=(target.container.z - 1 < 1) ? 1:target.container.z - 1;
this.cw=this.w*factor;
this.ch=this.h*factor;
this.z=factor;
target.container.z=this.z;
target.container.cw=this.cw;
target.container.ch=this.ch;
target.container.mox=(this.cw - target.wrapper.width)*(-1);
target.container.moy=(this.ch - target.wrapper.height)*(-1);
var l=-(target.container.focal_point.x - target.wrapper.width/2) - target.container.focal_point.x*(this.z - 1);
var t=-(target.container.focal_point.y - target.wrapper.height/2) - target.container.focal_point.y*(this.z - 1);
if(!target.fullscreen.is_fullscreen){
var left=(l < target.container.mox) ? target.container.mox:(l > 0) ? 0:l;
var top=(t < target.container.moy) ? target.container.moy:(t > 0) ? 0:t;
}else{
var left=l;
var top=t;
}
this.el.css({
"width":this.cw,
"height":this.ch,
"left":left,
"top":top
});
target.locations.refresh();
target.navigation.update();
},
Container.prototype.zoom_refresh=function(){
this.z=this.z;
this.cw=this.cw;
this.ch=this.ch;
if(!target.fullscreen.is_fullscreen){
this.mox=(this.cw - target.wrapper.width)*(-1);
this.moy=(this.ch - target.wrapper.height)*(-1);
}
var l=-(this.focal_point.x - target.wrapper.width/2) - this.focal_point.x*(this.z - 1);
var t=-(this.focal_point.y - target.wrapper.height/2) - this.focal_point.y*(this.z - 1);
if(!target.fullscreen.is_fullscreen){
var left=(l < this.mox) ? this.mox:(l > 0) ? 0:l;
var top=(t < this.moy) ? this.moy:(t > 0) ? 0:t;
}else{
var left=l;
var top=t;
}
this.el.css({
"left":left,
"top":top
});
}
Container.prototype.move=function(direction){
if(direction=='left'){
this.go_at(this.focal_point.x*this.z - this.w/7, this.focal_point.y*this.z);
}
if(direction=='right'){
this.go_at(this.focal_point.x*this.z + this.w/7, this.focal_point.y*this.z);
}
if(direction=='up'){
this.go_at(this.focal_point.x*this.z, this.focal_point.y*this.z - this.h/7);
}
if(direction=='down'){
this.go_at(this.focal_point.x*this.z, this.focal_point.y*this.z + this.w/7);
}}
Container.prototype.apply_inertia=function(cb, dx, dy){
if(O.animations.inertia){
var m=5, ox, oy;
this.interval;
var root=this;
if(this.interval!=1){
clearInterval(this.interval);
}
var nx, ny;
var fs=target.fullscreen.is_fullscreen;
this.interval=setInterval(function(){
if(!fs){
ox=(root.ox + (dx/10)*m < root.mox) ? root.mox:(root.ox + (dx/10)*m > 0) ? 0:root.ox + (dx/10)*m;
oy=(root.oy + (dy/10)*m < root.moy) ? root.moy:(root.oy + (dy/10)*m > 0) ? 0:root.oy + (dy/10)*m;
}else{
ox=root.ox + (dx/10)*m;
oy=root.oy + (dy/10)*m;
}
root.el.css({
"left":ox,
"top":oy
});
if(ox - root.ox==0&&oy - root.oy==0){
clearInterval(root.interval);
root.interval=1;
}
root.refresh();
m=m/1.04;
if(m <=0.005){
clearInterval(root.interval);
root.interval=1;
}}, 10);
}else{
cb();
}},
Container.prototype.constrain=function(){
this.ox=this.el.position().left;
this.oy=this.el.position().top;
this.left=(this.ox < this.mox) ? this.mox:(this.ox > 0) ? 0:this.ox;
this.top=(this.oy < this.moy) ? this.moy:(this.oy > 0) ? 0:this.oy;
this.el.css({
"left":this.left,
"top":this.top
});
},
Container.prototype.center=function(){
this.left=(target.wrapper.width - O.image.width)/2;
this.top=(target.wrapper.height - O.image.height)/2;
this.ox=this.left;
this.oy=this.top;
this.el.css({
"left":this.left,
"top":this.top
});
},
Container.prototype.go_at=function(x, y, no_animation){
var base=this;
if(O.animations.inertia&&this.interval!=1){
clearInterval(this.interval);
}
this.ox=(x - target.wrapper.width/2)*(-1);
this.oy=(y - target.wrapper.height/2)*(-1);
if(!target.fullscreen.is_fullscreen){
this.left=(this.ox < this.mox) ? this.mox:(this.ox > 0) ? 0:this.ox;
this.top=(this.oy < this.moy) ? this.moy:(this.oy > 0) ? 0:this.oy;
}else{
this.left=this.ox;
this.top=this.oy;
}
if(O.animations.move&&!no_animation){
base.el.stop().animate({
"left":base.left,
"top":base.top
}, {
duration:700,
easing:'easeOutCubic',
step:function(){
base.refresh();
},
complete:function(){
base.refresh();
}}
);
}else{
base.el.css({ "left":base.left, "top":base.top });
base.refresh();
}},
Container.prototype.refresh=function(){
this.ox=this.el.position().left;
this.oy=this.el.position().top;
this.get_focal_point();
},
Container.prototype.get_focal_point=function(){
this.focal_point={
x:(target.wrapper.width/2 - this.ox)/this.z,
y:(target.wrapper.height/2 - this.oy)/this.z
}}
function Locations(){
this.ar;
this.locs;
}
Locations.prototype.init=function(){
this.ar=new Array();
var dom_elements=target.wrapper.el.find('.location');
var l=dom_elements.length;
for (var i=0; i<l; i++){
this.ar[i]={
id:$(dom_elements[i]).attr('id'),
x:$(dom_elements[i]).attr('data-x'),
y:$(dom_elements[i]).attr('data-y'),
title:$(dom_elements[i]).attr('data-title'),
main_heading:$(dom_elements[i]).find('h1').html(),
sub_heading:$(dom_elements[i]).find('h2').html(),
address:$(dom_elements[i]).find('.address').html(),
phone:$(dom_elements[i]).find('.phone').html(),
content:$(dom_elements[i]).find('.content').html()
}}
dom_elements.hide();
target.locations.html();
target.locations.css();
}
Locations.prototype.html=function(){
var html;
this.locs=new Array();
var l=this.ar.length;
for (var i=0; i<l; i++){
html="<div class=\"ncl-location\" id="+this.ar[i].id+" style=\"left: "+this.ar[i].x+"px; top: "+this.ar[i].y+"px;\">\n";
html +="\t<div class=\"ncl-location-pin\" data-id=\""+i+"\"></div>\n";
html +="\t<div class=\"ncl-location-contents\">\n";
html +="\t\t<div class=\"ncl-location-close\"></div>\n";
if(this.ar[i].main_heading!=null&&this.ar[i].main_heading!=undefined&&this.ar[i].main_heading!=''){ html +="\t\t<h1>"+this.ar[i].main_heading+"</h1>\n"; }
if(this.ar[i].sub_heading!=null&&this.ar[i].sub_heading!=undefined&&this.ar[i].sub_heading!=''){ html +="\t\t<h2>"+this.ar[i].sub_heading+"</h2>\n"; }
if(this.ar[i].address!=null&&this.ar[i].address!=undefined&&this.ar[i].address!=''){ html +="\t\t<p class=\"address\">"+this.ar[i].address+"</p>\n"; }
if(this.ar[i].phone!=null&&this.ar[i].phone!=undefined&&this.ar[i].phone!=''){ html +="\t\t<p class=\"phone\">"+this.ar[i].phone+"</p>\n"; }
if(this.ar[i].content!=null&&this.ar[i].content!=undefined&&this.ar[i].content!=''){ html +="\t\t<p class=\"content\">"+this.ar[i].content+"</p>\n"; }
html +="\t</div>\n";
html +="</div>\n";
target.container.el.append(html);
this.locs[i]=$('.ncl-location#'+this.ar[i].id);
}}
Locations.prototype.css=function(){
var l=this.locs.length;
for (var i=0; i<l; i++){
this.locs[i].find('.ncl-location-contents').data({ "height":this.locs[i].find('.ncl-location-contents').outerHeight() })
this.locs[i].find('.ncl-location-contents').css({
"top":- $(this.locs[i]).find('.ncl-location-contents').data('height') - 50
}).hide();
}}
Locations.prototype.focus=function(index){
$('.ncl-location-contents.ncl-active').removeClass('ncl-active').stop().fadeOut(250);
this.locs[index].find('.ncl-location-contents').addClass('ncl-active').stop().fadeIn(250);
$('.ncl-selected-location').removeClass('ncl-selected-location');
this.locs[index].addClass('ncl-selected-location');
var d=(this.locs[index].find('.ncl-location-contents').data('height'))/2;
target.container.go_at((target.locations.ar[index].x)*target.container.z, (target.locations.ar[index].y)*target.container.z - d);
}
Locations.prototype.contract=function(index){
}
Locations.prototype.refresh=function(no_anim){
var z=target.container.z;
var l=this.ar.length;
for (var i=0; i<l; i++){
$('.ncl-location#'+this.ar[i].id).css({
"left":this.ar[i].x * target.container.z,
"top":this.ar[i].y * target.container.z
});
}}
function Menu(){
this.el;
this.ul;
}
Menu.prototype.init=function(){
target.wrapper.el.append('<div class="ncl-menu-wrap" />');
this.el=target.wrapper.el.find('.ncl-menu-wrap');
this.el.append('<ul />');
this.ul=this.el.find('ul');
var l=target.locations.ar.length;
for (var i=0; i<l; i++){
this.ul.append('<li id="ncl-location-'+i+'">'+target.locations.ar[i].title+'</li>');
}}
function Map(){
this.img;
this.el;
}
Map.prototype.init=function(){
this.img=new Image();
this.img.src=O.image.src;
$(this.img).addClass('ncl-map-image');
target.container.el.append($(this.img));
this.el=$(this.img);
}
function Navigation(){
this.el;
this.sliderPos;
this.sliderDraggable;
this.sliderHeight;
this.sy;
this.moy;
}
Navigation.prototype.init=function(){
this.el;
this.sliderPos=100;
this.html();
this.css();
},
Navigation.prototype.html=function(){
target.wrapper.el.append('<div class="ncl-nav-wrap" />');
this.el=target.wrapper.el.find('.ncl-nav-wrap');
var html;
if(O.nav_ui.move_ui){
html='<div class="ncl-nav-move">';
html +='<div class="ncl-move-left"></div>';
html +='<div class="ncl-move-right"></div>';
html +='<div class="ncl-move-up"></div>';
html +='<div class="ncl-move-down"></div>';
html +='</div>';
}
if(O.nav_ui.zoom_ui){
html +='<div class="ncl-slider-wrap">';
html +='<div class="ncl-slider">';
html +='<div class="ncl-slider-draggable"></div>';
html +='<div class="ncl-slider-slidebar"></div>';
html +='</div>';
html +='<div class="ncl-slider-zoomin"></div>';
html +='<div class="ncl-slider-zoomout"></div>';
html +='</div>';
}
this.el.append(html);
this.sliderDraggable=this.el.find('.ncl-slider-draggable');
this.sliderHeight=this.el.find('.ncl-slider').height();
if(!O.nav_ui.move_ui&&O.nav_ui.zoom_ui){
target.wrapper.el.find('.ncl-slider-wrap').addClass('ncl-single');
}},
Navigation.prototype.css=function(){
}
Navigation.prototype.update=function(){
this.sliderPos=-(target.container.z - O.zoom.max)/(O.zoom.max-1)*100;
this.sliderDraggable.css({
"top":this.sliderPos+"%"
});
}
Navigation.prototype.drag_init=function(e){
this.sy=e.pageY;
this.moy=100;
this.sliderPos=(e.pageY - this.el.find('.ncl-slider').offset().top)/this.sliderHeight*100;
target.navigation.sliderDraggable.css({
"top":this.sliderPos+'%'
});
}
Navigation.prototype.drag_drag=function(e){
this.oy=this.sliderPos + ((e.pageY - this.sy)/this.sliderHeight * 100);
this.oy=(this.oy > 100) ? 100:(this.oy < 0) ? 0:this.oy;
this.sliderDraggable.css({
"top":this.oy+'%'
});
target.container.zoom_zoom_at((1 - (this.oy/100))*(O.zoom.max-1) + 1);
}
Navigation.prototype.drag_finish=function(e){
target.navigation.sliderPos=this.oy;
}
Navigation.prototype.touch_init=function(e){
target.container.el.stop();
this.sd=Math.sqrt(Math.pow(e.touches[0].pageX - e.touches[1].pageX, 2) + Math.pow(e.touches[0].pageY - e.touches[1].pageY, 2));
this.startPos=this.sliderPos;
}
Navigation.prototype.touch_drag=function(e){
this.d=Math.sqrt(Math.pow(e.touches[0].pageX - e.touches[1].pageX, 2) + Math.pow(e.touches[0].pageY - e.touches[1].pageY, 2));
this.delta=this.d - this.sd;
this.sliderPos=this.startPos - ((this.delta/6)/this.sliderHeight * 100);
this.sliderPos=(this.sliderPos < 0) ? 0:(this.sliderPos > 100) ? 100:this.sliderPos;
this.sliderDraggable.css({
"top":this.sliderPos+'%'
});
target.container.zoom_zoom_at((1 - (this.sliderPos/100))*(O.zoom.max-1) + 1);
}
Navigation.prototype.touch_finish=function(e){
this.sd=0;
this.d=0;
this.delta=0;
target.navigation.sliderPos=this.sliderPos;
}
function Fullscreen(){
this.button;
this.is_fullscreen;
this.viewportWidth;
this.viewportHeight;
this.button;
}
Fullscreen.prototype.init=function(){
this.html();
this.button=target.wrapper.el.find('.ncl-fullscreen');
this.is_fullscreen=false;
if(typeof window.innerWidth!='undefined'){
this.viewportWidth=window.innerWidth;
this.viewportHeight=window.innerHeight;
}}
Fullscreen.prototype.html=function(){
target.wrapper.el.append('<div class="ncl-fullscreen" />');
}
Fullscreen.prototype.enter=function(){
this.button.css({ "right":30 });
this.is_fullscreen=true;
target.wrapper.el.wrap('<div class="ncl-fullscreen-wrap" />');
target.wrapper.el.parent().css({ "width":this.viewportWidth, "height":this.viewportHeight });
if(O.width!='auto'){ target.wrapper.el.css({ "width":'100%' }) }
if(O.height!='auto'){ target.wrapper.el.css({ "height":'100%' }) }
target.wrapper.refresh();
target.container.go_at(target.container.focal_point.x*target.container.z, target.container.focal_point.y*target.container.z, true);
}
Fullscreen.prototype.refresh=function(){
if(typeof window.innerWidth!='undefined'){
this.viewportWidth=window.innerWidth;
this.viewportHeight=window.innerHeight;
}
target.wrapper.el.parent().css({ "width":this.viewportWidth, "height":this.viewportHeight });
}
Fullscreen.prototype.exit=function(){
this.button.css({ "right":15 });
this.is_fullscreen=false;
target.wrapper.el.unwrap();
if(O.width!='auto'){ target.wrapper.el.css({ "width":target.wrapper.css_width }) }
if(O.height!='auto'){ target.wrapper.el.css({ "height":target.wrapper.css_height }) }
target.wrapper.refresh();
target.container.go_at(target.container.focal_point.x*target.container.z, target.container.focal_point.y*target.container.z, true);
}
function Autohide(){
this.ui;
}
Autohide.prototype.init=function(){
var base=this;
var visible=false;
base.ui=$('.ncl-nav-move').add('.ncl-slider-wrap').add('.ncl-fullscreen').add('.ncl-menu-wrap');
base.ui.fadeOut();
target.wrapper.el.on('mouseover', function(e){
if(isWithinElement(e.pageX, e.pageY, target.wrapper.el)){
base.ui.fadeIn();
}});
target.wrapper.el.on('mouseout', function(e){
if(!isWithinElement(e.pageX, e.pageY, target.wrapper.el)){
base.ui.fadeOut();
}});
}
function Mouse(){
this.mouseDown;
this.dragging;
this.sliderDragging;
this.sliderMouseDown;
}
Mouse.prototype.init=function(){
var base=this;
base.mouseDown=false;
base.dragging=false;
base.sliderDragging=false;
base.sliderMouseDown=false;
target.wrapper.el.on('mousedown', function(e){
e.preventDefault();
if(O.animations.inertia&&target.container.interval!=1){
clearInterval(target.container.interval);
}
if($(e.target).closest('.ncl-slider').length!=0){
base.sliderMouseDown=true;
}else{
base.mouseDown=true;
}
return false;
});
$(document).on('mousemove', function(e){
e.preventDefault();
if(base.mouseDown&&!base.dragging){
base.dragging=true;
target.container.drag_init(e);
}
if(base.dragging){
target.container.drag_drag(e);
}
if(base.sliderMouseDown&&!base.sliderDragging){
base.sliderDragging=true;
target.navigation.drag_init(e);
}
if(base.sliderDragging){
target.navigation.drag_drag(e);
}
return false;
});
$(document).on('mouseup', function(e){
if(base.mouseDown){
base.mouseDown=false;
}
if(base.dragging){
base.dragging=false;
target.container.drag_finish(e);
}
if(base.sliderMouseDown){
base.sliderMouseDown=false;
}
if(base.sliderDragging){
base.sliderDragging=false;
target.navigation.drag_finish(e);
}});
target.wrapper.el.on('click', function(e){
if($(e.target).hasClass('ncl-fullscreen')){
if(target.fullscreen.is_fullscreen){
target.fullscreen.exit();
}else{
target.fullscreen.enter();
}}else if($(e.target).closest('.ncl-menu-wrap').length!=0){
var index=$(e.target).attr('id').replace('ncl-location-', '');
target.locations.focus(index);
}else if($(e.target).hasClass('ncl-location-pin')){
var index=$(e.target).attr('data-id');
target.locations.focus(index);
}else if($(e.target).hasClass('ncl-slider-zoomin')){
target.container.zoom_zoom_in();
}else if($(e.target).hasClass('ncl-slider-zoomout')){
target.container.zoom_zoom_out();
}else if($(e.target).parent().hasClass('ncl-nav-move')){
var direction=$(e.target).attr('class').replace('ncl-move-', '');
target.container.move(direction);
}else if($(e.target).hasClass('ncl-location-close')){
$('.ncl-location-contents.ncl-active').removeClass('ncl-active').stop().fadeOut(250);
}});
}
function Scroller(){
}
Scroller.prototype.init=function(){
var base=this;
target.container.el.mousewheel(function(e, delta){
e.preventDefault();
if(O.animations.inertia&&target.container.interval!=1){
clearInterval(target.container.interval);
}
if(delta > 0){
target.container.zoom_zoom_in();
}else{
target.container.zoom_zoom_out();
}
return false;
});
}
function Touch(){
this.fingerDown;
this.dragging;
this.sliderFingerDown;
this.sliderDragging;
this.twoFingersDown;
this.twoFingersDragging;
}
Touch.prototype.init=function(){
var base=this;
base.fingerDown=false;
base.dragging=false;
base.sliderFingerDown=false;
base.sliderDragging=false;
base.twoFingersDown=false;
base.twoFingersDragging=false;
target.wrapper.el.get(0).addEventListener('touchstart', function(e){
e.preventDefault();
if(O.animations.inertia&&target.container.interval!=1){
clearInterval(target.container.interval);
}
if(e.touches.length > 1){
base.twoFingersDown=true;
}else if($(e.target).hasClass('ncl-fullscreen')){
if(target.fullscreen.is_fullscreen){
target.fullscreen.exit();
}else{
target.fullscreen.enter();
}}else if($(e.target).closest('.ncl-menu-wrap').length!=0){
var index=$(e.target).attr('id').replace('ncl-location-', '');
target.locations.focus(index);
}else if($(e.target).hasClass('ncl-location-pin')){
var index=$(e.target).attr('data-id');
target.locations.focus(index);
}else if($(e.target).closest('.ncl-slider').length!=0){
base.sliderFingerDown=true;
}else if($(e.target).hasClass('ncl-slider-zoomin')){
target.container.zoom_zoom_in();
}else if($(e.target).hasClass('ncl-slider-zoomout')){
target.container.zoom_zoom_out();
}else if($(e.target).parent().hasClass('ncl-nav-move')){
var direction=$(e.target).attr('class').replace('ncl-move-', '');
target.container.move(direction);
}else{
base.fingerDown=true;
}
return false;
}, false);
document.addEventListener('touchmove', function(e){
if(base.fingerDown&&!base.dragging&&e.touches.length==1){
e.preventDefault();
base.dragging=true;
target.container.drag_init(e.touches[0]);
}else if(base.dragging&&e.touches.length==1){
e.preventDefault();
target.container.drag_drag(e.touches[0]);
}else if(base.sliderFingerDown&&!base.sliderDragging&&e.touches.length==1){
e.preventDefault();
base.sliderDragging=true;
target.navigation.drag_init(e.touches[0]);
}else if(base.sliderDragging&&e.touches.length==1){
e.preventDefault();
target.navigation.drag_drag(e.touches[0]);
}else if(base.twoFingersDown&&!base.twoFingersDragging){
e.preventDefault();
base.twoFingersDragging=true;
target.navigation.touch_init(e);
}else if(base.twoFingersDragging){
e.preventDefault();
target.navigation.touch_drag(e);
}
return false;
}, false);
document.addEventListener('touchend', function(e){
if(base.fingerDown){
e.preventDefault();
base.fingerDown=false;
}
if(base.dragging){
e.preventDefault();
base.dragging=false;
target.container.drag_finish(e.touches[0]);
}
if(base.sliderFingerDown){
e.preventDefault();
base.sliderFingerDown=false;
}
if(base.sliderDragging){
e.preventDefault();
base.sliderDragging=false;
target.navigation.drag_finish(e.touches[0]);
}
if(base.twoFingersDown){
e.preventDefault();
base.twoFingersDown=false;
target.navigation.touch_finish();
}
if(base.twoFingersDragging){
e.preventDefault();
base.twoFingersDragging=false;
target.navigation.touch_zoom.finish();
}
return false;
}, false);
}
function Window(){
}
Window.prototype.init=function(){
$(window).on('resize.ncl', function(){
target.wrapper.refresh();
target.container.go_at(target.container.focal_point.x*target.container.z, target.container.focal_point.y*target.container.z, true);
if(target.fullscreen.is_fullscreen){
target.fullscreen.refresh();
}});
}
$.fn.rmap=function(options){
var D={
width:'auto',
height:'auto',
image:{
src:'images/map.jpg'
},
nav_ui:{
show:true,
autohide:false,
move_ui:true,
zoom_ui:true
},
menu:{
show:true
},
animations:{
move:true,
inertia:true
},
zoom:{
initial:1,
max:5
},
fullscreen:{
enabled:true,
start_in_fullscreen:false
}};
O=$.extend(true, D, options);
function normalize_options(options){
if(options.fullscreen){
options.width='auto';
options.height='auto';
}
if(options.zoom.initial < 1) options.zoom.initial=1;
}
return this.each(function(){
var wrapper=new Wrapper(),
container=new Container(),
locations=new Locations(),
menu=new Menu(),
map=new Map(),
navigation=new Navigation(),
fullscreen=new Fullscreen(),
autohide=new Autohide(),
_mouse=new Mouse(),
_touch=new Touch(),
_scroller=new Scroller(),
_window=new Window();
var el=$(this);
var img=new Image();
$(img).attr('src', O.image.src);
img.onload=function(){
O.image.width=img.width;
O.image.height=img.height;
el.addClass('ncl-root');
target={
el:el,
wrapper:wrapper,
container:container,
locations:locations,
menu:menu,
map:map,
navigation:navigation,
fullscreen:fullscreen,
autohide:autohide,
_mouse:_mouse,
_touch:_touch,
_scroller:_scroller,
_window:_window
}
target.wrapper.init();
target.container.init();
target.map.init();
target.locations.init();
if(O.nav_ui.show){ target.navigation.init(); }
if(O.menu.show){ target.menu.init(); }
if(O.fullscreen.enabled){ target.fullscreen.init(); }
target._mouse.init();
if('ontouchstart' in document.documentElement){ target._touch.init(); }
target._scroller.init();
target._window.init();
if(O.fullscreen.start_in_fullscreen) target.fullscreen.enter();
if(O.zoom.initial > 1){
target.container.zoom_zoom_at(O.zoom.initial);
target.navigation.update();
}
if(O.nav_ui.autohide){
target.autohide.init();
}}
});
}})(jQuery);
jQuery.easing['jswing']=jQuery.easing['swing'];
jQuery.extend(jQuery.easing,
{
easeInCubic: function (x, t, b, c, d){
return c*(t/=d)*t*t + b;
},
easeOutCubic: function (x, t, b, c, d){
return c*((t=t/d-1)*t*t + 1) + b;
},
easeInOutCubic: function (x, t, b, c, d){
if((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
}});
(function(d){function e(a){var b=a||window.event,c=[].slice.call(arguments,1),f=0,e=0,g=0,a=d.event.fix(b);a.type="mousewheel";b.wheelDelta&&(f=b.wheelDelta/120);b.detail&&(f=-b.detail/3);g=f;void 0!==b.axis&&b.axis===b.HORIZONTAL_AXIS&&(g=0,e=-1*f);void 0!==b.wheelDeltaY&&(g=b.wheelDeltaY/120);void 0!==b.wheelDeltaX&&(e=-1*b.wheelDeltaX/120);c.unshift(a,f,e,g);return(d.event.dispatch||d.event.handle).apply(this,c)}var c=["DOMMouseScroll","mousewheel"];if(d.event.fixHooks)for(var h=c.length;h;)d.event.fixHooks[c[--h]]=
d.event.mouseHooks;d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=c.length;a;)this.addEventListener(c[--a],e,!1);else this.onmousewheel=e},teardown:function(){if(this.removeEventListener)for(var a=c.length;a;)this.removeEventListener(c[--a],e,!1);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);