User:PetraMagna/momotalk-choice.js: Difference between revisions

From Blue Archive Wiki
Jump to navigation Jump to search
Content added Content deleted
mNo edit summary
(draft; WIP)
Line 1: Line 1:
let momotalk_options = function() {
const momotalk_options = function() {


function defer(method) {
function defer(method) {
if (window.jQuery) {
if (window.jQuery) {
method();
method();
} else {
} else {
setTimeout(function() { defer(method) }, 50);
setTimeout(function() { defer(method) }, 50);
}
}
}
}
const momotalk_init = function() {
function momotalk_main(method) {
$(document).ready(function() {
$(".momotalk-reply-container").each(function(i, container) {
return;
const title_split = mw.config.get('wgTitle').toLowerCase().split("/");
});
if (mw.config.get('wgNamespaceNumber') === 0 && title_split.length === 2 && title_split[1] === 'momotalk') {
};
console.log("MomoTalk init.");
} else {
function momotalk_main(method) {
console.log("Not MomoTalk page. Exit.");
$(document).ready(function() {
}
const title_split = mw.config.get('wgTitle').toLowerCase().split("/");
});
// don't do anything if this is not a MomoTalk page
}
if (mw.config.get('wgNamespaceNumber') === 0 && title_split.length === 2 && title_split[1] === 'momotalk') {
momotalk_init();
defer(momotalk_main);
} else {
console.log("Not MomoTalk page. Exit.");
}
});
}
defer(momotalk_main);
};
};



Revision as of 21:16, 7 December 2023

const momotalk_options = function() {

    function defer(method) {
        if (window.jQuery) {
            method();
        } else {
            setTimeout(function() { defer(method) }, 50);
        }
    }
    
    const momotalk_init = function() {
        $(".momotalk-reply-container").each(function(i, container) {
            return;
        });
    };
    
    function momotalk_main(method) {
        $(document).ready(function() {
            const title_split = mw.config.get('wgTitle').toLowerCase().split("/");
            // don't do anything if this is not a MomoTalk page
            if (mw.config.get('wgNamespaceNumber') === 0 && title_split.length === 2 && title_split[1] === 'momotalk') {
                momotalk_init();
            } else {
                console.log("Not MomoTalk page. Exit.");
            }
        });
    }
    
    defer(momotalk_main);
};

momotalk_options();