PORNBOX Copy Studio Liste Models Names (with IA Help)

PORNBOX Copy Studio Liste Models Names

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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();
})();