This commit is contained in:
Roman Pyrih
2024-11-12 13:33:19 +01:00
parent 6f280e1113
commit 8da0fc1925
2 changed files with 32 additions and 18 deletions

View File

@@ -50,7 +50,8 @@ Make your own cookie information popup in minutes.
title: "Cenimy prywatność użytkowników", // Title of popup bannner
description: "Używamy plików cookie, aby poprawić jakość przeglądania, wyświetlać reklamy lub treści dostosowane do indywidualnych potrzeb użytkowników oraz analizować ruch na stronie. Kliknięcie przycisku „Akceptuj wszystkie” oznacza zgodę na wykorzystywanie przez nas plików cookie.", // Message
acceptBtnLabel: "Akceptuj", // Accept cookie button text
declineInfoBtnLabel: "Odrzuć", // Decline cookie button text
declineInfoBtnLabel: "Dostosuj", // Decline cookie button text
acceptBtnSettingsLabel: "Zatwierdź",
moreInfoBtnLink: "", // Learn more link(default: privacy policy page)
moreInfoBtnLabel: "", // More info link text
cookieTypesTitle: "Wybierz pliki cookies do akceptacji", // Title of cookie preference options
@@ -121,7 +122,7 @@ Make your own cookie information popup in minutes.
}
});
let cookieNotice='<div id="cookieNoticePro" class="'+config.themeSettings.themeMode+" display-"+config.displayPosition+" full-width-"+config.fullWidth+'"><div id="closeIcon">'+ closeIcon +'</div><div class="title-wrap">'+cookieIcon+"<h4>"+config.title+'</h4></div><div class="content-wrap"><div class="msg-wrap"><p>'+config.description+' <a style="color:'+config.themeSettings.primaryColor+';" href="'+ config.moreInfoBtnLink +'">'+config.moreInfoBtnLabel+'</a></p><div id="cookieSettings">'+settingsIcon+config.settingsBtnLabel+'</div><div id="cookieTypes" style="display:none;"><h5>'+config.cookieTypesTitle+"</h5><ul>"+cookieTypes+'</ul></div></div><div class="btn-wrap"><button id="cookieAccept" style="color:'+config.themeSettings.lightColor+";background:"+config.themeSettings.primaryColor+";border: 1px solid "+config.themeSettings.primaryColor+';" type="button">'+config.acceptBtnLabel+'</button><button id="cookieReject" style="color:'+config.themeSettings.primaryColor+";border: 1px solid "+config.themeSettings.primaryColor+';" type="button">'+config.declineInfoBtnLabel+"</button></div>";
let cookieNotice='<div id="cookieNoticePro" class="'+config.themeSettings.themeMode+" display-"+config.displayPosition+" full-width-"+config.fullWidth+'"><div id="closeIcon">'+ closeIcon +'</div><div class="title-wrap">'+cookieIcon+"<h4>"+config.title+'</h4></div><div class="content-wrap"><div class="msg-wrap"><p>'+config.description+' <a style="color:'+config.themeSettings.primaryColor+';" href="'+ config.moreInfoBtnLink +'">'+config.moreInfoBtnLabel+'</a></p><div id="cookieSettings">'+settingsIcon+config.settingsBtnLabel+'</div><div id="cookieTypes" style="display:none;"><h5>'+config.cookieTypesTitle+"</h5><ul>"+cookieTypes+'</ul></div></div><div class="btn-wrap"><button id="cookieAccept" style="color:'+config.themeSettings.lightColor+";background:"+config.themeSettings.primaryColor+";border: 1px solid "+config.themeSettings.primaryColor+';" type="button"><span class="acceptBtnLabel">'+config.acceptBtnLabel+'</span><span class="acceptBtnSettingsLabel">'+config.acceptBtnSettingsLabel+'</span></button><button id="cookieReject" style="color:'+config.themeSettings.primaryColor+";border: 1px solid "+config.themeSettings.primaryColor+';" type="button">'+config.declineInfoBtnLabel+"</button></div>";
setTimeout(() => {
@@ -137,9 +138,9 @@ Make your own cookie information popup in minutes.
if(!config.showSettingsBtn) {
$("#cookieNoticePro #cookieSettings").hide();
}
if(!config.showDeclineBtn) {
$("#cookieNoticePro #cookieReject").hide();
}
// if(!config.showDeclineBtn) {
// $("#cookieNoticePro #cookieReject").hide();
// }
if(!config.showCookieIcon) {
$("#cookieNoticePro #cookieIcon").hide();
}
@@ -164,32 +165,40 @@ Make your own cookie information popup in minutes.
googleConsentModeHandler();
}
});
$("body").on("click", "#cookieSettings", () => {
$("body").on("click", "#cookieSettings, #cookieReject", () => {
if(event === "open"){
$('input[name="gdprPrefItem"]:not(:disabled)').attr("data-compulsory", "off").prop("checked", false);
$("#cookieTypes").slideDown("fast", function () {
$("#cookieSettings").prop("disabled", true);
$("#cookieSettings").prop("disabled", true);
});
} else {
$('input[name="gdprPrefItem"]:not(:disabled)').attr("data-compulsory", "off").prop("checked", config.allCheckboxesChecked);
$("#cookieTypes").toggle("fast", function () {
$("#cookieSettings").prop("disabled", false);
$("#cookieSettings").prop("disabled", false);
if ($("#cookieTypes").is(":visible")) {
$("#cookieAccept .acceptBtnLabel").hide();
$(".acceptBtnSettingsLabel").show();
} else {
$("#cookieAccept .acceptBtnLabel").show();
$("#cookieAccept .acceptBtnSettingsLabel").hide();
}
});
}
});
$("body").on("click", "#closeIcon", () => {
$("#cookieNoticePro").remove();
});
$("body").on("click", "#cookieReject", () => {
hideCookieBanner(false, config.expires);
config.onConsentReject.call(this);
// $("body").on("click", "#cookieReject", () => {
// hideCookieBanner(false, config.expires);
// config.onConsentReject.call(this);
// Delete prefs cookie from brower on reject
createCookie(COOKIE_CONSENT_PREFS, "", {
expires: daysToUTC(-365),
path: "/"
});
});
// // Delete prefs cookie from brower on reject
// createCookie(COOKIE_CONSENT_PREFS, "", {
// expires: daysToUTC(-365),
// path: "/"
// });
// });
}
// If already consent is accepted, inject preferences
else {
@@ -230,7 +239,7 @@ Make your own cookie information popup in minutes.
});
$("#cookieNoticePro").fadeOut("fast", () => {
$('body').off('click', "#cookieSettings");
$('body').off('click', "#cookieReject");
// $('body').off('click', "#cookieReject");
$('body').off('click', "#closeIcon");
$('body').off('click', "#cookieAccept");
$(this).remove();

View File

@@ -116,6 +116,11 @@ Make your own cookie information popup in minutes.
}
}
#cookieNoticePro button#cookieAccept .acceptBtnSettingsLabel{
display: none;
}
#cookieNoticePro.dark {
background-color: #393d4d;
background-color: var(--cookieNoticeProDark);