Merge branch 'dev' into feature/picset_caption

# Conflicts:
#	layouts/partials/pic_set.html
This commit is contained in:
FarseaSH 2022-09-04 20:01:42 +08:00
commit 3776130e5c
7 changed files with 377 additions and 323 deletions

View file

@ -1,11 +1,13 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
{{/*
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script> -->
*/}}
<!-- todo change jquery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://unpkg.com/jquery@3.3.1/dist/jquery.min.js"></script>
<!-- like button -->
<link href="https://cdn.bootcss.com/font-awesome/5.8.2/css/all.min.css" rel="stylesheet">
@ -31,7 +33,8 @@
<meta name="theme-color" content="#ffffff">
<!-- the Moments style css file -->
<link rel="stylesheet" type="text/css" href="{{.Site.BaseURL}}/css/style.css">
{{ $style := resources.Get "style-refractored.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }}
<link rel="stylesheet" href="{{ $style.Permalink }}">
<!-- fancybox css (js in the end before the body closing tag) -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css"/>

View file

@ -37,6 +37,17 @@
{{ $netease_music_song_id = replaceRE `(https?://)?music\.163\.com/song\?id=([0-9]*)([-a-zA-Z0-9()@:%\+.~#?&/=_]*)` "$2" .a }}
{{ end }}
{{/* 2.2 bilibili video */}}
{{ $bilibili_video_url := "0" }}
{{ if eq 1 (len (findRE `(https?://)?player\.bilibili\.com/player\.html.*` .a)) }}
{{ $resource_type = "bilibili_video" }}
{{ $bilibili_video_url = .a }}
{{ end }}
{{ if eq 1 (len (findRE `<iframe src="(//player\.bilibili.com/player\.html\?aid=.*&bvid=.*&cid=.*&page=1)" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>` .a)) }}
{{ $resource_type = "bilibili_video" }}
{{ $bilibili_video_url = replaceRE `<iframe src="(//player\.bilibili.com/player\.html\?aid=.*&bvid=.*&cid=.*&page=1)" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>` "$1" .a }}
{{ end }}
{{/* BEGIN generate output */}}
{{/* PART 1 default link */}}
@ -53,7 +64,7 @@
{{ end }}
</td>
<td style="padding-left: 20px">
<a href="{{ .a }}">{{.word}}</a>
<a href="{{ .a }}" target="_blank" rel="noopener noreferrer">{{.word}}</a>
</td>
</tr>
</table>
@ -67,3 +78,9 @@
src="//music.163.com/outchain/player?type=2&id={{ $netease_music_song_id }}&auto=1&height=66">
</iframe>
{{ end }}
{{ if eq "bilibili_video" $resource_type}}
<div class="bilibili-video">
<iframe src="{{ $bilibili_video_url }}" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
</div>
{{ end }}

View file

@ -1,6 +1,3 @@
<!-- START -->
{{ $caption := .other }}
{{ $num_per_row := 3}}
{{ $max_width := 80}}
{{ if or (eq (len .pic_set) 2) (eq (len .pic_set) 4)}}

View file

@ -1,7 +1,8 @@
<div class="moment-row">
<div class="pure-g">
<!-- time -->
{{/* time info shown in the left (or above in small screens) */}}
<div class="pure-u-1 pure-u-sm-1-3">
<div class="time">
<div class="month-day">{{ .Date.Format "Jan 2"}}{{ if in (slice 1 21 31) .Date.Day}}st{{ else if in (slice 2 22)
@ -10,23 +11,23 @@
</div>
</div>
<!-- moment-content -->
{{/* moment-main-content */}}
<div class="pure-u-1 pure-u-sm-2-3">
<div class="moment-content">
<!-- top mark -->
{{/* top mark */}}
{{ if gt .Params.top 0}}
<div class="top-mark" style="position: absolute; right: 5%;">
<i class="fas fa-bookmark" style="color: #e76b4f;"></i>
</div>
{{ end }}
<!-- user info -->
{{/* user info */}}
<div class="user-info">
<div class="avatar-block">
{{ with .Params.avatar }}
<img src='{{ . }}' class="avatar">
{{ else }}
<!-- fixme check whether the default avatar path is url or not-->
{{/* fixme check whether the default avatar path is url or not--> */}}
<img src='{{ $.Site.BaseURL }}/{{ .Site.Params.avatar }}' class="avatar">
{{ end }}
</div>
@ -51,33 +52,15 @@
</div>
</div>
</div>
<div style="padding-left: 5px; padding-right: 5px;">
<!-- content -->
{{/* Main text content */}}
<div class="context">
{{ .Content }}
</div>
<!-- add-on info 1: pictures -->
<!-- single picture (old version)-->
{{ with .Params.pic }}
<img src="{{ . }}" class="single-pic" alt="Responsive image" data-fancybox="gallery"></img>
{{ end }}
<!-- multiple pictures (old version) -->
{{ $pic_set_filtered := slice}}
{{ with .Params.pic_set }}
{{ range . }}
{{ with . }}
{{ $pic_set_filtered = $pic_set_filtered | append . }}
{{ end }}
{{ end }}
{{ end }}
{{ with $pic_set_filtered }}
{{ partial "pic_set.html" (dict "pic_set" .) }}
{{ end }}
<!-- new pictures API (combine single & multiple pictures)-->
{{/* add-on info 1: pictures */}}
{{/* new pictures API `pictures` (combine single & multiple pictures)*/}}
{{ $pictures_set:= slice}}
{{ with .Params.pictures }}
{{ range . }}
@ -102,23 +85,46 @@
{{/* partial "pic_set.html" $pictures_set "other" */}}
{{ end }}
<!-- add-on info 2: link -->
{{/* Probably DEPRECATED in the future: single picture (old version API `pic`)*/}}
{{ with .Params.pic }}
<img src="{{ . }}" class="single-pic" alt="Responsive image" data-fancybox="gallery"></img>
{{ end }}
{{/* Probably DEPRECATED: multiple pictures (old version API `pic_set`) */}}
{{ $pic_set_filtered := slice}}
{{ with .Params.pic_set }}
{{ range . }}
{{ with . }}
{{ $pic_set_filtered = $pic_set_filtered | append . }}
{{ end }}
{{ end }}
{{ end }}
{{ with $pic_set_filtered }}
{{ partial "pic_set.html" (dict "pic_set" .) }}
{{ end }}
{{/* add-on info 2: hyperlink to other resourse (e.g webpage, Netease music, Bilibili Video) */}}
{{ $link_link := .Params.link }}
{{ $link_logo := .Params.link_logo }}
{{ $link_text := .Params.link_text }}
{{ with .Params.link }}
{{ partial "link-block.html" (dict "logo" $link_logo "a" $link_link "word" $link_text "baseurl"
$.Site.BaseURL)}}
{{ partial "link-block.html" (dict "logo" $link_logo "a" $link_link "word" $link_text "baseurl"
$.Site.BaseURL)}}
{{ end }}
<!-- Note info -->
{{/* Note info shown below the main content */}}
<div class="moment-note">
<p class="note">{{ .Date.Format "15:04" }} {{ .Params.note }}</p>
<div style="padding-right: 12px;"><i class="far fa-heart"></i></div>
</div>
</div>
<hr style="clear: both">
<hr class="seperating_line">
</div>
</div>
</div>