Skip to content

Commit

Permalink
Merge pull request #84 from orestbida/v2.6
Browse files Browse the repository at this point in the history
v2.6.0
  • Loading branch information
orestbida authored Oct 6, 2021
2 parents 724611a + a01a259 commit 319adff
Show file tree
Hide file tree
Showing 15 changed files with 862 additions and 1,612 deletions.
19 changes: 19 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- enhancement
- bug
- documentation
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
524 changes: 255 additions & 269 deletions Readme.md

Large diffs are not rendered by default.

256 changes: 140 additions & 116 deletions demo/app.js
Original file line number Diff line number Diff line change
@@ -1,126 +1,150 @@
/*
* CookieConsent v2 DEMO config.
*/

// obtain cookieconsent plugin
var cc = initCookieConsent();

// microsoft logo
var logo = '<svg style="width: 110px; height: 30px; display: block;" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 337.6 72"><path fill="#737373" d="M140.4 14.4v43.2h-7.5V23.7h-.1l-13.4 33.9h-5l-13.7-33.9h-.1v33.9h-6.9V14.4h10.8l12.4 32h.2l13.1-32h10.2zm6.2 3.3c0-1.2.4-2.2 1.3-3 .9-.8 1.9-1.2 3.1-1.2 1.3 0 2.4.4 3.2 1.2s1.3 1.8 1.3 3-.4 2.2-1.3 3c-.9.8-1.9 1.2-3.2 1.2s-2.3-.4-3.1-1.2c-.8-.9-1.3-1.9-1.3-3zm8.1 8.9v31h-7.3v-31h7.3zm22.1 25.7c1.1 0 2.3-.2 3.6-.8 1.3-.5 2.5-1.2 3.6-2v6.8c-1.2.7-2.5 1.2-4 1.5-1.5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7fba00" d="M37.8 0H72v34.2H37.8z"/><path fill="#00a4ef" d="M0 37.8h34.2V72H0z"/><path fill="#ffb900" d="M37.8 37.8H72V72H37.8z"/></svg>';
var cookie = '🍪';

// run plugin with config object
cc.run({
autorun : true,
delay : 0,
current_lang : 'en',
auto_language : false,
autoclear_cookies : true,
cookie_expiration : 365,
theme_css: '../dist/cookieconsent.css',
force_consent: false,
current_lang : 'en',
autoclear_cookies : true, // default: false
theme_css: '../src/cookieconsent.css',
cookie_name: 'cc_cookie_demo1', // default: 'cc_cookie'
cookie_expiration : 365, // default: 182
page_scripts: true, // default: false

// auto_language : false, // default: false
// autorun : true, // default: true
// delay : 0, // default: 0
// force_consent: false,
// hide_from_bots: false, // default: false
// remove_cookie_tables: false // default: false
// cookie_domain: location.hostname, // default: current domain
// cookie_path: "/", // default: root
// cookie_same_site: "Lax",
// use_rfc_cookie: false, // default: false
// revision: 0, // default: 0

gui_options : {
consent_modal : {
layout : 'box', // box,cloud,bar
position : 'bottom right', // bottom,middle,top + left,right,center
transition : 'slide' // zoom,slide
},
settings_modal : {
layout : 'box', // box,bar
// position: 'left', // right,left (available only if bar layout selected)
transition : 'slide' // zoom,slide
}
},

onAccept: function(cookie){
console.log("onAccept fired ...");

// delete line below
typeof doDemoThings === 'function' && doDemoThings(cookie);
},

onChange: function(cookie, changed_preferences){
console.log("onChange fired ...");

onAccept: function(cookie){
console.log("onAccept fired ...");

if(cc.allowedCategory('analytics')){
cc.loadScript('https://www.google-analytics.com/analytics.js', function(){
ga('create', 'UA-46747204-4', 'auto');
ga('send', 'pageview');
console.log("analytics.js loaded");
});
}
// If analytics category's status was changed ...
if(changed_preferences.indexOf('analytics') > -1){

// delete line below
typeof doDemoThings === 'function' && doDemoThings(cookie);
},
// If analytics category is disabled ...
if(!cc.allowedCategory('analytics')){

onChange: function(cookie){
console.log("onChange fired ...");

// delete line below
typeof doDemoThings === 'function' && doDemoThings(cookie);
},
// Disable gtag ...
console.log("disabling gtag")
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('consent', 'default', {
'ad_storage': 'denied',
'analytics_storage': 'denied'
});
}
}

// delete line below
typeof doDemoThings === 'function' && doDemoThings(cookie);
},

languages : {
'en' : {
consent_modal : {
title : "I use cookies",
description : 'Hi, this website uses essential cookies to ensure its proper operation and tracking cookies to understand how you interact with it. The latter will be set only after consent. <button type="button" data-cc="c-settings" class="cc-link">Let me choose</button>',
primary_btn: {
text: 'Accept',
role: 'accept_all' //'accept_selected' or 'accept_all'
},
secondary_btn: {
text : 'Reject',
role : 'accept_necessary' //'settings' or 'accept_necessary'
}
},
settings_modal : {
title : '<div>Cookie settings</div><div aria-hidden="true" style="font-size: .8em; font-weight: 200; color: #687278; margin-top: 5px;">Powered by <a tabindex="-1" aria-hidden="true" href="https://github.com/orestbida/cookieconsent/" style="text-decoration: underline;">cookie-consent</a></div>',
save_settings_btn : "Save settings",
accept_all_btn : "Accept all",
close_btn_label: "Close",
cookie_table_headers : [
{col1: "Name" },
{col2: "Domain" },
{col3: "Expiration" },
{col4: "Description" },
{col5: "Type" }
],
blocks : [
{
title : "Cookie usage",
description: 'I use cookies to ensure the basic functionalities of the website and to enhance your online experience. You can choose for each category to opt-in/out whenever you want. For more details relative to cookies and other sensitive data, please read the full <a href="#" class="cc-link">privacy policy</a>.'
},{
title : "Strictly necessary cookies",
description: 'These cookies are essential for the proper functioning of my website. Without these cookies, the website would not work properly',
toggle : {
value : 'necessary',
enabled : true,
readonly: true //cookie categories with readonly=true are all treated as "necessary cookies"
}
},{
title : "Preferences cookies",
description: 'These cookies allow the website to remember the choices you have made in the past',
toggle : {
value : 'preferences', //there are no default categories => you specify them
enabled : false,
readonly: false
}
},{
title : "Analytics cookies",
description: 'These cookies collect information about how you use the website, which pages you visited and which links you clicked on. All of the data is anonymized and cannot be used to identify you',
toggle : {
value : 'analytics',
enabled : false,
readonly: false
},
cookie_table: [
{
col1: '_ga',
col2: 'google.com',
col3: '2 years',
col4: 'description ...' ,
col5: 'Permanent cookie'
},
{
col1: '_gat',
col2: 'google.com',
col3: '1 minute',
col4: 'description ...' ,
col5: 'Permanent cookie'
},
{
col1: '_gid',
col2: 'google.com',
col3: '1 day',
col4: 'description ...' ,
col5: 'Permanent cookie'
}
]
},{
title : "More information",
description: 'For any queries in relation to my policy on cookies and your choices, please <a class="cc-link" href="https://orestbida.com/contact">contact me</a>.',
}
]
}
}
}
languages : {
'en' : {
consent_modal : {
title : cookie + " We use cookies!",
description : 'Hi, this website uses essential cookies to ensure its proper operation and tracking cookies to understand how you interact with it. The latter will be set only after consent. <button type="button" data-cc="c-settings" class="cc-link">Let me choose</button>',
primary_btn: {
text: 'Accept all',
role: 'accept_all' //'accept_selected' or 'accept_all'
},
secondary_btn: {
text : 'Reject all',
role : 'accept_necessary' //'settings' or 'accept_necessary'
}
},
settings_modal : {
title : logo,
save_settings_btn : "Save settings",
accept_all_btn : "Accept all",
reject_all_btn: "Reject all",
close_btn_label: "Close",
cookie_table_headers : [
{col1: "Name" },
{col2: "Domain" },
{col3: "Expiration" },
{col4: "Description" }
],
blocks : [
{
title : "Cookie usage 📢",
description: 'I use cookies to ensure the basic functionalities of the website and to enhance your online experience. You can choose for each category to opt-in/out whenever you want. For more details relative to cookies and other sensitive data, please read the full <a href="#" class="cc-link">privacy policy</a>.'
},{
title : "Strictly necessary cookies",
description: 'These cookies are essential for the proper functioning of my website. Without these cookies, the website would not work properly',
toggle : {
value : 'necessary',
enabled : true,
readonly: true //cookie categories with readonly=true are all treated as "necessary cookies"
}
},{
title : "Performance and Analytics cookies",
description: 'These cookies allow the website to remember the choices you have made in the past',
toggle : {
value : 'analytics', //there are no default categories => you specify them
enabled : false,
readonly: false
},
cookie_table: [
{
col1: '^_ga',
col2: 'google.com',
col3: '2 years',
col4: 'description ...' ,
is_regex: true
},
{
col1: '_gid',
col2: 'google.com',
col3: '1 day',
col4: 'description ...' ,
}
]
},{
title : "Advertisement and Targeting cookies",
description: 'These cookies collect information about how you use the website, which pages you visited and which links you clicked on. All of the data is anonymized and cannot be used to identify you',
toggle : {
value : 'targeting',
enabled : false,
readonly: false
}
},{
title : "More information",
description: 'For any queries in relation to my policy on cookies and your choices, please <a class="cc-link" href="https://orestbida.com/contact">contact me</a>.',
}
]
}
}
}
});
59 changes: 27 additions & 32 deletions demo/app2.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,37 @@
/*
* CookieConsent v2 DEMO config.
*/

// obtain cookieconsent plugin
var cc = initCookieConsent();

// run plugin with config object
cc.run({
autorun : true,
delay : 0,
current_lang : 'en',
auto_language : false,
autoclear_cookies : true,
cookie_expiration : 365,
theme_css: '../dist/cookieconsent.css',
force_consent: true,

/* New options from v2.4 (everything is optional) */
// remove_cookie_tables: false // default: false (if set to true, cookie table's html will not be generated)

// cookie_domain: location.hostname, // default: current domain
autoclear_cookies : true, // default: false
theme_css: '../src/cookieconsent.css',
cookie_name: 'cc_cookie_demo2', // default: 'cc_cookie'
cookie_expiration : 365, // default: 182
page_scripts: true, // default: false
force_consent: true, // default: false

// auto_language : false, // default: false
// autorun : true, // default: true
// delay : 0, // default: 0
// hide_from_bots: false, // default: false
// remove_cookie_tables: false // default: false
// cookie_domain: location.hostname, // default: current domain
// cookie_path: "/", // default: root
// cookie_same_site: "Lax",

/* Manage existing <scripts> tags (check readme.md) */
page_scripts: true, // default: false (by default don't manage existing script tags)
// use_rfc_cookie: false, // default: false
// revision: 0, // default: 0

/* Basic gui options */
gui_options : {
consent_modal : {
layout : 'cloud', // box(default),cloud,bar
position : 'bottom center', // bottom(default),top + left,right,center:=> examples: 'bottom' or 'top right'
transition : 'slide' // zoom(default),slide
layout : 'cloud', // box,cloud,bar
position : 'bottom center', // bottom,middle,top + left,right,center
transition : 'slide' // zoom,slide
},
settings_modal : {
layout : 'bar', // box(default),bar
position: 'left', // right(default),left (available only if bar layout selected)
transition : 'slide' // zoom(default),slide
layout : 'bar', // box,bar
position: 'left', // right,left (available only if bar layout selected)
transition : 'slide' // zoom,slide
}
},

Expand All @@ -48,7 +43,7 @@ cc.run({
disableBtn('btn3');

// Delete line below
document.getElementById("cookie_val").innerHTML = JSON.stringify(cookie, null, 2);
document.getElementById("cookie_val") && (document.getElementById("cookie_val").innerHTML = JSON.stringify(cookie, null, 2));
},

onChange: function(cookie, changed_preferences){
Expand All @@ -72,14 +67,14 @@ cc.run({
}

// Delete line below
document.getElementById("cookie_val").innerHTML = JSON.stringify(cookie, null, 2);
document.getElementById("cookie_val") && (document.getElementById("cookie_val").innerHTML = JSON.stringify(cookie, null, 2));
},

languages : {
'en' : {
'en' : {
consent_modal : {
title : "Hello traveler, it's cookie time!",
description : 'Hi, this website uses essential cookies to ensure its proper operation and tracking cookies to understand how you interact with it. The latter will be set only after consent. <a href="#privacy-policy" class="cc-link">Privacy policy</a>',
title : "Hello traveller, it's cookie time!",
description : 'Our website uses essential cookies to ensure its proper operation and tracking cookies to understand how you interact with it. The latter will be set only after consent. <a href="#privacy-policy" class="cc-link">Privacy policy</a>',
primary_btn: {
text: 'Accept all',
role: 'accept_all' //'accept_selected' or 'accept_all'
Expand All @@ -91,7 +86,7 @@ cc.run({
revision_message: "<br><br> Dear user, terms and conditions have changed since the last time you visisted!"
},
settings_modal : {
title : '<div>Cookie preferences</div><div aria-hidden="true" style="font-size: .8em; font-weight: 400; color: #687278; margin-top: 3px;">Powered by <a tabindex="-1" aria-hidden="true" href="https://github.com/orestbida/cookieconsent/">cookie-consent</a></div>',
title : 'Cookie settings',
save_settings_btn : "Save current selection",
accept_all_btn : "Accept all",
reject_all_btn: "Reject all",
Expand Down
File renamed without changes.
Loading

0 comments on commit 319adff

Please sign in to comment.