Huggle/JS/debug tools.js

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

function display_ring()
{
    var log = huggle.get_ring_log();
    var list = log.split("\n");
    var html = "<html>";
    html += "<head>\n";
    html += "<style>* { font-family: Lucida Console, Monaco, monospace; }</style>\n";
    html += "</head>\n";
    html += "<body>";
    html += "<h1>Huggle ring log</h1>";
    var index;
    for (index = 0; index < list.length; ++index)
    {
        html += list[index] + "<br>";
    }
    html += "</body></html>";
    huggle_ui.render_html(html);
}

function register_menus()
{
    huggle_ui.create_menu_item(huggle_ui_menu_scripting, "Display ring log", "display_ring");
}

function ext_init()
{
    if (huggle_ui.mainwindow_is_loaded())
    {
        register_menus();
    } else if (!huggle.register_hook("main_open", "register_menus"))
    {
        return false;
    }
    return true;
}

function ext_get_info()
{
    var info = {};
    info["name"] = "debug_tools";
    info["version"] = "1.0.0";
    info["description"] = "Debugging helper";
    info["author"] = "Petr Bena";
    info["min_huggle_version"] = "3.4.7";
    info["required_context"] = "huggle_ui";
    return info;
}