Vergleich jscripts/editor.js - 1.6.0 - 1.6.15

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 125Zeile 125
		this.colors[38] = "#E6E6FA";
this.colors[39] = "#DDA0DD";
this.colors[40] = "#FFFFFF";

		this.colors[38] = "#E6E6FA";
this.colors[39] = "#DDA0DD";
this.colors[40] = "#FFFFFF";

		
// An array of video services to be shown (youtube, vimeo, etc)


// An array of video services to be shown (youtube, vimeo, etc)

		this.videos = new Object();
this.videos["dailymotion"] = this.options.lang.video_dailymotion;

		this.videos = new Object();
this.videos["dailymotion"] = this.options.lang.video_dailymotion;

		this.videos["googlevideo"] = this.options.lang.video_googlevideo;

 
		this.videos["metacafe"] = this.options.lang.video_metacafe;
this.videos["myspacetv"] = this.options.lang.video_myspacetv;
this.videos["vimeo"] = this.options.lang.video_vimeo;

		this.videos["metacafe"] = this.options.lang.video_metacafe;
this.videos["myspacetv"] = this.options.lang.video_myspacetv;
this.videos["vimeo"] = this.options.lang.video_vimeo;

Zeile 254Zeile 253

// Set the width/height of the area
subtract = 20;


// Set the width/height of the area
subtract = 20;

		subtract2 = 12;

		subtract2 = 8;

		areaContainer.style.height = parseInt(Element.getDimensions(this.editor).height)-this.toolbarHeight-subtract+"px";
areaContainer.style.width = parseInt(Element.getDimensions(this.editor).width)-subtract2+"px";


		areaContainer.style.height = parseInt(Element.getDimensions(this.editor).height)-this.toolbarHeight-subtract+"px";
areaContainer.style.width = parseInt(Element.getDimensions(this.editor).width)-subtract2+"px";


Zeile 370Zeile 369
		if(toolbar.lastChild.previousSibling)
toolbar.lastChild.previousSibling.className += ' toolbar_button_group_last';
},

		if(toolbar.lastChild.previousSibling)
toolbar.lastChild.previousSibling.className += ' toolbar_button_group_last';
},

	



	setElementState: function(element, state) {
element.addClassName('toolbar_'+state);

	setElementState: function(element, state) {
element.addClassName('toolbar_'+state);

		
if(element.hasClassName('toolbar_button_group_first')) {
if(state == 'clicked') {
append = 'toolbar_clicked';
}
else if(state == 'hover') {
append = 'toolbar_hover';
}
append += '_button_group_first';
element.addClassName(append);
}

if(element.hasClassName('toolbar_button_group_last')) {
if(state == 'clicked') {
append = 'toolbar_clicked';


if(element.hasClassName('toolbar_button_group_first')) {
if(state == 'clicked') {
append = 'toolbar_clicked';
}
else if(state == 'hover') {
append = 'toolbar_hover';
}
append += '_button_group_first';
element.addClassName(append);
}

if(element.hasClassName('toolbar_button_group_last')) {
if(state == 'clicked') {
append = 'toolbar_clicked';

			}
else if(state == 'hover') {
append = 'toolbar_hover';

			}
else if(state == 'hover') {
append = 'toolbar_hover';

Zeile 396Zeile 395
			element.addClassName(append);
}
},

			element.addClassName(append);
}
},

	



	removeElementState: function(element, state)
{
element.removeClassName('toolbar_'+state);

	removeElementState: function(element, state)
{
element.removeClassName('toolbar_'+state);

		



		if(element.hasClassName('toolbar_button_group_first')) {

		if(element.hasClassName('toolbar_button_group_first')) {

			if(state == 'clicked') {
append = 'toolbar_clicked';
}

			if(state == 'clicked') {
append = 'toolbar_clicked';
}

			else if(state == 'hover') {
append = 'toolbar_hover';
}
append += '_button_group_first';
element.removeClassName(append);
}

			else if(state == 'hover') {
append = 'toolbar_hover';
}
append += '_button_group_first';
element.removeClassName(append);
}

		



		if(element.hasClassName('toolbar_button_group_last')) {
if(state == 'clicked') {
append = 'toolbar_clicked';

		if(element.hasClassName('toolbar_button_group_last')) {
if(state == 'clicked') {
append = 'toolbar_clicked';

Zeile 421Zeile 420
			}
append += '_button_group_last';
element.removeClassName(append);

			}
append += '_button_group_last';
element.removeClassName(append);

		}	

		}

	},

	},





	dropDownMenuItemClick: function(e)
{
this.restartEditorSelection();
element = Event.element(e);

	dropDownMenuItemClick: function(e)
{
this.restartEditorSelection();
element = Event.element(e);





		if(!element)
return;

		if(!element)
return;

		



		if(!element.extra)
element = element.up('li');

		if(!element.extra)
element = element.up('li');

		



		var mnu = element.up('ul');
var dropdown = this.getElementToolbarItem(mnu);
var label = dropdown.down('.editor_dropdown_label');


		var mnu = element.up('ul');
var dropdown = this.getElementToolbarItem(mnu);
var label = dropdown.down('.editor_dropdown_label');


		if(!dropdown.insertText || (mnu.activeItem && mnu.activeItem == element))

		if(!dropdown.insertText || (dropdown.insertText != "video" && mnu.activeItem && mnu.activeItem == element))

			return;

			return;

		



		mnu.lastItemValue = element.extra;

		mnu.lastItemValue = element.extra;

		this.insertMyCode(dropdown.insertText, element.extra);

 

if(this.getSelectedText($(this.textarea)))
{


if(this.getSelectedText($(this.textarea)))
{

Zeile 466Zeile 464
			mnu.activeItem = element;
element.addClassName('editor_dropdown_menu_item_active');
}

			mnu.activeItem = element;
element.addClassName('editor_dropdown_menu_item_active');
}

 

this.insertMyCode(dropdown.insertText, element.extra);

		this.hideOpenDropDownMenu();
Event.stop(e);
},

		this.hideOpenDropDownMenu();
Event.stop(e);
},

Zeile 496Zeile 496
			}

var sel_color = element.down('.editor_dropdown_color_selected')

			}

var sel_color = element.down('.editor_dropdown_color_selected')

			if(sel_color)
{

			if(sel_color)
{

				sel_color.style.backgroundColor = item.style.backgroundColor;
mnu.lastItemValue = item.insertExtra;
var use_default = element.down('.editor_dropdown_color_item_default');
if(use_default) use_default.style.display = '';

				sel_color.style.backgroundColor = item.style.backgroundColor;
mnu.lastItemValue = item.insertExtra;
var use_default = element.down('.editor_dropdown_color_item_default');
if(use_default) use_default.style.display = '';

			}

			}

			item.addClassName('editor_dropdown_menu_item_active');
}
else

			item.addClassName('editor_dropdown_menu_item_active');
}
else

Zeile 510Zeile 510
			if(label)
{
label.innerHTML = mnu.childNodes[0].innerHTML;

			if(label)
{
label.innerHTML = mnu.childNodes[0].innerHTML;

			}


			}


			var sel_color = element.down('.editor_button_color_selected')
if(sel_color)
{

			var sel_color = element.down('.editor_button_color_selected')
if(sel_color)
{

Zeile 526Zeile 526
	createDropDownMenu: function(options)
{
var dropdown = document.createElement('div');

	createDropDownMenu: function(options)
{
var dropdown = document.createElement('div');

		dropdown.itemType = options.type;

		dropdown.elementType = options.type;

		if(options.image || options.sprite)
dropdown.className = 'toolbar_dropdown_image';
else

		if(options.image || options.sprite)
dropdown.className = 'toolbar_dropdown_image';
else

Zeile 596Zeile 596
				this.setDropDownMenuActiveItem(dropdown, 0);
}.bindAsEventListener(this));
}

				this.setDropDownMenuActiveItem(dropdown, 0);
}.bindAsEventListener(this));
}

		



		$H(options.options).each(function(option)
{
if(options.draw_option)
{
item = options.draw_option(option)

		$H(options.options).each(function(option)
{
if(options.draw_option)
{
item = options.draw_option(option)

			}

			}

			else

			else

			{

			{

				var item = document.createElement('li');
item.innerHTML = option.value;


				var item = document.createElement('li');
item.innerHTML = option.value;


Zeile 616Zeile 616
			Event.observe(item, 'mouseover', function()
{
item.addClassName('editor_dropdown_menu_item_over');

			Event.observe(item, 'mouseover', function()
{
item.addClassName('editor_dropdown_menu_item_over');

			});

			});

			Event.observe(item, 'mouseout', function()
{
item.removeClassName('editor_dropdown_menu_item_over');

			Event.observe(item, 'mouseout', function()
{
item.removeClassName('editor_dropdown_menu_item_over');

Zeile 631Zeile 631
		element = Event.element(e);
if(!element)
return;

		element = Event.element(e);
if(!element)
return;

		if(!element.itemType)

		if(!element.elementType)

			element = this.getElementToolbarItem(element);

			element = this.getElementToolbarItem(element);

		



		var mnu = $(element).down('ul');

		var mnu = $(element).down('ul');

		



		// This menu is already open, close it
if(mnu.style.display != 'none')

		// This menu is already open, close it
if(mnu.style.display != 'none')

		{

		{

			mnu.style.display = 'none';
element.removeClassName('editor_dropdown_menu_open');
this.removeElementState(element, 'clicked');

			mnu.style.display = 'none';
element.removeClassName('editor_dropdown_menu_open');
this.removeElementState(element, 'clicked');

Zeile 647Zeile 647
		}
// Opening this menu
else

		}
// Opening this menu
else

		{

		{

			// If a menu is already open, close it first
this.showDropDownMenu(mnu);
}

			// If a menu is already open, close it first
this.showDropDownMenu(mnu);
}

Zeile 656Zeile 656
	},

showDropDownMenu: function(mnu)

	},

showDropDownMenu: function(mnu)

	{

	{

		this.hideOpenDropDownMenu();
mnu.style.display = '';
element = this.getElementToolbarItem(mnu);

		this.hideOpenDropDownMenu();
mnu.style.display = '';
element = this.getElementToolbarItem(mnu);

Zeile 672Zeile 672
		this.openDropDownMenu.style.display = 'none';
this.getElementToolbarItem(this.openDropDownMenu).removeClassName('editor_dropdown_menu_open');
var dropDown = this.getElementToolbarItem(this.openDropDownMenu);

		this.openDropDownMenu.style.display = 'none';
this.getElementToolbarItem(this.openDropDownMenu).removeClassName('editor_dropdown_menu_open');
var dropDown = this.getElementToolbarItem(this.openDropDownMenu);

 
		this.removeElementState(this.openDropDownMenu.parentNode, 'clicked');

		this.removeElementState(element, 'clicked');
this.openDropDownMenu = null;
Event.stopObserving(document, 'click', this.hideOpenDropDownMenu.bindAsEventListener(this));

		this.removeElementState(element, 'clicked');
this.openDropDownMenu = null;
Event.stopObserving(document, 'click', this.hideOpenDropDownMenu.bindAsEventListener(this));

	},

	},


getElementToolbarItem: function(elem)
{


getElementToolbarItem: function(elem)
{

Zeile 684Zeile 685
			if(parent.insertText) return parent;
parent = parent.parentNode;
} while($(parent));

			if(parent.insertText) return parent;
parent = parent.parentNode;
} while($(parent));





		return false;
},

		return false;
},





	storeCaret: function()
{
if(MyBB.browser != 'ie' || !this.trackingCaret)
{
return;
}

	storeCaret: function()
{
if(MyBB.browser != 'ie' || !this.trackingCaret)
{
return;
}

		



		// Internet explorer errors if you try and select an element... so just handle that by try catch
try {
var range = document.selection.createRange();

		// Internet explorer errors if you try and select an element... so just handle that by try catch
try {
var range = document.selection.createRange();

Zeile 771Zeile 772
				toolbar.lastChild.previousSibling.className += ' toolbar_button_group_last';
}
var separator = document.createElement("span");

				toolbar.lastChild.previousSibling.className += ' toolbar_button_group_last';
}
var separator = document.createElement("span");

			separator.itemType = options.type;

			separator.elementType = options.type;

			separator.className = "toolbar_sep";
toolbar.insertBefore(separator, toolbar.lastChild);
}

			separator.className = "toolbar_sep";
toolbar.insertBefore(separator, toolbar.lastChild);
}

Zeile 780Zeile 781
	createToolbarButton: function(options)
{
var button = document.createElement('span');

	createToolbarButton: function(options)
{
var button = document.createElement('span');

		button.itemType = options.type;

		button.elementType = options.type;

		button.id = 'editor_item_'+options.name;
if(typeof(options.title) != 'undefined')
{

		button.id = 'editor_item_'+options.name;
if(typeof(options.title) != 'undefined')
{

Zeile 798Zeile 799
		button.insertExtra = '';
if(typeof(options.extra) != 'undefined')
button.insertExtra = options.extra;

		button.insertExtra = '';
if(typeof(options.extra) != 'undefined')
button.insertExtra = options.extra;

		



		if(typeof(options.sprite) != 'undefined')

		if(typeof(options.sprite) != 'undefined')

		{

		{

			var img = document.createElement('span');
img.className = 'toolbar_sprite toolbar_sprite_'+options.sprite;
}
else

			var img = document.createElement('span');
img.className = 'toolbar_sprite toolbar_sprite_'+options.sprite;
}
else

		{

		{

			var img = document.createElement('img');
img.src = this.themePath + "/images/" + options.image;
}

			var img = document.createElement('img');
img.src = this.themePath + "/images/" + options.image;
}

Zeile 828Zeile 829

var end = document.createElement('strong');
button.appendChild(end);


var end = document.createElement('strong');
button.appendChild(end);





		// Create the actual drop down menu
if(options.dropdown)
{

		// Create the actual drop down menu
if(options.dropdown)
{

Zeile 844Zeile 845
				elem.parentNode.addClassName('toolbar_button_over_arrow');
});
Event.observe(arrow, 'mouseout', function(e)

				elem.parentNode.addClassName('toolbar_button_over_arrow');
});
Event.observe(arrow, 'mouseout', function(e)

			{

			{

				elem = Event.element(e);
if(!elem) return;
elem.parentNode.removeClassName('toolbar_button_over_arrow');

				elem = Event.element(e);
if(!elem) return;
elem.parentNode.removeClassName('toolbar_button_over_arrow');

Zeile 860Zeile 861
			button.disable = function()
{
if(button.disabled == true) return;

			button.disable = function()
{
if(button.disabled == true) return;


if(options.disabled_sprite)


if(options.disabled_sprite)

				{
img.removeClassName('toolbar_sprite_'+options.sprite);
img.addClassName('toolbar_sprite_disabled_'+options.disabled_sprite);

				{
img.removeClassName('toolbar_sprite_'+options.sprite);
img.addClassName('toolbar_sprite_disabled_'+options.disabled_sprite);

Zeile 891Zeile 892
			{
button.disable();
button.disabled = true;

			{
button.disable();
button.disabled = true;

			}

			}

			else
button.disabled = false;

			else
button.disabled = false;

		}

		}


Event.observe(button, "mouseover", this.toolbarItemHover.bindAsEventListener(this));
Event.observe(button, "mouseout", this.toolbarItemOut.bindAsEventListener(this));


Event.observe(button, "mouseover", this.toolbarItemHover.bindAsEventListener(this));
Event.observe(button, "mouseout", this.toolbarItemOut.bindAsEventListener(this));

Zeile 905Zeile 906
			Event.observe(button, "click", this.toolbarItemClick.bindAsEventListener(this));
}
return button;

			Event.observe(button, "click", this.toolbarItemClick.bindAsEventListener(this));
}
return button;

	},


	},


	updateOldArea: function(e)

	updateOldArea: function(e)

	{

	{

		this.oldTextarea.value = $(this.textarea).value;
},

		this.oldTextarea.value = $(this.textarea).value;
},





	toolbarItemOut: function(e)

	toolbarItemOut: function(e)

	{
this.storeCaret();
element = Event.element(e);

if(!element)
return false;

if(!element.itemType)
element = this.getElementToolbarItem(element);


	{
this.storeCaret();
element = Event.element(e);

if(!element)
return false;

if(!element.elementType)
element = this.getElementToolbarItem(element);


		if(element.disabled)
return;


		if(element.disabled)
return;


Zeile 948Zeile 949
	toolbarItemHover: function(e)
{
this.storeCaret();

	toolbarItemHover: function(e)
{
this.storeCaret();

		element = Event.element(e);
if(!element)
return false;

if(!element.itemType)
element = this.getElementToolbarItem(element);

		element = Event.element(e);
if(!element)
return false;

if(!element.elementType)
element = this.getElementToolbarItem(element);


if(element.disabled)
return;


if(element.disabled)
return;





		if(!element.className || element.className.indexOf('toolbar_clicked') == -1)
this.setElementState(element, 'hover');
},

		if(!element.className || element.className.indexOf('toolbar_clicked') == -1)
this.setElementState(element, 'hover');
},





	toolbarItemClick: function(e)
{
element = Event.element(e);

	toolbarItemClick: function(e)
{
element = Event.element(e);

Zeile 969Zeile 970
		if(!element)
return false;


		if(!element)
return false;


		if(!element.itemType)
element = this.getElementToolbarItem(element);


		if(!element.elementType)
element = this.getElementToolbarItem(element);


		if(element.disabled)
return;


		if(element.disabled)
return;


Zeile 983Zeile 984
				if(!element.menu.lastItemValue)
{
this.showDropDownMenu(element.menu);

				if(!element.menu.lastItemValue)
{
this.showDropDownMenu(element.menu);

				}

				}

				else
{
this.insertMyCode(element.insertText, element.menu.lastItemValue);

				else
{
this.insertMyCode(element.insertText, element.menu.lastItemValue);

Zeile 991Zeile 992

return;
}


return;
}

		}

		}


if(element.id == "editor_item_close_tags")


if(element.id == "editor_item_close_tags")

		{

		{

			this.closeTags();

			this.closeTags();

		}
else
{

		}
else
{

			if(typeof(element.insertExtra) != 'undefined')
this.insertMyCode(element.insertText, element.insertExtra);
else

			if(typeof(element.insertExtra) != 'undefined')
this.insertMyCode(element.insertText, element.insertExtra);
else

Zeile 1013Zeile 1014
		do
{
listItem = prompt(this.options.lang.enter_list_item, "");

		do
{
listItem = prompt(this.options.lang.enter_list_item, "");





			if(listItem != "" && listItem != null)
{
list = list+"[*]"+listItem+"\n";

			if(listItem != "" && listItem != null)
{
list = list+"[*]"+listItem+"\n";

Zeile 1072Zeile 1073
		email = prompt(this.options.lang.enter_email, "");

if(email)

		email = prompt(this.options.lang.enter_email, "");

if(email)

		{

		{

			if(!selectedText)
{
title = prompt(this.options.lang.enter_email_title, "");

			if(!selectedText)
{
title = prompt(this.options.lang.enter_email_title, "");

Zeile 1102Zeile 1103
			this.performInsert("[img]"+image+"[/img]", "", true);
}
},

			this.performInsert("[img]"+image+"[/img]", "", true);
}
},

	



	insertVideo: function(type)
{
selectedText = this.getSelectedText($(this.textarea));

	insertVideo: function(type)
{
selectedText = this.getSelectedText($(this.textarea));

Zeile 1171Zeile 1172
							this.removeElementState(elem, 'clicked');
}


							this.removeElementState(elem, 'clicked');
}


						if(elem && (elem.itemType == "dropdown" || elem.dropdown || elem.menu))

						if(elem && (elem.elementType == "dropdown" || elem.dropdown || elem.menu))

						{
this.setDropDownMenuActiveItem(elem, 0);
}

						{
this.setDropDownMenuActiveItem(elem, 0);
}

Zeile 1358Zeile 1359
		textarea.focus();
this.trackingCaret = true;
this.storeCaret();

		textarea.focus();
this.trackingCaret = true;
this.storeCaret();

		this.trackingCaret = false;		

		this.trackingCaret = false;

		return is_closed;
},


		return is_closed;
},


Zeile 1382Zeile 1383
				}
if(tag)
{

				}
if(tag)
{

					if(tag.itemType == "dropdown" || tag.dropdown || tag.menu)

					if(tag.elementType == "dropdown" || tag.dropdown || tag.menu)

					{
this.setDropDownMenuActiveItem(tag, 0);
}

					{
this.setDropDownMenuActiveItem(tag, 0);
}