PDA

View Full Version : Show Thread Enhancements - dbd Truncate Quotes


deadbydawn
05-26-2010, 10:00 PM
About this product
Many times it is convenient to quote someone's reply so that they know the comment is directed at them, however this can become tedious if someone happens to be longwinded. Other times, the replying user simply doesn't understand the difference and quotes someone unnecessarily. Regardless, it leads to a lot of wasted screen space for everyone else to skip over.

That's where this product comes in. Using jQuery, it will automatically truncate quotes to a defined length and replace the remaining text with a "Read More" link. This is all done clientside, so no actual changes are being made to the html (and so it shouldn't affect anything with SEO). When the viewer clicks the read-more link, the div automatically expands showing the rest of the quoted text.

Product Installation breakdown

Files to Edit: 0
Templates to Edit: 1
Files to Upload: 2 (optional)
Time to Install: 1 minute


Installation instructions

Decide if you want to host the jquery scripts yourself, or if you would rather use google's CDN. I recommend the self hosted option, but it's your choice.

1a) self hosted: upload the contents of the upload_via_ftp/ folder to your vb_root/clientscript/ directory
jquery-1.4.2.min.js -> /clientscript/
jquery.jtruncate.pack.js -> /clientscript/

1b) cdn: nothing.

Import product-dbd_truncate_quotes.xml into Product Manager. Set Allow Overwrite to Yes if upgrading.
Go to template editor and add the following to the end of your headinclude_bottom template depending upon your decision from step 1.

3a) self hosted: add this to the top of the edit you are about to make in the mandatory section below:
<vb:if condition="$vboptions['dbd_tq_enabled'] == 1">
<script type="text/javascript" src="/clientscript/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/clientscript/jquery.jtruncate.pack.js"></script>

3b) cdn: add this to the top of the edit you are about to make in the mandatory section below:
<vb:if condition="$vboptions['dbd_tq_enabled'] == 1">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://jtruncate.googlecode.com/svn/trunk/jquery.jtruncate.js"></script>


MANDATORY STEP: Now that you have made a choice between 3a or 3b, paste that code into the template followed by this right below it:

<script type="text/javascript">
jq=jQuery.noConflict();
jq(document).ready(function(){
jq('.message').jTruncate({
length: {vb:raw vboptions.dbd_tq_length},
minTrail: {vb:raw vboptions.dbd_tq_minTrail},
moreText: "{vb:raw vboptions.dbd_tq_moreText}",
lessText: "{vb:raw vboptions.dbd_tq_lessText}",
ellipsisText: "{vb:raw vboptions.dbd_tq_ellipsisText}",
moreAni: '{vb:raw vboptions.dbd_tq_moreAni}',
lessAni: '{vb:raw vboptions.dbd_tq_lessAni}'
});
});
</script>
</vb:if>

Go to vbulletin options, scroll down to dbd Truncate Quotes, change the default settings if necessary
Click Installed :D

deadbydawn
05-27-2010, 08:34 PM
Reserved

deadbydawn
05-27-2010, 10:50 PM
For my own site, I have implemented a UserCP option to allow the user to opt-out of this modication. You never know how old the users computer might be, and while jQuery is very lightweight and shouldn't cause any problems, you just never know.

I apologize for not making this a part of the Product Install automated process, but so far I've gotten no answers to my query of how to do so (https://vborg.vbsupport.ru/showthread.php?t=243413). As soon as I find out, I'll gladly update the product!


Go to AdminCP -> User Profile Fields -> Add New User Profile Field
Profile Field Type: Single-Selection Radio Buttons
Title: Enable Truncate Quotes
Description: Turn the Quotes Truncation system on/off
Options:
Enabled
Disabled
Set Default: Yes
Display Order: 8
Field Required: No
Field Editable by User: Yes
Private Field: Yes
Field Searchable on Members List: No
Show on Members List: No
Allow Users to input their own value for this option: No
Which page displays this option: Options: Thread Viewing
Save


Take note of the "name" of the new Field after you click save. Mine, for example, is "field12".

Go to AdminCP->Styles & Templates->Style Manager->Edit your styles Templates
Edit headinclude_bottom
Find the line: <vb:if condition="$vboptions['dbd_tq_enabled'] == 1">
Replace with: <vb:if condition="$vboptions['dbd_tq_enabled'] == 1"><vb:if condition="$bbuserinfo['field12'] == Enabled">

Find the close of the if at the bottom: </vb:if>
Replace it with: </vb:if></vb:if>

Complete example using the self-hosted method:

<vb:if condition="$vboptions['dbd_tq_enabled'] == 1">
<vb:if condition="$bbuserinfo['field12'] == Enabled">
<script type="text/javascript" src="/clientscript/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/clientscript/jquery.jtruncate.pack.js"></script>
<script type="text/javascript">
jq=jQuery.noConflict();
jq(document).ready(function(){
jq('.message').jTruncate({
length: {vb:raw vboptions.dbd_tq_length},
minTrail: {vb:raw vboptions.dbd_tq_minTrail},
moreText: "{vb:raw vboptions.dbd_tq_moreText}",
lessText: "{vb:raw vboptions.dbd_tq_lessText}",
ellipsisText: "{vb:raw vboptions.dbd_tq_ellipsisText}",
moreAni: '{vb:raw vboptions.dbd_tq_moreAni}',
lessAni: '{vb:raw vboptions.dbd_tq_lessAni}'
});
});
</script>
</vb:if></vb:if>

And now your users have the option to decide for themselves :D

furst
06-15-2010, 11:00 PM
Go to template editor and add the following to the end of your headinclude_bottom template depending upon your decision from step 1.

3a) self hosted: add this to the top of your edit:im confused, am i adding this edit to the top or bottom/end? first you say to add the following to the end of your headinclude_bottom template then 3a) says add to the top

Which one is it? just a bit confused here.

Also am i adding the other larger edit to the end of 3a) or bottom of the headinclude_bottom template?

OlijO
08-02-2010, 08:01 AM
im confused, am i adding this edit to the top or bottom/end? first you say to add the following to the end of your headinclude_bottom template then 3a) says add to the top

Which one is it? just a bit confused here.

Also am i adding the other larger edit to the end of 3a) or bottom of the headinclude_bottom template?

Agree, it's a little confused and seams to doesn't work for me

deadbydawn
10-27-2010, 05:58 PM
My apologies for the confusion (and the delayed response). What I was trying to say there is that you will need to add either 3a or 3b to the top of the mandatory part of step 3 (which I will try to make clearer above).

So, if you were going to host it yourself, your edit to the END of the headinclude_bottom would be:


<vb:if condition="$vboptions['dbd_tq_enabled'] == 1">
<script type="text/javascript" src="/clientscript/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/clientscript/jquery.jtruncate.pack.js"></script>
<script type="text/javascript">
jq=jQuery.noConflict();
jq(document).ready(function(){
jq('.message').jTruncate({
length: {vb:raw vboptions.dbd_tq_length},
minTrail: {vb:raw vboptions.dbd_tq_minTrail},
moreText: "{vb:raw vboptions.dbd_tq_moreText}",
lessText: "{vb:raw vboptions.dbd_tq_lessText}",
ellipsisText: "{vb:raw vboptions.dbd_tq_ellipsisText}",
moreAni: '{vb:raw vboptions.dbd_tq_moreAni}',
lessAni: '{vb:raw vboptions.dbd_tq_lessAni}'
});
});
</script>
</vb:if>



And if you went with option b, CDN hosted, it would be:


<vb:if condition="$vboptions['dbd_tq_enabled'] == 1">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://jtruncate.googlecode.com/svn/trunk/jquery.jtruncate.js"></script>
<script type="text/javascript">
jq=jQuery.noConflict();
jq(document).ready(function(){
jq('.message').jTruncate({
length: {vb:raw vboptions.dbd_tq_length},
minTrail: {vb:raw vboptions.dbd_tq_minTrail},
moreText: "{vb:raw vboptions.dbd_tq_moreText}",
lessText: "{vb:raw vboptions.dbd_tq_lessText}",
ellipsisText: "{vb:raw vboptions.dbd_tq_ellipsisText}",
moreAni: '{vb:raw vboptions.dbd_tq_moreAni}',
lessAni: '{vb:raw vboptions.dbd_tq_lessAni}'
});
});
</script>
</vb:if>


I hope that helps!

Ig@r
09-17-2013, 03:54 PM
It's working with 4.2
*Installed*
Thanks

Ig@r
09-18-2013, 01:17 PM
My forum is not in the root directory so had to change path in the code
<script type="text/javascript" src="/forum/clientscript/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/forum/clientscript/jquery.jtruncate.pack.js"></script>

blue7
08-27-2015, 10:51 AM
It cause problem with this plugin (Image Resizer - Using nCode Script): https://vborg.vbsupport.ru/showthread.php?t=237650&page=10

Is there any way to solve it?