cookie-consent-box
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -1,1 +0,1 @@ | ||
!function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=0)}([function(e,t,n){n(1),e.exports=n(4)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),a=n(2),r=(o=a)&&o.__esModule?o:{default:o},c=n(3);var u=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var t=window.CookieBoxConfig;this.box=document.createElement("div"),this.box.className="cookie-box",this.settings={color:t.color||"#007bff",language:t.language||"en",url:t.url||"#",cookieKey:"cookie-box"},this.dictionary=r.default[this.settings.language]}return i(e,[{key:"init",value:function(){var e=this;this.dictionary?(0,c.readCookie)(this.settings.cookieKey)||(this.show(),document.querySelector(".cookie-box__button.accept").addEventListener("click",function(){return e.hide()})):console.error(this.settings.language+" language is not supported")}},{key:"render",value:function(){var e=this.settings;return'\n <div>\n <p class="cookie-box__title">'+r.default[e.language].title+'</p>\n <div class="cookie-box__content">'+r.default[e.language].content+'</div>\n <div class="cookie-box__buttons">\n <button class="cookie-box__button accept" style="background-color: '+e.color+'">'+r.default[e.language].accept+'</button>\n <a href="'+e.url+'" class="cookie-box__button link" target="_blank">'+r.default[e.language].learnMore+"</a>\n </div>\n </div>\n "}},{key:"show",value:function(){this.box.innerHTML=this.render(),document.body.appendChild(this.box)}},{key:"hide",value:function(){this.box.classList.add("hidden"),(0,c.createCookie)(this.settings.cookieKey,!0,365)}}]),e}();t.default=u;var s=setInterval(function(){"complete"===document.readyState&&(clearInterval(s),(new u).init())},50)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={en:{title:"Have a cookie",content:"Our website uses cookies to analyse how the site is used and to ensure your experience is consistent between visits.",accept:"Accept",learnMore:"Learn More"},pl:{title:"Ciastko?",content:"Nasza strona używa ciasteczek do analizy statystyk i zapewnienia takiego samego działania pomiędzi wizytami.",accept:"Akceptuję",learnMore:"Czytaj więcej"}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.createCookie=function(e,t,n){var o=void 0;if(n){var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3),o="; expires="+i.toGMTString()}else o="";document.cookie=e+"="+t+o+"; path=/"},t.readCookie=function(e){for(var t=e+"=",n=document.cookie.split(";"),o=0;o<n.length;o+=1){for(var i=n[o];" "===i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t))return i.substring(t.length,i.length)}return null}},function(e,t){}]); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cookie-consent-box",[],t):"object"==typeof exports?exports["cookie-consent-box"]=t():e["cookie-consent-box"]=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=0)}([function(e,t,n){n(1),e.exports=n(4)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(2),a=(o=r)&&o.__esModule?o:{default:o},c=n(3);var s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var t=window.CookieBoxConfig||{};this.box=document.createElement("div"),this.box.className="cookie-box",this.settings={color:t.color||"#007bff",language:t.language||"en",url:t.url||"#",cookieKey:"cookie-box"},this.dictionary=a.default[this.settings.language]}return i(e,[{key:"init",value:function(){var e=this;this.dictionary?(0,c.readCookie)(this.settings.cookieKey)||(this.show(),document.querySelector(".cookie-box__button.accept").addEventListener("click",function(){return e.hide()})):console.error(this.settings.language+" language is not supported")}},{key:"render",value:function(){var e=this.settings;return'\n <div>\n <p class="cookie-box__title">'+a.default[e.language].title+'</p>\n <div class="cookie-box__content">'+a.default[e.language].content+'</div>\n <div class="cookie-box__buttons">\n <button class="cookie-box__button accept" style="background-color: '+e.color+'">'+a.default[e.language].accept+'</button>\n <a href="'+e.url+'" class="cookie-box__button link" target="_blank">'+a.default[e.language].learnMore+"</a>\n </div>\n </div>\n "}},{key:"show",value:function(){this.box.innerHTML=this.render(),document.body.appendChild(this.box)}},{key:"hide",value:function(){this.box.classList.add("hidden"),(0,c.createCookie)(this.settings.cookieKey,!0,365)}}]),e}();t.default=s;var u=setInterval(function(){"complete"===document.readyState&&(clearInterval(u),(new s).init())},50)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={en:{title:"Have a cookie",content:"Our website uses cookies to analyse how the site is used and to ensure your experience is consistent between visits.",accept:"Accept",learnMore:"Learn More"},pl:{title:"Ciastko?",content:"Nasza strona używa ciasteczek do analizy statystyk i zapewnienia takiego samego działania pomiędzi wizytami.",accept:"Akceptuję",learnMore:"Czytaj więcej"}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.createCookie=function(e,t,n){var o=void 0;if(n){var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3),o="; expires="+i.toGMTString()}else o="";document.cookie=e+"="+t+o+"; path=/"},t.readCookie=function(e){for(var t=e+"=",n=document.cookie.split(";"),o=0;o<n.length;o+=1){for(var i=n[o];" "===i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t))return i.substring(t.length,i.length)}return null}},function(e,t){}])}); |
{ | ||
"name": "cookie-consent-box", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Yet another simple reusable cookie box widget without any dependencies.", | ||
"main": "dist/cookie-constent-box.js", | ||
"jsnext:main": "src/index.js", | ||
"main": "dist/cookie-consent-box.js", | ||
"jsnext:main": "dist/cookie-consent-box.js", | ||
"scripts": { | ||
@@ -8,0 +8,0 @@ "dev": "NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", |
@@ -8,3 +8,3 @@ /* eslint no-console: ["error", { allow: ["warn", "error"] }] */ | ||
constructor() { | ||
const userSettings = window.CookieBoxConfig; | ||
const userSettings = window.CookieBoxConfig || {}; | ||
@@ -11,0 +11,0 @@ this.box = document.createElement('div'); |
@@ -8,19 +8,24 @@ let mix = require('laravel-mix'); | ||
.webpackConfig({ | ||
module: { | ||
rules: [ | ||
{ | ||
test: /.(vue|jsx|js)$/, | ||
loader: 'eslint-loader', | ||
enforce: 'pre', | ||
exclude: /node_modules/, | ||
options: { | ||
cache: true, | ||
configFile: '.eslintrc', | ||
output: { | ||
library: 'cookie-consent-box', | ||
libraryTarget: 'umd', | ||
umdNamedDefine: true | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /.(vue|jsx|js)$/, | ||
loader: 'eslint-loader', | ||
enforce: 'pre', | ||
exclude: /node_modules/, | ||
options: { | ||
cache: true, | ||
configFile: '.eslintrc', | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new StyleLintPlugin({ lintDirtyModulesOnly: !mix.inProduction() }), | ||
], | ||
}, | ||
plugins: [ | ||
new StyleLintPlugin({ lintDirtyModulesOnly: !mix.inProduction() }), | ||
], | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
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
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
649092
127