From 82d779208d208c225e7b3deefc3aa45bb0aedce8 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Wed, 22 Nov 2017 08:56:25 +0100 Subject: Add example fixups for Instagram --- crocoite/data/fixups.instagram.js | 21 +++++++++++++++++++++ crocoite/data/scroll.js | 2 ++ 2 files changed, 23 insertions(+) create mode 100644 crocoite/data/fixups.instagram.js (limited to 'crocoite/data') diff --git a/crocoite/data/fixups.instagram.js b/crocoite/data/fixups.instagram.js new file mode 100644 index 0000000..da7b5ea --- /dev/null +++ b/crocoite/data/fixups.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/scroll.js b/crocoite/data/scroll.js index d16383c..2b4dff1 100644 --- a/crocoite/data/scroll.js +++ b/crocoite/data/scroll.js @@ -1,3 +1,5 @@ +/* Continuously scrolls the page + */ (function(){ function scroll (event) { if (__crocoite_stop__) { -- cgit v1.2.3