Back to vBulletin 3.6 Add-ons

Collapsable First Post using AJAX (or Last Post!)
Mod Version: 1.2.1, by magnus

This modification is in the archives.
vB Version: 3.6.8 Rating: (59 votes - 4.83 average) Installs: 412
Released: 18 Apr 2007 Last Update: 27 Apr 2007 Downloads: 2529
Not Supported Uses Plugins Auto-Template Additional Files  


NOTICE: This is for vBulletin v3.6 ONLY. You can find a v3.5 compatible version here.


*** Confirmed working on ALL vBulletin 3.6.x versions! ***



Keywords: FORUMDISPLAY, search, results, collapse, AJAX, collapsable, first, last, unread, post

Description:
Allows you to expand/collapse the first, last or first unread post of a thread from FORUMDISPLAY and search results without the need to load the entire thread.

Details:
Upon perusing the wonderful deals over at http://www.slickdeals.net, I noticed this nifty feature which caught my eye. I found it quite useful as most people have a bad habit of not being very descriptive with their thread titles. This little trick made my browsing experience much more enjoyable, so naturally I had to borrow [read: shamelessly rip] the idea.

Please note that no additional queries are added, unless using the 'First Unread Post' option. Otherwise, the only queries performed are the same as those when a thread is normally viewed.

The magic behind this modification is performed by http://jquery.com/.



Usage:
Simply click the expand icon [+] in front of the thread title to expand, and the collapse icon [-] to collapse. Rocket science, eh?



Installation:
  1. Download and unzip the ajax_first_post.zip archive.
  2. Upload necessary files to their respective locations. (Attention custom style users! Be sure to upload the images to your custom image directory.)
  3. Import the product-ajax_first_post.xml via the Product Manager.
  4. Make any desired configuration changes via AdminCP > vBulletin Options > Collapsable First Post using AJAX
  5. ???
  6. Profit!

Notes:
All template modifications are made automatically. They attach to pretty common text locations, so modified styles shouldn't* be a problem.

However, for those who wish (or need) to perform the edits manually, you can find that information here

Spoiler (click to open)


For those who have problems with the automatic template edits, or who just like to do things the hard way, here are the template edits required:

First, disable the automatic template edits:
  • Browse to AdminCP > vBulletin Options > Collapsable First Post Using AJAX Options
  • Select No for Enable Automatic Template Editing

Now perform the following template edits:

In FORUMDISPLAY -

FIND:
HTML Code:
$headinclude
ADD AFTER:
HTML Code:
<script type="text/javascript" src="clientscript/jquery.js"></script>
<script type="text/javascript" src="clientscript/vbulletin_vbpost.js"></script>



In search_results -

FIND:
HTML Code:
$headinclude
ADD AFTER:
HTML Code:
<script type="text/javascript" src="clientscript/jquery.js"></script>
<script type="text/javascript" src="clientscript/vbulletin_vbpost.js"></script>



[CHANGED IN 1.2] In threadbit -

FIND: (should be the first line)
HTML Code:
<tr>
REPLACE WITH:
HTML Code:
<tr<if condition="empty($ajax_firstpost_excluded) || !in_array($forumid, $ajax_firstpost_excluded)"> <if condition="$vbulletin->options['ajax_firstpost_firstlast']">id="vbpostrow_$thread[lastpostid]"<else />id="vbpostrow_$thread[firstpostid]"</if></if>>

FIND:
HTML Code:
		$thread[title_editable]
		<div>
ADD AFTER:
HTML Code:
				<if condition="empty($ajax_firstpost_excluded) || !in_array($forumid, $ajax_firstpost_excluded)"><img id="vbpostimg_<if condition="$vbulletin->options['ajax_firstpost_firstlast']">$thread[lastpostid]<else />$thread[firstpostid]</if>" src="$stylevar[imgdir_button]/expand.gif" onclick="return vbpost_get(<if condition="$vbulletin->options['ajax_firstpost_firstlast']">$thread[lastpostid]<else />$thread[firstpostid]</if>)" onMouseOver="this.style.cursor='pointer';" /></if>

Close
.



Comments:
As with all my hacks, this modification is provided free of charge. However, if you find this product useful and have money burning a hole in your pocket, feel free to make a small https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=magn2o%40comcast%2enet&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8, I won't mind.. really.

Version History:
  • 1.0.0 - Initial release, here's to hoping...
  • 1.1.0
    • Fixed JavaScript errors when using search.
    • Resolved (known) cross browser compatibility issues.
  • 1.2.0
    • New AdminCP configuration options:
      • Ability to select first or last post to be displayed.
      • Ability to disable on a per forum basis.
      • Option to update thread views when expanded.
      • Option to disable automatic template editing with a single click.
    • Tweaked a couple plugins to prevent unnecessary checking.
    • Properly registers in Who's Online
  • 1.2.1
    • Will no longer show expand icon next to thread redirects.
    • Added ability to display first unread post.
    • Completely revamped the automatic template editing system. Should now be able to make template edits to even the most modified templates as well.
    • Fixed a couple non-breaking typos.
    • Included JavaScript in USERCP_SHELL to allow expand/collapse of subscribed threads.
    • Added a hover title to the expand icon to inform the user what they can expect when clicking it.



Tips, Tricks and Modifications:
  • Fix for users of passiveVid receiving Warning: Invalid argument supplied for foreach() in /includes/class_postbit.php(296) : eval()'d code on line [#]

    Spoiler (click to open)


    Quote by haris_led
    i have the same problem. when passivevid is enabled, i get
    Code:
    Warning
    : Invalid argument supplied for foreach() in
    /includes/class_postbit.php(296) : eval()'d code
    on line
    39
    Ok, here's a fix. This is for passiveVid - (YouTube, Myspace, Google...) Not BBCODE users ONLY.

    In AdminCP > Plugins & Products > Plugin Manager, look for passiveVid - Showthread Replacement under Product : passiveVid and select [Edit].

    FIND:
    PHP Code:
                   foreach ($passiveVid as $k => $v) {
                       if ( 
    $this->registry->options['passiveVid_sites'] & $v['id'] ) {
                           
    $this->post['message'] = preg_replace_callback($v['string'],create_function('$matches',$v['replacement']),$this->post['message']);
                           
                       }
                   } 
    REPLACE WITH:
    PHP Code:
                   if ($passiveVid) {
                       foreach (
    $passiveVid as $k => $v) {
                           if ( 
    $this->registry->options['passiveVid_sites'] & $v['id'] ) {
                               
    $this->post['message'] = preg_replace_callback($v['string'],create_function('$matches',$v['replacement']),$this->post['message']);
                           
                           }
                       }
                   } 

    Disclaimer:
    Note that this was tested on my development board. I do not actively use passiveVid (or any video embedding tools) so I cannot be held responsible for any undesired effects that may occur as a result of making these changes.

    That being said, the changes simply check for the existence of a variable. There are no destructive functions being added or implemented, however, I just like to cover my rear.

    Close


Currently Known Bugs:
  • None

* Please note that this modification was developed on a forum with a userbase of 1 (myself). I've tested it for basic functionality but I cannot guarantee functionality or behavior on your forum. So, please -- make backups before installing this product!

Download

This modification is archived, downloads are still allowed.

File Type: %1$s ajax_first_post.zip (28.1 KB, 2295 downloads)

Screenshots

Click image for larger version
Name:	ajax_firstpost_ss01.jpg
Views:	4638
Size:	21.5 KB
ID:	63321   Click image for larger version
Name:	ajax_firstpost_ss02.jpg
Views:	5517
Size:	38.6 KB
ID:	63322  

Similar Mods

Collapsable First Post using AJAX for vB3.5 vBulletin 3.5 Add-ons

vblts.ru supports vBulletin®, 2022-2024