代码拉取完成,页面将自动刷新
同步操作将从 GZ/awescnb 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="./images/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>awescnb</title>
<style>
.hello {
margin: 80px 0 0;
text-align: center;
font-size: 32px;
color: #333;
}
</style>
</head>
<body>
<div id="root">
<h1 class="hello">🌊 Hello Awescnb</h1>
<aw-navlist></aw-navlist>
<aw-footer></aw-footer>
</div>
<template id="aw-footer">
<footer>awescnb @ <span></span></footer>
<style>
footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
text-align: center;
padding: 20px 0;
background: #f8f8f8;
color: #555;
}
</style>
</template>
<template id="aw-navlist">
<div class="page-list"></div>
<style>
.page-list {
display: flex;
flex-wrap: wrap;
gap: 8px;
width: 500px;
margin: 40px auto 0;
}
.page-list > a {
padding: 8px;
text-decoration: none;
border-radius: 4px;
color: #555;
}
.page-list > a:hover {
color: darkblue;
background-color: #f3f2f2;
}
</style>
</template>
<script>
HTMLElement.prototype.appendHTML = function(html) {
var divTemp = document.createElement('div'),
nodes = null,
fragment = document.createDocumentFragment()
divTemp.innerHTML = html
nodes = divTemp.childNodes
for (var i = 0, length = nodes.length; i < length; i += 1) {
fragment.appendChild(nodes[i].cloneNode(true))
}
this.appendChild(fragment)
nodes = null
fragment = null
}
class AwFooter extends HTMLElement {
constructor() {
super()
// var shadow = this.attachShadow({ mode: 'closed' })
const templateElem = document.getElementById('aw-footer')
const content = templateElem.content.cloneNode(true)
content.querySelector(
'span',
).innerText = new Date().getFullYear()
this.appendChild(content)
}
}
class NavList extends HTMLElement {
constructor() {
super()
const templateElem = document.getElementById('aw-navlist')
this.content = templateElem.content.cloneNode(true)
this._init()
this.render()
}
_init() {
this.createPageNav()
}
createPageNav() {
function createNavItem(item) {
return `<a href="${item.url}"><div>${item.title}</div></a>`
}
const pageList = [
{
title: '🏠 首页',
url: '/public/templates/home.html',
},
{
title: '📃 富文本',
url: '/public/templates/post1.html',
},
{
title: '📃 Markdown',
url: '/public/templates/post.html',
},
{
title: '📃 tinymce5',
url: '/public/templates/tinymce5.html',
},
{
title: '📑 标签博文列表',
url: '/public/templates/catalog.html',
},
{
title: '📂 随笔分类',
url: '/public/templates/category.html',
},
{
title: '📷 相册',
url: '/public/templates/photos.html',
},
{
title: '🔍 相册 - 照片预览',
url: '/public/templates/photoview.html',
},
{
title: '📚 随笔档案博文列表',
url: '/public/templates/postarchive.html',
},
{
title: '🔖 标签列表',
url: '/public/templates/tags.html',
},
]
pageList.forEach(item => {
const navItem = createNavItem(item)
this.content
.querySelector('.page-list')
.appendHTML(navItem)
})
}
render() {
this.appendChild(this.content)
}
}
window.customElements.define('aw-footer', AwFooter)
window.customElements.define('aw-navlist', NavList)
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。