// =-=-=-=-==-=-=-=-==-=-=-=-==-=-= // =-=-=-=-=-= CONSTANTS =-==-=-=-= // =-=-=-=-==-=-=-=-==-=-=-=-==-=-= const followButtonPaths = ["div.account__header button.logo-button","div.public-account-header a.logo-button","div.account-card a.logo-button","div.directory-card a.icon-button", "div.directory__card a.icon-button", "div.detailed-status a.logo-button", "button.remote-button", "div.account__header button.button--follow"] const profileNamePaths = ["div.account__header__tabs__name small", "div.public-account-header__tabs__name small", "div.detailed-status span.display-name__account", "div.display-name > span", "a.user-screen-name", "div.profile-info-panel small"] const domainRegex = /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/ const handleExtractUrlRegex = /^(?https?:\/\/(?:\.?[a-z0-9-]+)+(?:\.[a-z]+){1})?\/?@(?\w+)(?:@(?(?:[\w-]+\.)+?\w+))?(?:\/(?\d+))?\/?$/ const handleExtractUriRegex = /^(?https?:\/\/(?:\.?[a-z0-9-]+)+(?:\.[a-z]+){1})(?:\/users\/)(?\w+)(?:(?:\/statuses\/)(?\d+))?\/?$/ const enableConsoleLog = false const logPrepend = "[FediAct]" const instanceApi = "/api/v1/instance" const statusApi = "/api/v1/statuses" const searchApi = "/api/v2/search" const accountsApi = "/api/v1/accounts" const mutesApi = "/api/v1/mutes" const blocksApi = "/api/v1/blocks" const domainBlocksApi = "/api/v1/domain_blocks" const pollsApi = "/api/v1/polls" const apiDelay = 600 const maxTootCache = 200 const modalHtml = '
    ' const maxAsyncRequests = 10 // settings keys with defauls var settings = {} const settingsDefaults = { fediact_homeinstance: null, fediact_alert: false, fediact_mode: "blacklist", fediact_whitelist: null, fediact_blacklist: null, fediact_target: "_self", fediact_autoaction: true, fediact_token: null, fediact_redirects: true, fediact_enabledelay: true, fediact_hidemuted: false, fediact_runifloggedin: false, fediact_mutes: [], fediact_blocks: [], fediact_domainblocks: [] } const tmpSettings = { fedireply: undefined, lasthomerequest: undefined, whitelist: undefined, blacklist: undefined, exturi: undefined, tokenheader: undefined, processed: [], processedFollow: [], isProcessing: [] } // fix for cross-browser storage api compatibility and other global vars var browser, chrome // =-=-=-=-==-=-=-=-==-=-=-=-=- // =-=-=-=-=-= UTILS =-==-=-=-= // =-=-=-=-==-=-=-=-==-=-=-=-=- // wrappers to prepend to log messages function log(text) { if (enableConsoleLog) { console.log(logPrepend + ' ' + text) } } // Custom solution for detecting inserted nodes // Works in combination with nodeinserted.css (fixes Firefox blocking addon-inserted