add americanbanker Rule
This commit is contained in:
@@ -149,6 +149,7 @@ func loadRules() RuleSet {
|
|||||||
}
|
}
|
||||||
yaml.Unmarshal(yamlFile, &ruleSet)
|
yaml.Unmarshal(yamlFile, &ruleSet)
|
||||||
}
|
}
|
||||||
|
//log.Print(ruleSet)
|
||||||
|
|
||||||
log.Println("Loaded rules for", len(ruleSet), "Domains")
|
log.Println("Loaded rules for", len(ruleSet), "Domains")
|
||||||
return ruleSet
|
return ruleSet
|
||||||
@@ -163,7 +164,7 @@ func applyRules(domain string, path string, body string) string {
|
|||||||
if rule.Domain != domain {
|
if rule.Domain != domain {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if rule.Path != "" && rule.Path != path {
|
if rule.Path != "" && !strings.HasPrefix(path, rule.Path) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for _, regexRule := range rule.RegexRules {
|
for _, regexRule := range rule.RegexRules {
|
||||||
@@ -179,6 +180,7 @@ func applyRules(domain string, path string, body string) string {
|
|||||||
doc.Find(injection.Position).ReplaceWithHtml(injection.Replace)
|
doc.Find(injection.Position).ReplaceWithHtml(injection.Replace)
|
||||||
}
|
}
|
||||||
if injection.Append != "" {
|
if injection.Append != "" {
|
||||||
|
log.Println("Appending", injection.Append)
|
||||||
doc.Find(injection.Position).AppendHtml(injection.Append)
|
doc.Find(injection.Position).AppendHtml(injection.Append)
|
||||||
}
|
}
|
||||||
if injection.Prepend != "" {
|
if injection.Prepend != "" {
|
||||||
|
|||||||
18
ruleset.yaml
18
ruleset.yaml
@@ -11,13 +11,17 @@
|
|||||||
alert("Hello!");
|
alert("Hello!");
|
||||||
</script>
|
</script>
|
||||||
- domain: www.americanbanker.com
|
- domain: www.americanbanker.com
|
||||||
googleCache: false
|
path: /news
|
||||||
injections:
|
injections:
|
||||||
- position: head
|
- position: head
|
||||||
append: |
|
append: |
|
||||||
const inlineGate = document.querySelector('.inline-gate');
|
<script>
|
||||||
if (inlineGate) {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
inlineGate.classList.remove('inline-gate');
|
const inlineGate = document.querySelector('.inline-gate');
|
||||||
const inlineGated = document.querySelectorAll('.inline-gated');
|
if (inlineGate) {
|
||||||
for (const elem of inlineGated) { elem.classList.remove('inline-gated'); }
|
inlineGate.classList.remove('inline-gate');
|
||||||
}
|
const inlineGated = document.querySelectorAll('.inline-gated');
|
||||||
|
for (const elem of inlineGated) { elem.classList.remove('inline-gated'); }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user