Initial commit
This commit is contained in:
57
site/javascript/admin/textboxbuttons.js
Normal file
57
site/javascript/admin/textboxbuttons.js
Normal file
@@ -0,0 +1,57 @@
|
||||
/***********************************************
|
||||
* Admin textbox button styles for: friendshiptours.org
|
||||
* Author: Benjamin Ramey
|
||||
* E-mail: ben.ramey@gmail.com
|
||||
* Created: Tue Feb 12 16:40:04 CST 2008
|
||||
***********************************************/
|
||||
$(function() {
|
||||
//
|
||||
// Bold button
|
||||
//
|
||||
$("#bold_btn").click(function() {
|
||||
var textBox = document.getElementById('text');
|
||||
// get the selected text
|
||||
var selectedText = (textBox.value).substring(textBox.selectionStart,textBox.selectionEnd);
|
||||
|
||||
if(selectedText.length > 0)
|
||||
{
|
||||
var boldText = "[b]"+selectedText+"[/b]";
|
||||
textBox.value = (textBox.value).replace(selectedText,boldText);
|
||||
}
|
||||
});
|
||||
//
|
||||
// Italics button
|
||||
//
|
||||
$("#italics_btn").click(function() {
|
||||
var textBox = document.getElementById('text');
|
||||
// get the selected text
|
||||
var selectedText = (textBox.value).substring(textBox.selectionStart,textBox.selectionEnd);
|
||||
|
||||
if(selectedText.length > 0)
|
||||
{
|
||||
var italicsText = "[i]"+selectedText+"[/i]";
|
||||
textBox.value = (textBox.value).replace(selectedText,italicsText);
|
||||
}
|
||||
});
|
||||
//
|
||||
// Link button
|
||||
//
|
||||
$("#link_btn").click(function() {
|
||||
var textBox = document.getElementById('text');
|
||||
// get the selected text
|
||||
var selectedText = (textBox.value).substring(textBox.selectionStart,textBox.selectionEnd);
|
||||
|
||||
if(selectedText.length > 0)
|
||||
{
|
||||
var linkHref = new String();
|
||||
while((linkHref = prompt("Please enter the URL for this link:")).length <= 0)
|
||||
;
|
||||
|
||||
if(linkHref.length > 0)
|
||||
{
|
||||
var italicsText = "[link href="+linkHref+"]"+selectedText+"[/link]";
|
||||
textBox.value = (textBox.value).replace(selectedText,italicsText);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user