IAFD - Better Alias List (IA)

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

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

// ==UserScript==
// @name         IAFD - Better Alias List (IA)
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Reformat the Alias list with an space after each comma + Sites within parentheses (In serach results too)(IA)
// @icon         https://external-content.duckduckgo.com/ip3/www.iafd.com.ico
// @author       Janvier57
// @match        https://www.iafd.com/person.rme/*
// @match        https://www.iafd.com/results.asp?searchtype=comprehensive&searchstring=*
// @match        https://www.iafd.com/person.rme/id=*
// @match        https://www.iafd.com/matchups.rme/perfid=*
// @match        https://www.iafd.com/matchups.rme/*
// @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;
  }

  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;
  });

  var iframeAliasLists = document.querySelectorAll('.row .matchuph3 + .matchupaka');
  console.log('Found iframe alias lists:', iframeAliasLists);
  iframeAliasLists.forEach(function(iframeAliasList) {
    var text = iframeAliasList.textContent;
    console.log('Original iframe 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 iframe text:', newText);
    iframeAliasList.textContent = newText;
  });
})();