aboutsummaryrefslogtreecommitdiff
path: root/SELectureOptimizer.js
diff options
context:
space:
mode:
authorLeonard Kugis <leonard@kug.is>2020-04-25 22:12:16 +0200
committerLeonard Kugis <leonard@kug.is>2020-04-25 22:12:16 +0200
commitdf17352f080214003483354481237fa9b30f5917 (patch)
treef4c3bd1936aa245f1285f8dcbd54d687e10eeb64 /SELectureOptimizer.js
Initial commit
Diffstat (limited to 'SELectureOptimizer.js')
-rw-r--r--SELectureOptimizer.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/SELectureOptimizer.js b/SELectureOptimizer.js
new file mode 100644
index 0000000..887c6b6
--- /dev/null
+++ b/SELectureOptimizer.js
@@ -0,0 +1,27 @@
+// ==UserScript==
+// @name SE Lecture optimizer
+// @namespace http://tampermonkey.net/
+// @version 1.0
+// @date 2020-04-25
+// @description Removes the autoplay and autobuffer from the videos of the SE Lecture page. So no more loading of 20 videos simultaniously to watch 1 video.
+// @author Leonard Kugis
+// @homepage https://collaborating.tuhh.de/cev7691/SELectureOptimizer
+// @match https://media.tuhh.de/e16/Lecture-SE/
+// @grant none
+// ==/UserScript==
+
+(function() {
+ var videos = Array.from(document.getElementsByTagName("video"));
+ for(var i = 0; i < videos.length; i++) {
+ videos[i].pause(0);
+ var src = videos[i].src;
+ videos[i].removeAttribute("src");
+ videos[i].load();
+ var old = videos[i];
+ videos[i] = document.createElement("video");
+ videos[i].setAttribute("preload", "none");
+ videos[i].setAttribute("controls", "");
+ videos[i].setAttribute("src", src);
+ old.parentNode.replaceChild(videos[i], old);
+ }
+})();