@** * Copyright (c) 2013-2017, 2020 Kaj Magnus Lindberg * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . *@ @(tpi: debiki.SiteTpi, loadStaffBundle: Boolean) @* SECURITY try removing polyfill.io — it's a supply chain attack security risk. Now soon mostly gone (feature flag) — only old browser will download a polyfill. *@ @* [script_src_self] *@ @if(tpi.noPolyfillDotIo) { } else if(tpi.avoidPolyfillDotIo) { } else { } @* If in the admin area or about user section, then load more scripts directly, [5WKE24] since we need it directly, anyway. *@ @if(tpi.anyCurrentPageRole.isEmpty) { } else { @* Prefetch scripts. [7PLBF20] Safari and iOS doesn't support rel=prefetch — so the below stuff is for everyone-except-for-those-who-use-Apple. Use rel=prefetch (not =preload), because the script is only *perhaps* needed, and maybe not on this page but maybe on the next instead, and, in Chrome, prefetch requests won't get terminated, when navigating to the next page but pre*load* requests do get cancelled, see: https://medium.com/reloading/preload-prefetch-and-priorities-in-chrome-776165961bbf *@ } @* Prefetch the editor-bundle. But it's currently needed by the staff-bundle [7PKEW24] (for rendering posts on the moderation page) — so load it directly, if we're loading the staff-bundle. *@ @if(!loadStaffBundle) { @* Or don't prefetch it. Most people only read, won't write anything — let's save some server bandwidth and mobile phone batteries? *@ } else { }