commit 75dd27bf5b4f3b26f19ad17111f3842d57729e5f
parent 02d6ca1058cd648e2e806cd074efdb6b514494ca
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 16 Feb 2012 19:43:38 -0500
Remove setAttribute('onclick'...) with embedded id for AMO
Diffstat:
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/chrome/content/zotero/itemPane.js b/chrome/content/zotero/itemPane.js
@@ -98,6 +98,8 @@ var ZoteroItemPane = new function() {
var notes = Zotero.Items.get(item.getNotes());
if (notes.length) {
for(var i = 0; i < notes.length; i++) {
+ let id = notes[i].id;
+
var icon = document.createElement('image');
icon.setAttribute('src','chrome://zotero/skin/treeitem-note.png');
@@ -109,8 +111,8 @@ var ZoteroItemPane = new function() {
label.setAttribute('crop','end');
var box = document.createElement('box');
- box.setAttribute('onclick',"ZoteroPane_Local.selectItem(" + notes[i].id + ");");
box.setAttribute('class','zotero-clicky');
+ box.addEventListener('click', function () { ZoteroPane_Local.selectItem(id); });
box.appendChild(icon);
box.appendChild(label);
@@ -118,7 +120,7 @@ var ZoteroItemPane = new function() {
var removeButton = document.createElement('label');
removeButton.setAttribute("value","-");
removeButton.setAttribute("class","zotero-clicky zotero-clicky-minus");
- removeButton.setAttribute("onclick","ZoteroItemPane.removeNote(" + notes[i].id + ")");
+ removeButton.addEventListener('click', function () { ZoteroItemPane.removeNote(id); });
}
var row = document.createElement('row');
diff --git a/chrome/content/zotero/itemPane.xul b/chrome/content/zotero/itemPane.xul
@@ -30,7 +30,7 @@
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="include.js"/>
- <script src="itemPane.js"/>
+ <script src="itemPane.js" type="application/javascript;version=1.8"/>
<vbox id="zotero-item-pane" zotero-persist="width">
<!-- Trash -->