Skip to content

Instantly share code, notes, and snippets.

@buritica
Last active August 29, 2015 14:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buritica/17148e5065f36bc5dde5 to your computer and use it in GitHub Desktop.
Save buritica/17148e5065f36bc5dde5 to your computer and use it in GitHub Desktop.
Automate reader swiping
var timer;
var times = 0;
var delay = 4; // seconds
var totalSwipes = 3; //
var next = function() {
if (window.onswipePub) {
onswipePub.entryView.entryMgr.swipeNext();
} else {
leaf.app.router.next();
}
}
function demo() {
console.info('swiped %s times', times++);
next();
if (totalSwipes && times === totalSwipes) {
window.clearInterval(timer);
console.info('demo complete');
}
};
timer = window.setInterval(demo, delay * 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment