Volafile Chat Timestamps

Adds timestamps to chat messages on Volafile.

Autor
Arnold François Lecherche
Dziennych instalacji
0
Wszystkich instalacji
4
Oceny
0 0 0
Wersja
1.00
Utworzono
10-05-2021
Zaktualizowano
10-05-2021
Licencja
Brak licencji
Dotyczy

This prepends an ISO-formatted UTC timestamp to each message in a Volafile room; keep in mind that these timestamps are not saved, so if you refresh the page or return to an idle tab, any messages loaded will have the timestamp of the reload or return, not necessarily the time when the message was created.

Alternatively, you can make this a bookmarklet; just bookmark this very page, change the bookmark's title to "Volafile Chat Timestamps", and change its URL to this:

javascript:(function(w%2Cd%2CM)%7B%27use%20strict%27%3Bvar%20obs%3Dnew%20M(observ)%2Cconf%3D%7BchildList%3Atrue%7D%2Ca%3Dfalse%2Ck%3Bfunction%20observ(muts)%7Bvar%20i%3Dmuts.length%2Cm%2Cj%3Bwhile(i--)%7Bm%3Dmuts%5Bi%5D.addedNodes%3Bj%3Dm.length%3Bwhile(j--)if(m%5Bj%5D.hasAttribute(%27data-timestamp%27)%3D%3D%3Dfalse)timestamp(m%5Bj%5D)%7D%7Dfunction%20timestamp(msg)%7Bvar%20unam%3Dmsg.getElementsByClassName(%27username%27)%5B0%5D%2Ctime%2Cts%3Bif(!unam)return%3Bts%3Dcreate_element(%27span%27%2Cnew%20Date().toISOString()%2B%27%20%7C%20%27)%3Bts.setAttribute(%27class%27%2C%27userscript_chat_timestamp%27)%3Bunam.insertBefore(ts%2Cunam.childNodes%5B0%5D)%3Bmsg.setAttribute(%27data-timestamp%27%2C%27true%27)%7Dfunction%20create_element(elem%2Ctxt)%7Bvar%20uelem%3Dd.createElement(elem)%3Buelem.appendChild(d.createTextNode(txt))%3Breturn%20uelem%7Dfunction%20init()%7Bvar%20msgs%3Bif(a)return%20k%26%26w.clearInterval(k)%3Belse%20k%3Dk%7C%7Cw.setInterval(init%2C%201e3)%3B%0Amsgs%3Dd.getElementById(%27chat_messages%27)%3Bif(!msgs)return%3Bobs.observe(msgs%2Cconf)%3Ba%3Dtrue%3Bif(k)w.clearInterval(k)%7Dinit()%3Bd.addEventListener(%27DOMContentLoaded%27%2Cinit%2Cfalse)%3Bw.addEventListener(%27load%27%2Cinit%2Cfalse)%7D)(window%2Cdocument%2CMutationObserver)


Then click the bookmarklet while in any room where you want to see where you left off.