-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbookmarklet.js
40 lines (30 loc) · 1.03 KB
/
bookmarklet.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
javascript: (function () {
if (window.document.location.host.replace("www.", "") != "decathlon.de") {
return;
}
var oDiv = document.createElement("div");
var oSpan = document.createElement("p");
oDiv.setAttribute("class", "topbar");
oDiv.setAttribute("style", "color:#000000; text-align:center;");
models = __DKT._ctx.data[4].data.models;
var text = "";
models.forEach(function (model) {
text += model.webLabel + "<br>";
if (model.colors) {
model.colors.forEach(function (color) {
text += color.label + ", ";
});
text += "<br>";
}
shortTitle = model.webLabel.split(" ")[0];
model.skus.forEach(function (sku) {
text += "" + sku.size + ": " + sku.skuId + ", " + shortTitle;
text += "<br>";
});
text += "<br>";
});
oSpan.innerHTML = text;
document.body.insertBefore(oDiv, document.body.firstChild);
oDiv.appendChild(oSpan);
window.scrollTo(0, 0);
})();