Full-project rename. `git grep -i aksrt` is now empty apart from the
DBMigrator 3.3.0 changelog note that documents the rename itself.
Code identifiers
- PHP namespace AKSRT\ -> Jio\ (composer PSR-4 + 378 declarations)
- global constants AKSRT_* -> JIO_* (VERSION/DIR/URI, PAY_TYPE_*, CAPTCHA_*)
- procedural functions, hooks, options, meta keys, table names,
cookies, query vars, ajax actions and nonces: aksrt_ -> jio_
- text domain aksrt -> jio; Theme Name -> Jio
- JS globals: aksrtData/aksrtAdminData/... -> jioData/jioAdminData/...,
window.AKSRTCaptcha & friends -> window.JioCaptcha, Aksrt* -> Jio*
- Vue components Aks*.vue -> Jio*.vue (15 files renamed + imports)
- CSS classes/data-attrs/custom properties: aksrt- -> jio-
- REST namespace aksrt/v1 -> jio/v1 (incl. payment gateway callbacks)
Storage layer
- DB tables {prefix}aksrt_* -> {prefix}jio_*; SCHEMA_VERSION 3.2.0 -> 3.3.0
so dbDelta creates the new names on install
- widget id_base aksrt_widget_* -> jio_widget_*
- uninstall.php drop list rebuilt from the actual migrator tables
(dropped 3 stale entries, added the 17 missing ones)
Removed
- hardcoded https://api.aksrt.com/version.json default update endpoint;
get_endpoint() now reads the 「更新端点」 setting and do_check() no-ops
when it is empty
Files renamed: inc/helpers/aksrt-*.php -> jio-*.php (54),
assets/admin/src/components/form/Aks*.vue -> Jio*.vue (15).
Build artifacts regenerated: assets/css/build, assets/js/runtime,
assets/admin/build.
Verified: audit-psr4-paths errors=0, audit-admin-contracts errors=0
(warnings=56, unchanged baseline), 813/813 widget-system tests,
44/44 phpunit, php -l clean across all PHP.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
137 lines
4.6 KiB
JavaScript
137 lines
4.6 KiB
JavaScript
/**
|
|
* Jio Misc — image gradients and hidden content
|
|
*/
|
|
(function () {
|
|
"use strict";
|
|
|
|
function renderGradientBackground(container) {
|
|
if (!container || container.dataset.jioGradientState || typeof window.Grade !== "function") return;
|
|
|
|
var source = container.querySelector("img");
|
|
if (!source || (!source.classList.contains("lazyloaded") && !(source.complete && source.naturalWidth > 0))) return;
|
|
|
|
container.dataset.jioGradientState = "loading";
|
|
window.Grade(container, null, function (result) {
|
|
var gradientData = result && result[0];
|
|
var colors = gradientData && gradientData.gradientData;
|
|
if (!gradientData || !colors || !colors[0] || !colors[1]) {
|
|
delete container.dataset.jioGradientState;
|
|
return;
|
|
}
|
|
|
|
var opacity = container.getAttribute("data-opacity");
|
|
var colorName = opacity ? "rgba" : "rgb";
|
|
var alpha = opacity ? "," + opacity : "";
|
|
var color1 = colorName + "(" + colors[0].rgba.slice(0, 3).join(",") + alpha + ") 10%";
|
|
var color2 = colorName + "(" + colors[1].rgba.slice(0, 3).join(",") + alpha + ") 80%";
|
|
|
|
gradientData.element.classList.add("gradient-bg-loaded");
|
|
gradientData.element.style.backgroundImage = "linear-gradient(135deg, " + color1 + ", " + color2 + ")";
|
|
container.dataset.jioGradientState = "loaded";
|
|
});
|
|
}
|
|
|
|
function initGradientBackgrounds(root) {
|
|
var scope = root || document;
|
|
if (scope.nodeType === 1 && scope.matches(".gradient-bg")) {
|
|
renderGradientBackground(scope);
|
|
}
|
|
scope.querySelectorAll(".gradient-bg").forEach(renderGradientBackground);
|
|
}
|
|
|
|
document.addEventListener("lazyloaded", function (event) {
|
|
if (!(event.target instanceof Element) || !event.target.matches(".gradient-bg img")) return;
|
|
renderGradientBackground(event.target.closest(".gradient-bg"));
|
|
}, true);
|
|
|
|
function init(root) {
|
|
initGradientBackgrounds(root);
|
|
}
|
|
|
|
if (document.readyState === "loading") {
|
|
document.addEventListener("DOMContentLoaded", function () { init(); });
|
|
} else {
|
|
init();
|
|
}
|
|
// AJAX 注入新内容后由 auto_fun 重扫(各 init 均带 data 标记,重复调用幂等)。
|
|
if (window.jQuery) {
|
|
window.jQuery(document).on("auto_fun", function () { init(); });
|
|
}
|
|
|
|
})();
|
|
|
|
(function () {
|
|
"use strict";
|
|
|
|
function initHiddenContent() {
|
|
document.addEventListener("click", function (e) {
|
|
var btn = e.target.closest(".jio-hidden-content__submit-btn");
|
|
if (!btn) return;
|
|
|
|
e.preventDefault();
|
|
var wrapper = btn.closest(".jio-hidden-content--locked");
|
|
if (!wrapper) return;
|
|
|
|
var mode = wrapper.getAttribute("data-jio-visibility-mode");
|
|
var pid = wrapper.getAttribute("data-jio-visibility-pid");
|
|
var input = wrapper.querySelector(".jio-hidden-content__password-input");
|
|
var password = input ? input.value.trim() : "";
|
|
|
|
if (mode === "password" && !password) {
|
|
if (input) input.focus();
|
|
return;
|
|
}
|
|
|
|
var formData = new FormData();
|
|
formData.append("action", "jio_check_visibility");
|
|
formData.append("_nonce", (window.jioData && jioData.visibilityNonce) || "");
|
|
formData.append("mode", mode);
|
|
formData.append("pid", pid);
|
|
if (password) formData.append("password", password);
|
|
|
|
btn.disabled = true;
|
|
btn.textContent = "...";
|
|
|
|
fetch((window.jioData && jioData.ajaxUrl) || "/wp-admin/admin-ajax.php", {
|
|
method: "POST",
|
|
body: formData,
|
|
credentials: "same-origin",
|
|
})
|
|
.then(function (res) { return res.json(); })
|
|
.then(function (data) {
|
|
if (data.success) {
|
|
window.location.reload();
|
|
} else {
|
|
var msg = (data.data && data.data.message) ? data.data.message : "验证失败";
|
|
alert(msg);
|
|
btn.disabled = false;
|
|
btn.textContent = "验证";
|
|
}
|
|
})
|
|
.catch(function () {
|
|
alert("网络错误,请重试");
|
|
btn.disabled = false;
|
|
btn.textContent = "验证";
|
|
});
|
|
});
|
|
|
|
// Handle Enter key on password input
|
|
document.addEventListener("keydown", function (e) {
|
|
if (e.key === "Enter" && e.target.classList.contains("jio-hidden-content__password-input")) {
|
|
e.preventDefault();
|
|
var wrapper = e.target.closest(".jio-hidden-content--locked");
|
|
if (wrapper) {
|
|
var btn = wrapper.querySelector(".jio-hidden-content__submit-btn");
|
|
if (btn) btn.click();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
if (document.readyState === "loading") {
|
|
document.addEventListener("DOMContentLoaded", initHiddenContent);
|
|
} else {
|
|
initHiddenContent();
|
|
}
|
|
})();
|