diff --git a/Zotero.dot.dmg b/Zotero.dot.dmg index f11d8530a..d3bb37031 100644 Binary files a/Zotero.dot.dmg and b/Zotero.dot.dmg differ diff --git a/chrome/chromeFiles/content/scholar/bibliography.js b/chrome/chromeFiles/content/scholar/bibliography.js index 2a0b73e09..a3135d9b6 100644 --- a/chrome/chromeFiles/content/scholar/bibliography.js +++ b/chrome/chromeFiles/content/scholar/bibliography.js @@ -20,28 +20,32 @@ var Scholar_File_Interface_Bibliography = new function() { _io = window.arguments[0]; var listbox = document.getElementById("style-popup"); + var styleMenu = document.getElementById("style-menu"); var styles = Scholar.Cite.getStyles(); - var firstItem = true; + // add styles to list for(i in styles) { var itemNode = document.createElement("menuitem"); itemNode.setAttribute("value", i); itemNode.setAttribute("label", styles[i]); listbox.appendChild(itemNode); + + if(i == _io.style) { + styleMenu.selectedItem = 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")); + if(styleMenu.selectedIndex == -1) { + styleMenu.selectedIndex = 0; } } function acceptSelection() { // collect code _io.style = document.getElementById("style-menu").selectedItem.value; - _io.output = document.getElementById("output-radio").selectedItem.id; + if(document.getElementById("output-radio")) { + _io.output = document.getElementById("output-radio").selectedItem.id; + } } } \ No newline at end of file diff --git a/chrome/chromeFiles/content/scholar/ingester/browser.js b/chrome/chromeFiles/content/scholar/ingester/browser.js index 5c5aca447..ee8a26c80 100644 --- a/chrome/chromeFiles/content/scholar/ingester/browser.js +++ b/chrome/chromeFiles/content/scholar/ingester/browser.js @@ -359,7 +359,8 @@ Scholar_Ingester_Interface.Progress = new function() { if(_windowLoading || _windowLoaded) { // already loading or loaded return false; } - _progressWindow = window.openDialog("chrome://scholar/chrome/ingester/progress.xul", "", "chrome,dialog=no,titlebar=no,popup=yes"); + _progressWindow = window.openDialog("chrome://scholar/chrome/ingester/progress.xul", + "", "chrome,dialog=no,titlebar=no,popup=yes"); _progressWindow.addEventListener("load", _onWindowLoaded, false); _windowLoading = true; diff --git a/chrome/chromeFiles/content/scholar/selectItemsDialog.xul b/chrome/chromeFiles/content/scholar/selectItemsDialog.xul index 28bc8a7c2..ede99a89a 100644 --- a/chrome/chromeFiles/content/scholar/selectItemsDialog.xul +++ b/chrome/chromeFiles/content/scholar/selectItemsDialog.xul @@ -28,7 +28,6 @@ title="Select" orient="vertical" width="600" height="450" - persist="width height screenX screenY" buttons="cancel,accept" ondialogaccept="doAccept();" onload="doLoad();" diff --git a/chrome/chromeFiles/content/scholar/xpcom/cite.js b/chrome/chromeFiles/content/scholar/xpcom/cite.js index 9f8e02bc8..52c26878e 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/cite.js +++ b/chrome/chromeFiles/content/scholar/xpcom/cite.js @@ -9,10 +9,14 @@ Scholar.Cite = new function() { var _lastCSL = null; var _lastStyle = null; + this.getStyles = getStyles; + this.getStyleClass = getStyleClass; this.getBibliography = getBibliography; this.getCitation = getCitation; - this.getStyles = getStyles; + /* + * returns an associative array of cslID => styleName pairs + */ function getStyles() { // get styles var sql = "SELECT cslID, title FROM csl ORDER BY title"; @@ -27,6 +31,14 @@ Scholar.Cite = new function() { return stylesObject; } + /* + * returns the class of a given style + */ + function getStyleClass(cslID) { + var csl = _getCSL(cslID); + return csl.class; + } + /* * generates a bibliography */ @@ -86,13 +98,13 @@ CSL = function(csl) { this._terms = this._parseLocales(this._csl.terms); // load class defaults - this._class = this._csl["@class"].toString(); - Scholar.debug("CSL: style class is "+this._class); + this.class = this._csl["@class"].toString(); + Scholar.debug("CSL: style class is "+this.class); this._defaults = new Object(); // load class defaults - if(CSL._classDefaults[this._class]) { - var classDefaults = CSL._classDefaults[this._class]; + if(CSL._classDefaults[this.class]) { + var classDefaults = CSL._classDefaults[this.class]; for(var i in classDefaults) { this._defaults[i] = classDefaults[i]; } @@ -187,7 +199,7 @@ CSL.prototype.createBibliography = function(format) { var output = ""; if(format == "HTML") { - if(this._class == "note") { + if(this.class == "note") { output += '
    \r\n'; } else if(this._bib.hangingIndent) { output += '
    \r\n'; @@ -213,13 +225,13 @@ CSL.prototype.createBibliography = function(format) { string += ''; } - if(this._class == "note") { + if(this.class == "note") { output += "
  1. "+string+"
  2. \r\n"; } else { output += "

    "+string+"

    \r\n"; } } else if(format == "RTF") { - if(this._class == "note") { + if(this.class == "note") { index++; output += index+". "; } @@ -230,7 +242,7 @@ CSL.prototype.createBibliography = function(format) { } if(format == "HTML") { - if(this._class == "note") { + if(this.class == "note") { output += '
'; } else if(this._bib.hangingIndent) { output += ''; @@ -1044,7 +1056,7 @@ CSL.prototype._preprocessItems = function() { item, "disambiguate", this._bib); // handle (2006a) disambiguation for author-date styles - if(this._class == "author-date") { + if(this.class == "author-date") { var citation = author+" "+this._getFieldValue("date", this._getFieldDefaults("date"), item, "disambiguate", this._bib); diff --git a/chrome/chromeFiles/content/scholar/xpcom/integration.js b/chrome/chromeFiles/content/scholar/xpcom/integration.js index ed704b7b8..edffc82d8 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/integration.js +++ b/chrome/chromeFiles/content/scholar/xpcom/integration.js @@ -293,19 +293,24 @@ Scholar.Integration.DataListener.prototype._requestFinished = function(response) } Scholar.Integration.SOAP = new function() { - this.getCitation = getCitation; - this.getBibliography = getBibliography; - - function getCitation(vars) { - // get items - - var myWindow = Components.classes["@mozilla.org/appshell/appShellService;1"] + var window = Components.classes["@mozilla.org/appshell/appShellService;1"] .getService(Components.interfaces.nsIAppShellService) .hiddenDOMWindow; - + + this.getCitation = getCitation; + this.getBibliography = getBibliography; + this.setDocPrefs = setDocPrefs; + + /* + * generates a new citation for a given item + * ACCEPTS: style[, itemString, newItemIndex] + * RETURNS: (newItem, citation) + */ + function getCitation(vars) { + // get items var io = {dataIn: null, dataOut: null}; - myWindow.openDialog('chrome://scholar/content/selectItemsDialog.xul','', - 'chrome,popup,modal,centerscreen,titlebar=no',io); + window.openDialog('chrome://scholar/content/selectItemsDialog.xul','', + 'chrome,popup,modal,centerscreen',io); if(io.dataOut) { // cancel was not pressed var selectedItemIDs = io.dataOut; @@ -341,6 +346,11 @@ Scholar.Integration.SOAP = new function() { } } + /* + * gets a bibliography + * ACCEPTS: style, itemString + * RETURNS: bibliography + */ function getBibliography(vars) { // get items var itemIDs = vars[1].split("_"); @@ -348,6 +358,23 @@ Scholar.Integration.SOAP = new function() { return Scholar.Cite.getBibliography(vars[0], items, "Integration"); } + + /* + * sets document preferences + * ACCEPTS: [currentStyle] + * RETURNS: (style, styleClass) + */ + function setDocPrefs(vars) { + var io = new Object(); + if(vars && vars[0]) { + io.style = vars[0]; + } + + window.openDialog('chrome://scholar/content/integrationDocPrefs.xul','', + 'chrome,popup,modal,centerscreen',io); + var styleClass = Scholar.Cite.getStyleClass(io.style); + return [io.style, styleClass]; + } } Scholar.Integration.init(); \ No newline at end of file diff --git a/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd b/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd index 75e92e4aa..2157c6153 100644 --- a/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd +++ b/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd @@ -54,6 +54,8 @@ + +