summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/templatetags/cdn.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/main/templatetags/cdn.py b/main/templatetags/cdn.py
index fdb1be07..ef6bb144 100644
--- a/main/templatetags/cdn.py
+++ b/main/templatetags/cdn.py
@@ -9,9 +9,14 @@ def jquery(parser, token):
class JQueryNode(template.Node):
def render(self, context):
+ # if we have the request in context, we can check if it is secure and
+ # serve content from HTTPS instead.
+ secure = 'request' in context and context['request'].is_secure()
version = '1.4.2'
oncdn = getattr(settings, 'CDN_ENABLED', True)
- if oncdn:
+ if oncdn and secure:
+ jquery = 'https://ajax.googleapis.com/ajax/libs/jquery/%s/jquery.min.js' % version
+ elif oncdn:
jquery = 'http://ajax.googleapis.com/ajax/libs/jquery/%s/jquery.min.js' % version
else:
jquery = '/media/jquery-%s.min.js' % version