vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Forum Display Enhancements - Collapsable First Post using AJAX (or Last Post!) (https://vborg.vbsupport.ru/showthread.php?t=145187)

magnus 04-17-2007 10:00 PM

Collapsable First Post using AJAX (or Last Post!)
 
[hr]-[/hr]
NOTICE: This is for vBulletin v3.6 ONLY. You can find a v3.5 compatible version here.
[hr]-[/hr]
*** Confirmed working on ALL vBulletin 3.6.x versions! ***

[hr]-[/hr]
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 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 jQuery: The Write Less, Do More, JavaScript Library.

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

[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 donation, 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.

[hr]-[/hr]
Tips, Tricks and Modifications:

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!

aveon 04-18-2007 05:23 PM

wow man nice hack thanx for this i just love ajax

KevNJ 04-18-2007 05:47 PM

will be installing this when i get home. awesome mod!

4x4 Mecca 04-18-2007 05:55 PM

<a href="http://www.4x4mecca.com/forum/forumdisplay.php?f=36" target="_blank">http://www.4x4mecca.com/forum/forumdisplay.php?f=36</a>
I get an error message when I try. The plus sign is there, but what I see is "There was an error. Please try again."

magnus 04-18-2007 05:57 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 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>


[hr]-[/hr]
[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>

magnus 04-18-2007 06:01 PM

Quote:

Originally Posted by 4x4 Mecca (Post 1230576)
http://www.4x4mecca.com/forum/forumdisplay.php?f=36
I get an error message when I try. The plus sign is there, but what I see is "There was an error. Please try again."

Hrm.. that error appears when the script is unable to pull data. However, I tested the backend on your site and it seems to be working: http://www.4x4mecca.com/forum/vbpost...p?postid=12979

Let me nose around a bit.

magnus 04-18-2007 06:09 PM

@4x4 Mecca:

Redownload the archive and upload/overwrite your existing vbpost_ajax.php with the new one. Let me know if that fixes it.

4x4 Mecca 04-18-2007 06:09 PM

Thanks! I just edited the teplates manually just incase that was the problem. It still isn't working.

4x4 Mecca 04-18-2007 06:13 PM

Error is still there. Any idea what might be interfering?

Lionel 04-18-2007 06:14 PM

Quote:

Originally Posted by 4x4 Mecca (Post 1230576)
http://www.4x4mecca.com/forum/forumdisplay.php?f=36
I get an error message when I try. The plus sign is there, but what I see is "There was an error. Please try again."

same for me

magnus 04-18-2007 06:17 PM

Ok, I removed the download link for a second while I try and track this down. My apologies.

4x4 Mecca 04-18-2007 06:19 PM

I have a few (read maybe a lot) hacks installed, but I don't know which one could be messing with it. Anyone else recreate this on their own site?

ninjamaster 04-18-2007 06:20 PM

THANKS M8 nice work :)

Lionel 04-18-2007 06:20 PM

this is also giving a javascript error in newposts

magnus 04-18-2007 06:22 PM

Wait, you get an error when trying to write a new post? I don't see how this could affect that. What's the error?

Lionel 04-18-2007 06:23 PM

no i get the error like the poster above me and also in do=getnew

4x4 Mecca 04-18-2007 06:25 PM

I didn't get an error when making a new post or new reply.

Lionel 04-18-2007 06:25 PM

and also in do=getdaily

Lionel 04-18-2007 06:26 PM

where is the new file ?

4x4 Mecca 04-18-2007 06:26 PM

uploaded

4x4 Mecca 04-18-2007 06:27 PM

Still not working, and errors on get new posts too.

Lionel 04-18-2007 06:28 PM

sorry, nothing changed

magnus 04-18-2007 06:30 PM

Do me a favor, check to see if you have a vbpost_postbit template..

4x4 Mecca 04-18-2007 06:31 PM

Yes, I do.

Lionel 04-18-2007 06:32 PM

I do

magnus 04-18-2007 06:33 PM

This is odd.. for some reason or another, it's not being displayed. I installed a fresh vB and imported this product and it worked fine. There has to be a hack conflict somewhere.

4x4 Mecca 04-18-2007 06:34 PM

Is there any way another mod could be creating this problem?

sensimilla 04-18-2007 06:36 PM

Nice addon, great job!

bitdefuser 04-18-2007 06:36 PM

Question.
When a user hits the (+), does it add to the thread view count? Because I don't see it adding in your screenshots.

magnus 04-18-2007 06:37 PM

Quote:

Originally Posted by bitdefuser (Post 1230625)
Question.
When a user hits the (+), does it add to the thread view count? Because I don't see it happening in your screenshots.

No.

bitdefuser 04-18-2007 06:37 PM

Hm, can you please add an option that allows that?

4x4 Mecca 04-18-2007 06:38 PM

done, uploaded again.

Lionel 04-18-2007 06:39 PM

still the same for me

4x4 Mecca 04-18-2007 06:39 PM

still errors :(

magnus 04-18-2007 06:41 PM

This is so hard to do remotely.. lol.

Lionel 04-18-2007 06:41 PM

I am using vbseo if that means something

magnus 04-18-2007 06:42 PM

I developed this on a forum using vBSEO. That shouldn't be a problem.

Lionel 04-18-2007 06:43 PM

the image code I had to add manually in templates because of vbplaza

magnus 04-18-2007 06:45 PM

Ok, upload this file. This isn't going to fix it, it's to give me more information. I'm going to need you to delete it as soon as I'm done.

Lionel 04-18-2007 06:45 PM

after giving the alert, the image ajaxsmall.gif still displays and i must refresh to stop it


All times are GMT. The time now is 07:14 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.01605 seconds
  • Memory Usage 1,823KB
  • 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
  • (8)bbcode_html_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete