1
|
/**
|
2
|
* SPDX-License-Identifier: CC0-1.0
|
3
|
*
|
4
|
* View OpenCores projects list without nonfree js
|
5
|
*
|
6
|
* Copyright (C) 2021 Wojtek Kosior <koszko@koszko.org>
|
7
|
*
|
8
|
* This program is free software: you can redistribute it and/or modify
|
9
|
* it under the terms of the CC0 1.0 Universal License as published by
|
10
|
* the Creative Commons Corporation.
|
11
|
*
|
12
|
* This program is distributed in the hope that it will be useful,
|
13
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
* CC0 1.0 Universal License for more details.
|
16
|
*/
|
17
|
|
18
|
/* Use with https://www.drmcdougall.com/*** */
|
19
|
|
20
|
const banner_class = "floating-action-button-container";
|
21
|
for (const banner of document.getElementsByClassName(banner_class))
|
22
|
banner.remove()
|
23
|
|
24
|
for (const element of document.body.querySelectorAll("noscript")) {
|
25
|
const replacement = document.createElement('haketilo-noscript');
|
26
|
|
27
|
/*
|
28
|
* Make sure only images get added. For maximum security make sure they
|
29
|
* are using https:// scheme instead of dangerous data:.
|
30
|
*/
|
31
|
for (const subelem of [...replacement.querySelectorAll("*")]) {
|
32
|
if (subelem.tagName !== "IMG")
|
33
|
subelem.remove();
|
34
|
|
35
|
const best_src = subelem.getAttribute('data-src');
|
36
|
if (best_src.startsWith("https://"))
|
37
|
subelem.src = best_src;
|
38
|
else
|
39
|
subelem.remove();
|
40
|
}
|
41
|
|
42
|
element.replaceWith(replacement);
|
43
|
}
|