깡계확인 스크립트(글 5개나 댓글 5개 미만 표시) 및 핫딜챈 한정 핫딜챈 작성글 비율 표시
当前为
// ==UserScript==
// @name 아카라이브 깡계확인 및 핫딜챈 비율표시
// @namespace http://kemomimi.com/
// @version 1.1.1
// @description 깡계확인 스크립트(글 5개나 댓글 5개 미만 표시) 및 핫딜챈 한정 핫딜챈 작성글 비율 표시
// @match https://arca.live/b/*/*
// @grant GM_xmlhttpRequest
// @connect arca.live
// ==/UserScript==
const firstLink = document.querySelector('.info-row .user-info a');
if (firstLink) {
const targetURL = firstLink.href;
// GET 요청 보내기
GM_xmlhttpRequest({
method: 'GET',
url: targetURL,
onload: function(response) {
const htmlData = response.responseText;
const parser = new DOMParser();
const doc = parser.parseFromString(htmlData, 'text/html');
if(doc.querySelectorAll('.error-code').length >=1){
firstLink.style.fontSize = '20px';
firstLink.style.fontWeight = 'bold';
firstLink.style.color = 'red';
firstLink.style.textDecoration = 'line-through';
firstLink.textContent += ' (삭제된 계정)';
//console.log("삭제된 계정");
}else{
const cardBlockElement = doc.querySelector('.card-block');
const childNodes = cardBlockElement.childNodes;
var post = 0
var coment = 0
var hotdeal = 0
var flag = 0
for (const node of childNodes) {
if (node.nodeType === Node.ELEMENT_NODE) {
if(node.className == "clearfix"){
flag+=1
}
if(node.className== "user-recent" && flag==0){
post+=1
const colTitleNodes = node.querySelectorAll('.col-title span');
colTitleNodes.forEach(span => {
if(span.textContent.trim() === "핫딜 채널") {
hotdeal += 1;
}
});
}else if(node.className== "user-recent" && flag==1){
coment+=1
}
}
}
if (window.location.href.includes('/hotdeal/')) {
// 핫딜챈
var hotdealRatio = ((hotdeal/post)*100).toFixed(0)
if(post<=5 || coment<=5){
firstLink.style.fontSize = '17px';
firstLink.style.fontWeight = 'bold';
firstLink.style.color = 'red';
firstLink.textContent += ' (핫딜챈 비율:'+hotdealRatio+'% 최근 글:'+post+' 댓글:'+coment+')';
}else{
if (hotdealRatio >= 70){
firstLink.style.color = 'red';
}
if(hotdealRatio >= 90){
firstLink.style.fontWeight = 'bold';
firstLink.style.fontSize = '17px';
}
firstLink.textContent += ' (핫딜챈 비율: '+hotdealRatio+'%)';
}
}
else if(post<=5 || coment<=5){
firstLink.style.fontSize = '17px';
firstLink.style.fontWeight = 'bold';
firstLink.style.color = 'red';
firstLink.textContent += ' (최근 글:'+post+' 댓글:'+coment+')';
}else{
//firstLink.textContent += ' (최근 글:'+post+' 댓글:'+coment+')';
}
}
}
});
} else {
console.log('링크를 찾을 수 없음');
}