新增文章库
This commit is contained in:
1 parent
90bd40ffde
commit
4e6d6e5307
12 files changed
+1119
-4
No files matched your search
+163
-1
@@ -200,7 +200,7 @@ a.quick-chip[data-note]:hover::after { opacity: 1; transform: translateX(-50%) t
|
||||
.board-icon img.icon-img { width: 30px; height: 30px; }
|
||||
.board-section .section-title { text-align: center; font-size: 22px; margin-bottom: 6px; }
|
||||
.board-section .section-sub { text-align: center; color: var(--text-3); font-size: 14px; margin-bottom: 18px; }
|
||||
.boards { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
|
||||
.boards { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; }
|
||||
.board-card {
|
||||
position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
|
||||
gap: 12px; background-color: var(--card); background-image: var(--board-tint);
|
||||
@@ -499,3 +499,165 @@ a.nav-btn[data-note]:hover::after { opacity: 1; transform: translateX(-50%) tran
|
||||
.nav-block-grid { grid-template-columns: 1fr; grid-auto-rows: auto; }
|
||||
.nav-btn { justify-content: flex-start; padding: 8px 12px; }
|
||||
}
|
||||
|
||||
/* ============ 文章库(第五板块:三栏阅读区) ============ */
|
||||
.art-app { display: flex; flex-direction: column; height: 100vh; min-height: 0; }
|
||||
.art-topbar {
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
padding: 10px 14px; background: var(--card);
|
||||
border-bottom: 1px solid var(--line); flex: 0 0 auto;
|
||||
}
|
||||
.art-topbar-nav { display: flex; gap: 6px; flex: 0 0 auto; min-width: 0; }
|
||||
.art-topbar-nav .btn { white-space: nowrap; }
|
||||
.art-topbar-title {
|
||||
flex: 1 1 auto; text-align: center; font-size: 17px; font-weight: 600;
|
||||
white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 100%;
|
||||
}
|
||||
.art-topbar-acts { display: flex; gap: 6px; flex: 0 0 auto; min-width: 0; }
|
||||
.art-topbar-acts .btn.active {
|
||||
background: var(--accent-soft); border-color: var(--brand); color: var(--brand);
|
||||
}
|
||||
.art-note {
|
||||
flex: 0 0 auto; padding: 8px 16px; text-align: center;
|
||||
background: var(--accent-soft); color: var(--text-2); font-size: 13.5px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
.art-frame {
|
||||
flex: 1 1 auto; min-height: 0; display: flex;
|
||||
--w-title: 15%; --w-toc: 15%; position: relative;
|
||||
}
|
||||
.art-col {
|
||||
display: flex; flex-direction: column; min-height: 0;
|
||||
background: var(--card); min-width: 0;
|
||||
}
|
||||
.art-col-title { flex: 0 0 var(--w-title, 15%); border-right: 1px solid var(--line); }
|
||||
.art-col-toc { flex: 0 0 var(--w-toc, 15%); border-right: 1px solid var(--line); }
|
||||
.art-col.art-col-hidden { display: none; }
|
||||
/* 窄屏浮层显示态 */
|
||||
@media (max-width: 860px) {
|
||||
.art-col-title, .art-col-toc {
|
||||
position: absolute; top: 0; bottom: 0; z-index: 40;
|
||||
width: min(80%, 300px); box-shadow: var(--shadow); display: none;
|
||||
}
|
||||
.art-col-title { left: 0; border-right: 1px solid var(--line); }
|
||||
.art-col-toc { right: 0; border-left: 1px solid var(--line); }
|
||||
.art-col-title.art-col-show-mobile, .art-col-toc.art-col-show-mobile { display: flex; }
|
||||
.art-gutter { display: none !important; }
|
||||
}
|
||||
.art-col-head {
|
||||
display: flex; align-items: center; justify-content: space-between; gap: 6px;
|
||||
padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--text-2);
|
||||
border-bottom: 1px solid var(--line); background: var(--bg-2); flex: 0 0 auto;
|
||||
}
|
||||
.art-mini {
|
||||
border: none; background: transparent; cursor: pointer; color: var(--text-3);
|
||||
font-size: 13px; line-height: 1; padding: 3px 6px; border-radius: 5px;
|
||||
}
|
||||
.art-mini:hover { background: var(--hover-bg); color: var(--danger); }
|
||||
.art-nav, .art-toc { overflow-y: auto; flex: 1 1 auto; min-height: 0; padding: 6px 0; }
|
||||
.art-nav-part { margin: 4px 0; }
|
||||
.art-nav-part-name {
|
||||
padding: 5px 12px 3px; font-size: 12px; color: var(--text-3);
|
||||
position: sticky; top: 0; background: var(--card); font-weight: 600;
|
||||
}
|
||||
.art-nav-item {
|
||||
display: block; padding: 6px 12px 6px 16px; font-size: 13.5px;
|
||||
color: var(--text-2); border-left: 2px solid transparent;
|
||||
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
||||
}
|
||||
.art-nav-item:hover { background: var(--hover-bg); color: var(--brand); }
|
||||
.art-nav-item.active {
|
||||
background: var(--accent-soft); color: var(--brand); border-left-color: var(--brand);
|
||||
}
|
||||
.art-toc-link {
|
||||
display: block; padding: 5px 14px 5px 20px; font-size: 13px; color: var(--text-2);
|
||||
overflow: hidden; text-overflow: ellipsis; white-space: nowrap; position: relative;
|
||||
}
|
||||
.art-toc-link:hover { color: var(--brand); background: var(--hover-bg); }
|
||||
.art-toc-link.lv2 { padding-left: 30px; font-size: 12.5px; }
|
||||
.art-toc-link.lv3 { padding-left: 42px; font-size: 12px; }
|
||||
.art-toc-link.lv4 { padding-left: 54px; font-size: 11.5px; }
|
||||
.art-gutter {
|
||||
flex: 0 0 7px; cursor: col-resize; background: transparent;
|
||||
position: relative; z-index: 5;
|
||||
}
|
||||
.art-gutter:hover, .art-gutter.dragging { background: var(--brand); opacity: .35; }
|
||||
.art-body {
|
||||
flex: 1 1 auto; min-width: 0; min-height: 0; overflow-y: auto;
|
||||
background: var(--bg);
|
||||
}
|
||||
|
||||
/* 正文排版(Markdown 渲染区) */
|
||||
.art-article { max-width: 1000px; margin: 0 auto; padding: 26px 34px 60px; }
|
||||
.art-article-head { border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 18px; }
|
||||
.art-article-part {
|
||||
display: inline-block; font-size: 12px; color: var(--brand);
|
||||
background: var(--accent-soft); border-radius: 6px; padding: 2px 9px; margin-bottom: 8px;
|
||||
}
|
||||
.art-article-title { font-size: 26px; margin: 0 0 6px; line-height: 1.35; }
|
||||
.art-article-sum { color: var(--text-3); font-size: 14px; margin: 0 0 8px; }
|
||||
.art-article-meta { color: var(--text-3); font-size: 12px; }
|
||||
.art-md { line-height: 1.75; font-size: 15px; color: var(--text); overflow-wrap: break-word; }
|
||||
.art-md h1, .art-md h2, .art-md h3, .art-md h4, .art-md h5, .art-md h6 {
|
||||
margin: 1.3em 0 .5em; line-height: 1.4;
|
||||
}
|
||||
.art-md h1 { font-size: 1.6em; border-bottom: 1px solid var(--line); padding-bottom: .25em; }
|
||||
.art-md h2 { font-size: 1.4em; border-bottom: 1px solid var(--line); padding-bottom: .2em; }
|
||||
.art-md h3 { font-size: 1.22em; }
|
||||
.art-md h4 { font-size: 1.1em; }
|
||||
.art-md p { margin: .6em 0; }
|
||||
.art-md ul, .art-md ol { padding-left: 1.6em; margin: .5em 0; }
|
||||
.art-md li { margin: .2em 0; }
|
||||
.art-md blockquote {
|
||||
margin: .8em 0; padding: 8px 14px; color: var(--text-2);
|
||||
border-left: 4px solid var(--brand); background: var(--accent-soft); border-radius: 0 8px 8px 0;
|
||||
}
|
||||
.art-md code {
|
||||
font-family: Consolas, Menlo, Monaco, monospace; font-size: .92em;
|
||||
background: var(--code-bg); color: var(--code-text); border-radius: 4px; padding: 2px 6px;
|
||||
}
|
||||
.art-md pre {
|
||||
background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px;
|
||||
padding: 14px 16px; overflow-x: auto; line-height: 1.6;
|
||||
}
|
||||
.art-md pre code { background: none; padding: 0; color: var(--code-text); }
|
||||
.art-md img { max-width: 100%; border-radius: 8px; margin: .4em 0; }
|
||||
.art-md a { text-decoration: underline; text-underline-offset: 2px; }
|
||||
.art-md table {
|
||||
border-collapse: collapse; margin: .8em 0; max-width: 100%; display: block; overflow-x: auto;
|
||||
}
|
||||
.art-md th, .art-md td { border: 1px solid var(--line-2); padding: 6px 12px; font-size: 14px; }
|
||||
.art-md th { background: var(--bg-2); }
|
||||
.art-md hr { border: none; border-top: 1px solid var(--line); margin: 1.6em 0; }
|
||||
|
||||
/* 列表视图(先列表后阅读) */
|
||||
.art-list { max-width: 1000px; margin: 0 auto; padding: 24px 26px 60px; }
|
||||
.art-list-head h1 { font-size: 24px; margin: 0 0 4px; }
|
||||
.art-list-head .tip { margin: 0 0 10px; }
|
||||
.art-part-block { margin-top: 18px; }
|
||||
.art-part-title {
|
||||
font-size: 17px; color: var(--text-2); margin: 0 0 10px;
|
||||
padding-left: 10px; border-left: 4px solid var(--brand);
|
||||
}
|
||||
.art-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
|
||||
.art-card {
|
||||
display: flex; flex-direction: column; gap: 6px; padding: 14px 16px;
|
||||
background: var(--card); border: 1px solid var(--line); border-radius: 12px;
|
||||
color: var(--text); transition: all .15s ease; min-width: 0;
|
||||
}
|
||||
.art-card:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
|
||||
.art-card-title { font-weight: 600; font-size: 15px; }
|
||||
.art-card:hover .art-card-title { color: var(--brand); }
|
||||
.art-card-sum { color: var(--text-3); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
||||
.art-card-date { color: var(--text-3); font-size: 12px; }
|
||||
@media (max-width: 600px) {
|
||||
.art-cards { grid-template-columns: 1fr; }
|
||||
.art-article { padding: 18px 18px 48px; }
|
||||
.art-list { padding: 16px 14px 48px; }
|
||||
.art-article-title { font-size: 21px; }
|
||||
.art-topbar { gap: 5px; padding: 8px 8px; }
|
||||
.art-topbar .btn { padding: 4px 8px; font-size: 12px; }
|
||||
.art-topbar-title { font-size: 14px; }
|
||||
.art-tg-txt { display: none; }
|
||||
.art-topbar-nav { gap: 4px; }
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
/* article.js —— 文章库三栏阅读交互
|
||||
* 功能:三栏(标题栏 / 段落栏 / 正文)宽度拖拽调节、分区栏与段落栏显示/隐藏;
|
||||
* Markdown 正文 CDN 懒加载渲染、正文图片路径前缀补全、段落目录生成与平滑跳转。
|
||||
*/
|
||||
(function (global) {
|
||||
'use strict';
|
||||
|
||||
function $(sel, root) { return (root || document).querySelector(sel); }
|
||||
function $$(sel, root) { return Array.prototype.slice.call((root || document).querySelectorAll(sel)); }
|
||||
|
||||
var app = $('.js-art-app');
|
||||
var frame = $('.js-art-frame');
|
||||
if (!app || !frame) return;
|
||||
|
||||
var BODY_MIN = 22; // 正文列最小占比(%)
|
||||
var KEY = 'hp-art-layout';
|
||||
var MEDIA_SMALL = '(max-width: 860px)';
|
||||
|
||||
/* ---------- 布局状态(宽度 / 显隐) ---------- */
|
||||
function loadState() {
|
||||
var isList = global.HP_ART_DATA && global.HP_ART_DATA.listMode ? true : false;
|
||||
var st = { w1: 15, w2: 15, t1: true, t2: !isList }; // 列表页默认收起段落栏
|
||||
try {
|
||||
var saved = JSON.parse(localStorage.getItem(KEY) || 'null');
|
||||
if (saved) {
|
||||
st.w1 = clampPct(saved.w1, 6, 60);
|
||||
st.w2 = clampPct(saved.w2, 6, 60);
|
||||
if (typeof saved.t1 === 'boolean') st.t1 = saved.t1;
|
||||
if (typeof saved.t2 === 'boolean') st.t2 = saved.t2;
|
||||
} else if (window.matchMedia && window.matchMedia(MEDIA_SMALL).matches) {
|
||||
// 窄屏首次进入:默认只显示正文,两栏以浮层形式随时唤出
|
||||
st.t1 = false;
|
||||
st.t2 = false;
|
||||
}
|
||||
} catch (e) { /* ignore */ }
|
||||
return st;
|
||||
}
|
||||
function saveState(st) {
|
||||
try { localStorage.setItem(KEY, JSON.stringify(st)); } catch (e) { /* ignore */ }
|
||||
}
|
||||
function clampPct(v, min, max) {
|
||||
v = parseFloat(v);
|
||||
if (isNaN(v)) return min;
|
||||
return Math.min(max, Math.max(min, v));
|
||||
}
|
||||
var st = loadState();
|
||||
|
||||
function isSmall() {
|
||||
return (window.matchMedia && window.matchMedia(MEDIA_SMALL).matches) ? true : false;
|
||||
}
|
||||
|
||||
function applyLayout() {
|
||||
frame.style.setProperty('--w-title', st.w1 + '%');
|
||||
frame.style.setProperty('--w-toc', st.w2 + '%');
|
||||
var small = isSmall();
|
||||
var tTitle = $('.js-col-title');
|
||||
var tToc = $('.js-col-toc');
|
||||
var gTitle = $('.js-gutter[data-var="--w-title"]');
|
||||
var gToc = $('.js-gutter[data-var="--w-toc"]');
|
||||
if (!small) {
|
||||
if (tTitle) { tTitle.classList.toggle('art-col-hidden', !st.t1); }
|
||||
if (tToc) { tToc.classList.toggle('art-col-hidden', !st.t2); }
|
||||
if (gTitle) gTitle.style.display = st.t1 ? '' : 'none';
|
||||
if (gToc) gToc.style.display = st.t2 ? '' : 'none';
|
||||
} else {
|
||||
// 窄屏:默认隐藏,靠开关以浮层方式显示
|
||||
if (tTitle) tTitle.classList.toggle('art-col-show-mobile', !!st.t1);
|
||||
if (tToc) tToc.classList.toggle('art-col-show-mobile', !!st.t2);
|
||||
if (gTitle) gTitle.style.display = 'none';
|
||||
if (gToc) gToc.style.display = 'none';
|
||||
}
|
||||
updateToggleBtns();
|
||||
}
|
||||
|
||||
function setColVisible(col, visible) {
|
||||
if (col === 'title') st.t1 = visible;
|
||||
if (col === 'toc') st.t2 = visible;
|
||||
applyLayout();
|
||||
saveState(st);
|
||||
}
|
||||
|
||||
function updateToggleBtns() {
|
||||
$$('.js-art-toggle').forEach(function (b) {
|
||||
var c = b.getAttribute('data-col');
|
||||
var visible = (c === 'title') ? st.t1 : st.t2;
|
||||
b.classList.toggle('active', visible);
|
||||
var inSmall = isSmall();
|
||||
b.title = (inSmall
|
||||
? (visible ? '收起' : '展开') + ((c === 'title') ? '文章标题栏' : '段落目录')
|
||||
: '显示 / 隐藏' + ((c === 'title') ? '文章标题栏' : '段落目录'));
|
||||
});
|
||||
}
|
||||
|
||||
function bindToggles() {
|
||||
document.addEventListener('click', function (ev) {
|
||||
var b = ev.target && ev.target.closest ? ev.target.closest('.js-art-toggle') : null;
|
||||
if (!b) return;
|
||||
var c = b.getAttribute('data-col');
|
||||
if (c !== 'title' && c !== 'toc') return;
|
||||
var cur = (c === 'title') ? st.t1 : st.t2;
|
||||
setColVisible(c, !cur);
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------- 分隔条拖拽 ---------- */
|
||||
function bindGutters() {
|
||||
$$('.js-gutter', frame).forEach(function (g) {
|
||||
g.addEventListener('mousedown', function (ev) {
|
||||
ev.preventDefault();
|
||||
var colVar = g.getAttribute('data-var'); // --w-title / --w-toc
|
||||
var isTitle = colVar.indexOf('title') !== -1;
|
||||
var startX = ev.clientX;
|
||||
var frameW = frame.getBoundingClientRect().width || 1;
|
||||
var startW = isTitle ? st.w1 : st.w2;
|
||||
var other = isTitle ? st.w2 : st.w1;
|
||||
var moved = false;
|
||||
|
||||
function onMove(e) {
|
||||
var dx = e.clientX - startX;
|
||||
var pct = startW + (dx / frameW) * 100;
|
||||
var max = 100 - BODY_MIN - other; // 保证正文列至少 BODY_MIN%
|
||||
pct = clampPct(pct, 6, Math.max(6, max));
|
||||
if (Math.abs(pct - startW) > 0.2) moved = true;
|
||||
if (isTitle) { st.w1 = pct; } else { st.w2 = pct; }
|
||||
frame.style.setProperty(colVar, pct + '%');
|
||||
g.classList.add('dragging');
|
||||
}
|
||||
function onUp() {
|
||||
document.removeEventListener('mousemove', onMove);
|
||||
document.removeEventListener('mouseup', onUp);
|
||||
g.classList.remove('dragging');
|
||||
if (moved) {
|
||||
if (isTitle) { st.w1 = clampPct(st.w1, 6, Math.max(6, 100 - BODY_MIN - st.w2)); }
|
||||
else { st.w2 = clampPct(st.w2, 6, Math.max(6, 100 - BODY_MIN - st.w1)); }
|
||||
saveState(st);
|
||||
}
|
||||
}
|
||||
document.addEventListener('mousemove', onMove);
|
||||
document.addEventListener('mouseup', onUp);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------- Markdown 库 CDN 懒加载(marked v4) ---------- */
|
||||
var MARKED_URLS = [
|
||||
'https://cdn.jsdelivr.net/npm/marked@4.3.0/marked.min.js',
|
||||
'https://unpkg.com/marked@4.3.0/marked.min.js'
|
||||
];
|
||||
var markedPromise = null;
|
||||
|
||||
function loadMarked() {
|
||||
if (global.marked) return Promise.resolve(global.marked);
|
||||
if (markedPromise) return markedPromise;
|
||||
markedPromise = new Promise(function (resolve) {
|
||||
var tryLoad = function (i) {
|
||||
if (global.marked) { resolve(global.marked); return; }
|
||||
if (i >= MARKED_URLS.length) { resolve(null); return; }
|
||||
var s = document.createElement('script');
|
||||
s.src = MARKED_URLS[i];
|
||||
s.onload = function () { resolve(global.marked || null); };
|
||||
s.onerror = function () { tryLoad(i + 1); };
|
||||
document.head.appendChild(s);
|
||||
};
|
||||
tryLoad(0);
|
||||
});
|
||||
return markedPromise;
|
||||
}
|
||||
|
||||
/* ---------- 正文渲染与目录 ---------- */
|
||||
var rawEl = document.getElementById('artRaw');
|
||||
var mdBox = document.getElementById('artMd');
|
||||
var tocNav = $('.js-toc-nav');
|
||||
var tocCol = $('.js-col-toc');
|
||||
|
||||
function fixRelativeUrls() {
|
||||
// 正文图片/链接可能使用 data/articles/img/… 站点相对根路径(相对站点根),
|
||||
// 页面位于 article/ 子目录,渲染后需补 ../ 前缀才能正确指向 data/articles/img/。
|
||||
if (!mdBox) return;
|
||||
var absPrefixes = ['#', 'http:', 'https:', '//', 'mailto:', 'tel:', 'data:', '/', '../'];
|
||||
function apply(attr) {
|
||||
mdBox.querySelectorAll('img, a').forEach(function (el) {
|
||||
var v = el.getAttribute(attr);
|
||||
if (!v) return;
|
||||
var t = v.trim();
|
||||
for (var i = 0; i < absPrefixes.length; i++) {
|
||||
if (t.indexOf(absPrefixes[i]) === 0) return;
|
||||
}
|
||||
// 纯相对路径:视为相对站点根 → 相对当前 article/ 目录需 ../
|
||||
el.setAttribute(attr, '../' + v);
|
||||
});
|
||||
}
|
||||
apply('src');
|
||||
apply('href');
|
||||
}
|
||||
|
||||
function renderError() {
|
||||
var tpl = document.getElementById('artErrTpl');
|
||||
if (mdBox && tpl) mdBox.innerHTML = tpl.textContent;
|
||||
}
|
||||
|
||||
function buildToc() {
|
||||
if (!mdBox || !tocNav) return;
|
||||
var heads = $$('#artMd h1, #artMd h2, #artMd h3, #artMd h4, #artMd h5');
|
||||
tocNav.innerHTML = '';
|
||||
if (!heads.length) {
|
||||
tocNav.innerHTML = '<p class="tip" style="padding:10px">本文暂无段落标题</p>';
|
||||
return;
|
||||
}
|
||||
var frag = document.createDocumentFragment();
|
||||
heads.forEach(function (h, i) {
|
||||
var id = 'art-sec-' + i;
|
||||
h.id = id;
|
||||
var lv = parseInt(h.tagName.charAt(1), 10) || 1;
|
||||
var level = Math.min(4, Math.max(1, lv));
|
||||
var a = document.createElement('a');
|
||||
a.href = '#' + id;
|
||||
a.className = 'art-toc-link lv' + level;
|
||||
a.textContent = h.textContent;
|
||||
a.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
var target = document.getElementById(id);
|
||||
if (target) target.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
});
|
||||
frag.appendChild(a);
|
||||
});
|
||||
tocNav.appendChild(frag);
|
||||
}
|
||||
|
||||
function renderArticle() {
|
||||
if (!rawEl || !mdBox) {
|
||||
if (tocNav) tocNav.innerHTML = '<p class="tip" style="padding:10px">选择左侧任意文章后,此处生成段落目录。</p>';
|
||||
return;
|
||||
}
|
||||
loadMarked().then(function (marked) {
|
||||
if (!marked) { renderError(); return; }
|
||||
var md = rawEl.value || '';
|
||||
var html = marked.parse(md, { gfm: true, breaks: false });
|
||||
mdBox.innerHTML = html;
|
||||
fixRelativeUrls();
|
||||
buildToc();
|
||||
// 高亮标题栏当前项
|
||||
var curId = (global.HP_ART_DATA && global.HP_ART_DATA.curId) ? global.HP_ART_DATA.curId : 0;
|
||||
if (curId) {
|
||||
var link = $('.js-art-nav a[href="?id=' + curId + '"]');
|
||||
if (link) {
|
||||
$$('.js-art-nav a').forEach(function (a) { a.classList.remove('active'); });
|
||||
link.classList.add('active');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------- 初始化 ---------- */
|
||||
function init() {
|
||||
applyLayout();
|
||||
bindToggles();
|
||||
bindGutters();
|
||||
renderArticle();
|
||||
// 窗口尺寸变化(跨断点时重新应用显隐策略)
|
||||
var resizeTimer = null;
|
||||
window.addEventListener('resize', function () {
|
||||
if (resizeTimer) clearTimeout(resizeTimer);
|
||||
resizeTimer = setTimeout(function () { applyLayout(); }, 120);
|
||||
});
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
})(window);
|
||||
Reference in new issue
Block a user