hurley / GimmePS5Info

// ==UserScript==
// @name         GimmePS5Info
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.playstation.com/de-de/explore/ps5/*
// @grant        none
// @licence      MIT
// ==/UserScript==

(function() {
    'use strict';

    var ls = window.localStorage;
    var lsKey = 'ps5Body';

    var body = document.getElementById('page-content').innerHTML;
    var lsBody = ls.getItem(lsKey);
    var refreshInterval = null;

    // audio element
	var audioElement = document.createElement('audio');
	var audioAlarmSound = 'https://freesound.org/data/previews/25/25032_30374-lq.mp3';

    // Initial save of the page-content.
    if ( typeof lsBody === 'undefined' || lsBody === null || lsBody.length <= 0 ) {
        ls.setItem( lsKey, body );
    }

    // Init the audio element
    audioElement.setAttribute( 'src', audioAlarmSound );
    audioElement.addEventListener( 'ended', function() {
        this.play();
    }, false);

    if ( body !== lsBody ) {
        audioElement.play();
    } else {
        // Refresh in 5 Minutes.
        refreshInterval = setInterval( function() {
            location.reload();
        }, 1000 * 60 * 5 );
    }
})();