-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtwitter_popup.js
72 lines (67 loc) · 2.8 KB
/
twitter_popup.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// ==UserScript==
// @name Twitter Login Popup Remover
// @version 0.2.4
// @description Allows you to browse Twitter freely without logging in. src: https://greasyfork.org/en/scripts/441222-twitter-login-popup-remover/code
// @author npc tim
// @match *://*.twitter.com/*
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
let url = window.location.href;
let urlType = url.substring(8,14);
if(urlType == 'mobile') {
// Execute this script on the mobile version of the site
// Check if the banner is loaded. If it is, then remove the banner.
// Check every 100 milliseconds whether or not the banner appeared. Once it has appeared, stop checking for it.
let banner = document.getElementsByClassName("css-1dbjc4n r-l5o3uw");
let bannerInterval = setInterval(function() {
try {
banner[0].remove();
clearInterval(bannerInterval);
}
catch(err) {
}
}, 100);
// Check if the sign up prompt has appeared. If it is, then remove the sign up prompt. Also add scrolling capabilites back.
// Check every 250 milliseconds whether or not the prompt appeared.
let prompt1 = document.getElementsByClassName("css-1dbjc4n r-1awozwy r-1kihuf0 r-18u37iz r-1pi2tsx r-1777fci r-1pjcn9w r-xr3zp9 r-1xcajam r-ipm5af r-g6jmlv");
let promptInterval = setInterval(function() {
try {
let top = document.querySelector('html').style.top;
document.querySelector('html').style.overflowY='scroll';
prompt1[0].remove();
document.querySelector('html').style.removeProperty('position');
document.querySelector('html').scrollTop = Math.abs(parseInt(top));
}
catch(err) {
}
}, 250);
}
else {
// Execute this script on the desktop version of the site
// Check if the banner is loaded. If it is, then remove the banner.
// Check every 100 milliseconds whether or not the banner appeared. Once it has appeared, stop checking for it.
let banner = document.getElementsByClassName("css-1dbjc4n r-l5o3uw");
let bannerInterval = setInterval(function() {
try {
banner[0].remove();
clearInterval(bannerInterval);
}
catch(err) {
}
}, 100);
// Check if the sign up prompt has appeared. If it is, then remove the sign up prompt. Also add scrolling capabilites back.
// Check every 250 milliseconds whether or not the prompt appeared.
let prompt1 = document.getElementsByClassName("css-1dbjc4n r-1awozwy r-1kihuf0 r-18u37iz r-1pi2tsx r-1777fci r-1pjcn9w r-xr3zp9 r-1xcajam r-ipm5af r-g6jmlv");
let promptInterval = setInterval(function() {
try {
document.querySelector('html').style.overflowY='scroll';
prompt1[0].remove();
}
catch(err) {
}
}, 250);
}
})();