Theme Files Update

This commit is contained in:
GitHub Action 2023-11-06 08:18:30 +00:00
parent 0154182af0
commit bbc0089b64
4 changed files with 20 additions and 7 deletions

7
assets/js/link-share.js Normal file
View file

@ -0,0 +1,7 @@
async function linkShare(t, u, s){
let data = {title: t,text: s,url: u};
if(navigator.canShare(data)){
try {await navigator.share(data);} catch (er) {console.error(er);}
}else if (navigator?.clipboard?.writeText){
try {await navigator.clipboard.writeText(u);} catch (err) {console.error(err);}
}else{console.log("Neither WebShare API nor CLipboard API is supported")}}

View file

@ -36,14 +36,15 @@
{{ else -}}
{{ $script := $main | minify | fingerprint -}}
<script async src="{{ $script.Permalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script>
{{ end }}
{{ range .Params.custom_js -}}
<script type="text/javascript" src="{{ . | absURL }}"></script>
{{- end }}
{{- end -}}
{{- if and (not (eq .Site.Params.shareSocial nil)) (.Site.Params.shareSocial) -}}
{{ $linkShareJS := resources.Get "js/link-share.js" -}}
{{ $linkshare := $linkShareJS | minify | fingerprint -}}
<script async src="{{ $linkshare.Permalink }}" {{ printf "integrity=%q" $linkshare.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script>
{{- end -}}
{{ range .Params.custom_js -}}<script type="text/javascript" src="{{ . | absURL }}"></script>{{- end }}
{{ partial "mathjax.html" . }}
{{- if templates.Exists "partials/extra-foot.html" -}}
{{ partial "extra-foot.html" . }}
{{- end }}
{{- if templates.Exists "partials/extra-foot.html" -}}{{ partial "extra-foot.html" . }}{{- end }}
</body>
</html>

View file

@ -18,5 +18,8 @@
<li>
<a href="https://www.linkedin.com/shareArticle?mini=true&amp;url={{ $url }}&amp;source={{ .Site.BaseURL }}&amp;title={{ $title }}&amp;summary={{ $summary }}" target="_blank" rel="noopener" aria-label="Share on LinkedIn">{{- partial "svg.html" (dict "context" . "name" "linkedin") -}}</a>
</li>
<li>
<a href="#" onclick="linkShare({{ $title }},{{ $url }},{{ $summary }}); return false;" target="_self" rel="noopener" aria-label="Copy Link">{{- partial "svg.html" (dict "context" . "name" "share_2") -}}</a>
</li>
</ul>
</div>

View file

@ -80,6 +80,8 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-tag meta-icon"><path d="M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"></path><line x1="7" y1="7" x2="7" y2="7"></line></svg>
{{- else if (eq .name "share") -}}
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-share-2"><circle cx="18" cy="5" r="3"></circle><circle cx="6" cy="12" r="3"></circle><circle cx="18" cy="19" r="3"></circle><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line></svg>
{{- else if (eq .name "share_2") -}}
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-copy"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
{{- else -}}
<svg xmlns="http://www.w3.org/2000/svg" class="feather feather-link" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
{{- end -}}