vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Instant smilies&vb code hack ! (https://vborg.vbsupport.ru/showthread.php?t=3779)

10-08-2000 06:24 PM

Hello,

Wondring how to add the "instant smilies" and "instant vb code" in my forums when the user is posting a new topic?
Like in "OpenTopic" from infopop.com

Any help is appreciated :)

10-08-2000 09:12 PM

You don't need a "hack" for this. You can do this in your templates. Simply edit the templates for the different forms and add javascript to add the different codes and smilies into the message when clicked on.

10-08-2000 09:16 PM

Thanks wluke :)

would you mind tel me what javascript code should I use?
I am not that good in javascripts !

Thanks again

10-09-2000 02:41 AM

Ok,I got the javascript for that

If I wanna add the script to the template "newthread" under the options.I need to add buttons and php code of course !
How can I do this without missing up my forums?

Any help is greatfull

10-09-2000 12:29 PM

Just stick it right in there and see what happens really. Backup the template to be safe and it something goes wrong, restore the backed up template right away.

10-09-2000 03:06 PM

Care to post the Javascript for the rest of us ? :)

Have you had any luck getting it working yet ?

10-09-2000 04:26 PM

Ok,here is what I did:

First,I created a small table where I want my buttons and smili faces to be in the template "newthread",then,I added this javascript in the table:

Code:

<a href="javascript: x()" onClick="DoSmilie(' :!) ');"><img width="15" height="15" src="YourSmilieURLHere" border="0" alt="smile"></a>
  ?
  <a href="javascript: x()" onClick="DoSmilie(' :!( ');"><img width="15" height="15" src="YourSmilieURLHere" border="0" alt="frown"></a>
  ?
  <a href="javascript: x()" onClick="DoSmilie(' :!o ');"><img width="15" height="15" src="YourSmilieURLHere" border="0" alt="redface"></a>
  ?
  <a href="javascript: x()" onClick="DoSmilie(' :!D ');"><img width="15" height="15" src="YourSmilieURLHere" border="0" alt="biggrin"></a>
  ?
  <a href="javascript: x()" onClick="DoSmilie(' ;!) ');"><img width="15" height="15" src="YourSmilieURLHere" border="0" alt="wink"></a>
<br>
<a href="javascript: x()" onClick="DoSmilie(' :!p ');"><img width="15" height="15" src="YourSmilieURLHere" border="0" alt="tongue"></a>
  ?
  <a href="javascript: x()" onClick="DoSmilie(' :!cool: ');"><img width="15" height="15" src="YourSmilieURLHere" border="0" alt="cool"></a>
  ?
  <a href="javascript: x()" onClick="DoSmilie(' :!rolleyes: ');"><img width="15" height="15" src="YourSmilieURLHere" border="0" alt="rollyeyes"></a>
  ?
  <a href="javascript: x()" onClick="DoSmilie(' :!mad: ');"><img width="15" height="15" src="YourSmilieURLHere" border="0" alt="mad"></a>
  ?
  <a href="javascript: x()" onClick="DoSmilie(' :!eek: ');"><img width="15" height="15" src="YourSmilieURLHere" border="0" alt="eek"></a>
<br>
<a href="javascript: x()" onClick="DoSmilie(' :!confused: ');"><img width="15" height="22" src="YourSmilieURLHere" border="0" alt="confused"></a>
  ?
</TD><TD valign="top" align="right"><a href="javascript: x()" onClick="DoPrompt('url');"><img src="YourButtonURLHere" width="75" height="20" border="0" alt="Add URL"></a>
 ?
 <a href="javascript: x()" onClick="DoPrompt('email');"><img src="YourButtonURLHere" width="75" height="20" border="0" alt="Add e-mail address"></a>
<br>
<a href="javascript: x()" onClick="DoPrompt('bold');"><img src="YourButtonURLHere" width="75" height="20" border="0" alt="Bold"></a>
  ?
  <a href="javascript: x()" onClick="DoPrompt('italics');"><img src="YourButtonURLHere" width="75" height="20" border="0" alt="Italic"></a>
<br>
<a href="javascript: x()" onClick="DoPrompt('quote');"><img src="YourButtonURLHere" width="75" height="20" border="0" alt="Quote"></a>
  ?
  <a href="javascript: x()" onClick="DoPrompt('code');"><img src="YourButtonURLHere" width="75" height="20" border="0" alt="Code"></a>
<br>
<a href="javascript: x()" onClick="DoPrompt('liststart');"><img src="YourButtonURLHere" width="75" height="20" border="0" alt="list_start"></a>
 ?
  <a href="javascript: x()" onClick="DoPrompt('listitem');"><img src="YourButtonURLHere" width="75" height="20" border="0" alt="list_items"></a>
<br>
<a href="javascript: x()" onClick="DoPrompt('listend');"><img src="YourButtonURLHere" width="75" height="20" border="0" alt="list_end"></a>
 ?
<a href="javascript: x()" onClick="DoPrompt('image');"><img src="YourButtonURLHere" width="75" height="20" border="0" alt="Add image"></a>

--------
NOTE: please take the exclamation marks off from the tags above
---------

10-09-2000 04:27 PM

Then added this javascript at the top of the template right after the </title> tag :

Code:

<script language="JavaScript"><!--
               
                function x () {
                return;
                }
               
                function DoSmilie(addSmilie) {

        var addSmilie;
        var revisedMessage;
        var currentMessage = document.REPLIER.MESSAGE_BODY.value;
        revisedMessage = currentMessage+addSmilie;
        document.REPLIER.MESSAGE_BODY.value=revisedMessage;
        document.REPLIER.MESSAGE_BODY.focus();
        return;
        }
       
        function DoPrompt(action) {
        var revisedMessage;
        var currentMessage = document.REPLIER.MESSAGE_BODY.value;

       
        if (action == "url") {
        var thisURL = prompt("Type Full URL", "http://");
        var thisTitle = prompt("Type a word to present the URL", "web page");
var urlvBCode = ""+thisTitle+"";
        revisedMessage = currentMessage+urlvBCode;
        document.REPLIER.MESSAGE_BODY.value=revisedMessage;
        document.REPLIER.MESSAGE_BODY.focus();
        return;
        }
       
        if (action == "email") {
        var thisEmail = prompt("Type Full e-maill address", "");
        var emailvBCode = ""+thisEmail+"";
        revisedMessage = currentMessage+emailvBCode;
        document.REPLIER.MESSAGE_BODY.value=revisedMessage;
        document.REPLIER.MESSAGE_BODY.focus();
        return;
        }
       
        if (action == "bold") {
        var thisBold = prompt("Type the text you want it Bold", "");
        var boldvBCode = ""+thisBold+"";
        revisedMessage = currentMessage+boldvBCode;
        document.REPLIER.MESSAGE_BODY.value=revisedMessage;
        document.REPLIER.MESSAGE_BODY.focus();
        return;
        }
       
        if (action == "italics") {
        var thisItal = prompt("Type the text you want it Italic", "");
        var italvBCode = ""+thisItal+"";
        revisedMessage = currentMessage+italvBCode;
        document.REPLIER.MESSAGE_BODY.value=revisedMessage;
        document.REPLIER.MESSAGE_BODY.focus();
        return;
        }
       
        if (action == "image") {
        var thisImage = prompt("Type the Full URL for your image", "http://");
        var imagevBCode = "[IMG!]"+thisImage+"[/IMG!]";
        revisedMessage = currentMessage+imagevBCode;
        document.REPLIER.MESSAGE_BODY.value=revisedMessage;
        document.REPLIER.MESSAGE_BODY.focus();
        return;
        }
       
        if (action == "quote") {
        var quotevBCode = "[QUOTE!]  [/QUOTE!]";
        revisedMessage = currentMessage+quotevBCode;
        document.REPLIER.MESSAGE_BODY.value=revisedMessage;
        document.REPLIER.MESSAGE_BODY.focus();
        return;
        }
       
        if (action == "code") {
        var codevBCode = "[CODE!]  [/CODE!]";
        revisedMessage = currentMessage+codevBCode;
        document.REPLIER.MESSAGE_BODY.value=revisedMessage;
        document.REPLIER.MESSAGE_BODY.focus();
        return;
        }

        if (action == "liststart") {
        var liststartvBCode = "[LIST!]";
        revisedMessage = currentMessage+liststartvBCode;
        document.REPLIER.MESSAGE_BODY.value=revisedMessage;
        document.REPLIER.MESSAGE_BODY.focus();
        return;
        }
       
        if (action == "listend") {
        var listendvBCode = "[/LIST!]";
        revisedMessage = currentMessage+listendvBCode;
        document.REPLIER.MESSAGE_BODY.value=revisedMessage;
        document.REPLIER.MESSAGE_BODY.focus();
        return;
        }
                if (action == "listitem") {
        var thisItem = prompt("Type the "list_items" here and make sure you close the code with"list_end"", "");
        var itemvBCode = "[*]"+thisItem;
        revisedMessage = currentMessage+itemvBCode;
        document.REPLIER.MESSAGE_BODY.value=revisedMessage;
        document.REPLIER.MESSAGE_BODY.focus();
        return;
        }
       
        }
          //--></script>

-------------
NOTE: please take off the exclamation marks from the tags above !
-------------

Everything went fine so far.However,when I clicked on the smili face or any of the buttons it give me this script error :
----------------
Internet Explorer Script Error
-------------------------
An error has occurred in the script on this page.

Error: 'document.REPLIER.MESSAGE_BODY'is not an object
-----------------
How can I get rid of this now?? :(

10-09-2000 04:28 PM

Does some one have a url where I can see this.

Thanks,
Brian

10-12-2000 04:38 PM

Has anyone got this up and running yet ?


All times are GMT. The time now is 07:12 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01049 seconds
  • Memory Usage 1,766KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete