commit b2dda2ec23cacf6d5f5e64499ade00001c948eb8
parent 84246d46c0a7239d280547a497663c68b954eb71
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 20 Jun 2011 20:02:14 +0000
Replace all setTimeout(string, ms) calls with setTimeout(func, ms) for AMO
Diffstat:
4 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js
@@ -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
diff --git a/chrome/content/zotero/preferences/preferences.xul b/chrome/content/zotero/preferences/preferences.xul
@@ -277,7 +277,7 @@ To add a new preference:
<hbox>
<textbox id="storage-username"
preference="pref-storage-username"
- onkeypress="if (Zotero.isMac && event.keyCode == 13) { this.blur(); setTimeout('verifyStorageServer();', 1); }"
+ onkeypress="if (Zotero.isMac && 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 && event.keyCode == 13) { this.blur(); setTimeout('verifyStorageServer();', 1); }"
+ onkeypress="if (Zotero.isMac && event.keyCode == 13) { this.blur(); setTimeout(verifyStorageServer, 1); }"
oninput="unverifyStorageServer()"
onchange="Zotero.Sync.Storage.Session.WebDAV.prototype.password = this.value"/>
</hbox>
diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js
@@ -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'));
diff --git a/chrome/skin/default/zotero/timeline/timelineControls.js b/chrome/skin/default/zotero/timeline/timelineControls.js
@@ -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)
}
}