`;
container.insertBefore(newElem,container.children[0]);
/*let href = newElem.querySelector(".yt-lockup-title a").href;
let id = href.split("/watch?v=")[1];
let data = {
abstractVorElement: {
navigationEndpoint: {
watchEndpoint: {
videoId: id,
canonicalBaseUrl: href
},
commandMetadata: {
webCommandMetadata: {
url: href
}
}
}
}
};
let authorHref = newElem.querySelector(".yt-user-name").href;
let authorId = authorHref.split("/channel/")[1];
let authorData = {
abstractVorElement: {
navigationEndpoint: {
browseEndpoint: {
browseId: authorId,
canonicalBaseUrl: authorHref
},
commandMetadata: {
webCommandMetadata: {
url: authorHref
}
}
}
}
};
newElem.querySelector(".yt-lockup-title a").data = data;
newElem.querySelector(".yt-lockup-thumbnail a").data = data;
newElem.querySelector(".yt-user-name").data = authorData;*/
}
function buildFeaturedList(Bdata, number) {
if ($(".c3-featured-list") == null) {
let container = $("#c3-content-items");
let newElem = document.createElement("div");
newElem.classList = "c3-featured-list";
newElem.innerHTML = `
`;
container.insertBefore(newElem,container.children[0]);
/*let featuredList = Bdata.horizontalListRenderer.items;
let newNumber = 0;
featuredList.forEach(i => {
if (i.gridVideoRenderer) {
buildFeaturedContent(i.gridVideoRenderer, "bigListVideo", umber);
}
newNumber++;
});*/
let newNumber = 0;
Bdata.forEach(i => {
if (i.richItemRenderer) {
createRenderer(i.richItemRenderer.content.videoRenderer, "bigListVideo", newNumber, Bdata.length);
}
newNumber++;
});
}
}
function buildFeaturedChannels(Bdata, number) {
if ($(".c3-featured-channels") == null) {
let title = Bdata.title.runs[0].text;
let list = Bdata.content.horizontalListRenderer.items;
let container = $("#c3-featured-channels-slot");
let newElem = document.createElement("div");
newElem.classList = "c3-featured-channels";
newElem.innerHTML = `
${title}
`;
container.insertBefore(newElem,container.children[0]);
let newNumber = 0;
list.forEach(i => {
if (i.gridChannelRenderer) {
createRenderer(i.gridChannelRenderer, "featuredChannel", newNumber);
}
newNumber++;
});
}
}
function buildFeaturedPlaylists(Bdata, number) {
if ($(".c3-featured-playlists") == null) {
let title = Bdata.title.runs[0].text;
let list = Bdata.content.horizontalListRenderer.items;
let container = $("#c3-featured-playlists-slot");
let newElem = document.createElement("div");
newElem.classList = "c3-featured-playlists";
newElem.innerHTML = `
${title}
`;
container.insertBefore(newElem,container.children[0]);
let newNumber = 0;
list.forEach(i => {
if (i.gridPlaylistRenderer) {
createRenderer(i.gridPlaylistRenderer, "featuredPlaylist", newNumber);
}
newNumber++;
});
}
}
function createRenderer(Bdata, renderer, number, length, extra, extra2) {
if (number == null) {
number = 0;
}
let i = Bdata;
if (renderer == "superCompactVideo") {
let pageVid = extra;
let currPage = extra2;
let container = $("#videos-dd-content");
let newElem = document.createElement("a");
newElem.classList = "super-compact-video sc-video";
newElem.setAttribute("page",currPage);
newElem.setAttribute("page-video",pageVid);
newElem.innerHTML = `
`;
container.insertBefore(newElem,container.children[number]);
let video = i.richItemRenderer.content.videoRenderer;
let title = video.title.runs[0].text;
let time = video.lengthText.simpleText;
let views = video.viewCountText.simpleText;
let date = video.publishedTimeText.simpleText;
let thumbl = video.thumbnail.thumbnails.length;
let thumb = video.thumbnail.thumbnails[thumbl - 1].url;
let nav = video.navigationEndpoint;
let href = "/watch?v=" + video.videoId;
newElem.href = href;
newElem.querySelector(".sc-video-title span").textContent = title;
newElem.querySelector(".sc-video-title").title = title;
newElem.querySelector(".sc-video-time span").textContent = time;
newElem.querySelector(".sc-video-view-count span").textContent = views;
newElem.querySelector(".sc-video-date span").textContent = date;
newElem.querySelector(".sc-video-thumbnail img").src = thumb;
newElem.data = {
abstractVorElement: {
navigationEndpoint: nav
}
}
}
if (renderer == "altWatch9SCVid") {
let id = i.navigationEndpoint.watchEndpoint.videoId;
let href = "/watch?v=" + id;
let date = i.publishedTimeText.simpleText;
let viewCount = i.viewCountText.simpleText;
let container = $("#watch9-owner-slider .scroller-inner");
let title = i.title.runs[0].text;
let time = i.lengthText.simpleText;
let thumbnail = i.thumbnail.thumbnails[2].url;
let newElem = document.createElement("li");
newElem.classList = "st-super-compact-video";
newElem.innerHTML = `
`;
if (gdp.currChan.sidebar.links) {
let linkNo = 0;
$("#c3-channel-links-slot").classList.remove("hid");
gdp.currChan.sidebar.links.forEach(i => {
let link = i.channelExternalLinkViewModel;
let container = $("#c3-channel-links-slot");
var newElem = document.createElement("div");
newElem.classList = "c3-channel-link-container";
newElem.innerHTML = `
`;
container.insertBefore(newElem, container.children[linkNo]);
linkNo++;
let title = link.title.content;
newElem.querySelector(".c3-channel-link-text span").textContent = title;
let url = link.link.content;
newElem.querySelector(".c3-channel-link").setAttribute("href","https://" + url);
let icon;
if (link.favicon) {
icon = link.favicon.sources[2].url;
newElem.querySelector(".c3-channel-link img").setAttribute("src",icon);
}
});
}
if (gdp.currChan.currPage == "videos") {
$("#c3-content-header").innerHTML = `
`;
}
if (gdp.currChan.sidebar.country != null) {
$("#c3-location").classList.remove("hid");
}
}
var aion = getSapisidhash();
let refreshCheck = 0;
if ($(".v3")) {
doStarTube();
} else if (STS.polymerWarningBanner == false) {
doStarTube();
} else if (STS.polymerWarningBanner == true) {
setTimeout(function() {
if ($(".v3")) {
doStarTube();
} else if ($("ytd-app")) {
doBanner();
}
}, 1000);
}
function doStarTube() {
document.addEventListener("V3_NAVITRONIC_FINISHED", function(e) {
refreshCheck = 0;
everyLoad("x");
checkContentMargin();
setTimeout(checkContentMargin, 500);
setTimeout(checkContentMargin, 1500);
setTimeout(checkContentMargin, 2500);
setTimeout(checkContentMargin, 3000);
});
document.addEventListener("V3_NAVITRONIC_STARTED", function(e) {
setTimeout(checkContentMargin, 500);
setTimeout(checkContentMargin, 1500);
deleteTitleOnTop();
});
window.addEventListener("resize", function() {
checkContentMargin();
});
everyLoad("x");
setTimeout(createThirdColumn, 2000);
checkContentMargin();
function checkContentMargin() {
if (
$("#content") &&
$("[static] #appbar-guide-menu")
) {
var rock = $("#content").getBoundingClientRect();
$("#appbar-guide-menu").style.left = rock.left + "px";
$("html").style.setProperty("--guide-left",rock.left + "px");
if ($("#masthead-positioner")) {
var stone = $("#masthead-positioner").getBoundingClientRect();
$("#appbar-guide-menu").style.top = stone.height + "px";
$("html").style.setProperty("--guide-top",stone.height + "px");
}
$("#appbar-guide-menu").style.height = rock.height - 20 + "px";
$("html").style.setProperty("--guide-height",rock.height - 20 + "px");
}
}
setTimeout(everyLoad, 1000); // sometimes 's attributes "reset" halfway through loading, causing some settings to not apply, this should correct that when it happens. Done twice until I find a better way to do it.
setTimeout(everyLoad, 3000);
setTimeout(everyLoad, 6000);
setTimeout(everyLoad, 10000);
setTimeout(everyLoad, 15000);
setTimeout(everyLoad, 20000);
setTimeout(checkContentMargin, 1500);
setTimeout(checkContentMargin, 3000);
var elm = "#page";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
if (STS.expMoveGuideMainSectionToTop == true) {
var elm = ".guide-section";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
var guideSection0 = document.querySelectorAll(".guide-section")[1];
var guideSection1 = document.querySelectorAll(".guide-section")[0];
var guideSection2 = document.querySelectorAll(".guide-section")[2];
var guideSection3 = document.querySelectorAll(".guide-section")[3];
var newHome = document.querySelector('.guide-toplevel');
newHome.appendChild(guideSection0);
newHome.appendChild(guideSection1);
newHome.appendChild(guideSection2);
newHome.appendChild(guideSection3);
}
});
}
}
});
var interval = setInterval(function() {
if (STS.expViewsString == true) {
if ($(".watch-view-count") != null) {
if (!$(".watch-view-count").textContent.includes('view') && !$(".watch-view-count").textContent.includes('wa')) {
var tC = $(".watch-view-count").textContent;
$(".watch-view-count").textContent = tC + " views";
}
}
}
}, 500);
setTimeout(interval, 10);
function createWelcomeAlert() {
let container = document.querySelector("#alerts");
var newElem = document.createElement("div");
newElem.id = "st-welcome-alert";
newElem.innerHTML = `
Welcome to the StarTube Beta! Note that stability is not guaranteed with this release, and things can break. If you want to use the regular version of StarTube, click here.
“${gdp.searchValue}”results 1 - 20 of about ${gdp.resultCount}
`;
container.insertBefore(newElem,container.children[0]);
}
}
if ($("#page.all_comments")) {
$("html").setAttribute("location","comments");
if($("#stargazer-header")){
if($(".stargazer-tab.active")){
$(".stargazer-tab.active").classList.remove("active");
}
$("#stargazer-community.stargazer-tab").classList.add("active");
}
}
if ($("#page.watch")) {
$("html").setAttribute("location","watch");
if($("#stargazer-header")){
if($(".stargazer-tab.active")){
$(".stargazer-tab.active").classList.remove("active");
}
$("#stargazer-videos.stargazer-tab").classList.add("active");
}
if (window.location.href.includes("&list")) {
var elm = "#watch7-playlist-data";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
reconstructPlaylist();
}
});
}
}
if ($("#page.channel")) {
if($("#stargazer-header")){
if($(".stargazer-tab.active")){
$(".stargazer-tab.active").classList.remove("active");
}
$("#stargazer-channels.stargazer-tab").classList.add("active");
}
$("html").setAttribute("location","channel");
$("html").setAttribute("channel-location","home");
if (window.location.href.includes("/feed")) {
$("html").setAttribute("channel-location","feed");
}
if (window.location.href.includes("/videos")) {
$("html").setAttribute("channel-location","videos");
}
if (window.location.href.includes("/playlists")) {
$("html").setAttribute("channel-location","playlists");
}
if (window.location.href.includes("/community")) {
$("html").setAttribute("channel-location","backstage");
}
if (window.location.href.includes("/about")) {
$("html").setAttribute("channel-location","about");
}
if (window.location.href.includes("/search")) {
$("html").setAttribute("channel-location","search");
}
grabChannelData(x);
if (STS.expPolymerChannels == true) {
if ($(".channel-header-profile-image-container")) {
var theBtn = document.querySelector(".channel-header-profile-image-container");
var newHome = document.querySelector('#c4-primary-header-contents');
newHome.insertBefore(theBtn, newHome.children[2]);
} else {
var elm = ".channel-header-profile-image-container";
waitForElement10(elm).then(function(elm) {
if (canGo != false && $("#page.channel")) {
var theBtn = document.querySelector(".channel-header-profile-image-container");
var newHome = document.querySelector('#c4-primary-header-contents');
newHome.insertBefore(theBtn, newHome.children[2]);
}
});
}
}
if (STS.expPolymerChannels == true) {
if ($(".yt-subscription-button-subscriber-count-branded-horizontal") && $(".startube-poly-sub-count") == null) {
var theBtn = document.querySelector(".yt-subscription-button-subscriber-count-branded-horizontal");
theBtn.textContent = theBtn.textContent + " subscribers";
var newHome = document.querySelector('.branded-page-header-title');
newHome.insertBefore(theBtn, newHome.children[0]);
theBtn.classList.add("startube-poly-sub-count");
} else {
var elm = ".yt-subscription-button-subscriber-count-branded-horizontal";
waitForElement10(elm).then(function(elm) {
if (canGo != false && $(".startube-poly-sub-count") == null && $("#page.channel")) {
var theBtn = document.querySelector(".yt-subscription-button-subscriber-count-branded-horizontal");
theBtn.textContent = theBtn.textContent + " subscribers";
var newHome = document.querySelector('.branded-page-header-title');
newHome.insertBefore(theBtn, newHome.children[0]);
theBtn.classList.add("startube-poly-sub-count");
}
});
}
}
if (STS.expHomeTab == true) {
setTimeout(function() {
if ($(".startube-tab") == null) {
if ($(".epic-nav-item-empty.selected")) {
$(".epic-nav-item-empty.selected").parentNode.id = "channel-main-tab";
let container = $("#channel-navigation-menu");
let newElem = document.createElement("li");
newElem.setAttribute("class","startube-tab");
newElem.innerHTML = `
Home
`;
container.insertBefore(newElem, container.children[0]);
} else if ($("#channel-navigation-menu .epic-nav-item-empty.selected") == null) {
var elm = "#channel-navigation-menu li:nth-child(1) a";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
if ($("#channel-navigation-menu .epic-nav-item-empty.selected") == null) {
let navData = $("#channel-navigation-menu li a").data;
let navUrl = $("#channel-navigation-menu li a").getAttribute("href");
let container = $("#channel-navigation-menu");
let newElem = document.createElement("li");
newElem.setAttribute("class","startube-tab");
newElem.innerHTML = `
Home
`;
container.insertBefore(newElem, container.children[0]);
newElem.data = navData;
}
}
});
}
}
}, 250);
}
} else {
if ($("[channel-location]")) {
$("html").removeAttribute("channel-location");
}
}
if ($("#page.search")) {
$("html").setAttribute("location","search");
}
if (STS.expLogoLinksToFeed == true && $("#logo-container")) {
$("#logo-container").href = "/feed/what_to_watch/recommended";
$("#logo-container").data = {
abstractVorElement: {
navigationEndpoint: {
browseEndpoint: {
browseId: "FEwhat_to_watch",
canonicalBaseUrl: "/feed/what_to_watch/recommended"
},
commandMetadata: {
webCommandMetadata: {
url: "/feed/what_to_watch/recommended"
}
}
}
}
}
}
if (STS.expLogoLinksToSubs == true && $("#logo-container")) {
$("#logo-container").href = "/feed/subscriptions";
$("#logo-container").data = {
abstractVorElement: {
navigationEndpoint: {
browseEndpoint: {
browseId: "FEsubscriptions",
canonicalBaseUrl: "/feed/subscriptions"
},
commandMetadata: {
webCommandMetadata: {
url: "/feed/subscriptions"
}
}
}
}
}
}
var arraNum = 0;
arra.forEach(itemRoot => {
let name = itemRoot[0];
checkSetting(name).then(function(value) {
if (value == true && name == "configAccountMenuV3SettingsButton") {
$("html").setAttribute("config-account-menu-v3-settings-button", "");
createMESettingsBtn();
} else if (value == true && name == "configPolymerMenuV3SettingsButton") {
$("html").setAttribute("config-polymer-menu-v3-settings-button", "");
} else if (value == true && name == "configCreateMenuV3SettingsButton") {
$("html").setAttribute("config-create-menu-v3-settings-button", "");
} else if (value == true && name == "expAdaptiveLayout") {
$("html").setAttribute("exp-adaptive-layout", "");
} else if (value == true && name == "expRelatedThumbsSizeMedium") {
$("html").setAttribute("exp-related-thumbs-size-medium", "");
} else if (value == true && name == "expRelatedThumbsSizeLarge") {
$("html").setAttribute("exp-related-thumbs-size-large", "");
} else if (value == true && name == "expRelatedThumbsSizeStupid") {
$("html").setAttribute("exp-related-thumbs-size-stupid", "");
} else if (value == true && name == "configNoTabTopBorder") {
$("html").setAttribute("config-no-tab-top-border", "");
} else if (value == true && name == "configWatch7SidebarCardShadow") {
$("html").setAttribute("config-watch7-sidebar-card-shadow", "");
} else if (value == true && name == "expRelatedTabs") {
$("html").setAttribute("exp-related-tabs", "");
createRelatedTabsPrep();
} else if (value == true && name == "expRelatedTabsHoldsSubscribe") {
$("html").setAttribute("exp-related-tabs-holds-subscribe", "");
} else if (value == true && name == "expWatch9") {
$("html").setAttribute("exp-watch9", "");
createWatch9Prep();
} else if (value == true && name == "expWatch9NoOwner") {
$("html").setAttribute("exp-watch9-no-owner", "");
} else if (value == true && name == "expWatch9TrueExpander") {
$("html").setAttribute("exp-watch9-true-expander", "");
} else if (value == true && name == "expVerticalWatch9") {
$("html").setAttribute("exp-vertical-watch9", "");
} else if (value == true && name == "expWatch9SidebarBus") {
$("html").setAttribute("exp-watch9-sidebar-bus", "");
} else if (value == true && name == "expWatch9StickyColumns") {
$("html").setAttribute("exp-watch9-sticky-columns", "");
} else if (value == true && name == "expWatch9ReportTab") {
$("html").setAttribute("exp-watch9-report-tab", "");
} else if (value == true && name == "expGuideAlwaysPinned") {
guideAlwaysPinned();
} else if (value == true && name == "expWatch8") {
$("html").setAttribute("exp-watch8", "");
createWatch8Prep();
} else if (value == true && name == "expWatch8NoMore") {
$("html").setAttribute("exp-watch8-no-more", "");
} else if (value == true && name == "expSharrow") {
$("html").setAttribute("exp-sharrow", "");
} else if (value == true && name == "expAlwaysShowCompactDate") {
$("html").setAttribute("exp-always-show-compact-date", "");
} else if (value == true && name == "expNeverShowCompactDate") {
$("html").setAttribute("exp-never-show-compact-date", "");
} else if (value == true && name == "expTwoColumnSearchResults") {
$("html").setAttribute("exp-two-column-search-results", "");
} else if (value == true && name == "expRelatedGrid") {
$("html").setAttribute("exp-related-grid", "");
} else if (value == true && name == "expMoveGuideButtonToTopbar") {
$("html").setAttribute("exp-move-guide-button-to-topbar", "");
moveGuideButtonToTopbar();
} else if (value == true && name == "expMoveCountsToButtons") {
$("html").setAttribute("exp-move-counts-to-buttons", "");
moveCountsToButtons();
} else if (value == true && name == "expMoreTooltips") {
$("html").setAttribute("exp-more-tooltips", "");
createMoreTooltips();
} else if (value == true && name == "expFlatLogo") {
$("html").setAttribute("exp-flat-logo", "");
} else if (value == true && name == "expInvertLogo") {
$("html").setAttribute("exp-invert-logo", "");
} else if (value == true && name == "expGlossyLogo") {
$("html").setAttribute("exp-glossy-title", "");
} else if (value == true && name == "expClassicTitle") {
$("html").setAttribute("exp-classic-title", "");
} else if (value == true && name == "expClassicGuide") {
$("html").setAttribute("exp-classic-guide", "");
} else if (value == true && name == "expClassicSubscribe") {
$("html").setAttribute("exp-classic-subscribe", "");
} else if (value == true && name == "expClassicStyles") {
$("html").setAttribute("exp-classic-styles", "");
} else if (value == true && name == "expClassicLtod") {
$("html").setAttribute("exp-classic-ltod", "");
} else if (value == true && name == "expClassicButtons") {
$("html").setAttribute("exp-classic-buttons","");
} else if (value == true && name == "expBigSearchThumbs") {
$("html").setAttribute("exp-big-search-thumbs","");
} else if (value == true && name == "expBiggerSearchThumbs") {
$("html").setAttribute("exp-bigger-search-thumbs","");
} else if (value == true && name == "expNoVideosLink") {
$("html").setAttribute("exp-no-videos-link","");
} else if (value == true && name == "expSkinnySubscribe") {
$("html").setAttribute("exp-skinny-subscribe","");
} else if (value == true && name == "expModernStyles") {
$("html").setAttribute("exp-modern-styles", "");
changeCommentPlaceholder(0);
changeCommentHeader(0);
} else if (value == true && name == "expModernCards") {
$("html").setAttribute("exp-modern-cards", "");
} else if (value == true && name == "expLightChannelBar") {
$("html").setAttribute("exp-light-channel-bar", "");
} else if (value == true && name == "expModernNotifIcon") {
$("html").setAttribute("exp-modern-notif-icon", "");
} else if (value == true && name == "expModernTopbar") {
$("html").setAttribute("exp-modern-topbar", "");
} else if (value == true && name == "expModernUpload") {
$("html").setAttribute("exp-modern-upload", "");
} else if (value == true && name == "expModernGuideButton") {
$("html").setAttribute("exp-modern-guide-button", "");
} else if (value == true && name == "expModernSearchIcon") {
$("html").setAttribute("exp-modern-search-icon", "");
} else if (value == true && name == "expSearchText") {
$("html").setAttribute("exp-search-text", "");
createSearchText();
} else if (value == true && name == "expModernTitle") {
$("html").setAttribute("exp-modern-title", "");
} else if (value == true && name == "expModernGuide") {
$("html").setAttribute("exp-modern-guide", "");
doModernGuide();
} else if (value == true && name == "expModernHome") {
$("html").setAttribute("exp-modern-home", "");
} else if (value == true && name == "expModernPlaylists") {
$("html").setAttribute("exp-modern-playlists", "");
} else if (value == true && name == "expModernPlaylistThumbnails") {
$("html").setAttribute("exp-modern-playlist-thumbnails", "");
} else if (value == true && name == "expPlaylistRedBorder") {
$("html").setAttribute("exp-playlist-red-border", "");
} else if (value == true && name == "expPlaylistTimestamps") {
$("html").setAttribute("exp-playlist-timestamps", "");
} else if (value == true && name == "expTrueScrollableGuide") {
$("html").setAttribute("exp-true-scrollable-guide", "");
doScrollableGuide();
} else if (value == true && name == "expModernPlayer") {
$("html").setAttribute("exp-modern-player", "");
doModernPlayer();
} else if (value == true && name == "expModernPlayerV2") {
$("html").setAttribute("exp-modern-player", "");
$("html").setAttribute("exp-modern-player-v2", "");
doModernPlayer();
} else if (value == true && name == "expGoogleApps") {
$("html").setAttribute("exp-google-apps", "");
createGoogleApps();
} else if (value == true && name == "expCommentsFullWidth") {
$("html").setAttribute("exp-comments-full-width", "");
} else if (value == true && name == "expNoByText") {
$("html").setAttribute("exp-no-by-text", "");
} else if (value == true && name == "expAccountMenu") {
$("html").setAttribute("exp-account-menu", "");
createAccountMenu();
}else if (value == true && name == "expStaticSite") {
$("html").setAttribute("static", "");
} else if (value == true && name == "expHideAppbar") {
$("html").setAttribute("hide-appbar", "");
} else if (value == true && name == "expEpicWatch7") {
$("html").setAttribute("exp-epic-watch7", "");
} else if (value == true && name == "expEpicWatch7Flat") {
$("html").setAttribute("exp-epic-watch7-flat", "");
} else if (value == true && name == "expEpicHeader") {
$("html").setAttribute("topbar", "epic");
} else if (value == true && name == "expEpicStyling") {
$("html").setAttribute("exp-epic-styling", "");
} else if (value == true && name == "expEpicFeeds") {
$("html").setAttribute("exp-epic-feeds", "");
doCosmicFeedHeader();
} else if (value == true && name == "expCosmicHeader") {
$("html").setAttribute("topbar", "cosmic");
} else if (value == true && name == "expCosmicBG") {
$("html").setAttribute("cosmic-bg", "");
} else if (value == true && name == "expCosmicButtons") {
$("html").setAttribute("cosmic-buttons", "");
} else if (value == true && name == "expCosmicStyles") {
$("html").setAttribute("cosmic-styles", "");
} else if (value == true && name == "expCosmicBanners") {
$("html").setAttribute("exp-cosmic-banners", "");
} else if (value == true && name == "expCosmicBannersV2") {
$("html").setAttribute("exp-cosmic-banners-v2", "");
} else if (value == true && name == "expCosmicBannersV2") {
$("html").setAttribute("exp-cosmic-banners-v2", "");
} else if (value == true && name == "expCosmicComments") {
$("html").setAttribute("exp-legacy-comments", "");
$("html").setAttribute("exp-cosmic-comments", "");
} else if (value == true && name == "expCosmicGuideLayout") {
$("html").setAttribute("exp-cosmic-guide-layout", "");
createCosmicGuide();
} else if (value == true && name == "expCosmicGuideStyle") {
$("html").setAttribute("exp-cosmic-guide-style", "");
} else if (value == true && name == "expCosmicFeedsV1") {
$("html").setAttribute("exp-cosmic-feeds-v1", "");
doCosmicFeedHeader();
} else if (value == true && name == "expCosmicFeedsV2") {
$("html").setAttribute("exp-cosmic-feeds-v2", "");
doCosmicFeedHeader();
} else if (value == true && name == "expCosmicFeedsV3") {
$("html").setAttribute("exp-cosmic-feeds-v3", "");
doCosmicFeedHeader();
} else if (value == true && name == "expCosmicFeedsThirdColumn") {
$("html").setAttribute("exp-cosmic-feeds-third-column", "");
doThirdColumnVideosPrep();
} else if (value == true && name == "expWatch5D") {
$("html").setAttribute("exp-watch5d", "");
createWatch5Prep();
} else if (value == true && name == "expNotifSquare") {
$("html").setAttribute("notif-square", "");
} else if (value == true && name == "expChannels3" && !window.location.href.includes("force-c4")) {
$("html").setAttribute("exp-channels3","");
createChannels3Prep();
} else if (value == true && name == "expChannels3BGVerticalRepeat" && !window.location.href.includes("force-c4")) {
$("html").setAttribute("exp-channels3-bg-vertical-repeat","");
} else if (value == true && name == "expChannels3BGHorizontalRepeat" && !window.location.href.includes("force-c4")) {
$("html").setAttribute("exp-channels3-bg-horizontal-repeat","");
} else if (value == true && name == "expChannels3TimeVisible") {
$("html").setAttribute("exp-channels3-time-visible","");
} else if (value == true && name == "expChannels3DateVisible") {
$("html").setAttribute("exp-channels3-date-visible","");
} else if (value == true && name == "expChannels3DateHidden") {
$("html").setAttribute("exp-channels3-date-hidden","");
} else if (value == true && name == "expNoGuide") {
$("html").setAttribute("guide", "no");
} else if (value == true && name == "expGuideOnFeedsOnly") {
$("html").setAttribute("guide", "feeds");
} else if (value == true && name == "expAozoraHome") {
$("html").setAttribute("exp-aozora-home", "");
} else if (value == true && name == "expAozoraHeader") {
$("html").setAttribute("exp-aozora-header", "");
searchButtonLowercase();
} else if (value == true && name == "expAozoraBG") {
$("html").setAttribute("exp-aozora-bg", "");
} else if (value == true && name == "expAozoraStyles") {
$("html").setAttribute("exp-aozora-styles", "");
} else if (value == true && name == "expAozoraComments") {
$("html").setAttribute("exp-legacy-comments", "");
$("html").setAttribute("exp-aozora-comments", "");
} else if (value == true && name == "expAozoraSubscribe") {
$("html").setAttribute("exp-aozora-subscribe", "");
} else if (value == true && name == "expAozoraTopbarLinks") {
$("html").setAttribute("exp-aozora-topbar-links", "");
createAozoraTopbarLinks();
} else if (value == true && name == "expAozoraSearch") {
$("html").setAttribute("exp-aozora-search", "");
} else if (value == true && name == "expWatch5C") {
$("html").setAttribute("exp-watch5d", "");
$("html").setAttribute("exp-watch5c", "");
createWatch5Prep();
} else if (value == true && name == "expStargazerTabbedHeader") {
$("html").setAttribute("stargazer-header", "tabbed");
stargazerHeader(0);
searchButtonLowercase();
} else if (value == true && name == "expStargazerBarHeader") {
$("html").setAttribute("stargazer-header", "bar");
stargazerHeader(1);
searchButtonLowercase();
} else if (value == true && name == "expStargazerSimpleHeader") {
$("html").setAttribute("stargazer-header", "simple");
stargazerHeader(2);
searchButtonLowercase();
} else if (value == true && name == "expStargazerSubscribe") {
$("html").setAttribute("stargazer-sub","");
} else if (value == true && name == "expHomeTab") {
$("html").setAttribute("exp-home-tab", "");
} else if (value == true && name == "expRoboto") {
$("html").setAttribute("exp-roboto", "");
} else if (value == true && name == "expCenteredSearch") {
$("html").setAttribute("exp-centered-search", "");
} else if (value == true && name == "expBigSearch") {
$("html").setAttribute("exp-big-search", "");
} else if (value == true && name == "expSecondarySearchIcon") {
$("html").setAttribute("exp-secondary-search-icon", "");
createSearchTumor();
} else if (value == true && name == "expMaterialSearch") {
$("html").setAttribute("exp-material-search", "");
createSearchIcon();
} else if (value == true && name == "expPolymerAccountMenu") {
$("html").setAttribute("exp-account-menu", "");
$("html").setAttribute("exp-polymer-account-menu", "");
createAccountMenu();
} else if (value == true && name == "expPolymerShell") {
$("html").setAttribute("exp-polymer-shell", "");
createSearchIcon();
createNotifIcon();
} else if (value == true && name == "expEarlyPolymerShell") {
$("html").setAttribute("exp-polymer-shell", "");
$("html").setAttribute("exp-early-polymer-shell", "");
createNotifIcon();
} else if (value == true && name == "expEarlyPolymerGuide") {
$("html").setAttribute("exp-early-polymer-guide", "");
} else if (value == true && name == "expPolymerGen2Colors") {
$("html").setAttribute("exp-polymer-gen2-colors", "");
} else if (value == true && name == "expPolymerSubscribe") {
$("html").setAttribute("exp-polymer-subscribe", "");
} else if (value == true && name == "expPolymerGen2Subscribe") {
$("html").setAttribute("exp-polymer-subscribe", "");
$("html").setAttribute("exp-polymer-gen2-subscribe", "");
} else if (value == true && name == "expPolymerStyles") {
$("html").setAttribute("exp-polymer-styles", "");
changeCommentPlaceholder(1);
changeCommentHeader(1);
} else if (value == true && name == "expBetaPolymerStyles") {
$("html").setAttribute("exp-beta-polymer-styles", "");
} else if (value == true && name == "expPolymerChannels") {
$("html").setAttribute("exp-polymer-channels", "");
} else if (value == true && name == "expColorfulChannels") {
$("html").setAttribute("exp-colorful-channels", "");
} else if (value == true && name == "expPolymerComments") {
$("html").setAttribute("exp-polymer-comments", "");
} else if (value == true && name == "expPolymerTooltips") {
$("html").setAttribute("exp-polymer-tooltips", "");
} else if (value == true && name == "expTopbarShadow") {
$("html").setAttribute("exp-topbar-shadow", "");
} else if (value == true && name == "expMaterialSignIn") {
$("html").setAttribute("exp-material-sign-in", "");
} else if (value == true && name == "expRichGridHome") {
$("html").setAttribute("exp-rich-grid-home", "");
doRichGridHome();
} else if (value == true && name == "expWatch9A") {
$("html").setAttribute("exp-watch9a", "");
createRealWatch9Prep();
} else if (value == true && name == "expWatch9B") {
$("html").setAttribute("exp-watch9b", "");
createRealWatch9Prep();
} else if (value == true && name == "expWatch10Beta") {
$("html").setAttribute("exp-watch10-beta", "");
createWatch10Prep();
} else if (value == true && name == "expWatch10") {
$("html").setAttribute("exp-watch10", "");
createWatch10Prep();
} else if (value == true && name == "expSegmentedLtod") {
$("html").setAttribute("exp-segmented-ltod", "");
} else if (value == true && name == "expRoundedSubscribe") {
$("html").setAttribute("exp-rounded-subscribe", "");
} else if (value == true && name == "expBlackSubscribe") {
$("html").setAttribute("exp-black-subscribe", "");
} else if (value == true && name == "expWMRButtonsLowercase") {
$("html").setAttribute("exp-wmr-buttons-lowercase", "");
} else if (value == true && name == "expWMRAddTo") {
$("html").setAttribute("exp-wmr-addto", "");
} else if (value == true && name == "expWMRNoSaveText") {
$("html").setAttribute("exp-wmr-no-save-text", "");
} else if (value == true && name == "expWMRNoShareText") {
$("html").setAttribute("exp-wmr-no-share-text", "");
} else if (value == true && name == "expOutlineIcons") {
$("html").setAttribute("exp-outline-icons", "");
} else if (value == true && name == "expRoundedTopbarPfp") {
$("html").setAttribute("exp-rounded-topbar-pfp", "");
} else if (value == true && name == "expUploadIcon") {
$("html").setAttribute("exp-upload-icon", "");
createUploadIcon();
} else if (value == true && name == "expCreateIcon") {
$("html").setAttribute("exp-create-icon", "");
createCreateIcon();
} else if (value == true && name == "expYouTubeApps") {
$("html").setAttribute("exp-youtube-apps", "");
createYouTubeApps();
} else if (value == true && name == "expRingo2") {
$("html").setAttribute("exp-ringo2", "");
} else if (value == true && name == "exp2024Favicon") {
$("html").setAttribute("exp-2024-favicon", "");
replaceFavicon("2024");
} else if (value == true && name == "exp2017Favicon") {
$("html").setAttribute("exp-2017-favicon", "");
replaceFavicon("2017");
} else if (value == true && name == "exp2015Favicon") {
$("html").setAttribute("exp-2015-favicon", "");
replaceFavicon("2015");
} else if (value == true && name == "exp2012Favicon") {
$("html").setAttribute("exp-2012-favicon", "");
replaceFavicon("2012");
} else if (value == true && name == "exp2010Favicon") {
$("html").setAttribute("exp-2010-favicon", "");
replaceFavicon("2010");
} else if (value == true && name == "exp2005Favicon") {
$("html").setAttribute("exp-2005-favicon", "");
replaceFavicon("2005");
} else if (value == true && name == "expHideYoodles") {
$("html").setAttribute("exp-hide-yoodles", "");
hideYoodles();
} else if (value == true && name == "expFixedShareIcons") {
$("html").setAttribute("exp-fixed-share-icons", "");
} else if (value == true && name == "expFixedXIcon") {
$("html").setAttribute("exp-fixed-x-icon", "");
} else if (value == true && name == "expMaterialGbar") {
$("html").setAttribute("exp-material-gbar", "");
}
});
});
refreshCheck++;
if (
$("#startube-new-settings-popup") === null &&
STS.show2point3 == true
) {
let container76 = document.querySelector('.spitfire-body-container.v3');
let newElem76 = document.createElement("div");
newElem76.id = "startube-new-settings-popup";
newElem76.innerHTML = `
What's new in StarTube 2.3.0
Quality of life improvements
Many QoL improvements have been made, such as a more accurate 2014 layout, the videos dropdown on the 2011 & 2012 layouts, more accurate right click menu on the 2016-2020 player, as well as most layouts being more accurate overall.
Experimental new layout options
Unfinished versions of the Stargazer layouts have been added, as well as a more accurate version of Epic Panda.
`;
container76.insertBefore(newElem76, container76.children[0]);
$("#close-startube-new-settings-popup").addEventListener("click", function() {
$("#startube-new-settings-popup").remove();
STS.show2point3 = false;
applySettings(0);
$("html").setAttribute("no-startube-popup","");
var elm = "#show2point3";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
$("#show2point3").setAttribute("checked","false");
}
});
});
}
}
function createOOBEAccessBtn() {
let container = document.querySelector('.jfk-oobe-page .tabs');
//let container = document.querySelector('#yt-masthead-content');
var newElem = document.createElement("span");
newElem.id = "st-settings-button";
newElem.classList = "tab startube-show-svgs startube-oobe-access-btn";
newElem.innerHTML = `
Your changes were automatically saved. Refresh the page for them to apply.
Misc
Config
Site
Layout
Misc
Topbar
Guide
Player
Watch page
Channel page
Advanced
Config
General site layout options.
Config overview
Config is from StarTube version ${STS.importantInfo.startubeVersion}
Config is from the ${STS.importantInfo.startubeChannel} channel
Reset config
Turn off all StarTube options (will not affect locked settings)
Layout
General site layout options.
Layout mode
Manual
Adaptive
Adaptive layout is on. Switch to manual layout mode to choose your layout.
Layout select
Custom (don't enforce any specific layout, ideal for making use of V3's config options)
Polymer
2022
2021
2020
2019
2018
2017
2016 (prototype layout)
Hitchhiker
2024 (unofficial legacy layout, uses the experimental "Ringo2" rebrand)
2018-2020 (legacy layout)
2017 (legacy layout)
Early 2017
Late 2016
Mid 2016
Early 2016
2015
Early 2015
2014
Late 2013
Mid 2013
Early 2013
Epic Panda (prototype layout)
Mid-Late 2012 (prototype layout)
Mid-Late 2012 (prototype layout, custom ver)
Cosmic Panda
Late 2012
Mid 2012
Early 2012
Aozora
2011
Stargazer
Late 2009
Very unfinished
Early 2009
Very unfinished
2008
Very unfinished
Misc
General site layout options.
Favicon select
Choose which little icon appears on the tabs. Note that these don't work 100% of the time.
Auto
2024
2017-2024
2015-2017
2012-2015 (V3 default)
2010-2011
2005-2010
Topbar
General site layout options.
Gbar version
Use the modern Gbar on all layouts.
Use the classic Gbar on all layouts.
Use the material Gbar on all layouts.
Always off
None of the above; do not allow StarTube to change V3's Gbar settings (will not undo previous changes made by StarTube)
Account menu
Auto
Masthead Expanded (2014 and earlier)
Hitchhiker Menu (2015 onwards Hitchhiker layouts)
Polymer Menu (2017-present)
Guide
Guide (left sidebar) options.
Guide item link
Choose whether channel links on the guide (left sidebar) take you to their channel, or their feed. [This setting just changes the existing V3 setting GUIDE_NAVIGATE_TO_CHANNEL_FEED.]
Auto
Channel
Feed (V3 default)
Guide always pinned
Keep the guide visible on all pages, including the watch page. Only affects layouts from 2014 and later.
On
Off
Player
General site layout options.
Player version
Automatically decide based on layout
2016-2020
2015-2016
2013-2015 (V3 default)
Flash7
Embed Player (use this if the player isn't working)
None of the above; do not allow StarTube to change V3's player settings (will not undo previous changes made by StarTube)
Player size
Choose the set of player sizes to use across different resolutions.
Auto (stable)
Sticks to the basic V3 player sizes. If you don't want bugs, use this
Auto (high accuracy, less stable)
More accurate, but uses the custom player sizes, and therefore breaks theater mode on most layouts
Non-flexwatch [always 640x360]
Flexwatch Mini (V3 default)
Flexwatch Mini Version 2 (~2015 onwards) [Same player sizes, but they happen at different resoltions]
Breaks theater mode
Flexwatch Medium (Custom, bigger sizes) [640x360, 1024x576, 1600x900]
Breaks theater mode
Flexwatch Large (Custom, even bigger sizes, closer to modern YouTube) [854x480, 1280x720, 1920x1080]
Breaks theater mode
Watch page
General site layout options.
Watch layout select
Auto
Auto (use alt-watch9 for Hitchhiker layouts)
Alt-watch9 (works best on the hitchhiker layouts)
Fancy Alt-watch9 (works best on the hitchhiker layouts)
Related tabs
A component of alt-watch9 that can also be used in other layouts. If you disable this while using alt-watch9, you will get alt-watch9's original three-column layout.
Auto (only enabled when alt-watch9 is enabled)
On
On (don't move subscribe button)
Off
Related grid
On (only works with 2013 and later)
Off
Related video size
Auto
Small (2012-2016)
Medium (custom middleground)
Large (2016-present)
Huge (based on a Polymer experiment)
Show dates on related videos
Auto
Always show
Show on hover (V3 default)
Never show
Channel page
General site layout options.
Channel version
Auto
Channels4 (2013-present)
Channels3 (Late 2011-Early 2013)
Colorful channels
Makes the rest of the page use the colors of the channel banner. Only works with Channels4.
Auto (on for 2016 Polymer)
Auto (on for all Polymer layouts)
On
On (V3 implementation, doesn't change the guide or topbar)
Off
Advanced
Show all settings
Locked settings
Unlocked settings
Advanced configuration. If you change a setting here, you will most likely need to lock it, or else the setting will be overwritten.
`;
container.insertBefore(newElem, container.children[1]);
let dump = $("#startube-microconfigs-dump");
let number = 1;
ScF.forEach(i => {
let settingElem = document.createElement("div");
settingElem.id = i[1].name;
settingElem.classList = "astro-setting astro-checkbox-setting";
settingElem.setAttribute("hide","false");
settingElem.innerHTML = `
`;
dump.insertBefore(settingElem, dump.children[number - 1]);
settingElem.querySelector(".astro-setting-title span").textContent = i[1].name;
settingElem.querySelector(".astro-setting-desc span").innerHTML = i[1].description;
settingElem.setAttribute("value",i[1].value);
settingElem.setAttribute("iron",i[1].locked);
if (i[1].locked == true) {
settingElem.querySelector(".astro-lock").title = "This setting is locked. Click to unlock it.";
}
number++;
});
$("#downloadJSON").addEventListener("click", function() {
createJSON();
});
$("#astro-v3-settings-access-btn").addEventListener("click", openV3Settings);
$("#cancelJSON").addEventListener("click", function() {
$("#startube-settings-window").setAttribute("loading-config","false");
});
$("#json-upload").addEventListener("cancel", () => {
$("#startube-settings-window").setAttribute("loading-config","false");
});
$("#json-upload").addEventListener("change", () => {
$("#startube-settings-window").setAttribute("loading-config","true");
});
$("#st-load-file button").addEventListener("click", function() {
if ($("#st-load-file input").files[0]) {
var theFile = $("#st-load-file input").files[0].type;
if (theFile == "application/json") {
var file = $("#st-load-file input").files[0];
actionFile(file);
} else {
alert("Invalid file type. Please upload a JSON file.");
}
} else {
alert("Please select a file.");
}
});
$("#RTD").addEventListener("click", function() {
localStorage.removeItem(theSets);
localStorage.removeItem("starTubeConfigCreated");
window.location.reload();
});
$("#DAO").addEventListener("click", function() {
var settingArray = document.querySelectorAll('.astro-checkbox-setting[value="true"][iron="false"] .astro-checkbox');
settingArray.forEach(item => {
item.click();
});
window.location.reload();
});
doRadioSettings();
$("#refreshPage").addEventListener("click", function() {
window.location.reload();
});
$("#exitSettings").addEventListener("click", showHideSettings);
$("#startube-settings-fence").addEventListener("click", showHideSettings);
$("#astro-micro-filter-button").addEventListener("click", showHideMicroFilter);
$("#astro-micro-filter-fence").addEventListener("click", showHideMicroFilter);
$("#astro-mc-all").addEventListener("click",function() {
$("#astro-micro-filter-button").setAttribute("state","all");
$("#astro-micro-filter-menu").setAttribute("state","all");
$("#startube-microconfigs-dump").setAttribute("filter","none");
showHideMicroFilter();
/*let resultCount = 0;
setTimeout(function() {
var arraySettings = document.querySelectorAll(".astro-checkbox-setting[hide='false']");
arraySettings.forEach(itemRoot => {
resultCount++;
});
$("#startube-result-count span").textContent = resultCount + " results";
$("#startube-settings-content").setAttribute("searching","true");
}, 10);*/
});
$("#astro-mc-locked").addEventListener("click",function() {
$("#astro-micro-filter-button").setAttribute("state","locked");
$("#astro-micro-filter-menu").setAttribute("state","locked");
$("#startube-microconfigs-dump").setAttribute("filter","locked");
showHideMicroFilter();
/*let resultCount = 0;
setTimeout(function() {
var arraySettings = document.querySelectorAll(".astro-checkbox-setting[hide='false'][iron='true']");
arraySettings.forEach(itemRoot => {
resultCount++;
});
$("#startube-result-count span").textContent = resultCount + " results";
$("#startube-settings-content").setAttribute("searching","true");
}, 10);*/
});
$("#astro-mc-unlocked").addEventListener("click",function() {
$("#astro-micro-filter-button").setAttribute("state","unlocked");
$("#astro-micro-filter-menu").setAttribute("state","unlocked");
$("#startube-microconfigs-dump").setAttribute("filter","unlocked");
showHideMicroFilter();
/*let resultCount = 0;
setTimeout(function() {
var arraySettings = document.querySelectorAll(".astro-checkbox-setting[hide='false'][iron='false']");
arraySettings.forEach(itemRoot => {
resultCount++;
});
$("#startube-result-count span").textContent = resultCount + " results";
$("#startube-settings-content").setAttribute("searching","true");
}, 10);*/
});
function showHideMicroFilter() {
if ($("#astro-micro-filter-menu.hid") != null) {
$("#astro-micro-filter-menu").classList.remove("hid");
$("#astro-micro-filter-fence").classList.remove("hid");
} else if ($("#astro-micro-filter-menu.hid") == null) {
$("#astro-micro-filter-menu").classList.add("hid");
$("#astro-micro-filter-fence").classList.add("hid");
}
}
document.querySelectorAll(".astro-sidebar-item").forEach(i => {
if (i.id == "st-astro-config") {
i.addEventListener("click", function() {
$("#startube-settings-content > div").setAttribute("state","config");
$(".astro-sidebar-item.active").classList.remove("active");
$("#st-astro-config").classList.add("active");
});
} else if (i.id == "st-astro-layout") {
i.addEventListener("click", function() {
$("#startube-settings-content > div").setAttribute("state","layout");
$(".astro-sidebar-item.active").classList.remove("active");
$("#st-astro-layout").classList.add("active");
});
} else if (i.id == "st-astro-misc") {
i.addEventListener("click", function() {
$("#startube-settings-content > div").setAttribute("state","misc");
$(".astro-sidebar-item.active").classList.remove("active");
$("#st-astro-misc").classList.add("active");
});
} else if (i.id == "st-astro-topbar") {
i.addEventListener("click", function() {
$("#startube-settings-content > div").setAttribute("state","topbar");
$(".astro-sidebar-item.active").classList.remove("active");
$("#st-astro-topbar").classList.add("active");
});
} else if (i.id == "st-astro-guide") {
i.addEventListener("click", function() {
$("#startube-settings-content > div").setAttribute("state","guide");
$(".astro-sidebar-item.active").classList.remove("active");
$("#st-astro-guide").classList.add("active");
});
} else if (i.id == "st-astro-player") {
i.addEventListener("click", function() {
$("#startube-settings-content > div").setAttribute("state","player");
$(".astro-sidebar-item.active").classList.remove("active");
$("#st-astro-player").classList.add("active");
});
} else if (i.id == "st-astro-watch") {
i.addEventListener("click", function() {
$("#startube-settings-content > div").setAttribute("state","watch");
$(".astro-sidebar-item.active").classList.remove("active");
$("#st-astro-watch").classList.add("active");
});
} else if (i.id == "st-astro-channel") {
i.addEventListener("click", function() {
$("#startube-settings-content > div").setAttribute("state","channel");
$(".astro-sidebar-item.active").classList.remove("active");
$("#st-astro-channel").classList.add("active");
});
} else if (i.id == "st-astro-advanced") {
i.addEventListener("click", function() {
$("#startube-settings-content > div").setAttribute("state","advanced");
$(".astro-sidebar-item.active").classList.remove("active");
$("#st-astro-advanced").classList.add("active");
});
}
});
$("#astro-searchbar input").addEventListener("keydown", function() {
let resultCount = 0;
let key = event.key;
let thisE = this;
setTimeout(function() {
let value = thisE.value;
if (value == "`") {
var arraySettings = document.querySelectorAll(".astro-checkbox-setting");
arraySettings.forEach(itemRoot => {
if (itemRoot) {
resultCount++;
itemRoot.setAttribute("hide","false");
}
});
//$("#startube-result-count span").textContent = "In total, there are " + resultCount + " settings available (you are seeing this because you searched '`')";
$("#startube-settings-content").setAttribute("searching","true");
} else if (value !== "") {
var arraySettings = document.querySelectorAll(".astro-checkbox-setting");
arraySettings.forEach(itemRoot => {
if (itemRoot) {
var item = itemRoot.getAttribute("id");
item = item.toUpperCase();
value = value.toUpperCase();
if (item.includes(value)) {
resultCount++;
itemRoot.setAttribute("hide","false");
} else {
itemRoot.setAttribute("hide","true");
}
}
});
//$("#startube-result-count span").textContent = resultCount + " results";
$("#startube-settings-content").setAttribute("searching","true");
} else {
var arraySettings = document.querySelectorAll(".astro-checkbox-setting");
arraySettings.forEach(itemRoot => {
if (itemRoot) {
itemRoot.setAttribute("hide","false");
$("#startube-settings-content").setAttribute("searching","false");
// $("#startube-result-count span").textContent = "All of the microconfigs that StarTube's presets and other options make use of. You can customize a lot here, but it can get confusing.";
}
});
}
}, 10);
});
var arraySettings = document.querySelectorAll(".astro-checkbox-setting");
arraySettings.forEach(itemRoot => {
if (itemRoot) {
var item = itemRoot.getAttribute("id");
var itemV = STS[item];
if (itemV == true) {
itemRoot.setAttribute("value","true");
} else {
itemRoot.setAttribute("value","false");
}
if (STS.ironSettings[item] != null) {
itemRoot.setAttribute("iron", "true");
}
}
});
doListen();
function doListen() {
let i = 0;
for (i = 0; i < document.querySelectorAll(".astro-checkbox").length; i++) {
document.querySelectorAll(".astro-checkbox")[i].onclick = function(e)
{
e.preventDefault();
var iron = this.parentNode.parentNode.getAttribute("iron");
if (iron == "true") {
alert("You must unlock this setting before changing it. (Locking and unlocking settings is done by right clicking them)");
} else {
var thisElm = this.parentNode.parentNode;
changeSetting(thisElm);
}
applySettings();
};
}
for (i = 0; i < document.querySelectorAll(".astro-lock").length; i++) {
document.querySelectorAll(".astro-lock")[i].onclick = function(e)
{
e.preventDefault();
var thisElm = this.parentNode.parentNode;
var iron = thisElm.getAttribute("iron");
let id = thisElm.id;
let value = thisElm.getAttribute("value");
if (value == "true") {
value = true;
}
if (value == "false") {
value = false;
}
if (value == null) {
value = false;
}
if (STS.ironSettings[id] == null) {
STS.ironSettings[id] = value;
thisElm.setAttribute("iron","true");
this.setAttribute("data-tooltip-text","This setting is locked. Click to unlock it.");
applySettings();
} else {
delete STS.ironSettings[id];
thisElm.setAttribute("iron","false");
this.setAttribute("data-tooltip-text","Lock setting");
applySettings();
}
applySettings();
};
}
let list = document.querySelectorAll(".lb-setting");
list.forEach(item => {
/*
item.addEventListener("contextmenu", (e) => {
e.preventDefault();
item.classList.add("startube-iron-setting");
});*/
item.addEventListener("contextmenu",function() {
let id = this.id;
let value = this.getAttribute("value");
if (value == "true") {
value = true;
}
if (value == "false") {
value = false;
}
if (value == null) {
value = false;
}
if (STS.ironSettings[id] == null) {
STS.ironSettings[id] = value;
this.classList.add("startube-iron-setting");
applySettings();
} else {
delete STS.ironSettings[id];
this.classList.remove("startube-iron-setting");
applySettings();
}
});
});
}
}
function changeSetting(thisElm, a) {
if (a !== "a") {
var theSetting = thisElm.getAttribute("id");
var checked = thisElm.getAttribute("value");
} else {
var theSetting = thisElm;
var checked = true;
}
if (theSetting == "presetRegularPlayer") {
STS.expModernPlayer = false;
STS.expModernPlayerV2 = false;
window.location.reload();
}
if (theSetting == "presetModernPlayer") {
STS.expModernPlayer = true;
STS.expModernPlayerV2 = false;
window.location.reload();
}
if (theSetting == "presetModernPlayerV2") {
STS.expModernPlayer = false;
STS.expModernPlayerV2 = true;
window.location.reload();
}
if (theSetting == "RTD") {
localStorage.removeItem(theSets);
localStorage.removeItem("starTubeConfigCreated");
window.location.reload();
} else if (a !== "a") {
if (checked == "true") {
STS[theSetting] = false;
//localStorage.setItem(theSetting,"false");
thisElm.setAttribute("value","false");
if (STS.ironSettings[theSetting]) {
STS.ironSettings[theSetting] = false;
}
applySettings();
} else {
STS[theSetting] = true;
//localStorage.setItem(theSetting,"true");
thisElm.setAttribute("value","true");
if (STS.ironSettings[theSetting]) {
STS.ironSettings[theSetting] = true;
}
applySettings();
}
}
function disableOtherPresets(preset) {
STS.presetAozora2011 = false;
STS.presetCosmicPanda = false;
STS.presetEpicPanda = false;
STS.presetHitchhiker2013_1 = false;
STS.presetHitchhiker2013_1Alt = false;
STS.presetHitchhiker2013_2 = false;
STS.presetHitchhiker2013_2Alt = false;
STS.presetHitchhiker2013_3 = false;
STS.presetHitchhiker2013_3Alt = false;
STS.presetHitchhiker2014 = false;
STS.presetHitchhiker2014Alt = false;
STS.presetHitchhiker2015 = false;
STS.presetHitchhiker2015Alt = false;
STS.presetHitchhiker2016 = false;
STS.presetHitchhiker2016Alt = false;
STS.presetHitchhiker2017 = false;
STS.presetHitchhiker2017Alt = false;
STS.presetHitchhiker2017Ultra = false;
STS.presetHitchhiker2018 = false;
STS.presetPolymer2016 = false;
STS.presetPolymer2019 = false;
STS.presetPolymer2020 = false;
STS.presetPolymer2021 = false;
STS.presetPolymer2022 = false;
STS.presetHitchhiker2015_Early = false;
STS.presetHitchhiker2017_Early = false;
STS[preset] = true;
}
if (theSetting == "STPresetsAlsoSetV3Settings") {
STPresetsAlsoSetV3Settings == checked;
window.location.reload();
}
if (theSetting == "presetWatch9") {
STS.expRelatedTabs = true;
STS.expRelatedTabsHoldsSubscribe = true;
STS.expWatch9 = true;
STS.expWatch9NoOwner = true;
STS.expWatch9TrueExpander = false;
STS.expVerticalWatch9 = false;
STS.expWatch9SidebarBus = false;
STS.expWatch9StickyColumns = false;
STS.expWatch9ReportTab = true;
STS.expRelatedGrid = false;
STS.expWatch8 = false;
STS.expWatch8NoMore = false;
STS.expMoveCountsToButtons = false;
STS.expSharrow = false;
STS.expWatch9A = false;
STS.expWatch9B = false;
STS.expWatch10Beta = false;
STS.expWMRButtonsLowercase = false;
}
if (theSetting == "presetWatch9ThreeColumns") {
STS.expRelatedTabs = false;
STS.expRelatedTabsHoldsSubscribe = false;
STS.expWatch9 = true;
STS.expWatch9NoOwner = false;
STS.expWatch9TrueExpander = false;
STS.expVerticalWatch9 = false;
STS.expWatch9SidebarBus = false;
STS.expWatch9StickyColumns = false;
STS.expWatch9ReportTab = true;
STS.expRelatedGrid = false;
STS.expWatch8 = false;
STS.expWatch8NoMore = false;
STS.expMoveCountsToButtons = false;
STS.expSharrow = false;
STS.expWatch9A = false;
STS.expWatch9B = false;
STS.expWatch10Beta = false;
STS.expWMRButtonsLowercase = false;
}
if (theSetting == "presetWatch9Fancy") {
STS.expRelatedTabs = true;
STS.expRelatedTabsHoldsSubscribe = true;
STS.expWatch9 = true;
STS.expWatch9NoOwner = true;
STS.expWatch9TrueExpander = false;
STS.expVerticalWatch9 = true;
STS.expWatch9SidebarBus = true;
STS.expWatch9StickyColumns = true;
STS.expWatch9ReportTab = true;
STS.expRelatedGrid = false;
STS.expWatch8 = false;
STS.expWatch8NoMore = false;
STS.expMoveCountsToButtons = false;
STS.expSharrow = false;
STS.expWatch9A = false;
STS.expWatch9B = false;
STS.expWatch10Beta = false;
STS.expWMRButtonsLowercase = false;
}
if (theSetting == "disableEverything") {
localStorage.setItem(theSetting,"true");
var settingArray = document.querySelectorAll('[state-id="all"] .lb-setting[checked="true"]');
settingArray.forEach(item => {
if (!item.classList.contains('startube-iron-setting')) {
item.click();
}
});
window.location.reload();
}
function presetSelected(theSetting) {
disableOtherPresets(theSetting);
doIronSettings();
applySettings();
window.location.reload();
}
if (
theSetting == "presetAozora2011"
) {
STCosmicPandaSettings();
STAozoraSettings();
presetSelected(theSetting);
}
if (
theSetting == "presetCosmicPanda"
) {
STCosmicPandaSettings();
presetSelected(theSetting);
}
if (
theSetting == "presetEpicPanda"
) {
STEpicPandaSettings();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2013_1"
) {
STModernHitchhikerSettings();
ST2014Settings();
ST2013Settings();
STMid2013Settings();
STEarly2013Settings();
STWatch7();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2013_1Alt"
) {
STModernHitchhikerSettings();
ST2014Settings();
ST2013Settings();
STMid2013Settings();
STEarly2013Settings();
STAltWatch9();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2013_2"
) {
STModernHitchhikerSettings();
ST2014Settings();
ST2013Settings();
STMid2013Settings();
STWatch7();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2013_2Alt"
) {
STModernHitchhikerSettings();
ST2014Settings();
ST2013Settings();
STMid2013Settings();
STAltWatch9();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2013_3"
) {
STModernHitchhikerSettings();
ST2014Settings();
ST2013Settings();
STWatch7();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2013_3Alt"
) {
STModernHitchhikerSettings();
ST2014Settings();
ST2013Settings();
STAltWatch9();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2014"
) {
STModernHitchhikerSettings();
ST2014Settings();
STWatch7();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2014Alt"
) {
STModernHitchhikerSettings();
ST2014Settings();
STAltWatch9();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2015"
) {
STModernHitchhikerSettings();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2015Alt"
) {
STModernHitchhikerSettings();
STAltWatch9();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2015_Early"
) {
STModernHitchhikerSettings();
STEarly2015Settings();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2016"
) {
STModernHitchhikerSettings();
ST2016Settings();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2016Alt"
) {
STModernHitchhikerSettings();
ST2016Settings();
STAltWatch9();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2016_Mid"
) {
STModernHitchhikerSettings();
ST2016Settings();
STMid2016Settings();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2016_Early"
) {
STModernHitchhikerSettings();
STEarly2016Settings();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2017_Early"
) {
STModernHitchhikerSettings();
ST2016Settings();
STEarly2017Settings();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2017"
) {
STModernHitchhikerSettings();
ST2016Settings();
ST2017Settings();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2017Alt"
) {
STModernHitchhikerSettings();
ST2016Settings();
ST2017Settings();
STAltWatch9();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2017Ultra"
) {
STModernHitchhikerSettings();
ST2016Settings();
ST2017Settings();
STAltWatch9();
STIdealLayout();
presetSelected(theSetting);
}
if (
theSetting == "presetHitchhiker2018"
) {
STModernHitchhikerSettings();
ST2016Settings();
ST2017Settings();
ST2018Settings();
presetSelected(theSetting);
}
if (
theSetting == "presetPolymer2016"
) {
ST2018PolySettings();
ST2016PolySettings();
presetSelected(theSetting);
}
if (
theSetting == "presetPolymer2019"
) {
ST2018PolySettings();
presetSelected(theSetting);
}
if (
theSetting == "presetPolymer2020"
) {
ST2018PolySettings();
ST2020Settings();
presetSelected(theSetting);
}
if (
theSetting == "presetPolymer2021"
) {
ST2018PolySettings();
ST2020Settings();
ST2021Settings();
presetSelected(theSetting);
}
if (
theSetting == "presetPolymer2022"
) {
ST2018PolySettings();
ST2020Settings();
ST2021Settings();
ST2022Settings();
presetSelected(theSetting);
}
function doIronSettings() {
let irons = Object.entries(STS.ironSettings);
irons.forEach(i => {
let name = i[0];
let value = i[1];
STS[name] = value;
});
}
}
function doRadioSettings() {
document.querySelectorAll(".layoutMode").forEach(i => {
let value = i.getAttribute("value");
if (value == STS.radioSettings.layoutMode) {
i.setAttribute("checked","true");
$(".astro-settings").setAttribute("layout-mode", value);
}
i.addEventListener("click",function() {
$(".layoutMode[checked]").removeAttribute("checked");
$(".astro-settings").setAttribute("layout-mode", value);
value == i.getAttribute("value");
i.setAttribute("checked","true");
STS.radioSettings.layoutMode = value;
executeRadios("layoutMode",value);
applySettings();
});
});
document.querySelectorAll(".layoutSelect").forEach(i => {
let value = i.getAttribute("value");
if (value == STS.radioSettings.layoutSelect) {
i.setAttribute("checked","true");
}
i.addEventListener("click",function() {
$(".layoutSelect[checked]").removeAttribute("checked");
value == i.getAttribute("value");
i.setAttribute("checked","true");
STS.radioSettings.layoutSelect = value;
executeRadios("layoutSelect",value);
let value2 = SRS.playerSizerules;
executeRadios("playerSizerules",value2);
applySettings();
});
});
document.querySelectorAll(".gbarVersion").forEach(i => {
let value = i.getAttribute("value");
if (value == STS.radioSettings.gbarVersion) {
i.setAttribute("checked","true");
}
i.addEventListener("click",function() {
$(".gbarVersion[checked]").removeAttribute("checked");
value == i.getAttribute("value");
i.setAttribute("checked","true");
STS.radioSettings.gbarVersion = value;
executeRadios("gbarVersion",value);
applySettings();
});
});
document.querySelectorAll(".accountMenu").forEach(i => {
let value = i.getAttribute("value");
if (value == STS.radioSettings.accountMenu) {
i.setAttribute("checked","true");
}
i.addEventListener("click",function() {
$(".accountMenu[checked]").removeAttribute("checked");
value == i.getAttribute("value");
i.setAttribute("checked","true");
STS.radioSettings.accountMenu = value;
executeRadios("accountMenu",value);
applySettings();
});
});
document.querySelectorAll(".faviconSelect").forEach(i => {
let value = i.getAttribute("value");
if (value == STS.radioSettings.faviconSelect) {
i.setAttribute("checked","true");
}
i.addEventListener("click",function() {
$(".faviconSelect[checked]").removeAttribute("checked");
value == i.getAttribute("value");
i.setAttribute("checked","true");
STS.radioSettings.faviconSelect = value;
executeRadios("faviconSelect",value);
applySettings();
});
});
document.querySelectorAll(".playerVersion").forEach(i => {
let value = i.getAttribute("value");
if (value == STS.radioSettings.playerVersion) {
i.setAttribute("checked","true");
}
i.addEventListener("click",function() {
$(".playerVersion[checked]").removeAttribute("checked");
value == i.getAttribute("value");
i.setAttribute("checked","true");
STS.radioSettings.playerVersion = value;
executeRadios("playerVersion",value);
applySettings();
});
});
document.querySelectorAll(".playerSizerules").forEach(i => {
let value = i.getAttribute("value");
if (value == STS.radioSettings.playerSizerules) {
i.setAttribute("checked","true");
}
i.addEventListener("click",function() {
$(".playerSizerules[checked]").removeAttribute("checked");
value == i.getAttribute("value");
i.setAttribute("checked","true");
STS.radioSettings.playerSizerules = value;
executeRadios("playerSizerules",value);
applySettings();
});
});
document.querySelectorAll(".guideNavToFeed").forEach(i => {
let value = i.getAttribute("value");
if (value == STS.radioSettings.guideNavToFeed) {
i.setAttribute("checked","true");
}
i.addEventListener("click",function() {
$(".guideNavToFeed[checked]").removeAttribute("checked");
value == i.getAttribute("value");
i.setAttribute("checked","true");
STS.radioSettings.guideNavToFeed = value;
executeRadios("guideNavToFeed",value);
applySettings();
});
});
document.querySelectorAll(".guideAlwaysPinned").forEach(i => {
let value = i.getAttribute("value");
if (value == STS.radioSettings.guideAlwaysPinned) {
i.setAttribute("checked","true");
}
i.addEventListener("click",function() {
$(".guideAlwaysPinned[checked]").removeAttribute("checked");
value == i.getAttribute("value");
i.setAttribute("checked","true");
STS.radioSettings.guideAlwaysPinned = value;
executeRadios("guideAlwaysPinned",value);
applySettings();
});
});
document.querySelectorAll(".watchLayout").forEach(i => {
let value = i.getAttribute("value");
if (value == STS.radioSettings.watchLayout) {
i.setAttribute("checked","true");
}
i.addEventListener("click",function() {
$(".watchLayout[checked]").removeAttribute("checked");
value == i.getAttribute("value");
i.setAttribute("checked","true");
STS.radioSettings.watchLayout = value;
executeRadios("watchLayout",value);
applySettings();
});
});
document.querySelectorAll(".relatedTabs").forEach(i => {
let value = i.getAttribute("value");
if (value == STS.radioSettings.relatedTabs) {
i.setAttribute("checked","true");
}
i.addEventListener("click",function() {
$(".relatedTabs[checked]").removeAttribute("checked");
value == i.getAttribute("value");
i.setAttribute("checked","true");
STS.radioSettings.relatedTabs = value;
executeRadios("relatedTabs",value);
applySettings();
});
});
document.querySelectorAll(".relatedGrid").forEach(i => {
let value = i.getAttribute("value");
if (value == STS.radioSettings.relatedGrid) {
i.setAttribute("checked","true");
}
i.addEventListener("click",function() {
$(".relatedGrid[checked]").removeAttribute("checked");
value == i.getAttribute("value");
i.setAttribute("checked","true");
STS.radioSettings.relatedGrid = value;
executeRadios("relatedGrid",value);
applySettings();
});
});
document.querySelectorAll(".relatedSize").forEach(i => {
let value = i.getAttribute("value");
if (value == STS.radioSettings.relatedSize) {
i.setAttribute("checked","true");
}
i.addEventListener("click",function() {
$(".relatedSize[checked]").removeAttribute("checked");
value == i.getAttribute("value");
i.setAttribute("checked","true");
STS.radioSettings.relatedSize = value;
executeRadios("relatedSize",value);
applySettings();
});
});
document.querySelectorAll(".compactDate").forEach(i => {
let value = i.getAttribute("value");
if (value == STS.radioSettings.compactDate) {
i.setAttribute("checked","true");
}
i.addEventListener("click",function() {
$(".compactDate[checked]").removeAttribute("checked");
value == i.getAttribute("value");
i.setAttribute("checked","true");
STS.radioSettings.compactDate = value;
executeRadios("compactDate",value);
applySettings();
});
});
document.querySelectorAll(".channelVersion").forEach(i => {
let value = i.getAttribute("value");
if (value == STS.radioSettings.channelVersion) {
i.setAttribute("checked","true");
}
i.addEventListener("click",function() {
$(".channelVersion[checked]").removeAttribute("checked");
value == i.getAttribute("value");
i.setAttribute("checked","true");
STS.radioSettings.channelVersion = value;
executeRadios("channelVersion",value);
applySettings();
});
});
document.querySelectorAll(".colorfulChannels").forEach(i => {
let value = i.getAttribute("value");
if (value == STS.radioSettings.colorfulChannels) {
i.setAttribute("checked","true");
}
i.addEventListener("click",function() {
$(".colorfulChannels[checked]").removeAttribute("checked");
value == i.getAttribute("value");
i.setAttribute("checked","true");
STS.radioSettings.colorfulChannels = value;
executeRadios("colorfulChannels",value);
applySettings();
});
});
}
function createWatch8(number) {
if (document.querySelector(".cardified-page.exp-individual-cards-watch") == null) {
number++;
}
let container = document.querySelector('#watch7-content.watch-content .yt-uix-button-panel');
var altWatch9 = document.createElement("div");
altWatch9.id = "watch8-container";
altWatch9.setAttribute("state","none");
altWatch9.innerHTML = `
Add to
Share
Statistics
Transcript
Report
More
Statistics
Transcript
Channel videos
`;
container.insertBefore(altWatch9, container.children[number]);
if (document.querySelector(".cardified-page") != null) {
document.querySelector("#watch8-desc").setAttribute("class","yt-card yt-card-no-padding");
document.querySelector("#watch8-share").setAttribute("class","yt-card yt-card-no-padding");
document.querySelector("#watch8-stats").setAttribute("class","yt-card yt-card-no-padding");
document.querySelector("#watch8-transcript").setAttribute("class","yt-card yt-card-no-padding");
document.querySelector("#watch8-actions-row").setAttribute("class","yt-card yt-card-no-padding");
}
var elm = "#watch8-container";
waitForElement(elm).then(function(elm) {
if (canGo != false) {
if (document.querySelector("#watch8-sentiment-actions #watch7-sentiment-actions") == null) {
var elm = "#eow-description";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
var thePanel = document.querySelector("#watch7-sentiment-actions");
var newHome5 = document.querySelector('#watch8-sentiment-actions');
newHome5.insertBefore(thePanel, newHome5.children[0]);
}
});
}
if (document.querySelector("#watch8-desc #action-panel-details") == null) {
var elm = "#eow-description";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
var thePanel = document.querySelector("#action-panel-details");
var newHome5 = document.querySelector('#watch8-desc');
newHome5.insertBefore(thePanel, newHome5.children[0]);
}
});
}
if (document.querySelector("#watch9-share #action-panel-share") == null) {
document.querySelector("#watch7-secondary-actions .yt-uix-button:nth-child(2)").click();
}
if (document.querySelector("#watch8-desc #action-panel-share") == null) {
var elm = "#eow-description";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
var thePanel = document.querySelector("#action-panel-share");
var newHome5 = document.querySelector('#watch8-share');
newHome5.insertBefore(thePanel, newHome5.children[0]);
}
});
}
if (document.querySelector("#watch7-secondary-actions .hid.yt-uix-button:nth-child(4)") == null) {
if (document.querySelector("#watch9-share #action-panel-transcript") == null) {
document.querySelector("#watch7-secondary-actions .yt-uix-button:nth-child(4)").click();
}
if (document.querySelector("#watch8-desc #action-panel-transcript") == null) {
var elm = ".watch-transcript";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
var thePanel = document.querySelector("#action-panel-transcript");
var newHome5 = document.querySelector('#watch8-transcript');
newHome5.insertBefore(thePanel, newHome5.children[0]);
}
});
}
}
if (document.querySelector("#watch9-share #action-panel-stats") == null) {
document.querySelector("#watch7-secondary-actions .yt-uix-button:nth-child(5)").click();
}
if (document.querySelector("#watch8-desc #action-panel-stats") == null) {
var elm = ".metric-label";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
var thePanel = document.querySelector("#action-panel-stats");
var newHome5 = document.querySelector('#watch8-stats');
newHome5.insertBefore(thePanel, newHome5.children[0]);
}
});
}
if (document.querySelector("#watch9-addto #action-panel-addto") == null) {
document.querySelector("#watch7-secondary-actions .yt-uix-button:nth-child(3)").click();
}
if (document.querySelector("#watch8-addto #action-panel-addto") == null) {
var elm = ".playlist-items";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
var thePanel = document.querySelector("#action-panel-addto");
var newHome5 = document.querySelector('#watch8-addto');
newHome5.insertBefore(thePanel, newHome5.children[0]);
}
});
}
var nonfloater = document.querySelector("#nonfloater");
var addTo = document.querySelector("#addto.watch8-action");
var share = document.querySelector("#share.watch8-action");
var stats = document.querySelector("#stats.watch8-menuitem");
var stats2 = document.querySelector("#stats.watch8-button");
var transcript = document.querySelector("#transcript.watch8-menuitem");
var transcript2 = document.querySelector("#transcript.watch8-button");
var moreActions = document.querySelector("#more-actions.watch8-action");
var showScroller = document.querySelector("#channel-videos.watch8-action");
var close = document.querySelector("#watch8-close button");
if (document.querySelector("#watch7-secondary-actions .hid.yt-uix-button:nth-child(4)") != null) {
document.querySelector("#transcript.watch8-button").classList.add("hid");
document.querySelector("#transcript.watch8-menuitem").setAttribute("visible","false");
}
nonfloater.addEventListener("click", function() {
document.querySelector("#watch8-addto").setAttribute("visible", "false");
document.querySelector("#watch8-more").setAttribute("visible", "false");
document.querySelector("#nonfloater").setAttribute("visible", "false");
document.querySelector("#watch8-container").setAttribute("addto-visible", "false");
document.querySelector("#watch8-container").setAttribute("more-visible", "false");
});
addTo.addEventListener("click", function() {
if (document.querySelector("#watch8-addto[visible='false']") != null) {
document.querySelector("#watch8-addto").setAttribute("visible", "true");
document.querySelector("#nonfloater").setAttribute("visible", "true");
document.querySelector("#watch8-container").setAttribute("addto-visible", "true");
} else {
document.querySelector("#watch8-addto").setAttribute("visible", "false");
document.querySelector("#nonfloater").setAttribute("visible", "false");
document.querySelector("#watch8-container").setAttribute("addto-visible", "false");
}
});
share.addEventListener("click", function() {
if (document.querySelector("#watch8-container[state='share']") != null) {
document.querySelector("#watch8-container").setAttribute("state", "none");
} else {
document.querySelector("#watch8-container").setAttribute("state", "share");
}
});
moreActions.addEventListener("click", function() {
if (document.querySelector("#watch8-more[visible='false']") != null) {
document.querySelector("#watch8-more").setAttribute("visible", "true");
document.querySelector("#nonfloater").setAttribute("visible", "true");
document.querySelector("#watch8-container").setAttribute("more-visible", "true");
} else {
document.querySelector("#watch8-more").setAttribute("visible", "false");
document.querySelector("#nonfloater").setAttribute("visible", "false");
document.querySelector("#watch8-container").setAttribute("more-visible", "false");
}
});
stats.addEventListener("click", function() {
document.querySelector("#watch8-more").setAttribute("visible", "false");
document.querySelector("#nonfloater").setAttribute("visible", "false");
document.querySelector("#watch8-container").setAttribute("more-visible", "false");
if (document.querySelector("#watch8-container[state='stats']") != null) {
document.querySelector("#watch8-container").setAttribute("state", "none");
} else {
document.querySelector("#watch8-container").setAttribute("state", "stats");
}
});
stats2.addEventListener("click", function() {
if (document.querySelector("#watch8-container[state='stats']") != null) {
document.querySelector("#watch8-container").setAttribute("state", "none");
} else {
document.querySelector("#watch8-container").setAttribute("state", "stats");
}
});
transcript.addEventListener("click", function() {
document.querySelector("#watch8-more").setAttribute("visible", "false");
document.querySelector("#nonfloater").setAttribute("visible", "false");
document.querySelector("#watch8-container").setAttribute("more-visible", "false");
if (document.querySelector("#watch8-container[state='transcript']") != null) {
document.querySelector("#watch8-container").setAttribute("state", "none");
} else {
document.querySelector("#watch8-container").setAttribute("state", "transcript");
}
});
transcript2.addEventListener("click", function() {
if (document.querySelector("#watch8-container[state='transcript']") != null) {
document.querySelector("#watch8-container").setAttribute("state", "none");
} else {
document.querySelector("#watch8-container").setAttribute("state", "transcript");
}
});
close.addEventListener("click", function() {
document.querySelector("#watch8-container").setAttribute("state", "none");
});
var elm = "#watch-uploader-info";
waitForElement(elm).then(function(elm) {
if (canGo != false) {
// applyMetadata();
}
});
function applyMetadata() {
}
}
});
}
function createPopups() {
if ($("#wmr-popups")) {
$("#wmr-popups").remove();
}
let container = $(".spitfire-body-container");
var newElem = document.createElement("div");
newElem.id = "wmr-popups";
newElem.innerHTML = `
`;
container.insertBefore(newElem, container.children[1]);
document.querySelector("html").setAttribute("addto-visible", "false");
document.querySelector("html").setAttribute("share-visible", "false");
document.querySelector("html").setAttribute("more-visible", "false");
document.querySelector("html").setAttribute("popup-visible", "false");
if (document.querySelector("#wmr-popups #action-panel-addto") == null) {
document.querySelector("#watch7-secondary-actions .yt-uix-button:nth-child(3)").click();
}
if (document.querySelector("#wmr-popups #action-panel-addto") == null) {
var elm = ".playlist-items";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
var thePanel = document.querySelector("#action-panel-addto");
var newHome5 = document.querySelector('#wmr-addto-popup div');
newHome5.insertBefore(thePanel, newHome5.children[0]);
}
});
}
if (document.querySelector("#wmr-popups #action-panel-share") == null) {
document.querySelector("#watch7-secondary-actions .yt-uix-button:nth-child(2)").click();
}
if (document.querySelector("#wmr-popups #action-panel-share") == null) {
var elm = "#eow-description";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
var thePanel = document.querySelector("#action-panel-share");
var newHome5 = document.querySelector('#wmr-share-popup div');
newHome5.insertBefore(thePanel, newHome5.children[0]);
}
});
}
var nonfloater = document.querySelector("#wmr-fence");
var addTo = document.querySelector("[js-addto]");
var share = document.querySelector("[js-share]");
/*var stats = document.querySelector("#stats.watch8-menuitem");
var stats2 = document.querySelector("#stats.watch8-button");
var transcript = document.querySelector("#transcript.watch8-menuitem");
var transcript2 = document.querySelector("#transcript.watch8-button");
var moreActions = document.querySelector("#more-actions.watch8-action");
var showScroller = document.querySelector("#channel-videos.watch8-action");
var close = document.querySelector("#watch8-close button");
if (document.querySelector("#watch7-secondary-actions .hid.yt-uix-button:nth-child(4)") != null) {
document.querySelector("#transcript.watch8-button").classList.add("hid");
document.querySelector("#transcript.watch8-menuitem").setAttribute("visible","false");
}*/
nonfloater.addEventListener("click", function() {
document.querySelector("#wmr-addto-popup").setAttribute("visible", "false");
document.querySelector("#wmr-share-popup").setAttribute("visible", "false");
document.querySelector("#wmr-fence").setAttribute("visible", "false");
document.querySelector("html").setAttribute("addto-visible", "false");
document.querySelector("html").setAttribute("share-visible", "false");
document.querySelector("html").setAttribute("more-visible", "false");
document.querySelector("html").setAttribute("popup-visible", "false");
});
addTo.addEventListener("click", function() {
if (document.querySelector("#wmr-addto-popup[visible='false']") != null) {
document.querySelector("#wmr-addto-popup").setAttribute("visible", "true");
document.querySelector("#wmr-fence").setAttribute("visible", "true");
document.querySelector("html").setAttribute("addto-visible", "true");
document.querySelector("html").setAttribute("popup-visible", "true");
} else {
document.querySelector("#wmr-addto-popup").setAttribute("visible", "false");
document.querySelector("#wmr-fence").setAttribute("visible", "false");
document.querySelector("html").setAttribute("addto-visible", "false");
document.querySelector("html").setAttribute("popup-visible", "false");
}
});
share.addEventListener("click", function() {
if (document.querySelector("#wmr-share-popup[visible='false']") != null) {
document.querySelector("#wmr-share-popup").setAttribute("visible", "true");
document.querySelector("#wmr-fence").setAttribute("visible", "true");
document.querySelector("html").setAttribute("share-visible", "true");
document.querySelector("html").setAttribute("popup-visible", "true");
} else {
document.querySelector("#wmr-share-popup").setAttribute("visible", "false");
document.querySelector("#wmr-fence").setAttribute("visible", "false");
document.querySelector("html").setAttribute("share-visible", "false");
document.querySelector("html").setAttribute("popup-visible", "false");
}
});
}
function createRealWatch9(number) {
if (document.querySelector(".cardified-page.exp-individual-cards-watch") == null) {
//number++;
}
let container = document.querySelector('#watch7-content.watch-content .yt-uix-button-panel');
container = $("#watch7-content.watch-content");
var altWatch9 = document.createElement("div");
altWatch9.id = "watch9-container";
altWatch9.innerHTML = `
`;
container.insertBefore(altWatch9, container.children[number]);
$("#wmr-actions-container").innerHTML = STH.WMR_ACTIONS;
createPopups();
var elm = "#watch9-container";
waitForElement(elm).then(function(elm) {
if (canGo != false) {
addIcons();
if (document.querySelector("#watch9-sentiment-actions #watch7-sentiment-actions") == null) {
var elm = "#eow-description";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
var thePanel = document.querySelector("#watch7-sentiment-actions");
var newHome5 = document.querySelector('#watch9-sentiment-actions');
newHome5.insertBefore(thePanel, newHome5.children[0]);
}
});
}
if (document.querySelector("#watch9-desc #watch-description") == null) {
var elm = "#eow-description";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
var thePanel = document.querySelector("#watch-description");
var newHome5 = document.querySelector('#watch9-desc');
newHome5.insertBefore(thePanel, newHome5.children[0]);
}
});
}
if (document.querySelector("#watch9-owner #watch7-subscription-container") == null) {
var elm = "#eow-description";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
var thePanel = document.querySelector("#watch7-subscription-container");
var newHome5 = document.querySelector('#watch9-subscribe');
newHome5.insertBefore(thePanel, newHome5.children[0]);
}
});
}
if (document.querySelector("#watch9-container .video-extras-sparkbars") == null) {
var elm = "#eow-description";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
var thePanel = document.querySelector(".video-extras-sparkbars");
var newHome5 = document.querySelector('#watch7-sentiment-actions');
newHome5.insertBefore(thePanel, newHome5.children[1]);
}
});
}
if (document.querySelector("#watch9-container .watch-view-count") == null) {
var elm = "#eow-description";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
var thePanel = document.querySelector(".watch-view-count");
var newHome5 = document.querySelector('#watch9-view-count');
newHome5.insertBefore(thePanel, newHome5.children[1]);
}
});
}
if (document.querySelector("#watch9-container .watch-title") == null) {
var elm = "#eow-description";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
var thePanel = document.querySelector(".watch-title");
var newHome5 = document.querySelector('#watch9-title');
newHome5.insertBefore(thePanel, newHome5.children[0]);
}
});
}
if (document.querySelector("#watch9-container .yt-user-photo") == null) {
var elm = "#eow-description";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
var thePanel = document.querySelector(".yt-user-photo");
var newHome5 = document.querySelector('#watch9-pfp');
newHome5.insertBefore(thePanel, newHome5.children[0]);
}
});
}
if (document.querySelector("#watch9-container .yt-user-name") == null) {
var elm = "#eow-description";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
var thePanel = document.querySelector("#watch7-user-header");
var newHome5 = document.querySelector('#watch9-channel-name');
newHome5.insertBefore(thePanel, newHome5.children[0]);
}
});
}
if (document.querySelector("#watch9-container #watch9-subtitle #watch-uploader-info") == null) {
var elm = "#eow-description";
waitForElement10(elm).then(function(elm) {
if (canGo != false) {
var thePanel = document.querySelector("#watch-uploader-info");
var newHome5 = document.querySelector('#watch9-publish-date');
newHome5.insertBefore(thePanel, newHome5.children[0]);
}
});
}
var elm = "#watch-uploader-info";
waitForElement(elm).then(function(elm) {
if (canGo != false) {
applyMetadata();
}
});
function applyMetadata() {
if (document.querySelector(".yt-subscription-button-subscriber-count-branded-horizontal") != null) {
var subCount = document.querySelector(".yt-subscription-button-subscriber-count-branded-horizontal").textContent;
document.querySelector("#watch9-sub-count").textContent = subCount + " subscribers";
}
if (document.querySelector("#watch-uploader-info") != null) {
var date = document.querySelector("#watch-uploader-info").textContent;
date = date.split("on ")[1];
document.querySelector("#watch9-upload-date span").textContent = date;
}
}
}
});
}
function createWatch10(number) {
if (document.querySelector(".cardified-page.exp-individual-cards-watch") == null) {
//number++;
}
let container = document.querySelector('#watch7-content.watch-content .yt-uix-button-panel');
container = $("#watch7-content.watch-content");
var altWatch9 = document.createElement("div");
altWatch9.id = "watch10-container";
altWatch9.innerHTML = `