Nov 21, 2009

Forum post templates! - Using javascript

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > How-To's and Tutorials > Programming > Client Side Scripting > Javascript

Forum post templates! - Using javascript

Hercco
I guess I'll better start by explaining by what I mean by these post templates.

The idea came to me as one online-friend of mine has a habit of posting all his posts with same colour on a certain forum. We had previously talked how it would be cool if vBulletin (in this case) would have option to save a "post template" which it would automatically load to textarea everytime a new reply or thread is posted.

Well as it is not implemented on the server side, why not do it clientside! What you may have not realized is that "bookmark toolbar" or "personal bar" bookmarks (the links usually at the top of your browser window, below location field) can be used quite similarly as links on an html-page. And thus can be used to execulte Javascript.

So simply create a new "personal bar" (or whatever, depending on your browser) link and paste one of the following codes into the "location" field. And naturally make your changes before saving it.



This is for vBulletin:
CODE
javascript: window.document.vbform.message.value='[color=Burlywood]'+window.document.vbform.message.value+'[/color]';window.stop();


For phpBB:

CODE
javascript: window.document.post.message.value='[color=Burlywood]'+window.document.post.message.value+'[/color]';window.stop();


And for Invision:

CODE
javascript: window.document.REPLIER.Post.value='[color=Burlywood]'+window.document.REPLIER.Post.value+'[/color]';window.stop();



Even if you are not familiar with javascript you can probably understand what these scripts fo. they simply add "" in front and "" after the contents of the message.

Naturally you can change the contents anyway you want to make it add any tags and text you want there. For example some ASCII art would be quite neat at the beginning or end of all your posts.

For those who do not know JS: you can use '\n' to make line change and '\t' for tabulation.


One annoying thing about this is that, if you want to use same template for different forums using different forums software you will have to have separate links for each. One way to get around this could be writing a script that checks which elements exists and adds the template to the one that's real.


Hopefully someone will find this useful.

 

 

 


Comment/Reply (w/o sign-up)

lxcid
definitely a nice tutorial and idea... could really be expanded... i like this idea alot... but i have a question... how do actually make a personal bar in ie and do this? actually the reason i wanted to understand this is becuz i wanted to make a forum like software comparable to vbulletin in near future... i dunno if i would succeed or nt but its the first piority in my mine right now after i complete my exam... so something like this for my forum would be an excellent... or an advantage... smile.gif and can make my forum more customizable... and flexible... or wadever it is... could u explain the steps in detail? smile.gif thank u in advance... smile.gif its so cool...

Comment/Reply (w/o sign-up)

Hercco
I think the easiest was is to make a link in HTML page and simply drag it to the bar.

And about your own forum, why not make it server side? Allow users to change their template from a user control panel and possibly a button in the posting page for adding template to post.

Other neat trick with personal bar links and javascript is is grabbing information of a website. I have a links database system at my website (here) and to add links I use a button at browser personal bar.

What is does is grabs the sites that I am on title and url and simply with window.open() opens a new window for which it requests a PHP page with the page url and title as get variables (eg. quicklink.php?url=<url_here>&title=<title_here> ). The php page (quicklink.php) processes the get data and adds them as default values to a form. Then I just make my changes, write a description of the site and hit submit and the link appears to the database.

Comment/Reply (w/o sign-up)

lxcid
wow... thats very handy tool! i gonna pick up javascript after my java and jsp... lolz... anyway... i dunno whether i gonna put it in server side becuz that gonna eat up some database if i gonna let people do have this option... i dunno... but having it as an option is better den not having it i guess... lolz... tks man... this is very very cool...

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : forum, post, templates, javascript

  1. Conditional Statements Of Javascript
    Tutorial for beginers (1)
  2. Javascript Operators
    (0)
    In this part of the tutorial, we will discuss about JavaScript Arithmetic Operators, JavaScript
    Assignment Operators, Comparison Operators, Logical operators and conditional operator. +, -, *, /
    etc are the JavaScript Arithmetic Operators. =, +=, -= etc are the JavaScript Assignment Operators.
    ==, != etc are the Comparison Operators and “&&”, “||” etc are the Logical
    operators. Arithmetic operators are used to perform arithmetic between variables and/or values and
    Assignment operators are used to assign values to JavaScript variables. Comparison o....
  3. Javascript Tutorial For Beginner
    Using Javascript in HTML page (0)
    In this tutorial I will show you how you can put JavaScript in a HTML page. It is very easy to add
    JavaScript in a HTML page. We will use tag for this purpose. Inside the tag, we will use "type="
    attribute and will define the scripting language. We will define the script language as
    “text/javascript”. After define the script language we will add our JavaScript codes and
    at last we will close the tag using . So the complete code will be- CODE (Place for our
    JavaScript codes) Now we will use “document.write” command (it i....
  4. Is Their A Free Or Express Program To Help Make Javascript, Or How Do I Do It.
    i want to make javascript but dont know how. (0)
    can someone direct me to a free program that will help me make java script, or maybe just tell me
    how? ....
  5. Javascript SSI- Blocking Internet Protocols
    Blocking Internet Protocals from site (2)
    Hello, i thought this would be interesting since i haven't discussed Javascript in years.
    SSI(Server Side Includes) can be used for many interesting things...many of which deal with
    connection information and such. A few years ago i was working on something for the Counter-Strike
    Blacklist when it existed. It was a project i was making for a site called CS anti-hack Community.
    This was going to be an all web-based security project to basically not allow any IP currently on
    the blacklist to preceed to any site that wanted to be a part the anti-hack community. Well....
  6. Garmon's Javascript #1 - Simple Object Database
    Learn basic Object-Oriented Programming (1)
    Okay, so you're like me - you've heard about OOP or Object Oriented Programming and wonder
    what all the hOOPlah is about! So here's the straight pOOP. Okay, sorry for the stOOPid puns.
    I'll stop now. Honestly, I will. OOPs I did it again. Right. Here's the scenario: we have
    an online store, we want to maintain a database of our products, and we want to be able to access
    them. This tutorial shows how this can be done, with very simple, commented code. Please note, that
    I'm not recommending that you use JavaScript to store your actual product dat....

    1. Looking for forum, post, templates, javascript

See Also,

*SIMILAR VIDEOS*
Searching Video's for forum, post, templates, javascript
advertisement



Forum post templates! - Using javascript

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com