Skip to content

Instantly share code, notes, and snippets.

@Kuznetsov-Ilia
Created March 15, 2016 11:53
Show Gist options
  • Save Kuznetsov-Ilia/f664b823eb9f3ab1296a to your computer and use it in GitHub Desktop.
Save Kuznetsov-Ilia/f664b823eb9f3ab1296a to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Make youtube pizdato
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.youtube.com/watch*
// @grant none
// ==/UserScript==
/* jshint -W097 */
'use strict';
var d = document;
var b = d.body;
var state = true;
HTMLCollection.prototype.filter = Array.prototype.filter;
d.onkeypress = function(e) {
if(e.keyCode === 113) {
makePizdato(state);
state = !state;
}
};
function makePizdato(flag) {
siblings.call(id('body-container')).concat([
id('content'),
id('masthead-positioner'),
id('masthead-positioner-height-offset'),
id('player-playlist')
]).forEach(flag ? hide : show);
//id('body-container').style['padding-bottom'] = '0!important';
}
function siblings(_filter) {
var _this = this;
return this.parentNode.children.filter(function (child) {
var valid = child !== _this;
if (valid && isset(_filter)) {
valid = child.matches(_filter);
}
return valid;
});
}
function hide(el) {
el.prevDisplay = el.style.display;
el.style.display = 'none';
}
function show(el) {
el.style.display = el.prevDisplay || 'block';
}
function id(i) {
return d.getElementById(i);
}
function isset(a) {
return a !== undefined;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment