feat: upgrade to version 4.3.2

main v4.3.2
Seaton Jiang 2025-02-08 17:12:27 +08:00
parent e9794649ec
commit d1303478b2
No known key found for this signature in database
GPG Key ID: 1E85ACC90F7EB73E
4 changed files with 3134 additions and 809 deletions

View File

@ -2,110 +2,298 @@
* Kratos * Kratos
* Seaton Jiang <hi@seatonjiang.com> * Seaton Jiang <hi@seatonjiang.com>
*/ */
(function ($) { (function (
$
) {
"use strict"; "use strict";
var KRATOS_VERSION = "4.3.1"; var KRATOS_VERSION =
"4.3.2";
var navbarConfig = function () { var navbarConfig =
$("#navbutton").on("click", function () { function () {
$(".navbar-toggler").toggleClass("nav-close"); $(
}); "#navbutton"
).on(
"click",
function () {
$(
".navbar-toggler"
).toggleClass(
"nav-close"
);
}
);
}; };
var tooltipConfig = function () { var tooltipConfig =
$('[data-toggle="tooltip"]').tooltip(); function () {
$(
'[data-toggle="tooltip"]'
).tooltip();
}; };
var gotopConfig = function () { var gotopConfig =
$(window).on("load", function () { function () {
var $win = $(window); $(
var setShowOrHide = function () { window
if ($win.scrollTop() > 200) { ).on(
$(".gotop").addClass("active"); "load",
function () {
var $win =
$(
window
);
var setShowOrHide =
function () {
if (
$win.scrollTop() >
200
) {
$(
".gotop"
).addClass(
"active"
);
} else { } else {
$(".gotop").removeClass("active"); $(
".gotop"
).removeClass(
"active"
);
} }
}; };
setShowOrHide(); setShowOrHide();
$win.scroll(setShowOrHide); $win.scroll(
}); setShowOrHide
$(".gotop").on("click", function (event) { );
}
);
$(
".gotop"
).on(
"click",
function (
event
) {
event.preventDefault(); event.preventDefault();
$("html, body").animate({ scrollTop: $("html").offset().top }, 500); $(
"html, body"
).animate(
{
scrollTop:
$(
"html"
).offset()
.top,
},
500
);
return false; return false;
}); }
);
}; };
var searchConfig = function () { var searchConfig =
$(".search").on("click", function (e) { function () {
$(".search-form").animate({ width: "200px" }, 200); $(
$(".search-form input").css("display", "block"); ".search"
$(document).one("click", function () { ).on(
$(".search-form").animate({ width: "0" }, 100); "click",
$(".search-form input").hide(); function (
}); e
) {
$(
".search-form"
).animate(
{
width:
"200px",
},
200
);
$(
".search-form input"
).css(
"display",
"block"
);
$(
document
).one(
"click",
function () {
$(
".search-form"
).animate(
{
width:
"0",
},
100
);
$(
".search-form input"
).hide();
}
);
e.stopPropagation(); e.stopPropagation();
}); }
$(".search-form").on("click", function (e) { );
$(
".search-form"
).on(
"click",
function (
e
) {
e.stopPropagation(); e.stopPropagation();
}); }
);
}; };
var wechatConfig = function () { var wechatConfig =
$(".wechat").mouseout(function () { function () {
$(".wechat-pic")[0].style.display = "none"; $(
}); ".wechat"
$(".wechat").mouseover(function () { ).mouseout(
$(".wechat-pic")[0].style.display = "block"; function () {
}); $(
".wechat-pic"
)[0].style.display =
"none";
}
);
$(
".wechat"
).mouseover(
function () {
$(
".wechat-pic"
)[0].style.display =
"block";
}
);
}; };
var smiliesConfig = function () { var smiliesConfig =
$("#addsmile").on("click", function (e) { function () {
$(".smile").toggleClass("open"); $(
$(document).one("click", function () { "#addsmile"
$(".smile").toggleClass("open"); ).on(
}); "click",
function (
e
) {
$(
".smile"
).toggleClass(
"open"
);
$(
document
).one(
"click",
function () {
$(
".smile"
).toggleClass(
"open"
);
}
);
e.stopPropagation(); e.stopPropagation();
return false; return false;
}); }
);
}; };
var postlikeConfig = function () { var postlikeConfig =
$.fn.postLike = function () { function () {
if ($(this).hasClass("done")) { $.fn.postLike =
layer.msg(kratos.repeat, function () {}); function () {
if (
$(
this
).hasClass(
"done"
)
) {
layer.msg(
kratos.repeat,
function () {}
);
return false; return false;
} else { } else {
$(this).addClass("done"); $(
layer.msg(kratos.thanks); this
var id = $(this).data("id"), ).addClass(
action = $(this).data("action"); "done"
var ajax_data = { );
action: "love", layer.msg(
um_id: id, kratos.thanks
um_action: action, );
var id =
$(
this
).data(
"id"
),
action =
$(
this
).data(
"action"
);
var ajax_data =
{
action:
"love",
um_id:
id,
um_action:
action,
}; };
$.post( $.post(
kratos.site + "/wp-admin/admin-ajax.php", kratos.site +
"/wp-admin/admin-ajax.php",
ajax_data, ajax_data,
function (data) {} function (
data
) {}
); );
return false; return false;
} }
}; };
$(document).on("click", ".btn-thumbs", function () { $(
$(this).postLike(); document
}); ).on(
"click",
".btn-thumbs",
function () {
$(
this
).postLike();
}
);
}; };
var donateConfig = function () { var donateConfig =
$("#donate").on("click", function () { function () {
layer.open({ $(
"#donate"
).on(
"click",
function () {
layer.open(
{
type: 1, type: 1,
area: ["300px", "370px"], area: [
title: kratos.donate, "300px",
"370px",
],
title:
kratos.donate,
resize: false, resize: false,
scrollbar: false, scrollbar: false,
content: content:
@ -120,35 +308,109 @@
'/assets/img/payment/alipay.png"></label><input id="wechatpay" type="radio" name="pay-method"><label for="wechatpay" class="pay-button"><img src="' + '/assets/img/payment/alipay.png"></label><input id="wechatpay" type="radio" name="pay-method"><label for="wechatpay" class="pay-button"><img src="' +
kratos.directory + kratos.directory +
'/assets/img/payment/wechat.png"></label></div></div>', '/assets/img/payment/wechat.png"></label></div></div>',
});
$('.choose-pay input[type="radio"]').click(function () {
var id = $(this).attr("id");
if (id == "alipay") {
$(".qr-pay #alipay_qr").removeClass("d-none");
$(".qr-pay #wechat_qr").addClass("d-none");
} }
if (id == "wechatpay") { );
$(".qr-pay #alipay_qr").addClass("d-none"); $(
$(".qr-pay #wechat_qr").removeClass("d-none"); '.choose-pay input[type="radio"]'
).click(
function () {
var id =
$(
this
).attr(
"id"
);
if (
id ==
"alipay"
) {
$(
".qr-pay #alipay_qr"
).removeClass(
"d-none"
);
$(
".qr-pay #wechat_qr"
).addClass(
"d-none"
);
} }
}); if (
}); id ==
"wechatpay"
) {
$(
".qr-pay #alipay_qr"
).addClass(
"d-none"
);
$(
".qr-pay #wechat_qr"
).removeClass(
"d-none"
);
}
}
);
}
);
}; };
var accordionConfig = function () { var accordionConfig =
$(".acheader").on("click", function (event) { function () {
var $this = $(this); $(
$this.closest(".accordion").find(".contents").slideToggle(300); ".acheader"
if ($this.closest(".accordion").hasClass("active")) { ).on(
$this.closest(".accordion").removeClass("active"); "click",
function (
event
) {
var $this =
$(
this
);
$this
.closest(
".accordion"
)
.find(
".contents"
)
.slideToggle(
300
);
if (
$this
.closest(
".accordion"
)
.hasClass(
"active"
)
) {
$this
.closest(
".accordion"
)
.removeClass(
"active"
);
} else { } else {
$this.closest(".accordion").addClass("active"); $this
.closest(
".accordion"
)
.addClass(
"active"
);
} }
event.preventDefault(); event.preventDefault();
}); }
);
}; };
var consoleConfig = function () { var consoleConfig =
function () {
console.log( console.log(
"\n Kratos v" + "\n Kratos v" +
KRATOS_VERSION + KRATOS_VERSION +
@ -156,16 +418,27 @@
); );
}; };
var lightGalleryConfig = function () { var lightGalleryConfig =
if (typeof lightGallery !== 'undefined') { function () {
lightGallery(document.getElementById("lightgallery"), { if (
typeof lightGallery !==
"undefined"
) {
lightGallery(
document.getElementById(
"lightgallery"
),
{
selector: selector:
'a[href$=".jpg"], a[href$=".jpeg"], a[href$=".png"], a[href$=".gif"], a[href$=".bmp"], a[href$=".webp"]', 'a[href$=".jpg"], a[href$=".jpeg"], a[href$=".png"], a[href$=".gif"], a[href$=".bmp"], a[href$=".webp"]',
}); }
);
} }
}; };
document.addEventListener("DOMContentLoaded", function () { document.addEventListener(
"DOMContentLoaded",
function () {
accordionConfig(); accordionConfig();
navbarConfig(); navbarConfig();
tooltipConfig(); tooltipConfig();
@ -177,39 +450,79 @@
donateConfig(); donateConfig();
consoleConfig(); consoleConfig();
lightGalleryConfig(); lightGalleryConfig();
}); }
})(jQuery); );
})(
jQuery
);
function grin(tag) { function grin(
tag
) {
var myField; var myField;
tag = " " + tag + " "; tag =
" " +
tag +
" ";
if ( if (
document.getElementById("comment") && document.getElementById(
document.getElementById("comment").type == "textarea" "comment"
) &&
document.getElementById(
"comment"
)
.type ==
"textarea"
) { ) {
myField = document.getElementById("comment"); myField =
document.getElementById(
"comment"
);
} else { } else {
return false; return false;
} }
if (document.selection) { if (
document.selection
) {
myField.focus(); myField.focus();
sel = document.selection.createRange(); sel =
sel.text = tag; document.selection.createRange();
sel.text =
tag;
myField.focus(); myField.focus();
} else if (myField.selectionStart || myField.selectionStart == "0") { } else if (
var startPos = myField.selectionStart; myField.selectionStart ||
var endPos = myField.selectionEnd; myField.selectionStart ==
var cursorPos = endPos; "0"
) {
var startPos =
myField.selectionStart;
var endPos =
myField.selectionEnd;
var cursorPos =
endPos;
myField.value = myField.value =
myField.value.substring(0, startPos) + myField.value.substring(
0,
startPos
) +
tag + tag +
myField.value.substring(endPos, myField.value.length); myField.value.substring(
cursorPos += tag.length; endPos,
myField
.value
.length
);
cursorPos +=
tag.length;
myField.focus(); myField.focus();
myField.selectionStart = cursorPos; myField.selectionStart =
myField.selectionEnd = cursorPos; cursorPos;
myField.selectionEnd =
cursorPos;
} else { } else {
myField.value += tag; myField.value +=
tag;
myField.focus(); myField.focus();
} }
} }

View File

@ -4,10 +4,10 @@
* 模板函数 * 模板函数
* @author Seaton Jiang <hi@seatonjiang.com> * @author Seaton Jiang <hi@seatonjiang.com>
* @license GPL-3.0 License * @license GPL-3.0 License
* @version 2024.03.12 * @version 2025.02.08
*/ */
define('THEME_VERSION', '4.3.1'); define('THEME_VERSION', '4.3.2');
if (defined('WP_USE_THEMES') && WP_USE_THEMES === false) { if (defined('WP_USE_THEMES') && WP_USE_THEMES === false) {
return; return;

View File

@ -1,5 +1,5 @@
{ {
"version": "4.3.1", "version": "4.3.2",
"details_url": "https://github.com/seatonjiang/kratos/releases/tag/v4.3.1", "details_url": "https://github.com/seatonjiang/kratos/releases/tag/v4.3.2",
"download_url": "https://cdn.seatonjiang.com/kratos/v4.3.1.zip" "download_url": "https://cdn.seatonjiang.com/kratos/v4.3.2.zip"
} }

3258
style.css

File diff suppressed because it is too large Load Diff