Created
September 30, 2014 15:19
-
-
Save petetnt/b8c4b40dab1dfb836d98 to your computer and use it in GitHub Desktop.
WebM Pifulle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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