Repubblica TV HTML5

Use HTML5 video tags for Repubblica TV videos, removing ADS

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// Copyright 2013 Marco Trevisan (Treviño) <[email protected]>
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License version 3, as published
// by the Free Software Foundation.
//
// ==UserScript==
// @name        Repubblica TV HTML5
// @name:it     Repubblica TV HTML5
// @namespace   video.repubblica.it
// @description Use HTML5 video tags for Repubblica TV videos, removing ADS
// @description:it Usa il tag video HTML5 per riprodurre i filmati di Repubblica TV, eliminando la pubblicità
// @include     http*://video.repubblica.it/*
// @version     0.9.8
// @namespace   http://www.3v1n0.net
// @icon        http://www.repubblica.it/static/images/homepage/2010/favicon.ico
// @grant       none
// ==/UserScript==

// Load jquery if needed and once done, call the provided callback
function addJQuery(callback)
{
  if (this.$)
  {
    callback();
    return;
  }

  var script = document.createElement("script");
  script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
  script.addEventListener('load', function() {
    var script = document.createElement("script");
    script.textContent = "this.$=jQuery.noConflict(true);(" + callback.toString() + ")();";
    document.body.appendChild(script);
  }, false);
  document.body.appendChild(script);
}

addJQuery(function() {
  var player_div = $("div.video-player");

  if (player_div)
  {
    var width = player_div.width();
    var height = player_div.height();
    var src = player_div.find("meta[itemprop=contentUrl]").attr("content");

    if (src && src.length > 0 && src.search("rtmp://") < 0)
    {
      player_div.replaceWith('<video width="'+width+'" height="'+height+'" controls><source src="'+src+'" type="video/mp4"></video>');
    }
  }
});