~ubuntu-branches/ubuntu/maverick/all-in-one-sidebar/maverick-security

« back to all changes in this revision

Viewing changes to chrome/aios.jar!/content/prefs/general.js

  • Committer: Bazaar Package Importer
  • Author(s): Sveinung Kvilhaugsvik
  • Date: 2008-11-19 00:50:02 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20081119005002-hhtw2s4nue7xhn47
Tags: 0.7.6-0ubuntu1
* new upstream release (LP: #297708)
* contens of chrome no longer shipped in jar file (LP: #217037)
* No longer list firefox-2 as alternate dependency (LP: #272959)
* Added watchfile

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
var aios_xulUrl = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 
3
//var aios_remMinWidth, aios_remDefWidth, aios_remMaxWidth;
 
4
 
 
5
 
 
6
/*
 
7
        Liste der zur Verf�gung stehenden Sidebars erstellen
 
8
                => Aufruf durch aios_initPane()
 
9
*/
 
10
function aios_genSidebarList() {
 
11
 
 
12
        if(!document.getElementById('sidebarInitPopup') || !document.getElementById('panelInitPopup')) return false;
 
13
 
 
14
        var strings = document.getElementById("aiosStrings");
 
15
        //if(!confirm(strings.getString('prefs.confirm'))) return false;
 
16
 
 
17
        var sidebarInit = document.getElementById('sidebarInitPopup');
 
18
        var panelInit = document.getElementById('panelInitPopup');
 
19
        var allSidebars = aios_WIN.document.getElementsByAttribute('group', 'sidebar');
 
20
 
 
21
        var cnt = 0;
 
22
        var initID = null;
 
23
        var sidebarPrefInit = "";
 
24
        var panelPrefInit = "";
 
25
        try {
 
26
                sidebarPrefInit = aios_gPrefBranch.getCharPref("gen.init");
 
27
                panelPrefInit = aios_gPrefBranch.getCharPref("gen.open.init");
 
28
        } catch(e) { }
 
29
 
 
30
        for(var i = 0; i < allSidebars.length; i++) {
 
31
                var xulElem = null;
 
32
 
 
33
                // mu� eine ID haben, darf keinen observer haben (Men�eintr�ge usw.) und muss eine Sidebar-URL haben
 
34
                if(allSidebars[i].id && !allSidebars[i].getAttribute('observes') && allSidebars[i].getAttribute('sidebarurl')) {
 
35
 
 
36
                        var separator = document.createElementNS(aios_xulUrl, "menuseparator");
 
37
                        if(cnt == 0) {
 
38
                                sidebarInit.appendChild(separator);
 
39
                                panelInit.appendChild(separator.cloneNode(true));
 
40
                        }
 
41
 
 
42
                        if(allSidebars[i].id != "extensionsEMbSidebar" && allSidebars[i].id != "themesEMbSidebar") {
 
43
                                xulElem = document.createElementNS(aios_xulUrl, "menuitem");
 
44
                                xulElem.setAttribute('label', strings.getString('prefs.openpanel') + " " + allSidebars[i].getAttribute('label'));
 
45
                                xulElem.setAttribute('value', allSidebars[i].id);
 
46
 
 
47
                                if(allSidebars[i].getAttribute('tooltiptext'))
 
48
                                        xulElem.setAttribute('tooltiptext', allSidebars[i].getAttribute('tooltiptext'));
 
49
 
 
50
                                sidebarInit.appendChild(xulElem);
 
51
                                panelInit.appendChild(xulElem.cloneNode(true));
 
52
                        }
 
53
 
 
54
                        cnt++;
 
55
                }
 
56
        }
 
57
 
 
58
        sidebarInit.parentNode.value = sidebarPrefInit;
 
59
        panelInit.parentNode.value = panelPrefInit;
 
60
        return true;
 
61
}
 
62
 
 
63
 
 
64
/*
 
65
        Werte der aktuellen Sidebarbreite einsetzen
 
66
                => Aufruf durch oncommand() der drei <toolbarbutton>
 
67
*/
 
68
function aios_setWidthVal(mode) {
 
69
        var browserWidth = aios_getBrowserWidth();
 
70
        var widthSidebar = browserWidth[0];
 
71
        var widthContent = browserWidth[1] + browserWidth[2];
 
72
        var compWidth = browserWidth[3];
 
73
 
 
74
        var percent = parseInt(Math.round((widthSidebar * 100) / compWidth));
 
75
        var theUnit = document.getElementById('obj-' + mode + 'WidthUnit').value;
 
76
 
 
77
        if(theUnit == "px") {
 
78
          document.getElementById('obj-' + mode + 'WidthVal').value = widthSidebar;
 
79
          document.getElementById(mode + 'WidthVal').value = widthSidebar;
 
80
        }
 
81
        else if(theUnit == "%") {
 
82
          document.getElementById('obj-' + mode + 'WidthVal').value = percent;
 
83
          document.getElementById(mode + 'WidthVal').value = percent;
 
84
        }
 
85
}
 
86
 
 
87
 
 
88
/*
 
89
        Breitenangaben bei �nderung der Ma�einheit umrechnen und ausgeben
 
90
                => Aufruf durch ValueChange-Listener, initiert in aios_initPrefs()
 
91
*/
 
92
function aios_changeWidthUnit(mode) {
 
93
        var elem = document.getElementById('obj-' + mode + 'WidthVal');
 
94
        var theUnit = document.getElementById('obj-' + mode + 'WidthUnit').value;
 
95
 
 
96
        var browserWidth = aios_getBrowserWidth();
 
97
        var compWidth = browserWidth[3];
 
98
 
 
99
        if(theUnit == "px") elem.value = parseInt((parseInt(elem.value) * compWidth) / 100);
 
100
        else elem.value = parseInt((parseInt(elem.value) * 100) / compWidth);
 
101
 
 
102
        // Kontrolle
 
103
        aios_checkWidthVal(mode);
 
104
}
 
105
 
 
106
 
 
107
/*
 
108
        Angaben zur Sidebarbreite pr�fen
 
109
                => Aufruf durch onBlur() der drei Textfelder, aios_changeWidthUnit(), aios_setConfSidebarWidth()
 
110
*/
 
111
function aios_checkWidthVal(mode) {
 
112
        var elem = document.getElementById('obj-' + mode + 'WidthVal');
 
113
        var theUnit = document.getElementById('obj-' + mode + 'WidthUnit').value;
 
114
 
 
115
        elem.value = parseInt(elem.value);
 
116
 
 
117
        // Kontrolle
 
118
        if(mode == "max") {
 
119
                if(theUnit == "px" && elem.value < 100) elem.value = 100;
 
120
                else if(theUnit == "%" && elem.value < 10) elem.value = 10;
 
121
        }
 
122
}
 
123
 
 
124
 
 
125
/*
 
126
        stellt die Gr��e der Sidebar ein
 
127
                => Aufruf durch aios_savePrefs() in prefs.js
 
128
*/
 
129
function aios_setConfSidebarWidth() {
 
130
        var elem, theUnit, theValue;
 
131
        var widthStyle = "";
 
132
        var modes = new Array('min', 'def', 'max');
 
133
 
 
134
        var browserWidth = aios_getBrowserWidth();
 
135
        var compWidth = browserWidth[3];
 
136
 
 
137
        for(var i = 0; i < modes.length; i++) {
 
138
                elem = document.getElementById('obj-' + modes[i] + 'WidthVal');
 
139
                theUnit = document.getElementById('obj-' + modes[i] + 'WidthUnit').value;
 
140
 
 
141
                // Kontrolle
 
142
                aios_checkWidthVal(modes[i]);
 
143
 
 
144
                theValue = elem.value;
 
145
 
 
146
                // Prozente in Px umrechnen (Angaben in % funktionieren hier nicht??)
 
147
                if(theUnit == "%") theValue = parseInt((compWidth * theValue) / 100);
 
148
 
 
149
                switch(modes[i]) {
 
150
                        case "min":     widthStyle+= 'min-width: ' + theValue + 'px !important; '; break;
 
151
                        case "def":     widthStyle+= 'width: ' + theValue + 'px !important; '; break;
 
152
                        case "max": widthStyle+= 'max-width: ' + theValue + 'px !important; '; break;
 
153
                }
 
154
        }
 
155
 
 
156
        aios_WIN.document.getElementById('sidebar').setAttribute('style', widthStyle);
 
157
        aios_WIN.document.persist('sidebar', 'style');
 
158
}
 
 
b'\\ No newline at end of file'