guieditor/editor.js
author Dan Fuhry <dan@enanocms.org>
Fri, 12 Nov 2010 18:12:41 -0500
changeset 5 28ef73d2e7e8
parent 3 1e6929f9978b
child 6 7398bdc17604
permissions -rw-r--r--
Sprites, also floodlight search support
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;
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    76
	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
    77
}
640e15974415 First 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
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
    80
{
640e15974415 First 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
	var textarea = document.getElementById('ajaxEditArea');
5
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
    82
	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
    83
	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
    84
	{
640e15974415 First 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
		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
    86
			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
    87
			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
    88
		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
    89
			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
    90
			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
    91
		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
    92
			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
    93
			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
    94
		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
    95
			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
    96
			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
    97
			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
    98
				{
640e15974415 First 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
					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
   100
					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
   101
								<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
   102
									<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
   103
									' + $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
   104
									</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
   105
									<td valign="top"> \
5
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   106
										<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
   107
										<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
   108
									</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
   109
								</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
   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
									<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
   112
									' + $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
   113
									</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
   114
									<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
   115
										<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
   116
										<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
   117
									</td> \
1
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   118
								</tr> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   119
							</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
   120
					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
   121
									<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
   122
									<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
   123
								</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
   124
				});
640e15974415 First 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
			// 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
   127
			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
   128
			
640e15974415 First 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
			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
   130
			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
   131
			$('#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
   132
			
640e15974415 First 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
			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
   134
		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
   135
			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
   136
			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
   137
			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
   138
				{
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   139
					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
   140
					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
   141
								<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
   142
									<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
   143
									' + $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
   144
									</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
   145
									<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
   146
										<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
   147
										<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
   148
									</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
   149
								</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
   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
									<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
   152
									' + $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
   153
									</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
   154
									<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
   155
										<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
   156
										<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
   157
									</td> \
1
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   158
								</tr> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   159
							</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
   160
					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
   161
									<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
   162
									<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
   163
								</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
   164
				});
640e15974415 First 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
			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
   167
			$('#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
   168
			
640e15974415 First 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
			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
   170
		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
   171
			// 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
   172
			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
   173
			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
   174
			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
   175
				{
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   176
					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
   177
					// 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
   178
					// 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
   179
					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
   180
								<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
   181
									<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
   182
									' + $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
   183
									</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
   184
									<td valign="top"> \
1
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   185
										<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
   186
										<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
   187
										<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
   188
										<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
   189
										<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
   190
										</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
   191
									</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
   192
								</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
   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
									<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
   195
										' + $lang.get('guied_image_lbl_resize') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   196
									</td> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   197
									<td valign="top"> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   198
										<label> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   199
											<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
   200
											' + $lang.get('guied_image_checkbox_resize') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   201
										</label> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   202
										<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
   203
											' + $lang.get('guied_image_lbl_dimensions') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   204
											<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
   205
											<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
   206
											<br /> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   207
											&nbsp;&nbsp;&nbsp; \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   208
												' + $lang.get('guied_image_resize_or') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   209
												<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
   210
												' + $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
   211
											<small> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   212
												' + $lang.get('guied_image_msg_preserve_aspect') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   213
											</small> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   214
										</div> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   215
									</td> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   216
								</tr> \
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
									<td valign="top" style="white-space: nowrap;"> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   219
										' + $lang.get('guied_image_lbl_mode') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   220
									</td> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   221
									<td valign="top"> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   222
										<form> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   223
										<label> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   224
											<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
   225
											' + $lang.get('guied_image_lbl_framed') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   226
										</label> \
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
											<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
   229
											' + $lang.get('guied_image_lbl_inline') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   230
										</label> \
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
											<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
   233
											' + $lang.get('guied_image_lbl_raw') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   234
										</label><br /> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   235
										</form> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   236
										<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
   237
									</td> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   238
								</tr> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   239
							</table> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   240
							<div class="guied_image_mode framed"> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   241
								<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
   242
								<tr> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   243
									<td valign="top" style="white-space: nowrap;"> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   244
									' + $lang.get('guied_image_framed_lbl_side') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   245
									</td> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   246
									<td valign="top"> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   247
										<form> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   248
										<label> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   249
											<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
   250
											' + $lang.get('guied_image_framed_left') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   251
										</label> \
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
											<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
   254
											' + $lang.get('guied_image_framed_right') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   255
										</label> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   256
										</form> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   257
									</td> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   258
								</tr> \
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
									<td valign="top" style="white-space: nowrap;"> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   261
										' + $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
   262
									</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
   263
									<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
   264
										<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
   265
									</td> \
1
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   266
								</tr> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   267
								</table> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   268
							</div> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   269
							<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
   270
								<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
   271
								<tr> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   272
									<td valign="top" style="white-space: nowrap;"> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   273
										' + $lang.get('guied_image_lbl_alttext') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   274
									</td> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   275
									<td valign="top"> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   276
										<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
   277
									</td> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   278
								</tr> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   279
								</table> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   280
							</div> \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   281
							<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
   282
								' + $lang.get('guied_image_raw_msg_noopt') + ' \
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   283
							</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
   284
					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
   285
									<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
   286
									<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
   287
								</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
   288
				});
640e15974415 First 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
			// 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
   291
			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
   292
			
640e15974415 First 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
			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
   294
			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
   295
			$('#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
   296
			
640e15974415 First 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
			break;
2
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   298
		case 'table':
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   299
			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
   300
			break;
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   301
		case 'ulist':
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   302
			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
   303
			break;
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   304
		case 'olist':
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   305
			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
   306
			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
   307
		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
   308
			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
   309
			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
   310
	}
2
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   311
}
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
function guied_register_heading(select)
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   314
{
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   315
	var textarea = document.getElementById('ajaxEditArea');
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   316
	var n = Number($(select).val());
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   317
	if ( n < 1 || n > 6 )
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   318
		return;
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   319
	$(select).val('0');
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   320
	var tag = '';
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   321
	for ( var i = 0; i < n; i++ )
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   322
		tag += '=';
1
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   323
	
2
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   324
	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
   325
}
640e15974415 First 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
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
   328
{
640e15974415 First 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
	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
   330
	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
   331
	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
   332
	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
   333
	
640e15974415 First 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
	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
   335
}
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   336
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   337
function guied_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
   338
{
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   339
	var 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
   340
	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
   341
	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
   342
	guied_replace_selection(document.getElementById('ajaxEditArea'), tag);
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   343
	
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   344
	miniPromptDestroy(insertbtn);
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   345
}
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   346
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   347
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
   348
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
   349
{
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   350
	var 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
   351
	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
   352
	$(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
   353
				'<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
   354
				'<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
   355
				'<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
   356
				'<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
   357
			'</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
   358
}
640e15974415 First 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
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
   362
{
640e15974415 First 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
	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
   364
	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
   365
	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
   366
		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
   367
	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
   368
	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
   369
	// 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
   370
	$('#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
   371
	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
   372
	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
   373
}
640e15974415 First 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
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
   376
{
1
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   377
	$('#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
   378
}
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
function guied_image_toggle_default()
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   381
{
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   382
	if ( $('#guied_image_resize_default:checked').length )
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   383
	{
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   384
		$('#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
   385
	}
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   386
	else
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   387
	{
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   388
		$('#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
   389
	}
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
function guied_image_set_mode(val)
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   393
{
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   394
	$('#guied_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
   395
	$('.guied_image_mode').hide();
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   396
	$('.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
   397
}
640e15974415 First 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
1
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   399
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
   400
{
1
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   401
	var attrs = [];
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   402
	var filename = $('#guied_image_file').val();
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   403
	attrs.push(':' + namespace_list.File + filename);
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   404
	if ( $('#guied_image_resize:checked').length )
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   405
	{
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   406
		if ( $('#guied_image_resize_default:checked').length )
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   407
			attrs.push('thumb');
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   408
		else
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   409
			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
   410
	}
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   411
	var caption = '';
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   412
	switch($('.guied_image_mode_radio:checked').val())
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   413
	{
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   414
		case 'framed':
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   415
			attrs.push($('.guied_image_side:checked').val());
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   416
			caption = $('#guied_image_caption').val();
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   417
			break;
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   418
		case 'inline':
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   419
			caption = $('#guied_image_alttext').val();
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   420
			break;
2
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   421
		case 'raw':
307591683f3b Added olist, ulist, table and heading
Dan Fuhry <dan@enanocms.org>
parents: 1
diff changeset
   422
			attrs.push('raw');
1
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   423
	}
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   424
	if ( caption != '' )
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   425
		attrs.push(caption);
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   426
	
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   427
	var tag = '[[' + implode('|', attrs) + ']]';
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   428
	
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   429
	guied_replace_selection(document.getElementById('ajaxEditArea'), tag);
960c1572df75 Better icons, and finished the image tool.
Dan Fuhry <dan@enanocms.org>
parents: 0
diff changeset
   430
	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
   431
}
640e15974415 First 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
// 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
   434
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
   435
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
   436
                && (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
   437
640e15974415 First 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
// 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
   439
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
   440
{
640e15974415 First 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
	// 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
   442
	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
   443
		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
   444
		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
   445
			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
   446
		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
   447
		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
   448
			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
   449
			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
   450
		} 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
   451
			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
   452
		}
640e15974415 First 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
	// 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
   455
	} 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
   456
		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
   457
		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
   458
		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
   459
		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
   460
			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
   461
		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
   462
		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
   463
		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
   464
			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
   465
		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
   466
			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
   467
		} 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
   468
			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
   469
		}
640e15974415 First 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
		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
   471
			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
   472
		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
   473
		//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
   474
		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
   475
			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
   476
			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
   477
			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
   478
		} 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
   479
			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
   480
			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
   481
		}
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   482
		txtarea.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
   483
640e15974415 First 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
	// 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
   485
	}
640e15974415 First 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
	// 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
   487
	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
   488
		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
   489
}
640e15974415 First 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
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
   492
{
640e15974415 First 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
	// 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
   494
	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
   495
		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
   496
		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
   497
640e15974415 First 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
	// 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
   499
	} 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
   500
		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
   501
		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
   502
		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
   503
		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
   504
			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
   505
		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
   506
		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
   507
		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
   508
			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
		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
   510
			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
   511
		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
   512
		//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
   513
		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
   514
		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
   515
		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
   516
		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
   517
640e15974415 First 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
	// 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
   520
	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
   521
		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
   522
}
640e15974415 First 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
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
   525
{
640e15974415 First 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
	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
   527
		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
	
640e15974415 First 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
	// 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
   530
	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
   531
		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
   532
		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
   533
			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
   534
		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
   535
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   536
	// 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
   537
	} 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
   538
		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
   539
		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
   540
		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
   541
		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
   542
			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
   543
		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
   544
		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
   545
		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
   546
			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
   547
		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
   548
	}
640e15974415 First 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
	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
   550
}
640e15974415 First 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
// 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
   554
//
640e15974415 First 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
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
   557
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
   558
	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
   559
	{
640e15974415 First 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
		$(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
   561
				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
   562
				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
   563
				{
640e15974415 First 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
					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
   565
					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
   566
					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
   567
					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
   568
				},
640e15974415 First 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
				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
   570
				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
   571
				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
   572
				{
640e15974415 First 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
					// $('#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
   574
					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
   575
				}
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   576
		});
640e15974415 First revision. Largely unfinished; all buttons but Image work, but missing many features. Image is partially implemented.
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
   577
	}
640e15974415 First 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
};
5
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   580
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   581
// This is only used if floodlight is available
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   582
autofill_schemas.guied_floodlight = {
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   583
  init: function(element, fillclass, params)
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   584
  {
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   585
    params = params || {};
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   586
    $(element).autocomplete(makeUrlNS('Special', 'Autofill', 'type=floodlight') + '&userinput=', {
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   587
        minChars: 3,
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   588
        formatItem: function(row, _, __)
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   589
        {
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   590
          var type = ( typeof(row.type) == 'string' ) ? row.type : '';
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   591
          var html = '<big>' + row.title + '</big> <small>' + type + '</small>';
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   592
          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
   593
          row[0] = row[0].replace(/^go:/, '');
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   594
          return html;
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   595
        },
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   596
        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
   597
        showWhenNoResults: true,
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   598
        onItemSelect: function(li)
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   599
        {
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   600
        	$(element).val(li.selectValue.replace(/^go:/, ''));
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   601
        },
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   602
        width: 180,
28ef73d2e7e8 Sprites, also floodlight search support
Dan Fuhry <dan@enanocms.org>
parents: 3
diff changeset
   603
        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
   604
    });
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