~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/xpfe/components/prefwindow/resources/content/pref-search.js

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * The contents of this file are subject to the Netscape Public
 
3
 * License Version 1.1 (the "License"); you may not use this file
 
4
 * except in compliance with the License. You may obtain a copy of
 
5
 * the License at http://www.mozilla.org/NPL/
 
6
 *
 
7
 * Software distributed under the License is distributed on an "AS
 
8
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 
9
 * implied. See the License for the specific language governing
 
10
 * rights and limitations under the License.
 
11
 *
 
12
 * The Original Code is Mozilla Communicator client code, released
 
13
 * March 31, 1998.
 
14
 *
 
15
 * The Initial Developer of the Original Code is Netscape
 
16
 * Communications Corporation. Portions created by Netscape are
 
17
 * Copyright (C) 1998-1999 Netscape Communications Corporation. All
 
18
 * Rights Reserved.
 
19
 *
 
20
 * Contributor(s):
 
21
 *   Robert John Churchill <rjc@netscape.com>
 
22
 *   Mark Olson <maolson@earthlink.net>
 
23
 */
 
24
 
 
25
 
 
26
function checkEngine()
 
27
{
 
28
  var engineList = document.getElementById("engineList");
 
29
  var engineValue = engineList.label;
 
30
  
 
31
  //nothing is selected
 
32
  if (!engineValue)
 
33
  {
 
34
 
 
35
    try
 
36
    {
 
37
        var strDefaultSearchEngineName = parent.hPrefWindow.getPref("localizedstring", "browser.search.defaultenginename");
 
38
 
 
39
        var engineListSelection = engineList.getElementsByAttribute( "label", strDefaultSearchEngineName );
 
40
        var selectedItem = engineListSelection.length ? engineListSelection[0] : null;
 
41
    
 
42
        if (selectedItem)
 
43
        {
 
44
            //select a locale-dependent predefined search engine in absence of a user default
 
45
            engineList.selectedItem = selectedItem;
 
46
        }
 
47
        else
 
48
        {
 
49
            //select the first listed search engine
 
50
            engineList.selectedIndex = 1;
 
51
        }
 
52
    }
 
53
 
 
54
    catch(e)
 
55
    {
 
56
        //select the first listed search engine
 
57
        engineList.selectedIndex = 1;
 
58
    }
 
59
 
 
60
  }
 
61
}
 
62