Last active
June 1, 2024 08:18
-
-
Save Venipa/f9a91ba80d2f99297cc2bd7081cc87f6 to your computer and use it in GitHub Desktop.
Instagram - Brings HTML5 native player to top layer v2
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 Instagram HTML5 Video | |
// @namespace https://venipa.net | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author Venipa | |
// @match https://www.instagram.com/* | |
// @updateURL https://gist.github.com/Venipa/f9a91ba80d2f99297cc2bd7081cc87f6/raw/e98b7d9f29e91e7fe5aef14101380b9532a0df61/instagram-native-html5-player.user.js | |
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
// @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 = '9'; | |
if (video.style.position == '') video.style.position = 'relative'; | |
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(video, 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(video, arguments); | |
}; | |
})(unsafeWindow.HTMLVideoElement.prototype, checkVideo); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Watch videos without blasting ur ears:
