From 35100eb2d7dc5835c140f02736e778f877d6a6fa Mon Sep 17 00:00:00 2001 From: sunson Date: Thu, 5 Dec 2024 00:02:12 +0800 Subject: [PATCH] Update index.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正安装多级子目录下路径问题。 --- index.php | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/index.php b/index.php index 6ce79fa..780db5e 100644 --- a/index.php +++ b/index.php @@ -1,23 +1,20 @@ image.url); var backgroundDiv = document.getElementById('background'); - if (images.length > 0) { - backgroundDiv.style.backgroundImage = 'url(https://www.bing.com/' + images[0] + ')'; + var baseurl = 'https://www.bing.com/'; + if (images.length > 0) { + backgroundDiv.style.backgroundImage = 'url(' + baseurl + images[0] + ')'; } let index = 0; let currentBackgroundDiv = backgroundDiv; @@ -218,7 +218,7 @@ async function setBackgroundImages() { const nextIndex = (index + 1) % images.length; const nextBackgroundDiv = document.createElement('div'); nextBackgroundDiv.className = 'background next'; - nextBackgroundDiv.style.backgroundImage = 'url(https://www.bing.com/' + images[nextIndex] + ')'; + nextBackgroundDiv.style.backgroundImage = 'url(' + baseurl + images[nextIndex] + ')'; document.body.appendChild(nextBackgroundDiv); nextBackgroundDiv.style.opacity = 0; setTimeout(() => { @@ -228,7 +228,7 @@ async function setBackgroundImages() { document.body.removeChild(currentBackgroundDiv); currentBackgroundDiv = nextBackgroundDiv; index = nextIndex; - if(index>10)index=0;// 只取前十张 + if(index>10)index=0;// 只取前十张 }, 1000); }, 5000); @@ -482,4 +482,4 @@ $(document).ready(function () { }); - \ No newline at end of file +