laSexta.com and Antena3.com HTML5 player

HTML5 player for laSexta.com, avoiding the Flash Player plugin.

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

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

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.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

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           laSexta.com and Antena3.com HTML5 player
// @name:es        Reproductor HTML5 en laSexta.com y Antena3.com
// @author         Swyter
// @homepage       https://swyterzone.appspot.com
// @namespace      userscripts.org/swyter
// @description    HTML5 player for laSexta.com, avoiding the Flash Player plugin.
// @description:es Reproductor HTML5 para laSexta.com, evitando el uso del plugin Flash Player.
// @match          http://www.lasexta.com/*
// @match          http://www.antena3.com/*
// @version        1.3
// @grant          none
// @icon           https://i.imgur.com/rvx1xwK.png
// ==/UserScript==

if ((videoDataUrl = document.querySelector("*[name=videoDataUrl], input[value*='videosnuevosxml']").value))
{
  xhr = new XMLHttpRequest();

  xhr.open("GET", videoDataUrl);

  xhr.onreadystatechange = function()
  {
    if (this.readyState != xhr.DONE) return;

    /* build our own html5 player with our own stuff */
    vplayer = document.createElement("video");

    vplayer.src    = this.responseXML.getElementsByTagName("videoSource")[0].textContent;
    vplayer.poster = this.responseXML.getElementsByTagName("background")[0].textContent;

    vplayer.controls = "true";
    vplayer.volume = "0.4";

    vplayer.style = 'width: 644px; height: 362px;';

    /* replace it on the page */
    videoHolderElement = document.querySelector("*[itemprop='Video'], .visor_reemplace");
    videoHolderElement.parentElement.replaceChild(vplayer, videoHolderElement);
  }

  xhr.send();
}