YouTube Auto Scroll To Video

By JoeSimmons Last update Aug 23, 2009 — Installed 444 times.
// ==UserScript==
// @name           YouTube Auto Scroll To Video
// @namespace      http://userscripts.org/users/23652
// @description    Automatically scrolls to the vido on load
// @include        http://*.youtube.com/watch?*v=*
// @copyright      JoeSimmons
// @version        1.0.0
// @license        Creative Commons Attribution-Noncommercial 3.0 United States License
// ==/UserScript==

function ScrollToElement(theElement){
  var selectedPosX = 0;
  var selectedPosY = 0;
  while(theElement != null){
    selectedPosX += theElement.offsetLeft;
    selectedPosY += theElement.offsetTop;
    theElement = theElement.offsetParent;
  }
 window.scrollTo(selectedPosX,selectedPosY);
}

ScrollToElement(document.getElementById("watch-vid-title"));