Remove special case of "url" from insertFormatting
This commit is contained in:
		
					parent
					
						
							
								88e5e06b45
							
						
					
				
			
			
				commit
				
					
						d14da1214c
					
				
			
		
					 8 changed files with 18 additions and 84 deletions
				
			
		| 
						 | 
				
			
			@ -37,19 +37,11 @@ function insertFormatting(BBcode, id) {
 | 
			
		|||
	if (document.selection) {
 | 
			
		||||
		textarea.focus();
 | 
			
		||||
		selected = document.selection.createRange();
 | 
			
		||||
		if (BBcode == "url") {
 | 
			
		||||
			selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
 | 
			
		||||
		} else {
 | 
			
		||||
			selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
 | 
			
		||||
		}
 | 
			
		||||
		selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
 | 
			
		||||
	} else if (textarea.selectionStart || textarea.selectionStart == "0") {
 | 
			
		||||
		var start = textarea.selectionStart;
 | 
			
		||||
		var end = textarea.selectionEnd;
 | 
			
		||||
		if (BBcode == "url") {
 | 
			
		||||
			textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
		} else {
 | 
			
		||||
			textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
		}
 | 
			
		||||
		textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,19 +15,11 @@ function insertFormatting(BBcode, id) {
 | 
			
		|||
	if (document.selection) {
 | 
			
		||||
		textarea.focus();
 | 
			
		||||
		selected = document.selection.createRange();
 | 
			
		||||
		if (BBcode == "url") {
 | 
			
		||||
			selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
 | 
			
		||||
		} else {
 | 
			
		||||
			selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
 | 
			
		||||
		}
 | 
			
		||||
		selected.text = "[" + BBcode + "]" + selected.text + "[/" + BBcode + "]";
 | 
			
		||||
	} else if (textarea.selectionStart || textarea.selectionStart == "0") {
 | 
			
		||||
		var start = textarea.selectionStart;
 | 
			
		||||
		var end = textarea.selectionEnd;
 | 
			
		||||
		if (BBcode == "url") {
 | 
			
		||||
			textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
		} else {
 | 
			
		||||
			textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
		}
 | 
			
		||||
		textarea.value = textarea.value.substring(0, start) + "[" + BBcode + "]" + textarea.value.substring(start, end) + "[/" + BBcode + "]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	$(textarea).trigger('change');
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -423,19 +423,11 @@ function insertFormatting(BBcode, id) {
 | 
			
		|||
	if (document.selection) {
 | 
			
		||||
		textarea.focus();
 | 
			
		||||
		selected = document.selection.createRange();
 | 
			
		||||
		if (BBcode == "url") {
 | 
			
		||||
			selected.text = "["+BBcode+"=http://]" +  selected.text + "[/"+BBcode+"]";
 | 
			
		||||
		} else {
 | 
			
		||||
			selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
 | 
			
		||||
		}
 | 
			
		||||
		selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
 | 
			
		||||
	} else if (textarea.selectionStart || textarea.selectionStart == "0") {
 | 
			
		||||
		var start = textarea.selectionStart;
 | 
			
		||||
		var end = textarea.selectionEnd;
 | 
			
		||||
		if (BBcode == "url") {
 | 
			
		||||
			textarea.value = textarea.value.substring(0, start) + "["+BBcode+"=http://]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
		} else {
 | 
			
		||||
			textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
		}
 | 
			
		||||
		textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -603,19 +603,11 @@ function insertFormatting(BBcode, id) {
 | 
			
		|||
	if (document.selection) {
 | 
			
		||||
		textarea.focus();
 | 
			
		||||
		selected = document.selection.createRange();
 | 
			
		||||
		if (BBcode == "url") {
 | 
			
		||||
			selected.text = "["+BBcode+"=http://]" +  selected.text + "[/"+BBcode+"]";
 | 
			
		||||
		} else {
 | 
			
		||||
			selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
 | 
			
		||||
		}
 | 
			
		||||
		selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
 | 
			
		||||
	} else if (textarea.selectionStart || textarea.selectionStart == "0") {
 | 
			
		||||
		var start = textarea.selectionStart;
 | 
			
		||||
		var end = textarea.selectionEnd;
 | 
			
		||||
		if (BBcode == "url") {
 | 
			
		||||
			textarea.value = textarea.value.substring(0, start) + "["+BBcode+"=http://]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
		} else {
 | 
			
		||||
			textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
		}
 | 
			
		||||
		textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -71,19 +71,11 @@ function insertFormatting(BBcode, id) {
 | 
			
		|||
	if (document.selection) {
 | 
			
		||||
		textarea.focus();
 | 
			
		||||
		selected = document.selection.createRange();
 | 
			
		||||
		if (BBcode == "url") {
 | 
			
		||||
			selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
 | 
			
		||||
		} else {
 | 
			
		||||
			selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
 | 
			
		||||
		}
 | 
			
		||||
		selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
 | 
			
		||||
	} else if (textarea.selectionStart || textarea.selectionStart == "0") {
 | 
			
		||||
		var start = textarea.selectionStart;
 | 
			
		||||
		var end = textarea.selectionEnd;
 | 
			
		||||
		if (BBcode == "url") {
 | 
			
		||||
			textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
		} else {
 | 
			
		||||
			textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
		}
 | 
			
		||||
		textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,23 +20,13 @@ function insertFormatting(BBcode, id) {
 | 
			
		|||
	if (document.selection) {
 | 
			
		||||
		textarea.focus();
 | 
			
		||||
		selected = document.selection.createRange();
 | 
			
		||||
		if (BBcode == "url") {
 | 
			
		||||
			selected.text = "["+BBcode+"]" + "http://" + selected.text + "[/"+BBcode+"]";
 | 
			
		||||
		} else {
 | 
			
		||||
			selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
 | 
			
		||||
		}
 | 
			
		||||
		selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
 | 
			
		||||
	} else if (textarea.selectionStart || textarea.selectionStart == "0") {
 | 
			
		||||
		var start = textarea.selectionStart;
 | 
			
		||||
		var end = textarea.selectionEnd;
 | 
			
		||||
		if (BBcode == "url") {
 | 
			
		||||
			textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]"
 | 
			
		||||
				+ "http://" + textarea.value.substring(start, end)
 | 
			
		||||
				+ "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
		} else {
 | 
			
		||||
			textarea.value = textarea.value.substring(0, start)
 | 
			
		||||
				+ "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]"
 | 
			
		||||
				+ textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
		}
 | 
			
		||||
		textarea.value = textarea.value.substring(0, start)
 | 
			
		||||
			+ "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]"
 | 
			
		||||
			+ textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,19 +33,11 @@ function insertFormatting(BBcode, id) {
 | 
			
		|||
	if (document.selection) {
 | 
			
		||||
		textarea.focus();
 | 
			
		||||
		selected = document.selection.createRange();
 | 
			
		||||
		if (BBcode == "url") {
 | 
			
		||||
			selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
 | 
			
		||||
		} else {
 | 
			
		||||
			selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
 | 
			
		||||
		}
 | 
			
		||||
		selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
 | 
			
		||||
	} else if (textarea.selectionStart || textarea.selectionStart == "0") {
 | 
			
		||||
		var start = textarea.selectionStart;
 | 
			
		||||
		var end = textarea.selectionEnd;
 | 
			
		||||
		if (BBcode == "url") {
 | 
			
		||||
			textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
		} else {
 | 
			
		||||
			textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
		}
 | 
			
		||||
		textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,19 +50,11 @@ function insertFormatting(BBcode, id) {
 | 
			
		|||
	if (document.selection) {
 | 
			
		||||
		textarea.focus();
 | 
			
		||||
		selected = document.selection.createRange();
 | 
			
		||||
		if (BBcode == "url") {
 | 
			
		||||
			selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
 | 
			
		||||
		} else {
 | 
			
		||||
			selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
 | 
			
		||||
		}
 | 
			
		||||
		selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
 | 
			
		||||
	} else if (textarea.selectionStart || textarea.selectionStart == "0") {
 | 
			
		||||
		var start = textarea.selectionStart;
 | 
			
		||||
		var end = textarea.selectionEnd;
 | 
			
		||||
		if (BBcode == "url") {
 | 
			
		||||
			textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + "http://" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
		} else {
 | 
			
		||||
			textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
		}
 | 
			
		||||
		textarea.value = textarea.value.substring(0, start) + "["+BBcode+"]" + textarea.value.substring(start, end) + "[/"+BBcode+"]" + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue