Skip to content

Commit

Permalink
added playlist observer.
Browse files Browse the repository at this point in the history
fixed initializeAudioTranslation.
Added a report an issue btn in popup.
  • Loading branch information
YouG-o committed Mar 5, 2025
1 parent c5b539e commit 4c932bf
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 26 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/YouG-o/YNT_Browser-Extension.git"
"url": "git+https://github.com/YouG-o/YouTube_No_Translation.git"
},
"keywords": [
"youtube",
Expand All @@ -44,9 +44,9 @@
"author": "YouGo",
"license": "AGPL-3.0-or-later",
"bugs": {
"url": "https://github.com/YouG-o/YNT_Browser-Extension/issues"
"url": "https://github.com/YouG-o/YouTube_No_Translation/issues"
},
"homepage": "https://github.com/YouG-o/YNT_Browser-Extension#readme",
"homepage": "https://github.com/YouG-o/YouTube_No_Translation#readme",
"devDependencies": {
"@types/chrome": "^0.0.299",
"@types/webextension-polyfill": "^0.12.1",
Expand Down
3 changes: 2 additions & 1 deletion src/content/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ async function initializeFeatures() {
// Initialize functions
function initializeTitleTranslation() {
titlesLog('Initializing title translation prevention');

if (currentSettings?.titleTranslation) {
refreshMainTitle();
refreshOtherTitles();
Expand All @@ -58,7 +59,7 @@ function initializeAudioTranslation() {

// Initial setup
if (currentSettings?.audioTranslation) {
handleAudioTranslation
handleAudioTranslation();
}

// Message handler
Expand Down
4 changes: 1 addition & 3 deletions src/content/observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function setupSubtitlesObserver() {
let homeObserver: MutationObserver | null = null;
let recommendedObserver: MutationObserver | null = null;
let searchObserver: MutationObserver | null = null;
//let playlistObserver: MutationObserver | null = null;
let playlistObserver: MutationObserver | null = null;

// --- Observers Setup
function setupOtherTitlesObserver() {
Expand Down Expand Up @@ -228,7 +228,6 @@ function setupOtherTitlesObserver() {
//otherTitlesLog('Search results observer setup completed');
});

/*
// --- Observer for playlist/queue videos
waitForElement('#playlist ytd-playlist-panel-renderer #items').then((contents) => {
otherTitlesLog('Setting up playlist/queue videos observer');
Expand All @@ -242,7 +241,6 @@ function setupOtherTitlesObserver() {
});
otherTitlesLog('Playlist/Queue observer setup completed');
});
*/
}


Expand Down
49 changes: 30 additions & 19 deletions src/popup/popup.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../styles/main.css">
<title>YouTube No Translation</title>
</head>

<body class="w-[300px] bg-gray-700">
<div class="p-4">
<!-- Header -->
<header class="pb-4 border-b border-gray-600">
<h1 class="text-lg font-medium text-white flex items-center gap-2">
<img src="../../assets/icons/icon.png" alt="Logo" class="w-5 h-5">
YouTube No Translation
</h1>

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../styles/main.css">
<title>YouTube No Translation</title>
</head>

<body class="w-[300px] bg-gray-700">
<div class="p-4">
<!-- Header -->
<header class="pb-4 border-b border-gray-600">
<h1 class="text-lg font-medium text-white flex items-center gap-2">
<img src="../../assets/icons/icon.png" alt="Logo" class="w-5 h-5">
YouTube No Translation
</h1>
<div class="text-xs text-gray-400 flex items-center gap-1">
Created by YouGo
<a href="https://github.com/YouG-o" target="_blank" rel="noopener noreferrer">
<img src="../../assets/icons/Github-Dark.svg" alt="GitHub" title="GitHub" class="w-4 h-4 hover:opacity-80 transition-opacity">
</a>
</div>
</header>
<main class="py-4">
<div class="space-y-4">
Expand Down Expand Up @@ -83,9 +89,14 @@ <h2 class="text-sm font-medium text-white">Subtitles</h2>
</div>
<div class="flex items-center justify-between">
<p class="text-xs text-gray-400">v2.1.11</p>
<a href="https://github.com/YouG-o" target="_blank" rel="noopener noreferrer" class="text-xs text-gray-400 flex items-center gap-1">
Created by YouGo
<img src="../../assets/icons/Github-Dark.svg" alt="GitHub" title="GitHub" class="w-4 h-4 hover:opacity-80 transition-opacity">
<a href="https://github.com/YouG-o/YouTube_No_Translation/issues"
target="_blank"
rel="noopener noreferrer"
class="text-xs text-gray-400 hover:text-gray-300 transition-colors flex items-center gap-1">
<svg class="w-4 h-4" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>
</svg>
Report an issue
</a>
</div>
</footer>
Expand Down

0 comments on commit 4c932bf

Please sign in to comment.