YouTube Player for Forocoches

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

目前為 2015-09-21 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name YouTube Player for Forocoches
  3. // @name:es Reproductor de YouTube para Forocoches
  4. // @description Never thought I would made something so unsettling, enjoy it!
  5. // @description:es Nunca pensé que terminaría haciendo algo tan demigrante, ¡de nada!
  6. // @namespace swyter
  7. // @match http://forocoches.com/*
  8. // @match http://m.forocoches.com/*
  9. // @version 1
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. /* switch the iframe source to a less scummy one */
  14.  
  15. for (var cur in (vids=document.querySelectorAll("iframe[src*=smartycenter]")))
  16. {
  17. if(typeof vids[cur] !== 'object')
  18. continue;
  19.  
  20. vids[cur].src = 'https://www.youtube.com/embed/' + vids[cur].src.match(/\/([^\/]+)\/\d+\/\d+$/)[1];
  21. }
  22.  
  23. /* remove random crap */
  24.  
  25. filters =
  26. [
  27. "#infocookie",
  28. "div[id^='div-']",
  29. "ul[style*='#ca3415'] + ul",
  30. "a + ul + br",
  31. ".cajasprin"
  32. ];
  33.  
  34. for (var cur in (junk=document.querySelectorAll(filters.join(', '))))
  35. {
  36. if(typeof junk[cur] !== 'object')
  37. continue;
  38.  
  39. console.log("Removed junk element: " + junk[cur]);
  40. junk[cur].parentElement.removeChild(junk[cur]);
  41. }