EMLOG
用于首页 Hero 副标题与博主卡片简介,留空使用站点副标题。
/* 协议弹窗 */
function showAgreement(type) {
var titles = { service: "用户服务协议", privacy: "隐私政策" };
var contents = {
service: "欢迎使用 Horizon 主题搭建的博客网站。使用本主题即表示您已阅读并同意以下条款:
1. 服务说明
Horizon 是一款免费开源的 emlog 博客主题,供个人非商业用途免费使用。
2. 用户责任
用户应遵守国家法律法规,不得利用本主题搭建的网站发布违法违规内容。
3. 免责声明
本主题按"现状"提供,不作任何明示或暗示的保证。作者不对因使用本主题而产生的任何损失承担责任。
4. 版权声明
Copyright (c) Horizon. 保留所有权利。
",
privacy: "本隐私政策说明了 Horizon 主题收集和使用用户信息的方式:
1. 信息收集
我们仅收集您在注册、登录、评论时主动提供的信息(邮箱、昵称、评论内容)。
2. 信息使用
收集的信息仅用于提供博客服务(登录验证、评论显示、邮件通知)。
3. 信息保护
我们采用安全措施保护您的个人信息,不会向第三方出售或共享。
4. Cookie 使用
本站使用 Cookie 维持登录状态,您可以在浏览器设置中禁用。
5. 联系方式
如有隐私相关问题,请通过网站评论或邮件联系我们。
"
};
var title = titles[type] || "协议";
var content = contents[type] || "协议内容暂无";
var overlay = document.createElement("div");
overlay.style.cssText = "position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.5);z-index:10000;display:flex;align-items:center;justify-content:center;padding:20px;box-sizing:border-box;";
overlay.onclick = function(e) { if (e.target === overlay) document.body.removeChild(overlay); };
overlay.innerHTML = '';
document.body.appendChild(overlay);
}
function horizonAuthMarkLogged() {
try { localStorage.setItem("horizon_logged", "1"); } catch (e) {}
var ex = document.getElementById("exchange-content");
if (ex) ex.style.display = "block";
var lock = document.querySelector(".post-exchange");
if (lock) lock.style.display = "none";
}
function horizonAuthCloseModal() {
var modal = document.querySelector(".login-popup");
if (modal) { modal.classList.remove("is-visible"); document.body.classList.remove("no-scroll"); }
}
function horizonAuthSubmit(form) {
if (!form) return false;
var isSignup = form.closest("#signup") !== null;
var isForgot = form.closest("#reset-password") !== null;
var pwd = form.querySelector('input[type="password"]');
var account = form.querySelector('[name="user"], [name="mail"], [name="phone"]');
if (isSignup) {
var pwd2 = form.querySelectorAll('input[type="password"]')[1];
if (pwd2 && pwd && pwd.value !== pwd2.value) {
if (typeof hzPopupTips === "function") hzPopupTips(0, "两次密码不一致"); return false;
}
var agree = form.querySelector('input[name="agree"]');
if (agree && !agree.checked) {
if (typeof hzPopupTips === "function") hzPopupTips(0, "请先同意服务协议"); return false;
}
} else if (!isForgot) {
if (account && !account.value.trim()) { if (typeof hzPopupTips === "function") hzPopupTips(0, "请输入账号"); return false; }
if (pwd && !pwd.value.trim()) { if (typeof hzPopupTips === "function") hzPopupTips(0, "请输入密码"); return false; }
}
var btn = form.querySelector('button[type="submit"]');
var origText = btn ? btn.textContent : "";
if (btn) { btn.disabled = true; btn.textContent = "提交中..."; }
var fd = new FormData(form);
fd.append("resp", "json");
var url = form.getAttribute("action");
fetch(url, { method: "POST", body: fd, credentials: "same-origin" })
.then(function (r) { return r.json(); })
.then(function (res) {
if (res.code === 0) {
horizonAuthMarkLogged();
horizonAuthCloseModal();
location.href = BLOG_URL_BASE + "user";
return;
}
if (typeof hzPopupTips === "function") hzPopupTips(-1, res.msg || "操作失败");
if (btn) { btn.disabled = false; btn.textContent = origText; }
})
.catch(function () {
if (typeof hzPopupTips === "function") hzPopupTips(-1, "网络错误,请重试");
if (btn) { btn.disabled = false; btn.textContent = origText; }
});
return false;
}