Tcafe Block User

try to take over the world!

13.12.2020 itibariyledir. En son verisyonu görün.

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         Tcafe Block User
// @namespace    http://tampermonkey.net/
// @version      0.5
// @description  try to take over the world!
// @author       You
// @include      /tcafe2a.com/
// @require      http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @grant        GM_setValue
// @grant        GM_getValue
// @grant		 GM_addStyle
// @run-at       document-end
// ==/UserScript==
(function() { var css = document.createElement('link'); css.href = 'https://use.fontawesome.com/releases/v5.15.1/css/all.css'; css.rel = 'stylesheet'; css.type = 'text/css'; document.getElementsByTagName('head')[0].appendChild(css); })();

//document.querySelector('.top_bg').insertAdjacentHTML('beforeend', '&nbsp;<a class="BanIcon fas fa-ban" href="javascript:void(0)"></>')

// 차단유저 ID
const IDs = JSON.parse(GM_getValue("IDs", "[]"))


// 대상 node 선택
var target = document.querySelector('body')


// 감시자 인스턴스 만들기
var observer = new MutationObserver(function(mutations) {

    IDs.forEach(function (ID, index, array) {        
        let IDNode1 = document.querySelectorAll("div.user > a[onclick*=" + ID +"]")
        let IDNode2 = document.querySelectorAll("td > a[onclick*=" + ID +"]")

        if(IDNode2){
            for(var j=0; j < IDNode2.length; j++) {
                if (IDNode2[j].parentNode) {
                    console.log('게시글 번호  : ' + IDNode2[j].closest('tr').getAttribute('id') + ' -- ID : ' + ID)
                    $(IDNode2[j]).closest('tr').remove()
                }
            }
        }
        if(IDNode1 && /wr_id/.test(window.location.href)){
            for(var i=0; i < IDNode1.length; i++) {
                if (IDNode1[i].parentNode) {
                    console.log('코멘트 번호 : ' + IDNode1[i].closest('div.user').nextElementSibling.children[1].getAttribute('name') + ' -- ID : ' + ID)
                    $(IDNode1[i]).closest('div.box').remove()
                }
            }

        }
    })


})

// 감시자의 설정:
var config = { attributes: true, childList: true };

// 감시자 옵션 포함, 대상 노드에 전달
observer.observe(target, config);

// 차단 ID 저장
GM_setValue("IDs", JSON.stringify(IDs))

function BanList() {
    let getids = document.querySelector('td#sideViewRow_mb_id > span > a').getAttribute('href')
    let id =getids.replace(/.*\&stx=/,'')
    if(IDs.indexOf(id) !== -1){
        alert("이미 차단 등록되었습니다!")
    } else{
        IDs.push(id)
        GM_setValue("IDs", JSON.stringify(IDs))
    }

}


let BanIDs = document.querySelectorAll('span.member')
for (let i = 0; i < BanIDs.length; i++) {
    BanIDs[i].addEventListener("click", async function(e){
        await sleep(150)
        let entries = document.querySelector('td#sideViewRow_mb_id')
        //console.log(entries)
        entries.closest('tr').insertAdjacentHTML('afterend', '<tr height="19"><td id="Banid">&nbsp;<font color="gray">·</font>&nbsp;<span style="color: #A0A0A0;  font-family: 돋움; font-size: 11px;"><a href="javascript:void(0);">Ban ID</a></span></td></tr>')
        document.querySelector('#Banid').addEventListener("click", function(e){
            e.preventDefault()
            BanList()
        });

    })
}

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