Replace some 'for each..in' instances
There are hundreds more, but these are all the ones that generate warnings in the console at startup. XPCOM/XBL ones don't seem to do so, so we can ignore those for now (and hopefully not bother with them on 4.0). Instances in translators do generate warnings. Addresses #656
This commit is contained in:
parent
4d8471afac
commit
faed7cd7dd
4 changed files with 67 additions and 54 deletions
|
@ -296,7 +296,8 @@ var Zotero_Browser = new function() {
|
||||||
// ignore blacklisted domains
|
// ignore blacklisted domains
|
||||||
try {
|
try {
|
||||||
if(doc.domain) {
|
if(doc.domain) {
|
||||||
for each(var blacklistedURL in _blacklist) {
|
for (let i = 0; i < _blacklist.length; i++) {
|
||||||
|
let blacklistedURL = _blacklist[i];
|
||||||
if(doc.domain.substr(doc.domain.length-blacklistedURL.length) == blacklistedURL) {
|
if(doc.domain.substr(doc.domain.length-blacklistedURL.length) == blacklistedURL) {
|
||||||
Zotero.debug("Ignoring blacklisted URL "+doc.location);
|
Zotero.debug("Ignoring blacklisted URL "+doc.location);
|
||||||
return;
|
return;
|
||||||
|
@ -531,8 +532,8 @@ var Zotero_Browser = new function() {
|
||||||
menuitem.setAttribute("class", "menuitem-iconic");
|
menuitem.setAttribute("class", "menuitem-iconic");
|
||||||
menuitem.addEventListener("command", _constructLookupFunction(tab, function(event, obj) {
|
menuitem.addEventListener("command", _constructLookupFunction(tab, function(event, obj) {
|
||||||
var urls = [];
|
var urls = [];
|
||||||
for each(var item in obj.newItems) {
|
for (let i = 0; i < obj.newItems.length; i++) {
|
||||||
var url = Zotero.OpenURL.resolve(item);
|
var url = Zotero.OpenURL.resolve(obj.newItems[i]);
|
||||||
if(url) urls.push(url);
|
if(url) urls.push(url);
|
||||||
}
|
}
|
||||||
ZoteroPane.loadURI(urls, event);
|
ZoteroPane.loadURI(urls, event);
|
||||||
|
@ -837,7 +838,8 @@ Zotero_Browser.Tab.prototype.detectTranslators = function(rootDoc, doc) {
|
||||||
Zotero_Browser.Tab.prototype._searchFrames = function(rootDoc, searchDoc) {
|
Zotero_Browser.Tab.prototype._searchFrames = function(rootDoc, searchDoc) {
|
||||||
if(rootDoc == searchDoc) return true;
|
if(rootDoc == searchDoc) return true;
|
||||||
var frames = rootDoc.getElementsByTagName("frame");
|
var frames = rootDoc.getElementsByTagName("frame");
|
||||||
for each(var frame in frames) {
|
for (let i = 0; i < frames.length; i++) {
|
||||||
|
let frame = frames[i];
|
||||||
if(frame.contentDocument &&
|
if(frame.contentDocument &&
|
||||||
(frame.contentDocument == searchDoc ||
|
(frame.contentDocument == searchDoc ||
|
||||||
this._searchFrames(frame.contentDocument, searchDoc))) {
|
this._searchFrames(frame.contentDocument, searchDoc))) {
|
||||||
|
@ -846,7 +848,8 @@ Zotero_Browser.Tab.prototype._searchFrames = function(rootDoc, searchDoc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var frames = rootDoc.getElementsByTagName("iframe");
|
var frames = rootDoc.getElementsByTagName("iframe");
|
||||||
for each(var frame in frames) {
|
for (let i = 0; i < frames.length; i++) {
|
||||||
|
let frame = frames[i];
|
||||||
if(frame.contentDocument &&
|
if(frame.contentDocument &&
|
||||||
(frame.contentDocument == searchDoc ||
|
(frame.contentDocument == searchDoc ||
|
||||||
this._searchFrames(frame.contentDocument, searchDoc))) {
|
this._searchFrames(frame.contentDocument, searchDoc))) {
|
||||||
|
|
|
@ -72,7 +72,7 @@ var Zotero_LocateMenu = new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(installableLocateEngines.length) {
|
if(installableLocateEngines.length) {
|
||||||
for each(var locateEngine in installableLocateEngines) {
|
for (let locateEngine of installableLocateEngines) {
|
||||||
var menuitem = document.createElement("menuitem");
|
var menuitem = document.createElement("menuitem");
|
||||||
menuitem.setAttribute("label", locateEngine.label);
|
menuitem.setAttribute("label", locateEngine.label);
|
||||||
menuitem.setAttribute("class", "menuitem-iconic");
|
menuitem.setAttribute("class", "menuitem-iconic");
|
||||||
|
@ -147,7 +147,7 @@ var Zotero_LocateMenu = new function() {
|
||||||
var optionsToShow = {};
|
var optionsToShow = {};
|
||||||
|
|
||||||
// check which view options are available
|
// check which view options are available
|
||||||
for each(var item in selectedItems) {
|
for (let item of selectedItems) {
|
||||||
for(var viewOption in ViewOptions) {
|
for(var viewOption in ViewOptions) {
|
||||||
if(!optionsToShow[viewOption]) {
|
if(!optionsToShow[viewOption]) {
|
||||||
optionsToShow[viewOption] = ViewOptions[viewOption].canHandleItem(item);
|
optionsToShow[viewOption] = ViewOptions[viewOption].canHandleItem(item);
|
||||||
|
@ -172,7 +172,7 @@ var Zotero_LocateMenu = new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(addExtraOptions) {
|
if(addExtraOptions) {
|
||||||
for each(var viewOption in [key for(key in optionsToShow) if(key[0] === "_")]) {
|
for (let viewOption in optionsToShow) {
|
||||||
if(viewOption[0] !== "_" || !optionsToShow[viewOption]) continue;
|
if(viewOption[0] !== "_" || !optionsToShow[viewOption]) continue;
|
||||||
locateMenu.insertBefore(_addViewOption(selectedItems, viewOption.substr(1),
|
locateMenu.insertBefore(_addViewOption(selectedItems, viewOption.substr(1),
|
||||||
ViewOptions[viewOption], showIcons), lastNode);
|
ViewOptions[viewOption], showIcons), lastNode);
|
||||||
|
@ -192,9 +192,9 @@ var Zotero_LocateMenu = new function() {
|
||||||
var availableEngines = [];
|
var availableEngines = [];
|
||||||
|
|
||||||
// check which engines can translate an item
|
// check which engines can translate an item
|
||||||
for each(var engine in customEngines) {
|
for (let engine of customEngines) {
|
||||||
// require a submission for at least one selected item
|
// require a submission for at least one selected item
|
||||||
for each(var item in selectedItems) {
|
for (let item of selectedItems) {
|
||||||
if(engine.getItemSubmission(item)) {
|
if(engine.getItemSubmission(item)) {
|
||||||
availableEngines.push(engine);
|
availableEngines.push(engine);
|
||||||
break;
|
break;
|
||||||
|
@ -217,7 +217,7 @@ var Zotero_LocateMenu = new function() {
|
||||||
locateFn = this.locateItem;
|
locateFn = this.locateItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
for each(var engine in engines) {
|
for (let engine of engines) {
|
||||||
var menuitem = _createMenuItem(engine.name, null, engine.description);
|
var menuitem = _createMenuItem(engine.name, null, engine.description);
|
||||||
menuitem.setAttribute("class", "menuitem-iconic");
|
menuitem.setAttribute("class", "menuitem-iconic");
|
||||||
menuitem.setAttribute("image", engine.icon);
|
menuitem.setAttribute("image", engine.icon);
|
||||||
|
@ -246,7 +246,7 @@ var Zotero_LocateMenu = new function() {
|
||||||
if(!window.Zotero_Browser || !window.Zotero_Browser.tabbrowser) return locateEngines;
|
if(!window.Zotero_Browser || !window.Zotero_Browser.tabbrowser) return locateEngines;
|
||||||
|
|
||||||
var links = Zotero_Browser.tabbrowser.selectedBrowser.contentDocument.getElementsByTagName("link");
|
var links = Zotero_Browser.tabbrowser.selectedBrowser.contentDocument.getElementsByTagName("link");
|
||||||
for each(var link in links) {
|
for (let link of links) {
|
||||||
if(!link.getAttribute) continue;
|
if(!link.getAttribute) continue;
|
||||||
var rel = link.getAttribute("rel");
|
var rel = link.getAttribute("rel");
|
||||||
if(rel && rel === "search") {
|
if(rel && rel === "search") {
|
||||||
|
@ -287,7 +287,7 @@ var Zotero_LocateMenu = new function() {
|
||||||
|
|
||||||
var urls = [];
|
var urls = [];
|
||||||
var postDatas = [];
|
var postDatas = [];
|
||||||
for each(var item in selectedItems) {
|
for (let item of selectedItems) {
|
||||||
var submission = selectedEngine.getItemSubmission(item);
|
var submission = selectedEngine.getItemSubmission(item);
|
||||||
if(submission) {
|
if(submission) {
|
||||||
urls.push(submission.uri.spec);
|
urls.push(submission.uri.spec);
|
||||||
|
@ -347,7 +347,7 @@ var Zotero_LocateMenu = new function() {
|
||||||
|
|
||||||
this.handleItems = function(items, event) {
|
this.handleItems = function(items, event) {
|
||||||
var attachments = [];
|
var attachments = [];
|
||||||
for each(var item in items) {
|
for (let item of items) {
|
||||||
var attachment = _getFirstAttachmentWithMIMEType(item, this._mimeTypes);
|
var attachment = _getFirstAttachmentWithMIMEType(item, this._mimeTypes);
|
||||||
if(attachment) attachments.push(attachment.id);
|
if(attachment) attachments.push(attachment.id);
|
||||||
}
|
}
|
||||||
|
@ -357,9 +357,12 @@ var Zotero_LocateMenu = new function() {
|
||||||
|
|
||||||
function _getFirstAttachmentWithMIMEType(item, mimeTypes) {
|
function _getFirstAttachmentWithMIMEType(item, mimeTypes) {
|
||||||
var attachments = (item.isAttachment() ? [item] : Zotero.Items.get(item.getBestAttachments()));
|
var attachments = (item.isAttachment() ? [item] : Zotero.Items.get(item.getBestAttachments()));
|
||||||
for each(var attachment in attachments) {
|
for (let i = 0; i < attachments.length; i++) {
|
||||||
if(mimeTypes.indexOf(attachment.attachmentMIMEType) !== -1
|
let attachment = attachments[i];
|
||||||
&& attachment.attachmentLinkMode !== Zotero.Attachments.LINK_MODE_LINKED_URL) return attachment;
|
if (mimeTypes.indexOf(attachment.attachmentMIMEType) !== -1
|
||||||
|
&& attachment.attachmentLinkMode !== Zotero.Attachments.LINK_MODE_LINKED_URL) {
|
||||||
|
return attachment;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -375,8 +378,8 @@ var Zotero_LocateMenu = new function() {
|
||||||
this.canHandleItem = function(item) _getURL(item) !== false;
|
this.canHandleItem = function(item) _getURL(item) !== false;
|
||||||
|
|
||||||
this.handleItems = function(items, event) {
|
this.handleItems = function(items, event) {
|
||||||
var urls = [_getURL(item) for each(item in items)];
|
var urls = [for (item of items) _getURL(item)];
|
||||||
ZoteroPane_Local.loadURI([url for each(url in urls) if(url)], event);
|
ZoteroPane_Local.loadURI([for (url of urls) if (url) url], event);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _getURL(item) {
|
function _getURL(item) {
|
||||||
|
@ -394,7 +397,7 @@ var Zotero_LocateMenu = new function() {
|
||||||
var attachments = item.getAttachments();
|
var attachments = item.getAttachments();
|
||||||
if(attachments) {
|
if(attachments) {
|
||||||
// look through url fields for non-file:/// attachments
|
// look through url fields for non-file:/// attachments
|
||||||
for each(var attachment in Zotero.Items.get(attachments)) {
|
for (let attachment of Zotero.Items.get(attachments)) {
|
||||||
var urlField = attachment.getField('url');
|
var urlField = attachment.getField('url');
|
||||||
if(urlField) return urlField;
|
if(urlField) return urlField;
|
||||||
}
|
}
|
||||||
|
@ -440,7 +443,7 @@ var Zotero_LocateMenu = new function() {
|
||||||
|
|
||||||
this.handleItems = function(items, event) {
|
this.handleItems = function(items, event) {
|
||||||
var attachments = [];
|
var attachments = [];
|
||||||
for each(var item in items) {
|
for (let item of items) {
|
||||||
var attachment = _getFile(item);
|
var attachment = _getFile(item);
|
||||||
if(attachment) attachments.push(attachment.id);
|
if(attachment) attachments.push(attachment.id);
|
||||||
}
|
}
|
||||||
|
@ -450,7 +453,8 @@ var Zotero_LocateMenu = new function() {
|
||||||
|
|
||||||
function _getFile(item) {
|
function _getFile(item) {
|
||||||
var attachments = (item.isAttachment() ? [item] : Zotero.Items.get(item.getBestAttachments()));
|
var attachments = (item.isAttachment() ? [item] : Zotero.Items.get(item.getBestAttachments()));
|
||||||
for each(var attachment in attachments) {
|
for (let i = 0; i < attachments.length; i++) {
|
||||||
|
let attachment = attachments[i];
|
||||||
if(!ViewOptions.snapshot.canHandleItem(attachment)
|
if(!ViewOptions.snapshot.canHandleItem(attachment)
|
||||||
&& !ViewOptions.pdf.canHandleItem(attachment)
|
&& !ViewOptions.pdf.canHandleItem(attachment)
|
||||||
&& attachment.attachmentLinkMode !== Zotero.Attachments.LINK_MODE_LINKED_URL) {
|
&& attachment.attachmentLinkMode !== Zotero.Attachments.LINK_MODE_LINKED_URL) {
|
||||||
|
@ -478,7 +482,7 @@ var Zotero_LocateMenu = new function() {
|
||||||
|
|
||||||
this.handleItems = function(items, event) {
|
this.handleItems = function(items, event) {
|
||||||
var attachments = [];
|
var attachments = [];
|
||||||
for each(var item in items) {
|
for (let item of items) {
|
||||||
var attachment = _getBestNonNativeAttachment(item);
|
var attachment = _getBestNonNativeAttachment(item);
|
||||||
if(attachment) attachments.push(attachment.id);
|
if(attachment) attachments.push(attachment.id);
|
||||||
}
|
}
|
||||||
|
@ -488,7 +492,8 @@ var Zotero_LocateMenu = new function() {
|
||||||
|
|
||||||
function _getBestNonNativeAttachment(item) {
|
function _getBestNonNativeAttachment(item) {
|
||||||
var attachments = (item.isAttachment() ? [item] : Zotero.Items.get(item.getBestAttachments()));
|
var attachments = (item.isAttachment() ? [item] : Zotero.Items.get(item.getBestAttachments()));
|
||||||
for each(var attachment in attachments) {
|
for (let i = 0; i < attachments.length; i++) {
|
||||||
|
let attachment = attachments[i];
|
||||||
if(attachment.attachmentLinkMode !== Zotero.Attachments.LINK_MODE_LINKED_URL) {
|
if(attachment.attachmentLinkMode !== Zotero.Attachments.LINK_MODE_LINKED_URL) {
|
||||||
var file = attachment.getFile();
|
var file = attachment.getFile();
|
||||||
if(file) {
|
if(file) {
|
||||||
|
@ -534,7 +539,7 @@ var Zotero_LocateMenu = new function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.handleItems = function(items, event) {
|
this.handleItems = function(items, event) {
|
||||||
for each(var item in items) {
|
for (let item of items) {
|
||||||
var attachment = _getBestFile(item);
|
var attachment = _getBestFile(item);
|
||||||
if(attachment) {
|
if(attachment) {
|
||||||
ZoteroPane_Local.showAttachmentInFilesystem(attachment.id);
|
ZoteroPane_Local.showAttachmentInFilesystem(attachment.id);
|
||||||
|
@ -562,7 +567,7 @@ var Zotero_LocateMenu = new function() {
|
||||||
this.canHandleItem = function(item) item.isRegularItem();
|
this.canHandleItem = function(item) item.isRegularItem();
|
||||||
this.handleItems = function(items, event) {
|
this.handleItems = function(items, event) {
|
||||||
var urls = [];
|
var urls = [];
|
||||||
for each(var item in items) {
|
for (let item of items) {
|
||||||
if(!item.isRegularItem()) continue;
|
if(!item.isRegularItem()) continue;
|
||||||
var url = Zotero.OpenURL.resolve(item);
|
var url = Zotero.OpenURL.resolve(item);
|
||||||
if(url) urls.push(url);
|
if(url) urls.push(url);
|
||||||
|
|
|
@ -911,7 +911,8 @@ var ZoteroPane = new function()
|
||||||
}
|
}
|
||||||
|
|
||||||
var newids = [];
|
var newids = [];
|
||||||
for each(var id in ids) {
|
for (let i = 0; i < ids.length; i++) {
|
||||||
|
let id = ids[i];
|
||||||
id = parseInt(id);
|
id = parseInt(id);
|
||||||
if (isNaN(id)) {
|
if (isNaN(id)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1442,7 +1443,7 @@ var ZoteroPane = new function()
|
||||||
var disabled = !this.canEdit() || !(items.length == 1 && items[0].isRegularItem());
|
var disabled = !this.canEdit() || !(items.length == 1 && items[0].isRegularItem());
|
||||||
|
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
for each(var node in popup.childNodes) {
|
for (let node of popup.childNodes) {
|
||||||
node.disabled = true;
|
node.disabled = true;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -1844,7 +1845,8 @@ var ZoteroPane = new function()
|
||||||
// automatically converting text/html to plaintext rather than using
|
// automatically converting text/html to plaintext rather than using
|
||||||
// text/unicode. (That may be fixable, however.)
|
// text/unicode. (That may be fixable, however.)
|
||||||
var canCopy = false;
|
var canCopy = false;
|
||||||
for each(var item in items) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
|
let item = items[i];
|
||||||
if (item.isRegularItem()) {
|
if (item.isRegularItem()) {
|
||||||
canCopy = true;
|
canCopy = true;
|
||||||
break;
|
break;
|
||||||
|
@ -2096,9 +2098,8 @@ var ZoteroPane = new function()
|
||||||
];
|
];
|
||||||
|
|
||||||
var m = {};
|
var m = {};
|
||||||
var i = 0;
|
for (let i = 0; i < options.length; i++) {
|
||||||
for each(var option in options) {
|
m[options[i]] = i;
|
||||||
m[option] = i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var menu = document.getElementById('zotero-collectionmenu');
|
var menu = document.getElementById('zotero-collectionmenu');
|
||||||
|
@ -2205,7 +2206,8 @@ var ZoteroPane = new function()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide and enable all actions by default (so if they're shown they're enabled)
|
// Hide and enable all actions by default (so if they're shown they're enabled)
|
||||||
for each(var pos in m) {
|
for (let i in m) {
|
||||||
|
let pos = m[i];
|
||||||
menu.childNodes[pos].setAttribute('hidden', true);
|
menu.childNodes[pos].setAttribute('hidden', true);
|
||||||
menu.childNodes[pos].setAttribute('disabled', false);
|
menu.childNodes[pos].setAttribute('disabled', false);
|
||||||
}
|
}
|
||||||
|
@ -2246,9 +2248,8 @@ var ZoteroPane = new function()
|
||||||
];
|
];
|
||||||
|
|
||||||
var m = {};
|
var m = {};
|
||||||
var i = 0;
|
for (let i = 0; i < options.length; i++) {
|
||||||
for each(var option in options) {
|
m[options[i]] = i;
|
||||||
m[option] = i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var menu = document.getElementById('zotero-itemmenu');
|
var menu = document.getElementById('zotero-itemmenu');
|
||||||
|
@ -2286,7 +2287,8 @@ var ZoteroPane = new function()
|
||||||
canIndex = false;
|
canIndex = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for each(var item in items) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
|
let item = items[i];
|
||||||
if (canMerge && !item.isRegularItem() || itemGroup.isDuplicates()) {
|
if (canMerge && !item.isRegularItem() || itemGroup.isDuplicates()) {
|
||||||
canMerge = false;
|
canMerge = false;
|
||||||
}
|
}
|
||||||
|
@ -2318,7 +2320,8 @@ var ZoteroPane = new function()
|
||||||
}
|
}
|
||||||
|
|
||||||
var canCreateParent = true;
|
var canCreateParent = true;
|
||||||
for each(var item in items) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
|
let item = items[i];
|
||||||
if (!item.isTopLevelItem() || !item.isAttachment()) {
|
if (!item.isTopLevelItem() || !item.isAttachment()) {
|
||||||
canCreateParent = false;
|
canCreateParent = false;
|
||||||
break;
|
break;
|
||||||
|
@ -2416,10 +2419,9 @@ var ZoteroPane = new function()
|
||||||
|
|
||||||
// Block certain actions on files if no access
|
// Block certain actions on files if no access
|
||||||
if (item.isImportedAttachment() && !itemGroup.filesEditable) {
|
if (item.isImportedAttachment() && !itemGroup.filesEditable) {
|
||||||
var d = [m.deleteFromLibrary, m.createParent, m.renameAttachments];
|
[m.deleteFromLibrary, m.createParent, m.renameAttachments].forEach(function (x) {
|
||||||
for each(var val in d) {
|
disable.push(x);
|
||||||
disable.push(val);
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2471,7 +2473,8 @@ var ZoteroPane = new function()
|
||||||
menu.childNodes[m.reindexItem].setAttribute('label', Zotero.getString('pane.items.menu.reindexItem' + multiple));
|
menu.childNodes[m.reindexItem].setAttribute('label', Zotero.getString('pane.items.menu.reindexItem' + multiple));
|
||||||
|
|
||||||
// Hide and enable all actions by default (so if they're shown they're enabled)
|
// Hide and enable all actions by default (so if they're shown they're enabled)
|
||||||
for each(var pos in m) {
|
for (let i in m) {
|
||||||
|
let pos = m[i];
|
||||||
menu.childNodes[pos].setAttribute('hidden', true);
|
menu.childNodes[pos].setAttribute('hidden', true);
|
||||||
menu.childNodes[pos].setAttribute('disabled', false);
|
menu.childNodes[pos].setAttribute('disabled', false);
|
||||||
}
|
}
|
||||||
|
@ -2770,7 +2773,8 @@ var ZoteroPane = new function()
|
||||||
uris = [uris];
|
uris = [uris];
|
||||||
}
|
}
|
||||||
|
|
||||||
for each(var uri in uris) {
|
for (let i = 0; i < uris.length; i++) {
|
||||||
|
let uri = uris[i];
|
||||||
// Ignore javascript: and data: URIs
|
// Ignore javascript: and data: URIs
|
||||||
if (uri.match(/^(javascript|data):/)) {
|
if (uri.match(/^(javascript|data):/)) {
|
||||||
return;
|
return;
|
||||||
|
@ -2925,7 +2929,7 @@ var ZoteroPane = new function()
|
||||||
var itemGroup = self.collectionsView._getItemAtRow(self.collectionsView.selection.currentIndex);
|
var itemGroup = self.collectionsView._getItemAtRow(self.collectionsView.selection.currentIndex);
|
||||||
disabled = !itemGroup.editable;
|
disabled = !itemGroup.editable;
|
||||||
}
|
}
|
||||||
for each(var menuitem in menu.firstChild.childNodes) {
|
for (let menuitem of menu.firstChild.childNodes) {
|
||||||
menuitem.disabled = disabled;
|
menuitem.disabled = disabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3442,7 +3446,8 @@ var ZoteroPane = new function()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for each(var item in items) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
|
let item = items[i];
|
||||||
if (item.isRegularItem()) {
|
if (item.isRegularItem()) {
|
||||||
// Prefer local file attachments
|
// Prefer local file attachments
|
||||||
var uri = Components.classes["@mozilla.org/network/standard-url;1"]
|
var uri = Components.classes["@mozilla.org/network/standard-url;1"]
|
||||||
|
@ -3510,7 +3515,8 @@ var ZoteroPane = new function()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for each(var itemID in itemIDs) {
|
for (let i = 0; i < itemIDs.length; i++) {
|
||||||
|
let itemID = itemIDs[i];
|
||||||
var item = Zotero.Items.get(itemID);
|
var item = Zotero.Items.get(itemID);
|
||||||
if (!item.isAttachment()) {
|
if (!item.isAttachment()) {
|
||||||
throw ("Item " + itemID + " is not an attachment in ZoteroPane_Local.viewAttachment()");
|
throw ("Item " + itemID + " is not an attachment in ZoteroPane_Local.viewAttachment()");
|
||||||
|
@ -4101,12 +4107,12 @@ var ZoteroPane = new function()
|
||||||
this.serializePersist = function() {
|
this.serializePersist = function() {
|
||||||
if(!_unserialized) return;
|
if(!_unserialized) return;
|
||||||
var serializedValues = {};
|
var serializedValues = {};
|
||||||
for each(var el in document.getElementsByAttribute("zotero-persist", "*")) {
|
for (let el of document.getElementsByAttribute("zotero-persist", "*")) {
|
||||||
if(!el.getAttribute) continue;
|
if(!el.getAttribute) continue;
|
||||||
var id = el.getAttribute("id");
|
var id = el.getAttribute("id");
|
||||||
if(!id) continue;
|
if(!id) continue;
|
||||||
var elValues = {};
|
var elValues = {};
|
||||||
for each(var attr in el.getAttribute("zotero-persist").split(/[\s,]+/)) {
|
for (let attr of el.getAttribute("zotero-persist").split(/[\s,]+/)) {
|
||||||
var attrValue = el.getAttribute(attr);
|
var attrValue = el.getAttribute(attr);
|
||||||
elValues[attr] = attrValue;
|
elValues[attr] = attrValue;
|
||||||
}
|
}
|
||||||
|
@ -4200,10 +4206,10 @@ var ZoteroPane = new function()
|
||||||
"observe":function(aSubject, aTopic, aData) {
|
"observe":function(aSubject, aTopic, aData) {
|
||||||
if(aTopic == "zotero-reloaded") {
|
if(aTopic == "zotero-reloaded") {
|
||||||
Zotero.debug("Reloading Zotero pane");
|
Zotero.debug("Reloading Zotero pane");
|
||||||
for each(var func in _reloadFunctions) func(aData);
|
for (let func of _reloadFunctions) func(aData);
|
||||||
} else if(aTopic == "zotero-before-reload") {
|
} else if(aTopic == "zotero-before-reload") {
|
||||||
Zotero.debug("Zotero pane caught before-reload event");
|
Zotero.debug("Zotero pane caught before-reload event");
|
||||||
for each(var func in _beforeReloadFunctions) func(aData);
|
for (let func of _beforeReloadFunctions) func(aData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,13 +39,12 @@
|
||||||
zoteroInit(ed);
|
zoteroInit(ed);
|
||||||
});
|
});
|
||||||
|
|
||||||
var commands = ["Cut", "Copy", "Paste"];
|
["Cut", "Copy", "Paste"].forEach(function (command) {
|
||||||
for each(var command in commands) {
|
|
||||||
let cmd = command;
|
let cmd = command;
|
||||||
ed.addCommand(command, function (ui, value) {
|
ed.addCommand(command, function (ui, value) {
|
||||||
zoteroExecCommand(ed.getDoc(), cmd, ui, value);
|
zoteroExecCommand(ed.getDoc(), cmd, ui, value);
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
fix_list_elements : true,
|
fix_list_elements : true,
|
||||||
|
|
Loading…
Reference in a new issue