fix: fix script CORS error (#246)

This commit is contained in:
Dillon 2020-04-22 01:00:51 +08:00 committed by GitHub
parent a5d0b9a3eb
commit a0ab272f7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 33 deletions

View file

@ -12,7 +12,7 @@
{{- /* iconfont */ -}}
{{- if (.Scratch.Get "this").iconfont -}}
{{- with $cdn.iconfontCSS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- else -}}
{{- dict "source" "lib/iconfont/iconfont.css" "minify" true "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- end -}}
@ -20,7 +20,7 @@
{{- /* Smooth Scroll */ -}}
{{- with $cdn.smoothScrollJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/smooth-scroll/smooth-scroll.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
@ -28,7 +28,7 @@
{{- /* Search */ -}}
{{- if .Site.Params.search.enable -}}
{{- with $cdn.autocompleteJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/autocomplete/autocomplete.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
@ -38,7 +38,7 @@
{{- $searchConfig = dict "type" "lunr" "lunrIndexURL" .RelPermalink | merge $searchConfig -}}
{{- end -}}
{{- with $cdn.lunrJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/lunr/lunr.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
@ -52,7 +52,7 @@
{{- end -}}
{{- else if eq .Site.Params.search.type "algolia" -}}
{{- with $cdn.algoliasearchJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/algoliasearch/algoliasearch-lite.umd.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
@ -63,7 +63,7 @@
{{- /* lazysizes */ -}}
{{- with $cdn.lazysizesJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/lazysizes/lazysizes.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
@ -71,22 +71,22 @@
{{- /* lightgallery.js */ -}}
{{- if $params.lightgallery -}}
{{- with $cdn.lightgalleryCSS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- else -}}
{{- dict "source" "lib/lightgallery/lightgallery.min.css" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- end -}}
{{- with $cdn.lightgalleryJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/lightgallery/lightgallery.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
{{- with $cdn.lightgalleryThumbnailJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/lightgallery/lg-thumbnail.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
{{- with $cdn.lightgalleryZoomJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/lightgallery/lg-zoom.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
@ -97,7 +97,7 @@
{{- /* clipboard.js */ -}}
{{- if ne $params.copycode false -}}
{{- with $cdn.clipboardJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/clipboard/clipboard.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
@ -107,7 +107,7 @@
{{- /* Sharer.js */ -}}
{{- if $params.share.enable -}}
{{- with $cdn.sharerJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/sharer/sharer.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
@ -116,7 +116,7 @@
{{- /* TypeIt */ -}}
{{- with (.Scratch.Get "this").typeitMap -}}
{{- with $cdn.typeitJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/typeit/typeit.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
@ -130,36 +130,36 @@
{{- /* KaTeX */ -}}
{{- if $params.math.enable -}}
{{- with $cdn.katexCSS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- else -}}
{{- dict "source" "lib/katex/katex.min.css" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- end -}}
{{- with $cdn.katexJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/katex/katex.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
{{- with $cdn.katexAutoRenderJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/katex/auto-render.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
{{- $math := $params.math -}}
{{- if $math.copyTex -}}
{{- with $cdn.katexCopyTexCSS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- else -}}
{{- dict "source" "lib/katex/copy-tex.min.css" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- end -}}
{{- with $cdn.katexCopyTexJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/katex/copy-tex.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
{{- end -}}
{{- if $math.mhchem -}}
{{- with $cdn.katexMhchemJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/katex/mhchem.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
@ -180,7 +180,7 @@
{{- /* mermaid */ -}}
{{- if (.Scratch.Get "this").mermaid -}}
{{- with $cdn.mermaidJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/mermaid/mermaid.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
@ -191,12 +191,12 @@
{{- /* ECharts */ -}}
{{- if (.Scratch.Get "this").echarts -}}
{{- with $cdn.echartsJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/echarts/echarts.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
{{- with $cdn.echartsMacaronsJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/echarts/macarons.js" "minify" true "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
@ -205,12 +205,12 @@
{{- /* Mapbox GL */ -}}
{{- if (.Scratch.Get "this").mapbox -}}
{{- with $cdn.mapboxGLCSS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- else -}}
{{- dict "source" "lib/mapbox-gl/mapbox-gl.min.css" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- end -}}
{{- with $cdn.mapboxGLJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/mapbox-gl/mapbox-gl.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
@ -222,21 +222,21 @@
{{- if (.Scratch.Get "this").music -}}
{{- /* APlayer */ -}}
{{- with $cdn.aplayerCSS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- else -}}
{{- dict "source" "lib/aplayer/APlayer.min.css" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- end -}}
{{- $options := dict "targetPath" "lib/aplayer/dark.min.css" -}}
{{- dict "source" "lib/aplayer/dark.scss" "toCSS" $options "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- with $cdn.aplayerJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/aplayer/APlayer.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
{{- /* MetingJS */ -}}
{{- with $cdn.metingJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/meting/Meting.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}

View file

@ -9,7 +9,7 @@
{{- if $comment.disqus.enable -}}
<div id="disqus_thread" class="comment"></div>
{{- $source := printf "https://%s.disqus.com/embed.js" $comment.disqus.shortname -}}
{{- dict "source" $source "defer" true "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" $source "defer" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://disqus.com/?ref_noscript">Disqus</a>.
</noscript>
@ -19,12 +19,12 @@
{{- if $comment.gitalk.enable -}}
<div id="gitalk" class="comment"></div>
{{- with $cdn.gitalkCSS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- else -}}
{{- dict "source" "lib/gitalk/gitalk.css" "minify" true "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- end -}}
{{- with $cdn.gitalkJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/gitalk/gitalk.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
@ -40,7 +40,7 @@
{{- $options := dict "targetPath" "lib/valine/valine.min.css" -}}
{{- dict "source" "lib/valine/valine.scss" "toCSS" $options | dict "scratch" $.Scratch "data" | partial "scratch/stylesheet.html" -}}
{{- with $cdn.valineJS -}}
{{- dict "source" . "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" . | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- else -}}
{{- dict "source" "lib/valine/Valine.min.js" "fingerprint" $fingerprint | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- end -}}
@ -69,7 +69,7 @@
data-numposts="{{ $comment.facebook.numPosts }}"
></div>
{{- $source := printf "https://connect.facebook.net/%s/sdk.js#xfbml=1&version=v5.0&appId=%s&autoLogAppEvents=1" ($comment.facebook.languageCode | default (T "facebookLanguageCode")) $comment.facebook.appId -}}
{{- dict "source" $source "defer" true "crossorigin" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" $source "defer" true | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://developers.facebook.com/docs/plugins/comments/"></a>Facebook</a>.
</noscript>
@ -95,7 +95,7 @@
{{- if $comment.telegram.outlined -}}
{{- $attr = printf `%s data-outlined="1"` $attr -}}
{{- end -}}
{{- dict "source" "https://comments.app/js/widget.js?2" "defer" true "crossorigin" true "attr" $attr | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
{{- dict "source" "https://comments.app/js/widget.js?2" "defer" true "attr" $attr | dict "scratch" $.Scratch "data" | partial "scratch/script.html" -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://comments.app/">Telegram Comments</a>.
</noscript>