26 (edited by Maciek 2004-06-08 09:04)

Re: punBB bbcode button MOD 1.0 released

cuteseal wrote:

Hi Maciek,

I installed your mod - great idea and I really like it. It's very useful for everyday use.

Just some feedback:

1)  In firefox browsers, the buttons show up as normal buttons, instead of the flat style sheet ones.  any ideas?

2)  I didn't like the way your mod introduces new, non-standard bbcode (e.g. size, font, list).  My suggestion would be to put this functionality into a separate mod?

3)  Should also make the mod appear in the quickpost section.  It's pretty easy to do - I've modified your code to do so on my site:

http://www.shuttertalk.com/

Anyway, thanks again for the great mod!

1.hmm strange I check this leater
2 and 3 .I don't have a time to do this (school,works etc) but If you modified this MOD you can post it here

EDIT

I check and in my firefox buttons look's ok.

click

The best things in life are free*

* plus shipping and handling

[img]http://members.lycos.co.uk/maciekziolkowski/gmailsign.jpg[/img]

Re: punBB bbcode button MOD 1.0 released

oh yeah... firefox seems ok now. smile

Digital photography news, reviews, discussions and more!
http://www.shuttertalk.com

The online bible for all
http://www.publicbible.com

28

Re: punBB bbcode button MOD 1.0 released

getting
'document.input.mode' is null or not an object

post.php line: 173 char: 3


after installing. dunno what went wrong... maybe some typo i did during copy-paste?

29

Re: punBB bbcode button MOD 1.0 released

testa wrote:

getting
'document.input.mode' is null or not an object

post.php line: 173 char: 3


after installing. dunno what went wrong... maybe some typo i did during copy-paste?

ok you have error and what's happen ? script works or not i get this error sometimes but script works fine . Please give me more info.

The best things in life are free*

* plus shipping and handling

[img]http://members.lycos.co.uk/maciekziolkowski/gmailsign.jpg[/img]

Re: punBB bbcode button MOD 1.0 released

I've changed some code, and it work fine!

var normalmode = false;

//--------------------------------------------
// Set radio button status 
//--------------------------------------------
prep_mode();

function cookieVal(cookieName) {
    thisCookie = document.cookie.split("; ");
    for (i=0; i<thisCookie.length; i++) {
        if (cookieName == thisCookie[i].split("=")[0]) {
            return thisCookie[i].split("=")[1];
        }
    }
    return "";
}

function prep_mode() {
    expireDate = new Date;
    expireDate.setMonth(expireDate.getMonth()+6);

    theMode = cookieVal("cb_mode");
    if ( theMode == "normal" ) {
        document.input.mode[0].checked = true;
        document.input.mode[1].checked = false;
        normalmode = true;
    } else {
        document.input.mode[0].checked = false;
        document.input.mode[1].checked = true;
        normalmode = false;
        theMode = "advanced";
    }
    document.cookie = "cb_mode="+theMode+"; path=/; expires=" + expireDate.toGMTString();
}

function changeMode(newMode) {
    expireDate = new Date;
    expireDate.setMonth(expireDate.getMonth()+6);
    document.cookie = "cb_mode="+newMode+"; path=/; expires=" + expireDate.toGMTString();
    if(newMode == "normal") {
        normalmode = true;
    } else {
        normalmode = false;
    }
}

variable normalmode should be declared first!

31

Re: punBB bbcode button MOD 1.0 released

jacobswell wrote:

I've changed some code, and it work fine!

var normalmode = false;

//--------------------------------------------
// Set radio button status 
//--------------------------------------------
prep_mode();

function cookieVal(cookieName) {
    thisCookie = document.cookie.split("; ");
    for (i=0; i<thisCookie.length; i++) {
        if (cookieName == thisCookie[i].split("=")[0]) {
            return thisCookie[i].split("=")[1];
        }
    }
    return "";
}

function prep_mode() {
    expireDate = new Date;
    expireDate.setMonth(expireDate.getMonth()+6);

    theMode = cookieVal("cb_mode");
    if ( theMode == "normal" ) {
        document.input.mode[0].checked = true;
        document.input.mode[1].checked = false;
        normalmode = true;
    } else {
        document.input.mode[0].checked = false;
        document.input.mode[1].checked = true;
        normalmode = false;
        theMode = "advanced";
    }
    document.cookie = "cb_mode="+theMode+"; path=/; expires=" + expireDate.toGMTString();
}

function changeMode(newMode) {
    expireDate = new Date;
    expireDate.setMonth(expireDate.getMonth()+6);
    document.cookie = "cb_mode="+newMode+"; path=/; expires=" + expireDate.toGMTString();
    if(newMode == "normal") {
        normalmode = true;
    } else {
        normalmode = false;
    }
}

variable normalmode should be declared first!

Yes u have right :) . Anyway thanks for modification i go sleep right now but when i weak up i update script .

The best things in life are free*

* plus shipping and handling

[img]http://members.lycos.co.uk/maciekziolkowski/gmailsign.jpg[/img]

32 (edited by jacobswell 2004-06-13 23:28)

Re: punBB bbcode button MOD 1.0 released

one more bug patch.
if you use netscape, when you write a littel, you can't insert bbcode at the first position.
in function pastecode you can see the code

    else if(moz && messageBox.selectionEnd) {

change like this:

    else if(moz) {

33

Re: punBB bbcode button MOD 1.0 released

getting now

Line: 173
Char: 9
Error: 'document.input.mode' is null or not an object
Code: 0

although script works ok. still it would be nice if this bug will be fixed..

thanks folks for this nice mod and for your great work!

34 (edited by Maciek 2004-06-14 09:31)

Re: punBB bbcode button MOD 1.0 released

jacobswell wrote:

one more bug patch.
if you use netscape, when you write a littel, you can't insert bbcode at the first position.
in function pastecode you can see the code

    else if(moz && messageBox.selectionEnd) {

change like this:

    else if(moz) {

Ok i update MOD :) thanks again for help

/*
+--------------------------------------------------------------------------
|   PunBB code buttons 1.0.2 
|   ========================================
|   By Maciej Ziolkowski
|   http://pubbmod.wz.cz/forum
|   ========================================
|   Time: Mon, 14-o6-2004 10:08:30 GMT+1
|   Email: admin@amberapple.pl
+---------------------------------------------------------------------------
|   Modified by Jacobswell
|   http://jacobswell.nared.net/
+---------------------------------------------------------------------------
*/
anothertester wrote:

getting now

Line: 173
Char: 9
Error: 'document.input.mode' is null or not an object
Code: 0

although script works ok. still it would be nice if this bug will be fixed..

thanks folks for this nice mod and for your great work!

Ok try this 1.0.2 version.

The best things in life are free*

* plus shipping and handling

[img]http://members.lycos.co.uk/maciekziolkowski/gmailsign.jpg[/img]

35 (edited by jacobswell 2004-06-14 09:52)

Re: punBB bbcode button MOD 1.0 released

Maciek wrote:
/*
+--------------------------------------------------------------------------
|   PunBB code buttons 1.0.2 
|   ========================================
|   By Maciej Ziolkowski
|   http://pubbmod.wz.cz/forum
|   ========================================
|   Time: Mon, 14-o6-2004 10:08:30 GMT+1
|   Email: admin@amberapple.pl
+---------------------------------------------------------------------------
|   Modified by Jacobswell
|   http://jacobswell.nared.net/
+---------------------------------------------------------------------------
*/

Wow... my name is there. actually I apprecate for your code for without yours I would have a hard time to make one.

36

Re: punBB bbcode button MOD 1.0 released

can any buddy help me im olmoost finisht http://fun.zenz.nl/forum/

37

Re: punBB bbcode button MOD 1.0 released

Maciek wrote:

Ok try this 1.0.2 version.

ok, tested it. now i'm getting:

Line: 164
Char: 9
Error: 'document.input.mode' is null or not an object
Code: 0

(i'm using ie6 + latest updates)

38

Re: punBB bbcode button MOD 1.0 released

zenz wrote:

can any buddy help me im olmoost finisht http://fun.zenz.nl/forum/

can you copy this code from your forum

<table class="punspacer" cellspacing="1" cellpadding="4">
    <tr>
        <td><b><a href="index.php"><?php echo pun_htmlspecialchars($pun_config['o_board_title']) ?></a> / <?php echo $forum ?><?php if (isset($subject)) echo ' / '.pun_htmlspecialchars($subject) ?></b></td>
    </tr>
</table>

<?php echo $form."\n" ?>
    <input type="hidden" name="form_sent" value="1">
    <input type="hidden" name="form_user" value="<?php echo (!$cookie['is_guest']) ? pun_htmlspecialchars($cur_user['username']) : 'Guest'; ?>">
    <table class="punmain" cellspacing="1" cellpadding="4">
        <tr class="punhead">
            <td class="punhead" colspan="2"><?php echo $action ?></td>
        </tr>
        <tr>
            <td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php echo $lang_common['Username'] ?></b>  </td>
            <td class="puncon2"> <?php echo (!$cookie['is_guest']) ? pun_htmlspecialchars($cur_user['username']) : '<input type="text" name="req_username" size="25" maxlength="25" tabindex="'.($cur_index++).'">'; ?></td>
        </tr>
<?php if ($cookie['is_guest']): ?>        <tr>
            <td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php echo $lang_common['E-mail'] ?></b>  </td>
            <td class="puncon2"> <input type="text" name="req_email" size="50" maxlength="50" tabindex="<?php echo $cur_index++ ?>"></td>
        </tr>
<?php endif; ?><?php if (isset($fid)): ?>        <tr>
            <td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php echo $lang_common['Subject'] ?></b>  </td>
            <td class="puncon2"> <input type="text" name="req_subject" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>"></td>
        </tr>
<?php endif; ?>        
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap"><b><?php echo $lang_common['BBCode'] ?></b>  </td>
<td class="puncon2"><?php include("include/bb_code.php"); ?></td>
</tr>
<tr>
<td class="puncon1right" style="width: 140px; white-space: nowrap">
<b><?php echo $lang_common['Message'] ?></b>  <br><br>
<a href="help.php#bbcode" target="_blank"><?php echo $lang_common['BBCode'] ?></a>: <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?>  <br>
<a href="help.php#img" target="_blank"><?php echo $lang_common['img tag'] ?></a>: <?php echo ($pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?>  <br>
<a href="help.php#smilies" target="_blank"><?php echo $lang_common['Smilies'] ?></a>: <?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?>  
</td>
<td class="puncon2"> <textarea name="req_message" rows="20" cols="95" tabindex="<?php echo $cur_index++ ?>"><?php echo $quote ?></textarea></td>
</tr>

It should be betwen line439-477 and paste on this or my forum thanks.

anothertester wrote:
Maciek wrote:

Ok try this 1.0.2 version.

ok, tested it. now i'm getting:

Line: 164
Char: 9
Error: 'document.input.mode' is null or not an object
Code: 0

(i'm using ie6 + latest updates)

I don't have any idea way this happens hmm i have same problem sometimes have this error sometimes not sad , i check script when i get more free time )

The best things in life are free*

* plus shipping and handling

[img]http://members.lycos.co.uk/maciekziolkowski/gmailsign.jpg[/img]

Re: punBB bbcode button MOD 1.0 released

zenz wrote:

can any buddy help me im olmoost finisht http://fun.zenz.nl/forum/

edit bbcode.php beginning </select> like this

</select>
</td>
</tr>
<tr>
<td>
<//-------------------------------------------->
<// if we need some bbcode buttons :)                  > 
<//-------------------------------------------->
<input type="button" class="punbutton" value="B" name='B' style="font-weight:bold" onClick="Pastebbcode('b')"> 
<input type="button" class="punbutton" value="I" name='I' style="font-style:italic" onClick="Pastebbcode('i')"> 
<input type="button" class="punbutton" value="U" name='U' style="text-decoration:underline" onClick="Pastebbcode('u')"> 
<input type="button" class="punbutton" value="List" name='list'  onClick="Pastebbcode('list')"> 
<input type="button" class="punbutton" value="Img" name='img'  onClick="Pastebbcode('img')"> 
<input type="button" class="punbutton" value="http://" name='http://'  onClick="Pastebbcode('url')"> 
<input type="button" class="punbutton" value="email" name='email'  onClick="Pastebbcode('email')"> 
<input type="button" class="punbutton" value="quote" name='quote'  onClick="Pastebbcode('quote')"> 
<input type="button" class="punbutton" value="code" name='code'  onClick="Pastebbcode('code')"> 
<input type="button" class="punbutton" value="close all tags" name='close all tags' onClick="closeAllTags()"> 
</td>
</tr>
<//---------------------------------------------------->
<//but what if we need change radio button status :/   > 
<//---------------------------------------------------->
<tr>
<td>
<small><input type="radio" name="mode" value="normal" onClick="changeMode('normal')"> Guided Mode  <input type="radio" name="mode" value="advanced" onClick="changeMode('advanced')" checked="checked"> Normal Mode</small>
</td>
</tr>
</table>

40 (edited by jacobswell 2004-06-15 12:53)

Re: punBB bbcode button MOD 1.0 released

anothertester wrote:
Maciek wrote:

Ok try this 1.0.2 version.

ok, tested it. now i'm getting:

Line: 164
Char: 9
Error: 'document.input.mode' is null or not an object
Code: 0

(i'm using ie6 + latest updates)

Now I found the reason.

1. open edit.php
2. find

<form method="post" action="edit.php?id=<?php echo $id ?>&action=edit"  id="edit" onsubmit="return process_form(this)">

3. replace with

<form method="post" action="edit.php?id=<?php echo $id ?>&action=edit" name="theform" id="edit" onsubmit="return process_form(this)">

4. save and upload
5. open post.php
6. find

        $form = '<form method="post" action="post.php?action=post&tid='.$tid.'" id="post" onsubmit="return process_form(this)">';

7. replace with

        $form = '<form method="post" action="post.php?action=post&tid='.$tid.'" name="theform" id="post" onsubmit="return process_form(this)">';

8. save and upload
9. open bb_code.php
10. find

function prep_mode() {
    expireDate = new Date;
    expireDate.setMonth(expireDate.getMonth()+6);

    theMode = cookieVal("cb_mode");
    if ( theMode == "normal" ) {
        document.input.mode[0] = true;
        document.input.mode[1] = false;
        normalmode = true;
    } else {
        document.input.mode[0] = false;
        document.input.mode[1] = true;
        normalmode = false;
        theMode = "advanced";
    }
    document.cookie = "cb_mode="+theMode+"; path=/; expires=" + expireDate.toGMTString();
}

11. replace with

function prep_mode() {
    expireDate = new Date;
    expireDate.setMonth(expireDate.getMonth()+6);

    theMode = cookieVal("cb_mode");
    if ( theMode == "normal" ) {
        document.theform.input.mode[0] = true;
        document.theform.input.mode[1] = false;
        normalmode = true;
    } else {
        document.theform.input.mode[0] = false;
        document.theform.input.mode[1] = true;
        normalmode = false;
        theMode = "advanced";
    }
    document.cookie = "cb_mode="+theMode+"; path=/; expires=" + expireDate.toGMTString();
}

12. save and upload

41

Re: punBB bbcode button MOD 1.0 released

jacobswell
thanks for your effort!
i did exactly what you said but the "null or not" problem still persists. now just line number is changed to 165. sad

Re: punBB bbcode button MOD 1.0 released

This is the code. you do not edit post.php and post.php at all. just copy the code to bb_code.php

changes :
1. exchange script code and html code for form tag should first come before prep_mode function.
2. some changes dealing with radio input.

<table border="0" cellpadding="0" cellspacing="4" width="100%">
<tr>
<td width="100%">
<//-------------------------------------------->
<//well we have some cool options here :)      > 
<//-------------------------------------------->
<select name="font" onChange="Pastebbcode('font', this.options[this.selectedIndex].value)">
<option value="-">Font</option>
<option value="Arial">Arial</option>
<option value="Courier New">Courier New</option>
<option value="Impact">Impact</option>
<option value="Tahoma">Tahoma</option>
<option value="Times New Roman">Times New Roman</option>
<option value="Trebuchet MS">Trebuchet MS</option>
<option value="Verdana">Verdana</option>
</select>
<select name="size" onChange="Pastebbcode('size', this.options[this.selectedIndex].value)">
<option value="-">Size</option>
<option value="1">Small</option>
<option value="2">Medium</option>
<option value="3">Large</option>
<option value="4">Largest</option>
</select>
<select name="color" onChange="Pastebbcode('color', this.options[this.selectedIndex].value)">
<option value="-"> Color </option>
<option style="color:blue" value="blue">Blue</option>
<option style="color:darkblue" value="darkblue">Dark Blue</option>
<option style="color:indigo" value="indigo">Indigo</option>
<option style="color:violet" value="violet">Violet</option>
<option style="color:white" value="white">White</option>
<option style="color:black" value="black">Black</option>
<option style="color:darkred" value="darkred">Dark Red</option>
<option style="color:red" value="red">Red</option>
<option style="color:orange" value="orange">Orange</option>
<option style="color:brown" value="brown">Brown</option>
<option style="color:yellow" value="yellow">Yellow</option>
<option style="color:green" value="green">Green</option>
</select>
</td>
</tr>
<tr>
<td>
<//-------------------------------------------->
<// if we need some bbcode buttons :)                  > 
<//-------------------------------------------->
<input type="button" class="punbutton" value="B" name='B' style="font-weight:bold" onClick="Pastebbcode('b')"> 
<input type="button" class="punbutton" value="I" name='I' style="font-style:italic" onClick="Pastebbcode('i')"> 
<input type="button" class="punbutton" value="U" name='U' style="text-decoration:underline" onClick="Pastebbcode('u')"> 
<input type="button" class="punbutton" value="List" name='list'  onClick="Pastebbcode('list')"> 
<input type="button" class="punbutton" value="Img" name='img'  onClick="Pastebbcode('img')"> 
<input type="button" class="punbutton" value="http://" name='http://'  onClick="Pastebbcode('url')"> 
<input type="button" class="punbutton" value="email" name='email'  onClick="Pastebbcode('email')"> 
<input type="button" class="punbutton" value="quote" name='quote'  onClick="Pastebbcode('quote')"> 
<input type="button" class="punbutton" value="code" name='code'  onClick="Pastebbcode('code')"> 
<input type="button" class="punbutton" value="close all tags" name='close all tags' onClick="closeAllTags()"> 
</td>
</tr>
<//---------------------------------------------------->
<//but what if we need change radio button status :/   > 
<//---------------------------------------------------->
<tr>
<td>
<small><input type="radio" name="mode" value="normal" onClick="changeMode('normal')"> Guided Mode  <input type="radio" name="mode"  value="advanced" onClick="changeMode('advanced')" checked> Normal Mode</small>
</td>
</tr>
</table>
<script type="text/javascript" language="javascript"> 
/*
+--------------------------------------------------------------------------
|   PunBB code buttons 1.0.1 
|   ========================================
|   by Maciej Ziolkowski
|   http://pubbmod.wz.cz/forum
|   ========================================
|   Time: Fri, 28 May 2004 13:08:30 GMT+1
|   Email: 
+---------------------------------------------------------------------------
*/

//--------------------------------------------
// Determine browser type and stuff.
//--------------------------------------------
var comp = navigator.userAgent.toLowerCase();  
var vers = parseInt(navigator.appVersion);  
var msie = ((comp.indexOf("msie") != -1) && (comp.indexOf("opera") == -1));  
var nets = ((comp.indexOf('spoofer')==-1) && (comp.indexOf('compatible') == -1) && (comp.indexOf('opera')==-1) && (comp.indexOf('webtv')==-1) && (comp.indexOf('hotjava')==-1));  
var moz = ((comp.indexOf("msie") == -1) && (comp.indexOf('mozilla')!=-1) && (comp.indexOf("opera") == -1)); 
var win  = ((comp.indexOf("win")!=-1) || (comp.indexOf("16bit") != -1));  

//--------------------------------------------
// Set up  values
//--------------------------------------------
var b_prompt = "Please enter the text to be formatted in bold.";
var i_prompt = "Please enter the text to be formatted in italics";
var u_prompt = "Please enter the text to be underlined.";
var font_prompt = "Please enter the text to be formatted with the font tag.";
var size_prompt = "Please enter the text to be formatted with the size tag.";
var color_prompt = "Please enter the text to be formatted with the color tag.";
var align_prompt = "Please enter the text to be aligned.";
var quote_prompt = "Please enter the text to be quoted.";
var code_prompt = "Please enter the code to be treated as code and unformatted text.";

var myTags = new Array();
var buttonOver = "";
var normalmode = false;

//--------------------------------------------
// Set radio button status 
//--------------------------------------------
prep_mode();

function cookieVal(cookieName) {
    thisCookie = document.cookie.split("; ");
    for (i=0; i<thisCookie.length; i++) {
        if (cookieName == thisCookie[i].split("=")[0]) {
            return thisCookie[i].split("=")[1];
        }
    }
    return "";
}

function prep_mode() {
    expireDate = new Date;
    expireDate.setMonth(expireDate.getMonth()+6);

    theMode = cookieVal("cb_mode");
    if ( theMode == "normal" ) {
        document.getElementsByName("mode")[0].checked = true;
        document.getElementsByName("mode")[1].checked = false;
        normalmode = true;
    } else {
        document.getElementsByName("mode")[0].checked = false;
        document.getElementsByName("mode")[1].checked = true;
        normalmode = false;
        theMode = "advanced";
    }
    document.cookie = "cb_mode="+theMode+"; path=/; expires=" + expireDate.toGMTString();
}

function changeMode(newMode) {
    expireDate = new Date;
    expireDate.setMonth(expireDate.getMonth()+6);
    document.cookie = "cb_mode="+newMode+"; path=/; expires=" + expireDate.toGMTString();
    if(newMode == "normal") {
        normalmode = true;
    } else {
        normalmode = false;
    }
}
//--------------------------------------------
// function  Size
//--------------------------------------------
function Size(arrayName) {
    for (i=0;i<arrayName.length;i++) {
        if((arrayName[i] == "undefined") || (arrayName[i] == "") || (arrayName[i] == null)) {
            return i;
        }
    }
    return arrayName.length;
}
//--------------------------------------------
// function  Push
//--------------------------------------------
function Push(arrayName, arrayValue) {
    arraySize = Size(arrayName);
    arrayName[arraySize] = arrayValue;
}
//--------------------------------------------
// function  Pop
//--------------------------------------------
function Pop(arrayName) {
    arrayMo = Size(arrayName);
    arrayValue = arrayName[arrayMo - 1];
    delete arrayName[arrayMo - 1];
    return arrayValue;
}
//--------------------------------------------
// function inArray
//--------------------------------------------
function inArray(item, arrayName) {
    for(i=0;i<arrayName.length;i++) {
        if(arrayName[i] == item) {
            return true;
        }
    }
    return false;
}
//--------------------------------------------
// function pos
//--------------------------------------------
function Pos(item, arrayName) {
    for(i=0;i<arrayName.length;i++) {
        if(arrayName[i] == item) {
            return i;
        }
    }
    return -1;
}
//--------------------------------------------
// function list
//--------------------------------------------
function List(type) {
    if(type) {
        theList = "[list="+type+"]\n";
    } else {
        theList = "[list]\n";
    }
    promptRes = "1";
    while((promptRes != "") && (promptRes != null)) {
        promptRes = prompt("Enter a list item. Click cancel or leave blank to end the list.", "");
        if((promptRes != "") && (promptRes != null)) {
            theList = theList+"[*]"+promptRes+"\n";
        }
    }
    theList = theList+"[/list]\n";
    Pastecode(theList);
}
//--------------------------------------------
// function url
//--------------------------------------------
function Hyperlink() {
    var url = prompt("Please enter the URL of the website.", "http://");
    if(url) {
        var urltitle = prompt("If you wish to, you may also insert a title to be shown instead of the URL.", "");
        if(urltitle) {
            Pastecode("[url="+url+"]"+urltitle+"[/url]");
        } else {
            Pastecode("[url]"+url+"[/url]");
        }
    } else {
// should we display errror or not? if you want remove this :)
        alert("You must enter a URL and a title.");
// ------------------------------------------------------------
    }
}
//--------------------------------------------
// function image
//--------------------------------------------
function Img() {
    var image = prompt("Please enter the remote URL of the image.", "http://");
    if(image) {
        Pastecode("[img]"+image+"[/img]");
    } else {
// should we display errror or not? if you want remove this :)
        alert("You must enter a URL for the image.");
// ------------------------------------------------------------
    }
}
//--------------------------------------------
// function email
//--------------------------------------------
function Email() {
    var email = prompt("Please enter the email address.", "");
    if(email) {
        var emailtitle = prompt("If you wish to, you may also insert a title to be shown instead of the email address.", "My Email Address");
        if(emailtitle) {
            Pastecode("[email="+email+"]"+emailtitle+"[/email]");
        } else {
            Pastecode("[email]"+email+"[/email]");
        }
    } /* added by me */
    else {
// should we display errror or not? if you want remove this :)
        alert("You must enter a email address.");
// ------------------------------------------------------------
    }
}
//--------------------------------------------
// function Paste bbcode
//--------------------------------------------
function Pastebbcode(myCode,selItem) {
    if(myCode == "list") {
        List(selItem);
    } else if(myCode == "url") {
        Hyperlink();
    } else if(myCode == "img") {
        Img();
    } else if(myCode == "email") {
        Email();
    } else {
        if(normalmode) {
            var prompttext = eval(myCode + "_prompt");
            if(selItem) {
                if(selItem != "-") {
                    promptres = prompt(prompttext + "\n["+myCode+"="+selItem+"]xxx[/"+myCode+"]", "");
                }
            } else {
                promptres = prompt(prompttext + "\n["+myCode+"]xxx[/"+myCode+"]", "");
            }
            if((promptres != null) && (promptres != "")) {
                if(selItem) {
                    if(selItem != "-") {
                        Pastecode("["+myCode+"="+selItem+"]"+promptres+"[/"+myCode+"]");
                    }
                } else {
                    Pastecode("["+myCode+"]"+promptres+"[/"+myCode+"]");
                }
            } 
        } else {
            var thingA = myCode+"_"+selItem;
            args = thingA.split("_");
            lastIndex = 0;
            alreadyopen = false;
            for(i=0;i<myTags.length;i++) {
                theTag = myTags[i];
                if(theTag) {
                    args2 = theTag.split("_");
                    if(args2[0] == args[0]) {
                        alreadyopen = true;
                        lastIndex = i;
                    }
                }
            }
            if(alreadyopen) {
                while(myTags[lastIndex]) {
                    tagRemove = Pop(myTags);
                    thingB = tagRemove.split("_");
                    Pastecode("[/"+thingB[0]+"]", "", false);
                    // unclick it
                    element = eval("document.images['"+tagRemove+"']");
                    if(element && !element.disabled && element.nodeName == "IMG") {
                        if(Over == tagRemove) {                            
                        }
                    }
                    if(thingA == tagRemove) { 
                        noInsert = true;
                    }
                }
            }

            if(selItem && selItem != "-" && !noInsert) {
                isClosed = Pastecode("["+myCode+"="+selItem+"]", "[/"+myCode+"]", true);
                if(!isClosed) {
                    Push(myTags, myCode+"_"+selItem);
                } else {                    
                    element = eval("document.images['"+myCode+"']");
                    if(element && !element.disabled && element.nodeName == "IMG") {
                        element.className = "toolbar";
                    }
                }
            }
            else if(!selItem && !alreadyopen) {
                isClosed = Pastecode("["+myCode+"]", "[/"+myCode+"]", true);
                if(!isClosed) {
                    Push(myTags, myCode);
                } else {
                    element = eval("document.images['"+myCode+"']");
                    if(element && !element.disabled && element.nodeName == "IMG") {
                        element.className = "toolbar";
                    }
                }
            }
            var alreadyopen = false;
            var noInsert = false;
        }
    }
    setFocus(document.all.req_message);
}
//--------------------------------------------
// function close all Tags
//--------------------------------------------
function closeAllTags() {
    if(myTags[0]) {
        while(myTags[0]) {
            tagRemove = Pop(myTags);
            args = tagRemove.split("_");
            isClosed = Pastecode("[/"+args[0]+"]", "", false, true);
            element = eval("document.images['"+tagRemove+"']");
            if(element && !element.disabled && element.nodeName == "IMG") {
                element.className = "toolbar_normal";
            }
        }
    }
    myTags = new Array();
    setFocus(document.all.req_message);
}
//--------------------------------------------
// function Pastecode
//--------------------------------------------
function Pastecode(myCode, myClose, singleTag, ignoreSel) {
    isClosed = true;
    if(ignoreSel != true) {
        ignoreSel = false;
    }
    var messageBox = document.getElementById("req_message"); ;
    if(msie && win && (vers >= 4)) {
        setFocus(messageBox);
        var seltext = document.selection;
        var range = seltext.createRange();
        if(ignoreSel != false) {
            range.collapse;
        }
        if(((seltext.type == "Text" || seltext.type == "None") && range != null) && ignoreSel != true) {
            if(myClose && range.text.length > 0) {
                myCode = myCode+range.text+myClose;
            } else {
                if(singleTag) {
                    isClosed = false;
                }
            }
            range.text = myCode;
        } else {
            messageBox.value += myCode;
        }
    }
    else if(moz) {
        var select_start = messageBox.selectionStart;
        var select_end = messageBox.selectionEnd;
        if(select_end <= 2) {
            select_end = messageBox.textLength;
        }
        var start = (messageBox.value).substring(0, select_start);
        var middle = (messageBox.value).substring(select_start, select_end);
        var end = (messageBox.value).substring(select_end, messageBox.textLength);
        if((messageBox.selectionEnd - messageBox.selectionStart > 0) && ignoreSel != true) {
            middle = myCode+middle+myClose;
        } else {
            if(singleTag) {
                isClosed = false;
            }
            middle = myCode+middle;
        }
        messageBox.value = start+middle+end;
    }
    else {
        messageBox.value += myCode;
        if(singleTag) {
            isClosed = false;
        }
    }
    setFocus(messageBox);
                
    return isClosed;
}
//--------------------------------------------
// function setFocus
//--------------------------------------------
function setFocus(formElement) {
    formElement.focus();
}
//--------------------------------------------
// function addsmilies 
//--------------------------------------------
function smilie(addemot)
{
    Pastecode(" " + addemot + " ", "", false);
}
//--------------------------------------------
// Script End
//--------------------------------------------

</script>

43

Re: punBB bbcode button MOD 1.0 released

10X thx. nasty error sign is gone!

page layout was broken little bit. i had to change html part of the code:

</select>
<tr>
<td>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<//-------------------------------------------->
<// if we need some bbcode buttons :)          >
<//-------------------------------------------->
<input type="button" class="punbutton" value="B" name='B' style="font-weight:bold" onClick="Pastebbcode('b')"> 
<input type="button" class="punbutton" value="I" name='I' style="font-style:italic" onClick="Pastebbcode('i')"> 
<input type="button" class="punbutton" value="U" name='U' style="text-decoration:underline" onClick="Pastebbcode('u')"> 
<input type="button" class="punbutton" value="List" name='list'  onClick="Pastebbcode('list')"> 
<input type="button" class="punbutton" value="Img" name='img'  onClick="Pastebbcode('img')"> 
<input type="button" class="punbutton" value="http://" name='http://'  onClick="Pastebbcode('url')"> 
<input type="button" class="punbutton" value="email" name='email'  onClick="Pastebbcode('email')"> 
<input type="button" class="punbutton" value="quote" name='quote'  onClick="Pastebbcode('quote')"> 
<input type="button" class="punbutton" value="code" name='code'  onClick="Pastebbcode('code')"> 
<input type="button" class="punbutton" value="close all tags" name='close all tags' onClick="closeAllTags()"> 
</td>
</tr>
</td>
</tr>
<//---------------------------------------------------->
<//but what if we need change radio button status :/   >
<//---------------------------------------------------->
<tr>
<td>
<small><input type="radio" name="mode" value="normal" onClick="changeMode('normal')"> Guided Mode  <input type="radio" name="mode"  value="advanced" onClick="changeMode('advanced')" checked> Normal Mode</small>
</td>
</tr>
</table>

44

Re: punBB bbcode button MOD 1.0 released

sorry, actually instead of

<input type="button" class="punbutton" value="close all tags" name='close all tags' onClick="closeAllTags()">
</td>
</tr>
</td>
</tr>

must be

<input type="button" class="punbutton" value="close all tags" name='close all tags' onClick="closeAllTags()">
</td>
</tr>

blaah.. tracking down missing or not needed tags is much easier when using utility like tidyhtml. big_smile

45

Re: punBB bbcode button MOD 1.0 released

Anyone that does know how to install this in punBB++, i dont like the BBCode buttons that is in there...

46 (edited by Maciek 2004-06-15 22:53)

Re: punBB bbcode button MOD 1.0 released

Meduza wrote:

Anyone that does know how to install this in punBB++, i dont like the BBCode buttons that is in there...

I don't see any problem to add this mod to punbb++ only few changes and should works :P . If you want i check and make guide how do this.

The best things in life are free*

* plus shipping and handling

[img]http://members.lycos.co.uk/maciekziolkowski/gmailsign.jpg[/img]

Re: punBB bbcode button MOD 1.0 released

anothertester wrote:

10X thx. nasty error sign is gone!

page layout was broken little bit. i had to change html part of the code:

have you copied out my all code and exchange old code with it?
your code is missing closing table tag, I think. so the layout looks broken. and you wiped out some code. instead please just copy my code and make it bb_code.php it will work well. I did at my site and it looks good.

I've tested just two sites whether the cookie is working well as we desire.

48

Re: punBB bbcode button MOD 1.0 released

jacobswell
Could you explain what to do with this code... step by step. What shoul I do in order to get this buttons. None of the links from previous page work (can't download any zip-files).
Thank you.

49

Re: punBB bbcode button MOD 1.0 released

Hi
Im very sorry about this but for now i can't share any of my mod's sad beacouse
i don't have any copy i lost it when my Hard drive is crash .But im really sure someone else can give u a copy .

The best things in life are free*

* plus shipping and handling

[img]http://members.lycos.co.uk/maciekziolkowski/gmailsign.jpg[/img]

50

Re: punBB bbcode button MOD 1.0 released

Yes, I would be glad if someone sends me this mod... Here is my e-mail: gavrilov@degunino.net
Or give a link where I can download it... I really need it...