Files

1 line
2.0 KiB
JavaScript
Raw Permalink Normal View History

2026-11-17 16:15:01 -05:00
"use strict";function cancelEvent(a){a=a||window.event;if(a){a=a.originalEvent||a;if(a.stopPropagation){a.stopPropagation()}if(a.preventDefault){a.preventDefault()}}return false}function getGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(d){var b=Math.random()*16|0,a=d=="x"?b:(b&3|8);return a.toString(16)})}(function(j){var k="";var b=false;var a={};var f=!!(j.chrome&&chrome.storage&&chrome.storage.local);var e=!f&&!!j.localStorage;function g(m){k=m}function c(){b=true}function h(){if(b){b=false;return""}return k}function l(){var t=Array.prototype.slice.call(arguments),s=t.pop(),v=[],r=t.length==1,p,u=true,n=h(),m,q;for(m=0;m<t.length;m++){q=t[m]=n+t[m];if(q.substr(0,3)!="xt_"&&a[q]!==undefined){v.push(a[q])}else{if(e){try{p=localStorage.getItem(q)}catch(o){e=false}try{p=(p===undefined||p===null)?false:JSON.parse(p)}catch(o){p=false}v.push(a[q]=p)}else{if(!f){v.push(a[q]=false)}else{u=false}}}}if(u){return s(r?v[0]:v)}chrome.storage.local.get(t,function(w){var x;v=[];for(m=0;m<t.length;m++){q=t[m];x=w[q];x=x===undefined||x===null?false:JSON.parse(x);v.push(a[q]=x)}s(r?v[0]:v)})}function i(r,s){var m={},p=h(),n,o;for(n in r){if(r.hasOwnProperty(n)){o=r[n];n=p+n;a[n]=o;o=JSON.stringify(o);if(e){try{localStorage.setItem(n,o)}catch(q){e=false}}else{m[n]=o}}}if(e||!f){if(s){s()}return}chrome.storage.local.set(m,s)}function d(){var o=Array.prototype.slice.call(arguments),p=h(),n,m,r;if(typeof o[o.length-1]==="function"){r=o.pop()}for(n=0;n<o.length;n++){m=o[n]=p+o[n];delete a[m];if(e){try{localStorage.removeItem(m)}catch(q){e=false}}}if(f){chrome.storage.local.remove(o,r)}else{if(r){r()}}}j.ConfigStorage={prefix:g,noPrefix:c,get:l,set:i,remove:d}})(this);(function(){if(typeof window.CustomEvent==="function"){return false}function a(c,d){d=d||{bubbles:false,cancelable:false,detail:undefined};var b=document.createEvent("CustomEvent");b.initCustomEvent(c,d.bubbles,d.cancelable,d.detail);return b}a.prototype=window.Event.prototype;window.CustomEvent=a})();