Skip to content

Commit

Permalink
Update stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alluseri committed Jul 5, 2024
1 parent b85183c commit 7e72959
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
2 changes: 1 addition & 1 deletion scripts/page-observer.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var PageObserver = new MutationObserver(async Mutations => {
});

var VideoPageInterval = setInterval(() => {
if (document.querySelector("div#owner") && (document.querySelector(".view-count") || document.querySelector("#title > ytd-badge-supported-renderer > div > span"))) {
if (document.querySelector("div#owner") && (document.querySelector(".view-count") || document.querySelector("#title > ytd-badge-supported-renderer > div > p"))) {
Environment.runtime.sendMessage({ Operation: "SeriStyle_LoadScript", Args: ["scripts/transformer-videopage.js"] });
clearInterval(VideoPageInterval);
console.log("[SeriStyle|Interval] Burned transformer: Videopage.");
Expand Down
19 changes: 13 additions & 6 deletions scripts/transformer-css.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// jshint -W014, -W086

var SelSubPassiveBtn = "#subscribe-button-shape>button"; // Old: #subscribe-button yt-button-shape>button
var SelSubContainer = "yt-smartimation.ytd-subscribe-button-renderer>.smartimation__content>__slot-el"; // [OLD] Alt: #subscribe-button yt-smartimation
var SelSubPassiveBtn = "#subscribe-button-shape>button";
var SelSubContainer = "#subscribe-button>ytd-subscribe-button-renderer>yt-smartimation>div>__slot-el";
var SelMeta = "#meta.ytd-c4-tabbed-header-renderer";
var SelMetaSpan = SelMeta + ">span.meta-item";

Expand All @@ -10,6 +10,8 @@ document.head.appendChild(DomUtils.BuildElement("style", {
"innerText":
(
/* General */
// Wtfard
"ytd-ad-slot-renderer{display:none;}" +
// Remove "You"
"ytd-guide-collapsible-section-entry-renderer>#header{display:none;}" +
// Old search box styles
Expand All @@ -24,16 +26,19 @@ document.head.appendChild(DomUtils.BuildElement("style", {
"input#search{padding:1px 2px;margin-left:4px;}" +
// Remove thumbnail roundings
(SeriStyleSettings.General.ThumbnailRoundings.Value ? "#thumbnail{border-radius:0px;}" : "") +
// Fix video listing hover action menu
"#dismissible.ytd-compact-video-renderer:not(:hover)>div.details>#menu{visibility:hidden;}" +
// Old homepage top bar roundings(also applies to vp filters apparently)
"yt-chip-cloud-chip-renderer{border-radius:16px;}" +
// Old time status roundings
"ytd-thumbnail-overlay-time-status-renderer{border-radius:2px;}" +
// Old video duration roundings
"ytd-thumbnail-overlay-time-status-renderer{margin:4px;}" +
"div.ytd-thumbnail-overlay-time-status-renderer>badge-shape{border-radius:2px;height:12px;padding:3px 4px;background:rgba(0,0,0,0.8);font-size:1.2rem;font-weight:500;letter-spacing:0.5px;font-family:Roboto,Arial,sans-serif;}" + // line-height:1.2rem;
// Restyle Join and Analytics buttons
(!SeriStyleSettings.Advanced.LegacyPanels.Value ?
"#sponsor-button yt-button-shape>button{" + (SeriStyleSettings.VideoPage.HideJoinButton.Value ? "display:none;" : "text-transform:uppercase;background:none;border:1px solid #3EA6FF;color:#3EA6FF;border-radius:3px;") + "}" +
"#analytics-button yt-button-shape>button{text-transform:uppercase;background:#065FD4;color:#FFF;border-radius:3px;}"
: "") +
// Fix the Unsubscribe button
// Fix the Subscribe button
"ytd-subscribe-button-renderer{transition:none;width:unset;}" +
SelSubPassiveBtn + "{border-radius:3px;text-transform:uppercase;}" +
SelSubPassiveBtn + ".yt-spec-button-shape-next--filled{background:#C00;color:#FFF;}" + // "SUBSCRIBE" button, red color
Expand Down Expand Up @@ -69,13 +74,15 @@ document.head.appendChild(DomUtils.BuildElement("style", {
"[rounded-corners],.ytp-rounded-menu,ytd-menu-popup-renderer{border-radius:0px;}" +
// Force keyboard color
"#container.ytd-searchbox span{filter:invert(100%);}" +
// Remove logo selection outline
"a#logo.ytd-topbar-logo-renderer::before{display:none;}" +
/* Homepage */
// Hide shorts shelf
(SeriStyleSettings.HomePage.HideShorts.Value ? "#contents>ytd-rich-section-renderer{display:none;}" : "") +
// Hide thumbnail background
"ytd-thumbnail.ytd-rich-grid-media:before{background:none;}" +
// Hide series
(SeriStyleSettings.HomePage.HideSeries.Value ? "ytd-badge-supported-renderer.top-badge.ytd-rich-grid-media{display:none;}" : "") +
(SeriStyleSettings.HomePage.HideSeries.Value ? "ytd-badge-supported-renderer.top-badge{display:none;}" : "") +
// Fix alerts
(SeriStyleSettings.Playlist.TrueOld.Value ? "#alerts.ytd-browse{padding-right:0px;}" : "") +
// Remove jam paddings
Expand Down
23 changes: 14 additions & 9 deletions scripts/transformer-videopage.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ document.head.appendChild(DomUtils.BuildElement("style", {
// Description
SelBottomRow + "{flex-direction:column;border-bottom-color:rgba(255,255,255,0.1);border-bottom-style:solid;border-bottom-width:1px;padding-bottom:16px;}" +
"#comment-teaser{display:none;}" +
SelDescription + "{background:none;cursor:unset;}" +
SelDescription + "{background:none;cursor:unset;width:0;}" +
"#info-container{display:none;}" +
"tp-yt-paper-button.ytd-text-inline-expander{position:relative;left:unset;justify-content:flex-start;color:#AAA;font-family:Roboto,Arial,sans-serif;margin-top:8px;font-size:1.3rem;font-weight:500;letter-spacing:0.007px;text-transform:uppercase;}" +
"tp-yt-paper-button.ytd-text-inline-expander>paper-ripple{display:none;}" +
Expand All @@ -59,6 +59,7 @@ document.head.appendChild(DomUtils.BuildElement("style", {
"#snippet>.ytd-text-inline-expander:not([id]){display:none;}" + // Better than nth-child
"#expand-sizer{display:none;}" +
"#ytd-watch-info-text{display:none;}" +
"#description-inner ytd-video-description-infocards-section-renderer,#description-inner ytd-reel-shelf-renderer{display:none;}" +
// Old pfp style
"#owner #avatar{width:48px;height:48px;max-width:48px;max-height:48px;margin-right:16px;}" +
"#owner #avatar>#img{width:48px;height:48px;max-width:48px;max-height:48px;}" +
Expand All @@ -75,7 +76,7 @@ document.head.appendChild(DomUtils.BuildElement("style", {
// Realign videos
"ytd-item-section-renderer.ytd-watch-next-secondary-results-renderer{margin-top:calc(0px - var(--ytd-item-section-item-margin));}" + // TODO: Force usage of margin-bottom instead of margin-top
// Chat things
(SeriStyleSettings.VideoPage.HidePremiere.Value ? "#chat.ytd-watch-flexy{display:none;}" : "#show-hide-button.ytd-live-chat-frame{margin-bottom:2px;}") +
(SeriStyleSettings.VideoPage.HidePremiere.Value ? "" : "#show-hide-button.ytd-live-chat-frame{margin-bottom:2px;}") +
// Force hide immersive
"#cinematics{display:none;}" +
// Fix playlist panel colors
Expand All @@ -92,6 +93,8 @@ document.head.appendChild(DomUtils.BuildElement("style", {
(SeriStyleSettings.VideoPage.ForceCentering.Value ? "#columns.ytd-watch-flexy{justify-content:center;}ytd-watch-flexy[flexy]:not([full-bleed-player][full-bleed-no-max-width-columns]) #columns.ytd-watch-flexy{max-width:unset;}" : "") +
// Force content padding, usually not needed
(FCP ? "#columns.ytd-watch-flexy{padding-left:" + FCP + "px;padding-right:" + FCP + "px;}" : "") + // I don't feel comfortable just enforcing padding to 0 without a reason. Same for verticals.
// Break lines for author
"#channel-name a.yt-simple-endpoint{white-space:break-spaces;}" +
// Hide donation shelves
(SeriStyleSettings.VideoPage.HideDonationShelves.Value ? "#donation-shelf{display:none;}" : "") +
(!SeriStyleSettings.Advanced.DisableHotfixes.Value ?
Expand All @@ -100,11 +103,11 @@ document.head.appendChild(DomUtils.BuildElement("style", {
//
""
: "") +
//
"" +
// Fix comment hover action menu
"ytd-comment-view-model#comment:not(:hover)>#body>#action-menu{visibility:hidden;}" +
//
""
).replaceAll(/(?<!!important);/g, "!important;"), // <3 yt
).replaceAll(/(?<!!important);/g, "!important;"),
"id": "seristyle-tf-videopage"
}));

Expand Down Expand Up @@ -202,21 +205,23 @@ $(SelBottomRow).prepend($(SelOwner));
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 = (x.className + " seristyle_subpanel seristyle_firstpanel").replace("yt-formatted-string ", "")), x))(Views),
(x => ((x.className += " seristyle_subpanel"), x))($(SelFullDate))
]));
} else {
console.log("[SeriStyle|Videopage] No view count found, video must be sponsored. Locking redirects.");
console.log("[SeriStyle|Videopage] No view count found, video is broken or otherwise limited. 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(/(?<!!important);/g, "!important;"), // <3 yt
).replaceAll(/(?<!!important);/g, "!important;"),
"id": "seristyle-tf-fucksponsorships"
}));
$("#title > ytd-badge-supported-renderer > div > span").innerText = "I AM CRINGE AND I WANT MONEY FOR MY CONTENT";
// Test here: https://www.youtube.com/watch?v=WLoDdPLiArA
// Test for false positives here: https://www.youtube.com/watch?v=aQvGIIdgFDM
if (_ = $("#title > ytd-badge-supported-renderer > div.badge-style-type-members-only > p")) _.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;
Expand Down

0 comments on commit 7e72959

Please sign in to comment.