www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 425d806307f8b750ae06897083f81ae47527d597
parent d7ed7c256c5f20172037f510031fa65f5c6d7449
Author: Dan Stillman <dstillman@zotero.org>
Date:   Tue,  8 Aug 2006 06:08:21 +0000

Closes #158, Add linkFromURL() and importFromURL() functions to Scholar.Files


Diffstat:
Mchrome/chromeFiles/content/scholar/xpcom/data_access.js | 24++++++++++++++++++++++++
1 file changed, 24 insertions(+), 0 deletions(-)

diff --git a/chrome/chromeFiles/content/scholar/xpcom/data_access.js b/chrome/chromeFiles/content/scholar/xpcom/data_access.js @@ -1895,6 +1895,8 @@ Scholar.Files = new function(){ this.importFromFile = importFromFile; this.linkFromFile = linkFromFile; + this.importFromURL = importFromURL; + this.linkFromURL = linkFromURL; this.linkFromDocument = linkFromDocument; this.importFromDocument = importFromDocument; @@ -1949,6 +1951,28 @@ Scholar.Files = new function(){ } + function importFromURL(url, sourceItemID){ + var browser = Scholar.Browser.createHiddenBrowser(); + browser.addEventListener("load", function(){ + Scholar.Files.importFromDocument(browser.contentDocument, sourceItemID); + browser.removeEventListener("load", arguments.callee, true); + Scholar.Browser.deleteHiddenBrowser(browser); + }, true); + browser.loadURI(url, null, null, null, null); + } + + + function linkFromURL(url, sourceItemID){ + var browser = Scholar.Browser.createHiddenBrowser(); + browser.addEventListener("load", function(){ + Scholar.Files.linkFromDocument(browser.contentDocument, sourceItemID); + browser.removeEventListener("load", arguments.callee, true); + Scholar.Browser.deleteHiddenBrowser(browser); + }, true); + browser.loadURI(url, null, null, null, null); + } + + // TODO: what if called on file:// document? function linkFromDocument(document, sourceItemID){ var url = document.location;