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

Reformat the AKA list with an space after each comma and a Copy Button (IA)

Stan na 11-06-2025. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         EGAFD / BGAFD Better AKA Names and Copy button (with IA Help) v.1
// @namespace    http://tampermonkey.net/
// @version      1.00
// @description  Reformat the AKA list with an space after each comma and a Copy Button (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;
      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;
        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();
})();