aboutsummaryrefslogtreecommitdiffstats
path: root/templates/web/base
diff options
context:
space:
mode:
Diffstat (limited to 'templates/web/base')
-rw-r--r--templates/web/base/common_header_tags.html13
-rw-r--r--templates/web/base/common_scripts.html41
-rw-r--r--templates/web/base/front/javascript.html12
-rw-r--r--templates/web/base/index.html2
-rw-r--r--templates/web/base/report/photo-js.html3
5 files changed, 41 insertions, 30 deletions
diff --git a/templates/web/base/common_header_tags.html b/templates/web/base/common_header_tags.html
index 321e45649..1dad1cfa0 100644
--- a/templates/web/base/common_header_tags.html
+++ b/templates/web/base/common_header_tags.html
@@ -33,3 +33,16 @@
[% "$title :: " | html IF title %]
[% site_name -%]
</title>
+
+[% IF bodyclass.match('frontpage') %]
+ <link rel="prefetch" href="[% version('/js/validation_rules.js') %]">
+ <link rel="prefetch" href="[% version('/vendor/jquery.validate.min.js') %]">
+[% END %]
+[% IF NOT bodyclass.match('mappage') %]
+ [% FOR script IN map_js %]
+ <link rel="prefetch" href="[% IF script.match('^/'); version(script); ELSE; script; END %]">
+ [% END %]
+ <link rel="prefetch" href="[% version('/cobrands/fixmystreet/map.js') %]">
+ <link rel="prefetch" href="[% version('/vendor/dropzone.min.js') %]">
+ <link rel="prefetch" href="[% version('/vendor/fancybox/jquery.fancybox-1.3.4.pack.js') %]">
+[% END %]
diff --git a/templates/web/base/common_scripts.html b/templates/web/base/common_scripts.html
index 82f33569d..cecf9da5b 100644
--- a/templates/web/base/common_scripts.html
+++ b/templates/web/base/common_scripts.html
@@ -8,13 +8,21 @@ scripts = [];
scripts.push(
start _ "/js/translation_strings." _ lang_code _ ".js?" _ Math.int( date.now / 3600 ),
version('/jslib/jquery-1.7.2.min.js'),
- version('/js/validation_rules.js'),
- version('/vendor/jquery.validate.min.js'),
- version('/vendor/dropzone.min.js'),
version('/js/jquery.multi-select.js'),
version('/cobrands/fixmystreet/fixmystreet.js'),
);
+IF NOT bodyclass.match('frontpage');
+ scripts.push(
+ version('/js/validation_rules.js'),
+ version('/vendor/jquery.validate.min.js'),
+ );
+END;
+
+FOR script IN extra_js;
+ scripts.push(script);
+END;
+
IF c.user_exists AND (c.user.from_body OR c.user.is_superuser);
scripts.push(
version('/cobrands/fixmystreet/staff.js')
@@ -26,14 +34,25 @@ IF c.user_exists AND (c.user.from_body OR c.user.is_superuser);
END;
END;
-FOR script IN map_js;
- scripts.push(script);
+IF bodyclass.match('mappage');
+ FOR script IN map_js;
+ IF script.match('^/');
+ scripts.push(version(script));
+ ELSE;
+ scripts.push(script);
+ END;
+ END;
+ scripts.push(
+ version('/cobrands/fixmystreet/map.js'),
+ version('/vendor/dropzone.min.js'),
+ version('/vendor/fancybox/jquery.fancybox-1.3.4.pack.js'),
+ );
+ELSE;
+ scripts.push(
+ version('/cobrands/fixmystreet/prefetch-polyfill.js'),
+ );
END;
-scripts.push(
- version('/cobrands/fixmystreet/map.js'),
-);
-
IF admin;
scripts.push(
version('/vendor/jquery-ui/js/jquery-ui-1.10.3.custom.min.js'),
@@ -41,10 +60,6 @@ IF admin;
);
END;
-FOR script IN extra_js;
- scripts.push(script);
-END;
-
TRY;
PROCESS 'footer_extra_js.html';
CATCH file;
diff --git a/templates/web/base/front/javascript.html b/templates/web/base/front/javascript.html
deleted file mode 100644
index 69eb626f7..000000000
--- a/templates/web/base/front/javascript.html
+++ /dev/null
@@ -1,12 +0,0 @@
-[%
-# Assume using OpenStreetMap maps
-map_js = [
- version('/vendor/yepnope.js'),
- [ version('/cobrands/fixmystreet/front.js'), {
- id = 'script_front',
- 'data-scripts' = version('/vendor/OpenLayers/OpenLayers.fixmystreet.js') _ ',' _
- version('/js/map-OpenLayers.js') _ ',' _
- version('/js/map-OpenStreetMap.js')
- } ],
-]
-%]
diff --git a/templates/web/base/index.html b/templates/web/base/index.html
index 5a064ecb6..620c1a2be 100644
--- a/templates/web/base/index.html
+++ b/templates/web/base/index.html
@@ -1,5 +1,3 @@
-[% PROCESS 'front/javascript.html' %]
-
[% pre_container_extra = PROCESS 'around/postcode_form.html' %]
[% SET bodyclass = 'frontpage fullwidthpage' %]
[% INCLUDE 'header.html', title = '', inline_css = 1 %]
diff --git a/templates/web/base/report/photo-js.html b/templates/web/base/report/photo-js.html
index 8c8c91669..6f3dd55d1 100644
--- a/templates/web/base/report/photo-js.html
+++ b/templates/web/base/report/photo-js.html
@@ -1,6 +1,3 @@
[% extra_css = BLOCK %]
<link rel="stylesheet" href="[% version('/vendor/fancybox/jquery.fancybox-1.3.4.css') %]">
[% END %]
-[% extra_js = [
- version('/vendor/fancybox/jquery.fancybox-1.3.4.pack.js')
-] %]