changeset 2 | 307591683f3b |
parent 1 | 960c1572df75 |
child 3 | 1e6929f9978b |
1:960c1572df75 | 2:307591683f3b |
---|---|
13 show_title: true |
13 show_title: true |
14 }); |
14 }); |
15 |
15 |
16 toolbar += head.run(); |
16 toolbar += head.run(); |
17 |
17 |
18 var buttons = ['bold*', 'italic*', 'underline*', '|', 'intlink', 'extlink', 'image']; |
18 var buttons = ['heading', '|', 'bold*', 'italic*', 'underline*', '|', 'intlink', 'extlink', 'image', 'table', '|', 'ulist*', 'olist*']; |
19 |
19 |
20 // Button: Bold |
20 // Button: Bold |
21 var i; |
21 var i; |
22 var hide_label = false; |
22 var hide_label = false; |
23 for ( i = 0; i < buttons.length; i++ ) |
23 for ( i = 0; i < buttons.length; i++ ) |
24 { |
24 { |
25 if ( buttons[i] == '|' ) |
25 if ( buttons[i] == '|' ) |
26 { |
26 { |
27 label.assign_vars({ |
27 label.assign_vars({ |
28 TITLE: '<img alt="|" src="' + scriptPath + '/plugins/guieditor/icons/separator.png" />' |
28 TITLE: '<img alt="|" src="' + scriptPath + '/plugins/guieditor/icons/separator.png" />' |
29 }); |
|
30 toolbar += label.run(); |
|
31 } |
|
32 else if ( buttons[i] == 'heading' ) |
|
33 { |
|
34 var options = []; |
|
35 options.push('<option value="0">' + $lang.get('guied_lbl_heading') + '...</option>'); |
|
36 for ( var j = 1; j <= 6; j++ ) |
|
37 { |
|
38 options.push('<option value="' + j + '">' + $lang.get('guied_lbl_heading') + ' '+j+'</option>'); |
|
39 } |
|
40 options = implode('', options); |
|
41 label.assign_vars({ |
|
42 TITLE: '<select class="guied_dropdown" onchange="guied_register_heading(this);">' + options + '</select>' |
|
29 }); |
43 }); |
30 toolbar += label.run(); |
44 toolbar += label.run(); |
31 } |
45 } |
32 else |
46 else |
33 { |
47 { |
154 load_component('autofill'); |
168 load_component('autofill'); |
155 var selection = guied_get_selection(textarea); |
169 var selection = guied_get_selection(textarea); |
156 var il_mp = miniPrompt(function(div) |
170 var il_mp = miniPrompt(function(div) |
157 { |
171 { |
158 div.innerHTML += '<h3>' + $lang.get('guied_image_title') + '</h3>'; |
172 div.innerHTML += '<h3>' + $lang.get('guied_image_title') + '</h3>'; |
173 // Yes, I know what you're thinking. Probably something along the lines of "holy fuck, this is a long ass string." |
|
174 // I'll move all these tools over to templates at some point in time |
|
159 div.innerHTML += '<table border="0" cellspacing="5" cellpadding="0" style="width: 100%;"> \ |
175 div.innerHTML += '<table border="0" cellspacing="5" cellpadding="0" style="width: 100%;"> \ |
160 <tr> \ |
176 <tr> \ |
161 <td valign="top" style="white-space: nowrap;"> \ |
177 <td valign="top" style="white-space: nowrap;"> \ |
162 ' + $lang.get('guied_image_lbl_image') + ' \ |
178 ' + $lang.get('guied_image_lbl_image') + ' \ |
163 </td> \ |
179 </td> \ |
273 autofill_init_element(document.getElementById('guied_image_file'), {}); |
289 autofill_init_element(document.getElementById('guied_image_file'), {}); |
274 document.getElementById('guied_image_file').focus(); |
290 document.getElementById('guied_image_file').focus(); |
275 $('#guied_image_caption').val(selection); |
291 $('#guied_image_caption').val(selection); |
276 |
292 |
277 break; |
293 break; |
294 case 'table': |
|
295 guied_insert_wikitext_tag(textarea, "{| styled\n", "\n|}", $lang.get('guied_sample_table')); |
|
296 break; |
|
297 case 'ulist': |
|
298 guied_replace_selection(textarea, $lang.get('guied_sample_ulist')); |
|
299 break; |
|
300 case 'olist': |
|
301 guied_replace_selection(textarea, $lang.get('guied_sample_olist')); |
|
302 break; |
|
278 |
303 |
279 } |
304 } |
280 /* |
305 } |
281 |
306 |
282 */ |
307 function guied_register_heading(select) |
308 { |
|
309 var textarea = document.getElementById('ajaxEditArea'); |
|
310 var n = Number($(select).val()); |
|
311 if ( n < 1 || n > 6 ) |
|
312 return; |
|
313 $(select).val('0'); |
|
314 var tag = ''; |
|
315 for ( var i = 0; i < n; i++ ) |
|
316 tag += '='; |
|
317 |
|
318 guied_insert_wikitext_tag(textarea, tag + ' ', ' ' + tag, $lang.get('guied_sample_heading')); |
|
283 } |
319 } |
284 |
320 |
285 function guied_intlink_finish(insertbtn) |
321 function guied_intlink_finish(insertbtn) |
286 { |
322 { |
287 var page = $('#guied_intlink_page').val(); |
323 var page = $('#guied_intlink_page').val(); |
374 caption = $('#guied_image_caption').val(); |
410 caption = $('#guied_image_caption').val(); |
375 break; |
411 break; |
376 case 'inline': |
412 case 'inline': |
377 caption = $('#guied_image_alttext').val(); |
413 caption = $('#guied_image_alttext').val(); |
378 break; |
414 break; |
415 case 'raw': |
|
416 attrs.push('raw'); |
|
379 } |
417 } |
380 if ( caption != '' ) |
418 if ( caption != '' ) |
381 attrs.push(caption); |
419 attrs.push(caption); |
382 |
420 |
383 var tag = '[[' + implode('|', attrs) + ']]'; |
421 var tag = '[[' + implode('|', attrs) + ']]'; |