eric6.WebBrowser.GreaseMonkey.GreaseMonkeyScript

Module implementing the GreaseMonkey script.

Global Attributes

None

Classes

GreaseMonkeyScript Class implementing the GreaseMonkey script.

Functions

None


GreaseMonkeyScript

Class implementing the GreaseMonkey script.

Derived from

QObject

Class Attributes

DocumentEnd
DocumentIdle
DocumentStart

Class Methods

None

Methods

GreaseMonkeyScript Constructor
__parseScript Private method to parse the given script and populate the data structure.
__toJavaScriptList Private method to convert a list of str to a string containing a valid JavaScript list definition.
__watchedFileChanged Private slot handling changes of the script file.
description Public method to get the description of the script.
downloadUrl Public method to get the download URL of the script.
exclude Public method to get the list of excluded URLs.
fileName Public method to get the path of the Javascript file.
fullName Public method to get the full name of the script.
include Public method to get the list of included URLs.
isEnabled Public method to check, if the script is enabled.
isValid Public method to check the validity of the script.
name Public method to get the name of the script.
nameSpace Public method to get the name space of the script.
noFrames Public method to get the noFrames flag.
script Public method to get the Javascript source.
setEnabled Public method to enable a script.
startAt Public method to get the start point of the script.
updateUrl Public method to get the update URL of the script.
version Public method to get the version of the script.
webScript Public method to create a script object.

Static Methods

None

GreaseMonkeyScript (Constructor)

GreaseMonkeyScript(manager, path)

Constructor

manager
reference to the manager object (GreaseMonkeyManager)
path
path of the Javascript file (string)

GreaseMonkeyScript.__parseScript

__parseScript()

Private method to parse the given script and populate the data structure.

GreaseMonkeyScript.__toJavaScriptList

__toJavaScriptList(patterns)

Private method to convert a list of str to a string containing a valid JavaScript list definition.

patterns (list of str)
list of match patterns
Returns:
JavaScript script containing the list
Return Type:
str

GreaseMonkeyScript.__watchedFileChanged

__watchedFileChanged(fileName)

Private slot handling changes of the script file.

fileName (str)
path of the script file

GreaseMonkeyScript.description

description()

Public method to get the description of the script.

Returns:
description of the script (string)

GreaseMonkeyScript.downloadUrl

downloadUrl()

Public method to get the download URL of the script.

Returns:
download URL of the script (QUrl)

GreaseMonkeyScript.exclude

exclude()

Public method to get the list of excluded URLs.

Returns:
list of excluded URLs (list of strings)

GreaseMonkeyScript.fileName

fileName()

Public method to get the path of the Javascript file.

Returns:
path path of the Javascript file (string)

GreaseMonkeyScript.fullName

fullName()

Public method to get the full name of the script.

Returns:
full name of the script (string)

GreaseMonkeyScript.include

include()

Public method to get the list of included URLs.

Returns:
list of included URLs (list of strings)

GreaseMonkeyScript.isEnabled

isEnabled()

Public method to check, if the script is enabled.

Returns:
flag indicating an enabled state (boolean)

GreaseMonkeyScript.isValid

isValid()

Public method to check the validity of the script.

Returns:
flag indicating a valid script (boolean)

GreaseMonkeyScript.name

name()

Public method to get the name of the script.

Returns:
name of the script (string)

GreaseMonkeyScript.nameSpace

nameSpace()

Public method to get the name space of the script.

Returns:
name space of the script (string)

GreaseMonkeyScript.noFrames

noFrames()

Public method to get the noFrames flag.

Returns:
flag indicating to not run on sub frames
Return Type:
bool

GreaseMonkeyScript.script

script()

Public method to get the Javascript source.

Returns:
Javascript source (string)

GreaseMonkeyScript.setEnabled

setEnabled(enable)

Public method to enable a script.

enable
flag indicating the new enabled state (boolean)

GreaseMonkeyScript.startAt

startAt()

Public method to get the start point of the script.

Returns:
start point of the script (DocumentStart or DocumentEnd)

GreaseMonkeyScript.updateUrl

updateUrl()

Public method to get the update URL of the script.

Returns:
update URL of the script (QUrl)

GreaseMonkeyScript.version

version()

Public method to get the version of the script.

Returns:
version of the script (string)

GreaseMonkeyScript.webScript

webScript()

Public method to create a script object.

Returns:
prepared script object
Return Type:
QWebEngineScript
Raises ValueError:
raised to indicate an unsupported start point
Up