source: sandbox/filemanager/tp/fckeditor/editor/filemanager/browser/default/js/common.js @ 1575

Revision 1575, 1.9 KB checked in by amuller, 14 years ago (diff)

Ticket #597 - Implentação, melhorias do modulo gerenciador de arquivos

  • Property svn:executable set to *
Line 
1/*
2 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3 * Copyright (C) 2003-2009 Frederico Caldeira Knabben
4 *
5 * == BEGIN LICENSE ==
6 *
7 * Licensed under the terms of any of the following licenses at your
8 * choice:
9 *
10 *  - GNU General Public License Version 2 or later (the "GPL")
11 *    http://www.gnu.org/licenses/gpl.html
12 *
13 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
14 *    http://www.gnu.org/licenses/lgpl.html
15 *
16 *  - Mozilla Public License Version 1.1 or later (the "MPL")
17 *    http://www.mozilla.org/MPL/MPL-1.1.html
18 *
19 * == END LICENSE ==
20 *
21 * Common objects and functions shared by all pages that compose the
22 * File Browser dialog window.
23 */
24
25// Automatically detect the correct document.domain (#1919).
26(function()
27{
28        var d = document.domain ;
29
30        while ( true )
31        {
32                // Test if we can access a parent property.
33                try
34                {
35                        var test = window.top.opener.document.domain ;
36                        break ;
37                }
38                catch( e )
39                {}
40
41                // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
42                d = d.replace( /.*?(?:\.|$)/, '' ) ;
43
44                if ( d.length == 0 )
45                        break ;         // It was not able to detect the domain.
46
47                try
48                {
49                        document.domain = d ;
50                }
51                catch (e)
52                {
53                        break ;
54                }
55        }
56})() ;
57
58function AddSelectOption( selectElement, optionText, optionValue )
59{
60        var oOption = document.createElement("OPTION") ;
61
62        oOption.text    = optionText ;
63        oOption.value   = optionValue ;
64
65        selectElement.options.add(oOption) ;
66
67        return oOption ;
68}
69
70var oConnector  = window.parent.oConnector ;
71var oIcons              = window.parent.oIcons ;
72
73
74function StringBuilder( value )
75{
76    this._Strings = new Array( value || '' ) ;
77}
78
79StringBuilder.prototype.Append = function( value )
80{
81    if ( value )
82        this._Strings.push( value ) ;
83}
84
85StringBuilder.prototype.ToString = function()
86{
87    return this._Strings.join( '' ) ;
88}
Note: See TracBrowser for help on using the repository browser.