author | Dan Fuhry <dan@enanocms.org> |
Fri, 11 Feb 2011 01:25:12 -0500 | |
changeset 7 | 4f40b21648a9 |
parent 6 | 7398bdc17604 |
permissions | -rw-r--r-- |
7
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
1 |
attachHook('editor_gui_toolbar', 'guied_insert_toolbar(ta_wrapper, textarea, response.toolbar_templates);'); |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
2 |
|
7
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
3 |
function guied_insert_toolbar(ta_wrapper, textarea, toolbar_templates) |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
4 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
5 |
// Init toolbar |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
6 |
var toolbar = ''; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
7 |
var head = new templateParser(toolbar_templates.toolbar_start); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
8 |
var button = new templateParser(toolbar_templates.toolbar_button); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
9 |
var label = new templateParser(toolbar_templates.toolbar_label); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
10 |
var tail = new templateParser(toolbar_templates.toolbar_end); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
11 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
12 |
button.assign_bool({ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
13 |
show_title: true |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
14 |
}); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
15 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
16 |
toolbar += head.run(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
17 |
|
3
1e6929f9978b
And signature. Also hid labels for image and table buttons, so the toolbar doesn't wrap at 1024x768 in Enanium.
Dan Fuhry <dan@enanocms.org>
parents:
2
diff
changeset
|
18 |
var buttons = ['heading', '|', 'bold*', 'italic*', 'underline*', '|', 'intlink', 'extlink', 'image*', 'table*', '|', 'ulist*', 'olist*', '|', 'signature']; |
5
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
19 |
// if new images are to be added, run sprite.sh under icons/ and update this array |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
20 |
var spritelist = ['add', 'bold', 'extlink', 'image', 'intlink', 'italic', 'olist', 'signature', 'table', 'ulist', 'underline', 'separator']; |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
21 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
22 |
// Button: Bold |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
23 |
var i; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
24 |
var hide_label = false; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
25 |
for ( i = 0; i < buttons.length; i++ ) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
26 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
27 |
if ( buttons[i] == '|' ) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
28 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
29 |
label.assign_vars({ |
5
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
30 |
TITLE: gen_sprite_html(cdnPath + '/plugins/guieditor/icons/sprite.png', 8, 16, 0, (spritelist.length - 1) * 16), |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
31 |
}); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
32 |
toolbar += label.run(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
33 |
} |
2
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
34 |
else if ( buttons[i] == 'heading' ) |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
35 |
{ |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
36 |
var options = []; |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
37 |
options.push('<option value="0">' + $lang.get('guied_lbl_heading') + '...</option>'); |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
38 |
for ( var j = 1; j <= 6; j++ ) |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
39 |
{ |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
40 |
options.push('<option value="' + j + '">' + $lang.get('guied_lbl_heading') + ' '+j+'</option>'); |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
41 |
} |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
42 |
options = implode('', options); |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
43 |
label.assign_vars({ |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
44 |
TITLE: '<select class="guied_dropdown" onchange="guied_register_heading(this);">' + options + '</select>' |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
45 |
}); |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
46 |
toolbar += label.run(); |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
47 |
} |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
48 |
else |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
49 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
50 |
if ( buttons[i].charAt(buttons[i].length - 1) == '*' ) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
51 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
52 |
hide_label = true; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
53 |
buttons[i] = buttons[i].substr(0, buttons[i].length - 1); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
54 |
button.assign_bool({ show_title: false }); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
55 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
56 |
button.assign_vars({ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
57 |
TITLE: $lang.get('guied_btn_' + buttons[i]), |
5
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
58 |
// FIXME: indexOf is error prone here |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
59 |
SPRITE: gen_sprite_html(cdnPath + '/plugins/guieditor/icons/sprite.png', 16, 16, 0, spritelist.indexOf(buttons[i]) * 16), |
7
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
60 |
FLAGS: 'href="#" onclick="guied_act(\'' + buttons[i] + '\', this); return false;"' |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
61 |
}); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
62 |
toolbar += button.run(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
63 |
if ( hide_label ) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
64 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
65 |
button.assign_bool({ show_title: true }); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
66 |
hide_label = false; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
67 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
68 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
69 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
70 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
71 |
// End of toolbar |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
72 |
toolbar += tail.run(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
73 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
74 |
var wrapperdiv = document.createElement('div'); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
75 |
wrapperdiv.innerHTML = toolbar; |
7
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
76 |
wrapperdiv.className = 'guieditor hide-with-mce'; |
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
77 |
wrapperdiv.target_ta = textarea; |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
78 |
ta_wrapper.appendChild(wrapperdiv); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
79 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
80 |
|
7
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
81 |
function guied_act(action, obj) |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
82 |
{ |
7
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
83 |
var textarea = guied_self(obj).target_ta; |
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
84 |
if ( !textarea ) |
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
85 |
{ |
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
86 |
console.error('Could not get textarea'); |
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
87 |
console.debug(obj, guied_self(obj)); |
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
88 |
return null; |
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
89 |
} |
5
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
90 |
var af_class = typeof(autofill_schemas.floodlight) == 'object' ? 'guied_floodlight' : 'page'; |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
91 |
switch(action) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
92 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
93 |
case 'bold': |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
94 |
guied_insert_wikitext_tag(textarea, "'''", "'''", $lang.get('guied_sample_bold')); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
95 |
break; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
96 |
case 'italic': |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
97 |
guied_insert_wikitext_tag(textarea, "''", "''", $lang.get('guied_sample_italic')); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
98 |
break; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
99 |
case 'underline': |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
100 |
guied_insert_wikitext_tag(textarea, "__", "__", $lang.get('guied_sample_underline')); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
101 |
break; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
102 |
case 'intlink': |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
103 |
load_component('autofill'); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
104 |
var selection = guied_get_selection(textarea); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
105 |
var il_mp = miniPrompt(function(div) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
106 |
{ |
7
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
107 |
console.debug(div.parentNode); |
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
108 |
|
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
109 |
div.innerHTML += '<h3>' + $lang.get('guied_intlink_title') + '</h3>'; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
110 |
div.innerHTML += '<table border="0" cellspacing="5" cellpadding="0" style="width: 100%;"> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
111 |
<tr> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
112 |
<td valign="top" style="white-space: nowrap;"> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
113 |
' + $lang.get('guied_intlink_lbl_page') + ' \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
114 |
</td> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
115 |
<td valign="top"> \ |
5
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
116 |
<input type="text" id="guied_intlink_page" class="autofill ' + af_class + '" style="width: 100%;" /><br /> \ |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
117 |
<small>' + $lang.get('guied_intlink_af_hint') + '</small> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
118 |
</td> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
119 |
</tr> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
120 |
<tr> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
121 |
<td valign="top" style="white-space: nowrap;"> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
122 |
' + $lang.get('guied_intlink_lbl_text') + ' \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
123 |
</td> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
124 |
<td valign="top"> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
125 |
<input type="text" id="guied_intlink_text" style="width: 100%;" /><br /> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
126 |
<small>' + $lang.get('guied_intlink_text_hint') + '</small> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
127 |
</td> \ |
1
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
128 |
</tr> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
129 |
</table>'; |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
130 |
div.innerHTML += '<p style="text-align: right;"> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
131 |
<a class="abutton abutton_blue" onclick="guied_intlink_finish(this); return false;" href="#">' + $lang.get('guied_btn_insert') + '</a> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
132 |
<a class="abutton abutton_red" onclick="miniPromptDestroy(this); return false;" href="#">' + $lang.get('etc_cancel') + '</a> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
133 |
</p>'; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
134 |
}); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
135 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
136 |
// This fixes autofill |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
137 |
il_mp.style.zIndex = getHighestZ() + 1; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
138 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
139 |
autofill_init_element(document.getElementById('guied_intlink_page'), {}); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
140 |
document.getElementById('guied_intlink_page').focus(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
141 |
$('#guied_intlink_text').val(selection); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
142 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
143 |
break; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
144 |
case 'extlink': |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
145 |
load_component('autofill'); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
146 |
var selection = guied_get_selection(textarea); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
147 |
var il_mp = miniPrompt(function(div) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
148 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
149 |
div.innerHTML += '<h3>' + $lang.get('guied_extlink_title') + '</h3>'; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
150 |
div.innerHTML += '<table border="0" cellspacing="5" cellpadding="0" style="width: 100%;"> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
151 |
<tr> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
152 |
<td valign="top" style="white-space: nowrap;"> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
153 |
' + $lang.get('guied_extlink_lbl_link') + ' \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
154 |
</td> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
155 |
<td valign="top"> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
156 |
<input type="text" id="guied_extlink_link" style="width: 100%;" /><br /> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
157 |
<small>' + $lang.get('guied_extlink_link_hint') + '</small> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
158 |
</td> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
159 |
</tr> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
160 |
<tr> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
161 |
<td valign="top" style="white-space: nowrap;"> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
162 |
' + $lang.get('guied_extlink_lbl_text') + ' \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
163 |
</td> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
164 |
<td valign="top"> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
165 |
<input type="text" id="guied_extlink_text" style="width: 100%;" /><br /> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
166 |
<small>' + $lang.get('guied_extlink_text_hint') + '</small> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
167 |
</td> \ |
1
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
168 |
</tr> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
169 |
</table>'; |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
170 |
div.innerHTML += '<p style="text-align: right;"> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
171 |
<a class="abutton abutton_blue" onclick="guied_extlink_finish(this); return false;" href="#">' + $lang.get('guied_btn_insert') + '</a> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
172 |
<a class="abutton abutton_red" onclick="miniPromptDestroy(this); return false;" href="#">' + $lang.get('etc_cancel') + '</a> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
173 |
</p>'; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
174 |
}); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
175 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
176 |
document.getElementById('guied_extlink_link').focus(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
177 |
$('#guied_extlink_text').val(selection); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
178 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
179 |
break; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
180 |
case 'image': |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
181 |
// Fuck yeah. |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
182 |
load_component('autofill'); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
183 |
var selection = guied_get_selection(textarea); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
184 |
var il_mp = miniPrompt(function(div) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
185 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
186 |
div.innerHTML += '<h3>' + $lang.get('guied_image_title') + '</h3>'; |
2
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
187 |
// Yes, I know what you're thinking. Probably something along the lines of "holy fuck, this is a long ass string." |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
188 |
// I'll move all these tools over to templates at some point in time |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
189 |
div.innerHTML += '<table border="0" cellspacing="5" cellpadding="0" style="width: 100%;"> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
190 |
<tr> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
191 |
<td valign="top" style="white-space: nowrap;"> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
192 |
' + $lang.get('guied_image_lbl_image') + ' \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
193 |
</td> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
194 |
<td valign="top"> \ |
1
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
195 |
<img id="guied_image_preview" src="' + cdnPath + '/images/spacer.gif" style="display: block;" onerror="this.style.display = \'none\';" /> \ |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
196 |
<input type="text" id="guied_image_file" class="autofill guied_image" style="width: 100%;" onblur="guied_refresh_image();" /><br /> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
197 |
<small>' + $lang.get('guied_image_af_hint') + '</small> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
198 |
<div id="guied_upload_body" style="padding: 4px 0;"> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
199 |
<a class="abutton icon abutton_green" style="background-image: url(' + scriptPath + '/plugins/guieditor/icons/add.png);" href="#" onclick="guied_image_show_uploader(); return false;">' + $lang.get('guied_image_btn_upload') + '</a> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
200 |
</div> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
201 |
</td> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
202 |
</tr> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
203 |
<tr> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
204 |
<td valign="top" style="white-space: nowrap;"> \ |
1
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
205 |
' + $lang.get('guied_image_lbl_resize') + ' \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
206 |
</td> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
207 |
<td valign="top"> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
208 |
<label> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
209 |
<input type="checkbox" id="guied_image_resize" onclick="$(\'#guied_image_resizer\').toggle(\'blind\');" /> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
210 |
' + $lang.get('guied_image_checkbox_resize') + ' \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
211 |
</label> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
212 |
<div id="guied_image_resizer" style="display: none;"> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
213 |
' + $lang.get('guied_image_lbl_dimensions') + ' \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
214 |
<input type="text" id="guied_image_size_x" size="5" /> x \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
215 |
<input type="text" id="guied_image_size_y" size="5" /> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
216 |
<br /> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
217 |
\ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
218 |
' + $lang.get('guied_image_resize_or') + ' \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
219 |
<label><input type="checkbox" id="guied_image_resize_default" onclick="guied_image_toggle_default();" /> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
220 |
' + $lang.get('guied_image_resize_lbl_default') + '</label><br /> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
221 |
<small> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
222 |
' + $lang.get('guied_image_msg_preserve_aspect') + ' \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
223 |
</small> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
224 |
</div> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
225 |
</td> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
226 |
</tr> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
227 |
<tr> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
228 |
<td valign="top" style="white-space: nowrap;"> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
229 |
' + $lang.get('guied_image_lbl_mode') + ' \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
230 |
</td> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
231 |
<td valign="top"> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
232 |
<form> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
233 |
<label> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
234 |
<input class="guied_image_mode_radio" onclick="guied_image_set_mode(this.value);" type="radio" name="mode" value="framed" checked="checked" /> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
235 |
' + $lang.get('guied_image_lbl_framed') + ' \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
236 |
</label> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
237 |
<label> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
238 |
<input class="guied_image_mode_radio" onclick="guied_image_set_mode(this.value);" type="radio" name="mode" value="inline" /> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
239 |
' + $lang.get('guied_image_lbl_inline') + ' \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
240 |
</label> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
241 |
<label> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
242 |
<input class="guied_image_mode_radio" onclick="guied_image_set_mode(this.value);" type="radio" name="mode" value="raw" /> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
243 |
' + $lang.get('guied_image_lbl_raw') + ' \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
244 |
</label><br /> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
245 |
</form> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
246 |
<small id="guied_mode_hint">' + $lang.get('guied_image_mode_hint_framed') + '</small> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
247 |
</td> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
248 |
</tr> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
249 |
</table> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
250 |
<div class="guied_image_mode framed"> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
251 |
<table border="0" cellspacing="5" cellpadding="0" style="width: 100%;"> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
252 |
<tr> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
253 |
<td valign="top" style="white-space: nowrap;"> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
254 |
' + $lang.get('guied_image_framed_lbl_side') + ' \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
255 |
</td> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
256 |
<td valign="top"> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
257 |
<form> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
258 |
<label> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
259 |
<input class="guied_image_side" type="radio" name="side" value="left" checked="checked" /> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
260 |
' + $lang.get('guied_image_framed_left') + ' \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
261 |
</label> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
262 |
<label> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
263 |
<input class="guied_image_side" type="radio" name="side" value="right" /> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
264 |
' + $lang.get('guied_image_framed_right') + ' \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
265 |
</label> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
266 |
</form> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
267 |
</td> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
268 |
</tr> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
269 |
<tr> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
270 |
<td valign="top" style="white-space: nowrap;"> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
271 |
' + $lang.get('guied_image_lbl_caption') + ' \ |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
272 |
</td> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
273 |
<td valign="top"> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
274 |
<input type="text" id="guied_image_caption" style="width: 100%;" /> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
275 |
</td> \ |
1
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
276 |
</tr> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
277 |
</table> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
278 |
</div> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
279 |
<div class="guied_image_mode inline" style="display: none;"> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
280 |
<table border="0" cellspacing="5" cellpadding="0" style="width: 100%;"> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
281 |
<tr> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
282 |
<td valign="top" style="white-space: nowrap;"> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
283 |
' + $lang.get('guied_image_lbl_alttext') + ' \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
284 |
</td> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
285 |
<td valign="top"> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
286 |
<input type="text" id="guied_image_alttext" style="width: 100%;" /> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
287 |
</td> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
288 |
</tr> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
289 |
</table> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
290 |
</div> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
291 |
<div class="guied_image_mode raw" style="display: none;"> \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
292 |
' + $lang.get('guied_image_raw_msg_noopt') + ' \ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
293 |
</div>'; |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
294 |
div.innerHTML += '<p style="text-align: right;"> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
295 |
<a class="abutton abutton_blue" onclick="guied_image_finish(this); return false;" href="#">' + $lang.get('guied_btn_insert') + '</a> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
296 |
<a class="abutton abutton_red" onclick="miniPromptDestroy(this); return false;" href="#">' + $lang.get('etc_cancel') + '</a> \ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
297 |
</p>'; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
298 |
}); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
299 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
300 |
// This fixes autofill |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
301 |
il_mp.style.zIndex = getHighestZ() + 1; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
302 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
303 |
autofill_init_element(document.getElementById('guied_image_file'), {}); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
304 |
document.getElementById('guied_image_file').focus(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
305 |
$('#guied_image_caption').val(selection); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
306 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
307 |
break; |
2
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
308 |
case 'table': |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
309 |
guied_insert_wikitext_tag(textarea, "{| styled\n", "\n|}", $lang.get('guied_sample_table')); |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
310 |
break; |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
311 |
case 'ulist': |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
312 |
guied_replace_selection(textarea, $lang.get('guied_sample_ulist')); |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
313 |
break; |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
314 |
case 'olist': |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
315 |
guied_replace_selection(textarea, $lang.get('guied_sample_olist')); |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
316 |
break; |
3
1e6929f9978b
And signature. Also hid labels for image and table buttons, so the toolbar doesn't wrap at 1024x768 in Enanium.
Dan Fuhry <dan@enanocms.org>
parents:
2
diff
changeset
|
317 |
case 'signature': |
1e6929f9978b
And signature. Also hid labels for image and table buttons, so the toolbar doesn't wrap at 1024x768 in Enanium.
Dan Fuhry <dan@enanocms.org>
parents:
2
diff
changeset
|
318 |
guied_replace_selection(textarea, '~~~~'); |
1e6929f9978b
And signature. Also hid labels for image and table buttons, so the toolbar doesn't wrap at 1024x768 in Enanium.
Dan Fuhry <dan@enanocms.org>
parents:
2
diff
changeset
|
319 |
break; |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
320 |
} |
2
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
321 |
} |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
322 |
|
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
323 |
function guied_register_heading(select) |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
324 |
{ |
7
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
325 |
var textarea = guied_self(select).target_ta; |
2
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
326 |
var n = Number($(select).val()); |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
327 |
if ( n < 1 || n > 6 ) |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
328 |
return; |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
329 |
$(select).val('0'); |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
330 |
var tag = ''; |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
331 |
for ( var i = 0; i < n; i++ ) |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
332 |
tag += '='; |
1
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
333 |
|
2
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
334 |
guied_insert_wikitext_tag(textarea, tag + ' ', ' ' + tag, $lang.get('guied_sample_heading')); |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
335 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
336 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
337 |
function guied_intlink_finish(insertbtn) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
338 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
339 |
var page = $('#guied_intlink_page').val(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
340 |
var text = $('#guied_intlink_text').val(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
341 |
var tag = text == '' ? '[[' + page + ']]' : '[[' + page + '|' + text + ']]'; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
342 |
guied_replace_selection(document.getElementById('ajaxEditArea'), tag); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
343 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
344 |
miniPromptDestroy(insertbtn); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
345 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
346 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
347 |
function guied_extlink_finish(insertbtn) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
348 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
349 |
var link = $('#guied_extlink_link').val(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
350 |
var text = $('#guied_extlink_text').val(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
351 |
var tag = text == '' ? '[' + link + ']' : '[' + link + ' ' + text + ']'; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
352 |
guied_replace_selection(document.getElementById('ajaxEditArea'), tag); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
353 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
354 |
miniPromptDestroy(insertbtn); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
355 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
356 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
357 |
var guied_upl_oldhtml = ''; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
358 |
function guied_image_show_uploader() |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
359 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
360 |
var div = document.getElementById('guied_upload_body'); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
361 |
guied_upl_oldhtml = $(div).html(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
362 |
$(div).html('<form action="' + makeUrlNS('Special', 'UploadFile') + '" target="uploadwin" onsubmit="return guied_upload_popup();" method="post" enctype="multipart/form-data">' + |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
363 |
'<p><input type="file" style="width: 100%;" name="data" id="guied_upload_file" /></p>' + |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
364 |
'<input type="hidden" value="" name="rename" />' + |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
365 |
'<input type="hidden" value="" name="comments" />' + |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
366 |
'<p><input type="submit" name="doit" value="' + $lang.get('upload_btn_upload') + '"></p>' + |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
367 |
'</form>'); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
368 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
369 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
370 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
371 |
function guied_upload_popup() |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
372 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
373 |
window.open('about:blank', 'uploadwin', 'width=640,height=480,status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes'); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
374 |
var filename = $('#guied_upload_file').val(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
375 |
if ( filename == "" ) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
376 |
return false; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
377 |
filename = filename.split(/[\/\\\\]/); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
378 |
filename = filename[ filename.length - 1 ]; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
379 |
// sneaky little trick to make onblur get called |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
380 |
$('#guied_image_file').val(sanitize_page_id(filename)).focus(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
381 |
setTimeout('$("#guied_upload_body").html(guied_upl_oldhtml)', 100); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
382 |
return true; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
383 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
384 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
385 |
function guied_refresh_image() |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
386 |
{ |
1
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
387 |
$('#guied_image_preview').css('display', 'block').attr('src', makeUrlNS('Special', 'DownloadFile/' + $('#guied_image_file').val(), 'preview&width=200&height=400')).css('margin-bottom', '5px'); |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
388 |
} |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
389 |
|
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
390 |
function guied_image_toggle_default() |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
391 |
{ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
392 |
if ( $('#guied_image_resize_default:checked').length ) |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
393 |
{ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
394 |
$('#guied_image_size_x, #guied_image_size_y').attr('disabled', 'disabled'); |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
395 |
} |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
396 |
else |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
397 |
{ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
398 |
$('#guied_image_size_x, #guied_image_size_y').removeAttr('disabled'); |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
399 |
} |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
400 |
} |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
401 |
|
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
402 |
function guied_image_set_mode(val) |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
403 |
{ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
404 |
$('#guied_mode_hint').text($lang.get('guied_image_mode_hint_' + val)); |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
405 |
$('.guied_image_mode').hide(); |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
406 |
$('.guied_image_mode.' + val).show(); |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
407 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
408 |
|
1
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
409 |
function guied_image_finish(insertbtn) |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
410 |
{ |
1
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
411 |
var attrs = []; |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
412 |
var filename = $('#guied_image_file').val(); |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
413 |
attrs.push(':' + namespace_list.File + filename); |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
414 |
if ( $('#guied_image_resize:checked').length ) |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
415 |
{ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
416 |
if ( $('#guied_image_resize_default:checked').length ) |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
417 |
attrs.push('thumb'); |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
418 |
else |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
419 |
attrs.push($('#guied_image_size_x').val() + 'x' + $('#guied_image_size_y')); |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
420 |
} |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
421 |
var caption = ''; |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
422 |
switch($('.guied_image_mode_radio:checked').val()) |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
423 |
{ |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
424 |
case 'framed': |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
425 |
attrs.push($('.guied_image_side:checked').val()); |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
426 |
caption = $('#guied_image_caption').val(); |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
427 |
break; |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
428 |
case 'inline': |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
429 |
caption = $('#guied_image_alttext').val(); |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
430 |
break; |
2
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
431 |
case 'raw': |
307591683f3b
Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents:
1
diff
changeset
|
432 |
attrs.push('raw'); |
1
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
433 |
} |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
434 |
if ( caption != '' ) |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
435 |
attrs.push(caption); |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
436 |
|
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
437 |
var tag = '[[' + implode('|', attrs) + ']]'; |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
438 |
|
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
439 |
guied_replace_selection(document.getElementById('ajaxEditArea'), tag); |
960c1572df75
Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents:
0
diff
changeset
|
440 |
miniPromptDestroy(insertbtn); |
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
441 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
442 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
443 |
// Client detection from MediaWiki |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
444 |
var clientPC = navigator.userAgent.toLowerCase(); // Get client info |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
445 |
var is_gecko = ((clientPC.indexOf('gecko')!=-1) && (clientPC.indexOf('spoofer')==-1) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
446 |
&& (clientPC.indexOf('khtml') == -1) && (clientPC.indexOf('netscape/7.0')==-1)); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
447 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
448 |
// Function adapted from MediaWiki/phpBB |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
449 |
function guied_insert_wikitext_tag(txtarea, tagOpen, tagClose, sampleText) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
450 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
451 |
// IE |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
452 |
if (document.selection && !is_gecko) { |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
453 |
var theSelection = document.selection.createRange().text; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
454 |
if (!theSelection) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
455 |
theSelection=sampleText; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
456 |
txtarea.focus(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
457 |
if (theSelection.charAt(theSelection.length - 1) == " ") { // exclude ending space char, if any |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
458 |
theSelection = theSelection.substring(0, theSelection.length - 1); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
459 |
document.selection.createRange().text = tagOpen + theSelection + tagClose + " "; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
460 |
} else { |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
461 |
document.selection.createRange().text = tagOpen + theSelection + tagClose; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
462 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
463 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
464 |
// Mozilla |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
465 |
} else if(txtarea.selectionStart || txtarea.selectionStart == '0') { |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
466 |
var replaced = false; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
467 |
var startPos = txtarea.selectionStart; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
468 |
var endPos = txtarea.selectionEnd; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
469 |
if (endPos-startPos) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
470 |
replaced = true; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
471 |
var scrollTop = txtarea.scrollTop; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
472 |
var myText = (txtarea.value).substring(startPos, endPos); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
473 |
if (!myText) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
474 |
myText=sampleText; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
475 |
if (myText.charAt(myText.length - 1) == " ") { // exclude ending space char, if any |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
476 |
subst = tagOpen + myText.substring(0, (myText.length - 1)) + tagClose + " "; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
477 |
} else { |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
478 |
subst = tagOpen + myText + tagClose; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
479 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
480 |
txtarea.value = txtarea.value.substring(0, startPos) + subst + |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
481 |
txtarea.value.substring(endPos, txtarea.value.length); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
482 |
txtarea.focus(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
483 |
//set new selection |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
484 |
if (replaced) { |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
485 |
var cPos = startPos+(tagOpen.length+myText.length+tagClose.length); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
486 |
txtarea.selectionStart = cPos; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
487 |
txtarea.selectionEnd = cPos; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
488 |
} else { |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
489 |
txtarea.selectionStart = startPos+tagOpen.length; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
490 |
txtarea.selectionEnd = startPos+tagOpen.length+myText.length; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
491 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
492 |
txtarea.scrollTop = scrollTop; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
493 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
494 |
// All other browsers get no toolbar. |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
495 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
496 |
// reposition cursor if possible |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
497 |
if (txtarea.createTextRange) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
498 |
txtarea.caretPos = document.selection.createRange().duplicate(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
499 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
500 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
501 |
function guied_replace_selection(txtarea, text) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
502 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
503 |
// IE |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
504 |
if (document.selection && !is_gecko) { |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
505 |
txtarea.focus(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
506 |
document.selection.createRange().text = text; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
507 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
508 |
// Mozilla |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
509 |
} else if(txtarea.selectionStart || txtarea.selectionStart == '0') { |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
510 |
var replaced = false; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
511 |
var startPos = txtarea.selectionStart; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
512 |
var endPos = txtarea.selectionEnd; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
513 |
if (endPos-startPos) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
514 |
replaced = true; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
515 |
var scrollTop = txtarea.scrollTop; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
516 |
var myText = (txtarea.value).substring(startPos, endPos); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
517 |
if (!myText) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
518 |
myText = ''; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
519 |
txtarea.value = txtarea.value.substring(0, startPos) + text + |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
520 |
txtarea.value.substring(endPos, txtarea.value.length); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
521 |
txtarea.focus(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
522 |
//set new selection |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
523 |
var cPos = startPos+text.length; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
524 |
txtarea.selectionStart = cPos; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
525 |
txtarea.selectionEnd = cPos; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
526 |
txtarea.scrollTop = scrollTop; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
527 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
528 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
529 |
// reposition cursor if possible |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
530 |
if (txtarea.createTextRange) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
531 |
txtarea.caretPos = document.selection.createRange().duplicate(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
532 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
533 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
534 |
function guied_get_selection(txtarea, sampleText) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
535 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
536 |
if ( !sampleText ) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
537 |
sampleText = ''; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
538 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
539 |
// IE |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
540 |
if (document.selection && !is_gecko) { |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
541 |
var theSelection = document.selection.createRange().text; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
542 |
if (!theSelection) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
543 |
theSelection=sampleText; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
544 |
return theSelection; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
545 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
546 |
// Mozilla |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
547 |
} else if(txtarea.selectionStart || txtarea.selectionStart == '0') { |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
548 |
var replaced = false; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
549 |
var startPos = txtarea.selectionStart; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
550 |
var endPos = txtarea.selectionEnd; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
551 |
if (endPos-startPos) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
552 |
replaced = true; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
553 |
var scrollTop = txtarea.scrollTop; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
554 |
var myText = (txtarea.value).substring(startPos, endPos); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
555 |
if (!myText) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
556 |
myText=sampleText; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
557 |
return myText; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
558 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
559 |
return sampleText; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
560 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
561 |
|
7
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
562 |
function guied_self(elem) |
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
563 |
{ |
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
564 |
while ( elem.tagName != 'BODY' ) |
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
565 |
{ |
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
566 |
elem = elem.parentNode; |
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
567 |
if ( $(elem).hasClass('guieditor') ) |
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
568 |
return elem; |
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
569 |
} |
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
570 |
return null; |
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
571 |
} |
4f40b21648a9
Some work towards making it usable on any textarea (not just ajaxEditArea)
Dan Fuhry <dan@enanocms.org>
parents:
6
diff
changeset
|
572 |
|
0
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
573 |
// |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
574 |
// Autofill schema for images |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
575 |
// |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
576 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
577 |
var autofill_schemas = autofill_schemas || {}; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
578 |
autofill_schemas.guied_image = { |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
579 |
init: function(element, fillclass, params) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
580 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
581 |
$(element).autocomplete(makeUrlNS('Special', 'Autofill', 'type=' + fillclass) + '&userinput=', { |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
582 |
minChars: 3, |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
583 |
formatItem: function(row, _, __) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
584 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
585 |
var html = '<div style="float: left; margin-right: 4px;"><img alt="" src="' + row.thumbnail + '" /></div>'; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
586 |
html += row.title; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
587 |
html += '<div style="clear: both;"></div>'; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
588 |
return html; |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
589 |
}, |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
590 |
showWhenNoResults: true, |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
591 |
noResultsHTML: '<tr><td class="row1" style="font-size: smaller;">' + $lang.get('user_autofill_msg_no_suggestions') + '</td></tr>', |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
592 |
onItemSelect: function(li) |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
593 |
{ |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
594 |
// $('#guied_image_file').val(li.selectValue); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
595 |
guied_refresh_image(); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
596 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
597 |
}); |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
598 |
} |
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
599 |
|
640e15974415
First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff
changeset
|
600 |
}; |
5
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
601 |
|
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
602 |
// This is only used if floodlight is available |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
603 |
autofill_schemas.guied_floodlight = { |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
604 |
init: function(element, fillclass, params) |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
605 |
{ |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
606 |
params = params || {}; |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
607 |
$(element).autocomplete(makeUrlNS('Special', 'Autofill', 'type=floodlight') + '&userinput=', { |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
608 |
minChars: 3, |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
609 |
formatItem: function(row, _, __) |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
610 |
{ |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
611 |
var type = ( typeof(row.type) == 'string' ) ? row.type : ''; |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
612 |
var html = '<big>' + row.title + '</big> <small>' + type + '</small>'; |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
613 |
html += '<br /><small>' + $lang.get('floodlight_lbl_score') + row.score + '% | ' + row.size + '</small>'; |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
614 |
row[0] = row[0].replace(/^go:/, ''); |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
615 |
return html; |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
616 |
}, |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
617 |
tableHeader: '<tr><th>' + $lang.get('floodlight_table_heading') + '</th></tr>', |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
618 |
showWhenNoResults: true, |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
619 |
onItemSelect: function(li) |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
620 |
{ |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
621 |
$(element).val(li.selectValue.replace(/^go:/, '')); |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
622 |
}, |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
623 |
width: 180, |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
624 |
noResultsHTML: '<tr><td class="row1" style="font-size: smaller;">' + $lang.get('floodlight_msg_no_results') + '</td></tr>', |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
625 |
}); |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
626 |
} |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
627 |
}; |
28ef73d2e7e8
Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents:
3
diff
changeset
|
628 |