照片墙

This commit is contained in:
结发受长生
2019-05-08 22:56:39 +08:00
parent f78712c611
commit f64ec5dc6d
19 changed files with 124 additions and 55 deletions
@@ -0,0 +1,30 @@
[
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00001.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00002.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00003.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00004.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00005.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00006.png"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00007.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00001.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00002.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00003.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00004.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00005.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00006.png"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00007.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00001.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00002.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00003.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00004.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00005.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00006.png"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00007.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00001.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00002.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00003.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00004.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00005.jpg"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00006.png"},
{"url":"https://blog-cdn.nos-eastchina1.126.net/photo-wall/pic00007.jpg"}
]
+1
View File
@@ -19,6 +19,7 @@
@import "./footer";
@import "./waifu";
@import "./night";
@import "./page/photo-wall";
@media screen and (max-width: 800px) {
@import "./mobile";
@import "./mobile-slider";
@@ -0,0 +1,21 @@
/*
* 照片墙页面专用css
*/
// 瀑布流最外层
#photo-wall {
margin: 0 auto;
column-count: auto;
column-width: 240px;
column-gap: 20px;
// 每一列图片包含层
.item {
margin-bottom: 20px;
// 防止多列布局,分页媒体和多区域上下文中的意外中断
break-inside: avoid;
}
// 图片
.item-img {
width: 100%;
vertical-align: middle;
}
}
+2 -12
View File
@@ -8,21 +8,11 @@ function init() {
$nav.innerHTML = $nav.innerHTML + '<a class="extend next disabled" rel="next">Next &raquo;</a>'
}
// 新窗口打开
if (yiliaConfig && yiliaConfig.open_in_new) {
let $a = document.querySelectorAll(('.article-entry a:not(.article-more-a)'))
$a.forEach(($em) => {
let target = $em.getAttribute('target');
if (!target || target === '') {
$em.setAttribute('target', '_blank');
}
})
}
// 目录序号
if (yiliaConfig && yiliaConfig.toc_hide_index) {
let $a = document.querySelectorAll(('.toc-number'))
let $a = document.querySelectorAll('.toc-number')
Array.prototype.forEach.call($a, function($em){
$em.style.display = 'none';
$em.style.display = 'none'
})
}
}
+6 -1
View File
@@ -16,6 +16,11 @@ Util.addLoadEvent(function() {
})
const commentConfig = require("../config/comment.json")
if(window.yiliaConfig.isPost && commentConfig.valine.enable) {
// 如果是文章详情页面, 并且启用了评论, 则加载评论相关代码
// 文章详情页面, 并且启用了评论, 则加载评论相关代码
import(/* webpackChunkName: "comment" */ './comment')
}
if(window.yiliaConfig.pageid === 'PhotoWall') {
// 自定义的照片墙页面
import(/* webpackChunkName: "photo-wall" */ './photo-wall')
}
+13
View File
@@ -0,0 +1,13 @@
import photoWallJson from '../config/photo-wall.json'
var content = '<div class="itemContainer">'
photoWallJson.forEach(item => {
content += `
<div class="item">
<img class="item-img" src="${item.url}" alt=""/>
</div>
`
})
content += '</div>'
document.getElementById('photo-wall').innerHTML = content
+3 -3
View File
@@ -36,6 +36,6 @@ function init() {
}
// export default { init }
Util.addLoadEvent(function() {
init()
})
if(!window.yiliaConfig.pageid) { // 非个性化页面的普通文章
Util.addLoadEvent(init)
}