From 14fe016c16218e8f79d962ccb2f3b9420d252844 Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 12 Oct 2022 20:38:59 +0200 Subject: [PATCH 1/4] Replace inline script for cricital JS with standalone script The new script utilizes requestAnimationFrame to run DOM transformations as soon as possible. In my testing, this method is equivalent of a synchronous inline script. On Firefox, the callback sometimes fires too early and if that happens we register for another frame. I had 100% sucess within 2 frames in Firefox. --- templates/base/head.tmpl | 1 + templates/repo/clone_script.tmpl | 28 ------------------------- templates/repo/empty.tmpl | 1 - templates/repo/home.tmpl | 1 - templates/repo/wiki/revision.tmpl | 1 - templates/repo/wiki/view.tmpl | 1 - web_src/js/init.js | 35 +++++++++++++++++++++++++++++++ webpack.config.js | 3 +++ 8 files changed, 39 insertions(+), 32 deletions(-) delete mode 100644 templates/repo/clone_script.tmpl create mode 100644 web_src/js/init.js diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index 70a88ff75569a..b0326e09828e2 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -23,6 +23,7 @@ {{template "base/head_script" .}} +