Add first-run guidance to QuickFormat dialog

This commit is contained in:
Simon Kornblith 2012-02-01 17:23:25 -05:00
parent b7c1e889cd
commit 46f64523a4
4 changed files with 31 additions and 9 deletions

View file

@ -48,7 +48,14 @@
panel = document.getAnonymousNodes(this)[0];
if(!forEl) forEl = document.getElementById(this.getAttribute("for"));
panel.lastChild.textContent = Zotero.getString("firstRunGuidance."+about);
var text = Zotero.getString("firstRunGuidance."+about).split("\n");
var descriptionNode = panel.lastChild;
while(text.length) {
var textLine = text.shift();
descriptionNode.appendChild(document.createTextNode(textLine));
if(text.length) descriptionNode.appendChild(document.createElementNS(
"http://www.w3.org/1999/xhtml", "br"));
}
panel.openPopup(forEl, position ? position : "after_start",
x ? parseInt(x, 10) : 0, y ? parseInt(y, 10) : 0, false, false, null);
@ -56,6 +63,13 @@
]]>
</body>
</method>
<method name="hide">
<body>
<![CDATA[
document.getAnonymousNodes(this)[0].hidePopup();
]]>
</body>
</method>
</implementation>
<content>

View file

@ -25,11 +25,11 @@
var Zotero_QuickFormat = new function () {
const pixelRe = /^([0-9]+)px$/
var initialized, io, qfs, qfi, qfiWindow, qfiDocument, qfe, qfb, qfbHeight, keepSorted,
showEditor, referencePanel, referenceBox, referenceHeight = 0, separatorHeight = 0,
currentLocator, currentLocatorLabel, currentSearchTime, dragging, panel,
panelPrefix, panelSuffix, panelSuppressAuthor, panelLocatorLabel, panelLocator, panelInfo,
panelRefersToBubble, panelFrameHeight = 0, accepted = false;
var initialized, io, qfs, qfi, qfiWindow, qfiDocument, qfe, qfb, qfbHeight, qfGuidance,
keepSorted, showEditor, referencePanel, referenceBox, referenceHeight = 0,
separatorHeight = 0, currentLocator, currentLocatorLabel, currentSearchTime, dragging,
panel, panelPrefix, panelSuffix, panelSuppressAuthor, panelLocatorLabel, panelLocator,
panelInfo, panelRefersToBubble, panelFrameHeight = 0, accepted = false;
// A variable that contains the timeout object for the latest onKeyPress event
var eventTimeout = null;
@ -98,10 +98,9 @@ var Zotero_QuickFormat = new function () {
panelLocator = document.getElementById("locator");
panelInfo = document.getElementById("citation-properties-info");
// Don't need to set noautohide dynamically on these platforms, so do it now
if(Zotero.isMac || Zotero.isWin) {
tabPanel.setAttribute("noautohide", true);
referencePanel.setAttribute("noautohide", true);
}
} else if(event.target === qfi.contentDocument) {
qfiWindow = qfi.contentWindow;
@ -129,6 +128,9 @@ var Zotero_QuickFormat = new function () {
Zotero.debug("Moving window to "+targetX+", "+targetY);
window.moveTo(targetX, targetY);
}
qfGuidance = document.getElementById('quick-format-guidance');
qfGuidance.show();
_refocusQfe();
}, 0);
window.focus();
@ -961,6 +963,8 @@ var Zotero_QuickFormat = new function () {
* Handle return or escape
*/
function _onQuickSearchKeyPress(event) {
qfGuidance.hide();
var keyCode = event.keyCode;
if(keyCode === event.DOM_VK_RETURN || keyCode === event.DOM_VK_ENTER) {
event.preventDefault();

View file

@ -25,6 +25,7 @@
-->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://global/skin/browser.css" type="text/css"?>
<?xml-stylesheet href="chrome://zotero/skin/zotero.css" type="text/css"?>
<?xml-stylesheet href="chrome://zotero/skin/integration.css" type="text/css"?>
<?xml-stylesheet href="chrome://zotero-platform/content/integration.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd">
@ -112,4 +113,6 @@
</rows>
</grid>
</panel>
<zoteroguidancepanel id="quick-format-guidance" about="quickFormat"
for="zotero-icon" x="26"/>
</window>

View file

@ -758,4 +758,5 @@ connector.error.title = Zotero Connector Error
connector.standaloneOpen = Your database cannot be accessed because Zotero Standalone is currently open. Please view your items in Zotero Standalone.
firstRunGuidance.saveIcon = Zotero can recognize a reference on this page. Click this icon in the address bar to save the reference to your Zotero library.
firstRunGuidance.authorMenu = Zotero lets you specify editors and translators, too. You can turn an author into an editor or translator by selecting from this menu.
firstRunGuidance.authorMenu = Zotero lets you specify editors and translators, too. You can turn an author into an editor or translator by selecting from this menu.
firstRunGuidance.quickFormat = Type a title or author to search for a reference. After you've made your selection, click the bubble to add page numbers, prefixes, or suffixes.\n\nIf you prefer the "classic" add citation dialog, you can revert to it in the Zotero preferences.