Skip to content

Commit f12f44f

Browse files
committed
Fix menu button
1 parent c90871d commit f12f44f

File tree

7 files changed

+787
-724
lines changed

7 files changed

+787
-724
lines changed

.github/workflows/extension.yml

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
1-
name: Web Extension CI
1+
name: Web Extension
22

33
on:
44
push:
55
tags:
66
- 'v*'
77

88
jobs:
9-
build:
9+
publish:
1010
runs-on: ubuntu-latest
11-
1211
steps:
1312
- uses: actions/checkout@v3
1413
- uses: actions/setup-node@v3
1514
with:
16-
node-version: '16'
15+
node-version: 16
1716
- run: yarn
18-
- run: yarn test
1917
- run: yarn package
2018
- uses: softprops/action-gh-release@v1
2119
with:
2220
draft: true
23-
files: dist/archive.zip
21+
files: dist/extension.zip
22+
- uses: mnao305/chrome-extension-upload@v4.0.1
23+
with:
24+
files: dist/extension.zip
25+
extension-id: ${{ vars.EXTENSION_ID }}
26+
client-id: ${{ secrets.CLIENT_ID }}
27+
client-secret: ${{ secrets.CLIENT_SECRET }}
28+
refresh-token: ${{ secrets.REFRESH_TOKEN }}

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Chat Filter for YouTube Live
22

3-
![badge](https://github.com/fiahfy/youtube-live-chat-filter/workflows/Web%20Extension%20CI/badge.svg)
3+
![badge](https://github.com/fiahfy/youtube-live-chat-filter/workflows/Web%20Extension/badge.svg)
44

55
> Chrome Extension for Filtering Chat Messages on YouTube Live.
66
@@ -18,7 +18,7 @@
1818

1919
## Installation
2020

21-
1. Download `archive.zip` from [releases page](https://github.com/fiahfy/youtube-live-chat-filter/releases) and unzip this file.
21+
1. Download `extension.zip` from [releases page](https://github.com/fiahfy/youtube-live-chat-filter/releases) and unzip this file.
2222
2. Open the Extension Management page by navigating to `chrome://extensions`.
2323
3. Enable Developer Mode by clicking the toggle switch next to **Developer mode**.
2424
4. Click the **LOAD UNPACKED** button and select the unpacked directory named `app`.

package.json

+21-21
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,38 @@
33
"description": "Chrome Extension for Filtering Chat Messages on YouTube Live.",
44
"version": "0.0.11",
55
"dependencies": {
6-
"@vue/composition-api": "^1.6.2",
7-
"nanoid": "^3.3.4",
6+
"@vue/composition-api": "^1.7.1",
7+
"nanoid": "^4.0.2",
88
"vue": "~2.6.14",
9-
"vuetify": "^2.6.6",
9+
"vuetify": "~2.6.15",
1010
"vuex": "~3.6.2",
1111
"vuex-module-decorators": "~1.2.0",
1212
"vuex-persist": "^3.1.3"
1313
},
1414
"devDependencies": {
15-
"@fiahfy/eslint-config-vue": "^0.0.17",
16-
"@fiahfy/prettier-config": "^0.0.2",
17-
"@fiahfy/tsconfig": "^0.0.1",
18-
"@types/chrome": "^0.0.188",
19-
"concurrently": "^7.2.1",
15+
"@fiahfy/eslint-config-vue": "^0.0.20",
16+
"@fiahfy/prettier-config": "^0.0.3",
17+
"@fiahfy/tsconfig": "^0.0.2",
18+
"@types/chrome": "^0.0.235",
19+
"concurrently": "^8.0.1",
2020
"copy-webpack-plugin": "^11.0.0",
21-
"css-loader": "^6.7.1",
22-
"eslint": "^8.17.0",
21+
"css-loader": "^6.7.3",
22+
"eslint": "^8.39.0",
2323
"file-loader": "^6.2.0",
24-
"html-webpack-plugin": "^5.5.0",
25-
"husky": "^8.0.1",
24+
"html-webpack-plugin": "^5.5.1",
25+
"husky": "^8.0.3",
2626
"mv3-hot-reload": "^0.2.7",
27-
"prettier": "^2.6.2",
27+
"prettier": "^2.8.8",
2828
"sass": "~1.32.13",
29-
"sass-loader": "^13.0.0",
29+
"sass-loader": "^13.2.2",
3030
"svg-inline-loader": "^0.8.2",
31-
"ts-loader": "^9.3.0",
32-
"typescript": "^4.7.3",
31+
"ts-loader": "^9.4.2",
32+
"typescript": "^5.0.4",
3333
"vue-loader": "~15.9.8",
34-
"vue-template-compiler": "^2.6.14",
35-
"vuetify-loader": "^1.7.3",
36-
"webpack": "^5.73.0",
37-
"webpack-cli": "^4.9.2"
34+
"vue-template-compiler": "~2.6.14",
35+
"vuetify-loader": "~1.7.3",
36+
"webpack": "^5.81.0",
37+
"webpack-cli": "^5.0.2"
3838
},
3939
"private": true,
4040
"productName": "Chat Filter for YouTube Live",
@@ -44,7 +44,7 @@
4444
"lint": "npm run lint:eslint && npm run lint:prettier",
4545
"lint:eslint": "eslint --ext .js,.ts,.vue --ignore-path .gitignore .",
4646
"lint:prettier": "prettier -c --ignore-path .gitignore .",
47-
"package": "npm run build && mkdir -p dist && zip -r dist/archive.zip app",
47+
"package": "npm run build && mkdir -p dist && zip -r dist/extension.zip app",
4848
"prepare": "husky install",
4949
"test": "npm run lint",
5050
"watch:dist": "mv3-hot-reload",

src/components/RuleTableRow.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
outlined
2424
x-small
2525
style="pointer-events: none"
26-
v-text="item.active ? 'active' : 'inactive'"
27-
/>
26+
>
27+
{{ item.active ? 'active' : 'inactive' }}
28+
</v-chip>
2829
</td>
2930
</tr>
3031
</template>

src/content-script.css

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ yt-live-chat-header-renderer
77
> yt-sort-filter-sub-menu-renderer {
88
width: 100%;
99
}
10-
yt-live-chat-header-renderer
11-
> .ylcfr-menu-button.ylcfr-active-menu-button
12-
> button
13-
> yt-icon {
10+
yt-live-chat-header-renderer > .ylcfr-menu-button.ylcfr-active-menu-button {
1411
color: #4387f1 !important;
1512
}
1613
yt-live-chat-header-renderer > .ylcfr-menu-button > button > yt-icon > svg {

src/content-script.ts

+26-6
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,29 @@ const addMenuButton = async () => {
5959
const header = await querySelectorAsync(
6060
'#chat-messages > yt-live-chat-header-renderer'
6161
)
62-
const refIconButton = header && header.querySelector('yt-icon-button')
62+
const refIconButton = header && header.querySelector('yt-live-chat-button')
6363
if (!header || !refIconButton) {
6464
return
6565
}
6666

6767
const icon = document.createElement('yt-icon')
68-
icon.classList.add('yt-live-chat-header-renderer', 'style-scope')
68+
icon.classList.add('style-scope', 'yt-button-renderer')
69+
70+
const button = document.createElement('button')
71+
button.id = 'button'
72+
button.classList.add('style-scope', 'yt-icon-button')
6973

7074
const iconButton = document.createElement('yt-icon-button')
71-
iconButton.id = 'overflow'
72-
iconButton.classList.add(
75+
iconButton.id = 'button'
76+
iconButton.classList.add('style-scope', 'yt-button-renderer')
77+
78+
const a = document.createElement('a')
79+
a.tabIndex = -1
80+
a.classList.add('yt-simple-endpoint', 'style-scope', 'yt-button-renderer')
81+
82+
const liveChatButton = document.createElement('yt-live-chat-button')
83+
liveChatButton.id = 'live-chat-header-context-menu'
84+
liveChatButton.classList.add(
7385
ClassName.menuButton,
7486
'style-scope',
7587
'yt-live-chat-header-renderer'
@@ -78,13 +90,21 @@ const addMenuButton = async () => {
7890
iconButton.onclick = async () => {
7991
await chrome.runtime.sendMessage({ type: 'menu-button-clicked' })
8092
}
81-
iconButton.append(icon)
8293

83-
header.insertBefore(iconButton, refIconButton)
94+
header.insertBefore(liveChatButton, refIconButton)
95+
96+
liveChatButton.append(a)
97+
a.append(iconButton)
98+
iconButton.append(button)
99+
button.append(icon)
84100

85101
// insert svg after wrapper button appended
86102
icon.innerHTML = filterList
87103

104+
// remove unnecessary elements
105+
liveChatButton.querySelector('yt-button-renderer')?.remove()
106+
iconButton.querySelector('button')?.remove()
107+
88108
updateMenuButton()
89109
}
90110

0 commit comments

Comments
 (0)