home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
FAQ
/
cgi-bin
/
discus4_00
/
source
/
fpanel.js
< prev
next >
Wrap
Text File
|
2009-11-06
|
5KB
|
189 lines
//
// FORMATTING PANEL FOR DISCUS 'ADD A MESSAGE' box
// Copyright (c) 2001, DiscusWare, LLC, all rights reserved
// This code is distributed under the same terms as Discus itself
//
function panelclose () {
if (document.userpass) {
if (document.userpass.format_b.value == 1) {
insertText(document.userpass.message, '}');
}
if (document.userpass.format_i.value == 1) {
insertText(document.userpass.message, '}');
}
if (document.userpass.format_u.value == 1) {
insertText(document.userpass.message, '}');
}
// if (document.userpass.format_link.value == 1) {
// insertText(document.userpass.message, '}');
// }
if (document.userpass.format_clr.value == 1) {
insertText(document.userpass.message, '}');
}
if (document.userpass.format_font.value == 1) {
insertText(document.userpass.message, '}');
}
if (document.userpass.format_size.value == 1) {
insertText(document.userpass.message, '}');
}
}
return true;
}
function storeCursorPosition (elem) {
if (elem.createTextRange) {
elem.caretPos = document.selection.createRange().duplicate();
}
}
function insertText (elem, text) {
elem.focus();
if (elem.createTextRange && elem.caretPos) {
var caretPos = elem.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
} else {
elem.value = elem.value + text;
}
}
function bolder () {
if (document.userpass) {
if (document.userpass.format_b.value == 1) {
document.button_b.src = img_bold_up.src;
insertText(document.userpass.message, '}');
document.userpass.format_b.value = "0";
} else {
document.button_b.src = img_bold_dn.src;
insertText(document.userpass.message, '\\b{');
document.userpass.format_b.value = "1";
}
document.userpass.message.focus();
}
return false;
}
function linky_click (text) {
if (document.userpass) {
// if (document.userpass.format_link.value == 1) {
// document.button_link.src = img_link_up.src;
// insertText(document.userpass.message, '}');
// document.userpass.format_link.value = "";
// } else {
var l = prompt(text, "http://");
if (l != null) {
// document.button_link.src = img_link_dn.src;
insertText(document.userpass.message, '\\newurl{' + l + ',' + l + '}');
// document.userpass.format_link.value = "1";
// }
}
document.userpass.message.focus();
}
return false;
}
function italic () {
if (document.userpass) {
if (document.userpass.format_i.value == 1) {
document.button_i.src = img_ital_up.src;
insertText(document.userpass.message, '}');
document.userpass.format_i.value = "0";
} else {
document.button_i.src = img_ital_dn.src;
insertText(document.userpass.message, '\\i{');
document.userpass.format_i.value = "1";
}
document.userpass.message.focus();
}
return false;
}
function underl () {
if (document.userpass) {
if (document.userpass.format_u.value == 1) {
document.button_u.src = img_undl_up.src;
insertText(document.userpass.message, '}');
document.userpass.format_u.value = "0";
} else {
document.button_u.src = img_undl_dn.src;
insertText(document.userpass.message, '\\u{');
document.userpass.format_u.value = "1";
}
document.userpass.message.focus();
}
return false;
}
function smiley () {
if (document.userpass.inserter.value != "") {
if (typeof document.userpass.tagname != 'undefined') {
insertText(document.userpass.message, "\\" + document.userpass.tagname.value + "{" + document.userpass.inserter.value + "}");
} else {
insertText(document.userpass.message, "\\clipart{" + document.userpass.inserter.value + "}");
}
document.userpass.inserter.value = "";
}
document.userpass.message.focus();
}
function colorsel () {
if (document.userpass) {
if (document.userpass.color) {
var z = document.userpass.color[document.userpass.color.selectedIndex].value;
if (z == "") {
insertText(document.userpass.message, '}');
document.userpass.format_clr.value = 0;
} else {
if (document.userpass.format_clr.value == 1) {
insertText(document.userpass.message, "}\\" + z + "{");
} else {
document.userpass.format_clr.value = 1;
insertText(document.userpass.message, "\\" + z + "{");
}
}
}
document.userpass.message.focus();
}
}
function fontsel () {
if (document.userpass) {
if (document.userpass.font) {
var z = document.userpass.font[document.userpass.font.selectedIndex].value;
if (z == "") {
insertText(document.userpass.message, '}');
document.userpass.format_font.value = 0;
} else {
if (document.userpass.format_font.value == 1) {
insertText(document.userpass.message, "}\\font{" + z + ",");
} else {
insertText(document.userpass.message, "\\font{" + z + ",");
document.userpass.format_font.value = 1;
}
}
}
document.userpass.message.focus();
}
}
function sizesel () {
if (document.userpass) {
if (document.userpass.size) {
var z = document.userpass.size[document.userpass.size.selectedIndex].value;
if (z == "") {
insertText(document.userpass.message, '}');
document.userpass.format_size.value = "0";
} else {
if (document.userpass.format_size.value == 1) {
insertText(document.userpass.message, "}\\" + z + "{");
} else {
insertText(document.userpass.message, "\\" + z + "{");
document.userpass.format_size.value = 1;
}
}
}
document.userpass.message.focus();
}
}