Skip to content

Instantly share code, notes, and snippets.

@paulca
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulca/1d7a821e915d6814372a to your computer and use it in GitHub Desktop.
Save paulca/1d7a821e915d6814372a to your computer and use it in GitHub Desktop.
<script type="javascript">
(function($){
var params, source;
params = function(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
source = params('source')
if(source != '')
{
$('a[href^="https://ti.to"]').each(function(index, item){
url = $(item).attr('href') + '?source=' + source;
$(item).attr('href', url);
})
}
})(jQuery)
</script>
@carlwood
Copy link

Good stuff! Just tweaked the script to work with the new beta.tito.io link. Are you going to add a new gist? Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment