版本号 3.2.4 -> 3.2.5(修 Prism 报错,项目地址改为自建 Git)
## 修 Prism is not defined
首页控制台报 `Uncaught ReferenceError: Prism is not defined`,来源是
wp-editormd 插件(不是本主题):它在 Prism 脚本加载之前就无条件执行了
`Prism.plugins.autoloader.languages_path = "..."`。
线上页面里的真实顺序:
第 668 行 该赋值语句
第 695 行 prism-core.min.js
第 696 行 prism-autoloader.min.js
在 `wp_head` 优先级 0 垫一个最小空壳 `window.Prism`(含 plugins.autoloader
这条访问链路),让那句赋值有地方可写。已核对 prism-core.min.js 源码:它开头
只读 `u.Prism.manual` 与 `u.Prism.disableWorkerMessageHandler`,结尾
`global.Prism = Prism` 整体覆盖 —— 空壳必定被真实对象替换,不承担持久职责,
只为吸收那条过早的赋值。已用 jsdom 验证:去掉空壳重现原始报错,加上后消失,
且之后 `Prism.highlightAll` 仍可正常调用。
## 项目地址统一到 code.yangyq.net
原作者署名、原主题地址、README、语言包、JS 里的控制台横幅全部换成自建仓库地址。
LICENSE 文件保持原样不动(MIT 要求保留原始版权声明)。
## CDN 分支改成拿不到就回退本地
原来的 `g_cdn` 分支指向 `cdn.jsdelivr.net/gh/vtrois/kratos`,本仓库在自建
Gitea 上,jsDelivr 只认 github/npm/wordpress,实测该地址 404。现改为仅在
`YANG_THEME_CDN_REPO` 常量存在时才走 CDN,否则一律用
`get_template_directory_uri()`。留一个 404 的地址比留空更危险:页面能开、
样式全丢,极难排查。
## 顺带
- `.gitattributes` 补 `*.mo binary`:原来是靠"含 NUL"启发式判定,不是契约
- `update.json` 的版本号跟进到 3.2.5
- `kratos.min.js` / `kratos.min.css` 用压缩器重新生成,不手工改产物
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
/*--------------------------------------------------------------
|
||||
>>> Kratos 样式表
|
||||
>>> Seaton Jiang <seaton@vtrois.com>
|
||||
>>> Yongquan Yang <yangyq.net>
|
||||
----------------------------------------------------------------
|
||||
|
||||
1. 全局
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
/*!
|
||||
* Kratos
|
||||
* Seaton Jiang <seaton@vtrois.com>
|
||||
* Yongquan Yang <yangyq.net>
|
||||
*/
|
||||
; (function () {
|
||||
'use strict'
|
||||
@@ -137,7 +137,7 @@
|
||||
}
|
||||
|
||||
var consoleConfig = function () {
|
||||
console.log('\n Kratos v' + KRATOS_VERSION + '\n\n https://github.com/vtrois/kratos \n\n')
|
||||
console.log('\n Kratos v' + KRATOS_VERSION + '\n\n https://code.yangyq.net/laoyang/wordpress-kratos-yang \n\n')
|
||||
}
|
||||
|
||||
$(function () {
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
function grin (t) { var o; if (t = " " + t + " ", !document.getElementById("comment") || "textarea" != document.getElementById("comment").type) return !1; if (o = document.getElementById("comment"), document.selection) o.focus(), sel = document.selection.createRange(), sel.text = t, o.focus(); else if (o.selectionStart || "0" == o.selectionStart) { var e = o.selectionStart, a = o.selectionEnd, n = a; o.value = o.value.substring(0, e) + t + o.value.substring(a, o.value.length), n += t.length, o.focus(), o.selectionStart = n, o.selectionEnd = n } else o.value += t, o.focus() } (function () { "use strict"; var t = "3.1.7", o = function () { $("#navbutton").on("click", function () { $(".navbar-toggler").toggleClass("nav-close") }) }, e = function () { $(function () { $('[data-toggle="tooltip"]').tooltip() }) }, a = function () { $(window).on("load", function () { var t = $(window); t.scrollTop() > 200 ? $(".gotop").addClass("active") : $(".gotop").removeClass("active"), t.scroll(function () { t.scrollTop() > 200 ? $(".gotop").addClass("active") : $(".gotop").removeClass("active") }) }), $(".gotop").on("click", function (t) { return t.preventDefault(), $("html, body").animate({ scrollTop: $("html").offset().top }, 500), !1 }) }, n = function () { $(".search").on("click", function (t) { $(".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() }), t.stopPropagation() }), $(".search-form").on("click", function (t) { t.stopPropagation() }) }, c = function () { $(".wechat").mouseout(function () { $(".wechat-pic")[0].style.display = "none" }), $(".wechat").mouseover(function () { $(".wechat-pic")[0].style.display = "block" }) }, s = function () { $("#addsmile").on("click", function (t) { return $(".smile").toggleClass("open"), $(document).one("click", function () { $(".smile").toggleClass("open") }), t.stopPropagation(), !1 }) }, i = function () { $.fn.postLike = function () { if ($(this).hasClass("done")) return layer.msg(kratos.repeat, function () { }), !1; $(this).addClass("done"), layer.msg(kratos.thanks); var t = $(this).data("id"), o = $(this).data("action"), e = { action: "love", um_id: t, um_action: o }; return $.post(kratos.site + "/wp-admin/admin-ajax.php", e, function (t) { }), !1 }, $(document).on("click", ".btn-thumbs", function () { $(this).postLike() }) }, l = function () { $("#donate").on("click", function () { layer.open({ type: 1, area: ["300px", "370px"], title: kratos.donate, resize: !1, scrollbar: !1, 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 t = $(this).attr("id"); "alipay" == t && ($(".qr-pay #alipay_qr").removeClass("d-none"), $(".qr-pay #wechat_qr").addClass("d-none")), "wechatpay" == t && ($(".qr-pay #alipay_qr").addClass("d-none"), $(".qr-pay #wechat_qr").removeClass("d-none")) }) }) }, r = function () { $(document).on("click", ".acheader", function (t) { var o = $(this); o.closest(".accordion").find(".contents").slideToggle(300), o.closest(".accordion").hasClass("active") ? o.closest(".accordion").removeClass("active") : o.closest(".accordion").addClass("active"), t.preventDefault() }) }, d = function () { console.log("\n Kratos v" + t + "\n\n https://github.com/vtrois/kratos \n\n") }; $(function () { r(), o(), e(), a(), n(), c(), s(), i(), l(), d() }) })()
|
||||
function grin(t){var a,e,o,n;if(t=" "+t+" ",!document.getElementById("comment")||"textarea"!=document.getElementById("comment").type)return!1;a=document.getElementById("comment"),document.selection?(a.focus(),(sel=document.selection.createRange()).text=t,a.focus()):a.selectionStart||"0"==a.selectionStart?(e=a.selectionStart,n=o=a.selectionEnd,a.value=a.value.substring(0,e)+t+a.value.substring(o,a.value.length),n+=t.length,a.focus(),a.selectionStart=n,a.selectionEnd=n):(a.value+=t,a.focus())}$(function(){$(document).on("click",".acheader",function(t){var a=$(this);a.closest(".accordion").find(".contents").slideToggle(300),a.closest(".accordion").hasClass("active")?a.closest(".accordion").removeClass("active"):a.closest(".accordion").addClass("active"),t.preventDefault()}),$("#navbutton").on("click",function(){$(".navbar-toggler").toggleClass("nav-close")}),$(function(){$('[data-toggle="tooltip"]').tooltip()}),$(window).on("load",function(){var t=$(window);200<t.scrollTop()?$(".gotop").addClass("active"):$(".gotop").removeClass("active"),t.scroll(function(){200<t.scrollTop()?$(".gotop").addClass("active"):$(".gotop").removeClass("active")})}),$(".gotop").on("click",function(t){return t.preventDefault(),$("html, body").animate({scrollTop:$("html").offset().top},500),!1}),$(".search").on("click",function(t){$(".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()}),t.stopPropagation()}),$(".search-form").on("click",function(t){t.stopPropagation()}),$(".wechat").mouseout(function(){$(".wechat-pic")[0].style.display="none"}),$(".wechat").mouseover(function(){$(".wechat-pic")[0].style.display="block"}),$("#addsmile").on("click",function(t){return $(".smile").toggleClass("open"),$(document).one("click",function(){$(".smile").toggleClass("open")}),t.stopPropagation(),!1}),$.fn.postLike=function(){var t,a;return $(this).hasClass("done")?layer.msg(kratos.repeat,function(){}):($(this).addClass("done"),layer.msg(kratos.thanks),t=$(this).data("id"),a=$(this).data("action"),$.post(kratos.site+"/wp-admin/admin-ajax.php",{action:"love",um_id:t,um_action:a},function(t){})),!1},$(document).on("click",".btn-thumbs",function(){$(this).postLike()}),$("#donate").on("click",function(){layer.open({type:1,area:["300px","370px"],title:kratos.donate,resize:!1,scrollbar:!1,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 t=$(this).attr("id");"alipay"==t&&($(".qr-pay #alipay_qr").removeClass("d-none"),$(".qr-pay #wechat_qr").addClass("d-none")),"wechatpay"==t&&($(".qr-pay #alipay_qr").addClass("d-none"),$(".qr-pay #wechat_qr").removeClass("d-none"))})}),console.log("\n Kratos v3.1.8\n\n https://code.yangyq.net/laoyang/wordpress-kratos-yang \n\n")});
|
||||
Reference in New Issue
Block a user