From 37ff6ea7cbf4f4b2b180b0a67f0f6c87cc4c8534 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 21 Oct 2018 10:20:11 +0200 Subject: defer script loading --- index.pl | 1 + templates/layouts/default.html.ep | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/index.pl b/index.pl index cec3c27..ea58544 100644 --- a/index.pl +++ b/index.pl @@ -919,6 +919,7 @@ sub handle_request { hide_opts => $hide_opts, hide_low_delay => $hide_low_delay, show_realtime => $show_realtime, + load_marquee => ($template eq 'single' or $template eq 'multi'), ); } return; diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep index 18ee9e4..bf7a937 100644 --- a/templates/layouts/default.html.ep +++ b/templates/layouts/default.html.ep @@ -15,6 +15,7 @@ % if ($force_mobile == 1 or ($self->browser->mobile and $force_mobile != 0)) { %= stylesheet '/static/mobile.css' % } + %if (stash('load_marquee')) { %= javascript '/static/jquery-1.10.2.min.js' %= javascript '/static/jquery-ui.min.js' %= javascript '/static/autocomplete.js' @@ -23,8 +24,14 @@ %= javascript begin $(function () { $('marquee').marquee() }); % end + % } else { + %= javascript '/static/jquery-1.10.2.min.js', defer => undef + %= javascript '/static/jquery-ui.min.js', defer => undef + %= javascript '/static/autocomplete.js', defer => undef + %= javascript '/static/collapse.js', defer => undef + % } % if (stash('with_geolocation')) { - %= javascript '/static/geolocation.js' + %= javascript '/static/geolocation.js', defer => undef % }