DotDB PLUS

Add links and icons to TLDs in DotDB search results

当前为 2025-04-18 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name DotDB PLUS
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description Add links and icons to TLDs in DotDB search results
  6. // @author AtoZDomains@x.com
  7. // @match https://dotdb.com/search*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. function addLinksAndIconsToTLDs() {
  15. const tableBody = document.querySelector('#result-table tbody');
  16. if (!tableBody) {
  17. return;
  18. }
  19.  
  20. const rows = tableBody.querySelectorAll('tr');
  21.  
  22. rows.forEach(row => {
  23. const keywordCell = row.querySelectorAll('td')[0]; // Get keyword column (first td)
  24. if (!keywordCell) {
  25. return;
  26. }
  27. const keywordElement = keywordCell.querySelector('b') || keywordCell; // Prefer keyword in <b> tag, otherwise use entire td content
  28. let sld = keywordElement.textContent.trim().replace(/<b>|<\/b>/g, ''); // Get keyword, remove <b> tags
  29.  
  30. const tldCell = row.querySelectorAll('td')[3];
  31. if (!tldCell) {
  32. return;
  33. }
  34.  
  35. const tldDiv = tldCell.querySelector('.collapse-content .tw-w-\\[90\\%\\]');
  36. if (!tldDiv) {
  37. return;
  38. }
  39.  
  40. let tldText = tldDiv.textContent.trim();
  41. if (!tldText) {
  42. return;
  43. }
  44.  
  45. const tlds = tldText.split(',').map(tld => tld.trim());
  46.  
  47. let newHTML = '';
  48. tlds.forEach(tld => {
  49. const domain = `${sld}${tld}`;
  50. const link = `https://${domain}`;
  51. const iconUrl = `https://www.google.com/s2/favicons?domain=${domain}`;
  52.  
  53. const tldLinkHTML = `
  54. <a href="${link}" target="_blank" rel="noopener noreferrer" style="display: inline-flex; align-items: center; margin-right: 5px;">
  55. <img src="${iconUrl}" style="width: 16px; height: 16px; margin-right: 3px; vertical-align: middle;">
  56. ${tld}
  57. </a>`;
  58. newHTML += tldLinkHTML;
  59. });
  60.  
  61. tldDiv.innerHTML = newHTML;
  62. });
  63. }
  64.  
  65. window.addEventListener('load', addLinksAndIconsToTLDs);
  66.  
  67. })();