kliput / Autoplay TokFM

// ==UserScript==
// @name         Autoplay TokFM
// @namespace    http://github.com/kliput
// @version      0.1
// @description  Start TokFM player automatically
// @author       kliput
// @match        http://audycje.tokfm.pl/player
// @grant        none
// @copyright 2018, kliput (https://openuserjs.org//users/kliput)
// @license MIT
// ==/UserScript==

(function () {
  'use strict';

  function clickPlay() {
    var play = document.getElementsByClassName('app--button-radio_on')[0];
    if (play) {
      play.click();
    }
    else {
      console.log('no element, waiting...');
      setTimeout(clickPlay, 500);
    }
  }
  clickPlay();
})();