spa0609 / Traefik.io Replace HostRule with Link

// ==UserScript==
// @name         Traefik.io Replace HostRule with Link
// @namespace    https://openuserjs.org/users/spa0609
// @version      0.3
// @description  Finds host rules in Traefik.io dashbord and replaces them with link. So that you can open them.
// @grant        none
// @require      https://code.jquery.com/jquery-2.1.4.min.js
// @include      http://monitor.docker.local:8080/dashboard/
// @author       spa0609 (https://openuserjs.org/users/spa0609)
// @copyright 2019, spa0609 (https://openuserjs.org/users/spa0609)
// @license MIT
// ==/UserScript==

// ==OpenUserJS==
// @author       spa0609
// ==/OpenUserJS==


var $j = jQuery.noConflict(true);
var doing_modifications = false;

function InitLayout() {
  try {
    doing_modifications = true;
    var $host = $j(".has-text-grey:contains('Host')");
    if ($host.length === 0) {
      return;
    }
    if ($host.find('a').length === 0) {
      var link = $host.text().replace("Host:", "");
      $host.replaceWith($j("<a target='_blank' href='http://" + link + "'>" + link + "</a>"));
    }

  }
  catch (exception) {
    doing_modifications = false;
    console.log("Error found on the page :" + exception);
  }
  doing_modifications = false;
}

$j(document).ready(function () {
  var timer = 0;
  $j("body").bind("DOMSubtreeModified", function () {
    if (timer) {
      window.clearTimeout(timer);
    }

    timer = window.setTimeout(function () {
      InitLayout();
    }, 100);
  });
});