-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c2d5418
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// ==UserScript== | ||
// @name Enable Matterhorn Engage Downloads | ||
// @namespace https://mh-engage.ltcc.tuwien.ac.at | ||
// @include https://mh-engage.ltcc.tuwien.ac.at/engage/ui/watch.html?id=* | ||
// @version 1 | ||
// @grant none | ||
// ==/UserScript== | ||
|
||
// Matterhorn Engage supports downloading of streams but it's disabled in the front end. | ||
|
||
// Opencast.download.showLinks() fills #oc_client_downloads with download links during | ||
// page load. The function, however, checks if a certain attribute is set and if yes it | ||
// doesn't show certain links. We disable that check so that it always evaluates to true. | ||
var showLinks = Opencast.download.showLinks.toString(); | ||
showLinks = showLinks.replace("media[i][\"tags\"][\"tag\"].indexOf('engage')", '-1'); | ||
Opencast.download.showLinks = eval('(' + showLinks + ')'); | ||
|
||
// Fix the icon of the download button. | ||
$("<style> \ | ||
#oc_player-head-right #oc_download-button { \ | ||
background-position: -180px -125px; \ | ||
} \ | ||
#oc_player-head-right #oc_download-button:hover, #oc_player-head-right #oc_download-button:focus { \ | ||
background-position: -180px -155px; \ | ||
} \ | ||
</style>").appendTo("head"); | ||
|
||
// Save the state of the download button so we can restore it once it has been removed. | ||
var download_button = null; | ||
$(function () { | ||
download_button = $('#oc_download-button'); | ||
}); | ||
|
||
// #oc_download-button is detached() from an asynchronous AJAX call. | ||
// So we've to readd it once all AJAX calls have been finished. | ||
$(document).ajaxStop(function () { | ||
if ($('#oc_download-button').parent().html() === null) { | ||
$('#oc_player-head-right').append(download_button); | ||
} | ||
}); |