summaryrefslogtreecommitdiff
path: root/crocoite/data/per-site/twitter.js
blob: 2773f645a9fb9db3a73ac6a8cfcd61185aad369b (plain)
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
/* Fixups for twitter:
 * - Some accounts are hidden behind a “suspicious activity” message, click
 *   that.
 * - Click “more replies” buttons periodically (as they popup when scrolling)
 */
(function(){
function makeClickEvent () {
	return new MouseEvent('click', {
				view: window,
				bubbles: true,
				cancelable: true
				});
}
function expandThread () {
	let links = document.querySelectorAll('a.ThreadedConversation-moreRepliesLink');
	for (let i = 0; i < links.length; i++) {
		links[i].dispatchEvent (makeClickEvent ());
	}
	return true;
}
function showProfile () {
	var show = document.querySelector ("button.ProfileWarningTimeline-button");
	if (show) {
		show.dispatchEvent (makeClickEvent ());
	}
}
window.addEventListener("load", showProfile);
/* XXX: can we use a mutation observer instead? */
window.setInterval (expandThread, 1000);
}());