Zeile 19 | Zeile 19 |
---|
{ return false; }
|
{ return false; }
|
|
|
if(!this.options.rtl) {
|
if(!this.options.rtl) {
|
this.options.trl = 0;
| this.options.rtl = 0;
|
} }
| } }
|
Zeile 40 | Zeile 41 |
---|
this.sizes["xx-small"] = this.options.lang.size_xx_small; this.sizes["x-small"] = this.options.lang.size_x_small; this.sizes["small"] = this.options.lang.size_small;
|
this.sizes["xx-small"] = this.options.lang.size_xx_small; this.sizes["x-small"] = this.options.lang.size_x_small; this.sizes["small"] = this.options.lang.size_small;
|
this.sizes["medium"] = this.options.lang.size_medium
| this.sizes["medium"] = this.options.lang.size_medium; this.sizes["large"] = this.options.lang.size_large;
|
this.sizes["x-large"] = this.options.lang.size_x_large; this.sizes["xx-large"] = this.options.lang.size_xx_large;
// An array of colours to be shown. this.colors = new Array();
|
this.sizes["x-large"] = this.options.lang.size_x_large; this.sizes["xx-large"] = this.options.lang.size_xx_large;
// An array of colours to be shown. this.colors = new Array();
|
this.colors["white"] = this.options.lang.color_white; this.colors["black"] = this.options.lang.color_black; this.colors["red"] = this.options.lang.color_red; this.colors["yellow"] = this.options.lang.color_yellow; this.colors["pink"] = this.options.lang.color_pink; this.colors["green"] = this.options.lang.color_green; this.colors["orange"] = this.options.lang.color_orange; this.colors["purple"] = this.options.lang.color_purple; this.colors["blue"] = this.options.lang.color_blue; this.colors["beige"] = this.options.lang.color_beige; this.colors["brown"] = this.options.lang.color_brown; this.colors["teal"] = this.options.lang.color_teal; this.colors["navy"] = this.options.lang.color_navy; this.colors["maroon"] = this.options.lang.color_maroon; this.colors["limegreen"] = this.options.lang.color_limegreen;
| this.colors["#ffffff"] = this.options.lang.color_white; this.colors["#000000"] = this.options.lang.color_black; this.colors["#FF0000"] = this.options.lang.color_red; this.colors["#FFFF00"] = this.options.lang.color_yellow; this.colors["#FFC0CB"] = this.options.lang.color_pink; this.colors["#008000"] = this.options.lang.color_green; this.colors["#FFA500"] = this.options.lang.color_orange; this.colors["#800080"] = this.options.lang.color_purple; this.colors["#0000FF"] = this.options.lang.color_blue; this.colors["#F5F5DC"] = this.options.lang.color_beige; this.colors["#A52A2A"] = this.options.lang.color_brown; this.colors["#008080"] = this.options.lang.color_teal; this.colors["#000080"] = this.options.lang.color_navy; this.colors["#800000"] = this.options.lang.color_maroon; this.colors["#32CD32"] = this.options.lang.color_limegreen;
|
// Here we get the ID of the textarea we're replacing and store it. this.textarea = textarea;
|
// Here we get the ID of the textarea we're replacing and store it. this.textarea = textarea;
|
| |
// Only swap it over once the page has loaded (add event) Event.observe(window, "load", this.showEditor.bindAsEventListener(this));
| // Only swap it over once the page has loaded (add event) Event.observe(window, "load", this.showEditor.bindAsEventListener(this));
|
Zeile 74 | Zeile 75 |
---|
{ // Assign the old textarea to a variable for later use. oldTextarea = $(this.textarea);
|
{ // Assign the old textarea to a variable for later use. oldTextarea = $(this.textarea);
|
| // Now this.textarea becomes the new textarea ID this.textarea += "_new";
|
// Begin the creation of our new editor.
| // Begin the creation of our new editor.
|
Zeile 93 | Zeile 97 |
---|
else if(oldTextarea.clientWidth) { w = oldTextarea.clientWidth+"px";
|
else if(oldTextarea.clientWidth) { w = oldTextarea.clientWidth+"px";
|
}
| }
|
else
|
else
|
{
| {
|
w = "560px";
|
w = "560px";
|
}
| }
|
if(this.options && this.options.height) { w = this.options.height; } else if(oldTextarea.style.height)
|
if(this.options && this.options.height) { w = this.options.height; } else if(oldTextarea.style.height)
|
{
| {
|
h = oldTextarea.style.height; } else if(oldTextarea.clientHeight)
| h = oldTextarea.style.height; } else if(oldTextarea.clientHeight)
|
Zeile 126 | Zeile 131 |
---|
// Create text font/color/size toolbar textFormatting = document.createElement("div"); textFormatting.style.position = "absolute";
|
// Create text font/color/size toolbar textFormatting = document.createElement("div"); textFormatting.style.position = "absolute";
|
| textFormatting.style.width = "100%";
|
if(this.options.rtl == 1) { textFormatting.style.right = 0;
| if(this.options.rtl == 1) { textFormatting.style.right = 0;
|
Zeile 139 | Zeile 147 |
---|
// Create the font drop down. fontSelect = document.createElement("select"); fontSelect.style.margin = "2px";
|
// Create the font drop down. fontSelect = document.createElement("select"); fontSelect.style.margin = "2px";
|
| fontSelect.id = "font";
|
fontSelect.options[fontSelect.options.length] = new Option(this.options.lang.font, "-");
|
fontSelect.options[fontSelect.options.length] = new Option(this.options.lang.font, "-");
|
|
|
for(font in this.fonts) { fontSelect.options[fontSelect.options.length] = new Option(this.fonts[font], font); } Event.observe(fontSelect, "change", this.changeFont.bindAsEventListener(this)); textFormatting.appendChild(fontSelect);
|
for(font in this.fonts) { fontSelect.options[fontSelect.options.length] = new Option(this.fonts[font], font); } Event.observe(fontSelect, "change", this.changeFont.bindAsEventListener(this)); textFormatting.appendChild(fontSelect);
|
|
|
// Create the font size drop down. sizeSelect = document.createElement("select"); sizeSelect.style.margin = "2px";
|
// Create the font size drop down. sizeSelect = document.createElement("select"); sizeSelect.style.margin = "2px";
|
| sizeSelect.id = "size";
|
sizeSelect.options[sizeSelect.options.length] = new Option(this.options.lang.size, "-");
|
sizeSelect.options[sizeSelect.options.length] = new Option(this.options.lang.size, "-");
|
|
|
for(size in this.sizes) { sizeSelect.options[sizeSelect.options.length] = new Option(this.sizes[size], size); } Event.observe(sizeSelect, "change", this.changeSize.bindAsEventListener(this)); textFormatting.appendChild(sizeSelect);
|
for(size in this.sizes) { sizeSelect.options[sizeSelect.options.length] = new Option(this.sizes[size], size); } Event.observe(sizeSelect, "change", this.changeSize.bindAsEventListener(this)); textFormatting.appendChild(sizeSelect);
|
|
|
// Create the colour drop down. colorSelect = document.createElement("select"); colorSelect.style.margin = "2px";
|
// Create the colour drop down. colorSelect = document.createElement("select"); colorSelect.style.margin = "2px";
|
| colorSelect.id = "color";
|
colorSelect.options[colorSelect.options.length] = new Option(this.options.lang.color, "-");
|
colorSelect.options[colorSelect.options.length] = new Option(this.options.lang.color, "-");
|
|
|
for(color in this.colors) { colorSelect.options[colorSelect.options.length] = new Option(this.colors[color], color);
| for(color in this.colors) { colorSelect.options[colorSelect.options.length] = new Option(this.colors[color], color);
|
Zeile 174 | Zeile 188 |
---|
// Create close tags button closeBar = document.createElement("div"); closeBar.style.position = "absolute";
|
// Create close tags button closeBar = document.createElement("div"); closeBar.style.position = "absolute";
|
|
|
if(this.options.rtl == 1)
|
if(this.options.rtl == 1)
|
{
| {
|
closeBar.style.left = 0;
|
closeBar.style.left = 0;
|
} else {
| } else {
|
closeBar.style.right = 0; }
|
closeBar.style.right = 0; }
|
|
|
var closeButton = document.createElement("img"); closeButton.id = "close_tags"; closeButton.src = "images/codebuttons/close_tags.gif";
| var closeButton = document.createElement("img"); closeButton.id = "close_tags"; closeButton.src = "images/codebuttons/close_tags.gif";
|
Zeile 208 | Zeile 224 |
---|
// Create formatting section of second toolbar. formatting = document.createElement("div"); formatting.style.position = "absolute";
|
// Create formatting section of second toolbar. formatting = document.createElement("div"); formatting.style.position = "absolute";
|
| formatting.style.width = "100%"; formatting.style.whiteSpace = "nowrap";
|
if(this.options.rtl == 1) { formatting.style.right = 0;
|
if(this.options.rtl == 1) { formatting.style.right = 0;
|
}
| }
|
else { formatting.style.left = 0;
| else { formatting.style.left = 0;
|
Zeile 231 | Zeile 250 |
---|
// Create insertable elements section of second toolbar. elements = document.createElement("div"); elements.style.position = "absolute";
|
// Create insertable elements section of second toolbar. elements = document.createElement("div"); elements.style.position = "absolute";
|
|
|
if(this.options.rtl == 1)
|
if(this.options.rtl == 1)
|
{
| {
|
elements.style.left = 0;
|
elements.style.left = 0;
|
}
| }
|
else { elements.style.right = 0;
| else { elements.style.right = 0;
|
Zeile 243 | Zeile 263 |
---|
toolbar2.appendChild(elements); this.insertStandardButton(elements, "list_num", "images/codebuttons/list_num.gif", "list", "1", this.options.lang.title_numlist); this.insertStandardButton(elements, "list_bullet", "images/codebuttons/list_bullet.gif", "list", "", this.options.lang.title_bulletlist);
|
toolbar2.appendChild(elements); this.insertStandardButton(elements, "list_num", "images/codebuttons/list_num.gif", "list", "1", this.options.lang.title_numlist); this.insertStandardButton(elements, "list_bullet", "images/codebuttons/list_bullet.gif", "list", "", this.options.lang.title_bulletlist);
|
this.insertSeparator(elements);
| this.insertSeparator(elements);
|
this.insertStandardButton(elements, "img", "images/codebuttons/image.gif", "image", "", this.options.lang.title_image); this.insertStandardButton(elements, "url", "images/codebuttons/link.gif", "url", "", this.options.lang.title_hyperlink); this.insertStandardButton(elements, "email", "images/codebuttons/email.gif", "email", "", this.options.lang.title_email);
| this.insertStandardButton(elements, "img", "images/codebuttons/image.gif", "image", "", this.options.lang.title_image); this.insertStandardButton(elements, "url", "images/codebuttons/link.gif", "url", "", this.options.lang.title_hyperlink); this.insertStandardButton(elements, "email", "images/codebuttons/email.gif", "email", "", this.options.lang.title_email);
|
Zeile 254 | Zeile 274 |
---|
// Append the second toolbar to the editor editor.appendChild(toolbar2);
|
// Append the second toolbar to the editor editor.appendChild(toolbar2);
|
|
|
// Create our new text area areaContainer = document.createElement("div");
|
// Create our new text area areaContainer = document.createElement("div");
|
| areaContainer.style.clear = "both";
|
// Set the width/height of the area
|
// Set the width/height of the area
|
if(MyBB.browser == "mozilla")
| subtract = subtract2 = 0; if(MyBB.browser != "ie" || (MyBB.browser == "ie" && MyBB.useragent.indexOf('msie 7.') != -1))
|
{
|
{
|
subtract = subtract2 = parseInt(editor.style.padding)*2; } else { subtract = subtract2 = 0;
| subtract = subtract2 = 8;
|
} areaContainer.style.height = parseInt(editor.style.height)-parseInt(toolBar.style.height)-parseInt(toolbar2.style.height)-subtract+"px";
|
} areaContainer.style.height = parseInt(editor.style.height)-parseInt(toolBar.style.height)-parseInt(toolbar2.style.height)-subtract+"px";
|
areaContainer.style.width = (parseInt(editor.style.width)-subtract2)+"px";
| areaContainer.style.width = parseInt(editor.style.width)-subtract2+"px";
|
// Create text area textInput = document.createElement("textarea"); textInput.id = this.textarea;
|
// Create text area textInput = document.createElement("textarea"); textInput.id = this.textarea;
|
textInput.name = oldTextarea.name; textInput.style.height = areaContainer.style.height; textInput.style.width = areaContainer.style.width;
| textInput.name = oldTextarea.name+"_new"; textInput.style.height = parseInt(areaContainer.style.height)+"px"; textInput.style.width = parseInt(areaContainer.style.width)+"px";
|
if(oldTextarea.value != '')
|
if(oldTextarea.value != '')
|
{
| {
|
textInput.value = oldTextarea.value; }
|
textInput.value = oldTextarea.value; }
|
|
|
if(oldTextarea.tabIndex) { textInput.tabIndex = oldTextarea.tabIndex;
|
if(oldTextarea.tabIndex) { textInput.tabIndex = oldTextarea.tabIndex;
|
}
| }
|
areaContainer.appendChild(textInput); editor.appendChild(areaContainer);
|
areaContainer.appendChild(textInput); editor.appendChild(areaContainer);
|
|
|
if(oldTextarea.form) { Event.observe(oldTextarea.form, "submit", this.closeTags.bindAsEventListener(this));
|
if(oldTextarea.form) { Event.observe(oldTextarea.form, "submit", this.closeTags.bindAsEventListener(this));
|
| Event.observe(oldTextarea.form, "submit", this.updateOldArea.bindAsEventListener(this));
|
}
|
}
|
// Replace the old with the new oldTextarea.parentNode.replaceChild(editor, oldTextarea);
| // Hide the old editor oldTextarea.style.visibility = "hidden"; oldTextarea.style.position = "absolute"; oldTextarea.style.top = "-1000px"; oldTextarea.id += "_old"; this.oldTextarea = oldTextarea;
// Append the new editor oldTextarea.parentNode.insertBefore(editor, oldTextarea);
Event.observe(textInput, "keyup", this.updateOldArea.bindAsEventListener(this)); Event.observe(textInput, "blur", this.updateOldArea.bindAsEventListener(this)); }, updateOldArea: function(e) { this.oldTextarea.value = $(this.textarea).value;
|
},
|
},
|
|
|
insertStandardButton: function(into, id, src, insertText, insertExtra, alt) {
| insertStandardButton: function(into, id, src, insertText, insertExtra, alt) {
|
Zeile 323 | Zeile 363 |
---|
},
toolbarItemOut: function(e)
|
},
toolbarItemOut: function(e)
|
{ element = MyBB.eventElement(e); if(!element) { return false;
| { element = MyBB.eventElement(e); if(!element) { return false;
|
}
|
}
|
|
|
if(element.insertText) { if(element.insertExtra)
|
if(element.insertText) { if(element.insertExtra)
|
{
| {
|
insertCode = element.insertText+"_"+element.insertExtra; } else { insertCode = element.insertText;
|
insertCode = element.insertText+"_"+element.insertExtra; } else { insertCode = element.insertText;
|
}
| }
|
if(MyBB.inArray(insertCode, this.openTags)) { DomLib.addClass(element, "toolbar_clicked");
| if(MyBB.inArray(insertCode, this.openTags)) { DomLib.addClass(element, "toolbar_clicked");
|
Zeile 348 | Zeile 391 |
---|
},
toolbarItemHover: function(e)
|
},
toolbarItemHover: function(e)
|
{
| {
|
element = MyBB.eventElement(e);
|
element = MyBB.eventElement(e);
|
|
|
if(!element) { return false; }
|
if(!element) { return false; }
|
|
|
DomLib.addClass(element, "toolbar_hover"); },
|
DomLib.addClass(element, "toolbar_hover"); },
|
|
|
toolbarItemClick: function(e)
|
toolbarItemClick: function(e)
|
{
| {
|
element = MyBB.eventElement(e);
|
element = MyBB.eventElement(e);
|
|
|
if(!element) { return false; }
|
if(!element) { return false; }
|
|
|
if(element.id == "close_tags") { this.closeTags();
| if(element.id == "close_tags") { this.closeTags();
|
Zeile 376 | Zeile 423 |
---|
},
changeFont: function(e)
|
},
changeFont: function(e)
|
{ element = MyBB.eventElement(e); if(!element) {
| { element = MyBB.eventElement(e); if(!element) {
|
return false;
|
return false;
|
}
| }
|
this.insertMyCode("font", element.options[element.selectedIndex].value);
|
this.insertMyCode("font", element.options[element.selectedIndex].value);
|
|
|
if(this.getSelectedText($(this.textarea))) { element.selectedIndex = 0;
| if(this.getSelectedText($(this.textarea))) { element.selectedIndex = 0;
|
Zeile 390 | Zeile 440 |
---|
},
changeSize: function(e)
|
},
changeSize: function(e)
|
{
| {
|
element = MyBB.eventElement(e);
|
element = MyBB.eventElement(e);
|
|
|
if(!element) { return false; }
|
if(!element) { return false; }
|
|
|
this.insertMyCode("size", element.options[element.selectedIndex].value);
|
this.insertMyCode("size", element.options[element.selectedIndex].value);
|
|
|
if(this.getSelectedText($(this.textarea))) { element.selectedIndex = 0;
| if(this.getSelectedText($(this.textarea))) { element.selectedIndex = 0;
|
Zeile 406 | Zeile 459 |
---|
changeColor: function(e) { element = MyBB.eventElement(e);
|
changeColor: function(e) { element = MyBB.eventElement(e);
|
|
|
if(!element) { return false; }
|
if(!element) { return false; }
|
|
|
this.insertMyCode("color", element.options[element.selectedIndex].value);
|
this.insertMyCode("color", element.options[element.selectedIndex].value);
|
|
|
if(this.getSelectedText($(this.textarea))) { element.selectedIndex = 0;
| if(this.getSelectedText($(this.textarea))) { element.selectedIndex = 0;
|
Zeile 420 | Zeile 476 |
---|
insertList: function(type) { list = "";
|
insertList: function(type) { list = "";
|
|
|
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"; } } while(listItem != "" && listItem != null);
|
if(listItem != "" && listItem != null) { list = list+"[*]"+listItem+"\n"; } } while(listItem != "" && listItem != null);
|
|
|
if(list == "") { return false; }
|
if(list == "") { return false; }
|
|
|
if(type) { list = "[list="+type+"]\n"+list;
| if(type) { list = "[list="+type+"]\n"+list;
|
Zeile 441 | Zeile 501 |
---|
{ list = "[list]\n"+list; }
|
{ list = "[list]\n"+list; }
|
|
|
list = list+"[/list]\n"; this.performInsert(list, "", true, false); },
| list = list+"[/list]\n"; this.performInsert(list, "", true, false); },
|
Zeile 449 | Zeile 510 |
---|
{ selectedText = this.getSelectedText($(this.textarea)); url = prompt(this.options.lang.enter_url, "http://");
|
{ selectedText = this.getSelectedText($(this.textarea)); url = prompt(this.options.lang.enter_url, "http://");
|
|
|
if(url) { if(!selectedText) { title = prompt(this.options.lang.enter_url_title, "");
|
if(url) { if(!selectedText) { title = prompt(this.options.lang.enter_url_title, "");
|
} else { title = selectedText; } if(title)
| } else { title = selectedText; } if(title)
|
{ this.performInsert("[url="+url+"]"+title+"[/url]", "", true, false); } else { this.performInsert("[url]"+url+"[/url]", "", true, false);
|
{ this.performInsert("[url="+url+"]"+title+"[/url]", "", true, false); } else { this.performInsert("[url]"+url+"[/url]", "", true, false);
|
} } },
| } } },
|
insertEmail: function() { selectedText = this.getSelectedText($(this.textarea)); email = prompt(this.options.lang.enter_email, "");
|
insertEmail: function() { selectedText = this.getSelectedText($(this.textarea)); email = prompt(this.options.lang.enter_email, "");
|
|
|
if(email) { if(!selectedText) { title = prompt(this.options.lang.enter_email_title, "");
|
if(email) { if(!selectedText) { title = prompt(this.options.lang.enter_email_title, "");
|
}
| }
|
else { title = selectedText; }
|
else { title = selectedText; }
|
|
|
if(title) { this.performInsert("[email="+email+"]"+title+"[/email]", "", true, false);
| if(title) { this.performInsert("[email="+email+"]"+title+"[/email]", "", true, false);
|
Zeile 498 | Zeile 563 |
---|
insertIMG: function() { image = prompt(this.options.lang.enter_image, "http://");
|
insertIMG: function() { image = prompt(this.options.lang.enter_image, "http://");
|
|
|
if(image)
|
if(image)
|
{
| {
|
this.performInsert("[img]"+image+"[/img]", "", true); } },
| this.performInsert("[img]"+image+"[/img]", "", true); } },
|
Zeile 510 | Zeile 576 |
---|
{ case "list": this.insertList(extra);
|
{ case "list": this.insertList(extra);
|
break;
| break;
|
case "url": this.insertURL(); break;
| case "url": this.insertURL(); break;
|
Zeile 531 | Zeile 597 |
---|
{ var full_tag = code; }
|
{ var full_tag = code; }
|
|
|
var newTags = new Array();
|
var newTags = new Array();
|
for(var i=0;i<this.openTags.length;i++)
| for(var i=0; i< this.openTags.length; ++i)
|
{ if(this.openTags[i]) { exploded_tag = this.openTags[i].split("_");
|
{ if(this.openTags[i]) { exploded_tag = this.openTags[i].split("_");
|
|
|
if(exploded_tag[0] == code) { already_open = true; this.performInsert("[/"+exploded_tag[0]+"]", "", false);
|
if(exploded_tag[0] == code) { already_open = true; this.performInsert("[/"+exploded_tag[0]+"]", "", false);
|
|
|
if($(this.openTags[i]))
|
if($(this.openTags[i]))
|
{
| {
|
$(this.openTags[i]).className = "toolbar_normal"; }
|
$(this.openTags[i]).className = "toolbar_normal"; }
|
| if($(exploded_tag[0]) && $(exploded_tag[0]).type == "select-one") { $(exploded_tag[0]).selectedIndex = 0; }
|
if(this.openTags[i] == full_tag) { no_insert = true;
| if(this.openTags[i] == full_tag) { no_insert = true;
|
Zeile 556 | Zeile 631 |
---|
} } }
|
} } }
|
|
|
this.openTags = newTags; var do_insert = false;
|
this.openTags = newTags; var do_insert = false;
|
|
|
if(extra != "" && extra != "-" && no_insert == false) { start_tag = "["+code+"="+extra+"]";
|
if(extra != "" && extra != "-" && no_insert == false) { start_tag = "["+code+"="+extra+"]";
|
end_tag = "[/"+code+"]"; do_insert = true; }
| end_tag = "[/"+code+"]"; do_insert = true; }
|
else if(!extra && already_open == false) { start_tag = "["+code+"]";
| else if(!extra && already_open == false) { start_tag = "["+code+"]";
|
Zeile 582 | Zeile 659 |
---|
{ DomLib.removeClass($(full_tag), "toolbar_clicked"); }
|
{ DomLib.removeClass($(full_tag), "toolbar_clicked"); }
|
| else if($(code) && $(code).type == "select-one") { $(code).selectedIndex = 0; }
|
} }
|
} }
|
| if(this.openTags.length == 0) { $('close_tags').style.visibility = 'hidden'; }
|
},
getSelectedText: function(element)
| },
getSelectedText: function(element)
|
Zeile 620 | Zeile 707 |
---|
{ var ignore_selection = false; }
|
{ var ignore_selection = false; }
|
|
|
if(!close_tag) { var close_tag = ""; } var textarea = $(this.textarea); textarea.focus();
|
if(!close_tag) { var close_tag = ""; } var textarea = $(this.textarea); textarea.focus();
|
|
|
if(document.selection) { var selection = document.selection;
|
if(document.selection) { var selection = document.selection;
|
var range = selection.createRange()
| var range = selection.createRange();
|
if(ignore_selection != false) { selection.collapse; }
|
if(ignore_selection != false) { selection.collapse; }
|
|
|
if((selection.type == "Text" || selection.type == "None") && range != null && ignore_selection != true) { if(close_tag != "" && range.text.length > 0) { var keep_selected = true; range.text = open_tag+range.text+close_tag;
|
if((selection.type == "Text" || selection.type == "None") && range != null && ignore_selection != true) { if(close_tag != "" && range.text.length > 0) { var keep_selected = true; range.text = open_tag+range.text+close_tag;
|
}
| }
|
else { var keep_selected = false;
|
else { var keep_selected = false;
|
|
|
if(is_single) { is_closed = false;
| if(is_single) { is_closed = false;
|
Zeile 662 | Zeile 754 |
---|
var select_start = textarea.selectionStart; var select_end = textarea.selectionEnd; var scroll_top = textarea.scrollTop;
|
var select_start = textarea.selectionStart; var select_end = textarea.selectionEnd; var scroll_top = textarea.scrollTop;
|
|
|
if(select_end <= 2) { select_end = textarea.textLength; }
|
if(select_end <= 2) { select_end = textarea.textLength; }
|
|
|
var start = textarea.value.substring(0, select_start); var middle = textarea.value.substring(select_start, select_end); var end = textarea.value.substring(select_end, textarea.textLength);
|
var start = textarea.value.substring(0, select_start); var middle = textarea.value.substring(select_start, select_end); var end = textarea.value.substring(select_end, textarea.textLength);
|
|
|
if(select_end - select_start > 0 && ignore_selection != true && close_tag != "") { var keep_selected = true; middle = open_tag+middle+close_tag;
|
if(select_end - select_start > 0 && ignore_selection != true && close_tag != "") { var keep_selected = true; middle = open_tag+middle+close_tag;
|
}
| }
|
else { var keep_selected = false;
| else { var keep_selected = false;
|
Zeile 683 | Zeile 778 |
---|
} middle = open_tag; }
|
} middle = open_tag; }
|
|
|
textarea.value = start+middle+end;
|
textarea.value = start+middle+end;
|
|
|
if(keep_selected == true && ignore_selection != true) { textarea.selectionStart = select_start;
| if(keep_selected == true && ignore_selection != true) { textarea.selectionStart = select_start;
|
Zeile 695 | Zeile 792 |
---|
textarea.selectionEnd = textarea.selectionStart; } textarea.scrollTop = scroll_top;
|
textarea.selectionEnd = textarea.selectionStart; } textarea.scrollTop = scroll_top;
|
}
| }
|
else { textarea.value += open_tag;
|
else { textarea.value += open_tag;
|
|
|
if(is_single) { is_closed = false; } }
|
if(is_single) { is_closed = false; } }
|
| this.updateOldArea();
|
textarea.focus(); return is_closed;
|
textarea.focus(); return is_closed;
|
},
| },
|
closeTags: function() {
| closeTags: function() {
|
Zeile 717 | Zeile 816 |
---|
tag = MyBB.arrayPop(this.openTags); exploded_tag = tag.split("_"); this.performInsert("[/"+exploded_tag[0]+"]", "", false);
|
tag = MyBB.arrayPop(this.openTags); exploded_tag = tag.split("_"); this.performInsert("[/"+exploded_tag[0]+"]", "", false);
|
| if($(exploded_tag[0])) { tag = $(exploded_tag[0]); }
|
if($(tag)) {
|
if($(tag)) {
|
DomLib.removeClass($(tag), "toolbar_clicked");
| if(tag.type == "select-one") { tag.selectedIndex = 0; } else { DomLib.removeClass($(tag), "toolbar_clicked"); }
|
}
|
}
|
|
|
} } $(this.textarea).focus();
| } } $(this.textarea).focus();
|
Zeile 739 | Zeile 850 |
---|
bindSmilieInserter: function(id) { if(!$(id))
|
bindSmilieInserter: function(id) { if(!$(id))
|
{
| {
|
return false; }
|
return false; }
|
|
|
smilies = DomLib.getElementsByClassName($(id), "img", "smilie");
|
smilies = DomLib.getElementsByClassName($(id), "img", "smilie");
|
|
|
if(smilies.length > 0) {
|
if(smilies.length > 0) {
|
for(var i=0;i<smilies.length;i++)
| for(var i=0; i < smilies.length; ++i)
|
{ var smilie = smilies[i]; smilie.onclick = this.insertSmilie.bindAsEventListener(this);
| { var smilie = smilies[i]; smilie.onclick = this.insertSmilie.bindAsEventListener(this);
|
Zeile 762 | Zeile 875 |
---|
insertSmilie: function(e) { element = MyBB.eventElement(e);
|
insertSmilie: function(e) { element = MyBB.eventElement(e);
|
|
|
if(!element || !element.alt) { return false;
| if(!element || !element.alt) { return false;
|