From d18c84f05b83c07a91aab52063ebc1ea029808dc Mon Sep 17 00:00:00 2001
From: Alluseri <42897348+Alluseri@users.noreply.github.com>
Date: Sat, 5 Aug 2023 06:50:19 +0500
Subject: [PATCH] Prod, new & better true olds. Meow.
---
bgworker.js | 9 ++++++
html/config.js | 6 ++--
html/popup.html | 2 +-
html/popup.js | 2 +-
manifest.firefox.json | 5 ++--
manifest.json | 5 ++--
scripts/defaults.js | 48 ++++++++++++++++++++++++++++----
scripts/page-observer.js | 20 ++++++++-----
scripts/server.js | 2 +-
scripts/transformer-css.js | 21 +++++++++++++-
scripts/transformer-general.js | 12 ++++++++
scripts/transformer-videopage.js | 33 +++++++++++++++++++---
update.firefox.json | 9 ++++++
13 files changed, 146 insertions(+), 28 deletions(-)
diff --git a/bgworker.js b/bgworker.js
index 8f57dee..ef83645 100644
--- a/bgworker.js
+++ b/bgworker.js
@@ -21,4 +21,13 @@
return;
}
});
+ env.webNavigation.onHistoryStateUpdated.addListener(function(Data) {
+ if (Data == null || !Data.url.includes("youtube")) return;
+ try {
+ console.log(Data);
+ env.tabs.sendMessage(Data.tabId, { Operation: "SeriStyle_HistoryState", Args: [Data.url] });
+ } catch {
+ console.log("Receiving end error.", JSON.stringify(Data, null, "\t"));
+ }
+ });
})();
\ No newline at end of file
diff --git a/html/config.js b/html/config.js
index 266bef6..53fca48 100644
--- a/html/config.js
+++ b/html/config.js
@@ -113,8 +113,8 @@ document.addEventListener("DOMContentLoaded", async () => {
console.log(ex);
}
- Language = SeriStyleSettings.SeriStyle.Language.Value;
- Array.from(document.getElementsByClassName("localize")).forEach(Element => Element.innerText = window.SeriStyleLocales[Language].HTML[Element.id]);
+ var KLanguage = window.SeriStyleLocales[Language = SeriStyleSettings.SeriStyle.Language.Value] || window.SeriStyleLocales[Language = SeriStyleSettings.SeriStyle.Language.Value = "en-US"];
+ Array.from(document.getElementsByClassName("localize")).forEach(Element => Element.innerText = KLanguage.HTML[Element.id]);
if (!Fail) {
document.getElementById("btn-reset").onclick = () => {
@@ -138,7 +138,7 @@ document.addEventListener("DOMContentLoaded", async () => {
Nav.appendChild(DomUtils.BuildElement("button", {
className: "modern-tab",
value: "",
- innerText: window.SeriStyleLocales[Language].Categories[Category],
+ innerText: KLanguage.Categories[Category],
navtab: Category,
onclick: function () {
Navigate(this.navtab);
diff --git a/html/popup.html b/html/popup.html
index 4869100..7f0d0eb 100644
--- a/html/popup.html
+++ b/html/popup.html
@@ -15,7 +15,7 @@
diff --git a/html/popup.js b/html/popup.js
index 6fd285c..c3118c2 100644
--- a/html/popup.js
+++ b/html/popup.js
@@ -11,7 +11,7 @@ document.addEventListener('DOMContentLoaded', function () {
});
document.getElementById("low-i-debug").onclick = async () => {
var DebugInfo = [
- "- SeriStyle v1.10.0",
+ "- SeriStyle v1.11.0",
"- " + navigator.userAgent,
"- " + StorageMode
];
diff --git a/manifest.firefox.json b/manifest.firefox.json
index 8495971..ed76b2f 100644
--- a/manifest.firefox.json
+++ b/manifest.firefox.json
@@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "SeriStyle",
"author": "Nekoseri",
- "version": "1.10.0",
+ "version": "1.11.0",
"description": "Bring the early-2021 UI back to YouTube!",
"icons": {
"16": "icons/default16.png",
@@ -18,7 +18,8 @@
"permissions": [
"tabs",
"storage",
- "scripting"
+ "scripting",
+ "webNavigation"
],
"host_permissions": [
"*://www.youtube.com/*"
diff --git a/manifest.json b/manifest.json
index e057644..b2f5e60 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "SeriStyle",
"author": "Nekoseri",
- "version": "1.10.0",
+ "version": "1.11.0",
"description": "Bring the early-2021 UI back to YouTube!",
"icons": {
"16": "icons/default16.png",
@@ -18,7 +18,8 @@
"permissions": [
"tabs",
"storage",
- "scripting"
+ "scripting",
+ "webNavigation"
],
"host_permissions": [
"*://www.youtube.com/*"
diff --git a/scripts/defaults.js b/scripts/defaults.js
index 02cdf33..7d6eed9 100644
--- a/scripts/defaults.js
+++ b/scripts/defaults.js
@@ -1,4 +1,4 @@
-this.SeriStyleMetaVersion = 1;
+this.SeriStyleMetaVersion = 2;
this.SeriStyleLocales = {
"en-US": {
@@ -18,13 +18,11 @@ this.SeriStyleLocales = {
Advanced: "Advanced settings"
},
Messages: {
- UpdateSettings: "SeriStyle was updated to version 1.10.0, which introduced new settings!\n\nDo you want to visit the settings page(opens in a new tab)?"
+ UpdateSettings: "SeriStyle was updated to version 1.11.0, which introduced new settings!\n\nDo you want to visit the settings page(opens in a new tab)?"
}
}
};
-
-
this.SeriStyleSettings = {
SeriStyle: {
Language: {
@@ -101,6 +99,12 @@ this.SeriStyleSettings = {
}
},
VideoPage: {
+ BlueAccent: {
+ Kind: 0,
+ Name: {
+ "en-US": "Old accent color on action bar"
+ }
+ },
HideDownloadButton: {
Kind: 0,
Name: {
@@ -211,6 +215,20 @@ this.SeriStyleSettings = {
"en-US": "Half the spaces around sorting buttons"
},
Value: true
+ },
+ NoSponsors: {
+ Kind: 0,
+ Name: {
+ "en-US": "Hide the \"Channel sponsors\" section"
+ },
+ Value: true
+ },
+ TrueOld: {
+ Kind: 0,
+ Name: {
+ "en-US": "True Old UI"
+ },
+ Value: true
}
},
Playlist: {
@@ -255,6 +273,17 @@ this.SeriStyleSettings = {
"en-US": "$ms"
}
},
+ OldIconInterval: {
+ Kind: 2,
+ Range: [0, 5000],
+ Name: {
+ "en-US": "Old icon observer update interval"
+ },
+ Value: 200,
+ Format: {
+ "en-US": "$ms"
+ }
+ },
VideoPageInterval: {
Kind: 2,
Range: [0, 5000],
@@ -337,6 +366,7 @@ this.DomUtils = {
}
};
+this.GetExel = (Element) => btoa(Element?.querySelector("path")?.attributes.d?.value);
this.MatchesExel = (Element, ExelArg) => btoa(Element?.querySelector("path")?.attributes.d?.value) == ExelArg;
this.FindByExel = (Elements, ExelArg) => Elements.find(x => btoa(x?.querySelector("path")?.attributes.d?.value) == ExelArg);
this.FindAllByExel = (Elements, ExelArg) => Elements.filter(x => btoa(x?.querySelector("path")?.attributes.d?.value) == ExelArg);
@@ -352,8 +382,11 @@ this.ExelImmersive = "TTIxIDd2MTBIM1Y3aDE4bTEtMUgydjEyaDIwVjZ6TTExLjUgMnYzaDFWMm
this.ExelDonate = "TTExIDE3aDJ2LTFoMWMuNTUgMCAxLS40NSAxLTF2LTNjMC0uNTUtLjQ1LTEtMS0xaC0zdi0xaDRWOGgtMlY3aC0ydjFoLTFjLS41NSAwLTEgLjQ1LTEgMXYzYzAgLjU1LjQ1IDEgMSAxaDN2MUg5djJoMnYxem01LjUtMTVjLTEuNzQgMC0zLjQxLjg4LTQuNSAyLjI4QzEwLjkxIDIuODggOS4yNCAyIDcuNSAyIDQuNDIgMiAyIDQuNjQgMiA3Ljk5YzAgNC4xMiAzLjQgNy40OCA4LjU1IDEyLjU4TDEyIDIybDEuNDUtMS40NEMxOC42IDE1LjQ3IDIyIDEyLjExIDIyIDcuOTkgMjIgNC42NCAxOS41OCAyIDE2LjUgMnptLTMuNzUgMTcuODUtLjc1Ljc0LS43NC0uNzMtLjA0LS4wNEM2LjI3IDE0LjkyIDMgMTEuNjkgMyA3Ljk5IDMgNS4xOSA0Ljk4IDMgNy41IDNjMS40IDAgMi43OS43MSAzLjcxIDEuODlMMTIgNS45bC43OS0xLjAxQzEzLjcxIDMuNzEgMTUuMSAzIDE2LjUgMyAxOS4wMiAzIDIxIDUuMTkgMjEgNy45OWMwIDMuNy0zLjI4IDYuOTQtOC4yNSAxMS44Nno=";
this.ExelAnnotations = "TTE3LjUsN2MxLjkzLDAsMy41LDEuNTcsMy41LDMuNWMwLDEtMC41Myw0LjUtMC44NSw2LjVoLTIuMDJsMC4yNC0xLjg5bDAuMTQtMS4wOWwtMS4xLTAuMDNDMTUuNSwxMy45NCwxNCwxMi40LDE0LDEwLjUgQzE0LDguNTcsMTUuNTcsNywxNy41LDcgICAgICAgICAgICAgTTYuNSw3QzguNDMsNywxMCw4LjU3LDEwLDEwLjVjMCwxLTAuNTMsNC41LTAuODU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WgxMVY4eiAgICAgICAgICAgIE0xOCw1djFoM1Y1SDE4eiBNNiwxNGgxdi0ydi0xVjlINnYySDN2MSBoM1YxNHogTTEwLDEyaDExdi0xSDEwVjEyeg==";
+this.ExelVerified = "TTEyIDJDNi41IDIgMiA2LjUgMiAxMnM0LjUgMTAgMTAgMTAgMTAtNC41IDEwLTEwUzE3LjUgMiAxMiAyek05LjggMTcuM2wtNC4yLTQuMUw3IDExLjhsMi44IDIuN0wxNyA3LjRsMS40IDEuNC04LjYgOC41eg==";
+this.ExelProducer = "TTEyIDR2OS4zOGMtLjczLS44NC0xLjgtMS4zOC0zLTEuMzgtMi4yMSAwLTQgMS43OS00IDRzMS43OSA0IDQgNCA0LTEuNzkgNC00VjhoNlY0aC03eg==";
this.SvgCreateClip = '
';
this.SvgAddToPlaylist = '
';
@@ -363,4 +396,7 @@ this.SvgDislike = '
';
\ No newline at end of file
+this.SvgMenu = '
';
+
+this.PathVerified = "M12,2C6.48,2,2,6.48,2,12s4.48,10,10,10s10-4.48,10-10 S17.52,2,12,2z M9.92,17.93l-4.95-4.95l2.05-2.05l2.9,2.9l7.35-7.35l2.05,2.05L9.92,17.93z";
+this.PathProducer = "M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z";
\ No newline at end of file
diff --git a/scripts/page-observer.js b/scripts/page-observer.js
index 7120a10..8674049 100644
--- a/scripts/page-observer.js
+++ b/scripts/page-observer.js
@@ -11,6 +11,12 @@ var Environment = this.browser || this.chrome;
}
})();
+Environment.runtime.onMessage.addListener((Message) => {
+ if (Message.Operation != "SeriStyle_HistoryState") return;
+ var URL = Message.Args[0];
+ window.dispatchEvent(new CustomEvent("historychange", {detail: Message.Args[0]}));
+});
+
var GeneralTransformerBurned = false;
var GT_Burn1 = false;
@@ -45,38 +51,38 @@ var PageObserver = new MutationObserver(async Mutations => {
});
var VideoPageInterval = setInterval(() => {
- if (document.querySelector("div#owner") && document.querySelector(".view-count")) {
+ if (document.querySelector("div#owner") && (document.querySelector(".view-count") || document.querySelector("#title > ytd-badge-supported-renderer > div > span"))) {
Environment.runtime.sendMessage({ Operation: "SeriStyle_LoadScript", Args: ["scripts/transformer-videopage.js"] });
clearInterval(VideoPageInterval);
- console.log("[SeriStyle|Observer] Burned transformer: Videopage.");
+ console.log("[SeriStyle|Interval] Burned transformer: Videopage.");
}
}, SeriStyleSettings.Advanced.VideoPageInterval.Value);
var PlaylistInterval = setInterval(() => {
if (document.querySelector("ytd-menu-renderer.ytd-playlist-header-renderer")) {
Environment.runtime.sendMessage({ Operation: "SeriStyle_LoadScript", Args: ["scripts/transformer-playlist.js"] });
clearInterval(PlaylistInterval);
- console.log("[SeriStyle|Observer] Burned transformer: Playlist.");
+ console.log("[SeriStyle|Interval] Burned transformer: Playlist.");
}
}, SeriStyleSettings.Advanced.PlaylistInterval.Value);
var VideoPlayerInterval = setInterval(() => {
if (document.querySelector(".ytp-settings-menu>.ytp-panel>.ytp-panel-menu")) {
Environment.runtime.sendMessage({ Operation: "SeriStyle_LoadScript", Args: ["scripts/transformer-videoplayer.js"] });
clearInterval(VideoPlayerInterval);
- console.log("[SeriStyle|Observer] Burned transformer: VideoPlayer.");
+ console.log("[SeriStyle|Interval] Burned transformer: VideoPlayer.");
}
}, SeriStyleSettings.Advanced.VideoPlayerInterval.Value);
var ChannelPageInterval = setInterval(() => {
if (document.querySelector("ytd-browse[page-subtype='channels'] #contents.ytd-rich-grid-renderer") && document.querySelector("ytd-browse[page-subtype='channels'] #header.ytd-rich-grid-renderer")) {
Environment.runtime.sendMessage({ Operation: "SeriStyle_LoadScript", Args: ["scripts/transformer-channelpage.js"] });
clearInterval(ChannelPageInterval);
- console.log("[SeriStyle|Observer] Burned transformer: ChannelPage.");
+ console.log("[SeriStyle|Interval] Burned transformer: ChannelPage.");
}
}, SeriStyleSettings.Advanced.ChannelPageInterval.Value);
Environment.runtime.sendMessage({ Operation: "SeriStyle_LoadScript", Args: ["scripts/transformer-css.js"] });
-console.log("[SeriStyle|Observer] Burned transformer: CSS.");
+console.log("[SeriStyle|Direct] Burned transformer: CSS.");
Environment.runtime.sendMessage({ Operation: "SeriStyle_LoadScript", Args: ["scripts/transformer-launch.js"] });
-console.log("[SeriStyle|Observer] Burned transformer: Launch.");
+console.log("[SeriStyle|Direct] Burned transformer: Launch.");
PageObserver.observe(document.querySelector("ytd-app"), {
childList: true,
diff --git a/scripts/server.js b/scripts/server.js
index 68ffdcf..f37d805 100644
--- a/scripts/server.js
+++ b/scripts/server.js
@@ -17,7 +17,7 @@
SeriStyleSettings[Category][Setting].Value = Modified[Category][Setting];
} catch {
Modified[Category][Setting] = undefined;
- console.log("Removed " + Category + "." + Setting + " due to absence in defaults.");
+ console.log("[SeriStyle|INFO] Removed " + Category + "." + Setting + " due to absence in defaults.");
}
}
} catch (ex) {
diff --git a/scripts/transformer-css.js b/scripts/transformer-css.js
index ba870ea..2e0b6aa 100644
--- a/scripts/transformer-css.js
+++ b/scripts/transformer-css.js
@@ -2,6 +2,8 @@
var SelSubPassiveBtn = "#subscribe-button yt-button-shape>button";
var SelSubContainer = "yt-smartimation.ytd-subscribe-button-renderer"; // Alt: #subscribe-button yt-smartimation
+var SelMeta = "#meta.ytd-c4-tabbed-header-renderer";
+var SelMetaSpan = SelMeta+">span.meta-item";
// TODO: Merge general button styles
document.head.appendChild(DomUtils.BuildElement("style", {
@@ -136,7 +138,24 @@ document.head.appendChild(DomUtils.BuildElement("style", {
"ytd-playlist-video-renderer{border-radius:0px;}" +
//
""
- )
+ ) +
+
+ /* Channel Page */
+ (SeriStyleSettings.ChannelPage.TrueOld.Value ?
+ SelMetaSpan + "{margin:0;}" +
+ SelMetaSpan + ">#channel-handle{display:none;}" +
+ SelMetaSpan + ">#videos-count{display:none;}" +
+ SelMeta+">#channel-tagline{display:none;}" +
+ "#channel-header-container.ytd-c4-tabbed-header-renderer{padding-top:0px;align-items:center;}" +
+ "#channel-header-container.ytd-c4-tabbed-header-renderer>#avatar{width:80px;height:80px;margin-bottom:0px;}" +
+ "#inner-header-container.ytd-c4-tabbed-header-renderer{margin-top:0px;}"
+ : "") +
+ (SeriStyleSettings.General.OldColors.Value ?
+ "#channel-header.ytd-c4-tabbed-header-renderer, #tabs-inner-container.ytd-c4-tabbed-header-renderer{background:#181818;}" +
+ "ytd-browse[page-subtype='channels'] {background:#0F0F0F;}"
+ : "") +
+ (SeriStyleSettings.ChannelPage.NoSponsors.Value ? "ytd-recognition-shelf-renderer{display:none;}" : "") +
+ ""
).replaceAll(/(?yt-icon.ytd-searchbox";
var SelMicIcon = "#voice-search-button yt-icon";
var SelMenuIcon = "#guide-icon.ytd-masthead";
+var _;
document.head.appendChild(DomUtils.BuildElement("style", {
"innerText":
@@ -22,6 +23,17 @@ $(SelSearchIcon).innerHTML = SvgSearch;
$(SelMicIcon).innerHTML = SvgMic;
$(SelMenuIcon).innerHTML = SvgMenu;
+setInterval(function() { // It's not my problem that everyone is stupid enough not to fix Subtree MutationObserver for the whole existence of this class
+ $$("path").forEach(Element => {
+ var Exel = btoa(Element.attributes.d?.value);
+ if (Exel == ExelVerified) {
+ Element.attributes.d.value = PathVerified;
+ } else if (Exel == ExelProducer) {
+ Element.attributes.d.value = PathProducer;
+ }
+ });
+}, SeriStyleSettings.Advanced.OldIconInterval.Value);
+
function FixContentHTML(Element, Metadata) {
console.log(Element);
console.log(Metadata);
diff --git a/scripts/transformer-videopage.js b/scripts/transformer-videopage.js
index 022e748..7aed010 100644
--- a/scripts/transformer-videopage.js
+++ b/scripts/transformer-videopage.js
@@ -81,6 +81,8 @@ document.head.appendChild(DomUtils.BuildElement("style", {
".header.ytd-playlist-panel-renderer{background:#212121FA;}"
: "") +
(SeriStyleSettings.VideoPage.HideJoinButton.Value ? "#sponsor-button{display:none;}" : "") +
+ // Hide "Shorts with this video" shelf
+ "#contents>ytd-reel-shelf-renderer{display:none;}" +
//
""
).replaceAll(/(? {
$(SelBottomRow).prepend($(SelOwner));
// Create span
-$(SelTopRow).prepend(DomUtils.BuildElement("div", { id: "seristyle_oldpanel" }, [
- (x => ((x.className = (x.className + " seristyle_subpanel seristyle_firstpanel").replace("yt-formatted-string ", "")), x))($(SelViews)),
- (x => ((x.className += " seristyle_subpanel"), x))($(SelFullDate))
-]));
+var Views = $(SelViews);
+if (Views) {
+ $(SelTopRow).prepend(DomUtils.BuildElement("div", { id: "seristyle_oldpanel" }, [
+ (x => ((x.className = (x.className + " seristyle_subpanel seristyle_firstpanel").replace("yt-formatted-string ", "")), x))($(SelViews)),
+ (x => ((x.className += " seristyle_subpanel"), x))($(SelFullDate))
+ ]));
+} else {
+ console.log("[SeriStyle|Videopage] No view count found, video must be sponsored. Locking redirects.");
+ document.head.appendChild(DomUtils.BuildElement("style", {
+ "innerText":
+ (
+ ".html5-ypc-endscreen{display:flex;flex-direction:row;justify-content:center;}" +
+ ".html5-ypc-thumbnail{float:none;}" +
+ ".html5-ypc-module{display:flex;flex-direction:column;align-items:center;}"
+ ).replaceAll(/(? ytd-badge-supported-renderer > div > span").innerText = "I AM CRINGE AND I WANT MONEY FOR MY CONTENT";
+ const FuckThisURL = document.location.href;
+ window.addEventListener("historychange", function(Deets) {
+ var URL = Deets.detail;
+ if (URL != FuckThisURL) {
+ console.log("[SeriStyle|Videopage] Hard reloading the page after sponsorship lock.");
+ window.open(URL, "_self");
+ }
+ });
+}
// New panels
if (!SeriStyleSettings.Advanced.LegacyPanels.Value) {
diff --git a/update.firefox.json b/update.firefox.json
index d2b74ae..fe00e76 100644
--- a/update.firefox.json
+++ b/update.firefox.json
@@ -46,6 +46,15 @@
"strict_min_version": "109"
}
}
+ },
+ {
+ "version": "1.11.0",
+ "update_link": "https://github.com/Alluseri/SeriStyle/releases/download/1.11.0/SeriStyle-1.11.0.xpi",
+ "applications": {
+ "gecko": {
+ "strict_min_version": "109"
+ }
+ }
}
]
}