Open Image on Double-Click

Opens the image in a new tab on double-clicking full image

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name        Open Image on Double-Click
// @namespace   net.tealpink
// @version     1.0.0
// @description Opens the image in a new tab on double-clicking full image
// @author      tealpink
// @license     MIT
// @match       https://onlyfans.com/*
// @grant       none
// @run-at      document-idle
// @noframes
// ==/UserScript==

(function () {
    'use strict';

    // Add a double-click listener to the document body
    document.body.addEventListener('dblclick', function (e) {
        const clickedElement = e.target;

        // Check if the clicked element is a <div> containing an <img>
        if (clickedElement.tagName === 'DIV' && clickedElement.querySelector('img')) {
            const imgElement = clickedElement.querySelector('img');
            openImageInNewTab(imgElement);
        }
    });

    // Function to open an image in a new tab
    function openImageInNewTab(imgElement) {
        if (imgElement && imgElement.src) {
            window.open(imgElement.src, '_blank'); // Open the image source in a new tab
        } else {
            alert('No image source found!');
        }
    }
})();