mirror of https://github.com/vtrois/kratos
parent
b0fd30c2d7
commit
0905b89f87
|
@ -2,199 +2,214 @@
|
||||||
* Kratos
|
* Kratos
|
||||||
* Seaton Jiang <hi@seatonjiang.com>
|
* Seaton Jiang <hi@seatonjiang.com>
|
||||||
*/
|
*/
|
||||||
; (function () {
|
(function () {
|
||||||
'use strict'
|
"use strict";
|
||||||
|
|
||||||
var KRATOS_VERSION = '4.1.5'
|
var KRATOS_VERSION = "4.1.6";
|
||||||
|
|
||||||
var navbarConfig = function () {
|
var navbarConfig = function () {
|
||||||
$('#navbutton').on('click', function () {
|
$("#navbutton").on("click", function () {
|
||||||
$('.navbar-toggler').toggleClass('nav-close')
|
$(".navbar-toggler").toggleClass("nav-close");
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var tooltipConfig = function () {
|
|
||||||
$('[data-toggle="tooltip"]').tooltip()
|
|
||||||
}
|
|
||||||
|
|
||||||
var gotopConfig = function () {
|
|
||||||
$(window).on('load', function () {
|
|
||||||
var $win = $(window)
|
|
||||||
var setShowOrHide = function () {
|
|
||||||
if ($win.scrollTop() > 200) {
|
|
||||||
$('.gotop').addClass('active')
|
|
||||||
} else {
|
|
||||||
$('.gotop').removeClass('active')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setShowOrHide()
|
|
||||||
$win.scroll(setShowOrHide)
|
|
||||||
})
|
|
||||||
$('.gotop').on('click', function (event) {
|
|
||||||
event.preventDefault()
|
|
||||||
$('html, body').animate({ scrollTop: $('html').offset().top }, 500)
|
|
||||||
return false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var searchConfig = function () {
|
|
||||||
$('.search').on('click', 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()
|
|
||||||
})
|
|
||||||
$('.search-form').on('click', function (e) {
|
|
||||||
e.stopPropagation()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var wechatConfig = function () {
|
|
||||||
$('.wechat').mouseout(function () {
|
|
||||||
$('.wechat-pic')[0].style.display = 'none'
|
|
||||||
})
|
|
||||||
$('.wechat').mouseover(function () {
|
|
||||||
$('.wechat-pic')[0].style.display = 'block'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var smiliesConfig = function () {
|
|
||||||
$('#addsmile').on('click', function (e) {
|
|
||||||
$('.smile').toggleClass('open')
|
|
||||||
$(document).one('click', function () {
|
|
||||||
$('.smile').toggleClass('open')
|
|
||||||
})
|
|
||||||
e.stopPropagation()
|
|
||||||
return false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var postlikeConfig = function () {
|
|
||||||
$.fn.postLike = function () {
|
|
||||||
if ($(this).hasClass('done')) {
|
|
||||||
layer.msg(kratos.repeat, function () {})
|
|
||||||
return false
|
|
||||||
} else {
|
|
||||||
$(this).addClass('done')
|
|
||||||
layer.msg(kratos.thanks)
|
|
||||||
var id = $(this).data('id'),
|
|
||||||
action = $(this).data('action')
|
|
||||||
var ajax_data = {
|
|
||||||
action: 'love',
|
|
||||||
um_id: id,
|
|
||||||
um_action: action
|
|
||||||
}
|
|
||||||
$.post(kratos.site + '/wp-admin/admin-ajax.php', ajax_data, function (data) { })
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$(document).on('click', '.btn-thumbs', function () {
|
|
||||||
$(this).postLike()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var donateConfig = function () {
|
|
||||||
$('#donate').on('click', function () {
|
|
||||||
layer.open({
|
|
||||||
type: 1,
|
|
||||||
area: ['300px', '370px'],
|
|
||||||
title: kratos.donate,
|
|
||||||
resize: false,
|
|
||||||
scrollbar: false,
|
|
||||||
content:
|
|
||||||
'<div class="donate-box"><div class="meta-pay text-center my-2"><strong>' +
|
|
||||||
kratos.scan +
|
|
||||||
'</strong></div><div class="qr-pay text-center"><img class="pay-img" id="alipay_qr" src="' +
|
|
||||||
kratos.alipay +
|
|
||||||
'"><img class="pay-img d-none" id="wechat_qr" src="' +
|
|
||||||
kratos.wechat +
|
|
||||||
'"></div><div class="choose-pay text-center mt-2"><input id="alipay" type="radio" name="pay-method" checked><label for="alipay" class="pay-button"><img src="' +
|
|
||||||
kratos.directory +
|
|
||||||
'/assets/img/payment/alipay.png"></label><input id="wechatpay" type="radio" name="pay-method"><label for="wechatpay" class="pay-button"><img src="' +
|
|
||||||
kratos.directory +
|
|
||||||
'/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')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var accordionConfig = function () {
|
|
||||||
$(document).on('click', '.acheader', function (event) {
|
|
||||||
var $this = $(this)
|
|
||||||
$this.closest('.accordion').find('.contents').slideToggle(300)
|
|
||||||
if ($this.closest('.accordion').hasClass('active')) {
|
|
||||||
$this.closest('.accordion').removeClass('active')
|
|
||||||
} else {
|
|
||||||
$this.closest('.accordion').addClass('active')
|
|
||||||
}
|
|
||||||
event.preventDefault()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var consoleConfig = function () {
|
|
||||||
console.log('\n Kratos v' + KRATOS_VERSION + '\n\n https://github.com/seatonjiang/kratos \n\n')
|
|
||||||
}
|
|
||||||
|
|
||||||
var lightGalleryConfig = function () {
|
|
||||||
if (kratos.lightgallery === '1' && window.lightGallery !== undefined) {
|
|
||||||
lightGallery(document.getElementById('lightgallery'), {
|
|
||||||
selector: 'a[href$=".jpg"], a[href$=".jpeg"], a[href$=".png"], a[href$=".gif"], a[href$=".bmp"], a[href$=".webp"]'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
|
||||||
accordionConfig()
|
|
||||||
navbarConfig()
|
|
||||||
tooltipConfig()
|
|
||||||
gotopConfig()
|
|
||||||
searchConfig()
|
|
||||||
wechatConfig()
|
|
||||||
smiliesConfig()
|
|
||||||
postlikeConfig()
|
|
||||||
donateConfig()
|
|
||||||
consoleConfig()
|
|
||||||
lightGalleryConfig()
|
|
||||||
});
|
});
|
||||||
})()
|
};
|
||||||
|
|
||||||
|
var tooltipConfig = function () {
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
};
|
||||||
|
|
||||||
|
var gotopConfig = function () {
|
||||||
|
$(window).on("load", function () {
|
||||||
|
var $win = $(window);
|
||||||
|
var setShowOrHide = function () {
|
||||||
|
if ($win.scrollTop() > 200) {
|
||||||
|
$(".gotop").addClass("active");
|
||||||
|
} else {
|
||||||
|
$(".gotop").removeClass("active");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
setShowOrHide();
|
||||||
|
$win.scroll(setShowOrHide);
|
||||||
|
});
|
||||||
|
$(".gotop").on("click", function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
$("html, body").animate({ scrollTop: $("html").offset().top }, 500);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var searchConfig = function () {
|
||||||
|
$(".search").on("click", 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();
|
||||||
|
});
|
||||||
|
$(".search-form").on("click", function (e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var wechatConfig = function () {
|
||||||
|
$(".wechat").mouseout(function () {
|
||||||
|
$(".wechat-pic")[0].style.display = "none";
|
||||||
|
});
|
||||||
|
$(".wechat").mouseover(function () {
|
||||||
|
$(".wechat-pic")[0].style.display = "block";
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var smiliesConfig = function () {
|
||||||
|
$("#addsmile").on("click", function (e) {
|
||||||
|
$(".smile").toggleClass("open");
|
||||||
|
$(document).one("click", function () {
|
||||||
|
$(".smile").toggleClass("open");
|
||||||
|
});
|
||||||
|
e.stopPropagation();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var postlikeConfig = function () {
|
||||||
|
$.fn.postLike = function () {
|
||||||
|
if ($(this).hasClass("done")) {
|
||||||
|
layer.msg(kratos.repeat, function () {});
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
$(this).addClass("done");
|
||||||
|
layer.msg(kratos.thanks);
|
||||||
|
var id = $(this).data("id"),
|
||||||
|
action = $(this).data("action");
|
||||||
|
var ajax_data = {
|
||||||
|
action: "love",
|
||||||
|
um_id: id,
|
||||||
|
um_action: action,
|
||||||
|
};
|
||||||
|
$.post(
|
||||||
|
kratos.site + "/wp-admin/admin-ajax.php",
|
||||||
|
ajax_data,
|
||||||
|
function (data) {}
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$(document).on("click", ".btn-thumbs", function () {
|
||||||
|
$(this).postLike();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var donateConfig = function () {
|
||||||
|
$("#donate").on("click", function () {
|
||||||
|
layer.open({
|
||||||
|
type: 1,
|
||||||
|
area: ["300px", "370px"],
|
||||||
|
title: kratos.donate,
|
||||||
|
resize: false,
|
||||||
|
scrollbar: false,
|
||||||
|
content:
|
||||||
|
'<div class="donate-box"><div class="meta-pay text-center my-2"><strong>' +
|
||||||
|
kratos.scan +
|
||||||
|
'</strong></div><div class="qr-pay text-center"><img class="pay-img" id="alipay_qr" src="' +
|
||||||
|
kratos.alipay +
|
||||||
|
'"><img class="pay-img d-none" id="wechat_qr" src="' +
|
||||||
|
kratos.wechat +
|
||||||
|
'"></div><div class="choose-pay text-center mt-2"><input id="alipay" type="radio" name="pay-method" checked><label for="alipay" class="pay-button"><img src="' +
|
||||||
|
kratos.directory +
|
||||||
|
'/assets/img/payment/alipay.png"></label><input id="wechatpay" type="radio" name="pay-method"><label for="wechatpay" class="pay-button"><img src="' +
|
||||||
|
kratos.directory +
|
||||||
|
'/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");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var accordionConfig = function () {
|
||||||
|
$(document).on("click", ".acheader", function (event) {
|
||||||
|
var $this = $(this);
|
||||||
|
$this.closest(".accordion").find(".contents").slideToggle(300);
|
||||||
|
if ($this.closest(".accordion").hasClass("active")) {
|
||||||
|
$this.closest(".accordion").removeClass("active");
|
||||||
|
} else {
|
||||||
|
$this.closest(".accordion").addClass("active");
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var consoleConfig = function () {
|
||||||
|
console.log(
|
||||||
|
"\n Kratos v" +
|
||||||
|
KRATOS_VERSION +
|
||||||
|
"\n\n https://github.com/seatonjiang/kratos \n\n"
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
var lightGalleryConfig = function () {
|
||||||
|
if (kratos.lightgallery === "1" && window.lightGallery !== undefined) {
|
||||||
|
lightGallery(document.getElementById("lightgallery"), {
|
||||||
|
selector:
|
||||||
|
'a[href$=".jpg"], a[href$=".jpeg"], a[href$=".png"], a[href$=".gif"], a[href$=".bmp"], a[href$=".webp"]',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
accordionConfig();
|
||||||
|
navbarConfig();
|
||||||
|
tooltipConfig();
|
||||||
|
gotopConfig();
|
||||||
|
searchConfig();
|
||||||
|
wechatConfig();
|
||||||
|
smiliesConfig();
|
||||||
|
postlikeConfig();
|
||||||
|
donateConfig();
|
||||||
|
consoleConfig();
|
||||||
|
lightGalleryConfig();
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
||||||
function grin(tag) {
|
function grin(tag) {
|
||||||
var myField
|
var myField;
|
||||||
tag = ' ' + tag + ' '
|
tag = " " + tag + " ";
|
||||||
if (document.getElementById('comment') && document.getElementById('comment').type == 'textarea') {
|
if (
|
||||||
myField = document.getElementById('comment')
|
document.getElementById("comment") &&
|
||||||
} else {
|
document.getElementById("comment").type == "textarea"
|
||||||
return false
|
) {
|
||||||
}
|
myField = document.getElementById("comment");
|
||||||
if (document.selection) {
|
} else {
|
||||||
myField.focus()
|
return false;
|
||||||
sel = document.selection.createRange()
|
}
|
||||||
sel.text = tag
|
if (document.selection) {
|
||||||
myField.focus()
|
myField.focus();
|
||||||
} else if (myField.selectionStart || myField.selectionStart == '0') {
|
sel = document.selection.createRange();
|
||||||
var startPos = myField.selectionStart
|
sel.text = tag;
|
||||||
var endPos = myField.selectionEnd
|
myField.focus();
|
||||||
var cursorPos = endPos
|
} else if (myField.selectionStart || myField.selectionStart == "0") {
|
||||||
myField.value = myField.value.substring(0, startPos) + tag + myField.value.substring(endPos, myField.value.length)
|
var startPos = myField.selectionStart;
|
||||||
cursorPos += tag.length
|
var endPos = myField.selectionEnd;
|
||||||
myField.focus()
|
var cursorPos = endPos;
|
||||||
myField.selectionStart = cursorPos
|
myField.value =
|
||||||
myField.selectionEnd = cursorPos
|
myField.value.substring(0, startPos) +
|
||||||
} else {
|
tag +
|
||||||
myField.value += tag
|
myField.value.substring(endPos, myField.value.length);
|
||||||
myField.focus()
|
cursorPos += tag.length;
|
||||||
}
|
myField.focus();
|
||||||
|
myField.selectionStart = cursorPos;
|
||||||
|
myField.selectionEnd = cursorPos;
|
||||||
|
} else {
|
||||||
|
myField.value += tag;
|
||||||
|
myField.focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ if (defined('WP_USE_THEMES') && WP_USE_THEMES === false) {
|
||||||
* @version 2022.11.27
|
* @version 2022.11.27
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define('THEME_VERSION', '4.1.5');
|
define('THEME_VERSION', '4.1.6');
|
||||||
|
|
||||||
// 主题配置
|
// 主题配置
|
||||||
require get_template_directory() . '/inc/codestar-framework/autoload.php';
|
require get_template_directory() . '/inc/codestar-framework/autoload.php';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "4.1.5",
|
"version": "4.1.6",
|
||||||
"details_url": "https://github.com/seatonjiang/kratos/releases/tag/v4.1.5",
|
"details_url": "https://github.com/seatonjiang/kratos/releases/tag/v4.1.6",
|
||||||
"download_url": "https://cdn.seatonjiang.com/kratos/v4.1.5.zip"
|
"download_url": "https://cdn.seatonjiang.com/kratos/v4.1.6.zip"
|
||||||
}
|
}
|
Loading…
Reference in New Issue