aboutsummaryrefslogtreecommitdiff
path: root/content/botland-shop.js
blob: 0864fca234087ce570a2de83a18b72d6611dacd4 (plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/**
 * SPDX-License-Identifier: CC0-1.0
 *
 * Copyright (C) 2026 Woj. Kosior <koszko@koszko.org>
 */

if (false) { /* #+begin_src background-js */
    jsBlockUrls =
        /* #+begin_src manifest-jq
           .matches =
           # */
    ["https://botland.store/*",
     "https://botland.com.pl/*",
     "https://botland.cz/*",
     "https://botland.de/*"]
} /* #+end_src *both* */

/*
 * Make images and some useful information display on botland.com.pl & friends.
 *
 * The people at botland.com.pl have so far been nice to me and allowed me to
 * make an order via email.  It is therefore possible to buy something from them
 * without running any nonfree JS.
 */

for (const img of document.querySelectorAll('img.lazyload[data-src]')) {
    img.src = img.getAttribute('data-src');
    img.style.opacity = 1;
}

/*
 * The code below has been written back before this simple extension was
 * created.  It hasn't been tested as part of the simple extension, but is
 * nonetheless placed here opportunistically, in case it still proves useful to
 * someone.
 */

for (const varnish of document.querySelectorAll(".varnish-content")) {
    varnish.style.display = "block";
}

for (const widget of
     document.querySelectorAll(".product-availability-widget")) {
    widget.style.display = "initial";
}

for (const placeholder of document.querySelectorAll(".ph-item")) {
    placeholder.remove();
}

let firstAvailabilityBox = true;
for (const box of
     document.querySelectorAll(".product-availability-info__box")) {
    if (firstAvailabilityBox) {
        const span = document.createElement("span");
        span.innerText = box.getAttribute("data-text");
        box.parentElement.replaceWith(span);
        firstAvailabilityBox = false;
    } else {
        box.remove();
    }
}

for (const priceElem of
     document.querySelectorAll(".product-prices-inner, .product-price")) {
    priceElem.classList.remove("visibility-hidden");
}

for (const loader of document.querySelectorAll("i.varnish-loader")) {
    loader.remove();
}