From fb1ccb2a13c45d7240565d2e75b349ffdee6cf0d Mon Sep 17 00:00:00 2001 From: Prateek Chaubey <41151614+prateek-chaubey@users.noreply.github.com> Date: Mon, 19 Aug 2024 18:22:28 +0530 Subject: [PATCH] Updated the UI 1. Fixed Sponsor bar glitch 2. Fixed the xml caption download error 3. Filename typo error fix 4. Added Light mode in different elements of YTPRO 5. Updated the switches --- scripts/script.js | 98 ++++++++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 44 deletions(-) diff --git a/scripts/script.js b/scripts/script.js index 4c8fe54..a06d9f3 100644 --- a/scripts/script.js +++ b/scripts/script.js @@ -1,6 +1,6 @@ /*****YTPRO******* Author: Prateek Chaubey -Version: 3.4.62 +Version: 3.4.65 URI: https://github.com/prateek-chaubey/ */ @@ -67,7 +67,7 @@ const n = components.searchParams.get('n'); var nc=eval(ytproNCode[0]+ytproNCode[1]+"('"+n+"');"); components.searchParams.set('n',nc); if(p == "sig"){ -return components.toString()+"&sig="+sig; +return components.toString()+"&sig="+sig; } else{ return components.toString(); @@ -79,11 +79,11 @@ return components.toString(); /*Dark and Light Mode*/ var c="#000"; var d="#f2f2f2"; +var isD=false; var dislikes="..."; //Force Dark mode - /* if(document.cookie.indexOf("PREF") < 0 || document.cookie.indexOf("f6=") < 0){ document.cookie.replace( @@ -98,8 +98,10 @@ window.location.href=window.location.href; }*/ if(document.cookie.indexOf("f6=400") > -1){ c ="#fff";d="rgba(255,255,255,0.1)"; +isD=true; }else{ -c="#000";d="rgba(0,0,0,0.1)"; +c="#000";d="rgba(0,0,0,0.05)"; +isD=false; } var downBtn=``; @@ -345,7 +347,7 @@ text-align:center;line-height:35px; `); setDiv.setAttribute("id","setDiv"); var svg=document.createElement("div"); -svg.innerHTML=` +svg.innerHTML=` `; setDiv.appendChild(svg); insertAfter(document.getElementsByTagName("ytm-home-logo")[0],setDiv); @@ -411,14 +413,14 @@ compactDisplay: "short", /*Skips the bad part :)*/ function skipSponsor(){ var sDiv=document.createElement("div"); -sDiv.setAttribute("style",`height:3px;pointer-events:none;width:100%;background:transparent;position:fixed;z-index:99999999;`) +sDiv.setAttribute("style",`height:3px;pointer-events:none;width:100%;position:absolute;z-index:99;`) sDiv.setAttribute("id","sDiv"); var dur=document.getElementsByClassName('video-stream')[0].duration; for(var x in sTime){ var s1=document.createElement("div"); var s2=sTime[x]; -s1.setAttribute("style",`height:3px;width:${(100/dur) * (s2[1]-s2[0])}%;background:#0f8;position:fixed;z-index:99999999;left:${(100/dur) * s2[0]}%;`) +s1.setAttribute("style",`height:3px;width:${(100/dur) * (s2[1]-s2[0])}%;background:#0f8;position:absolute;z-index:9;left:${(100/dur) * s2[0]}%;`) sDiv.appendChild(s1); } @@ -478,6 +480,7 @@ sTime.push(time); /*Skip the Sponsor*/ document.getElementsByClassName('video-stream')[0].ontimeupdate=()=>{ +skipSponsor(); var cur=document.getElementsByClassName('video-stream')[0].currentTime; for(var x in sTime){ var s2=sTime[x]; @@ -491,7 +494,7 @@ addSkipper(s2[0]); }; -setInterval(skipSponsor,50); + } @@ -590,13 +593,13 @@ history.back(); }); ytpSetI.setAttribute("style",` -height:65%;width:85%;overflow:auto;background:#0f0f0f; +height:65%;width:85%;overflow:auto;background:${isD ? "#212121" : "#f1f1f1"}; position:absolute;bottom:20px; -z-index:99999999999999;padding:20px;text-align:center;border-radius:25px;color:white;text-align:center; +z-index:99999999999999;padding:20px;text-align:center;border-radius:25px;color:${c};text-align:center; `); ytpSetI.innerHTML=`"; +var t=vD?.videoDetails?.title.replaceAll("|","").replaceAll("\\","").replaceAll("?","").replaceAll("*","").replaceAll("<","").replaceAll("/","").replaceAll(":","").replaceAll('"',"").replaceAll(">","").replaceAll("'",""); +ytproDownDiv.innerHTML=``; @@ -823,7 +833,7 @@ url=ytproGetURL(vids[x].signatureCipher,"sig"); url=ytproGetURL(vids[x].url,"n"); } -ytproDownDiv.innerHTML+=`
  • +ytproDownDiv.innerHTML+=`
  • ${downBtn}${vids[x].qualityLabel} ${formatFileSize(((vids[x].bitrate*(vids[x].approxDurationMs/1000))/8))}
  • ` ; } @@ -859,9 +869,9 @@ ytproDownDiv.innerHTML+=`
  • Captions

    "; +ytproDownDiv.innerHTML+=`
    Captions

    `; for(var x in cap){ -ytproDownDiv.innerHTML+=`${cap[x]?.name?.runs[0]?.text}
    ${downBtn}
    .xml
    ${downBtn}
    .vtt
    ${downBtn}
    .srv1
    ${downBtn}
    .ttml


    `; +ytproDownDiv.innerHTML+=`${cap[x]?.name?.runs[0]?.text}
    ${downBtn}
    .xml
    ${downBtn}
    .vtt
    ${downBtn}
    .srv1
    ${downBtn}
    .ttml


    `; } } @@ -1164,15 +1174,15 @@ z-index:99999999999999; `); ytproHh.setAttribute("style",` -height:50%;width:85%;overflow:auto;background:#0f0f0f; +height:50%;width:85%;overflow:auto;background:${isD ? "#212121" : "#f1f1f1"}; position:absolute;bottom:20px; -z-index:99999999999999;padding:20px;text-align:center;border-radius:25px;color:white;text-align:center; +z-index:99999999999999;padding:20px;text-align:center;border-radius:25px;text-align:center; `); -ytproHh.innerHTML=""; +ytproHh.innerHTML=``; ytproHh.innerHTML+="Hearted Videos