@getdesigned-vienna/cookie-consent
Advanced tools
Comparing version 1.1.3 to 1.1.5
@@ -1,3 +0,4 @@ | ||
function GdCookieConsent(debug = false) { | ||
function GdCookieConsent(debug = false, expiration = 365) { | ||
this.debugMode = debug; | ||
this.expiration = expiration; | ||
this.$gdcc = null; // will point to gdcc wrapper soon | ||
@@ -110,4 +111,20 @@ this.config = [] | ||
this.modifySrcAndScriptType = function (id, status) { | ||
var optIn = '.gdcc-optin[data-gdcc-cookie="' + id + '"][data-gdcc-src], .gdcc-optin-' + id + '[data-gdcc-src], [data-gdcc-selector="gdcc-optin-' + id + '"][data-gdcc-src]'; | ||
var optOut = '.gdcc-optout[data-gdcc-cookie="' + id + '"][data-gdcc-src], .gdcc-optout-' + id + '[data-gdcc-src], [data-gdcc-selector="gdcc-optout-' + id + '"][data-gdcc-src]'; | ||
var optIn = '' + | ||
'.gdcc-optin[data-gdcc-cookie="' + id + '"][data-gdcc-src], ' + | ||
'.gdcc-optin[data-gdcc-cookie="' + id + '"][data-gdcc-inline], ' + | ||
'.gdcc-optin-' + id + '[data-gdcc-src], ' + | ||
'.gdcc-optin-' + id + '[data-gdcc-inline], ' + | ||
'[data-gdcc-selector="gdcc-optin-' + id + '"][data-gdcc-src], ' + | ||
'[data-gdcc-selector="gdcc-optin-' + id + '"][data-gdcc-inline]' | ||
; | ||
var optOut = '' + | ||
'.gdcc-optout[data-gdcc-cookie="' + id + '"][data-gdcc-src], ' + | ||
'.gdcc-optout[data-gdcc-cookie="' + id + '"][data-gdcc-inline], ' + | ||
'.gdcc-optout-' + id + '[data-gdcc-src], ' + | ||
'.gdcc-optout-' + id + '[data-gdcc-inline], ' + | ||
'[data-gdcc-selector="gdcc-optout-' + id + '"][data-gdcc-src],' + | ||
'[data-gdcc-selector="gdcc-optout-' + id + '"][data-gdcc-inline]' | ||
; | ||
var that = this; | ||
@@ -129,4 +146,11 @@ | ||
$this.attr('type', 'text/javascript'); | ||
if (typeof $this.attr('data-gdcc-inline') !== typeof undefined && $this.attr('data-gdcc-inline') !== false) { | ||
$('head').append($this[0].outerHTML); | ||
$this.remove(); | ||
} | ||
} | ||
$this.attr('src', $this.attr('data-gdcc-src')); | ||
if (typeof $this.attr('data-gdcc-src') !== typeof undefined && $this.attr('data-gdcc-src') !== false) { | ||
$this.attr('src', $this.attr('data-gdcc-src')); | ||
} | ||
}); | ||
@@ -143,3 +167,6 @@ | ||
} | ||
$this.removeAttr('src'); | ||
if (typeof $this.attr('src') !== typeof undefined && $this.attr('src') !== false) { | ||
$this.removeAttr('src'); | ||
} | ||
}); | ||
@@ -220,3 +247,3 @@ } | ||
var json = JSON.stringify(context.config); | ||
cookie('gdcc-cookie-consent-settings', json); | ||
cookie('gdcc-cookie-consent-settings', json, this.expiration); | ||
this.log(JSON.parse(json)); | ||
@@ -223,0 +250,0 @@ } |
{ | ||
"name": "@getdesigned-vienna/cookie-consent", | ||
"version": "1.1.3", | ||
"version": "1.1.5", | ||
"description": "Cookie Consent completely configured via HTML", | ||
@@ -5,0 +5,0 @@ "main": "getdesigned-cookie-consent.js", |
@@ -89,3 +89,9 @@ Getdesigned Cookie Consent (GDCC) | ||
* The "type" attribute normally set to "text/css" and "type=text/javascript" should be set to "text/plain" instead. GDCC will take care. | ||
* Additionally, you can use inline scripts. Therefore, use the "data-gdcc-inline" attribute | ||
<script data-gdcc-inline data-gdcc-selector="gdcc-optin-googleanalytics" type="text/plain"> | ||
// Insert your code here | ||
</script> | ||
## Missing cookie permissions / i18n | ||
@@ -92,0 +98,0 @@ * When the user clicks on an optout element (e.g. a note that YouTube is currently disabled), it is possible to ask the user, if she/he wants to proceed and enable the corresponding cookie category. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29861
331
117
1