summaryrefslogtreecommitdiff
path: root/crocoite/data/per-site
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2018-01-20 17:01:47 +0100
committerLars-Dominik Braun <lars@6xq.net>2018-01-20 17:01:47 +0100
commit03c8f73d36f7491080adc97732f2da064008badc (patch)
tree4874247410b66c25b564491e5aca184ac0b36841 /crocoite/data/per-site
parent1bf7b6822eb3dce006fc3eab739f50fd384453f8 (diff)
downloadcrocoite-03c8f73d36f7491080adc97732f2da064008badc.tar.gz
crocoite-03c8f73d36f7491080adc97732f2da064008badc.tar.bz2
crocoite-03c8f73d36f7491080adc97732f2da064008badc.zip
twitter: Expand “more replies” links
Click them periodically.
Diffstat (limited to 'crocoite/data/per-site')
-rw-r--r--crocoite/data/per-site/twitter.js29
1 files changed, 21 insertions, 8 deletions
diff --git a/crocoite/data/per-site/twitter.js b/crocoite/data/per-site/twitter.js
index 330370a..2773f64 100644
--- a/crocoite/data/per-site/twitter.js
+++ b/crocoite/data/per-site/twitter.js
@@ -1,17 +1,30 @@
-/* Fixups for twitter: Some accounts are hidden behind a “suspicious activity”
- * message, click that.
+/* 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 fixup () {
- var show = document.querySelector ("button.ProfileWarningTimeline-button");
- if (show) {
- var click = new MouseEvent('click', {
+function makeClickEvent () {
+ return new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: true
});
- show.dispatchEvent (click);
+}
+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", fixup);
+window.addEventListener("load", showProfile);
+/* XXX: can we use a mutation observer instead? */
+window.setInterval (expandThread, 1000);
}());