Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.hooks.php |
— | — | @@ -91,8 +91,7 @@ |
92 | 92 | 'edittoolbar-tool-table-dimensions', |
93 | 93 | 'edittoolbar-tool-table-dimensions-rows', |
94 | 94 | 'edittoolbar-tool-table-dimensions-columns', |
95 | | - 'edittoolbar-tool-table-dimensions-headerrows', |
96 | | - 'edittoolbar-tool-table-dimensions-headercolumns', |
| 95 | + 'edittoolbar-tool-table-dimensions-header', |
97 | 96 | 'edittoolbar-tool-table-insert', |
98 | 97 | 'edittoolbar-tool-table-cancel', |
99 | 98 | 'edittoolbar-tool-replace', |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js |
— | — | @@ -6,731 +6,1088 @@ |
7 | 7 | $j( '#toolbar' ).remove(); |
8 | 8 | // Build a wikiEditor around the textarea |
9 | 9 | $j( 'textarea#wpTextbox1' ).wikiEditor( { |
10 | | - 'dialogs': {}, |
11 | | - 'toolbar': { |
12 | | - // Main section |
13 | | - 'main': { |
14 | | - type: 'toolbar', |
15 | | - groups: { |
16 | | - 'format': { |
17 | | - tools: { |
18 | | - 'bold': { |
19 | | - labelMsg: 'edittoolbar-tool-bold', |
20 | | - type: 'button', |
21 | | - icon: 'format-bold.png', |
22 | | - action: { |
23 | | - type: 'encapsulate', |
24 | | - options: { |
25 | | - pre: "'''", |
26 | | - periMsg: 'edittoolbar-tool-bold-example', |
27 | | - post: "'''" |
28 | | - } |
29 | | - } |
30 | | - }, |
31 | | - 'italic': { |
32 | | - section: 'main', |
33 | | - group: 'format', |
34 | | - id: 'italic', |
35 | | - labelMsg: 'edittoolbar-tool-italic', |
36 | | - type: 'button', |
37 | | - icon: 'format-italic.png', |
38 | | - action: { |
39 | | - type: 'encapsulate', |
40 | | - options: { |
41 | | - pre: "''", |
42 | | - periMsg: 'edittoolbar-tool-italic-example', |
43 | | - post: "''" |
44 | | - } |
45 | | - } |
46 | | - } |
| 10 | + |
| 11 | +'toolbar': { |
| 12 | + // Main section |
| 13 | + 'main': { |
| 14 | + type: 'toolbar', |
| 15 | + groups: { |
| 16 | + 'format': { |
| 17 | + tools: { |
| 18 | + 'bold': { |
| 19 | + labelMsg: 'edittoolbar-tool-bold', |
| 20 | + type: 'button', |
| 21 | + icon: 'format-bold.png', |
| 22 | + action: { |
| 23 | + type: 'encapsulate', |
| 24 | + options: { |
| 25 | + pre: "'''", |
| 26 | + periMsg: 'edittoolbar-tool-bold-example', |
| 27 | + post: "'''" |
47 | 28 | } |
48 | | - }, |
49 | | - 'insert': { |
50 | | - tools: { |
51 | | - 'link': { |
52 | | - labelMsg: 'edittoolbar-tool-link', |
53 | | - type: 'button', |
54 | | - icon: 'insert-link.png', |
55 | | - action: { |
56 | | - type: 'dialog', |
57 | | - module: 'insert-link' |
58 | | - } |
59 | | - }, |
60 | | - 'file': { |
61 | | - labelMsg: 'edittoolbar-tool-file', |
62 | | - type: 'button', |
63 | | - icon: 'insert-file.png', |
64 | | - action: { |
65 | | - type: 'encapsulate', |
66 | | - options: { |
67 | | - pre: "[[", |
68 | | - preMsg: 'edittoolbar-tool-file-pre', |
69 | | - periMsg: 'edittoolbar-tool-file-example', |
70 | | - post: "]]" |
71 | | - } |
72 | | - } |
73 | | - }, |
74 | | - 'reference': { |
75 | | - labelMsg: 'edittoolbar-tool-reference', |
76 | | - filters: [ 'body.ns-subject' ], |
77 | | - type: 'button', |
78 | | - icon: 'insert-reference.png', |
79 | | - action: { |
80 | | - type: 'encapsulate', |
81 | | - options: { |
82 | | - pre: "<ref>", |
83 | | - periMsg: 'edittoolbar-tool-reference-example', |
84 | | - post: "</ref>" |
85 | | - } |
86 | | - } |
87 | | - }, |
88 | | - 'signature': { |
89 | | - labelMsg: 'edittoolbar-tool-signature', |
90 | | - filters: [ 'body:not(.ns-0)' ], |
91 | | - type: 'button', |
92 | | - icon: 'insert-signature.png', |
93 | | - action: { |
94 | | - type: 'encapsulate', |
95 | | - options: { |
96 | | - post: "--~~~~" |
97 | | - } |
98 | | - } |
99 | | - } |
| 29 | + } |
| 30 | + }, |
| 31 | + 'italic': { |
| 32 | + section: 'main', |
| 33 | + group: 'format', |
| 34 | + id: 'italic', |
| 35 | + labelMsg: 'edittoolbar-tool-italic', |
| 36 | + type: 'button', |
| 37 | + icon: 'format-italic.png', |
| 38 | + action: { |
| 39 | + type: 'encapsulate', |
| 40 | + options: { |
| 41 | + pre: "''", |
| 42 | + periMsg: 'edittoolbar-tool-italic-example', |
| 43 | + post: "''" |
100 | 44 | } |
101 | 45 | } |
102 | 46 | } |
103 | | - }, |
104 | | - // Format section |
105 | | - 'advanced': { |
106 | | - labelMsg: 'edittoolbar-section-advanced', |
107 | | - type: 'toolbar', |
108 | | - groups: { |
109 | | - 'heading': { |
110 | | - tools: { |
111 | | - 'heading': { |
112 | | - labelMsg: 'edittoolbar-tool-heading', |
113 | | - type: 'select', |
114 | | - list: { |
115 | | - 'heading-2' : { |
116 | | - labelMsg: 'edittoolbar-tool-heading-2', |
117 | | - action: { |
118 | | - type: 'encapsulate', |
119 | | - options: { |
120 | | - pre: "==", |
121 | | - periMsg: 'edittoolbar-tool-heading-example', |
122 | | - post: "==" |
123 | | - } |
124 | | - } |
125 | | - }, |
126 | | - 'heading-3' : { |
127 | | - labelMsg: 'edittoolbar-tool-heading-3', |
128 | | - action: { |
129 | | - type: 'encapsulate', |
130 | | - options: { |
131 | | - pre: "===", |
132 | | - periMsg: 'edittoolbar-tool-heading-example', |
133 | | - post: "===" |
134 | | - } |
135 | | - } |
136 | | - }, |
137 | | - 'heading-4' : { |
138 | | - labelMsg: 'edittoolbar-tool-heading-4', |
139 | | - action: { |
140 | | - type: 'encapsulate', |
141 | | - options: { |
142 | | - pre: "====", |
143 | | - periMsg: 'edittoolbar-tool-heading-example', |
144 | | - post: "====" |
145 | | - } |
146 | | - } |
147 | | - }, |
148 | | - 'heading-5' : { |
149 | | - labelMsg: 'edittoolbar-tool-heading-5', |
150 | | - action: { |
151 | | - type: 'encapsulate', |
152 | | - options: { |
153 | | - pre: "=====", |
154 | | - periMsg: 'edittoolbar-tool-heading-example', |
155 | | - post: "=====" |
156 | | - } |
157 | | - } |
158 | | - } |
159 | | - } |
160 | | - } |
| 47 | + } |
| 48 | + }, |
| 49 | + 'insert': { |
| 50 | + tools: { |
| 51 | + 'link': { |
| 52 | + labelMsg: 'edittoolbar-tool-link', |
| 53 | + type: 'button', |
| 54 | + icon: 'insert-link.png', |
| 55 | + action: { |
| 56 | + type: 'dialog', |
| 57 | + module: 'insert-link' |
| 58 | + } |
| 59 | + }, |
| 60 | + 'file': { |
| 61 | + labelMsg: 'edittoolbar-tool-file', |
| 62 | + type: 'button', |
| 63 | + icon: 'insert-file.png', |
| 64 | + action: { |
| 65 | + type: 'encapsulate', |
| 66 | + options: { |
| 67 | + pre: "[[", |
| 68 | + preMsg: 'edittoolbar-tool-file-pre', |
| 69 | + periMsg: 'edittoolbar-tool-file-example', |
| 70 | + post: "]]" |
161 | 71 | } |
162 | | - }, |
163 | | - 'list': { |
164 | | - labelMsg: 'edittoolbar-group-list', |
165 | | - tools: { |
166 | | - 'ulist': { |
167 | | - labelMsg: 'edittoolbar-tool-ulist', |
168 | | - type: 'button', |
169 | | - icon: 'format-ulist.png', |
170 | | - action: { |
171 | | - type: 'encapsulate', |
172 | | - options: { |
173 | | - pre: "* ", |
174 | | - periMsg: 'edittoolbar-tool-ulist-example', |
175 | | - post: "", |
176 | | - ownline: true |
177 | | - } |
178 | | - } |
179 | | - }, |
180 | | - 'olist': { |
181 | | - labelMsg: 'edittoolbar-tool-olist', |
182 | | - type: 'button', |
183 | | - icon: 'format-olist.png', |
184 | | - action: { |
185 | | - type: 'encapsulate', |
186 | | - options: { |
187 | | - pre: "# ", |
188 | | - periMsg: 'edittoolbar-tool-olist-example', |
189 | | - post: "", |
190 | | - ownline: true |
191 | | - } |
192 | | - } |
193 | | - } |
| 72 | + } |
| 73 | + }, |
| 74 | + 'reference': { |
| 75 | + labelMsg: 'edittoolbar-tool-reference', |
| 76 | + filters: [ 'body.ns-subject' ], |
| 77 | + type: 'button', |
| 78 | + icon: 'insert-reference.png', |
| 79 | + action: { |
| 80 | + type: 'encapsulate', |
| 81 | + options: { |
| 82 | + pre: "<ref>", |
| 83 | + periMsg: 'edittoolbar-tool-reference-example', |
| 84 | + post: "</ref>" |
194 | 85 | } |
195 | | - }, |
196 | | - 'size': { |
197 | | - labelMsg: 'edittoolbar-group-size', |
198 | | - tools: { |
199 | | - 'big': { |
200 | | - labelMsg: 'edittoolbar-tool-big', |
201 | | - type: 'button', |
202 | | - icon: 'format-big.png', |
203 | | - action: { |
204 | | - type: 'encapsulate', |
205 | | - options: { |
206 | | - pre: "<big>", |
207 | | - periMsg: 'edittoolbar-tool-big-example', |
208 | | - post: "</big>" |
209 | | - } |
| 86 | + } |
| 87 | + }, |
| 88 | + 'signature': { |
| 89 | + labelMsg: 'edittoolbar-tool-signature', |
| 90 | + filters: [ 'body:not(.ns-0)' ], |
| 91 | + type: 'button', |
| 92 | + icon: 'insert-signature.png', |
| 93 | + action: { |
| 94 | + type: 'encapsulate', |
| 95 | + options: { |
| 96 | + post: "--~~~~" |
| 97 | + } |
| 98 | + } |
| 99 | + } |
| 100 | + } |
| 101 | + } |
| 102 | + } |
| 103 | + }, |
| 104 | + // Format section |
| 105 | + 'advanced': { |
| 106 | + labelMsg: 'edittoolbar-section-advanced', |
| 107 | + type: 'toolbar', |
| 108 | + groups: { |
| 109 | + 'heading': { |
| 110 | + tools: { |
| 111 | + 'heading': { |
| 112 | + labelMsg: 'edittoolbar-tool-heading', |
| 113 | + type: 'select', |
| 114 | + list: { |
| 115 | + 'heading-2' : { |
| 116 | + labelMsg: 'edittoolbar-tool-heading-2', |
| 117 | + action: { |
| 118 | + type: 'encapsulate', |
| 119 | + options: { |
| 120 | + pre: "==", |
| 121 | + periMsg: 'edittoolbar-tool-heading-example', |
| 122 | + post: "==" |
210 | 123 | } |
211 | | - }, |
212 | | - 'small': { |
213 | | - labelMsg: 'edittoolbar-tool-small', |
214 | | - type: 'button', |
215 | | - icon: 'format-small.png', |
216 | | - action: { |
217 | | - type: 'encapsulate', |
218 | | - options: { |
219 | | - pre: "<small>", |
220 | | - periMsg: 'edittoolbar-tool-small-example', |
221 | | - post: "</small>" |
222 | | - } |
223 | | - } |
224 | 124 | } |
225 | | - } |
226 | | - }, |
227 | | - 'baseline': { |
228 | | - labelMsg: 'edittoolbar-group-baseline', |
229 | | - tools: { |
230 | | - 'superscript': { |
231 | | - labelMsg: 'edittoolbar-tool-superscript', |
232 | | - type: 'button', |
233 | | - icon: 'format-superscript.png', |
234 | | - action: { |
235 | | - type: 'encapsulate', |
236 | | - options: { |
237 | | - pre: "<sup>", |
238 | | - periMsg: 'edittoolbar-tool-superscript-example', |
239 | | - post: "</sup>" |
240 | | - } |
| 125 | + }, |
| 126 | + 'heading-3' : { |
| 127 | + labelMsg: 'edittoolbar-tool-heading-3', |
| 128 | + action: { |
| 129 | + type: 'encapsulate', |
| 130 | + options: { |
| 131 | + pre: "===", |
| 132 | + periMsg: 'edittoolbar-tool-heading-example', |
| 133 | + post: "===" |
241 | 134 | } |
242 | | - }, |
243 | | - 'subscript': { |
244 | | - labelMsg: 'edittoolbar-tool-subscript', |
245 | | - type: 'button', |
246 | | - icon: 'format-subscript.png', |
247 | | - action: { |
248 | | - type: 'encapsulate', |
249 | | - options: { |
250 | | - pre: "<sub>", |
251 | | - periMsg: 'edittoolbar-tool-subscript-example', |
252 | | - post: "</sub>" |
253 | | - } |
254 | | - } |
255 | 135 | } |
256 | | - } |
257 | | - }, |
258 | | - 'insert': { |
259 | | - labelMsg: 'edittoolbar-group-insert', |
260 | | - tools: { |
261 | | - 'gallery': { |
262 | | - labelMsg: 'edittoolbar-tool-gallery', |
263 | | - type: 'button', |
264 | | - icon: 'insert-gallery.png', |
265 | | - action: { |
266 | | - type: 'encapsulate', |
267 | | - options: { |
268 | | - pre: "<gallery>\n", |
269 | | - periMsg: 'edittoolbar-tool-gallery-example', |
270 | | - post: "\n</gallery>", |
271 | | - ownline: true |
272 | | - } |
| 136 | + }, |
| 137 | + 'heading-4' : { |
| 138 | + labelMsg: 'edittoolbar-tool-heading-4', |
| 139 | + action: { |
| 140 | + type: 'encapsulate', |
| 141 | + options: { |
| 142 | + pre: "====", |
| 143 | + periMsg: 'edittoolbar-tool-heading-example', |
| 144 | + post: "====" |
273 | 145 | } |
274 | | - }, |
275 | | - 'table': { |
276 | | - labelMsg: 'edittoolbar-tool-table', |
277 | | - type: 'button', |
278 | | - icon: 'insert-table.png', |
279 | | - action: { |
280 | | - type: 'dialog', |
281 | | - module: 'insert-table' |
282 | | - } |
283 | | - }, |
284 | | - 'newline': { |
285 | | - labelMsg: 'edittoolbar-tool-newline', |
286 | | - type: 'button', |
287 | | - icon: 'insert-newline.png', |
288 | | - action: { |
289 | | - type: 'encapsulate', |
290 | | - options: { |
291 | | - pre: "<br />\n" |
292 | | - } |
293 | | - } |
294 | 146 | } |
295 | | - } |
296 | | - }, |
297 | | - 'search': { |
298 | | - tools: { |
299 | | - 'replace': { |
300 | | - labelMsg: 'edittoolbar-tool-replace', |
301 | | - type: 'button', |
302 | | - icon: 'search-replace.png', |
303 | | - action: { |
304 | | - type: 'dialog', |
305 | | - module: 'search-and-replace' |
| 147 | + }, |
| 148 | + 'heading-5' : { |
| 149 | + labelMsg: 'edittoolbar-tool-heading-5', |
| 150 | + action: { |
| 151 | + type: 'encapsulate', |
| 152 | + options: { |
| 153 | + pre: "=====", |
| 154 | + periMsg: 'edittoolbar-tool-heading-example', |
| 155 | + post: "=====" |
306 | 156 | } |
307 | 157 | } |
308 | 158 | } |
309 | 159 | } |
310 | 160 | } |
311 | | - }, |
312 | | - 'characters': { |
313 | | - labelMsg: 'edittoolbar-section-characters', |
314 | | - type: 'booklet', |
315 | | - pages: { |
316 | | - 'latin': { |
317 | | - 'labelMsg': 'edittoolbar-characters-page-latin', |
318 | | - 'layout': 'characters', |
319 | | - 'characters': [ |
320 | | - "\u00c1", "\u00e1", "\u00c0", "\u00e0", "\u00c2", "\u00e2", "\u00c4", "\u00e4", |
321 | | - "\u00c3", "\u00e3", "\u01cd", "\u01ce", "\u0100", "\u0101", "\u0102", "\u0103", |
322 | | - "\u0104", "\u0105", "\u00c5", "\u00e5", "\u0106", "\u0107", "\u0108", "\u0109", |
323 | | - "\u00c7", "\u00e7", "\u010c", "\u010d", "\u010a", "\u010b", "\u0110", "\u0111", |
324 | | - "\u010e", "\u010f", "\u00c9", "\u00e9", "\u00c8", "\u00e8", "\u00ca", "\u00ea", |
325 | | - "\u00cb", "\u00eb", "\u011a", "\u011b", "\u0112", "\u0113", "\u0114", "\u0115", |
326 | | - "\u0116", "\u0117", "\u0118", "\u0119", "\u011c", "\u011d", "\u0122", "\u0123", |
327 | | - "\u011e", "\u011f", "\u0120", "\u0121", "\u0124", "\u0125", "\u0126", "\u0127", |
328 | | - "\u00cd", "\u00ed", "\u00cc", "\u00ec", "\u00ce", "\u00ee", "\u00cf", "\u00ef", |
329 | | - "\u0128", "\u0129", "\u01cf", "\u01d0", "\u012a", "\u012b", "\u012c", "\u012d", |
330 | | - "\u0130", "\u0131", "\u012e", "\u012f", "\u0134", "\u0135", "\u0136", "\u0137", |
331 | | - "\u0139", "\u013a", "\u013b", "\u013c", "\u013d", "\u013e", "\u0141", "\u0142", |
332 | | - "\u013f", "\u0140", "\u0143", "\u0144", "\u00d1", "\u00f1", "\u0145", "\u0146", |
333 | | - "\u0147", "\u0148", "\u00d3", "\u00f3", "\u00d2", "\u00f2", "\u00d4", "\u00f4", |
334 | | - "\u00d6", "\u00f6", "\u00d5", "\u00f5", "\u01d1", "\u01d2", "\u014c", "\u014d", |
335 | | - "\u014e", "\u014f", "\u01ea", "\u01eb", "\u0150", "\u0151", "\u0154", "\u0155", |
336 | | - "\u0156", "\u0157", "\u0158", "\u0159", "\u015a", "\u015b", "\u015c", "\u015d", |
337 | | - "\u015e", "\u015f", "\u0160", "\u0161", "\u0162", "\u0163", "\u0164", "\u0165", |
338 | | - "\u00da", "\u00fa", "\u00d9", "\u00f9", "\u00db", "\u00fb", "\u00dc", "\u00fc", |
339 | | - "\u0168", "\u0169", "\u016e", "\u016f", "\u01d3", "\u01d4", "\u016a", "\u016b", |
340 | | - "\u01d6", "\u01d8", "\u01da", "\u01dc", "\u016c", "\u016d", "\u0172", "\u0173", |
341 | | - "\u0170", "\u0171", "\u0174", "\u0175", "\u00dd", "\u00fd", "\u0176", "\u0177", |
342 | | - "\u0178", "\u00ff", "\u0232", "\u0233", "\u0179", "\u017a", "\u017d", "\u017e", |
343 | | - "\u017b", "\u017c", "\u00c6", "\u00e6", "\u01e2", "\u01e3", "\u00d8", "\u00f8", |
344 | | - "\u0152", "\u0153", "\u00df", "\u00f0", "\u00de", "\u00fe", "\u018f", "\u0259" |
345 | | - ] |
| 161 | + } |
| 162 | + }, |
| 163 | + 'list': { |
| 164 | + labelMsg: 'edittoolbar-group-list', |
| 165 | + tools: { |
| 166 | + 'ulist': { |
| 167 | + labelMsg: 'edittoolbar-tool-ulist', |
| 168 | + type: 'button', |
| 169 | + icon: 'format-ulist.png', |
| 170 | + action: { |
| 171 | + type: 'encapsulate', |
| 172 | + options: { |
| 173 | + pre: "* ", |
| 174 | + periMsg: 'edittoolbar-tool-ulist-example', |
| 175 | + post: "", |
| 176 | + ownline: true |
| 177 | + } |
| 178 | + } |
| 179 | + }, |
| 180 | + 'olist': { |
| 181 | + labelMsg: 'edittoolbar-tool-olist', |
| 182 | + type: 'button', |
| 183 | + icon: 'format-olist.png', |
| 184 | + action: { |
| 185 | + type: 'encapsulate', |
| 186 | + options: { |
| 187 | + pre: "# ", |
| 188 | + periMsg: 'edittoolbar-tool-olist-example', |
| 189 | + post: "", |
| 190 | + ownline: true |
| 191 | + } |
| 192 | + } |
| 193 | + } |
| 194 | + } |
| 195 | + }, |
| 196 | + 'size': { |
| 197 | + labelMsg: 'edittoolbar-group-size', |
| 198 | + tools: { |
| 199 | + 'big': { |
| 200 | + labelMsg: 'edittoolbar-tool-big', |
| 201 | + type: 'button', |
| 202 | + icon: 'format-big.png', |
| 203 | + action: { |
| 204 | + type: 'encapsulate', |
| 205 | + options: { |
| 206 | + pre: "<big>", |
| 207 | + periMsg: 'edittoolbar-tool-big-example', |
| 208 | + post: "</big>" |
| 209 | + } |
| 210 | + } |
| 211 | + }, |
| 212 | + 'small': { |
| 213 | + labelMsg: 'edittoolbar-tool-small', |
| 214 | + type: 'button', |
| 215 | + icon: 'format-small.png', |
| 216 | + action: { |
| 217 | + type: 'encapsulate', |
| 218 | + options: { |
| 219 | + pre: "<small>", |
| 220 | + periMsg: 'edittoolbar-tool-small-example', |
| 221 | + post: "</small>" |
| 222 | + } |
| 223 | + } |
| 224 | + } |
| 225 | + } |
| 226 | + }, |
| 227 | + 'baseline': { |
| 228 | + labelMsg: 'edittoolbar-group-baseline', |
| 229 | + tools: { |
| 230 | + 'superscript': { |
| 231 | + labelMsg: 'edittoolbar-tool-superscript', |
| 232 | + type: 'button', |
| 233 | + icon: 'format-superscript.png', |
| 234 | + action: { |
| 235 | + type: 'encapsulate', |
| 236 | + options: { |
| 237 | + pre: "<sup>", |
| 238 | + periMsg: 'edittoolbar-tool-superscript-example', |
| 239 | + post: "</sup>" |
| 240 | + } |
| 241 | + } |
| 242 | + }, |
| 243 | + 'subscript': { |
| 244 | + labelMsg: 'edittoolbar-tool-subscript', |
| 245 | + type: 'button', |
| 246 | + icon: 'format-subscript.png', |
| 247 | + action: { |
| 248 | + type: 'encapsulate', |
| 249 | + options: { |
| 250 | + pre: "<sub>", |
| 251 | + periMsg: 'edittoolbar-tool-subscript-example', |
| 252 | + post: "</sub>" |
| 253 | + } |
| 254 | + } |
| 255 | + } |
| 256 | + } |
| 257 | + }, |
| 258 | + 'insert': { |
| 259 | + labelMsg: 'edittoolbar-group-insert', |
| 260 | + tools: { |
| 261 | + 'gallery': { |
| 262 | + labelMsg: 'edittoolbar-tool-gallery', |
| 263 | + type: 'button', |
| 264 | + icon: 'insert-gallery.png', |
| 265 | + action: { |
| 266 | + type: 'encapsulate', |
| 267 | + options: { |
| 268 | + pre: "<gallery>\n", |
| 269 | + periMsg: 'edittoolbar-tool-gallery-example', |
| 270 | + post: "\n</gallery>", |
| 271 | + ownline: true |
| 272 | + } |
| 273 | + } |
| 274 | + }, |
| 275 | + 'table': { |
| 276 | + labelMsg: 'edittoolbar-tool-table', |
| 277 | + type: 'button', |
| 278 | + icon: 'insert-table.png', |
| 279 | + action: { |
| 280 | + type: 'dialog', |
| 281 | + module: 'insert-table' |
| 282 | + } |
| 283 | + }, |
| 284 | + 'newline': { |
| 285 | + labelMsg: 'edittoolbar-tool-newline', |
| 286 | + type: 'button', |
| 287 | + icon: 'insert-newline.png', |
| 288 | + action: { |
| 289 | + type: 'encapsulate', |
| 290 | + options: { |
| 291 | + pre: "<br />\n" |
| 292 | + } |
| 293 | + } |
| 294 | + } |
| 295 | + } |
| 296 | + }, |
| 297 | + 'search': { |
| 298 | + tools: { |
| 299 | + 'replace': { |
| 300 | + labelMsg: 'edittoolbar-tool-replace', |
| 301 | + type: 'button', |
| 302 | + icon: 'search-replace.png', |
| 303 | + action: { |
| 304 | + type: 'dialog', |
| 305 | + module: 'search-and-replace' |
| 306 | + } |
| 307 | + } |
| 308 | + } |
| 309 | + } |
| 310 | + } |
| 311 | + }, |
| 312 | + 'characters': { |
| 313 | + labelMsg: 'edittoolbar-section-characters', |
| 314 | + type: 'booklet', |
| 315 | + pages: { |
| 316 | + 'latin': { |
| 317 | + 'labelMsg': 'edittoolbar-characters-page-latin', |
| 318 | + 'layout': 'characters', |
| 319 | + 'characters': [ |
| 320 | + "\u00c1", "\u00e1", "\u00c0", "\u00e0", "\u00c2", "\u00e2", "\u00c4", "\u00e4", "\u00c3", "\u00e3", |
| 321 | + "\u01cd", "\u01ce", "\u0100", "\u0101", "\u0102", "\u0103", "\u0104", "\u0105", "\u00c5", "\u00e5", |
| 322 | + "\u0106", "\u0107", "\u0108", "\u0109", "\u00c7", "\u00e7", "\u010c", "\u010d", "\u010a", "\u010b", |
| 323 | + "\u0110", "\u0111", "\u010e", "\u010f", "\u00c9", "\u00e9", "\u00c8", "\u00e8", "\u00ca", "\u00ea", |
| 324 | + "\u00cb", "\u00eb", "\u011a", "\u011b", "\u0112", "\u0113", "\u0114", "\u0115", "\u0116", "\u0117", |
| 325 | + "\u0118", "\u0119", "\u011c", "\u011d", "\u0122", "\u0123", "\u011e", "\u011f", "\u0120", "\u0121", |
| 326 | + "\u0124", "\u0125", "\u0126", "\u0127", "\u00cd", "\u00ed", "\u00cc", "\u00ec", "\u00ce", "\u00ee", |
| 327 | + "\u00cf", "\u00ef", "\u0128", "\u0129", "\u01cf", "\u01d0", "\u012a", "\u012b", "\u012c", "\u012d", |
| 328 | + "\u0130", "\u0131", "\u012e", "\u012f", "\u0134", "\u0135", "\u0136", "\u0137", "\u0139", "\u013a", |
| 329 | + "\u013b", "\u013c", "\u013d", "\u013e", "\u0141", "\u0142", "\u013f", "\u0140", "\u0143", "\u0144", |
| 330 | + "\u00d1", "\u00f1", "\u0145", "\u0146", "\u0147", "\u0148", "\u00d3", "\u00f3", "\u00d2", "\u00f2", |
| 331 | + "\u00d4", "\u00f4", "\u00d6", "\u00f6", "\u00d5", "\u00f5", "\u01d1", "\u01d2", "\u014c", "\u014d", |
| 332 | + "\u014e", "\u014f", "\u01ea", "\u01eb", "\u0150", "\u0151", "\u0154", "\u0155", "\u0156", "\u0157", |
| 333 | + "\u0158", "\u0159", "\u015a", "\u015b", "\u015c", "\u015d", "\u015e", "\u015f", "\u0160", "\u0161", |
| 334 | + "\u0162", "\u0163", "\u0164", "\u0165", "\u00da", "\u00fa", "\u00d9", "\u00f9", "\u00db", "\u00fb", |
| 335 | + "\u00dc", "\u00fc", "\u0168", "\u0169", "\u016e", "\u016f", "\u01d3", "\u01d4", "\u016a", "\u016b", |
| 336 | + "\u01d6", "\u01d8", "\u01da", "\u01dc", "\u016c", "\u016d", "\u0172", "\u0173", "\u0170", "\u0171", |
| 337 | + "\u0174", "\u0175", "\u00dd", "\u00fd", "\u0176", "\u0177", "\u0178", "\u00ff", "\u0232", "\u0233", |
| 338 | + "\u0179", "\u017a", "\u017d", "\u017e", "\u017b", "\u017c", "\u00c6", "\u00e6", "\u01e2", "\u01e3", |
| 339 | + "\u00d8", "\u00f8", "\u0152", "\u0153", "\u00df", "\u00f0", "\u00de", "\u00fe", "\u018f", "\u0259" |
| 340 | + ] |
| 341 | + }, |
| 342 | + 'latinextended': { |
| 343 | + 'labelMsg': 'edittoolbar-characters-page-latinextended', |
| 344 | + 'layout': 'characters', |
| 345 | + 'characters': [ |
| 346 | + "\u1e00", "\u1e01", "\u1e9a", "\u1ea0", "\u1ea1", "\u1ea2", "\u1ea3", "\u1ea4", "\u1ea5", "\u1ea6", |
| 347 | + "\u1ea7", "\u1ea8", "\u1ea9", "\u1eaa", "\u1eab", "\u1eac", "\u1ead", "\u1eae", "\u1eaf", "\u1eb0", |
| 348 | + "\u1eb1", "\u1eb2", "\u1eb3", "\u1eb4", "\u1eb5", "\u1eb6", "\u1eb7", "\u1e02", "\u1e03", "\u1e04", |
| 349 | + "\u1e05", "\u1e06", "\u1e07", "\u1e08", "\u1e09", "\u1e0a", "\u1e0b", "\u1e0c", "\u1e0d", "\u1e0e", |
| 350 | + "\u1e0f", "\u1e10", "\u1e11", "\u1e12", "\u1e13", "\u1e14", "\u1e15", "\u1e16", "\u1e17", "\u1e18", |
| 351 | + "\u1e19", "\u1e1a", "\u1e1b", "\u1e1c", "\u1e1d", "\u1eb8", "\u1eb9", "\u1eba", "\u1ebb", "\u1ebc", |
| 352 | + "\u1ebd", "\u1ebe", "\u1ebf", "\u1ec0", "\u1ec1", "\u1ec2", "\u1ec3", "\u1ec4", "\u1ec5", "\u1ec6", |
| 353 | + "\u1ec7", "\u1e1e", "\u1e1f", "\u1e20", "\u1e21", "\u1e22", "\u1e23", "\u1e24", "\u1e25", "\u1e26", |
| 354 | + "\u1e27", "\u1e28", "\u1e29", "\u1e2a", "\u1e2b", "\u1e96", "\u1e2c", "\u1e2d", "\u1e2e", "\u1e2f", |
| 355 | + "\u1ec8", "\u1ec9", "\u1eca", "\u1ecb", "\u1e30", "\u1e31", "\u1e32", "\u1e33", "\u1e34", "\u1e35", |
| 356 | + "\u1e36", "\u1e37", "\u1e38", "\u1e39", "\u1e3a", "\u1e3b", "\u1e3c", "\u1e3d", "\u1efa", "\u1efb", |
| 357 | + "\u1e3e", "\u1e3f", "\u1e40", "\u1e41", "\u1e42", "\u1e43", "\u1e44", "\u1e45", "\u1e46", "\u1e47", |
| 358 | + "\u1e48", "\u1e49", "\u1e4a", "\u1e4b", "\u1e4c", "\u1e4d", "\u1e4e", "\u1e4f", "\u1e50", "\u1e51", |
| 359 | + "\u1e52", "\u1e53", "\u1ecc", "\u1ecd", "\u1ece", "\u1ecf", "\u1ed0", "\u1ed1", "\u1ed2", "\u1ed3", |
| 360 | + "\u1ed4", "\u1ed5", "\u1ed6", "\u1ed7", "\u1ed8", "\u1ed9", "\u1eda", "\u1edb", "\u1edc", "\u1edd", |
| 361 | + "\u1ede", "\u1edf", "\u1ee0", "\u1ee1", "\u1ee2", "\u1ee3", "\u1e54", "\u1e55", "\u1e56", "\u1e57", |
| 362 | + "\u1e58", "\u1e59", "\u1e5a", "\u1e5b", "\u1e5c", "\u1e5d", "\u1e5e", "\u1e5f", "\u1e60", "\u1e61", |
| 363 | + "\u1e9b", "\u1e62", "\u1e63", "\u1e64", "\u1e65", "\u1e66", "\u1e67", "\u1e68", "\u1e69", "\u1e9c", |
| 364 | + "\u1e9d", "\u1e6a", "\u1e6b", "\u1e6c", "\u1e6d", "\u1e6e", "\u1e6f", "\u1e70", "\u1e71", "\u1e97", |
| 365 | + "\u1e72", "\u1e73", "\u1e74", "\u1e75", "\u1e76", "\u1e77", "\u1e78", "\u1e79", "\u1e7a", "\u1e7b", |
| 366 | + "\u1ee4", "\u1ee5", "\u1ee6", "\u1ee7", "\u1ee8", "\u1ee9", "\u1eea", "\u1eeb", "\u1eec", "\u1eed", |
| 367 | + "\u1eee", "\u1eef", "\u1ef0", "\u1ef1", "\u1e7c", "\u1e7d", "\u1e7e", "\u1e7f", "\u1efc", "\u1efd", |
| 368 | + "\u1e80", "\u1e81", "\u1e82", "\u1e83", "\u1e84", "\u1e85", "\u1e86", "\u1e87", "\u1e88", "\u1e89", |
| 369 | + "\u1e98", "\u1e8a", "\u1e8b", "\u1e8c", "\u1e8d", "\u1e8e", "\u1e8f", "\u1e99", "\u1ef2", "\u1ef3", |
| 370 | + "\u1ef4", "\u1ef5", "\u1ef6", "\u1ef7", "\u1ef8", "\u1ef9", "\u1efe", "\u1eff", "\u1e90", "\u1e91", |
| 371 | + "\u1e92", "\u1e93", "\u1e94", "\u1e95", "\u1e9e", "\u1e9f" |
| 372 | + ] |
| 373 | + }, |
| 374 | + 'ipa': { |
| 375 | + labelMsg: 'edittoolbar-characters-page-ipa', |
| 376 | + layout: 'characters', |
| 377 | + characters: [ |
| 378 | + "p", "t\u032a", "t", "\u0288", "c", "k", "q", "\u02a1", "\u0294", "b","d\u032a", "d", "\u0256", |
| 379 | + "\u025f", "\u0261", "\u0262", "\u0253", "\u0257", "\u0284", "\u0260", "\u029b", "t\u0361s", |
| 380 | + "t\u0361\u0283", "t\u0361\u0255", "d\u0361z", "d\u0361\u0292", "d\u0361\u0291", "\u0278", "f", |
| 381 | + "\u03b8", "s", "\u0283", "\u0285", "\u0286", "\u0282", "\u0255", "\u00e7", "\u0267", "x", "\u03c7", |
| 382 | + "\u0127", "\u029c", "h", "\u03b2", "v", "\u028d", "\u00f0", "z", "\u0292", "\u0293", "\u0290", |
| 383 | + "\u0291", "\u029d", "\u0263", "\u0281", "\u0295", "\u0296", "\u02a2", "\u0266", "\u026c", "\u026e", |
| 384 | + "m", "m\u0329", "\u0271", "\u0271\u0329", "\u0271\u030d", "n\u032a", "n\u032a\u030d", "n", |
| 385 | + "n\u0329", "\u0273", "\u0273\u0329", "\u0272", "\u0272\u0329", "\u014b", "\u014b\u030d", |
| 386 | + "\u014b\u0329", "\u0274", "\u0274\u0329", "\u0299", "\u0299\u0329", "r", "r\u0329", "\u0280", |
| 387 | + "\u0280\u0329", "\u027e", "\u027d", "\u027f", "\u027a", "l\u032a", "l\u032a\u0329", "l", "l\u0329", |
| 388 | + "\u026b", "\u026b\u0329", "\u026d", "\u026d\u0329", "\u028e", "\u028e\u0329", "\u029f", |
| 389 | + "\u029f\u0329", "w", "\u0265", "\u028b", "\u0279", "\u027b", "j", "\u0270", "\u0298", "\u01c2", |
| 390 | + "\u01c0", "!", "\u01c1", "\u02b0", "\u02b1", "\u02b7", "\u02b8", "\u02b2", "\u02b3", "\u207f", |
| 391 | + "\u02e1", "\u02b4", "\u02b5", "\u02e2", "\u02e3", "\u02e0", "\u02b6", "\u02e4", "\u02c1", "\u02c0", |
| 392 | + "\u02bc", "i", "i\u032f", "\u0129", "y", "y\u032f", "\u1ef9", "\u026a", "\u026a\u032f", |
| 393 | + "\u026a\u0303", "\u028f", "\u028f\u032f", "\u028f\u0303", "\u0268", "\u0268\u032f", "\u0268\u0303", |
| 394 | + "\u0289", "\u0289\u032f", "\u0289\u0303", "\u026f", "\u026f\u032f", "\u026f\u0303", "u", "u\u032f", |
| 395 | + "\u0169", "\u028a", "\u028a\u032f", "\u028a\u0303", "e", "e\u032f", "\u1ebd", "\u00f8", |
| 396 | + "\u00f8\u032f", "\u00f8\u0303", "\u0258", "\u0258\u032f", "\u0258\u0303", "\u0275", "\u0275\u032f", |
| 397 | + "\u0275\u0303", "\u0264", "\u0264\u032f", "\u0264\u0303", "o", "o\u032f", "\u00f5", "\u025b", |
| 398 | + "\u025b\u032f", "\u025b\u0303", "\u0153", "\u0153\u032f", "\u0153\u0303", "\u025c", "\u025c\u032f", |
| 399 | + "\u025c\u0303", "\u0259", "\u0259\u032f", "\u0259\u0303", "\u025e", "\u025e\u032f", "\u025e\u0303", |
| 400 | + "\u028c", "\u028c\u032f", "\u028c\u0303", "\u0254", "\u0254\u032f", "\u0254\u0303", "\u00e6", |
| 401 | + "\u00e6\u032f", "\u00e6\u0303", "\u0276", "\u0276\u032f", "\u0276\u0303", "a", "a\u032f", "\u00e3", |
| 402 | + "\u0250", "\u0250\u032f", "\u0250\u0303", "\u0251", "\u0251\u032f", "\u0251\u0303", "\u0252", |
| 403 | + "\u0252\u032f", "\u0252\u0303", "\u02c8", "\u02cc", "\u02d0", "\u02d1", "\u02d8", ".", "\u203f", |
| 404 | + "|", "\u2016" |
| 405 | + ] |
| 406 | + }, |
| 407 | + 'symbols': { |
| 408 | + 'labelMsg': 'edittoolbar-characters-page-symbols', |
| 409 | + 'layout': 'characters', |
| 410 | + 'characters': [ |
| 411 | + "~", "|", "\u00a1", "\u00bf", "\u2020", "\u2021", "\u2194", "\u2191", "\u2193", "\u2022", "\u00b6", |
| 412 | + "#", "\u00bd", "\u2153", "\u2154", "\u00bc", "\u00be", "\u215b", "\u215c", "\u215d", "\u215e", |
| 413 | + "\u221e", "\u2018", "\u201c", "\u2019", "\u201d", |
| 414 | + { |
| 415 | + 'label': "\u00ab\u00bb", |
| 416 | + 'action': { |
| 417 | + 'type': 'encapsulate', 'options': { 'pre': "\u00ab", 'post': "\u00bb" } |
| 418 | + } |
| 419 | + }, |
| 420 | + "\u00a4", "\u20b3", "\u0e3f", "\u20b5", "\u00a2", "\u20a1", "\u20a2", "$", "\u20ab", "\u20af", |
| 421 | + "\u20ac", "\u20a0", "\u20a3", "\u0192", "\u20b4", "\u20ad", "\u20a4", "\u2133", "\u20a5", "\u20a6", |
| 422 | + "\u2116", "\u20a7", "\u20b0", "\u00a3", "\u17db", "\u20a8", "\u20aa", "\u09f3", "\u20ae", "\u20a9", |
| 423 | + "\u00a5", "\u2660", "\u2663", "\u2665", "\u2666", "m\u00b2", "m\u00b3", "\u2013", "\u2014", |
| 424 | + "\u2026", "\u2018", "\u201c", "\u2019", "\u201d", "\u00b0", "\u2033", "\u2032", "\u2248", "\u2260", |
| 425 | + "\u2264", "\u2265", "\u00b1", "\u2212", "\u00d7", "\u00f7", "\u2190", "\u2192", "\u00b7", "\u00a7" |
| 426 | + ] |
| 427 | + }, |
| 428 | + 'greek': { |
| 429 | + 'labelMsg': 'edittoolbar-characters-page-greek', |
| 430 | + 'layout': 'characters', |
| 431 | + 'language': 'hl', |
| 432 | + 'characters': [ |
| 433 | + "\u0391", "\u0386", "\u03b1", "\u03ac", "\u0392", "\u03b2", "\u0393", "\u03b3", "\u0394", "\u03b4", |
| 434 | + "\u0395", "\u0388", "\u03b5", "\u03ad", "\u0396", "\u03b6", "\u0397", "\u0389", "\u03b7", "\u03ae", |
| 435 | + "\u0398", "\u03b8", "\u0399", "\u038a", "\u03b9", "\u03af", "\u039a", "\u03ba", "\u039b", "\u03bb", |
| 436 | + "\u039c", "\u03bc", "\u039d", "\u03bd", "\u039e", "\u03be", "\u039f", "\u038c", "\u03bf", "\u03cc", |
| 437 | + "\u03a0", "\u03c0", "\u03a1", "\u03c1", "\u03a3", "\u03c3", "\u03c2", "\u03a4", "\u03c4", "\u03a5", |
| 438 | + "\u038e", "\u03c5", "\u03cd", "\u03a6", "\u03c6", "\u03a7", "\u03c7", "\u03a8", "\u03c8", "\u03a9", |
| 439 | + "\u038f", "\u03c9", "\u03ce" |
| 440 | + ] |
| 441 | + }, |
| 442 | + 'cyrillic': { |
| 443 | + 'labelMsg': 'edittoolbar-characters-page-cyrillic', |
| 444 | + 'layout': 'characters', |
| 445 | + 'characters': [ |
| 446 | + "\u0410", "\u0430", "\u04d8", "\u04d9", "\u0411", "\u0431", "\u0412", "\u0432", "\u0413", "\u0433", |
| 447 | + "\u0490", "\u0491", "\u0403", "\u0453", "\u0492", "\u0493", "\u0414", "\u0434", "\u0402", "\u0452", |
| 448 | + "\u0415", "\u0435", "\u0404", "\u0454", "\u0401", "\u0451", "\u0416", "\u0436", "\u0417", "\u0437", |
| 449 | + "\u0405", "\u0455", "\u0418", "\u0438", "\u0406", "\u0456", "\u0407", "\u0457", "\u0130", "\u0419", |
| 450 | + "\u0439", "\u04e2", "\u04e3", "\u0408", "\u0458", "\u041a", "\u043a", "\u040c", "\u045c", "\u049a", |
| 451 | + "\u049b", "\u041b", "\u043b", "\u0409", "\u0459", "\u041c", "\u043c", "\u041d", "\u043d", "\u040a", |
| 452 | + "\u045a", "\u04a2", "\u04a3", "\u041e", "\u043e", "\u04e8", "\u04e9", "\u041f", "\u043f", "\u0420", |
| 453 | + "\u0440", "\u0421", "\u0441", "\u0422", "\u0442", "\u040b", "\u045b", "\u0423", "\u0443", "\u040e", |
| 454 | + "\u045e", "\u04ee", "\u04ef", "\u04b0", "\u04b1", "\u04ae", "\u04af", "\u0424", "\u0444", "\u0425", |
| 455 | + "\u0445", "\u04b2", "\u04b3", "\u04ba", "\u04bb", "\u0426", "\u0446", "\u0427", "\u0447", "\u04b6", |
| 456 | + "\u04b7", "\u040f", "\u045f", "\u0428", "\u0448", "\u0429", "\u0449", "\u042a", "\u044a", "\u042b", |
| 457 | + "\u044b", "\u042c", "\u044c", "\u042d", "\u044d", "\u042e", "\u044e", "\u042f", "\u044f" |
| 458 | + ] |
| 459 | + }, |
| 460 | + 'arabic': { |
| 461 | + 'labelMsg': 'edittoolbar-characters-page-arabic', |
| 462 | + 'layout': 'characters', |
| 463 | + 'language': 'ar', |
| 464 | + 'direction': 'rtl', |
| 465 | + 'characters': [ |
| 466 | + "\u061b", "\u061f", "\u0621", "\u0622", "\u0623", "\u0624", "\u0625", "\u0626", "\u0627", "\u0628", |
| 467 | + "\u0629", "\u062a", "\u062b", "\u062c", "\u062d", "\u062e", "\u062f", "\u0630", "\u0631", "\u0632", |
| 468 | + "\u0633", "\u0634", "\u0635", "\u0636", "\u0637", "\u0638", "\u0639", "\u063a", "\u0641", "\u0642", |
| 469 | + "\u0643", "\u0644", "\u0645", "\u0646", "\u0647", "\u0648", "\u0649", "\u064a", "\u060c", "\u067e", |
| 470 | + "\u0686", "\u0698", "\u06af", "\u06ad" |
| 471 | + ] |
| 472 | + }, |
| 473 | + 'hebrew': { |
| 474 | + 'labelMsg': 'edittoolbar-characters-page-hebrew', |
| 475 | + 'layout': 'characters', |
| 476 | + 'direction': 'rtl', |
| 477 | + 'characters': [ |
| 478 | + "\u05d0", "\u05d1", "\u05d2", "\u05d3", "\u05d4", "\u05d5", "\u05d6", "\u05d7", "\u05d8", "\u05d9", |
| 479 | + "\u05db", "\u05da", "\u05dc", "\u05de", "\u05dd", "\u05e0", "\u05df", "\u05e1", "\u05e2", "\u05e4", |
| 480 | + "\u05e3", "\u05e6", "\u05e5", "\u05e7", "\u05e8", "\u05e9", "\u05ea", "\u05f3", "\u05f4", "\u05f0", |
| 481 | + "\u05f1", "\u05f2", "\u05d0", "\u05d3", "\u05d4", "\u05d5", "\u05d6", "\u05d7", "\u05d8", "\u05d9", |
| 482 | + "\u05da", "\u05db", "\u05dc", "\u05dd", "\u05de", "\u05df", "\u05e0", "\u05e1", "\u05e2", "\u05e3", |
| 483 | + "\u05e4", "\u05be", "\u05f3", "\u05f4", |
| 484 | + [ "\u05b0\u25cc", "\u05b0" ], [ "\u05b1\u25cc", "\u05b1" ], [ "\u05b2\u25cc", "\u05b2" ], |
| 485 | + [ "\u05b3\u25cc", "\u05b3" ], [ "\u05b4\u25cc", "\u05b4" ], [ "\u05b5\u25cc", "\u05b5" ], |
| 486 | + [ "\u05b6\u25cc", "\u05b6" ], [ "\u05b7\u25cc", "\u05b7" ], [ "\u05b8\u25cc", "\u05b8" ], |
| 487 | + [ "\u05b9\u25cc", "\u05b9" ], [ "\u05bb\u25cc", "\u05bb" ], [ "\u05bc\u25cc", "\u05bc" ], |
| 488 | + [ "\u05c1\u25cc", "\u05c1" ], [ "\u05c2\u25cc", "\u05c2" ], [ "\u05c7\u25cc", "\u05c7" ], |
| 489 | + [ "\u0591\u25cc", "\u0591" ], [ "\u0592\u25cc", "\u0592" ], [ "\u0593\u25cc", "\u0593" ], |
| 490 | + [ "\u0594\u25cc", "\u0594" ], [ "\u0595\u25cc", "\u0595" ], [ "\u0596\u25cc", "\u0596" ], |
| 491 | + [ "\u0597\u25cc", "\u0597" ], [ "\u0598\u25cc", "\u0598" ], [ "\u0599\u25cc", "\u0599" ], |
| 492 | + [ "\u059a\u25cc", "\u059a" ], [ "\u059b\u25cc", "\u059b" ], [ "\u059c\u25cc", "\u059c" ], |
| 493 | + [ "\u059d\u25cc", "\u059d" ], [ "\u059e\u25cc", "\u059e" ], [ "\u059f\u25cc", "\u059f" ], |
| 494 | + [ "\u05a0\u25cc", "\u05a0" ], [ "\u05a1\u25cc", "\u05a1" ], [ "\u05a2\u25cc", "\u05a2" ], |
| 495 | + [ "\u05a3\u25cc", "\u05a3" ], [ "\u05a4\u25cc", "\u05a4" ], [ "\u05a5\u25cc", "\u05a5" ], |
| 496 | + [ "\u05a6\u25cc", "\u05a6" ], [ "\u05a7\u25cc", "\u05a7" ], [ "\u05a8\u25cc", "\u05a8" ], |
| 497 | + [ "\u05a9\u25cc", "\u05a9" ], [ "\u05aa\u25cc", "\u05aa" ], [ "\u05ab\u25cc", "\u05ab" ], |
| 498 | + [ "\u05ac\u25cc", "\u05ac" ], [ "\u05ad\u25cc", "\u05ad" ], [ "\u05ae\u25cc", "\u05ae" ], |
| 499 | + [ "\u05af\u25cc", "\u05af" ], [ "\u05bf\u25cc", "\u05bf" ], [ "\u05c0\u25cc", "\u05c0" ], |
| 500 | + [ "\u05c3\u25cc", "\u05c3" ] |
| 501 | + ] |
| 502 | + }, |
| 503 | + 'telugu': { |
| 504 | + 'labelMsg': 'edittoolbar-characters-page-telugu', |
| 505 | + 'language': 'te', |
| 506 | + 'layout': 'characters', |
| 507 | + 'characters': [ |
| 508 | + "\u0c01", "\u0c02", "\u0c03", "\u0c05", "\u0c06", "\u0c07", "\u0c08", "\u0c09", "\u0c0a", "\u0c0b", |
| 509 | + "\u0c60", "\u0c0c", "\u0c61", "\u0c0e", "\u0c0f", "\u0c10", "\u0c12", "\u0c13", "\u0c14", "\u0c15", |
| 510 | + "\u0c16", "\u0c17", "\u0c18", "\u0c19", "\u0c1a", "\u0c1b", "\u0c1c", "\u0c1d", "\u0c1e", "\u0c1f", |
| 511 | + "\u0c20", "\u0c21", "\u0c22", "\u0c23", "\u0c24", "\u0c25", "\u0c26", "\u0c27", "\u0c28", "\u0c2a", |
| 512 | + "\u0c2b", "\u0c2c", "\u0c2d", "\u0c2e", "\u0c2f", "\u0c30", "\u0c31", "\u0c32", "\u0c33", "\u0c35", |
| 513 | + "\u0c36", "\u0c37", "\u0c38", "\u0c39", "\u0c3e", "\u0c3f", "\u0c40", "\u0c41", "\u0c42", "\u0c43", |
| 514 | + "\u0c44", "\u0c46", "\u0c47", "\u0c48", "\u0c4a", "\u0c4b", "\u0c4c", "\u0c4d", "\u0c62", "\u0c63", |
| 515 | + "\u0c58", "\u0c59", "\u0c66", "\u0c67", "\u0c68", "\u0c69", "\u0c6a", "\u0c6b", "\u0c6c", "\u0c6d", |
| 516 | + "\u0c6e", "\u0c6f", "\u0c3d", "\u0c78", "\u0c79", "\u0c7a", "\u0c7b", "\u0c7c", "\u0c7d", "\u0c7e", |
| 517 | + "\u0c7f" |
| 518 | + ] |
| 519 | + } |
| 520 | + } |
| 521 | + }, |
| 522 | + 'help': { |
| 523 | + labelMsg: 'edittoolbar-section-help', |
| 524 | + type: 'booklet', |
| 525 | + pages: { |
| 526 | + 'format': { |
| 527 | + labelMsg: 'edittoolbar-help-page-format', |
| 528 | + layout: 'table', |
| 529 | + headings: [ |
| 530 | + { textMsg: 'edittoolbar-help-heading-description' }, |
| 531 | + { textMsg: 'edittoolbar-help-heading-syntax' }, |
| 532 | + { textMsg: 'edittoolbar-help-heading-result' } |
| 533 | + ], |
| 534 | + rows: [ |
| 535 | + { |
| 536 | + 'description': { htmlMsg: 'edittoolbar-help-content-italic-description' }, |
| 537 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-italic-syntax' }, |
| 538 | + 'result': { htmlMsg: 'edittoolbar-help-content-italic-result' } |
| 539 | + }, |
| 540 | + { |
| 541 | + 'description': { htmlMsg: 'edittoolbar-help-content-bold-description' }, |
| 542 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-bold-syntax' }, |
| 543 | + 'result': { htmlMsg: 'edittoolbar-help-content-bold-result' } |
| 544 | + }, |
| 545 | + { |
| 546 | + 'description': { htmlMsg: 'edittoolbar-help-content-bolditalic-description' }, |
| 547 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-bolditalic-syntax' }, |
| 548 | + 'result': { htmlMsg: 'edittoolbar-help-content-bolditalic-result' } |
| 549 | + } |
| 550 | + ] |
| 551 | + }, |
| 552 | + 'link': { |
| 553 | + labelMsg: 'edittoolbar-help-page-link', |
| 554 | + layout: 'table', |
| 555 | + headings: [ |
| 556 | + { textMsg: 'edittoolbar-help-heading-description' }, |
| 557 | + { textMsg: 'edittoolbar-help-heading-syntax' }, |
| 558 | + { textMsg: 'edittoolbar-help-heading-result' } |
| 559 | + ], |
| 560 | + rows: [ |
| 561 | + { |
| 562 | + 'description': { htmlMsg: 'edittoolbar-help-content-ilink-description' }, |
| 563 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-ilink-syntax' }, |
| 564 | + 'result': { htmlMsg: 'edittoolbar-help-content-ilink-result' } |
| 565 | + }, |
| 566 | + { |
| 567 | + 'description': { htmlMsg: 'edittoolbar-help-content-xlink-description' }, |
| 568 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-xlink-syntax' }, |
| 569 | + 'result': { htmlMsg: 'edittoolbar-help-content-xlink-result' } |
| 570 | + } |
| 571 | + ] |
| 572 | + }, |
| 573 | + 'heading': { |
| 574 | + labelMsg: 'edittoolbar-help-page-heading', |
| 575 | + layout: 'table', |
| 576 | + headings: [ |
| 577 | + { textMsg: 'edittoolbar-help-heading-description' }, |
| 578 | + { textMsg: 'edittoolbar-help-heading-syntax' }, |
| 579 | + { textMsg: 'edittoolbar-help-heading-result' } |
| 580 | + ], |
| 581 | + rows: [ |
| 582 | + { |
| 583 | + 'description': { htmlMsg: 'edittoolbar-help-content-heading1-description' }, |
| 584 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-heading1-syntax' }, |
| 585 | + 'result': { htmlMsg: 'edittoolbar-help-content-heading1-result' } |
| 586 | + }, |
| 587 | + { |
| 588 | + 'description': { htmlMsg: 'edittoolbar-help-content-heading2-description' }, |
| 589 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-heading2-syntax' }, |
| 590 | + 'result': { htmlMsg: 'edittoolbar-help-content-heading2-result' } |
| 591 | + }, |
| 592 | + { |
| 593 | + 'description': { htmlMsg: 'edittoolbar-help-content-heading3-description' }, |
| 594 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-heading3-syntax' }, |
| 595 | + 'result': { htmlMsg: 'edittoolbar-help-content-heading3-result' } |
| 596 | + }, |
| 597 | + { |
| 598 | + 'description': { htmlMsg: 'edittoolbar-help-content-heading4-description' }, |
| 599 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-heading4-syntax' }, |
| 600 | + 'result': { htmlMsg: 'edittoolbar-help-content-heading4-result' } |
| 601 | + }, |
| 602 | + { |
| 603 | + 'description': { htmlMsg: 'edittoolbar-help-content-heading5-description' }, |
| 604 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-heading5-syntax' }, |
| 605 | + 'result': { htmlMsg: 'edittoolbar-help-content-heading5-result' } |
| 606 | + } |
| 607 | + ] |
| 608 | + }, |
| 609 | + 'list': { |
| 610 | + labelMsg: 'edittoolbar-help-page-list', |
| 611 | + layout: 'table', |
| 612 | + headings: [ |
| 613 | + { textMsg: 'edittoolbar-help-heading-description' }, |
| 614 | + { textMsg: 'edittoolbar-help-heading-syntax' }, |
| 615 | + { textMsg: 'edittoolbar-help-heading-result' } |
| 616 | + ], |
| 617 | + rows: [ |
| 618 | + { |
| 619 | + 'description': { htmlMsg: 'edittoolbar-help-content-ulist-description' }, |
| 620 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-ulist-syntax' }, |
| 621 | + 'result': { htmlMsg: 'edittoolbar-help-content-ulist-result' } |
| 622 | + }, |
| 623 | + { |
| 624 | + 'description': { htmlMsg: 'edittoolbar-help-content-olist-description' }, |
| 625 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-olist-syntax' }, |
| 626 | + 'result': { htmlMsg: 'edittoolbar-help-content-olist-result' } |
| 627 | + } |
| 628 | + ] |
| 629 | + }, |
| 630 | + 'file': { |
| 631 | + labelMsg: 'edittoolbar-help-page-file', |
| 632 | + layout: 'table', |
| 633 | + headings: [ |
| 634 | + { textMsg: 'edittoolbar-help-heading-description' }, |
| 635 | + { textMsg: 'edittoolbar-help-heading-syntax' }, |
| 636 | + { textMsg: 'edittoolbar-help-heading-result' } |
| 637 | + ], |
| 638 | + rows: [ |
| 639 | + { |
| 640 | + 'description': { htmlMsg: 'edittoolbar-help-content-file-description' }, |
| 641 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-file-syntax' }, |
| 642 | + 'result': { htmlMsg: 'edittoolbar-help-content-file-result' } |
| 643 | + } |
| 644 | + ] |
| 645 | + }, |
| 646 | + 'reference': { |
| 647 | + labelMsg: 'edittoolbar-help-page-reference', |
| 648 | + layout: 'table', |
| 649 | + headings: [ |
| 650 | + { textMsg: 'edittoolbar-help-heading-description' }, |
| 651 | + { textMsg: 'edittoolbar-help-heading-syntax' }, |
| 652 | + { textMsg: 'edittoolbar-help-heading-result' } |
| 653 | + ], |
| 654 | + rows: [ |
| 655 | + { |
| 656 | + 'description': { htmlMsg: 'edittoolbar-help-content-reference-description' }, |
| 657 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-reference-syntax' }, |
| 658 | + 'result': { htmlMsg: 'edittoolbar-help-content-reference-result' } |
| 659 | + }, |
| 660 | + { |
| 661 | + 'description': { htmlMsg: 'edittoolbar-help-content-rereference-description' }, |
| 662 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-rereference-syntax' }, |
| 663 | + 'result': { htmlMsg: 'edittoolbar-help-content-rereference-result' } |
| 664 | + }, |
| 665 | + { |
| 666 | + 'description': { htmlMsg: 'edittoolbar-help-content-showreferences-description' }, |
| 667 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-showreferences-syntax' }, |
| 668 | + 'result': { htmlMsg: 'edittoolbar-help-content-showreferences-result' } |
| 669 | + } |
| 670 | + ] |
| 671 | + }, |
| 672 | + 'discussion': { |
| 673 | + labelMsg: 'edittoolbar-help-page-discussion', |
| 674 | + layout: 'table', |
| 675 | + headings: [ |
| 676 | + { textMsg: 'edittoolbar-help-heading-description' }, |
| 677 | + { textMsg: 'edittoolbar-help-heading-syntax' }, |
| 678 | + { textMsg: 'edittoolbar-help-heading-result' } |
| 679 | + ], |
| 680 | + rows: [ |
| 681 | + { |
| 682 | + 'description': { htmlMsg: 'edittoolbar-help-content-signaturetimestamp-description' }, |
| 683 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-signaturetimestamp-syntax' }, |
| 684 | + 'result': { htmlMsg: 'edittoolbar-help-content-signaturetimestamp-result' } |
| 685 | + }, |
| 686 | + { |
| 687 | + 'description': { htmlMsg: 'edittoolbar-help-content-signature-description' }, |
| 688 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-signature-syntax' }, |
| 689 | + 'result': { htmlMsg: 'edittoolbar-help-content-signature-result' } |
| 690 | + }, |
| 691 | + { |
| 692 | + 'description': { htmlMsg: 'edittoolbar-help-content-indent-description' }, |
| 693 | + 'syntax': { htmlMsg: 'edittoolbar-help-content-indent-syntax' }, |
| 694 | + 'result': { htmlMsg: 'edittoolbar-help-content-indent-result' } |
| 695 | + } |
| 696 | + ] |
| 697 | + } |
| 698 | + } |
| 699 | + } |
| 700 | +}, |
| 701 | +'dialogs': { |
| 702 | + 'insert-link': { |
| 703 | + titleMsg: 'edittoolbar-tool-link-title', |
| 704 | + id: 'edittoolbar-link-dialog', |
| 705 | + html: '\ |
| 706 | + <div id="edittoolbar-link-tabs">\ |
| 707 | + <ul>\ |
| 708 | + <li><a href="#edittoolbar-link-dialog-tab-int" rel="edittoolbar-tool-link-int"></a></li>\ |
| 709 | + <li><a href="#edittoolbar-link-dialog-tab-ext" rel="edittoolbar-tool-link-ext"></a></li>\ |
| 710 | + </ul>\ |
| 711 | + <div id="edittoolbar-link-dialog-tab-int"><form><fieldset><table><tr>\ |
| 712 | + <td><label for="edittoolbar-link-int-target" rel="edittoolbar-tool-link-int-target"></label></td>\ |
| 713 | + <td>\ |
| 714 | + <input type="text" id="edittoolbar-link-int-target" />\ |
| 715 | + <div id="edittoolbar-link-int-target-status" style="display: inline;"></div>\ |
| 716 | + </td>\ |
| 717 | + </tr><tr>\ |
| 718 | + <td><label for="edittoolbar-link-int-text" rel="edittoolbar-tool-link-int-text"></label></td>\ |
| 719 | + <td><input type="text" id="edittoolbar-link-int-text" /></td>\ |
| 720 | + </table></fieldset></form></div>\ |
| 721 | + <div id="edittoolbar-link-dialog-tab-ext"><form><fieldset><table><tr>\ |
| 722 | + <td><label for="edittoolbar-link-ext-target" rel="edittoolbar-tool-link-ext-target"></label></td>\ |
| 723 | + <td><input type="text" id="edittoolbar-link-ext-target" /></td>\ |
| 724 | + </tr><tr>\ |
| 725 | + <td><label for="edittoolbar-link-ext-text" rel="edittoolbar-tool-link-ext-text"></label></td>\ |
| 726 | + <td><input type="text" id="edittoolbar-link-ext-text" /></td>\ |
| 727 | + </table></fieldset></form></div>\ |
| 728 | + </div>', |
| 729 | + init: function() { |
| 730 | + // Updates the UI to show if the page title being inputed by the user exists or not |
| 731 | + function updateExistence( target ) { |
| 732 | + function updateWidget( status ) { |
| 733 | + $j( '#edittoolbar-link-int-target-status' ).children().hide(); |
| 734 | + $j( '#edittoolbar-link-int-target-status-' + status ).show(); |
| 735 | + } |
| 736 | + // Abort previous request |
| 737 | + var request = $j( '#edittoolbar-link-int-target-status' ).data( 'request' ); |
| 738 | + if ( request ) { |
| 739 | + request.abort(); |
| 740 | + } |
| 741 | + var target = $j( '#edittoolbar-link-int-target' ).val(); |
| 742 | + var cache = $j( '#edittoolbar-link-int-target-status' ).data( 'cache' ); |
| 743 | + if ( cache[target] ) { |
| 744 | + updateWidget( cache[target] ); |
| 745 | + return; |
| 746 | + } |
| 747 | + if ( target == '' ) { |
| 748 | + // Hide the widget when the textbox is empty |
| 749 | + $j( '#edittoolbar-link-int-target-status' ).children().hide(); |
| 750 | + return; |
| 751 | + } |
| 752 | + if ( target.indexOf( '|' ) != -1 ) { |
| 753 | + // Title contains | , which means it's invalid |
| 754 | + // but confuses the API. Show invalid and bypass API |
| 755 | + updateWidget( 'invalid' ); |
| 756 | + return; |
| 757 | + } |
| 758 | + // Show loading spinner while waiting for the API to respond |
| 759 | + updateWidget( 'loading' ); |
| 760 | + // Call the API to check page status, saving the request object so it can be aborted if necessary |
| 761 | + $j( '#edittoolbar-link-int-target-status' ).data( |
| 762 | + 'request', |
| 763 | + $j.ajax( { |
| 764 | + url: wgScriptPath + '/api.php', |
| 765 | + dataType: 'json', |
| 766 | + data: { |
| 767 | + 'action': 'query', |
| 768 | + 'indexpageids': '', |
| 769 | + 'titles': target, |
| 770 | + 'format': 'json' |
346 | 771 | }, |
347 | | - 'latinextended': { |
348 | | - 'labelMsg': 'edittoolbar-characters-page-latinextended', |
349 | | - 'layout': 'characters', |
350 | | - 'characters': [ |
351 | | - "\u1e00", "\u1e01", "\u1e9a", "\u1ea0", "\u1ea1", "\u1ea2", "\u1ea3", "\u1ea4", |
352 | | - "\u1ea5", "\u1ea6", "\u1ea7", "\u1ea8", "\u1ea9", "\u1eaa", "\u1eab", "\u1eac", |
353 | | - "\u1ead", "\u1eae", "\u1eaf", "\u1eb0", "\u1eb1", "\u1eb2", "\u1eb3", "\u1eb4", |
354 | | - "\u1eb5", "\u1eb6", "\u1eb7", "\u1e02", "\u1e03", "\u1e04", "\u1e05", "\u1e06", |
355 | | - "\u1e07", "\u1e08", "\u1e09", "\u1e0a", "\u1e0b", "\u1e0c", "\u1e0d", "\u1e0e", |
356 | | - "\u1e0f", "\u1e10", "\u1e11", "\u1e12", "\u1e13", "\u1e14", "\u1e15", "\u1e16", |
357 | | - "\u1e17", "\u1e18", "\u1e19", "\u1e1a", "\u1e1b", "\u1e1c", "\u1e1d", "\u1eb8", |
358 | | - "\u1eb9", "\u1eba", "\u1ebb", "\u1ebc", "\u1ebd", "\u1ebe", "\u1ebf", "\u1ec0", |
359 | | - "\u1ec1", "\u1ec2", "\u1ec3", "\u1ec4", "\u1ec5", "\u1ec6", "\u1ec7", "\u1e1e", |
360 | | - "\u1e1f", "\u1e20", "\u1e21", "\u1e22", "\u1e23", "\u1e24", "\u1e25", "\u1e26", |
361 | | - "\u1e27", "\u1e28", "\u1e29", "\u1e2a", "\u1e2b", "\u1e96", "\u1e2c", "\u1e2d", |
362 | | - "\u1e2e", "\u1e2f", "\u1ec8", "\u1ec9", "\u1eca", "\u1ecb", "\u1e30", "\u1e31", |
363 | | - "\u1e32", "\u1e33", "\u1e34", "\u1e35", "\u1e36", "\u1e37", "\u1e38", "\u1e39", |
364 | | - "\u1e3a", "\u1e3b", "\u1e3c", "\u1e3d", "\u1efa", "\u1efb", "\u1e3e", "\u1e3f", |
365 | | - "\u1e40", "\u1e41", "\u1e42", "\u1e43", "\u1e44", "\u1e45", "\u1e46", "\u1e47", |
366 | | - "\u1e48", "\u1e49", "\u1e4a", "\u1e4b", "\u1e4c", "\u1e4d", "\u1e4e", "\u1e4f", |
367 | | - "\u1e50", "\u1e51", "\u1e52", "\u1e53", "\u1ecc", "\u1ecd", "\u1ece", "\u1ecf", |
368 | | - "\u1ed0", "\u1ed1", "\u1ed2", "\u1ed3", "\u1ed4", "\u1ed5", "\u1ed6", "\u1ed7", |
369 | | - "\u1ed8", "\u1ed9", "\u1eda", "\u1edb", "\u1edc", "\u1edd", "\u1ede", "\u1edf", |
370 | | - "\u1ee0", "\u1ee1", "\u1ee2", "\u1ee3", "\u1e54", "\u1e55", "\u1e56", "\u1e57", |
371 | | - "\u1e58", "\u1e59", "\u1e5a", "\u1e5b", "\u1e5c", "\u1e5d", "\u1e5e", "\u1e5f", |
372 | | - "\u1e60", "\u1e61", "\u1e9b", "\u1e62", "\u1e63", "\u1e64", "\u1e65", "\u1e66", |
373 | | - "\u1e67", "\u1e68", "\u1e69", "\u1e9c", "\u1e9d", "\u1e6a", "\u1e6b", "\u1e6c", |
374 | | - "\u1e6d", "\u1e6e", "\u1e6f", "\u1e70", "\u1e71", "\u1e97", "\u1e72", "\u1e73", |
375 | | - "\u1e74", "\u1e75", "\u1e76", "\u1e77", "\u1e78", "\u1e79", "\u1e7a", "\u1e7b", |
376 | | - "\u1ee4", "\u1ee5", "\u1ee6", "\u1ee7", "\u1ee8", "\u1ee9", "\u1eea", "\u1eeb", |
377 | | - "\u1eec", "\u1eed", "\u1eee", "\u1eef", "\u1ef0", "\u1ef1", "\u1e7c", "\u1e7d", |
378 | | - "\u1e7e", "\u1e7f", "\u1efc", "\u1efd", "\u1e80", "\u1e81", "\u1e82", "\u1e83", |
379 | | - "\u1e84", "\u1e85", "\u1e86", "\u1e87", "\u1e88", "\u1e89", "\u1e98", "\u1e8a", |
380 | | - "\u1e8b", "\u1e8c", "\u1e8d", "\u1e8e", "\u1e8f", "\u1e99", "\u1ef2", "\u1ef3", |
381 | | - "\u1ef4", "\u1ef5", "\u1ef6", "\u1ef7", "\u1ef8", "\u1ef9", "\u1efe", "\u1eff", |
382 | | - "\u1e90", "\u1e91", "\u1e92", "\u1e93", "\u1e94", "\u1e95", "\u1e9e", "\u1e9f" |
383 | | - ] |
384 | | - }, |
385 | | - 'ipa': { |
386 | | - labelMsg: 'edittoolbar-characters-page-ipa', |
387 | | - layout: 'characters', |
388 | | - characters: [ |
389 | | - "p", "t\u032a", "t", "\u0288", "c", "k", "q", "\u02a1", "\u0294", "b","d\u032a", "d", |
390 | | - "\u0256", "\u025f", "\u0261", "\u0262", "\u0253", "\u0257", "\u0284", "\u0260", |
391 | | - "\u029b", "t\u0361s", "t\u0361\u0283", "t\u0361\u0255", "d\u0361z", "d\u0361\u0292", |
392 | | - "d\u0361\u0291", "\u0278", "f", "\u03b8", "s", "\u0283", "\u0285", "\u0286", "\u0282", |
393 | | - "\u0255", "\u00e7", "\u0267", "x", "\u03c7", "\u0127", "\u029c", "h", "\u03b2", "v", |
394 | | - "\u028d", "\u00f0", "z", "\u0292", "\u0293", "\u0290", "\u0291", "\u029d", "\u0263", |
395 | | - "\u0281", "\u0295", "\u0296", "\u02a2", "\u0266", "\u026c", "\u026e", "m", "m\u0329", |
396 | | - "\u0271", "\u0271\u0329", "\u0271\u030d", "n\u032a", "n\u032a\u030d", "n", "n\u0329", |
397 | | - "\u0273", "\u0273\u0329", "\u0272", "\u0272\u0329", "\u014b", "\u014b\u030d", |
398 | | - "\u014b\u0329", "\u0274", "\u0274\u0329", "\u0299", "\u0299\u0329", "r", "r\u0329", |
399 | | - "\u0280", "\u0280\u0329", "\u027e", "\u027d", "\u027f", "\u027a", "l\u032a", |
400 | | - "l\u032a\u0329", "l", "l\u0329", "\u026b", "\u026b\u0329", "\u026d", "\u026d\u0329", |
401 | | - "\u028e", "\u028e\u0329", "\u029f", "\u029f\u0329", "w", "\u0265", "\u028b", "\u0279", |
402 | | - "\u027b", "j", "\u0270", "\u0298", "\u01c2", "\u01c0", "!", "\u01c1", "\u02b0", |
403 | | - "\u02b1", "\u02b7", "\u02b8", "\u02b2", "\u02b3", "\u207f", "\u02e1", "\u02b4", |
404 | | - "\u02b5", "\u02e2", "\u02e3", "\u02e0", "\u02b6", "\u02e4", "\u02c1", "\u02c0", |
405 | | - "\u02bc", "i", "i\u032f", "\u0129", "y", "y\u032f", "\u1ef9", "\u026a", "\u026a\u032f", |
406 | | - "\u026a\u0303", "\u028f", "\u028f\u032f", "\u028f\u0303", "\u0268", "\u0268\u032f", |
407 | | - "\u0268\u0303", "\u0289", "\u0289\u032f", "\u0289\u0303", "\u026f", "\u026f\u032f", |
408 | | - "\u026f\u0303", "u", "u\u032f", "\u0169", "\u028a", "\u028a\u032f", "\u028a\u0303", "e", |
409 | | - "e\u032f", "\u1ebd", "\u00f8", "\u00f8\u032f", "\u00f8\u0303", "\u0258", "\u0258\u032f", |
410 | | - "\u0258\u0303", "\u0275", "\u0275\u032f", "\u0275\u0303", "\u0264", "\u0264\u032f", |
411 | | - "\u0264\u0303", "o", "o\u032f", "\u00f5", "\u025b", "\u025b\u032f", "\u025b\u0303", |
412 | | - "\u0153", "\u0153\u032f", "\u0153\u0303", "\u025c", "\u025c\u032f", "\u025c\u0303", |
413 | | - "\u0259", "\u0259\u032f", "\u0259\u0303", "\u025e", "\u025e\u032f", "\u025e\u0303", |
414 | | - "\u028c", "\u028c\u032f", "\u028c\u0303", "\u0254", "\u0254\u032f", "\u0254\u0303", |
415 | | - "\u00e6", "\u00e6\u032f", "\u00e6\u0303", "\u0276", "\u0276\u032f", "\u0276\u0303", "a", |
416 | | - "a\u032f", "\u00e3", "\u0250", "\u0250\u032f", "\u0250\u0303", "\u0251", "\u0251\u032f", |
417 | | - "\u0251\u0303", "\u0252", "\u0252\u032f", "\u0252\u0303", "\u02c8", "\u02cc", "\u02d0", |
418 | | - "\u02d1", "\u02d8", ".", "\u203f", "|", "\u2016" |
419 | | - ] |
420 | | - }, |
421 | | - 'symbols': { |
422 | | - 'labelMsg': 'edittoolbar-characters-page-symbols', |
423 | | - 'layout': 'characters', |
424 | | - 'characters': [ |
425 | | - "~", "|", "\u00a1", "\u00bf", "\u2020", "\u2021", "\u2194", "\u2191", "\u2193", |
426 | | - "\u2022", "\u00b6", "#", "\u00bd", "\u2153", "\u2154", "\u00bc", "\u00be", "\u215b", |
427 | | - "\u215c", "\u215d", "\u215e", "\u221e", "\u2018", "\u201c", "\u2019", "\u201d", |
428 | | - { |
429 | | - 'label': "\u00ab\u00bb", |
430 | | - 'action': { |
431 | | - 'type': 'encapsulate', 'options': { 'pre': "\u00ab", 'post': "\u00bb" } |
432 | | - } |
433 | | - }, |
434 | | - "\u00a4", "\u20b3", "\u0e3f", "\u20b5", "\u00a2", "\u20a1", "\u20a2", "$", "\u20ab", |
435 | | - "\u20af", "\u20ac", "\u20a0", "\u20a3", "\u0192", "\u20b4", "\u20ad", "\u20a4", |
436 | | - "\u2133", "\u20a5", "\u20a6", "\u2116", "\u20a7", "\u20b0", "\u00a3", "\u17db", |
437 | | - "\u20a8", "\u20aa", "\u09f3", "\u20ae", "\u20a9", "\u00a5", "\u2660", "\u2663", |
438 | | - "\u2665", "\u2666", "m\u00b2", "m\u00b3", "\u2013", "\u2014", "\u2026", "\u2018", |
439 | | - "\u201c", "\u2019", "\u201d", "\u00b0", "\u2033", "\u2032", "\u2248", "\u2260", |
440 | | - "\u2264", "\u2265", "\u00b1", "\u2212", "\u00d7", "\u00f7", "\u2190", "\u2192", |
441 | | - "\u00b7", "\u00a7" |
442 | | - ] |
443 | | - }, |
444 | | - 'greek': { |
445 | | - 'labelMsg': 'edittoolbar-characters-page-greek', |
446 | | - 'layout': 'characters', |
447 | | - 'language': 'hl', |
448 | | - 'characters': [ |
449 | | - "\u0391", "\u0386", "\u03b1", "\u03ac", "\u0392", "\u03b2", "\u0393", "\u03b3", |
450 | | - "\u0394", "\u03b4", "\u0395", "\u0388", "\u03b5", "\u03ad", "\u0396", "\u03b6", |
451 | | - "\u0397", "\u0389", "\u03b7", "\u03ae", "\u0398", "\u03b8", "\u0399", "\u038a", |
452 | | - "\u03b9", "\u03af", "\u039a", "\u03ba", "\u039b", "\u03bb", "\u039c", "\u03bc", |
453 | | - "\u039d", "\u03bd", "\u039e", "\u03be", "\u039f", "\u038c", "\u03bf", "\u03cc", |
454 | | - "\u03a0", "\u03c0", "\u03a1", "\u03c1", "\u03a3", "\u03c3", "\u03c2", "\u03a4", |
455 | | - "\u03c4", "\u03a5", "\u038e", "\u03c5", "\u03cd", "\u03a6", "\u03c6", "\u03a7", |
456 | | - "\u03c7", "\u03a8", "\u03c8", "\u03a9", "\u038f", "\u03c9", "\u03ce" |
457 | | - ] |
458 | | - }, |
459 | | - 'cyrillic': { |
460 | | - 'labelMsg': 'edittoolbar-characters-page-cyrillic', |
461 | | - 'layout': 'characters', |
462 | | - 'characters': [ |
463 | | - "\u0410", "\u0430", "\u04d8", "\u04d9", "\u0411", "\u0431", "\u0412", "\u0432", |
464 | | - "\u0413", "\u0433", "\u0490", "\u0491", "\u0403", "\u0453", "\u0492", "\u0493", |
465 | | - "\u0414", "\u0434", "\u0402", "\u0452", "\u0415", "\u0435", "\u0404", "\u0454", |
466 | | - "\u0401", "\u0451", "\u0416", "\u0436", "\u0417", "\u0437", "\u0405", "\u0455", |
467 | | - "\u0418", "\u0438", "\u0406", "\u0456", "\u0407", "\u0457", "\u0130", "\u0419", |
468 | | - "\u0439", "\u04e2", "\u04e3", "\u0408", "\u0458", "\u041a", "\u043a", "\u040c", |
469 | | - "\u045c", "\u049a", "\u049b", "\u041b", "\u043b", "\u0409", "\u0459", "\u041c", |
470 | | - "\u043c", "\u041d", "\u043d", "\u040a", "\u045a", "\u04a2", "\u04a3", "\u041e", |
471 | | - "\u043e", "\u04e8", "\u04e9", "\u041f", "\u043f", "\u0420", "\u0440", "\u0421", |
472 | | - "\u0441", "\u0422", "\u0442", "\u040b", "\u045b", "\u0423", "\u0443", "\u040e", |
473 | | - "\u045e", "\u04ee", "\u04ef", "\u04b0", "\u04b1", "\u04ae", "\u04af", "\u0424", |
474 | | - "\u0444", "\u0425", "\u0445", "\u04b2", "\u04b3", "\u04ba", "\u04bb", "\u0426", |
475 | | - "\u0446", "\u0427", "\u0447", "\u04b6", "\u04b7", "\u040f", "\u045f", "\u0428", |
476 | | - "\u0448", "\u0429", "\u0449", "\u042a", "\u044a", "\u042b", "\u044b", "\u042c", |
477 | | - "\u044c", "\u042d", "\u044d", "\u042e", "\u044e", "\u042f", "\u044f" |
478 | | - ] |
479 | | - }, |
480 | | - 'arabic': { |
481 | | - 'labelMsg': 'edittoolbar-characters-page-arabic', |
482 | | - 'layout': 'characters', |
483 | | - 'language': 'ar', |
484 | | - 'direction': 'rtl', |
485 | | - 'characters': [ |
486 | | - "\u061b", "\u061f", "\u0621", "\u0622", "\u0623", "\u0624", "\u0625", "\u0626", |
487 | | - "\u0627", "\u0628", "\u0629", "\u062a", "\u062b", "\u062c", "\u062d", "\u062e", |
488 | | - "\u062f", "\u0630", "\u0631", "\u0632", "\u0633", "\u0634", "\u0635", "\u0636", |
489 | | - "\u0637", "\u0638", "\u0639", "\u063a", "\u0641", "\u0642", "\u0643", "\u0644", |
490 | | - "\u0645", "\u0646", "\u0647", "\u0648", "\u0649", "\u064a", "\u060c", "\u067e", |
491 | | - "\u0686", "\u0698", "\u06af", "\u06ad" |
492 | | - ] |
493 | | - }, |
494 | | - 'hebrew': { |
495 | | - 'labelMsg': 'edittoolbar-characters-page-hebrew', |
496 | | - 'layout': 'characters', |
497 | | - 'direction': 'rtl', |
498 | | - 'characters': [ |
499 | | - "\u05d0", "\u05d1", "\u05d2", "\u05d3", "\u05d4", "\u05d5", "\u05d6", "\u05d7", |
500 | | - "\u05d8", "\u05d9", "\u05db", "\u05da", "\u05dc", "\u05de", "\u05dd", "\u05e0", |
501 | | - "\u05df", "\u05e1", "\u05e2", "\u05e4", "\u05e3", "\u05e6", "\u05e5", "\u05e7", |
502 | | - "\u05e8", "\u05e9", "\u05ea", "\u05f3", "\u05f4", "\u05f0", "\u05f1", "\u05f2", |
503 | | - "\u05d0", "\u05d3", "\u05d4", "\u05d5", "\u05d6", "\u05d7", "\u05d8", "\u05d9", |
504 | | - "\u05da", "\u05db", "\u05dc", "\u05dd", "\u05de", "\u05df", "\u05e0", "\u05e1", |
505 | | - "\u05e2", "\u05e3", "\u05e4", "\u05be", "\u05f3", "\u05f4", |
506 | | - [ "\u05b0\u25cc", "\u05b0" ], [ "\u05b1\u25cc", "\u05b1" ], |
507 | | - [ "\u05b2\u25cc", "\u05b2" ], [ "\u05b3\u25cc", "\u05b3" ], |
508 | | - [ "\u05b4\u25cc", "\u05b4" ], [ "\u05b5\u25cc", "\u05b5" ], |
509 | | - [ "\u05b6\u25cc", "\u05b6" ], [ "\u05b7\u25cc", "\u05b7" ], |
510 | | - [ "\u05b8\u25cc", "\u05b8" ], [ "\u05b9\u25cc", "\u05b9" ], |
511 | | - [ "\u05bb\u25cc", "\u05bb" ], [ "\u05bc\u25cc", "\u05bc" ], |
512 | | - [ "\u05c1\u25cc", "\u05c1" ], [ "\u05c2\u25cc", "\u05c2" ], |
513 | | - [ "\u05c7\u25cc", "\u05c7" ], [ "\u0591\u25cc", "\u0591" ], |
514 | | - [ "\u0592\u25cc", "\u0592" ], [ "\u0593\u25cc", "\u0593" ], |
515 | | - [ "\u0594\u25cc", "\u0594" ], [ "\u0595\u25cc", "\u0595" ], |
516 | | - [ "\u0596\u25cc", "\u0596" ], [ "\u0597\u25cc", "\u0597" ], |
517 | | - [ "\u0598\u25cc", "\u0598" ], [ "\u0599\u25cc", "\u0599" ], |
518 | | - [ "\u059a\u25cc", "\u059a" ], [ "\u059b\u25cc", "\u059b" ], |
519 | | - [ "\u059c\u25cc", "\u059c" ], [ "\u059d\u25cc", "\u059d" ], |
520 | | - [ "\u059e\u25cc", "\u059e" ], [ "\u059f\u25cc", "\u059f" ], |
521 | | - [ "\u05a0\u25cc", "\u05a0" ], [ "\u05a1\u25cc", "\u05a1" ], |
522 | | - [ "\u05a2\u25cc", "\u05a2" ], [ "\u05a3\u25cc", "\u05a3" ], |
523 | | - [ "\u05a4\u25cc", "\u05a4" ], [ "\u05a5\u25cc", "\u05a5" ], |
524 | | - [ "\u05a6\u25cc", "\u05a6" ], [ "\u05a7\u25cc", "\u05a7" ], |
525 | | - [ "\u05a8\u25cc", "\u05a8" ], [ "\u05a9\u25cc", "\u05a9" ], |
526 | | - [ "\u05aa\u25cc", "\u05aa" ], [ "\u05ab\u25cc", "\u05ab" ], |
527 | | - [ "\u05ac\u25cc", "\u05ac" ], [ "\u05ad\u25cc", "\u05ad" ], |
528 | | - [ "\u05ae\u25cc", "\u05ae" ], [ "\u05af\u25cc", "\u05af" ], |
529 | | - [ "\u05bf\u25cc", "\u05bf" ], [ "\u05c0\u25cc", "\u05c0" ], |
530 | | - [ "\u05c3\u25cc", "\u05c3" ] |
531 | | - ] |
532 | | - }, |
533 | | - 'telugu': { |
534 | | - 'labelMsg': 'edittoolbar-characters-page-telugu', |
535 | | - 'language': 'te', |
536 | | - 'layout': 'characters', |
537 | | - 'characters': [ |
538 | | - "\u0c01", "\u0c02", "\u0c03", "\u0c05", "\u0c06", "\u0c07", "\u0c08", "\u0c09", |
539 | | - "\u0c0a", "\u0c0b", "\u0c60", "\u0c0c", "\u0c61", "\u0c0e", "\u0c0f", "\u0c10", |
540 | | - "\u0c12", "\u0c13", "\u0c14", "\u0c15", "\u0c16", "\u0c17", "\u0c18", "\u0c19", |
541 | | - "\u0c1a", "\u0c1b", "\u0c1c", "\u0c1d", "\u0c1e", "\u0c1f", "\u0c20", "\u0c21", |
542 | | - "\u0c22", "\u0c23", "\u0c24", "\u0c25", "\u0c26", "\u0c27", "\u0c28", "\u0c2a", |
543 | | - "\u0c2b", "\u0c2c", "\u0c2d", "\u0c2e", "\u0c2f", "\u0c30", "\u0c31", "\u0c32", |
544 | | - "\u0c33", "\u0c35", "\u0c36", "\u0c37", "\u0c38", "\u0c39", "\u0c3e", "\u0c3f", |
545 | | - "\u0c40", "\u0c41", "\u0c42", "\u0c43", "\u0c44", "\u0c46", "\u0c47", "\u0c48", |
546 | | - "\u0c4a", "\u0c4b", "\u0c4c", "\u0c4d", "\u0c62", "\u0c63", "\u0c58", "\u0c59", |
547 | | - "\u0c66", "\u0c67", "\u0c68", "\u0c69", "\u0c6a", "\u0c6b", "\u0c6c", "\u0c6d", |
548 | | - "\u0c6e", "\u0c6f", "\u0c3d", "\u0c78", "\u0c79", "\u0c7a", "\u0c7b", "\u0c7c", |
549 | | - "\u0c7d", "\u0c7e", "\u0c7f" |
550 | | - ] |
| 772 | + success: function( data ) { |
| 773 | + // TODO: What happens if data.query.pageids is undefined? |
| 774 | + var page = data.query.pages[data.query.pageids[0]]; |
| 775 | + var status = 'exists'; |
| 776 | + if ( typeof page.missing != 'undefined' ) |
| 777 | + status = 'notexists'; |
| 778 | + else if ( typeof page.invalid != 'undefined' ) |
| 779 | + status = 'invalid'; |
| 780 | + |
| 781 | + cache[target] = status; |
| 782 | + updateWidget( status ); |
551 | 783 | } |
| 784 | + } ) |
| 785 | + ); |
| 786 | + } |
| 787 | + // Set labels of tabs based on rel values |
| 788 | + $j(this).find( '[rel]' ).each( function() { |
| 789 | + $j(this).text( gM( $j(this).attr( 'rel' ) ) ); |
| 790 | + }); |
| 791 | + // Build tabs |
| 792 | + $j( '#edittoolbar-link-tabs' ).tabs(); |
| 793 | + // Automatically copy the value of the internal link page title field to the link text field unless the user |
| 794 | + // has changed the link text field - this is a convience thing since most link texts are going to be the |
| 795 | + // the same as the page title |
| 796 | + $j( '#edittoolbar-link-int-target' ).bind( 'keypress paste', function() { |
| 797 | + // $j(this).val() is the old value, before the keypress |
| 798 | + if ( $j( '#edittoolbar-link-int-text' ).data( 'untouched' ) ) |
| 799 | + // Defer this until $j(this).val() has been updated |
| 800 | + setTimeout( function() { |
| 801 | + $j( '#edittoolbar-link-int-text' ).val( $j( '#edittoolbar-link-int-target' ).val() ); |
| 802 | + }, 0 ); |
| 803 | + }); |
| 804 | + $j( '#edittoolbar-link-int-text' ).bind( 'keypress paste cut', function() { |
| 805 | + $j(this).data( 'untouched', false ); |
| 806 | + }); |
| 807 | + // Set the initial value of the external link field to start out as a real URL |
| 808 | + $j( '#edittoolbar-link-ext-target' ).val( 'http://' ); |
| 809 | + // Add images to the page existence widget, which will be shown mutually exclusively to communicate if the |
| 810 | + // page exists, does not exist or the title is invalid (like if it contains a | character) |
| 811 | + var existsMsg = gM( 'edittoolbar-tool-link-int-target-status-exists' ); |
| 812 | + var notexistsMsg = gM( 'edittoolbar-tool-link-int-target-status-notexists' ); |
| 813 | + var invalidMsg = gM( 'edittoolbar-tool-link-int-target-status-invalid' ); |
| 814 | + var loadingMsg = gM( 'edittoolbar-tool-link-int-target-status-loading' ); |
| 815 | + $j( '#edittoolbar-link-int-target-status' ) |
| 816 | + .append( $j( '<img />' ).attr( { |
| 817 | + 'id': 'edittoolbar-link-int-target-status-exists', |
| 818 | + 'src': $j.wikiEditor.imgPath + 'dialogs/' + 'insert-link-exists.png', |
| 819 | + 'alt': existsMsg, |
| 820 | + 'title': existsMsg |
| 821 | + } ) ) |
| 822 | + .append( $j( '<img />' ).attr( { |
| 823 | + 'id': 'edittoolbar-link-int-target-status-notexists', |
| 824 | + 'src': $j.wikiEditor.imgPath + 'dialogs/' + 'insert-link-notexists.png', |
| 825 | + 'alt': notexistsMsg, |
| 826 | + 'title': notexistsMsg |
| 827 | + } ) ) |
| 828 | + .append( $j( '<img />' ).attr( { |
| 829 | + 'id': 'edittoolbar-link-int-target-status-invalid', |
| 830 | + 'src': $j.wikiEditor.imgPath + 'dialogs/' + 'insert-link-invalid.png', |
| 831 | + 'alt': invalidMsg, |
| 832 | + 'title': invalidMsg |
| 833 | + } ) ) |
| 834 | + .append( $j( '<img />' ).attr( { |
| 835 | + 'id': 'edittoolbar-link-int-target-status-loading', |
| 836 | + 'src': $j.wikiEditor.imgPath + 'loading.gif', |
| 837 | + 'alt': loadingMsg, |
| 838 | + 'title': loadingMsg |
| 839 | + } ) ) |
| 840 | + .data( 'cache', {} ) |
| 841 | + .children().hide(); |
| 842 | + |
| 843 | + $j( '#edittoolbar-link-int-target' ) |
| 844 | + .bind( 'keypress paste cut', function() { |
| 845 | + // Cancel the running timer if applicable |
| 846 | + if ( typeof $j(this).data( 'timerID' ) != 'undefined' ) { |
| 847 | + clearTimeout( $j(this).data( 'timerID' ) ); |
552 | 848 | } |
| 849 | + // Delay fetch for a while |
| 850 | + // FIXME: Make 250 configurable elsewhere |
| 851 | + var timerID = setTimeout( updateExistence, 250 ); |
| 852 | + $j(this).data( 'timerID', timerID ); |
| 853 | + } ) |
| 854 | + .change( function() { |
| 855 | + // Cancel the running timer if applicable |
| 856 | + if ( typeof $j(this).data( 'timerID' ) != 'undefined' ) { |
| 857 | + clearTimeout( $j(this).data( 'timerID' ) ); |
| 858 | + } |
| 859 | + // Fetch right now |
| 860 | + updateExistence(); |
| 861 | + } ); |
| 862 | + }, |
| 863 | + dialog: { |
| 864 | + width: 550, // FIXME: autoresize width |
| 865 | + buttons: { |
| 866 | + 'edittoolbar-tool-link-insert': function() { |
| 867 | + function escapeInternalText( s ) { |
| 868 | + return s.replace( /(]{2,})/g, '<nowiki>$1</nowiki>' ); |
| 869 | + } |
| 870 | + function escapeExternalTarget( s ) { |
| 871 | + return s.replace( / /g, '%20' ) |
| 872 | + .replace( /]/g, '%5D' ); |
| 873 | + } |
| 874 | + function escapeExternalText( s ) { |
| 875 | + return s.replace( /(]+)/g, '<nowiki>$1</nowiki>' ); |
| 876 | + } |
| 877 | + var insertText = ''; |
| 878 | + var whitespace = [ '', '' ]; |
| 879 | + switch ( $j( '#edittoolbar-link-tabs' ).tabs( 'option', 'selected' ) ) { |
| 880 | + case 0: // Internal link |
| 881 | + // FIXME: Exactly how fragile is this? |
| 882 | + if ( $j( '#edittoolbar-link-int-target-status-invalid' ).is( ':visible' ) ) { |
| 883 | + // Refuse to add links to invalid titles |
| 884 | + alert( gM( 'edittoolbar-tool-link-int-invalid' ) ); |
| 885 | + return; |
| 886 | + } |
| 887 | + var target = $j( '#edittoolbar-link-int-target' ).val(); |
| 888 | + var text = $j( '#edittoolbar-link-int-text' ).val(); |
| 889 | + whitespace = $j( '#edittoolbar-link-dialog-tab-int' ).data( 'whitespace' ); |
| 890 | + if ( target == text ) |
| 891 | + insertText = '[[' + target + ']]'; |
| 892 | + else |
| 893 | + insertText = '[[' + target + '|' + escapeInternalText( text ) + ']]'; |
| 894 | + break; |
| 895 | + case 1: |
| 896 | + var target = $j( '#edittoolbar-link-ext-target' ).val(); |
| 897 | + var text = $j( '#edittoolbar-link-ext-text' ).val(); |
| 898 | + var escTarget = escapeExternalTarget( target ); |
| 899 | + var escText = escapeExternalText( text ); |
| 900 | + whitespace = $j( '#edittoolbar-link-dialog-tab-ext' ).data( 'whitespace' ); |
| 901 | + if ( escTarget == escText ) |
| 902 | + insertText = escTarget; |
| 903 | + else if ( text == '' ) |
| 904 | + insertText = '[' + escTarget + ']'; |
| 905 | + else |
| 906 | + insertText = '[' + escTarget + ' ' + escText + ']'; |
| 907 | + break; |
| 908 | + } |
| 909 | + // Preserve whitespace in selection when replacing |
| 910 | + insertText = whitespace[0] + insertText + whitespace[1]; |
| 911 | + $j.wikiEditor.modules.toolbar.fn.doAction( $j(this).data( 'context' ), { |
| 912 | + type: 'replace', |
| 913 | + options: { |
| 914 | + pre: insertText |
| 915 | + } |
| 916 | + }, $j(this) ); |
| 917 | + $j(this).dialog( 'close' ); |
553 | 918 | }, |
554 | | - 'help': { |
555 | | - labelMsg: 'edittoolbar-section-help', |
556 | | - type: 'booklet', |
557 | | - pages: { |
558 | | - 'format': { |
559 | | - labelMsg: 'edittoolbar-help-page-format', |
560 | | - layout: 'table', |
561 | | - headings: [ |
562 | | - { textMsg: 'edittoolbar-help-heading-description' }, |
563 | | - { textMsg: 'edittoolbar-help-heading-syntax' }, |
564 | | - { textMsg: 'edittoolbar-help-heading-result' } |
565 | | - ], |
566 | | - rows: [ |
567 | | - { |
568 | | - 'description': { htmlMsg: 'edittoolbar-help-content-italic-description' }, |
569 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-italic-syntax' }, |
570 | | - 'result': { htmlMsg: 'edittoolbar-help-content-italic-result' } |
571 | | - }, |
572 | | - { |
573 | | - 'description': { htmlMsg: 'edittoolbar-help-content-bold-description' }, |
574 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-bold-syntax' }, |
575 | | - 'result': { htmlMsg: 'edittoolbar-help-content-bold-result' } |
576 | | - }, |
577 | | - { |
578 | | - 'description': { htmlMsg: 'edittoolbar-help-content-bolditalic-description' }, |
579 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-bolditalic-syntax' }, |
580 | | - 'result': { htmlMsg: 'edittoolbar-help-content-bolditalic-result' } |
581 | | - } |
582 | | - ] |
583 | | - }, |
584 | | - 'link': { |
585 | | - labelMsg: 'edittoolbar-help-page-link', |
586 | | - layout: 'table', |
587 | | - headings: [ |
588 | | - { textMsg: 'edittoolbar-help-heading-description' }, |
589 | | - { textMsg: 'edittoolbar-help-heading-syntax' }, |
590 | | - { textMsg: 'edittoolbar-help-heading-result' } |
591 | | - ], |
592 | | - rows: [ |
593 | | - { |
594 | | - 'description': { htmlMsg: 'edittoolbar-help-content-ilink-description' }, |
595 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-ilink-syntax' }, |
596 | | - 'result': { htmlMsg: 'edittoolbar-help-content-ilink-result' } |
597 | | - }, |
598 | | - { |
599 | | - 'description': { htmlMsg: 'edittoolbar-help-content-xlink-description' }, |
600 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-xlink-syntax' }, |
601 | | - 'result': { htmlMsg: 'edittoolbar-help-content-xlink-result' } |
602 | | - } |
603 | | - ] |
604 | | - }, |
605 | | - 'heading': { |
606 | | - labelMsg: 'edittoolbar-help-page-heading', |
607 | | - layout: 'table', |
608 | | - headings: [ |
609 | | - { textMsg: 'edittoolbar-help-heading-description' }, |
610 | | - { textMsg: 'edittoolbar-help-heading-syntax' }, |
611 | | - { textMsg: 'edittoolbar-help-heading-result' } |
612 | | - ], |
613 | | - rows: [ |
614 | | - { |
615 | | - 'description': { htmlMsg: 'edittoolbar-help-content-heading1-description' }, |
616 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-heading1-syntax' }, |
617 | | - 'result': { htmlMsg: 'edittoolbar-help-content-heading1-result' } |
618 | | - }, |
619 | | - { |
620 | | - 'description': { htmlMsg: 'edittoolbar-help-content-heading2-description' }, |
621 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-heading2-syntax' }, |
622 | | - 'result': { htmlMsg: 'edittoolbar-help-content-heading2-result' } |
623 | | - }, |
624 | | - { |
625 | | - 'description': { htmlMsg: 'edittoolbar-help-content-heading3-description' }, |
626 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-heading3-syntax' }, |
627 | | - 'result': { htmlMsg: 'edittoolbar-help-content-heading3-result' } |
628 | | - }, |
629 | | - { |
630 | | - 'description': { htmlMsg: 'edittoolbar-help-content-heading4-description' }, |
631 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-heading4-syntax' }, |
632 | | - 'result': { htmlMsg: 'edittoolbar-help-content-heading4-result' } |
633 | | - }, |
634 | | - { |
635 | | - 'description': { htmlMsg: 'edittoolbar-help-content-heading5-description' }, |
636 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-heading5-syntax' }, |
637 | | - 'result': { htmlMsg: 'edittoolbar-help-content-heading5-result' } |
638 | | - } |
639 | | - ] |
640 | | - }, |
641 | | - 'list': { |
642 | | - labelMsg: 'edittoolbar-help-page-list', |
643 | | - layout: 'table', |
644 | | - headings: [ |
645 | | - { textMsg: 'edittoolbar-help-heading-description' }, |
646 | | - { textMsg: 'edittoolbar-help-heading-syntax' }, |
647 | | - { textMsg: 'edittoolbar-help-heading-result' } |
648 | | - ], |
649 | | - rows: [ |
650 | | - { |
651 | | - 'description': { htmlMsg: 'edittoolbar-help-content-ulist-description' }, |
652 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-ulist-syntax' }, |
653 | | - 'result': { htmlMsg: 'edittoolbar-help-content-ulist-result' } |
654 | | - }, |
655 | | - { |
656 | | - 'description': { htmlMsg: 'edittoolbar-help-content-olist-description' }, |
657 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-olist-syntax' }, |
658 | | - 'result': { htmlMsg: 'edittoolbar-help-content-olist-result' } |
659 | | - } |
660 | | - ] |
661 | | - }, |
662 | | - 'file': { |
663 | | - labelMsg: 'edittoolbar-help-page-file', |
664 | | - layout: 'table', |
665 | | - headings: [ |
666 | | - { textMsg: 'edittoolbar-help-heading-description' }, |
667 | | - { textMsg: 'edittoolbar-help-heading-syntax' }, |
668 | | - { textMsg: 'edittoolbar-help-heading-result' } |
669 | | - ], |
670 | | - rows: [ |
671 | | - { |
672 | | - 'description': { htmlMsg: 'edittoolbar-help-content-file-description' }, |
673 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-file-syntax' }, |
674 | | - 'result': { htmlMsg: 'edittoolbar-help-content-file-result' } |
675 | | - } |
676 | | - ] |
677 | | - }, |
678 | | - 'reference': { |
679 | | - labelMsg: 'edittoolbar-help-page-reference', |
680 | | - layout: 'table', |
681 | | - headings: [ |
682 | | - { textMsg: 'edittoolbar-help-heading-description' }, |
683 | | - { textMsg: 'edittoolbar-help-heading-syntax' }, |
684 | | - { textMsg: 'edittoolbar-help-heading-result' } |
685 | | - ], |
686 | | - rows: [ |
687 | | - { |
688 | | - 'description': { htmlMsg: 'edittoolbar-help-content-reference-description' }, |
689 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-reference-syntax' }, |
690 | | - 'result': { htmlMsg: 'edittoolbar-help-content-reference-result' } |
691 | | - }, |
692 | | - { |
693 | | - 'description': { htmlMsg: 'edittoolbar-help-content-rereference-description' }, |
694 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-rereference-syntax' }, |
695 | | - 'result': { htmlMsg: 'edittoolbar-help-content-rereference-result' } |
696 | | - }, |
697 | | - { |
698 | | - 'description': { htmlMsg: 'edittoolbar-help-content-showreferences-description' }, |
699 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-showreferences-syntax' }, |
700 | | - 'result': { htmlMsg: 'edittoolbar-help-content-showreferences-result' } |
701 | | - } |
702 | | - ] |
703 | | - }, |
704 | | - 'discussion': { |
705 | | - labelMsg: 'edittoolbar-help-page-discussion', |
706 | | - layout: 'table', |
707 | | - headings: [ |
708 | | - { textMsg: 'edittoolbar-help-heading-description' }, |
709 | | - { textMsg: 'edittoolbar-help-heading-syntax' }, |
710 | | - { textMsg: 'edittoolbar-help-heading-result' } |
711 | | - ], |
712 | | - rows: [ |
713 | | - { |
714 | | - 'description': { |
715 | | - htmlMsg: 'edittoolbar-help-content-signaturetimestamp-description' |
716 | | - }, |
717 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-signaturetimestamp-syntax' }, |
718 | | - 'result': { htmlMsg: 'edittoolbar-help-content-signaturetimestamp-result' } |
719 | | - }, |
720 | | - { |
721 | | - 'description': { htmlMsg: 'edittoolbar-help-content-signature-description' }, |
722 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-signature-syntax' }, |
723 | | - 'result': { htmlMsg: 'edittoolbar-help-content-signature-result' } |
724 | | - }, |
725 | | - { |
726 | | - 'description': { htmlMsg: 'edittoolbar-help-content-indent-description' }, |
727 | | - 'syntax': { htmlMsg: 'edittoolbar-help-content-indent-syntax' }, |
728 | | - 'result': { htmlMsg: 'edittoolbar-help-content-indent-result' } |
729 | | - } |
730 | | - ] |
| 919 | + 'edittoolbar-tool-link-cancel': function() { |
| 920 | + $j(this).dialog( 'close' ); |
| 921 | + } |
| 922 | + }, |
| 923 | + open: function() { |
| 924 | + // Pre-fill the text fields based on the current selection |
| 925 | + var selection = $j(this).data( 'context' ).$textarea.getSelection(); |
| 926 | + $j( '#edittoolbar-link-dialog-tab-int' ).data( 'whitespace', [ '', '' ] ); |
| 927 | + $j( '#edittoolbar-link-dialog-tab-ext' ).data( 'whitespace', [ '', '' ] ); |
| 928 | + if ( selection != '' ) { |
| 929 | + var intText, intTarget, extText, extTarget; |
| 930 | + var matches; |
| 931 | + var tab = -1; |
| 932 | + if ( ( matches = selection.match( /^(\s*)\[\[([^\]\|]+)(\|([^\]\|]*))?\]\](\s*)$/ ) ) ) { |
| 933 | + // [[foo|bar]] or [[foo]] |
| 934 | + intTarget = matches[2]; |
| 935 | + intText = ( matches[4] ? matches[4] : matches[2] ); |
| 936 | + tab = 0; |
| 937 | + // Preserve whitespace when replacing |
| 938 | + $j( '#edittoolbar-link-dialog-tab-int' ).data( 'whitespace', [ matches[1], matches[5] ] ); |
| 939 | + } else if ( ( matches = selection.match( /^(\s*)\[([^\] ]+)( ([^\]]+))?\](\s*)$/ ) ) ) { |
| 940 | + // [http://www.example.com foo] or [http://www.example.com] |
| 941 | + extTarget = matches[2]; |
| 942 | + extText = ( matches[4] ? matches[4] : '' ); |
| 943 | + tab = 1; |
| 944 | + // Preserve whitespace when replacing |
| 945 | + $j( '#edittoolbar-link-dialog-tab-ext' ).data( 'whitespace', [ matches[1], matches[5] ] ); |
| 946 | + } else { |
| 947 | + intTarget = intText = extText = selection; |
| 948 | + extTarget = 'http://'; |
| 949 | + } |
| 950 | + // Change the value by calling val() doesn't trigger the change event, so let's do that ourselves |
| 951 | + if ( typeof intText != 'undefined' ) |
| 952 | + $j( '#edittoolbar-link-int-text' ).val( intText ).change(); |
| 953 | + if ( typeof intTarget != 'undefined' ) |
| 954 | + $j( '#edittoolbar-link-int-target' ).val( intTarget ).change(); |
| 955 | + if ( typeof extText != 'undefined' ) |
| 956 | + $j( '#edittoolbar-link-ext-text' ).val( extText ).change(); |
| 957 | + if ( typeof extTarget != 'undefined' ) |
| 958 | + $j( '#edittoolbar-link-ext-target' ).val( extTarget ).change(); |
| 959 | + if ( tab != -1 ) |
| 960 | + $j( '#edittoolbar-link-tabs' ).tabs( 'select', tab ); |
| 961 | + } |
| 962 | + $j( '#edittoolbar-link-int-text' ).data( 'untouched', |
| 963 | + $j( '#edittoolbar-link-int-text' ).val() == $j( '#edittoolbar-link-int-target' ).val() |
| 964 | + ); |
| 965 | + } |
| 966 | + } |
| 967 | + }, |
| 968 | + 'insert-table': { |
| 969 | + titleMsg: 'edittoolbar-tool-table-title', |
| 970 | + id: 'edittoolbar-table-dialog', |
| 971 | + html: '\ |
| 972 | + <form><fieldset><legend rel="edittoolbar-tool-table-dimensions"></legend><table><tr>\ |
| 973 | + <td><input type="checkbox" id="edittoolbar-table-dimensions-header" value="1" /></td>\ |
| 974 | + <td class="label"><label for="edittoolbar-table-dimensions-header"\ |
| 975 | + rel="edittoolbar-tool-table-dimensions-header"></label></td>\ |
| 976 | + </tr></table><table><tr>\ |
| 977 | + <td class="label"><label for="edittoolbar-table-dimensions-columns"\ |
| 978 | + rel="edittoolbar-tool-table-dimensions-columns"></label></td>\ |
| 979 | + <td><input type="text" id="edittoolbar-table-dimensions-columns" size="2" /></td>\ |
| 980 | + <td class="label"><label for="edittoolbar-table-dimensions-rows"\ |
| 981 | + rel="edittoolbar-tool-table-dimensions-rows"></label></td>\ |
| 982 | + <td><input type="text" id="edittoolbar-table-dimensions-rows" size="2" /></td>\ |
| 983 | + </tr></table></fieldset></form>', |
| 984 | + init: function() { |
| 985 | + $j(this).find( '[rel]' ).each( function() { |
| 986 | + $j(this).text( gM( $j(this).attr( 'rel' ) ) ); |
| 987 | + }); |
| 988 | + $j( '#edittoolbar-table-dimensions-rows' ).val( 2 ); |
| 989 | + $j( '#edittoolbar-table-dimensions-columns' ).val( 2 ); |
| 990 | + }, |
| 991 | + dialog: { |
| 992 | + width: 350, // FIXME: autoresize |
| 993 | + buttons: { |
| 994 | + 'edittoolbar-tool-table-insert': function() { |
| 995 | + var rows = parseInt( $j( '#edittoolbar-table-dimensions-rows' ).val() ); |
| 996 | + var cols = parseInt( $j( '#edittoolbar-table-dimensions-columns' ).val() ); |
| 997 | + var header = Math.min( 1, $j( '#edittoolbar-table-dimensions-header:checked' ).size() ); |
| 998 | + var table = "{|\n"; |
| 999 | + for ( var r = 0; r < rows + header; r++ ) { |
| 1000 | + table += "|-\n"; |
| 1001 | + for ( var c = 0; c < cols; c++ ) { |
| 1002 | + var isHeader = ( r + 1 == header ); |
| 1003 | + var delim = isHeader ? '!' : '|'; |
| 1004 | + if ( c > 0 ) { |
| 1005 | + delim += delim; |
| 1006 | + } |
| 1007 | + table += delim + ' ' + gM( |
| 1008 | + isHeader ? 'edittoolbar-tool-table-example-header' : 'edittoolbar-tool-table-example', |
| 1009 | + [ r + 1, c + 1 ] |
| 1010 | + ) + ' '; |
731 | 1011 | } |
| 1012 | + // Replace trailing space by newline |
| 1013 | + // table[table.length - 1] is read-only |
| 1014 | + table = table.substr( 0, table.length - 1 ) + "\n"; |
732 | 1015 | } |
| 1016 | + table += "|}"; |
| 1017 | + $j.wikiEditor.modules.toolbar.fn.doAction( |
| 1018 | + $j(this).data( 'context' ), |
| 1019 | + { |
| 1020 | + type: 'encapsulate', |
| 1021 | + options: { |
| 1022 | + pre: table, |
| 1023 | + ownline: true |
| 1024 | + } |
| 1025 | + }, |
| 1026 | + $j(this) |
| 1027 | + ); |
| 1028 | + $j(this).dialog( 'close' ); |
| 1029 | + }, |
| 1030 | + 'edittoolbar-tool-table-cancel': function() { |
| 1031 | + $j(this).dialog( 'close' ); |
733 | 1032 | } |
734 | 1033 | } |
735 | | - } ); |
| 1034 | + } |
| 1035 | + }, |
| 1036 | + 'search-and-replace': { |
| 1037 | + titleMsg: 'edittoolbar-tool-replace-title', |
| 1038 | + id: 'edittoolbar-replace-dialog', |
| 1039 | + html: '\ |
| 1040 | + <form><fieldset><table><tr>\ |
| 1041 | + <td><label for="edittoolbar-replace-search" rel="edittoolbar-tool-replace-search"></label></td>\ |
| 1042 | + <td><input type="text" id="edittoolbar-replace-search" /></td>\ |
| 1043 | + </tr><tr>\ |
| 1044 | + <td><label for="edittoolbar-replace-replace" rel="edittoolbar-tool-replace-replace"></label></td>\ |
| 1045 | + <td><input type="text" id="edittoolbar-replace-replace" /></td>\ |
| 1046 | + </tr></table><table><tr>\ |
| 1047 | + <td><input type="checkbox" id="edittoolbar-replace-case" /></td>\ |
| 1048 | + <td><label for="edittoolbar-replace-case" rel="edittoolbar-tool-replace-case"></label></td>\ |
| 1049 | + </tr><tr>\ |
| 1050 | + <td><input type="checkbox" id="edittoolbar-replace-regex" /></td>\ |
| 1051 | + <td><label for="edittoolbar-replace-regex" rel="edittoolbar-tool-replace-regex"></label></td>\ |
| 1052 | + </tr><tr>\ |
| 1053 | + <td><input type="checkbox" id="edittoolbar-replace-all" /></td>\ |
| 1054 | + <td><label for="edittoolbar-replace-all" rel="edittoolbar-tool-replace-all"></label></td>\ |
| 1055 | + </tr></table></fieldset></form>', |
| 1056 | + init: function() { |
| 1057 | + $j(this).find( '[rel]' ).each( function() { |
| 1058 | + $j(this).text( gM( $j(this).attr( 'rel' ) ) ); |
| 1059 | + }); |
| 1060 | + }, |
| 1061 | + dialog: { |
| 1062 | + width: 350, // FIXME: autoresize width |
| 1063 | + buttons: { |
| 1064 | + 'edittoolbar-tool-replace-button': function() { |
| 1065 | + var searchStr = $j( '#edittoolbar-replace-search' ).val(); |
| 1066 | + var replaceStr = $j( '#edittoolbar-replace-replace' ).val(); |
| 1067 | + var flags = ''; |
| 1068 | + if ( !$j( '#edittoolbar-replace-case' ).is( ':checked' ) ) { |
| 1069 | + flags += 'i'; |
| 1070 | + } |
| 1071 | + if ( $j( '#edittoolbar-replace-all' ).is( ':checked' ) ) { |
| 1072 | + flags += 'g'; |
| 1073 | + } |
| 1074 | + if ( !$j( '#edittoolbar-replace-regex' ).is( ':checked' ) ) { |
| 1075 | + searchStr = RegExp.escape( searchStr ); |
| 1076 | + } |
| 1077 | + var regex = new RegExp( searchStr, flags ); |
| 1078 | + var $textarea = $j(this).data( 'context' ).$textarea; |
| 1079 | + if ( !$textarea.val().match( regex ) ) { |
| 1080 | + alert( gM( 'edittoolbar-tool-replace-nomatch' ) ); |
| 1081 | + } else { |
| 1082 | + $textarea.val( $textarea.val().replace( regex, replaceStr ) ); |
| 1083 | + } |
| 1084 | + // TODO: Hook for wikEd |
| 1085 | + }, |
| 1086 | + 'edittoolbar-tool-replace-close': function() { |
| 1087 | + $j(this).dialog( 'close' ); |
| 1088 | + } |
| 1089 | + } |
| 1090 | + } |
736 | 1091 | } |
737 | | -} ); |
| 1092 | +} |
| 1093 | + |
| 1094 | +} ); } } ); |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.i18n.php |
— | — | @@ -78,8 +78,7 @@ |
79 | 79 | 'edittoolbar-tool-table-dimensions' => 'Dimensions', |
80 | 80 | 'edittoolbar-tool-table-dimensions-rows' => 'Rows', |
81 | 81 | 'edittoolbar-tool-table-dimensions-columns' => 'Columns', |
82 | | - 'edittoolbar-tool-table-dimensions-headerrows' => 'Header rows', |
83 | | - 'edittoolbar-tool-table-dimensions-headercolumns' => 'Header columns', |
| 82 | + 'edittoolbar-tool-table-dimensions-header' => 'Include header row', |
84 | 83 | 'edittoolbar-tool-table-insert' => 'Insert', |
85 | 84 | 'edittoolbar-tool-table-cancel' => 'Cancel', |
86 | 85 | 'edittoolbar-tool-replace' => 'Replace', |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.dialogs.js |
— | — | @@ -20,6 +20,11 @@ |
21 | 21 | if ( data.dialog in $.wikiEditor.modules.dialogs.modules ) { |
22 | 22 | $( '#' + $.wikiEditor.modules.dialogs.modules[data.dialog].id ).dialog( 'open' ); |
23 | 23 | } |
| 24 | + }, |
| 25 | + closeDialog: function( context, data ) { |
| 26 | + if ( data.dialog in $.wikiEditor.modules.dialogs.modules ) { |
| 27 | + $( '#' + $.wikiEditor.modules.dialogs.modules[data.dialog].id ).dialog( 'close' ); |
| 28 | + } |
24 | 29 | } |
25 | 30 | }, |
26 | 31 | /** |
— | — | @@ -33,11 +38,9 @@ |
34 | 39 | * @param {Object} config Configuration object to create module from |
35 | 40 | */ |
36 | 41 | create: function( context, config ) { |
37 | | - // Accept additional modules |
38 | | - if ( 'modules' in config ) { |
39 | | - for ( module in config.modules ) { |
40 | | - $.wikiEditor.modules.dialogs.modules[module] = config.modules[module]; |
41 | | - } |
| 42 | + // Add modules |
| 43 | + for ( module in config ) { |
| 44 | + $.wikiEditor.modules.dialogs.modules[module] = config[module]; |
42 | 45 | } |
43 | 46 | // Build out modules immediately |
44 | 47 | for ( module in $.wikiEditor.modules.dialogs.modules ) { |
— | — | @@ -69,393 +72,6 @@ |
70 | 73 | } |
71 | 74 | } |
72 | 75 | }, |
73 | | -/** |
74 | | - * Stock modules |
75 | | - */ |
76 | | -modules: { |
77 | | - 'insert-link': { |
78 | | - titleMsg: 'edittoolbar-tool-link-title', |
79 | | - id: 'edittoolbar-link-dialog', |
80 | | - html: '\ |
81 | | - <div id="edittoolbar-link-tabs">\ |
82 | | - <ul>\ |
83 | | - <li><a href="#edittoolbar-link-dialog-tab-int" rel="edittoolbar-tool-link-int"></a></li>\ |
84 | | - <li><a href="#edittoolbar-link-dialog-tab-ext" rel="edittoolbar-tool-link-ext"></a></li>\ |
85 | | - </ul>\ |
86 | | - <div id="edittoolbar-link-dialog-tab-int"><form><fieldset><table><tr>\ |
87 | | - <td><label for="edittoolbar-link-int-target" rel="edittoolbar-tool-link-int-target"></label></td>\ |
88 | | - <td>\ |
89 | | - <input type="text" id="edittoolbar-link-int-target" />\ |
90 | | - <div id="edittoolbar-link-int-target-status" style="display: inline;"></div>\ |
91 | | - </td>\ |
92 | | - </tr><tr>\ |
93 | | - <td><label for="edittoolbar-link-int-text" rel="edittoolbar-tool-link-int-text"></label></td>\ |
94 | | - <td><input type="text" id="edittoolbar-link-int-text" /></td>\ |
95 | | - </table></fieldset></form></div>\ |
96 | | - <div id="edittoolbar-link-dialog-tab-ext"><form><fieldset><table><tr>\ |
97 | | - <td><label for="edittoolbar-link-ext-target" rel="edittoolbar-tool-link-ext-target"></label></td>\ |
98 | | - <td><input type="text" id="edittoolbar-link-ext-target" /></td>\ |
99 | | - </tr><tr>\ |
100 | | - <td><label for="edittoolbar-link-ext-text" rel="edittoolbar-tool-link-ext-text"></label></td>\ |
101 | | - <td><input type="text" id="edittoolbar-link-ext-text" /></td>\ |
102 | | - </table></fieldset></form></div>\ |
103 | | - </div>', |
104 | | - init: function() { |
105 | | - $(this).find( '[rel]' ).each( function() { |
106 | | - $(this).text( gM( $(this).attr( 'rel' ) ) ); |
107 | | - }); |
108 | | - $( '#edittoolbar-link-tabs' ).tabs(); |
109 | | - |
110 | | - // Link int-target and int-text fields |
111 | | - // This means mirroring the contents of int-target in int-text |
112 | | - // as long as int-text itself hasn't been changed by the user |
113 | | - $( '#edittoolbar-link-int-target' ).bind( 'keypress paste', function() { |
114 | | - // $(this).val() is the old value, before the keypress |
115 | | - if ( $( '#edittoolbar-link-int-text' ).data( 'untouched' ) ) |
116 | | - // Defer this until $(this).val() has been updated |
117 | | - setTimeout( function() { |
118 | | - $( '#edittoolbar-link-int-text' ).val( $( '#edittoolbar-link-int-target' ).val() ); |
119 | | - }, 0 ); |
120 | | - }); |
121 | | - $( '#edittoolbar-link-int-text' ).bind( 'keypress paste', function() { |
122 | | - $(this).data( 'untouched', false ); |
123 | | - }); |
124 | | - $( '#edittoolbar-link-ext-target' ).val( 'http://' ); |
125 | | - |
126 | | - // Page existence check widget |
127 | | - var existsImg = $.wikiEditor.imgPath + 'dialogs/' + 'insert-link-exists.png'; |
128 | | - var notexistsImg = $.wikiEditor.imgPath + 'dialogs/' + 'insert-link-notexists.png'; |
129 | | - var invalidImg = $.wikiEditor.imgPath + 'dialogs/' + 'insert-link-invalid.png'; |
130 | | - var loadingImg = $.wikiEditor.imgPath + 'loading.gif'; |
131 | | - var existsMsg = gM( 'edittoolbar-tool-link-int-target-status-exists' ); |
132 | | - var notexistsMsg = gM( 'edittoolbar-tool-link-int-target-status-notexists' ); |
133 | | - var invalidMsg = gM( 'edittoolbar-tool-link-int-target-status-invalid' ); |
134 | | - var loadingMsg = gM( 'edittoolbar-tool-link-int-target-status-loading' ); |
135 | | - $( '#edittoolbar-link-int-target-status' ) |
136 | | - .append( $( '<img />' ).attr( { |
137 | | - 'id': 'edittoolbar-link-int-target-status-exists', |
138 | | - 'src': existsImg, |
139 | | - 'alt': existsMsg, |
140 | | - 'title': existsMsg } ) ) |
141 | | - .append( $( '<img />' ).attr( { |
142 | | - 'id': 'edittoolbar-link-int-target-status-notexists', |
143 | | - 'src': notexistsImg, |
144 | | - 'alt': notexistsMsg, |
145 | | - 'title': notexistsMsg } ) ) |
146 | | - .append( $( '<img />' ).attr( { |
147 | | - 'id': 'edittoolbar-link-int-target-status-invalid', |
148 | | - 'src': invalidImg, |
149 | | - 'alt': invalidMsg, |
150 | | - 'title': invalidMsg } ) ) |
151 | | - .append( $( '<img />' ).attr( { |
152 | | - 'id': 'edittoolbar-link-int-target-status-loading', |
153 | | - 'src': loadingImg, |
154 | | - 'alt': loadingMsg, |
155 | | - 'title': loadingMsg } ) ) |
156 | | - .data( 'cache', {} ) |
157 | | - .children().hide(); |
158 | | - |
159 | | - function updateExistence( target ) { |
160 | | - function updateWidget( status ) { |
161 | | - $( '#edittoolbar-link-int-target-status' ).children().hide(); |
162 | | - $( '#edittoolbar-link-int-target-status-' + status ).show(); |
163 | | - } |
164 | | - |
165 | | - // Abort previous request |
166 | | - var request = $( '#edittoolbar-link-int-target-status' ).data( 'request' ); |
167 | | - if ( request ) |
168 | | - request.abort(); |
169 | | - |
170 | | - var target = $( '#edittoolbar-link-int-target' ).val(); |
171 | | - var cache = $( '#edittoolbar-link-int-target-status' ).data( 'cache' ); |
172 | | - if ( cache[target] ) { |
173 | | - updateWidget( cache[target] ); |
174 | | - return; |
175 | | - } |
176 | | - |
177 | | - if ( target == '' ) { |
178 | | - // Hide the widget when the textbox is empty |
179 | | - $( '#edittoolbar-link-int-target-status' ).children().hide(); |
180 | | - return; |
181 | | - } |
182 | | - if ( target.indexOf( '|' ) != -1 ) { |
183 | | - // Title contains | , which means it's invalid |
184 | | - // but confuses the API. Show invalid and bypass API |
185 | | - updateWidget( 'invalid' ); |
186 | | - return; |
187 | | - } |
188 | | - |
189 | | - updateWidget( 'loading' ); |
190 | | - var request = $.ajax( { |
191 | | - url: wgScriptPath + '/api.php', |
192 | | - dataType: 'json', |
193 | | - data: { |
194 | | - 'action': 'query', |
195 | | - 'indexpageids': '', |
196 | | - 'titles': target, |
197 | | - 'format': 'json' |
198 | | - }, |
199 | | - success: function( data ) { |
200 | | - // TODO: What happens if data.query.pageids is undefined? |
201 | | - var page = data.query.pages[data.query.pageids[0]]; |
202 | | - var status = 'exists'; |
203 | | - if ( typeof page.missing != 'undefined' ) |
204 | | - status = 'notexists'; |
205 | | - else if ( typeof page.invalid != 'undefined' ) |
206 | | - status = 'invalid'; |
207 | | - |
208 | | - cache[target] = status; |
209 | | - updateWidget( status ); |
210 | | - } |
211 | | - }); |
212 | | - // Save request object so it can be aborted if necessary |
213 | | - $( '#edittoolbar-link-int-target-status' ).data( 'request', request ); |
214 | | - } |
215 | | - |
216 | | - $( '#edittoolbar-link-int-target' ).bind( 'keypress paste', function() { |
217 | | - // Cancel the running timer if applicable |
218 | | - if ( typeof $(this).data( 'timerID' ) != 'undefined' ) |
219 | | - clearTimeout( $(this).data( 'timerID' ) ); |
220 | | - |
221 | | - // Delay fetch for a while |
222 | | - // FIXME: Make 250 configurable elsewhere |
223 | | - var timerID = setTimeout( updateExistence, 250 ); |
224 | | - $(this).data( 'timerID', timerID ); |
225 | | - }).change( function() { |
226 | | - // Cancel the running timer if applicable |
227 | | - if ( typeof $(this).data( 'timerID' ) != 'undefined' ) |
228 | | - clearTimeout( $(this).data( 'timerID' ) ); |
229 | | - |
230 | | - // Fetch right now |
231 | | - updateExistence(); |
232 | | - }); |
233 | | - }, |
234 | | - dialog: { |
235 | | - width: 550, // FIXME: autoresize width |
236 | | - buttons: { |
237 | | - 'edittoolbar-tool-link-insert': function() { |
238 | | - function escapeInternalText( s ) { |
239 | | - return s.replace( /(]{2,})/g, '<nowiki>$1</nowiki>' ); |
240 | | - } |
241 | | - function escapeExternalTarget( s ) { |
242 | | - return s.replace( / /g, '%20' ) |
243 | | - .replace( /]/g, '%5D' ); |
244 | | - } |
245 | | - function escapeExternalText( s ) { |
246 | | - return s.replace( /(]+)/g, '<nowiki>$1</nowiki>' ); |
247 | | - } |
248 | | - var insertText = ''; |
249 | | - var whitespace = [ '', '' ]; |
250 | | - switch ( $( '#edittoolbar-link-tabs' ).tabs( 'option', 'selected' ) ) { |
251 | | - case 0: // Internal link |
252 | | - // FIXME: Exactly how fragile is this? |
253 | | - if ( $( '#edittoolbar-link-int-target-status-invalid' ).is( ':visible' ) ) { |
254 | | - // Refuse to add links to invalid titles |
255 | | - alert( gM( 'edittoolbar-tool-link-int-invalid' ) ); |
256 | | - return; |
257 | | - } |
258 | | - var target = $( '#edittoolbar-link-int-target' ).val(); |
259 | | - var text = $( '#edittoolbar-link-int-text' ).val(); |
260 | | - whitespace = $( '#edittoolbar-link-dialog-tab-int' ).data( 'whitespace' ); |
261 | | - if ( target == text ) |
262 | | - insertText = '[[' + target + ']]'; |
263 | | - else |
264 | | - insertText = '[[' + target + '|' + escapeInternalText( text ) + ']]'; |
265 | | - break; |
266 | | - case 1: |
267 | | - var target = $( '#edittoolbar-link-ext-target' ).val(); |
268 | | - var text = $( '#edittoolbar-link-ext-text' ).val(); |
269 | | - var escTarget = escapeExternalTarget( target ); |
270 | | - var escText = escapeExternalText( text ); |
271 | | - whitespace = $( '#edittoolbar-link-dialog-tab-ext' ).data( 'whitespace' ); |
272 | | - if ( escTarget == escText ) |
273 | | - insertText = escTarget; |
274 | | - else if ( text == '' ) |
275 | | - insertText = '[' + escTarget + ']'; |
276 | | - else |
277 | | - insertText = '[' + escTarget + ' ' + escText + ']'; |
278 | | - break; |
279 | | - } |
280 | | - // Preserve whitespace in selection when replacing |
281 | | - insertText = whitespace[0] + insertText + whitespace[1]; |
282 | | - $.wikiEditor.modules.toolbar.fn.doAction( $(this).data( 'context' ), { |
283 | | - type: 'replace', |
284 | | - options: { |
285 | | - pre: insertText |
286 | | - } |
287 | | - }, $(this) ); |
288 | | - $(this).dialog( 'close' ); |
289 | | - }, |
290 | | - 'edittoolbar-tool-link-cancel': function() { |
291 | | - $(this).dialog( 'close' ); |
292 | | - } |
293 | | - }, |
294 | | - open: function() { |
295 | | - // Smart pre-fill text fields |
296 | | - var selection = $(this).data( 'context' ).$textarea.getSelection(); |
297 | | - $( '#edittoolbar-link-dialog-tab-int' ).data( 'whitespace', [ '', '' ] ); |
298 | | - $( '#edittoolbar-link-dialog-tab-ext' ).data( 'whitespace', [ '', '' ] ); |
299 | | - if ( selection != '' ) { |
300 | | - var inttext, inttarget, exttext, exttarget; |
301 | | - var matches; |
302 | | - var tab = -1; |
303 | | - if ( ( matches = selection.match( /^(\s*)\[\[([^\]\|]+)(\|([^\]\|]*))?\]\](\s*)$/ ) ) ) { |
304 | | - // [[foo|bar]] or [[foo]] |
305 | | - inttarget = matches[2]; |
306 | | - inttext = ( matches[4] ? matches[4] : matches[2] ); |
307 | | - tab = 0; |
308 | | - // Preserve whitespace when replacing |
309 | | - $( '#edittoolbar-link-dialog-tab-int' ).data( 'whitespace', [ matches[1], matches[5] ] ); |
310 | | - } else if ( ( matches = selection.match( /^(\s*)\[([^\] ]+)( ([^\]]+))?\](\s*)$/ ) ) ) { |
311 | | - // [http://www.example.com foo] or [http://www.example.com] |
312 | | - exttarget = matches[2]; |
313 | | - exttext = ( matches[4] ? matches[4] : '' ); |
314 | | - tab = 1; |
315 | | - // Preserve whitespace when replacing |
316 | | - $( '#edittoolbar-link-dialog-tab-ext' ).data( 'whitespace', [ matches[1], matches[5] ] ); |
317 | | - } else { |
318 | | - inttarget = inttext = exttext = selection; |
319 | | - exttarget = 'http://'; |
320 | | - } |
321 | | - |
322 | | - // val() doesn't trigger the change event, so let's do that ourselves |
323 | | - if ( typeof inttext != 'undefined' ) |
324 | | - $( '#edittoolbar-link-int-text' ).val( inttext ).change(); |
325 | | - if ( typeof inttarget != 'undefined' ) |
326 | | - $( '#edittoolbar-link-int-target' ).val( inttarget ).change(); |
327 | | - if ( typeof exttext != 'undefined' ) |
328 | | - $( '#edittoolbar-link-ext-text' ).val( exttext ).change(); |
329 | | - if ( typeof exttarget != 'undefined' ) |
330 | | - $( '#edittoolbar-link-ext-target' ).val( exttarget ).change(); |
331 | | - if ( tab != -1 ) |
332 | | - $( '#edittoolbar-link-tabs' ).tabs( 'select', tab ); |
333 | | - } |
334 | | - $( '#edittoolbar-link-int-text' ).data( 'untouched', |
335 | | - $( '#edittoolbar-link-int-text' ).val() == $( '#edittoolbar-link-int-target' ).val() |
336 | | - ); |
337 | | - } |
338 | | - } |
339 | | - }, |
340 | | - 'insert-table': { |
341 | | - titleMsg: 'edittoolbar-tool-table-title', |
342 | | - id: 'edittoolbar-table-dialog', |
343 | | - html: '\ |
344 | | - <form><fieldset><legend rel="edittoolbar-tool-table-dimensions"></legend><table><tr>\ |
345 | | - <td class="label"><label for="edittoolbar-table-dimensions-columns"\ |
346 | | - rel="edittoolbar-tool-table-dimensions-columns"></label></td>\ |
347 | | - <td><input type="text" id="edittoolbar-table-dimensions-columns" size="2" /></td>\ |
348 | | - <td class="label"><label for="edittoolbar-table-dimensions-rows"\ |
349 | | - rel="edittoolbar-tool-table-dimensions-rows"></label></td>\ |
350 | | - <td><input type="text" id="edittoolbar-table-dimensions-rows" size="2" /></td>\ |
351 | | - </tr><tr>\ |
352 | | - <td class="label"><label for="edittoolbar-table-dimensions-headercolumns"\ |
353 | | - rel="edittoolbar-tool-table-dimensions-headercolumns"></label></td>\ |
354 | | - <td><input type="text" id="edittoolbar-table-dimensions-headercolumns" size="2" /></td>\ |
355 | | - <td class="label"><label for="edittoolbar-table-dimensions-headerrows"\ |
356 | | - rel="edittoolbar-tool-table-dimensions-headerrows"></label></td>\ |
357 | | - <td><input type="text" id="edittoolbar-table-dimensions-headerrows" size="2" /></td>\ |
358 | | - </tr></table></fieldset></form>', |
359 | | - init: function() { |
360 | | - $(this).find( '[rel]' ).each( function() { |
361 | | - $(this).text( gM( $(this).attr( 'rel' ) ) ); |
362 | | - }); |
363 | | - }, |
364 | | - dialog: { |
365 | | - width: 350, // FIXME: autoresize |
366 | | - buttons: { |
367 | | - 'edittoolbar-tool-table-insert': function() { |
368 | | - var rows = parseInt( $( '#edittoolbar-table-dimensions-rows' ).val() ); |
369 | | - var cols = parseInt( $( '#edittoolbar-table-dimensions-columns' ).val() ); |
370 | | - var hrows = parseInt( $( '#edittoolbar-table-dimensions-headerrows' ).val() ); |
371 | | - var hcols = parseInt( $( '#edittoolbar-table-dimensions-headercolumns' ).val() ); |
372 | | - |
373 | | - var table = "{|\n"; |
374 | | - for ( var r = 0; r < rows; r++ ) { |
375 | | - table += "|-\n"; |
376 | | - for ( var c = 0; c < cols; c++ ) { |
377 | | - var isHeader = ( r < hrows || c < hcols ); |
378 | | - var delim = isHeader ? '!' : '|'; |
379 | | - if ( c > 0 ) |
380 | | - delim += delim; |
381 | | - table += delim + ' ' + |
382 | | - gM( isHeader ? |
383 | | - 'edittoolbar-tool-table-example-header' : |
384 | | - 'edittoolbar-tool-table-example', |
385 | | - [ r + 1, c + 1 ] ) + ' '; |
386 | | - } |
387 | | - // Replace trailing space by newline |
388 | | - // table[table.length - 1] is read-only |
389 | | - table = table.substr( 0, table.length - 1 ) + "\n"; |
390 | | - } |
391 | | - table += "|}"; |
392 | | - $.wikiEditor.modules.toolbar.fn.doAction( |
393 | | - $(this).data( 'context' ), { |
394 | | - type: 'encapsulate', |
395 | | - options: { |
396 | | - pre: table, |
397 | | - ownline: true |
398 | | - } |
399 | | - }, $(this) ); |
400 | | - $(this).dialog( 'close' ); |
401 | | - }, |
402 | | - 'edittoolbar-tool-table-cancel': function() { |
403 | | - $(this).dialog( 'close' ); |
404 | | - } |
405 | | - } |
406 | | - } |
407 | | - }, |
408 | | - 'search-and-replace': { |
409 | | - titleMsg: 'edittoolbar-tool-replace-title', |
410 | | - id: 'edittoolbar-replace-dialog', |
411 | | - html: '\ |
412 | | - <form><fieldset><table><tr>\ |
413 | | - <td><label for="edittoolbar-replace-search" rel="edittoolbar-tool-replace-search"></label></td>\ |
414 | | - <td><input type="text" id="edittoolbar-replace-search" /></td>\ |
415 | | - </tr><tr>\ |
416 | | - <td><label for="edittoolbar-replace-replace" rel="edittoolbar-tool-replace-replace"></label></td>\ |
417 | | - <td><input type="text" id="edittoolbar-replace-replace" /></td>\ |
418 | | - </tr></table><table><tr>\ |
419 | | - <td><input type="checkbox" id="edittoolbar-replace-case" /></td>\ |
420 | | - <td><label for="edittoolbar-replace-case" rel="edittoolbar-tool-replace-case"></label></td>\ |
421 | | - </tr><tr>\ |
422 | | - <td><input type="checkbox" id="edittoolbar-replace-regex" /></td>\ |
423 | | - <td><label for="edittoolbar-replace-regex" rel="edittoolbar-tool-replace-regex"></label></td>\ |
424 | | - </tr><tr>\ |
425 | | - <td><input type="checkbox" id="edittoolbar-replace-all" /></td>\ |
426 | | - <td><label for="edittoolbar-replace-all" rel="edittoolbar-tool-replace-all"></label></td>\ |
427 | | - </tr></table></fieldset></form>', |
428 | | - init: function() { |
429 | | - $(this).find( '[rel]' ).each( function() { |
430 | | - $(this).text( gM( $(this).attr( 'rel' ) ) ); |
431 | | - }); |
432 | | - }, |
433 | | - dialog: { |
434 | | - width: 350, // FIXME: autoresize width |
435 | | - buttons: { |
436 | | - 'edittoolbar-tool-replace-button': function() { |
437 | | - var searchStr = $( '#edittoolbar-replace-search' ).val(); |
438 | | - var replaceStr = $( '#edittoolbar-replace-replace' ).val(); |
439 | | - var flags = ''; |
440 | | - if ( !$( '#edittoolbar-replace-case' ).is( ':checked' ) ) |
441 | | - flags += 'i'; |
442 | | - if ( $( '#edittoolbar-replace-all' ).is( ':checked' ) ) |
443 | | - flags += 'g'; |
444 | | - if ( !$( '#edittoolbar-replace-regex' ).is( ':checked' ) ) |
445 | | - searchStr = RegExp.escape( searchStr ); |
446 | | - var regex = new RegExp( searchStr, flags ); |
447 | | - var $textarea = $(this).data( 'context' ).$textarea; |
448 | | - if ( !$textarea.val().match( regex ) ) |
449 | | - alert( gM( 'edittoolbar-tool-replace-nomatch' ) ); |
450 | | - else |
451 | | - $textarea.val( $textarea.val().replace( regex, replaceStr ) ); |
452 | | - // TODO: Hook for wikEd |
453 | | - }, |
454 | | - 'edittoolbar-tool-replace-close': function() { |
455 | | - $(this).dialog( 'close' ); |
456 | | - } |
457 | | - } |
458 | | - } |
459 | | - } |
460 | | -} |
| 76 | +'modules': {} |
461 | 77 | |
462 | 78 | }; } ) ( jQuery ); |
\ No newline at end of file |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -1031,6 +1031,11 @@ |
1032 | 1032 | if ( data.dialog in $.wikiEditor.modules.dialogs.modules ) { |
1033 | 1033 | $( '#' + $.wikiEditor.modules.dialogs.modules[data.dialog].id ).dialog( 'open' ); |
1034 | 1034 | } |
| 1035 | + }, |
| 1036 | + closeDialog: function( context, data ) { |
| 1037 | + if ( data.dialog in $.wikiEditor.modules.dialogs.modules ) { |
| 1038 | + $( '#' + $.wikiEditor.modules.dialogs.modules[data.dialog].id ).dialog( 'close' ); |
| 1039 | + } |
1035 | 1040 | } |
1036 | 1041 | }, |
1037 | 1042 | /** |
— | — | @@ -1044,11 +1049,9 @@ |
1045 | 1050 | * @param {Object} config Configuration object to create module from |
1046 | 1051 | */ |
1047 | 1052 | create: function( context, config ) { |
1048 | | - // Accept additional modules |
1049 | | - if ( 'modules' in config ) { |
1050 | | - for ( module in config.modules ) { |
1051 | | - $.wikiEditor.modules.dialogs.modules[module] = config.modules[module]; |
1052 | | - } |
| 1053 | + // Add modules |
| 1054 | + for ( module in config ) { |
| 1055 | + $.wikiEditor.modules.dialogs.modules[module] = config[module]; |
1053 | 1056 | } |
1054 | 1057 | // Build out modules immediately |
1055 | 1058 | for ( module in $.wikiEditor.modules.dialogs.modules ) { |
— | — | @@ -1080,394 +1083,7 @@ |
1081 | 1084 | } |
1082 | 1085 | } |
1083 | 1086 | }, |
1084 | | -/** |
1085 | | - * Stock modules |
1086 | | - */ |
1087 | | -modules: { |
1088 | | - 'insert-link': { |
1089 | | - titleMsg: 'edittoolbar-tool-link-title', |
1090 | | - id: 'edittoolbar-link-dialog', |
1091 | | - html: '\ |
1092 | | - <div id="edittoolbar-link-tabs">\ |
1093 | | - <ul>\ |
1094 | | - <li><a href="#edittoolbar-link-dialog-tab-int" rel="edittoolbar-tool-link-int"></a></li>\ |
1095 | | - <li><a href="#edittoolbar-link-dialog-tab-ext" rel="edittoolbar-tool-link-ext"></a></li>\ |
1096 | | - </ul>\ |
1097 | | - <div id="edittoolbar-link-dialog-tab-int"><form><fieldset><table><tr>\ |
1098 | | - <td><label for="edittoolbar-link-int-target" rel="edittoolbar-tool-link-int-target"></label></td>\ |
1099 | | - <td>\ |
1100 | | - <input type="text" id="edittoolbar-link-int-target" />\ |
1101 | | - <div id="edittoolbar-link-int-target-status" style="display: inline;"></div>\ |
1102 | | - </td>\ |
1103 | | - </tr><tr>\ |
1104 | | - <td><label for="edittoolbar-link-int-text" rel="edittoolbar-tool-link-int-text"></label></td>\ |
1105 | | - <td><input type="text" id="edittoolbar-link-int-text" /></td>\ |
1106 | | - </table></fieldset></form></div>\ |
1107 | | - <div id="edittoolbar-link-dialog-tab-ext"><form><fieldset><table><tr>\ |
1108 | | - <td><label for="edittoolbar-link-ext-target" rel="edittoolbar-tool-link-ext-target"></label></td>\ |
1109 | | - <td><input type="text" id="edittoolbar-link-ext-target" /></td>\ |
1110 | | - </tr><tr>\ |
1111 | | - <td><label for="edittoolbar-link-ext-text" rel="edittoolbar-tool-link-ext-text"></label></td>\ |
1112 | | - <td><input type="text" id="edittoolbar-link-ext-text" /></td>\ |
1113 | | - </table></fieldset></form></div>\ |
1114 | | - </div>', |
1115 | | - init: function() { |
1116 | | - $(this).find( '[rel]' ).each( function() { |
1117 | | - $(this).text( gM( $(this).attr( 'rel' ) ) ); |
1118 | | - }); |
1119 | | - $( '#edittoolbar-link-tabs' ).tabs(); |
1120 | | - |
1121 | | - // Link int-target and int-text fields |
1122 | | - // This means mirroring the contents of int-target in int-text |
1123 | | - // as long as int-text itself hasn't been changed by the user |
1124 | | - $( '#edittoolbar-link-int-target' ).bind( 'keypress paste', function() { |
1125 | | - // $(this).val() is the old value, before the keypress |
1126 | | - if ( $( '#edittoolbar-link-int-text' ).data( 'untouched' ) ) |
1127 | | - // Defer this until $(this).val() has been updated |
1128 | | - setTimeout( function() { |
1129 | | - $( '#edittoolbar-link-int-text' ).val( $( '#edittoolbar-link-int-target' ).val() ); |
1130 | | - }, 0 ); |
1131 | | - }); |
1132 | | - $( '#edittoolbar-link-int-text' ).bind( 'keypress paste', function() { |
1133 | | - $(this).data( 'untouched', false ); |
1134 | | - }); |
1135 | | - $( '#edittoolbar-link-ext-target' ).val( 'http://' ); |
1136 | | - |
1137 | | - // Page existence check widget |
1138 | | - var existsImg = $.wikiEditor.imgPath + 'dialogs/' + 'insert-link-exists.png'; |
1139 | | - var notexistsImg = $.wikiEditor.imgPath + 'dialogs/' + 'insert-link-notexists.png'; |
1140 | | - var invalidImg = $.wikiEditor.imgPath + 'dialogs/' + 'insert-link-invalid.png'; |
1141 | | - var loadingImg = $.wikiEditor.imgPath + 'loading.gif'; |
1142 | | - var existsMsg = gM( 'edittoolbar-tool-link-int-target-status-exists' ); |
1143 | | - var notexistsMsg = gM( 'edittoolbar-tool-link-int-target-status-notexists' ); |
1144 | | - var invalidMsg = gM( 'edittoolbar-tool-link-int-target-status-invalid' ); |
1145 | | - var loadingMsg = gM( 'edittoolbar-tool-link-int-target-status-loading' ); |
1146 | | - $( '#edittoolbar-link-int-target-status' ) |
1147 | | - .append( $( '<img />' ).attr( { |
1148 | | - 'id': 'edittoolbar-link-int-target-status-exists', |
1149 | | - 'src': existsImg, |
1150 | | - 'alt': existsMsg, |
1151 | | - 'title': existsMsg } ) ) |
1152 | | - .append( $( '<img />' ).attr( { |
1153 | | - 'id': 'edittoolbar-link-int-target-status-notexists', |
1154 | | - 'src': notexistsImg, |
1155 | | - 'alt': notexistsMsg, |
1156 | | - 'title': notexistsMsg } ) ) |
1157 | | - .append( $( '<img />' ).attr( { |
1158 | | - 'id': 'edittoolbar-link-int-target-status-invalid', |
1159 | | - 'src': invalidImg, |
1160 | | - 'alt': invalidMsg, |
1161 | | - 'title': invalidMsg } ) ) |
1162 | | - .append( $( '<img />' ).attr( { |
1163 | | - 'id': 'edittoolbar-link-int-target-status-loading', |
1164 | | - 'src': loadingImg, |
1165 | | - 'alt': loadingMsg, |
1166 | | - 'title': loadingMsg } ) ) |
1167 | | - .data( 'cache', {} ) |
1168 | | - .children().hide(); |
1169 | | - |
1170 | | - function updateExistence( target ) { |
1171 | | - function updateWidget( status ) { |
1172 | | - $( '#edittoolbar-link-int-target-status' ).children().hide(); |
1173 | | - $( '#edittoolbar-link-int-target-status-' + status ).show(); |
1174 | | - } |
1175 | | - |
1176 | | - // Abort previous request |
1177 | | - var request = $( '#edittoolbar-link-int-target-status' ).data( 'request' ); |
1178 | | - if ( request ) |
1179 | | - request.abort(); |
1180 | | - |
1181 | | - var target = $( '#edittoolbar-link-int-target' ).val(); |
1182 | | - var cache = $( '#edittoolbar-link-int-target-status' ).data( 'cache' ); |
1183 | | - if ( cache[target] ) { |
1184 | | - updateWidget( cache[target] ); |
1185 | | - return; |
1186 | | - } |
1187 | | - |
1188 | | - if ( target == '' ) { |
1189 | | - // Hide the widget when the textbox is empty |
1190 | | - $( '#edittoolbar-link-int-target-status' ).children().hide(); |
1191 | | - return; |
1192 | | - } |
1193 | | - if ( target.indexOf( '|' ) != -1 ) { |
1194 | | - // Title contains | , which means it's invalid |
1195 | | - // but confuses the API. Show invalid and bypass API |
1196 | | - updateWidget( 'invalid' ); |
1197 | | - return; |
1198 | | - } |
1199 | | - |
1200 | | - updateWidget( 'loading' ); |
1201 | | - var request = $.ajax( { |
1202 | | - url: wgScriptPath + '/api.php', |
1203 | | - dataType: 'json', |
1204 | | - data: { |
1205 | | - 'action': 'query', |
1206 | | - 'indexpageids': '', |
1207 | | - 'titles': target, |
1208 | | - 'format': 'json' |
1209 | | - }, |
1210 | | - success: function( data ) { |
1211 | | - // TODO: What happens if data.query.pageids is undefined? |
1212 | | - var page = data.query.pages[data.query.pageids[0]]; |
1213 | | - var status = 'exists'; |
1214 | | - if ( typeof page.missing != 'undefined' ) |
1215 | | - status = 'notexists'; |
1216 | | - else if ( typeof page.invalid != 'undefined' ) |
1217 | | - status = 'invalid'; |
1218 | | - |
1219 | | - cache[target] = status; |
1220 | | - updateWidget( status ); |
1221 | | - } |
1222 | | - }); |
1223 | | - // Save request object so it can be aborted if necessary |
1224 | | - $( '#edittoolbar-link-int-target-status' ).data( 'request', request ); |
1225 | | - } |
1226 | | - |
1227 | | - $( '#edittoolbar-link-int-target' ).bind( 'keypress paste', function() { |
1228 | | - // Cancel the running timer if applicable |
1229 | | - if ( typeof $(this).data( 'timerID' ) != 'undefined' ) |
1230 | | - clearTimeout( $(this).data( 'timerID' ) ); |
1231 | | - |
1232 | | - // Delay fetch for a while |
1233 | | - // FIXME: Make 250 configurable elsewhere |
1234 | | - var timerID = setTimeout( updateExistence, 250 ); |
1235 | | - $(this).data( 'timerID', timerID ); |
1236 | | - }).change( function() { |
1237 | | - // Cancel the running timer if applicable |
1238 | | - if ( typeof $(this).data( 'timerID' ) != 'undefined' ) |
1239 | | - clearTimeout( $(this).data( 'timerID' ) ); |
1240 | | - |
1241 | | - // Fetch right now |
1242 | | - updateExistence(); |
1243 | | - }); |
1244 | | - }, |
1245 | | - dialog: { |
1246 | | - width: 550, // FIXME: autoresize width |
1247 | | - buttons: { |
1248 | | - 'edittoolbar-tool-link-insert': function() { |
1249 | | - function escapeInternalText( s ) { |
1250 | | - return s.replace( /(]{2,})/g, '<nowiki>$1</nowiki>' ); |
1251 | | - } |
1252 | | - function escapeExternalTarget( s ) { |
1253 | | - return s.replace( / /g, '%20' ) |
1254 | | - .replace( /]/g, '%5D' ); |
1255 | | - } |
1256 | | - function escapeExternalText( s ) { |
1257 | | - return s.replace( /(]+)/g, '<nowiki>$1</nowiki>' ); |
1258 | | - } |
1259 | | - var insertText = ''; |
1260 | | - var whitespace = [ '', '' ]; |
1261 | | - switch ( $( '#edittoolbar-link-tabs' ).tabs( 'option', 'selected' ) ) { |
1262 | | - case 0: // Internal link |
1263 | | - // FIXME: Exactly how fragile is this? |
1264 | | - if ( $( '#edittoolbar-link-int-target-status-invalid' ).is( ':visible' ) ) { |
1265 | | - // Refuse to add links to invalid titles |
1266 | | - alert( gM( 'edittoolbar-tool-link-int-invalid' ) ); |
1267 | | - return; |
1268 | | - } |
1269 | | - var target = $( '#edittoolbar-link-int-target' ).val(); |
1270 | | - var text = $( '#edittoolbar-link-int-text' ).val(); |
1271 | | - whitespace = $( '#edittoolbar-link-dialog-tab-int' ).data( 'whitespace' ); |
1272 | | - if ( target == text ) |
1273 | | - insertText = '[[' + target + ']]'; |
1274 | | - else |
1275 | | - insertText = '[[' + target + '|' + escapeInternalText( text ) + ']]'; |
1276 | | - break; |
1277 | | - case 1: |
1278 | | - var target = $( '#edittoolbar-link-ext-target' ).val(); |
1279 | | - var text = $( '#edittoolbar-link-ext-text' ).val(); |
1280 | | - var escTarget = escapeExternalTarget( target ); |
1281 | | - var escText = escapeExternalText( text ); |
1282 | | - whitespace = $( '#edittoolbar-link-dialog-tab-ext' ).data( 'whitespace' ); |
1283 | | - if ( escTarget == escText ) |
1284 | | - insertText = escTarget; |
1285 | | - else if ( text == '' ) |
1286 | | - insertText = '[' + escTarget + ']'; |
1287 | | - else |
1288 | | - insertText = '[' + escTarget + ' ' + escText + ']'; |
1289 | | - break; |
1290 | | - } |
1291 | | - // Preserve whitespace in selection when replacing |
1292 | | - insertText = whitespace[0] + insertText + whitespace[1]; |
1293 | | - $.wikiEditor.modules.toolbar.fn.doAction( $(this).data( 'context' ), { |
1294 | | - type: 'replace', |
1295 | | - options: { |
1296 | | - pre: insertText |
1297 | | - } |
1298 | | - }, $(this) ); |
1299 | | - $(this).dialog( 'close' ); |
1300 | | - }, |
1301 | | - 'edittoolbar-tool-link-cancel': function() { |
1302 | | - $(this).dialog( 'close' ); |
1303 | | - } |
1304 | | - }, |
1305 | | - open: function() { |
1306 | | - // Smart pre-fill text fields |
1307 | | - var selection = $(this).data( 'context' ).$textarea.getSelection(); |
1308 | | - $( '#edittoolbar-link-dialog-tab-int' ).data( 'whitespace', [ '', '' ] ); |
1309 | | - $( '#edittoolbar-link-dialog-tab-ext' ).data( 'whitespace', [ '', '' ] ); |
1310 | | - if ( selection != '' ) { |
1311 | | - var inttext, inttarget, exttext, exttarget; |
1312 | | - var matches; |
1313 | | - var tab = -1; |
1314 | | - if ( ( matches = selection.match( /^(\s*)\[\[([^\]\|]+)(\|([^\]\|]*))?\]\](\s*)$/ ) ) ) { |
1315 | | - // [[foo|bar]] or [[foo]] |
1316 | | - inttarget = matches[2]; |
1317 | | - inttext = ( matches[4] ? matches[4] : matches[2] ); |
1318 | | - tab = 0; |
1319 | | - // Preserve whitespace when replacing |
1320 | | - $( '#edittoolbar-link-dialog-tab-int' ).data( 'whitespace', [ matches[1], matches[5] ] ); |
1321 | | - } else if ( ( matches = selection.match( /^(\s*)\[([^\] ]+)( ([^\]]+))?\](\s*)$/ ) ) ) { |
1322 | | - // [http://www.example.com foo] or [http://www.example.com] |
1323 | | - exttarget = matches[2]; |
1324 | | - exttext = ( matches[4] ? matches[4] : '' ); |
1325 | | - tab = 1; |
1326 | | - // Preserve whitespace when replacing |
1327 | | - $( '#edittoolbar-link-dialog-tab-ext' ).data( 'whitespace', [ matches[1], matches[5] ] ); |
1328 | | - } else { |
1329 | | - inttarget = inttext = exttext = selection; |
1330 | | - exttarget = 'http://'; |
1331 | | - } |
1332 | | - |
1333 | | - // val() doesn't trigger the change event, so let's do that ourselves |
1334 | | - if ( typeof inttext != 'undefined' ) |
1335 | | - $( '#edittoolbar-link-int-text' ).val( inttext ).change(); |
1336 | | - if ( typeof inttarget != 'undefined' ) |
1337 | | - $( '#edittoolbar-link-int-target' ).val( inttarget ).change(); |
1338 | | - if ( typeof exttext != 'undefined' ) |
1339 | | - $( '#edittoolbar-link-ext-text' ).val( exttext ).change(); |
1340 | | - if ( typeof exttarget != 'undefined' ) |
1341 | | - $( '#edittoolbar-link-ext-target' ).val( exttarget ).change(); |
1342 | | - if ( tab != -1 ) |
1343 | | - $( '#edittoolbar-link-tabs' ).tabs( 'select', tab ); |
1344 | | - } |
1345 | | - $( '#edittoolbar-link-int-text' ).data( 'untouched', |
1346 | | - $( '#edittoolbar-link-int-text' ).val() == $( '#edittoolbar-link-int-target' ).val() |
1347 | | - ); |
1348 | | - } |
1349 | | - } |
1350 | | - }, |
1351 | | - 'insert-table': { |
1352 | | - titleMsg: 'edittoolbar-tool-table-title', |
1353 | | - id: 'edittoolbar-table-dialog', |
1354 | | - html: '\ |
1355 | | - <form><fieldset><legend rel="edittoolbar-tool-table-dimensions"></legend><table><tr>\ |
1356 | | - <td class="label"><label for="edittoolbar-table-dimensions-columns"\ |
1357 | | - rel="edittoolbar-tool-table-dimensions-columns"></label></td>\ |
1358 | | - <td><input type="text" id="edittoolbar-table-dimensions-columns" size="2" /></td>\ |
1359 | | - <td class="label"><label for="edittoolbar-table-dimensions-rows"\ |
1360 | | - rel="edittoolbar-tool-table-dimensions-rows"></label></td>\ |
1361 | | - <td><input type="text" id="edittoolbar-table-dimensions-rows" size="2" /></td>\ |
1362 | | - </tr><tr>\ |
1363 | | - <td class="label"><label for="edittoolbar-table-dimensions-headercolumns"\ |
1364 | | - rel="edittoolbar-tool-table-dimensions-headercolumns"></label></td>\ |
1365 | | - <td><input type="text" id="edittoolbar-table-dimensions-headercolumns" size="2" /></td>\ |
1366 | | - <td class="label"><label for="edittoolbar-table-dimensions-headerrows"\ |
1367 | | - rel="edittoolbar-tool-table-dimensions-headerrows"></label></td>\ |
1368 | | - <td><input type="text" id="edittoolbar-table-dimensions-headerrows" size="2" /></td>\ |
1369 | | - </tr></table></fieldset></form>', |
1370 | | - init: function() { |
1371 | | - $(this).find( '[rel]' ).each( function() { |
1372 | | - $(this).text( gM( $(this).attr( 'rel' ) ) ); |
1373 | | - }); |
1374 | | - }, |
1375 | | - dialog: { |
1376 | | - width: 350, // FIXME: autoresize |
1377 | | - buttons: { |
1378 | | - 'edittoolbar-tool-table-insert': function() { |
1379 | | - var rows = parseInt( $( '#edittoolbar-table-dimensions-rows' ).val() ); |
1380 | | - var cols = parseInt( $( '#edittoolbar-table-dimensions-columns' ).val() ); |
1381 | | - var hrows = parseInt( $( '#edittoolbar-table-dimensions-headerrows' ).val() ); |
1382 | | - var hcols = parseInt( $( '#edittoolbar-table-dimensions-headercolumns' ).val() ); |
1383 | | - |
1384 | | - var table = "{|\n"; |
1385 | | - for ( var r = 0; r < rows; r++ ) { |
1386 | | - table += "|-\n"; |
1387 | | - for ( var c = 0; c < cols; c++ ) { |
1388 | | - var isHeader = ( r < hrows || c < hcols ); |
1389 | | - var delim = isHeader ? '!' : '|'; |
1390 | | - if ( c > 0 ) |
1391 | | - delim += delim; |
1392 | | - table += delim + ' ' + |
1393 | | - gM( isHeader ? |
1394 | | - 'edittoolbar-tool-table-example-header' : |
1395 | | - 'edittoolbar-tool-table-example', |
1396 | | - [ r + 1, c + 1 ] ) + ' '; |
1397 | | - } |
1398 | | - // Replace trailing space by newline |
1399 | | - // table[table.length - 1] is read-only |
1400 | | - table = table.substr( 0, table.length - 1 ) + "\n"; |
1401 | | - } |
1402 | | - table += "|}"; |
1403 | | - $.wikiEditor.modules.toolbar.fn.doAction( |
1404 | | - $(this).data( 'context' ), { |
1405 | | - type: 'encapsulate', |
1406 | | - options: { |
1407 | | - pre: table, |
1408 | | - ownline: true |
1409 | | - } |
1410 | | - }, $(this) ); |
1411 | | - $(this).dialog( 'close' ); |
1412 | | - }, |
1413 | | - 'edittoolbar-tool-table-cancel': function() { |
1414 | | - $(this).dialog( 'close' ); |
1415 | | - } |
1416 | | - } |
1417 | | - } |
1418 | | - }, |
1419 | | - 'search-and-replace': { |
1420 | | - titleMsg: 'edittoolbar-tool-replace-title', |
1421 | | - id: 'edittoolbar-replace-dialog', |
1422 | | - html: '\ |
1423 | | - <form><fieldset><table><tr>\ |
1424 | | - <td><label for="edittoolbar-replace-search" rel="edittoolbar-tool-replace-search"></label></td>\ |
1425 | | - <td><input type="text" id="edittoolbar-replace-search" /></td>\ |
1426 | | - </tr><tr>\ |
1427 | | - <td><label for="edittoolbar-replace-replace" rel="edittoolbar-tool-replace-replace"></label></td>\ |
1428 | | - <td><input type="text" id="edittoolbar-replace-replace" /></td>\ |
1429 | | - </tr></table><table><tr>\ |
1430 | | - <td><input type="checkbox" id="edittoolbar-replace-case" /></td>\ |
1431 | | - <td><label for="edittoolbar-replace-case" rel="edittoolbar-tool-replace-case"></label></td>\ |
1432 | | - </tr><tr>\ |
1433 | | - <td><input type="checkbox" id="edittoolbar-replace-regex" /></td>\ |
1434 | | - <td><label for="edittoolbar-replace-regex" rel="edittoolbar-tool-replace-regex"></label></td>\ |
1435 | | - </tr><tr>\ |
1436 | | - <td><input type="checkbox" id="edittoolbar-replace-all" /></td>\ |
1437 | | - <td><label for="edittoolbar-replace-all" rel="edittoolbar-tool-replace-all"></label></td>\ |
1438 | | - </tr></table></fieldset></form>', |
1439 | | - init: function() { |
1440 | | - $(this).find( '[rel]' ).each( function() { |
1441 | | - $(this).text( gM( $(this).attr( 'rel' ) ) ); |
1442 | | - }); |
1443 | | - }, |
1444 | | - dialog: { |
1445 | | - width: 350, // FIXME: autoresize width |
1446 | | - buttons: { |
1447 | | - 'edittoolbar-tool-replace-button': function() { |
1448 | | - var searchStr = $( '#edittoolbar-replace-search' ).val(); |
1449 | | - var replaceStr = $( '#edittoolbar-replace-replace' ).val(); |
1450 | | - var flags = ''; |
1451 | | - if ( !$( '#edittoolbar-replace-case' ).is( ':checked' ) ) |
1452 | | - flags += 'i'; |
1453 | | - if ( $( '#edittoolbar-replace-all' ).is( ':checked' ) ) |
1454 | | - flags += 'g'; |
1455 | | - if ( !$( '#edittoolbar-replace-regex' ).is( ':checked' ) ) |
1456 | | - searchStr = RegExp.escape( searchStr ); |
1457 | | - var regex = new RegExp( searchStr, flags ); |
1458 | | - var $textarea = $(this).data( 'context' ).$textarea; |
1459 | | - if ( !$textarea.val().match( regex ) ) |
1460 | | - alert( gM( 'edittoolbar-tool-replace-nomatch' ) ); |
1461 | | - else |
1462 | | - $textarea.val( $textarea.val().replace( regex, replaceStr ) ); |
1463 | | - // TODO: Hook for wikEd |
1464 | | - }, |
1465 | | - 'edittoolbar-tool-replace-close': function() { |
1466 | | - $(this).dialog( 'close' ); |
1467 | | - } |
1468 | | - } |
1469 | | - } |
1470 | | - } |
1471 | | -} |
| 1087 | +'modules': {} |
1472 | 1088 | |
1473 | 1089 | }; } ) ( jQuery );/** |
1474 | 1090 | * This plugin provides a way to build a user interface around a textarea. You |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -107,100 +107,9 @@ |
108 | 108 | return($.os.name=='mac'?13:($.os.name=='linux'?15:16))*row;} |
109 | 109 | return this.each(function(){$(this).focus();if(this.selectionStart||this.selectionStart=='0'){this.selectionStart=pos;this.selectionEnd=pos;$(this).scrollTop(getCaretScrollPosition(this));}else if(document.selection&&document.selection.createRange){var range=document.selection.createRange();var oldPos=$(this).getCaretPosition();var goBack=false;if(oldPos==pos){pos++;goBack=true;} |
110 | 110 | range.moveToElementText(this);range.collapse();range.move('character',pos);range.select();this.scrollTop+=range.offsetTop;if(goBack){range.move('character',-1);range.select();}} |
111 | | -$(this).trigger('scrollToPosition');});}});})(jQuery);RegExp.escape=function(s){return s.replace(/([.*+?^${}()|\/\\[\]])/g,'\\$1');};(function($){$.wikiEditor.modules.dialogs={api:{addDialog:function(context,data){$.wikiEditor.modules.dialogs.fn.create(context,{'modules':data})},openDialog:function(context,data){if(data.dialog in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[data.dialog].id).dialog('open');}}},fn:{create:function(context,config){if('modules'in config){for(module in config.modules){$.wikiEditor.modules.dialogs.modules[module]=config.modules[module];}} |
| 111 | +$(this).trigger('scrollToPosition');});}});})(jQuery);RegExp.escape=function(s){return s.replace(/([.*+?^${}()|\/\\[\]])/g,'\\$1');};(function($){$.wikiEditor.modules.dialogs={api:{addDialog:function(context,data){$.wikiEditor.modules.dialogs.fn.create(context,{'modules':data})},openDialog:function(context,data){if(data.dialog in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[data.dialog].id).dialog('open');}},closeDialog:function(context,data){if(data.dialog in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[data.dialog].id).dialog('close');}}},fn:{create:function(context,config){for(module in config){$.wikiEditor.modules.dialogs.modules[module]=config[module];} |
112 | 112 | for(module in $.wikiEditor.modules.dialogs.modules){var module=$.wikiEditor.modules.dialogs.modules[module];if($('#'+module.id).size()==0){var configuration=module.dialog;configuration.bgiframe=true;configuration.autoOpen=false;configuration.modal=true;configuration.title=$.wikiEditor.autoMsg(module,'title');for(msg in configuration.buttons){configuration.buttons[gM(msg)]=configuration.buttons[msg];delete configuration.buttons[msg];} |
113 | | -$('<div /> ').attr('id',module.id).html(module.html).data('context',context).appendTo($('body')).each(module.init).dialog(configuration);}}}},modules:{'insert-link':{titleMsg:'edittoolbar-tool-link-title',id:'edittoolbar-link-dialog',html:'\ |
114 | | - <div id="edittoolbar-link-tabs">\ |
115 | | - <ul>\ |
116 | | - <li><a href="#edittoolbar-link-dialog-tab-int" rel="edittoolbar-tool-link-int"></a></li>\ |
117 | | - <li><a href="#edittoolbar-link-dialog-tab-ext" rel="edittoolbar-tool-link-ext"></a></li>\ |
118 | | - </ul>\ |
119 | | - <div id="edittoolbar-link-dialog-tab-int"><form><fieldset><table><tr>\ |
120 | | - <td><label for="edittoolbar-link-int-target" rel="edittoolbar-tool-link-int-target"></label></td>\ |
121 | | - <td>\ |
122 | | - <input type="text" id="edittoolbar-link-int-target" />\ |
123 | | - <div id="edittoolbar-link-int-target-status" style="display: inline;"></div>\ |
124 | | - </td>\ |
125 | | - </tr><tr>\ |
126 | | - <td><label for="edittoolbar-link-int-text" rel="edittoolbar-tool-link-int-text"></label></td>\ |
127 | | - <td><input type="text" id="edittoolbar-link-int-text" /></td>\ |
128 | | - </table></fieldset></form></div>\ |
129 | | - <div id="edittoolbar-link-dialog-tab-ext"><form><fieldset><table><tr>\ |
130 | | - <td><label for="edittoolbar-link-ext-target" rel="edittoolbar-tool-link-ext-target"></label></td>\ |
131 | | - <td><input type="text" id="edittoolbar-link-ext-target" /></td>\ |
132 | | - </tr><tr>\ |
133 | | - <td><label for="edittoolbar-link-ext-text" rel="edittoolbar-tool-link-ext-text"></label></td>\ |
134 | | - <td><input type="text" id="edittoolbar-link-ext-text" /></td>\ |
135 | | - </table></fieldset></form></div>\ |
136 | | - </div>',init:function(){$(this).find('[rel]').each(function(){$(this).text(gM($(this).attr('rel')));});$('#edittoolbar-link-tabs').tabs();$('#edittoolbar-link-int-target').bind('keypress paste',function(){if($('#edittoolbar-link-int-text').data('untouched')) |
137 | | -setTimeout(function(){$('#edittoolbar-link-int-text').val($('#edittoolbar-link-int-target').val());},0);});$('#edittoolbar-link-int-text').bind('keypress paste',function(){$(this).data('untouched',false);});$('#edittoolbar-link-ext-target').val('http://');var existsImg=$.wikiEditor.imgPath+'dialogs/'+'insert-link-exists.png';var notexistsImg=$.wikiEditor.imgPath+'dialogs/'+'insert-link-notexists.png';var invalidImg=$.wikiEditor.imgPath+'dialogs/'+'insert-link-invalid.png';var loadingImg=$.wikiEditor.imgPath+'loading.gif';var existsMsg=gM('edittoolbar-tool-link-int-target-status-exists');var notexistsMsg=gM('edittoolbar-tool-link-int-target-status-notexists');var invalidMsg=gM('edittoolbar-tool-link-int-target-status-invalid');var loadingMsg=gM('edittoolbar-tool-link-int-target-status-loading');$('#edittoolbar-link-int-target-status').append($('<img />').attr({'id':'edittoolbar-link-int-target-status-exists','src':existsImg,'alt':existsMsg,'title':existsMsg})).append($('<img />').attr({'id':'edittoolbar-link-int-target-status-notexists','src':notexistsImg,'alt':notexistsMsg,'title':notexistsMsg})).append($('<img />').attr({'id':'edittoolbar-link-int-target-status-invalid','src':invalidImg,'alt':invalidMsg,'title':invalidMsg})).append($('<img />').attr({'id':'edittoolbar-link-int-target-status-loading','src':loadingImg,'alt':loadingMsg,'title':loadingMsg})).data('cache',{}).children().hide();function updateExistence(target){function updateWidget(status){$('#edittoolbar-link-int-target-status').children().hide();$('#edittoolbar-link-int-target-status-'+status).show();} |
138 | | -var request=$('#edittoolbar-link-int-target-status').data('request');if(request) |
139 | | -request.abort();var target=$('#edittoolbar-link-int-target').val();var cache=$('#edittoolbar-link-int-target-status').data('cache');if(cache[target]){updateWidget(cache[target]);return;} |
140 | | -if(target==''){$('#edittoolbar-link-int-target-status').children().hide();return;} |
141 | | -if(target.indexOf('|')!=-1){updateWidget('invalid');return;} |
142 | | -updateWidget('loading');var request=$.ajax({url:wgScriptPath+'/api.php',dataType:'json',data:{'action':'query','indexpageids':'','titles':target,'format':'json'},success:function(data){var page=data.query.pages[data.query.pageids[0]];var status='exists';if(typeof page.missing!='undefined') |
143 | | -status='notexists';else if(typeof page.invalid!='undefined') |
144 | | -status='invalid';cache[target]=status;updateWidget(status);}});$('#edittoolbar-link-int-target-status').data('request',request);} |
145 | | -$('#edittoolbar-link-int-target').bind('keypress paste',function(){if(typeof $(this).data('timerID')!='undefined') |
146 | | -clearTimeout($(this).data('timerID'));var timerID=setTimeout(updateExistence,250);$(this).data('timerID',timerID);}).change(function(){if(typeof $(this).data('timerID')!='undefined') |
147 | | -clearTimeout($(this).data('timerID'));updateExistence();});},dialog:{width:550,buttons:{'edittoolbar-tool-link-insert':function(){function escapeInternalText(s){return s.replace(/(]{2,})/g,'<nowiki>$1</nowiki>');} |
148 | | -function escapeExternalTarget(s){return s.replace(/ /g,'%20').replace(/]/g,'%5D');} |
149 | | -function escapeExternalText(s){return s.replace(/(]+)/g,'<nowiki>$1</nowiki>');} |
150 | | -var insertText='';var whitespace=['',''];switch($('#edittoolbar-link-tabs').tabs('option','selected')){case 0:if($('#edittoolbar-link-int-target-status-invalid').is(':visible')){alert(gM('edittoolbar-tool-link-int-invalid'));return;} |
151 | | -var target=$('#edittoolbar-link-int-target').val();var text=$('#edittoolbar-link-int-text').val();whitespace=$('#edittoolbar-link-dialog-tab-int').data('whitespace');if(target==text) |
152 | | -insertText='[['+target+']]';else |
153 | | -insertText='[['+target+'|'+escapeInternalText(text)+']]';break;case 1:var target=$('#edittoolbar-link-ext-target').val();var text=$('#edittoolbar-link-ext-text').val();var escTarget=escapeExternalTarget(target);var escText=escapeExternalText(text);whitespace=$('#edittoolbar-link-dialog-tab-ext').data('whitespace');if(escTarget==escText) |
154 | | -insertText=escTarget;else if(text=='') |
155 | | -insertText='['+escTarget+']';else |
156 | | -insertText='['+escTarget+' '+escText+']';break;} |
157 | | -insertText=whitespace[0]+insertText+whitespace[1];$.wikiEditor.modules.toolbar.fn.doAction($(this).data('context'),{type:'replace',options:{pre:insertText}},$(this));$(this).dialog('close');},'edittoolbar-tool-link-cancel':function(){$(this).dialog('close');}},open:function(){var selection=$(this).data('context').$textarea.getSelection();$('#edittoolbar-link-dialog-tab-int').data('whitespace',['','']);$('#edittoolbar-link-dialog-tab-ext').data('whitespace',['','']);if(selection!=''){var inttext,inttarget,exttext,exttarget;var matches;var tab=-1;if((matches=selection.match(/^(\s*)\[\[([^\]\|]+)(\|([^\]\|]*))?\]\](\s*)$/))){inttarget=matches[2];inttext=(matches[4]?matches[4]:matches[2]);tab=0;$('#edittoolbar-link-dialog-tab-int').data('whitespace',[matches[1],matches[5]]);}else if((matches=selection.match(/^(\s*)\[([^\] ]+)( ([^\]]+))?\](\s*)$/))){exttarget=matches[2];exttext=(matches[4]?matches[4]:'');tab=1;$('#edittoolbar-link-dialog-tab-ext').data('whitespace',[matches[1],matches[5]]);}else{inttarget=inttext=exttext=selection;exttarget='http://';} |
158 | | -if(typeof inttext!='undefined') |
159 | | -$('#edittoolbar-link-int-text').val(inttext).change();if(typeof inttarget!='undefined') |
160 | | -$('#edittoolbar-link-int-target').val(inttarget).change();if(typeof exttext!='undefined') |
161 | | -$('#edittoolbar-link-ext-text').val(exttext).change();if(typeof exttarget!='undefined') |
162 | | -$('#edittoolbar-link-ext-target').val(exttarget).change();if(tab!=-1) |
163 | | -$('#edittoolbar-link-tabs').tabs('select',tab);} |
164 | | -$('#edittoolbar-link-int-text').data('untouched',$('#edittoolbar-link-int-text').val()==$('#edittoolbar-link-int-target').val());}}},'insert-table':{titleMsg:'edittoolbar-tool-table-title',id:'edittoolbar-table-dialog',html:'\ |
165 | | - <form><fieldset><legend rel="edittoolbar-tool-table-dimensions"></legend><table><tr>\ |
166 | | - <td class="label"><label for="edittoolbar-table-dimensions-columns"\ |
167 | | - rel="edittoolbar-tool-table-dimensions-columns"></label></td>\ |
168 | | - <td><input type="text" id="edittoolbar-table-dimensions-columns" size="2" /></td>\ |
169 | | - <td class="label"><label for="edittoolbar-table-dimensions-rows"\ |
170 | | - rel="edittoolbar-tool-table-dimensions-rows"></label></td>\ |
171 | | - <td><input type="text" id="edittoolbar-table-dimensions-rows" size="2" /></td>\ |
172 | | - </tr><tr>\ |
173 | | - <td class="label"><label for="edittoolbar-table-dimensions-headercolumns"\ |
174 | | - rel="edittoolbar-tool-table-dimensions-headercolumns"></label></td>\ |
175 | | - <td><input type="text" id="edittoolbar-table-dimensions-headercolumns" size="2" /></td>\ |
176 | | - <td class="label"><label for="edittoolbar-table-dimensions-headerrows"\ |
177 | | - rel="edittoolbar-tool-table-dimensions-headerrows"></label></td>\ |
178 | | - <td><input type="text" id="edittoolbar-table-dimensions-headerrows" size="2" /></td>\ |
179 | | - </tr></table></fieldset></form>',init:function(){$(this).find('[rel]').each(function(){$(this).text(gM($(this).attr('rel')));});},dialog:{width:350,buttons:{'edittoolbar-tool-table-insert':function(){var rows=parseInt($('#edittoolbar-table-dimensions-rows').val());var cols=parseInt($('#edittoolbar-table-dimensions-columns').val());var hrows=parseInt($('#edittoolbar-table-dimensions-headerrows').val());var hcols=parseInt($('#edittoolbar-table-dimensions-headercolumns').val());var table="{|\n";for(var r=0;r<rows;r++){table+="|-\n";for(var c=0;c<cols;c++){var isHeader=(r<hrows||c<hcols);var delim=isHeader?'!':'|';if(c>0) |
180 | | -delim+=delim;table+=delim+' '+ |
181 | | -gM(isHeader?'edittoolbar-tool-table-example-header':'edittoolbar-tool-table-example',[r+1,c+1])+' ';} |
182 | | -table=table.substr(0,table.length-1)+"\n";} |
183 | | -table+="|}";$.wikiEditor.modules.toolbar.fn.doAction($(this).data('context'),{type:'encapsulate',options:{pre:table,ownline:true}},$(this));$(this).dialog('close');},'edittoolbar-tool-table-cancel':function(){$(this).dialog('close');}}}},'search-and-replace':{titleMsg:'edittoolbar-tool-replace-title',id:'edittoolbar-replace-dialog',html:'\ |
184 | | - <form><fieldset><table><tr>\ |
185 | | - <td><label for="edittoolbar-replace-search" rel="edittoolbar-tool-replace-search"></label></td>\ |
186 | | - <td><input type="text" id="edittoolbar-replace-search" /></td>\ |
187 | | - </tr><tr>\ |
188 | | - <td><label for="edittoolbar-replace-replace" rel="edittoolbar-tool-replace-replace"></label></td>\ |
189 | | - <td><input type="text" id="edittoolbar-replace-replace" /></td>\ |
190 | | - </tr></table><table><tr>\ |
191 | | - <td><input type="checkbox" id="edittoolbar-replace-case" /></td>\ |
192 | | - <td><label for="edittoolbar-replace-case" rel="edittoolbar-tool-replace-case"></label></td>\ |
193 | | - </tr><tr>\ |
194 | | - <td><input type="checkbox" id="edittoolbar-replace-regex" /></td>\ |
195 | | - <td><label for="edittoolbar-replace-regex" rel="edittoolbar-tool-replace-regex"></label></td>\ |
196 | | - </tr><tr>\ |
197 | | - <td><input type="checkbox" id="edittoolbar-replace-all" /></td>\ |
198 | | - <td><label for="edittoolbar-replace-all" rel="edittoolbar-tool-replace-all"></label></td>\ |
199 | | - </tr></table></fieldset></form>',init:function(){$(this).find('[rel]').each(function(){$(this).text(gM($(this).attr('rel')));});},dialog:{width:350,buttons:{'edittoolbar-tool-replace-button':function(){var searchStr=$('#edittoolbar-replace-search').val();var replaceStr=$('#edittoolbar-replace-replace').val();var flags='';if(!$('#edittoolbar-replace-case').is(':checked')) |
200 | | -flags+='i';if($('#edittoolbar-replace-all').is(':checked')) |
201 | | -flags+='g';if(!$('#edittoolbar-replace-regex').is(':checked')) |
202 | | -searchStr=RegExp.escape(searchStr);var regex=new RegExp(searchStr,flags);var $textarea=$(this).data('context').$textarea;if(!$textarea.val().match(regex)) |
203 | | -alert(gM('edittoolbar-tool-replace-nomatch'));else |
204 | | -$textarea.val($textarea.val().replace(regex,replaceStr));},'edittoolbar-tool-replace-close':function(){$(this).dialog('close');}}}}}};})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'supportedBrowsers':{'ltr':{'msie':7,'firefox':2,'opera':9,'safari':3,'chrome':1,'camino':1},'rtl':{'msie':8,'firefox':2,'opera':9,'safari':3,'chrome':1,'camino':1}},imgPath:wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/'};$.wikiEditor.isSupportKnown=function(){return(function(supportedBrowsers){return $.browser.name in supportedBrowsers;})($.wikiEditor.supportedBrowsers[$('body.rtl').size()?'rtl':'ltr']);};$.wikiEditor.isSupported=function(){return(function(supportedBrowsers){return $.browser.name in supportedBrowsers&&$.browser.versionNumber>=supportedBrowsers[$.browser.name];})($.wikiEditor.supportedBrowsers[$('body.rtl').size()?'rtl':'ltr']);};$.wikiEditor.autoMsg=function(object,property){if(typeof property=='object'){for(i in property){if(property[i]in object||property[i]+'Msg'in object){property=property[i];break;}}} |
| 113 | +$('<div /> ').attr('id',module.id).html(module.html).data('context',context).appendTo($('body')).each(module.init).dialog(configuration);}}}},'modules':{}};})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'supportedBrowsers':{'ltr':{'msie':7,'firefox':2,'opera':9,'safari':3,'chrome':1,'camino':1},'rtl':{'msie':8,'firefox':2,'opera':9,'safari':3,'chrome':1,'camino':1}},imgPath:wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/'};$.wikiEditor.isSupportKnown=function(){return(function(supportedBrowsers){return $.browser.name in supportedBrowsers;})($.wikiEditor.supportedBrowsers[$('body.rtl').size()?'rtl':'ltr']);};$.wikiEditor.isSupported=function(){return(function(supportedBrowsers){return $.browser.name in supportedBrowsers&&$.browser.versionNumber>=supportedBrowsers[$.browser.name];})($.wikiEditor.supportedBrowsers[$('body.rtl').size()?'rtl':'ltr']);};$.wikiEditor.autoMsg=function(object,property){if(typeof property=='object'){for(i in property){if(property[i]in object||property[i]+'Msg'in object){property=property[i];break;}}} |
205 | 114 | if(property in object){return object[property];}else if(property+'Msg'in object){return gM(object[property+'Msg']);}else{return'';}};$.fn.wikiEditor=function(){var context=$(this).data('context');if(typeof context!=='undefined'){arguments=$.makeArray(arguments);if(arguments.length>0){var call=arguments.shift();if(call in context.api){context.api[call](context,arguments[0]==undefined?{}:arguments[0]);} |
206 | 115 | return $(this).data('context',context);} |
207 | 116 | return $(this);} |