[케인] 댓글사진확대 + 글씨확대 + 트게더스킨

[케인 팬카페 전용]

目前为 2024-07-08 提交的版本。查看 最新版本

// ==UserScript==
// @name         [케인] 댓글사진확대 + 글씨확대 + 트게더스킨
// @namespace    https://cafe.naver.com/kanetv
// @version      1.12
// @description  [케인 팬카페 전용]
// @author       돈통
// @match        https://cafe.naver.com/kanetv*
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAACTSURBVDhPY6AUMEJpDFCs/fU/lIkCeq9yo+jBagCxmkGACUrDAS7NuACGAbgANttBAEOw+Lket7E4Jw+UyxDFdPIllIkVgA0g1dkg0Ds3TZbBYukTsg0Agz2WPESHATKAh4fL8S9kGcBwIloGyiI/DEAA5BJ4LJBqCMwbJBuAnh5QOIQMwZaYMARwGYJNMxUAAwMAWZQyUi84O4wAAAAASUVORK5CYII=
// @grant        GM_getValue
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_registerMenuCommand
// @require      https://code.jquery.com/jquery-3.6.0.min.js
// @license      MIT
// ==/UserScript==



var comnum=0;
var a = 0;
var b = 0;
var z = 0;
var buttonadd = 0;
var stop = 0;
let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;





let observer = new MutationObserver(e => {
    console.log("detected!!");
    if(stop==1) return 0;
    let cn = Number(document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName('button_comment')[0].getElementsByClassName('num')[0].innerHTML);
    //console.log(cn);
    var pages = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("btn_register is_active")
    var pagesnum = pages.length;
    for(let idx=0; idx<pagesnum; idx++){
        console.log(pages[idx].classList);
        if(pages[idx].classList.contains('eventlistening')) continue;
        pages[idx].classList.add('eventlistening');
        pages[idx].addEventListener("click", async function(){
        console.log("댓글 수정/등록됨");
        if(stop==1) return 0;
        await sleep(500);
        let a = document.querySelector('#cafe_main').contentWindow.document.querySelectorAll('.comment_image_link');
        //console.log(a)
        var waittime = 0
        a.forEach((element) => {
            if (element.firstChild.src == "" || element.firstChild.src.startsWith("https://cafe.naver.com")){
                //console.log("wait");
                waittime = waittime + 50;
                a = document.querySelector('#cafe_main').contentWindow.document.querySelectorAll('.comment_image_link');
            }
        });
        //console.log(waittime);
        setTimeout(function(){
                a.forEach((element) => {
                    if(element.firstChild.currentSrc.includes("_gif")==true){element.firstChild.currentSrc = element.firstChild.currentSrc.replaceAll("?type=mc250_375_gif","");}
                    if(element.firstChild.src.includes("_gif")==true){element.firstChild.src = element.firstChild.src.replaceAll("?type=mc250_375_gif","");}
                    element.firstChild.currentSrc = element.firstChild.currentSrc.replaceAll("?type=mc250_375","");
                    element.firstChild.src = element.firstChild.src.replaceAll("?type=mc250_375","");
                    //console.log(element.firstChild.outerHTML);
                });},waittime);
        console.log("enlarge picture");
        }, false);
    }
    if(comnum == cn){
        if (document.getElementById("Enlarge_button") != null){
            console.log("안늘립니다. skip");
            return;
        }
    }
    window.setTimeout(function(){
        a = document.querySelector('#cafe_main').contentWindow.document.querySelectorAll('.comment_image_link');
        //console.log(a)
        comnum = cn;
        var waittime = 0
        a.forEach((element) => {
            if (element.firstChild.src == "" || element.firstChild.src.startsWith("https://cafe.naver.com")){
                //console.log("wait");
                waittime = waittime + 50;
                a = document.querySelector('#cafe_main').contentWindow.document.querySelectorAll('.comment_image_link');
            }
        });
        //console.log(waittime);
        setTimeout(function(){
            a.forEach((element) => {
                if(element.firstChild.currentSrc.includes("_gif")==true){element.firstChild.currentSrc = element.firstChild.currentSrc.replaceAll("?type=mc250_375_gif","");}
                if(element.firstChild.src.includes("_gif")==true){element.firstChild.src = element.firstChild.src.replaceAll("?type=mc250_375_gif","");}
                element.firstChild.currentSrc = element.firstChild.currentSrc.replaceAll("?type=mc250_375","");
                element.firstChild.src = element.firstChild.src.replaceAll("?type=mc250_375","");
                //console.log(element.firstChild.src);
            });},waittime);
        console.log("enlarge picture");
    },100);
});

function sleep(sec) {
  return new Promise(resolve => setTimeout(resolve, sec));
}

function addObserverIfDesiredNodeAvailable() {
    console.log("try observe");
    const composeBox = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName('CommentBox');
    if(!composeBox[0]) {
        window.setTimeout(addObserverIfDesiredNodeAvailable,500);
        return;
    }
    console.log("found it!")
    console.log(composeBox[0]);
    if(GM_getValue('obs',true)){
        GM_setValue('obs',false);
        observer.observe(document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName('CommentBox')[0], {childList: true, subtree: true, characterData: true});
    }
}


async function getcommentlist(){
    return new Promise((resolve, reject) => {
    console.log("wait until loaded");
    var intv0 = setInterval(function() {
        try{
        var elems = document.querySelector('#cafe_main').contentWindow.document.querySelectorAll('.ArticleLoading');
        }catch{return false;}
        //console.log('.ArticleLoading')
        if(elems.length > 0){
            return false
        }
        //when element is found, clear the interval.
        console.log("loaded");
        clearInterval(intv0);
        console.log("finding element...");
        var intvf = setInterval(function() {
            try{
                var elems = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName('button_comment')[0].getElementsByClassName('num')[0].innerHTML;
            }catch{return false;}
            //when element is found, clear the interval.
            console.log("element is found");
            clearInterval(intvf);
            clearInterval(intv0);
            resolve(true);
        }, 100);
    }, 100);
    });

}





async function addbutton(){
    if(GM_setValue('elbtn',5)==5) GM_setValue('elbtn',false)
    if(GM_getValue('elbtn')==true){
        console.log("확대버튼 이미만듬");
        return 0;
    }
    else{
    await console.log("버튼넣는중");
    await console.log(document.getElementById("Enlarge_button"))
    if (await document.getElementById("Enlarge_button") != null){
        console.log("버튼 이미있음");
        return 0;
    }
    var btn;
    var btn2;
    var intve = await setInterval(async function() {
        try{
            if(GM_getValue('elbtn')==true){
                console.log("확대버튼 이미만듬");
                clearInterval(intve);
                return 0;
            }
            GM_setValue('elbtn',true);
            var target = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName('comment_tab')[0];
            btn = document.createElement("button");
            btn.style.cssText = `color: white; padding: 2px; text-align: center; width: 50px; background-color: crimson; border-radius: 5px; margin-left: 10px; font-size: 12px; text-decoration: none; cursor: pointer;`
            btn.innerText = `확대OFF`
            btn.target = "_blank"
            btn.role = "button"
            btn.id = `Enlarge_button`
            btn.onclick = () => {
                console.log("확대 재시작");
                target.removeChild(btn);
                console.log(document.getElementById("Enlarge_button"));
                if (document.getElementById("Enlarge_button")==null){
                    target.appendChild(btn2);
                }
                stop = 0;
                GM_setValue('elbtn',true);
                document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("comment_refresh_button")[0].click();

            };
            btn2 = document.createElement("button");
            btn2.style.cssText = `color: white; padding: 2px; text-align: center; width: 50px; background-color: green; border-radius: 5px; margin-left: 10px; font-size: 12px; text-decoration: none; cursor: pointer;`
            btn2.innerText = `확대ON`
            btn2.target = "_blank"
            btn2.role = "button"
            btn2.id = `Enlarge_button`
            btn2.onclick = () => {
                console.log("확대 중지");
                target.removeChild(btn2);
                console.log(document.getElementById("Enlarge_button"));
                if (document.getElementById("Enlarge_button")==null){
                    target.appendChild(btn);
                }
                stop = 1;
                GM_setValue('elbtn',true);
                document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("comment_refresh_button")[0].click();
            };
            //console.log("made on off button");
        }catch{
            GM_setValue('elbtn',false);
            return false;}
        try{
            //console.log("check");
            //await console.log(document.getElementById("Enlarge_button"))
            if (await document.getElementById("Enlarge_button") != null){
                console.log("버튼 이미있음22");
                GM_setValue('elbtn',true);
                clearInterval(intve);
                return false;
            }
            else if(stop == 1) target.appendChild(btn);
            else target.appendChild(btn2);
            GM_setValue('elbtn',true);
        }catch{
            GM_setValue('elbtn',false);
            return false;
        }
        //console.log("made on off button");
        //when element is found, clear the interval.
        console.log("added on off button");
        GM_setValue('elbtn',true);
        clearInterval(intve);
    }, 100);
    var intve2 = await setInterval(await function() {
        try{
    document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("comment_refresh_button")[0].addEventListener("click", async function(){
        console.log("새로고침 됨");
        if(stop==1){
            console.log("확대안해");
            let a = document.querySelector('#cafe_main').contentWindow.document.querySelectorAll('.comment_image_link');
            var waittime = 0
            a.forEach((element) => {
                if (element.firstChild.src == "" || element.firstChild.src.startsWith("https://cafe.naver.com")){
                    //console.log("wait");
                    waittime = waittime + 50;
                    a = document.querySelector('#cafe_main').contentWindow.document.querySelectorAll('.comment_image_link');
                }
            });
            //console.log(waittime);
            setTimeout(function(){
                a.forEach((element) => {
                    //if(element.firstChild.currentSrc.includes("?type=mc250_375")==false){
                    //element.firstChild.currentSrc = element.firstChild.currentSrc + "?type=mc250_375";}
                    //if(element.firstChild.src.includes("?type=mc250_375")==false){
                    //element.firstChild.src = element.firstChild.src + "?type=mc250_375";}
                });},waittime);
            console.log("shrink picture");
            //console.log(a);
            return 0;
        }
        await sleep(500);
        let a = document.querySelector('#cafe_main').contentWindow.document.querySelectorAll('.comment_image_link');
        waittime = 0
        a.forEach((element) => {
            if (element.firstChild.src == "" || element.firstChild.src.startsWith("https://cafe.naver.com")){
                console.log("wait");
                waittime = waittime + 50;
                a = document.querySelector('#cafe_main').contentWindow.document.querySelectorAll('.comment_image_link');
            }
        });
        //console.log(a);
        //console.log(waittime);
        setTimeout(function(){
            a.forEach((element) => {
                if(element.firstChild.currentSrc.includes("_gif")==true){element.firstChild.currentSrc = element.firstChild.currentSrc.replaceAll("?type=mc250_375_gif","");}
                if(element.firstChild.src.includes("_gif")==true){element.firstChild.src = element.firstChild.src.replaceAll("?type=mc250_375_gif","");}
                element.firstChild.currentSrc = element.firstChild.currentSrc.replaceAll("?type=mc250_375","");
                element.firstChild.src = element.firstChild.src.replaceAll("?type=mc250_375","");
                //console.log(element.firstChild.src);
            });},waittime);
        console.log("enlarge picture");
        //console.log(a);
    }, false);
            }catch{return false;}
        //when element is found, clear the interval.
        //console.log("added refresh func");
        clearInterval(intve2);
    }, 100);
    var intve3 = await setInterval(await function() {
        try{
    document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("comment_tab_button")[0].addEventListener("click", async function(){
        console.log("새로고침 됨");
        if(stop==1) return 0;
        await sleep(500);
        let a = document.querySelector('#cafe_main').contentWindow.document.querySelectorAll('.comment_image_link');
        var waittime = 0
        a.forEach((element) => {
            if (element.firstChild.src == "" || element.firstChild.src.startsWith("https://cafe.naver.com")){
                //console.log("wait");
                waittime = waittime + 50;
                a = document.querySelector('#cafe_main').contentWindow.document.querySelectorAll('.comment_image_link');
            }
        });
        //console.log(waittime);
        setTimeout(function(){
            a.forEach((element) => {
                if(element.firstChild.currentSrc.includes("_gif")==true){element.firstChild.currentSrc = element.firstChild.currentSrc.replaceAll("?type=mc250_375_gif","");}
                if(element.firstChild.src.includes("_gif")==true){element.firstChild.src = element.firstChild.src.replaceAll("?type=mc250_375_gif","");}
                element.firstChild.currentSrc = element.firstChild.currentSrc.replaceAll("?type=mc250_375","");
                element.firstChild.src = element.firstChild.src.replaceAll("?type=mc250_375","");
                //console.log(element.firstChild.outerHTML);
            });},waittime);
        console.log("enlarge picture");
    }, false);
            }catch{return false;}
        //when element is found, clear the interval.
        //console.log("added tab 0 func");
        clearInterval(intve3);
    }, 100);
    var intve4 = await setInterval(await function() {
        try{
    document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("comment_tab_button")[1].addEventListener("click", async function(){
        console.log("새로고침 됨");
        if(stop==1) return 0;
        await sleep(500);
        let a = document.querySelector('#cafe_main').contentWindow.document.querySelectorAll('.comment_image_link');
        var waittime = 0
        a.forEach((element) => {
            if (element.firstChild.src == "" || element.firstChild.src.startsWith("https://cafe.naver.com")){
                //console.log("wait");
                waittime = waittime + 50;
                a = document.querySelector('#cafe_main').contentWindow.document.querySelectorAll('.comment_image_link');
            }
        });
        //console.log(waittime);
        setTimeout(function(){
            a.forEach((element) => {
                if(element.firstChild.currentSrc.includes("_gif")==true){element.firstChild.currentSrc = element.firstChild.currentSrc.replaceAll("?type=mc250_375_gif","");}
                if(element.firstChild.src.includes("_gif")==true){element.firstChild.src = element.firstChild.src.replaceAll("?type=mc250_375_gif","");}
                element.firstChild.currentSrc = element.firstChild.currentSrc.replaceAll("?type=mc250_375","");
                element.firstChild.src = element.firstChild.src.replaceAll("?type=mc250_375","");
                //console.log(element.firstChild.outerHTML);
            });},waittime);
        console.log("enlarge picture");
    }, false);
            }catch{return false;}
        //when element is found, clear the interval.
        //console.log("added tab 1 func");
        clearInterval(intve4);
    }, 100);
    var intve5 = await setInterval(await function() {
        try{
    var pages = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("btn number")
    var pagesnum = pages.length;
    for(let idx=0; idx<pagesnum; idx++){
        pages[idx].addEventListener("click", async function(){
        console.log("새로고침 됨");
        if(stop==1) return 0;
        await sleep(500);
        let a = document.querySelector('#cafe_main').contentWindow.document.querySelectorAll('.comment_image_link');
        var waittime = 0
        a.forEach((element) => {
            if (element.firstChild.src == "" || element.firstChild.src.startsWith("https://cafe.naver.com")){
                //console.log("wait");
                waittime = waittime + 50;
                a = document.querySelector('#cafe_main').contentWindow.document.querySelectorAll('.comment_image_link');
            }
        });
            //console.log(waittime);
            setTimeout(function(){
                a.forEach((element) => {
                    if(element.firstChild.currentSrc.includes("_gif")==true){element.firstChild.currentSrc = element.firstChild.currentSrc.replaceAll("?type=mc250_375_gif","");}
                    if(element.firstChild.src.includes("_gif")==true){element.firstChild.src = element.firstChild.src.replaceAll("?type=mc250_375_gif","");}
                    element.firstChild.currentSrc = element.firstChild.currentSrc.replaceAll("?type=mc250_375","");
                    element.firstChild.src = element.firstChild.src.replaceAll("?type=mc250_375","");
                    //console.log(element.firstChild.outerHTML);
                });},waittime);
        console.log("enlarge picture");
    }, false);
    }
        }catch{return false;}
        //when element is found, clear the interval.
        //console.log("added number func");
        clearInterval(intve5);
    }, 100);
    }
}



(function() {
    'use strict';

    var css = document.createElement('style');
    var head = document.head;

    css.type = 'text/css';

    css.innerText = `* {
        -webkit-user-select: text !important;
        -moz-user-select: text !important;
        -ms-user-select: text !important;
         user-select: text !important;
    }`;

    function main() {

        var doc = document;
        var body = document.body;

        var docEvents = [
            doc.oncontextmenu = null,
            doc.onselectstart = null,
            doc.ondragstart = null,
            doc.onmousedown = null
        ];

        var bodyEvents = [
            body.oncontextmenu = null,
            body.onselectstart = null,
            body.ondragstart = null,
            body.onmousedown = null,
            body.oncut = null,
            body.oncopy = null,
            body.onpaste = null
        ];

        [].forEach.call(
            ['copy', 'cut', 'paste', 'select', 'selectstart'],
            function(event) {
                document.addEventListener(event, function(e) { e.stopPropagation(); }, true);
            }
        );

        alwaysAbsoluteMode();
        enableCommandMenu();
        head.appendChild(css);
        document.addEventListener('keydown', keyPress);
    }

    function keyPress(event) {
        if (event.ctrlKey && event.keyCode == 192) {
            return confirm('Activate Absolute Right Click Mode!') == true ? absoluteMode() : null;
        }
    }

    function absoluteMode() {
        [].forEach.call(
            ['contextmenu', 'copy', 'cut', 'paste', 'mouseup', 'mousedown', 'keyup', 'keydown', 'drag', 'dragstart', 'select', 'selectstart'],
            function(event) {
                document.addEventListener(event, function(e) { e.stopPropagation(); }, true);
            }
        );
    }

    function alwaysAbsoluteMode() {
        let sites = ['example.com','www.example.com'];
        const list = RegExp(sites.join('|')).exec(location.hostname);
        return list ? absoluteMode() : null;
    }


    var blackList = [
        'youtube.com','.google.','.google.com','gf.qytechs.cn','twitter.com','instagram.com','facebook.com','translate.google.com','.amazon.','.ebay.','github.','stackoverflow.com',
        'bing.com','live.com','.microsoft.com','dropbox.com','pcloud.com','box.com','sync.com','onedrive.com','mail.ru','deviantart.com','pastebin.com',
        'dailymotion.com','twitch.tv','spotify.com','steam.com','steampowered.com','gitlab.com','.reddit.com'
    ]

    var enabled = false;
    var url = window.location.hostname;
    var match = RegExp(blackList.join('|')).exec(url);

    if (window && typeof window != undefined && head != undefined) {

        if (!match && enabled != true) {

            main();
            enabled = true

            //console.log(location.hostname);

            window.addEventListener('contextmenu', function contextmenu(event) {
                event.stopPropagation();
                event.stopImmediatePropagation();
                var handler = new eventHandler(event);
                window.removeEventListener(event.type, contextmenu, true);
                var eventsCallBack = new eventsCall(function() {});
                handler.fire();
                window.addEventListener(event.type, contextmenu, true);
                if (handler.isCanceled && (eventsCallBack.isCalled)) {
                    event.preventDefault();
                }
            }, true);
        }

        function eventsCall() {
            this.events = ['DOMAttrModified', 'DOMNodeInserted', 'DOMNodeRemoved', 'DOMCharacterDataModified', 'DOMSubtreeModified'];
            this.bind();
        }

        eventsCall.prototype.bind = function() {
            this.events.forEach(function (event) {
                document.addEventListener(event, this, true);
            }.bind(this));
        };

        eventsCall.prototype.handleEvent = function() {
            this.isCalled = true;
        };

        eventsCall.prototype.unbind = function() {
            this.events.forEach(function (event) {}.bind(this));
        };

        function eventHandler(event) {
            this.event = event;
            this.contextmenuEvent = this.createEvent(this.event.type);
        }

        eventHandler.prototype.createEvent = function(type) {
            var target = this.event.target;
            var event = target.ownerDocument.createEvent('MouseEvents');
            event.initMouseEvent(
                type, this.event.bubbles, this.event.cancelable,
                target.ownerDocument.defaultView, this.event.detail,
                this.event.screenX, this.event.screenY, this.event.clientX, this.event.clientY,
                this.event.ctrlKey, this.event.altKey, this.event.shiftKey, this.event.metaKey,
                this.event.button, this.event.relatedTarget
            );
            return event;
        };

        eventHandler.prototype.fire = function() {
            var target = this.event.target;
            var contextmenuHandler = function(event) {
                event.preventDefault();
            }.bind(this);
            target.dispatchEvent(this.contextmenuEvent);
            this.isCanceled = this.contextmenuEvent.defaultPrevented;
        };

    }

})();



function enableCommandMenu() {
        var commandMenu = true;
        try {
            if (typeof(GM_registerMenuCommand) == undefined) {
                return;
            } else {
                    if (commandMenu == true ) {
                        if(GM_getValue('tgdskin', 5)==5) GM_setValue('tgdskin',false);

                        if(GM_getValue('tgdskin', true)==true){
                            GM_registerMenuCommand('트게더 스킨 끄기 [현재: ON]', function() {
                            GM_setValue('tgdskin', false);
                            location.reload();
                            })
                        }
                        else{
                            GM_registerMenuCommand('트게더 스킨 켜기 [현재: OFF]', function() {
                            GM_setValue('tgdskin', true);
                            location.reload();
                            })
                        }
                        if(GM_getValue('largetext', 5)==5) GM_setValue('largetext',true);
                        if(GM_getValue('largetext', true)==true){
                            GM_registerMenuCommand('글씨 확대 끄기 [현재: ON]', function() {
                            GM_setValue('largetext', false);
                            location.reload();
                            })
                        }
                        else{
                            GM_registerMenuCommand('글씨 확대 켜기 [현재: OFF]', function() {
                            GM_setValue('largetext', true);
                            location.reload();
                            })
                        }
                    };
                }

        }
        catch(err) {
            console.log(err);
        }
    }


$(document.getElementById('cafe_main')).on('load', function(){ setTimeout(async function() {

    enableCommandMenu();
    addstyle('.skin-1080 .article-board tbody td {border-bottom: 1px solid #e2e2e2;}');
    addstyle('.article-board tbody td {border-bottom: 1px solid #e2e2e2;}');
    addstyle('.CommentBox .comment_list .CommentItem {    border-top: 1px solid #ccc}');
    addstyle('.RelatedArticles .list_item {border-bottom: 1px solid #e2e2e2;}');

    if(GM_getValue('largetext', true)){
    addstyle('.skin-1080 .article-board .article {font-size:15px}');
    addstyle('.article-board .article {font-size:15px}');
    addstyle('.ArticleBoardWriterInfo .nickname {font-size:15px}');
    addstylecon('.skin-1080 #cafe-menu .cafe-menu-list li a {font-size:15px}');
    addstyle('.article_profile .td_date,.article_profile .td_view {border-left: 1px solid rgb(226, 226, 226); font-size:15px}');
    addstyle('.article_profile .article {font-weight: 500; font-size: 15px}');
    addstyle('.article_profile .board-list .cmt {font-weight: bold; font-size:15px}');
    addstyle('.skin-1080 .article-board .pers_nick_area .p-nick {font-size:15px}');
    addstyle('.skin-1080 .article-board .pers_nick_area .p-nick a {font-size:15px}');
    addstyle('.article-board .pers_nick_area .p-nick {font-size:15px}');
    addstyle('.article-board .pers_nick_area .p-nick a {font-size:15px}');
    addstyle('.RelatedArticles .tit_area {font-size:15px}');
    addstyle('.skin-1080 .article-board .board-box .td_article .article .inner {font-size:15px}');
    addstyle('.skin-1080 .article-album-sub dt a, .skin-1080 .article-album-sub .reply {font-size:15px}');
    addstyle('.skin-1080 .article-board .board-list .cmt {font-size:15px}');
    addstyle('.article-board .board-list .cmt {font-size:15px}');
    addstyle('.skin-1080 .article-board tbody td {padding: 5px 7px}');
    }
    if(GM_getValue('tgdskin', true)){
        addstyle('.input_search_area .btn-search-green {background-color: #6441a5;}');
        addstyle('.input_search_area .btn-search-green {background-color: #6441a5;}');
        addstylecon('.skin-1080 .cafe-write-btn a {background-color: #6441a5;}');
        addstylebody('.cafe-search .btn {background-color: #6441a5;}');
        GM_addStyle('body {font-weight: 500;}');
        addstyle('body {font-weight: 500;}');
        addstyle('.skin-1080 .article-board .th_name {text-align: center;}');
        addstyle('.CafeViewer .se-viewer .BaseButton--green {    background: #6441a5;    color: #fff;}');
        addstyle('.skin-1080 .article-board .td_article {padding-left: 0px;	padding-right: 2px;}');
        addstyle(".skin-1080 .article-board .td_view {border-left: 1px solid rgb(226, 226, 226);}");
        addstyle('.skin-1080 .article-board .board-tag {padding-left: 8px; padding-right: 15px;}');
        addstyle('.skin-1080 .article-board .board-name {padding: 0 10px 0 0;}');
        addstyle('.skin-1080 .article-board .board-name .inner_name {border-right: 1px solid rgb(226, 226, 226); text-align: center;}');
        addstyle('.skin-1080 .article-board .board-notice .board-tag-txt {width: 48px;}');
        addstyle('.skin-1080 .article-board .board-name .inner_name .link_name {text-align: center;}');
        addstyle('.skin-1080 .article-board .board-number .inner_number {border-right: 1px solid rgb(226, 226, 226); text-align: center;}');
        addstyle('.skin-1080 .article-board .td_likes {border-left: 1px solid rgb(226, 226, 226);}');
        addstyle('.skin-1080 .article-board .board-list .cmt {color: #6441a5 !important;}');
        addstyle('.skin-1080 .article-board .board-list .answer {color: #6441a5;}');
        addstyle('.skin-1080 .article-board .board-list .ico-q {color: #6441a5;}');
        addstyle('.skin-1080 .article-board .board-list .p_cafebook {color: #6441a5;}');
        addstyle('.skin-1080 .article-board .board-list .reply_del {color: #6441a5;}');
        addstyle('.skin-1080 .article-board .board-list .reply_txt {color: #6441a5;}');
        addstyle('.skin-1080 .article-board .board-list .reply_txt:after {border-color: #6441a5 transparent transparent transparent;}');
        addstyle('.skin-1080 .article-board .board-list .reply_txt.is_selected:after {border-color: transparent transparent #6441a5 transparent;}');
        addstyle('.skin-1080 .article-board .pers_nick_area .p-nick {white-space: nowrap;	overflow: hidden;	text-overflow: ellipsis;	border-left: 1px solid rgb(226, 226, 226);	border-right: 1px solid rgb(226, 226, 226);	text-align: center;}');
        addstyle('.skin-1080 .article-board .pers_nick_area .p-nick a {text-align: center;}');
        addstyle('.skin-1080 .article-board .pers_nick_area .mem-level img  {vertical-align: middle; display: none}');
        addstyle('.skin-1080 .article_list_message .message {color: #616161;}');
        addstyle('.skin-1080 .article-album-sub .reply {color: #6441a5;}');
        addstyle('.skin-1080 .article-album-sub .price {color: #6441a5;}');
        addstyle('.skin-1080 .article-album-movie-sub .tit_area .reply {color: #6441a5;}');
        addstyle('.skin-1080 .article-movie-sub .tit_area .reply {color: #6441a5;}');
        addstyle('.skin-1080 .article-tag .list_tag .tit_area .cmt {color: #6441a5;}');
        addstyle('.skin-1080 .article-intro .box_history .fileview .txt_file {color: #6441a5;}');
        addstyle('.skin-1080 .board-notice.type_required .article, .skin-1080 .board-notice.type_main .article {color: #6441a5;}');
        addstyle('.skin-1080 .board-notice.type_required .cmt, .skin-1080 .board-notice.type_main .cmt {	color: #6441a5;}');
        addstyle('.skin-1080 .board-notice.type_required .board-tag-txt, .skin-1080 .board-notice.type_main .board-tag-txt {	border: 1px solid #6441a5;	background-color: #6441a5;	color: #fff;}');
        addstyle('.skin-1080 .board-notice.type_menu .article {	color: #6441a5;}');
        addstyle('.skin-1080 .board-notice.type_menu .cmt {	color: #6441a5;}');
        addstyle('.skin-1080 .board-notice.type_menu .board-tag-txt {	border: 1px solid #6441a5;	background-color: #6441a5;	color: #fff;}');
        addstyle('.skin-1080 .com .box-w .group-mlist .tcol-p {	color: #6441a5;}');
        addstyle('.skin-1080 .prev-next a.on {background-color: #5f44a1;color: #fff;}');
        addstyle('.skin-1080#main-area .bg-color {	background-color: #eaea00;}');
        addstyle('.skin-1080#main-area .m-tcol-c {	color: #000;}');
        addstyle('.skin-1080#main-area .m-tcol-p {	color: #6441a5;}');
        addstyle('.skin-1080#main-area .article-album-sub {	border-bottom: 1px solid #ff0000;}');
        addstyle('.skin-1080 .article-board thead th {border-bottom-color: #e2e2e2;}');
        addstyle('.skin-1080 .article-board tbody td {border-color: #e2e2e2; !important}');
        addstyle('.skin-1080 .ia-info-btn .link_chat {display: none;}');
        addstyle('.ModalLayer .layer_commerce_content .cate_box .category_list li.selected .btn {    color: #5f44a1}');
        addstyle('.ModalLayer .layer_schedule_content .register .btn_add_map.active {    color: #5f44a1}');
        addstyle('.BaseButton .svg-icon.icon-solid-writing { color: #fff;}');
        addstyle('.BaseButton--skinGreen {    background: #6441a5;    color: #ffffff;}');
        addstyle('.BaseButton--greenMain {    background: #5f44a1;}');
        addstyle('.ArticleTitle .link_board {    color: #5f44a1}');
        addstyle('.WriterInfo .profile_info .subscript_area .btn_subscript {color: #ffffff;}');
        addstyle('.LoadingSquare .dot{background: #5f44a1;}');
        addstyle('.ReplyBox .like_article {font-size: 14px;    display: inline-block;    padding: 6px 12px;    margin-bottom: 0px;    font-size: 14px;    font-weight: 400;    line-height: 1.42857;    text-align: center;    white-space: nowrap;    vertical-align: middle;    touch-action: manipulation;    cursor: pointer;    user-select: none;    background-image: none;    border: 1px solid rgba(0, 0, 0, 0);    border-radius: 4px;    color: rgb(92, 184, 92);    background-image: none;    background-color: rgba(0, 0, 0, 0);    border-color: rgb(92, 184, 92);}');
        addstyle('.ReplyBox .like_article .u_likeit_list_module {    margin-right: 0px}');
        addstyle('.ReplyBox .like_article .u_likeit_list_module .u_likeit_list_btn .u_ico {    width: 20px;    height: 20px;  background: url(https://raw.githubusercontent.com/ywj515/tgdcafe/main/like.svg); no-repeat;}');
        addstyle('.ReplyBox .like_article .u_likeit_list_module .u_likeit_list_btn.on .u_ico {    background: url(https://raw.githubusercontent.com/ywj515/tgdcafe/main/like.svg); no-repeat}');
        addstyle('.SubscribeButton .ToggleSwitch .switch_input:checked+.switch_slider {    background-color: #5f44a1}');
        
        addstyle('.CommentBox .comment_list .comment_nick_box .comment_nick_info .comment_info_date {    right: 0 !important;}');
        addstyle('.CommentBox .comment_list .comment_footer { flex-direction: row;    align-items: stretch; font-weight: 500; color:#000;}');
        addstyle('.CommentBox .comment_list .comment_footer .comment_info_box {font-weight: 500; color:#000;}');
        addstyle('.CommentBox .comment_list .comment_footer .u_likeit_list_module .u_likeit_list_btn .u_cnt {color:#000}');
        addstyle('.ReplyBox .box_left .like_article .ReactionLikeIt.u_likeit_list_module._cafeReactionModule .like_no.u_likeit_list_btn._button.off .u_ico._icon {width: 20px; height: 20px;margin-right: 6px;background: url(https://raw.githubusercontent.com/ywj515/tgdcafe/main/like.svg);  no-repeat};');
        addstyle('.ReplyBox {display: flex; justify-content:center; margin-top:20px}');
        addstyle('.ReplyBox .box_left .like_article .ReactionLikeIt.u_likeit_list_module._cafeReactionModule .like_no.u_likeit_list_btn._button.on .u_ico._icon {width: 20px; height: 20px;margin-right: 6px;background: url(https://raw.githubusercontent.com/ywj515/tgdcafe/main/like.svg);  no-repeat}');
        addstyle('.ToggleButton .checkbox:checked+.label .bg_track[data-v-d8e678f2] {  background-color: #5f44a1}');
        addstyle('.vote_check .label_box .vote_rate .rate_bar[data-v-74c2a70c] {background-color: #5f44a1;}');
        addstyle('.vote_check .label_box .vote_rate .txt[data-v-74c2a70c] {color: #5f44a1;}');
        addstyle('.CafeCustomVote .cafe_vote_view .cafe_vote_list .vote_check .label_box .vote_rate .rate_bar[data-v-4f21a8f4] {background-color: #5f44a1;}');
        addstyle('.CafeCustomVote .cafe_vote_view .cafe_vote_list .vote_check .label_box .vote_rate .txt[data-v-4f21a8f4] {color: #5f44a1;}');
        addstyle('.CafeViewer .CafeCustomVote .cafe_vote_view .cafe_vote_list .vote_check .label_box .vote_rate .rate_bar {background-color: #5f44a1;}');
        addstyle('.CafeViewer .CafeCustomVote .cafe_vote_view .cafe_vote_list .vote_check .label_box .vote_rate .txt {color: #5f44a1;}');
        addstyle('.CafeViewer .CafeCustomSchedule .cafe_schedule_view .cafe_schedule_view_title .cafe_schedule_view_important {    color: #5f44a1}');
        addstyle('.CafeViewer .CafeCustomSchedule .cafe_schedule .cafe_schedule_title .cafe_schedule_important {  color: #5f44a1}');
        addstyle('.CafeViewer .se-viewer .BaseButton--greenMain {    background: #5f44a1;}');
        addstyle('.FormSelectBox .select_option .item[aria-selected=true] .option {    color: #5f44a1}');
        addstyle('.TimePicker .layer_select_time .time_item[aria-selected=true] .selectbox_item_button {    color: #5f44a1}');
        addstyle('.CalendarSelectBox .vdp-datepicker .vdp-datepicker__calendar .cell:not(.blank):not(.disabled).day:hover,.CalendarSelectBox .vdp-datepicker .vdp-datepicker__calendar .cell:not(.blank):not(.disabled).month:hover,.CalendarSelectBox .vdp-datepicker .vdp-datepicker__calendar .cell:not(.blank):not(.disabled).year:hover {color: #5f44a1}');
        addstyle('.LoadingRing .box {border-color: #5f44a1 transparent transparent transparent;}');
        addstyle('.SelectRegion .select_city_header .city_button.selected {    color: #5f44a1}');
        addstyle('.SelectRegion .select_city_content .region_list li.selected .btn {    color: #5f44a1}');
        addstyle('.comm_layer2.npay_guide_layer .box_area .go {color: #5f44a1!important}');
        addstyle('.layernotice .btns .link_confirm {    color: #5f44a1}');
        addstyle('.ModalLayer .layer_commerce_safety_guide .deal_thead .safety_deal_step {color: #5f44a1}');
        addstyle('.PurchaseButton .purchase_chat .chat_coach_mark {background-color: #5f44a1;}');
        addstyle('.SaleInfo .ProductName .SaleLabel.reservation_escrow,.SaleInfo .ProductName .SaleLabel.safety {    color: #5f44a1}');
        addstyle('.RelatedArticles .tit_area b {    color: #5f44a1}');
        addstyle('.MemberOnlyArticleGuide .tit_guide .emph {    color: #5f44a1}');
        addstyle('.MemberOnlyArticleGuide .txt_cafe {color: #5f44a1;}');
        addstyle('.LayerPopup .temporary_message .lds-ring div {border: 2px solid #5f44a1; border-color: #5f44a1 transparent transparent transparent}');
        addstyle('.WriterInfo .profile_info .subscript_area .btn_subscript {background: #5f44a1};');
        addstyle('.RelatedArticles .tit_area .num {color: #5f44a1;}');
        
        addstyle('.CommentBox .comment_list .comment_nick_box .LevelIcon {display:none;}');
        addstyle('.WriterInfo .profile_info .nick_level {display:none;}');
        addstyle('.WriterInfo .profile_info .link_talk {display:none;)');
        addstyle('.ReplyBox .button_comment {display:none}');
        addstyle('.ArticleContentBox .article_writer {display:none}');
        addstyle('.ReplyBox .like_article .button_like_list {display:none}');
        addstyle('.skin-1080 .article-board .board-list div.inner_list a:visited, .skin-1080 .article-board .board-list div.inner_list div.inner_list a:visited * div.inner_list a:visited, div.inner_list a:visited * {color: #aaa !important;}')
        addstyle('.article-board .board-list .cmt { color: #5f44a1}');
        addstyle('.list-i-new { display: none}');
        addstyle('.article-board .th_name {text-align: center;}');
        
        addstyle('.article-board .td_article {padding-left: 0px;	padding-right: 2px;}');
        addstyle(".article-board .td_view {border-left: 1px solid rgb(226, 226, 226);}");
        addstyle('.article-board .board-tag {padding-left: 8px; padding-right: 15px;}');
        addstyle('.article-board .board-name {padding: 0 10px 0 0;}');
        addstyle('.article-board .board-name .inner_name {border-right: 1px solid rgb(226, 226, 226); text-align: center;}');
        addstyle('.article-board .board-notice .board-tag-txt {width: 48px;}');
        addstyle('.article-board .board-name .inner_name .link_name {text-align: center;}');
        addstyle('.article-board .board-number .inner_number {border-right: 1px solid rgb(226, 226, 226); text-align: center;}');
        addstyle('.article-board .td_likes {border-left: 1px solid rgb(226, 226, 226);}');
        addstyle('.article-board .board-list .cmt {color: #6441a5 !important;}');
        addstyle('.article-board .board-list .answer {color: #6441a5;}');
        addstyle('.article-board .board-list .ico-q {color: #6441a5;}');
        addstyle('.article-board .board-list .p_cafebook {color: #6441a5;}');
        addstyle('.article-board .board-list .reply_del {color: #6441a5;}');
        addstyle('.article-board .board-list .reply_txt {color: #6441a5;}');
        addstyle('.article-board .board-list .reply_txt:after {border-color: #6441a5 transparent transparent transparent;}');
        addstyle('.article-board .board-list .reply_txt.is_selected:after {border-color: transparent transparent #6441a5 transparent;}');
        addstyle('.article-board .pers_nick_area .p-nick {white-space: nowrap;	overflow: hidden;	text-overflow: ellipsis;	border-left: 1px solid rgb(226, 226, 226);	border-right: 1px solid rgb(226, 226, 226);	text-align: center;}');
        addstyle('.article-board .pers_nick_area .p-nick a {text-align: center;}');
        addstyle('.article-board .pers_nick_area .mem-level img  {vertical-align: middle}');
        addstyle('.article_list_message .message {color: #616161;}');
        addstyle('.article-album-sub .reply {color: #6441a5;}');
        addstyle('.article-album-sub .price {color: #6441a5;}');
        addstyle('.article-album-movie-sub .tit_area .reply {color: #6441a5;}');
        addstyle('.article-movie-sub .tit_area .reply {color: #6441a5;}');
        addstyle('.article-tag .list_tag .tit_area .cmt {color: #6441a5;}');
        addstyle('.article-intro .box_history .fileview .txt_file {color: #6441a5;}');
        addstyle('.board-notice.type_required .article, .board-notice.type_main .article {color: #6441a5;}');
        addstyle('.board-notice.type_required .cmt, .board-notice.type_main .cmt {	color: #6441a5;}');
        addstyle('.board-notice.type_required .board-tag-txt, .board-notice.type_main .board-tag-txt {	border: 1px solid #6441a5;	background-color: #6441a5;	color: #fff;}');
        addstyle('.board-notice.type_menu .article {	color: #6441a5;}');
        addstyle('.board-notice.type_menu .cmt {	color: #6441a5;}');
        addstyle('.board-notice.type_menu .board-tag-txt {	border: 1px solid #6441a5;	background-color: #6441a5;	color: #fff;}');
        addstyle('.com .box-w .group-mlist .tcol-p {	color: #6441a5;}');
        addstyle('.prev-next a.on {background-color: #5f44a1;color: #fff;}');
        addstyle('.article-board thead th {border-bottom-color: #e2e2e2;}');
        addstyle('.article-board tbody td {border-color: #e2e2e2; !important}');
        addstyle('.ArticleBoardWriterInfo .LevelIcon {display: none}');
        addstyle('.ArticleBoardWriterInfo {white-space: nowrap;	overflow: hidden;	text-overflow: ellipsis;	border-left: 1px solid rgb(226, 226, 226);	border-right: 1px solid rgb(226, 226, 226);	text-align: center;}');
        addstyle('.RelatedArticles .tit_area .new-12-x-12 {display: none}');
        addstyle('.RelatedArticles .tit_area .svg-icon.list_attach_img {display: none}');
        addstyle('.RelatedArticles .tit_area .svg-icon.list_attach_video {display: none}');
        
        addstyle('.RelatedArticles .member_area {padding-left: 0; text-align: center; border-left: 1px solid rgb(226, 226, 226);	border-right: 1px solid rgb(226, 226, 226);}');
        addstyle('.RelatedArticles .date_area {padding-right: 16px;}');
        addstyle('.RelatedArticles .list_item:first-child {border-top: 1px solid #e2e2e2;}');
        addstyle('.TabButton .tab_btn[aria-selected=true] {background-color: #6441a5;	color: #fff;}');
        addstyle('.article_profile .article {font-weight: 500;}');
        addstyle('.article_profile .td_article {padding: 3px 2px 2px 4px;}');
        addstyle('.article_profile .td_date,.article_profile .td_view {border-left: 1px solid rgb(226, 226, 226);}');
        addstyle('.article-board .board-list .inner_list .svg-icon.list_attach_img {display:none}');
        addstyle('.article-board .board-list .inner_list .svg-icon.list_attach_video {display:none}');
        addstyle('.skin-1080 .list-i-img {display:none}');
        addstyle('.skin-1080 .list-i-movie {display:none}');
        addstyle('.skin-1080#main-area .board-box img.tcol-c {background-color: rgba(0, 0, 0, 0)}');
        addstylecon('.skin-1080 .ia-info-btn .link_chat {display:none}');
        addstylecon('.skin-1080 .ia-info-btn .link_chat .new_chatting {display:none}');
        addstyle('.article_profile .list-style .link_sort.on {color: #6441a5}');
        addstyle('.article_profile .list-style .link_sort.on:after {background-color: #6441a5}');
        addstyle('.article_profile .board-list .cmt {font-weight: bold;}');
    }

    try{
        await imageenlarger();
    }catch{};
}, 1);});




async function imageenlarger() {
    if(GM_getValue('tgdskin', true)) await styleadding();
    if(GM_getValue('waitforimageenlarger')){
        console.log("already");
        return 0;
    }
    GM_setValue('waitforimageenlarger',true);
    await console.log("wait for imageenlarger");
    var loadd = await getcommentlist();
    await console.log(loadd);
    await console.log("start imageenlarger");
    await setTimeout(async function() {
    z = document.createElement('style');
    z.innerHTML ='.CommentBox .comment_list .CommentItemImage .comment_image_link .image {    max-width: 100%;    max-height: 100%;    vertical-align: top; border-radius: 0%}';
    document.querySelector('#cafe_main').contentWindow.document.body.appendChild(z);
    let a = await document.querySelector('#cafe_main').contentWindow.document.querySelectorAll('.comment_image_link');
    await console.log("초기 댓글 늘리는 중...");
    var waittime = 200
    if(stop==0){
        if(a.length==0){
            waittime+=500;
        }
        a.forEach((element) => {
            if (element.firstChild.src == "" || element.firstChild.src.startsWith("https://cafe.naver.com")){
                console.log("wait");
                waittime = waittime + 50;
                a = document.querySelector('#cafe_main').contentWindow.document.querySelectorAll('.comment_image_link');
            }
        });
        console.log(waittime);
        setTimeout(await function(){
            a = document.querySelector('#cafe_main').contentWindow.document.querySelectorAll('.comment_image_link');
            a.forEach((element) => {
                if(element.firstChild.currentSrc.includes("_gif")==true){element.firstChild.currentSrc = element.firstChild.currentSrc.replaceAll("?type=mc250_375_gif","");}
                if(element.firstChild.src.includes("_gif")==true){element.firstChild.src = element.firstChild.src.replaceAll("?type=mc250_375_gif","");}
                element.firstChild.currentSrc = element.firstChild.currentSrc.replaceAll("?type=mc250_375","");
                element.firstChild.src = element.firstChild.src.replaceAll("?type=mc250_375","");
                //console.log(element.firstChild.outerHTML);
            });
             console.log(a);
            console.log("enlarge picture");
        },waittime);
    }
    var idxintvf = 0;
    var intvf = await setInterval(async function() {
        try{
        var comnum = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName('button_comment')[0].getElementsByClassName('num')[0].innerHTML;
        }catch{
            idxintvf+=1;
            if(idxintvf>100) await clearInterval(intvf);
            return false;}
        //when element is found, clear the interval.
        //console.log("comnum found");
        //console.log(comnum);
        //await sleep(500);
        await clearInterval(intvf);
    }, 100);
    await addbutton();
    await console.log("버튼추가");
    await GM_setValue('obs',true);
    if(GM_getValue('obs',true)){
        await console.log("adding observer..");
        await addObserverIfDesiredNodeAvailable();
    }
    await GM_setValue('waitforimageenlarger',false);
    }, 100);
}





async function styleadding(){
    console.log("start styleadding");
    var ggg = 0;
    var kkk = 0;
    var gggg = 0;

    try{
    let a = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("list-i-new")
    let newnum = a.length;
    //console.log(a)
    console.log(newnum);
    gggg = newnum;
    for(let idx=0; idx<newnum; idx++){
        a[idx].remove()
    }
    let b = document.getElementsByClassName("ico_new")
    newnum = b.length
        //console.log(newnum);
    //console.log(b)
    for(let idx=0; idx<newnum; idx++){
        b[idx].remove()
    }
    let c = document.querySelector('#cafe_main').contentWindow.document.getElementsByTagName("img")
    newnum = c.length
        //console.log(newnum);
    //console.log(c)
    for(let idx=0; idx<newnum; idx++){
        //console.log(c[idx]);
        if (c[idx] != undefined) if (c[idx].src == "https://ssl.pstatic.net/static/cafe/cafe_pc/icon_board_new.png") c[idx].remove();
    }
    try{
    let d = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("p-nick")
    newnum = d.length
        //console.log(newnum);
    //console.log(d)
    for(let idx=0; idx<newnum; idx++){
        //console.log(d[idx].childNodes[1])
        if(d[idx].childNodes[1].getElementsByTagName("img")[0].src == "https://cafe.pstatic.net/levelicon/1/6_999.gif"){
            d[idx].childNodes[1].getElementsByTagName("img")[0].src="https://static-cdn.jtvnw.net/badges/v1/5527c58c-fb7d-422d-b71b-f309dcb85cc1/1";
            d[idx].childNodes[1].getElementsByTagName("img")[0].height = 15;
            d[idx].childNodes[1].getElementsByTagName("img")[0].width = 15;
            d[idx].prepend(d[idx].childNodes[1]);
        }
        else d[idx].childNodes[1].remove()
    }}catch{};
    setTimeout(function(){
        let d2 = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("icon_level")
        newnum = d2.length
        //console.log(newnum);
        //console.log(d2)
        for(let idx=0; idx<newnum; idx++){
            //console.log(d2[idx].style.backgroundImage)
            if(d2[idx].style.backgroundImage == "url(\"https://ca-fe.pstatic.net/web-section/static/img/sprite_levelicon_9dbde2.svg#6_999-usage\")"){
                let z = document.createElement('img');
                z.src = "https://static-cdn.jtvnw.net/badges/v1/5527c58c-fb7d-422d-b71b-f309dcb85cc1/1";
                document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("nick_box")[0].prepend(z);
            }
        }
    },1000);
    //for(let idx=0; idx<newnum; idx++){
        //console.log(d[idx].childNodes[1])
    //}

    try{
        setTimeout(function(){
        try{
        let d = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("board-box")[0].getElementsByClassName("inner_list");
        let e = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("board-box")[0].getElementsByClassName("board-tag type_dot")
        var dnewnum = d.length
        //console.log(dnewnum);
        //console.log(e);
        var offset = dnewnum - e.length;
        //console.log(d);
        for(let idx=0; idx<dnewnum; idx++){
            try{
            //console.log(d[idx].childNodes);
            let nnum = d[idx].childNodes.length;
                let ot = 0;
                let om = 0;
                let ir = 10;
                let mr = 10;
            for(let idxx=0; idxx<nnum; idxx++){
                try{

                //console.log(d[idx].childNodes[idxx]);


                if(d[idx].childNodes[idxx].getElementsByClassName("list-i-img").length!=0){
                    //d[idx].prepend(d[idx].childNodes[idxx]);
                    //console.log("이미지");
                    ot+=1;
                    ir = idxx;
                }
                else if(d[idx].childNodes[idxx].getElementsByClassName("list-i-movie").length!=0){
                    //d[idx].prepend(d[idx].childNodes[idxx]);
                    om+=1;
                    mr = idxx;
                }

                if(om>0){
                    e[idx-offset].childNodes[0].src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/video.svg"
                    e[idx-offset].childNodes[0].width="12"
                    e[idx-offset].childNodes[0].height="12";
                    e[idx-offset].childNodes[0].style="vertical-align: middle;padding-bottom: 2px;";
                    idxx = nnum;
                }
                else if(ot>0){
                    e[idx-offset].childNodes[0].src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/image_green.svg"
                    e[idx-offset].childNodes[0].width="12"
                    e[idx-offset].childNodes[0].height="12";
                    e[idx-offset].childNodes[0].style="vertical-align: middle;padding-bottom: 2px;";
                    idxx = nnum;
                }



            }catch{}
            }
            if(om==0&&ot==0){
                e[idx-offset].childNodes[0].src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/text.svg"
                    e[idx-offset].childNodes[0].width="12"
                    e[idx-offset].childNodes[0].height="12";
                    e[idx-offset].childNodes[0].style="vertical-align: middle;padding-bottom: 2px;";
            }

        }catch{}
        }}catch{}

        },100)}catch{}





    try{
        setTimeout(function(){
        //console.log(document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("article-board")[0].childNodes[0].getElementsByClassName("inner_list"))
        try{
        let d = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("article-board")[0].childNodes[0].getElementsByClassName("inner_list");
        newnum = d.length
        //console.log(newnum);
        console.log(d)
        for(let idx=0; idx<newnum; idx++){
            try{
                let svgicon = d[idx].childNodes[2].getElementsByTagName("svg")[0].className.baseVal;
                let ot = 0;
                let om = 0;
                //console.log(svgicon)
                if(svgicon == "svg-icon list_attach_img"){
                    //console.log("adding img")
                    //d[idx].prepend(d[idx].childNodes[idxx]);
                    ot+=1;
                }
                if(svgicon == "svg-icon list_attach_video"){
                    //d[idx].prepend(d[idx].childNodes[idxx]);
                    om+=1;
                }
                if(om>0){
                    //d[idx].childNodes[0].getElementsByTagName("svg")[0].remove();
                    let z = document.createElement('img');
                    z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/video.svg"
                    z.width="12"
                    z.height="12";
                    z.style="vertical-align: middle;padding-bottom: 2px;";
                    d[idx].childNodes[0].prepend(z);
                }
                else if(ot>0){
                    //d[idx].childNodes[0].getElementsByTagName("svg")[0].remove();
                    let z = document.createElement('img');
                    z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/image_green.svg"
                    z.width="12"
                    z.height="12";
                    z.style="vertical-align: middle;padding-bottom: 2px; padding-right: 2px";
                    d[idx].childNodes[0].prepend(z);
                }
                else{
                    let z = document.createElement('img');
                    z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/text.svg"
                    z.width="12"
                    z.height="12";
                    z.style="vertical-align: middle;padding-bottom: 2px; padding-right: 2px";
                    d[idx].childNodes[0].prepend(z);
                }
                }catch{
                    let z = document.createElement('img');
                    z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/text.svg"
                    z.width="12"
                    z.height="12";
                    z.style="vertical-align: middle;padding-bottom: 2px; padding-right: 2px";
                    d[idx].childNodes[0].prepend(z);
                    continue;
                }
        }}catch{}},1000)
    setTimeout(function(){
            try{
                for(let iii=0; iii<12; iii++){
                    console.log("글목록 버튼..");
                    //console.log(document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("paginate_area")[0].getElementsByClassName("ArticlePaginate")[0].getElementsByClassName("btn"));
                    document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("paginate_area")[0].getElementsByClassName("ArticlePaginate")[0].getElementsByClassName("btn")[iii].addEventListener("click", async function(){
                        setTimeout(function(){
        //console.log(document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("article-board")[0].childNodes[0].getElementsByClassName("inner_list"))
        let d = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("article-board")[0].childNodes[0].getElementsByClassName("inner_list");
        newnum = d.length
        //console.log(newnum);
        console.log(d)
        for(let idx=0; idx<newnum; idx++){
            try{
                let svgicon = d[idx].childNodes[2].getElementsByTagName("svg")[0].className.baseVal;
                let ot = 0;
                let om = 0;
                //console.log(svgicon)
                if(svgicon == "svg-icon list_attach_img"){
                    //console.log("adding img")
                    //d[idx].prepend(d[idx].childNodes[idxx]);
                    ot+=1;
                }
                if(svgicon == "svg-icon list_attach_video"){
                    //d[idx].prepend(d[idx].childNodes[idxx]);
                    om+=1;
                }
                if(om>0){
                    //d[idx].childNodes[0].getElementsByTagName("svg")[0].remove();
                    let z = document.createElement('img');
                    z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/video.svg"
                    z.width="12"
                    z.height="12";
                    z.style="vertical-align: middle;padding-bottom: 2px;";
                    d[idx].childNodes[0].prepend(z);
                }
                else if(ot>0){
                    //d[idx].childNodes[0].getElementsByTagName("svg")[0].remove();
                    let z = document.createElement('img');
                    z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/image_green.svg"
                    z.width="12"
                    z.height="12";
                    z.style="vertical-align: middle;padding-bottom: 2px; padding-right: 2px";
                    d[idx].childNodes[0].prepend(z);
                }
                else{
                    let z = document.createElement('img');
                    z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/text.svg"
                    z.width="12"
                    z.height="12";
                    z.style="vertical-align: middle;padding-bottom: 2px; padding-right: 2px";
                    d[idx].childNodes[0].prepend(z);
                }
                }catch{
                    let z = document.createElement('img');
                    z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/text.svg"
                    z.width="12"
                    z.height="12";
                    z.style="vertical-align: middle;padding-bottom: 2px; padding-right: 2px";
                    d[idx].childNodes[0].prepend(z);
                    continue;
                }
        }},50)
                    }) }




                }catch{}
        },200);}catch{}

    try{
        let d = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("BoardBottomOption")[0].getElementsByClassName("btn number")
        newnum = d.length
        //console.log(newnum);
        console.log(d)
        for(let idx=0; idx<newnum; idx++){
            let nnum = d[idx].childNodes.length;
            let ot = 0;
            let om = 0;
            let ir = 10;
            let mr = 10;
            for(let idxx=0; idxx<nnum; idxx++){
                if(d[idx].childNodes[idxx].className == "list-i-img"){
                    //d[idx].prepend(d[idx].childNodes[idxx]);
                    ot+=1;
                    ir = idxx;
                }
                if(d[idx].childNodes[idxx].className == "list-i-movie"){
                    //d[idx].prepend(d[idx].childNodes[idxx]);
                    om+=1;
                    mr = idxx;
                }
            }
            if(mr!=10){
                d[idx].removeChild(d[idx].childNodes[mr]);
            }
            if(ir!=10){
                d[idx].removeChild(d[idx].childNodes[ir]);
            }
            if(om>0){
                let z = document.createElement('img');
                z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/video.svg"
                z.width="12"
                z.height="12";
                z.style="vertical-align: middle;padding-bottom: 2px;";
                d[idx].prepend(z);
            }
            else if(ot>0){
                let z = document.createElement('img');
                z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/image_green.svg"
                z.width="12"
                z.height="12";
                z.style="vertical-align: middle;padding-bottom: 2px;";
                d[idx].prepend(z);
            }
            else{
                let z = document.createElement('img');
                z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/text.svg"
                z.width="12"
                z.height="12";
                z.style="vertical-align: middle;padding-bottom: 2px;";
                d[idx].prepend(z);
            }
        }}catch{}


    try{
        let d = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("article-board.m-tcol-c")[1].getElementsByClassName("inner_list")
        newnum = d.length
        //console.log(d)
        for(let idx=0; idx<newnum; idx++){
            let nnum = d[idx].childNodes.length;
            let ot = 0;
            let om = 0;
            let ir = 10;
            let mr = 10;
            for(let idxx=0; idxx<nnum; idxx++){
                if(d[idx].childNodes[idxx].className == "list-i-img"){
                    //d[idx].prepend(d[idx].childNodes[idxx]);
                    ot+=1;
                    ir = idxx;
                }
                if(d[idx].childNodes[idxx].className == "list-i-movie"){
                    //d[idx].prepend(d[idx].childNodes[idxx]);
                    om+=1;
                    mr = idxx;
                }
            }
            if(mr!=10){
                d[idx].removeChild(d[idx].childNodes[mr]);
            }
            if(ir!=10){
                d[idx].removeChild(d[idx].childNodes[ir]);
            }
            if(om>0){
                let z = document.createElement('img');
                z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/video.svg"
                z.width="12"
                z.height="12";
                z.style="vertical-align: middle;padding-bottom: 2px;";
                d[idx].prepend(z);
            }
            else if(ot>0){
                let z = document.createElement('img');
                z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/image_green.svg"
                z.width="12"
                z.height="12";
                z.style="vertical-align: middle;padding-bottom: 2px;";
                d[idx].prepend(z);
            }
            else{
                let z = document.createElement('img');
                z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/text.svg"
                z.width="12"
                z.height="12";
                z.style="vertical-align: middle;padding-bottom: 2px;";
                d[idx].prepend(z);
            }
        }}catch{}


    try{
        let d = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("article-board.m-tcol-c")[0].getElementsByClassName("td_article");
        //console.log(d);
        newnum = d.length
        //console.log(newnum);
        for(let idx=0; idx<newnum; idx++){
            let nnum = d[idx].childNodes.length;
            let ot = 0;
            let om = 0;
            for(let idxx=0; idxx<nnum; idxx++){
                if(d[idx].childNodes[idxx].className == "board-tag"){
                    if(d[idx].childNodes[idxx].innerText == "공지"){
                        ot+=1;
                    }
                    if(d[idx].childNodes[idxx].innerText == "추천"){
                        om+=1;
                    }
                }
                if(ot>0 && d[idx].childNodes[idxx].className == "board-list"){
                    let z = document.createElement('img');
                    z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/info.svg"
                    z.width="12"
                    z.height="12";
                    z.style="vertical-align: middle;padding-bottom: 2px;";
                    d[idx].childNodes[idxx].childNodes[1].prepend(z);
                }
                if(om>0 && d[idx].childNodes[idxx].className == "board-list"){
                    let z = document.createElement('img');
                    z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/star.svg"
                    z.width="12"
                    z.height="12";
                    z.style="vertical-align: middle;padding-bottom: 2px;";
                    d[idx].childNodes[idxx].childNodes[1].prepend(z);
                }
            }
        }}catch{}




    //console.log("1차끝")






    try{
        //console.log("test")
        setTimeout(function(){
            let d = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("RelatedArticlesList")[0].getElementsByClassName("list_item")
            newnum = d.length
            //console.log(newnum);
            ////console.log(d);
            ////console.log(newnum);
            for(let idx=0; idx<newnum; idx++){
                try{
                    d[idx].childNodes[0].getElementsByTagName("img")[0].remove();
                }catch{}
                try{
                let svgicon = d[idx].childNodes[0].getElementsByTagName("svg")[0].className.baseVal;
                let ot = 0;
                let om = 0;
                //console.log(svgicon)
                if(svgicon == "svg-icon list_attach_img"){
                    //console.log("adding img")
                    //d[idx].prepend(d[idx].childNodes[idxx]);
                    ot+=1;
                }
                if(svgicon == "svg-icon list_attach_video"){
                    //d[idx].prepend(d[idx].childNodes[idxx]);
                    om+=1;
                }
                if(om>0){
                    //d[idx].childNodes[0].getElementsByTagName("svg")[0].remove();
                    let z = document.createElement('img');
                    z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/video.svg"
                    z.width="12"
                    z.height="12";
                    z.style="vertical-align: middle;padding-bottom: 2px;";
                    d[idx].childNodes[0].prepend(z);
                }
                else if(ot>0){
                    //d[idx].childNodes[0].getElementsByTagName("svg")[0].remove();
                    let z = document.createElement('img');
                    z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/image_green.svg"
                    z.width="12"
                    z.height="12";
                    z.style="vertical-align: middle;padding-bottom: 2px; padding-right: 2px";
                    d[idx].childNodes[0].prepend(z);
                }
                else{
                    let z = document.createElement('img');
                    z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/text.svg"
                    z.width="12"
                    z.height="12";
                    z.style="vertical-align: middle;padding-bottom: 2px; padding-right: 2px";
                    d[idx].childNodes[0].prepend(z);
                }
                }catch{
                    let z = document.createElement('img');
                    z.src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/text.svg"
                    z.width="12"
                    z.height="12";
                    z.style="vertical-align: middle;padding-bottom: 2px; padding-right: 2px";
                    d[idx].childNodes[0].prepend(z);
                    continue;
                }
            }
        },1000);
        setTimeout(function(){
            try{
                for(let iii=0; iii<3; iii++){
                    //console.log("글목록 버튼..");
                    //console.log(document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("paginate_area")[0].getElementsByClassName("ArticlePaginate")[0].getElementsByClassName("btn"));
                    document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("paginate_area")[0].getElementsByClassName("ArticlePaginate")[0].getElementsByClassName("btn")[iii].addEventListener("click", async function(){
                        let d = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("RelatedArticlesList")
                        setTimeout(function(){
                            console.log("글목록 다시 불러오기");
                            //console.log("test")
                            d = d[0].getElementsByClassName("list_item")
                            newnum = d.length
                            ////console.log(d);
                            ////console.log(newnum);

                            for(let idx=0; idx<newnum; idx++){
                                try{
                                //d[idx].childNodes[0].getElementsByTagName("img")[0].remove();
                                }catch{}
                                try{
                                let svgicon = d[idx].childNodes[0].getElementsByTagName("svg")[0].className.baseVal;
                                let ot = 0;
                                let om = 0;
                                //console.log(svgicon)
                                if(svgicon == "svg-icon list_attach_img"){
                                    console.log("adding img")
                                    //d[idx].prepend(d[idx].childNodes[idxx]);
                                    ot+=1;
                                }
                                if(svgicon == "svg-icon list_attach_video"){
                                    //d[idx].prepend(d[idx].childNodes[idxx]);
                                    om+=1;
                                }
                                if(om>0){
                                    d[idx].childNodes[0].getElementsByTagName("img")[0].src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/video.svg"
                                }
                                else if(ot>0){
                                    d[idx].childNodes[0].getElementsByTagName("img")[0].src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/image_green.svg"
                                }
                                else{
                                    d[idx].childNodes[0].getElementsByTagName("img")[0].src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/text.svg"
                                }
                                }catch{
                                    d[idx].childNodes[0].getElementsByTagName("img")[0].src = "https://raw.githubusercontent.com/ywj515/tgdcafe/main/text.svg"
                                }
                            }
                        },200);
                    })
                }}catch{}
        },200);}catch{}

    //console.log("2차시작")

    try{
        ggg = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName("board-tag").length;
        console.log(ggg);
    }catch{}
    setTimeout(async function(){
        if(ggg==0 && gggg == 0){
            let g = await ifDesiredNodeAvailable("u_txt _label");
            //console.log(g);
            g[0].innerText = "추천";
            g[0].outerText = "추천";
        }
        },200)

    
    }catch{}
}















function ifDesiredNodeAvailable(classname) {
    let composeBox = document.querySelector('#cafe_main').contentWindow.document.getElementsByClassName(classname);
    if(!composeBox[0]) {
        composeBox = window.setTimeout(ifDesiredNodeAvailable(classname),500);
        return composeBox;
    }
    //console.log(composeBox);
    return composeBox;
}

function addstyle(config){
    let z = document.createElement('style');
    z.innerHTML = config;
    document.querySelector('#cafe_main').contentWindow.document.body.appendChild(z);
}

function addstylecon(config){
    let z = document.createElement('style');
    z.innerHTML = config;
    document.getElementById("content-area").appendChild(z);
}

function addstylebody(config){
    let z = document.createElement('style');
    z.innerHTML = config;
    document.getElementById("cafe-body").appendChild(z);
}

function addstylerbody(config){
    let z = document.createElement('style');
    z.innerHTML = config;
    document.body.appendChild(z);
}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址