guieditor/editor.js
author Dan Fuhry <dan@enanocms.org>
Mon, 15 Nov 2010 19:22:13 -0500
changeset 6 7398bdc17604
parent 5 28ef73d2e7e8
child 7 4f40b21648a9
permissions -rw-r--r--
Added hide-with-mce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
     1
attachHook('editor_gui_toolbar', 'guied_insert_toolbar(ta_wrapper, response.toolbar_templates);');
640e15974415 First 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
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     3
function guied_insert_toolbar(ta_wrapper, toolbar_templates)
640e15974415 First 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),
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
    60
					FLAGS: 'href="#" onclick="guied_act(\'' + buttons[i] + '\'); 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
    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;
6
7398bdc17604 Added hide-with-mce
Dan Fuhry <dan@enanocms.org>
parents: 5
diff changeset
    76
	wrapperdiv.className = 'hide-with-mce';
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
    77
	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
    78
}
640e15974415 First 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
function guied_act(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
    81
{
640e15974415 First 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
	var textarea = document.getElementById('ajaxEditArea');
5
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
    83
	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
    84
	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
    85
	{
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    86
		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
    87
			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
    88
			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
    89
		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
    90
			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
    91
			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
    92
		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
    93
			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
    94
			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
    95
		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
    96
			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
    97
			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
    98
			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
    99
				{
640e15974415 First 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
					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
   101
					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
   102
								<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
   103
									<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
   104
									' + $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
   105
									</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
   106
									<td valign="top"> \
5
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   107
										<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
   108
										<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
   109
									</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
   110
								</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
   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_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
   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"> \
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   116
										<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
   117
										<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
   118
									</td> \
1
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   119
								</tr> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   120
							</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
   121
					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
   122
									<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
   123
									<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
   124
								</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
   125
				});
640e15974415 First 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
			
640e15974415 First 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
			// 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
   128
			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
   129
			
640e15974415 First 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
			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
   131
			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
   132
			$('#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
   133
			
640e15974415 First 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
			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
   135
		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
   136
			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
   137
			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
   138
			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
   139
				{
640e15974415 First 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
					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
   141
					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
   142
								<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
   143
									<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
   144
									' + $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
   145
									</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
   146
									<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
   147
										<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
   148
										<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
   149
									</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
   150
								</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
   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_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
   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_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
   157
										<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
   158
									</td> \
1
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   159
								</tr> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   160
							</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
   161
					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
   162
									<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
   163
									<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
   164
								</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
   165
				});
640e15974415 First 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
			
640e15974415 First 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
			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
   168
			$('#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
   169
			
640e15974415 First 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
			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
   171
		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
   172
			// 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
   173
			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
   174
			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
   175
			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
   176
				{
640e15974415 First 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
					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
   178
					// 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
   179
					// 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
   180
					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
   181
								<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
   182
									<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
   183
									' + $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
   184
									</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
   185
									<td valign="top"> \
1
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   186
										<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
   187
										<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
   188
										<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
   189
										<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
   190
										<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
   191
										</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
   192
									</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
   193
								</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
   194
								<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
   195
									<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
   196
										' + $lang.get('guied_image_lbl_resize') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   197
									</td> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   198
									<td valign="top"> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   199
										<label> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   200
											<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
   201
											' + $lang.get('guied_image_checkbox_resize') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   202
										</label> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   203
										<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
   204
											' + $lang.get('guied_image_lbl_dimensions') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   205
											<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
   206
											<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
   207
											<br /> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   208
											&nbsp;&nbsp;&nbsp; \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   209
												' + $lang.get('guied_image_resize_or') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   210
												<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
   211
												' + $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
   212
											<small> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   213
												' + $lang.get('guied_image_msg_preserve_aspect') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   214
											</small> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   215
										</div> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   216
									</td> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   217
								</tr> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   218
								<tr> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   219
									<td valign="top" style="white-space: nowrap;"> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   220
										' + $lang.get('guied_image_lbl_mode') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   221
									</td> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   222
									<td valign="top"> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   223
										<form> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   224
										<label> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   225
											<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
   226
											' + $lang.get('guied_image_lbl_framed') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   227
										</label> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   228
										<label> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   229
											<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
   230
											' + $lang.get('guied_image_lbl_inline') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   231
										</label> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   232
										<label> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   233
											<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
   234
											' + $lang.get('guied_image_lbl_raw') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   235
										</label><br /> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   236
										</form> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   237
										<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
   238
									</td> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   239
								</tr> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   240
							</table> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   241
							<div class="guied_image_mode framed"> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   242
								<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
   243
								<tr> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   244
									<td valign="top" style="white-space: nowrap;"> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   245
									' + $lang.get('guied_image_framed_lbl_side') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   246
									</td> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   247
									<td valign="top"> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   248
										<form> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   249
										<label> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   250
											<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
   251
											' + $lang.get('guied_image_framed_left') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   252
										</label> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   253
										<label> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   254
											<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
   255
											' + $lang.get('guied_image_framed_right') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   256
										</label> \
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
									</td> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   259
								</tr> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   260
								<tr> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   261
									<td valign="top" style="white-space: nowrap;"> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   262
										' + $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
   263
									</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
   264
									<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
   265
										<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
   266
									</td> \
1
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   267
								</tr> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   268
								</table> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   269
							</div> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   270
							<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
   271
								<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
   272
								<tr> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   273
									<td valign="top" style="white-space: nowrap;"> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   274
										' + $lang.get('guied_image_lbl_alttext') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   275
									</td> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   276
									<td valign="top"> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   277
										<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
   278
									</td> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   279
								</tr> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   280
								</table> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   281
							</div> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   282
							<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
   283
								' + $lang.get('guied_image_raw_msg_noopt') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   284
							</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
   285
					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
   286
									<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
   287
									<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
   288
								</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
   289
				});
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   290
			
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   291
			// 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
   292
			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
   293
			
640e15974415 First 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
			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
   295
			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
   296
			$('#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
   297
			
640e15974415 First 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
			break;
2
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   299
		case 'table':
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   300
			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
   301
			break;
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   302
		case 'ulist':
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   303
			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
   304
			break;
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   305
		case 'olist':
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   306
			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
   307
			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
   308
		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
   309
			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
   310
			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
   311
	}
2
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   312
}
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   313
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   314
function guied_register_heading(select)
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   315
{
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   316
	var textarea = document.getElementById('ajaxEditArea');
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   317
	var n = Number($(select).val());
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   318
	if ( n < 1 || n > 6 )
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   319
		return;
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   320
	$(select).val('0');
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   321
	var tag = '';
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   322
	for ( var i = 0; i < n; i++ )
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   323
		tag += '=';
1
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   324
	
2
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   325
	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
   326
}
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   327
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   328
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
   329
{
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   330
	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
   331
	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
   332
	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
   333
	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
   334
	
640e15974415 First 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
	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
   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
640e15974415 First 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
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
   339
{
640e15974415 First 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 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
   341
	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
   342
	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
   343
	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
   344
	
640e15974415 First 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
	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
   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
640e15974415 First 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
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
   349
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
   350
{
640e15974415 First 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 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
   352
	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
   353
	$(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
   354
				'<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
   355
				'<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
   356
				'<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
   357
				'<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
   358
			'</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
   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
640e15974415 First 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
640e15974415 First 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
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
   363
{
640e15974415 First 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
	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
   365
	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
   366
	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
   367
		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
   368
	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
   369
	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
   370
	// 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
   371
	$('#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
   372
	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
   373
	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
   374
}
640e15974415 First 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
640e15974415 First 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
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
   377
{
1
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   378
	$('#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
   379
}
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   380
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   381
function guied_image_toggle_default()
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   382
{
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   383
	if ( $('#guied_image_resize_default:checked').length )
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   384
	{
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   385
		$('#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
   386
	}
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   387
	else
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
		$('#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
   390
	}
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
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   393
function guied_image_set_mode(val)
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   394
{
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   395
	$('#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
   396
	$('.guied_image_mode').hide();
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   397
	$('.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
   398
}
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   399
1
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   400
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
   401
{
1
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   402
	var attrs = [];
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   403
	var filename = $('#guied_image_file').val();
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   404
	attrs.push(':' + namespace_list.File + filename);
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   405
	if ( $('#guied_image_resize:checked').length )
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   406
	{
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   407
		if ( $('#guied_image_resize_default:checked').length )
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   408
			attrs.push('thumb');
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   409
		else
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   410
			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
   411
	}
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   412
	var caption = '';
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   413
	switch($('.guied_image_mode_radio:checked').val())
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   414
	{
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   415
		case 'framed':
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   416
			attrs.push($('.guied_image_side:checked').val());
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   417
			caption = $('#guied_image_caption').val();
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   418
			break;
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   419
		case 'inline':
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   420
			caption = $('#guied_image_alttext').val();
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   421
			break;
2
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   422
		case 'raw':
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   423
			attrs.push('raw');
1
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   424
	}
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   425
	if ( caption != '' )
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   426
		attrs.push(caption);
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   427
	
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   428
	var tag = '[[' + implode('|', attrs) + ']]';
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   429
	
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   430
	guied_replace_selection(document.getElementById('ajaxEditArea'), tag);
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   431
	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
   432
}
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   433
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   434
// 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
   435
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
   436
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
   437
                && (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
   438
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   439
// 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
   440
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
   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
	// 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
   443
	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
   444
		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
   445
		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
   446
			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
   447
		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
   448
		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
   449
			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
   450
			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
   451
		} 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
   452
			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
   453
		}
640e15974415 First 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
640e15974415 First 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
	// 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
   456
	} 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
   457
		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
   458
		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
   459
		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
   460
		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
   461
			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
   462
		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
   463
		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
   464
		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
   465
			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
   466
		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
   467
			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
   468
		} 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
   469
			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
   470
		}
640e15974415 First 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
		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
   472
			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
   473
		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
   474
		//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
   475
		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
   476
			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
   477
			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
   478
			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
   479
		} 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
   480
			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
   481
			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
   482
		}
640e15974415 First 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
		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
   484
640e15974415 First 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
	// 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
   486
	}
640e15974415 First 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
	// 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
   488
	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
   489
		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
   490
}
640e15974415 First 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
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
   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
	// 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
   495
	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
   496
		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
   497
		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
   498
640e15974415 First 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
	// 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
   500
	} 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
   501
		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
   502
		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
   503
		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
   504
		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
   505
			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
   506
		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
   507
		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
   508
		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
   509
			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
   510
		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
   511
			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
   512
		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
   513
		//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
   514
		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
   515
		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
   516
		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
   517
		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
   518
640e15974415 First 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
	}
640e15974415 First 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
	// 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
   521
	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
   522
		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
   523
}
640e15974415 First 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
640e15974415 First 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
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
   526
{
640e15974415 First 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
	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
   528
		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
   529
	
640e15974415 First 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
	// 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
   531
	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
   532
		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
   533
		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
   534
			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
   535
		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
   536
640e15974415 First 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
	// 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
   538
	} 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
   539
		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
   540
		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
   541
		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
   542
		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
   543
			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
   544
		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
   545
		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
   546
		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
   547
			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
   548
		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
   549
	}
640e15974415 First 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
	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
   551
}
640e15974415 First 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
640e15974415 First 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
//
640e15974415 First 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
// 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
   555
//
640e15974415 First 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
640e15974415 First 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
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
   558
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
   559
	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
   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
		$(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
   562
				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
   563
				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
   564
				{
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   565
					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
   566
					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
   567
					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
   568
					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
   569
				},
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   570
				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
   571
				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
   572
				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
   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
					// $('#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
   575
					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
   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
		});
640e15974415 First 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
	}
640e15974415 First 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
	
640e15974415 First 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
};
5
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   581
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   582
// This is only used if floodlight is available
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   583
autofill_schemas.guied_floodlight = {
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   584
  init: function(element, fillclass, params)
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   585
  {
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   586
    params = params || {};
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   587
    $(element).autocomplete(makeUrlNS('Special', 'Autofill', 'type=floodlight') + '&userinput=', {
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   588
        minChars: 3,
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   589
        formatItem: function(row, _, __)
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   590
        {
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   591
          var type = ( typeof(row.type) == 'string' ) ? row.type : '';
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   592
          var html = '<big>' + row.title + '</big> <small>' + type + '</small>';
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   593
          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
   594
          row[0] = row[0].replace(/^go:/, '');
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   595
          return html;
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   596
        },
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   597
        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
   598
        showWhenNoResults: true,
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   599
        onItemSelect: function(li)
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   600
        {
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   601
        	$(element).val(li.selectValue.replace(/^go:/, ''));
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   602
        },
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   603
        width: 180,
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   604
        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
   605
    });
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   606
  }
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   607
};
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   608