Skip to content

Instantly share code, notes, and snippets.

@Qofar
Last active August 29, 2015 14:05
Show Gist options
  • Save Qofar/c0a59d5a715897442d21 to your computer and use it in GitHub Desktop.
Save Qofar/c0a59d5a715897442d21 to your computer and use it in GitHub Desktop.
youtubeとニコニコ動画でCSSぶっこんでシネマモードを実現するUserScript ダブルクリックで切り替え
// ==UserScript==
// @name youtube/nicovideo Cinema Mode
// @description toggle on double click.
// @include http://www.youtube.com/*
// @include https://www.youtube.com/*
// @include http://www.nicovideo.jp/watch/*
// @include http://live.nicovideo.jp/watch/*
// @include http://live.nicovideo.jp/gate/*
// ==/UserScript==
(function(){
if(location.host.indexOf("www.youtube.com") === 0) {
var css = '#masthead-positioner,#content,#footer-container,#watch-discussion{display:none!important;}'
+'body{background-color:#1B1B1B !important;}'
+'#player-api{position:static !important; margin:0 auto !important;}';
} else if(location.host.indexOf("www.nicovideo.jp") === 0) {
var css = '#siteHeader,#footer,#content > div:not(#playerContainerWrapper),#playerTabWrapper{visibility:hidden!important;}'
+'body{background-color:#1B1B1B !important;}'
+'#playerNicoplayer{margin:0 auto !important;}';
} else if(location.host.indexOf("live.nicovideo.jp") === 0) {
var css = 'body>div:not(#page_cover),#page>div:not(#slider_container):not(#watch_player_box),#wall,#utility_link{visibility:hidden!important;}'
+'body,#page_cover,#wall_canvas{background-color:#1B1B1B!important;}'
}
var style = null;
function toggle() {
if(style) {
style.parentNode.removeChild(style);
style = null;
} else {
style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode(css));
document.head.appendChild(style);
}
}
document.addEventListener('dblclick', toggle);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment