Specifically, this involves loading the logbook.qrz.com page into an iframe within a newly created tab and automatically querying it.

// ==UserScript==
// @name QRZ.com View QSO Logbook Records
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Add "My QSO" tab on QRZ callsign pages to show related logbook entries
// @author BG6QED
// @match https://www.qrz.com/db/*
// @match https://logbook.qrz.com/*
// ==/UserScript==
(function() {
'use strict';
// Process QRZ callsign detail page
if (window.location.hostname === 'www.qrz.com') && if (/\/db\//.test(window.location.pathname)) {
// Extract the callsign
const callsign = window.location.pathname.split('/db/')[1].toUpperCase().replace(/\/$/, '');
// Find the tab navigation
const tabsNav = document.querySelector('ul.ui-tabs-nav');
if (!tabsNav) return;
// Create and insert the new tab and panel
const tabId = 't_qso';
tabsNav.insertBefore(
Object.assign(document.createElement('li'), {
className: 'ui-state-default ui-corner-top',
innerHTML: `<<a href="#${tabId}" class="ui-tabs-anchor" id="ui-id-5">Regarding my QSO</a>```
}),
tabsNav.querySelector('li:has(input[onclick*="logbook.qrz.com/logbook/?op=add"])') || tabsNav.lastChild
);
const newPanel = Object.assign(document.createElement('div'), {
id: tabId,
className: 'ui-tabs-panel ui-widget-content ui-corner-bottom',
style: 'display: none',
innerHTML: ``
```<iframe with id "qsoIframe", styled with a width of 100%, a height of 800 pixels, and no border.></iframe>```javascript
});
tabsNav.parentNode.appendChild(newPanel);
// Tab switching handling
const handleTabClick = (tabLi, targetId, isNew) => {
```> e => {
e.preventDefault();
// Execute the original event
if (!isNew) tabLi.querySelector('a').click();
// Update tab and panel status
tabsNav.querySelectorAll('li').forEach(li => {> {
const active = li === tabLi;
li.classList.toggle('ui-tabs-active', active);
li.classList.toggle('ui-state-active', active);
});
document.querySelectorAll('.ui-tabs-panel').forEach(panel => {> ```javascript
{
panel.style.display = panel.id === targetId ? 'block' : 'none';
});
// Load iframe
if (isNew) {
newPanel.querySelector('iframe').src =
`https://logbook.qrz.com/?autosearch=${encodeURIComponent(callsign.toLowerCase())}`;
}
};
// Bind event
const newTab = tabsNav.querySelector(`li:has(a[href="#${tabId}"])`)
newTab.querySelector('a').addEventListener('click', handleTabClick(newTab, tabId, true));
tabsNav.querySelectorAll('li:not(:last-child)').forEach(li => {
```> {
const anchor = li.querySelector('a');
if (anchor) {
anchor.addEventListener('click', function(event) {
handleTabClick(li, anchor.getAttribute('href').slice(0, -1));
event.preventDefault();
});
}
}(1), false));
});
}
// Handle automatic search on the log page
else if (window.location.hostname === 'logbook.qrz.com') {
const searchTerm = new URLSearchParams(window.location.search).get('autosearch');
if (searchTerm) {
const interval = setInterval(() => {> {
const searchInput = document.getElementById('search');
if (searchInput) {
// Code to handle the search input goes here
}
} && if (typeof goto === 'function') {
searchInput.value = searchTerm;
goto('search');
clearInterval(interval);
}
}, 500);
setTimeout(() => {> {
clearInterval(interval), 10000);
}