From 6305e4cadad8f8d65193491763d9d06bb0db47e6 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Thu, 27 Jul 2006 23:01:55 +0000 Subject: [PATCH] closes #55, export bibliography to printable version closes #4, Make printable version - moves functions for creating and deleting hidden browser objects to scholar.js (from ingester.js), since these are necessary for printing as well - allows saving bibliography in HTML or printing bibliography. style support is not yet complete (pending finalization of 0.9 version of CSL specification). --- .../content/scholar/bibliography.js | 47 +++++++++++ .../content/scholar/bibliography.xul | 29 +++++++ .../content/scholar/fileInterface.js | 84 +++++++++++++++++++ .../chromeFiles/content/scholar/xpcom/cite.js | 2 +- .../content/scholar/xpcom/ingester.js | 15 ---- .../content/scholar/xpcom/scholar.js | 27 ++++++ .../content/scholar/xpcom/utilities.js | 7 +- .../locale/en-US/scholar/scholar.dtd | 9 +- scrapers.sql | 10 +-- 9 files changed, 203 insertions(+), 27 deletions(-) create mode 100644 chrome/chromeFiles/content/scholar/bibliography.js create mode 100644 chrome/chromeFiles/content/scholar/bibliography.xul diff --git a/chrome/chromeFiles/content/scholar/bibliography.js b/chrome/chromeFiles/content/scholar/bibliography.js new file mode 100644 index 000000000..3bdc9a755 --- /dev/null +++ b/chrome/chromeFiles/content/scholar/bibliography.js @@ -0,0 +1,47 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Scholar_File_Interface_Bibliography +// +////////////////////////////////////////////////////////////////////////////// + +// Class to provide options for bibliography + +Scholar_File_Interface_Bibliography = new function() { + var _io; + + this.init = init; + this.acceptSelection = acceptSelection; + + /* + * Initialize some variables and prepare event listeners for when chrome is done + * loading + */ + function init() { + _io = window.arguments[0]; + + var listbox = document.getElementById("style-popup"); + var styles = Scholar.Cite.getStyles(); + + var firstItem = true; + for(i in styles) { + var itemNode = document.createElement("menuitem"); + itemNode.setAttribute("value", i); + itemNode.setAttribute("label", styles[i]); + listbox.appendChild(itemNode); + } + + // select first item by default + document.getElementById("style-menu").selectedIndex = 0; + + if(navigator.userAgent.toLowerCase().indexOf("mac") != -1) { + // hack to eliminate clipboard option for mac users + document.getElementById("output-radio").removeChild(document.getElementById("copy-to-clipboard")); + } + } + + function acceptSelection() { + // collect code + _io.style = document.getElementById("style-menu").selectedItem.value; + _io.output = document.getElementById("output-radio").selectedItem.id; + } +} \ No newline at end of file diff --git a/chrome/chromeFiles/content/scholar/bibliography.xul b/chrome/chromeFiles/content/scholar/bibliography.xul new file mode 100644 index 000000000..04debab5d --- /dev/null +++ b/chrome/chromeFiles/content/scholar/bibliography.xul @@ -0,0 +1,29 @@ + + + + + +