sjd module
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.gf.qytechs.cn/scripts/551413/1672783/s-j-d.js
// ==UserScript==
// @name s-j-d
// @namespace http://tampermonkey.net/
// @version 0.1.26
// @description sjd module
// @author You
// @match https://splix.io/
// @grant none
// @run-at document-start
// ==/UserScript==
await(async function () {
if (document.location.pathname !== "/") return;
const verToInt = v => v.split(".").reduce((acc, n, i) => acc + parseInt(n) * Math.pow(100, 2 - i), 0)
const getDemodVer = text => text?.match(/@version\s+(\d+\.\d+\.\d+)/)?.[1] || "0.0.0"
const isNotInjected = () => !window.jsDemodularized && ![...document.scripts].some(s => s.innerText.includes("globalThis.IS_DEV_BUILD"))
const isStorageActual = () => verToInt(localStorage.clientCode?.match(/@demod.*?\sv:(\d+\.\d+\.\d+)/)?.[1] || "0.0.0") >= verToInt(currentVersion) &&
Math.floor(Date.now() / (2 * 60 * 1000)) === Math.floor((parseInt(localStorage.clientCode?.match(/@demod.*?\sts:(\d+)/)?.[1]) || 0) / (2 * 60 * 1000))
const currentVersion = "0.1.26";
localStorage.demodularizerVersion = "0.2.3";
if (verToInt(getDemodVer(localStorage.demod)) > verToInt(currentVersion)) {
await (new Function("return (async () => { " + localStorage.demod + " })()"))()
} else {
if (isStorageActual() && isNotInjected()) {
document.open("text/html")
document.write(localStorage.clientCode)
document.close()
window.jsDemodularized = true
}
if (!window.locked) {
window.locked = true;
bundleAndUpdate()
}
}
async function bundleAndUpdate() {
async function bundleJS(url, visited = new Set()) {
if (visited.has(url)) return ""
visited.add(url)
let response = await fetch(url + `?v=${Math.floor(Date.now())}`) // added cachebust
if (!response.ok) throw new Error(`Response status: ${response.status}, URL: ${url}`)
let script = (await response.text()).replaceAll(/\bexport\b/g, "")
const importRegex = /^import[\s\S]*?["'](.*)["'].*$/gm
let match
let result = script
while ((match = importRegex.exec(script)) !== null) {
const importPath = match[1]
let importedCode
if (importPath.includes('deps/')) {
const parts = importPath.replace('../../deps/', '').split('/')
const cdnUrl = `https://cdn.jsdelivr.net/npm/@adlad/${parts[0].replace('adlad-', '')}@${parts[1]}/${parts.slice(2).join('/')}`
importedCode = await bundleJS(cdnUrl, visited)
} else if (importPath.startsWith('.')) {
importedCode = await bundleJS(new URL(importPath, url).toString(), visited)
}
result = result.replace(match[0], importedCode)
}
return result
}
const loadScript = fetch(
`https://update.gf.qytechs.cn/scripts/551413/s-j-dt.js?v=${Math.floor(Date.now() / (2 * 60 * 1000))}`
).then(r => (r.ok ? r.text() : null)).catch(() => { console.log('fetch failedd') });
let isUpdated = false;
if (!isStorageActual()) { // update client if updateTime or
const clientPath = "https://raw.githubusercontent.com/jespertheend/splix/refs/tags/v0.19.0/client/"
const bundled = (await bundleJS(clientPath + "src/main.js"))
.replaceAll(/((\S)(\S)\3\2\S+(s)\S+\4\S+\4\S+)\d/g, "$10")
.replace(/IS_DEV_BUILD\s*=\s*true/, "IS_DEV_BUILD = false") +
`\n/* @demod v:${currentVersion} ts:${Date.now()} */`
localStorage.clientCode = (await (await fetch(clientPath + "index.html")).text())
.replace(/<script.*?\/main.*?<\/script>/, "")
.replace("</body>", `<script>${bundled}</script></body>`)
console.log('bundling')
isUpdated = true;
}
try {
const latest = await loadScript;
if (latest) {
const version = getDemodVer(latest);
const prevVersion = getDemodVer(localStorage.demod);
if (version) {
console.log('demod saved ' + version)
localStorage.demod = latest
if (verToInt(version) > verToInt(prevVersion)) {
console.log("demod ver updated, reload " + version + " before: " + prevVersion)
isUpdated = true;
}
}
}
} catch { }
if (isUpdated) {
console.clear(); // clean the console
location.reload();
}
}
})();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址