var supernova=[];

var myFavoriteSite=[];

var nomas=[];

var attentionDomain=[];


function onExtensionClick() {

//for the further development of your favorite sites


}

chrome.browserAction.onClicked.addListener(onExtensionClick);{

//for the further development of your favorite sites

}


function WheelAgainstTheTerminator(min,max){

return Math.floor(Math.random() * (max - min + 1)) + min;

}


chrome.runtime.onStartup.addListener(function() {

for(let i=0; i<localStorage.length; i++) {

let key = localStorage.key(i);

if(key=="attentiondomin"){

let mesAttentionDomain = localStorage.getItem("attentiondomin");

let a = JSON.parse(mesAttentionDomain);

for(let i=0; i<a.length; i++) {

if(a[i].count>3){

supernova.push(a[i].domain);

attentionDomain[i]={

domain:a[i].domain,

count:a[i].count,

magic:0

};

}

else{

attentionDomain[i]={

domain:a[i].domain,

count:a[i].count,

magic:1

};

}

}

}

if(key="myFavoriteSite"){


}

}

});


function IinventedTheWheel(cookie){

let ttt=cookie;

var itmycookie=true;

if(nomas.length>0)

{

for(var i=0;i<nomas.length;i++){

var name=nomas[i].name;

if((ttt.name==name)&&(ttt.value==nomas[i].value)){

nomas.splice(i, 1);

itmycookie=false;

break;

}

}

}

if(!supernova.includes(cookie.domain)){

let ifind=true;

for(let g=0;g<attentionDomain.length;g++){

if(cookie.domain==attentionDomain[g].domain){

ifind=false;

if(attentionDomain[g].magic==1){

attentionDomain[g].count=attentionDomain[g].count+1;

attentionDomain[g].magic=0;

if(attentionDomain[g].count>3){

supernova.push(attentionDomain[g].domain);

}

}

itmycookie=false;

break;

}

}

if(ifind){

attentionDomain.push({domain:cookie.domain,count:1,magic:0});

}

let sss=JSON.stringify(attentionDomain);

localStorage.setItem("attentiondomin",sss);

}

if(itmycookie)

WowHowiLikeToParse(ttt);

}


function WowHowiLikeToParse(cookie){

let ttt=cookie;

var newCookie = {};

newCookie.name = ttt.name;

let value=ttt.value;

var uurl;

let http="http";

http=http+((cookie.secure) ? "s" : "") + "://" ;

if(ttt.domain.startsWith('.')){

uurl =ttt.domain.slice(1,ttt.domain.length);

uurl=http+uurl;

}else{

uurl=http+ttt.domain;

}

if(!ttt.session){

newCookie.expirationDate=ttt.expirationDate;

}

if(value.length==1){

if(value=="0"||value=="1"){

if(Math.random()>.5){

newCookie.value="1";

}else{

newCookie.value="0";}

}else{

var charcodeb=value.charCodeAt(0);

if(charcodeb>47 && charcodeb<58){

newCookie.value=String.fromCharCode(WheelAgainstTheTerminator(49,57));

}

else{

newCookie.value=String.fromCharCode(WheelAgainstTheTerminator(65,90));

}

}

}

else{

var vvv=ttt.value.split("");

for (var i=0;i<vvv.length;i++){

var ccc=String(vvv[i]);

var charcode=ccc.charCodeAt(0);

if(charcode==37){

var therd=String(vvv[i+3]);

if(therd.charCodeAt(0)==37){

var lovejs=String(vvv[i+1]);

var biglovejs=String(vvv[i+2]);

var togehtr=lovejs+biglovejs;

var first=lovejs.charCodeAt(0);

var second=biglovejs.charCodeAt(0);

var forhumen=parseInt(togehtr,16);

if(forhumen>47&&forhumen<58)

{

var lL=String.fromCharCode(WheelAgainstTheTerminator(49,57));

var kK=lL.toString(16);

}

i=i+2;

}

}

else if(charcode>47 && charcode<58){

var done=false;

if(i>0){

var stillLovejs=String(vvv[i-1]);

var anotherSecond=stillLovejs.charCodeAt(0);

if((i<ttt.value.length)){

var buyaTram=String(vvv[i+1]);

var anotherThird=buyaTram.charCodeAt(0);

if((anotherThird>47&&anotherThird<58)&&(anotherSecond<48||anotherSecond>57)){

vvv[i]=String.fromCharCode(WheelAgainstTheTerminator(49,57));

done=true;

}

if(!done){

if(anotherThird>47&&anotherThird<58){

var Valenzetti=Math.random();

if(Valenzetti>0.01&&Valenzetti<0.02){

vvv[i]="4";done=true;

}

else if(Valenzetti>0.02&&Valenzetti<0.03){

vvv[i]="8";done=true;

}

else if(Valenzetti>0.03&&Valenzetti<0.04){

vvv[i]="1";vvv[i+1]="5";i=i+1;done=true;

}

else if(Valenzetti>0.04&&Valenzetti<0.05){

vvv[i]="1";vvv[i+1]="6";i=i+1;done=true;

}

else if(Valenzetti>0.05&&Valenzetti<0.06){

vvv[i]="2";vvv[i+1]="3";i=i+1;done=true;

}

else if(Valenzetti>0.06&&Valenzetti<0.07){

vvv[i]="4";vvv[i+1]="2";i=i+1;done=true;

}

}

}

}

}else{

vvv[i]=String.fromCharCode(WheelAgainstTheTerminator(49,57));

done=true;

}

if(!done)

vvv[i]=String.fromCharCode(WheelAgainstTheTerminator(48,57));

}

else if((charcode>64&&charcode<91)||(charcode>96&&charcode<123)){

if(Math.random()>0.5){

vvv[i]=String.fromCharCode(WheelAgainstTheTerminator(65,90));

}else{

vvv[i]=String.fromCharCode(WheelAgainstTheTerminator(97,122));

}

}

else if(charcode>191){

vvv[i]=String.fromCharCode(WheelAgainstTheTerminator(192,255));

}

else{

}

}

newCookie.value=vvv.join("");

}

newCookie.url = uurl;

newCookie.domain = ttt.domain;

nomas.push(newCookie);

chrome.cookies.set(newCookie);

}



chrome.cookies.onChanged.addListener(function (changeInfo) {

var removed = changeInfo.removed;

var wheel = changeInfo.cookie;

var cause = changeInfo.cause;


if(!removed){

if(!wheel.httpOnly){

if(cause!="overwrite"){

if(wheel.domain!=".google.com"){

IinventedTheWheel(wheel);

}

}

}

}

});