`;
}
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 EXaddListener(elm,event,action){
elm.addEventListener(event,function(){
action;
});
}
function doSubscribeIcons(){
var elm = ".yt-uix-subscription-button:not(.st-icon-sub):not(.st-listening)";
waitForElement10(elm).then(function(elm){
if(canGo != false){
document.querySelectorAll(".yt-uix-button-subscribe-branded:not(.st-icon-sub):not(.st-listening)").forEach(i=>{
let cont=i.querySelector(".yt-uix-button-icon-wrapper");
let nE=document.createElement("div");
nE.classList.add("st-svg");
nE.innerHTML=STH0.SVG;
cont.append(nE);
nE.querySelector(".filled-icon g").innerHTML=`
`;
nE.querySelector(".outline-icon path").setAttribute("d",svgDefs.sub.o);
i.classList.add("st-icon-sub");
i.querySelector("svg").setAttribute("viewBox","0 0 68 48");
if(!i.classList.contains("st-listening")){
EXaddListener(i,"click",setTimeout(doSubscribeIcons,2000));
i.classList.add("st-listening");
}
});
document.querySelectorAll(".yt-uix-button-subscribed-branded:not(.st-icon-sub):not(.st-listening)").forEach(i=>{
let cont=i.querySelector(".yt-uix-button-icon-wrapper");
let nE=document.createElement("div");
nE.classList.add("st-svg");
nE.innerHTML=STH0.SVG;
cont.append(nE);
nE.querySelector(".filled-icon path").setAttribute("d",svgDefs.subbed.f);
nE.querySelector(".outline-icon path").setAttribute("d",svgDefs.subbed.o);
i.classList.add("st-icon-sub");
i.querySelector("svg").setAttribute("viewbox","0 0 68 48");
if(!i.classList.contains("st-listening")){
EXaddListener(i,"click",setTimeout(doSubscribeIcons,2000));
i.classList.add("st-listening");
}
});
}
});
}
// EXfunct
function moveSortBtn(){
if($("#page.watch") || $("#page.all_comments")){
if($(".widget_bounds .yt-spinner-message") == null && $("#st-comment-sort") == null){
var elm = ".left-options > button";
waitForElement10(elm).then(function(elm){
if(canGo != false && $("#st-comment-sort") == null){
if($("#page.watch") || $("#page.all_comments")){
var newHome = $(".all-comments");
var toMove = $(".left-options > button");
newHome.appendChild(toMove);
$(".all-comments button").id = "st-comment-sort";
let cont = $("#st-comment-sort");
cont.classList.add("flex-bar");
cont.querySelector("span").textContent = "Sort by";
let nE = document.createElement("div");
nE.setAttribute("class","st-svg");
nE.innerHTML = `
`;
cont.insertBefore(nE,cont.children[0]);
}
}
});
}else if($("#st-comment-sort")){
$("#st-comment-sort").querySelector("span").textContent = "Sort by";
}
}
}
// EXfunct
function changeCommentPlaceholder(n){
if($("#page.watch") || $("#page.all_comments")){
if($(".widget_bounds .yt-spinner-message") == null && $(".share.focus_caller.startube") == null){
var elm = ".focus_caller";
waitForElement10(elm).then(function(elm){
if(canGo != false){
if($("#page.watch") || $("#page.all_comments")){
if(n == 1){
$(".share.focus_caller").textContent = "Add a public comment";
}else if(n == 0){
$(".share.focus_caller").textContent = "Add a comment";
}
$(".share.focus_caller").classList.add("startube");
}
}
});
}
}
}
// EXfunct
function changeCommentHeader(n){
if($("#page.watch") || $("#page.all_comments")){
if($(".distiller_yt_headline.startube") == null){
var elm = ".distiller_yt_headline";
waitForElement10(elm).then(function(elm){
if(canGo != false){
if($("#page.watch") || $("#page.all_comments")){
if($(".distiller_yt_headline.startube") == null){
CWD.commentCount = $(".distiller_yt_headline span:nth-child(2)").textContent.split("(")[1].split(")")[0];
$(".distiller_yt_headline").innerHTML = `
Comments • Comments
`;
$(".distiller_yt_headline .comment-count").textContent = CWD.commentCount;
$(".distiller_yt_headline").classList.add("startube");
let comment=$(".comment");
CWD.commentTeaserPfp=comment.querySelector(".distiller_yt-thread_avatar").src;
CWD.commentTeaserText=comment.querySelector(".text-content span").textContent;
}
if($(".st-teaser-comment-text")){
if(CWD.commentTeaserText!=null){
$(".st-teaser-comment-text").textContent=CWD.commentTeaserText;
$(".st-comment-teaser-pfp").src=CWD.commentTeaserPfp;
$(".st-comment-count").textContent=CWD.commentCount;
$(".st-comment-teaser").setAttribute("has-comment","");
}else{
$(".st-your-pfp").src=gdp.pfp;
}
}
}
}
});
}
}
}
function dupeDetect(){
if($("#StarTubeDuplicateDetector")==null){
// This is used for detecting whether or not the user has multiple versions of StarTube enabled, as that almost never goes well
// Each StarTube version has its own unique ID so StarTube versions can determine what other version of StarTube is running alongside them.
// Only supports StarTube stable and beta 2.3.1 and later.
let cont=$("body");
let nE=document.createElement("div");
nE.id="StarTubeDuplicateDetector";
nE.setAttribute("st-id",STUID);
nE.setAttribute("st-ver",currStarVer);
cont.insertBefore(nE,cont.children[0]);
}else{
let st_id=$("#StarTubeDuplicateDetector").getAttribute("st-id");
let ver=$("#StarTubeDuplicateDetector").getAttribute("st-ver");
if(ver==null){
ver="2.3.1 or earlier";
}
if(st_id==STUID){
}else{
alert("You have another version of StarTube installed: "+ver+" (the version of StarTube giving you this message is: "+currStarVer+"). Having multiple versions of StarTube installed is almost never a good idea. Please disable one of them.");
}
}
}
function doStarTube(){
document.addEventListener("V3_NAVITRONIC_STARTED", function(e){
if(e.detail.isPopstateCached==true){
isPopstate=true;
}else{
isPopstate=false;
}
setTimeout(checkContentMargin, 500);
setTimeout(checkContentMargin, 1500);
});
document.addEventListener("V3_SERVERCONTRACT_FLUSH_DOCEL_ATTRIB", function(e){
everyLoad();
});
document.addEventListener("V3_NAVITRONIC_FINISHED", function(e){
refreshCheck = 0;
everyLoad("x");
checkPlayerSize();
checkContentMargin();
setTimeout(checkContentMargin, 500);
setTimeout(checkContentMargin, 1500);
setTimeout(checkContentMargin, 2500);
setTimeout(checkContentMargin, 3000);
altWatch9Resize();
setTimeout(altWatch9Resize,1000);
});
window.addEventListener("resize", function(){
checkContentMargin();
checkPlayerSize();
altWatch9Resize();
});
setTimeout(checkPlayerSize,500);
setTimeout(checkPlayerSize,2000);
setTimeout(checkPlayerSize,4000);
setTimeout(altWatch9Resize,1000);
setTimeout(altWatch9Resize,3000);
setTimeout(altWatch9Resize,5000);
function altWatch9Resize(){
if($("[wl^='aw9']")&&$(".st-watch-owner-column")){
if($("[pw='640']")){
if($(".st-watch-owner-column .st-handoff-item")){
let tM=$(".st-watch-owner-column .st-handoff-item");
let nH=$("#creator-slider .st-slider-inner");
nH.append(tM);
}
}else if($(".st-watch-owner-column .st-handoff-item")==null){
let tM=$("#creator-slider .st-handoff-item");
let nH=$(".st-watch-owner-column");
nH.append(tM);
if($("[trigger='creator'].active")){
$("#st-watch-below").setAttribute("state","video-info");
$("[trigger='creator']").classList.remove("active");
$("[trigger='video-info']").classList.add("active");
$("#creator-slider").classList.remove("active");
$("#video-info-slider").classList.add("active");
}
}
}
}
function checkPlayerSize(){
if($("#watch7-main")){
let width=$("#watch7-main > #watch7-content").offsetWidth;
$("body .v3").setAttribute("pw",width);
}
}
everyLoad("x");
setTimeout(createThirdColumn, 2000);
setTimeout(dupeDetect,STDELAY);
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");
}
floaterPosition();
}
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, 2000);
setTimeout(everyLoad, 4000);
setTimeout(everyLoad, 6000);
setTimeout(everyLoad, 8000);
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 gS0=document.querySelectorAll(".guide-section")[1];
var gS1=document.querySelectorAll(".guide-section")[0];
var gS2=document.querySelectorAll(".guide-section")[2];
var gS3=document.querySelectorAll(".guide-section")[3];
var nH=$('.guide-toplevel');
nH.appendChild(gS0);
nH.appendChild(gS1);
nH.appendChild(gS2);
nH.appendChild(gS3);
}
});
}
}
});
function createWelcomeAlert(){
let cont=$("#alerts");
let nE=document.createElement("div");
nE.id="st-welcome-alert";
nE.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.
`;
cont.insertBefore(nE,cont.children[0]);
nE.querySelector(".close").addEventListener("click",function(){
nE.style.display="none";
closedWelcomeBanner=true;
STS.showWelcomeBanner=false;
applySettings();
});
}
function createEFYTAlert(){
let cont=$("#alerts");
let nE=document.createElement("div");
nE.id="st-efyt-alert";
nE.innerHTML=`
The Enhancer for YouTube extension is not supported and will cause issues.
`;
cont.insertBefore(nE,cont.children[0]);
nE.querySelector(".close").addEventListener("click",function(){
nE.style.display="none";
closedEFYTBanner=true;
});
switch(bannerNo){
case 1:
newElem.querySelector(".yt-alert").classList.add("yt-alert-info");
break;
case 2:
newElem.querySelector(".yt-alert").classList.add("yt-alert-warn");
break;
case 3:
newElem.querySelector(".yt-alert").classList.add("yt-alert-error");
break;
}
}
function removeLCDark(CW){
if(CW.document.querySelector("html[dark]")){
CW.document.querySelector("html").removeAttribute("dark");
CW.document.querySelector("yt-live-chat-app").removeAttribute("dark");
}
}
function replaceLC(){
let cont=$(".live_chat_box_iframe_holder");
let nE=document.createElement("iframe");
nE.src="https://www.youtube.com/live_chat?is_popout=1&v="+CWD.id;
nE.width="100%";
nE.height="100%";
nE.id="st-live-chat";
cont.innerHTML=``;
cont.insertBefore(nE,cont.children[0]);
let CW=nE.contentWindow;
if($("[dark]")){
CW.document.querySelector("html").setAttribute("dark","");
}else{
setTimeout(function(){
removeLCDark(CW);
},1000);
setTimeout(function(){
removeLCDark(CW);
},3000);
setTimeout(function(){
removeLCDark(CW);
},4000);
setTimeout(function(){
removeLCDark(CW);
},5000);
setTimeout(function(){
removeLCDark(CW);
},7000);
setTimeout(function(){
removeLCDark(CW);
},10000);
}
}
function createThirdColumn(){
if(
$("#page.home")&&
sets.aozoraHome==true&&
!window.location.href.includes("/feed")
){
let theRecs="";
if($(".lohp-newspaper-shelf")){
theRecs=document.querySelectorAll(".feed-item-container")[1];
}else{
theRecs=$(".feed-item-container");
}
if(theRecs.querySelector(".lohp-newspaper-shelf")){
theRecs=document.querySelectorAll(".feed-item-container")[2];
}
let nH=$(".branded-page-v2-secondary-col .branded-page-box");
theRecs.style.display="block";
nH.appendChild(theRecs);
let cont=$(".branded-page-v2-secondary-col");
let nE=document.createElement("div");
nE.id="epic-panda-rules";
nE.innerHTML=`
`;
cont.insertBefore(nE,cont.children[0]);
var elm=".feed-item-container:nth-child(10) img";
waitForElement500(elm).then(function(elm){
if(canGo!=false){
let arrayShelves=document.querySelectorAll(".compact-shelf");
arrayShelves.forEach(i=>{
if(i){
i.classList.add("rule-added");
let nE2=document.createElement("div");
nE2.setAttribute("class","horizontal-rule");
nE2.innerHTML=`
`;
i.insertBefore(nE2,i.children[0]);
}
});
}
});
}
}
function createShelfIcons(){
if(
sets.polymerStyles==true&&
!window.location.href.includes("/feed")
){
if($(".home")||$(".channel")){
var elm=".yt-uix-shelfslider-next";
waitForElement500(elm).then(function(elm){
if(canGo!=false){
let arrayShelves=document.querySelectorAll(".compact-shelf");
arrayShelves.forEach(i=>{
if(i.querySelector(".yt-uix-shelfslider-next:not(.icon-added) .yt-uix-button-icon-wrapper")){
let next=i.querySelector(".yt-uix-shelfslider-next:not(.icon-added) .yt-uix-button-icon-wrapper");
next.parentNode.classList.add("icon-added");
next.parentNode.classList.add("st-shelf-btn");
let nE=document.createElement("div");
nE.setAttribute("class","st-svg");
nE.innerHTML=STH0.SVG;
next.insertBefore(nE,next.children[0]);
nE.querySelector(".filled-icon path").setAttribute("d",svgDefs.rChev.f);
nE.querySelector(".outline-icon path").setAttribute("d",svgDefs.rChev.o);
}
if(i.querySelector(".yt-uix-shelfslider-prev:not(.icon-added) .yt-uix-button-icon-wrapper")){
let prev=i.querySelector(".yt-uix-shelfslider-prev:not(.icon-added) .yt-uix-button-icon-wrapper");
prev.parentNode.classList.add("icon-added");
prev.parentNode.classList.add("st-shelf-btn");
let nE=document.createElement("div");
nE.setAttribute("class","st-svg");
nE.innerHTML=STH0.SVG;
prev.insertBefore(nE,prev.children[0]);
nE.querySelector(".filled-icon path").setAttribute("d",svgDefs.lChev.f);
nE.querySelector(".outline-icon path").setAttribute("d",svgDefs.lChev.o);
}
});
}
});
}
}
}
function createFeedText(){
if($(".epic-panda-header")==null){
var elm=".branded-page-v2-subnav-container";
waitForElement10(elm).then(function(elm){
if(canGo!=false){
let cont=$('.feed-item-container');
let nE=document.createElement("div");
nE.classList="epic-panda-header";
nE.innerHTML=`
From YouTube
`;
cont.insertBefore(nE,cont.children[0]);
}
});
}
}
if($("#st-settings-button")==null){
var elm="#footer";
waitForElement10(elm).then(function(elm){
if(canGo!=false){
if($(".oz-expand-debugger-icon")){
$(".oz-expand-debugger-icon").addEventListener("click",function(){
if($("#st-settings-button")==null){
createExpandedFooter();
}
});
}else if($("#upload-menu-account")){
$("#upload-menu-account:not(.yt-uix-button-menu-new-section-separator)").addEventListener("click",function(){
if($("#st-settings-button")==null){
createOOBEAccessBtn();
}
});
}
if($(".astro-settings")==null){
createSettingsMenu();
}
}
});
}
function deleteTitleOnTop(){
if($("#st-watch-above-container")){
$("#st-watch-above-container").remove();
}
}
function guideAlwaysPinned(){
if($(".guide-pinning-enabled")==null){
$("body").classList.add("guide-pinning-enabled");
}
if($(".guide-pinned")==null){
$("body").classList.add("guide-pinned");
}
if($(".guide-guide")==null){
$("body").classList.add("show-guide");
}
}
function hideYoodles(){
if($("#logo-container.doodle")){
$("#logo-container.doodle").classList.remove("doodle");
$("#logo-container img").src="//s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif";
if($(".content-region")){
$(".content-region").removeAttribute("style");
}
}
}
function createNewWatchPrep(){
if($("#watch7-content.watch-content .yt-uix-button")!=null){
if($("#st-watch-below-container")==null||$("#st-watch-above-container")==null){
if($("#watch7-creator-bar")!==null){
createNewWatch(1);
}else{
createNewWatch(0);
}
}
}else{
var elm="#watch7-content.watch-content .yt-uix-button";
waitForElement10(elm).then(function(elm){
if(canGo!=false){
if($("#st-watch-below-container")==null||$("#st-watch-above-container")==null){
if($("#watch7-creator-bar")!==null){
createNewWatch(1);
}else{
createNewWatch(0);
}
}
}
});
}
}
function moveCountsToButtons(){
var elm=".watch";
waitForElement10(elm).then(function(elm){
if(canGo!=false){
if($(".likes-count")!=null){
let lC=$(".likes-count").textContent;
let dC=$(".dislikes-count").textContent;
$("#watch-like .run").textContent=lC;
$("#watch-dislike .yt-uix-button-content").innerHTML=`
Dislike
`;
$("#watch-dislike .run").textContent=dC;
$("#watch-dislike").classList.remove("yt-uix-button-empty");
}
}
});
}
function createMoreTooltips(){
var elm=".watch";
waitForElement10(elm).then(function(elm){
if(canGo!=false){
if(document.querySelector(".video-extras-sparkbars") != null){
if(document.querySelector(".video-extras-sparkbars.yt-uix-tooltip") == null){
var percent = document.querySelector(".video-extras-sparkbar-likes").style.width;
document.querySelector(".video-extras-sparkbars").setAttribute("title", percent + " of viewers like this video");
document.querySelector(".video-extras-sparkbars").classList.add("yt-uix-tooltip");
}
}
if(document.querySelector("#watch7-user-header .yt-user-name") != null){
if(document.querySelector("#watch7-user-header .yt-user-name.yt-uix-tooltip") == null){
var user = document.querySelector("#watch7-user-header .yt-user-name").textContent;
document.querySelector("#watch7-user-header .yt-user-name").setAttribute("title", "View " + user + "'s channel");
document.querySelector("#watch7-user-header .yt-user-name").classList.add("yt-uix-tooltip");
document.querySelector("#watch7-user-header .yt-user-videos").setAttribute("title", "View " + user + "'s videos");
document.querySelector("#watch7-user-header .yt-user-videos").classList.add("yt-uix-tooltip");
}
}
if(document.querySelector(".yt-uix-button-subscribe-branded:not([disabled='True'])") != null){
if(document.querySelector(".yt-uix-button-subscribe-branded:not([disabled='True']):not(.yt-uix-tooltip)") != null){
document.querySelector(".yt-uix-button-subscribe-branded:not([disabled='True']):not(.yt-uix-tooltip)").setAttribute("title", "Subscribe");
document.querySelector(".yt-uix-button-subscribe-branded:not([disabled='True']):not(.yt-uix-tooltip)").classList.add("yt-uix-tooltip");
}
}
if(document.querySelector(".yt-uix-button-subscribed-branded:not([disabled='True'])") != null){
if(document.querySelector(".yt-uix-button-subscribed-branded:not([disabled='True']):not(.yt-uix-tooltip)") != null){
document.querySelector(".yt-uix-button-subscribed-branded:not([disabled='True']):not(.yt-uix-tooltip)").setAttribute("title", "Unsubscribe");
document.querySelector(".yt-uix-button-subscribed-branded:not([disabled='True']):not(.yt-uix-tooltip)").classList.add("yt-uix-tooltip");
}
}
if(document.querySelector("#watch7-secondary-actions .start") != null){
if(document.querySelector("#watch7-secondary-actions .start.yt-uix-tooltip") == null){
document.querySelector("#watch7-secondary-actions .start").setAttribute("title", "Video info");
document.querySelector("#watch7-secondary-actions .start").classList.add("yt-uix-tooltip");
if(STS.expWatch7AboutTabRename == true){
document.querySelector("#watch7-secondary-actions .start span").textContent = "Video info";
}
if(STS.expWatch7AboutTabRename2 == true){
document.querySelector("#watch7-secondary-actions .start span").textContent = "Details";
}
}
}
}
});
if(document.querySelector("#watch7-secondary-actions .yt-uix-button:nth-child(2)") != null){
if(document.querySelector("#watch7-secondary-actions .yt-uix-button.yt-uix-tooltip:nth-child(2)") == null){
document.querySelector("#watch7-secondary-actions .yt-uix-button:nth-child(2)").setAttribute("title", "Share");
document.querySelector("#watch7-secondary-actions .yt-uix-button:nth-child(2)").classList.add("yt-uix-tooltip");
}
}
if(document.querySelector("#watch7-secondary-actions .yt-uix-button:nth-child(3)") != null){
if(document.querySelector("#watch7-secondary-actions .yt-uix-button.yt-uix-tooltip:nth-child(3)") == null){
document.querySelector("#watch7-secondary-actions .yt-uix-button:nth-child(3)").setAttribute("title", "Add to");
document.querySelector("#watch7-secondary-actions .yt-uix-button:nth-child(3)").classList.add("yt-uix-tooltip");
}
}
}
function createSearchText(){
if($("#masthead-search-term")){
$("#masthead-search-term").setAttribute("placeholder",lang[usedLang].search);
}
}
function doModernGuide(){
if($("#FEwhat_to_watch-guide-item.startube") == null){
if($("#FEwhat_to_watch-guide-item") != null){
$("#FEwhat_to_watch-guide-item .display-name span").textContent = "Home";
$("#FEwhat_to_watch-guide-item").classList.add("startube");
let container = $("#FEwhat_to_watch-guide-item .yt-valign-container");
let newElem = document.createElement("div");
newElem.setAttribute("class","st-svg thumb");
container.classList.add("startube-has-icon");
newElem.innerHTML = `
`;
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($("[chan-loc]")){
$("html").removeAttribute("chan-loc");
}
}
if($("#page.search")){
$("html").setAttribute("location","search");
}
let feedLink="/feed/what_to_watch/recommended";
if(SRS.logoLink.tValue=="feedGrid"){
feedLink="/feed/what_to_watch/recommended?flow=grid";
}
if($("#logo-container")){
if(SRS.logoLink.tValue=="feedList"||SRS.logoLink.tValue=="feedGrid"){
$("#logo-container").href=feedLink;
$("#logo-container").data={
abstractVorElement:{
navigationEndpoint:{
browseEndpoint:{
browseId:"FEwhat_to_watch",
canonicalBaseUrl:feedLink
},
commandMetadata:{
webCommandMetadata:{
url:feedLink
}
}
}
}
}
}
}
let subsLink = "/feed/subscriptions";
if(SRS.subsGrid.tValue=="grid"){
subsLink = "/feed/subscriptions?flow=grid";
}
if(SRS.logoLink.tValue=="feedGrid"){
var elm="#FEwhat_to_watch-guide-item";
waitForElement10(elm).then(function(elm){
if(canGo!=false){
$("#FEwhat_to_watch-guide-item a").href="/feed/what_to_watch/recommended?flow=grid";
$("#FEwhat_to_watch-guide-item a").data={
abstractVorElement:{
navigationEndpoint:{
browseEndpoint:{
browseId:"FEwhat_to_watch",
canonicalBaseUrl:"/feed/what_to_watch/recommended?flow=grid"
},
commandMetadata:{
webCommandMetadata:{
url:"/feed/what_to_watch/recommended?flow=grid"
}
}
}
}
}
}
});
}
if($("#logo-container")){
if(SRS.logoLink.tValue=="subs"){
$("#logo-container").href=subsLink;
$("#logo-container").data={
abstractVorElement:{
navigationEndpoint:{
browseEndpoint:{
browseId:"FEsubscriptions",
canonicalBaseUrl:subsLink
},
commandMetadata:{
webCommandMetadata:{
url:subsLink
}
}
}
}
}
}
}
if(SRS.subsGrid.tValue=="grid"&&$("#FEsubscriptions-guide-item")){
$("#FEsubscriptions-guide-item a").href=subsLink;
$("#FEsubscriptions-guide-item a").data={
abstractVorElement:{
navigationEndpoint:{
browseEndpoint:{
browseId:"FEsubscriptions",
canonicalBaseUrl:subsLink
},
commandMetadata:{
webCommandMetadata:{
url:subsLink
}
}
}
}
}
}
let theDelay=1;
if(isPopstate==true){
theDelay=300;
}
setTimeout(function(){
switch (SRS.layoutSelect.tValue){
case "stargazer2008_1":
layoutFactor=150000;
break;
case "stargazer2009_1":
layoutFactor=180000;
break;
case "stargazer2009_3":
layoutFactor=200000;
break;
case "aozora2011_2":
layoutFactor=250000;
break;
case "cosmic2012_1":
layoutFactor=276000;
break;
case "cosmic2012_2":
layoutFactor=278000;
break;
case "cosmic2012_3":
layoutFactor=280000;
break;
case "epic2012_2":
layoutFactor=310000;
break;
case "epic2012_1":
layoutFactor=320000;
break;
case "hh2013_1":
layoutFactor=336000;
break;
case "hh2013_2":
layoutFactor=338000;
break;
case "hh2013_3":
layoutFactor=340000;
break;
case "hh2013alt_3":
layoutFactor=350000;
break;
case "hh2014alt_1":
layoutFactor=360000;
break;
case "hh2014":
layoutFactor=368000;
break;
case "hhE2015":
layoutFactor=370000;
break;
case "hh2015":
layoutFactor=372000;
break;
case "hhE2016":
layoutFactor=374000;
break;
case "hhM2016":
layoutFactor=375000;
break;
case "hh2016":
layoutFactor=376000;
break;
case "hhE2017":
layoutFactor=377000;
break;
case "hh2017":
layoutFactor=378000;
break;
case "hh2018":
layoutFactor=379000;
break;
case "hh2024":
layoutFactor=380000;
break;
case "sb2016":
layoutFactor=410000;
break;
case "sb2017":
layoutFactor=415000;
break;
case "sb2024":
layoutFactor=420000;
break;
case "poly2016":
layoutFactor=445000;
break;
case "polyE2017":
layoutFactor=450000;
break;
case "poly2017":
layoutFactor=455000;
break;
case "poly2018":
layoutFactor=460000;
break;
case "poly2019":
layoutFactor=465000;
break;
case "poly2020":
layoutFactor=470000;
break;
case "poly2021":
layoutFactor=475000;
break;
case "poly2022":
layoutFactor=480000;
break;
case "amst2023_1":
layoutFactor=490000;
break;
case "amst2024c":
layoutFactor=500000;
break;
}
switch (SRS.relatedTabs.tValue){
case "onNoSub":
$(".spitfire-body-container").setAttribute("rel-tabs","on-no-sub");
break;
case "on":
$(".spitfire-body-container").setAttribute("rel-tabs","on");
break;
case "off":
$(".spitfire-body-container").setAttribute("rel-tabs","off");
break;
}
switch (SRS.watchLayout.tValue){
case "watch4b":
$(".spitfire-body-container").setAttribute("wl","w4b");
break;
case "watch4c":
$(".spitfire-body-container").setAttribute("wl","w4c");
break;
case "watch5a":
$(".spitfire-body-container").setAttribute("wl","w5a");
break;
case "watch5b":
$(".spitfire-body-container").setAttribute("wl","w5b");
break;
case "watch5c":
$(".spitfire-body-container").setAttribute("wl","w5c");
break;
case "watch5d":
$(".spitfire-body-container").setAttribute("wl","w5d");
break;
case "watch6":
$(".spitfire-body-container").setAttribute("wl","w6");
break;
case "watch7beta":
$(".spitfire-body-container").setAttribute("wl","w7beta");
html.setAttribute("exp-epic-watch7","");
break;
case "watch7":
$(".spitfire-body-container").setAttribute("wl","w7");
break;
case "watch8":
$(".spitfire-body-container").setAttribute("wl","w8");
break;
case "watch9a":
$(".spitfire-body-container").setAttribute("wl","w9a");
break;
case "watch9b":
$(".spitfire-body-container").setAttribute("wl","w9b");
break;
case "watch9c":
$(".spitfire-body-container").setAttribute("wl","w9c");
break;
case "watch10beta":
$(".spitfire-body-container").setAttribute("wl","w10beta");
html.setAttribute("comment-teaser","");
break;
case "watch10teaser":
$(".spitfire-body-container").setAttribute("wl","w10finalteaser");
html.setAttribute("comment-teaser","");
break;
case "watch10":
$(".spitfire-body-container").setAttribute("wl","w10final");
break;
case "watch11":
$(".spitfire-body-container").setAttribute("wl","w11");
break;
case "altWatch9":
$(".spitfire-body-container").setAttribute("wl","aw9");
break;
case "altWatch9Fancy":
$(".spitfire-body-container").setAttribute("wl","aw9f");
html.setAttribute("exp-watch9-sidebar-bus","");
html.setAttribute("exp-watch9-sticky-columns","");
break;
default:
}
switch (SRS.searchText.tValue){
case "on":
createSearchText();
break;
case "off":
break;
}
switch (SRS.playerVersion.tValue){
case "modernV1":
doModernPlayer();
html.setAttribute("pl-ver","mv1");
break;
case "modernV2":
doModernPlayer();
html.setAttribute("pl-ver","mv2");
break;
case "modernV3":
doModernPlayer();
html.setAttribute("pl-ver","mv2-3");
break;
case "modernV4":
doModernPlayer();
html.setAttribute("pl-ver","mv2-34");
break;
}
switch (SRS.accountMenu.tValue){
case "mhh":
createAccountMenu();
html.setAttribute("exp-account-menu","");
break;
case "poly":
createAccountMenu();
html.setAttribute("exp-account-menu","");
html.setAttribute("exp-polymer-account-menu","");
break;
}
switch (SRS.uploadBtn.tValue){
case "icon":
createUploadIcon();
html.setAttribute("upload-icon","");
break;
case "create":
createCreateIcon(0);
html.setAttribute("create-icon","");
break;
case "createBtn":
createCreateIcon(1);
html.setAttribute("create-btn","");
break;
}
switch (SRS.appsBtn.tValue){
case "yt":
createYouTubeApps();
html.setAttribute("exp-youtube-apps","");
break;
case "goog":
createGoogleApps();
html.setAttribute("exp-google-apps","");
break;
}
if(SRS.guideAlwaysPinned.tValue=="on"){
guideAlwaysPinned();
}
if(SRS.relatedGrid.tValue=="on"){
html.setAttribute("exp-related-grid","");
}
if(SRS.frostedGlass.tValue=="on"){
$(".spitfire-body-container").setAttribute("frosted-glass","");
createFrostedGlass();
}
if(SRS.rndPlayer.tValue=="on"){
html.setAttribute("round-player","");
}
if(SRS.rndThumbs.tValue=="on"){
html.setAttribute("round-thumbs","");
}
if(SRS.siteFont.tValue=="roboto"){
html.setAttribute("exp-roboto","");
}
if(SRS.colorfulChannels.tValue=="on"){
html.setAttribute("exp-colorful-channels","");
}
if(SRS.playerSpinner.tValue=="material"){
html.setAttribute("mtrl-spin","");
setTimeout(createMaterialSpinner,100);
}
if(SRS.outlineIcons.tValue=="on"){
html.setAttribute("exp-outline-icons","");
sets.outlineIcons=true;
}
if(SRS.channelVersion.tValue=="c3"&&!window.location.href.includes("force-c4")){
html.setAttribute("exp-channels3","");
createChannels3Prep();
}
/*thesets*/
$(".spitfire-body-container").setAttribute("layout",SRS.layoutSelect.tValue);
html.setAttribute("ly",SRS.layoutSelect.tValue);
if(SRS.layoutSelect.tValue=="poly2022"||SRS.layoutSelect.tValue=="amst2023_1"||SRS.layoutSelect.tValue=="amst2024c"){
html.setAttribute("exp-secondary-search-icon","");
createSearchTumor();
sets.secondarySearchIcon=true;
html.setAttribute("simple-reply","");
sets.simpleReply=true;
}
if($("[layout^='hh']")==null){
html.setAttribute("hide-appbar","");
}
if($("[layout^='hh']")||$("[layout^='sb']")||$("[layout^='poly']")||$("[layout^='amst']")){
if($("[layout^='hh2013']")==null){
html.setAttribute("exp-modern-playlists","");
sets.modernPlaylists=true;
html.setAttribute("exp-modern-playlist-thumbnails","");
sets.modernPlaylistThumbnails=true;
}
if($("[layout^='hh2013']")==null&&$("[layout^='hh2014']")==null){
html.setAttribute("exp-home-tab","");
sets.homeTab=true;
html.setAttribute("exp-modern-topbar","");
sets.modernTopbar=true;
}
if($("[layout^='hh']")==null&&$("[layout^='sb']")==null){
html.setAttribute("exp-polymer-channels","");
sets.polymerChannels=true;
}
if($("[layout^='hh2013']")==null&&$("[layout^='hh2014']")==null&&$("[layout^='hhE2015']")==null&&$("[layout^='hh2015']")==null){
html.setAttribute("exp-modern-guide-button","");
sets.modernGuideButton=true;
}
}
if($("[layout^='sb']")||$("[layout^='poly']")||$("[layout^='amst']")){
html.setAttribute("poly-comments","");
html.setAttribute("exp-polymer-comments","");
moveSortBtn();
sets.polymerComments=true;
html.setAttribute("exp-material-sign-in","");
sets.materialSignIn=true;
changeCommentPlaceholder(1);
changeCommentHeader(1);
setTimeout(createShelfIcons,200);
createNotifIcon();
createSearchIcon();
setTimeout(createNotifIcon,20000);
html.setAttribute("exp-modern-home","");
sets.modernHome=true;
}
if($("[layout^='poly']")||$("[layout^='amst']")){
html.setAttribute("exp-polymer-shell","");
sets.polymerShell=true;
html.setAttribute("poly-styles","");
html.setAttribute("exp-polymer-styles","");
sets.polymerStyles=true;
}
if($("[layout^='hh']")){
if($("[layout^='hh2013']")==null&&$("[layout^='hh2014']")==null&&$("[layout^='hhE2015']")==null&&$("[layout^='hh2015']")==null&&$("[layout^='hhE2016']")==null){
html.setAttribute("exp-modern-notif-icon","");
sets.modernNotifIcon=true;
html.setAttribute("exp-modern-title","");
sets.modernTitle=true;
}
if($("[layout^='hh2013']")==null&&$("[layout^='hh2014']")==null){
html.setAttribute("modern-styles","");
changeCommentPlaceholder(0);
changeCommentHeader(0);
sets.modernStyles=true;
}
if($("[layout^='hh2013']")==null){
html.setAttribute("exp-light-channel-bar","");
sets.lightChannelBar=true;
html.setAttribute("exp-modern-home","");
sets.modernHome=true;
html.setAttribute("modern-cards","");
}
}
if(SRS.gbarVersion.tValue=="material"){
html.setAttribute("exp-material-gbar","");
}
if($("[layout^='star']")){
html.setAttribute("stargazer-sub","");
}
if($("[layout^='stargazer2008']")){
html.setAttribute("stargazer-header","tabbed");
stargazerHeader(0);
searchButtonLowercase();
}
if($("[layout^='stargazer2009_1']")){
html.setAttribute("stargazer-header","bar");
stargazerHeader(1);
searchButtonLowercase();
}
if($("[layout^='stargazer2009_3']")){
html.setAttribute("stargazer-header","simple");
stargazerHeader(2);
searchButtonLowercase();
}
if($("[layout^='aoz']")||$("[layout^='star']")){
html.setAttribute("aozora-styles","");
html.setAttribute("exp-aozora-styles","");
sets.aozoraStyles=true;
html.setAttribute("exp-aozora-bg","");
sets.aozoraBG=true;
html.setAttribute("aozora-home","");
html.setAttribute("exp-aozora-home","");
sets.aozoraHome=true;
}
if($("[layout^='aoz']")){
html.setAttribute("aozora-header","");
html.setAttribute("exp-aozora-header","");
searchButtonLowercase();
sets.aozoraHeader=true;
html.setAttribute("exp-aozora-topbar-links","");
createAozoraTopbarLinks();
sets.aozoraTopbarLinks=true;
}
if($("[layout^='cos']")){
html.setAttribute("cosmic-styles","");
sets.cosmicStyles=true;
//html.setAttribute("cosmic-buttons","");
sets.cosmicButtons=true;
html.setAttribute("exp-cosmic-guide-style","");
sets.cosmicGuideStyle=true;
html.setAttribute("exp-aozora-topbar-links","");
createAozoraTopbarLinks();
sets.aozoraTopbarLinks=true;
html.setAttribute("exp-cosmic-feeds-third-column","");
doThirdColumnVideosPrep();
html.setAttribute("aozora-home","");
html.setAttribute("exp-aozora-home","");
sets.aozoraHome=true;
html.setAttribute("topbar","cosmic");
//html.setAttribute("cosmic-bg","");
}
if($("[layout^='cosmic2012_1']")){
html.setAttribute("exp-cosmic-banners","");
html.setAttribute("exp-cosmic-feeds-v1","");
doCosmicFeedHeader();
}
if($("[layout^='cosmic2012_2']")){
html.setAttribute("exp-cosmic-banners-v2","");
html.setAttribute("exp-cosmic-feeds-v2","");
doCosmicFeedHeader();
}
if($("[layout^='cosmic2012_3']")){
html.setAttribute("exp-cosmic-banners-v2","");
html.setAttribute("exp-cosmic-feeds-v3","");
doCosmicFeedHeader();
}
if($("[layout^='hhE2017']")||$("[layout^='hh2017']")||$("[layout^='hh2018']")||$("[layout^='hh2024']")||$("[layout^='poly201']")){
html.setAttribute("exp-big-search-thumbs","");
}
if($("[layout^='epic2012_2']")){
//html.setAttribute("cosmic-buttons","");
sets.cosmicButtons=true;
html.setAttribute("exp-aozora-topbar-links","");
createAozoraTopbarLinks();
sets.aozoraTopbarLinks=true;
html.setAttribute("topbar","cosmic");
}
if($("[layout^='epic2012_1']")||$("[layout^='epic2012_2']")){
html.setAttribute("exp-epic-styling","");
sets.epicStyling=true;
html.setAttribute("aozora-home","");
html.setAttribute("exp-aozora-home","");
sets.aozoraHome=true;
}
if($("[layout^='hh2013_1']")||$("[layout^='hh2013_2']")){
html.setAttribute("aozora-home","");
html.setAttribute("exp-aozora-home","");
sets.aozoraHome=true;
}
if($("[layout^='epic2012_2']")){
html.setAttribute("exp-epic-feeds","");
doCosmicFeedHeader();
}
if($("[layout^='epic2012_1']")){
html.setAttribute("topbar","epic");
html.setAttribute("exp-epic-watch7-flat","");
}
if($("[layout^='hh2013_1']")||$("[layout^='epic2012_1']")){
html.setAttribute("exp-classic-buttons","");
}
if($("[layout^='poly2016']")){
html.setAttribute("exp-beta-polymer-styles","");
sets.betaPolyStyles=true;
html.setAttribute("exp-early-polymer-shell","");
sets.earlyPolymerShell=true;
}
if($("[layout^='poly2017']")||$("[layout^='polyE2017']")){
html.setAttribute("exp-early-polymer-shell","");
sets.earlyPolymerShell=true;
}
if($("[layout^='amst']")){
html.setAttribute("exp-rounded-guide","");
sets.roundedGuide=true;
html.setAttribute("round-styles","");
sets.roundStyles=true;
html.setAttribute("poly-g3-colors","");
sets.polyG3Colors=true;
}
if($("[layout^='poly201']")){
html.setAttribute("exp-polymer-subscribe","");
}
if($("[layout^='poly202']")||$("[layout^='amst']")){
html.setAttribute("exp-polymer-subscribe","");
html.setAttribute("exp-polymer-gen2-subscribe","");
html.setAttribute("exp-bigger-search-thumbs","");
sets.polyG2Sub=true;
}
if($("[layout^='poly2021']")||$("[layout^='poly2022']")){
html.setAttribute("typography-spacing","");
}
if($("[layout^='poly2019']")||$("[layout^='poly202']")||$("[layout^='amst']")){
html.setAttribute("poly-g2-colors","");
html.setAttribute("exp-polymer-gen2-colors","");
sets.polyG2Colors=true;
html.setAttribute("poly-g2-comments","");
sets.polyG2Comments=true;
}
if($("[layout^='sb']")){
html.setAttribute("skybird","");
createSearchIcon();
createNotifIcon();
setTimeout(createNotifIcon,20000);
sets.sb=true;
html.setAttribute("skybird-cards","");
sets.sbCards=true;
html.setAttribute("exp-polymer-subscribe","");
html.setAttribute("exp-polymer-gen2-subscribe","");
sets.polyG2Sub=true;
html.setAttribute("modern-cards","");
sets.modernCards=true;
}
if($("[layout^='sb']")||$("[layout^='poly']")||$("[layout^='amst']")){
$("body .v3").setAttribute("poly-layout","");
}
if($("[layout^='poly']")||$("[layout^='amst']")){
$("body .v3").setAttribute("poly-layout","true");
}
if($("[layout^='hh2013_1']")==null&&$("[layout^='hh2013_2']")==null&&$("[layout^='star']")==null&&$("[layout^='epic']")==null&&$("[layout^='aoz']")==null&&$("[layout^='coz']")==null){
html.setAttribute("exp-skinny-subscribe","");
}
if($("[layout^='hh2013']")==null&&$("[layout^='hh2014alt']")==null){
html.setAttribute("exp-modern-upload","");
}
if($("[layout^='hh2013_1']")){
html.setAttribute("classic-styles","");
}
if($("[layout^='hhE2016']")||$("[layout^='hhM2016']")||$("[layout^='hh2016']")||$("[layout^='hhE2017']")||$("[layout^='hh2017']")||$("[layout^='hh2018']")||$("[layout^='hh2024']")||$("[layout^='poly']")||$("[layout^='ams']")){
html.setAttribute("exp-modern-search-icon","");
}
if($("[layout^='poly2022']")||$("[layout^='amst2023_1']")||$("[layout^='amst2024c']")){
if($("[wl^='w9']")==null){
html.setAttribute("exp-yt-sans-title","");
}
}
/*if($("[layout^='amst2024c']")){
html.setAttribute("create-btn","");
createCreateIcon(1);
}*/
html.setAttribute("config-watch7-sidebar-card-shadow","");
html.setAttribute("exp-comments-full-width","");
html.setAttribute("exp-fixed-share-icons","");
replaceFavicon(SRS.faviconSelect.tValue);
$(".spitfire-body-container").setAttribute("search-text",SRS.searchText.tValue);
$(".spitfire-body-container").setAttribute("rel-size",SRS.relatedSize.tValue);
$(".spitfire-body-container").setAttribute("compact-date",SRS.compactDate.tValue);
createNewWatchPrep();
if(SRS.compactName.tValue=="on"&&$("#page.watch")){
multiMod("related");
}
if(V3_SETTINGS_CONF.WATCH_AUTOPLAY_DELEGATION==true&&$("[location='watch']")){
var elm=".autoplay-bar";
waitForElement10(elm).then(function(elm){
if(canGo!=false){
createAutoplay();
setTimeout(createAutoplay,1500);
setTimeout(createAutoplay,3000);
}
});
}
},theDelay);
var arraNum=0;
arra.forEach(i=>{
let name=i[0];
checkSetting(name).then(function(value){
if(value == true && name == "configNoCast"){
html.setAttribute("nocast","");
}else 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 == "expWatch9NoOwner"){
html.setAttribute("exp-watch9-no-owner", "");
}else if(value == true && name == "expWatch9TrueExpander"){
html.setAttribute("exp-watch9-true-expander","");
}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 == "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("classic-sub","");
}else if(value == true && name == "expClassicLtod"){
html.setAttribute("exp-classic-ltod","");
}else if(value == true && name == "expNoVideosLink"){
html.setAttribute("exp-no-videos-link","");
}else if(value == true && name == "expModernGuide"){
html.setAttribute("exp-modern-guide","");
doModernGuide();
}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 == "expNoByText"){
html.setAttribute("exp-no-by-text","");
}else if(value == true && name == "expStaticSite"){
html.setAttribute("static", "");
}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 == "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 == "expNotifSquare"){
html.setAttribute("notif-square","");
}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 == "expAozoraComments"){
html.setAttribute("exp-legacy-comments","");
html.setAttribute("exp-aozora-comments","");
}else if(value == true && name == "expAozoraSearch"){
html.setAttribute("aozora-search","");
}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 == "expMaterialSearch"){
html.setAttribute("exp-material-search","");
createSearchIcon();
}else if(value == true && name == "expTopbarShadow"){
html.setAttribute("exp-topbar-shadow","");
}else if(value == true && name == "expRichGridHome"){
html.setAttribute("exp-rich-grid-home","");
setTimeout(doRichGridHome,200);
}else if(value == true && name == "expSegmentedLtod"){
html.setAttribute("segmented-ltod","");
}else if(value == true && name == "expRoundedSubscribe"){
html.setAttribute("round-sub","");
}else if(value == true && name == "expBlackSubscribe"){
html.setAttribute("black-sub","");
}else if(value == true && name == "expRoundedSearch"){
html.setAttribute("round-search","");
}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 == "expRoundedTopbarPfp"){
html.setAttribute("exp-rounded-topbar-pfp","");
}else if(value == true && name == "expRingo2"){
html.setAttribute("ringo2","");
html.setAttribute("exp-ringo2","");
doGuideIcons("ringo2");
}else if(value == true && name == "expRingo2Gradients"){
html.setAttribute("ringo2-gradients","");
}else if(value == true && name == "expHideYoodles"){
html.setAttribute("exp-hide-yoodles","");
hideYoodles();
}else if(value == true && name == "expFixedXIcon"){
html.setAttribute("exp-fixed-x-icon","");
}
});
});
refreshCheck++;
if(
$("#st-nsp") === null &&
STS.show2point4 == true
){
let container76=$('.spitfire-body-container.v3');
let newElem76=document.createElement("div");
newElem76.id="st-nsp";
newElem76.innerHTML=`
What's new in StarTube 2.4.0
Settings have been reset
Due to a bug with the new internal settings structure, upgrading 2.3 configs to 2.4 configs is unreliable and can cause major issues. So instead, you've been given a fresh new config for 2.4.0. The settings structure is more futureproofed now, and is much better overall.
Watch Layout HTML Rewrite
The watch layout HTML (page structure) has been rewritten. While mostly an under-the-hood improvement, some improvements have been made to the user experience because of it.
Stargazer watch layout
One of the Stargazer watch layouts, Watch4B has been added thanks to the HTML rewrite.
Advanced options are being phased out
Several advanced options have been removed, and were replaced with easier to understand regular options.
New layout options
2023 Layout, Early 2017 Layout, Early 2014 Layout (Prototype), and Late 2013 Layout (Prototype) have been added, and are all variations of existing layouts.
Free as a Skybird
An entirely custom layout has been added to StarTube: Skybird. It aims to be an alternate universe 2016/2017 layout.
Toggle Dark Mode from the account menu
In the Polymer layouts, you can now toggle dark mode from the account menu.
`;
container.insertBefore(newElem, container.children[4]);
$("#st-settings-button").addEventListener("click", showHideSettings);
}
function createExpandedFooter(){
let container = document.querySelector('.smartadd.selected .smartadd_content .internal-config');
//let container = document.querySelector('#yt-masthead-content');
var newElem = document.createElement("div");
newElem.id = "startube-astro-settings";
newElem.innerHTML = `
`;
container.insertBefore(newElem, container.children[0]);
$("#st-settings-button").addEventListener("click", showHideSettings);
}
function createSettingsMenu(){
let conta=$('.spitfire-body-container.v3');
let nE=document.createElement("div");
nE.id="startube-settings-window-entity";
nE.classList="hid astronomical-settings-refresh astro-settings flex-bar";
nE.innerHTML=`
${STH.astroSettings}
`;
conta.insertBefore(nE,conta.children[1]);
function createSetting(i,container,n,theSet){
let newE=document.createElement("div");
newE.classList="astro-setting astro-radio-setting";
newE.setAttribute("c",theSet);
newE.setAttribute("value",i.value);
newE.innerHTML=STH.astroSetting;
container.insertBefore(newE,container.children[n]);
newE.querySelector(".astro-setting-title span").textContent=i.name;
if(i.mText){
let mT=i.mText;
let aM=newE.querySelector(".astro-minitext");
aM.innerHTML=mT.text;
if(mT.color){
aM.classList.add("astro-"+mT.color);
}
}
if(i.new){
let conta=newE.querySelector(".astro-setting-title");
let newerE=document.createElement("div");
newerE.classList.add("st-new");
newerE.innerHTML=`
New in ${currStarVer}
`;
conta.append(newerE);
}
}
function createSector(i,container,n,theSet,ix){
let newE=document.createElement("div");
newE.classList="astro-sector";
newE.innerHTML=STH.astroSector;
container.insertBefore(newE,container.children[n]);
newE.querySelector("h5").textContent=i.sectorTitle.text;
let settNumb=1;
i.opts.forEach(i=>{
if(i.opt){
createSetting(i.opt,newE,settNumb,theSet);
}else{
createSector(i.sector,newE,settNumb,theSet);
}
settNumb++;
});
}
function createSection(tab,ix,n){
let conta=$("[state-id='"+tab+"'] .astro-scroller-inner");
nE=document.createElement("div");
nE.id=ix.section.id;
nE.classList="astro-section";
nE.innerHTML=STH.astroSection;
conta.insertBefore(nE,conta.children[n]);
nE.querySelector("h4").textContent=ix.section.title.text;
if(ix.section.desc){
nE.querySelector(".astro-description span").innerHTML=ix.section.desc.text;
}
if(ix.section.cW){
nE.querySelector(".astro-cw-cont").innerHTML=ix.section.cW.text;
}
if(ix.section.new){
// nE.querySelector(".astro-title");
}
let setNumb=2;
let theSet=ix.section.id;
ix.section.opts.forEach(i=>{
if(i.opt){
createSetting(i.opt,nE,setNumb,theSet);
}else{
createSector(i.sector,nE,setNumb,theSet);
}
setNumb++;
});
if(ix.section.new){
let conta=nE.querySelector(".astro-title");
let newerE=document.createElement("div");
newerE.classList.add("st-new");
newerE.innerHTML=`
New in ${updateStarVer}
`;
conta.append(newerE);
}
}
radioSets.pages.forEach(i=>{
let obj=i.page;
let tab=obj.tab;
let sectNumb=0;
obj.sections.forEach(ix=>{
createSection(tab,ix,sectNumb);
sectNumb++;
});
});
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].desc;
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");
});
let nH=$("[state-id='config'] .astro-scroller-inner");
let tM=$("#st-logo-section");
nH.insertBefore(tM,nH.children[0]);
$("#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(i => {
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(i => {
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(i => {
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:not(.astro-link)").forEach(i => {
i.addEventListener("click", function(){
$("#startube-settings-content > div").setAttribute("state",i.getAttribute("p"));
$(".astro-sidebar-item.active").classList.remove("active");
i.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(i => {
if(i){
resultCount++;
i.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(i => {
if(i){
var item = i.getAttribute("id");
item = item.toUpperCase();
value = value.toUpperCase();
if(item.includes(value)){
resultCount++;
i.setAttribute("hide","false");
}else{
i.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(i => {
if(i){
i.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(i => {
if(i){
var item = i.getAttribute("id");
var itemV = STS[item];
if(itemV == true){
i.setAttribute("value","true");
}else{
i.setAttribute("value","false");
}
if(STS.ironSettings[item] != null){
i.setAttribute("iron", "true");
}
}
});
/*let FX=$("#st-fancy-fx");
html.addEventListener("mousemove",(e)=>{
var x=e.clientX;
var y=e.clientY;
x=x-10;
y=y-10;
FX.style.left=x+'px';
FX.style.top=y+'px';
});*/
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();
};
}
}
}
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=="RTD"){
localStorage.removeItem(theSets);
localStorage.removeItem("starTubeConfigCreated");
window.location.reload();
}else if(a!=="a"){
if(checked=="true"){
STS[theSetting]=false;
thisElm.setAttribute("value","false");
if(STS.ironSettings[theSetting]){
STS.ironSettings[theSetting]=false;
}
applySettings();
}else{
STS[theSetting]=true;
thisElm.setAttribute("value","true");
if(STS.ironSettings[theSetting]){
STS.ironSettings[theSetting]=true;
}
applySettings();
}
}
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(".astro-radio-setting").forEach(i=>{
if(i.hasAttribute("c")){
let c=i.getAttribute("c");
let xc="[p='"+c+"']";
let value=i.getAttribute("value");
if(value==STS.radioSettings[c].visValue){
i.setAttribute("checked","true");
$(".astro-settings").setAttribute(c,value);
}
i.addEventListener("click",function(){
document.querySelectorAll(".astro-radio-setting").forEach(i2=>{
if (i2.getAttribute("c")==c&&i2.getAttribute("checked")=="true"){
i2.removeAttribute("checked");
$(".astro-settings").setAttribute(c,value);
value==i.getAttribute("value");
i.setAttribute("checked","true");
STS.radioSettings[c].visValue=value;
executeRadios(c,value);
applySettings();
}
});
});
}
});
document.querySelectorAll(".astro-input-setting").forEach(i => {
if(i.hasAttribute("c")){
let c=i.getAttribute("c");
let xc="[p='"+c+"']";
let value=i.querySelector("input").value;
if(value==STS.inputSettings[c].visValue){
$(".astro-settings").setAttribute(c,value);
}
i.addEventListener("keydown",function(){
setTimeout(function(){
value=i.querySelector("input").value;
$(".astro-settings").setAttribute(c,value);
STS.inputSettings[c].visValue=value;
STS.inputSettings[c].tValue=value;
applySettings();
},10);
});
}
});
}
function handoffComments(dir){
let tM=$(".comments-iframe-container");
let nH=$("#comment-panel [js-destination]");
if(dir=="forward"){
html.setAttribute("comment-panel-open","true");
}
if(dir=="backward"){
nH=$("#watch-discussion");
html.setAttribute("comment-panel-open","false");
}
nH.insertBefore(tM,nH.children[0]);
}
//EXfunct
function addIcons(){
if($("#watch-like svg")==null){
var elm="#eow-description";
waitForElement10(elm).then(function(elm){
if(canGo!=false){
let cont=$("#watch-like .yt-uix-button-icon-wrapper");
let nE=document.createElement("div");
nE.setAttribute("class","st-svg");
cont.classList.add("startube-has-icon");
nE.innerHTML = `
`;
cont.insertBefore(nE,cont.children[0]);
}
});
}
if($("#watch-dislike svg")==null){
var elm="#eow-description";
waitForElement10(elm).then(function(elm){
if(canGo!=false){
let cont=$("#watch-dislike .yt-uix-button-icon-wrapper");
let nE=document.createElement("div");
nE.setAttribute("class","st-svg");
cont.classList.add("startube-has-icon");
nE.innerHTML = `
`;
cont.insertBefore(nE,cont.children[0]);
}
});
}
}
function createApps(){
let cont=$('#yt-masthead-user');
let nE=document.createElement("div");
nE.id='google-apps';
nE.innerHTML=`
`;
cont.insertBefore(nE,cont.children[0]);
}
let nE=document.createElement("div");
nE.id="startube-style";
nE.innerHTML=`
`;
html.insertBefore(nE,html.children[0]);
}
function doBanner(){
var elm="#content.ytd-app";
waitForElement(elm).then(function(elm){
if(canGo!=false){
let cont=$('#content.ytd-app');
let nE=document.createElement("div");
nE.id="nebula-return-banner";
nE.innerHTML=`