From 1ef3b56c8763994e28305723c65474324d5b676f Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 20 Sep 2014 15:32:38 -0700 Subject: [PATCH] nmbug.js: Stub out a dialog for editing tags It lists the associated Message-ID and tags, but I haven't added JavaScript to support editing the tag list yet. I'm using the element [1] to float this dialog over the launching page (e.g. Gmane), so we don't have to worry about mucking with whatever's going on there ;). [1]: https://html.spec.whatwg.org/multipage/forms.html#the-dialog-element --- nmbug.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/nmbug.js b/nmbug.js index 3321729..ecf03d8 100644 --- a/nmbug.js +++ b/nmbug.js @@ -25,7 +25,29 @@ nmbug = { request.send(); }, _edit_tags: function (message_id, tags) { - alert('edit ' + tags + ' for ' + message_id); + var dialog = document.createElement('dialog'); + + var content = document.createElement('p'); + content.innerHTML = 'Edit tags for ' + message_id; + dialog.appendChild(content); + + var ul = document.createElement('ul'); + dialog.appendChild(ul); + for (var i = 0; i < tags.length; i++) { + var li = document.createElement('li'); + li.innerHTML = tags[i]; + ul.appendChild(li); + } + var close = document.createElement('button'); + close.innerHTML = 'Close'; + close.onclick = function () { + dialog.close(); + }; + dialog.appendChild(close); + + document.body.appendChild(dialog); + + dialog.show(); }, }; -- 2.26.2