const targetNode = document.getElementById('content_area'); // 監視対象の要素
const config = { childList: true, subtree: true }; // 子要素の追加/削除、子孫要素も監視
const callback = function(mutationsList, observer) {
    for(let mutation of mutationsList) {
        if (mutation.type === 'childList') {
            console.log('A child node has been added or removed.');
            // ここで新しいコンテンツに対する処理を実行
            applyMyScriptToNewContent();
            // 処理が完了したら、必要に応じて監視を停止することも可能
            // observer.disconnect();
        }
    }
};
const observer = new MutationObserver(callback);
if (targetNode) {
    observer.observe(targetNode, config);
}
// 初回ロード時
document.addEventListener("DOMContentLoaded", function() {
    applyMyScriptToNewContent();
});
税抜3,300円以上ご購入で送料無料※ 離島発送不可