Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
// this code is not amazing. Was not suppose to be...
// like I was lazy to check the news, I was also lazy to code ahahah
// check the reason of this gist here: https://www.youtube.com/watch?v=7w9p3beJHyA
// define slideshow time in seconds
var slideTime = 3;
// fail safe clear
window.feedlySlide = undefined;
$(document).on('keyup', function(e) {
if(e.which == 81) { // use 'q' key to start the slideshow
if (window.feedlySlide == undefined) {
// start the interval for the slideshow
window.feedlySlide = setInterval(function () {
$(".slideBumper-right").click();
}, slideTime * 1000);
// add element showing tht slishow is running
var span = document.createElement('div');
span.innerHTML = "<span id='feedly-slide-indicator' style='background: green;position: absolute;top:0;right:0;color: white; z-index: 5000;'>Running Slideshow!</span>";
document.getElementsByClassName('sliderContainer')[0].appendChild(span);
}
} else if (e.which == 87) { // use 'w' key to stop the slideshow
// stop the slideshow interval
clearInterval(window.feedlySlide);
window.feedlySlide = undefined;
// clear element
$("span#feedly-slide-indicator").remove();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment