diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2017-12-19 09:14:43 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2017-12-19 09:14:43 +0100 |
commit | 8e939f8922815bd917f4dd750aa5f8a17a8f750c (patch) | |
tree | f30d630a33c1aba991b723da4fcb139852bac674 /crocoite/data/per-site | |
parent | 6a771cf9df0e9446feab59b50cea2998d42a459f (diff) | |
download | crocoite-8e939f8922815bd917f4dd750aa5f8a17a8f750c.tar.gz crocoite-8e939f8922815bd917f4dd750aa5f8a17a8f750c.tar.bz2 crocoite-8e939f8922815bd917f4dd750aa5f8a17a8f750c.zip |
Select default behavior scripts by site URL
Diffstat (limited to 'crocoite/data/per-site')
-rw-r--r-- | crocoite/data/per-site/instagram.js | 21 | ||||
-rw-r--r-- | crocoite/data/per-site/twitter.js | 17 |
2 files changed, 38 insertions, 0 deletions
diff --git a/crocoite/data/per-site/instagram.js b/crocoite/data/per-site/instagram.js new file mode 100644 index 0000000..da7b5ea --- /dev/null +++ b/crocoite/data/per-site/instagram.js @@ -0,0 +1,21 @@ +/* Fixups for instagram: searches for the “show more” button and clicks it + */ +(function(){ +function fixup () { + var links = document.querySelectorAll ("main a"); + for (var i = 0; i < links.length; i++) { + var href = links[i].getAttribute ("href"); + if (href.search (/\?max_id=\d+$/) != -1) { + var click = new MouseEvent('click', { + view: window, + bubbles: true, + cancelable: true + }); + console.log ('clicking', href); + links[i].dispatchEvent (click); + break; + } + } +} +window.addEventListener("load", fixup); +}()); diff --git a/crocoite/data/per-site/twitter.js b/crocoite/data/per-site/twitter.js new file mode 100644 index 0000000..330370a --- /dev/null +++ b/crocoite/data/per-site/twitter.js @@ -0,0 +1,17 @@ +/* Fixups for twitter: Some accounts are hidden behind a “suspicious activity” + * message, click that. + */ +(function(){ +function fixup () { + var show = document.querySelector ("button.ProfileWarningTimeline-button"); + if (show) { + var click = new MouseEvent('click', { + view: window, + bubbles: true, + cancelable: true + }); + show.dispatchEvent (click); + } +} +window.addEventListener("load", fixup); +}()); |