From 385fb242828391755f668bb90aea8f71e657e4d5 Mon Sep 17 00:00:00 2001 From: Neil Williams Date: Wed, 16 Nov 2011 13:31:23 -0800 Subject: [PATCH] Fix default stylesheet lookup in editor. --- r2/r2/templates/subredditstylesheet.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/r2/r2/templates/subredditstylesheet.html b/r2/r2/templates/subredditstylesheet.html index e6ae9c59f..455acc09b 100644 --- a/r2/r2/templates/subredditstylesheet.html +++ b/r2/r2/templates/subredditstylesheet.html @@ -23,6 +23,7 @@ from r2.lib.filters import keep_space from r2.lib.template_helpers import add_sr, static from r2.lib.media import s3_direct_url + import os %> <%namespace file="utils.html" import="error_field, image_upload"/> @@ -141,10 +142,12 @@ } function showDefaultStylesheet(btn) { var default_stylesheet = $('#default_stylesheet'); + /* make sure to load the default stylesheet contents from the local domain so it doesn't get caught by cross-domain rules. */ + var stylesheet_url = '${add_sr(os.path.join(c.site.static_path, g.static_names.get("reddit.css", "reddit.css")), nocname=True, sr_path=False)}'; if (!default_stylesheet.data('loaded')) { default_stylesheet.text('loading...'); - $.get(document.styleSheets[0].href, function(css) { + $.get(stylesheet_url, function(css) { default_stylesheet.val(css); default_stylesheet.data('loaded', true); })