ページ内のリンクをリストするエクステ

ext.add("list-url", function(){
    var urls = [];
    var aa = window.content.document.getElementsByTagName("a");
    var text = "";
    var alt = "";
    for (var i = 0; i < aa.length ; i++) {
        if(aa[i].href == ""){ continue; }

        if (aa[i].text == "" && aa[i].hasChildNodes() && aa[i].childNodes[0].nodeType == Node.ELEMENT_NODE){
            alt = aa[i].childNodes[0].getAttribute("alt");
            text = " " + aa[i].childNodes[0].nodeName + (alt ? ": " + alt : "");
        }else{
            text = aa[i].text;
        }
        urls.push([text, decodeURIComponent(aa[i].href)]);
    }

    if(urls.length == 0){
        display.echoStatusBar("No url found.");
    }else{
        prompt.selector(
            {
                message    : "Select URL",
                collection : urls,
                width : [35, 65],
                header : ["text", "url"],
                callback   : function (i) {
                    if (i >= 0)
                        openUILinkIn(urls[i][1], "tab"); // or current tabshifted window
                }
            }
        );
    }
}, "list url");


=>
プラグイン化した。
https://github.com/10sr/keysnail-plugin/blob/master/list-page-urls.ks.js