Send multiple requests separate instead of array in Javascript - javascript

This is part of code (code not mine, I can't understand how it's working, maybe it's called Promise, but I'm not sure).
m = {
mounted: function() {
var e = this;
this.$bus.on("buff-event", (function(t) {
e.buff(t)
}))
},
methods: {
buff: function(e) {
var t = this;
this.$bus.emit("bfceebecbb-change", "Motivating...");
var n = '[{"__class__":"ServerRequest","requestData":[],"requestClass":"OtherPlayerService","requestMethod":"' + e + '","requestId":%%requestId%%}]';
this.requestFaker.fetch(n).then((function(i) {
i = (i = i.filter((function(t) {
return t.requestMethod == e
}))[0]).responseData.filter((function(e) {
return void 0 === e.next_interaction_in && !e.is_self && (void 0 === e.accepted || 1 == e.accepted)
})), n = [], _.forEach(i, (function(e) {
n.push('{"__class__":"ServerRequest","requestData":[' + e.player_id + '],"requestClass":"OtherPlayerService","requestMethod":"polivateRandomBuilding","requestId":%%requestId%%}')
})), n.length ? (n = "[" + n.join(",") + "]", t.requestFaker.fetch(n).then((function() {
t.$bus.emit("bfceebecbb-change", "Motivation success")
}))) : t.$bus.emit("bfceebecbb-change", "Nobody to motivate")
}))
}
}
},
This code collecting data of users, store in to array and then pass it to the server. So it sending big array of all users in one request (it pushing all entries to array in this part n.push('{"__class__":"ServerRequest"...).
What I want to achieve is to send requests for each user one by one with some delays (for example 1 second delay between requests).
I've tried many ways to achieve it, but all unsuccessfully, I'm lack of knowledge about this programming language.
I've tried to use setTimeout functions in different ways, but all the time unsuccessfully:
methods: {
buff: function(e) {
var t = this;
this.$bus.emit("bfceebecbb-change", "Motivating...");
var n = '[{"__class__":"ServerRequest","requestData":[],"requestClass":"OtherPlayerService","requestMethod":"' + e + '","requestId":%%requestId%%}]';
this.requestFaker.fetch(n).then((function(i) {
i = (i = i.filter((function(t) {
return t.requestMethod == e
}))[0]).responseData.filter((function(e) {
return void 0 === e.next_interaction_in && !e.is_self && (void 0 === e.accepted || 1 == e.accepted)
})), n = [], _.forEach(i, (function(e) {
n.push('{"__class__":"ServerRequest","requestData":[' + e.player_id + '],"requestClass":"OtherPlayerService","requestMethod":"polivateRandomBuilding","requestId":%%requestId%%}')
})), n.length ?
setTimeout((function() {
(setTimeout((function() {n = "[" + n.join(",") + "]"}), 1000) , t.requestFaker.fetch(n).then((function() {
t.$bus.emit("bfceebecbb-change", "Motivation success")
})))}), 1000) : t.$bus.emit("bfceebecbb-change", "Nobody to motivate")
}))
}
}
Also tried like this:
methods: {
buff: function(e) {
var t = this;
this.$bus.emit("bfceebecbb-change", "Motivating...");
var n = '[{"__class__":"ServerRequest","requestData":[],"requestClass":"OtherPlayerService","requestMethod":"' + e + '","requestId":%%requestId%%}]';
this.requestFaker.fetch(n).then((function(i) {
i = (i = i.filter((function(t) {
return t.requestMethod == e
}))[0]).responseData.filter((function(e) {
return void 0 === e.next_interaction_in && !e.is_self && (void 0 === e.accepted || 1 == e.accepted)
})), n = [], _.forEach(i, (function(e) {
n.push('{"__class__":"ServerRequest","requestData":[' + e.player_id + '],"requestClass":"OtherPlayerService","requestMethod":"polivateRandomBuilding","requestId":%%requestId%%}')
})), n.length ?
setTimeout((function() {
(n = "[" + n.join(",") + "]", t.requestFaker.fetch(n).then((function() {
t.$bus.emit("bfceebecbb-change", "Motivation success")
})))}), 1000) : t.$bus.emit("bfceebecbb-change", "Nobody to motivate")
}))
}
}
UPDATED
As per comment asked what is %%requestId%% - I found this part:
{
key: "fetch",
value: function(e) {
function t(t) {
return e.apply(this, arguments)
}
return t.toString = function() {
return e.toString()
}, t
}((function(e) {
for (var t = e;
(t = e.replace("%%requestId%%", this.requestId)) !== e;) e = t, this.incRequestId();
return fetch(gameVars.gatewayUrl, this.getHeadForFetchQuery(e)).then((function(e) {
return e.json()
}))
}))
}

try this
in general, forEach should be replaced with for..of loop with using async/await helper function which will delay the request (in await delaySome(1000); part)
it should send data in the same format, and if it fails at the server, that's probably where it needs tweaking.. or everywhere else..
m = {
mounted: function() {
var e = this;
this.$bus.on("buff-event", function(t) {
e.buff(t);
});
},
methods: {
buff: function(e) {
var t = this;
function delaySome(delay) {
return new Promise((resolve) => {
setTimeout(() => {
resolve();
}, delay);
});
}
this.$bus.emit("bfceebecbb-change", "Motivating...");
var n = '[{"__class__":"ServerRequest","requestData":[],"requestClass":"OtherPlayerService","requestMethod":"' + e + '","requestId":%%requestId%%}]';
this.requestFaker.fetch(n).then(async function(i) {
(i = (i = i.filter(function(t) {
return t.requestMethod == e;
})[0]).responseData.filter(function(e) {
return void 0 === e.next_interaction_in && !e.is_self && (void 0 === e.accepted || 1 == e.accepted);
})),
(n = []);
if (i.length) {
for (const e of i) {
await delaySome(1000);
t.requestFaker.fetch('[{"__class__":"ServerRequest","requestData":[' + e.player_id + '],"requestClass":"OtherPlayerService","requestMethod":"polivateRandomBuilding","requestId":%%requestId%%}]').then(function() {
t.$bus.emit("bfceebecbb-change", "Motivation success");
})
}
} else {
t.$bus.emit("bfceebecbb-change", "Nobody to motivate")
}
});
},
},
};

Related

What type of JavaScript obfuscation is this and how can I properly deobfuscte it? (online deobfuscators don't work)

I'm trying to study this code but I can't read it. (code below) I tried deobfuscating it but it's just as hard to read as it was before. What type of obfuscation is this and what website, application, or process can I use to make it easy to read?
eval(function(p,a,c,k,e,d){while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+c+'\\b','g'),k[c])}}return p}('43 131=[\'\\73\\26\\11\\24\\7\\15\\10\\0\\3\\13\\8\\5\',\'\\55\\26\\11\\13\\80\\26\\10\\46\\3\\23\\9\\5\',\'\\3\\23\\33\\6\\3\\23\\7\\7\\25\\31\\56\\5\',\'\\3\\20\\48\\6\\25\\58\\14\\6\\37\\15\\10\\92\',\'\\55\\16\\10\\11\\3\\23\\3\\10\\85\\3\\5\\5\',\'\\85\\18\\10\\40\\78\\26\\11\\68\\32\\31\\5\\5\',\'\\50\\2\\14\\6\\40\\49\\67\\0\',\'\\3\\20\\18\\36\\3\\23\\0\\8\\55\\8\\5\\5\',\'\\3\\13\\62\\6\\25\\51\\69\\20\\3\\13\\20\\5\',\'\\78\\14\\49\\50\\49\\22\\31\\5\',\'\\30\\63\\41\\36\\68\\2\\20\\5\',\'\\3\\19\\8\\85\\3\\12\\9\\73\\79\\3\\5\\5\',\'\\22\\7\\26\\75\\3\\20\\12\\63\',\'\\54\\18\\10\\46\\3\\12\\49\\25\\16\\8\\5\\5\',\'\\3\\9\\69\\67\\16\\48\\19\\7\\33\\3\\5\\5\',\'\\3\\23\\32\\6\\52\\6\\50\\6\\52\\24\\9\\5\',\'\\31\\16\\10\\38\\3\\13\\37\\79\\73\\3\\5\\5\',\'\\3\\47\\46\\6\\77\\2\\26\\16\\50\\31\\5\\5\',\'\\80\\16\\10\\67\\79\\15\\11\\77\\17\\3\\5\\5\',\'\\6\\41\\33\\9\\2\\63\\49\\5\',\'\\55\\15\\10\\45\\45\\18\\11\\11\\17\\33\\5\\5\',\'\\63\\26\\10\\58\\3\\47\\2\\6\\77\\15\\11\\7\',\'\\56\\18\\11\\14\\70\\15\\10\\77\\3\\12\\56\\5\',\'\\3\\13\\37\\56\\3\\9\\62\\7\\25\\39\\49\\5\',\'\\3\\9\\25\\40\\85\\38\\78\\39\',\'\\3\\19\\32\\6\\39\\6\\33\\25\\68\\31\\5\\5\',\'\\3\\23\\40\\7\\52\\36\\37\\16\\3\\19\\0\\5\',\'\\3\\9\\33\\77\\30\\36\\33\\25\',\'\\3\\20\\78\\105\\3\\20\\67\\8\\68\\33\\5\\5\',\'\\3\\13\\78\\75\\54\\18\\11\\40\\68\\33\\5\\5\',\'\\50\\80\\15\\75\\31\\14\\49\\5\',\'\\3\\12\\75\\37\\73\\15\\10\\8\\54\\33\\5\\5\',\'\\3\\20\\36\\92\\45\\37\\55\\6\\19\\33\\5\\5\',\'\\2\\15\\11\\17\\7\\80\\16\\29\',\'\\30\\24\\13\\6\\25\\48\\22\\33\',\'\\3\\13\\92\\7\\75\\2\\55\\7\\77\\18\\11\\73\',\'\\56\\14\\48\\6\\20\\16\\11\\52\\3\\20\\8\\5\',\'\\3\\25\\39\\6\\39\\49\\19\\6\\39\\16\\11\\24\',\'\\45\\48\\31\\9\\2\\62\\37\\5\',\'\\3\\19\\32\\6\\33\\24\\19\\6\\58\\18\\11\\22\',\'\\3\\47\\62\\6\\62\\29\\8\\6\\3\\9\\16\\5\',\'\\3\\19\\7\\6\\62\\41\\46\\7\\47\\18\\10\\29\',\'\\3\\9\\20\\58\\6\\3\\31\\20\',\'\\3\\19\\14\\7\\33\\8\\22\\45\\10\\8\\5\\5\',\'\\3\\19\\2\\6\\58\\67\\32\\6\\75\\16\\10\\48\',\'\\3\\47\\9\\39\\3\\19\\41\\47\\17\\31\\5\\5\',\'\\54\\26\\11\\62\\3\\13\\13\\7\\19\\16\\10\\41\',\'\\3\\23\\49\\15\\22\\16\\11\\32\\51\\8\\5\\5\',\'\\3\\47\\40\\6\\39\\58\\2\\6\\33\\18\\10\\69\',\'\\3\\19\\32\\7\\52\\37\\81\\49\\3\\13\\56\\5\',\'\\3\\20\\14\\7\\44\\16\\11\\11\\3\\9\\31\\5\',\'\\3\\12\\9\\78\\26\\58\\16\\47\',\'\\3\\12\\22\\92\\51\\16\\11\\54\\8\\8\\5\\5\',\'\\3\\19\\48\\6\\52\\44\\18\\69\\3\\13\\18\\5\',\'\\3\\19\\14\\6\\15\\31\\62\\7\\19\\26\\10\\2\',\'\\73\\18\\10\\6\\3\\13\\70\\10\\81\\31\\5\\5\',\'\\3\\25\\48\\6\\75\\75\\24\\6\\36\\18\\11\\3\',\'\\3\\20\\18\\67\\3\\13\\20\\30\\56\\31\\5\\5\',\'\\3\\20\\30\\18\\10\\29\\40\\6\\15\\8\\5\\5\',\'\\3\\25\\7\\7\\39\\63\\45\\7\\40\\29\\49\\5\',\'\\3\\19\\19\\6\\19\\2\\31\\52\\3\\23\\26\\5\',\'\\3\\19\\45\\6\\20\\80\\26\\16\\10\\3\\5\\5\',\'\\3\\23\\39\\6\\52\\58\\0\\7\\3\\9\\0\\5\',\'\\3\\12\\48\\6\\36\\37\\17\\24\\3\\12\\0\\5\',\'\\3\\19\\55\\6\\52\\24\\37\\11\\32\\31\\5\\5\',\'\\26\\22\\37\\80\\63\\30\\31\\5\',\'\\3\\9\\7\\6\\15\\48\\9\\7\\3\\12\\0\\5\',\'\\7\\26\\11\\76\\3\\20\\24\\7\\36\\51\\26\\5\',\'\\3\\9\\45\\6\\20\\26\\11\\3\\16\\33\\16\\5\',\'\\3\\13\\19\\6\\20\\6\\92\\6\\52\\73\\3\\5\',\'\\17\\76\\70\\44\\3\\25\\75\\31\',\'\\3\\23\\33\\47\\45\\15\\11\\31\\8\\8\\5\\5\',\'\\68\\36\\48\\6\\58\\15\\10\\16\\3\\23\\31\\5\',\'\\3\\23\\24\\6\\37\\16\\11\\22\\79\\41\\31\\5\',\'\\16\\18\\11\\15\\7\\15\\10\\52\\3\\12\\20\\5\',\'\\3\\9\\52\\10\\55\\18\\11\\76\',\'\\81\\76\\24\\6\\77\\15\\10\\25\\3\\23\\16\\5\',\'\\16\\24\\92\\7\\15\\26\\11\\52\\3\\47\\8\\5\',\'\\8\\18\\10\\58\\3\\12\\50\\6\\58\\33\\20\\5\',\'\\3\\12\\3\\37\\46\\26\\10\\44\\3\\25\\49\\5\',\'\\3\\13\\14\\6\\19\\39\\14\\6\\40\\63\\18\\5\',\'\\3\\19\\13\\6\\40\\45\\20\\18\\3\\23\\33\\5\',\'\\3\\9\\45\\7\\58\\6\\9\\67\\16\\31\\5\\5\',\'\\3\\9\\7\\7\\58\\44\\92\\7\\75\\26\\11\\25\',\'\\54\\26\\11\\11\\50\\8\\22\\9\',\'\\32\\38\\37\\58\\54\\76\\31\\5\',\'\\79\\7\\49\\0\\26\\15\\11\\14\',\'\\10\\22\\40\\6\\52\\36\\0\\105\',\'\\3\\19\\29\\79\\3\\19\\52\\37\\41\\3\\5\\5\',\'\\56\\26\\10\\22\\3\\23\\51\\15\',\'\\2\\16\\10\\14\\78\\29\\13\\7\\37\\33\\5\\5\',\'\\54\\16\\11\\2\\32\\22\\31\\50\',\'\\14\\16\\11\\55\\10\\22\\0\\8\',\'\\31\\16\\11\\78\\3\\19\\46\\7\\39\\26\\11\\40\',\'\\3\\25\\56\\15\\3\\12\\51\\22\\30\\33\\5\\5\',\'\\17\\62\\49\\41\\49\\6\\9\\5\',\'\\7\\31\\26\\40\\63\\29\\70\\5\',\'\\46\\16\\10\\9\\32\\15\\11\\70\\10\\3\\5\\5\',\'\\30\\26\\11\\67\\3\\47\\39\\7\\44\\22\\0\\5\',\'\\55\\15\\10\\23\\78\\44\\92\\7\\20\\33\\5\\5\',\'\\3\\25\\37\\67\\3\\23\\25\\49\\49\\33\\5\\5\',\'\\3\\19\\40\\6\\20\\2\\17\\73\\17\\31\\5\\5\',\'\\85\\15\\11\\3\\3\\23\\14\\7\\19\\26\\10\\54\',\'\\3\\19\\2\\6\\77\\24\\31\\73\\32\\8\\5\\5\',\'\\3\\9\\14\\6\\37\\67\\14\\6\\39\\49\\22\\5\',\'\\3\\13\\39\\7\\25\\63\\39\\7\\20\\16\\11\\41\',\'\\3\\9\\46\\7\\19\\44\\50\\7\\39\\26\\10\\11\',\'\\3\\13\\30\\70\\3\\13\\50\\7\\52\\31\\5\\5\',\'\\22\\51\\24\\6\\44\\76\\8\\70\',\'\\7\\36\\13\\6\\33\\15\\11\\20\\3\\47\\15\\5\',\'\\68\\8\\49\\105\\22\\15\\11\\62\',\'\\3\\9\\12\\10\\85\\16\\11\\12\\16\\8\\5\\5\',\'\\3\\13\\7\\6\\25\\39\\7\\6\\52\\51\\31\\5\',\'\\3\\20\\7\\7\\62\\37\\50\\7\\52\\31\\5\\5\',\'\\3\\25\\48\\7\\25\\15\\11\\24\\3\\23\\25\\20\',\'\\8\\41\\0\\18\\63\\0\\20\\5\',\'\\3\\20\\29\\47\\6\\33\\40\\6\\75\\33\\5\\5\',\'\\3\\9\\12\\29\\56\\3\\19\\7\\75\\3\\5\\5\',\'\\3\\19\\24\\6\\47\\24\\69\\9\\3\\9\\3\\5\',\'\\68\\15\\10\\31\\3\\12\\12\\54\\6\\8\\5\\5\',\'\\3\\12\\31\\20\\41\\16\\10\\3\\3\\25\\16\\5\',\'\\3\\9\\39\\6\\20\\3\\33\\16\\3\\9\\18\\5\',\'\\2\\18\\11\\51\\31\\80\\50\\6\\40\\8\\5\\5\',\'\\3\\12\\2\\6\\52\\54\\9\\56\',\'\\11\\62\\45\\7\\25\\18\\10\\45\\3\\25\\18\\5\',\'\\2\\16\\10\\62\\3\\20\\20\\41\',\'\\2\\16\\11\\3\\3\\23\\40\\7\\40\\26\\10\\80\',\'\\3\\12\\39\\6\\77\\15\\11\\47\\2\\6\\3\\5\',\'\\3\\20\\45\\6\\47\\45\\8\\50\\11\\8\\5\\5\',\'\\73\\14\\40\\6\\47\\16\\10\\69\\3\\23\\26\\5\',\'\\68\\15\\11\\33\\8\\18\\10\\50\\3\\13\\70\\5\',\'\\3\\9\\49\\6\\50\\67\\15\\56\'];(21(28,72){43 35=21(34){163(--34){28[\'123\'](28[\'164\']())}},42=21(){43 34={\'165\':{\'166\':\'144\',\'167\':\'168\'},\'142\':21(65,57,60,84){84=84||{};83 89=57+\'=\'+60,104=66;99(83 53=66,98=65[\'96\'];53<98;53++){43 125=65[53];89+=\';\\86\'+125;43 103=65[125];65[\'123\'](103),98=65[\'96\'],103!==!![]&&(89+=\'=\'+103)}84[\'144\']=89},\'130\':21(){27\'171\'},\'141\':21(65,57){65=65||21(89){27 89};43 60=65(120 132(\'(?:^|;\\86)\'+57[\'136\'](/([.$?*|{}()[]\\/+^])/34,\'$1\')+\'=([^;]*)\')),84=21(89,104){89(++104)};27 84(35,72),60?135(60[111]):114}},64=21(){43 65=120 132(\'\\116+\\86*\\115(\\115)\\86*{\\116+\\86*[\\117|\\118].+[\\117|\\118];?\\86*}\');27 65[\'152\'](34[\'130\'][\'128\']())};34[\'143\']=64;83 90=\'\';43 91=34[\'143\']();74(!91)34[\'142\']([\'*\'],\'140\',111);95 91?90=34[\'141\'](106,\'140\'):34[\'130\']()};42()}(131,177));43 4=21(28,72){28=28-66;83 35=131[28];74(4[\'156\']===114){183 42=21(34){43 64=\'180+/=\',90=127(34)[\'136\'](/=+$/,\'\');83 91=\'\';99(83 65=66,57,60,84=66;60=90[\'182\'](84++);~60&&(57=65%139?57*162+60:60,65++%139)?91+=127[\'145\'](172&57>>(-146*65&169)):66){60=64[\'174\'](60)}27 91};43 88=21(34,64){83 57=[],60=66,84,89=\'\',104=\'\';34=42(34);99(83 98=66,103=34[\'96\'];98<103;98++){104+=\'%\'+(\'181\'+34[\'133\'](98)[\'128\'](178))[\'176\'](-146)}34=135(104);83 53;99(53=66;53<100;53++){57[53]=53}99(53=66;53<100;53++){60=(60+57[53]+64[\'133\'](53%64[\'96\']))%100,84=57[53],57[53]=57[60],57[60]=84}53=66,60=66;99(83 112=66;112<34[\'96\'];112++){53=(53+111)%100,60=(60+57[53])%100,84=57[53],57[53]=57[60],57[60]=84,89+=127[\'145\'](34[\'133\'](112)^57[(57[53]+57[60])%100])}27 89};4[\'155\']=88,4[\'126\']={},4[\'156\']=!![]}43 61=4[\'126\'][28];74(61===114){74(4[\'159\']===114){43 34=21(64){71[\'149\']=64,71[\'97\']=[111,66,66],71[\'151\']=21(){27\'175\'},71[\'154\']=\'\\116+\\86*\\115(\\115)\\86*{\\116+\\86*\',71[\'153\']=\'[\\117|\\118].+[\\117|\\118];?\\86*}\'};34[\'124\'][\'160\']=21(){43 64=120 132(71[\'154\']+71[\'153\']),90=64[\'152\'](71[\'151\'][\'128\']())?--71[\'97\'][111]:--71[\'97\'][66];27 71[\'150\'](90)},34[\'124\'][\'150\']=21(64){74(!170(~64))27 64;27 71[\'137\'](71[\'149\'])},34[\'124\'][\'137\']=21(64){99(83 91=66,65=71[\'97\'][\'96\'];91<65;91++){71[\'97\'][\'123\'](148[\'173\'](148[\'161\']())),65=71[\'97\'][\'96\']}27 64(71[\'97\'][66])},120 34(4)[\'160\'](),4[\'159\']=!![]}35=4[\'155\'](35,72),4[\'126\'][28]=35}95 35=61;27 35};43 147=21(){43 28={\'\\49\\36\\48\\75\\73\':4(\'\\0\\2\\38\\24\',\'\\15\\16\\54\\19\')+4(\'\\0\\2\\9\\24\',\'\\68\\25\\39\\22\')+4(\'\\0\\2\\38\\23\',\'\\6\\63\\37\\38\')+4(\'\\0\\2\\9\\38\',\'\\94\\19\\30\\94\')+\'\\92\',\'\\11\\10\\55\\6\\50\':4(\'\\0\\2\\38\\0\',\'\\30\\16\\46\\10\')+\'\\138\\105\\129\\86\\105\'+4(\'\\0\\2\\18\\24\',\'\\18\\6\\22\\40\')+4(\'\\0\\2\\29\\69\',\'\\67\\39\\73\\49\')+4(\'\\0\\2\\13\\38\',\'\\54\\101\\80\\17\'),\'\\55\\47\\63\\54\\11\':21(35){27 35()},\'\\85\\14\\30\\39\\50\':21(35,42){27 35(42)},\'\\48\\44\\22\\58\\50\':4(\'\\0\\2\\13\\12\',\'\\6\\14\\59\\36\')+4(\'\\0\\2\\12\\69\',\'\\15\\30\\25\\87\')+4(\'\\0\\2\\13\\6\',\'\\46\\17\\15\\6\')+\'\\14\\59\',\'\\44\\62\\25\\30\\7\':21(35,42){27 35===42},\'\\62\\63\\79\\6\\85\':4(\'\\0\\2\\24\\69\',\'\\32\\3\\30\\36\'),\'\\55\\78\\20\\26\\48\':21(35,42){27 35!==42},\'\\30\\51\\10\\85\\79\':4(\'\\0\\2\\24\\24\',\'\\10\\12\\59\\18\'),\'\\44\\40\\52\\25\\19\':4(\'\\0\\2\\9\',\'\\55\\76\\20\\81\'),\'\\73\\20\\6\\50\\76\':4(\'\\0\\2\\38\\6\',\'\\7\\37\\101\\44\')};83 72=!![];27 21(35,42){43 61={\'\\44\\17\\76\\67\\79\':28[4(\'\\0\\2\\38\\18\',\'\\13\\37\\59\\6\')],\'\\48\\62\\67\\41\\30\':28[4(\'\\0\\2\\9\\9\',\'\\40\\54\\19\\14\')],\'\\50\\22\\50\\32\\8\':21(88){27 28[\'\\55\\47\\63\\54\\11\'](88)},\'\\15\\70\\44\\46\\70\':21(88,34){27 28[4(\'\\0\\2\\13\\69\',\'\\56\\36\\45\\0\')](88,34)},\'\\31\\22\\44\\73\\50\':28[4(\'\\0\\2\\29\\13\',\'\\45\\26\\33\\8\')],\'\\32\\25\\20\\31\\56\':21(88,34){27 28[4(\'\\0\\2\\18\\38\',\'\\8\\32\\8\\32\')](88,34)},\'\\17\\16\\33\\32\\68\':28[4(\'\\0\\2\\29\\6\',\'\\67\\14\\2\\80\')],\'\\26\\49\\44\\25\\36\':21(88,34){27 28[4(\'\\0\\2\\13\\30\',\'\\19\\48\\56\\110\')](88,34)},\'\\8\\41\\26\\52\\22\':28[4(\'\\0\\2\\13\\29\',\'\\67\\39\\73\\49\')]};74(28[4(\'\\0\\2\\0\',\'\\15\\30\\25\\87\')](28[4(\'\\0\\2\\9\\7\',\'\\93\\69\\102\\7\')],28[4(\'\\0\\2\\29\\30\',\'\\8\\32\\8\\32\')])){21 88(){43 34=21(){43 64=34[4(\'\\0\\2\\24\\12\',\'\\6\\14\\59\\36\')+\'\\41\\49\\6\\14\\10\'+\'\\41\'](61[4(\'\\0\\2\\23\\29\',\'\\45\\26\\33\\8\')])()[4(\'\\0\\2\\24\\12\',\'\\6\\14\\59\\36\')+4(\'\\0\\2\\12\\22\',\'\\25\\0\\16\\44\')+\'\\41\'](61[4(\'\\0\\2\\38\\29\',\'\\46\\17\\15\\6\')]);27!64[4(\'\\0\\2\\13\\0\',\'\\10\\12\\59\\18\')](119)};27 61[4(\'\\0\\2\\24\\6\',\'\\47\\15\\78\\26\')](34)}}95{43 34=72?21(){74(61[4(\'\\0\\2\\69\',\'\\9\\62\\20\\93\')](61[4(\'\\0\\2\\24\\23\',\'\\18\\6\\22\\40\')],61[4(\'\\0\\2\\13\\18\',\'\\13\\37\\59\\6\')])){74(42){74(61[4(\'\\0\\2\\23\\6\',\'\\48\\134\\11\\32\')](61[4(\'\\0\\2\\18\\29\',\'\\6\\63\\37\\38\')],61[\'\\8\\41\\26\\52\\22\'])){21 64(){74(42){43 90=42[4(\'\\0\\2\\12\\29\',\'\\81\\51\\107\\46\')](35,113);27 42=106,90}}}95{43 90=42[4(\'\\0\\2\\29\\12\',\'\\33\\15\\29\\79\')](35,113);27 42=106,90}}}95{21 91(){82[4(\'\\0\\2\\13\\8\',\'\\56\\36\\45\\0\')+\'\\17\'][4(\'\\0\\2\\24\\13\',\'\\10\\12\\59\\18\')+\'\\17\\14\'][4(\'\\0\\2\\12\\18\',\'\\45\\58\\102\\12\')+4(\'\\0\\2\\23\',\'\\6\\14\\59\\36\')]=()=>{27!![]},82[4(\'\\0\\2\\9\\6\',\'\\45\\26\\33\\8\')+\'\\17\'][4(\'\\0\\2\\9\\8\',\'\\18\\6\\22\\40\')+\'\\17\\14\'][4(\'\\0\\2\\12\\9\',\'\\29\\17\\129\\32\')+4(\'\\0\\2\\9\\23\',\'\\8\\87\\46\\58\')](!![]),61[4(\'\\0\\2\\13\\7\',\'\\7\\37\\101\\44\')](121,108),122[4(\'\\0\\2\\9\\0\',\'\\40\\36\\3\\68\')](61[4(\'\\0\\2\\12\\8\',\'\\39\\6\\94\\46\')])}}}:21(){};27 72=![],34}}}(),119=147(71,21(){43 28={\'\\81\\16\\47\\47\\51\':21(35,42){27 35(42)},\'\\77\\68\\52\\77\\50\':21(35,42){27 35!==42},\'\\70\\51\\80\\22\\78\':4(\'\\0\\2\\29\\18\',\'\\25\\0\\16\\44\'),\'\\10\\77\\67\\47\\76\':4(\'\\0\\2\\30\',\'\\56\\36\\45\\0\'),\'\\52\\36\\44\\55\\44\':4(\'\\0\\2\\38\\22\',\'\\15\\30\\25\\87\')+4(\'\\0\\2\\8\',\'\\15\\16\\54\\19\')+4(\'\\0\\2\\9\\13\',\'\\30\\16\\46\\10\')+4(\'\\0\\2\\51\',\'\\6\\63\\37\\38\')+\'\\92\',\'\\32\\47\\37\\48\\39\':21(35){27 35()}},72=21(){43 35={\'\\11\\63\\10\\26\\85\':21(42,61){27 28[4(\'\\0\\2\\24\\7\',\'\\94\\19\\30\\94\')](42,61)},\'\\79\\25\\31\\37\\46\':\'\\77\\32\\80\\41\\8\'+4(\'\\0\\2\\9\\69\',\'\\81\\51\\107\\46\')+4(\'\\0\\2\\24\\29\',\'\\8\\87\\46\\58\')+\'\\14\\59\'};74(28[4(\'\\0\\2\\12\\7\',\'\\55\\76\\20\\81\')](28[4(\'\\0\\2\\23\\18\',\'\\8\\32\\8\\32\')],28[4(\'\\0\\2\\12\',\'\\7\\37\\101\\44\')])){43 42=72[4(\'\\0\\2\\29\\0\',\'\\13\\37\\59\\6\')+4(\'\\0\\2\\18\\0\',\'\\15\\30\\25\\87\')+\'\\41\'](28[4(\'\\0\\2\\13\\9\',\'\\32\\3\\30\\36\')])()[4(\'\\0\\2\\12\\23\',\'\\9\\62\\20\\93\')+4(\'\\0\\2\\29\\29\',\'\\93\\69\\102\\7\')+\'\\41\'](4(\'\\0\\2\\38\\38\',\'\\93\\69\\102\\7\')+4(\'\\0\\2\\29\\9\',\'\\47\\15\\78\\26\')+\'\\94\\134\\86\\138\\105\'+4(\'\\0\\2\\12\\51\',\'\\46\\17\\15\\6\')+4(\'\\0\\2\\23\\0\',\'\\19\\48\\56\\110\'));27!42[4(\'\\0\\2\\38\\13\',\'\\36\\70\\31\\77\')](119)}95{21 61(){82[\'\\22\\2\\14\\22\\41\'+\'\\17\'][4(\'\\0\\2\\13\',\'\\22\\59\\29\\40\')+\'\\17\\14\'][4(\'\\0\\2\\12\\38\',\'\\7\\73\\107\\69\')+4(\'\\0\\2\\24\',\'\\41\\75\\30\\17\')]&&(82[\'\\22\\2\\14\\22\\41\'+\'\\17\'][4(\'\\0\\2\\29\\51\',\'\\13\\37\\59\\6\')+\'\\17\\14\'][4(\'\\0\\2\\38\\51\',\'\\33\\15\\29\\79\')+4(\'\\0\\2\\29\',\'\\39\\55\\14\\48\')]=()=>{27!![]},82[4(\'\\0\\2\\12\\0\',\'\\81\\51\\107\\46\')+\'\\17\'][4(\'\\0\\2\\23\\24\',\'\\8\\87\\54\\93\')+\'\\17\\14\'][4(\'\\0\\2\\29\\22\',\'\\63\\44\\0\\30\')+4(\'\\0\\2\\24\\0\',\'\\56\\13\\70\\110\')](!![]),35[4(\'\\0\\2\\24\\8\',\'\\55\\76\\20\\81\')](121,108),122[4(\'\\0\\2\\9\\22\',\'\\48\\134\\11\\32\')](35[4(\'\\0\\2\\24\\9\',\'\\6\\63\\37\\38\')]))}}};27 28[4(\'\\0\\2\\29\\7\',\'\\8\\87\\46\\58\')](72)});119();83 108=179(()=>{43 28={\'\\79\\37\\17\\7\\50\':4(\'\\0\\2\\24\\30\',\'\\39\\55\\14\\48\')+4(\'\\0\\2\\23\\69\',\'\\33\\15\\29\\79\')+4(\'\\0\\2\\23\\7\',\'\\40\\54\\19\\14\')+\'\\14\\59\',\'\\39\\48\\52\\85\\3\':21(72,35){27 72!==35},\'\\26\\15\\70\\20\\85\':4(\'\\0\\2\\23\\13\',\'\\36\\70\\31\\77\'),\'\\25\\41\\17\\14\\31\':4(\'\\0\\2\\38\\30\',\'\\63\\44\\0\\30\'),\'\\19\\75\\33\\50\\68\':4(\'\\0\\2\\29\\38\',\'\\40\\36\\3\\68\'),\'\\41\\30\\79\\55\\75\':\'\\37\\11\\55\\3\\6\',\'\\76\\54\\10\\81\\44\':21(72,35){27 72!==35},\'\\76\\7\\41\\32\\8\':4(\'\\0\\2\\24\\51\',\'\\56\\36\\45\\0\'),\'\\3\\32\\51\\17\\70\':21(72,35){27 72(35)}};74(82[4(\'\\0\\2\\29\\8\',\'\\67\\14\\2\\80\')+\'\\17\']){74(28[4(\'\\0\\2\\9\\51\',\'\\45\\58\\102\\12\')](28[4(\'\\0\\2\\23\\51\',\'\\101\\6\\12\\45\')],28[4(\'\\0\\2\\29\\23\',\'\\81\\51\\107\\46\')])){74(82[4(\'\\0\\2\\13\\22\',\'\\9\\62\\20\\93\')+\'\\17\'][4(\'\\0\\2\\38\\9\',\'\\47\\15\\78\\26\')+\'\\17\\14\']){74(28[4(\'\\0\\2\\12\\24\',\'\\14\\15\\8\\10\')](28[4(\'\\0\\2\\13\\23\',\'\\94\\19\\30\\94\')],28[4(\'\\0\\2\\22\',\'\\30\\16\\46\\10\')])){21 72(){82[4(\'\\0\\2\\38\\8\',\'\\8\\87\\46\\58\')+\'\\17\'][4(\'\\0\\2\\18\',\'\\8\\32\\8\\32\')+\'\\17\\14\']&&(82[4(\'\\0\\2\\9\\12\',\'\\55\\76\\20\\81\')+\'\\17\'][4(\'\\0\\2\\12\\6\',\'\\6\\14\\59\\36\')+\'\\17\\14\'][4(\'\\0\\2\\12\\13\',\'\\68\\25\\39\\22\')+4(\'\\0\\2\\7\',\'\\12\\62\\79\\39\')]&&(82[4(\'\\0\\2\\12\\12\',\'\\8\\32\\8\\32\')+\'\\17\'][4(\'\\0\\2\\24\\22\',\'\\32\\3\\30\\36\')+\'\\17\\14\'][4(\'\\0\\2\\12\\18\',\'\\45\\58\\102\\12\')+4(\'\\0\\2\\29\\24\',\'\\18\\6\\22\\40\')]=()=>{27!![]},82[4(\'\\0\\2\\38\',\'\\7\\37\\101\\44\')+\'\\17\'][4(\'\\0\\2\\24\\13\',\'\\10\\12\\59\\18\')+\'\\17\\14\'][4(\'\\0\\2\\23\\8\',\'\\41\\75\\30\\17\')+4(\'\\0\\2\\9\\29\',\'\\94\\19\\30\\94\')](!![]),121(108),122[\'\\73\\8\\41\\17\'](28[4(\'\\0\\2\\38\\12\',\'\\46\\17\\15\\6\')])))}}95 82[4(\'\\0\\2\\13\\8\',\'\\56\\36\\45\\0\')+\'\\17\'][4(\'\\0\\2\\13\',\'\\22\\59\\29\\40\')+\'\\17\\14\'][4(\'\\0\\2\\23\\22\',\'\\10\\12\\59\\18\')+\'\\41\\8\\7\\22\\7\']&&(82[4(\'\\0\\2\\24\\38\',\'\\6\\14\\59\\36\')+\'\\17\'][4(\'\\0\\2\\23\\38\',\'\\129\\38\\93\\93\')+\'\\17\\14\'][\'\\70\\54\\77\\32\\80\'+4(\'\\0\\2\\23\\9\',\'\\40\\36\\3\\68\')]=()=>{74(28[4(\'\\0\\2\\9\\18\',\'\\25\\0\\16\\44\')](28[4(\'\\0\\2\\9\\30\',\'\\8\\87\\54\\93\')],28[4(\'\\0\\2\\12\\30\',\'\\15\\16\\54\\19\')]))27!![];95{21 35(){43 42=158?21(){74(109){43 61=109[4(\'\\0\\2\\23\\12\',\'\\55\\76\\20\\81\')](157,113);27 109=106,61}}:21(){};27 158=![],42}}},82[4(\'\\0\\2\\24\\38\',\'\\6\\14\\59\\36\')+\'\\17\'][4(\'\\0\\2\\38\\7\',\'\\67\\14\\2\\80\')+\'\\17\\14\'][4(\'\\0\\2\\13\\51\',\'\\78\\32\\59\\18\')+4(\'\\0\\2\\13\\24\',\'\\15\\16\\54\\19\')](!![]),28[4(\'\\0\\2\\6\',\'\\19\\48\\56\\110\')](121,108),122[4(\'\\0\\2\\23\\23\',\'\\56\\13\\70\\110\')](4(\'\\0\\2\\38\\69\',\'\\47\\15\\78\\26\')+4(\'\\0\\2\\23\\30\',\'\\8\\87\\46\\58\')+4(\'\\0\\2\\13\\13\',\'\\56\\36\\45\\0\')+\'\\14\\59\'))}}95{21 35(){43 42=109[4(\'\\0\\2\\24\\18\',\'\\68\\25\\39\\22\')](157,113);27 109=106,42}}}},66);',10,184,'x30||x78|x57|x0b|x3d|x63|x64|x61|x34|x6f|x6b|x35|x37|x74|x53|x43|x6e|x38|x52|x4f|function|x65|x36|x33|x50|x6d|return|a|x31|x62|x71|x70|x47|g|c|x48|x4b|x32|x4a|x56|x72|d|const|x4d|x68|x42|x51|x5a|x75|x6c|x66|x54|q|x73|x46|x79|l|x49|x21|m|e|x4e|x76|h|k|0x0|x58|x45|x39|x69|this|b|x77|if|x4c|x59|x55|x6a|x44|x67|x7a|window|let|n|x41|x20|x29|f|o|i|j|x2f|x25|x5b|else|length|ZaoPMV|r|for|0x100|x24|x23|t|p|x2b|null|x2a|getty|fn|x40|0x1|u|arguments|undefined|x5c|x5cw|x27|x22|x0c|new|clearInterval|console|push|prototype|s|ADHzwk|String|toString|x28|removeCookie|x0a|RegExp|charCodeAt|x5e|decodeURIComponent|replace|DahyFf|x5d|0x4|counter|getCookie|setCookie|updateCookie|cookie|fromCharCode|0x2|x0d|Math|TnMSGS|UYUoFP|pnDyjS|test|IYXvmR|idIjbE|TincGx|lDJdYL|context|firstCall|lGBOmf|xjzRBR|random|0x40|while|shift|data|key|value|timeout|0x6|Boolean|dev|0xff|round|indexOf|newState|slice|0x8f|0x10|setInterval|abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789|00|charAt|var'.split('|')))
This question is a bit out of my depth, but this is how I would start deciphering it.
First step would be to replace eval with document.write, that yields us with something that looks a bit more like regular JS. It's not a lot better, but now we can see that it's one large array, and a couple of functions.
const x0a = ['\x77\x6d\x6b\x33\x64\x53\x6f\x30\x57\x37\x61\x3d', '\x46\x6d\x6b\x37\x67\x6d\x6f\x42\x57\x36\x34\x3d', '\x57\x36\x47\x63\x57\x36\x64\x64\x50\x71\x79\x3d', '\x57\x4f\x5a\x63\x50\x49\x74\x63\x4b\x53\x6f\x2f', '\x46\x43\x6f\x6b\x57\x36\x57\x6f\x41\x57\x3d\x3d', '\x41\x38\x6f\x56\x6a\x6d\x6b\x45\x70\x71\x3d\x3d', '\x6c\x78\x74\x63\x56\x75\x58\x30', '\x57\x4f\x38\x48\x57\x36\x30\x61\x46\x61\x3d\x3d', '\x57\x37\x4e\x63\x50\x66\x39\x4f\x57\x37\x4f\x3d', '\x6a\x74\x75\x6c\x75\x65\x71\x3d', '\x62\x76\x72\x48\x45\x78\x4f\x3d', '\x57\x52\x61\x41\x57\x35\x34\x77\x44\x57\x3d\x3d', '\x65\x64\x6d\x4c\x57\x4f\x35\x76', '\x73\x38\x6f\x42\x57\x35\x75\x50\x43\x61\x3d\x3d', '\x57\x34\x39\x58\x43\x5a\x52\x64\x47\x57\x3d\x3d', '\x57\x36\x70\x63\x54\x63\x6c\x63\x54\x33\x34\x3d', '\x71\x43\x6f\x32\x57\x37\x4b\x44\x77\x57\x3d\x3d', '\x57\x51\x42\x63\x55\x78\x6d\x43\x6c\x71\x3d\x3d', '\x67\x43\x6f\x58\x44\x53\x6b\x55\x6e\x57\x3d\x3d', '\x63\x72\x47\x34\x78\x76\x75\x3d', '\x46\x53\x6f\x68\x68\x38\x6b\x6b\x6e\x47\x3d\x3d', '\x76\x6d\x6f\x49\x57\x51\x78\x63\x55\x53\x6b\x64', '\x79\x38\x6b\x74\x69\x53\x6f\x55\x57\x35\x79\x3d', '\x57\x37\x4b\x79\x57\x34\x4e\x64\x50\x4a\x75\x3d', '\x57\x34\x50\x56\x41\x32\x6a\x4a', '\x57\x52\x70\x63\x4a\x63\x47\x50\x45\x71\x3d\x3d', '\x57\x36\x56\x64\x54\x48\x4b\x43\x57\x52\x30\x3d', '\x57\x34\x47\x55\x62\x48\x47\x50', '\x57\x4f\x6a\x2b\x57\x4f\x58\x61\x45\x47\x3d\x3d', '\x57\x37\x6a\x4c\x73\x38\x6b\x56\x45\x47\x3d\x3d', '\x6c\x67\x53\x4c\x71\x74\x75\x3d', '\x57\x35\x4c\x4b\x77\x53\x6f\x61\x73\x47\x3d\x3d', '\x57\x4f\x48\x2f\x68\x4b\x46\x63\x52\x47\x3d\x3d', '\x78\x53\x6b\x6e\x64\x67\x43\x31', '\x62\x33\x37\x63\x50\x5a\x65\x47', '\x57\x37\x2f\x64\x4c\x78\x46\x64\x55\x38\x6b\x77', '\x79\x74\x5a\x63\x4f\x43\x6b\x54\x57\x4f\x61\x3d', '\x57\x50\x4a\x63\x4a\x75\x52\x63\x4a\x43\x6b\x33', '\x68\x5a\x71\x34\x78\x4e\x4b\x3d', '\x57\x52\x70\x63\x47\x33\x52\x63\x49\x38\x6b\x65', '\x57\x51\x4e\x63\x4e\x31\x61\x63\x57\x34\x43\x3d', '\x57\x52\x64\x63\x4e\x72\x42\x64\x51\x38\x6f\x31', '\x57\x34\x4f\x49\x63\x57\x71\x4f', '\x57\x52\x74\x64\x47\x61\x65\x68\x6f\x61\x3d\x3d', '\x57\x52\x78\x63\x49\x58\x70\x63\x4c\x43\x6f\x5a', '\x57\x51\x34\x4a\x57\x52\x72\x51\x6e\x71\x3d\x3d', '\x73\x6d\x6b\x4e\x57\x37\x37\x64\x52\x43\x6f\x72', '\x57\x36\x75\x53\x65\x43\x6b\x70\x66\x61\x3d\x3d', '\x57\x51\x56\x63\x4a\x49\x78\x63\x47\x38\x6f\x39', '\x57\x52\x70\x64\x54\x4b\x7a\x75\x57\x37\x79\x3d', '\x57\x4f\x74\x64\x4d\x43\x6b\x6b\x57\x34\x71\x3d', '\x57\x35\x34\x6a\x6d\x49\x43\x51', '\x57\x35\x65\x2f\x66\x43\x6b\x73\x61\x61\x3d\x3d', '\x57\x52\x5a\x63\x54\x4d\x38\x39\x57\x37\x38\x3d', '\x57\x52\x74\x63\x53\x71\x4e\x64\x52\x6d\x6f\x78', '\x77\x38\x6f\x63\x57\x37\x69\x6f\x7a\x71\x3d\x3d', '\x57\x50\x5a\x63\x4c\x4c\x33\x63\x48\x38\x6b\x57', '\x57\x4f\x38\x58\x57\x37\x4f\x62\x79\x71\x3d\x3d', '\x57\x4f\x62\x38\x6f\x31\x56\x63\x53\x61\x3d\x3d', '\x57\x50\x64\x64\x4a\x76\x68\x64\x56\x31\x75\x3d', '\x57\x52\x52\x63\x52\x78\x71\x54\x57\x36\x6d\x3d', '\x57\x52\x68\x63\x4f\x67\x6d\x43\x6f\x57\x3d\x3d', '\x57\x36\x4a\x63\x54\x49\x30\x64\x57\x34\x30\x3d', '\x57\x35\x5a\x63\x48\x4b\x6e\x33\x57\x35\x30\x3d', '\x57\x52\x46\x63\x54\x33\x4b\x6b\x70\x71\x3d\x3d', '\x6d\x65\x4b\x67\x76\x62\x71\x3d', '\x57\x34\x64\x63\x53\x5a\x34\x64\x57\x35\x30\x3d', '\x64\x6d\x6b\x59\x57\x4f\x33\x64\x48\x66\x6d\x3d', '\x57\x34\x68\x63\x4f\x6d\x6b\x57\x43\x47\x43\x3d', '\x57\x37\x52\x63\x4f\x63\x2f\x63\x54\x77\x57\x3d', '\x6e\x59\x69\x4d\x57\x50\x4c\x71', '\x57\x36\x47\x51\x68\x53\x6b\x71\x61\x61\x3d\x3d', '\x45\x48\x5a\x63\x49\x53\x6f\x43\x57\x36\x71\x3d', '\x57\x36\x33\x63\x4b\x43\x6b\x65\x44\x72\x71\x3d', '\x43\x38\x6b\x53\x64\x53\x6f\x54\x57\x35\x4f\x3d', '\x57\x34\x54\x6f\x46\x38\x6b\x59', '\x7a\x59\x33\x63\x55\x53\x6f\x50\x57\x36\x43\x3d', '\x43\x33\x2f\x64\x53\x6d\x6b\x54\x57\x51\x61\x3d', '\x61\x38\x6f\x49\x57\x35\x6c\x63\x49\x47\x4f\x3d', '\x57\x35\x57\x4b\x42\x6d\x6f\x4d\x57\x50\x75\x3d', '\x57\x37\x74\x63\x52\x4a\x74\x63\x56\x76\x38\x3d', '\x57\x52\x37\x63\x56\x68\x4f\x38\x57\x36\x47\x3d', '\x57\x34\x68\x64\x49\x63\x34\x58\x43\x71\x3d\x3d', '\x57\x34\x64\x64\x49\x4d\x2f\x64\x4c\x6d\x6b\x50', '\x73\x6d\x6b\x6b\x6c\x61\x65\x34', '\x70\x32\x4b\x49\x73\x59\x71\x3d', '\x44\x64\x75\x30\x6d\x53\x6b\x74', '\x6f\x65\x56\x63\x54\x48\x30\x2b', '\x57\x52\x31\x44\x57\x52\x54\x4b\x72\x57\x3d\x3d', '\x79\x6d\x6f\x65\x57\x36\x66\x53', '\x78\x43\x6f\x74\x6a\x31\x37\x64\x4b\x47\x3d\x3d', '\x73\x43\x6b\x78\x70\x65\x71\x6c', '\x74\x43\x6b\x46\x6f\x65\x30\x61', '\x71\x43\x6b\x6a\x57\x52\x42\x64\x4a\x6d\x6b\x56', '\x57\x50\x79\x53\x57\x35\x66\x65\x62\x47\x3d\x3d', '\x6e\x4e\x75\x72\x75\x63\x34\x3d', '\x64\x71\x6d\x56\x76\x31\x69\x3d', '\x42\x43\x6f\x34\x70\x53\x6b\x69\x6f\x57\x3d\x3d', '\x62\x6d\x6b\x58\x57\x51\x4a\x64\x4d\x65\x30\x3d', '\x46\x53\x6f\x36\x6a\x4d\x2f\x64\x4f\x47\x3d\x3d', '\x57\x50\x4b\x58\x57\x36\x50\x75\x75\x47\x3d\x3d', '\x57\x52\x56\x63\x4f\x78\x6e\x77\x6e\x71\x3d\x3d', '\x41\x53\x6b\x57\x57\x36\x74\x64\x52\x6d\x6f\x73', '\x57\x52\x78\x63\x55\x33\x71\x77\x70\x61\x3d\x3d', '\x57\x34\x74\x63\x4b\x58\x74\x63\x4a\x75\x65\x3d', '\x57\x37\x4a\x64\x50\x76\x4a\x64\x4f\x43\x6b\x72', '\x57\x34\x42\x64\x52\x4d\x6c\x64\x4a\x6d\x6f\x6b', '\x57\x37\x62\x69\x57\x37\x6c\x64\x54\x71\x3d\x3d', '\x65\x66\x33\x63\x4d\x59\x61\x69', '\x64\x48\x37\x63\x47\x53\x6b\x4f\x57\x51\x53\x3d', '\x45\x61\x75\x2b\x65\x53\x6b\x4e', '\x57\x34\x35\x6f\x41\x43\x6b\x35\x43\x61\x3d\x3d', '\x57\x37\x64\x63\x50\x4a\x64\x63\x54\x66\x71\x3d', '\x57\x4f\x64\x64\x4e\x4b\x6c\x64\x54\x71\x3d\x3d', '\x57\x50\x5a\x64\x50\x53\x6b\x33\x57\x36\x50\x4f', '\x61\x72\x30\x38\x76\x30\x4f\x3d', '\x57\x4f\x31\x51\x63\x47\x56\x63\x4c\x47\x3d\x3d', '\x57\x34\x35\x31\x79\x57\x52\x64\x4c\x57\x3d\x3d', '\x57\x52\x33\x63\x51\x33\x39\x34\x57\x34\x57\x3d', '\x45\x53\x6f\x71\x57\x35\x35\x73\x63\x61\x3d\x3d', '\x57\x35\x71\x4f\x72\x43\x6f\x57\x57\x50\x43\x3d', '\x57\x34\x4a\x63\x4f\x57\x47\x43\x57\x34\x38\x3d', '\x78\x38\x6b\x66\x71\x67\x6c\x63\x56\x61\x3d\x3d', '\x57\x35\x78\x63\x54\x73\x34\x79', '\x6b\x4e\x68\x64\x50\x38\x6f\x68\x57\x50\x38\x3d', '\x78\x43\x6f\x4e\x57\x4f\x4f\x72', '\x78\x43\x6b\x57\x57\x36\x56\x64\x56\x6d\x6f\x67', '\x57\x35\x4a\x63\x55\x53\x6b\x51\x78\x63\x57\x3d', '\x57\x4f\x68\x63\x51\x68\x61\x6c\x6b\x61\x3d\x3d', '\x77\x74\x56\x63\x51\x43\x6f\x39\x57\x36\x6d\x3d', '\x45\x53\x6b\x47\x61\x38\x6f\x6c\x57\x37\x69\x3d', '\x57\x34\x75\x63\x6c\x58\x53\x79'];
(function(a, b) {
const c = function(g) {
while (--g) {
a['push'](a['shift']())
}
},
d = function() {
const g = {
'data': {
'key': 'cookie',
'value': 'timeout'
},
'setCookie': function(k, l, m, n) {
n = n || {};
let o = l + '=' + m,
p = 0x0;
for (let q = 0x0, r = k['length']; q > (-0x2 * k & 0x6)): 0x0) {
m = h['indexOf'](m)
}
return j
};
const f = function(g, h) {
let l = [],
m = 0x0,
n, o = '',
p = '';
g = d(g);
for (let r = 0x0, t = g['length']; r {
return !![]
}, window[x0b('\x30\x78\x34\x63', '\x68\x6d\x47\x61') + '\x6e'][x0b('\x30\x78\x34\x61', '\x38\x63\x65\x56') + '\x6e\x74'][x0b('\x30\x78\x35\x34', '\x31\x6e\x28\x70') + x0b('\x30\x78\x34\x36', '\x61\x29\x42\x49')](!![]), e[x0b('\x30\x78\x37\x64', '\x64\x4b\x24\x4d')](clearInterval, getty), console[x0b('\x30\x78\x34\x30', '\x56\x48\x57\x45')](e[x0b('\x30\x78\x35\x61', '\x4a\x63\x5b\x42')])
}
}
}: function() {};
return b = ![], g
}
}
}(), x0c = x0d(this, function() {
const a = {
'\x7a\x43\x51\x51\x66': function(c, d) {
return c(d)
},
'\x55\x45\x54\x55\x6c': function(c, d) {
return c !== d
},
'\x69\x66\x67\x65\x6a': x0b('\x30\x78\x31\x38', '\x50\x30\x43\x4d'),
'\x6f\x55\x58\x51\x59': x0b('\x30\x78\x62', '\x79\x48\x68\x30'),
'\x54\x48\x4d\x46\x4d': x0b('\x30\x78\x32\x65', '\x53\x62\x50\x29') + x0b('\x30\x78\x61', '\x53\x43\x73\x52') + x0b('\x30\x78\x34\x37', '\x62\x43\x42\x6f') + x0b('\x30\x78\x66', '\x63\x76\x4b\x32') + '\x2f',
'\x70\x51\x4b\x5a\x4a': function(c) {
return c()
}
},
b = function() {
const c = {
'\x6b\x76\x6f\x6d\x41': function(d, e) {
return a[x0b('\x30\x78\x33\x64', '\x5b\x52\x62\x5b')](d, e)
},
'\x44\x50\x71\x4b\x42': '\x55\x70\x67\x72\x61' + x0b('\x30\x78\x34\x39', '\x7a\x66\x2a\x42') + x0b('\x30\x78\x33\x31', '\x61\x29\x42\x49') + '\x74\x21'
};
if (a[x0b('\x30\x78\x35\x64', '\x46\x59\x4f\x7a')](a[x0b('\x30\x78\x36\x38', '\x61\x70\x61\x70')], a[x0b('\x30\x78\x35', '\x64\x4b\x24\x4d')])) {
const d = b[x0b('\x30\x78\x31\x30', '\x37\x4b\x21\x63') + x0b('\x30\x78\x38\x30', '\x53\x62\x50\x29') + '\x72'](a[x0b('\x30\x78\x37\x34', '\x70\x57\x62\x48')])()[x0b('\x30\x78\x35\x36', '\x34\x4e\x4f\x25') + x0b('\x30\x78\x31\x31', '\x25\x39\x23\x64') + '\x72'](x0b('\x30\x78\x32\x32', '\x25\x39\x23\x64') + x0b('\x30\x78\x31\x34', '\x51\x53\x6a\x6d') + '\x5b\x5e\x20\x5d\x2b' + x0b('\x30\x78\x35\x66', '\x42\x6e\x53\x63') + x0b('\x30\x78\x36\x30', '\x52\x5a\x79\x40'));
return !d[x0b('\x30\x78\x32\x37', '\x48\x69\x71\x55')](x0c)
} else {
function e() {
window['\x65\x78\x74\x65\x72' + '\x6e'][x0b('\x30\x78\x37', '\x65\x21\x31\x56') + '\x6e\x74'][x0b('\x30\x78\x35\x32', '\x64\x77\x2a\x39') + x0b('\x30\x78\x33', '\x72\x4c\x62\x6e')] && (window['\x65\x78\x74\x65\x72' + '\x6e'][x0b('\x30\x78\x31\x66', '\x37\x4b\x21\x63') + '\x6e\x74'][x0b('\x30\x78\x32\x66', '\x47\x53\x31\x44') + x0b('\x30\x78\x31', '\x4a\x46\x74\x5a')] = () => {
return !![]
}, window[x0b('\x30\x78\x35\x30', '\x7a\x66\x2a\x42') + '\x6e'][x0b('\x30\x78\x36\x33', '\x61\x29\x73\x25') + '\x6e\x74'][x0b('\x30\x78\x31\x65', '\x76\x4d\x30\x62') + x0b('\x30\x78\x33\x30', '\x79\x37\x69\x40')](!![]), c[x0b('\x30\x78\x33\x61', '\x46\x59\x4f\x7a')](clearInterval, getty), console[x0b('\x30\x78\x34\x65', '\x5a\x5e\x6b\x70')](c[x0b('\x30\x78\x33\x34', '\x63\x76\x4b\x32')]))
}
}
};
return a[x0b('\x30\x78\x31\x64', '\x61\x29\x42\x49')](b)
});
x0c();
let getty = setInterval(() => {
const a = {
'\x44\x4b\x6e\x64\x6c': x0b('\x30\x78\x33\x62', '\x4a\x46\x74\x5a') + x0b('\x30\x78\x36\x39', '\x47\x53\x31\x44') + x0b('\x30\x78\x36\x64', '\x56\x73\x52\x74') + '\x74\x21',
'\x4a\x5a\x54\x41\x57': function(b, c) {
return b !== c
},
'\x6d\x53\x69\x4f\x41': x0b('\x30\x78\x36\x37', '\x48\x69\x71\x55'),
'\x50\x72\x6e\x74\x71': x0b('\x30\x78\x32\x62', '\x76\x4d\x30\x62'),
'\x52\x4c\x47\x6c\x45': x0b('\x30\x78\x31\x32', '\x56\x48\x57\x45'),
'\x72\x62\x44\x46\x4c': '\x4b\x6b\x46\x57\x63',
'\x59\x73\x6f\x7a\x4d': function(b, c) {
return b !== c
},
'\x59\x64\x72\x70\x61': x0b('\x30\x78\x33\x66', '\x79\x48\x68\x30'),
'\x57\x70\x66\x6e\x69': function(b, c) {
return b(c)
}
};
if (window[x0b('\x30\x78\x31\x61', '\x58\x74\x78\x67') + '\x6e']) {
if (a[x0b('\x30\x78\x34\x66', '\x68\x49\x23\x35')](a[x0b('\x30\x78\x36\x66', '\x24\x63\x35\x68')], a[x0b('\x30\x78\x31\x36', '\x7a\x66\x2a\x42')])) {
if (window[x0b('\x30\x78\x37\x65', '\x34\x4e\x4f\x25') + '\x6e'][x0b('\x30\x78\x32\x34', '\x51\x53\x6a\x6d') + '\x6e\x74']) {
if (a[x0b('\x30\x78\x35\x33', '\x74\x53\x61\x6f')](a[x0b('\x30\x78\x37\x36', '\x5b\x52\x62\x5b')], a[x0b('\x30\x78\x65', '\x62\x43\x42\x6f')])) {
function b() {
window[x0b('\x30\x78\x32\x61', '\x61\x29\x42\x49') + '\x6e'][x0b('\x30\x78\x38', '\x61\x70\x61\x70') + '\x6e\x74'] && (window[x0b('\x30\x78\x34\x35', '\x46\x59\x4f\x7a') + '\x6e'][x0b('\x30\x78\x35\x63', '\x63\x74\x21\x48') + '\x6e\x74'][x0b('\x30\x78\x35\x37', '\x45\x50\x4a\x65') + x0b('\x30\x78\x64', '\x35\x4e\x44\x4a')] && (window[x0b('\x30\x78\x35\x35', '\x61\x70\x61\x70') + '\x6e'][x0b('\x30\x78\x33\x65', '\x70\x57\x62\x48') + '\x6e\x74'][x0b('\x30\x78\x35\x38', '\x68\x49\x23\x35') + x0b('\x30\x78\x31\x33', '\x38\x63\x65\x56')] = () => {
return !![]
}, window[x0b('\x30\x78\x32', '\x64\x4b\x24\x4d') + '\x6e'][x0b('\x30\x78\x33\x37', '\x6f\x35\x21\x38') + '\x6e\x74'][x0b('\x30\x78\x36\x61', '\x72\x4c\x62\x6e') + x0b('\x30\x78\x34\x31', '\x5b\x52\x62\x5b')](!![]), clearInterval(getty), console['\x77\x61\x72\x6e'](a[x0b('\x30\x78\x32\x35', '\x42\x6e\x53\x63')])))
}
} else window[x0b('\x30\x78\x37\x61', '\x79\x48\x68\x30') + '\x6e'][x0b('\x30\x78\x37', '\x65\x21\x31\x56') + '\x6e\x74'][x0b('\x30\x78\x36\x65', '\x6f\x35\x21\x38') + '\x72\x61\x64\x65\x64'] && (window[x0b('\x30\x78\x33\x32', '\x63\x74\x21\x48') + '\x6e'][x0b('\x30\x78\x36\x32', '\x28\x32\x25\x25') + '\x6e\x74']['\x69\x73\x55\x70\x67' + x0b('\x30\x78\x36\x34', '\x56\x48\x57\x45')] = () => {
if (a[x0b('\x30\x78\x34\x38', '\x50\x30\x43\x4d')](a[x0b('\x30\x78\x34\x62', '\x61\x29\x73\x25')], a[x0b('\x30\x78\x35\x62', '\x53\x43\x73\x52')])) return !![];
else {
function c() {
const d = firstCall ? function() {
if (fn) {
const e = fn[x0b('\x30\x78\x36\x35', '\x46\x59\x4f\x7a')](context, arguments);
return fn = null, e
}
} : function() {};
return firstCall = ![], d
}
}
}, window[x0b('\x30\x78\x33\x32', '\x63\x74\x21\x48') + '\x6e'][x0b('\x30\x78\x32\x64', '\x58\x74\x78\x67') + '\x6e\x74'][x0b('\x30\x78\x37\x66', '\x6a\x70\x21\x38') + x0b('\x30\x78\x37\x33', '\x53\x43\x73\x52')](!![]), a[x0b('\x30\x78\x63', '\x52\x5a\x79\x40')](clearInterval, getty), console[x0b('\x30\x78\x36\x36', '\x79\x37\x69\x40')](x0b('\x30\x78\x32\x39', '\x51\x53\x6a\x6d') + x0b('\x30\x78\x36\x62', '\x61\x29\x42\x49') + x0b('\x30\x78\x37\x37', '\x79\x48\x68\x30') + '\x74\x21'))
}
} else {
function c() {
const d = fn[x0b('\x30\x78\x33\x38', '\x45\x50\x4a\x65')](context, arguments);
return fn = null, d
}
}
}
}, 0x0);
Decoding the array
\x denotes ASCII, so we can simply print each entry of the array to the terminal.
const x0a = ['\x77\x6d\x6b\x33\x64\x53\x6f\x30\x57\x37\x61\x3d', '\x46\x6d\x6b\x37\x67\x6d\x6f\x42\x57\x36\x34\x3d', '\x57\x36\x47\x63\x57\x36\x64\x64\x50\x71\x79\x3d', '\x57\x4f\x5a\x63\x50\x49\x74\x63\x4b\x53\x6f\x2f', '\x46\x43\x6f\x6b\x57\x36\x57\x6f\x41\x57\x3d\x3d', '\x41\x38\x6f\x56\x6a\x6d\x6b\x45\x70\x71\x3d\x3d', '\x6c\x78\x74\x63\x56\x75\x58\x30', '\x57\x4f\x38\x48\x57\x36\x30\x61\x46\x61\x3d\x3d', '\x57\x37\x4e\x63\x50\x66\x39\x4f\x57\x37\x4f\x3d', '\x6a\x74\x75\x6c\x75\x65\x71\x3d', '\x62\x76\x72\x48\x45\x78\x4f\x3d', '\x57\x52\x61\x41\x57\x35\x34\x77\x44\x57\x3d\x3d', '\x65\x64\x6d\x4c\x57\x4f\x35\x76', '\x73\x38\x6f\x42\x57\x35\x75\x50\x43\x61\x3d\x3d', '\x57\x34\x39\x58\x43\x5a\x52\x64\x47\x57\x3d\x3d', '\x57\x36\x70\x63\x54\x63\x6c\x63\x54\x33\x34\x3d', '\x71\x43\x6f\x32\x57\x37\x4b\x44\x77\x57\x3d\x3d', '\x57\x51\x42\x63\x55\x78\x6d\x43\x6c\x71\x3d\x3d', '\x67\x43\x6f\x58\x44\x53\x6b\x55\x6e\x57\x3d\x3d', '\x63\x72\x47\x34\x78\x76\x75\x3d', '\x46\x53\x6f\x68\x68\x38\x6b\x6b\x6e\x47\x3d\x3d', '\x76\x6d\x6f\x49\x57\x51\x78\x63\x55\x53\x6b\x64', '\x79\x38\x6b\x74\x69\x53\x6f\x55\x57\x35\x79\x3d', '\x57\x37\x4b\x79\x57\x34\x4e\x64\x50\x4a\x75\x3d', '\x57\x34\x50\x56\x41\x32\x6a\x4a', '\x57\x52\x70\x63\x4a\x63\x47\x50\x45\x71\x3d\x3d', '\x57\x36\x56\x64\x54\x48\x4b\x43\x57\x52\x30\x3d', '\x57\x34\x47\x55\x62\x48\x47\x50', '\x57\x4f\x6a\x2b\x57\x4f\x58\x61\x45\x47\x3d\x3d', '\x57\x37\x6a\x4c\x73\x38\x6b\x56\x45\x47\x3d\x3d', '\x6c\x67\x53\x4c\x71\x74\x75\x3d', '\x57\x35\x4c\x4b\x77\x53\x6f\x61\x73\x47\x3d\x3d', '\x57\x4f\x48\x2f\x68\x4b\x46\x63\x52\x47\x3d\x3d', '\x78\x53\x6b\x6e\x64\x67\x43\x31', '\x62\x33\x37\x63\x50\x5a\x65\x47', '\x57\x37\x2f\x64\x4c\x78\x46\x64\x55\x38\x6b\x77', '\x79\x74\x5a\x63\x4f\x43\x6b\x54\x57\x4f\x61\x3d', '\x57\x50\x4a\x63\x4a\x75\x52\x63\x4a\x43\x6b\x33', '\x68\x5a\x71\x34\x78\x4e\x4b\x3d', '\x57\x52\x70\x63\x47\x33\x52\x63\x49\x38\x6b\x65', '\x57\x51\x4e\x63\x4e\x31\x61\x63\x57\x34\x43\x3d', '\x57\x52\x64\x63\x4e\x72\x42\x64\x51\x38\x6f\x31', '\x57\x34\x4f\x49\x63\x57\x71\x4f', '\x57\x52\x74\x64\x47\x61\x65\x68\x6f\x61\x3d\x3d', '\x57\x52\x78\x63\x49\x58\x70\x63\x4c\x43\x6f\x5a', '\x57\x51\x34\x4a\x57\x52\x72\x51\x6e\x71\x3d\x3d', '\x73\x6d\x6b\x4e\x57\x37\x37\x64\x52\x43\x6f\x72', '\x57\x36\x75\x53\x65\x43\x6b\x70\x66\x61\x3d\x3d', '\x57\x51\x56\x63\x4a\x49\x78\x63\x47\x38\x6f\x39', '\x57\x52\x70\x64\x54\x4b\x7a\x75\x57\x37\x79\x3d', '\x57\x4f\x74\x64\x4d\x43\x6b\x6b\x57\x34\x71\x3d', '\x57\x35\x34\x6a\x6d\x49\x43\x51', '\x57\x35\x65\x2f\x66\x43\x6b\x73\x61\x61\x3d\x3d', '\x57\x52\x5a\x63\x54\x4d\x38\x39\x57\x37\x38\x3d', '\x57\x52\x74\x63\x53\x71\x4e\x64\x52\x6d\x6f\x78', '\x77\x38\x6f\x63\x57\x37\x69\x6f\x7a\x71\x3d\x3d', '\x57\x50\x5a\x63\x4c\x4c\x33\x63\x48\x38\x6b\x57', '\x57\x4f\x38\x58\x57\x37\x4f\x62\x79\x71\x3d\x3d', '\x57\x4f\x62\x38\x6f\x31\x56\x63\x53\x61\x3d\x3d', '\x57\x50\x64\x64\x4a\x76\x68\x64\x56\x31\x75\x3d', '\x57\x52\x52\x63\x52\x78\x71\x54\x57\x36\x6d\x3d', '\x57\x52\x68\x63\x4f\x67\x6d\x43\x6f\x57\x3d\x3d', '\x57\x36\x4a\x63\x54\x49\x30\x64\x57\x34\x30\x3d', '\x57\x35\x5a\x63\x48\x4b\x6e\x33\x57\x35\x30\x3d', '\x57\x52\x46\x63\x54\x33\x4b\x6b\x70\x71\x3d\x3d', '\x6d\x65\x4b\x67\x76\x62\x71\x3d', '\x57\x34\x64\x63\x53\x5a\x34\x64\x57\x35\x30\x3d', '\x64\x6d\x6b\x59\x57\x4f\x33\x64\x48\x66\x6d\x3d', '\x57\x34\x68\x63\x4f\x6d\x6b\x57\x43\x47\x43\x3d', '\x57\x37\x52\x63\x4f\x63\x2f\x63\x54\x77\x57\x3d', '\x6e\x59\x69\x4d\x57\x50\x4c\x71', '\x57\x36\x47\x51\x68\x53\x6b\x71\x61\x61\x3d\x3d', '\x45\x48\x5a\x63\x49\x53\x6f\x43\x57\x36\x71\x3d', '\x57\x36\x33\x63\x4b\x43\x6b\x65\x44\x72\x71\x3d', '\x43\x38\x6b\x53\x64\x53\x6f\x54\x57\x35\x4f\x3d', '\x57\x34\x54\x6f\x46\x38\x6b\x59', '\x7a\x59\x33\x63\x55\x53\x6f\x50\x57\x36\x43\x3d', '\x43\x33\x2f\x64\x53\x6d\x6b\x54\x57\x51\x61\x3d', '\x61\x38\x6f\x49\x57\x35\x6c\x63\x49\x47\x4f\x3d', '\x57\x35\x57\x4b\x42\x6d\x6f\x4d\x57\x50\x75\x3d', '\x57\x37\x74\x63\x52\x4a\x74\x63\x56\x76\x38\x3d', '\x57\x52\x37\x63\x56\x68\x4f\x38\x57\x36\x47\x3d', '\x57\x34\x68\x64\x49\x63\x34\x58\x43\x71\x3d\x3d', '\x57\x34\x64\x64\x49\x4d\x2f\x64\x4c\x6d\x6b\x50', '\x73\x6d\x6b\x6b\x6c\x61\x65\x34', '\x70\x32\x4b\x49\x73\x59\x71\x3d', '\x44\x64\x75\x30\x6d\x53\x6b\x74', '\x6f\x65\x56\x63\x54\x48\x30\x2b', '\x57\x52\x31\x44\x57\x52\x54\x4b\x72\x57\x3d\x3d', '\x79\x6d\x6f\x65\x57\x36\x66\x53', '\x78\x43\x6f\x74\x6a\x31\x37\x64\x4b\x47\x3d\x3d', '\x73\x43\x6b\x78\x70\x65\x71\x6c', '\x74\x43\x6b\x46\x6f\x65\x30\x61', '\x71\x43\x6b\x6a\x57\x52\x42\x64\x4a\x6d\x6b\x56', '\x57\x50\x79\x53\x57\x35\x66\x65\x62\x47\x3d\x3d', '\x6e\x4e\x75\x72\x75\x63\x34\x3d', '\x64\x71\x6d\x56\x76\x31\x69\x3d', '\x42\x43\x6f\x34\x70\x53\x6b\x69\x6f\x57\x3d\x3d', '\x62\x6d\x6b\x58\x57\x51\x4a\x64\x4d\x65\x30\x3d', '\x46\x53\x6f\x36\x6a\x4d\x2f\x64\x4f\x47\x3d\x3d', '\x57\x50\x4b\x58\x57\x36\x50\x75\x75\x47\x3d\x3d', '\x57\x52\x56\x63\x4f\x78\x6e\x77\x6e\x71\x3d\x3d', '\x41\x53\x6b\x57\x57\x36\x74\x64\x52\x6d\x6f\x73', '\x57\x52\x78\x63\x55\x33\x71\x77\x70\x61\x3d\x3d', '\x57\x34\x74\x63\x4b\x58\x74\x63\x4a\x75\x65\x3d', '\x57\x37\x4a\x64\x50\x76\x4a\x64\x4f\x43\x6b\x72', '\x57\x34\x42\x64\x52\x4d\x6c\x64\x4a\x6d\x6f\x6b', '\x57\x37\x62\x69\x57\x37\x6c\x64\x54\x71\x3d\x3d', '\x65\x66\x33\x63\x4d\x59\x61\x69', '\x64\x48\x37\x63\x47\x53\x6b\x4f\x57\x51\x53\x3d', '\x45\x61\x75\x2b\x65\x53\x6b\x4e', '\x57\x34\x35\x6f\x41\x43\x6b\x35\x43\x61\x3d\x3d', '\x57\x37\x64\x63\x50\x4a\x64\x63\x54\x66\x71\x3d', '\x57\x4f\x64\x64\x4e\x4b\x6c\x64\x54\x71\x3d\x3d', '\x57\x50\x5a\x64\x50\x53\x6b\x33\x57\x36\x50\x4f', '\x61\x72\x30\x38\x76\x30\x4f\x3d', '\x57\x4f\x31\x51\x63\x47\x56\x63\x4c\x47\x3d\x3d', '\x57\x34\x35\x31\x79\x57\x52\x64\x4c\x57\x3d\x3d', '\x57\x52\x33\x63\x51\x33\x39\x34\x57\x34\x57\x3d', '\x45\x53\x6f\x71\x57\x35\x35\x73\x63\x61\x3d\x3d', '\x57\x35\x71\x4f\x72\x43\x6f\x57\x57\x50\x43\x3d', '\x57\x34\x4a\x63\x4f\x57\x47\x43\x57\x34\x38\x3d', '\x78\x38\x6b\x66\x71\x67\x6c\x63\x56\x61\x3d\x3d', '\x57\x35\x78\x63\x54\x73\x34\x79', '\x6b\x4e\x68\x64\x50\x38\x6f\x68\x57\x50\x38\x3d', '\x78\x43\x6f\x4e\x57\x4f\x4f\x72', '\x78\x43\x6b\x57\x57\x36\x56\x64\x56\x6d\x6f\x67', '\x57\x35\x4a\x63\x55\x53\x6b\x51\x78\x63\x57\x3d', '\x57\x4f\x68\x63\x51\x68\x61\x6c\x6b\x61\x3d\x3d', '\x77\x74\x56\x63\x51\x43\x6f\x39\x57\x36\x6d\x3d', '\x45\x53\x6b\x47\x61\x38\x6f\x6c\x57\x37\x69\x3d', '\x57\x34\x75\x63\x6c\x58\x53\x79'];
x0a.forEach(v => console.log(v));
Decoded:
const arr = [
"W4hdIc4XCq==",
"W4ddIM/dLmkP",
"smkklae4",
"p2KIsYq=",
"Ddu0mSkt",
"oeVcTH0+",
"WR1DWRTKrW==",
"ymoeW6fS",
"xCotj17dKG==",
"sCkxpeql",
"tCkFoe0a",
"qCkjWRBdJmkV",
"WPySW5febG==",
"nNuruc4=",
"dqmVv1i=",
"BCo4pSkioW==",
"bmkXWQJdMe0=",
"FSo6jM/dOG==",
"WPKXW6PuuG==",
"WRVcOxnwnq==",
"ASkWW6tdRmos",
"WRxcU3qwpa==",
"W4tcKXtcJue=",
"W7JdPvJdOCkr",
"W4BdRMldJmok",
"W7biW7ldTq==",
"ef3cMYai",
"dH7cGSkOWQS=",
"Eau+eSkN",
"W45oACk5Ca==",
"W7dcPJdcTfq=",
"WOddNKldTq==",
"WPZdPSk3W6PO",
"ar08v0O=",
"WO1QcGVcLG==",
"W451yWRdLW==",
"WR3cQ394W4W=",
"ESoqW55sca==",
"W5qOrCoWWPC=",
"W4JcOWGCW48=",
"x8kfqglcVa==",
"W5xcTs4y",
"kNhdP8ohWP8=",
"xCoNWOOr",
"xCkWW6VdVmog",
"W5JcUSkQxcW=",
"WOhcQhalka==",
"wtVcQCo9W6m=",
"ESkGa8olW7i=",
"W4uclXSy",
];

How to force my script to load after an asynchronous, external script?

I have a script that is modifying a Shopify App (Which means the scripts are attached through a third party process and I can't access them.) I want my script to load only after their script is completely finished executing, but I can't figure out what to use to signal this process is complete.
This is my script (currently using setInterval as a stopgap):
$(window).load(function(){
var check = setInterval(function() {
let sprCheck = window['SPR'];
var spr = $("#shopify-product-reviews"),
container = spr.find(".spr-content"),
reviewButton = spr.find(".spr-summary-actions-newreview");
if (sprCheck) {
clearInterval(check);
var reviews = spr.find('.spr-reviews'),
reviewButtonWrap = spr.find('.spr-summary-actions'),
form = spr.find('.spr-form'),
toggleContainer = spr.find('.spr-summary-actions-togglereviews'),
reviewButtonLabel = reviewButton.text();
reviewButtonWrap.detach().appendTo(container);
spr.css('overflow','visible');
form.detach().insertAfter(reviews);
if (reviews.children().length) {
reviewButtonWrap.css('display', 'none');
}
toggleContainer.click(function() {
reviewButtonWrap.toggle();
});
spr.fadeTo(300, 1);
reviewButton.click(function(){
if (form.is(':visible')) {
reviewButton.text('Cancel Review');
reviewButton.addClass('spr-close-form');
} else {
reviewButton.text(reviewButtonLabel);
reviewButton.removeClass('spr-close-form');
}
});
}
}, 300);
})
This is where their script is attached:
(function() {
function asyncLoad() {
var urls = ["\/\/productreviews.shopifycdn.com\/assets\/v4\/spr.js?shop=sukker-sweet-phase-2.myshopify.com"];
for (var i = 0; i < urls.length; i++) {
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = urls[i];
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
}
};
if(window.attachEvent) {
window.attachEvent('onload', asyncLoad);
} else {
window.addEventListener('load', asyncLoad, false);
}
})();
This is their script itself:
e = function() {
"use strict";
window.innerShiv = function() {
function n(e, t, r) {
return /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i.test(r) ? e : t + "></" + r + ">"
}
var s, o = document,
d = "abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video".split(" ");
return function(e, t) {
if (!s && ((s = o.createElement("div")).innerHTML = "<nav></nav>", 1 !== s.childNodes.length)) {
for (var r = o.createDocumentFragment(), a = d.length; a--;) r.createElement(d[a]);
r.appendChild(s)
}
if (e = e.replace(/^\s\s*/, "").replace(/\s\s*$/, "").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/(<([\w:]+)[^>]*?)\/>/g, n), s.innerHTML = (r = e.match(/^<(tbody|tr|td|col|colgroup|thead|tfoot)/i)) ? "<table>" + e + "</table>" : e, r = r ? s.getElementsByTagName(r[1])[0].parentNode : s, !1 === t) return r.childNodes;
a = o.createDocumentFragment();
for (var i = r.childNodes.length; i--;) a.appendChild(r.firstChild);
return a
}
}()
}, t = {
exports: {}
}, e.call(t.exports, t, t.exports), t.exports;
var e, t;
(function() {
window.SPR = function() {
function n() {}
return n.shop = Shopify.shop, n.host = "//productreviews.shopifycdn.com", n.version = "v4", n.api_url = n.host + "/proxy/" + n.version, n.badgeEls = [], n.reviewEls = [], n.elSettings = {}, n.$ = void 0, n.extraAjaxParams = {
shop: n.shop
}, n.registerCallbacks = function() {
return this.$(document).bind("spr:badge:loaded", "undefined" != typeof SPRCallbacks && null !== SPRCallbacks ? SPRCallbacks.onBadgeLoad : void 0), this.$(document).bind("spr:product:loaded", "undefined" != typeof SPRCallbacks && null !== SPRCallbacks ? SPRCallbacks.onProductLoad : void 0), this.$(document).bind("spr:reviews:loaded", "undefined" != typeof SPRCallbacks && null !== SPRCallbacks ? SPRCallbacks.onReviewsLoad : void 0), this.$(document).bind("spr:form:loaded", "undefined" != typeof SPRCallbacks && null !== SPRCallbacks ? SPRCallbacks.onFormLoad : void 0), this.$(document).bind("spr:form:success", "undefined" != typeof SPRCallbacks && null !== SPRCallbacks ? SPRCallbacks.onFormSuccess : void 0), this.$(document).bind("spr:form:failure", "undefined" != typeof SPRCallbacks && null !== SPRCallbacks ? SPRCallbacks.onFormFailure : void 0)
}, n.loadStylesheet = function() {
var e;
return (e = document.createElement("link")).setAttribute("rel", "stylesheet"), e.setAttribute("type", "text/css"), e.setAttribute("href", "https://productreviews.shopifycdn.com/assets/v4/spr-805222bdeda8199e3a86a468a398e3070e6126868692225ffa23ac7502b1eca2.css"), e.setAttribute("media", "screen"), document.getElementsByTagName("head")[0].appendChild(e)
}, n.initRatingHandler = function() {
return n.$(document).on("mouseover mouseout", "form a.spr-icon-star", function(e) {
var t, r, a;
return t = e.currentTarget, a = n.$(t).attr("data-value"), r = n.$(t).parent(), "mouseover" === e.type ? (r.find("a.spr-icon:lt(" + a + ")").addClass("spr-icon-star-hover"), r.find("a.spr-icon:gt(" + (a - 1) + ")").removeClass("spr-icon-star-hover")) : r.find("a.spr-icon").removeClass("spr-icon-star-hover")
})
}, n.initDomEls = function() {
return this.badgeEls = this.$(".shopify-product-reviews-badge[data-id]"), this.reviewEls = this.$("#shopify-product-reviews[data-id]"), this.$.each(this.reviewEls, (a = this, function(e, t) {
var r;
return r = a.$(t).attr("data-id"), a.elSettings[r] = {}, a.elSettings[r].reviews_el = "#" + (a.$(t).attr("data-reviews-prefix") ? a.$(t).attr("data-reviews-prefix") : "reviews_"), a.elSettings[r].form_el = "#" + (a.$(t).attr("data-form-prefix") ? a.$(t).attr("data-form-prefix") : "form_")
}));
var a
}, n.loadProducts = function() {
return this.$.each(this.reviewEls, (i = this, function(e, t) {
var r, a;
if (r = i.$(t).attr("data-id"), "false" !== i.$(t).attr("data-autoload")) return a = i.$.extend({
product_id: r,
version: i.version
}, i.extraAjaxParams), i.$.get(i.api_url + "/reviews/product", a, i.productCallback, "jsonp")
}));
var i
}, n.loadBadges = function() {
var e, t, r, a, i, n;
if (0 < (r = this.$.map(this.badgeEls, (n = this, function(e) {
return n.$(e).attr("data-id")
}))).length) {
for (t = 7, i = []; 0 < (e = r.splice(0, t)).length;) a = this.$.extend(this.extraAjaxParams, {
product_ids: e
}), i.push(this.$.get(this.api_url + "/reviews/badges", a, this.badgesCallback, "jsonp"));
return i
}
}, n.pageReviews = function(e) {
var t, r, a;
return a = this.$(e).data("product-id"), r = this.$(e).data("page"), t = this.$.extend({
page: r,
product_id: a
}, this.extraAjaxParams), this.$.get(this.api_url + "/reviews", t, this.paginateCallback, "jsonp"), !1
}, n.submitForm = function(e) {
var t, r, a;
return t = this.$(e).serializeObject(), t = this.$.extend(t, this.extraAjaxParams), t = (t = this.$.param(t)).replace(/%0D%0A/g, "%0A"), this.$.ajax({
url: this.api_url + "/reviews/create",
type: "GET",
dataType: "jsonp",
data: t,
success: this.formCallback,
beforeSend: (a = this, function() {
return a.$(".spr-button-primary").attr("disabled", "disabled")
}),
complete: (r = this, function() {
return r.$(".spr-button-primary").removeAttr("disabled")
})
}), !1
}, n.reportReview = function(e) {
var t;
return confirm("Are you sure you want to report this review as inappropriate?") && (t = this.$.extend({
id: e
}, this.extraAjaxParams), this.$.get(this.api_url + "/reviews/report", t, this.reportCallback, "jsonp")), !1
}, n.toggleReviews = function(e) {
return this.$("#shopify-product-reviews[data-id='" + e + "']").find(".spr-reviews").toggle()
}, n.toggleForm = function(e) {
return this.$("#shopify-product-reviews[data-id='" + e + "']").find(".spr-form").toggle()
}, n.setRating = function(e) {
var t, r, a;
return t = this.$(e).parents("form"), a = this.$(e).attr("data-value"), r = this.$(e).parent(), t.find("input[name='review[rating]']").val(a), this.setStarRating(a, r)
}, n.setStarRating = function(e, t) {
return t.find("a:lt(" + e + ")").removeClass("spr-icon-star-empty spr-icon-star-hover"), t.find("a:gt(" + (e - 1) + ")").removeClass("spr-icon-star-hover").addClass("spr-icon-star-empty")
}, n.badgesCallback = function(e) {
var r;
return r = e.badges, n.$.map(n.badgeEls, function(e) {
var t;
if (t = n.$(e).attr("data-id"), r[t] !== undefined) return n.$(e).replaceWith(r[t]), n.triggerEvent("spr:badge:loaded", {
id: t
})
})
}, n.productCallback = function(e) {
var t;
return t = e.remote_id.toString(), n.renderProduct(t, e.product_stripped, e.aggregate_rating), n.renderForm(t, e.form), n.renderReviews(t, e.reviews)
}, n.renderProduct = function(t, r, a) {
return this.$.map(this.reviewEls, (i = this, function(e) {
if (t === i.$(e).attr("data-id")) return i.$(e).html([innerShiv(r, !1), a]), i.triggerEvent("spr:product:loaded", {
id: t
})
}));
var i
}, n.renderForm = function(e, t) {
return this.$(this.elSettings[e].form_el + e).html(t), this.triggerEvent("spr:form:loaded", {
id: e
})
}, n.renderReviews = function(e, t) {
return n.$(n.elSettings[e].reviews_el + e).html(t), n.triggerEvent("spr:reviews:loaded", {
id: e
})
}, n.formCallback = function(e) {
var t, r, a, i;
return i = e.status, a = e.remote_id, r = e.form, (t = n.$(n.elSettings[a].form_el + a)).html(r), "failure" === i && n.initStarRating(t), "success" === i && (n.$("#shopify-product-reviews[data-id='" + a + "'] .spr-summary-actions-newreview").hide(), n.$(".spr-form-message-success").focus()), n.triggerEvent("spr:form:" + i, {
id: a
})
}, n.initStarRating = function(e) {
var t, r, a;
if ((a = e.find("input[name='review[rating]']")) && a.val()) return r = a.val(), t = e.find(".spr-starrating"), this.setStarRating(r, t)
}, n.paginateCallback = function(e) {
var t, r;
return r = e.remote_id.toString(), t = e.reviews, n.renderReviews(r, t)
}, n.reportCallback = function(e) {
var t;
return t = "#report_" + e.id, n.$(t).replaceWith("<span class='spr-review-reportreview'>" + n.$(t).attr("data-msg") + "</span>")
}, n.loadjQuery = function(e) {
return n.loadScript("//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js", function() {
return n.$ = jQuery.noConflict(!0), e()
})
}, n.loadScript = function(e, t) {
var r;
return (r = document.createElement("script")).type = "text/javascript", r.readyState ? r.onreadystatechange = function() {
if ("loaded" === r.readyState || "complete" === r.readyState) return r.onreadystatechange = null, t()
} : r.onload = function() {
return t()
}, r.src = e, document.getElementsByTagName("head")[0].appendChild(r)
}, n.loadjQueryExtentions = function(r) {
return r.fn.serializeObject = function() {
var e, t;
return e = {}, t = this.serializeArray(), r.each(t, function() {
return e[this.name] ? (e[this.name].push || (e[this.name] = [e[this.name]]), e[this.name].push(this.value || "")) : e[this.name] = this.value || ""
}), e
}
}, n.triggerEvent = function(e, t) {
return this.$(document).trigger(e, t)
}, n
}(), SPR.loadStylesheet(), SPR.loadjQuery(function() {
return SPR.$.ajaxSetup({
cache: !1
}), SPR.loadjQueryExtentions(SPR.$), SPR.$(document).ready(function() {
return SPR.registerCallbacks(), SPR.initRatingHandler(), SPR.initDomEls(), SPR.loadProducts(), SPR.loadBadges()
})
})
}).call(this)
}("undefined" != typeof global ? global : "undefined" != typeof window && window);
Where their script is attached, you could try adding an onload attribute:
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.onload = "functionToRunMyOwnScript()"
If you can't access the place where it's attached, I personally don't think there's anything wrong with using the interval, as you're currently doing.
I think you have 2 options.
like you do it (check again and again if the changes are done)
use MutationObserver , if you wanna go this way, make sure to test this heavly.
To your solution, I think what you miss is a better check (sprCheck). If you say sometimes the function is triggered when the element exists, but is not at the right spot yet, then you also have to check if the element is on the right check before you continue.

Asynchronous function is not working in order of process

I'm working with asynchronous javascript in NodeJS. I have a function, that modifies it's parameters and then resolve and emits to SocketIO client. The problem is, the function doesn't process the lines in order, it makes some process first and some process after it, I think it is just about asynchronous JavaScript problem, but I can't understand what to do for solve this.
My function,
const processStylesAndImages = (target, targetSlug, id, socket, styles, images, protocol, CSS, DOM) => {
return new Promise(async (resolve, reject) => {
let { coverage } = await CSS.takeCoverageDelta();
let { nodes } = await DOM.getFlattenedDocument({ depth: -1 });
styles = styles.filter(style => !style.isInline && style.sourceURL.trim().length > 0);
for(let style of styles) {
style.mediaQueries = [];
let m;
while(m = mediaQueryRegex.exec(style.css)) {
style.mediaQueries.push({
startOffset: m.index,
endOffset: m.index + m[0].length,
rule: style.css.slice(m.index, m.index + m[0].length),
used: true,
rules: []
});
}
style.used = [];
while(m = charsetRegex.exec(style.css)) {
style.used.push({
startOffset: m.index,
endOffset: m.index + m[0].length,
used: true,
styleSheetId: style.styleSheetId
});
}
while(m = importRegexVariable.exec(style.css)) {
style.used.push({
startOffset: m.index,
endOffset: m.index + m[0].length,
used: true,
styleSheetId: style.styleSheetId
});
}
let fontFaces = [];
while(m = fontFaceRegex.exec(style.css)) {
fontFaces.push(m);
}
fontFaces.forEach((m, index) => {
let pushed = false;
let props = css.parse(style.css.slice(m.index, m.index + m[0].length)).stylesheet.rules[0].declarations;
let fontFamily;
let fontWeight = null;
props.forEach(prop => {
if(prop.property == 'font-family') {
if(prop.value.startsWith("'") || prop.value.startsWith('"')) {
prop.value = prop.value.slice(1);
}
if(prop.value.endsWith("'") || prop.value.endsWith('"')) {
prop.value = prop.value.slice(0, -1);
}
prop.value = prop.value.toLowerCase();
fontFamily = prop.value;
} else if(prop.property == 'font-weight') {
fontWeight = prop.value;
}
});
if(fontWeight == null || 'normal') fontWeight = 400;
if(style.sourceURL == 'https://www.webmedya.com.tr/css/font-awesome.min.css') console.log(fontFamily, fontWeight);
nodes.forEach(async (node, nodeIndex) => {
let { computedStyle } = await CSS.getComputedStyleForNode({ nodeId: node.nodeId });
computedStyle = computedStyle.filter(item => {
return (item.name == 'font-family' || item.name == 'font-weight') && (item.value !== '' || typeof(item.value) !== 'undefined');
});
let elementFontFamily;
let elementFontWeight;
computedStyle.forEach(compute => {
if(compute.name == 'font-family' && compute.value !== '' && typeof(compute.value) !== 'undefined') {
elementFontFamily = compute.value.toLowerCase();
} else if(compute.name == 'font-weight') {
if(compute.value !== '' && typeof(compute.value) !== 'undefined') {
if(compute.value == 'normal') {
elementFontWeight = 400;
} else {
elementFontWeight = compute.value;
}
} else {
elementFontWeight = 400;
}
}
});
if(elementFontFamily && elementFontWeight) {
if(elementFontFamily.includes(fontFamily) && (elementFontWeight == fontWeight)) {
if(!pushed) {
//console.log(m);
style.used.push({
startOffset: m.index,
endOffset: m.index + m[0].length,
used: true,
styleSheetId: style.styleSheetId
});
pushed = true;
console.log('Pushed', style.css.slice(m.index, m.index + m[0].length));
}
}
}
});
});
console.log('BBBBBBBBBBBBB');
console.log('AAAAAAAAAAAA');
let parsedSourceURL = url.parse(style.sourceURL.trim());
if(parsedSourceURL.protocol === null && parsedSourceURL.host === null) {
if(style.sourceURL.trim().startsWith('/')) {
style.sourceURL = `${target}${style.sourceURL.trim()}`;
} else {
style.sourceURL = `${target}/${style.sourceURL.trim()}`;
}
};
style.parentCSS = "-1";
style.childCSSs = [];
style.childCSSs = getImports(style.css, style.sourceURL.trim(), target);
coverage.forEach(item => {
if(item.styleSheetId.trim() == style.styleSheetId.trim())
style.used.push(item);
});
style.mediaQueries.forEach((mediaQuery, index) => {
style.used.forEach((usedRule, usedIndex) => {
if(usedRule.startOffset > mediaQuery.startOffset && usedRule.endOffset < mediaQuery.endOffset) {
style.mediaQueries[index].rules.push(style.used[usedIndex]);
style.used[usedIndex] = false;
}
});
});
style.used = style.used.filter(item => {
return item !== false;
});
style.mediaQueries = style.mediaQueries.filter(item => {
return item.rules.length > 0;
});
style.mediaQueries.forEach((mediaQuery, index) => {
mediaQuery.rules.sort((a, b) => a.startOffset - b.startOffset);
});
style.used = style.used.concat(style.mediaQueries);
delete style.mediaQueries;
style.used.sort((a, b) => a.startOffset - b.startOffset);
let compressedCss = "";
if(style.used.length > 0) {
style.used.forEach(usedRule => {
if(usedRule.rule && usedRule.rules.length > 0) {
let queryRule = usedRule.rule.match(/#media[^{]+/)[0];
compressedCss += queryRule + '{';
usedRule.rules.forEach(item => {
compressedCss += style.css.slice(item.startOffset, item.endOffset);
});
compressedCss += '}';
} else {
compressedCss += style.css.slice(usedRule.startOffset, usedRule.endOffset);
}
});
};
style.compressedCss = compressedCss;
}
console.log('CCCCCCCCCCCCCCCCCCCC');
styles = preTraverse(styles, targetSlug, id);
debug('CSS Dosyaları İşlendi!');
fs.readFile(`./data/${targetSlug}/${id}/cimg/statistics.json`, async (err, data) => {
if(err) reject(err);
try {
data = JSON.parse(data);
await CSS.stopRuleUsageTracking();
await protocol.close();
if(typeof(styles) !== 'undefined' && styles.length > 0) {
debug('IMG Dosyaları İşlendi!');
socket.emit('log', { stage: 6, images, data, styles });
resolve({ images, data, styles });
} else {
debug('IMG Dosyaları İşlendi!');
socket.emit('log', { stage: 6, images, data, styles: [] });
resolve({ images, data, styles: [] });
};
} catch(e) {
reject(e);
};
});
});
};
Results when the functions starts for some parameters,
BBBBBBBBBBBBB
AAAAAAAAAAAA
fontawesome 400
BBBBBBBBBBBBB
AAAAAAAAAAAA
BBBBBBBBBBBBB
AAAAAAAAAAAA
CCCCCCCCCCCCCCCCCCCC
Pushed #font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.7.0');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}
Pushed #font-face{font-family:open sans;font-style:normal;font-weight:300;src:local('Open Sans Light'),local('OpenSans-Light'),url(https://fonts.gstatic.com/s/opensans/v15/DXI1ORHCpsQm3Vp6mXoaTa-j2U0lmluP9RWlSytm3ho.woff2) format('woff2');unicode-range:U+0460-052F,U+20B4,U+2DE0-2DFF,U+A640-A69F}
Pushed #font-face{font-family:open sans;font-style:normal;font-weight:300;src:local('Open Sans Light'),local('OpenSans-Light'),url(https://fonts.gstatic.com/s/opensans/v15/DXI1ORHCpsQm3Vp6mXoaTZX5f-9o1vgP2EXwfjgl7AY.woff2) format('woff2');unicode-range:U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
The expected result is,
BBBBBBBBBBBBB
AAAAAAAAAAAA
fontawesome 400
Pushed #font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.7.0');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}
BBBBBBBBBBBBB
AAAAAAAAAAAA
Pushed #font-face{font-family:open sans;font-style:normal;font-weight:300;src:local('Open Sans Light'),local('OpenSans-Light'),url(https://fonts.gstatic.com/s/opensans/v15/DXI1ORHCpsQm3Vp6mXoaTa-j2U0lmluP9RWlSytm3ho.woff2) format('woff2');unicode-range:U+0460-052F,U+20B4,U+2DE0-2DFF,U+A640-A69F}
Pushed #font-face{font-family:open sans;font-style:normal;font-weight:300;src:local('Open Sans Light'),local('OpenSans-Light'),url(https://fonts.gstatic.com/s/opensans/v15/DXI1ORHCpsQm3Vp6mXoaTZX5f-9o1vgP2EXwfjgl7AY.woff2) format('woff2');unicode-range:U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
BBBBBBBBBBBBB
AAAAAAAAAAAA
CCCCCCCCCCCCCCCCCCCC
The function is skips the for loop at line 6 in JSFiddle. It behaves like asynchronous process, but I want to it behave like synchronous.
Thanks!
You should await the new Promise((res, rej) => { promise on line 39 in your fiddle. You create a promise with .then() and .catch() handlers which you run it within your loop, but don't await it. Meaning, the promise is triggered, but the code continues to the next iteration already.
So try to add await in front of that new Promise(...) on line 39 and run it.

How to query almost the entire postgresql database for a property on every item? (Using sequelize and Node.js)

I'm trying to scan through an entire tree in my database, looking for two properties ('title' and 'id') for every item, and then I need to check if there's a linked database table below the current table, and if so, I need to perform the same actions on that table.
Once I get the whole tree, I need to insert those into a master variable that I can then import elsewhere throughout my web app.
(I'm at the point where I'm pretty sure I'm reinventing the wheel. I've searched the Sequelize documentation, but if there's a simple solution, I didn't see it.)
Here's the relevant portions of my current code (it's not fully working yet, but should give the idea).
(You can find the full project repository by clicking this link here.)
```
const buildTopicTreeFromCurrentDatabase = (callback) => {
let topicTree = [];
let isFinished = false;
const isSearchFinished = new Emitter();
console.log(`emitter created`);
isSearchFinished.on('finished', () => {
console.log(`the search is done`);
if (isFinished = true) {
callback(null, this.primaryTopicsShort)
};
});
/* need to go back and refactor -- violates DRY */
this.primaryTopicsShort = [];
PrimaryTopic.all()
.then((primaryTopics) => {
if (primaryTopics.length === 0) {
return callback('no Primary Topics defined');
}
for (let i = 0; i < primaryTopics.length; i++) {
this.primaryTopicsShort[i] = {
title: primaryTopics[i].title,
id: primaryTopics[i].id,
secondaryTopics: []
};
PrimaryTopic.findById(this.primaryTopicsShort[i].id, {
include: [{
model: SecondaryTopic,
as: 'secondaryTopics'
}]
})
.then((currentPrimaryTopic) => {
if (currentPrimaryTopic.secondaryTopics.length !== 0) {
for (let j = 0; j < currentPrimaryTopic.secondaryTopics.length; j++) {
this.primaryTopicsShort[i].secondaryTopics[j] = {
title: currentPrimaryTopic.secondaryTopics[j].title,
id: currentPrimaryTopic.secondaryTopics[j].id,
thirdTopics: []
};
SecondaryTopic.findById(this.primaryTopicsShort[i].secondaryTopics[j].id, {
include: [{
model: ThirdTopic,
as: 'thirdTopics'
}]
})
.then((currentSecondaryTopic) => {
if (currentPrimaryTopic.secondaryTopics.length - 1 === j) {
isSearchFinished.emit('finished');
}
if (currentSecondaryTopic.thirdTopics.length !== 0) {
for (let k = 0; k < currentSecondaryTopic.thirdTopics.length; k++) {
this.primaryTopicsShort[i].secondaryTopics[j].thirdTopics[k] = {
title: currentSecondaryTopic.thirdTopics[k].title,
id: currentSecondaryTopic.thirdTopics[k].id,
fourthTopics: []
};
ThirdTopic.findById(this.primaryTopicsShort[i].secondaryTopics[j].thirdTopics[k].id, {
include: [{
model: FourthTopic,
as: 'fourthTopics'
}]
})
.then((currentThirdTopics) => {
if (currentThirdTopics.fourthTopics.length !== 0) {
for (let l = 0; l < currentThirdTopics.fourthTopics.length; l++) {
this.primaryTopicsShort[i].secondaryTopics[j].thirdTopics[k].fourthTopics[k] = {
title: currentThirdTopics.fourthTopics[l].title,
id: currentThirdTopics.fourthTopics[l].id,
fifthTopics: []
}
FourthTopic.findById(this.primaryTopicsShort[i].secondaryTopics[j].thirdTopics[k].fourthTopics[l].id, {
include: [{
model: FifthTopic,
as: 'fifthTopics'
}]
})
.then((currentFourthTopics) => {
if (currentFourthTopics.fifthTopics.length !== 0) {
for (let m = 0; m < currentFourthTopics.fifthTopics.length; m++) {
this.primaryTopicsShort[i].secondaryTopics[j].thirdTopics[k].fourthTopics[k].fifthTopics[m] = {
title: currentFourthTopics.fifthTopics[m].title,
id: currentFourthTopics.fifthTopics[m].id
}
}
}
})
.catch((err) => {
callback(err);
});
}
}
})
.catch((err) => {
callback(err)
});
}
}
})
.catch((err) => {
callback(err);
})
}
}
})
.catch((err) => {
callback(err);
})
}
})
.catch((err) => {
callback(err);
});
};
There are a few problems with this code.
First, I need to be using a DRY and recursive solution, since the database structure may change in the future.
Second, I've played around a lot with the 'finished' emitter, but I haven't figured out yet how to place it so that the event is emitted at the end of searching the database, and also so that I don't cycle back through the database multiple times.
I've been working on the following recursive solution, but the hours keep stretching by and I don't feel like I'm getting anywhere.
const buildDatabaseNames = (DatabaseNameStr, callback) => {
let camelSingular = DatabaseNameStr.slice(0,1);
camelSingular = camelSingular.toLowerCase();
camelSingular = camelSingular + DatabaseNameStr.slice(1, DatabaseNameStr.length);
let camelPlural = DatabaseNameStr.slice(0,1);
camelPlural = camelPlural.toLowerCase();
camelPlural = camelPlural + DatabaseNameStr.slice(1, DatabaseNameStr.length) + 's';
let databaseNameStr = `{ "capsSingular": ${"\"" + DatabaseNameStr + "\""}, "capsPlural": ${"\"" + DatabaseNameStr + 's' + "\""}, "camelSingular": ${"\"" + camelSingular + "\""}, "camelPlural": ${"\"" + camelPlural + "\""} }`;
let names = JSON.parse(databaseNameStr);
return callback(names);
};
const isAnotherDatabase = (DatabaseName, id, NextDatabaseName) => {
DatabaseName.findById({
where: {
id: id
}
})
.then((res) => {
if (typeof res.NextDatabaseName === undefined) {
return false;
} else if (res.NextDatabaseName.length === 0) {
return false;
} else {
return true;
}
})
.catch((err) => {
console.error(err);
process.exit();
});
};
const searchDatabase = (first, i, current, next, list, callback) => {
if (typeof first === 'string') {
first = buildDatabaseNames(first);
current = buildDatabaseNames(current);
next = buildDatabaseNames(next);
}
if (first === current) {
this.first = current;
let topicTree = [];
const isSearchFinished = new Emitter();
console.log(`emitter created`);
isSearchFinished.on('finished', () => {
console.log(`the search is done`);
callback(null, this.primaryTopicsShort);
});
}
current.CapsSingular.all()
.then((res) => {
current.camelPlural = res;
if (if current.camelPlural.length !== 0) {
for (let j = 0; j < currentParsed.camelPlural.length; j++) {
if (first === current) {
this.first[i].current[j].title = current.camelPlural[j].title,
this.first[i].current[j].id = current.camelPlural[j].id
next.camelSingular = []
} else {
this.first[i]..current[j].title = current.camelPlural[j].title,
this.first[i].id = current.camelPlural[j].id,
next.camelSingular = []
}
let isNext = isAnotherDatabase(current.)
searchDatabase(null, j, next, list[i + 1], list, callback).bind(this);
}
} else {
callback(null, this.first);
}
})
.catch((err) => {
callback(err);
});
};
I decided to stop and ask for help, as I just realized that in order to make the properties (this.first[i].current[j].title = current.camelPlural[j].title) on each recursive iteration accurate, I'll have to do a JSON.stringify, alter the string for the next iteration, place all the required iterations of itinto a variable, pass it into the next recursion, and then do JSON.parse again afterwards. It seems like I'm making this ridiculously complicated?
Any help is appreciated, thank you.
While I wasn't able to make a recursive, generic solution, I did at least find some result.
const buildTopicTreeFromCurrentDatabase = (callback) => {
let topicTree = [];
const isSearchFinished = new Emitter();
isSearchFinished.on('finished', () => {
if (isFinished === 0) {
callback(null, this.primaryTopicsShort);
};
});
/* need to go back and refactor -- violates DRY */
this.primaryTopicsShort = [];
let isFinished = 0;
isFinished = isFinished++;
PrimaryTopic.all()
.then((primaryTopics) => {
isFinished = isFinished + primaryTopics.length;
if (primaryTopics.length === 0) {
return callback('no Primary Topics defined');
}
for (let i = 0; i < primaryTopics.length; i++) {
if (i === 0) {
var isLastPrimary = false;
};
this.primaryTopicsShort[i] = {
title: primaryTopics[i].title,
id: primaryTopics[i].id,
secondaryTopics: []
};
PrimaryTopic.findById(this.primaryTopicsShort[i].id, {
include: [{
model: SecondaryTopic,
as: 'secondaryTopics'
}]
})
.then((currentPrimaryTopic) => {
isFinished = isFinished - 1 + currentPrimaryTopic.secondaryTopics.length;
if (i === primaryTopics.length - 1) {
isLastPrimary = true;
};
if (currentPrimaryTopic.secondaryTopics.length === 0 && isLastPrimary) {
isSearchFinished.emit('finished');
} else if (currentPrimaryTopic.secondaryTopics.length !== 0) {
for (let j = 0; j < currentPrimaryTopic.secondaryTopics.length; j++) {
if (j === 0) {
var isLastSecondary = false;
}
this.primaryTopicsShort[i].secondaryTopics[j] = {
title: currentPrimaryTopic.secondaryTopics[j].title,
id: currentPrimaryTopic.secondaryTopics[j].id,
thirdTopics: []
};
SecondaryTopic.findById(this.primaryTopicsShort[i].secondaryTopics[j].id, {
include: [{
model: ThirdTopic,
as: 'thirdTopics'
}]
})
.then((currentSecondaryTopic) => {
isFinished = isFinished - 1 + currentSecondaryTopic.thirdTopics.length;
if (j === currentPrimaryTopic.secondaryTopics.length - 1) {
isLastSecondary = true;
}
if (currentSecondaryTopic.thirdTopics.length === 0 && isLastPrimary && isLastSecondary) {
isSearchFinished.emit('finished');
} else if (currentSecondaryTopic.thirdTopics.length !== 0) {
for (let k = 0; k < currentSecondaryTopic.thirdTopics.length; k++) {
if (k === 0) {
var isLastThird = false;
};
this.primaryTopicsShort[i].secondaryTopics[j].thirdTopics[k] = {
title: currentSecondaryTopic.thirdTopics[k].title,
id: currentSecondaryTopic.thirdTopics[k].id,
fourthTopics: []
};
ThirdTopic.findById(this.primaryTopicsShort[i].secondaryTopics[j].thirdTopics[k].id, {
include: [{
model: FourthTopic,
as: 'fourthTopics'
}]
})
.then((currentThirdTopic) => {
isFinished = isFinished - 1 + currentThirdTopic.fourthTopics.length;
if (k === currentSecondaryTopic.thirdTopics.length - 1) {
isLastThird = true;
};
if (currentThirdTopic.fourthTopics.length === 0 && isLastPrimary && isLastSecondary && isLastThird) {
isSearchFinished.emit('finished');
} else if (currentThirdTopic.fourthTopics.length !== 0) {
for (let l = 0; l < currentThirdTopic.fourthTopics.length; l++) {
if (l = 0) {
var isLastFourth = false;
}
this.primaryTopicsShort[i].secondaryTopics[j].thirdTopics[k].fourthTopics[k] = {
title: currentThirdTopic.fourthTopics[l].title,
id: currentThirdTopic.fourthTopics[l].id,
fifthTopics: []
}
FourthTopic.findById(this.primaryTopicsShort[i].secondaryTopics[j].thirdTopics[k].fourthTopics[l].id, {
include: [{
model: FifthTopic,
as: 'fifthTopics'
}]
})
.then((currentFourthTopics) => {
isFinished = isFinished - 1 + currentFourthTopics.fifthTopics.length;
if (l = currentThirdTopic.fourthTopics.length - 1) {
isLastFourth = true;
}
if (currentFourthTopic.fifthTopics.length === 0 && isLastPrimary && isLastSecondary && isLastThird && isLastFourth) {
isSearchFinished.emit('finished');
} else if (currentFourthTopic.fifthTopics.length !== 0) {
for (let m = 0; m < currentFourthTopic.fifthTopics.length; m++) {
if (m = 0) {
var isLastFifth = false;
}
if (m === currentFourthTopic.fifthTopics.length - 1) {
isLastFifth = true;
}
this.primaryTopicsShort[i].secondaryTopics[j].thirdTopics[k].fourthTopics[k].fifthTopics[m] = {
title: currentFourthTopic.fifthTopics[m].title,
id: currentFourthTopic.fifthTopics[m].id
};
if (isLastPrimary === true && isLastSecondary === true && isLastThird === true && isLastFourth === true && isLastFifth === true) {
isFinished = isFinished - 1;
isSearchFinished.emit('finished');
};
}
}
})
.catch((err) => {
callback(err);
});
}
}
})
.catch((err) => {
callback(err)
});
}
}
})
.catch((err) => {
callback(err);
})
}
}
})
.catch((err) => {
callback(err);
});
}
})
.catch((err) => {
callback(err);
});
};
I eventually learned that the root of the problem I face was in the asynchronous nature of the database calls.
To prevent the final callback from getting fired before all the calls were complete, I used something called a semaphore. It's a thing used often in other languages, but not often used in JavaScript (so I hear).
You can see how it works by looking at the variable isFinished. The value starts at zero and goes up for every entry it retrieves from the database. When it finishes processing the data, the code subtracts 1 from the total value. The final callback event (in the emitter), can only go off once the isFinished value returns to zero.
This isn't the most elegant solution. As #Timshel said, it probably would have been wiser not to design this database portion not have so many different tables.
But this solution will do for now.
Thanks.

Cannot read property 'innerHTML' of undefined

I'm trying to test an app in salesforce lightning component, but when I load the app (I try this app) I got the error
Cannot read property 'innerHTML' of undefined
The associated code is here :
!(function(t, e) {
var r = function(e) {
(t.execScript || function(e) {
t["eval"].call(t, e)
})(e)
},
i = function(t, e) {
return t instanceof(e || Array)
},
s = document,
n = "getElementsByTagName",
a = "length",
c = "readyState",
l = "onreadystatechange",
u = s[n]("script"),
o = u[u[a] - 1],
f = o.innerHTML.replace(/^\s+|\s+$/g, "");
if (!t.ljs) {
var h = o.src.match(/checkLoaded/) ? 1 : 0,
d = s[n]("head")[0] || s.documentElement,
p = function(t) {
var e = {};
e.u = t.replace(/#(=)?([^#]*)?/g, function(t, r, i) {
e[r ? "f" : "i"] = i;
return ""
});
return e
},
v = function(t, e, r) {
var i = s.createElement(t),
n;
if (r) {
if (i[c]) {
i[l] = function() {
if (i[c] === "loaded" || i[c] === "complete") {
i[l] = null;
r()
}
}
} else {
i.onload = r
}
}
for (n in e) {
e[n] && (i[n] = e[n])
}
d.appendChild(i)
},
m = function(t, e) {
if (this.aliases && this.aliases[t]) {
var r = this.aliases[t].slice(0);
i(r) || (r = [r]);
e && r.push(e);
return this.load.apply(this, r)
}
if (i(t)) {
for (var s = t[a]; s--;) {
this.load(t[s])
}
e && t.push(e);
return this.load.apply(this, t)
}
if (t.match(/\.js\b/) || t.match(/\.sfjs\b/)) {
t = t.replace(".sfjs", "");
return this.loadjs(t, e)
} else if (t.match(/\.css\b/) || t.match(/\.sfcss\b/)) {
t = t.replace(".sfcss", "");
return this.loadcss(t, e)
} else {
return this.loadjs(t, e)
}
},
y = {},
g = {
aliases: {},
loadjs: function(t, r) {
var i = p(t);
t = i.u;
if (y[t] === true) {
r && r();
return this
} else if (y[t] !== e) {
if (r) {
y[t] = function(t, e) {
return function() {
t && t();
e && e()
}
}(y[t], r)
}
return this
}
y[t] = function(e) {
return function() {
y[t] = true;
e && e()
}
}(r);
r = function() {
y[t]()
};
v("script", {
type: "text/javascript",
src: t,
id: i.i,
onerror: function(t) {
if (i.f) {
var e = t.currentTarget;
e.parentNode.removeChild(e);
v("script", {
type: "text/javascript",
src: i.f,
id: i.i
}, r)
}
}
}, r);
return this
},
loadcss: function(t, e) {
var r = p(t);
t = r.u;
y[t] || v("link", {
type: "text/css",
rel: "stylesheet",
href: t,
id: r.i
});
y[t] = true;
e && e();
return this
},
load: function() {
var t = arguments,
r = t[a];
if (r === 1 && i(t[0], Function)) {
t[0]();
return this
}
m.call(this, t[0], r <= 1 ? e : function() {
g.load.apply(g, [].slice.call(t, 1))
});
return this
},
addAliases: function(t) {
for (var e in t) {
this.aliases[e] = i(t[e]) ? t[e].slice(0) : t[e]
}
return this
}
};
if (h) {
var j, b, x, A;
for (j = 0, b = u[a]; j < b; j++) {
(A = u[j].getAttribute("src")) && (y[A.replace(/#.*$/, "")] = true)
}
x = s[n]("link");
for (j = 0, b = x[a]; j < b; j++) {
(x[j].rel === "stylesheet" || x[j].type === "text/css") && (y[x[j].getAttribute("href").replace(/#.*$/, "")] = true)
}
}
t.ljs = g
}
f && r(f)
})(window);
But I'm a novice with javascript and I don't know how to fix it (i'd like to test this app)
Thanks !
That just means that the element that you are looking for does not exist:
var elementNotFound = document.getElementById("noSuchId"); // Does not exist
console.log("The element:", elementNotFound);
console.log(elementNotFound.innerHTML);
As you have posted the mimified JavaScript and no HTML, I don't know how to help further then saying: Make use the ID you are using to find the element is correct and has no spelling mistakes, and that the element is actually in the HTML.
Hope this helps.

Categories