aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-11-14 16:23:11 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-11-15 16:02:26 +0000
commitf59e12ee3fa9c65f178a300954586f6ac91bba79 (patch)
treee28721f5b356f5b916e59811a192cc96cc32ac4c /web
parent865df7790d20ffbeacd8dd10316f4a7f733dcb1d (diff)
Have front page load minimal JS necessary.
By creating a small file with only what is needed (focus, js flagging), we can drop loading jQuery and all the application JavaScript on the front page, prefetching them instead.
Diffstat (limited to 'web')
-rw-r--r--web/js/front.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/web/js/front.js b/web/js/front.js
new file mode 100644
index 000000000..d2c814490
--- /dev/null
+++ b/web/js/front.js
@@ -0,0 +1,13 @@
+document.getElementById('pc').focus();
+
+(function(){
+ var around_forms = document.querySelectorAll('form[action*="around"]');
+ for (var i=0; i<around_forms.length; i++) {
+ var form = around_forms[i];
+ var el = document.createElement('input');
+ el.type = 'hidden';
+ el.name = 'js';
+ el.value = 1;
+ form.insertBefore(el, form.firstChild);
+ }
+})();