Initial script stuff.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Captain ALM 2022-07-30 15:07:10 +01:00
parent 26b7893c71
commit 5a62535bce
Signed by: alfred
GPG Key ID: 4E4ADD02609997B1
5 changed files with 83 additions and 15 deletions

View File

@ -4,6 +4,8 @@
This provides my template and cache supporting web / application server for my city university portfolio subdomain.
[Production Server](https://cityuni.captainalm.com/)
Maintainer:
[Captain ALM](https://code.mrmelon54.xyz/alfred)

View File

@ -20,10 +20,12 @@ main{
.centered{
text-align: center;
}
.content > p{
.content, .content > *{
word-break: break-word;
-ms-word-wrap: break-word;
word-wrap: break-word;
}
.content > p, .content > h1, .content > h2, .content > h3, .content > h4, .content > h5, .content > h6{
margin-top: 0.5em;
margin-bottom: 0.5em;
}

View File

@ -11,7 +11,15 @@
{{ else }}
<link id="style-theme" rel="stylesheet" href="{{ .Data.CSSDarkURL }}"/>
{{ end }}
<script src="{{ .Data.JScriptURL }}"></script>
<script type="application/javascript">
const TheParameters = "{{ .Parameters }}"
const CssLightURL = "{{ .Data.CSSLightURL }}"
const CssDarkURL = "{{ .Data.CSSDarkURL }}"
const SunImageURL = "{{ .Data.SunImageLocation }}"
const MoonImageURL = "{{ .Data.MoonImageLocation }}"
const PlayImageURL = "{{ .Data.PlayVideoImageLocation }}"
</script>
<script type="application/javascript" src="{{ .Data.JScriptURL }}"></script>
</head>
<body>
<header class="header">
@ -94,7 +102,7 @@
</nav>
</header>
<main class="main-box flex-col">
<div>
<div id="about">
<div class="item-table flex-col">
<div class="item-heading">
<div class="item-table-full">
@ -114,8 +122,13 @@
</div>
</div>
</div>
{{ $c := 0 }}
{{ range .GetEntries }}
<div>
{{ $c = $.CounterPlusPlus }}
<div id="entry-{{ $c }}">
<script type="application/javascript">
EntryData[{{ $c }}] = CreateEntry("{{ .Name }}", "{{ .VideoLocation }}", "{{ .VideoContentType }}", "{{ .GetStartDateHTML }}", "{{ .GetEndDateHTML }}", "{{ .GetInt64Duration }}")
</script>
<div class="item-table flex-col">
<div class="item-heading">
<div class="item-table-full">
@ -134,14 +147,19 @@
<div class="content">{{ .GetContent }}</div>
</div>
<div class="item-table-360">
<div>
<div id="video-{{ $c }}">
{{ if eq .VideoLocation "" }}
<img src="{{ $.Data.NoVideoImageLocation }}" alt="No Video" width="360px">
{{ else }}
<video controls width="360px">
<source src="{{ .VideoLocation }}" type="{{ .VideoContentType }}">
<a href="{{ .VideoLocation }}">The Video</a>
</video>
<script type="application/javascript">
CreateVideoPlaceholder({{ $c }})
</script>
<noscript>
<video controls width="360px">
<source src="{{ .VideoLocation }}" type="{{ .VideoContentType }}">
<a href="{{ .VideoLocation }}">The Video</a>
</video>
</noscript>
{{ end }}
</div>
</div>
@ -156,11 +174,6 @@
</div>
{{ end }}
</div>
<!-- This needs to be moved into a script tag along with other stuff not here yet for JS support
<div class="data-hold">{{ .GetInt64Duration }}</div>
<div class="data-hold">{{ .GetStartDateHTML }}</div>
<div class="data-hold">{{ .GetEndDateHTML }}</div>
-->
</div>
{{ end }}
</main>

View File

@ -2,3 +2,47 @@
This file is (C) Captain ALM
Under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License
*/
const EntryData = []
function CreateEntry(name, videourl, videotype, start, end, duration) {
return {
name: name,
videourl: videourl,
videotype: videotype,
start: Date.parse(start),
end: Date.parse(end),
duration : duration
};
}
function CreateVideoPlaceholder(id) {
let imgPH = document.createElement("img")
imgPH.src = PlayImageURL
imgPH.id = "play-"+id
imgPH.alt = "Play Video"
imgPH.width = 360
imgPH.style.cursor = "pointer"
if (document.addEventListener) {
imgPH.addEventListener("click", function () {ActivateVideo(id);})
} else {
imgPH.setAttribute("onclick", "ActivateVideo("+id+");")
imgPH.onclick = function () {ActivateVideo(id);}
}
document.getElementById("video-" + id).appendChild(imgPH)
}
function ActivateVideo(id) {
let holder = document.getElementById("video-" + id)
holder.removeChild(document.getElementById("play-"+id))
let vid = document.createElement("video")
vid.controls = true
let vids = document.createElement("source")
vids.src = EntryData[id].videourl
vids.type = EntryData[id].videotype
let vida = document.createElement("a")
vida.href = EntryData[id].videourl
vida.innerText = "The Video"
vid.appendChild(vids)
vid.appendChild(vida)
holder.appendChild(vid)
if (vid.play) {
vid.play()
}
}

View File

@ -13,9 +13,10 @@ type Marshal struct {
OrderName int8
OrderDuration int8
Light bool
Counter int
}
func (m Marshal) GetEntries() (toReturn []EntryYaml) {
func (m *Marshal) GetEntries() (toReturn []EntryYaml) {
toReturn = m.Data.Entries
if m.OrderStartDate > 0 {
sort.Slice(toReturn, func(i, j int) bool {
@ -59,3 +60,9 @@ func (m Marshal) GetEntries() (toReturn []EntryYaml) {
}
return toReturn
}
func (m *Marshal) CounterPlusPlus() int {
toret := m.Counter
m.Counter++
return toret
}