1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2025-06-05 21:49:31 +02:00

Improved uMatrix Rule Generator (#23)

This commit is contained in:
nobody
2020-06-07 07:54:44 +02:00
parent bb094dad31
commit df8676c95e
3 changed files with 13 additions and 16 deletions

View File

@@ -257,19 +257,17 @@ options._openRuleSet = function({target}) {
let btnCopy = document.getElementById("button-copy-rule-set");
let content = "";
let ruleSyntax = "";
if (optionKey === "uMatrix") {
ruleSyntax = " script allow";
} else if (optionKey === "uBlock") {
ruleSyntax = " * noop";
}
textArea.style.display = "block";
btnCopy.style.display = "block";
for (var domain in urls) {
content += "* " + domain + ruleSyntax + '\n';
if (optionKey === "uMatrix") {
content += "* " + domain + " script allow" + '\n';
content += "* " + domain + " css allow" + '\n';
} else if (optionKey === "uBlock") {
content += "* " + domain + " * noop" + '\n';
}
}
textArea.value = content.replace(/\n+$/, "");
}

View File

@@ -28,6 +28,7 @@
<li>Added: Swiper JS+CSS v4.5.1 and v5.4.2 (<a href="https://codeberg.org/nobody/LocalCDN/issues/22">#22</a>)</li>
<li>Added: Cloudflare Mirage2 (<a href="https://codeberg.org/nobody/LocalCDN/issues/22">#22</a>)</li>
<li>Improved: Help page (<a href="https://codeberg.org/nobody/LocalCDN/issues/22">#22</a>)</li>
<li>Improved: uMatrix Rule Generator (<a href="https://codeberg.org/nobody/LocalCDN/issues/23">#23</a>)</li>
</ul>
<div class="topic-label">
Please update your uBlock/uMatrix rules

View File

@@ -32,19 +32,17 @@ updates._openRuleSet = function({target}) {
let btnCopy = document.getElementById("button-copy-rule-set");
let content = "";
let ruleSyntax = "";
if (updateKey === "uMatrix") {
ruleSyntax = " script allow";
} else if (updateKey === "uBlock") {
ruleSyntax = " * noop";
}
textArea.style.display = "block";
btnCopy.style.display = "block";
for (var domain in urls) {
content += "* " + domain + ruleSyntax + '\n';
if (updateKey === "uMatrix") {
content += "* " + domain + " script allow" + '\n';
content += "* " + domain + " css allow" + '\n';
} else if (updateKey === "uBlock") {
content += "* " + domain + " * noop" + '\n';
}
}
textArea.value = content.replace(/\n+$/, "");
}