Skip to content

Instantly share code, notes, and snippets.

@petetnt
Created Sep 30, 2014
Embed
What would you like to do?
WebM Pifulle
// ==UserScript==
// @name webm4pifu
// @namespace http://github.com/petetnt
// @description webm pifulle embed (greasemonkey/tampermonkey)
// @include http://www.punkinfinland.net/forum/*
// @version 0.0.1
// ==/UserScript==
(function () {
'use strict';
var links = document.links;
Object.keys(links).forEach(function (link) {
var href = links[link].href,
videoElem = "";
if (typeof href !== "undefined") {
if (href.split(".").pop().match(/webm*/)) {
videoElem = document.createElement("video");
videoElem.muted = true;
videoElem.autoplay = true;
videoElem.loop = true;
videoElem.src = href;
videoElem.style.maxWidth = "500px";
videoElem.style.width = "100%";
links[link].parentNode.replaceChild(videoElem, links[link]);
}
}
});
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment