Add delay before showing icon guidance

This commit is contained in:
Simon Kornblith 2014-04-28 23:40:45 -04:00
parent cefe301c74
commit 2ce31d7565
2 changed files with 17 additions and 5 deletions

View file

@ -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>

View file

@ -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()"/>