메일플러그 개별발송 자동해제

메일플러그 개별발송이 체크되어 있는 것을 자동으로 해제

// ==UserScript==
// @license      MIT
// @name         메일플러그 개별발송 자동해제
// @namespace    shuggie
// @version      2024-05-23
// @description  메일플러그 개별발송이 체크되어 있는 것을 자동으로 해제
// @author       장민석
// @match        https://*.mailplug.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to execute custom code when #page2 is in the URL
    function executeCustomScript() {
        if (window.location.hash.includes('write')) {
            (function checkElement() {
                const element = document.getElementsByName('in_div');
                if (element.length > 0) {
                    var ind=document.getElementsByName('in_div')[0];
                    ind.value='N';
                    ind.checked=false;
                } else {
                    setTimeout(checkElement, 100); // Check again after 100ms
                }
            })();
        }
    }

    // Initial check
    executeCustomScript();

    // Check hash change
    window.addEventListener('hashchange', executeCustomScript);
})();