Javascript Help scripting Google Photo Slideshow

Javascript Help scripting Google Photo Slideshow
0.0 0

#1

I’m creating a digital frame using a raspberry pi and google photo slide show and found this script to slow down the speed of the pictures changing as well as go back to the first photo when the last photo is reached, but it isn’t working. I’m using greasemonkey on Firefox. I’m new to scripts so it might be an easy fix, but I’ve tried a lot with nothing working. Any help is appreciated.

// ==UserScript==
// @name google photos slower slideshow
// @include https://photos.google.com/album/*

// ==/UserScript==

// CHANGE first_photo TO USE THE URL OF THE FIRST PHOTO IN YOUR ALBUM
var first_photo = ‘https://photos.google.com/album/XXXX/photo/XXXX’;
function pressKey() {
var key = 39; // right arrow keycode
var body = document.getElementsByTagName(‘body’)[0];
if(document.createEventObject) {
var eventObj = document.createEventObject();
eventObj.keyCode = key;
body.fireEvent(“onkeydown”, eventObj);
} else if (document.createEvent) {
var eventObj = document.createEvent(“Events”);
eventObj.initEvent(“keydown”, true, true);
eventObj.which = key;
body.dispatchEvent(eventObj);
}
}
function next_or_prev() {
var current_url = window.location.href;
pressKey();
if (current_url == window.location.href) {
// page didnt change, must be at last photo
// load the first photo
window.location.href = first_photo;
}
}
window.setInterval(function(){next_or_prev()}, 600000);