PageSourceSearch

https://statics.3cat.cat/js/libs/ccma-storage/ccma-storage.min.js?v=7.2609.5

js 3cat.cat collected 2026-09-24 09:00:43 UTC 9,533 bytes, 9 lines download raw bytes

1!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.CCMAStorage=t():e.CCMAStorage=t()}(window,function(){return o={},r.m=n=[function(o,r,i){var a,s;
2/*!
3 * JavaScript Cookie v2.2.1
4 * https://github.com/js-cookie/js-cookie
5 *
6 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
7 * Released under the MIT license
8 */!function(e){if(void 0===(s="function"==typeof(a=e)?a.call(r,i,r,o):a)||(o.exports=s),o.exports=e(),!!0){var t=window.Cookies,n=window.Cookies=e();n.noConflict=function(){return window.Cookies=t,n}}}(function(){function s(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var o in n)t[o]=n[o]}return t}function c(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function e(u){function a(){}function n(e,t,n){if("undefined"!=typeof document){"number"==typeof(n=s({path:"/"},a.defaults,n)).expires&&(n.expires=new Date(+new Date+864e5*n.expires)),n.expires=n.expires?n.expires.toUTCString():"";try{var o=JSON.stringify(t);/^[\{\[]/.test(o)&&(t=o)}catch(e){}t=u.write?u.write(t,e):encodeURIComponent(String(t)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),e=encodeURIComponent(String(e)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var r="";for(var i in n)n[i]&&(r+="; "+i,!0!==n[i]&&(r+="="+n[i].split(";")[0]));return document.cookie=e+"="+t+r}}function t(e,t){if("undefined"!=typeof document){for(var n={},o=document.cookie?document.cookie.split("; "):[],r=0;r<o.length;r++){var i=o[r].split("="),a=i.slice(1).join("=");t||'"'!==a.charAt(0)||(a=a.slice(1,-1));try{var s=c(i[0]);if(a=(u.read||u)(a,s)||c(a),t)try{a=JSON.parse(a)}catch(e){}if(n[s]=a,e===s)break}catch(e){}}return e?n[e]:n}}return a.set=n,a.get=function(e){return t(e,!1)},a.getJSON=function(e){return t(e,!0)},a.remove=function(e,t){n(e,"",s(t,{expires:-1}))},a.defaults={},a.withConverter=e,a}(function(){})})},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.r(t),n.d(t,"get",function(){return o}),n.d(t,"set",function(){return a}),n.d(t,"remove",function(){return m});var s=!1;var u=!!window.appCCMAStorage,c={},d=0,f={};function p(e){if("object"===r(e)&&null!==e&&(e=JSON.stringify(e)),u)console.log(e);else{var t=document.createElement("pre");t.innerHTML=e,document.body?document.body.appendChild(t):document.documentElement.appendChild(t)}}s&&p("DEVICE DETECTED: "+(u?"Android":"iOS"));function i(e,t,n){var o=JSON.stringify(t);if(u){var r,i=!1;switch(e){case"get":i=window.appCCMAStorage.get(o);break;case"set":i=window.appCCMAStorage.set(o);break;case"remove":i=window.appCCMAStorage.remove(o)}return i&&(r=n(l(e,i))),r}d+=1,t.requestId=d,delete c[t.requestId];var a={event:e+"AppLocalStorage",value:o=JSON.stringify(t),requestId:t.requestId};s&&(p(" > SEND TO IOS APP - METHOD: "+e+", KEY: "+t.key),p(" > MESSAGE"),p(a)),f[t.requestId]=function(e){!function(e,t,n){if(t)if(void 0!==e.data.requestId){if(s&&(p("HANDLE NATIVE IFRAME MESSAGE"),p("requestId: "+t),p("event requestId: "+e.data.requestId)),t==e.data.requestId){window.removeEventListener("message",f[t],!1);var o=l(e.data.method,e.data);s&&(p("RESULT"),p(o)),c[e.data.requestId]=o,n(o)}}else s&&(p("ev.data.requestId NOT EXIST IN HANDLE NATIVE IFRAME MESSAGE"),p("requestId: "+t))}(e,t.requestId,n)},window.addEventListener("message",f[t.requestId],!1),window.webkit.messageHandlers.iosNativeLink.postMessage(a)}function l(e,t){var n,o;if("object"!==r(t)&&(t=JSON.parse(t)),"get"==e){if(void 0!==t.value&&(n=window.atob(t.value),o=JSON.parse(n),n="object"===("undefined"==typeof playList?"undefined":r(playList))?JSON.stringify(o.data):o.data),o&&function(e){if(!e.autoRenew&&e.creationDate&&"number"==typeof e.options.expires){var t=(new Date).getTime(),n=new Date(e.creationDate);if(n.setDate(n.getDate()+e.options.expires),t-n.getTime()>24*e.options.expires*60*60*1e3)return 1}}(o))return void m(t.key)}else n=t.result;return n}function o(e){var t={key:e};return new Promise(function(e){i("get",t,e)})}function a(e,t,n){if(n)switch(n.expires){case null:n.expires=0;break;case 1/0:n.expires=365}var o={key:e,value:{data:t,options:n=n||{expires:0,path:"/",domain:".3cat.cat"},creationDate:(new Date).getTime()}};return"object"===r(o.value)&&null!==o.value&&(o.value=JSON.stringify(o.value)),o.value=window.btoa(o.value),new Promise(function(e){i("set",o,e)})}function m(e,t){var n={key:e,options:t};return new Promise(function(e){i("remove",n,e)})}},function(e,t,n){"use strict";n.r(t),n.d(t,"get",function(){return m}),n.d(t,"set",function(){return g}),n.d(t,"remove",function(){return w});var o=n(0),s=n.n(o);function r(e){var t;switch(e){case"localStorage":var n=!!window.appCCMAStorage,o=!!window.iOSNativeLocalStorage;t=n||o;break;default:t=!1}return t}function u(e){var t=new RegExp("^(http|https)(:\\/\\/)((?!-))[a-z0-9][a-z0-9-_]{0,61}[a-z0-9]{0,1}(\\.ccma\\.cat)$","gm");return!!e.match(t)||(console.log("Error: el domini no té permís per enviar postmessages"),!1)}function c(){if("undefined"!=typeof Storage)try{if(t=(new Date).getTime().toString(),window.localStorage.setItem("testWR",t),e=window.localStorage.getItem("testWR"),window.localStorage.removeItem("testWR"),e===t)return 1}catch(e){return}var e,t}function d(e){try{var t=JSON.parse(e);return void 0!==t.creationDate&&void 0!==t.data&&void 0!==t.options&&t}catch(e){return!1}}function i(e,t,i){t.options&&t.options.expires===1/0&&(t.options.expires="Infinity");var a=Date.now()+Math.floor(1e5*Math.random()),n={action:e,id:a,params:t};v[a]=function(e){var t,n,o,r;t=e,n=a,o=i,r=JSON.parse(t.data),u(t.origin)&&(n&&n===r.id||void 0===n?(window.removeEventListener("message",v[n],!1),delete v[n],r.result?o(r.result):o()):console.log("Error: Els id's dels missatges no coincideixen"))},window.addEventListener("message",v[a],!1),document.getElementById("CCMAStorageIFrame").contentWindow.postMessage(JSON.stringify(n),"https://www.3cat.cat")}function a(){return!!document.getElementById("CCMAStorageIFrame")}function f(e,t,n){var o={data:t,creationDate:(new Date).getTime()};if(n)switch(n.expires){case null:n.expires=0;break;case 1/0:n.expires=365,o.autoRenew=!0}n=n||{expires:0,path:"/",domain:".3cat.cat"},o.options=n,c()?n.expires&&0<n.expires?window.localStorage.setItem(e,JSON.stringify(o)):window.sessionStorage.setItem(e,JSON.stringify(o)):s.a.set(e,JSON.stringify(o),n)}function p(e){var t,n,o,r,i,a;if(c())if(t=window.sessionStorage.getItem(e)||window.localStorage.getItem(e),n=d(t)){if(function(e){if(e.autoRenew)return!1;
8if(e.creationDate&&"number"==typeof e.options.expires){var t=(new Date).getTime(),n=new Date(e.creationDate);if(n.setDate(n.getDate()+e.options.expires),!0===e.options.naturalDays)return t>n.getTime();if(t-n.getTime()>24*e.options.expires*60*60*1e3)return!0}return!1}(n))return w(e),o;o=n.data}else t&&(o=t);else t=s.a.get(e),(n=d(t))?(o=n.data,n.autoRenew&&(r=e,a=(i=n).options,s.a.set(r,JSON.stringify(i),a))):t&&(o=t);return o}function l(e,t){c()?(window.sessionStorage.removeItem(e),window.localStorage.removeItem(e)):(t=t||{path:"/",domain:".3cat.cat"},s.a.remove(e,t))}var m,g,w,v=[],y=r("localStorage")||!1,S=!!y&&function(e){var t;switch(e){case"localStorage":t=!!r("localStorage")&&n(1);break;default:t=!1}return t}("localStorage");window.ccmaStorageIframeMode&&window.addEventListener("message",function(e){if(u(e.origin)){var t=JSON.parse(e.data);t&&t.params&&t.params.options&&"Infinity"===t.params.options.expires&&(t.params.options.expires=1/0),function(e,t,n,o){var r;if(o)switch(e){case"_syncSet":f(n.name,n.value,n.options),r={id:t},window.parent.postMessage(JSON.stringify(r),o);break;case"_syncGet":r={id:t,result:p(n.name)},window.parent.postMessage(JSON.stringify(r),o);break;case"_syncRemove":l(n.name,n.options),r={id:t},window.parent.postMessage(JSON.stringify(r),o)}else console.log("Error: el domini no pot ser null")}(t.action,t.id,t.params,e.origin)}},!1),w=y?(m=function(e){return S.get(e)},g=function(e,t,n){return S.set(e,t,n)},function(e,t){return S.remove(e,t)}):(g=function(t,n,o){return new Promise(function(e){a()?i("_syncSet",{name:t,value:n,options:o},e):(f(t,n,o),e())})},m=function(t){return new Promise(function(e){a()?i("_syncGet",{name:t},e):e(p(t))})},function(t,n){return new Promise(function(e){a()?i("_syncRemove",{name:t,options:n},e):(l(t,n),e())})})}],r.c=o,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2);function r(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,r),t.l=!0,t.exports}var n,o});
9//# sourceMappingURL=ccma-storage.min.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.