afr / show-site-details-nms-nec

// ==UserScript==
// @name         show-site-details-nms-nec
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  try to take over the world!
// @author       afr
// @include      /(^https|http):\/\/(\d{1,3}).(\d{1,3}).(\d{1,3}).(\d{1,3})/
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @require      https://gist.github.com/raw/2625891/waitForKeyElements.js
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
// @updateURL    https://openuserjs.org/meta/afr/show-site-details-nms-nec.meta.js
// @downloadURL  https://openuserjs.org/install/afr/show-site-details-nms-nec.user.js
// @copyright    2022
// @license      MIT
// ==/UserScript==

(function () {
  'use strict';

  let i = 1

  function showSiteDetails() {
    if (document.getElementById('siteDetails') === null && document.getElementById('lct_ne_name-innerCt') === null) {
      const siteDetails = document.getElementsByTagName('title')[0].innerText
      const element = document.createElement('h1')
      element.id = 'siteDetails'
      element.setAttribute('style', 'margin-left: 10px; margin-top: 5px;')
      element.innerText = siteDetails
      const target = document.querySelectorAll('table')[7].querySelectorAll('tr')[0]
      target.appendChild(element)

    }else {
      console.log(`this function runs ${i++} time(s)`)

    }

  }

  waitForKeyElements('#EQUIP, #IDUIMAGE', showSiteDetails)

})();