Skip to content

Instantly share code, notes, and snippets.

@bionik
Created June 14, 2018 12:38
Show Gist options
  • Save bionik/73138b5f0186f2761a337d4f85dc2bfb to your computer and use it in GitHub Desktop.
Save bionik/73138b5f0186f2761a337d4f85dc2bfb to your computer and use it in GitHub Desktop.
apina.biz video to gif userscript
// ==UserScript==
// @name Apina.biz video2gif
// @description Replace apina.biz videos with gif
// @namespace bionik
// @include https://apina.biz/*
// @version 1
// @grant none
// ==/UserScript==
var videos = document.querySelectorAll('video.gif');
for(var i = 0; i < videos.length; i++){
var video = videos[i];
var video_source = video.querySelector('source');
var video_src = video_source.src;
var img = document.createElement('img');
var img_src = video_src;
img_src = img_src.replace(".webm", ".gif");
img_src = img_src.replace(".mp4", ".gif");
img.src = img_src;
img.width = video.width;
img.height = video.height;
video.parentNode.replaceChild(img, video);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment