put excludes after includes where they normally go

This commit is contained in:
Amm0ni4 2024-01-25 07:56:50 +00:00
parent eeb95347fb
commit 5b54701196
2 changed files with 8 additions and 8 deletions

View file

@ -3,13 +3,6 @@ def modify_script(input_script_path, includes_file_path, output_script_path):
with open(input_script_path, 'r') as input_file: with open(input_script_path, 'r') as input_file:
script_lines = input_file.readlines() script_lines = input_file.readlines()
# Find the last line that starts with "// @description:"
last_description_line_index = None
for i in range(len(script_lines) - 1, -1, -1):
if script_lines[i].startswith('// @description:'):
last_description_line_index = i
break
# Read the content of the includes file # Read the content of the includes file
with open(includes_file_path, 'r') as includes_file: with open(includes_file_path, 'r') as includes_file:
includes_content = includes_file.read() includes_content = includes_file.read()
@ -17,6 +10,13 @@ def modify_script(input_script_path, includes_file_path, output_script_path):
# Delete lines with "@include" or "@match" # Delete lines with "@include" or "@match"
script_lines = [line for line in script_lines if '@match' not in line and '@include' not in line] script_lines = [line for line in script_lines if '@match' not in line and '@include' not in line]
# Find the last line that starts with "// @description:"
last_description_line_index = None
for i in range(len(script_lines) - 1, -1, -1):
if script_lines[i].startswith('// @description:'):
last_description_line_index = i
break
# Insert includes # Insert includes
script_lines.insert(last_description_line_index + 1, includes_content) script_lines.insert(last_description_line_index + 1, includes_content)

View file

@ -81,7 +81,6 @@
// @description:vi Bỏ qua tất cả các trang web liên kết ngắn tự động bỏ qua các trang web liên kết gây phiền nhiễu, trực tiếp đến đích của bạn // @description:vi Bỏ qua tất cả các trang web liên kết ngắn tự động bỏ qua các trang web liên kết gây phiền nhiễu, trực tiếp đến đích của bạn
// @description:pt-br Ignora automaticamente encurtadores de links irritantes, diretamente para o link final // @description:pt-br Ignora automaticamente encurtadores de links irritantes, diretamente para o link final
// @description:fr-ca Contourner tous les sites de liens courts saute automatiquement les raccourcisseurs de liens gênants, directement vers votre destination // @description:fr-ca Contourner tous les sites de liens courts saute automatiquement les raccourcisseurs de liens gênants, directement vers votre destination
// @exclude /^(https?:\/\/)(.+)?((advertisingexcel|talkforfitness|rsadnetworkinfo|rsinsuranceinfo|rsfinanceinfo|rssoftwareinfo|rshostinginfo|rseducationinfo|gametechreviewer|vegan4k|phineypet|batmanfactor|techedifier|urlhives|linkhives|github|freeoseocheck|greenenez|aliyun|reddit|bing|live|yahoo|wiki-topia|edonmanor|vrtier|whatsapp|gearsadviser|edonmanor|tunebug|menrealitycalc|(cloud|mail|translate).google).com|(thumb8|thumb9|crewbase|crewus|shinchu|shinbhu|ultraten|uniqueten|topcryptoz|allcryptoz|coinsvalue|cookinguide|cryptowidgets|webfreetools|carstopia|makeupguide|carsmania).net|(linksfly|shortsfly|urlsfly|wefly|blog24).me|(greasyfork|openuserjs|adarima|telegram).org|mcrypto.club|misterio.ro|insurancegold.in|coinscap.info)(\/.*)/
// @match *://*.earnify.pro/* // @match *://*.earnify.pro/*
// @match *://*.aprovax.com/* // @match *://*.aprovax.com/*
// @match *://*.lootcash.vip/* // @match *://*.lootcash.vip/*
@ -729,6 +728,7 @@
// @match *://*.goes3.urlcash.click/* // @match *://*.goes3.urlcash.click/*
// @match *://*.r1.foxylinks.site/* // @match *://*.r1.foxylinks.site/*
// @match *://*/recaptcha/api2/* // @match *://*/recaptcha/api2/*
// @exclude /^(https?:\/\/)(.+)?((advertisingexcel|talkforfitness|rsadnetworkinfo|rsinsuranceinfo|rsfinanceinfo|rssoftwareinfo|rshostinginfo|rseducationinfo|gametechreviewer|vegan4k|phineypet|batmanfactor|techedifier|urlhives|linkhives|github|freeoseocheck|greenenez|aliyun|reddit|bing|live|yahoo|wiki-topia|edonmanor|vrtier|whatsapp|gearsadviser|edonmanor|tunebug|menrealitycalc|(cloud|mail|translate).google).com|(thumb8|thumb9|crewbase|crewus|shinchu|shinbhu|ultraten|uniqueten|topcryptoz|allcryptoz|coinsvalue|cookinguide|cryptowidgets|webfreetools|carstopia|makeupguide|carsmania).net|(linksfly|shortsfly|urlsfly|wefly|blog24).me|(greasyfork|openuserjs|adarima|telegram).org|mcrypto.club|misterio.ro|insurancegold.in|coinscap.info)(\/.*)/
// @downloadURL https://codeberg.org/Amm0ni4/bypass-all-shortlinks-debloated/raw/branch/main/Bypass_All_Shortlinks.user.js // @downloadURL https://codeberg.org/Amm0ni4/bypass-all-shortlinks-debloated/raw/branch/main/Bypass_All_Shortlinks.user.js
// @updateURL https://codeberg.org/Amm0ni4/bypass-all-shortlinks-debloated/raw/branch/main/Bypass_All_Shortlinks.user.js // @updateURL https://codeberg.org/Amm0ni4/bypass-all-shortlinks-debloated/raw/branch/main/Bypass_All_Shortlinks.user.js
// ==/UserScript== // ==/UserScript==