aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2020-07-03 19:56:08 -0400
committerAjay Ramachandran <[email protected]>2020-07-03 19:56:08 -0400
commitbfafcd07cce81fb40ce8cb2d36b0309e14028a5a (patch)
tree0a50e69c842ea95cb3ac270c36f9dcdd692dfee8
parent77abc1d031d299302b6ac365e7a108d620a9f458 (diff)
downloadSponsorBlock-bfafcd07cce81fb40ce8cb2d36b0309e14028a5a.tar.gz
SponsorBlock-bfafcd07cce81fb40ce8cb2d36b0309e14028a5a.zip
Fix font issue, NaN issue and remove hide real time
-rw-r--r--src/config.ts6
-rw-r--r--src/content.ts23
2 files changed, 12 insertions, 17 deletions
diff --git a/src/config.ts b/src/config.ts
index adf7f0fc..31880f48 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -5,8 +5,6 @@ import Utils from "./utils";
const utils = new Utils();
interface SBConfig {
- hideRealTime: boolean,
- timeWithSkips: boolean,
userID: string,
sponsorTimes: SBMap<string, any>,
whitelistedChannels: string[],
@@ -17,6 +15,7 @@ interface SBConfig {
skipCount: number,
sponsorTimesContributed: number,
submissionCountSinceCategories: number, // New count used to show the "Read The Guidelines!!" message
+ showTimeWithSkips: boolean,
unsubmittedWarning: boolean,
disableSkipping: boolean,
trackViewCount: boolean,
@@ -125,8 +124,6 @@ var Config: SBObject = {
*/
configListeners: [],
defaults: {
- hideRealTime: false,
- timeWithSkips: true,
userID: null,
sponsorTimes: new SBMap("sponsorTimes"),
whitelistedChannels: [],
@@ -137,6 +134,7 @@ var Config: SBObject = {
skipCount: 0,
sponsorTimesContributed: 0,
submissionCountSinceCategories: 0,
+ showTimeWithSkips: true,
unsubmittedWarning: true,
disableSkipping: false,
trackViewCount: true,
diff --git a/src/content.ts b/src/content.ts
index e28acc26..6d8ae79b 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -801,7 +801,6 @@ function updatePreviewBar() {
if (localSponsorTimes == null) localSponsorTimes = [];
let allSponsorTimes = localSponsorTimes.concat(sponsorTimesSubmitting);
- showTimeWithoutSkips(allSponsorTimes);
//create an array of the sponsor types
let types = [];
@@ -819,6 +818,10 @@ function updatePreviewBar() {
previewBar.set(utils.getSegmentsFromSponsorTimes(allSponsorTimes), types, video.duration)
+ if (Config.config.showTimeWithSkips) {
+ showTimeWithoutSkips(allSponsorTimes);
+ }
+
//update last video id
lastPreviewBarUpdate = sponsorVideoID;
}
@@ -1608,8 +1611,6 @@ function formatTime(seconds) {
}
function showTimeWithoutSkips(allSponsorTimes): void {
- if(!Config.config.timeWithSkips) return;
-
let skipDuration = 0;
// Calculate skipDuration based from the segments in the preview bar
@@ -1627,21 +1628,17 @@ function showTimeWithoutSkips(allSponsorTimes): void {
let formatedTime = utils.getFormattedTime(video.duration - skipDuration);
- const durationID = "durationAfterSkips";
- let duration = document.getElementById(durationID);
+ const durationID = "sponsorBlockDurationAfterSkips";
+ let duration = document.getElementById(durationID);
// Create span if needed
if(duration === null) {
duration = document.createElement('span');
- duration.id = durationID;
+ duration.id = durationID;
+ duration.classList.add("ytp-time-duration");
+
display.appendChild(duration);
}
- if(Config.config.hideRealTime) {
- // Empty if not enabled
- duration.innerText = "";
- display.getElementsByTagName("span")[2].innerText = formatedTime;
- } else {
- duration.innerText = (skipDuration === 0) ? "" : " ("+formatedTime+")";
- }
+ duration.innerText = (skipDuration <= 0 || isNaN(skipDuration)) ? "" : " ("+formatedTime+")";
}