Skip to content

Instantly share code, notes, and snippets.

@zarinfam
Created July 11, 2019 09:02
Show Gist options
  • Save zarinfam/1264ef619af19754c846d93986d8c5a7 to your computer and use it in GitHub Desktop.
Save zarinfam/1264ef619af19754c846d93986d8c5a7 to your computer and use it in GitHub Desktop.
Created with Copy to Gist
function fixUrls(){
$('a').each(function () {
//get the original URL
var theURL = $(this).attr('href');
if (theURL.includes('t.umblr.com/redirect?')) {
//split at the equals sign
var one = theURL.split('=');
//split again at the amperstand
var two = one[1].split('&')
//get rif of the URL encoding
var decodedURL = decodeURIComponent(two[0])
//put decoded URL in the href attribute
$(this).attr('href', decodedURL)
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment