Skip to content

Commit

Permalink
Fiddle javascript variables sanely
Browse files Browse the repository at this point in the history
  • Loading branch information
ericholscher committed Oct 8, 2013
1 parent 226985b commit 3ee97c2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion readthedocs/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
#'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
)

CORS_ORIGIN_REGEX_WHITELIST = ('^http?://(\w+\.)?readthedocs\.org$', '^https?://(\w+\.)?readthedocs\.org$')
CORS_ORIGIN_REGEX_WHITELIST = ('^http://(.+)\.readthedocs\.org$', '^https://(.+)\.readthedocs\.org$')
# So people can post to their accounts
CORS_ALLOW_CREDENTIALS = True
ROOT_URLCONF = 'urls'
Expand Down
10 changes: 9 additions & 1 deletion readthedocs/templates/sphinx/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,26 @@
{% if using_theme %}
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
{% endif %}
<script type="text/javascript">
// This is included here for javascript included in the project
var doc_version = "{{ current_version }}";
var doc_slug = "{{ slug }}";
var page_name = "{{ pagename }}";
</script>
<!-- end RTD <htmltitle> -->
{% endblock %}

{% block extrahead %}
{{ super() }}
<!-- RTD Extra Head -->
{% if not self.htmltitle %}
<script type="text/javascript">
// This is included here for Javascript that doesn't have access to the templates.
// This is included here for theme's that don't have a htmltitle template
var doc_version = "{{ current_version }}";
var doc_slug = "{{ slug }}";
var page_name = "{{ pagename }}";
</script>
{% endif %}
{#
We include the media servers version here so we can update rtd.js across all
documentation without rebuilding every one. If this script is embedded in each build, then updating the file across all docs is basically impossible.
Expand Down

0 comments on commit 3ee97c2

Please sign in to comment.