Skip to content

Instantly share code, notes, and snippets.

@madeingnecca
Last active July 26, 2019 09:03
Show Gist options
  • Save madeingnecca/6805e87f98e41dc407f0ca8bcba72ef2 to your computer and use it in GitHub Desktop.
Save madeingnecca/6805e87f98e41dc407f0ca8bcba72ef2 to your computer and use it in GitHub Desktop.
Semrush print hierarchy (source)
(function() {
var data = {}, html, url, i;
$('td.sa-sortingColumn a').each(function() {
var url = $.trim($(this).attr('title'));
data[url] = $(this).closest('tr').find('td.sa-ta-left a').map(function() {
return $(this).attr('href');
}).get();
});
html = '';
html += '<ul>';
for (url in data) {
html += '<li>';
html += '<span>' + url + '</span>';
html += '<ul>';
for (i = 0; i < data[url].length; i++) {
html += '<li>' + data[url][i] + '</li>';
}
html += '</ul>';
html += '</li>';
}
html += '</ul>';
var b=window.open();
b.document.write(html);
b.document.close()
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment