Merge pull request #47482 from sftim/20240813_revise_sweetalert

Revise Sweetalert asset load
pull/47671/head
Kubernetes Prow Robot 2024-08-25 09:28:08 +01:00 committed by GitHub
commit 2d2f37ac2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -6,7 +6,13 @@
{{ end }}
{{/* copy-and-paste helper for codenew shortcode */}}
{{- if or (.HasShortcode "code_sample") (.HasShortcode "code") (.HasShortcode "codenew") -}}
<script async src="{{ "js/sweetalert-2.1.2.min.js" | relURL }}"></script>
{{- if hugo.IsProduction -}}
{{- $sweetAlert := resources.Get "js/sweetalert-2.1.2.min.js" | minify | fingerprint -}}
<script async src="{{ $sweetAlert.RelPermalink }}" integrity="{{ $sweetAlert.Data.Integrity }}" crossorigin="anonymous"></script>
{{- else -}}
{{- $sweetAlert := resources.Get "js/sweetalert-2.1.2.min.js" -}}
<script async src="{{ $sweetAlert.RelPermalink }}"></script>
{{- end -}}
<script type="text/javascript">
function copyCode(elem){
if (document.getElementById(elem)) {