Last active
July 29, 2022 21:23
-
-
Save Venipa/74a751f64699a9a1f25b8548d1615bd6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// ==UserScript== | |
// @name Twitter HTML5 Video | |
// @namespace https://venipa.net | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author Venipa | |
// @match https://twitter.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com | |
// @updateUrl https://gist.github.com/Venipa/74a751f64699a9a1f25b8548d1615bd6/raw/twitter-html5-player.user.js | |
// @grant unsafeWindow | |
// ==/UserScript== | |
/* jshint esversion: 6 */ | |
(function() { | |
'use strict'; | |
function checkVideo(video, play) { | |
if (!video.controls) video.controls = true; | |
if (video.style.zIndex == '') video.style.zIndex = '99'; | |
if (video.volume == 1) video.volume = 0.1; | |
if (play) video.muted = false; | |
} | |
(function(video, check){ | |
var fn = video.load; | |
video.load = function() { | |
if (this.hasAttribute("playsinline")) { | |
check(this, false); | |
} | |
return fn.apply(this, arguments); | |
}; | |
})(unsafeWindow.HTMLVideoElement.prototype, checkVideo); | |
(function(video, check){ | |
var fn = video.play; | |
video.play = function() { | |
if (this.hasAttribute("playsinline")) { | |
check(this, true); | |
} | |
return fn.apply(this, arguments); | |
}; | |
})(unsafeWindow.HTMLVideoElement.prototype, checkVideo); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Userscript: Script

Better Twitter Player: