itsastickup / [DEPRECATED] Auto-send to kindle from fivefilters.org

// ==UserScript==
// @name         [DEPRECATED] Auto-send to kindle from fivefilters.org
// @namespace    http://itsastickup.com
// @version      0.1
// @description  Does not work with the new site
// @author       itsastickup
// @license MIT 
// @copyright 2019, Mr Public Domain
// @match        https://pushtokindle.fivefilters.org/send.php*
// @grant GM_log
// @grant window.close
// @require      http://code.jquery.com/jquery-3.3.1.slim.min.js#sha384=q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo
// ==/UserScript==

(function () {
  'use strict';

  function debug(s, label) {
    label = label || '';
    if (label) {
      label = label + ': ';
    }
    console.debug('auto send to kindle 2019 itsastickup - ' + label + s);
    return s;
  }

  function debugb(s, label) {

    label = label || '';
    if (label) {
      label = '<div>' + label + ': ' + '</div>';
    }
    $('body').prepend(label + '<pre>' + s + '</pre>');
  }

  debug('start');

  var sent = false;
  var lb = null;
  $(document).ready(function () {

    setInterval(function () {

      if (sent == false) {
        if ($("#loadingBar").length) {
          lb = $("#loadingBar");
          if (lb.css('display') == 'none') {
            $("#send").click();

            sent = true;
          }
        }
      }
      else {
        if ($('h3:contains("Sent!")').length) {
          window.close();
        }
      }
    }, 250);
  });

})();