refactor asciinema
This commit is contained in:
parent
55ab032dbf
commit
595325b5ad
@ -5,18 +5,14 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' data: ;{{ if .Params.asciinema }}script-src 'self' 'unsafe-inline' 'unsafe-eval';{{ end }}">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' data: {{ partial "asciinema/csp" . }} ;">
|
||||
<link rel="alternate" type="application/rss+xml" href="/posts/index.xml">
|
||||
<!-- Diable favicon requests: https://stackoverflow.com/a/13416784 -->
|
||||
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
|
||||
{{ if .Params.asciinema }}
|
||||
{{ with resources.Get "vendor/asciinema/asciinema-player.css" | minify | fingerprint }}
|
||||
<link rel="stylesheet" type="text/css" href="{{ .RelPermalink }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{- if isset .Site.Params "onionlocation" }}
|
||||
{{ partial "asciinema/head" . }}
|
||||
{{- if isset .Site.Params "onionlocation" -}}
|
||||
<meta http-equiv="onion-location" content="{{ urls.JoinPath .Site.Params.OnionLocation .RelPermalink }}">
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
|
||||
<link rel="stylesheet" href="{{ "css/styles.css" | relURL }}">
|
||||
<link id="theme_css" rel="stylesheet" href="{{ "css/themes" | relURL }}/{{ .Site.Params.ThemeStyle | default $themeStyleDefault }}">
|
||||
|
3
layouts/_partials/asciinema/csp.html
Normal file
3
layouts/_partials/asciinema/csp.html
Normal file
@ -0,0 +1,3 @@
|
||||
{{- /* This renders as 'unsafe-eval' . This seems to be work fine
|
||||
though. TODO: how to render as proper single quotes? */ -}}
|
||||
{{- if .Params.asciinema -}}'unsafe-eval'{{- end -}}
|
8
layouts/_partials/asciinema/head.html
Normal file
8
layouts/_partials/asciinema/head.html
Normal file
@ -0,0 +1,8 @@
|
||||
{{ if .Params.asciinema }}
|
||||
{{ with resources.Get "vendor/asciinema/asciinema-player.css" | minify | fingerprint }}
|
||||
<link rel="stylesheet" type="text/css" href="{{ .RelPermalink }}" />
|
||||
{{ end }}
|
||||
{{ with resources.Get "vendor/asciinema/asciinema-player.min.js" | fingerprint }}
|
||||
<script src="{{ .RelPermalink }}"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
@ -1,7 +1,4 @@
|
||||
<div id='{{ .Get "key" }}'></div>
|
||||
{{ with resources.Get "vendor/asciinema/asciinema-player.min.js" | fingerprint }}
|
||||
<script src="{{ .RelPermalink }}"></script>
|
||||
{{ end }}
|
||||
<script>
|
||||
AsciinemaPlayer.create('casts/{{ .Get "key" }}.cast', document.getElementById('{{ .Get "key" }}'), {
|
||||
{{ if .Get "cols" }}cols: "{{ .Get "cols" }}",{{ end }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user