Komica - Unembed Youtube

Open youtube in new tab instead of playing directly when clicking on the video.

  1. // ==UserScript==
  2. // @name Komica - Unembed Youtube
  3. // @version 0.1.1
  4. // @namespace eight04.blogspot.com
  5. // @description Open youtube in new tab instead of playing directly when clicking on the video.
  6. // @include http://*mykomica.org/*
  7. // @include http://*.mymoe.moe/*
  8. // @grant none
  9. // @compatible firefox
  10. // @compatible chrome
  11. // @compatible opera
  12. // ==/UserScript==
  13.  
  14. var i, m, ytplayers;
  15.  
  16. ytplayers = document.querySelectorAll(".ytplayer");
  17.  
  18. for (i = 0; i < ytplayers.length; i++) {
  19. if ((m = ytplayers[i].parentNode.href.match(/ytclick\('([^']+)'.+?\)/))) {
  20. ytplayers[i].parentNode.href = "https://www.youtube.com/watch?v=" + m[1];
  21. ytplayers[i].parentNode.target = "_blank";
  22. }
  23. }