diff --git a/r2/r2/public/static/js/base.js b/r2/r2/public/static/js/base.js index ea901475a..3479f5c81 100644 --- a/r2/r2/public/static/js/base.js +++ b/r2/r2/public/static/js/base.js @@ -1,5 +1,11 @@ r = window.r || {} +r.setup = function(config) { + r.config = config + // Set the legacy config global + reddit = config +} + $(function() { r.login.ui.init() r.analytics.init() diff --git a/r2/r2/templates/base.compact b/r2/r2/templates/base.compact index 14a1e853a..9d47edbac 100644 --- a/r2/r2/templates/base.compact +++ b/r2/r2/templates/base.compact @@ -24,7 +24,7 @@ from r2.lib.template_helpers import static from r2.lib import js %> -<%namespace file="utils.html" import="js_preamble, googleanalytics"/> +<%namespace file="utils.html" import="js_setup, googleanalytics"/>
${self.robots()} - ${unsafe(js.use('jquery', 'mobile'))} + ${js_setup()} ${googleanalytics('mobile')} ${self.bodyHTML()} diff --git a/r2/r2/templates/base.html b/r2/r2/templates/base.html index c00809635..0f559cef3 100644 --- a/r2/r2/templates/base.html +++ b/r2/r2/templates/base.html @@ -26,7 +26,7 @@ from r2.models import Link, Comment, Subreddit from r2.lib.tracking import UserInfo %> -<%namespace file="utils.html" import="js_preamble, googleanalytics"/> +<%namespace file="utils.html" import="js_setup, googleanalytics"/> @@ -39,15 +39,9 @@ ${self.robots()} - ##these are globals, so they should be run first - ##things that need are referenced by the reddit, the buttons, and - ##the frame should go here - - ${self.stylesheet()} ${self.javascript()} + ${js_setup()} ##things here may depend on globals, or included js, so we run them last + ${js_setup()} diff --git a/r2/r2/templates/framebuster.html b/r2/r2/templates/framebuster.html index 37ddf4ced..0d1043ac0 100644 --- a/r2/r2/templates/framebuster.html +++ b/r2/r2/templates/framebuster.html @@ -1,14 +1,12 @@ <%namespace file="reddit.html" import="javascript"/> -<%namespace file="utils.html" import="js_preamble"/> +<%namespace file="utils.html" import="js_setup"/>