Documentation/Source/eric6.WebBrowser.GreaseMonkey.GreaseMonkeyScript.html

changeset 4918
71caf42a13d8
child 5715
cbcca230679f
equal deleted inserted replaced
4917:682750cc7bd5 4918:71caf42a13d8
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.WebBrowser.GreaseMonkey.GreaseMonkeyScript</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body><a NAME="top" ID="top"></a>
22 <h1>eric6.WebBrowser.GreaseMonkey.GreaseMonkeyScript</h1>
23 <p>
24 Module implementing the GreaseMonkey script.
25 </p>
26 <h3>Global Attributes</h3>
27 <table>
28 <tr><td>None</td></tr>
29 </table>
30 <h3>Classes</h3>
31 <table>
32 <tr>
33 <td><a href="#GreaseMonkeyScript">GreaseMonkeyScript</a></td>
34 <td>Class implementing the GreaseMonkey script.</td>
35 </tr>
36 </table>
37 <h3>Functions</h3>
38 <table>
39 <tr><td>None</td></tr>
40 </table>
41 <hr /><hr />
42 <a NAME="GreaseMonkeyScript" ID="GreaseMonkeyScript"></a>
43 <h2>GreaseMonkeyScript</h2>
44 <p>
45 Class implementing the GreaseMonkey script.
46 </p>
47 <h3>Derived from</h3>
48 QObject
49 <h3>Class Attributes</h3>
50 <table>
51 <tr><td>DocumentEnd</td></tr><tr><td>DocumentIdle</td></tr><tr><td>DocumentStart</td></tr>
52 </table>
53 <h3>Class Methods</h3>
54 <table>
55 <tr><td>None</td></tr>
56 </table>
57 <h3>Methods</h3>
58 <table>
59 <tr>
60 <td><a href="#GreaseMonkeyScript.__init__">GreaseMonkeyScript</a></td>
61 <td>Constructor</td>
62 </tr><tr>
63 <td><a href="#GreaseMonkeyScript.__parseScript">__parseScript</a></td>
64 <td>Private method to parse the given script and populate the data structure.</td>
65 </tr><tr>
66 <td><a href="#GreaseMonkeyScript.__toJavaScriptList">__toJavaScriptList</a></td>
67 <td>Private method to convert a list of str to a string containing a valid JavaScript list definition.</td>
68 </tr><tr>
69 <td><a href="#GreaseMonkeyScript.__watchedFileChanged">__watchedFileChanged</a></td>
70 <td>Private slot handling changes of the script file.</td>
71 </tr><tr>
72 <td><a href="#GreaseMonkeyScript.description">description</a></td>
73 <td>Public method to get the description of the script.</td>
74 </tr><tr>
75 <td><a href="#GreaseMonkeyScript.downloadUrl">downloadUrl</a></td>
76 <td>Public method to get the download URL of the script.</td>
77 </tr><tr>
78 <td><a href="#GreaseMonkeyScript.exclude">exclude</a></td>
79 <td>Public method to get the list of excluded URLs.</td>
80 </tr><tr>
81 <td><a href="#GreaseMonkeyScript.fileName">fileName</a></td>
82 <td>Public method to get the path of the Javascript file.</td>
83 </tr><tr>
84 <td><a href="#GreaseMonkeyScript.fullName">fullName</a></td>
85 <td>Public method to get the full name of the script.</td>
86 </tr><tr>
87 <td><a href="#GreaseMonkeyScript.include">include</a></td>
88 <td>Public method to get the list of included URLs.</td>
89 </tr><tr>
90 <td><a href="#GreaseMonkeyScript.isEnabled">isEnabled</a></td>
91 <td>Public method to check, if the script is enabled.</td>
92 </tr><tr>
93 <td><a href="#GreaseMonkeyScript.isValid">isValid</a></td>
94 <td>Public method to check the validity of the script.</td>
95 </tr><tr>
96 <td><a href="#GreaseMonkeyScript.name">name</a></td>
97 <td>Public method to get the name of the script.</td>
98 </tr><tr>
99 <td><a href="#GreaseMonkeyScript.nameSpace">nameSpace</a></td>
100 <td>Public method to get the name space of the script.</td>
101 </tr><tr>
102 <td><a href="#GreaseMonkeyScript.noFrames">noFrames</a></td>
103 <td>Public method to get the noFrames flag.</td>
104 </tr><tr>
105 <td><a href="#GreaseMonkeyScript.script">script</a></td>
106 <td>Public method to get the Javascript source.</td>
107 </tr><tr>
108 <td><a href="#GreaseMonkeyScript.setEnabled">setEnabled</a></td>
109 <td>Public method to enable a script.</td>
110 </tr><tr>
111 <td><a href="#GreaseMonkeyScript.startAt">startAt</a></td>
112 <td>Public method to get the start point of the script.</td>
113 </tr><tr>
114 <td><a href="#GreaseMonkeyScript.updateUrl">updateUrl</a></td>
115 <td>Public method to get the update URL of the script.</td>
116 </tr><tr>
117 <td><a href="#GreaseMonkeyScript.version">version</a></td>
118 <td>Public method to get the version of the script.</td>
119 </tr><tr>
120 <td><a href="#GreaseMonkeyScript.webScript">webScript</a></td>
121 <td>Public method to create a script object.</td>
122 </tr>
123 </table>
124 <h3>Static Methods</h3>
125 <table>
126 <tr><td>None</td></tr>
127 </table>
128 <a NAME="GreaseMonkeyScript.__init__" ID="GreaseMonkeyScript.__init__"></a>
129 <h4>GreaseMonkeyScript (Constructor)</h4>
130 <b>GreaseMonkeyScript</b>(<i>manager, path</i>)
131 <p>
132 Constructor
133 </p><dl>
134 <dt><i>manager</i></dt>
135 <dd>
136 reference to the manager object (GreaseMonkeyManager)
137 </dd><dt><i>path</i></dt>
138 <dd>
139 path of the Javascript file (string)
140 </dd>
141 </dl><a NAME="GreaseMonkeyScript.__parseScript" ID="GreaseMonkeyScript.__parseScript"></a>
142 <h4>GreaseMonkeyScript.__parseScript</h4>
143 <b>__parseScript</b>(<i></i>)
144 <p>
145 Private method to parse the given script and populate the data
146 structure.
147 </p><a NAME="GreaseMonkeyScript.__toJavaScriptList" ID="GreaseMonkeyScript.__toJavaScriptList"></a>
148 <h4>GreaseMonkeyScript.__toJavaScriptList</h4>
149 <b>__toJavaScriptList</b>(<i>patterns</i>)
150 <p>
151 Private method to convert a list of str to a string containing a valid
152 JavaScript list definition.
153 </p><dl>
154 <dt><i>patterns</i> (list of str)</dt>
155 <dd>
156 list of match patterns
157 </dd>
158 </dl><dl>
159 <dt>Returns:</dt>
160 <dd>
161 JavaScript script containing the list
162 </dd>
163 </dl><dl>
164 <dt>Return Type:</dt>
165 <dd>
166 str
167 </dd>
168 </dl><a NAME="GreaseMonkeyScript.__watchedFileChanged" ID="GreaseMonkeyScript.__watchedFileChanged"></a>
169 <h4>GreaseMonkeyScript.__watchedFileChanged</h4>
170 <b>__watchedFileChanged</b>(<i>fileName</i>)
171 <p>
172 Private slot handling changes of the script file.
173 </p><dl>
174 <dt><i>fileName</i> (str)</dt>
175 <dd>
176 path of the script file
177 </dd>
178 </dl><a NAME="GreaseMonkeyScript.description" ID="GreaseMonkeyScript.description"></a>
179 <h4>GreaseMonkeyScript.description</h4>
180 <b>description</b>(<i></i>)
181 <p>
182 Public method to get the description of the script.
183 </p><dl>
184 <dt>Returns:</dt>
185 <dd>
186 description of the script (string)
187 </dd>
188 </dl><a NAME="GreaseMonkeyScript.downloadUrl" ID="GreaseMonkeyScript.downloadUrl"></a>
189 <h4>GreaseMonkeyScript.downloadUrl</h4>
190 <b>downloadUrl</b>(<i></i>)
191 <p>
192 Public method to get the download URL of the script.
193 </p><dl>
194 <dt>Returns:</dt>
195 <dd>
196 download URL of the script (QUrl)
197 </dd>
198 </dl><a NAME="GreaseMonkeyScript.exclude" ID="GreaseMonkeyScript.exclude"></a>
199 <h4>GreaseMonkeyScript.exclude</h4>
200 <b>exclude</b>(<i></i>)
201 <p>
202 Public method to get the list of excluded URLs.
203 </p><dl>
204 <dt>Returns:</dt>
205 <dd>
206 list of excluded URLs (list of strings)
207 </dd>
208 </dl><a NAME="GreaseMonkeyScript.fileName" ID="GreaseMonkeyScript.fileName"></a>
209 <h4>GreaseMonkeyScript.fileName</h4>
210 <b>fileName</b>(<i></i>)
211 <p>
212 Public method to get the path of the Javascript file.
213 </p><dl>
214 <dt>Returns:</dt>
215 <dd>
216 path path of the Javascript file (string)
217 </dd>
218 </dl><a NAME="GreaseMonkeyScript.fullName" ID="GreaseMonkeyScript.fullName"></a>
219 <h4>GreaseMonkeyScript.fullName</h4>
220 <b>fullName</b>(<i></i>)
221 <p>
222 Public method to get the full name of the script.
223 </p><dl>
224 <dt>Returns:</dt>
225 <dd>
226 full name of the script (string)
227 </dd>
228 </dl><a NAME="GreaseMonkeyScript.include" ID="GreaseMonkeyScript.include"></a>
229 <h4>GreaseMonkeyScript.include</h4>
230 <b>include</b>(<i></i>)
231 <p>
232 Public method to get the list of included URLs.
233 </p><dl>
234 <dt>Returns:</dt>
235 <dd>
236 list of included URLs (list of strings)
237 </dd>
238 </dl><a NAME="GreaseMonkeyScript.isEnabled" ID="GreaseMonkeyScript.isEnabled"></a>
239 <h4>GreaseMonkeyScript.isEnabled</h4>
240 <b>isEnabled</b>(<i></i>)
241 <p>
242 Public method to check, if the script is enabled.
243 </p><dl>
244 <dt>Returns:</dt>
245 <dd>
246 flag indicating an enabled state (boolean)
247 </dd>
248 </dl><a NAME="GreaseMonkeyScript.isValid" ID="GreaseMonkeyScript.isValid"></a>
249 <h4>GreaseMonkeyScript.isValid</h4>
250 <b>isValid</b>(<i></i>)
251 <p>
252 Public method to check the validity of the script.
253 </p><dl>
254 <dt>Returns:</dt>
255 <dd>
256 flag indicating a valid script (boolean)
257 </dd>
258 </dl><a NAME="GreaseMonkeyScript.name" ID="GreaseMonkeyScript.name"></a>
259 <h4>GreaseMonkeyScript.name</h4>
260 <b>name</b>(<i></i>)
261 <p>
262 Public method to get the name of the script.
263 </p><dl>
264 <dt>Returns:</dt>
265 <dd>
266 name of the script (string)
267 </dd>
268 </dl><a NAME="GreaseMonkeyScript.nameSpace" ID="GreaseMonkeyScript.nameSpace"></a>
269 <h4>GreaseMonkeyScript.nameSpace</h4>
270 <b>nameSpace</b>(<i></i>)
271 <p>
272 Public method to get the name space of the script.
273 </p><dl>
274 <dt>Returns:</dt>
275 <dd>
276 name space of the script (string)
277 </dd>
278 </dl><a NAME="GreaseMonkeyScript.noFrames" ID="GreaseMonkeyScript.noFrames"></a>
279 <h4>GreaseMonkeyScript.noFrames</h4>
280 <b>noFrames</b>(<i></i>)
281 <p>
282 Public method to get the noFrames flag.
283 </p><dl>
284 <dt>Returns:</dt>
285 <dd>
286 flag indicating to not run on sub frames
287 </dd>
288 </dl><dl>
289 <dt>Return Type:</dt>
290 <dd>
291 bool
292 </dd>
293 </dl><a NAME="GreaseMonkeyScript.script" ID="GreaseMonkeyScript.script"></a>
294 <h4>GreaseMonkeyScript.script</h4>
295 <b>script</b>(<i></i>)
296 <p>
297 Public method to get the Javascript source.
298 </p><dl>
299 <dt>Returns:</dt>
300 <dd>
301 Javascript source (string)
302 </dd>
303 </dl><a NAME="GreaseMonkeyScript.setEnabled" ID="GreaseMonkeyScript.setEnabled"></a>
304 <h4>GreaseMonkeyScript.setEnabled</h4>
305 <b>setEnabled</b>(<i>enable</i>)
306 <p>
307 Public method to enable a script.
308 </p><dl>
309 <dt><i>enable</i></dt>
310 <dd>
311 flag indicating the new enabled state (boolean)
312 </dd>
313 </dl><a NAME="GreaseMonkeyScript.startAt" ID="GreaseMonkeyScript.startAt"></a>
314 <h4>GreaseMonkeyScript.startAt</h4>
315 <b>startAt</b>(<i></i>)
316 <p>
317 Public method to get the start point of the script.
318 </p><dl>
319 <dt>Returns:</dt>
320 <dd>
321 start point of the script (DocumentStart or DocumentEnd)
322 </dd>
323 </dl><a NAME="GreaseMonkeyScript.updateUrl" ID="GreaseMonkeyScript.updateUrl"></a>
324 <h4>GreaseMonkeyScript.updateUrl</h4>
325 <b>updateUrl</b>(<i></i>)
326 <p>
327 Public method to get the update URL of the script.
328 </p><dl>
329 <dt>Returns:</dt>
330 <dd>
331 update URL of the script (QUrl)
332 </dd>
333 </dl><a NAME="GreaseMonkeyScript.version" ID="GreaseMonkeyScript.version"></a>
334 <h4>GreaseMonkeyScript.version</h4>
335 <b>version</b>(<i></i>)
336 <p>
337 Public method to get the version of the script.
338 </p><dl>
339 <dt>Returns:</dt>
340 <dd>
341 version of the script (string)
342 </dd>
343 </dl><a NAME="GreaseMonkeyScript.webScript" ID="GreaseMonkeyScript.webScript"></a>
344 <h4>GreaseMonkeyScript.webScript</h4>
345 <b>webScript</b>(<i></i>)
346 <p>
347 Public method to create a script object.
348 </p><dl>
349 <dt>Returns:</dt>
350 <dd>
351 prepared script object
352 </dd>
353 </dl><dl>
354 <dt>Return Type:</dt>
355 <dd>
356 QWebEngineScript
357 </dd>
358 </dl><dl>
359 <dt>Raises <b>ValueError</b>:</dt>
360 <dd>
361 raised to indicate an unsupported start point
362 </dd>
363 </dl>
364 <div align="right"><a href="#top">Up</a></div>
365 <hr />
366 </body></html>

eric ide

mercurial