diff --git a/scripts/main.js b/scripts/main.js index fd77fd2..5968331 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -41,26 +41,33 @@ const createSuperLabel = ((url, id) => { }); // 更新提示 创建 -const createUpdateLayer = ((abbr, lastVersion, latestVersion, download, deviceInfo, flag) => { +const createUpdateLayer = ((abbr, lastVersion, latestVersion, download, device, deviceInfo, flag) => { ++updateLayerNumber; + const stableOrDev = ((flag == 'release') ? 'stable' : 'dev'); const dom = ` -
`; + `; $('sidebar').before(dom); + $(`.update-layer-${updateLayerNumber} .download`).click(() => { + const set = ((version, stableOrDev) => { + localStorage.setItem(`last-${device}-${abbr}-${stableOrDev}-download`, version); + }); + set(latestVersion, stableOrDev); + }); }); // 更新提示 删除 @@ -512,14 +519,14 @@ $(document).ready(() => { const lastStableVersion = localStorage.getItem(`last-${device}-${abbr}-stable-download`); const latestStableVersion = launcher.version; if (lastStableVersion && lastStableVersion != latestStableVersion) { - createUpdateLayer(abbr, lastStableVersion, latestStableVersion, launcher.download, deviceInfo, 'release'); + createUpdateLayer(abbr, lastStableVersion, latestStableVersion, launcher.download, device, deviceInfo, 'release'); }; }; if (launcher.hasOwnProperty('dev')) { const lastDevVersion = localStorage.getItem(`last-${device}-${abbr}-dev-download`); const latestDevVersion = launcher.dev.version; if (lastDevVersion && lastDevVersion != latestDevVersion) { - createUpdateLayer(abbr, lastDevVersion, latestDevVersion, launcher.dev.download, deviceInfo, 'preRelease'); + createUpdateLayer(abbr, lastDevVersion, latestDevVersion, launcher.dev.download, device, deviceInfo, 'preRelease'); }; }; };