# 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.

### Signals

scriptChanged()
  emitted to indicate a script change
updatingChanged(bool)
  emitted to indicate a change of the updating state

### Derived from

QObject

### Class Attributes

DocumentEnd
DocumentIdle
DocumentStart

### Class Methods

None

### Methods

GreaseMonkeyScript | Constructor
__downloadRequires | Private method to download the required scripts.
__downloaderError | Private slot to handle a downloader error.
__downloaderFinished | Private slot to handle a finished download.
__parseScript | Private method to parse the given script and populate the data structure.
__reloadScript | Private method to reload the script.
__requireDownloadError | Private slot to handle a downloader error.
__requireDownloaded | Private slot to handle a finished download of a required script.
__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.
isUpdating | Public method to get the updating flag.
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.
require | Public method to get the list of required scripts.
setEnabled | Public method to enable a script.
startAt | Public method to get the start point of the script.
updateScript | Public method to updated 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.__downloadRequires

__downloadRequires()

Private method to download the required scripts.

#### GreaseMonkeyScript.__downloaderError

__downloaderError()

Private slot to handle a downloader error.

#### GreaseMonkeyScript.__downloaderFinished

__downloaderFinished()

Private slot to handle a finished download.

#### GreaseMonkeyScript.__parseScript

__parseScript()

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

#### GreaseMonkeyScript.__reloadScript

__reloadScript()

Private method to reload the script.

#### GreaseMonkeyScript.__requireDownloadError

__requireDownloadError()

Private slot to handle a downloader error.

#### GreaseMonkeyScript.__requireDownloaded

__requireDownloaded()

Private slot to handle a finished download of a required script.

#### 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 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.isUpdating

isUpdating()

Public method to get the updating flag.

Returns:
  updating flag

Return Type:
  bool

#### 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.require

require()

Public method to get the list of required scripts.

Returns:
  list of required scripts (list of strings)

#### 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.updateScript

updateScript()

Public method to updated the script.

#### 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