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

Unified Diff: chrome/content/crawler.js

Issue 9615013: Crawler, first version (Closed)
Patch Set: Created March 6, 2013, 4:05 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« .hgignore ('K') | « README.md ('k') | chrome/content/crawler.xul » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/crawler.js
===================================================================
deleted file mode 100644
--- a/chrome/content/crawler.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * This Source Code is subject to the terms of the Mozilla Public License
- * version 2.0 (the "License"). You can obtain a copy of the License at
- * http://mozilla.org/MPL/2.0/.
- */
-
-const Cu = Components.utils;
-
-Cu.import("resource://gre/modules/Services.jsm");
-
-let crawling = false;
-
-function require(module)
-{
- let result = {};
- result.wrappedJSObject = result;
- Services.obs.notifyObservers(result, "abpcrawler-require", module);
- return result.exports;
-}
-
-let {Crawler} = require("crawler");
-
-function onUnload()
-{
- const fields = ["backend-url", "parallel-tabs"];
- fields.forEach(function(field)
- {
- let control = document.getElementById(field);
- control.setAttribute("value", control.value);
- });
-}
-
-function getBackendUrl()
-{
- let backendUrlTextBox = document.getElementById("backend-url");
- return backendUrlTextBox.value;
-}
-
-function getParallelTabs()
-{
- let parallelTabsTextBox = document.getElementById("parallel-tabs");
- return parseInt(parallelTabsTextBox.value);
-}
-
-function onAccept()
-{
- let backendUrl = getBackendUrl();
- let parallelTabs = getParallelTabs();
- let dialog = document.documentElement;
- let acceptButton = dialog.getButton("accept");
- crawling = acceptButton.disabled = true;
-
- let mainWindow = window.opener;
- if (!mainWindow || mainWindow.closed)
- {
- alert( "Unable to find the main window, aborting.");
- crawling = acceptButton.disabled = false;
- }
- else
- Crawler.crawl(backendUrl, parallelTabs, mainWindow, function()
- {
- crawling = acceptButton.disabled = false;
- });
-
- return false;
-}
-
-function onCancel()
-{
- let closingPossible = !crawling;
- if (!closingPossible)
- alert("Crawling still in progress.");
- return closingPossible;
-}
« .hgignore ('K') | « README.md ('k') | chrome/content/crawler.xul » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld