Skip to content

Instantly share code, notes, and snippets.

@richmolj
Last active August 29, 2015 13:57
Show Gist options
  • Save richmolj/9468910 to your computer and use it in GitHub Desktop.
Save richmolj/9468910 to your computer and use it in GitHub Desktop.
var api = new UpvtIframeApi('#upvt-iframe');
function slugify (str) {
var slugged = str.replace(/^\s+|\s+$/g, '');
slugged = slugged.toLowerCase()
return slugged.replace(/[^a-z0-9 -]/g, '')
.replace(/\s+/g, '-')
.replace(/-+/g, '-')
}
api.events.onMatchupView = function(matchup) {
var slug = slugify(""+matchup.contestants[0].name+"-vs-"+matchup.contestants[1].name+"");
var selector = "."+slug;
DISQUS.reset({
reload: true,
config: function () {
this.page.identifier = slug;
this.page.url = window.location.href + "/#!/" + slug;
}
});
$(".bracket-intro").fadeOut(500).promise().done(function() {
$('.matchup').hide()
$(selector).fadeIn();
});
}
// <div class="i-heart-ny-vs-adidas">
api.events.onBracketView = function() {
$(".matchup").fadeOut(500).promise().done(function() {
$(".bracket-intro").fadeIn(500);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment