-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed bug with extension on non-playlist pages where it would spam error logs due to not finding a playlist element * Fixed bug where playlists containing "Upcoming" videos would not calculate a total duration * Fixed bug where the yt-navigate-finish event listener was not being removed before a new one could be added * Added browser console logs to indicate when the extension loads & when it cannot find a playlist
- Loading branch information
Showing
6 changed files
with
58 additions
and
7 deletions.
There are no files selected for viewing
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,11 +1,14 @@ | ||
import { main } from "src/modules/index"; | ||
import "./main.css"; | ||
import { logger } from "./shared/modules/logger"; | ||
|
||
// Entry-point | ||
if (document.readyState !== "loading") { | ||
logger.info("Loaded."); | ||
main(); | ||
} else { | ||
document.addEventListener("DOMContentLoaded", () => { | ||
logger.info("Loaded."); | ||
main(); | ||
}); | ||
} |
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,23 @@ | ||
class Logger { | ||
static instance; | ||
|
||
constructor() { | ||
const { version } = chrome.runtime.getManifest(); | ||
this.prefix = `YTPDC (v${version}):`; | ||
} | ||
|
||
static getInstance() { | ||
return Logger.instance ? Logger.instance : new Logger(); | ||
} | ||
|
||
logWithPrefix(logMethod) { | ||
return (...args) => logMethod(this.prefix, ...args); | ||
} | ||
|
||
info = this.logWithPrefix(console.info); | ||
debug = this.logWithPrefix(console.debug); | ||
warn = this.logWithPrefix(console.warn); | ||
error = this.logWithPrefix(console.error); | ||
} | ||
|
||
export const logger = Logger.getInstance(); |
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