diff --git a/js/Meting.js b/js/Meting.js deleted file mode 100644 index 926c452..0000000 --- a/js/Meting.js +++ /dev/null @@ -1,99 +0,0 @@ -"use strict"; - -function _objectSpread(a) { - for (var b = 1; b < arguments.length; b++) { - var c = null == arguments[b] ? {} : arguments[b], - d = Object.keys(c); - "function" == typeof Object.getOwnPropertySymbols && (d = d.concat(Object.getOwnPropertySymbols(c).filter(function (a) { - return Object.getOwnPropertyDescriptor(c, a).enumerable - }))), d.forEach(function (b) { - _defineProperty(a, b, c[b]) - }) - } - return a -} - -function _defineProperty(a, b, c) { - return b in a ? Object.defineProperty(a, b, { - value: c, - enumerable: !0, - configurable: !0, - writable: !0 - }) : a[b] = c, a -} -class MetingJSElement extends HTMLElement { - connectedCallback() { - window.APlayer && window.fetch && (this._init(), this._parse()) - } - disconnectedCallback() { - this.lock || this.aplayer.destroy() - } - _camelize(a) { - return a.replace(/^[_.\- ]+/, "").toLowerCase().replace(/[_.\- ]+(\w|$)/g, (a, b) => b.toUpperCase()) - } - _init() { - let a = {}; - for (let b = 0; b < this.attributes.length; b += 1) a[this._camelize(this.attributes[b].name)] = this.attributes[b].value; - let b = ["server", "type", "id", "api", "auth", "auto", "lock", "name", "title", "artist", "author", "url", "cover", "pic", "lyric", "lrc"]; - this.meta = {}; - for (var c = 0; c < b.length; c++) { - let d = b[c]; - this.meta[d] = a[d], delete a[d] - } - this.config = a, this.api = this.meta.api || window.meting_api || "https://api.wuenci.com/meting/api/?server=:server&type=:type&id=:id&r=:r", this.meta.auto && this._parse_link() - } - _parse_link() { - let a = [ - ["music.163.com.*song.*id=(\\d+)", "netease", "song"], - ["music.163.com.*album.*id=(\\d+)", "netease", "album"], - ["music.163.com.*artist.*id=(\\d+)", "netease", "artist"], - ["music.163.com.*playlist.*id=(\\d+)", "netease", "playlist"], - ["music.163.com.*discover/toplist.*id=(\\d+)", "netease", "playlist"], - ["y.qq.com.*song/(\\w+).html", "tencent", "song"], - ["y.qq.com.*album/(\\w+).html", "tencent", "album"], - ["y.qq.com.*singer/(\\w+).html", "tencent", "artist"], - ["y.qq.com.*playsquare/(\\w+).html", "tencent", "playlist"], - ["y.qq.com.*playlist/(\\w+).html", "tencent", "playlist"], - ["xiami.com.*song/(\\w+)", "xiami", "song"], - ["xiami.com.*album/(\\w+)", "xiami", "album"], - ["xiami.com.*artist/(\\w+)", "xiami", "artist"], - ["xiami.com.*collect/(\\w+)", "xiami", "playlist"] - ]; - for (var b = 0; b < a.length; b++) { - let c = a[b], - d = new RegExp(c[0]), - e = d.exec(this.meta.auto); - if (null !== e) return this.meta.server = c[1], this.meta.type = c[2], void(this.meta.id = e[1]) - } - } - _parse() { - if (this.meta.url) { - let a = { - name: this.meta.name || this.meta.title || "Audio name", - artist: this.meta.artist || this.meta.author || "Audio artist", - url: this.meta.url, - cover: this.meta.cover || this.meta.pic, - lrc: this.meta.lrc || this.meta.lyric || "", - type: this.meta.type || "auto" - }; - return a.lrc || (this.meta.lrcType = 0), this.innerText && (a.lrc = this.innerText, this.meta.lrcType = 2), void this._loadPlayer([a]) - } - let a = this.api.replace(":server", this.meta.server).replace(":type", this.meta.type).replace(":id", this.meta.id).replace(":auth", this.meta.auth).replace(":r", Math.random()); - fetch(a).then(a => a.json()).then(a => this._loadPlayer(a)) - } - _loadPlayer(a) { - let b = { - audio: a, - mutex: !0, - lrcType: this.meta.lrcType || 3, - storageName: "metingjs" - }; - if (a.length) { - let a = _objectSpread({}, b, this.config); - for (let b in a)("true" === a[b] || "false" === a[b]) && (a[b] = "true" === a[b]); - let c = document.createElement("div"); - a.container = c, this.appendChild(c), this.aplayer = new APlayer(a) - } - } -} -window.customElements && !window.customElements.get("meting-js") && (window.MetingJSElement = MetingJSElement, window.customElements.define("meting-js", MetingJSElement)); \ No newline at end of file diff --git a/js/set.js b/js/set.js index f16ae8e..1dc4712 100644 --- a/js/set.js +++ b/js/set.js @@ -95,9 +95,11 @@ function getBgImg() { var bg_img_preinstall = { "type": "1", // 1:默认背景 2:每日一图 3:随机风景 4:随机动漫 + "2": "https://api.dujin.org/bing/1920.php", // 每日一图 + "3": "https://api.ixiaowai.cn/gqapi/gqapi.php", // 随机风景 + "4": "https://api.ixiaowai.cn/api/api.php" // 随机动漫 }; - // 更改背景图片 function setBgImgInit() { var bg_img = getBgImg(); @@ -105,28 +107,16 @@ function setBgImgInit() { switch (bg_img["type"]) { case "1": - var pictures = new Array(); - pictures[0] = './img/background1.webp'; - pictures[1] = './img/background2.webp'; - pictures[2] = './img/background3.webp'; - pictures[3] = './img/background4.webp'; - pictures[4] = './img/background5.webp'; - pictures[5] = './img/background6.webp'; - pictures[6] = './img/background7.webp'; - pictures[7] = './img/background8.webp'; - pictures[8] = './img/background9.webp'; - pictures[9] = './img/background10.webp'; - var rd = Math.floor(Math.random() * 10); - $('#bg').attr('src', pictures[rd]) //随机默认壁纸 + $('#bg').attr('src', `./img/background${1 + ~~(Math.random() * 10)}.webp`) //随机默认壁纸 break; case "2": - $('#bg').attr('src', localStorage.getItem('wallpaper_api_1')); //必应每日 + $('#bg').attr('src', bg_img_preinstall[2]); //必应每日 break; case "3": - $('#bg').attr('src', localStorage.getItem('wallpaper_api_2')); //随机风景 + $('#bg').attr('src', bg_img_preinstall[3]); //随机风景 break; case "4": - $('#bg').attr('src', localStorage.getItem('wallpaper_api_3')); //随机动漫 + $('#bg').attr('src', bg_img_preinstall[4]); //随机动漫 break; } }; @@ -142,19 +132,7 @@ $(document).ready(function () { if (type === "1") { setBgImg(bg_img); - var pictures = new Array(); - pictures[0] = './img/background1.webp'; - pictures[1] = './img/background2.webp'; - pictures[2] = './img/background3.webp'; - pictures[3] = './img/background4.webp'; - pictures[4] = './img/background5.webp'; - pictures[5] = './img/background6.webp'; - pictures[6] = './img/background7.webp'; - pictures[7] = './img/background8.webp'; - pictures[8] = './img/background9.webp'; - pictures[9] = './img/background10.webp'; - var rd = Math.floor(Math.random() * 10); - $('#bg').attr('src', pictures[rd]) //随机默认壁纸 + $('#bg').attr('src', `./img/background${1 + ~~(Math.random() * 10)}.webp`) //随机默认壁纸 iziToast.show({ icon: "fa-solid fa-image", timeout: 2500, @@ -164,7 +142,7 @@ $(document).ready(function () { if (type === "2") { setBgImg(bg_img); - $('#bg').attr('src', localStorage.getItem('wallpaper_api_1')); //必应每日 + $('#bg').attr('src', bg_img_preinstall[2]); //必应每日 iziToast.show({ icon: "fa-solid fa-image", timeout: 2500, @@ -174,7 +152,7 @@ $(document).ready(function () { if (type === "3") { setBgImg(bg_img); - $('#bg').attr('src', localStorage.getItem('wallpaper_api_2')); //随机风景 + $('#bg').attr('src', bg_img_preinstall[3]); //随机风景 iziToast.show({ icon: "fa-solid fa-image", timeout: 2500, @@ -184,7 +162,7 @@ $(document).ready(function () { if (type === "4") { setBgImg(bg_img); - $('#bg').attr('src', localStorage.getItem('wallpaper_api_3')); //随机动漫 + $('#bg').attr('src', bg_img_preinstall[4]); //随机动漫 iziToast.show({ icon: "fa-solid fa-image", timeout: 2500,