Replace all setTimeout(string, ms) calls with setTimeout(func, ms) for AMO

This commit is contained in:
Dan Stillman 2011-06-20 20:02:14 +00:00
parent 84246d46c0
commit b2dda2ec23
4 changed files with 25 additions and 8 deletions

View file

@ -139,7 +139,10 @@ var ZoteroOverlay = new function()
// Used for loading pages from upgrade wizard
if (Zotero && Zotero.initialURL) {
setTimeout("gBrowser.selectedTab = gBrowser.addTab(Zotero.initialURL); Zotero.initialURL = null;", 1);
setTimeout(function () {
gBrowser.selectedTab = gBrowser.addTab(Zotero.initialURL);
Zotero.initialURL = null;
}, 1);
}
// Hide browser chrome on Zotero tab

View file

@ -277,7 +277,7 @@ To add a new preference:
<hbox>
<textbox id="storage-username"
preference="pref-storage-username"
onkeypress="if (Zotero.isMac &amp;&amp; event.keyCode == 13) { this.blur(); setTimeout('verifyStorageServer();', 1); }"
onkeypress="if (Zotero.isMac &amp;&amp; event.keyCode == 13) { this.blur(); setTimeout(verifyStorageServer, 1); }"
onsynctopreference="unverifyStorageServer();"
onchange="var pass = document.getElementById('storage-password'); if (pass.value) { Zotero.Sync.Storage.Session.WebDAV.prototype.password = pass.value; }"/>
</hbox>
@ -286,7 +286,7 @@ To add a new preference:
<label value="&zotero.preferences.sync.password;"/>
<hbox>
<textbox id="storage-password" flex="0" type="password"
onkeypress="if (Zotero.isMac &amp;&amp; event.keyCode == 13) { this.blur(); setTimeout('verifyStorageServer();', 1); }"
onkeypress="if (Zotero.isMac &amp;&amp; event.keyCode == 13) { this.blur(); setTimeout(verifyStorageServer, 1); }"
oninput="unverifyStorageServer()"
onchange="Zotero.Sync.Storage.Session.WebDAV.prototype.password = this.value"/>
</hbox>

View file

@ -396,7 +396,10 @@ var ZoteroPane = new function()
}
// Focus the quicksearch on pane open
setTimeout("document.getElementById('zotero-tb-search').inputField.select();", 1);
var searchBar = document.getElementById('zotero-tb-search');
setTimeout(function () {
searchBar.inputField.select();
}, 1);
// Auto-empty trashed items older than a certain number of days
var days = Zotero.Prefs.get('trashAutoEmptyDays');
@ -1749,11 +1752,17 @@ var ZoteroPane = new function()
if (event.keyCode == event.DOM_VK_ESCAPE) {
textbox.value = '';
ZoteroPane_Local.setItemsPaneMessage(Zotero.getString('searchInProgress'));
setTimeout("ZoteroPane_Local.search(); ZoteroPane_Local.clearItemsPaneMessage();", 1);
setTimeout(function () {
ZoteroPane_Local.search();
ZoteroPane_Local.clearItemsPaneMessage();
}, 1);
}
else if (event.keyCode == event.DOM_VK_RETURN || event.keyCode == event.DOM_VK_ENTER) {
ZoteroPane_Local.setItemsPaneMessage(Zotero.getString('searchInProgress'));
setTimeout("ZoteroPane_Local.search(true); ZoteroPane_Local.clearItemsPaneMessage();", 1);
setTimeout(function () {
ZoteroPane_Local.search(true);
ZoteroPane_Local.clearItemsPaneMessage();
}, 1);
}
}
@ -1763,7 +1772,10 @@ var ZoteroPane = new function()
// result of Undo or Redo
if (!textbox.value.length) {
ZoteroPane_Local.setItemsPaneMessage(Zotero.getString('searchInProgress'));
setTimeout("ZoteroPane_Local.search(); ZoteroPane_Local.clearItemsPaneMessage();", 1);
setTimeout(function () {
ZoteroPane_Local.search();
ZoteroPane_Local.clearItemsPaneMessage();
}, 1);
}
else if (textbox.value.indexOf('"') != -1) {
ZoteroPane_Local.setItemsPaneMessage(Zotero.getString('advancedSearchMode'));

View file

@ -87,7 +87,9 @@ function doKeyPress(e)
checkDate(lastJumpToYearValue);
}
else {
jumpToYearTimer = setTimeout('wasChanged(document.getElementById("jumpYear").value);', 1000)
jumpToYearTimer = setTimeout(function () {
wasChanged(document.getElementById("jumpYear").value);
}, 1000)
}
}