vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Collapsable First Post using AJAX for vB3.5 (https://vborg.vbsupport.ru/showthread.php?t=145812)

magnus 04-25-2007 10:00 PM

Collapsable First Post using AJAX for vB3.5
 
[hr]-[/hr]
NOTICE: This is for vBulletin v3.5 ONLY. You can find a v3.6 compatible version here.
[hr]-[/hr]

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

Description:
Allows you to expand/collapse the first 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 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. The only queries performed are the same as those when a thread is normally viewed.

The magic behind this modification is performed by jQuery: The Write Less, Do More, JavaScript Library.

vB 3.5 Notes:

Please note that this version is developed for vB3.5, and as such, there are limitations not found in vB3.6. Currently, this modification is restricted to displaying the first post only, as the necessary tables and PHP to display last post, and first unread post aren't (easily) available in vB3.5 without more in-depth hacking and additional queries.

This extended features may be added at a later date, but until then, this is the meat and potatos.

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

[hr]-[/hr]
Installation:
  1. Download and unzip the ajax_first_post_vB3.5.zip archive.
  2. Upload necessary files to their respective locations.
  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 using an intuitive automatic template editing routine. Modified styles shouldn't* be a problem. Honestly, I would be suprised if anyone actually NEEDED to make manual edits.

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

[hr]-[/hr]
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 :up:donation:up:, I won't mind.. really. :)

Version History:
  • 1.2.2
    • First vB3.5 release.

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!

magnus 04-26-2007 01:02 PM

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>


[hr]-[/hr]
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)"> id="vbpostrow_$thread[firstpostid]"</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_$thread[firstpostid]" src="$stylevar[imgdir_button]/expand.gif" onclick="return vbpost_get($thread[firstpostid])" onMouseOver="this.style.cursor='pointer';" /></if>

apdcanari 04-26-2007 07:00 PM

Thanks :up:

letsjoy 04-29-2007 08:36 PM

Thanks man :)

Dave Hawley 04-30-2007 12:31 AM

This is one neat hack! Nice job and all works just as advertised. Is there anyway ONLY Threads with no replies can show the plus sign?

Gizmo5h1t3 05-03-2007 01:04 PM

thats a crackin idea, installed and it works a treat!!!

skooby 05-04-2007 03:22 AM

Not working for me but I think I know why.

I have in my root a folder that contains the default style for the site. Because of that could it be causing the errors I'm getting because the images are now in /style/images instead of /images?

This is what I get in Firefox:

Code:

Database error in vBulletin 3.6.5:

Invalid SQL:

                SELECT
                        post.*, post.username AS postusername, post.ipaddress AS ip, IF(post.visible = 2, 1, 0) AS isdeleted,
                        user.*, userfield.*, usertextfield.*,
                        icon.title as icontitle, icon.iconpath,
                        IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
                        ,avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight
                        ,
                        editlog.userid AS edit_userid, editlog.username AS edit_username, editlog.dateline AS edit_dateline, editlog.reason AS edit_reason,
                        post_parsed.pagetext_html, post_parsed.hasimages
                       
                FROM post AS post
                LEFT JOIN user AS user ON(user.userid = post.userid)
                LEFT JOIN userfield AS userfield ON(userfield.userid = user.userid)
                LEFT JOIN usertextfield AS usertextfield ON(usertextfield.userid = user.userid)
                LEFT JOIN icon AS icon ON(icon.iconid = post.iconid)
                LEFT JOIN avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN customavatar AS customavatar ON(customavatar.userid = user.userid)
                LEFT JOIN editlog AS editlog ON(editlog.postid = post.postid)
                LEFT JOIN post_parsed AS post_parsed ON(post_parsed.postid = post.postid AND post_parsed.styleid_code = -1 AND post_parsed.styleid_html = -1 AND post_parsed.styleid_php = -1 AND post_parsed.styleid_quote = -1)
                WHERE post.postid = 61;

MySQL Error  : Table 'noktric4_forum.post_parsed' doesn't exist
Error Number : 1146
Date        : Friday, May 4th 2007 @ 12:18:06 AM
Script      : http://www.nokturnalist.com/vbpost_ajax.php
Referrer    : http://www.nokturnalist.com/forumdisplay.php?f=2


In IE, it just gives the Database encountered an error. My site is www.nokturnalist.com if you want to check it yourself.

magnus 05-04-2007 10:39 AM

Quote:

Originally Posted by skooby (Post 1241062)
Not working for me but I think I know why.

I have in my root a folder that contains the default style for the site. Because of that could it be causing the errors I'm getting because the images are now in /style/images instead of /images?

This is what I get in Firefox:

Code:

Database error in vBulletin 3.6.5:

You're trying to run the vB3.5 version on vB3.6. Click here for the vB3.6 version

skooby 05-04-2007 12:39 PM

Well I installed the 3.6 without realizing my site uses 3.5.4 so I uninstalled it and removed the manual entries and then reinstalled it with 3.5. Maybe I'll do it again, I must have left something out. I did make a backup before I installed it so I can always revert to that.

magnus 05-04-2007 01:31 PM

The error message you posted says your site runs vBulletin 3.6.5 -- not 3.5.4.

Quote:

Database error in vBulletin 3.6.5:

JohnBee 09-11-2007 02:36 AM

Any chance this will come for 3.6x? I really think this mod is useful.

magnus 09-11-2007 06:26 PM

Quote:

Originally Posted by JohnBee (Post 1336702)
Any chance this will come for 3.6x? I really think this mod is useful.

This modification was developed for vB3.6. This is just the vB3.5 port, click here for the vB3.6 version.

ArchangelX 08-20-2008 07:36 AM

I've done everything here, tried both the manual and the auto. The only problem is that the + box doesn't open up at all. It's like the javascript isn't activating. I've double checked to make sure it's in the right folders, and it is...any suggestions?

Dave Hawley 08-20-2008 07:52 AM

Are you allowing AJAX

ArchangelX 08-20-2008 07:19 PM

Is there an option for that somewhere? :D

*runs off to go check*

ArchangelX 08-20-2008 07:23 PM

Crap. Yes, I am. It's set to Enable All. Any suggestions?


All times are GMT. The time now is 04:54 PM.

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.01264 seconds
  • Memory Usage 1,786KB
  • 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
  • (2)bbcode_code_printable
  • (6)bbcode_html_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (16)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