commit 2ce31d7565325f8fb0d2a79f8612e8296be8f891
parent cefe301c740e20625b20776f3838313631623699
Author: Simon Kornblith <simon@simonster.com>
Date: Mon, 28 Apr 2014 23:40:45 -0400
Add delay before showing icon guidance
Diffstat:
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/chrome/content/zotero/bindings/guidancepanel.xml b/chrome/content/zotero/bindings/guidancepanel.xml
@@ -35,6 +35,8 @@
<parameter name="text"/>
<body>
<![CDATA[
+ Components.utils.import("resource://gre/modules/Services.jsm");
+
var about = this.getAttribute("about"),
pref = "firstRunGuidanceShown."+about,
shown = false;
@@ -58,10 +60,20 @@
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);
-
- Zotero.Prefs.set(pref, true);
+
+ var me = this;
+ var f = function() {
+ if(me.hasAttribute("foregroundonly") && Services.ww.activeWindow != window) return;
+ panel.openPopup(forEl, position ? position : "after_start",
+ x ? parseInt(x, 10) : 0, y ? parseInt(y, 10) : 0, false, false, null);
+ Zotero.Prefs.set(pref, true);
+ };
+
+ if(this.hasAttribute("delay")) {
+ window.setTimeout(f, this.getAttribute("delay"));
+ } else {
+ f();
+ }
]]>
</body>
</method>
diff --git a/chrome/content/zotero/overlay.xul b/chrome/content/zotero/overlay.xul
@@ -52,7 +52,7 @@
<toolbar id="zotero-toolbar" nowindowdrag="true"/>
<vbox id="appcontent">
- <zoteroguidancepanel id="zotero-toolbar-button-guidance" about="toolbarButton" for="zotero-toolbar-button" position="bottomcenter topleft"/>
+ <zoteroguidancepanel id="zotero-toolbar-button-guidance" about="toolbarButton" for="zotero-toolbar-button" position="bottomcenter topleft" delay="1000" foregroundonly="true"/>
<!-- onmouseup shouldn't be necessary but seems to help prevent tag selector from sometimes going off the screen -->
<splitter id="zotero-splitter" resizebefore="closest" resizeafter="closest" hidden="true"
onmouseup="ZoteroPane.updateTagSelectorSize()"/>