就是將 `logbook.qrz.com` 頁面的 iframe 加載到新的標籤頁,並自動查詢。

// ==使用者腳本==
// @名稱 觀看 QRZ.com 的 QSO 日誌記錄
// @空間名稱 http://tampermonkey.net/
// @版本 1.0
// @描述 在 QRZ 呼號頁面新增「與我的 QSO」標籤,以顯示相關的日誌記錄
// @作者 BG6QED
// @匹配 https://www.qrz.com/db/*
// @匹配 https://logbook.qrz.com/*
// ==/使用者腳本==
(function() {
'use strict';
// 處理 QRZ 呼號詳細頁面
if (window.location.hostname === 'www.qrz.com' && 如果 (window.location.pathname.match('/db/test')) {
// 提取呼號
const callsign = window.location.pathname.split('/db/')[1].toUpperCase().replace(/\/$/, '');
// 找到標籤導航
const tabsNav = document.querySelector('ul.ui-tabs-nav');
if (!tabsNav) return;
// 建立並插入新的標籤和面板
const tabId = 't_qso';
tabsNav.insertBefore(
Object.assign(document.createElement('li'), {
className: 'ui-state-default ui-corner-top',
innerHTML: `<連結至「#${tabId}」,使用 `ui-tabs-anchor` 類別和 `ui-id-5` ID。>與我的 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` 具有 `id` 為 "qsoIframe",`style` 屬性設定為「寬度:100%;高度:800 像素;邊框:無」。></iframe>});
tabsNav.parentNode.appendChild(newPanel);
// 標籤切換處理
const handleTabClick = (tabLi, targetId, isNew) => {> e => {
e.preventDefault();
// 執行原始事件
if (!isNew) tabLi.querySelector('a').click();
// 更新標籤和面板狀態
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 => {> {
panel.style.display = panel.id === targetId ? 'block' : 'none';
});
// 加載 iframe
if (isNew) {
newPanel.querySelector('iframe').src =
`https://logbook.qrz.com/?autosearch=${encodeURIComponent(callsign.toLowerCase())}`;
}
};
// 綁定事件
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));
});
}
// 處理記錄頁面自動搜尋
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 && ```
if (typeof goto === 'function') {
searchInput.value = searchTerm;
goto('search');
clearInterval(interval);
}
}, 500);
setTimeout(() => {
```> clearInterval(interval), 10000);
}
})();