use match rules instead of include rules whenever possible

This commit is contained in:
Amm0ni4 2024-01-19 17:13:39 +00:00
parent 1ecd379f76
commit 788abf64fd
2 changed files with 544 additions and 537 deletions

View file

@ -22,9 +22,16 @@ def extract_regex_from_js(js_code):
def regex_to_include_line(regex):
#regex = regex.strip("/")
regex = '(' + regex + ')'
include_line = "// @include /^(https?:\/\/)(.+)?" + regex + "(\/.*)/"
include_line = include_line.replace( "\.*)(\/.*)/", "\.*)/" ) #clean excess in the regex
#Use @include for more complex regex
if '|' in regex:
regex = '(' + regex + ')'
include_line = "// @include /^(https?:\/\/)(.+)?" + regex + "(\/.*)/"
include_line = include_line.replace( "\.*)(\/.*)/", "\.*)/" ) #clean excess in the regex
#Use @match for simpler regex
else:
include_line = '// @match *://*.' + regex + '/*'
return include_line

File diff suppressed because it is too large Load diff