Skip to content

Instantly share code, notes, and snippets.

@blizzy78
Last active August 16, 2016 12:05
Show Gist options
  • Select an option

  • Save blizzy78/bfc5dd50cd263a14fa14 to your computer and use it in GitHub Desktop.

Select an option

Save blizzy78/bfc5dd50cd263a14fa14 to your computer and use it in GitHub Desktop.

Revisions

  1. blizzy78 revised this gist Aug 16, 2016. 1 changed file with 43 additions and 27 deletions.
    70 changes: 43 additions & 27 deletions remove-golem-pre-video-ads.js
    Original file line number Diff line number Diff line change
    @@ -1,39 +1,55 @@
    // ==UserScript==
    // @name Remove Golem.de Pre-Video Ads
    // @namespace http://blizzy.de/
    // @version 0.3
    // @version 1.0
    // @description Removes pre-video ads from videos on golem.de
    // @match http://*.golem.de/*
    // @copyright 2014-2015, Maik Schreiber
    // @require //code.jquery.com/jquery-2.1.3.min.js
    // @copyright 2014-2016, Maik Schreiber
    // @require //code.jquery.com/jquery-3.1.0.min.js
    // @grant none
    // ==/UserScript==

    function createVideo(id, width, height, poster) {
    return $.parseHTML('<video width="' + width + '" height="' + height + '" poster="' + poster + '" preload="auto" controls>' +
    '<source src="http://video.golem.de/download/' + id + '?q=high"/>' +
    '<source src="http://video.golem.de/download/' + id + '?q=medium"/>' +
    '</video>');
    return $.parseHTML('<video width="' + width + '" height="' + height + '" poster="' + poster + '" preload="auto" controls>' +
    '<source src="http://video.golem.de/download/' + id + '?q=high"/>' +
    '<source src="http://video.golem.de/download/' + id + '?q=medium"/>' +
    '</video>');
    }

    $('div[id^="NVBPlayer"]').each(function(idx, el) {
    el = $(el);
    var id = el.attr('id').substring(9);
    var embedded = el.find('embed');
    var width = embedded.attr('width');
    var height = embedded.attr('height');
    var poster = embedded.attr('flashvars').replace(/^.*&image_src=([^&]+)&.*$/, '$1');
    var video = createVideo(id, width, height, poster);
    el.replaceWith(video);
    });
    function replaceVideos() {
    $('div[id^="NVBPlayer"]').each(function(idx, el) {
    el = $(el);
    var id = el.attr('id').substring(9);
    var embedded = el.find('embed');
    var width = embedded.attr('width');
    var height = embedded.attr('height');
    var poster = embedded.attr('flashvars').replace(/^.*&image_src=([^&]+)&.*$/, '$1');
    var video = createVideo(id, width, height, poster);
    el.replaceWith(video);
    });

    $('object[id^="NVBPlayer"]').each(function(idx, el) {
    el = $(el);
    var id = el.attr('id').substring(9);
    var width = el.attr('width');
    var height = el.attr('height');
    var flashvars = el.find('param[name="flashvars"]').attr('value');
    var poster = flashvars.replace(/^.*&image_src=([^&]+)&.*$/, '$1');
    var video = createVideo(id, width, height, poster);
    el.replaceWith(video);
    });
    $('object[id^="NVBPlayer"]').each(function(idx, el) {
    el = $(el);
    var id = el.attr('id').substring(9);
    var width = el.attr('width');
    var height = el.attr('height');
    var flashvars = el.find('param[name="flashvars"]').attr('value');
    var poster = flashvars.replace(/^.*&image_src=([^&]+)&.*$/, '$1');
    var video = createVideo(id, width, height, poster);
    el.replaceWith(video);
    });

    $('figure[id^="gvideo_"]').each(function(idx, el) {
    el = $(el);
    var id = el.attr('id').substring(7);
    var playerEl = el.find('div[id="rmpPlayer' + id + '"]');
    var width = playerEl.css('width').replace(/^([0-9]+).*/, '$1');
    var height = playerEl.css('height').replace(/^([0-9]+).*/, '$1');
    var posterEl = el.find('img[class="rmp-poster-img"]');
    var poster = posterEl.attr('src');
    var video = createVideo(id, width, height, poster);
    el.replaceWith(video);
    });
    }

    window.setTimeout(replaceVideos, 2000);
  2. blizzy78 revised this gist Jan 27, 2015. 1 changed file with 23 additions and 7 deletions.
    30 changes: 23 additions & 7 deletions remove-golem-pre-video-ads.js
    Original file line number Diff line number Diff line change
    @@ -1,23 +1,39 @@
    // ==UserScript==
    // @name Remove Golem.de Pre-Video Ads
    // @namespace http://blizzy.de/
    // @version 0.2
    // @version 0.3
    // @description Removes pre-video ads from videos on golem.de
    // @match http://*.golem.de/*
    // @copyright 2014, Maik Schreiber
    // @require //code.jquery.com/jquery-2.1.1.min.js
    // @copyright 2014-2015, Maik Schreiber
    // @require //code.jquery.com/jquery-2.1.3.min.js
    // @grant none
    // ==/UserScript==

    function createVideo(id, width, height, poster) {
    return $.parseHTML('<video width="' + width + '" height="' + height + '" poster="' + poster + '" preload="auto" controls>' +
    '<source src="http://video.golem.de/download/' + id + '?q=high"/>' +
    '<source src="http://video.golem.de/download/' + id + '?q=medium"/>' +
    '</video>');
    }

    $('div[id^="NVBPlayer"]').each(function(idx, el) {
    el = $(el);
    var id = el.attr('id').substring(9);
    var embedded = el.find('embed');
    var width = embedded.attr('width');
    var height = embedded.attr('height');
    var poster = embedded.attr('flashvars').replace(/^.*&image_src=([^&]+)&.*$/, '$1');
    var video = $.parseHTML('<video width="' + width + '" height="' + height + '" poster="' + poster + '" preload="auto" controls>' +
    '<source src="http://video.golem.de/download/' + id + '?q=high"/>' +
    '<source src="http://video.golem.de/download/' + id + '?q=medium"/>' +
    '</video>');
    var video = createVideo(id, width, height, poster);
    el.replaceWith(video);
    });

    $('object[id^="NVBPlayer"]').each(function(idx, el) {
    el = $(el);
    var id = el.attr('id').substring(9);
    var width = el.attr('width');
    var height = el.attr('height');
    var flashvars = el.find('param[name="flashvars"]').attr('value');
    var poster = flashvars.replace(/^.*&image_src=([^&]+)&.*$/, '$1');
    var video = createVideo(id, width, height, poster);
    el.replaceWith(video);
    });
  3. blizzy78 revised this gist Sep 20, 2014. 1 changed file with 12 additions and 15 deletions.
    27 changes: 12 additions & 15 deletions remove-golem-pre-video-ads.js
    Original file line number Diff line number Diff line change
    @@ -1,26 +1,23 @@
    // ==UserScript==
    // @name Remove Golem.de Pre-Video Ads
    // @namespace http://blizzy.de/
    // @version 0.1
    // @version 0.2
    // @description Removes pre-video ads from videos on golem.de
    // @match http://*.golem.de/*
    // @copyright 2014, Maik Schreiber
    // @require //code.jquery.com/jquery-2.1.1.min.js
    // ==/UserScript==

    $('figure').each(function(idx, el) {
    $('div[id^="NVBPlayer"]').each(function(idx, el) {
    el = $(el);
    var id = el.attr('id');
    if (id.indexOf('gvideo_') === 0) {
    id = id.substring(7);
    var embedded = el.find('embed');
    var width = embedded.attr('width');
    var height = embedded.attr('height');
    var poster = embedded.attr('flashvars').replace(/^.*&image_src=([^&]+)&.*$/, '$1');
    var video = $.parseHTML('<video width="' + width + '" height="' + height + '" poster="' + poster + '" controls>' +
    '<source src="http://video.golem.de/download/' + id + '?q=high"/>' +
    '<source src="http://video.golem.de/download/' + id + '?q=medium"/>' +
    '</video>');
    el.replaceWith(video);
    }
    var id = el.attr('id').substring(9);
    var embedded = el.find('embed');
    var width = embedded.attr('width');
    var height = embedded.attr('height');
    var poster = embedded.attr('flashvars').replace(/^.*&image_src=([^&]+)&.*$/, '$1');
    var video = $.parseHTML('<video width="' + width + '" height="' + height + '" poster="' + poster + '" preload="auto" controls>' +
    '<source src="http://video.golem.de/download/' + id + '?q=high"/>' +
    '<source src="http://video.golem.de/download/' + id + '?q=medium"/>' +
    '</video>');
    el.replaceWith(video);
    });
  4. blizzy78 created this gist Sep 12, 2014.
    26 changes: 26 additions & 0 deletions remove-golem-pre-video-ads.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    // ==UserScript==
    // @name Remove Golem.de Pre-Video Ads
    // @namespace http://blizzy.de/
    // @version 0.1
    // @description Removes pre-video ads from videos on golem.de
    // @match http://*.golem.de/*
    // @copyright 2014, Maik Schreiber
    // @require //code.jquery.com/jquery-2.1.1.min.js
    // ==/UserScript==

    $('figure').each(function(idx, el) {
    el = $(el);
    var id = el.attr('id');
    if (id.indexOf('gvideo_') === 0) {
    id = id.substring(7);
    var embedded = el.find('embed');
    var width = embedded.attr('width');
    var height = embedded.attr('height');
    var poster = embedded.attr('flashvars').replace(/^.*&image_src=([^&]+)&.*$/, '$1');
    var video = $.parseHTML('<video width="' + width + '" height="' + height + '" poster="' + poster + '" controls>' +
    '<source src="http://video.golem.de/download/' + id + '?q=high"/>' +
    '<source src="http://video.golem.de/download/' + id + '?q=medium"/>' +
    '</video>');
    el.replaceWith(video);
    }
    });