From 7fbe225678acd65e3e6230d3b170500f644262db Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 22 Sep 2014 08:19:31 -0700 Subject: [PATCH] nmbug.js: List tags as in a

instead of as

  • in a
      This is more compact, since there are currently 27 tags in notmuch's nmbug list ;). I also switched to more generic variable names (tag_list, tag, and element) so that future tag-name changes are less invasive. --- nmbug.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/nmbug.js b/nmbug.js index daf6120..f2640a6 100644 --- a/nmbug.js +++ b/nmbug.js @@ -110,18 +110,19 @@ nmbug = { content.innerHTML = 'Edit tags for ' + message_id; dialog.appendChild(content); - var ul = frame.document.createElement('ul'); - dialog.appendChild(ul); + var tag_list = frame.document.createElement('p'); + dialog.appendChild(tag_list); for (var i = 0; i < available_tags.length; i++) { - var li = frame.document.createElement('li'); - li.innerHTML = available_tags[i]; - li.style.cursor = 'pointer'; + var tag = frame.document.createElement('a'); + tag.innerHTML = available_tags[i]; + tag.style.cursor = 'pointer'; if (tags.indexOf(available_tags[i]) >= 0) { - li.style.backgroundColor = 'lime'; + tag.style.backgroundColor = 'lime'; } - li.onclick = this._toggle_tag.bind( - this, message_id, available_tags[i], li); - ul.appendChild(li); + tag.onclick = this._toggle_tag.bind( + this, message_id, available_tags[i], tag); + tag_list.appendChild(tag); + tag_list.appendChild(frame.document.createTextNode(' ')); } var close = frame.document.createElement('button'); close.innerHTML = 'Close'; @@ -134,14 +135,14 @@ nmbug = { dialog.show(); }, - _toggle_tag: function (message_id, tag, li) { + _toggle_tag: function (message_id, tag, element) { var prefix; - if (li.style.backgroundColor == 'lime') { + if (element.style.backgroundColor == 'lime') { prefix = '-'; /* unset */ - li.style.backgroundColor = null; + element.style.backgroundColor = null; } else { prefix = '+'; /* set */ - li.style.backgroundColor = 'lime'; + element.style.backgroundColor = 'lime'; } var url = [ nmbug_server, -- 2.26.2