-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.js
39 lines (32 loc) · 1.4 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Checking page title
var runner = function() {
if (document.URL.includes("instagram.com")) {
var root_ = document.getElementById('react-root');
var span_ = root_.querySelector('[data-testid=live-badge]');
if (span_) {
var video = root_.getElementsByTagName('video')[0];
var videoParent = video.closest("div");
if (videoParent) {
// var body = document.getElementsByTagName("BODY")[0];
document.body.classList.add("with-instagram-landscaper");
videoParent.classList.add("video-container");
var node = document.createElement("span");
var textnode = document.createTextNode("Full Screen");
node.appendChild(textnode);
node.addEventListener('click', function (e) {
root_.classList.add('landscape-width-css');
});
videoParent.appendChild(node);
document.body.onkeyup = function(e){
if(e.key === 'Escape' && root_.classList.contains('landscape-width-css')){
document.body.classList.remove("with-instagram-landscaper");
root_.classList.remove('landscape-width-css');
}
}
}
}
}
}
setTimeout(function() {
runner();
}, 1000)