aboutsummaryrefslogtreecommitdiff
path: root/chrome/content/redirectList.js
blob: 7a273cd5269da038fc4018c39c06625015c3dc71 (plain)
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
var RedirectList = {

    id          : "redirector@einaregilsson.com",
    name        : "Redirector",

    addItemsToListBox : function(items) {

        var list = $('lstRedirects');
        var item, row, value;

        for each (item in items) {
            row = document.createElement('listitem');

            this.createCell(row, item.exampleUrl);
            this.createCell(row, item.pattern);
            this.createCell(row, item.redirectUrl);
            this.createCell(row, item.onlyIfLinkExists);

            list.appendChild(row);
        }
    },

    createCell : function(row, value) {
        var cell = document.createElement('listcell');
        cell.setAttribute('label', value);
        cell.setAttribute('value', value);
        row.appendChild(cell);
    },


    onLoad : function() {
        try {
            RedirLib.initialize(this);
            Redirector.init();
            this.addItemsToListBox(Redirector.list);
        } catch(e) {
            alert(e);
        }
    }

};