Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * This Source Code is subject to the terms of the Mozilla Public License | |
3 * version 2.0 (the "License"). You can obtain a copy of the License at | |
4 * http://mozilla.org/MPL/2.0/. | |
5 */ | |
6 | |
Wladimir Palant
2012/09/21 15:36:18
Site-note: I don't think that this manual UI will
| |
7 const Cu = Components.utils; | |
8 | |
9 Cu.import("resource://gre/modules/Services.jsm"); | |
10 | |
11 let crawling = false; | |
12 | |
13 function require(module) | |
14 { | |
15 let result = {}; | |
16 result.wrappedJSObject = result; | |
17 Services.obs.notifyObservers(result, "abpcrawler-require", module); | |
18 return result.exports; | |
19 } | |
20 | |
21 let {Crawler} = require("crawler"); | |
22 | |
23 function onUnload() | |
24 { | |
25 const fields = ["backend-url", "parallel-tabs"]; | |
26 fields.forEach(function(field) | |
27 { | |
28 let control = document.getElementById(field); | |
29 control.setAttribute("value", control.value); | |
Wladimir Palant
2012/09/21 15:36:18
Are you trying to make the field values persist? U
| |
30 }); | |
31 } | |
32 | |
33 function onClose() | |
34 { | |
35 return !crawling; | |
Wladimir Palant
2012/09/21 15:36:18
Maybe show a message why the window cannot be clos
| |
36 } | |
37 | |
38 function getBackendUrl() | |
39 { | |
40 let backendUrlTextBox = document.getElementById("backend-url"); | |
41 return backendUrlTextBox.value; | |
42 } | |
43 | |
44 function getParallelTabs() | |
45 { | |
46 let parallelTabsTextBox = document.getElementById("parallel-tabs"); | |
47 return parseInt(parallelTabsTextBox.value); | |
48 } | |
49 | |
50 function onAccept() | |
51 { | |
52 let backendUrl = getBackendUrl(); | |
53 let parallelTabs = getParallelTabs(); | |
54 let dialog = document.getElementById("abpcrawler-crawler"); | |
Wladimir Palant
2012/09/21 15:36:18
How about using document.documentElement here?
| |
55 let acceptButton = dialog.getButton("accept"); | |
56 crawling = acceptButton.disabled = true; | |
57 Crawler.crawl(backendUrl, parallelTabs, window.opener, function() | |
Wladimir Palant
2012/09/21 15:36:18
Of course we could have the condition that window.
| |
58 { | |
59 crawling = acceptButton.disabled = false; | |
60 }); | |
61 return false; | |
62 } | |
OLD | NEW |