From f59e12ee3fa9c65f178a300954586f6ac91bba79 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 14 Nov 2017 16:23:11 +0000 Subject: 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. --- web/js/front.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 web/js/front.js (limited to 'web/js/front.js') 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 Date: Fri, 24 Nov 2017 12:21:50 +0000 Subject: Add js=1 to links to /around from the front page The location disambiguation page uses the frontpage JavaScript and has lots of links pointing to /around, so the code should make sure those links include the `js` parameter. --- web/js/front.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'web/js/front.js') diff --git a/web/js/front.js b/web/js/front.js index d2c814490..8471972d4 100644 --- a/web/js/front.js +++ b/web/js/front.js @@ -10,4 +10,9 @@ document.getElementById('pc').focus(); el.value = 1; form.insertBefore(el, form.firstChild); } + var around_links = document.querySelectorAll('a[href*="around"]'); + for (i=0; i -1 ? '&js=1' : '?js=1'); + } })(); -- cgit v1.2.3