1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2024-12-23 00:25:15 +01:00

Ruleset generator for NoScript (#489)

This commit is contained in:
nobody 2021-06-07 06:39:55 +02:00
parent afb70e65d0
commit 601a446dbf
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
4 changed files with 16 additions and 1 deletions

View File

@ -46,6 +46,8 @@ ruleGenerator.openRuleSet = function ({target}) {
content += `* ${domain} * noop\n`; content += `* ${domain} * noop\n`;
} else if (key === 'AdGuard') { } else if (key === 'AdGuard') {
content += `@@||${domain}^\n`; content += `@@||${domain}^\n`;
} else if (key === 'NoScript') {
content += `"$:${domain}",\n`;
} }
} }
textArea.value = content.replace(/\n+$/, ''); textArea.value = content.replace(/\n+$/, '');

View File

@ -95,6 +95,7 @@ optionsAdvanced.init = function (opt) {
document.getElementById('generate-ublock-rules').addEventListener('change', ruleGenerator.openRuleSet); document.getElementById('generate-ublock-rules').addEventListener('change', ruleGenerator.openRuleSet);
document.getElementById('generate-umatrix-rules').addEventListener('change', ruleGenerator.openRuleSet); document.getElementById('generate-umatrix-rules').addEventListener('change', ruleGenerator.openRuleSet);
document.getElementById('generate-adguard-rules').addEventListener('change', ruleGenerator.openRuleSet); document.getElementById('generate-adguard-rules').addEventListener('change', ruleGenerator.openRuleSet);
document.getElementById('generate-noscript-rules').addEventListener('change', ruleGenerator.openRuleSet);
document.getElementById('button-copy-rule-set').addEventListener('click', ruleGenerator.copyRuleSet); document.getElementById('button-copy-rule-set').addEventListener('click', ruleGenerator.copyRuleSet);
document.getElementById('negate-html-filter-list-warning').addEventListener('click', function () { options._onLinkClick(Links.CODEBERG_HTML_FILTER); }); document.getElementById('negate-html-filter-list-warning').addEventListener('click', function () { options._onLinkClick(Links.CODEBERG_HTML_FILTER); });
document.getElementById('ruleset-help').addEventListener('click', function () { options._onLinkClick(Links.CODEBERG_RULESET); }); document.getElementById('ruleset-help').addEventListener('click', function () { options._onLinkClick(Links.CODEBERG_RULESET); });

View File

@ -227,6 +227,12 @@
<div class="b-input"></div> <div class="b-input"></div>
</label> </label>
</div> </div>
<div class="ruleset-generator">
<label class="b-contain" for="generate-noscript-rules">NoScript
<input id="generate-noscript-rules" name="rule-sets" data-ruleset="NoScript" type="radio" value="NoScript" autocomplete="off">
<div class="b-input"></div>
</label>
</div>
<textarea rows="12" id="generated-rules" readonly></textarea> <textarea rows="12" id="generated-rules" readonly></textarea>
<button id="button-copy-rule-set" value="Copy" class="btns"><span data-i18n-content="copyRuleSet">Copy</span><span id="button-copy-rule-set-icon"></span></button> <button id="button-copy-rule-set" value="Copy" class="btns"><span data-i18n-content="copyRuleSet">Copy</span><span id="button-copy-rule-set-icon"></span></button>
</section> </section>

View File

@ -25,7 +25,7 @@
New in LocalCDN: New in LocalCDN:
</div> </div>
<ul> <ul>
<li></li> <li>Ruleset generator for NoScript (<a href="https://codeberg.org/nobody/LocalCDN/issues/489">#489</a>)</li>
</ul> </ul>
<div id="generator-section"> <div id="generator-section">
<div class="topic-label"> <div class="topic-label">
@ -49,6 +49,12 @@
<div class="b-input"></div> <div class="b-input"></div>
</label> </label>
</div> </div>
<div class="ruleset-generator">
<label class="b-contain" for="generate-noscript-rules">NoScript
<input id="generate-noscript-rules" name="rule-sets" data-ruleset="NoScript" type="radio" value="NoScript" autocomplete="off">
<div class="b-input"></div>
</label>
</div>
<div> <div>
<textarea rows="12" cols="15" id="generated-rules" readonly></textarea> <textarea rows="12" cols="15" id="generated-rules" readonly></textarea>
<input id="button-copy-rule-set" type="button" value="Copy"> <input id="button-copy-rule-set" type="button" value="Copy">