Last active
February 26, 2021 11:04
-
-
Save kopiro/7431923 to your computer and use it in GitHub Desktop.
Facebook: scroll in the messages to a particular date
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javascript: | |
| (function(){ | |
| function _(a) { return document.querySelectorAll(a); } | |
| var to = new Date(prompt('Arrival date', '2013/04/18')).getTime()/1000; | |
| if (!to) return alert('Invalid date'); | |
| var thetime = 0; | |
| var sametimes = 0; | |
| function thefoo(){ | |
| var time = parseInt(_('.webMessengerMessageGroup')[0].querySelector('[data-utime]').dataset.utime,10); | |
| if (time==thetime) { | |
| sametimes++; | |
| _('[role=main] .uiScrollableAreaWrap')[0].scrollTop=0; | |
| if (sametimes<10) setTimeout(thefoo, 800); | |
| else alert("Can't scroll more!"); | |
| } else { | |
| sametimes = 0; | |
| thetime = time; | |
| if (thetime>to) setTimeout(thefoo, 500); | |
| else alert("Done!"); | |
| } | |
| } thefoo(); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Kopio, where do I install this javascript to use this code? Thank you.