YouTube Player for Forocoches

Never thought I would made something so unsettling, enjoy it!

Pada tanggal 04 Juli 2016. Lihat %(latest_version_link).

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name           YouTube Player for Forocoches
// @name:es        Reproductor de YouTube para Forocoches
// @description    Never thought I would made something so unsettling, enjoy it!
// @description:es Nunca pensé que terminaría haciendo algo tan demigrante, ¡de nada!
// @namespace      swyter
// @match          *://www.forocoches.com/*
// @match          *://m.forocoches.com/*
// @match          *://forocoches.com/*
// @version        1.1.1.3
// @grant          none
// ==/UserScript==

/* switch the iframe source to a less scummy one */

for (var cur in (vids=document.querySelectorAll("iframe[src*=smartycenter]")))
{
  if(typeof vids[cur] !== 'object')
    continue;

  vids[cur].src = 'https://www.youtube.com/embed/' + vids[cur].src.split("/")[6];
}

/* remove random crap */

filters =
[
  "#infocookie",
  "div[id^='div-']",
  "ul[style*='#ca3415'] + ul",
  "a + ul + br",
  ".cajasprin"
];

for (var cur in (junk=document.querySelectorAll(filters.join(', '))))
{
  if(typeof junk[cur] !== 'object')
    continue;

  console.log("Removed junk element: " + junk[cur]);
  junk[cur].parentElement.removeChild(junk[cur]);
}

/* wait until the page is ready for the code snippet to run */
document.addEventListener('DOMContentLoaded', function()
{
  console.log("!!! DOMContentLoaded");

  for(a of (document.querySelectorAll("div[id^=post_message]")))
  {
    if (a.childNodes[0].nodeValue.trim().match("Este mensaje está oculto porque .+ está en tu lista de ignorados(.)?$") != null)
    {
      console.log(a, a.childNodes[0].nodeValue);

      a = a.parentElement.parentElement.parentElement.parentElement;
      a.parentElement.removeChild(a);
    }
  }
  
  blocked_users = 
  [
    'Pedrote', 'RAMON38', 'Orof', 'matalpinensis', 'Kurtcob', 'DalePapi', 'pinilleitor', 'Zenobio73',
    'kevinxuan', 'Euritos', '-Averia-', 'Mcbubles', 'Medlinor', 'Amon Amarth','ShurKhalifa', 'Satou',
    'sirp', 'spilock', 'amstel', 'josalb', 'pablitochu89', 'sagi1978', 'Mr. Deadpool', 'DeBoer',
    'Jabyesp', 'mcarlosd', 'eosal', 'Mugremita', 'chafer', 'KRASNY BOR', 'Recaredo'
  ]
  
  for (e of document.querySelectorAll(".bigusername, .smallfont > span[onclick]"))
  {
    if (!(blocked_users.indexOf(e.textContent) != -1))
     continue;

    console.log('Obscured posts by blocked user: ', e.textContent);

    (e.nodeName != 'SPAN' ?
     e.parentNode.parentNode.parentNode.parentNode.parentElement :
     e.parentNode.parentNode.parentNode
    ).style.opacity = 0.3;
  }
  
  
});