EGAFD / BGAFD Better AKA Names and Copy button (with IA Help) v.1.05

Reformat the AKA list with an space after each comma and correction for easy copy (IA)

Από την 11/06/2025. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         EGAFD / BGAFD Better AKA Names and Copy button (with IA Help) v.1.05
// @namespace    http://tampermonkey.net/
// @version      1.05
// @description  Reformat the AKA list with an space after each comma and correction for easy copy (IA)
// @author       Janvier57
// @icon         https://external-content.duckduckgo.com/ip3/www.egafd.com.ico
// @match        https://www.egafd.com/actresses/details.php/*
// @match        https://www.bgafd.co.uk/actresses/details.php/*
// @grant        none
// ==/UserScript==

(function() {
  'use strict';
  console.log('Script started');
  var modelsList = null;
  var timeout = 1000; // 1 second
  var interval = 100; // 100ms

  function waitForElement() {
    modelsList = document.querySelector('tr:has(.acta) ul.list:has(.acta)');
    if (modelsList) {
      console.log('modelsList found');
      runScript();
    } else {
      console.log('modelsList not found, waiting...');
      setTimeout(waitForElement, interval);
      timeout -= interval;
      if (timeout <= 0) {
        console.log('Timeout exceeded, aborting script');
      }
    }
  }

  function runScript() {
    var akaModels = document.querySelectorAll('tr:has(.acta) ul.list:has(.acta) span.acta');
    console.log('akadModels:', akaModels);

    // Add comma + space after each model name
    var modelsText = '';
    akaModels.forEach((model, index) => {
      modelsText += model.textContent.trim();
      if (index < akaModels.length - 1) {
        modelsText += ', ';
      }
    });
    console.log('modelsText:', modelsText);
    modelsList.innerHTML = modelsText;
    console.log('modelsList updated');

    // Add "Copy AKA names" button
    var copyButton = document.createElement('button');
    copyButton.textContent = 'Copy AKA names';
    copyButton.onclick = function() {
      var modelsText = '';
      akaModels.forEach((model, index) => {
        modelsText += model.textContent.trim();
        if (index < akaModels.length - 1) {
          modelsText += ', ';
        }
      });
      console.log('Copy button clicked');
      navigator.clipboard.writeText(modelsText).then(function() {
        alert('Copied');
      });
    };
    modelsList.parentNode.appendChild(copyButton);
    console.log('Copy button added');
  }

  waitForElement();
})();