Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: chrome/content/crawler.js

Issue 8402021: Crawler frontend (Closed)
Patch Set: Created Sept. 21, 2012, 1:16 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « chrome.manifest ('k') | chrome/content/crawler.xul » ('j') | chrome/content/crawler.xul » ('J')

Powered by Google App Engine
This is Rietveld