540 lines
40 KiB
HTML
540 lines
40 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<meta property="og:title" content="🎵️ TiktOctt"/>
|
|
<meta property="OctoSpaccHubSdk:Url" content="https://hub.octt.eu.org/TiktOctt/"/>
|
|
<meta property="OctoSpaccHubSdk:WebManifestExtra" content="'display':'standalone', 'icons':[{ 'src':'./logo.png', 'type':'image/png', 'sizes':'1024x1024' }],"/>
|
|
<link rel="apple-touch-icon" href="./logo.png"/>
|
|
<style>
|
|
:root {
|
|
--footerHeight: 40px;
|
|
--hudBaseHeight: 8em;
|
|
--screenPadding: 8px;
|
|
--hudButtonSize: 48px;
|
|
--colorPrimary: #fe77a0;
|
|
}
|
|
.v-vlite {
|
|
--vlite-colorPrimary: var(--colorPrimary) !important;
|
|
--vlite-controlBarBackground: none !important;
|
|
--vlite-controlBarHeight: 0px !important;
|
|
}
|
|
body {
|
|
margin: 0;
|
|
color: white;
|
|
background-color: black;
|
|
overflow: hidden;
|
|
height: 100%;
|
|
font-family: sans-serif;
|
|
}
|
|
a {
|
|
color: white !important;
|
|
}
|
|
.videosContainer {
|
|
position: fixed;
|
|
height: 100%;
|
|
max-height: 100%;
|
|
overflow-y: scroll;
|
|
scrollbar-width: none;
|
|
/* scroll-snap-type: mandatory;
|
|
scroll-snap-points-y: repeat(100vh); */
|
|
scroll-snap-type: y mandatory;
|
|
}
|
|
.videoItem {
|
|
scroll-snap-align: start;
|
|
scroll-snap-stop: always;
|
|
position: relative;
|
|
/* height: calc(100vh - var(--footerHeight)); */
|
|
}
|
|
.videosList, .videoItem, .videoItem > *, .videoItem video {
|
|
width: 100%;
|
|
height: 100%;
|
|
aspect-ratio: auto !important;
|
|
}
|
|
/* .videoItem .vjs-hidden, .videoItem .vjs-text-track-display, .videoItem .vjs-loading-spinner, .videoItem .vjs-big-play-button, .videoItem .vjs-control-bar */
|
|
.videoItem .v-controlButton, .videoItem .v-time {
|
|
display: none;
|
|
}
|
|
.videoItem .v-controlBar.v-hidden {
|
|
opacity: unset;
|
|
}
|
|
.videoItem .v-video .v-controlBar {
|
|
top: 0;
|
|
}
|
|
.videoItem > .hud {
|
|
position: relative;
|
|
bottom: var(--footerHeight);
|
|
/* margin: 8px;
|
|
z-index: 1;
|
|
padding-left: 8px;
|
|
padding-right: 8px; */
|
|
height: calc(2 * var(--hudBaseHeight) + var(--screenPadding));
|
|
bottom: calc(var(--footerHeight) + var(--hudBaseHeight) + var(--screenPadding) + 5em);
|
|
background-image: linear-gradient(to bottom, rgba(0,0,0,0.0), rgba(0,0,0,1.0));
|
|
}
|
|
.videoItem > .hud > * {
|
|
position: relative;
|
|
}
|
|
.videoItem > .hud > p {
|
|
/* margin: 8px; */
|
|
/* approximation based on all the <p>s */
|
|
bottom: calc((-1 * var(--hudBaseHeight)) + (2 * var(--screenPadding)) + 4em - (2 * var(--footerHeight)));
|
|
padding-left: var(--screenPadding);
|
|
padding-right: var(--screenPadding);
|
|
max-width: calc(100vw - (2 * var(--screenPadding)));
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
text-overflow: ellipsis;
|
|
}
|
|
.videoItem > .hud > p.title {
|
|
font-size: larger;
|
|
margin-top: var(--screenPadding);
|
|
padding-bottom: var(--screenPadding);
|
|
}
|
|
.videoItem > .hud > p.subtitle > a {
|
|
text-decoration: none;
|
|
}
|
|
.videoItem > .hud > p.status {
|
|
font-size: small;
|
|
top: 11em;
|
|
/* margin-bottom: calc(-1 * var(--screenPadding)); */
|
|
/* padding-top: var(--screenPadding); */
|
|
}
|
|
.iconButton, .videoItem > .hud > button {
|
|
background: none;
|
|
border: none;
|
|
}
|
|
.videoItem > .hud > button {
|
|
position: relative;
|
|
display: block;
|
|
left: calc(100vw - var(--hudButtonSize) - (2 * var(--screenPadding)));
|
|
/* bottom: calc(var(--hudButtonSize) /* + 4em */ /* (2 * var(--screenPadding)) ); */
|
|
bottom: calc(4em + (2 * var(--screenPadding)));
|
|
margin-bottom: calc(2 * var(--screenPadding));
|
|
}
|
|
.iconButton, .iconButton > *, .videoItem > .hud > button, .videoItem > .hud > button > * {
|
|
width: var(--hudButtonSize);
|
|
height: var(--hudButtonSize);
|
|
}
|
|
.framesArea {
|
|
width: 100vw;
|
|
height: 100%;
|
|
position: absolute;
|
|
z-index: 3;
|
|
}
|
|
.framesArea > * {
|
|
margin: 2em;
|
|
width: calc(100vw - 4em);
|
|
height: calc(100% - 4em);
|
|
}
|
|
.toastArea {
|
|
position: fixed;
|
|
z-index: 1;
|
|
width: 100vw;
|
|
text-align: center;
|
|
padding-top: 1em;
|
|
top: 1em;
|
|
}
|
|
.toastArea > span {
|
|
padding: 0.5em;
|
|
position: fixed;
|
|
left: 0;
|
|
right: 0;
|
|
margin: auto;
|
|
width: fit-content;
|
|
}
|
|
.framesArea > *, .toastArea > span {
|
|
background-color: #222;
|
|
border-radius: 2px;
|
|
}
|
|
.contentFrame > .header {
|
|
background: black;
|
|
padding: 0.5em;
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
.contentFrame > .header > button {
|
|
float: right;
|
|
width: var(--hudButtonSize);
|
|
height: var(--hudButtonSize);
|
|
font-size: large;
|
|
}
|
|
.contentFrame > .header > span {
|
|
text-overflow: ellipsis;
|
|
overflow: hidden;
|
|
display: block ruby;
|
|
padding-right: var(--screenPadding);
|
|
}
|
|
.contentFrame > .content {
|
|
padding: 1em;
|
|
overflow: auto;
|
|
width: calc(100% - 2em);
|
|
height: calc(100% - 4em);
|
|
position: relative;
|
|
bottom: calc(var(--hudButtonSize) / 2);
|
|
}
|
|
.contentFrame > .content * {
|
|
max-width: 100% !important;
|
|
height: auto !important;
|
|
}
|
|
.audioNag, button[name="menu"] {
|
|
position: fixed;
|
|
z-index: 2;
|
|
}
|
|
.audioNag {
|
|
font-size: large;
|
|
margin: calc(2 * var(--screenPadding));
|
|
}
|
|
button[name="menu"] {
|
|
right: 0;
|
|
margin: var(--screenPadding);
|
|
}
|
|
.splash {
|
|
width: 100%;
|
|
height: 100vh;
|
|
text-align: center;
|
|
background-color: black;
|
|
position: absolute;
|
|
z-index: 3;
|
|
}
|
|
.splash > img {
|
|
position: absolute;
|
|
max-width: 60%;
|
|
max-height: 40%;
|
|
}
|
|
.splash > img, .icon.pause {
|
|
margin: auto;
|
|
top: 0;
|
|
bottom: 0;
|
|
left: 0;
|
|
right: 0;
|
|
}
|
|
.splash > p {
|
|
position: absolute;
|
|
width: 100%;
|
|
}
|
|
.splash > p[name="nojs"] {
|
|
top: 2em;
|
|
}
|
|
.splash > p[name="loading"] {
|
|
bottom: 3em;
|
|
}
|
|
.footer {
|
|
position: fixed;
|
|
bottom: 0;
|
|
width: 100%;
|
|
height: var(--footerHeight);
|
|
background: black;
|
|
}
|
|
</style>
|
|
<link rel="stylesheet" href="./node_modules/vlitejs/dist/vlite.css"/>
|
|
<script src="./node_modules/vlitejs/dist/vlite.js"></script>
|
|
</head>
|
|
<body>
|
|
<div class="splash">
|
|
<p name="nojs">This application requires modern JavaScript. If nothing loads in a while, please check your browser settings.</p>
|
|
<img src="./logo.png"/>
|
|
<p name="loading" hidden="true">... Loading ...</p>
|
|
</div>
|
|
<div class="toastArea"></div>
|
|
<button class="audioNag">🔊️ Unmute</button>
|
|
<button name="menu" class="iconButton">
|
|
<!-- Solar Broken Line Icons, Solar Icons: <https://www.svgrepo.com/svg/529002/hamburger-menu> -->
|
|
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4 7L7 7M20 7L11 7" stroke="#FFFFFF" stroke-width="1.5" stroke-linecap="round"/><path d="M20 17H17M4 17L13 17" stroke="#FFFFFF" stroke-width="1.5" stroke-linecap="round"/><path d="M4 12H7L20 12" stroke="#FFFFFF" stroke-width="1.5" stroke-linecap="round"/></svg>
|
|
</button>
|
|
<div class="framesArea" style="display: none;"></div>
|
|
<div class="videosContainer">
|
|
<div class="videosList"></div>
|
|
</div>
|
|
<script>(function(){
|
|
|
|
const icons = {
|
|
/* Solar Broken Line Icons, Solar Icons */
|
|
share /* <https://www.svgrepo.com/svg/529194/share> */: `<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4 12C4 13.3807 5.11929 14.5 6.5 14.5C7.88071 14.5 9 13.3807 9 12C9 10.6193 7.88071 9.5 6.5 9.5" stroke="#FFFFFF" stroke-width="1.5" stroke-linecap="round"/><path d="M14 6.5L9 10" stroke="#FFFFFF" stroke-width="1.5" stroke-linecap="round"/><path d="M14 17.5L9 14" stroke="#FFFFFF" stroke-width="1.5" stroke-linecap="round"/><path d="M16.5 21C17.8807 21 19 19.8807 19 18.5C19 17.1193 17.8807 16 16.5 16C15.1193 16 14 17.1193 14 18.5" stroke="#FFFFFF" stroke-width="1.5" stroke-linecap="round"/><path d="M18.665 6.74993C17.9746 7.94566 16.4457 8.35535 15.2499 7.66499C14.0542 6.97464 13.6445 5.44566 14.3349 4.24993C15.0252 3.0542 16.5542 2.64451 17.7499 3.33487" stroke="#FFFFFF" stroke-width="1.5" stroke-linecap="round"/></svg>`,
|
|
heart /* https://www.svgrepo.com/svg/529006/heart-angle */: `<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 5.50063L11.4596 6.02073C11.463 6.02421 11.4664 6.02765 11.4698 6.03106L12 5.50063ZM8.96173 18.9109L8.49742 19.4999L8.96173 18.9109ZM15.0383 18.9109L14.574 18.3219L15.0383 18.9109ZM7.00061 16.4209C6.68078 16.1577 6.20813 16.2036 5.94491 16.5234C5.68169 16.8432 5.72758 17.3159 6.04741 17.5791L7.00061 16.4209ZM2.34199 13.4115C2.54074 13.7749 2.99647 13.9084 3.35988 13.7096C3.7233 13.5108 3.85677 13.0551 3.65801 12.6917L2.34199 13.4115ZM13.4698 8.03034C13.7627 8.32318 14.2376 8.32309 14.5304 8.03014C14.8233 7.7372 14.8232 7.26232 14.5302 6.96948L13.4698 8.03034ZM2.75 9.1371C2.75 6.98623 3.96537 5.18252 5.62436 4.42419C7.23607 3.68748 9.40166 3.88258 11.4596 6.02073L12.5404 4.98053C10.0985 2.44352 7.26409 2.02539 5.00076 3.05996C2.78471 4.07292 1.25 6.42503 1.25 9.1371H2.75ZM8.49742 19.4999C9.00965 19.9037 9.55955 20.3343 10.1168 20.6599C10.6739 20.9854 11.3096 21.25 12 21.25V19.75C11.6904 19.75 11.3261 19.6293 10.8736 19.3648C10.4213 19.1005 9.95208 18.7366 9.42605 18.3219L8.49742 19.4999ZM15.5026 19.4999C16.9292 18.3752 18.7528 17.0866 20.1833 15.4758C21.6395 13.8361 22.75 11.8026 22.75 9.1371H21.25C21.25 11.3345 20.3508 13.0282 19.0617 14.4798C17.7469 15.9603 16.0896 17.1271 14.574 18.3219L15.5026 19.4999ZM22.75 9.1371C22.75 6.42503 21.2153 4.07292 18.9992 3.05996C16.7359 2.02539 13.9015 2.44352 11.4596 4.98053L12.5404 6.02073C14.5983 3.88258 16.7639 3.68748 18.3756 4.42419C20.0346 5.18252 21.25 6.98623 21.25 9.1371H22.75ZM14.574 18.3219C14.0479 18.7366 13.5787 19.1005 13.1264 19.3648C12.6739 19.6293 12.3096 19.75 12 19.75V21.25C12.6904 21.25 13.3261 20.9854 13.8832 20.6599C14.4405 20.3343 14.9903 19.9037 15.5026 19.4999L14.574 18.3219ZM9.42605 18.3219C8.63014 17.6945 7.82129 17.0963 7.00061 16.4209L6.04741 17.5791C6.87768 18.2624 7.75472 18.9144 8.49742 19.4999L9.42605 18.3219ZM3.65801 12.6917C3.0968 11.6656 2.75 10.5033 2.75 9.1371H1.25C1.25 10.7746 1.66995 12.1827 2.34199 13.4115L3.65801 12.6917ZM11.4698 6.03106L13.4698 8.03034L14.5302 6.96948L12.5302 4.97021L11.4698 6.03106Z" fill="#FFFFFF"/></svg>`,
|
|
heartFilled: `<svg width="800" height="800" viewBox="0 0 24 24" fill="none" version="1.1" id="svg1" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"><defs id="defs1"/><path style="fill:#1a1a1a;stroke-width:0.03" d="m 3.066315,12.73195 c 0.028084,0.16036 0.0182,0.401349 0.129264,0.549433 0.1367685,0.182358 0.2882154,0.404433 0.4656573,0.551831 0.1623813,0.134887 0.3395487,0.262856 0.4739676,0.430879 0.1026399,0.1283 0.198972,0.259487 0.3016158,0.387792 0.113082,0.141353 0.2792253,0.243037 0.3877917,0.387792 0.1058463,0.01536 0.017894,0.09147 0.043088,0.129264 0.086176,0.129264 0.064632,0.04309 0.129264,0.129264 0.050249,0.067 0.079015,0.148441 0.1292637,0.21544 0.1206465,0.160862 0.3102336,0.270018 0.4308798,0.43088 0.038539,0.05138 0.050547,0.118907 0.086176,0.172351 0.1833339,0.275001 0.5073621,0.476344 0.7245111,0.724515 0.1367106,0.156241 0.240207,0.401749 0.4267035,0.512876 0.3683847,0.219506 -0.077144,-0.108835 0.4309008,0.259937 0.135204,0.09814 0.2675682,0.200385 0.395913,0.307339 0.046812,0.03901 0.07523,0.101095 0.1292637,0.129264 0.1558587,0.08125 0.3492555,0.173342 0.5007084,0.254199 0.094294,0.05034 0.2782896,0.248841 0.3396438,0.296561 0.1133721,0.08818 0.2343669,0.16658 0.3447039,0.258528 0.062416,0.05201 0.1073538,0.123603 0.1723518,0.172352 0.025693,0.01927 0.063395,0.02045 0.086176,0.04309 0.042571,0.0423 0.013019,0.09028 0.1160094,0.158551 0.1583157,0.104939 0.3542865,0.179986 0.5170557,0.258528 0.034114,0.01646 0.04779,0.061 0.080348,0.08035 0.099533,0.05917 0.194102,0.129347 0.301616,0.172352 0.02667,0.01067 0.0601,-0.01206 0.08618,0 0.01206,0.0056 -0.0094,0.03046 0,0.03986 0.03557,0.03557 0.74521,0.359462 0.85853,0.387791 0.12282,0.03071 0.260911,0.01121 0.383184,0.04309 0.173419,0.04521 0.346389,0.08748 0.513521,0.129264 0.0784,0.0196 0.746728,0.0091 0.758994,0 0.03247,-0.02399 0.05101,-0.06489 0.08564,-0.08564 0.337832,-0.202359 0.0222,0.0058 0.172352,-0.04309 0.19465,-0.06343 0.424696,-0.140439 0.597656,-0.255746 0.40672,-0.271147 0.842162,-0.507739 1.279142,-0.726244 0.279123,-0.139571 0.672905,-0.629816 0.899325,-0.856237 0.112345,-0.112345 0.220742,-0.245534 0.344704,-0.344704 0.08087,-0.0647 0.177652,-0.107651 0.258528,-0.172351 0.06344,-0.05076 0.105083,-0.126788 0.172351,-0.172352 0.01133,-0.0077 0.03137,0.0097 0.04105,0 0.07641,-0.07642 0.120947,-0.185623 0.21544,-0.256493 0.04162,-0.03122 0.27234,-0.175455 0.293894,-0.208262 0.07414,-0.112851 0.148749,-0.211939 0.258528,-0.299762 0.190576,-0.152461 0.409093,-0.275569 0.603231,-0.43088 0.03172,-0.02538 0.04984,-0.06801 0.08618,-0.08618 0.02569,-0.01285 0.06048,0.01285 0.08618,0 0.01285,-0.0064 -0.008,-0.03114 0,-0.04309 0.02253,-0.0338 0.05368,-0.0618 0.08618,-0.08618 0.07698,-0.05773 0.19126,-0.105363 0.258528,-0.172352 0.02264,-0.02255 0.02049,-0.06304 0.04309,-0.08564 0.05139,-0.05139 0.159407,-0.101516 0.214903,-0.129264 0.08322,-0.04161 0.140935,-0.159561 0.21544,-0.21544 0.318335,-0.238751 0.661753,-0.494545 0.904847,-0.818671 0.210029,-0.280038 0.297878,-0.594508 0.43088,-0.904847 0.03795,-0.08856 0.0988,-0.167125 0.129264,-0.258528 0.01408,-0.04225 0.05505,-0.249747 0.08618,-0.301616 0.0209,-0.03483 0.06527,-0.05134 0.08618,-0.08618 0.05429,-0.09048 0.319738,-0.636681 0.342674,-0.728424 0.007,-0.02787 -0.0091,-0.05893 0,-0.08618 0.02212,-0.06637 0.106845,-0.142684 0.129264,-0.20994 0.0091,-0.02725 -0.007,-0.05831 0,-0.08618 0.02007,-0.08029 0.106379,-0.146786 0.129263,-0.21544 0.0208,-0.06239 0.01343,-0.153282 0.04309,-0.211664 0.04864,-0.09575 0.144642,-0.192383 0.171816,-0.301078 0.03314,-0.132559 -0.005,-0.269773 0.03874,-0.401057 0.02031,-0.06094 0.06362,-0.11221 0.08618,-0.172352 0.0619,-0.165077 0.07349,-0.349735 0.129264,-0.517056 0.162666,-0.4879978 0.290899,-1.0797424 0.21544,-1.6079563 -0.01946,-0.1362099 -0.05541,-0.2647371 -0.08618,-0.3877917 -0.01558,-0.062314 -0.0706,-0.1100379 -0.08618,-0.1723521 -0.02015,-0.080614 -0.01703,-0.18036 -0.04309,-0.2585277 -0.0064,-0.01927 -0.034,-0.02492 -0.04309,-0.043088 -0.04957,-0.099146 -0.176085,-0.4359618 -0.214893,-0.5590665 -0.07577,-0.2403648 -0.116931,-0.4948704 -0.196757,-0.7343469 -0.01016,-0.030468 -0.03781,-0.054497 -0.04309,-0.086176 -0.0094,-0.056669 0.0081,-0.1154787 0,-0.1723521 C 21.212878,6.2226489 21.086517,5.8997748 21.016284,5.7944262 20.869292,5.5739373 20.487871,5.2660131 20.288765,5.066907 20.210251,4.9883934 20.14639,4.881444 20.073325,4.8083793 c -0.02271,-0.022709 -0.06347,-0.020379 -0.08618,-0.043088 -0.02271,-0.022709 -0.02038,-0.063466 -0.04309,-0.086176 -0.05922,-0.059219 -0.148442,-0.079015 -0.21544,-0.129264 C 19.63745,4.4814729 19.571546,4.4032551 19.475942,4.3402545 19.352927,4.2591912 19.264197,4.1147937 19.134678,4.0420785 18.801174,3.854841 18.494548,3.7204593 18.147095,3.5715507 c -0.04309,-0.014362 -0.08618,-0.028725 -0.129264,-0.043088 -0.02873,0 -0.05893,0.00908 -0.08618,0 -0.01927,-0.00642 -0.02382,-0.036665 -0.04309,-0.043088 -0.0545,-0.018167 -0.116617,0.013934 -0.172352,0 -0.07114,-0.017786 -0.113141,-0.066257 -0.171279,-0.085636 -0.221673,-0.073892 -0.502878,-0.096174 -0.731412,-0.1723518 -0.108903,-0.036301 -0.251197,0.023503 -0.364207,0 -0.18598,-0.038679 -0.952842,-0.098801 -1.104666,-0.043088 -0.308017,0.1130298 0.194261,-0.025106 -0.214903,0.043088 -0.08767,-0.014965 -0.139597,0.071007 -0.21544,0.086176 -0.04225,0.00845 -0.08701,-0.00845 -0.129264,0 -0.240947,0.04819 -0.490533,0.1549491 -0.732496,0.2154399 -0.02787,0.00697 -0.06003,-0.01189 -0.08617,0 -0.0052,0.00236 -0.02029,0.075039 -0.02527,0.080236 -0.130644,0.1363197 0.06297,-0.1783056 -0.07384,0.034498 -0.01737,0.027014 -0.02038,0.063467 -0.04309,0.086176 -0.02271,0.022709 -0.06347,0.020379 -0.08618,0.043088 -0.01016,0.010156 0.0095,0.03236 0,0.043088 -0.0085,0.00955 -0.02959,-0.0093 -0.03835,0 -0.0566,0.060071 -0.08294,0.1683597 -0.167608,0.2106909 -0.01269,0.00634 -0.03164,-0.00907 -0.04255,0 -0.03184,0.026466 -0.07654,0.119103 -0.121532,0.1640916 -0.01505,0.015051 -0.104065,0.028156 -0.123562,0.043088 -0.04968,0.038045 -0.147432,0.1563045 -0.2134,0.2009847 -0.01133,0.00767 -0.03138,-0.00968 -0.04106,0 -0.0097,0.00968 0.0098,0.031493 0,0.041053 -0.09887,0.096531 -0.231528,0.1398072 -0.344167,0.2148999 -0.01436,0.014363 -0.02873,0.028725 -0.04309,0.043088 0,0.014182 0.01003,0.032518 0,0.042547 -9.6e-4,9.6e-4 -0.0817,-9.27e-4 -0.0836,0 -0.156238,0.076226 0.07067,0.00545 -0.08564,0.083605 -0.132305,0.066152 -0.262144,0.1457652 -0.398207,0.2090952 -0.04219,0.019638 -0.512157,0.012427 -0.536958,0 C 11.42513,5.0325756 11.358733,4.9836468 11.28706,4.9441776 11.077475,4.8287622 10.830677,4.6577301 10.597653,4.599474 c -0.02787,-0.00697 -0.05876,0.00859 -0.08618,0 -0.09755,-0.03057 -0.145857,-0.1458525 -0.207929,-0.2079243 -0.03285,-0.032853 -0.190768,-0.104892 -0.214903,-0.1287255 -0.01009,-0.00997 0.0085,-0.031184 0,-0.042549 -0.0111,-0.014862 -0.1327121,-0.1071507 -0.1610333,-0.1260318 -0.036942,-0.024628 -0.094639,-0.011694 -0.1260345,-0.043088 -0.00939,-0.00939 0.012058,-0.03428 0,-0.039857 -0.026072,-0.012058 -0.058308,0.00697 -0.086176,0 C 9.5698233,3.9749046 9.441702,3.911952 9.2948097,3.8825736 9.1516887,3.8539494 9.0437643,3.7444083 8.907018,3.7102218 c -0.041801,-0.01045 -0.090677,0.019174 -0.129264,0 C 8.6714079,3.6573777 8.5571736,3.61266 8.4346701,3.5820342 c -0.069669,-0.017417 -0.1450209,0.014084 -0.2154396,0 -0.07312,-0.014624 -0.1749465,-0.045569 -0.238278,-0.072941 -0.1125651,-0.048652 -1.0216677,0 -1.2378744,0 -0.1220238,0 -0.3100242,-0.029943 -0.4297962,0 -0.062314,0.015578 -0.1114161,0.065864 -0.1723518,0.086176 -0.013626,0.00454 -0.028725,0 -0.043088,0 -0.028364,0 -0.058207,-0.00904 -0.085092,0 -0.019253,0.00647 -0.023818,0.036665 -0.043088,0.043088 -0.027251,0.00908 -0.058308,-0.00697 -0.086176,0 C 5.6930289,3.685971 5.5101288,3.7640121 5.3233422,3.8107089 5.1959895,3.842547 5.1034593,3.9511584 4.983246,3.9804846 4.8336021,4.0169907 4.53936,4.1227581 4.4272995,4.2348186 c -0.010156,0.010156 0.00642,0.030242 0,0.043088 C 4.3829073,4.3666914 4.2387402,4.5193038 4.1737263,4.6059888 4.0126032,4.82082 3.9180837,4.857093 3.7864713,5.1219675 3.7125189,5.2707987 3.5147064,5.3644143 3.4423038,5.5092195 c -0.02975,0.0595 -0.1394394,0.3108468 -0.1718049,0.3436203 -0.00997,0.010092 -0.031643,-0.00907 -0.042551,0 -0.016385,0.013619 -0.027297,0.099097 -0.039617,0.1175373 -0.022426,0.033568 -0.063278,0.052026 -0.085639,0.085638 C 3.0096939,6.1958013 2.953193,6.4081362 2.8480248,6.5658885 2.8091188,6.6242475 2.6982945,6.7121382 2.6770089,6.775995 c -0.00908,0.027251 0.015934,0.062275 0,0.086176 -0.017815,0.026722 -0.063467,0.020379 -0.086176,0.043088 -0.02361,0.02361 -0.028458,0.1302264 -0.042552,0.1680429 -0.03729,0.1000611 -0.086058,0.2038815 -0.1287274,0.2886873 -0.016198,0.032195 0.01177,0.087858 0,0.1222026 -0.063839,0.1862871 -0.067621,0.3749043 -0.1292639,0.5590626 -0.044461,0.1328265 0,0.7383471 0,0.8875956 0,0.1304664 -0.045204,0.6677559 0,0.7593045 0.00628,0.012718 0.032522,-0.010029 0.042552,0 0.018049,0.018048 0.023602,0.3528425 0.043088,0.4062125 0.021946,0.06011 0.070109,0.109734 0.085629,0.171813 0.028355,0.113421 -0.00569,0.07898 0.042552,0.171813 0.010199,0.01963 0.069085,0.516155 0.086176,0.533241 0.0094,0.0094 0.034252,-0.01205 0.039858,0 0.018487,0.03972 0.029966,0.249659 0.042552,0.3 0.032188,0.128751 0.096646,0.257319 0.1292639,0.387792 0.015436,0.06174 -0.020839,0.147001 0,0.207629 0.028321,0.0824 0.093196,0.143755 0.129264,0.21544 0.012282,0.02441 -0.0073,0.06703 0,0.09398 0.026368,0.09738 0.098911,0.173048 0.1264762,0.255744 0.031439,0.09432 0.00458,0.198797 0.00862,0.298135 z" id="path2"/><path style="fill:#fe77a0;fill-opacity:1;stroke-width:0.0430881" d="m 12.150808,20.332481 c -0.05925,-0.01026 -0.194973,-0.03956 -0.301616,-0.06512 -0.106643,-0.02555 -0.312475,-0.06164 -0.457405,-0.0802 -0.256162,-0.0328 -1.056181,-0.353548 -1.08658,-0.435633 -0.0079,-0.02133 -0.04387,-0.03878 -0.07993,-0.03878 -0.03606,0 -0.152741,-0.05884 -0.2592898,-0.130744 C 9.85944,19.510094 9.6725916,19.400752 9.5507706,19.33902 9.4289499,19.277289 9.24186,19.139998 9.1350162,19.03393 9.0281718,18.927863 8.8728906,18.79068 8.789946,18.72908 8.7070017,18.667481 8.5582704,18.544697 8.4594318,18.456225 8.3605935,18.367754 8.1461916,18.228123 7.9829838,18.145933 7.819776,18.063742 7.6591545,17.963857 7.6260474,17.923965 7.5286965,17.806665 7.102887,17.491972 6.9059904,17.391809 6.7929726,17.334317 6.6556293,17.205458 6.5435652,17.051772 6.4443204,16.915667 6.2201778,16.671213 6.0454704,16.508541 5.870763,16.345869 5.696976,16.151973 5.6592771,16.077661 5.6215782,16.003349 5.4661851,15.806822 5.3139591,15.640934 4.9491354,15.243366 4.9120287,15.197178 4.9120287,15.140637 c 0,-0.06132 -0.5435061,-0.661282 -1.1047758,-1.219537 -0.6330591,-0.629657 -0.664038,-0.67968 -0.7020726,-1.133653 -0.017725,-0.21156 -0.063775,-0.439795 -0.1045452,-0.518147 -0.040076,-0.07702 -0.061092,-0.140036 -0.046701,-0.140036 0.014391,0 -0.014196,-0.0653 -0.063525,-0.145122 -0.04933,-0.07982 -0.08969,-0.203411 -0.08969,-0.274654 0,-0.07124 -0.029084,-0.211967 -0.064632,-0.31272 -0.035548,-0.100752 -0.064632,-0.238917 -0.064632,-0.307033 0,-0.06811 -0.015913,-0.123846 -0.035363,-0.123846 -0.01945,0 -0.058074,-0.146087 -0.085833,-0.324636 C 2.5225001,10.462703 2.4705501,10.260075 2.434814,10.190969 2.399078,10.121859 2.369839,9.9771045 2.369839,9.8692851 2.369839,9.7614657 2.351522,9.6732495 2.329135,9.6732495 2.305127,9.6732495 2.288323,9.359541 2.288167,8.9084382 2.287945,8.2617285 2.303556,8.0737638 2.389264,7.6912029 2.5036677,7.1805597 2.5819795,6.9530568 2.6606826,6.9027063 c 0.029623,-0.018951 0.05386,-0.069898 0.05386,-0.1132161 0,-0.043317 0.03072,-0.1042539 0.068266,-0.1354146 C 2.8203545,6.6229149 2.9183931,6.4702716 3.0006717,6.314868 3.2396685,5.8634637 3.4254846,5.5721043 3.6026307,5.3709978 3.6933966,5.2679547 3.8046573,5.122533 3.8498772,5.0478378 3.8950971,4.9731429 4.0229283,4.8053859 4.1339466,4.6750449 4.2449652,4.5447039 4.3786446,4.3762707 4.4310123,4.300749 4.4966535,4.2060846 4.6028679,4.135665 4.7729874,4.074021 4.9087062,4.0248423 5.0702316,3.9563337 5.1319332,3.9217791 5.1936345,3.8872248 5.3972253,3.8119077 5.5843569,3.7544079 6.4398054,3.4915542 6.3422802,3.5050395 7.239255,3.5255784 c 0.4618569,0.010576 0.9366876,0.038262 1.0551795,0.061525 0.3051801,0.059915 0.6892947,0.1684719 0.7935585,0.2242719 0.048805,0.02612 0.219843,0.087861 0.3800841,0.1372029 0.4268559,0.1314387 0.52968,0.1942905 0.8743019,0.5344221 0.05994,0.059161 0.185974,0.1284054 0.280072,0.1538763 0.0941,0.025471 0.338198,0.1414269 0.542447,0.2576796 0.48608,0.2766633 0.680363,0.28542 1.130417,0.050948 0.169354,-0.088231 0.327306,-0.1816884 0.351005,-0.2076828 0.0237,-0.025994 0.101256,-0.082735 0.172351,-0.1260909 0.176154,-0.1074225 0.43149,-0.3271314 0.832831,-0.7166256 0.302496,-0.2935671 0.370616,-0.3377928 0.657171,-0.4266612 0.175831,-0.05453 0.397252,-0.1143804 0.492045,-0.1330011 0.09479,-0.01862 0.298384,-0.06594 0.452424,-0.1051554 0.245594,-0.062523 0.356984,-0.06524 0.904847,-0.02207 0.636179,0.050128 1.248002,0.1498815 1.396542,0.2276958 0.0453,0.023729 0.203058,0.068398 0.35058,0.099264 0.402103,0.084131 1.141168,0.449496 1.430022,0.7069467 0.134762,0.1201122 0.322052,0.2715033 0.416199,0.3364254 0.09415,0.064922 0.414823,0.3656526 0.712615,0.6682902 0.539114,0.5478882 0.730354,0.8334255 0.734011,1.0959411 7.29e-4,0.052263 0.05095,0.2752437 0.111605,0.4955115 0.105405,0.3827802 0.170367,0.5731086 0.460239,1.3484226 0.107504,0.2875395 0.132213,0.4268775 0.148995,0.8402157 0.01919,0.4725444 0.01204,0.5265306 -0.154072,1.1647408 -0.0958,0.368076 -0.204052,0.740703 -0.240552,0.82806 -0.0365,0.08736 -0.06636,0.228322 -0.06636,0.313257 0,0.08493 -0.03786,0.226132 -0.08414,0.313772 -0.04628,0.08764 -0.124782,0.256292 -0.17446,0.374784 -0.04968,0.118492 -0.118459,0.270333 -0.152847,0.337424 -0.03439,0.06709 -0.06252,0.151027 -0.06252,0.186525 0,0.0355 -0.116338,0.291067 -0.258528,0.56793 -0.14219,0.276864 -0.258528,0.533214 -0.258528,0.569669 0,0.03645 -0.01748,0.0847 -0.03884,0.107213 -0.02136,0.02251 -0.108807,0.211279 -0.194319,0.41948 -0.08551,0.2082 -0.201331,0.45057 -0.257378,0.538599 -0.11428,0.179495 -0.506861,0.558353 -0.947207,0.914094 -0.16134,0.130341 -0.346509,0.285458 -0.411488,0.344703 -0.130944,0.119393 -0.410426,0.333576 -0.929939,0.712664 -0.189587,0.138342 -0.383403,0.300618 -0.430702,0.360614 -0.0473,0.06 -0.124306,0.138744 -0.171127,0.174995 -0.04682,0.03625 -0.170636,0.148316 -0.275146,0.249034 -0.104511,0.100719 -0.206857,0.183124 -0.227438,0.183124 -0.02058,0 -0.03742,0.01757 -0.03742,0.03905 0,0.02148 -0.09922,0.110326 -0.220478,0.197444 -0.121264,0.08712 -0.451365,0.39726 -0.73356,0.689202 -0.436006,0.451065 -0.566322,0.558371 -0.867493,0.714315 -0.194926,0.100932 -0.54059,0.296198 -0.768141,0.433925 -0.451097,0.27303 -0.800887,0.437406 -0.87486,0.411121 -0.02593,-0.0092 -0.09572,0.01721 -0.155111,0.05873 -0.109596,0.07661 -0.570059,0.136648 -0.77533,0.101091 z" id="path3"/><path style="fill:#fe77a0;fill-opacity:1;stroke-width:0.03" d="m 2.2021783,13.146818 c 0.031691,0.04903 0.037871,0.116038 0.063441,0.167177 0.00454,0.0091 0.016319,0.01284 0.021544,0.02154 0.00584,0.0097 0.00493,0.02258 0.010772,0.03232 0.013474,0.02246 0.037388,0.04404 0.05386,0.06463 0.031578,0.03947 0.059373,0.08638 0.086176,0.129264 0.035947,0.05752 0.057867,0.128411 0.096948,0.183124 0.08813,0.123383 -0.027641,-0.07223 0.064632,0.0754 0.05614,0.08982 0.1220827,0.176042 0.1725518,0.2696 0.027176,0.05038 0.048023,0.104119 0.076908,0.153538 0.039825,0.06814 0.086264,0.133616 0.1241436,0.202797 0.015524,0.03891 0.023066,0.06226 0.043369,0.0978 0.08747,0.153073 0.1713684,0.312697 0.2726319,0.457569 0.04012,0.0574 0.090252,0.107863 0.131397,0.16455 0.057887,0.07975 0.1121982,0.158879 0.176883,0.232777 0.037532,0.04288 0.060736,0.09658 0.096948,0.140037 0.097597,0.117116 0.2217315,0.219784 0.323628,0.334518 0.00236,0.0027 0.084598,0.106173 0.086873,0.10865 0.1071036,0.116647 0.2251587,0.225155 0.3371664,0.337163 0.06366,0.06366 0.1243293,0.137004 0.193896,0.193896 0.024003,0.01963 0.051704,0.03442 0.075704,0.05406 0.015806,0.01293 0.02699,0.03106 0.043322,0.04332 0.012842,0.0096 0.029727,0.01264 0.043088,0.02154 0.012675,0.0084 0.018707,0.02547 0.032316,0.03232 0.00317,0.0016 0.00798,-0.0024 0.010638,0 0.00522,0.0046 0.00461,0.01402 0.010078,0.01836 0.045845,0.03631 0.069956,0.03358 0.1204773,0.06567 0.1327266,0.106179 -0.011933,-0.0033 0.097734,0.0652 0.035335,0.02207 0.054933,0.05041 0.086176,0.0754 0.032805,0.02624 0.036702,0.02097 0.075404,0.04309 0.079053,0.04517 0.155781,0.08968 0.2374836,0.129563 0.017409,0.0085 0.026193,0.02872 0.041094,0.0411 0.059885,0.04975 0.1424721,0.08786 0.2041341,0.129698 0.030752,0.02087 0.04319,0.06175 0.074334,0.08511 0.021954,0.01647 0.024809,0.0021 0.042039,0.01077 0.021228,0.01064 0.04258,0.03106 0.063625,0.04208 0.1003407,0.05255 0.204414,0.07877 0.3170007,0.09485 0.049535,0.0071 0.099464,0.02011 0.1508079,0.01077 0.029198,-0.0053 0.096369,-0.04483 0.1193361,-0.05442 0.082193,-0.03434 0.1717695,-0.06015 0.2405604,-0.120281 0.2195658,-0.191929 0.2290698,-0.427442 0.289287,-0.699675 0.027102,-0.122524 0.048633,-0.244175 0.037142,-0.370582 -0.00894,-0.0983 -0.051013,-0.187768 -0.087139,-0.278082 -0.07731,-0.193276 -0.1668084,-0.324715 -0.275067,-0.505145 -0.095413,-0.159021 -0.1951932,-0.309567 -0.3165009,-0.45063 -0.054265,-0.0631 -0.1138272,-0.121517 -0.1680759,-0.184633 -0.043856,-0.05102 -0.080215,-0.108397 -0.1260897,-0.157614 -0.03497,-0.03752 -0.077928,-0.06674 -0.1155384,-0.101615 -0.026127,-0.02422 -0.048421,-0.05252 -0.07558,-0.07558 C 5.8300242,14.432212 5.7685617,14.396596 5.7117597,14.3549 5.504796,14.202978 5.2821522,14.082106 5.0651721,13.945414 4.8250599,13.794148 4.6126641,13.645348 4.3509645,13.525769 4.1380914,13.4285 3.9041496,13.337966 3.6734706,13.291896 c -0.031875,-0.0064 -0.064873,-0.0058 -0.096754,-0.01214 -0.084091,-0.01671 -0.1481253,-0.03438 -0.2332965,-0.04503 -0.1080021,-0.0135 -0.2139144,-0.0547 -0.32316,-0.06463 -0.1231246,-0.01119 -0.25349,0 -0.3770196,0 -0.031481,0 -0.074556,0.0054 -0.1067022,0 -0.068757,-0.01164 -0.022902,-0.01077 -0.05386,-0.01077" id="path4"/><path d="m 12,5.50063 -0.5404,0.5201 c 0.0034,0.00348 0.0068,0.00692 0.0102,0.01033 z M 8.96173,18.9109 8.49742,19.4999 Z m 6.07657,0 -0.4643,-0.589 z m -8.03769,-2.49 c -0.31983,-0.2632 -0.79248,-0.2173 -1.0557,0.1025 -0.26322,0.3198 -0.21733,0.7925 0.1025,1.0557 z M 2.34199,13.4115 c 0.19875,0.3634 0.65448,0.4969 1.01789,0.2981 0.36342,-0.1988 0.49689,-0.6545 0.29813,-1.0179 z M 13.4698,8.03034 c 0.2929,0.29284 0.7678,0.29275 1.0606,-2e-4 0.2929,-0.29294 0.2928,-0.76782 -2e-4,-1.06066 z M 2.75,9.1371 C 2.75,6.98623 3.96537,5.18252 5.62436,4.42419 7.23607,3.68748 9.40166,3.88258 11.4596,6.02073 l 1.0808,-1.0402 C 10.0985,2.44352 7.26409,2.02539 5.00076,3.05996 2.78471,4.07292 1.25,6.42503 1.25,9.1371 Z m 5.74742,10.3628 c 0.51223,0.4038 1.06213,0.8344 1.61938,1.16 C 10.6739,20.9854 11.3096,21.25 12,21.25 v -1.5 c -0.3096,0 -0.6739,-0.1207 -1.1264,-0.3852 -0.4523,-0.2643 -0.92152,-0.6282 -1.44755,-1.0429 z m 7.00518,0 c 1.4266,-1.1247 3.2502,-2.4133 4.6807,-4.0241 1.4562,-1.6397 2.5667,-3.6732 2.5667,-6.3387 h -1.5 c 0,2.1974 -0.8992,3.8911 -2.1883,5.3427 -1.3148,1.4805 -2.9721,2.6473 -4.4877,3.8421 z M 22.75,9.1371 C 22.75,6.42503 21.2153,4.07292 18.9992,3.05996 16.7359,2.02539 13.9015,2.44352 11.4596,4.98053 l 1.0808,1.0402 C 14.5983,3.88258 16.7639,3.68748 18.3756,4.42419 20.0346,5.18252 21.25,6.98623 21.25,9.1371 Z m -8.176,9.1848 c -0.5261,0.4147 -0.9953,0.7786 -1.4476,1.0429 C 12.6739,19.6293 12.3096,19.75 12,19.75 v 1.5 c 0.6904,0 1.3261,-0.2646 1.8832,-0.5901 0.5573,-0.3256 1.1071,-0.7562 1.6194,-1.16 z m -5.14795,0 C 8.63014,17.6945 7.82129,17.0963 7.00061,16.4209 l -0.9532,1.1582 c 0.83027,0.6833 1.70731,1.3353 2.45001,1.9208 z M 3.65801,12.6917 C 3.0968,11.6656 2.75,10.5033 2.75,9.1371 h -1.5 c 0,1.6375 0.41995,3.0456 1.09199,4.2744 z m 7.81179,-6.66064 2,1.99928 1.0604,-1.06086 -2,-1.99927 z" fill="#1C274C" id="path1" style="fill:#fe00a0;fill-opacity:1"/></svg>`,
|
|
};
|
|
|
|
let currentVideoElem, firstVideoElem, lastVideoElem;
|
|
let isSplashNeeded = true;
|
|
let userInteracted = false;
|
|
let videoPreloadCount = 5;
|
|
const backendFetchCount = 50;
|
|
const videoObjects = [];
|
|
const postsCache = {};
|
|
const postsHistory = [];
|
|
|
|
const scrollObserver = new IntersectionObserver(function(elems){
|
|
for (elem of elems) {
|
|
if (elem.isIntersecting) {
|
|
addVideos(videoPreloadCount);
|
|
}
|
|
}
|
|
});
|
|
|
|
function jsonStorageApi (key, setValue) {
|
|
return JSON.parse(localStorage[setValue !== undefined ? 'setItem' : 'getItem'](
|
|
`org.eu.octt.TiktOctt/v1/${key}`, JSON.stringify(setValue)) || '{}');
|
|
}
|
|
|
|
async function pullNewVideos () {
|
|
const siteUrl = 'https://octospacc.altervista.org';
|
|
const postsRequest = await fetch(`${siteUrl}/wp-content/uploads/${siteUrl.split('.').slice(0, 1)[0].split('//')[1]}/scripts/stuff.php?&Thing=SiteWpJsonCors&AccessToken=9ab6e20c&$Query=${encodeURIComponent(`wp/v2/posts?orderby=rand&search=wp-block-video&per_page=${backendFetchCount}`)}`);
|
|
const postsData = await postsRequest.json();
|
|
for (const post of postsData) {
|
|
if (!postsCache[post.id]) {
|
|
post.videoUrl = post.content.rendered.split('</video>')[0].split('>').slice(-2)[0].split('src="')[1].split('"')[0]
|
|
.replaceAll(`${siteUrl}/wp-content/uploads/`, 'https://octospacc.github.io/microblog-mirror/assets/uploads/');
|
|
post.contentHtml = post.content.rendered
|
|
.replaceAll('<video ', '<!-- <video ').replaceAll('</video>', '</video-none> -->');
|
|
try {
|
|
const videoRequest = await fetch(post.videoUrl, { method: 'HEAD' });
|
|
if (videoRequest.status === 200) {
|
|
postsCache[post.id] = post;
|
|
}
|
|
} catch(err) {}
|
|
}
|
|
}
|
|
}
|
|
|
|
function onUserInteract () {
|
|
userInteracted = true;
|
|
if (currentVideoElem) {
|
|
videoObjects[currentVideoElem.dataset.videoId].player.unMute();
|
|
}
|
|
document.querySelector('.audioNag')?.remove();
|
|
}
|
|
|
|
// TODO fix something here or in posts fetching,
|
|
// when not enough posts are fetched from the backend we might end up never fecthing new ones here
|
|
function theAlgorithm () {
|
|
const posts = Object.values(postsCache);
|
|
let post = posts[~~(Math.random() * posts.length)];
|
|
// ensure a new random video is shown until we exhaust them
|
|
if (postsHistory.includes(post.id) && (postsHistory.length < posts.length)) {
|
|
while (postsHistory.includes(post.id)) {
|
|
post = posts[~~(Math.random() * posts.length)];
|
|
}
|
|
}
|
|
// TODO fix never show the exact same post two times next to each other, leads to frustration
|
|
//while (post.id === postsHistory.slice(-1)[0]) {
|
|
// post = posts[~~(Math.random() * posts.length)];
|
|
//}
|
|
postsHistory.push(post.id);
|
|
return post;
|
|
}
|
|
|
|
function cleanExcerpt (text) {
|
|
text = text.trim();
|
|
if (text.split('>')[0].split(' ')[0].split('<')[1] === 'div') {
|
|
text = text.split('</div>')[1];
|
|
}
|
|
return text.replaceAll('<p>', '').replaceAll('<p ', '').replaceAll('</p>', '');
|
|
}
|
|
|
|
function heartPostState (id, buttonElem, invert) {
|
|
let hearts = jsonStorageApi('hearts');
|
|
if (invert) {
|
|
hearts[id] = !hearts[id];
|
|
jsonStorageApi('hearts', hearts);
|
|
}
|
|
const icon = icons[hearts[id] ? 'heartFilled' : 'heart'];
|
|
if (buttonElem) {
|
|
buttonElem.innerHTML = icon;
|
|
}
|
|
return icon;
|
|
}
|
|
|
|
function shareLink (event) {
|
|
event.stopPropagation();
|
|
var link = this.parentElement.querySelector('a').href;
|
|
navigator.clipboard.writeText(link);
|
|
document.querySelector('.toastArea').appendChild(Object.assign(document.createElement('span'), { innerHTML: `Copied to clipboard` }));
|
|
setTimeout((function(){
|
|
document.querySelector('.toastArea > span').remove();
|
|
}), 2000);
|
|
if ('share' in navigator) {
|
|
navigator.share({ url: link });
|
|
}
|
|
}
|
|
|
|
function openContentFrame (content, name, link) {
|
|
const framesAreaElem = document.querySelector('.framesArea');
|
|
framesAreaElem.style.display = null;
|
|
framesAreaElem.innerHTML = `<div class="contentFrame">
|
|
<div class="header">
|
|
<button>❌️</button>
|
|
<span>${link ? `<a target="_blank" href="${link}">${name}</a>` : name}</span>
|
|
</div>
|
|
<div class="content">${content}</div>
|
|
</div>`;
|
|
document.querySelector('.framesArea > .contentFrame > .header > button').onclick = (function(){
|
|
this.parentElement.parentElement.remove();
|
|
framesAreaElem.style.display = 'none';
|
|
});
|
|
}
|
|
|
|
async function addVideos (preloadCount) {
|
|
const fragmentElem = document.createDocumentFragment();
|
|
if (firstVideoElem) {
|
|
scrollObserver.unobserve(firstVideoElem);
|
|
firstVideoElem = null;
|
|
}
|
|
try {
|
|
await pullNewVideos();
|
|
} catch(err) {
|
|
setTimeout((function(){ addVideos(preloadCount); }), 1000);
|
|
return;
|
|
}
|
|
for (let i=0; i<preloadCount; i++) {
|
|
const post = theAlgorithm();
|
|
const itemElem = document.createElement('div');
|
|
const hudElem = Object.assign(document.createElement('div'), {
|
|
className: 'hud',
|
|
onclick: (function(){ this.parentElement.querySelector('.v-video .v-overlay').click() }),
|
|
innerHTML /* using nbsp to preserve vertical alignment */: `
|
|
<p class="status"><a target="_blank" href="${post.link}">${post.date}</a></p>
|
|
<p class="title"><a href="javascript:void(0);">${post.title.rendered || '...'}</a></p>
|
|
<p class="subtitle"><a href="javascript:void(0);">${cleanExcerpt(post.excerpt.rendered) || ' '}</a></p>
|
|
<button name="heart">${heartPostState(post.guid.rendered)}</button>
|
|
<button name="share">${icons.share}</button>
|
|
`,
|
|
});
|
|
hudElem.querySelector('p.status').onclick = (function(event){ event.stopPropagation(); });
|
|
hudElem.querySelector('p.title').onclick = hudElem.querySelector('p.subtitle').onclick = (function(event){
|
|
event.stopPropagation();
|
|
openContentFrame(post.content.rendered, post.link, post.link);
|
|
});
|
|
hudElem.querySelector('button[name="heart"]').onclick = (function(event){
|
|
event.stopPropagation();
|
|
heartPostState(post.guid.rendered, this, true)
|
|
});
|
|
hudElem.querySelector('button[name="share"]').onclick = shareLink;
|
|
const videoElem = Object.assign(document.createElement('video'), {
|
|
src: post.videoUrl,
|
|
muted: true, loop: true,
|
|
onerror: (function(){
|
|
// we must find a clean way to make the video autoplay if it loads
|
|
// after failing the first time, this is just a temporary patch
|
|
//this.autoplay = true;
|
|
// TODO make this only try to reload the video when it's actually the current
|
|
// because onerror triggers only when an error first happens and not constantly
|
|
//videoObjects[currentVideoElem.dataset.videoId].loading(true);
|
|
this.load();
|
|
//if (currentVideoElem === this) {
|
|
// videoObject.play();
|
|
// //this.play();
|
|
//}
|
|
}),
|
|
//oncanplay: onCanPlayVideo,
|
|
});
|
|
//videoElem.load();
|
|
//videoElem.play();
|
|
//lastVideoElem = videoElem;
|
|
if (!firstVideoElem) {
|
|
firstVideoElem = videoElem;
|
|
if (!currentVideoElem) {
|
|
currentVideoElem = videoElem;
|
|
}
|
|
}
|
|
itemElem.classList.add('videoItem');
|
|
itemElem.appendChild(videoElem);
|
|
itemElem.appendChild(hudElem);
|
|
fragmentElem.appendChild(itemElem);
|
|
const videoObject = await new Vlitejs(videoElem, { onReady: onCanPlayVideo });
|
|
videoElem.dataset.videoId = (videoObjects.push(videoObject) - 1);
|
|
videoElem.parentElement.onclick = onClickVideo;
|
|
}
|
|
document.querySelector('.videosList').appendChild(fragmentElem);
|
|
scrollObserver.observe(firstVideoElem);
|
|
}
|
|
addVideos(1);
|
|
|
|
function onClickVideo () {
|
|
if (!userInteracted) {
|
|
onUserInteract();
|
|
videoObjects[this.querySelector('video').dataset.videoId].player.play();
|
|
}
|
|
}
|
|
|
|
function onCanPlayVideo () {
|
|
const videoElem = (this.media || this);
|
|
const splashElem = document.querySelector('.splash');
|
|
if (splashElem && (document.querySelector('.videoItem video' /* first item */) === videoElem)) {
|
|
isSplashNeeded = false;
|
|
setTimeout((function(){
|
|
videoElem.currentTime = 0;
|
|
document.querySelector('.splash')?.remove();
|
|
const videoObject = videoObjects[videoElem.dataset.videoId];
|
|
videoObject.player.play();
|
|
if (userInteracted) {
|
|
videoObject.player.unMute();
|
|
}
|
|
videoElem.parentElement.focus();
|
|
}), 1000);
|
|
}
|
|
}
|
|
|
|
// TODO fix, it's kinda bad with touch scrolling since so many events are generated;
|
|
// pausing should maybe only happen when the scoll is completed?
|
|
function onVideosScroll () {
|
|
for (const videoElem of document.querySelectorAll('.videoItem video')) {
|
|
const videoObject = videoObjects[videoElem.dataset.videoId];
|
|
if (~~videoElem.getBoundingClientRect().y === 0) {
|
|
currentVideoElem = videoElem;
|
|
videoObject.player.seekTo(0);
|
|
videoObject.player.play();
|
|
if (userInteracted) {
|
|
videoObject.player.unMute();
|
|
}
|
|
videoElem.parentElement.focus();
|
|
} else {
|
|
videoObject.player.pause();
|
|
videoObject.player.seekTo(0);
|
|
}
|
|
}
|
|
}
|
|
document.querySelector('.videosContainer').onscroll = onVideosScroll;
|
|
document.querySelector('.videosContainer').focus();
|
|
onVideosScroll();
|
|
|
|
document.querySelector('.splash').onclick = onUserInteract;
|
|
document.querySelector('.audioNag').onclick = (function(){
|
|
onUserInteract();
|
|
document.querySelector('.videosContainer').focus();
|
|
});
|
|
document.querySelector('button[name="menu"]').onclick = (function(){
|
|
openContentFrame(`<p>
|
|
TiktOctt is a personal experiment to display video posts from my WordPress MicroBlog (<a target="_blank" href="https://octospacc.altervista.org/">octospacc.altervista.org</a>) in a short-form, infinite-scrolling feed fashion. It uses the WordPress JSON REST API to fetch data, and a couple of hacks to cope with infrastructural problems of the video streaming. Once I manage to fix the big issues and get around to tweaking the suggestion algorithm better, this will be made officially available for other sites and possibly platforms. — <a href="https://octospacc.altervista.org/2024/05/13/dickcock-more-like-tiktoctt/">See the presentation video</a>. Also visit <a href="../">the OctoSpacc Hub</a> for more.
|
|
</p><h3>Changelog</h3>
|
|
<h4>2024-05-14</h4><ul>
|
|
<li>Add the menu button and this about dialogue.</li>
|
|
<li>Migrate video player from HTML5 to <a target="blank" href="https://github.com/vlitejs/vlite">vLitejs</a>, and tweak some video loading code, to hopefully fix all streaming issues on mobile browsers.</li>
|
|
<li>Thanks to the new video player, we also now have a pause indicator button and seekbar for free, and pause video on desktop via spacebar.</li>
|
|
<li>Slightly improve the UI, allowing for a bigger click area for play/pause, better popup dialogue with well-scaled content and bigger button, and better keyboard navigation with TABbing on buttons.</li>
|
|
<li>Fix the share feature, which only copied but failed to open the mobile share menu.</li>
|
|
<li>Add no-JS warning on the splash screen, and also a fallback "Loading..." text if bootup takes longer than expected (to not make the app seem frozen).</li>
|
|
</ul>
|
|
<h4>2024-05-12</h4><ul>
|
|
<li>First MVP version.</li>
|
|
<li>Basic UI, with post date, link, title, description, and preview, share and like features.</li>
|
|
<li>Basic random suggestion algorithm, providing unique posts until they are exhausted, then going in true random.</li>
|
|
</ul><p>
|
|
Copyright notice: all code and assets that comprise this program are either original, or used with permission from the copyright holder(s) by the terms of free and open-source licenses. This application is an original and independent project, and is not in any way correlated with, or endorsed by, any other software that appears similar in branding, coding, appearance, or functionality.
|
|
</p>`, 'About TiktOctt (v2024-05-14)');
|
|
});
|
|
|
|
document.querySelector('.splash > p[name="nojs"]').remove();
|
|
currentVideoElem = document.querySelector('video');
|
|
setInterval((function(){
|
|
const splashElem = document.querySelector('.splash > p[name="loading"]');
|
|
if (isSplashNeeded && splashElem) {
|
|
splashElem.hidden = false;
|
|
}
|
|
}), 3000);
|
|
|
|
})();</script>
|
|
</body>
|
|
</html>
|