Created
March 15, 2016 00:27
-
-
Save shgysk8zer0/575c647afb6fcf362f27 to your computer and use it in GitHub Desktop.
Quickly get info from <link>s,filtering unwanted `rel`s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function $(query) { | |
return Array.from(document.querySelectorAll(query)); | |
} | |
$('link').filter(link = > ![ | |
'icon', | |
'stylesheet', | |
'next', | |
'prev' | |
].some(rel => link.relList.contains(rel))).reduce((links, link) => { | |
links[link.rel] = link.href; | |
return links | |
}, {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment