From e7a429d57368da0b38ae52a6b62abc38e22584e1 Mon Sep 17 00:00:00 2001 From: Prateek Chaubey <41151614+prateek-chaubey@users.noreply.github.com> Date: Fri, 29 Nov 2024 19:36:06 +0530 Subject: [PATCH] Update script.js Fixed Dislike button issue Added opening external links in browser --- scripts/script.js | 73 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 60 insertions(+), 13 deletions(-) diff --git a/scripts/script.js b/scripts/script.js index f811f43..d54cf4d 100644 --- a/scripts/script.js +++ b/scripts/script.js @@ -1,9 +1,10 @@ /*****YTPRO******* Author: Prateek Chaubey -Version: 3.4.66 +Version: 3.4.70 URI: https://github.com/prateek-chaubey/ */ + //DEBUG /*var debug=false; var Android={ @@ -19,6 +20,7 @@ window.location.href=`javascript:(function () { var script = document.createElem } /**/ +if(!YTProVer){ /*Few Stupid Inits*/ var YTProVer="3.45"; @@ -31,6 +33,7 @@ var isF=false; //what is this for? var isAP=false; // oh it's for bg play var isM=false; // no idea !! var sTime=[]; +var webUrls=["m.youtube.com","youtube.com","yout.be","accounts.google.com"]; if(localStorage.getItem("autoSpn") == null || localStorage.getItem("fitS") == null){ localStorage.setItem("autoSpn","true"); @@ -909,14 +912,23 @@ if(window.location.href.indexOf("youtube.com/watch") > -1){ try{ -var elm=document.getElementsByTagName("dislike-button-view-model")[0].children[0].children[0]; -elm.children[0].style.width="80px"; -elm.children[0].children[0].style.position="absolute"; -elm.children[0].children[0].style.left="15px"; -if(elm.children[0].children[2] == null){ -elm.children[0].innerHTML+=`${dislikes}`; -}else{elm.children[0].children[2].innerHTML=dislikes;} -}catch{} +var elm=document.getElementsByTagName("dislike-button-view-model")[0].children[0]; +elm.children[0].children[0].children[0].style.width="90px"; +elm.children[0].children[0].children[0].children[0].style.position="absolute"; + +elm.children[0].children[0].children[0].children[0].style.left="15px"; + +elm.parentElement.innerHTML=` + +`; + +}catch(e){ + +} /*Check If Element Already Exists*/ @@ -1445,6 +1457,7 @@ try{document.getElementsByTagName("ytm-shorts-lockup-view-model")[x].remove(); } } + /****** I LOVE YOU <3 *****/ @@ -1490,6 +1503,9 @@ Vv.style.transform=`scale(${scale})`; + + + }, 1); @@ -1539,12 +1555,43 @@ document.body.appendChild(x); - - - - window.onload = function(){ if(parseFloat(Android.getInfo()) < parseFloat(YTProVer) && (window.location.href == "https://m.youtube.com/" || window.location.href == "https://m.youtube.com") ){ updateModel(); } + + + + + }; + + + + + +document.addEventListener('click',(event) => { + +let anchor = event.target.closest('a'); +if (anchor) { + + +if(anchor.href.includes("www.youtube.com/redirect")){ + +const url=new URL(anchor.href).searchParams.get("q"); + +Android.oplink(url); +event.preventDefault(); +event.stopPropagation(); + +} + + +} +}, +true); + + + + +}