vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Show Thread Enhancements - dbd Truncate Quotes (https://vborg.vbsupport.ru/showthread.php?t=243424)

deadbydawn 05-26-2010 10:00 PM

dbd Truncate Quotes
 
1 Attachment(s)
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
  1. 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.
  2. Import product-dbd_truncate_quotes.xml into Product Manager. Set Allow Overwrite to Yes if upgrading.
  3. 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:
    Code:

                    <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:
    Code:

                    <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:

    Code:

            <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>

  4. Go to vbulletin options, scroll down to dbd Truncate Quotes, change the default settings if necessary
  5. 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. 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:
    Code:

    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:
Code:

<vb:if condition="$vboptions['dbd_tq_enabled'] == 1">
Replace with:
Code:

<vb:if condition="$vboptions['dbd_tq_enabled'] == 1"><vb:if condition="$bbuserinfo['field12'] == Enabled">
Find the close of the if at the bottom:
Code:

</vb:if>
Replace it with:
Code:

</vb:if></vb:if>
Complete example using the self-hosted method:

Code:

                <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

Quote:

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

Quote:

Originally Posted by furst (Post 2054250)
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:

Code:

                <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:

Code:

                <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
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/showthrea...237650&page=10

Is there any way to solve it?


All times are GMT. The time now is 07:00 AM.

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.01379 seconds
  • Memory Usage 1,763KB
  • 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
  • (12)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete