MChat 1.3.5
Verfasst: 10.03.2011 21:05
Hallo ich habe Probleme mit dem chat MChat 1.3.5 Es gehen keine smilys keine BBcodes eigentlich garnichts nur schreiben
was kann das sein !!!
was kann das sein !!!
Code: Alles auswählen
/**
*
* @package mChat ProSilver Style
* @version 1.3.1 27.08.2009
* @copyright (c) djs596 ( http://djs596.com/ ), (c) RMcGirr83 ( http://www.rmcgirr83.org/ ), (c) Stokerpiller ( http://www.phpbb3bbcodes.com/ )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
**/
div.mChatBG1 {
background-color: #22262A;
padding: 5px 5px 5px 15px;
border-bottom: 1px solid #181818;
border-top:1px solid #34383C;
overflow: hidden;
}
div.mChatBG2 {
background-color: #22262A;
padding: 5px 5px 5px 15px;
border-bottom: 1px solid #181818;
border-top:1px solid #34383C;
overflow: hidden;
}
div.mChatRowLimit {
overflow: auto;
width: 100%;
height: 200px;
}
div.mChatRowLimitCustom {
overflow: auto;
width: 100%;
height: 500px;
}
div.mChatPanel {
text-align: center;
padding: 5px;
}
input.mChatText {
cursor: text;
width: 50%;
background-color: #34383C;
border: 1px solid #B4BAC0;
color: #D4D4D4;
padding: 3px 5px 3px 5px;
margin: 5px 0px 0px 5px;
}
input.mChatText:hover, input.mChatText:focus{
border-color: #41464B;
color:#b1b1b1;
}
input.mChatButton {
width: auto;
font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif;
font-weight: bold;
background-color: #4C4C4C;
background-image: url("bg_button.gif");
border: 1px solid #666666;
padding: 2px 5px 2px 5px;
margin: 5px 0px 0px 5px;
font-size: 1em;
color:#00FFFF;
}
input.mChatButton:hover {
border-color: #cfcfcf;
color: #cfcfcf;
}
div.mChatHover:hover {
background-color: #2D3338;
}
div.mChatBodyFix {
width: 100% !important;
background-color: #22262A !important;
color:#7E7E7E !important;
Code: Alles auswählen
@import url("chat.css");
@import url("mchat.css");
/* Layout
------------ */
* {
/* Reset browsers default margin, padding and font sizes */
margin: 0;
padding: 0;
}
html {
font-size: 100%;
}
body {
/* Text-Sizing with ems: http://www.clagnut.com/blog/348/ */
font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif;
color: #FFF;
background: #242424 url(images/body.gif);
font-size: 10px;
margin: 0;
padding: 0 5px;
}
#body-simple {
background: #191919;
padding: 5px;
}
/* Misc stuff */
img {
border: none;
}
.gen {
margin: 1px 1px;
font-size: 1.2em;
}
.genmed {
margin: 1px 1px;
font-size: 1.1em;
}
.gensmall {
margin: 1px 1px;
font-size: 1em;
}
.titles {
font-family: "Lucida Grande", Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 1.3em;
text-decoration: none;
}
.error, table td .error {
color: #F0E80A;
}
.spacer {
background: #864E4A url(images/th.gif) top left repeat-x;
}
hr { height: 0px; border: solid #B62723 0px; border-top-width: 1px;}
.pagination {
padding: 4px;
font-size: 1em;
font-weight: bold;
}
/* Links
------------ */
.rtl a {
direction: rtl;
unicode-bidi: embed;
}
a {
color: #B62723;
text-decoration: none;
}
a:active,
a:visited {
color: #B62723;
text-decoration: none;
}
a:hover {
color: #F0E80A;
text-decoration: underline;
}
a.forumlink {
font-weight: bold;
font-family: "Lucida Grande", Helvetica, Arial, sans-serif;
font-size: 1.2em;
}
a.topictitle {
margin: 1px 0px;
font-family: "Lucida Grande", Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 1.2em;
}
a.topictitle, .postbody a {
color: #B62723;
}
a.topictitle:visited, .postbody a:visited {
color: #D34B47;
}
a.topictitle:visited:hover, .postbody a:visited:hover {
color: #B62723;
}
a.topictitle:hover, .postbody a:hover {
color: #F0E80A;
}
/* Header and logo */
#maintable {
border-style: solid;
border-width: 0 1px 1px 1px;
border-color: #000;
margin: 0 auto;
}
#logorow {
background: url(images/logo_bg.gif) top left repeat-x;
text-align: center;
padding: 0;
}
#logo-left {
background: url(images/logo_left.jpg) top left no-repeat;
}
#logo-right {
background: url(images/logo_right.jpg) top right no-repeat;
}
#logorow, #logo-left {
height: 88px;
overflow: hidden;
}
.pm-notify-new, .pm-notify-unread {
border-left: solid 1px #C53431;
border-right: solid 1px #B62723;
border-top: solid 1px #C53431;
border-bottom: solid 1px #B62723;
background: #313131 url(images/cell.gif) top left repeat-x;
margin: 10px 0;
padding: 10px;
text-align: center;
font-size: 12px;
font-weight: bold;
}
.pm-notify-new a, .pm-notify-new a:visited, .pm-notify-unread a, .pm-notify-unread a:visited { text-decoration: underline; }
.pm-notify-header {
margin-bottom: 10px;
color: #CCC;
}
.pm-notify-new, .pm-notify-unread:hover {
border-left: solid 1px #FCF536;
border-right: solid 1px #F0E80A;
border-top: solid 1px #FCF536;
border-bottom: solid 1px #F0E80A;
}
.pm-notify-new { padding: 30px; }
/* Navigation buttons */
.navrow {
background: #C63F3B url(images/buttons.gif) top left repeat-x;
height: 21px;
overflow: hidden;
border-bottom: solid 1px #000;
border-top: solid 1px #000;
color: #F0E80A;
text-align: center;
font-size: 11px;
padding: 1px;
}
* html .navrow { padding: 0; }
.navrow b, .navrow strong { font-weight: normal; }
.navrow a, .navrow a:visited {
color: #FFF;
text-decoration: none;
}
.navrow a:hover {
color: #F0E80A;
text-decoration: underline;
}
a.link-new, a.link-new:visited { color: #F0E80A; }
a.link-new:hover, a.link-new:visited:hover { color: #FFF; }
/* Content and tables */
#contentrow {
padding: 5px;
background-color: #191919;
}
.tablebg {
border: solid 1px #000;
background: #313131 url(images/cell.gif) top left repeat-x;
}
.row1, .row2, .row3, .legend, .forumrules, tr.row1 .row, tr.row2 .row, tr.row3 .row, .postbottom {
border-left: solid 1px #404040;
border-right: solid 1px #121212;
border-top: solid 1px #3C3C3C;
border-bottom: solid 1px #131313;
background: #313131 url(images/cell.gif) top left repeat-x;
padding: 4px;
}
th {
color: #F0CDCC;
font-size: 11px;
font-weight: bold;
background: #864E4A url(images/th.gif) top left repeat-x;
white-space: nowrap;
padding: 0 5px;
text-align: center;
height: 26px;
border-left: solid 1px #C23631;
border-right: solid 1px #7D1916;
border-top: solid 1px #C33D39;
border-bottom: solid 1px #7D1916;
}
th a, th a:visited {
color: #F0CDCC !important;
text-decoration: underline;
}
th a:hover {
color: #FFF;
text-decoration: underline;
}
td {
padding: 2px;
}
td.profile {
padding: 4px;
}
.catdiv {
height: 24px;
padding: 0 3px;
border-left: solid 1px #404040;
border-right: solid 1px #121212;
border-top: solid 1px #3C3C3C;
border-bottom: solid 1px #131313;
background: #2C2C2C url(images/cathead.gif) top left repeat-x;
}
.rtl .catdiv {
background: #2C2C2C url(images/cathead.gif) top left repeat-x;
}
.cat {
height: 24px;
padding: 0 3px;
border-left: solid 1px #404040;
border-right: solid 1px #121212;
border-top: solid 1px #3C3C3C;
border-bottom: solid 1px #131313;
background: #2C2C2C url(images/cathead.gif) top left repeat-x;
text-indent: 4px;
}
.cathead {
background: #9A2A26 url(images/catbottom.gif) top left repeat-x;
height: 24px;
padding: 1px 3px;
border-left: solid 1px #C23631;
border-right: solid 1px #7D1916;
border-top: solid 1px #C33D39;
border-bottom: solid 1px #7D1916;
}
/* Table header */
caption, .cap-div {
margin: 0;
padding: 0;
background: url(images/hdr_mid.gif) top left repeat-x;
white-space: nowrap;
height: 27px;
text-align: center;
}
.cap-left {
background: url(images/hdr_left.gif) top left no-repeat;
}
.cap-right {
background: url(images/hdr_right.gif) top right no-repeat;
padding-top: 8px;
height: 19px;
}
caption, caption h1, caption h2, caption h3, caption h4, caption span,
.cap-div, .cap-div h1, .cap-div h2, .cap-div h3, .cap-div h4, .cap-div span {
font-size: 12px;
font-weight: bold;
color: #D03632;
}
caption h1, caption h2, caption h3, caption h4, caption span,
.cap-div h1, .cap-div h2, .cap-div h3, .cap-div h4, .cap-div span {
display: inline;
}
caption a, caption a:visited, .cap-div a, .cap-div a:visited {
color: #D03632;
text-decoration: underline;
}
caption a:hover, .cap-div a:hover {
color: #D0D0D0;
text-decoration: underline;
}
/* Footer */
#wrapfooter {
text-align: center;
color: #CCC;
padding-top: 10px;
}
.copyright {
color: #888;
font-weight: normal;
font-size: 9px;
line-height: 1.2em;
}
.copyright a, .copyright a:visited {
color: #AAA;
text-decoration: underline;
}
.copyright a:hover { color: #FFF; }
/* Breadcrumbs */
p.breadcrumbs {
margin: 0;
padding: 0;
float: left;
color: #AAA;
font-weight: bold;
white-space: normal;
font-size: 1em;
}
.rtl p.breadcrumbs {
float: right;
}
p.datetime {
margin: 0;
padding: 0;
float: right;
white-space: nowrap;
font-size: 1em;
}
.rtl p.datetime {
float: left;
}
/* Index/viewforum */
.subforum.read {
background: url(images/sub_old.gif) top left no-repeat;
padding-left: 12px;
}
.subforum.unread {
background: url(images/sub_new.gif) top left no-repeat;
padding-left: 12px;
}
.legend {
text-align: center;
margin: 0 auto;
padding: 2px;
}
.legend-viewforum {
margin: 0;
text-align: left;
}
.forumrules {
padding: 4px;
font-weight: normal;
font-size: 1.1em;
border-left-color: #AAA;
border-top-color: #AAA;
border-right-color: #CCC;
border-bottom-color: #CCC;
font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
}
.forumrules h3 {
color: #F0E80A;
}
/* Post */
.postsubject {
font-size: 12px;
font-weight: bold;
color: #B62723;
}
td.postbottom {
background: #2D2D2D url(images/profile.gif) top left repeat-x;
font-size: 10px;
color: #D0D0D0;
white-space: nowrap;
padding: 2px 4px;
vertical-align: middle;
}
td.postbuttons { padding-top: 3px; }
.postdetails {
color: #CCC;
font-size: 10px;
text-align: left;
}
.postdetails b {
color: #DDD;
}
.posterrank { font-size: 9px; color: #B0B0B0; }
.posterprofile { font-size: 10px; color: #D0D0D0; }
.postauthor {
color: #B62723;
font-size: 12px;
margin-bottom: 3px;
font-weight: bold;
}
.postonline { margin-bottom: 2px; }
.postreported, .postreported a:visited, .postreported a:hover, .postreported a, .postreported a:active {
margin: 1px 0px;
color: #F0E80A;
font-weight: bold;
}
.postapprove, .postapprove a:visited, .postapprove a:hover, .postapprove a, .postapprove a:active {
color: #00FF00;
font-weight: bold;
}
.postapprove img, .postreported img {
vertical-align: bottom;
padding-top: 5px;
}
.postbody {
font-size: 12px;
line-height: 1.4em;
margin: 3px 0;
}
.signature {
font-size: 11px;
color: #EEE;
margin-top: 5px;
}
.signature .line { color: #AAA; }
.postbody li, ol, ul {
margin: 0 0 0 1.5em;
}
.rtl .postbody li, .rtl ol, .rtl ul {
margin: 0 1.5em 0 0;
}
.posthilit {
background-color: #B62723;
color: #fff;
}
.postsubject {
font-size: 12px;
font-weight: bold;
color: #B62723;
}
.postbody a { text-decoration: underline; }
/* UCP */
.folder-current a, .folder-current a:visited {
color: #FFF;
font-weight: bold;
}
.folder-current a:hover { color: #F0E80A; }
td.pm_marked_colour { background: #F0E80A; }
td.pm_marked_colour_left { border-left: solid 3px #F0E80A; padding-left: 2px; }
td.pm_marked_colour_right { border-right: solid 3px #F0E80A; padding-right: 2px; }
td.pm_replied_colour { background: #B62723; }
td.pm_replied_colour_left { border-left: solid 3px #B62723; padding-left: 2px; }
td.pm_replied_colour_right { border-right: solid 3px #B62723; padding-right: 2px; }
td.pm_friend_colour { background: #007700; }
td.pm_friend_colour_left { border-left: solid 3px #007700; padding-left: 2px; }
td.pm_friend_colour_right { border-right: solid 3px #007700; padding-right: 2px; }
td.pm_foe_colour { background: #DD0000; }
td.pm_foe_colour_left { border-left: solid 3px #DD0000; padding-left: 2px; }
td.pm_foe_colour_right { border-right: solid 3px #DD0000; padding-right: 2px; }
/* Form Elements
------------ */
form {
margin: 0px;
padding: 0px;
border: 0px;
}
textarea, select, .post, .btnbbcode, .btnmain, .btnlite, .btnfile, .helpline {
font-weight: normal;
font-family: "Lucida Grande", Verdana, Helvetica, sans-serif;
color: #D0D0D0;
border: 1px solid #B62723;
background-color: #222;
}
input {
font-size: 1.1em;
padding: 1px;
}
textarea {
font-size: 1.3em;
line-height: 1.4em;
padding: 2px;
}
select {
font-size: 1.1em;
padding: 1px;
}
option {
padding: 0 1em 0 0;
}
.rtl option {
padding: 0 0 0 1em;
}
.post {
border-style: solid;
border-width: 1px;
}
.btnbbcode {
font-size: 1.1em;
border: 1px solid #444;
}
.btnbbcode:hover {
border-color: #999;
color: #FFF;
}
.btnmain {
font-weight: bold;
cursor: pointer;
padding: 1px 5px;
font-size: 1.1em;
}
.btnlite {
font-weight: normal;
cursor: pointer;
padding: 1px 5px;
font-size: 1.1em;
}
.btnfile {
font-weight: normal;
padding: 1px 5px;
font-size: 1.1em;
}
.helpline {
background-color: transparent;
color: #AAA;
border-style: none;
}
#helpline { color: #AAA; }
* html textarea, * html select, * html .post, * html .btnmain, * html .btnlite, * html .btnfile {
border-color: #D0D0D0;
}
textarea:hover, select:hover, .post:hover, .btnmain:hover, .btnlite:hover, .btnfile:hover {
border-color: #D0D0D0;
}
textarea:focus, select:focus, .post:focus, .btnmain:focus, .btnlite:focus, .btnfile:focus {
border-color: #F0E80A;
color: #FFF;
}
label:hover {
color: #F0E80A;
}
textarea.posting-textarea, #ie8#fix {
width: 98%;
}
/* BBCode
------------ */
.quotetitle, .attachtitle, .codetitle {
margin: 10px 5px 0px 5px;
padding: 2px 4px;
border: solid 1px #090909;
color: #D0D0D0;
background-color: #2E2E2E;
font-size: 0.85em;
font-weight: bold;
}
.quotetitle .quotetitle {
font-size: 1em;
}
.quotecontent, .attachcontent {
margin: 0px 5px 10px 5px;
padding: 5px;
border-color: #090909;
border-width: 0px 1px 1px 1px;
border-style: solid;
font-weight: normal;
font-size: 1em;
line-height: 1.4em;
/* font-family: "Lucida Grande", "Trebuchet MS", Helvetica, Arial, sans-serif; */
background-color: #2E2E2E;
color: #EEE;
}
.attachcontent {
font-size: 0.85em;
}
.codecontent {
direction: ltr;
margin: 0px 5px 10px 5px;
padding: 5px;
border-color: #090909;
border-width: 0px 1px 1px 1px;
border-style: solid;
font-weight: normal;
font-size: 11px;
font-family: Monaco, 'Courier New', monospace;
background-color: #2E2E2E;
color: #EEE;
}
.quotewrapper, .codewrapper, .attachwrapper {
clear: both;
margin: 10px 5px;
background: #B62A26 url(images/code_header.gif) top left no-repeat;
padding-left: 19px;
border: solid 1px #090909;
}
.quotewrapper { background-image: url(images/quote_header.gif); }
.quotewrapper .quotetitle, .codewrapper .codetitle, .attachwrapper .attachtitle {
margin: 0;
border-width: 0 0 1px 1px;
}
.quotewrapper .quotecontent, .codewrapper .codecontent, .attachwrapper .attachcontent {
margin: 0;
border-width: 0 0 0 1px;
}
.attachcontent, .codecontent {
overflow: auto;
overflow-x: auto;
}
.syntaxbg {
color: #FFF;
}
.syntaxcomment {
color: #AAA;
}
.syntaxdefault {
color: #FFF;
}
.syntaxhtml {
color: #FFF;
}
.syntaxkeyword {
color: #F0E80A;
}
.syntaxstring {
color: #B62723;
}
/* More misc stuff */
h1 {
font-family: "Lucida Grande", "Trebuchet MS", Verdana, sans-serif;
font-weight: bold;
font-size: 1.8em;
text-decoration: none;
}
h2 {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 1.5em;
text-decoration: none;
line-height: 120%;
}
h3 {
font-size: 1.3em;
font-weight: bold;
font-family: Arial, Helvetica, sans-serif;
line-height: 120%;
}
h4 {
margin: 0px;
font-size: 1.1em;
font-weight: bold;
}
p {
font-size: 1.1em;
}
p.moderators {
margin: 0px;
float: left;
color: #CCC;
font-weight: bold;
}
.rtl p.moderators {
float: right;
}
p.linkmcp {
margin: 0px;
float: right;
white-space: nowrap;
}
.rtl p.linkmcp {
float: left;
}
p.searchbar {
padding: 2px 0;
white-space: nowrap;
}
p.searchbarreg {
margin: 0px;
float: right;
white-space: nowrap;
}
.rtl p.searchbarreg {
float: left;
}
p.forumdesc {
padding-bottom: 4px;
}
p.topicauthor {
margin: 1px 0px;
}
p.topicdetails {
margin: 1px 0px;
}
td.history-current, tr.row1 td.history-current, tr.row2 td.history-current {
background: #444;
}
table.colortable td {
padding: 0;
}
pre {
font-size: 1.1em;
font-family: Monaco, 'Courier New', monospace;
}
.nowrap {
white-space: nowrap;
}
.username-coloured {
font-weight: bold;
}
.sep {
color: #888;
}
/* reset style for file input */
.btnfile, .btnfile:hover, .btnfile:focus {
border: none;
background-color: #FFF;
color: #000;
}
Code: Alles auswählen
/**
* bbCode control by subBlue design [ www.subBlue.com ]
* Includes unixsafe colour palette selector by SHS`
*/
// Startup variables
var imageTag = false;
var theSelection = false;
var bbcodeEnabled = true;
// Check for Browser & Platform for PC & IE specific bits
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version
var is_ie = ((clientPC.indexOf('msie') != -1) && (clientPC.indexOf('opera') == -1));
var is_win = ((clientPC.indexOf('win') != -1) || (clientPC.indexOf('16bit') != -1));
var baseHeight;
/**
* Shows the help messages in the helpline window
*/
function helpline(help)
{
// document.forms[form_name].helpbox.value = help_line[help];
document.getElementById('helpline').innerHTML = help_line[help] + ' ';
}
/**
* Fix a bug involving the TextRange object. From
* http://www.frostjedi.com/terra/scripts/demo/caretBug.html
*/
function initInsertions()
{
var doc;
if (document.forms[form_name])
{
doc = document;
}
else
{
doc = opener.document;
}
var textarea = doc.forms[form_name].elements[text_name];
if (is_ie && typeof(baseHeight) != 'number')
{
/* === mChat focus fix Start === */
var mChatFocus = window.mChatFocusFix || false;
if(!mChatFocus)
{
textarea.focus();
}
baseHeight = doc.selection.createRange().duplicate().boundingHeight;
/* ==== mChat focus fix End ==== */
if (!document.forms[form_name])
{
document.body.focus();
}
}
}
/**
* bbstyle
*/
function bbstyle(bbnumber)
{
if (bbnumber != -1)
{
bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]);
}
else
{
insert_text('[*]');
document.forms[form_name].elements[text_name].focus();
}
}
/**
* Apply bbcodes
*/
function bbfontstyle(bbopen, bbclose)
{
theSelection = false;
var textarea = document.forms[form_name].elements[text_name];
textarea.focus();
if ((clientVer >= 4) && is_ie && is_win)
{
// Get text selection
theSelection = document.selection.createRange().text;
if (theSelection)
{
// Add tags around selection
document.selection.createRange().text = bbopen + theSelection + bbclose;
document.forms[form_name].elements[text_name].focus();
theSelection = '';
return;
}
}
else if (document.forms[form_name].elements[text_name].selectionEnd && (document.forms[form_name].elements[text_name].selectionEnd - document.forms[form_name].elements[text_name].selectionStart > 0))
{
mozWrap(document.forms[form_name].elements[text_name], bbopen, bbclose);
document.forms[form_name].elements[text_name].focus();
theSelection = '';
return;
}
//The new position for the cursor after adding the bbcode
var caret_pos = getCaretPosition(textarea).start;
var new_pos = caret_pos + bbopen.length;
// Open tag
insert_text(bbopen + bbclose);
// Center the cursor when we don't have a selection
// Gecko and proper browsers
if (!isNaN(textarea.selectionStart))
{
textarea.selectionStart = new_pos;
textarea.selectionEnd = new_pos;
}
// IE
else if (document.selection)
{
var range = textarea.createTextRange();
range.move("character", new_pos);
range.select();
storeCaret(textarea);
}
textarea.focus();
return;
}
/**
* Insert text at position
*/
function insert_text(text, spaces, popup)
{
var textarea;
if (!popup)
{
textarea = document.forms[form_name].elements[text_name];
}
else
{
textarea = opener.document.forms[form_name].elements[text_name];
}
if (spaces)
{
text = ' ' + text + ' ';
}
if (!isNaN(textarea.selectionStart))
{
var sel_start = textarea.selectionStart;
var sel_end = textarea.selectionEnd;
mozWrap(textarea, text, '');
textarea.selectionStart = sel_start + text.length;
textarea.selectionEnd = sel_end + text.length;
}
else if (textarea.createTextRange && textarea.caretPos)
{
if (baseHeight != textarea.caretPos.boundingHeight)
{
textarea.focus();
storeCaret(textarea);
}
var caret_pos = textarea.caretPos;
caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) == ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text;
}
else
{
textarea.value = textarea.value + text;
}
if (!popup)
{
textarea.focus();
}
}
/**
* Add inline attachment at position
*/
function attach_inline(index, filename)
{
insert_text('[attachment=' + index + ']' + filename + '[/attachment]');
document.forms[form_name].elements[text_name].focus();
}
/**
* Add quote text to message
*/
function addquote(post_id, username, l_wrote)
{
var message_name = 'message_' + post_id;
var theSelection = '';
var divarea = false;
if (l_wrote === undefined)
{
// Backwards compatibility
l_wrote = 'wrote';
}
if (document.all)
{
divarea = document.all[message_name];
}
else
{
divarea = document.getElementById(message_name);
}
// Get text selection - not only the post content :(
if (window.getSelection)
{
theSelection = window.getSelection().toString();
}
else if (document.getSelection)
{
theSelection = document.getSelection();
}
else if (document.selection)
{
theSelection = document.selection.createRange().text;
}
if (theSelection == '' || typeof theSelection == 'undefined' || theSelection == null)
{
if (divarea.innerHTML)
{
theSelection = divarea.innerHTML.replace(/<br>/ig, '\n');
theSelection = theSelection.replace(/<br\/>/ig, '\n');
theSelection = theSelection.replace(/<\;/ig, '<');
theSelection = theSelection.replace(/>\;/ig, '>');
theSelection = theSelection.replace(/&\;/ig, '&');
theSelection = theSelection.replace(/ \;/ig, ' ');
}
else if (document.all)
{
theSelection = divarea.innerText;
}
else if (divarea.textContent)
{
theSelection = divarea.textContent;
}
else if (divarea.firstChild.nodeValue)
{
theSelection = divarea.firstChild.nodeValue;
}
}
if (theSelection)
{
if (bbcodeEnabled)
{
insert_text('[quote="' + username + '"]' + theSelection + '[/quote]');
}
else
{
insert_text(username + ' ' + l_wrote + ':' + '\n');
var lines = split_lines(theSelection);
for (i = 0; i < lines.length; i++)
{
insert_text('> ' + lines[i] + '\n');
}
}
}
return;
}
function split_lines(text)
{
var lines = text.split('\n');
var splitLines = new Array();
var j = 0;
for(i = 0; i < lines.length; i++)
{
if (lines[i].length <= 80)
{
splitLines[j] = lines[i];
j++;
}
else
{
var line = lines[i];
do
{
var splitAt = line.indexOf(' ', 80);
if (splitAt == -1)
{
splitLines[j] = line;
j++;
}
else
{
splitLines[j] = line.substring(0, splitAt);
line = line.substring(splitAt);
j++;
}
}
while(splitAt != -1);
}
}
return splitLines;
}
/**
* From http://www.massless.org/mozedit/
*/
function mozWrap(txtarea, open, close)
{
var selLength = (typeof(txtarea.textLength) == 'undefined') ? txtarea.value.length : txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
var scrollTop = txtarea.scrollTop;
if (selEnd == 1 || selEnd == 2)
{
selEnd = selLength;
}
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd);
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + open + s2 + close + s3;
txtarea.selectionStart = selStart + open.length;
txtarea.selectionEnd = selEnd + open.length;
txtarea.focus();
txtarea.scrollTop = scrollTop;
return;
}
/**
* Insert at Caret position. Code from
* http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
*/
function storeCaret(textEl)
{
if (textEl.createTextRange)
{
textEl.caretPos = document.selection.createRange().duplicate();
}
}
/**
* Color pallette
*/
function colorPalette(dir, width, height)
{
var r = 0, g = 0, b = 0;
var numberList = new Array(6);
var color = '';
numberList[0] = '00';
numberList[1] = '40';
numberList[2] = '80';
numberList[3] = 'BF';
numberList[4] = 'FF';
document.writeln('<table cellspacing="1" cellpadding="0" border="0">');
for (r = 0; r < 5; r++)
{
if (dir == 'h')
{
document.writeln('<tr>');
}
for (g = 0; g < 5; g++)
{
if (dir == 'v')
{
document.writeln('<tr>');
}
for (b = 0; b < 5; b++)
{
color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]);
document.write('<td bgcolor="#' + color + '" style="width: ' + width + 'px; height: ' + height + 'px;">');
document.write('<a href="#" onclick="bbfontstyle(\'[color=#' + color + ']\', \'[/color]\'); return false;"><img src="images/spacer.gif" width="' + width + '" height="' + height + '" alt="#' + color + '" title="#' + color + '" /></a>');
document.writeln('</td>');
}
if (dir == 'v')
{
document.writeln('</tr>');
}
}
if (dir == 'h')
{
document.writeln('</tr>');
}
}
document.writeln('</table>');
}
/**
* Caret Position object
*/
function caretPosition()
{
var start = null;
var end = null;
}
/**
* Get the caret position in an textarea
*/
function getCaretPosition(txtarea)
{
var caretPos = new caretPosition();
// simple Gecko/Opera way
if(txtarea.selectionStart || txtarea.selectionStart == 0)
{
caretPos.start = txtarea.selectionStart;
caretPos.end = txtarea.selectionEnd;
}
// dirty and slow IE way
else if(document.selection)
{
// get current selection
var range = document.selection.createRange();
// a new selection of the whole textarea
var range_all = document.body.createTextRange();
range_all.moveToElementText(txtarea);
// calculate selection start point by moving beginning of range_all to beginning of range
var sel_start;
try
{
for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++)
{
range_all.moveStart('character', 1);
}
txtarea.sel_start = sel_start;
// we ignore the end value for IE, this is already dirty enough and we don't need it
caretPos.start = txtarea.sel_start;
caretPos.end = txtarea.sel_start;
}
catch(e)
{
}
return caretPos;
}