diff --git a/r2/r2/public/static/js/base.js b/r2/r2/public/static/js/base.js index d5b1d9340..3302b1a16 100644 --- a/r2/r2/public/static/js/base.js +++ b/r2/r2/public/static/js/base.js @@ -35,7 +35,6 @@ $(function() { r.login.ui.init() r.analytics.init() r.ui.init() - r.spotlight.init() r.interestbar.init() r.apps.init() r.wiki.init() diff --git a/r2/r2/public/static/js/spotlight.js b/r2/r2/public/static/js/spotlight.js index 1b49570a5..cf207439f 100644 --- a/r2/r2/public/static/js/spotlight.js +++ b/r2/r2/public/static/js/spotlight.js @@ -54,6 +54,8 @@ r.spotlight.setup = function(links, interest_prob, promotion_prob) { this.interest_prob = interest_prob this.promotion_prob = promotion_prob + + this.init() } r.spotlight.chooseRandom = function() { @@ -168,15 +170,18 @@ r.spotlight.help = function(thing) { return } - help.data('HelpBubble').hide(function() { - help.find('.help-section').hide() - if (thing.hasClass('promoted')) { - help.find('.help-promoted').show() - } else if (thing.hasClass('interestbar')) { - help.find('.help-interestbar').show() - } else { - help.find('.help-organic').show() - } + // this function can be called before the help bubble has initialized + $(function() { + help.data('HelpBubble').hide(function() { + help.find('.help-section').hide() + if (thing.hasClass('promoted')) { + help.find('.help-promoted').show() + } else if (thing.hasClass('interestbar')) { + help.find('.help-interestbar').show() + } else { + help.find('.help-organic').show() + } + }) }) } diff --git a/r2/r2/templates/spotlightlisting.html b/r2/r2/templates/spotlightlisting.html index 58875e624..e83aebfe0 100644 --- a/r2/r2/templates/spotlightlisting.html +++ b/r2/r2/templates/spotlightlisting.html @@ -89,12 +89,12 @@ - +