Created
June 14, 2021 13:06
-
-
Save ItsOnlyBinary/52a3b1197993d8ea67b11ec8833398ff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
kiwi.plugin('userbox_whois_geoip', function(kiwi, log) { | |
var currentUser = null; | |
kiwi.on('userbox.show', function (user, buffer) { | |
currentUser = user; | |
}); | |
kiwi.on('sidebar.hide', function (user, buffer) { | |
currentUser = null; | |
}); | |
kiwi.on('irc.whois', function (event, network, ircEventObj) { | |
if (event.nick !== currentUser.nick) { | |
return; | |
} | |
var userboxWhois = document.querySelector('.kiwi-userbox-whois'); | |
if (!userboxWhois) { | |
// Whois not currently shown | |
return; | |
} | |
var userboxWhoisGeoip = userboxWhois.querySelector('.kiwi-whois-geoip'); | |
if (userboxWhoisGeoip) { | |
// Dom element already exists | |
return; | |
} | |
if (!event.special || !event.special.geoip) { | |
// Whois does not have the data we are looking for | |
return; | |
} | |
var whoisGeoip = document.createElement('span'); | |
whoisGeoip.className = 'kiwi-whois-geoip'; | |
whoisGeoip.innerText = event.special.geoip; | |
userboxWhois.appendChild(whoisGeoip); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment