Mabinogi World Wiki is brought to you by Coty C., 808idiotz, our other patrons, and contributors like you!!
Want to make the wiki better? Contribute towards getting larger projects done on our Patreon!

MediaWiki:StatForm.js

From Mabinogi World Wiki

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
jQuery(function ($) {
    addStatChangeHooks();
    $(".stat-change:first").closest("fieldset").find(".multipleTemplateAdder")
    .click(function () {
        setTimeout(addStatChangeHooks, 50)
    });
});

function addStatChangeHooks() {
    function process () {
        var $table = $(this).closest("table");
        $table.find(".stat-posneg option:first").val(processStatChange($table));
    }
    $(".stat-name:visible:not(.hooked)").click(process).addClass("hooked").click();
    $(".stat-change:visible:not(.hooked)").keyup(process).addClass("hooked").keyup();
}

function processStatChange($table) {
    var change = $table.find(".stat-change").val();
    return change[0] == "+" ? "Positive" : "Negative";
}