From: W. Trevor King Date: Sat, 20 Sep 2014 22:32:38 +0000 (-0700) Subject: nmbug.js: Stub out a dialog for editing tags X-Git-Tag: v0.1.0~30 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1ef3b56c8763994e28305723c65474324d5b676f;p=nmhive.git 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 --- 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(); }, };