PORNBOX Copy Studio Liste Models Names (with IA Help)

PORNBOX Copy Studio Liste Models Names

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         PORNBOX Copy Studio Liste Models Names (with IA Help)
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  PORNBOX Copy Studio Liste Models Names
// @author       Janvier57
// @icon         https://external-content.duckduckgo.com/ip3/www.pornbox.com.ico
// @match        https://pornbox.com/application/model/list*
// @grant        none
// ==/UserScript==

(function() {
  'use strict';
  var containerSelector = '#pane-model-list.tab-pane[style="display: block;"]:has(.models-info .filters .filters__row.js-filters-wrapper .filters__item-wrap.filters__item-wrap--attribute:nth-child(5) .customdrop__selected) .models-info .filters .filters__row.js-filters-wrapper .filters__item-wrap.filters__item-wrap--attribute:nth-child(5):has( .customdrop__selected)';
  console.log('Container selector:', containerSelector);

  var maxAttempts = 10;
  var attempt = 0;

  function appendButton() {
    var container = document.querySelector(containerSelector);
    console.log('Container:', container);
    attempt++;
    if (container) {
      console.log('Container found');
      var button = document.createElement('button');
      button.className = 'copystudio actress';
      button.style.background = 'green';
      button.style.color = 'white';
      button.style.border = 'none';
      button.style.padding = '5px 10px';
      button.style.borderRadius = '5px';
      button.style.cursor = 'pointer';
      button.innerHTML = '✏️ Copy Studio Actress';
      button.onclick = function() {
        console.log('Button clicked');
        var actressNames = [];
        var elements = document.querySelectorAll('#pane-model-list.tab-pane[style="display: block;"]:has(.models-info .filters .filters__row.js-filters-wrapper .filters__item-wrap.filters__item-wrap--attribute:nth-child(5) .customdrop__selected)  .itemsWrapper .block-item.block-item--model  .item-inner__data  a[href^="/application/model/"].item-inner__title');
        elements.forEach(function(element) {
          actressNames.push(element.textContent);
        });
        var list = 'Studio Actress:\n' + actressNames.join(', ');
        var textarea = document.createElement('textarea');
        textarea.value = list;
        document.body.appendChild(textarea);
        textarea.select();
        document.execCommand('copy');
        document.body.removeChild(textarea);
        toast('Copied!');
      };
      container.appendChild(button);
      console.log('Button appended');
    } else {
      console.log('Container not found');
      if (attempt < maxAttempts) {
        console.log('Retrying in 1 second...');
        setTimeout(appendButton, 1000);
      } else {
        console.log('Max attempts reached. Giving up.');
      }
    }
  }

  function toast(message) {
    var button = document.querySelector('.copystudio.actress');
    var rect = button.getBoundingClientRect();
    var toastElement = document.createElement('div');
    toastElement.style.position = 'fixed';
    toastElement.style.top = (rect.top - 50) + 'px';
    toastElement.style.left = (rect.left + (rect.width / 2) - 100) + 'px';
    toastElement.style.background = 'green';
    toastElement.style.color = 'white';
    toastElement.style.padding = '20px 40px';
    toastElement.style.borderRadius = '10px';
    toastElement.style.zIndex = '1000';
    toastElement.style.fontSize = '18px';
    toastElement.style.fontWeight = 'bold';
    toastElement.innerHTML = message;
    document.body.appendChild(toastElement);
    setTimeout(function() {
      toastElement.remove();
    }, 2000);
  }

  appendButton();
})();