1 # -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 # ***** BEGIN LICENSE BLOCK *****
3 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 # The contents of this file are subject to the Mozilla Public License Version
6 # 1.1 (the "License"); you may not use this file except in compliance with
7 # the License. You may obtain a copy of the License at
8 # http://www.mozilla.org/MPL/
10 # Software distributed under the License is distributed on an "AS IS" basis,
11 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 # for the specific language governing rights and limitations under the
15 # The Original Code is the Firefox Preferences System.
17 # The Initial Developer of the Original Code is
19 # Portions created by the Initial Developer are Copyright (C) 2005
20 # the Initial Developer. All Rights Reserved.
23 # Ben Goodger <ben@mozilla.org>
24 # Asaf Romano <mozilla.mano@sent.com>
25 # Jeff Walden <jwalden+code@mit.edu>
27 # Alternatively, the contents of this file may be used under the terms of
28 # either the GNU General Public License Version 2 or later (the "GPL"), or
29 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 # in which case the provisions of the GPL or the LGPL are applicable instead
31 # of those above. If you wish to allow use of your version of this file only
32 # under the terms of either the GPL or the LGPL, and not to allow others to
33 # use your version of this file under the terms of the MPL, indicate your
34 # decision by deleting the provisions above and replace them with the notice
35 # and other provisions required by the GPL or the LGPL. If you do not delete
36 # the provisions above, a recipient may use your version of this file under
37 # the terms of any one of the MPL, the GPL or the LGPL.
39 # ***** END LICENSE BLOCK *****
49 var menulist = document.getElementById(
"defaultFont");
50 if (menulist.selectedIndex == -1) {
51 menulist.insertItemAt(0,
"",
"",
"");
52 menulist.selectedIndex = 0;
62 updateButtons:
function (aButtonID, aPreferenceID)
64 var button = document.getElementById(aButtonID);
65 var preference = document.getElementById(aPreferenceID);
66 button.disabled = preference.value !=
true;
74 popup: { blockVisible:
false, sessionVisible:
false, allowVisible:
true, prefilledHost:
"", permissionType:
"popup" },
75 image: { blockVisible:
true, sessionVisible:
false, allowVisible:
true, prefilledHost:
"", permissionType:
"image" }
82 _showExceptions:
function (aPermissionType)
84 var bundlePreferences = document.getElementById(
"bundlePreferences");
85 var params = this._exceptionsParams[aPermissionType];
86 params.windowTitle = bundlePreferences.getString(aPermissionType +
"permissionstitle");
87 params.introText = bundlePreferences.getString(aPermissionType +
"permissionstext");
88 document.documentElement.openWindow(
"Browser:Permissions",
89 "chrome://browser/content/preferences/permissions.xul",
117 showPopupExceptions:
function ()
119 this._showExceptions(
"popup");
129 readLoadImages:
function ()
131 var
pref = document.getElementById(
"permissions.default.image");
132 return (pref.value == 1 || pref.value == 3);
139 writeLoadImages:
function ()
141 return (document.getElementById(
"loadImages").checked) ? 1 : 2;
148 showImageExceptions:
function ()
150 this._showExceptions(
"image");
159 showAdvancedJS:
function ()
161 document.documentElement.openSubDialog(
"chrome://browser/content/preferences/advanced-scripts.xul",
170 _rebuildFonts:
function ()
172 var langGroupPref = document.getElementById(
"font.language.group");
173 this._selectDefaultLanguageGroup(langGroupPref.value,
174 this._readDefaultFontTypeForLanguage(langGroupPref.value) ==
"serif");
180 _selectDefaultLanguageGroup:
function (aLanguageGroup, aIsSerif)
191 fonttype : aIsSerif ?
"serif" :
"sans-serif" },
195 fonttype : aIsSerif ?
"serif" :
"sans-serif" },
200 var
preferences = document.getElementById(
"contentPreferences");
201 for (var
i = 0;
i < prefs.length; ++
i) {
202 var preference = document.getElementById(prefs[
i].format.replace(/%LANG%/, aLanguageGroup));
204 preference = document.createElement(
"preference");
205 var
name = prefs[
i].format.replace(/%LANG%/, aLanguageGroup);
206 preference.id =
name;
207 preference.setAttribute(
"name", name);
208 preference.setAttribute(
"type", prefs[
i].type);
209 preferences.appendChild(preference);
215 var element = document.getElementById(prefs[
i].element);
217 element.setAttribute(
"preference", preference.id);
219 if (prefs[
i].fonttype)
220 FontBuilder.buildFontList(aLanguageGroup, prefs[
i].fonttype, element);
222 preference.setElementValue(element);
231 _readDefaultFontTypeForLanguage:
function (aLanguageGroup)
234 var defaultFontTypePref =
kDefaultFontType.replace(/%LANG%/, aLanguageGroup);
235 var preference = document.getElementById(defaultFontTypePref);
237 preference = document.createElement(
"preference");
238 preference.id = defaultFontTypePref;
239 preference.setAttribute(
"name", defaultFontTypePref);
240 preference.setAttribute(
"type",
"string");
241 preference.setAttribute(
"onchange",
"gContentPane._rebuildFonts();");
242 document.getElementById(
"contentPreferences").appendChild(preference);
244 return preference.value;
251 configureFonts:
function ()
253 document.documentElement.openSubDialog(
"chrome://browser/content/preferences/fonts.xul",
261 configureColors:
function ()
263 document.documentElement.openSubDialog(
"chrome://browser/content/preferences/colors.xul",
272 showLanguages:
function ()
274 document.documentElement.openSubDialog(
"chrome://browser/content/preferences/languages.xul",
const kFontSizeFmtVariable
playlistfolders preferences
const kFontNameFmtSansSerif
const kFontNameListFmtSerif
const kFontNameListFmtSansSerif
_getSelectedPageStyle s i