all repos — honk @ b63e7ff3ec139a987a5aaad9614ef4a35d4dee12

my fork of honk

little better refresh indicator
Ted Unangst tedu@tedunangst.com
Mon, 19 Aug 2019 21:03:44 -0400
commit

b63e7ff3ec139a987a5aaad9614ef4a35d4dee12

parent

ef154c38b3942560cfaa8ef27b1e8e4a705fb0a1

2 files changed, 10 insertions(+), 2 deletions(-)

jump to
M docs/changelog.txtdocs/changelog.txt

@@ -2,6 +2,8 @@ changelog

-- next ++ Dynamic refresh. + ++ Reply control. Ack replies to show them on the site. + Schema change. (add flags to honks table)
M views/honkpage.htmlviews/honkpage.html

@@ -15,19 +15,25 @@ {{ if .TopXID }}

<div class="info" id="refreshbox"> <script> var topxid = "{{ .TopXID }}" -function refreshhonks() { +function refreshhonks(btn) { + btn.innerHTML = "refreshing" + btn.disabled = true get("/?topxid=" + escape(topxid), function(xhr) { var doc = xhr.responseXML topxid = doc.children[0].children[1].children[0].innerText var honks = doc.children[0].children[1].children var mebox = document.getElementById("refreshbox") + var newhonks = honks.length - 1 for (var i = honks.length; i > 1; i--) { mebox.insertAdjacentElement('afterend', honks[i-1]) } + btn.innerHTML = "refresh" + btn.disabled = false + btn.parentElement.children[1].innerHTML = " " + newhonks + " new" }) } </script> -<p><button onclick="refreshhonks()">refresh</button> +<p><button onclick="refreshhonks(this)">refresh</button><span></span> </div> {{ end }} {{ range .Honks }}