VeeHD Native HTML5 Video Player

Watch videos on VeeHD without the need for flashplayer

当前为 2016-04-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name VeeHD Native HTML5 Video Player
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Watch videos on VeeHD without the need for flashplayer
  6. // @author stoisch
  7. // @match http://veehd.com/*
  8. // ==/UserScript==
  9. /* jshint -W097 */
  10. 'use strict';
  11.  
  12. // Initiate Download
  13. document.querySelector('div[class="uv"]').click();
  14.  
  15. // Delay Action
  16. setTimeout(
  17. function () {
  18. // Grab link from iframe
  19. var src = document.getElementById('playeriframe').contentDocument.body.innerHTML.match(/href=\W(.*?.mp4)\W>/)[1];
  20.  
  21. // Create html5 player
  22. var html5_video = document.createElement("VIDEO");
  23. html5_video.setAttribute("src",src);
  24. html5_video.setAttribute("width", "970");
  25. html5_video.setAttribute("height", "665");
  26. html5_video.setAttribute("controls", "controls");
  27. // Find and replace frame
  28. document.getElementById("p").appendChild(html5_video);
  29. var videoHolderElement = document.querySelector('#p');
  30. videoHolderElement.parentElement.replaceChild(html5_video, videoHolderElement);
  31.  
  32. console.log("Replaced :)");
  33. }, 1000
  34. );