PluginProbe
Wp-Insert / 1.2.2
Wp-Insert v1.2.2
trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.3.0 1.3.1 1.3.3 1.4 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 2.0 All 63 releases
wp-insert / fckeditor / editor / _source / classes / fckhtmliterator.js

fckhtmliterator.js in Wp-Insert 1.2.2, at fckeditor/editor/_source/classes/fckhtmliterator.js

143 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 * This class can be used to interate through nodes inside a range.
22 *
23 * During interation, the provided range can become invalid, due to document
24 * mutations, so CreateBookmark() used to restore it after processing, if
25 * needed.
26 */
27
28 var FCKHtmlIterator = function( source )
29 {
30 this._sourceHtml = source ;
31 }
32 FCKHtmlIterator.prototype =
33 {
34 Next : function()
35 {
36 var sourceHtml = this._sourceHtml ;
37 if ( sourceHtml == null )
38 return null ;
39
40 var match = FCKRegexLib.HtmlTag.exec( sourceHtml ) ;
41 var isTag = false ;
42 var value = "" ;
43 if ( match )
44 {
45 if ( match.index > 0 )
46 {
47 value = sourceHtml.substr( 0, match.index ) ;
48 this._sourceHtml = sourceHtml.substr( match.index ) ;
49 }
50 else
51 {
52 isTag = true ;
53 value = match[0] ;
54 this._sourceHtml = sourceHtml.substr( match[0].length ) ;
55 }
56 }
57 else
58 {
59 value = sourceHtml ;
60 this._sourceHtml = null ;
61 }
62 return { 'isTag' : isTag, 'value' : value } ;
63 },
64
65 Each : function( func )
66 {
67 var chunk ;
68 while ( ( chunk = this.Next() ) )
69 func( chunk.isTag, chunk.value ) ;
70 }
71 } ;
72 /*
73 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
74 * Copyright (C) 2003-2009 Frederico Caldeira Knabben
75 *
76 * == BEGIN LICENSE ==
77 *
78 * Licensed under the terms of any of the following licenses at your
79 * choice:
80 *
81 * - GNU General Public License Version 2 or later (the "GPL")
82 * http://www.gnu.org/licenses/gpl.html
83 *
84 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
85 * http://www.gnu.org/licenses/lgpl.html
86 *
87 * - Mozilla Public License Version 1.1 or later (the "MPL")
88 * http://www.mozilla.org/MPL/MPL-1.1.html
89 *
90 * == END LICENSE ==
91 *
92 * This class can be used to interate through nodes inside a range.
93 *
94 * During interation, the provided range can become invalid, due to document
95 * mutations, so CreateBookmark() used to restore it after processing, if
96 * needed.
97 */
98
99 var FCKHtmlIterator = function( source )
100 {
101 this._sourceHtml = source ;
102 }
103 FCKHtmlIterator.prototype =
104 {
105 Next : function()
106 {
107 var sourceHtml = this._sourceHtml ;
108 if ( sourceHtml == null )
109 return null ;
110
111 var match = FCKRegexLib.HtmlTag.exec( sourceHtml ) ;
112 var isTag = false ;
113 var value = "" ;
114 if ( match )
115 {
116 if ( match.index > 0 )
117 {
118 value = sourceHtml.substr( 0, match.index ) ;
119 this._sourceHtml = sourceHtml.substr( match.index ) ;
120 }
121 else
122 {
123 isTag = true ;
124 value = match[0] ;
125 this._sourceHtml = sourceHtml.substr( match[0].length ) ;
126 }
127 }
128 else
129 {
130 value = sourceHtml ;
131 this._sourceHtml = null ;
132 }
133 return { 'isTag' : isTag, 'value' : value } ;
134 },
135
136 Each : function( func )
137 {
138 var chunk ;
139 while ( ( chunk = this.Next() ) )
140 func( chunk.isTag, chunk.value ) ;
141 }
142 } ;
143