var registerBlockType=wp.blocks.registerBlockType,createElement=wp.element.createElement,concatChildren=wp.element.concatChildren,serverSideRender=wp.serverSideRender,InspectorControls=wp.blockEditor.InspectorControls,PanelBody=wp.components.PanelBody,CheckboxControl=wp.components.CheckboxControl,ToggleControl=wp.components.ToggleControl,uc_icon=createElement("svg",{width:24,height:25,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 25"},createElement("path",{fill:"#DF6926",d:"M3.73944 9.15206C3.74104 10.2569 3.71133 11.3321 3.74998 12.4049C3.87768 15.9496 6.43323 19.0957 9.87449 19.9809C14.0145 21.0459 18.1914 18.929 19.7311 14.9711C20.0931 14.0404 20.2832 13.0692 20.2777 12.0634C20.2696 10.5801 20.272 9.09672 20.2699 7.6134C20.2697 7.49136 20.2699 7.36931 20.2699 7.1984C20.7169 7.1984 21.1477 7.1984 21.5785 7.1984C21.591 7.17135 21.6035 7.14429 21.616 7.11723C20.5653 5.85064 19.5145 4.58405 18.4237 3.26923C17.341 4.57171 16.2841 5.84309 15.1726 7.18009C15.6852 7.18009 16.1083 7.18009 16.5591 7.18009C16.5669 7.31173 16.5776 7.40996 16.5777 7.50821C16.5785 9.00181 16.584 10.4954 16.5761 11.989C16.5649 14.1125 15.1518 15.9136 13.1057 16.4277C10.3127 17.1295 7.56375 15.0771 7.45076 12.1792C7.40735 11.0658 7.43714 9.94942 7.43651 8.83437C7.43525 6.63489 7.43867 4.4354 7.4337 2.23592C7.43275 1.81451 7.41463 1.388 6.95288 1.14984C6.95508 1.12219 6.95729 1.09453 6.95949 1.06687C7.67346 0.830703 8.37691 0.553649 9.10355 0.366713C10.718 -0.0486334 12.3566 -0.108474 14.0025 0.173539C16.6288 0.62355 18.881 1.80294 20.6958 3.74841C23.3602 6.60468 24.4624 10.0092 23.8227 13.8577C23.0461 18.5299 20.3282 21.7147 15.8894 23.3262C11.0371 25.0879 5.43919 23.3383 2.40132 19.1454C-0.203008 15.5509 -0.668955 11.6311 0.906066 7.48335C1.3741 6.25081 2.08212 5.14988 2.9475 4.15381C3.22942 3.82932 3.5331 3.89023 3.65545 4.31154C3.71987 4.53335 3.73452 4.7756 3.73573 5.00881C3.74283 6.37963 3.73936 7.75051 3.73944 9.15206Z"}));registerBlockType("updraftcentral/dashboard",{title:uc_block.title,description:uc_block.description,icon:uc_icon,category:"widgets",supports:{html:!1,reusable:!1,lock:!1,multiple:!1,customClassName:!1},attributes:{require_role:{type:"string",default:"administrator"},fill:{type:"boolean",default:!0}},edit:function(r){var e=Object.keys(uc_block.roles),t=(e.sort(),[]);return e.forEach(function(o,e){var t;uc_block.roles[o].hasOwnProperty("name")&&this.push(createElement("div",null,createElement(ToggleControl,{label:uc_block.roles[o].name,onChange:function(e){var t,l;t=o,e=e,l=r.attributes.require_role.split(","),e?-1===l.indexOf(t)&&l.splice(l.length,0,t):-1!==l.indexOf(t)&&l.splice(l.indexOf(t),1),l.sort(),r.setAttributes({require_role:l.join(",")})},checked:(t=o,-1!==r.attributes.require_role.split(",").indexOf(t))})))},t),t=concatChildren(t),createElement("div",null,createElement(InspectorControls,null,createElement(PanelBody,{title:uc_block.settings,initialOpen:!0},createElement("style",null,".uc_block_label { margin-bottom: 10px; display: block; font-size: 12px; font-family: verdana; text-transform: uppercase; }"),createElement("label",{className:"components-base-control__label uc_block_label"},uc_block.layout),createElement(CheckboxControl,{label:uc_block.fill_content,onChange:function(e){r.setAttributes({fill:e})},checked:r.attributes.fill}),createElement("p",null),createElement("label",{className:"components-base-control__label uc_block_label"},uc_block.require_role),t)),createElement(serverSideRender,{block:"updraftcentral/dashboard",attributes:r.attributes}))}});
jQuery(document).ready(function($){
var namefirst="SalesTeam";
var at="@";
var domain="webrageous.com"
var thelink=$('<a>',{
text: namefirst+at+domain,
title: namefirst+at+domain,
href: "mailto:" + namefirst+at+domain
}).appendTo('.mailaddress');
var namefirst="SalesTeam";
var at="@";
var domain="webrageous.com"
var thelink=$('<a>',{
text: namefirst+at+domain,
title: namefirst+at+domain,
href: "mailto:" + namefirst+at+domain
}).appendTo('.mailsalesteam');
});
(function(a){
"use strict";
a(function(){})
})(jQuery);
function contact_sidebar_validate(a){
if(""==a.firstName.value){
return alert("Please enter a value for the \"First Name\" field."), a.firstName.focus(), !1
}
if(""==a.lastName.value){
return alert("Please enter a value for the \"Last Name\" field."), a.lastName.focus(), !1
}
if(""==a.email.value){
return alert("Please enter a value for the \"Email\" field."), a.email.focus(), !1
}
if(10 > a.phone.value.length){
return alert("Please enter at least 10 digits in the \"Phone\" field."), a.phone.focus(), !1
}
if(( a.phone.value.length >=20)){
return alert("Too many digits in the \"Phone\" field."), a.phone.focus(), !1
}
if(""==a.message.value){
return alert("Please enter a value for the \"Message\" field."), a.message.focus(), !1
}
if(10 > a.message.value.length){
return alert("Please enter at least 10 characters in the \"message\" field."), a.message.focus(), !1
}
if(""==a.TypeofBusiness.value){
return alert("Please select \"Type of Business\"."), a.TypeofBusiness.focus(), !1
}
if("111"!=a.code.value){
return alert("Please enter a valid \"Anti-Spam\" code."), a.code.focus(), !1
}
var b=a.phone.value,
c = !0,
d = !0,
e=0,
f="";
for (i=0; i < b.length; i +=1){
for (ch=b.charAt(i), j=0; j < "0123456789-.,xX".length&&!(ch=="0123456789-.,xX".charAt(j)); j +=1){};
if(j=="0123456789-.,xX".length){
c = !1;
break
}
if("."==ch){
f +=".", e +=1
}else if(","==ch&&0!=e){
d = !1;
break
}else{
","!=ch&&(f +=ch)
}}
return c ? !(1 < e)&&d||(alert("Please enter a valid number in the \"phone\" field."), a.phone.focus(), !1):(alert("Please enter only digit characters in the \"phone\" field."), a.phone.focus(), !1)
}
function contact_footer_validate(a){
if(""==a.firstName.value){
return alert("Please enter a value for the \"First Name\" field."), a.firstName.focus(), !1
}
if(""==a.lastName.value){
return alert("Please enter a value for the \"Last Name\" field."), a.lastName.focus(), !1
}
if(""==a.email.value){
return alert("Please enter a value for the \"Email\" field."), a.email.focus(), !1
}
if((10 > a.phone.value.length)){
return alert("Please enter at least 10 digits in the \"Phone\" field."), a.phone.focus(), !1
}
if(( a.phone.value.length >=20)){
return alert("Too many digits in the \"Phone\" field."), a.phone.focus(), !1
}
if(""==a.TypeofBusiness.value){
return alert("Please select \"Type of Business\"."), a.TypeofBusiness.focus(), !1
}
if(""==a.message.value){
return alert("Please enter a value for the \"Message\" field."), a.message.focus(), !1
}
if(10 > a.message.value.length){
return alert("Please enter at least 10 characters in the \"message\" field."), a.message.focus(), !1
}
if(""==a.code.value){
return alert("Please enter the value into the \"Anti-Spam\" field."), a.code.focus(), !1
}
if("111"!=a.code.value){
return alert("Please enter a valid \"Anti-Spam\" code."), a.code.focus(), !1
}
var b=a.phone.value,
c = !0,
d = !0,
e=0,
f="";
for (i=0; i < b.length; i +=1){
for (ch=b.charAt(i), j=0; j < "0123456789-.,xX".length&&!(ch=="0123456789-.,xX".charAt(j)); j +=1){};
if(j=="0123456789-.,xX".length){
c = !1;
break
}
if("."==ch){
f +=".", e +=1
}else if(","==ch&&0!=e){
d = !1;
break
}else{
","!=ch&&(f +=ch)
}}
return c ? !(1 < e)&&d||(alert("Please enter a valid number in the \"phone\" field."), a.phone.focus(), !1):(alert("Please enter only digit characters in the \"phone\" field."), a.phone.focus(), !1)
};
CLI_ACCEPT_COOKIE_NAME=(typeof CLI_ACCEPT_COOKIE_NAME!=='undefined' ? CLI_ACCEPT_COOKIE_NAME:'viewed_cookie_policy');
CLI_PREFERENCE_COOKIE=(typeof CLI_PREFERENCE_COOKIE!=='undefined' ? CLI_PREFERENCE_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";
}
if(days){
var date=new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires="; expires=" + date.toGMTString();
}else{
var expires="";
}
document.cookie=name + "=" + value + secure + expires + "; path=/";
if(days < 1){
host_name=window.location.hostname;
document.cookie=name + "=" + value + expires + "; path=/; domain=." + host_name + ";";
if(host_name.indexOf("www")!=1){
var host_name_withoutwww=host_name.replace('www', '');
document.cookie=name + "=" + value + secure + expires + "; path=/; domain=" + host_name_withoutwww + ";";
}
host_name=host_name.substring(host_name.lastIndexOf(".", host_name.lastIndexOf(".") - 1));
document.cookie=name + "=" + value + secure + expires + "; path=/; domain=" + host_name + ";";
}},
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);
},
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;
}}
var CLI =
{
bar_config: {},
showagain_config: {},
allowedCategories: [],
js_blocking_enabled: false,
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.js_blocking_enabled=Boolean(Cli_Data.js_blocking);
this.settings=args.settings;
this.bar_elm=jQuery(this.settings.notify_div_id);
this.showagain_elm=jQuery(this.settings.showagain_div_id);
this.settingsModal=jQuery('#cliSettingsPopup');
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.delete_link=jQuery(".cookielawinfo-cookie-delete");
this.settings_button=jQuery('.cli_settings_button');
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.addStyleAttribute();
this.configBar();
this.toggleBar();
this.attachDelete();
this.attachEvents();
this.configButtons();
this.reviewConsent();
var cli_hidebar_on_readmore=this.hideBarInReadMoreLink();
if(Boolean(this.settings.scroll_close)===true&&cli_hidebar_on_readmore===false){
window.addEventListener("scroll", CLI.closeOnScroll, false);
}},
hideBarInReadMoreLink: function (){
if(Boolean(CLI.settings.button_2_hidebar)===true&&this.main_link.length > 0&&this.main_link.hasClass('cli-minimize-bar')){
this.hideHeader();
cliBlocker.cookieBar(false);
this.showagain_elm.slideDown(this.settings.animate_speed_show);
return true;
}
return false;
},
attachEvents: function (){
jQuery(document).on('click',
'.wt-cli-privacy-btn',
function (e){
e.preventDefault();
CLI.accept_close();
CLI.settingsPopUpClose();
}
);
jQuery('.wt-cli-accept-btn').on("click",
function (e){
e.preventDefault();
CLI.acceptRejectCookies(jQuery(this));
});
jQuery('.wt-cli-accept-all-btn').on("click",
function (e){
e.preventDefault();
CLI.acceptRejectCookies(jQuery(this), 'accept');
});
jQuery('.wt-cli-reject-btn').on("click",
function (e){
e.preventDefault();
CLI.acceptRejectCookies(jQuery(this), 'reject');
});
this.settingsPopUp();
this.settingsTabbedAccordion();
this.toggleUserPreferenceCheckBox();
this.hideCookieBarOnClose();
this.cookieLawInfoRunCallBacks();
},
acceptRejectCookies(element, action='custom'){
var open_link=element[0].hasAttribute("href")&&element.attr("href")!='#' ? true:false;
var new_window=false;
if(action=='accept'){
this.enableAllCookies();
this.accept_close();
new_window=CLI.settings.button_7_new_win ? true:false;
}else if(action=='reject'){
this.disableAllCookies();
this.reject_close();
new_window=Boolean(this.settings.button_3_new_win) ? true:false;
}else{
this.accept_close();
new_window=Boolean(this.settings.button_1_new_win) ? true:false;
}
if(open_link){
if(new_window){
window.open(element.attr("href"), '_blank');
}else{
window.location.href=element.attr("href");
}}
},
toggleUserPreferenceCheckBox: function (){
jQuery('.cli-user-preference-checkbox').each(function (){
categoryCookie='cookielawinfo-' + jQuery(this).attr('data-id');
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').on("click",
function (e){
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.generateConsent();
}
);
},
settingsPopUp: function (){
jQuery(document).on('click',
'.cli_settings_button',
function (e){
e.preventDefault();
CLI.settingsModal.addClass("cli-show").css({ 'opacity': 0 }).animate({ 'opacity': 1 });
CLI.settingsModal.removeClass('cli-blowup cli-out').addClass("cli-blowup");
jQuery('body').addClass("cli-modal-open");
jQuery(".cli-settings-overlay").addClass("cli-show");
jQuery("#cookie-law-info-bar").css({ 'opacity': .1 });
if(!jQuery('.cli-settings-mobile').is(':visible')){
CLI.settingsModal.find('.cli-nav-link:eq(0)').trigger("click");
}}
);
jQuery('#cliModalClose').on("click",
function (e){
CLI.settingsPopUpClose();
}
);
CLI.settingsModal.on("click",
function (e){
if(!(document.getElementsByClassName('cli-modal-dialog')[0].contains(e.target))){
CLI.settingsPopUpClose();
}}
);
jQuery('.cli_enable_all_btn').on("click",
function (e){
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.privacyReadmore();
},
settingsTabbedAccordion: function (){
jQuery(".cli-tab-header").on("click",
function (e){
if(!(jQuery(e.target).hasClass('cli-slider')||jQuery(e.target).hasClass('cli-user-preference-checkbox'))){
if(jQuery(this).hasClass("cli-tab-active")){
jQuery(this).removeClass("cli-tab-active");
jQuery(this)
.siblings(".cli-tab-content")
.slideUp(200);
}else{
jQuery(".cli-tab-header").removeClass("cli-tab-active");
jQuery(this).addClass("cli-tab-active");
jQuery(".cli-tab-content").slideUp(200);
jQuery(this)
.siblings(".cli-tab-content")
.slideDown(200);
}}
}
);
},
settingsPopUpClose: function (){
this.settingsModal.removeClass('cli-show');
this.settingsModal.addClass('cli-out');
jQuery('body').removeClass("cli-modal-open");
jQuery(".cli-settings-overlay").removeClass("cli-show");
jQuery("#cookie-law-info-bar").css({ 'opacity': 1 });
},
privacyReadmore: function (){
var el=jQuery('.cli-privacy-content .cli-privacy-content-text');
if(el.length > 0){
var clone=el.clone(),
originalHtml=clone.html(),
originalHeight=el.outerHeight(),
Trunc={
addReadmore: function (textBlock){
if(textBlock.html().length > 250){
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 > 250){
var newStr=currentText.substring(0, 250);
textBlock.empty().html(newStr).append('...');
}},
replaceText: function (textBlock, original){
return textBlock.html(original);
}};
Trunc.addReadmore(el);
Trunc.truncateText(el);
jQuery('a.cli-privacy-readmore').on("click",
function (e){
e.preventDefault();
if(jQuery('.cli-privacy-overview').hasClass('cli-collapsed')){
Trunc.truncateText(el);
jQuery('.cli-privacy-overview').removeClass('cli-collapsed');
el.css('height', '100%');
}else{
jQuery('.cli-privacy-overview').addClass('cli-collapsed');
Trunc.replaceText(el, originalHtml);
}}
);
}},
attachDelete: function (){
this.delete_link.on("click",
function (e){
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.generateConsent();
return false;
}
);
},
configButtons: function (){
this.main_button.css('color', this.settings.button_1_link_colour);
if(Boolean(this.settings.button_1_as_button)){
this.main_button.css('background-color', this.settings.button_1_button_colour);
this.main_button.on('mouseenter',
function (){
jQuery(this).css('background-color', CLI.settings.button_1_button_hover);
}
)
.on('mouseleave',
function (){
jQuery(this).css('background-color', CLI.settings.button_1_button_colour);
}
);
}
this.main_link.css('color', this.settings.button_2_link_colour);
if(Boolean(this.settings.button_2_as_button)){
this.main_link.css('background-color', this.settings.button_2_button_colour);
this.main_link.on('mouseenter',
function (){
jQuery(this).css('background-color', CLI.settings.button_2_button_hover);
}
)
.on('mouseleave',
function (){
jQuery(this).css('background-color', CLI.settings.button_2_button_colour);
}
);
}
this.reject_link.css('color', this.settings.button_3_link_colour);
if(Boolean(this.settings.button_3_as_button)){
this.reject_link.css('background-color', this.settings.button_3_button_colour);
this.reject_link.on('mouseenter',
function (){
jQuery(this).css('background-color', CLI.settings.button_3_button_hover);
}
)
.on('mouseleave',
function (){
jQuery(this).css('background-color', CLI.settings.button_3_button_colour);
}
);
}
this.settings_button.css('color', this.settings.button_4_link_colour);
if(Boolean(this.settings.button_4_as_button)){
this.settings_button.css('background-color', this.settings.button_4_button_colour);
this.settings_button.on('mouseenter',
function (){
jQuery(this).css('background-color', CLI.settings.button_4_button_hover);
}
)
.on('mouseleave',
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.on('mouseenter',
function (){
jQuery(this).css('background-color', CLI.settings.button_7_button_hover);
}
)
.on('mouseleave',
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(!CLI_Cookie.exists(CLI_ACCEPT_COOKIE_NAME)){
this.displayHeader();
}else{
this.hideHeader();
}
if(Boolean(this.settings.show_once_yn)){
setTimeout(
function (){
CLI.close_header();
},
CLI.settings.show_once
);
}
if(CLI.js_blocking_enabled===false){
if(Boolean(Cli_Data.ccpaEnabled)===true){
if(Cli_Data.ccpaType==='ccpa'&&Boolean(Cli_Data.ccpaBarEnabled)===false){
cliBlocker.cookieBar(false);
}}else{
jQuery('.wt-cli-ccpa-opt-out,.wt-cli-ccpa-checkbox,.wt-cli-ccpa-element').remove();
}}
this.showagain_elm.on("click",
function (e){
e.preventDefault();
CLI.showagain_elm.slideUp(CLI.settings.animate_speed_hide,
function (){
CLI.bar_elm.slideDown(CLI.settings.animate_speed_show);
if(CLI_COOKIEBAR_AS_POPUP){
CLI.showPopupOverlay();
}}
);
}
);
},
configShowAgain: function (){
this.showagain_config={
'background-color': this.settings.background,
'color': this.l1hs(this.settings.text),
'position': 'fixed',
'font-family': this.settings.font_family
};
if(Boolean(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 (){
this.bar_config={
'background-color': this.settings.background,
'color': this.settings.text,
'font-family': this.settings.font_family
};
if(this.settings.notify_position_vertical=="top"){
this.bar_config['top']='0';
if(Boolean(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);
this.hideHeader();
},
accept_close: function (){
this.hidePopupOverlay();
this.generateConsent();
this.cookieLawInfoRunCallBacks();
CLI_Cookie.set(CLI_ACCEPT_COOKIE_NAME, 'yes', CLI_ACCEPT_COOKIE_EXPIRE);
if(Boolean(this.settings.notify_animate_hide)){
if(CLI.js_blocking_enabled===true){
this.bar_elm.slideUp(this.settings.animate_speed_hide, cliBlocker.runScripts);
}else{
this.bar_elm.slideUp(this.settings.animate_speed_hide);
}}else{
if(CLI.js_blocking_enabled===true){
this.bar_elm.hide(0, cliBlocker.runScripts);
}else{
this.bar_elm.hide();
}}
if(Boolean(this.settings.showagain_tab)){
this.showagain_elm.slideDown(this.settings.animate_speed_show);
}
if(Boolean(this.settings.accept_close_reload)===true){
this.reload_current_page();
}
return false;
},
reject_close: function (){
this.hidePopupOverlay();
this.generateConsent();
this.cookieLawInfoRunCallBacks();
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(Boolean(this.settings.notify_animate_hide)){
if(CLI.js_blocking_enabled===true){
this.bar_elm.slideUp(this.settings.animate_speed_hide, cliBlocker.runScripts);
}else{
this.bar_elm.slideUp(this.settings.animate_speed_hide);
}}else{
if(CLI.js_blocking_enabled===true){
this.bar_elm.hide(cliBlocker.runScripts);
}else{
this.bar_elm.hide();
}}
if(Boolean(this.settings.showagain_tab)){
this.showagain_elm.slideDown(this.settings.animate_speed_show);
}
if(Boolean(this.settings.reject_close_reload)===true){
this.reload_current_page();
}
return false;
},
reload_current_page: function (){
window.location.reload(true);
},
closeOnScroll: function (){
if(window.pageYOffset > 100&&!CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)){
CLI.accept_close();
if(Boolean(CLI.settings.scroll_close_reload)===true){
window.location.reload();
}
window.removeEventListener("scroll", CLI.closeOnScroll, false);
}},
displayHeader: function (){
if(Boolean(this.settings.notify_animate_show)){
this.bar_elm.slideDown(this.settings.animate_speed_show);
}else{
this.bar_elm.show();
}
this.showagain_elm.hide();
if(CLI_COOKIEBAR_AS_POPUP){
this.showPopupOverlay();
}},
hideHeader: function (){
if(Boolean(this.settings.showagain_tab)){
if(Boolean(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(Boolean(this.settings.popup_overlay)){
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 > 400 ? 300:cli_winw - 30;
cli_elm.css({
'width': cli_defw, 'height': 'auto', 'max-height': cli_winh, 'overflow': 'auto', 'position': 'fixed', 'box-sizing': 'border-box'
}
);
if(this.checkifStyleAttributeExist()===false){
cli_elm.css({ 'padding': '25px 15px' });
}
if(this.settings.widget_position=='left'){
cli_elm.css({
'left': '15px', 'right': 'auto', 'bottom': '15px', 'top': 'auto'
}
);
}else{
cli_elm.css({
'left': 'auto', 'right': '15px', 'bottom': '15px', '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() - 40;
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_winh, 'bottom': '', 'top': '50%', 'left': '50%', 'margin-left': (cli_defw / 2) * -1, 'margin-top': '-100px', 'overflow': 'auto'
}
).addClass('cli-bar-popup cli-modal-content');
if(this.checkifStyleAttributeExist()===false){
cli_elm.css({ 'padding': '25px 15px' });
}
cli_h=cli_elm.height();
li_h=cli_h < 200 ? 200:cli_h;
cli_elm.css({ 'top': '50%', 'margin-top': ((cli_h / 2) + 30) * -1 });
setTimeout(
function (){
cli_elm.css({
'bottom': ''
}
);
},
100
);
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
);
}
);
},
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);
}}
);
},
hideCookieBarOnClose: function (){
jQuery(document).on('click',
'.cli_cookie_close_button',
function (e){
e.preventDefault();
var elm=jQuery(this);
if(Cli_Data.ccpaType==='ccpa'){
CLI.enableAllCookies();
}
CLI.accept_close();
}
);
},
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;
},
cookieLawInfoRunCallBacks: function (){
this.checkCategories();
if(CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)=='yes'){
if("function"==typeof CookieLawInfo_Accept_Callback){
CookieLawInfo_Accept_Callback();
}}
},
generateConsent: function (){
var preferenceCookie=CLI_Cookie.read(CLI_PREFERENCE_COOKIE);
cliConsent={};
if(preferenceCookie!==null){
cliConsent=window.atob(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_PREFERENCE_COOKIE, cliConsent, CLI_ACCEPT_COOKIE_EXPIRE);
},
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=styleClass.replace('cli-bar-container', '');
styleClass=styleClass.trim();
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, ' '));
},
CookieLawInfo_Callback: function (enableBar, enableBlocking){
enableBar=typeof enableBar!=='undefined' ? enableBar:true;
enableBlocking=typeof enableBlocking!=='undefined' ? enableBlocking:true;
if(CLI.js_blocking_enabled===true&&Boolean(Cli_Data.custom_integration)===true){
cliBlocker.cookieBar(enableBar);
cliBlocker.runScripts(enableBlocking);
}},
checkifStyleAttributeExist: function (){
var exist=false;
var attr=this.bar_elm.attr('data-cli-style');
if(typeof attr!==typeof undefined&&attr!==false){
exist=true;
}
return exist;
},
reviewConsent: function (){
jQuery(document).on('click',
'.cli_manage_current_consent,.wt-cli-manage-consent-link',
function (){
CLI.displayHeader();
}
);
},
mayBeSetPreferenceCookie: function (){
if(CLI.getParameterByName('cli_bypass')==="1"){
CLI.generateConsent();
}}
}
var cliBlocker =
{
blockingStatus: true,
scriptsLoaded: false,
ccpaEnabled: false,
ccpaRegionBased: false,
ccpaApplicable: false,
ccpaBarEnabled: false,
cliShowBar: true,
isBypassEnabled: CLI.getParameterByName('cli_bypass'),
checkPluginStatus: function (callbackA, callbackB){
this.ccpaEnabled=Boolean(Cli_Data.ccpaEnabled);
this.ccpaRegionBased=Boolean(Cli_Data.ccpaRegionBased);
this.ccpaBarEnabled=Boolean(Cli_Data.ccpaBarEnabled);
if(Boolean(Cli_Data.custom_integration)===true){
callbackA(false);
}else{
if(this.ccpaEnabled===true){
this.ccpaApplicable=true;
if(Cli_Data.ccpaType==='ccpa'){
if(this.ccpaBarEnabled!==true){
this.cliShowBar=false;
this.blockingStatus=false;
}}
}else{
jQuery('.wt-cli-ccpa-opt-out,.wt-cli-ccpa-checkbox,.wt-cli-ccpa-element').remove();
}
if(cliBlocker.isBypassEnabled==="1"){
cliBlocker.blockingStatus=false;
}
callbackA(this.cliShowBar);
callbackB(this.blockingStatus);
}},
cookieBar: function (showbar){
showbar=typeof showbar!=='undefined' ? showbar:true;
cliBlocker.cliShowBar=showbar;
if(cliBlocker.cliShowBar===false){
CLI.bar_elm.hide();
CLI.showagain_elm.hide();
CLI.settingsModal.removeClass('cli-blowup cli-out');
CLI.hidePopupOverlay();
jQuery(".cli-settings-overlay").removeClass("cli-show");
}else{
if(!CLI_Cookie.exists(CLI_ACCEPT_COOKIE_NAME)){
CLI.displayHeader();
}else{
CLI.hideHeader();
}}
},
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 (blocking){
blocking=typeof blocking!=='undefined' ? blocking:true;
cliBlocker.blockingStatus=blocking;
srcReplaceableElms=['iframe', 'IFRAME', 'EMBED', 'embed', 'OBJECT', 'object', 'IMG', 'img'];
var genericFuncs =
{
renderByElement: function (callback){
cliScriptFuncs.renderScripts();
callback();
cliBlocker.scriptsLoaded=true;
},
};
var cliScriptFuncs =
{
scriptsDone: function (){
if(typeof Cli_Data.triggerDomRefresh!=='undefined'){
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 scriptType=$script.getAttribute('data-cli-script-type');
var elementPosition=$script.getAttribute('data-cli-element-position');
var isBlock=$script.getAttribute('data-cli-block');
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
}
var attrs=jQuery($script).prop("attributes");
for (var ii=0; ii < attrs.length; ++ii){
if(attrs[ii].nodeName!=='id'){
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)){
s.setAttribute('data-cli-consent', 'accepted');
s.type='text/javascript';
}
if(cliBlocker.ccpaApplicable===true){
if(ccpaOptedOut===true||CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)==null){
s.type='text/plain';
}}
}else{
s.type='text/javascript';
}
if($script.type!=s.type){
if(elementPosition==='head'){
document.head.appendChild(s);
}else{
document.body.appendChild(s);
}
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')
runList.push(function (callback){
cliScriptFuncs.insertScript($script, callback)
}
)
}
)
cliScriptFuncs.seq(runList, cliScriptFuncs.scriptsDone);
}}
};
genericFuncs.renderByElement(cliBlocker.removeCookieByCategory);
},
ccpaOptedOut: function (){
var ccpaOptedOut=false;
var preferenceCookie=CLI_Cookie.read(CLI_PREFERENCE_COOKIE);
if(preferenceCookie!==null){
cliConsent=window.atob(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
}
);
if(CLI.js_blocking_enabled===true){
cliBlocker.checkPluginStatus(cliBlocker.cookieBar, cliBlocker.runScripts);
}}
}
);
class VideoPopup {
constructor(options={}){
this.defaults={
autoplay: this.validateBoolean(options.autoplay, true),
wrapClose: this.validateBoolean(options.wrapClose, false),
noCookie: this.validateBoolean(options.noCookie, false),
handleVars: this.validateBoolean(options.handleVars, false),
onPageLoad: this.validateBoolean(options.onPageLoad, false),
oplCookie: options.oplCookie||false,
debug: this.validateBoolean(options.debug, false)
};
this.init();
}
init(){
this.addClickListener();
}
addClickListener(){
document.querySelectorAll('a.vp-a, a.vp-s').forEach(link=> {
link.addEventListener('click', async (e)=> {
if(link.classList.contains('vp-a')){
e.preventDefault();
link.blur();
await this.openPopup(link, true);
}
else if(link.classList.contains('vp-s')){
e.preventDefault();
link.blur();
await this.openPopup(link, false);
}});
});
}
validateBoolean(value, defaultValue){
if(value===undefined||value===null) return defaultValue;
if(value===true||value===false) return value;
if(value&&typeof value==='string'){
const cleanValue=value.trim().toLowerCase();
if(cleanValue==='true'||cleanValue==='1') return true;
if(cleanValue==='false'||cleanValue==='0') return false;
}
if(typeof value==='number'){
if(value===1) return true;
if(value===0) return false;
}
return defaultValue;
}
trimIfExists(value){
if(value&&(typeof value==='string'||typeof value==='number')){
const trimmed=typeof value==='string' ? value.trim():value;
return trimmed==='' ? null:trimmed;
}
return value;
}
async openPopup(element, autoplay){
const data=this.extractData(element);
const embedHTML=this.generateEmbed(data, autoplay);
await this.createPopup(embedHTML, data);
}
setCookie(name, days){
if(!name||!days) return;
const expirySec=Math.floor(Date.now() / 1000) + (days * 24 * 60 * 60);
const expiryDate=new Date(expirySec * 1000);
document.cookie=`${name}=${expirySec};expires=${expiryDate.toUTCString()};path=/`;
}
getCookie(name){
if(!name) return;
const match=document.cookie.match(new RegExp('(^|)' + name + '=([^;]+)'));
return match ? true:false;
}
unsetCookie(name){
if(!name) return;
if(this.getCookie(name)){
document.cookie=`${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/`;
}}
extractData(element){
const url=element.href;
let autoplay_status;
if(element.classList.contains('vp-a')){
autoplay_status='true (vp-a class)';
}else if(element.classList.contains('vp-s')){
autoplay_status='false (vp-s class)';
}else{
autoplay_status='the link are not contains vp-s or vp-a class!';
}
const noCookie=this.trimIfExists(element.getAttribute('data-cookie'));
const wrapClose=this.trimIfExists(element.getAttribute('data-wrap-c'));
return {
url: url,
noCookie: this.validateBoolean(noCookie, this.defaults.noCookie),
wrapClose: this.validateBoolean(wrapClose, this.defaults.wrapClose),
videoType: this.detectVideoType(url),
videoMimeType: this.getDirectVideoMimeType(url),
isAutoplay: autoplay_status,
mute: this.trimIfExists(element.getAttribute('data-mute')),
linkClasses: element.classList,
handleVars: this.defaults.handleVars,
onPageLoad: this.defaults.onPageLoad,
oplCookie: this.defaults.oplCookie
};}
generateEmbed(data, autoplay){
const url=data.url ? data.url.trim():null;
if(!url) return null;
if(this.isYouTube(url)){
return this.createYouTubeEmbed(url, data, autoplay);
}else if(this.isVimeo(url)){
return this.createVimeoEmbed(url, data, autoplay);
}else if(this.isDirectVideo(url)){
return this.createDirectVideoEmbed(url, data, autoplay);
}
return 0;
}
isYouTube(url){
return /youtube\.com|youtu\.be|youtube-nocookie\.com/i.test(url);
}
isVimeo(url){
return /vimeo\.com/i.test(url);
}
isDirectVideo(url){
return /\.(mp4|webm)$/i.test(url);
}
getDirectVideoMimeType(url){
if(/\.mp4$/i.test(url)){
return 'video/mp4';
}
else if(/\.webm$/i.test(url)){
return 'video/webm';
}else{
return null;
}}
detectVideoType(url){
if(this.isYouTube(url)){
return 'vp-video-type-youtube';
}
else if(this.isVimeo(url)){
return 'vp-video-type-vimeo';
}
else if(this.isDirectVideo(url)){
const getVideoMimeType=this.getDirectVideoMimeType(url);
if(getVideoMimeType=='video/mp4'){
return 'vp-video-type-mp4';
}
else if(getVideoMimeType=='video/webm'){
return 'vp-video-type-webm';
}
return null;
}
return false;
}
extractYouTubeId(url){
const match=url.match(/(?:youtube\.com\/(?:watch\?v=|embed\/|v\/|shorts\/)|youtu\.be\/|youtube-nocookie\.com\/(?:watch\?v=|embed\/|v\/)|m\.youtube\.com\/watch\?v=)([^&\n?#]+)/);
return match ? match[1]:null;
}
extractVimeoId(url){
const match=url.match(/vimeo\.com\/(?:channels\/[^\/]+\/|video\/)?(\d+)(?:\/|\?|$)/);
return match ? match[1]:null;
}
createYouTubeEmbed(url, data, autoplay){
if(!url) return null;
url=url.trim();
const videoId=this.extractYouTubeId(url);
if(!videoId) return false;
const youtubeDomain=data.noCookie===true||data.noCookie==1 ? 'youtube-nocookie.com':'youtube.com';
let embedUrl=`https://www.${youtubeDomain}/embed/${videoId}?`;
embedUrl +=`autoplay=${autoplay ? 1:0}`;
if(data.mute==1) embedUrl +=`&mute=1`;
return `<iframe src="${embedUrl}" frameborder="0" allow="autoplay; fullscreen"></iframe>`;
}
createVimeoEmbed(url, data, autoplay){
if(!url) return null;
url=url.trim();
const videoId=this.extractVimeoId(url);
if(!videoId) return false;
let embedUrl=`https://player.vimeo.com/video/${videoId}?`;
embedUrl +=`autoplay=${autoplay ? 1:0}`;
if(data.mute==1) embedUrl +=`&muted=1`;
if(data.noCookie===true||data.noCookie==1) embedUrl +=`&dnt=1`;
return `<iframe src="${embedUrl}" frameborder="0" allow="autoplay; fullscreen"></iframe>`;
}
createDirectVideoEmbed(url, data, autoplay){
if(!url) return null;
url=url.trim();
if(!this.isDirectVideo(url)) return false;
const autoplayAttr=autoplay ? ' autoplay':'';
const mutedAttr=data.mute ? ' muted':'';
const getVideoMimeType=this.getDirectVideoMimeType(url)||'video/mp4';
return `<video${mutedAttr}${autoplayAttr} controls playsInline controlslist="nodownload" disablePictureInPicture="true">
<source src="${url}" type="${getVideoMimeType}">
Your browser does not support the video tag.
</video>`;
}
deleteCurrentPopup(){
const currentOldPopup=document.querySelector('.YouTubePopUp-Wrap');
if(currentOldPopup){
currentOldPopup.remove();
}
const currentPopup=document.querySelector('.vp-show');
if(currentPopup){
currentPopup.classList.remove('vp-show');
currentPopup.remove();
}}
async createPopup(embedHTML, data){
this.deleteCurrentPopup();
const popup=document.createElement('div');
const modalType=this.defaults.onPageLoad ? 'vp-modal vp-modal_type_onpageload':'vp-modal vp-modal_type_click';
popup.className=modalType;
const videoTypeClass=data.videoType ? ' ' + data.videoType:'';
const iframe=embedHTML ? embedHTML:'';
popup.innerHTML=`
<div class="vp-container${videoTypeClass}">
<div class="vp-video" style="width: 800px; height: 450px;">
<span class="vp-close"></span>
${iframe}
</div>
</div>
`;
const popupContainer=popup.querySelector('.vp-container');
document.body.appendChild(popup);
await new Promise(resolve=> setTimeout(resolve, 30));
this.deleteCurrentPopup();
popup.classList.add('vp-show');
popup.focus();
data['iframe']=iframe ? 'appear':'no iframe';
if(this.defaults.onPageLoad&&data.oplCookie){
const cookieName=data.oplCookie["name"];
const cookieDays=data.oplCookie["days"];
if(cookieName&&cookieDays){
this.setCookie(cookieName, parseInt(cookieDays));
}}
popup.addEventListener('click', async (e)=> {
if(data.wrapClose!=1&&data.wrapClose!==true){
if(popup&&e.target===popup){
await this.closePopup();
}
if(popupContainer&&e.target===popupContainer){
await this.closePopup();
}}
});
popup.querySelector('.vp-close').addEventListener('click', async ()=> {
await this.closePopup();
});
document.addEventListener('keydown', async (e)=> {
const isShowPopup=document.querySelector('.vp-show');
if(e.key==='Escape'&&isShowPopup){
await this.closePopup();
}});
this.debug(data);
}
async closePopup(){
const popup=document.querySelector('.vp-show');
if(popup){
popup.classList.remove('vp-show');
await new Promise(resolve=> setTimeout(resolve, 500));
popup.remove();
}}
debug(data){
if(!this.defaults.handleVars){
console.log("videoPopup.js: General options object not found. Will use default options.");
}
const debugLogTitle=this.defaults.onPageLoad ? 'Video Popup - On Page Load Modal Debug':'Video Popup Modal Debug';
if(this.defaults.debug){
const videoURL=data.url ? data.url.trim():null;
if(!videoURL){
console.log(`===${debugLogTitle} - Start===`);
console.log('   No video URL! Please enter a video URL to display the debug result.');
console.log(`===${debugLogTitle} - End===`);
console.log('');
return;
}
console.log(`===${debugLogTitle} - Start===`);
console.log('Link Properties:');
for (const [key, value] of Object.entries(data)){
if(key==='oplCookie'&&typeof value==='object'&&value!==null){
console.log(`   ${key}: {`);
for (const [cookieKey, cookieValue] of Object.entries(value)){
console.log(`           ${cookieKey}: "${cookieValue}"`);
}
console.log(`       }`);
}else{
console.log(`   ${key}: ${value}`);
}}
console.log('Functions Status:');
console.log('   If YouTube Video:');
const isYouTubeResult=this.isYouTube(videoURL);
console.log(`      isYouTube: ${isYouTubeResult ? 'true':isYouTubeResult}`);
const youtubeVideoId=this.extractYouTubeId(videoURL);
console.log(`      extractYouTubeId: ${youtubeVideoId ? `Works Good - ${youtubeVideoId}`:youtubeVideoId}`);
const youtubeEmbedResult=this.createYouTubeEmbed(videoURL, data, true);
console.log(`      createYouTubeEmbed: ${youtubeEmbedResult ? 'Works Good':youtubeEmbedResult}`);
console.log('   If Vimeo Video:');
const isVimeoResult=this.isVimeo(videoURL);
console.log(`      isVimeo: ${isVimeoResult ? 'true':isVimeoResult}`);
const vimeoVideoId=this.extractVimeoId(videoURL);
console.log(`      extractVimeoId: ${vimeoVideoId ? `Works Good - ${vimeoVideoId}`:vimeoVideoId}`);
const vimeoEmbedResult=this.createVimeoEmbed(videoURL, data, true);
console.log(`      createVimeoEmbed: ${vimeoEmbedResult ? 'Works Good':vimeoEmbedResult}`);
console.log('   If Direct Video:');
const isDirectVideoResult=this.isDirectVideo(videoURL);
console.log(`      isDirectVideo: ${isDirectVideoResult ? 'true':isDirectVideoResult}`);
const directEmbedResult=this.createDirectVideoEmbed(videoURL, data, true);
console.log(`      createDirectVideoEmbed: ${directEmbedResult ? 'Works Good':directEmbedResult}`);
const generateEmbedResult=this.generateEmbed(data, true);
console.log(`   generateEmbed: ${generateEmbedResult ? 'Works Good':generateEmbedResult}`);
console.log(`===${debugLogTitle} - End===`);
console.log('');
}}
}
class VideoPopupOnPageLoad extends VideoPopup {
constructor(options={}){
super(options);
}
init(){}
async closePopup(){
await super.closePopup();
delete this;
}}
document.addEventListener('DOMContentLoaded', ()=> {
if(typeof theVideoPopupGeneralOptions==='undefined'){
new VideoPopup( { handleVars: false });
return;
}
new VideoPopup({
autoplay: true,
onPageLoad: false,
oplCookie: false,
wrapClose: theVideoPopupGeneralOptions.wrap_close,
noCookie: theVideoPopupGeneralOptions.no_cookie,
handleVars: true,
debug: theVideoPopupGeneralOptions.debug
});
});