-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
2,602 additions
and
101 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
export function checkForModeratorMessages(message: HTMLElement) { | ||
if (message.hasAttribute('moderator-checked')) { | ||
return; | ||
} | ||
message.setAttribute('moderator-checked', 'true'); | ||
if (message.hasAttribute('moderator-checked')) { | ||
return; | ||
} | ||
message.setAttribute('moderator-checked', 'true'); | ||
|
||
// Look for moderator avatar | ||
const moderatorAvatar = message.querySelector('[data-test="moderatorAvatar"]'); | ||
if (moderatorAvatar) { | ||
addClassModerator(message); | ||
} | ||
// Look for moderator avatar | ||
const moderatorAvatar = message.querySelector('[data-test="moderatorAvatar"]'); | ||
if (moderatorAvatar) { | ||
addClassModerator(message); | ||
} | ||
} | ||
|
||
export function addClassModerator(message: HTMLElement) { | ||
// Add special styling class | ||
message.classList.add('moderator-message'); | ||
// Add special styling class | ||
message.classList.add('moderator-message'); | ||
|
||
// Add MOD badge | ||
const username = message.querySelector('.sc-lmONJn span'); | ||
if (username && !username.querySelector('.moderator-badge')) { | ||
const badge = document.createElement('span'); | ||
badge.className = 'moderator-badge'; | ||
badge.textContent = 'MOD'; | ||
username.appendChild(badge); | ||
} | ||
// Add MOD badge | ||
const username = message.querySelector('.sc-lmONJn span'); | ||
if (username && !username.querySelector('.moderator-badge')) { | ||
const badge = document.createElement('span'); | ||
badge.className = 'moderator-badge'; | ||
badge.textContent = 'MOD'; | ||
username.appendChild(badge); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import path from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
import CopyPlugin from 'copy-webpack-plugin'; | ||
import webpack from 'webpack'; | ||
import TerserPlugin from 'terser-webpack-plugin'; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
|
||
// Configuration de base | ||
const baseConfig = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.tsx?$/, | ||
use: 'ts-loader', | ||
exclude: /node_modules/, | ||
} | ||
] | ||
}, | ||
resolve: { | ||
extensions: ['.tsx', '.ts', '.js'], | ||
alias: { | ||
'@': path.resolve(__dirname, 'src/') | ||
} | ||
}, | ||
optimization: { | ||
minimize: true, | ||
minimizer: [ | ||
new TerserPlugin({ | ||
terserOptions: { | ||
compress: { | ||
pure_funcs: [], // Ne pas retirer les console.log | ||
drop_console: false, // Garder les console.log | ||
}, | ||
format: { | ||
comments: false, | ||
}, | ||
}, | ||
extractComments: false, | ||
}), | ||
], | ||
}, | ||
}; | ||
|
||
// Configuration pour l'extension web | ||
const extensionConfig = { | ||
...baseConfig, | ||
name: 'extension', | ||
target: 'web', | ||
entry: { | ||
content: './src/content.ts' | ||
}, | ||
output: { | ||
filename: '[name].js', | ||
path: path.resolve(__dirname, 'dist'), | ||
clean: { | ||
keep: /icons|styles|manifest\.json/ | ||
} | ||
}, | ||
plugins: [ | ||
new CopyPlugin({ | ||
patterns: [ | ||
{ | ||
from: "src/styles", | ||
to: "styles" | ||
}, | ||
{ | ||
from: "icons", | ||
to: "icons" | ||
}, | ||
{ | ||
from: "manifest.json", | ||
to: "manifest.json", | ||
transform(content) { | ||
const manifest = JSON.parse(content); | ||
manifest.content_scripts[0].js = ['content.js']; | ||
manifest.content_scripts[0].css = ['styles/styles.css']; | ||
return JSON.stringify(manifest, null, 2); | ||
} | ||
} | ||
], | ||
}), | ||
new webpack.ProvidePlugin({ | ||
process: 'process/browser', | ||
Buffer: ['buffer', 'Buffer'] | ||
}) | ||
], | ||
devtool: 'source-map', | ||
resolve: { | ||
...baseConfig.resolve, | ||
fallback: { | ||
"path": 'path-browserify', | ||
"fs": false, | ||
"crypto": 'crypto-browserify', | ||
"buffer": 'buffer', | ||
"stream": 'stream-browserify', | ||
"util": 'util', | ||
"url": 'url', | ||
"assert": 'assert', | ||
"http": 'stream-http', | ||
"https": 'https-browserify', | ||
"os": 'os-browserify/browser', | ||
"process": 'process/browser' | ||
} | ||
} | ||
}; | ||
|
||
// Configuration pour les scripts Node | ||
const nodeConfig = { | ||
...baseConfig, | ||
name: 'node-scripts', | ||
target: 'node', | ||
entry: { | ||
release: './scripts/release.ts' | ||
}, | ||
output: { | ||
filename: '[name].js', | ||
path: path.resolve(__dirname, 'dist-scripts'), | ||
clean: true | ||
}, | ||
externals: { | ||
'zx': 'commonjs zx', | ||
'node-fetch': 'commonjs node-fetch', | ||
'form-data': 'commonjs form-data' | ||
} | ||
}; | ||
|
||
export default [extensionConfig, nodeConfig]; |