closeBanner

try to take over the world!

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         closeBanner
// @namespace    http://tampermonkey.net/
// @version      0.2.3
// @description  try to take over the world!
// @author       anonym
// @grant        none
// @include        https://alpha.e-sim.org/battle.html?id=*
// @include        https://primera.e-sim.org/battle.html?id=*
// ==/UserScript==
const closeBanners = () => {
    const banners = document.querySelectorAll('.ui-dialog.ui-widget.ui-widget-content.ui-corner-all.ui-draggable.ui-dialog-buttons');

    const closeBanner = (banner) => {
    const observer = new MutationObserver(mutationRecords => {
    const display = mutationRecords[0].target.style.display;
        if(display === 'block') {
        const btnYes = banner.querySelectorAll('.ui-button.ui-widget.ui-state-default.ui-corner-all.ui-button-text-only')[0];
    const event = new Event('click');
    console.log('banner');
    btnYes.dispatchEvent(event);
        }
 
});

  observer.observe(banner, {
  attributes: true
});

};
    let i;
    if(document.URL.indexOf('primera') > 0){
        i = 0;
    } else {
       i = 1;
    }

    for(i; i< banners.length; i++) {
        closeBanner(banners[i]);
    }
}

let script = document.createElement('script');
	script.textContent = '(' + closeBanners + ')(jQuery, window);';
	document.body.appendChild(script);