-
Notifications
You must be signed in to change notification settings - Fork 2
/
cookiepolicymanager.min.js
1 lines (1 loc) · 2.06 KB
/
cookiepolicymanager.min.js
1
function CookiePolicyManager(a){"use strict";function i(){var a=s(p(c)),d=b[a[0]];return{allowed:"boolean"==typeof d?d:!1,type:a[0],subType:a[1]}}function j(a){if("function"!=typeof a)throw"callback must be a function, was: "+typeof a;-1===g.indexOf(a)&&(g.push(a),n())}function k(a,d){if(a="string"==typeof a?a.trim().toLowerCase():"",d="string"==typeof d?d.trim().toLocaleLowerCase():"","boolean"!=typeof b[a])throw'type must be one of "'+Object.keys(b).join('", "')+'"';var e=i();"implicit"===a&&""!==e.type&&e.type!==a?"console"in window&&console.log('Ignored implicit agreement. Current type: "'+r(e.type,e.subType)+'"'):p(c,r(a,d)),n()}function l(){p(c,"");try{sessionStorage.removeItem(d)}catch(a){}}function m(){var a=i();return{allowed:a.allowed,because:r(a.type,a.subType)}}function n(){i().allowed&&(g.forEach(function(a){a()}),g=[])}function o(){if(q("session")&&""===i().type){var a=location.href.split("#")[0],b=(sessionStorage.getItem(d)||"").split("#")[0],c=f.ignoreUrls.map(function(a){return a.split("#")[0]});""!==b&&b!==a&&-1===c.indexOf(a)?(k("implicit","navigation"),sessionStorage.removeItem(d)):sessionStorage.setItem(d,location.href)}}function p(a,b){var c=604800,d="boolean"==typeof d?d:q("local");return""===b?void(d?localStorage.removeItem(a):document.cookie=a+"=;max-age=0"):"string"==typeof b?void(d?localStorage.setItem(a,b):document.cookie=a+"="+encodeURIComponent(b)+";max-age="+c):d?localStorage.getItem(a):decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(a).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null}function q(a){try{var b="cpm-test",c=window[a+"Storage"];return c.setItem(b,b),c.removeItem(b),!0}catch(d){return!1}}function r(a,b){return a+(b?"/"+b:"")}function s(a){var b=(a||"").split("/");return[b[0],b.length?b[1]:""]}var b={deny:!1,explicit:!0,implicit:!0},c="cpm-agree",d="cpm-prev",f=(q("local"),{navigation:!1,ignoreUrls:[]}),g=[];if("object"==typeof a)for(var h in f)f.hasOwnProperty(h)&&typeof a[h]==typeof f[h]&&(f[h]=a[h]);return f.navigation&&o(),{status:m,action:j,update:k,clear:l}}