|
55 | 55 | </v-list> |
56 | 56 | </v-menu> |
57 | 57 | </v-app-bar> |
58 | | - <v-main class="content" style="max-height: 500px; overflow-y: scroll; padding: 6px"> |
| 58 | + <v-main |
| 59 | + class="content" |
| 60 | + style="max-height: 500px; overflow-y: scroll; padding: 6px" |
| 61 | + > |
59 | 62 | <v-card |
60 | 63 | id="notice" |
61 | 64 | v-show="isShowNotice" |
|
85 | 88 | <span class="v-text d-flex" style="color: #fff" |
86 | 89 | >当前版本: {{ version }} {{ isdebug ? "debug" : "" }}</span |
87 | 90 | > |
88 | | - <span class="v-text d-flex" style="color: #fff">已是最新版本</span> |
| 91 | + <span |
| 92 | + v-if="version == remoteVersion" |
| 93 | + class="v-text d-flex" |
| 94 | + style="color: #fff" |
| 95 | + >已是最新版本</span |
| 96 | + > |
| 97 | + <a |
| 98 | + v-else |
| 99 | + class="v-text d-flex" |
| 100 | + style="color: #e3ff00; text-decoration: none" |
| 101 | + href="https://github.com/scriptscat/scriptcat/releases" |
| 102 | + target="_blank" |
| 103 | + >有新的版本</a |
| 104 | + > |
89 | 105 | </div> |
90 | 106 | </v-footer> |
91 | 107 | </v-app> |
@@ -132,6 +148,7 @@ export default class Popup extends Vue { |
132 | 148 | tabs = null; |
133 | 149 |
|
134 | 150 | version = ExtVersion; |
| 151 | + remoteVersion = ""; |
135 | 152 | isdebug = process.env.NODE_ENV == "development"; |
136 | 153 |
|
137 | 154 | panel = [0]; |
@@ -188,42 +205,46 @@ export default class Popup extends Vue { |
188 | 205 | } |
189 | 206 |
|
190 | 207 | created() { |
191 | | - chrome.storage.local.get(["notice", "oldNotice"], (items) => { |
| 208 | + chrome.storage.local.get(["notice", "oldNotice", "version"], (items) => { |
192 | 209 | this.notice = items["notice"]; |
193 | 210 | this.oldNotice = items["oldNotice"]; |
| 211 | + this.remoteVersion = items["version"]; |
194 | 212 | }); |
195 | | - chrome.tabs.query({ active: true, lastFocusedWindow: true }, async (tabs) => { |
196 | | - MsgCenter.sendMessage( |
197 | | - RequestTabRunScript, |
198 | | - { |
199 | | - tabId: tabs[0].id, |
200 | | - url: tabs[0].url, |
201 | | - }, |
202 | | - (val) => { |
203 | | - this.scripts = val.run; |
204 | | - this.menu = val.runMenu || {}; |
205 | | - this.bgMenu = val.bgMenu || {}; |
206 | | - // 将有菜单的后台脚本,放到运行脚本中 |
207 | | - this.scriptConrtoller |
208 | | - .scriptList((where) => { |
209 | | - return where |
210 | | - .where("type") |
211 | | - .anyOf([SCRIPT_TYPE_BACKGROUND, SCRIPT_TYPE_CRONTAB]); |
212 | | - }) |
213 | | - .then((result) => { |
214 | | - this.bgScripts = result; |
215 | | - let map = new Map(); |
216 | | - result.forEach((val) => { |
217 | | - map.set(val.id, val); |
| 213 | + chrome.tabs.query( |
| 214 | + { active: true, lastFocusedWindow: true }, |
| 215 | + async (tabs) => { |
| 216 | + MsgCenter.sendMessage( |
| 217 | + RequestTabRunScript, |
| 218 | + { |
| 219 | + tabId: tabs[0].id, |
| 220 | + url: tabs[0].url, |
| 221 | + }, |
| 222 | + (val) => { |
| 223 | + this.scripts = val.run; |
| 224 | + this.menu = val.runMenu || {}; |
| 225 | + this.bgMenu = val.bgMenu || {}; |
| 226 | + // 将有菜单的后台脚本,放到运行脚本中 |
| 227 | + this.scriptConrtoller |
| 228 | + .scriptList((where) => { |
| 229 | + return where |
| 230 | + .where("type") |
| 231 | + .anyOf([SCRIPT_TYPE_BACKGROUND, SCRIPT_TYPE_CRONTAB]); |
| 232 | + }) |
| 233 | + .then((result) => { |
| 234 | + this.bgScripts = result; |
| 235 | + let map = new Map(); |
| 236 | + result.forEach((val) => { |
| 237 | + map.set(val.id, val); |
| 238 | + }); |
| 239 | + for (const id in this.bgMenu) { |
| 240 | + this.scripts.push(map.get(parseInt(id))); |
| 241 | + this.menu[id] = this.bgMenu[id]; |
| 242 | + } |
218 | 243 | }); |
219 | | - for (const id in this.bgMenu) { |
220 | | - this.scripts.push(map.get(parseInt(id))); |
221 | | - this.menu[id] = this.bgMenu[id]; |
222 | | - } |
223 | | - }); |
224 | | - } |
225 | | - ); |
226 | | - }); |
| 244 | + } |
| 245 | + ); |
| 246 | + } |
| 247 | + ); |
227 | 248 | } |
228 | 249 | } |
229 | 250 | </script> |
|
0 commit comments