From a5cdfc2ceff2178f479befa7beb3c1c2df25fed8 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Sun, 24 Jul 2011 17:41:48 +0000 Subject: [PATCH] Use arrow panel for "Add Citation by Identifier" --- .../content/zotero-platform/mac/overlay.css | 18 ------- chrome/content/zotero/lookup.js | 52 +++++++++++++++---- chrome/content/zotero/zoteroPane.xul | 24 ++++++++- chrome/skin/default/zotero/overlay.css | 4 ++ 4 files changed, 68 insertions(+), 30 deletions(-) diff --git a/chrome/content/zotero-platform/mac/overlay.css b/chrome/content/zotero-platform/mac/overlay.css index a3fa35a425..3ae40e851f 100644 --- a/chrome/content/zotero-platform/mac/overlay.css +++ b/chrome/content/zotero-platform/mac/overlay.css @@ -69,24 +69,6 @@ display: none; } -.zotero-tb-button[type="menu"] > .toolbarbutton-icon { - -moz-padding-end: 4px; -} - -.zotero-tb-button[type="menu"] > .toolbarbutton-menu-dropmarker { - list-style-image: url("chrome://zotero/skin/mac/folderDropArrow.png"); - padding: 0; -} - -/* This property controls the strength of the SVG outer glow mask on the toolbar buttons */ -.zotero-tb-button > .toolbarbutton-icon > stack > .zotero-tb-glow { - opacity: .7; -} - -#zotero-tb-attachment-add > .toolbarbutton-icon > stack > .zotero-tb-glow { - display: none; -} - #zotero-tb-sync > .toolbarbutton-icon { -moz-binding: none !important; padding: 2px 0px 2px 8px !important; diff --git a/chrome/content/zotero/lookup.js b/chrome/content/zotero/lookup.js index 5165244214..418e0f4bdb 100644 --- a/chrome/content/zotero/lookup.js +++ b/chrome/content/zotero/lookup.js @@ -1,9 +1,9 @@ /* ***** BEGIN LICENSE BLOCK ***** - Copyright © 2009 Center for History and New Media - George Mason University, Fairfax, Virginia, USA - http://zotero.org + Copyright © 2009-2011 Center for History and New Media + George Mason University, Fairfax, Virginia, USA + http://zotero.org This file is part of Zotero. @@ -23,12 +23,23 @@ ***** END LICENSE BLOCK ***** */ - +/** + * Handles UI for lookup panel + * @namespace + */ const Zotero_Lookup = new function () { + /** + * Performs a lookup by DOI, PMID, or ISBN + */ this.accept = function() { - document.getElementById("progress").setAttribute("status", "animate"); - document.getElementById("accept-button").disabled = true; - var identifier = document.getElementById("lookup-textbox").value; + var progressElement = document.getElementById("zotero-lookup-progress"); + progressElement.setAttribute("status", "animate"); + + var acceptElement = document.getElementById("zotero-lookup-accept-button"); + acceptElement.disabled = true; + + var identifierElement = document.getElementById("zotero-lookup-textbox"); + var identifier = identifierElement.value; var doi = Zotero.Utilities.cleanDOI(identifier); if(doi) { @@ -54,10 +65,11 @@ const Zotero_Lookup = new function () { translate.setHandler("done", function(translate, success) { if(success) { - window.close(); + document.getElementById("zotero-lookup-panel").hidePopup(); } else { - document.getElementById("accept-button").disabled = undefined; - document.getElementById("progress").setAttribute("status", "error"); + acceptElement.disabled = undefined; + progressElement.removeAttribute("status"); + var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); prompts.alert(window, Zotero.getString("lookup.failure.title"), @@ -78,4 +90,24 @@ const Zotero_Lookup = new function () { translate.translate(libraryID); return false; } + + /** + * Focuses the field + */ + this.onShowing = function() { + if(!Zotero.isFx4) { + document.getElementById("zotero-lookup-panel").style.padding = "10px"; + } + document.getElementById("zotero-lookup-textbox").focus(); + } + + /** + * Cancels the popup and resets fields + */ + this.onHidden = function() { + var progressElement = document.getElementById("zotero-lookup-progress"); + if(progressElement.hasAttribute("status")) progressElement.removeAttribute("status"); + document.getElementById("zotero-lookup-accept-button").disabled = undefined; + document.getElementById("zotero-lookup-textbox").value = ""; + } } diff --git a/chrome/content/zotero/zoteroPane.xul b/chrome/content/zotero/zoteroPane.xul index d38a7eb221..2d17a8d241 100644 --- a/chrome/content/zotero/zoteroPane.xul +++ b/chrome/content/zotero/zoteroPane.xul @@ -31,6 +31,7 @@ %globalDTD; %zoteroDTD; + %dialogOverlayDTD; ]>