From 892e8191853b89b9a3491b80abf2b87e633d21f3 Mon Sep 17 00:00:00 2001
From: hjthjthjt
Date: Tue, 28 Jan 2020 16:26:57 +0800
Subject: [PATCH] feature(all): add custom blocks
---
ajax-comment/app.css | 25 ++++
ajax-comment/app.js | 69 +++++++++++
ajax-comment/main.php | 84 +++++++++++++
comments.php | 5 +-
css/comments.css | 261 +++++++++++++++++++++++-----------------
footer.php | 6 +-
functions.php | 51 ++++++--
header.php | 16 +--
js/style.js | 35 ++++++
page.php | 51 ++++++--
pages/page-archieve.php | 32 +++--
single.php | 63 +++++-----
style.css | 25 +++-
13 files changed, 536 insertions(+), 187 deletions(-)
create mode 100644 ajax-comment/app.css
create mode 100644 ajax-comment/app.js
create mode 100644 ajax-comment/main.php
diff --git a/ajax-comment/app.css b/ajax-comment/app.css
new file mode 100644
index 0000000..5eab0a2
--- /dev/null
+++ b/ajax-comment/app.css
@@ -0,0 +1,25 @@
+.butterBar {
+ margin-left: 36%;
+ max-width: 640px;
+ position: fixed;
+ text-align: center;
+ top: 0;
+ width: 58%;
+ z-index: 800
+}
+
+.butterBar--center {
+ left: 50%;
+ margin-left: -320px
+}
+
+.butterBar-message {
+ background: rgba(255, 255, 255, 0.97);
+ border-bottom-left-radius: 4px;
+ border-bottom-right-radius: 4px;
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.25), 0 0 1px rgba(0, 0, 0, 0.35);
+ display: inline-block;
+ font-size: 14px;
+ margin-bottom: 0;
+ padding: 12px 25px
+}
diff --git a/ajax-comment/app.js b/ajax-comment/app.js
new file mode 100644
index 0000000..605400e
--- /dev/null
+++ b/ajax-comment/app.js
@@ -0,0 +1,69 @@
+$(document).ready(function ($) {
+ var __cancel = $('#cancel-comment-reply-link'),
+ __cancel_text = __cancel.text(),
+ __list = 'commentlist';//your comment wrapprer
+ $(document).on("submit", "#commentform", function () {
+ $.ajax({
+ url: ajaxcomment.ajax_url,
+ data: $(this).serialize() + "&action=ajax_comment",
+ type: $(this).attr('method'),
+ beforeSend: faAjax.createButterbar("提交中...."),
+ error: function (request) {
+ var t = faAjax;
+ t.createButterbar(request.responseText);
+ },
+ success: function (data) {
+ $('textarea').each(function () {
+ this.value = ''
+ });
+ var t = faAjax,
+ cancel = t.I('cancel-comment-reply-link'),
+ temp = t.I('wp-temp-form-div'),
+ respond = t.I(t.respondId),
+ post = t.I('comment_post_ID').value,
+ parent = t.I('comment_parent').value;
+ if (parent != '0') {
+ $('#comment-nav').before('' + data + '
');
+ } else if (!$('.' + __list).length) {
+ if (ajaxcomment.formpostion == 'bottom') {
+ $('#respond').before('' + data + '
');
+ } else {
+ $('#respond').after('' + data + '
');
+ }
+
+ } else {
+ if (ajaxcomment.order == 'asc') {
+ $('.' + __list).append(data); // your comments wrapper
+ } else {
+ $('.' + __list).prepend(data); // your comments wrapper
+ }
+ }
+ t.createButterbar("提交成功");
+ cancel.style.display = 'none';
+ cancel.onclick = null;
+ t.I('comment_parent').value = '0';
+ if (temp && respond) {
+ temp.parentNode.insertBefore(respond, temp);
+ temp.parentNode.removeChild(temp)
+ }
+ }
+ });
+ return false;
+ });
+ faAjax = {
+ I: function (e) {
+ return document.getElementById(e);
+ },
+ clearButterbar: function (e) {
+ if ($(".butterBar").length > 0) {
+ $(".butterBar").remove();
+ }
+ },
+ createButterbar: function (message) {
+ var t = this;
+ t.clearButterbar();
+ $("body").append('
+
+
+
+ 共有 条评论
+
-
-本文采用 CC BY-NC-SA 3.0 协议进行许可,在您遵循此协议的情况下,可以自由共享与演绎本文章。
- +本文采用 CC BY-NC-SA 3.0 + 协议进行许可,在您遵循此协议的情况下,可以自由共享与演绎本文章。
+
-本文采用 CC BY-NC-SA 3.0 协议进行许可,在您遵循此协议的情况下,可以自由共享与演绎本文章。
- +本文采用 CC BY-NC-SA 3.0 + 协议进行许可,在您遵循此协议的情况下,可以自由共享与演绎本文章。
+