Created
July 11, 2019 09:02
-
-
Save zarinfam/1264ef619af19754c846d93986d8c5a7 to your computer and use it in GitHub Desktop.
Created with Copy to Gist
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 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