camDebugger

debug cam!

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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         camDebugger
// @namespace    http://tampermonkey.net/
// @version      0.4
// @license Amos
// @description  debug cam!
// @author       Amos
// @match        https://www.camstage.org/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// ==/UserScript==
/* globals jQuery, $, waitForKeyElements */

function findWordNode(word,node=document.body){
    if(node.firstChild&&node.firstChild.nodeValue&&node.firstChild.nodeValue.includes(word)){
        return node
    }
    if(node.style&&node.style.display){
        console.log(node.style.display)
    }
    if(node.children){
        for(let subNode of node.children){
            let wordInSubNode = findWordNode(word,subNode)
            if(wordInSubNode) return wordInSubNode
        }
    }
    return null
}

function showWord(word,translateWord){
    let node=findWordNode(word)
    forceDisplayNode(node)
    if(!node.firstChild.nodeValue.endsWith(`(${translateWord})`)){
        node.firstChild.nodeValue=node.firstChild.nodeValue+`(${translateWord})`
    }
    node.style='color:red'
}

function forceDisplayNode(node){
    let rootNode = null
    while(node){
        if(node.style&&node.style.display==='none'){
            node.style.display=''
        }
        rootNode=node
        node=node.parentNode
    }
}
let url = new URL(window.location.href)
let isDebug = url.searchParams.get('debug')
let zh=url.searchParams.get('zh')
let en=url.searchParams.get('en')
en=en?en:''
if(isDebug==='true'&&zh){
    setInterval(()=>{
        showWord(zh,en)
    },1000)
}