// ==UserScript==
// @name Exoticaz.to Image Resizer with Settings and Slider
// @namespace http://tampermonkey.net/
// @version 0.6
// @description Adds target="_blank" to torrent links, changes image width, and adds a customizable size adjuster with slider on exoticaz.to
// @match https://exoticaz.to/*
// @grant GM_addStyle
// @license MIT
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
// Add CSS styles
GM_addStyle(`
#sizeAdjuster {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 9998;
background-color: #2c3e50;
border-radius: 50px;
padding: 10px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
transition: all 0.3s ease;
display: flex;
align-items: center;
overflow: hidden;
width: 50px;
height: 50px;
}
#sizeAdjuster:hover {
width: 250px;
border-radius: 25px;
}
#sizeIcon {
background-color: #3498db;
border-radius: 50%;
width: 30px;
height: 30px;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
transition: transform 0.3s ease;
}
#sizeAdjuster:hover #sizeIcon {
transform: rotate(180deg);
}
#sizeSlider {
width: 150px;
margin-left: 20px;
display: none;
}
#sizeAdjuster:hover #sizeSlider {
display: block;
}
#sizeValue {
color: #ecf0f1;
margin-left: 10px;
font-family: Arial, sans-serif;
font-size: 14px;
display: none;
}
#sizeAdjuster:hover #sizeValue {
display: block;
}
#settingsPopup {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: #ffffff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 20px rgba(0,0,0,0.2);
z-index: 9999;
font-family: Arial, sans-serif;
}
#settingsPopup h2 {
margin-top: 0;
color: #2c3e50;
}
#settingsPopup input[type="number"] {
width: 100px;
padding: 5px;
margin: 10px 0;
}
#settingsPopup button {
background-color: #3498db;
color: white;
border: none;
padding: 10px 15px;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}
#settingsPopup button:hover {
background-color: #2980b9;
}
#overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.5);
z-index: 9997;
}
`);
// Create and add the size adjuster
const adjuster = document.createElement('div');
adjuster.id = 'sizeAdjuster';
adjuster.innerHTML = `
🖼️
300px
`;
document.body.appendChild(adjuster);
// Create and add the settings popup
const settingsPopup = document.createElement('div');
settingsPopup.id = 'settingsPopup';
settingsPopup.innerHTML = `
Image Size Settings
`;
document.body.appendChild(settingsPopup);
// Create and add the overlay
const overlay = document.createElement('div');
overlay.id = 'overlay';
document.body.appendChild(overlay);
// Function to modify links and images
function modifyElements(imageWidth) {
// Add target="_blank" to torrent links
const divs = document.querySelectorAll('div.mb-1');
divs.forEach(div => {
const anchor = div.querySelector('a.torrent-link');
if (anchor) {
anchor.setAttribute('target', '_blank');
}
});
// Change image width
const imageContainers = document.querySelectorAll('div.screen-image.d-inline-block.float-left.mr-1');
imageContainers.forEach(container => {
const img = container.querySelector('img');
if (img) {
img.style.width = `${imageWidth}px`;
img.style.height = 'auto';
}
});
}
// Load saved size or use default
let defaultSize = localStorage.getItem('exoticazImageSize') || 300;
let currentSize = defaultSize;
document.getElementById('defaultSize').value = defaultSize;
document.getElementById('sizeSlider').value = defaultSize;
document.getElementById('sizeValue').textContent = `${defaultSize}px`;
// Initial run
modifyElements(currentSize);
// Use a MutationObserver to handle dynamically loaded content
const observer = new MutationObserver(() => modifyElements(currentSize));
observer.observe(document.body, { childList: true, subtree: true });
// Event listener for slider
document.getElementById('sizeSlider').addEventListener('input', function() {
currentSize = this.value;
document.getElementById('sizeValue').textContent = `${currentSize}px`;
modifyElements(currentSize);
});
// Event listener for icon click
document.getElementById('sizeIcon').addEventListener('click', (e) => {
e.stopPropagation();
settingsPopup.style.display = 'block';
overlay.style.display = 'block';
});
// Event listener for save button
document.getElementById('saveSettings').addEventListener('click', () => {
defaultSize = document.getElementById('defaultSize').value;
localStorage.setItem('exoticazImageSize', defaultSize);
currentSize = defaultSize;
document.getElementById('sizeSlider').value = defaultSize;
document.getElementById('sizeValue').textContent = `${defaultSize}px`;
modifyElements(currentSize);
settingsPopup.style.display = 'none';
overlay.style.display = 'none';
});
// Event listener for overlay (to close popup when clicking outside)
overlay.addEventListener('click', () => {
settingsPopup.style.display = 'none';
overlay.style.display = 'none';
});
})();