Skip to content

Instantly share code, notes, and snippets.

@gisikw
Created December 7, 2012 09:29
Show Gist options
  • Save gisikw/4232097 to your computer and use it in GitHub Desktop.
Save gisikw/4232097 to your computer and use it in GitHub Desktop.
YouTube Centering

YouTube Centerer

Really simple Chrome extension to center the new YouTube Layout. Their width is constrained to 970, and there's no reason it can't be centered when your browser window is wider. All this script does is apply a quick style change across the full YouTube site. Note that this may change as YouTube revises its layout.

Installation

  • Download the youtube.user.js file
  • In Chrome, go to Tools -> Extensions
  • Drag the file you downloaded onto the window
  • Click "Add"

Enjoy! -Kevin

// ==UserScript==
// @name YouTube Centering
// @description Centers the new YouTube Layout
// @version 0.0.2
// @include http://www.youtube.com/*
// @include https://www.youtube.com/*
// ==/UserScript==
if(document.getElementById('watch7-video-container')){
(s=document.getElementsByTagName('body')[0].style);s.margin='0 auto';s.width='970px';s.paddingRight='350px';
} else {
(s=document.getElementById('body-container').style);s.margin='0 auto';s.width='970px';
}
@thienha1
Copy link

Can you make scripts that set a timer to automatically pause/stop on all Youtube embed videos? Like pause a video after X seconds!!?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment