Devtool mobile

Enables you to open developer tools on mobile

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Devtool mobile
// @version      1.4
// @description  Enables you to open developer tools on mobile
// @author       ㅇㅇ
// @license      MIT
// @match        *://*/*
// @grant        none
// @namespace https://greasyfork.org/users/1426529
// ==/UserScript==

(function () {
    'use strict';

    var erudaLoaded = false;
    var erudaScript = null;
    var touchCount = 0;
    var touchTimer = null;

    function loadEruda() {
        if (!erudaLoaded) {
            erudaScript = document.createElement('script');
            erudaScript.src = "//cdn.jsdelivr.net/npm/eruda";
            document.body.appendChild(erudaScript);

            erudaScript.onload = function () {
                eruda.init();
                eruda.show();
                erudaLoaded = true;
                localStorage.setItem('erudaLoaded', 'true');
            };
        }
    }

    function unloadEruda() {
        if (erudaLoaded) {
            eruda.destroy();
            document.body.removeChild(erudaScript);
            erudaScript = null;
            erudaLoaded = false;
            localStorage.setItem('erudaLoaded', 'false');
        }
    }

    document.addEventListener('touchstart', function (e) {
        if (e.touches.length === 2) { // 두 손가락 터치 감지
            touchCount++;

            if (touchTimer) {
                clearTimeout(touchTimer);
            }

            touchTimer = setTimeout(function () {
                touchCount = 0; // 300ms 이후 터치 카운트 초기화
            }, 300);

            if (touchCount === 3) { // 3번 터치 시 동작
                erudaLoaded ? unloadEruda() : loadEruda();
                touchCount = 0;
            }
        }
    });

    document.addEventListener('keydown', function (e) {
        if (e.ctrlKey && e.shiftKey && e.key === 'R') {
            erudaLoaded ? unloadEruda() : loadEruda();
        }
    });

    if (localStorage.getItem('erudaLoaded') === 'true') {
        loadEruda();
    }
})();