vBulletin Modifications

Need to find a variable...

Welcome to vBHackers.com! - vBHackers Updates:

Go Back   vBulletin Modifications > General vBulletin Section > General vBulletin Support

Reply
 
LinkBack Thread Tools
Old 10-18-2006, 12:42 PM   #1
vB User
Join Date: Aug 2006
Real Name: Samantha
Samantha is on a distinguished road

Default Need to find a variable...

My idea is to realize a hack that says how many characters a post contains while you are writing it down, in other words a counter that says something like this:

Yuo can still use: xxx characters in you post!


Do you think this can be done? What variables are involved in this process? I mean where the total number of characters and the actual number of characters are stored?


Thank you!

Samantha




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 10-22-2006, 06:04 AM   #2
vBulletin Guru
Nick R's Avatar
Join Date: May 2006
Real Name: Nick
Location: Cyberspace, UK
Nick R is on a distinguished road

Default

Well, you need to do it in JS and it's pretty easy, you just need to check the length of the string inside the textbox. Then compare it with a variable from vB which you put in the JS code in the template. Then it should work dynamically. Seeing as JS isn't my expertise all I can tell you is what you need to do as I don't know the function names though they could be the same. You'll have to give me a few minutes.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-22-2006, 06:21 AM   #3
vB User
Join Date: Aug 2006
Real Name: Samantha
Samantha is on a distinguished road

Default

Quote:
Originally Posted by rogersnm
... You'll have to give me a few minutes.
First of all thank you so much for your time, you are always so kind to me :embarrass
Just take all the time you need I have no hurry at all ;)


Regards
Samantha




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-22-2006, 06:34 AM   #4
vBulletin Guru
Nick R's Avatar
Join Date: May 2006
Real Name: Nick
Location: Cyberspace, UK
Nick R is on a distinguished road

Default

right well the solution I came up with:

Go into showthread_quickreply and find:
Quote:
<div class="controlbar">
directly above add:
Quote:
<script type="text/javascript">
<!--
function charactersleft(source, limit, target)
{
var difference = limit-source.length;
if (difference < 0)
{
document.getElementById(target).innerHTML = "You have no characters left";
} else {
document.getElementById(target).innerHTML = "You have "+difference+" characters left";
}
}
//-->
</script>
then find:
Quote:
id="{$editorid}_textarea"
Note: there should be 2 instances. And replace with:
Quote:
onkeyup="charactersleft(this.value, {$vbulletin->options[postmaxchars]}, 'quickreply_charsleft')" id="{$editorid}_textarea"
Now you have it working, there is one more thing you must add.
Quote:
<span id="quickreply_charsleft">
</span>
You can put that anywhere in the template.

NOTE: there is a little bug in vB which for some reason is adding a space in "this.value" there should be no space.

Last edited by Nick R; 10-22-2006 at 06:42 AM..




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-22-2006, 06:54 AM   #5
vBulletin Guru
Nick R's Avatar
Join Date: May 2006
Real Name: Nick
Location: Cyberspace, UK
Nick R is on a distinguished road

Default

actually I can't find a single place where this will work where as it works fine on it's own. Something in vB is totally messing this up.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-22-2006, 01:21 PM   #6
vB User
Join Date: Aug 2006
Real Name: Samantha
Samantha is on a distinguished road

Default

Infact it doesn't work Thank you anyway!




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-22-2006, 01:54 PM   #7
vBulletin Guru
Nick R's Avatar
Join Date: May 2006
Real Name: Nick
Location: Cyberspace, UK
Nick R is on a distinguished road

Default

No, it does work just not with vB. Get vb's text area and the code I gave you and put them together. It works perfectly :S




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-24-2006, 10:09 AM   #8
vB User
Join Date: Aug 2006
Real Name: Samantha
Samantha is on a distinguished road

Default

Thanks rogersnm will give this a try ;)




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Where to find some graphics.... BigJohnny General vBulletin Support 2 08-16-2006 07:09 PM
Truncate Variable Nick R General vBulletin Discussion 8 08-03-2006 06:11 PM
Post variable not working.. Nick R General vBulletin Support 3 07-27-2006 11:44 AM
Using a vBulletin variable somewhere else, like in PhotoPost Classifieds franklin General vBulletin Support 0 07-13-2006 12:12 PM
Cron Job Variable Nick R General vBulletin Support 4 07-06-2006 02:11 PM


All times are GMT -3. The time now is 09:20 PM.

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc. (Patent Pending)