// ==UserScript==
// @name WiGLE MAC address manufacturer lookup
// @namespace com.franga2000
// @downloadUrl https://gist.githubusercontent.com/franga2000/e9fe898fb2f0efeaf284598dff6e216c/raw/GM_WiGLE_OUI.js
// @match https://wigle.net/mapsearch*
// @run-at document-idle
// @grant none
// ==/UserScript==
function loadTitle(el) {
var req = new XMLHttpRequest();
req.open("GET", "https://api.macvendors.com/" + el.innerHTML);
req.onload = function() {
if (req.status == 200) {
el.title = req.response;
}
};
req.send(null);
}
var selector = "#resultColumn .mapsearchResult .mapsearchInnerTable tr:nth-child(2) td:nth-child(1) strong";
function init() {
document.querySelectorAll(selector).forEach(function(el) {
el.onmouseover = function() {
if (el.title == "") {
el.title = "Loading...";
loadTitle(el);
}
};
});
}
var target = document.getElementById('resultColumn');
var observer = new MutationObserver(init);
observer.observe(document.getElementById("resultColumn"), { attributes: false, childList: true, characterData: false });