first commit

This commit is contained in:
2025-01-06 20:47:25 +01:00
commit 3bdbd78c2f
25591 changed files with 3586440 additions and 0 deletions

View File

@@ -0,0 +1,179 @@
/*
* ISC License
*
* Copyright (c) 2024 idnovate.com
* idnovate is a Registered Trademark & Property of idnovate.com, innovación y desarrollo SCP
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* @author idnovate
* @copyright 2024 idnovate
* @license https://www.isc.org/licenses/ https://opensource.org/licenses/ISC ISC License
*/
$(document).ready(function () {
toggleFields();
$('input[name="C_P_DEBUG"], select[name="C_P_MODE"], input[name="C_P_OVERLAY"], input[name="C_P_DISPLAY_TITLE"], input[name="technical"], input[name="C_P_GTM_ENABLE"]').change(function () {
toggleFields();
});
});
function toggleFields() {
if ($('input[name="C_P_DEBUG"]:checked').val() === '1') {
$('#C_P_IPS_DEBUG').closest('.form-group').slideDown(); // > PS 1.6
$('#C_P_IPS_DEBUG').closest('.margin-form').hide().prev().hide(); // PS 1.5
} else {
$('#C_P_IPS_DEBUG').closest('.form-group').slideUp(); // > PS 1.6
$('#C_P_IPS_DEBUG').closest('.margin-form').show().prev().show(); // PS 1.5
}
/*if ($('select[name="C_P_MODE"] option:selected').val() === '2') {
$('#C_P_CLASSIC_ACCEPT').closest('.form-group').show();
$('[name="C_P_MORE_INFO_DISPLAY"]').closest('.form-wrapper > .form-group').hide();
$('[name="C_P_MORE_INFO_BACKGROUND_COLOR"]').closest('.form-wrapper > .form-group').hide();
$('[name="C_P_MORE_INFO_FONT_COLOR"]').closest('.form-wrapper > .form-group').hide();
$('[name="C_P_REJECT_DISPLAY"]').closest('.form-wrapper > .form-group').hide();
$('[name="C_P_REJECT_BACKGROUND_COLOR"]').closest('.form-wrapper > .form-group').hide();
$('[name="C_P_REJECT_FONT_COLOR"]').closest('.form-wrapper > .form-group').hide();
$("#module-tabs a[href='#fieldset_3_3']").hide();
$("#module-tabs a[href='#fieldset_4_4']").hide();
$("#module-tabs a[href='#fieldset_5_5']").hide();
} else {
$('#C_P_CLASSIC_ACCEPT').closest('.form-group').hide();
$('[name="C_P_MORE_INFO_DISPLAY"]').closest('.form-wrapper > .form-group').show();
$('[name="C_P_MORE_INFO_BACKGROUND_COLOR"]').closest('.form-wrapper > .form-group').show();
$('[name="C_P_MORE_INFO_FONT_COLOR"]').closest('.form-wrapper > .form-group').show();
$('[name="C_P_REJECT_DISPLAY"]').closest('.form-wrapper > .form-group').show();
$('[name="C_P_REJECT_BACKGROUND_COLOR"]').closest('.form-wrapper > .form-group').show();
$('[name="C_P_REJECT_FONT_COLOR"]').closest('.form-wrapper > .form-group').show();
$("#module-tabs a[href='#fieldset_3_3']").show();
$("#module-tabs a[href='#fieldset_4_4']").show();
$("#module-tabs a[href='#fieldset_5_5']").show();
}*/
// Overlay
if ($('input[name="C_P_OVERLAY"]:checked').val() === '1') {
$('[name="C_P_OVERLAY_OPACITY"]').closest('.form-wrapper > .form-group').show();
$('[id="C_P_OVERLAY_MSG"]').closest('.form-wrapper > .form-group').show();
} else {
$('[name="C_P_OVERLAY_OPACITY"]').closest('.form-wrapper > .form-group').hide();
$('[id="C_P_OVERLAY_MSG"]').closest('.form-wrapper > .form-group').hide();
}
// Title
let defaultLang;
if (typeof default_language !== 'undefined') {
defaultLang = default_language;
} else if (typeof defaultLanguage !== 'undefined') {
defaultLang = defaultLanguage['id_lang'];
} else {
defaultLang = id_language;
}
/*if ($('input[name="C_P_DISPLAY_TITLE"]:checked').val() === '1') {
$('[name="C_P_TITLE_'+ defaultLang +'"]').closest('.form-wrapper > .form-group').show();
} else {
$('[name="C_P_TITLE_'+ defaultLang +'"]').closest('.form-wrapper > .form-group').hide();
}*/
// Modules with technical cookies
if ($('input[name="technical"]:checked').val() === '1') {
$('#cookiesplus-module-list').closest('.form-wrapper > .form-group').hide();
$('#js_script').closest('.form-wrapper > .form-group').hide();
$('#js_not_script').closest('.form-wrapper > .form-group').hide();
$('#cookiesplus-script-block').closest('.form-wrapper > .form-group').hide();
} else {
$('#cookiesplus-module-list').closest('.form-wrapper > .form-group').show();
$('#js_script').closest('.form-wrapper > .form-group').show();
$('#js_not_script').closest('.form-wrapper > .form-group').show();
$('#cookiesplus-script-block').closest('.form-wrapper > .form-group').show();
}
// GTM fire
if ($('input[name="C_P_GTM_ENABLE"]:checked').val() === '1') {
$('#cookiesplus-gtm-fire-list').closest('.form-wrapper > .form-group').hide();
$('#cookiesplus-gtm-list').closest('.form-wrapper > .form-group').show();
} else {
$('#cookiesplus-gtm-fire-list').closest('.form-wrapper > .form-group').show();
$('#cookiesplus-gtm-list').closest('.form-wrapper > .form-group').hide();
}
}
$(document).ready(function () {
if (typeof (tinySetup) != "undefined") {
tinySetup({
editor_selector: "cp_tiny",
valid_children: "+body[style|script|iframe|section|link],pre[iframe|section|script|div|p|br|span|img|style|h1|h2|h3|h4|h5],*[*]",
forced_root_block: '',
// formats: {'marginTop': {selector: 'p', styles: {'margin-top': '%value'}}},
image_advtab: true,
plugins: 'print preview code searchreplace directionality autolink visualblocks visualchars fullscreen image link table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists textcolor wordcount media contextmenu colorpicker',
external_plugins: {
"filemanager": ad + "/filemanager/plugin.min.js"
},
menubar: {
file: {title: 'File', items: 'newdocument'},
edit: {title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall'},
insert: {title: 'Insert', items: 'link media | button'},
format: {title: 'Format', items: 'bold italic underline strikethrough superscript subscript | formats | removeformat'},
table: {title: 'Table', items: 'inserttable tableprops deletetable | cell row column'},
tools: {title: 'Tools', items: 'code'}
},
toolbar1: 'code, bold, italic, underline, strikethrough, colorpicker, alignleft, aligncenter, alignright, alignjustify, casechange, permanentpen, formatpainter, removeformat, fontselect, fontsizeselect, bullist, numlist, checklist, outdent, indent, custommargin',
/*setup: function(editor) {
editor.addButton('custommargin', {
text: 'Margin',
icon: false,
onclick: function() {
editor.windowManager.open({
title: 'Margin (in px)',
body: [
{type: 'textbox', name: 'margin-top', label: 'margin-top'},
{type: 'textbox', name: 'margin-right', label: 'margin-right'},
{type: 'textbox', name: 'margin-bottom', label: 'margin-bottom'},
{type: 'textbox', name: 'margin-left', label: 'margin-left'}
],
onsubmit: function(e) {
tinymce.activeEditor.focus();
tinymce.activeEditor.formatter.toggle('marginTop', {value : e.data['margin-top'] + 'px'});
// editor.execCommand('mceToggleFormat', false, 'marginTop', e.data['margin-top'] + 'px');
//
// editor.selection.setContent('<pre class="language-' + e.data.language + ' line-numbers"><code>' + ed.selection.getContent() + '</code></pre>');
}
});
}
})
}*/
})
}
// Apply CodeMirror in JS field
$('.codemirror.codemirror-js').each(function () {
CodeMirror.fromTextArea($(this)[0], {
mode: "javascript",
theme: "monokai",
autoRefresh: true,
lineNumbers: true,
'CodeMirror-lines': 10
});
});
// Apply CodeMirror in CSS field
$('.codemirror.codemirror-css').each(function () {
CodeMirror.fromTextArea($(this)[0], {
mode: "css",
theme: "monokai",
autoRefresh: true,
lineNumbers: true,
'CodeMirror-lines': 10
});
});
});

View File

@@ -0,0 +1,499 @@
/*
* ISC License
*
* Copyright (c) 2024 idnovate.com
* idnovate is a Registered Trademark & Property of idnovate.com, innovación y desarrollo SCP
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* @author idnovate
* @copyright 2024 idnovate
* @license https://www.isc.org/licenses/ https://opensource.org/licenses/ISC ISC License
*/
var cookiesPlusBlockedScripts = cookiesPlusBlockedScripts || [];
var cookieGdpr = {
init: function () {
if (document.cookie.indexOf('cookiesplus=') === -1) {
// cookiesplus cookie doesn't exist, initialize it
// cookiesplusVars = [];
// cookiesplusVars['C_P_DISPLAY_MODAL'] = false;
var expireTime = new Date();
expireTime.setDate(expireTime.getDate() + C_P_EXPIRY);
var expires = "expires=" + expireTime.toUTCString();
document.cookie = "cookiesplus={};" + expires + ";path=/";
}
// mode DIVs before </body>
$('.cookiesplus-move').appendTo(document.body);
let cookiesplusVars = cookieGdpr.tryParseJSONObject(decodeURIComponent(cookieGdpr.getCookiesPlusCookieValue('cookiesplus')));
// Initialize values
cookiesplusFinalities = Object.keys(cookiesplusVars).filter(v => v.startsWith('cookiesplus-finality'));
cookiesplusFinalities.forEach(function (key) {
if (cookiesplusVars[key] === 'on') {
$("label[for='"+key+'-'+cookiesplusVars[key]+"']").click()
}
})
cookieGdpr.removeCookies();
cookieGdpr.executeScripts();
// Don't display modal in Cookies CMS
if ($('body#cms').length) {
id = $('body#cms').attr('class').match(/cms-[\w-]*\b/);
if (id) {
id = id[0].replace(/[^0-9]/gi, '');
if (typeof cookiesplusVars.C_P_CMS_PAGE !== 'undefined'
&& (typeof cookiesplusVars.C_P_CMS_PAGE === id)) {
return;
}
}
}
if (typeof cookiesplusVars.C_P_DISPLAY_MODAL === 'undefined'
|| (typeof cookiesplusVars.C_P_DISPLAY_MODAL !== 'undefined'
&& cookiesplusVars.C_P_DISPLAY_MODAL == true)) {
cookieGdpr.displayModal();
}
},
displayModal: function () {
if (typeof $.uniform !== "undefined" && typeof $.uniform.update !== "undefined") {
$.uniform.update(".cookiesplus-finality-checkbox");
$.uniform.restore(".cookiesplus-finality-checkbox");
}
if (typeof C_P_FINALITIES_COUNT === 'undefined'
|| C_P_FINALITIES_COUNT <= 1) {
return;
}
if (typeof C_P_NOT_AVAILABLE_OUTSIDE_EU !== 'undefined'
&& C_P_NOT_AVAILABLE_OUTSIDE_EU === 0) {
return;
} else {
this.displayOverlay();
$('.cookiesplus-actions .first-layer').show();
$('.cookiesplus-finalities').hide();
$('.cookiesplus-actions .second-layer').hide();
$('#cookiesplus-modal .cookiesplus-close-and-save').show();
$('#cookiesplus-modal .cookiesplus-close').hide();
$('#cookiesplus-modal').fadeIn('fast');
}
// this.checkEvenDimensions('#cookiesplus-modal');
/*$(window).resize(function () {
cookieGdpr.checkEvenDimensions('#cookiesplus-modal');
});*/
},
displayModalAdvanced: function (fromFirstLayer) {
if (typeof $.uniform !== "undefined" && typeof $.uniform.update !== "undefined") {
$.uniform.update(".cookiesplus-finality-checkbox");
$.uniform.restore(".cookiesplus-finality-checkbox");
}
/*if (C_P_FINALITIES_COUNT === 0) {
return;
}*/
this.displayOverlay();
if (typeof C_P_NOT_AVAILABLE_OUTSIDE_EU !== 'undefined'
&& C_P_NOT_AVAILABLE_OUTSIDE_EU === 0) {
$('#cookiesplus-modal-not-available').fadeIn('fast');
$('#cookiesplus-overlay').click(function() {
cookieGdpr.close();
})
} else {
$('#cookiesplus-modal').fadeIn('fast');
$('.cookiesplus-actions .first-layer').hide();
$('.cookiesplus-finalities').show();
$('.cookiesplus-actions .second-layer').show();
if (!fromFirstLayer) {
$('#cookiesplus-modal .cookiesplus-close-and-save').hide();
$('#cookiesplus-modal .cookiesplus-close').show();
}
}
// this.checkEvenDimensions('#cookiesplus-modal');
},
save: function () {
return cookieGdpr.sendForm();
},
acceptAllCookies: function () {
$('input:radio:not(:disabled)[name^=cookiesplus-finality-][value=on]').prop('checked', true);
return cookieGdpr.sendForm();
},
rejectAllCookies: function () {
$('input:radio:not(:disabled)[name^=cookiesplus-finality-][value=off]').prop('checked', true);
return cookieGdpr.sendForm();
},
displayOverlay: function () {
if (typeof C_P_OVERLAY !== 'undefined'
&& C_P_OVERLAY === '1') {
$('#cookiesplus-overlay').fadeIn('fast');
$('#cookiesplus-overlay').css('background-color', 'rgba(0, 0, 0, ' + C_P_OVERLAY_OPACITY + ')');
}
$('#cookiesplus-overlay').click(function(){
cookieGdpr.shake($('#cookiesplus-modal'), 4, 2, 20);
});
},
close: function () {
$('#cookiesplus-modal, #cookiesplus-modal-not-available, #cookiesplus-overlay').hide();
// $('.cookiesplus-save').prop('disabled', true);
},
checkEvenDimensions: function (div) {
// $(div).css('height', '');
var styleObject = $(div).prop('style');
styleObject.removeProperty('height');
if ($(div).height() % 2 === 1) {
$(div).height(2 * Math.round(($(div).height() - 1) / 2));
}
styleObject.removeProperty('width');
$(div).css('width', '');
if ($(div).width() % 2 === 1) {
$(div).width(2 * Math.round(($(div).width() - 1) / 2));
}
},
shake: function (div, shakes, distance, duration) {
if (shakes > 0) {
div.each(function () {
var $el = $(this);
var left = $el.css('left');
$el.animate({left: "-=" + distance}, duration, function () {
$el.animate({left: "+=" + distance * 2}, duration, function () {
$el.animate({left: left}, duration, function () {
cookieGdpr.shake($el, shakes - 1, distance, duration);
});
});
});
});
}
},
sendForm: function() {
// Read cookie value
let cookiesplusVars = cookieGdpr.tryParseJSONObject(decodeURIComponent(cookieGdpr.getCookiesPlusCookieValue('cookiesplus')));
if (cookiesplusVars instanceof Array) {
cookiesplusVars = Object.assign({}, cookiesplusVars);
}
// Save new info
cookiesplusVars['C_P_DISPLAY_MODAL'] = false;
$('#cookiesplus-form input:checked').each(function() {
cookiesplusVars[$(this).attr('name')] = $(this).val();
});
cookiesplusVars['consent_date'] = C_P_DATE;
var expireTime = new Date();
expireTime.setDate(expireTime.getDate() + C_P_EXPIRY);
var expires = "expires=" + expireTime.toUTCString();
document.cookie = "cookiesplus=" + encodeURIComponent(JSON.stringify(cookiesplusVars)) + ";" + expires + ";path=/";
cookieGdpr.removeCookies();
if (typeof C_P_REFRESH !== 'undefined'
&& !C_P_REFRESH) {
$.ajax({
type: "POST",
cache : false,
async : true,
url : $('#cookiesplus-form').attr('action'),
data: 'saveCookiesPlusPreferences=&ajax=1&'+$('#cookiesplus-form').serialize(),
dataType: 'json',
headers: {
"cache-control": "no-cache"
},
success: function(data) {
if (data.consent_link && data.consent_hash) {
$('.cookiesplus-consent-hash a').attr('href', data.consent_link);
$('.cookiesplus-consent-hash a').text(data.consent_hash);
$('.cookiesplus-consent-hash').show();
cookiesplusVars['consent_hash'] = data.consent_hash;
document.cookie = "cookiesplus=" + encodeURIComponent(JSON.stringify(cookiesplusVars)) + ";" + expires + ";path=/";
}
/*var d = new Date();
d.setTime(d.getTime() + (365 * 1000));
var expires = "expires=" + d.toUTCString();*/
// document.cookie = "cookiesplus=" + data.cookie + ";" + expires + ";path=/";
cookieGdpr.executeScripts();
cookieGdpr.fireGTMEvents();
cookieGdpr.fireFBPixel();
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(errorThrown);
}
});
cookieGdpr.close();
return false;
} else {
cookieGdpr.close();
return true;
}
},
removeCookies : function() {
$('#cookiesplus-form input:checked').each(function() {
if ($(this).val() !== 'on') {
// Save preferences
let finalityId = $(this).data('finality-id');
if (typeof C_P_COOKIES[finalityId] !== 'undefined') {
Object.keys(C_P_COOKIES[finalityId]).forEach(function (key) {
if (C_P_COOKIES[finalityId][key].name.includes('#')) {
let cookieValue = C_P_COOKIES[finalityId][key].name;
let hashIndex = cookieValue.indexOf("#");
let prefix = cookieValue.substr(0, hashIndex);
let suffix = cookieValue.substr(hashIndex + 1);
console.log('Removing cookies starting with ' + prefix + ' and ending with ' + suffix);
document.cookie.split(";").forEach(function(cookie) {
let cookieName = cookie.trim().split("=")[0];
if (cookieName.indexOf(prefix) === 0 && cookieName.endsWith(suffix)) {
var urlParts = location.hostname.split('.');
for (var i = 2; i < urlParts.length + 1; i++) {
console.log('Removing cookie ' + cookieName);
document.cookie = cookieName + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;Max-Age=0; path=/;';
document.cookie = cookieName + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;Max-Age=0; path=/; domain='+urlParts.slice(-i).join('.');
document.cookie = cookieName + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;Max-Age=0; path=/; domain=.'+urlParts.slice(-i).join('.');
}
}
});
} else {
console.log('Removing cookie ' + C_P_COOKIES[finalityId][key].name);
var urlParts = location.hostname.split('.');
for (var i = 2; i < urlParts.length + 1; i++) {
document.cookie = C_P_COOKIES[finalityId][key].name + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;Max-Age=0; path=/;';
document.cookie = C_P_COOKIES[finalityId][key].name + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;Max-Age=0; path=/; domain='+urlParts.slice(-i).join('.');
document.cookie = C_P_COOKIES[finalityId][key].name + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;Max-Age=0; path=/; domain=.'+urlParts.slice(-i).join('.');
}
}
})
}
}
});
},
executeScripts : function() {
// For each checked finality, execute associated script
$('#cookiesplus-form input:checked').each(function() {
if ($(this).val() === 'on') {
// Execute finality script
if (typeof C_P_SCRIPT !== 'undefined' && C_P_SCRIPT[$(this).data('finality-id')]) {
// var F = new Function(C_P_SCRIPT[$(this).data('finality-id')]);
// F();
$('body').append('<div style="display: none;" id="cookiesplus-scripts-' + $(this).data('finality-id') + '"></div>');
cookieGdpr.setInnerHTML(document.querySelector('#cookiesplus-scripts-' + $(this).data('finality-id')), C_P_SCRIPT[$(this).data('finality-id')]);
// Remove script to avoid execute it more than once
C_P_SCRIPT[$(this).data('finality-id')] = [];
}
} else if ($(this).val() === 'off') {
// Execute finality script
if (typeof C_P_SCRIPT_NOT !== 'undefined' && C_P_SCRIPT_NOT[$(this).data('finality-id')]) {
// var F = new Function(C_P_SCRIPT_NOT[$(this).data('finality-id')]);
// F();
$('body').append('<div style="display: none;" id="cookiesplus-scripts-' + $(this).data('finality-id') + '"></div>');
cookieGdpr.setInnerHTML(document.querySelector('#cookiesplus-scripts-' + $(this).data('finality-id')), C_P_SCRIPT_NOT[$(this).data('finality-id')]);
// Remove script to avoid execute it more than once
C_P_SCRIPT_NOT[$(this).data('finality-id')] = [];
}
}
});
// Append blocked script, js and css
for (var i = 0; i < cookiesPlusBlockedScripts.length; i++) {
let cookiesPlusBlockedScript = cookiesPlusBlockedScripts[i];
let finalities = cookiesPlusBlockedScript['finalities'].split(',');
let allFinalitiesAccepted = true;
for (var j = 0; j < finalities.length; j++) {
if (!$('#cookiesplus-form input#cookiesplus-finality-' + finalities[j] + '-on:checked').val()) {
allFinalitiesAccepted = false;
break;
}
}
if (allFinalitiesAccepted) {
// Append JS and scripts
if (!$.isEmptyObject(cookiesPlusBlockedScript['js'])) {
Object.keys(cookiesPlusBlockedScript['js']).forEach(function(key) {
var s = document.createElement( 'script');
s.setAttribute( 'src', cookiesPlusBlockedScript['js'][key] );
s.setAttribute('async', '');
document.body.appendChild(s);
(function(cookiesPlusBlockedScriptKey) {
s.onload = function() {
if (cookiesPlusBlockedScript['script']) {
$(cookiesPlusBlockedScript['location']).replaceWith(cookiesPlusBlockedScript['script']);
cookiesPlusBlockedScripts[cookiesPlusBlockedScriptKey]['script'] = [];
}
};
})(i);
})
cookiesPlusBlockedScripts[i]['js'] = [];
} else {
if (cookiesPlusBlockedScript['script']) {
$(cookiesPlusBlockedScript['location']).replaceWith(cookiesPlusBlockedScript['script']);
cookiesPlusBlockedScripts[i]['script'] = [];
}
}
// Append CSS
Object.keys(cookiesPlusBlockedScript['css']).forEach(function(key) {
var s = document.createElement('link');
s.setAttribute('rel', 'stylesheet');
s.setAttribute('href', cookiesPlusBlockedScript['css'][key] );
document.head.appendChild(s);
})
cookiesPlusBlockedScripts[i]['css'] = [];
}
}
return true;
},
fireGTMEvents : function() {
// For each checked finality, execute associated script
$('#cookiesplus-form input:checked').each(function() {
if (typeof C_P_GTM !== 'undefined' && !$.isEmptyObject(C_P_GTM) && C_P_GTM[$(this).data('finality-id')]) {
if (C_P_GTM[$(this).data('finality-id')]['gtmFinality']) {
Object.keys(C_P_GTM[$(this).data('finality-id')]['gtmFinality']).forEach(key => {
if ($(this).val() === 'on') {
// Fire GTM events
console.log('Granting consent ' + key);
gtag('consent', 'update', {
[key]: 'granted'
});
} else {
console.log('Denying consent ' + key);
gtag('consent', 'update', {
[key]: 'denied'
});
}
//console.log(`${key}: ${C_P_GTM[$(this).data('finality-id')]['gtmFinality'][key]}`);
});
}
}
});
window.dataLayer = window.dataLayer || [];
$('#cookiesplus-form input:checked').each(function() {
if ($(this).val() === 'on') {
// Fire GTM events
if (typeof C_P_GTM !== 'undefined' && !$.isEmptyObject(C_P_GTM) && C_P_GTM[$(this).data('finality-id')]) {
if (C_P_GTM[$(this).data('finality-id')]['firingEvent']) {
console.log('Firing event '+[C_P_GTM[$(this).data('finality-id')]['firingEvent']]);
dataLayer.push({'event': [C_P_GTM[$(this).data('finality-id')]['firingEvent']]});
}
}
}
});
dataLayer.push({'event': 'gtm.init_consent'});
return true;
},
fireFBPixel : function() {
if (typeof C_P_FB === 'undefined' || $.isEmptyObject(C_P_FB) ) {
return false;
}
let fbAllConsents = false;
// For each finality, execute associated script
$('#cookiesplus-form input:checked').each(function() {
// Fire FB Pixel
fbAllConsents = true;
if ($(this).val() !== 'on' && C_P_FB[$(this).data('finality-id')]) {
fbAllConsents = false;
return false;
}
});
if (fbAllConsents) {
console.log('Firing FB Pixel');
fbq('consent', 'grant');
}
return true;
},
setInnerHTML : function(elm, html) {
elm.innerHTML = html;
Array.from(elm.querySelectorAll("script")).forEach( function(oldScript) {
const newScript = document.createElement("script");
Array.from(oldScript.attributes)
.forEach( function(attr) {
newScript.setAttribute(attr.name, attr.value)
});
newScript.appendChild(document.createTextNode(oldScript.innerHTML));
oldScript.parentNode.replaceChild(newScript, oldScript);
});
},
tryParseJSONObject: function(jsonString) {
try {
var o = JSON.parse(jsonString);
// Handle non-exception-throwing cases:
// Neither JSON.parse(false) or JSON.parse(1234) throw errors, hence the type-checking,
// but... JSON.parse(null) returns null, and typeof null === "object",
// so we must check for that, too. Thankfully, null is falsey, so this suffices:
if (o && typeof o === "object") {
return o;
}
}
catch (e) { }
return {};
},
getCookiesPlusCookieValue: function(name) {
// return document.cookie.match('(^|;)\\s*' + name + '\\s*=\\s*([^;]+)')?.pop() || '';
var match = document.cookie.match(RegExp('(?:^|;\\s*)' + name + '=([^;]*)'));
return match ? match[1] : null;
}
}
$(document).ready(function () {
cookieGdpr.init();
$('.cookiesplus-displaymodal').on('click', function() {
cookieGdpr.displayModal();
})
$('.cookiesplus-displaymodaladvanced').on('click', function() {
cookieGdpr.displayModalAdvanced();
})
$('a[href*="#cookiesplus-displaymodaladvanced"]').click(function(e) {
e.preventDefault();
cookieGdpr.displayModalAdvanced();
});
});

View File

@@ -0,0 +1,32 @@
<?php
/**
* ISC License
*
* Copyright (c) 2024 idnovate.com
* idnovate is a Registered Trademark & Property of idnovate.com, innovación y desarrollo SCP
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* @author idnovate
* @copyright 2024 idnovate
* @license https://www.isc.org/licenses/ https://opensource.org/licenses/ISC ISC License
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,208 @@
/*
* ISC License
*
* Copyright (c) 2024 idnovate.com
* idnovate is a Registered Trademark & Property of idnovate.com, innovación y desarrollo SCP
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* @author idnovate
* @copyright 2024 idnovate
* @license https://www.isc.org/licenses/ https://opensource.org/licenses/ISC ISC License
*/
!function ($) {
"use strict"; // jshint ;_;
/* TAB CLASS DEFINITION
* ==================== */
var Tab = function (element) {
this.element = $(element)
}
Tab.prototype = {
constructor: Tab
, show: function () {
var $this = this.element
, $ul = $this.closest('ul:not(.dropdown-menu)')
, selector = $this.attr('data-target')
, previous
, $target
, e
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
if ( $this.parent('li').hasClass('active') ) return
previous = $ul.find('.active:last a')[0]
e = $.Event('show', {
relatedTarget: previous
})
$this.trigger(e)
if (e.isDefaultPrevented()) return
$target = $(selector)
this.activate($this.parent('li'), $ul)
this.activate($target, $target.parent(), function () {
$this.trigger({
type: 'shown'
, relatedTarget: previous
})
})
}
, activate: function ( element, container, callback) {
var $active = container.find('> .active')
, transition = callback
&& $.support.transition
&& $active.hasClass('fade')
function next() {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
element.addClass('active')
if (transition) {
element[0].offsetWidth // reflow for transition
element.addClass('in')
} else {
element.removeClass('fade')
}
if ( element.parent('.dropdown-menu') ) {
element.closest('li.dropdown').addClass('active')
}
callback && callback()
}
transition ?
$active.one($.support.transition.end, next) :
next()
$active.removeClass('in')
}
}
/* TAB PLUGIN DEFINITION
* ===================== */
var old = $.fn.tab
$.fn.tab = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('tab')
if (!data) $this.data('tab', (data = new Tab(this)))
if (typeof option == 'string') data[option]()
})
}
$.fn.tab.Constructor = Tab
/* TAB NO CONFLICT
* =============== */
$.fn.tab.noConflict = function () {
$.fn.tab = old
return this
}
/* TAB DATA-API
* ============ */
$(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
e.preventDefault()
$(this).tab('show')
})
}(window.jQuery);
(function($){
$.createTabs = function(){
// Create tab block
if ($('#content').find('form [id^="fieldset"]').length) {
blockTab = '<div class="col-lg-2"><div id="module-tabs" class="list-group">';
$.each($('#content').find('form [id^="fieldset"]'), function() {
heading = $(this).find('.panel-heading, legend');
blockTab += '<a href="#'+$(this).attr('id')+'" class="list-group-item" data-toggle="tab">'+heading.html()+'</a>';
$(this).addClass('tab-pane');
});
blockTab += '</div></div>';
// Add content
$('#content').addClass('row');
$('#content').find('form')/*.wrap("<div class='row'></div>")*/.before(blockTab).addClass('col-lg-10 tab-content');
// Remove <br>
$('#content').find('form > br').remove();
// Display first tab
$('#content').find('#module-tabs a:first').tab('show').addClass('active');
// Toggle panel
$("#content").find(".list-group-item").on('click', function() {
var el = $(this).parent().closest('.list-group').children('.active');
if (el.hasClass('active')) {
el.removeClass('active');
}
$(this).addClass('active');
});
$('#content').find('form').after($('<div class="clearfix">'));
// Custom
$('#module-tabs').parent().show();
$('div.ui-widget-header').css('height', '25px');
$('div.form-group div.col-lg-2').show();
}
// Javascript to enable link to tab
var url = document.location.toString();
if (url.match('#')) {
$('#module-tabs a[href=#'+url.split('#')[1]+']').click();
}
// Change hash for page-reload
$('a[data-toggle="tab"]').on('show.bs.tab', function (e) {
// window.location.hash = e.target.hash;
history.pushState(null,null,e.target.hash);
});
};
})(jQuery);
// Fire function
$(document).ready(function() {
if (location.hash) {
setTimeout(function() {
window.scrollTo(0, 0);
}, 1);
}
$.createTabs();
});