1
0
Fork 0
mirror of https://github.com/dillonzq/LoveIt.git synced 2025-03-13 11:18:15 +01:00

chore(deprecated): remove script type "text/javascript" ()

This commit is contained in:
Dillon 2025-02-23 10:31:07 +08:00 committed by GitHub
parent bfc0cb7ae1
commit 88d754f1f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 7 additions and 13 deletions
assets/js
layouts
src/js

View file

@ -379,7 +379,6 @@ var Theme = /*#__PURE__*/function () {
if (searchConfig.lunrSegmentitURL && !document.getElementById('lunr-segmentit')) {
var script = document.createElement('script');
script.id = 'lunr-segmentit';
script.type = 'text/javascript';
script.src = searchConfig.lunrSegmentitURL;
script.async = true;
if (script.readyState) {
@ -715,7 +714,6 @@ var Theme = /*#__PURE__*/function () {
var utterancesConfig = this.config.comment.utterances;
var script = document.createElement('script');
script.src = 'https://utteranc.es/client.js';
script.type = 'text/javascript';
script.setAttribute('repo', utterancesConfig.repo);
script.setAttribute('issue-term', utterancesConfig.issueTerm);
if (utterancesConfig.label) script.setAttribute('label', utterancesConfig.label);
@ -737,7 +735,6 @@ var Theme = /*#__PURE__*/function () {
var giscusConfig = this.config.comment.giscus;
var giscusScript = document.createElement('script');
giscusScript.src = 'https://giscus.app/client.js';
giscusScript.type = 'text/javascript';
giscusScript.setAttribute('data-repo', giscusConfig.repo);
giscusScript.setAttribute('data-repo-id', giscusConfig.repoId);
giscusScript.setAttribute('data-category', giscusConfig.category);

View file

@ -10,7 +10,7 @@
<a href="javascript:void(0);" title="{{ T `back` }}" onclick="window.history.back();"><i class="far fa-hand-point-left fa-fw" aria-hidden="true"></i></a>
</p>
</div>
<script type="text/javascript">
<script>
(function() {
var emojiArray = ['\\(o_o)/', '(˚Δ˚)b', '(^-^*)', '(≥o≤)', '(^_^)b', '(·_·)','(=\'X\'=)', '(>_<)', '(;-;)'];
document.getElementById('error-emoji').appendChild(document.createTextNode(emojiArray[Math.floor(Math.random() * emojiArray.length)]));

View file

@ -15,7 +15,7 @@
<body data-header-desktop="{{ .Site.Params.header.desktopMode }}" data-header-mobile="{{ .Site.Params.header.mobileMode }}">
{{- /* Check theme isDark before body rendering */ -}}
{{- $theme := .Site.Params.defaulttheme -}}
<script type="text/javascript">(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('{{ $theme }}' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '{{ $theme }}' === 'dark')) && document.body.setAttribute('theme', 'dark');</script>
<script>(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('{{ $theme }}' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '{{ $theme }}' === 'dark')) && document.body.setAttribute('theme', 'dark');</script>
<div id="mask"></div>

View file

@ -3,7 +3,7 @@
{{- if $analytics.enable -}}
{{- /* Google Analytics */ -}}
{{- with $analytics.google.id -}}
<script type="text/javascript">
<script>
window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());
gtag('config', '{{ . }}'{{ if $analytics.google.anonymizeIP }}, { 'anonymize_ip': true }{{ end }});
</script>
@ -12,7 +12,7 @@
{{- /* Fathom Analytics */ -}}
{{- with $analytics.fathom.id -}}
<script type="text/javascript">
<script>
window.fathom=window.fathom||function(){(fathom.q=fathom.q||[]).push(arguments);};
fathom('set', 'siteId', '{{ . }}');
fathom('trackPageview');
@ -27,7 +27,7 @@
{{- /* Yandex Metrica */ -}}
{{- with $analytics.yandexMetrica.id -}}
<script type="text/javascript" >
<script>
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");

View file

@ -1,5 +1,5 @@
{{- with .Content -}}
<script type="text/javascript">{{ . | safeJS }}</script>
<script>{{ . | safeJS }}</script>
{{- else -}}
{{- if strings.HasPrefix .Source "<script" -}}
{{- safeHTML .Source -}}
@ -36,6 +36,6 @@
{{- with .Attr -}}
{{- $attrs = add " " . | add $attrs -}}
{{- end -}}
<script type="text/javascript" {{ $attrs | safeHTMLAttr }}></script>
<script {{ $attrs | safeHTMLAttr }}></script>
{{- end -}}
{{- end -}}

View file

@ -302,7 +302,6 @@ class Theme {
if (searchConfig.lunrSegmentitURL && !document.getElementById('lunr-segmentit')) {
const script = document.createElement('script');
script.id = 'lunr-segmentit';
script.type = 'text/javascript';
script.src = searchConfig.lunrSegmentitURL;
script.async = true;
if (script.readyState) {
@ -599,7 +598,6 @@ class Theme {
const utterancesConfig = this.config.comment.utterances;
const script = document.createElement('script');
script.src = 'https://utteranc.es/client.js';
script.type = 'text/javascript';
script.setAttribute('repo', utterancesConfig.repo);
script.setAttribute('issue-term', utterancesConfig.issueTerm);
if (utterancesConfig.label) script.setAttribute('label', utterancesConfig.label);
@ -622,7 +620,6 @@ class Theme {
const giscusConfig = this.config.comment.giscus;
const giscusScript = document.createElement('script');
giscusScript.src = 'https://giscus.app/client.js';
giscusScript.type = 'text/javascript';
giscusScript.setAttribute('data-repo', giscusConfig.repo);
giscusScript.setAttribute('data-repo-id', giscusConfig.repoId);
giscusScript.setAttribute('data-category', giscusConfig.category);