~ubuntu-branches/ubuntu/intrepid/moin/intrepid-updates

« back to all changes in this revision

Viewing changes to wiki/htdocs/applets/FCKeditor/fckeditor.js

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-02-14 16:09:24 UTC
  • mfrom: (0.2.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20060214160924-fyrx3gvknzqvt4vj
Tags: 1.5.2-1ubuntu1
Drop python2.3 package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
        this.CheckBrowser       = true ;
35
35
        this.DisplayErrors      = true ;
36
36
        this.EnableSafari       = false ;               // This is a temporary property, while Safari support is under development.
 
37
        this.EnableOpera        = false ;               // This is a temporary property, while Opera support is under development.
37
38
 
38
39
        this.Config                     = new Object() ;
39
40
 
46
47
        // Check for errors
47
48
        if ( !this.InstanceName || this.InstanceName.length == 0 )
48
49
        {
49
 
                this._ThrowError( 701, 'You must specify a instance name.' ) ;
 
50
                this._ThrowError( 701, 'You must specify an instance name.' ) ;
50
51
                return ;
51
52
        }
52
53
 
54
55
 
55
56
        if ( !this.CheckBrowser || this._IsCompatibleBrowser() )
56
57
        {
57
 
                document.write( '<input type="hidden" id="' + this.InstanceName + '" name="' + this.InstanceName + '" value="' + this._HTMLEncode( this.Value ) + '" />' ) ;
 
58
                document.write( '<input type="hidden" id="' + this.InstanceName + '" name="' + this.InstanceName + '" value="' + this._HTMLEncode( this.Value ) + '" style="display:none" />' ) ;
58
59
                document.write( this._GetConfigHtml() ) ;
59
60
                document.write( this._GetIFrameHtml() ) ;
60
61
        }
62
63
        {
63
64
                var sWidth  = this.Width.toString().indexOf('%')  > 0 ? this.Width  : this.Width  + 'px' ;
64
65
                var sHeight = this.Height.toString().indexOf('%') > 0 ? this.Height : this.Height + 'px' ;
65
 
                document.write('<textarea name="' + this.InstanceName + '" rows="4" cols="40" style="WIDTH: ' + sWidth + '; HEIGHT: ' + sHeight + '" wrap="virtual">' + this._HTMLEncode( this.Value ) + '<\/textarea>') ;
 
66
                document.write('<textarea name="' + this.InstanceName + '" rows="4" cols="40" style="WIDTH: ' + sWidth + '; HEIGHT: ' + sHeight + '">' + this._HTMLEncode( this.Value ) + '<\/textarea>') ;
66
67
        }
67
68
 
68
69
        document.write( '</div>' ) ;
72
73
{
73
74
        if ( !this.CheckBrowser || this._IsCompatibleBrowser() )
74
75
        {
 
76
                // We must check the elements firstly using the Id and then the name.
75
77
                var oTextarea = document.getElementById( this.InstanceName ) ;
 
78
                var colElementsByName = document.getElementsByName( this.InstanceName ) ;
 
79
                var i = 0;
 
80
                while ( oTextarea || i == 0 )
 
81
                {
 
82
                        if ( oTextarea && oTextarea.tagName == 'TEXTAREA' )
 
83
                                break ;
 
84
                        oTextarea = colElementsByName[i++] ;
 
85
                }
76
86
                
77
87
                if ( !oTextarea )
78
 
                        oTextarea = document.getElementsByName( this.InstanceName )[0] ;
79
 
                
80
 
                if ( !oTextarea || oTextarea.tagName != 'TEXTAREA' )
81
88
                {
82
 
                        alert( 'Error: The TEXTAREA id "' + this.InstanceName + '" was not found' ) ;
 
89
                        alert( 'Error: The TEXTAREA with id or name set to "' + this.InstanceName + '" was not found' ) ;
83
90
                        return ;
84
91
                }
85
92
 
111
118
                sConfig += escape(o) + '=' + escape( this.Config[o] ) ;
112
119
        }
113
120
 
114
 
        return '<input type="hidden" id="' + this.InstanceName + '___Config" value="' + sConfig + '" />' ;
 
121
        return '<input type="hidden" id="' + this.InstanceName + '___Config" value="' + sConfig + '" style="display:none" />' ;
115
122
}
116
123
 
117
124
FCKeditor.prototype._GetIFrameHtml = function()
127
134
FCKeditor.prototype._IsCompatibleBrowser = function()
128
135
{
129
136
        var sAgent = navigator.userAgent.toLowerCase() ;
130
 
 
 
137
        
131
138
        // Internet Explorer
132
139
        if ( sAgent.indexOf("msie") != -1 && sAgent.indexOf("mac") == -1 && sAgent.indexOf("opera") == -1 )
133
140
        {
134
141
                var sBrowserVersion = navigator.appVersion.match(/MSIE (.\..)/)[1] ;
135
142
                return ( sBrowserVersion >= 5.5 ) ;
136
143
        }
 
144
        
137
145
        // Gecko
138
 
        else if ( navigator.product == "Gecko" && navigator.productSub >= 20030210 )
 
146
        if ( navigator.product == "Gecko" && navigator.productSub >= 20030210 )
139
147
                return true ;
 
148
        
 
149
        // Opera
 
150
        if ( this.EnableOpera )
 
151
        {
 
152
                var aMatch = sAgent.match( /^opera\/(\d+\.\d+)/ ) ;
 
153
                if ( aMatch && aMatch[1] >= 9.0 )
 
154
                        return true ;
 
155
        }
 
156
        
140
157
        // Safari
141
 
        else if ( this.EnableSafari && sAgent.indexOf( 'safari' ) != -1 )
 
158
        if ( this.EnableSafari && sAgent.indexOf( 'safari' ) != -1 )
142
159
                return ( sAgent.match( /safari\/(\d+)/ )[1] >= 312 ) ;  // Build must be at least 312 (1.3)
143
 
        else
144
 
                return false ;
 
160
        
 
161
        return false ;
145
162
}
146
163
 
147
164
FCKeditor.prototype._ThrowError = function( errorNumber, errorDescription )