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.
Remove pre-video ads from golem.de
// ==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);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment