YouTube Player for Forocoches

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

24.09.2015 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==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          http://www.forocoches.com/*
// @match          http://m.forocoches.com/*
// @match          http://forocoches.com/*
// @version        1.1
// @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.match(/\/([^\/]+)\/\d+\/\d+$/)[1];
}

/* 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]);
}