Auto-reload FilmOn streams at each timeout

This script allows you to auto-reload a FilmOn stream at each timeout

  1. // ==UserScript==
  2. // @name Auto-reload FilmOn streams at each timeout
  3. // @namespace https://github.com/GavinBrelstaff
  4. // @description This script allows you to auto-reload a FilmOn stream at each timeout
  5. // @match http*://www.filmon.com/channel/*
  6. // @version 2.0
  7. // @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
  8. // ==/UserScript==
  9.  
  10. window.count = 0;
  11.  
  12. setInterval(function() // Polling
  13. {
  14. const el = document.querySelector( 'div.tvg-count.countdown[secs]' );
  15. if( el ) // count down on page
  16. {
  17. const secs = el.getAttribute('secs');
  18. //document.title = "Filmon " + secs;
  19. if( secs < 6 ) location.href = location.href; // reload the page
  20. }
  21. const el3 = document.querySelector( 'div.jw-display-icon-container.jw-display-icon-display' );
  22. if( !el && el3 ) // catch Loading... icon appearance
  23. {
  24. const visibility = el3.checkVisibility();
  25. if( visibility ) el3.style.visibility = "hidden";
  26. //document.title = 'Filmon ' + window.count + ' ' + visibility;
  27. if( visibility && window.count > 1)
  28. location.href = location.href; // reload the page
  29. else
  30. window.count++;
  31. }
  32.  
  33. }, 1000); // every second