Skip to content

Instantly share code, notes, and snippets.

@fogrew
Last active January 25, 2017 17:32
Show Gist options
  • Save fogrew/522f3e89ebd0ec25ff618b20b6d0cb30 to your computer and use it in GitHub Desktop.
Save fogrew/522f3e89ebd0ec25ff618b20b6d0cb30 to your computer and use it in GitHub Desktop.
Authors of comments in issue: sort and remove duplicates
// get all elements with authors
var $authors = document.querySelectorAll('.comment .author');
var authors = [];
$authors.forEach(item => authors.push(item.innerText));
// sorting
authors.sort();
// remove duplicates
[...new Set(authors)];
// bookmarklet
var a=[];$$('.comment .author').map(i=>a.push(i.innerText));a.sort();[...new Set(a)];
// get all elements with authors
var $authors = document.querySelectorAll('.comment .author');
var authors = [];
$authors.forEach(item => {
var text = item.innerText;
if(!authors[text]) {
authors.push(text);
}
});
// sorting
authors.sort();
// bookmarklet
var a=[];$$('.comment .author').map(i=>{var t=i.innerText;if(!a[t])a.push(t)});a.sort();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment