IAFD - Better Alias List (IA)

Reformat the Alias list with an space after each comma + Sites within parentheses (In serach results too)(IA)

Verzia zo dňa 21.12.2024. Pozri najnovšiu verziu.

// ==UserScript==
// @name         IAFD - Better Alias List (IA)
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  Reformat the Alias list with an space after each comma + Sites within parentheses (In serach results too)(IA)
// @icon         https://www.iafd.com/favicon-196x196.png
// @author       Janvier57
// @match        https://www.iafd.com/person.rme/*
// @match        https://www.iafd.com/results.asp?searchtype=comprehensive&searchstring=*
// @grant        none
// ==/UserScript==

(function() {
  'use strict';
  var biodata = document.querySelector('p.headshotcaption + p.bioheading + .biodata');
  if (biodata) {
    var html = biodata.innerHTML;
    var newHtml = html.replace(/<br>/g, ', ');
    biodata.innerHTML = newHtml;
  }

/* V.3:Remove Sites within parentheses (In search results too):
Before:
Aubrey (realitykings.com),
After:
Aubrey,
==== */
  var aliasLists = document.querySelectorAll('p.headshotcaption + p.bioheading + .biodata, .text-left:not(#corrections):not(#persontitlead)');
  console.log('Found alias lists:', aliasLists);
  aliasLists.forEach(function(aliasList) {
    var text = aliasList.textContent;
    console.log('Original text:', text);
    var items = text.split(',');
    var newItems = items.map(function(item) {
      var index = item.indexOf('(');
      if (index !== -1) {
        item = item.substring(0, index).trim();
      }
      return item;
    });
    var newText = newItems.join(', ');
    console.log('New text:', newText);
    aliasList.textContent = newText;
  });
})();