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/d248e7384cf349f455dafde8b13b4b70 to your computer and use it in GitHub Desktop.
Save dotWee/d248e7384cf349f455dafde8b13b4b70 to your computer and use it in GitHub Desktop.
Add a Download button below the currently viewing video on vimp.oth-regensburg.de/m/
// ==UserScript==
// @name vimp.oth-regensburg.de-m_add-video-download-button.user
// @description Add a Download button below the currently viewing video on vimp.oth-regensburg.de/m/
// @match *://vimp.oth-regensburg.de/m/*
// @version 1.0.0
// @grant none
// @author Lukas Wolfsteiner <lukas@wolfsteiner.media>
// ==/UserScript==
var downloadButtonParentSelector = document.querySelector('#siteContent > article > div.wrap.col-xs-12.col-sm-6.col-md-9.col-lg-9.col-xlg-9 > section.details > div:nth-child(1) > div.buttonpane.clearfix');
if (downloadButtonParentSelector !== null) {
// element exists
console.log('download button parent already exists');
// check if download button already exists
var downloadButtonSelector = document.querySelector('#siteContent > article > div.wrap.col-xs-12.col-sm-6.col-md-9.col-lg-9.col-xlg-9 > section.details > div:nth-child(1) > div.buttonpane.clearfix > a');
if (downloadButtonSelector !== null) {
// button already exists
console.log('button already exists');
} else {
var videoKey = document.getElementById("sharekey").value;
console.log(`videoKey: ${videoKey}`);
// var videoUrl = `https://vimp.oth-regensburg.de/getMedium/${videoKey}.mp4`;
var videoUrl = `https://vimp.oth-regensburg.de/getMedia.php?key=${videoKey}&type=mp4`;
var buttonDownload = `<a class="btn btn-primary downloadMedia" href="${videoUrl}"><i class="icon-cloud-download"></i> Download</a>`;
downloadButtonParentSelector.innerHTML += buttonDownload;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment