跳转到内容

MediaWiki:Common.js:修订间差异

来自洽隐山房
无编辑摘要
无编辑摘要
第9行: 第9行:
     });
     });
}
}
async function main(){
var scene = document.createElement("div");
var scene = document.createElement("div");
document.body.appendChild(scene);
document.body.appendChild(scene);
scene.style.zIndex = -100;
scene.style.zIndex = -100;
scene.style.position = "fixed";
scene.style.position = "fixed";
scene.id = "parallax-bg";
scene.id = "parallax-bg";
scene.style.inset = "-300px";
scene.style.inset = "-300px";
var img = document.createElement("img");
var img = document.createElement("img");
scene.appendChild(img);
scene.appendChild(img);
img.src = "/_nuxt/bg-1.DbZGBWF5.jpg";
img.src = "/_nuxt/bg-1.DbZGBWF5.jpg";
img.dataset.depth = 0.5;
img.dataset.depth = 0.5;
 
await loadScript("https://cdnjs.cloudflare.com/ajax/libs/parallax/3.1.0/parallax.min.js");
loadScript("https://cdnjs.cloudflare.com/ajax/libs/parallax/3.1.0/parallax.min.js").then(function(){
new Parallax(scene);
new Parallax(scene);
});
await loadScript("https://cdn.jsdelivr.net/npm/@hotwired/turbo@latest/dist/turbo.es2017-esm.min.js");
loadScript("https://cdn.jsdelivr.net/npm/@hotwired/turbo@latest/dist/turbo.es2017-esm.min.js");
}
setTimeout(main, 0);

2026年8月20日 (四) 05:56的版本

/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
function loadScript(url) {
    return new Promise((resolve, reject) => {
        const script = document.createElement('script');
        script.src = url;
        script.onload = () => resolve();
		script.onerror = (e) => reject(e)
        document.head.appendChild(script);
    });
}
var scene = document.createElement("div");
document.body.appendChild(scene);
scene.style.zIndex = -100;
scene.style.position = "fixed";
scene.id = "parallax-bg";
scene.style.inset = "-300px";
var img = document.createElement("img");
scene.appendChild(img);
img.src = "/_nuxt/bg-1.DbZGBWF5.jpg";
img.dataset.depth = 0.5;

loadScript("https://cdnjs.cloudflare.com/ajax/libs/parallax/3.1.0/parallax.min.js").then(function(){
	new Parallax(scene);
});
	
loadScript("https://cdn.jsdelivr.net/npm/@hotwired/turbo@latest/dist/turbo.es2017-esm.min.js");