nmbug.js: Add tag-toggling with a stub _toggle_tag
authorW. Trevor King <wking@tremily.us>
Sun, 21 Sep 2014 13:06:18 +0000 (06:06 -0700)
committerW. Trevor King <wking@tremily.us>
Sun, 21 Sep 2014 13:33:20 +0000 (06:33 -0700)
This takes care of binding the new method and adjusting the CSS.

nmbug.js

index 3493377d02e6bd88a53d59f92072800541083d01..669272da4ab25e58d03008d2d3d3bf53343d79ff 100644 (file)
--- a/nmbug.js
+++ b/nmbug.js
@@ -95,9 +95,12 @@ nmbug = {
                for (var i = 0; i < available_tags.length; i++) {
                        var li = document.createElement('li');
                        li.innerHTML = available_tags[i];
+                       li.style.cursor = 'pointer';
                        if (tags.indexOf(available_tags[i]) >= 0) {
                                li.style.backgroundColor = 'lime';
                        }
+                       li.onclick = this._toggle_tag.bind(
+                               this, message_id, available_tags[i], li);
                        ul.appendChild(li);
                }
                var close = document.createElement('button');
@@ -111,6 +114,9 @@ nmbug = {
 
                dialog.show();
        },
+       _toggle_tag: function (message_id, tag, li) {
+               alert('toggle ' + tag + ' for ' + message_id);
+       },
 };
 
 var _gmane_handler = {