twitcovertanongmail.com / Hide annoying youtube videos

// ==UserScript==
// @name        Hide annoying youtube videos
// @description hides videos with low
// @namespace   Covert
// @include     *www.youtube.com/watch?v=*
// @include     *www.youtube.com/feed/*
// @include     *www.youtube.com/watch?*
// @include     *www.youtube.com/results?*
// @include     *www.youtube.com/user/*
// @version     1
// @grant       none
// @require     http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js
// ==/UserScript==

//   Try one of these if doesnt work
// http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js
// http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js
// http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// requires greasemonkey for firefox
// requires https://greasyfork.org/en/scripts/2302-youtube-video-ratings-bar-with-power-meter


// clinking user link, takes you to their videos tab page on their profile
$('A.g-hovercard.yt-uix-sessionlink.spf-link').attr("href", function(i, href) {
  return href + '/videos';
});


// these are useless and annoying
$('.resume-playback-background').hide();
$('.resume-playback-progress-bar').hide();



// if the likes bar width is below 88%, hides the video
$(document).ready(function() { 
setInterval(function() {
function getWidthPercent(element) {
return parseFloat(element.style.width) || 0;}
$(".likesBar").each(function() {
if (getWidthPercent(this) < 88.7) $(this).closest(".yt-lockup-tile, .video-list-item.related-list-item, .yt-shelf-grid-item, .expanded-shelf-content-item-wrapper").hide();
});}, 3000);});

// if the hates bar width is above 1.5%, hides the video
$(document).ready(function() { 
setInterval(function() {
function getWidthPercent(element) {
return parseFloat(element.style.width) || 0;}
$(".hatesBar").each(function() {
if (getWidthPercent(this) > 1.5) $(this).closest(".yt-lockup-tile, .video-list-item.related-list-item, .yt-shelf-grid-item, .expanded-shelf-content-item-wrapper").hide();
});}, 3000);});

/*
$(document).ready(function() { 
setInterval(function() {
function getWidthPercent(element) {
return parseFloat(element.style.width) || 0;}
$(".hatesBar").each(function() {
if (getWidthPercent(this) > 1.5) $(this).closest(".yt-lockup-tile, .video-list-item.related-list-item, .yt-shelf-grid-item, .expanded-shelf-content-item-wrapper").css({ 'filter': 'grayscale(100%)' , 'opacity': '.15'});
});}, 3000);});
*/

// hides videos containing specific phrases
$(document).ready(function() { var refreshId = setInterval( function() {
       $(".yt-shelf-grid-item:contains('blah blah 1', 'blah blah 2'):not(:contains('exposed','leaked','leaks','leak'))").css({ 'filter': 'grayscale(100%)' , 'opacity': '.5'});
       }, 3000); //rescans every 2500ms, used for 'load more'
    });



// shrinks word selectors, allows keywords together, ignores case sensitivity
$(document).ready(function() { 
 jQuery.expr[':'].contains = function(obj, index, meta, stack){
 result = false;
 theList = meta[3].split("','");
 var contents = (obj.textContent || obj.innerText || jQuery(obj).text() || '')
 for (x=0;x<theList.length;x++) {
 if (contents.toLowerCase().indexOf(theList[x].toLowerCase()) >= 0) {
 return true;}} return false;};

  /* if (contents.indexOf(theList[x]) >= 0) {
  if(window.location.href.indexOf("") > -1) {*/
  
  // script only runs on these pages
 $(document).ready(function () 
 {  if(   (!window.location.href.indexOf("/feed/subscriptions") > -1)  
        & (!window.location.href.indexOf("/feed/") > -1)    
      )   
  {   
    //hies videos containing keywords, unless additional keyword found
    $(document).ready(function() { var refreshId = setInterval( function() {
       $(".yt-shelf-grid-item:contains('trump','hillary','fight comp','clinton','iphone'):not(:contains('exposed','leaked','leaks','leak','whistle','scandal','seen','wiki','worst','wearechange','secular talk','1791','weapons','tpp','ttip'))").css({ 'filter': 'grayscale(100%)' , 'opacity': '.15'});
       }, 3000); //rescans every 2500ms, used for 'load more'
    });
 
  }
  
 });
});