mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-09 03:46:16 -08:00
Refactor code structure for improved readability and maintainability
Remove debugging border from the websr plugin's styling Enhance canvas sizing logic in artplayer-plugin-websr - Updated canvas positioning to center it within the player. - Introduced a new function to calculate canvas size based on the video aspect ratio. - Adjusted canvas dimensions during initialization and on resize events to maintain aspect ratio. - Ensured canvas styles are updated to reflect the calculated dimensions. feat: add comparison mode to artplayer-plugin-websr - Updated README.md to reflect new comparison feature and simplified content. - Modified package.json to remove unnecessary keywords. - Enhanced index.js to implement comparison functionality, allowing users to compare original and upscaled video. - Added new methods for enabling, disabling, and toggling comparison mode, as well as setting and getting the comparison position. - Updated TypeScript definitions to include new comparison options and methods.
This commit is contained in:
1 parent
07a5b0c0f0
commit
7dffd99cfd
308 files changed
+3175
-852
No files matched your search
@@ -2,6 +2,13 @@ import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { glob } from 'glob'
|
||||
|
||||
function ensureDirExists(filePath) {
|
||||
const dir = path.dirname(filePath)
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir, { recursive: true })
|
||||
}
|
||||
}
|
||||
|
||||
function parsePluginInfo(path) {
|
||||
const file = path.split('/').pop() || ''
|
||||
const baseName = file.replace('.d.ts', '')
|
||||
@@ -28,6 +35,7 @@ for (let index = 0; index < artplayerTS.length; index++) {
|
||||
|
||||
code.replace('export default ', '')
|
||||
code += `export = Artplayer;\nexport as namespace Artplayer;\n`
|
||||
ensureDirExists(artplayerTSoutput)
|
||||
fs.writeFileSync(artplayerTSoutput, code.trim())
|
||||
console.log(`✨ Built ${artplayerTSoutput}`);
|
||||
|
||||
@@ -40,6 +48,7 @@ console.log(`✨ Built ${artplayerTSoutput}`);
|
||||
const { name, file } = parsePluginInfo(type)
|
||||
const code = `${String(fs.readFileSync(type)).replace(reg, '')}\nexport = ${name};\nexport as namespace ${name};\n`
|
||||
const output = path.join('docs/assets/ts', file)
|
||||
ensureDirExists(output)
|
||||
fs.writeFileSync(output, code.trim())
|
||||
console.log(`✨ Built ${output}`)
|
||||
pluginFiles.push(file)
|
||||
@@ -54,6 +63,7 @@ console.log(`✨ Built ${artplayerTSoutput}`);
|
||||
/let libUris = \[([\s\S]*?)\]/,
|
||||
`let libUris = [\n ${newLibUris},\n ]`,
|
||||
)
|
||||
ensureDirExists(commonJsPath)
|
||||
fs.writeFileSync(commonJsPath, newContent)
|
||||
console.log(`✨ Updated libUris in ${commonJsPath}`)
|
||||
})()
|
||||
Reference in new issue
Block a user