Skip to content

Instantly share code, notes, and snippets.

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 dotWee/3124cadda4ad112e5ea33b9761e5353b to your computer and use it in GitHub Desktop.
Save dotWee/3124cadda4ad112e5ea33b9761e5353b to your computer and use it in GitHub Desktop.
Add a Download button below the currently viewing video on oth-regensburg.zoom.us
// ==UserScript==
// @name oth-regensburg.zoom.us_add-video-download-button.user
// @description Add a Download button below the currently viewing video on oth-regensburg.zoom.us
// @match *://oth-regensburg.zoom.us/*
// @run-at document-idle
// @version 1.0.0
// @grant none
// @author Lukas Wolfsteiner <lukas@wolfsteiner.media>
// @updateURL https://gist.github.com/dotWee/3124cadda4ad112e5ea33b9761e5353b/raw/a2e79ed7fa0909525abd81d125e3861409bb3c75/oth-regensburg.zoom.us_add-video-download-button.user.js
// @downloadURL https://gist.github.com/dotWee/3124cadda4ad112e5ea33b9761e5353b/raw/a2e79ed7fa0909525abd81d125e3861409bb3c75/oth-regensburg.zoom.us_add-video-download-button.user.js
// ==/UserScript==
document.superListener = document.addEventListener;
document.addEventListener = function(type, listener, useCapture){
if(type != 'contextmenu')
document.superListener(type, listener, !!useCapture);
};
function insertLink() {
var video = document.getElementsByTagName('video')[0];
var videoSource = video.src; //video.getAttribute('src');
console.log(video);
var link = document.createElement('a');
link.setAttribute('href', videoSource)
link.setAttribute('download', "download");
link.setAttribute('id', 'download-link');
link.style.position = 'absolute';
link.style.paddingTop = '25px';
link.innerHTML =`<button id='download-button' href="${videoSource}">Download video - right click here and click <b>'Save link as...'</b></button>`;
var mainSection = document.getElementsByClassName('main')[0];
mainSection.insertAdjacentHTML('afterBegin', link.outerHTML);
mainSection.oncontextmenu = null;
var downloadButton = document.getElementById('download-button');
downloadButton.style.backgroundColor = '#008CBA';
downloadButton.style.border = 'none';
downloadButton.style.color = 'white';
downloadButton.style.padding = '15px 32px';
downloadButton.style.textAlign = 'center';
downloadButton.style.textDecoration = 'none';
downloadButton.style.fontSize = '16px';
downloadButton.style.cursor = 'pointer';
downloadButton.oncontextmenu = null;
link.style.cursor = 'pointer';
changeElementPosition();
window.onresize = changeElementPosition;
}
function changeElementPosition() {
var height = getVideoHeight();
var insertedLink = document.getElementById('download-link');
insertedLink.style.marginTop = height;
insertedLink.oncontextmenu = null;
}
function getVideoHeight() {
return document.getElementsByClassName('player-view')[0].style.height;
}
insertLink();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment