JBrowser Source Docs
You are reading the documentation for JBrowser 1.4.0. The newest release is 1.5.4. Go to the latest documentation

jbrowser.services.userscripts

Generated from the source code of JBrowser 1.4.0.

jbrowser/services/userscripts.py · 132 lines

User scripts (JavaScript) and user styles (CSS), scoped by domain pattern and space.

Constants#

Name Value
SCRIPT_PREFIX 'jb-user:'
RUN_AT {'start': QWebEngineScript.InjectionPoint.DocumentCreation, 'ready': QWebEngineScript.I…

UserScript#

class UserScriptsource

Attributes

Name Value
name str
kind str = 'js'
code str = ''
matches list[str] = field(default_factory=lambda: ['*'])
spaces list[str] = field(default_factory=list)
run_at str = 'ready'
enabled bool = True
all_frames bool = False
id str = field(default_factory=lambda: uuid.uuid4().hex[:12])
updated float = field(default_factory=time.time)

UserScriptService#

class UserScriptService(QObject)source
UserScriptService(path: Path, parent: QObject | None=None)

Signals

Signal Arguments
changed ()

UserScriptService.save_now#

save_now() -> Nonesource

UserScriptService.all#

all() -> list[UserScript]source

UserScriptService.get#

get(sid: str) -> UserScript | Nonesource

UserScriptService.upsert#

upsert(script: UserScript) -> Nonesource

UserScriptService.remove#

remove(sid: str) -> Nonesource

UserScriptService.for_space#

for_space(space_id: str) -> list[UserScript]source

UserScriptService.sync_profile#

sync_profile(profile: QWebEngineProfile, space_id: str) -> Nonesource

Functions#

pattern_to_regex_source#

pattern_to_regex_source(pattern: str) -> strsource

Translate a match pattern into a JS regex source string matched against location.href.