Template:XXifstat

<pre class="script">
/* PLEASE DO NOT USE THIS TEMPLATE IN PAGES */

/* get a page's language (Don't use page.language!) */
var u = Uri.Parts(Page.uri);
var lang = string.toLower(u.path[0]);
if(string.Contains(lang, "project")) {
 lang = string.Substr(lang, 8);
}
/* fall back to page.language on a user page */
else if (string.StartsWith(lang, "user:")) {
 lang = page.language;
}

var interface = string.toLower($0);
var strPath = "";
var isDOM = false;
var isFUEL = false;
var domPage = "";

if (string.StartsWith(interface, 'nsidomsvg')) {
    isDOM = true;
    if (string.EndsWith(interface, 'element') && string.Length(interface) > 16) {
        interface = string.Substr($0, 9, string.Length(interface) - 16);
        strPath = lang + '/SVG/Element/' + interface;
        if(wiki.pageExists(strPath)) {
            <code>(web.link(wiki.uri(strPath), interface))</code>
        } else {
            <code><a rel=('internal') href=(wiki.uri(strPath)) class=('new')>interface</a></code>
            " - Needs documentation";
        }
    } else {
        "SVG (Unsure how to handle) " + $0;
    }
} else if (string.StartsWith(interface, 'nsidom')) {
    isDOM = true;
    interface = string.Substr($0, 6);
    var destNewType = lang + '/DOM/' + interface;
    var destOldType = lang + '/DOM:' + interface;

    if(wiki.pageExists(destNewType)) { /* the page exists from the dekiwiki age */
        <code>(web.link(wiki.uri(destNewType),interface))</code>;
        domPage = wiki.getpage(destNewType);
    } else if (wiki.pageExists(destOldType)) { /* the page exists from the mediawiki age */
        <code>(web.link(wiki.uri(destOldType),interface))</code>;
        domPage = wiki.getpage(destOldType);
    } else { /* the page doesn't exist */
        <code><<span class="start-tag">a</span><span class="attribute-name"> rel</span>=(<span class="attribute-value">'internal') </span><span class="attribute-name">href</span><span>=</span>(<span>wiki.uri(</span>destNewType<span>)) </span><span class="attribute-name">class</span>=<span class="attribute-value">('new')></span>interface</<span class="end-tag">a></span></code>;
        " (" + $0 +")";
    }
} else if (string.StartsWith(interface, 'exti')) {
    isFUEL = true;
    strPath = lang + "/Toolkit_API/" + $0;
    if(wiki.pageExists(strPath)) {
        <code>(web.link(wiki.uri(strPath), $0))</code>
    } else {
        <code><a rel=('internal') href=(wiki.uri(strPath)) class=('new')>$0</a></code>
        " - Needs documentation (check if it is an Interface).";
    }
} else if (string.StartsWith(interface, 'fueli')) {
    isFUEL = true;
    strPath = lang + "/Toolkit_API/FUEL/" + $0;
    if(wiki.pageExists(strPath)) {
        <code>(web.link(wiki.uri(strPath), $0))</code>
    } else {
        <code><a rel=('internal') href=(wiki.uri(strPath)) class=('new')>$0</a></code>
        " - Needs documentation (check if it is an Interface).";
    }
}

if (!isFUEL) {

    var str = "/XPCOM_Interface_Reference/";

    switch(lang) {
      case 'de':
        str = "/XPCOM_Interface_Referenz/";
        break;
    }

    /* check $0 exists */
    if(wiki.pageExists(lang + str + $0)) {
        if (isDOM) {
            " - ";
        }
        <code>(web.link(wiki.uri(lang + str + $0), $0))</code>
        var newPage = wiki.getpage(lang + str + $0);
        if(date.DiffMonths(date.now, newPage.date) > 12) {
            " (possibly outdated)";
        }
        if(map.contains(newPage.tags, "NeedsContent")) {
            " (NeedsContent)";
        }
        if(map.contains(newPage.tags, "NeedsHelp")) {
            " (NeedsHelp)";
        }
        if(map.contains(newPage.tags, "NeedsAttention")) {
            " (NeedsAttention)";
        }
        if(map.contains(newPage.tags, "NeedsMarkupWork")) {
            " (NeedsMarkupWork)";
        }
    } else if(wiki.pageExists(lang + '/' + $0)) {
        if (isDOM) {
            " - ";
        }
        <code>(web.link(wiki.uri(lang + '/' + $0), $0))</code>
        " - Needs to be moved. [possibly outdated, check tags]";
    } else if(!isDOM) {
        <code><a rel=('internal') href=(wiki.uri(lang + str + $0)) class=('new')>$0</a></code>
        " - Needs documentation (check if it is an Interface).";
    }
}

%>
Search for pages that use Template:XXifstat to see example use cases and how many pages use this macro.

Document Tags and Contributors

Contributors to this page: ethertank, trevorh
Last updated by: ethertank,