Skip to content

Instantly share code, notes, and snippets.

@watagashi
Last active August 9, 2021 03:50
Show Gist options
  • Save watagashi/eef5afe39283a7b6d1e54bdb74446ceb to your computer and use it in GitHub Desktop.
Save watagashi/eef5afe39283a7b6d1e54bdb74446ceb to your computer and use it in GitHub Desktop.
registerPlugin({
newMessageElement: function (elem) {
var removeBr = function (st) {
var br;
for (;;) {
br = st.getElementsByTagName('br')[0];
if (!br) return;
try {
st.replaceChild(document.createTextNode(' \r'), br);
} catch (e) {
// parent of node to be replaced is already missing.
return;
}
}
},
searchStatus = function (elem) {
var st = elem.getElementsByClassName('status')[0];
if (!st) return;
removeBr(st);
return st;
},
st = elem;
while (st) {
st = searchStatus(st);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment