Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@petetnt
Created September 30, 2014 15:19
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 petetnt/b8c4b40dab1dfb836d98 to your computer and use it in GitHub Desktop.
Save petetnt/b8c4b40dab1dfb836d98 to your computer and use it in GitHub Desktop.
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