Skip to content

Instantly share code, notes, and snippets.

@paretje
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paretje/97bcdc7e14ee05f46ad3 to your computer and use it in GitHub Desktop.
Save paretje/97bcdc7e14ee05f46ad3 to your computer and use it in GitHub Desktop.
Use a video object instead of flash on the website of één
// ==UserScript==
// @name No Flash on VRT
// @version 0.3
// @author Paretje
// @description Use a video object instead of flash on the website of één
// @namespace http://www.online-urbanus.be
// @downloadURL https://gist.githubusercontent.com/paretje/97bcdc7e14ee05f46ad3/raw/noflashonvrt.user.js
// @updateURL https://gist.githubusercontent.com/paretje/97bcdc7e14ee05f46ad3/raw/noflashonvrt.user.js
// @include http://www.een.be/*
// @include http://een.be/*
// @include http://www.canvas.be/*
// @include http://deredactie.be/*
// @include http://www.ketnet.be/*
// @grant none
// ==/UserScript==
function showVideoObject(element, url, width, height) {
element.html(
'<object width="' + width + '" height="' + height + '" data="' + url +
'" type="video/mp4"></object>'
)
}
$vamp.create = function(playerconfig) {
element = $('#' + playerconfig.id)
if(playerconfig.branc == 'canvas') {
$.jsonp({
url: "http://mp.vrt.be/api/playlist/details/"+playerconfig.guid+".json",
callback: "videoDetail",
timeout: 10000,
success: function(data) {
showVideoObject(element, data.channel.items[0].item.ipad_url, playerconfig.width, playerconfig.height)
}
})
} else {
if(playerconfig.brand == 'ketnet') {
element = element.parent()
}
showVideoObject(element, playerconfig.source.hls, playerconfig.width, playerconfig.height)
}
}
function ketnetHack() {
if (playerConfig.brand == 'ketnet' && $('object#'+playerConfig.id).length == 0) {
setTimeout(function() {
ketnetHack()
},100)
} else {
$vamp.create(playerConfig)
}
}
ketnetHack()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment