Skip to content

Instantly share code, notes, and snippets.

@darkcolonist
Last active May 26, 2016 09:30
Show Gist options
  • Save darkcolonist/3e6f2e0f9d61268a3c8fc69a5a6ddc18 to your computer and use it in GitHub Desktop.
Save darkcolonist/3e6f2e0f9d61268a3c8fc69a5a6ddc18 to your computer and use it in GitHub Desktop.
youtube tapermonkey script - deface youtube on client to make it look like it's not youtube at all
// ==UserScript==
// @name youtube deface
// @namespace jQueryForChromeExample
// @include http*://*youtube.com/*
// @match https://www.youtube.com/*
// @author Christian Noel Reyes
// @description This userscript is meant to disfigure youtube using jQuery in a userscript on Google Chrome. (eg: https://dl.dropboxusercontent.com/u/617821/images/tapermonkey-youtube-disfigure-example.png)
// ==/UserScript==
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();";
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
}
// the guts of this userscript
function main() {
// Note, jQ replaces $ to avoid conflicts.
jQ("#masthead-positioner .yt-masthead-logo-container").remove();
jQ("#masthead-positioner #yt-masthead-user").remove();
jQ("#guide").remove();
jQ("#page").css({
"padding-left":0
});
jQ(".yt-ui-ellipsis").css({
"background-color":"#0A1F2D",
"border-radius":"5px",
"padding":"3px"
});
jQ(".yt-badge").css({
"border":"1px solid #0A1F2D",
"background":"#167ac6"
});
jQ(".yt-card").css({
"background":"#163144"
});
jQ("#content").css({
"margin-left":0
});
jQ("#masthead-positioner #yt-masthead-container").css({
"background":"transparent",
"border-bottom":"none",
"opacity":.5
});
jQ("#page-container").css({
"padding-top":"46px"
});
jQ("#watch7-sidebar-contents").remove();
jQ("#masthead-positioner-height-offset").remove();
jQ("#watch7-container").remove();
jQ("#footer-container").remove();
jQ("body").css({
background: 'url("https://dl.dropboxusercontent.com/u/617821/images/hq.walls/overloaded.jpg")'
});
jQ(".html5-player-chrome.html5-stop-propagation").css({
background: '#0F314C'
});
jQ("#player").css({
margin: 0
});
jQ(".ytp-play-progress").css({
backgroundColor: "#0F314C"
});
jQ(".ad-container").css({
display: "none"
});
jQ("[rel='shortcut icon']").attr("href", "https://dl.dropboxusercontent.com/u/617821/images/gnome-wat-icon.png");
jQ("[rel='icon']").attr("href", "https://dl.dropboxusercontent.com/u/617821/images/gnome-wat-icon.png");
}
// load jQuery and execute the main function
addJQuery(main);
@darkcolonist
Copy link
Author

image

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