Skip to content

Commit

Permalink
Merge pull request #169 from ynshung/view-removed
Browse files Browse the repository at this point in the history
Removed view counter functionality
  • Loading branch information
ynshung authored Oct 26, 2023
2 parents 99f1f88 + da3b597 commit e7b48e0
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Control your YouTube shorts just like a normal YouTube video! Features include p
- Click the speed button to revert to normal speed or toggle between different speeds
- Toggle to auto skip short when current one ends
- Control volume with the **volume slider** or with - and =, mute audio with M
- View counter and upload date above video title
- **Customizable** keybinds

Extra features:
Expand All @@ -39,6 +38,7 @@ Extra features:
- Hide overlay on shorts (title, channel, etc.)
- Navigate to previous or next short without animation with W and S
- Go to the next frame or previous frame with . and , while paused
- Upload date above video title

### Screenshots

Expand Down
3 changes: 0 additions & 3 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,6 @@
"volumeSlider": {
"message": "Volume Slider"
},
"viewCounter": {
"message": "View Counter"
},
"uploadDate": {
"message": "Upload Date"
},
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "__MSG_extName__",
"default_locale": "en",
"description": "__MSG_extDescription__",
"version": "3.2.0",
"version": "3.2.1",
"action": { "default_popup": "index.html" },
"permissions": ["storage"],

Expand Down
11 changes: 1 addition & 10 deletions src/lib/Info.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import { isVideoPlaying } from "./VideoState";
import {
getCurrentId,
getOverlayElement,
getUploadDate,
getViews,
} from "./getters";
import { getCurrentId, getOverlayElement, getUploadDate } from "./getters";

export function setInfo(features: any) {
const views_interval = setInterval(addInfo, 10);

function addInfo() {
const info = [];
if (features["viewCounter"]) {
const views = getViews().replace(/(\r\n|\n|\r)/gm, "");
if (views) info.push(views);
}
if (features["uploadDate"]) {
const uploadDate = getUploadDate().replace(/(\r\n|\n|\r)/gm, "");
if (uploadDate) info.push(uploadDate);
Expand Down
2 changes: 0 additions & 2 deletions src/lib/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ export const DEFAULT_FEATURES = {
playbackRate: true,
volumeSlider: true,
keybinds: true,
viewCounter: true,
uploadDate: true,
};

Expand All @@ -167,7 +166,6 @@ export const FEATURES_ORDER: DefaultsDictionary = [
"playbackRate",
"volumeSlider",
"keybinds",
"viewCounter",
"uploadDate",
];

Expand Down
12 changes: 1 addition & 11 deletions src/lib/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,9 @@ export function getOverlay() {
) as HTMLElement;
}

export function getViews() {
export function getUploadDate() {
return (
document.querySelector("#factoids ytd-factoid-renderer:nth-child(2) div")
?.textContent ?? ""
);
}

export function getUploadDate() {
return (
(
document.querySelector(
"#factoids ytd-factoid-renderer:nth-child(3) div",
) as HTMLElement
).textContent ?? ""
);
}

0 comments on commit e7b48e0

Please sign in to comment.