Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remove non-chat log lines from e.g. http://logs.libuv.org/tc39/latest
// Remove non-chat log lines from e.g. http://logs.libuv.org/tc39/latest
// paste in debugger console and run, or see _bookmarklet.md for a URL you can add to your favorites bar for the same.
(function () {
function remove(name) {
let elems = document.getElementsByClassName(name);
do {
let e = elems[0];
if (!e) break;
let parent = elems[0].parentNode;
parent.removeChild(e);
elems = document.getElementsByClassName(name);
} while (elems && elems.length > 0);
}
remove("join");
remove("quit");
remove("part");
// remove("nick");
})()

(I can't seem to use markdown to make an easy-to-drag-and-drop URL.)

Copy the following to a bookmark and simply click it to run the code on the page.

javascript:!function()%7Bfunction%20e(e)%7Bvar%20t=document.getElementsByClassName(e);do%7Bvar%20n=t%5B0%5D;if(!n)break;t%5B0%5D.parentNode.removeChild(n),t=document.getElementsByClassName(e)%7Dwhile(t&&t.length%3E0)%7De(%22join%22),e(%22quit%22),e(%22part%22)%7D();

let uglify = require('uglify-js');
let code = uglify.minify(`
(function () {
function remove(name) {
var elems = document.getElementsByClassName(name);
do {
var e = elems[0];
if (!e) break;
var parent = elems[0].parentNode;
parent.removeChild(e);
elems = document.getElementsByClassName(name);
} while (elems && elems.length > 0);
}
remove("join");
remove("quit");
remove("part");
// remove("nick");
})()
`).code;
let result = encodeURI('javascript:' + code);
console.log(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment