Refactor version display in context menu and clean up versioning format

- Updated the context menu version function to dynamically append the application version to the link and include a ref parameter in the URL.
- Removed the build version log from the initialization logs in the Artplayer class.
- Cleaned up the version and environment getters to return unquoted strings.
This commit is contained in:
Harvey Zack committed 2025-06-20 10:18:39 +08:00
1 parent da94223721
commit 7e7bd8c0ad
4 files changed
+21 -9

No files matched your search

@@ -1,6 +1,13 @@
export default function version(option) {
return {
...option,
html: `<a href="https://artplayer.org" target="_blank">ArtPlayer ${'__APP_VERSION__'}</a>`,
html: `<a href="https://artplayer.org" target="_blank">ArtPlayer</a>`,
mounted(el) {
const link = el.querySelector('a');
const version = this.constructor.version;
const ref = encodeURIComponent(location.href);
link.textContent += ` ${version}`;
link.href += `?ref=${ref}`;
},
};
}
+2 -3
View File
@@ -68,7 +68,6 @@ export default class Artplayer extends Emitter {
const log = (msg) => console.log(`[ART.${this.id}] -> ${msg}`);
log('Version@' + Artplayer.version);
log('Env@' + Artplayer.env);
log('Build@' + Artplayer.build);
for (let index = 0; index < config.events.length; index++) {
this.on('video:' + config.events[index], (event) => log('Event@' + event.type));
}
@@ -82,11 +81,11 @@ export default class Artplayer extends Emitter {
}
static get version() {
return '"5.2.4"';
return '"5.2.4"'.replace(/"/g, '');
}
static get env() {
return '"development"';
return '"development"'.replace(/"/g, '');
}
static get config() {