This file is indexed.

/usr/share/xul-ext/all-in-one-sidebar/content/downloads.js is in xul-ext-all-in-one-sidebar 0.7.23-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
window.addEventListener("DOMContentLoaded", aios_init, false);

var aios_managerWindow, aios_posElem, aios_Interval;
var aios_IntervalCount = 0;

var aios_inSidebar = (top.document.getElementById('sidebar-box')) ? true : false;


/* Fix fuer Clean-Button im Downloads-Panel */
if(aios_inSidebar) window.arguments = [];


function aios_init() {
    var enable_sidebar, enable_count, enable_layout, enable_layoutall;

    // Menueleiste unter Mac OS X ausblenden
    aios_hideMacMenubar();

    aios_managerWindow = document.getElementById("downloadManager");
    aios_posElem = document.getElementById("downloadView");

    // fuer CSS-Zwecke speichern
    AiOS_HELPER.rememberAppInfo( aios_managerWindow );

    try {
        enable_sidebar = AiOS_HELPER.prefBranchAiOS.getBoolPref("dm.sidebar");
        enable_count = AiOS_HELPER.prefBranchAiOS.getBoolPref("dm.count");
        enable_layout = AiOS_HELPER.prefBranchAiOS.getBoolPref("dm.layout");
        enable_layoutall = AiOS_HELPER.prefBranchAiOS.getBoolPref("dm.layoutall");
    }
    catch(e) {
        return false;
    }

    // Sidebar-Layout
    if((enable_layout && aios_inSidebar) || enable_layoutall) aios_sidebarLayout();

    // Elemente zaehlen und anzeigen
    if(enable_count) {
        // beim Aufbau der Downloadliste den Titel aktualisieren
        var orig_stepListBuilder = stepListBuilder;
        stepListBuilder = function(aNumItems) {
            orig_stepListBuilder(aNumItems);
            aios_countItems();
        };

        // bei neuen Downloads oder Statuswechseln den Titel aktualisieren
        // https://developer.mozilla.org/en/DOM/Mutation_events
        // https://developer.mozilla.org/en/DOM/DOM_Mutation_Observers
        var dm = Components.classes["@mozilla.org/download-manager;1"]
                 .getService(Components.interfaces.nsIDownloadManager);

        dm.addListener({
            onStateChange : function(state, dl) { aios_countItems(); },
            onDownloadStateChange : function(state, dl) { aios_countItems(); }
        });

        // beim Loeschen der Downloadliste den Titel aktualisieren
        var orig_clearDownloadList = clearDownloadList;
        clearDownloadList = function() {
            orig_clearDownloadList();
            aios_countItems();
        };
    }
    else {
        // Zahl im Titel entfernen
        // => noetig nur direkt nach der Deaktivierung der Option, weil im Broadcaster die Anzahl gespeichert ist
        if(top.document.getElementById('sidebar-title')) {
            var title = top.document.getElementById('sidebar-title').getAttribute("value");

            if(title.indexOf(" [") > 0) {
                var newTitle = title.substring(0, title.indexOf(" ["));
                top.document.getElementById('sidebar-title').setAttribute("value", newTitle);

                if(aios_inSidebar) AiOS_HELPER.mostRecentWindow.document.getElementById("viewDownloadsSidebar").setAttribute('sidebartitle', newTitle);
            }
        }
    }

    if(document.getElementById("searchbox")) {

        window.setTimeout(function() {
            document.getElementById("searchbox").focus();
        }, 50);

    }

    // Tastaturkuerzel entfernen, um nicht die des Hauptbrowsers zu blockieren
    if(aios_inSidebar) aios_removeAccesskeys();

    return true;
}


/*
    aktiviert das an die Sidebar angepasste Layout
        => Aufruf durch aios_init()
*/
function aios_sidebarLayout() {
    var cmdBar, i;

    // CSS fuer Sidebar-Optimierungen aktivieren
    aios_addCSS("downloads.css", aios_managerWindow);

    cmdBar = document.getElementById("search");

    // Toolbar nach oben versetzen
    aios_managerWindow.insertBefore(cmdBar, aios_posElem);


    // Buttons durch Toolbarbuttons ersetzen
    var tbChilds = cmdBar.childNodes;
    var tbutton, tobserver;
    for(i = 0; i < tbChilds.length; i++) {

        if(tbChilds[i].tagName == "button") {
            tbutton = document.createElement("toolbarbutton");

            for(var j = 0; j < tbChilds[i].attributes.length; j++) {
                tbutton.setAttribute(tbChilds[i].attributes[j].name, tbChilds[i].attributes[j].value);
            }

            tbChilds[i].parentNode.replaceChild(tbutton, tbChilds[i]);
        }
    }
}


/*
    zaehlt und zeigt die aktivierten und deaktivierten Extensions im Sidebartitel an
        => Aufruf durch aios_init()
*/
function aios_countItems() {
    if(!AiOS_HELPER.mostRecentWindow.document) return false;

    // Fix fuer MR Tech Local Install
    var li_count = false;

    if(typeof Local_Install == "object") {
        var li_gPrefBranch = AiOS_HELPER.prefService.getBranch("local_install.");
        li_count = li_gPrefBranch.getBoolPref("showManagerTotals");
        if(li_count) return false;
        else Local_Install.setWindowTitle = function(){};
    }

    // bisherigen Titel feststellen
    var newTitle;
    var origTitle = "";
    if(AiOS_HELPER.mostRecentWindow.document.getElementById("viewDownloadsSidebar")) origTitle = AiOS_HELPER.mostRecentWindow.document.getElementById("viewDownloadsSidebar").getAttribute('label');

    if(document.getElementById("viewGroup")) {
        if(document.getElementById("viewGroup").selectedItem) {
            var viewTitle = document.getElementById("viewGroup").selectedItem.getAttribute('label');
            origTitle = origTitle + " - " + viewTitle;
        }
    }

    // Elemente zaehlen
    //var exts = aios_filterItems(aios_boxElem.childNodes, function(c){ return c.nodeName == "richlistitem" });
    var exts = aios_filterItems();

    var str_count = "";

    var list_downloading = 0;
    var list_done = 0;
    var list_failed = 0;

    for(var i = 0; i < exts.length; i++) {
        var state = exts[i].getAttribute('state');

        // downloading => starting + downloading + paused + downloading
        if(state == "-1" || state == "0" || state == "4" || state == "5") list_downloading++;

        // done => done
        if(state == "1") list_done++;

        // failed => failed + canceled
        if(state == "2" || state == "3") list_failed++;
    }

    str_count = list_done;
    if(list_downloading > 0 || list_failed > 0) str_count = str_count + "/" + list_downloading;
    if(list_failed > 0) str_count = str_count + "/" + list_failed;

    newTitle = origTitle + " [" + str_count + "]";

    // Titel und Label setzen
    document.title = newTitle;

    if(top.document.getElementById('sidebar-title')) top.document.getElementById('sidebar-title').setAttribute("value", newTitle);

    // Sidebartitel im Broadcaster speichern, damit er beim Schliessen/oeffnen der Sidebar wiederhergestellt werden kann
    if(aios_inSidebar) AiOS_HELPER.mostRecentWindow.document.getElementById("viewDownloadsSidebar").setAttribute('sidebartitle', newTitle);

    return true;
}


/*
    Original-Code by Caio Chassot
        Slim_Extension_List_0.1
        http://v2studio.com/k/moz/

        => Aufruf durch aios_init()

function aios_filterItems(l,f) {
    var r = [];
    if (!f) f = function(v){return v};
    for (var i=0; i<l.length; i++) if (f(l[i])) r.push(l[i]);
    return r;
}*/
function aios_filterItems() {
    var r = [];
    var childs;

    childs = document.getElementById("downloadView").childNodes;

    for (var i = 0; i < childs.length; i++) {
        if (childs[i].nodeName == "richlistitem" && childs[i].getAttribute('hidden') != "true") {
            r.push(childs[i]);
        }
    }

    return r;
}


/*
    legt den Sidebartitel fest (nur bei Add-ons)
        => Aufruf durch aios_init() und onclick-Handler auf den Radio-Buttons
*/
function aios_setTitle(aObj) {
    if(typeof Local_Install == "object") return false;

    if(!AiOS_HELPER.mostRecentWindow.document) return false;

    var newTitle;
    var origTitle = AiOS_HELPER.mostRecentWindow.document.getElementById("viewDownloadsSidebar").getAttribute('label');

    var viewTitle;

    // Label des zukuenftigen Panels (ausgeloest nur durch Klick auf Radio-Button)
    if(typeof aObj == "object") viewTitle = aObj.getAttribute('label');
    // Label des selektierten Radio-Buttons
    else if(document.getElementById("viewGroup")) viewTitle = document.getElementById("viewGroup").selectedItem.getAttribute('label');

    newTitle = origTitle + " - " + viewTitle;

    // Titel und Label setzen
    //document.title = newTitle;

    if(!top.document.getElementById('sidebar-title')) return false;
    top.document.getElementById('sidebar-title').setAttribute("value", newTitle);

    // Sidebartitel im Broadcaster speichern, damit er beim Schliessen/oeffnen der Sidebar wiederhergestellt werden kann
    if(aios_inSidebar) AiOS_HELPER.mostRecentWindow.document.getElementById("viewDownloadsSidebar").setAttribute('sidebartitle', newTitle);

    return true;
}