first!
This commit is contained in:
commit
cf7a27bfa1
225 changed files with 3580 additions and 0 deletions
1
layouts/shortcodes/break.html
Normal file
1
layouts/shortcodes/break.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<br/>
|
||||
1
layouts/shortcodes/code.html
Normal file
1
layouts/shortcodes/code.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<span class="code">{{ index .Params 0 }}</span>
|
||||
14
layouts/shortcodes/img.html
Normal file
14
layouts/shortcodes/img.html
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<div class="image-container">
|
||||
{{ $src := .Get "src" }}
|
||||
{{ if hasPrefix $src "/" }}
|
||||
<img src='{{ $src }}' title='{{ .Get "caption" | markdownify }}' />
|
||||
{{ else }}
|
||||
{{ $img := .Page.Resources.GetMatch $src }}
|
||||
{{ if $img }}
|
||||
<img src='{{ $img.RelPermalink }}' title='{{ .Get "caption" | markdownify }}' />
|
||||
{{ else }}
|
||||
<img src='{{ $src }}' title='{{ .Get "caption" | markdownify }}' />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<p>{{ .Get "caption" | markdownify }}</p>
|
||||
</div>
|
||||
1
layouts/shortcodes/important.html
Normal file
1
layouts/shortcodes/important.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<span class="important">{{ index .Params 0 }}</span>
|
||||
1
layouts/shortcodes/inlinecode.html
Normal file
1
layouts/shortcodes/inlinecode.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<code style="display: inline-block; overflow: initial; background-color: #000; color: #fff; padding: 0 4px">{{ index .Params 0 }}</code>
|
||||
1
layouts/shortcodes/twitter-archive-iframe.html
Normal file
1
layouts/shortcodes/twitter-archive-iframe.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<iframe style="border: none; height: 75vh;" src="https://mmaker.moe/twitter-archive/" width="100%"></iframe>
|
||||
16
layouts/shortcodes/video.html
Normal file
16
layouts/shortcodes/video.html
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<div class="video-container">
|
||||
{{ $src := .Get "src" }}
|
||||
{{ $poster := .Get "poster" }}
|
||||
{{ if and $src (not (hasPrefix $src "http")) (not (hasPrefix $src "/")) }}
|
||||
{{ $vid := .Page.Resources.GetMatch $src }}
|
||||
{{ if $vid }}{{ $src = $vid.RelPermalink }}{{ end }}
|
||||
{{ end }}
|
||||
{{ if and $poster (not (hasPrefix $poster "http")) (not (hasPrefix $poster "/")) }}
|
||||
{{ $p := .Page.Resources.GetMatch $poster }}
|
||||
{{ if $p }}{{ $poster = $p.RelPermalink }}{{ end }}
|
||||
{{ end }}
|
||||
<video controls muted preload="auto" title='{{ .Get "caption" }}' poster='{{ $poster }}'>
|
||||
<source src='{{ $src }}' type="video/webm">
|
||||
</video>
|
||||
<p>{{ .Get "caption" }}</p>
|
||||
</div>
|
||||
138
layouts/shortcodes/videolist.html
Normal file
138
layouts/shortcodes/videolist.html
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
<p>
|
||||
<div class="videoplayer">
|
||||
<video controls>
|
||||
<source src="" type="video/mp4">
|
||||
</video>
|
||||
</div>
|
||||
<div class="videoplayer-title">Now playing: [no video selected]</div>
|
||||
</p>
|
||||
|
||||
<div class="medialist medialistscroll">
|
||||
{{ range $index, $elem := sort $.Site.Data.videos.videos "date" "desc" }}
|
||||
{{ $srcLink := or $elem.link (printf "https://cdn.mmaker.moe/video/%s_%s.mp4" $elem.date $elem.videoid) }}
|
||||
{{ $srcThumb := or $elem.thumb (printf "https://cdn.mmaker.moe/video/thumbnail/%s_%s.jpg" $elem.date $elem.videoid) }}
|
||||
{{ partial "media_item" ( dict "srcLink" $srcLink "srcThumb" $srcThumb "title" $elem.title "date" $elem.date "type" $elem.type "videoid" $elem.videoid ) }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<br />
|
||||
|
||||
<div class="videoplayer-description">Description</div>
|
||||
<div class="videodescription">[no video selected]</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function ()
|
||||
{
|
||||
const CDN_PATH = "https://cdn.mmaker.moe/video/";
|
||||
const COMMENTS_ENABLED = true;
|
||||
let videos = document.getElementsByClassName("mediaitem");
|
||||
let videoPlayer = document.getElementsByClassName("videoplayer")[0].children[0];
|
||||
let videoPlayerTitle = document.getElementsByClassName("videoplayer-title")[0];
|
||||
videoPlayer.volume = 0.25;
|
||||
|
||||
function loadIssoThread(videoId, videoTitle)
|
||||
{
|
||||
if (!COMMENTS_ENABLED) return;
|
||||
|
||||
let issoThread = document.getElementById("isso-thread");
|
||||
if (!issoThread) return;
|
||||
|
||||
// Set both data-isso-id and data-title
|
||||
// The title prevents Isso from checking if the URI exists
|
||||
issoThread.setAttribute("data-isso-id", "/videos/" + videoId);
|
||||
issoThread.setAttribute("data-title", videoTitle);
|
||||
|
||||
if (window.Isso) {
|
||||
window.Isso.fetchComments();
|
||||
}
|
||||
}
|
||||
|
||||
function setVideo(url, videoId, videoTitle, videoDate)
|
||||
{
|
||||
setUrl(videoId);
|
||||
videoPlayer.src = url;
|
||||
videoPlayerTitle.textContent = "Now playing: " + videoTitle;
|
||||
getDesc(CDN_PATH + "description/" + videoDate + "_" + videoId + ".description");
|
||||
loadIssoThread(videoId, videoTitle);
|
||||
}
|
||||
|
||||
function setUrl(videoId)
|
||||
{
|
||||
let url = new URL(window.location.href);
|
||||
url.searchParams.set('v', videoId);
|
||||
window.history.pushState(null, document.title, url.href);
|
||||
}
|
||||
|
||||
function handleUrl()
|
||||
{
|
||||
let url = new URL(window.location);
|
||||
let v = url.searchParams.get("v");
|
||||
if (!v) return;
|
||||
|
||||
let video = document.querySelector('[data-video-id="' + v + '"]');
|
||||
if (video != null)
|
||||
{
|
||||
let videoUrl = video.parentElement.href;
|
||||
let videoTitle = video.querySelector('.mediaitem-title').textContent;
|
||||
let videoDate = video.querySelector('.mediaitem-date').textContent;
|
||||
|
||||
setUrl(v);
|
||||
videoPlayer.src = videoUrl;
|
||||
videoPlayerTitle.textContent = "Now playing: " + videoTitle;
|
||||
getDesc(CDN_PATH + "description/" + videoDate + "_" + v + ".description");
|
||||
|
||||
let issoThread = document.getElementById("isso-thread");
|
||||
if (issoThread) {
|
||||
issoThread.setAttribute("data-isso-id", "/videos/" + v);
|
||||
issoThread.setAttribute("data-title", videoTitle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getDesc(url)
|
||||
{
|
||||
let videoDescription = document.getElementsByClassName("videodescription")[0];
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
if (response.status === 403)
|
||||
{
|
||||
return "[No description available]";
|
||||
}
|
||||
return response.text();
|
||||
})
|
||||
.then((data) => {
|
||||
videoDescription.textContent = data;
|
||||
})
|
||||
.catch((error) => {
|
||||
videoDescription.textContent = "[Error occurred when fetching description]";
|
||||
});
|
||||
}
|
||||
|
||||
for (let video of videos)
|
||||
{
|
||||
let videoTitle = video.getElementsByClassName("mediaitem-title")[0].textContent;
|
||||
let videoDate = video.getElementsByClassName("mediaitem-date")[0].textContent;
|
||||
let videoThumbnail = video.getElementsByClassName("mediaitem-thumb")[0];
|
||||
let videoId = video.getAttribute("data-video-id");
|
||||
let videoType = video.getAttribute("data-video-type");
|
||||
let videoTypes = ["video", "ビデオ", "collab work"];
|
||||
video.addEventListener("click", function(evt)
|
||||
{
|
||||
if (!(videoTypes.indexOf(videoType) >= 0)) {
|
||||
videoPlayer.pause();
|
||||
return;
|
||||
} else {
|
||||
evt.preventDefault();
|
||||
};
|
||||
videoUrl = video.parentElement.href;
|
||||
|
||||
if (videoPlayer.src != videoUrl)
|
||||
{
|
||||
setVideo(videoUrl, videoId, videoTitle, videoDate);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', handleUrl);
|
||||
})();
|
||||
</script>
|
||||
1
layouts/shortcodes/warning.html
Normal file
1
layouts/shortcodes/warning.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<span class="warning">{{ index .Params 0 }}</span>
|
||||
6
layouts/shortcodes/yt.html
Normal file
6
layouts/shortcodes/yt.html
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<div class="video-wrapper">
|
||||
<a href="https://www.youtube.com/watch?v={{ index .Params 0 }}"><img width="528" height="297" src="https://i.ytimg.com/vi_webp/{{ index .Params 0 }}/mqdefault.webp" onmouseover="enableEmbed(this, getVideoEmbed({{ index .Params 0 }}));" /></a>
|
||||
<!--
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/{{ index .Params 0 }}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
-->
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue