2

I recently did a clean install of El Captian & added Tampermonkey into my safari. Youtube had evolved a lot since its inception and, personally, I found the homepage had become quite shitty so I used the snippet of code in my Tampermonkey script below to redirect the homepage to the subscription page

function jump(nwl){
    if(nwl=="https://www.youtube.com/"){
    window.location = "https://www.youtube.com/feed/subscriptions";
    }else if(nwl!=wl){
      do_removeRecommendation();
      wl =  nwl;
    }
    if(nwl=="https://www.youtube.com/feed/subscriptions"){
       removeWatched();
    }
    if(nwl=="https://www.youtube.com/subscription_manager"){
        GM_addStyle('#masthead-appbar-container { display: none !important; }'
           );
    }

}
jump(window.location.href);
setInterval(function(){
    jump(window.location.href);
},1000);

Back when I was using Yosemite this worked pretty well in my chrome. But I am switching to safari now & this is what happens when I accident go to the youtube homepage:

youtube has a shitty homepage

It bloody changed the location of some iframe which made no sense.

enter image description here

Although if we refresh the page, it would then redirect to https://www.youtube.com/feed/subscriptions quite nicely.

1
  • As this is part of a larger script, I couldn't reproduce your problem. But: Can you try inserting the line if (window.top !== window || document.hidden) return; as the second line in your snippet? (i.e. as the first line in the jump function. – Arthur Oct 6 '15 at 10:46

You must log in to answer this question.

Browse other questions tagged .