Skip to content

Instantly share code, notes, and snippets.

@emindeniz99
Last active May 6, 2023 06:24
Show Gist options
  • Save emindeniz99/9638abc6ad06523b47c27aec1ca843b5 to your computer and use it in GitHub Desktop.
Save emindeniz99/9638abc6ad06523b47c27aec1ca843b5 to your computer and use it in GitHub Desktop.
panopto video speed
// ==UserScript==
// @name panopto video speed
// @namespace http://tampermonkey.net/
// @version 0.1.1
// @description try to take over the world!
// @author You
// @match https://boun.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=*
// @icon https://www.google.com/s2/favicons?domain=panopto.eu
// @grant none
// ==/UserScript==
(function() {
'use strict';
const speedAdd=(speed=3)=>{
const superfast =document.querySelector("#Fastest").cloneNode(true);
superfast.onclick=()=>{document.getElementsByTagName("video").primaryVideo.playbackRate=speed;
document.querySelector("#playSpeedMultiplier").innerText=`${speed}x`;
};
superfast.innerText=`${speed}`;
superfast.id="ssuper";
document.querySelector("#playSpeedExpander").insertBefore(superfast,document.querySelector("#playSpeedExpander .flyout-close"))
}
// set up the mutation observer
var h1observer = new MutationObserver(function (mutations, me) {
// mutations is an array of mutations that occurred
// me is the MutationObserver instance
var canvas = document.querySelector("#Fastest");
if (canvas) {
speedAdd(2.25);
speedAdd(2.5);
speedAdd(2.75);
speedAdd(3);
speedAdd(3.25);
speedAdd(3.5);
speedAdd(4);
speedAdd(16);
me.disconnect(); // stop observing
return;
}
});
// start observing
h1observer.observe(document, {
childList: true,
subtree: true,
});
// Your code here...
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment