Huggle/JS/user guard.js

From MediaWiki.org
< Huggle‎ | JS
Jump to navigation Jump to search
function ext_is_working()
{
    return true;
}

function ext_init()
{
    huggle.register_hook("edit_after_pre_process", "check");
    return true;
}

function check(edit)
{
    if (edit["Page"]["IsUserpage"] == true && edit["Page"]["RootName"] == huggle.get_username())
    {
        huggle_ui.show_tooltip_message("<b><big>Someone just modified your userpage on " +
                                       edit["Page"]["SiteName"] + "!<br>Page: " +
                                       edit["Page"]["PageName"] + " user: " + 
                                       edit["User"]["Username"] + "</big></b>");
    } else if (edit["Page"]["NS"]["CanonicalName"] == "User talk" && edit["Page"]["RootName"] == huggle.get_username())
    {
        huggle_ui.show_tooltip_message("<b><big>Someone just modified your talk page!!<br>User: " + 
                                       edit["User"]["Username"] + "</big></b>");
    }
}

function ext_get_info()
{
    var info = {};
    info["name"] = "User guard";
    info["version"] = "1.0.0";
    info["description"] = "Notify you on changes to your user space";
    info["author"] = "Petr Bena";
    info["min_huggle_version"] = "3.4.3";
    info["required_context"] = "huggle_ui";
    info["requires_unsafe"] = false;
    return info;
}