BBCodeBox3

prosilver | subsilver2

Willkommen und Guten Tag, Guest  Beim nächsten Piep ist es zwischen 13:00 und 14:00 Uhr

It is currently Sun 23. Feb 2025, 14:52

All times are UTC + 1 hour [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
PostPosted: Fri 11. Apr 2008, 00:45 
Administrator
User avatar

Posts: 427

Last 3 Topics:
Tabmenu Test
[Snippet] Avatar Ev...
[DEV] Zero and X-P...

Joined:
Sun 13. Jan 2008, 23:44

Der erste Fix löst das Problem in der BBCode Box,

das BB-Codes nicht an der Cursorposition eingefügt werden
und
das der Cursor nach oben springt.

---------------------------------------------------------------
## Frei angepasst nach: Fix BBCode and Emoticon insertion 1.0.1,
## Anteilen vom Accurate BBCode Insertion Mod ( with special thx to bombon)
## und anderen Snippets

Code:
#
#-----[ OPEN ]------------------------------------------
#

mods/bbcode_box/add_bbcode.js + mods/bbcode_box/bbcode_box.js

#
# >>>>    Note: Make all changes in both files <<<<<
# >>>> Wichtig: Alle Aenderungen in beiden Dateien machen <<<<
#

#
#-----[ FIND ]------------------------------------------
#

function BBCplain() {

#
#-----[ BEFORE, ADD ]-------------! Updated !-----------------
#

function bbplace(text) {
   var txtarea = document.post.message;
   var scrollTop = (typeof(txtarea.scrollTop) == 'number' ? txtarea.scrollTop : -1);
   if (txtarea.createTextRange && txtarea.caretPos) {
      var caretPos = txtarea.caretPos;
      caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' :

caretPos.text + text;
      txtarea.focus();
   } else if (txtarea.selectionStart || txtarea.selectionStart == '0') {
      var startPos = txtarea.selectionStart;
      var endPos = txtarea.selectionEnd;
      txtarea.value = txtarea.value.substring(0, startPos)
         + text
         + txtarea.value.substring(endPos, txtarea.value.length);
      txtarea.focus();
      txtarea.selectionStart = startPos + text.length;
      txtarea.selectionEnd = startPos + text.length;
   } else {
      txtarea.value  += text;
      txtarea.focus();
   }
   if(scrollTop >= 0 ) { txtarea.scrollTop = scrollTop;}
}

function emoticon(text) {
   text = ' ' + text + ' ';
   bbplace(text);
}

#
#-----[ FIND AND DELETE]-------! Updated !--------------------
#

function emoticon(text) {
   var txtarea = document.post.message;
   text = ' ' + text + ' ';
   if (txtarea.createTextRange && txtarea.caretPos) {
      var caretPos = txtarea.caretPos;
      caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' :

caretPos.text + text;
      txtarea.focus();
   } else {
      txtarea.value  += text;
      txtarea.focus();
   }
}

#
#-----[ FIND ]------------------------------------------------
#

function mozWrap(txtarea, open, close)
{
   var selLength = txtarea.textLength;
   var selStart = txtarea.selectionStart;
   var selEnd = txtarea.selectionEnd;
   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;
   return;
}

#
#-----[ REPLACE WITH ]--------------------------------------------------------
#

// From http://www.massless.org/mozedit/
function mozWrap(txtarea, open, close)
{
   if (txtarea.selectionEnd > txtarea.value.length) { txtarea.selectionEnd = txtarea.value.length; }

   var oldPos = txtarea.scrollTop;
   var oldHght = txtarea.scrollHeight;

   var selStart = txtarea.selectionStart;
   var selEnd = txtarea.selectionEnd+open.length;

   txtarea.value = txtarea.value.slice(0,selStart)+open+txtarea.value.slice(selStart);
   txtarea.value = txtarea.value.slice(0,selEnd)+close+txtarea.value.slice(selEnd);

   txtarea.selectionStart = selStart+open.length;
   txtarea.selectionEnd = selEnd;

   var newHght = txtarea.scrollHeight - oldHght;
   txtarea.scrollTop = oldPos + newHght;

   txtarea.focus();
}

#
#-----[ FIND ALL ]------------------------------------------
#

document.post.message.value+=ToAdd;

#
#-----[ REPLACE ALL WITH ]-------------------------------------
#

bbplace(ToAdd);

#
#-----[ FIND ALL ]--------------------------------------------------
#

txtarea.value += bbopen + bbclose;

#
#-----[ REPLACE ALL WITH ]------------------------------------------
#

bbplace(bbopen + bbclose);

#
#-----[ FIND ALL ]--------------------------------------------------
#

document.post.message.value += text;

#
#-----[ REPLACE ALL WITH ]------------------------------------------
#

bbplace(text);

#
#-----[ THATS IT ]---------------------------------------------
#


_____________________________

Der zweite Fix löst das Problem, das man im Postbereich einen bestimmten Schrifttyp (Font Type), sowie eine bestimmte Schriftgröße (Font Size) und Schriftfarbe (Font Color) nicht zweimal hintereinander auswählen kann.

Code:
#
#-----[ OPEN ]------------------------------------------
#

templates/your_template/posting_body.tpl

#
#-----[ After this.. ]------------------------------------------
#

<!--
//====================================================================== |
//==== Start Advanced BBCode Box MOD =================================== |
//==== v5.1.0 ========================================================== |
//====
-->

#
#-----[ ..Find ]------------------------------------------
#

<select style="height: 20px;" name="ft" onChange="BBCft()" onMouseOver="helpline('ft')">
<option style="font-weight : bold;" selected="selected">Font type</option>
<option value="Arial">Default font</option>

#
#-----[ Replace with ]------------------------------------------
#

<select style="height: 20px;" name="ft" onChange="BBCft();this.selectedIndex=0" onMouseOver="helpline('ft')">
<option style="font-weight : bold;" selected="selected">Font type</option>
<option value="Arial">Default font</option>

#
#-----[ ..Find ]------------------------------------------
#

<select style="height: 20px;" name="fs" onChange="BBCfs()" onMouseOver="helpline('fs')">
<option style="font-weight : bold;" selected="selected">Font Size</option>

#
#-----[ Replace with ]------------------------------------------
#

<select style="height: 20px;" name="fs" onChange="BBCfs();this.selectedIndex=0" onMouseOver="helpline('fs')">
<option style="font-weight : bold;" selected="selected">Font Size</option>

#
#-----[ ..Find ]------------------------------------------
#

<select style="height: 20px;" name="fc" onChange="BBCfc()" onMouseOver="helpline('fc')">
<option style="font-weight : bold;" selected>Font Color</option>

#
#-----[ Replace with ]------------------------------------------
#

<select style="height: 20px;" name="fc" onChange="BBCfc();this.selectedIndex=0" onMouseOver="helpline('fc')">
<option style="font-weight : bold;" selected>Font Color</option>

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------------
#



lg
4seven


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron
POWERED_BY
[ Time : 0.012s | 15 Queries | GZIP : Off | Board-Version: 3.0.7 PL1 ]