const popupArr = []; // 1. 팝업 열기 function go(url) { const popup = window.open(url); if (popup) popupArr.push(popup); } const blockprofile = [ 'https://steamcommunity.com/profiles/76561198970602734/', 'https://steamcommunity.com/profiles/76561198815509960/', 'https://steamcommunity.com/profiles/76561198941571367/', 'https://steamcommunity.com/profiles/76561199017126441/', 'https://steamcommunity.com/profiles/76561198425248541/', 'https://steamcommunity.com/profiles/76561198299818571/', 'https://steamcommunity.com/profiles/76561198289652713/', 'https://steamcommunity.com/profiles/76561199465803104/', 'https://steamcommunity.com/profiles/76561198847793451/', 'https://steamcommunity.com/profiles/76561198234246612/', 'https://steamcommunity.com/profiles/76561199073829686/', 'https://steamcommunity.com/profiles/76561199220078444/', 'https://steamcommunity.com/profiles/76561198137115229/', 'https://steamcommunity.com/profiles/76561198167634400/', 'https://steamcommunity.com/profiles/76561198202690333/', 'https://steamcommunity.com/profiles/76561198298438469/', 'https://steamcommunity.com/profiles/76561198856555122/', 'https://steamcommunity.com/profiles/76561198003937421/', 'https://steamcommunity.com/profiles/76561198109755462/', 'https://steamcommunity.com/profiles/76561199356773372/', 'https://steamcommunity.com/profiles/76561198255223639/', 'https://steamcommunity.com/profiles/76561199638932194/', 'https://steamcommunity.com/profiles/76561199356639659/', 'https://steamcommunity.com/profiles/76561198102367931/', 'https://steamcommunity.com/profiles/76561199196669913/', ]; for (let i = 0; i < blockprofile.length; i++) { go(blockprofile[i]); } // 2. 차단 실행 함수 function tryBlock(popup, retryCount = 0) { if (!popup || popup.closed) return; try { // 1-1. '더보기' 메뉴 클릭 const moreBtn = popup.document.querySelector('#profile_action_dropdown_link'); if (moreBtn) moreBtn.click(); // 1-2. 메뉴 뜰 시간 기다렸다가 버튼 탐색 setTimeout(() => { const blockBtn = popup.document.querySelector('#profile_action_dropdown a[href*="ConfirmBlock"]'); if (blockBtn) { blockBtn.click(); setTimeout(() => { const confirmBtn = popup.document.querySelector("body div.newmodal .btn_green_steamui.btn_medium"); if (confirmBtn) confirmBtn.click(); setTimeout(() => popup.close(), 5000); }, 3000); } else { // 실패: 재시도 허용 if (retryCount < 3) { console.warn(`차단 버튼 없음. 새로고침 시도 ${retryCount + 1}/3`); popup.location.reload(); // 2초 후 다시 시도 setTimeout(() => { tryBlock(popup, retryCount + 1); }, 2000); } else { console.warn(`차단 실패 (최대 재시도): 창 닫기`); popup.close(); } } }, 1000); } catch (e) { console.warn('문서 접근 실패:', e); } } // 3. 10초 후 모든 창에서 차단 시도 setTimeout(() => { for (let i = 0; i < popupArr.length; i++) { tryBlock(popupArr[i], 0); } }, 10000);