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)
-   -   Add-On Releases - vBISpy - AJAX real-time feed of new posts/threads (https://vborg.vbsupport.ru/showthread.php?t=125947)

Hicksatpd 09-07-2006 09:53 PM

Here's what I have:

http://www.pacersdigest.com/forums/vaispy.php

MPDev 09-07-2006 09:58 PM

Okay, line 258 in vb_spy.js should read:

Code:

                post_url = 'showthread.php?p=' + postid + '#post' + spyid;
I've updated the zip with this fix.

Hicksatpd 09-07-2006 10:08 PM

Hmm. It's the correct link now, but for some reason I'm being bumped back to post #1. ??

Hicksatpd 09-07-2006 10:14 PM

Oh, I think I know. The link doesn't specify a page #. It's sending me to page 1, and then looking for a post that's on page 2+.

Hicksatpd 09-07-2006 10:16 PM

Well, wait, now that I tried it on a thread with only one page, it still doesn't work. It sends me to the correct post, but then I'm immediately back at post #1.

MPDev 09-07-2006 10:34 PM

Try:

Code:

post_url = 'showthread.php?p=' + spyid + '#post' + spyid;

nix 09-07-2006 10:39 PM

Yea that worked.

MPDev 09-07-2006 10:52 PM

Okay, I modified the vaispy.php script accordingly and posted it here.

Hicksatpd 09-07-2006 10:53 PM

Yep, that did it! Thank you very much for all of your work!

buro9 09-08-2006 08:04 AM

Another minor thing.

If nothing is returned, you should return the Xml with an empty root node of <events />

This will avoid invalid Xml errors being silently thrown in the JavaScript.

Simply change this in the .php file:
PHP Code:

    if ( $output )
    {
        echo 
"<events>$output</events>";
    } 

to
PHP Code:

    if ( $output )
    {
        echo 
"<events>$output</events>";
    } else {
        echo 
"<events />";
    } 

And because that will now prevent the JavaScript exception, change this in the va_spy.js file:
Code:

        try {
                events = request.responseXML.getElementsByTagName("events")[0];
                event = events.getElementsByTagName("event");
        }

        catch (e) {
                setTimeout("getXML()", 5000);
                return;
        }

to
Code:

        try {
                events = request.responseXML.getElementsByTagName("events")[0];
                event = events.getElementsByTagName("event");
                if (event.length == 0) {
                        setTimeout("getXML()", 5000);
                        return;
                }
        }

        catch (e) {
                setTimeout("getXML()", 5000);
                return;
        }

We'll actually never use that catch statement now, but no harm in being extra defensive and leaving it in there :)

bashy 09-08-2006 09:11 AM

Excellent, well done, i was watching that thread in anticipation,

Thanks alot m8 :)

theodonnells 09-08-2006 09:13 AM

No new posts show for me, getting this error in java console....
Quote:

Error: syntax error
Source File: http://www.mysite.com/forums/vaispy....21830258337&_=
Line: 1, Column: 31
Source Code:
<?xml version="1.0" encoding=""?>------------------------------^

Mark.B 09-08-2006 09:28 AM

Would be good if there was a way to stop guests viewing this.

buro9 09-08-2006 09:33 AM

Quote:

Originally Posted by theodonnells
No new posts show for me, getting this error in java console....

Do you have a different language pack from the default installed? It's missing the encoding, which is normally part of the localisation.

Indeed the line in the PHP file is:
PHP Code:

echo '<?xml version="1.0" encoding="' . $stylevar['charset'] . '"?>' . "\r\n";


buro9 09-08-2006 09:34 AM

Quote:

Originally Posted by Mark.B
Would be good if there was a way to stop guests viewing this.


Add this:
PHP Code:

if (empty($vbulletin->userinfo['userid']))
{
    
print_no_permission();


To the .php file, just below where it has this:
PHP Code:

// ######################### REQUIRE BACK-END ############################
require_once('./global.php'); 


Mark.B 09-08-2006 09:38 AM

Quote:

Originally Posted by buro9
Add this:
To the .php file, just below where it has this:

Thanks...spot on. :D

bashy 09-08-2006 10:18 AM

Hi m8 is there away to change the amount of posts show please?

Perhaps to something like 30, or would this cause a lot more server load?

Floris 09-08-2006 12:13 PM

Very cool modification. Thumbsup

MPDev 09-08-2006 12:48 PM

Thanks, Floris; I have something really neat in store for people who use this modification that I should be ready to show shortly.

Thank you, buro9; I'll add that to the code immediately.

voteforbird 09-08-2006 05:12 PM

What line would I change to slow down how quick the posts display? I don't mean the database check time, but rather the time that each update is fed downwards.

buro9 09-08-2006 05:22 PM

Quote:

Originally Posted by voteforbird
What line would I change to slow down how quick the posts display? I don't mean the database check time, but rather the time that each update is fed downwards.

Change the pushtime value from 1000 (1 second) to 2000 (2 seconds) or whatever you want. Note that there is an instance of a hard-coded 1000 lower down in the code within a settimeout call... change that one too.

buro9 09-08-2006 05:23 PM

Quote:

Originally Posted by bashy
Hi m8 is there away to change the amount of posts show please?

Perhaps to something like 30, or would this cause a lot more server load?

In the PHP file I noticed a line that had this:
PHP Code:

spymax 25

See what happens when you change it :)

buro9 09-08-2006 05:27 PM

And MPDev... fantastic hack :)

Don't mind me helping support it... I know from experience it can be a chore answering hack support questions, and I like this one a lot so I've already delved through most of the code and figured out a few tweaks here and there. I'll stick to sharing tips though :)

One thing that did come to mind... a way of caching according to usergroups. I haven't yet opened this up to guests as I'm wary of additional database load, but if I put in a per usergroup cache mechanism based on a users primary usergroup... then this would solve any potential load issue on large boards :)

MPDev 09-08-2006 05:56 PM

Are you kidding? I don't mind at all, in fact it's why I put it out here so that (hopefully) we could all enjoy it and improve it.

vBIspy.com is nearing ready for launch; once it's ready it'll be a fun way to see what people are talking about and promote our websites. (You just register your vbispy.php and vBIspy.com grabs a few threads on a polling cycle to promote your site).

jcr 09-08-2006 09:43 PM

Holy crap! This works great :D :D Mine is here

jcr 09-08-2006 09:51 PM

BTW.. Could it be possible to add a external version to this one? A include version that I could post on an external website or the main portal page? ( non-vb-portal )

G_Man 09-08-2006 09:53 PM

Quote:

Originally Posted by MPDev
Are you kidding? I don't mind at all, in fact it's why I put it out here so that (hopefully) we could all enjoy it and improve it.

vBIspy.com is nearing ready for launch; once it's ready it'll be a fun way to see what people are talking about and promote our websites. (You just register your vbispy.php and vBIspy.com grabs a few threads on a polling cycle to promote your site).


Right on!!!

I hope to get this up and running today... Darn Real World and Work!! :p



****edit - that was too easy!! Works a trick!!!!!!!!!!!!!!!!!!!!!!

Cheers Mate!

hotwheels 09-08-2006 10:13 PM

This is a great mod. I installed it on my site and set it up with a link under the actual post.
This way after someone replies to a post, all they need to do is click on "Realtime New Posts" and they are brought right back to the ajax page, which make's this very functional on my site.

Thanks hotwheels of insanemustangs.com :D

See the pic for my example:

Freesteyelz 09-08-2006 10:29 PM

Sweet mod. Thanks again, MPDev. :) *Clicked Install*

ZGeek 09-08-2006 11:50 PM

This is a really awesome hack and I'd love to see it developed further. (like a module for vbadvanced hehehehe)

Is there anything that can be done for the whos online page? When its viewed and people are on that page they are reported like this:

Unknown Location
/forum/vaispy.php?do=xml&last=993718&r=0.4711818012095664 3&_=

bashy 09-08-2006 11:50 PM

Hi m8, thanks but changing that actually stops it displaying any posts!! :(

Its this ya need to change ;)

PHP Code:

        ORDER BY lastpost DESC LIMIT 10"); 

Also....ya need to add more lines here i think, then perhaps change your amount that you posted

PHP Code:

<tr id="row1" style="display: none;"></tr>
<
tr id="row2" style="display: none;"></tr>
<
tr id="row3" style="display: none;"></tr>
<
tr id="row4" style="display: none;"></tr>
<
tr id="row5" style="display: none;"></tr>
<
tr id="row6" style="display: none;"></tr>
<
tr id="row7" style="display: none;"></tr>
<
tr id="row8" style="display: none;"></tr>
<
tr id="row9" style="display: none;"></tr>
<
tr id="row10" style="display: none;"></tr>
<
tr id="row11" style="display: none;"></tr>
<
tr id="row12" style="display: none;"></tr>
<
tr id="row13" style="display: none;"></tr>
<
tr id="row14" style="display: none;"></tr>
<
tr id="row15" style="display: none;"></tr>
<
tr id="row16" style="display: none;"></tr>
<
tr id="row17" style="display: none;"></tr>
<
tr id="row18" style="display: none;"></tr>
<
tr id="row19" style="display: none;"></tr>
<
tr id="row20" style="display: none;"></tr>
<
tr id="row21" style="display: none; opacity:.85"></tr>
<
tr id="row22" style="display: none; opacity:.65"></tr>
<
tr id="row23" style="display: none; opacity:.45"></tr>
<
tr id="row24" style="display: none; opacity:.25"></tr>
<
tr id="row25" style="display: none; opacity:.05"></tr

Quote:

Originally Posted by buro9
In the PHP file I noticed a line that had this:
PHP Code:

spymax 25

See what happens when you change it :)


bashy 09-09-2006 12:04 AM

EDIT:

To change the amount of posts to show:
Find and change the 50 to the amount you require
[phpORDER BY lastpost DESC LIMIT 50");[/php]

Find and change the 50 to the amount you require
PHP Code:

    spymax 50

Find and add more rows to the amount that you require
[php]
PHP Code:

<tr id="row1" style="display: none;"></tr>
<
tr id="row2" style="display: none;"></tr>
<
tr id="row3" style="display: none;"></tr>
<
tr id="row4" style="display: none;"></tr>
<
tr id="row5" style="display: none;"></tr>
<
tr id="row6" style="display: none;"></tr>
<
tr id="row7" style="display: none;"></tr>
<
tr id="row8" style="display: none;"></tr>
<
tr id="row9" style="display: none;"></tr>
<
tr id="row10" style="display: none;"></tr>
<
tr id="row11" style="display: none;"></tr>
<
tr id="row12" style="display: none;"></tr>
<
tr id="row13" style="display: none;"></tr>
<
tr id="row14" style="display: none;"></tr>
<
tr id="row15" style="display: none;"></tr>
<
tr id="row16" style="display: none;"></tr>
<
tr id="row17" style="display: none;"></tr>
<
tr id="row18" style="display: none;"></tr>
<
tr id="row19" style="display: none;"></tr>
<
tr id="row20" style="display: none;"></tr>
<
tr id="row21" style="display: none; opacity:.85"></tr>
<
tr id="row22" style="display: none; opacity:.65"></tr>
<
tr id="row23" style="display: none; opacity:.45"></tr>
<
tr id="row24" style="display: none; opacity:.25"></tr>
<
tr id="row25" style="display: none; opacity:.05"></tr

This is mine as i have set it to 50
PHP Code:

<tr id="row1" style="display: none;"></tr>
<
tr id="row2" style="display: none;"></tr>
<
tr id="row3" style="display: none;"></tr>
<
tr id="row4" style="display: none;"></tr>
<
tr id="row5" style="display: none;"></tr>
<
tr id="row6" style="display: none;"></tr>
<
tr id="row7" style="display: none;"></tr>
<
tr id="row8" style="display: none;"></tr>
<
tr id="row9" style="display: none;"></tr>
<
tr id="row10" style="display: none;"></tr>
<
tr id="row11" style="display: none;"></tr>
<
tr id="row12" style="display: none;"></tr>
<
tr id="row13" style="display: none;"></tr>
<
tr id="row14" style="display: none;"></tr>
<
tr id="row15" style="display: none;"></tr>
<
tr id="row16" style="display: none;"></tr>
<
tr id="row17" style="display: none;"></tr>
<
tr id="row18" style="display: none;"></tr>
<
tr id="row19" style="display: none;"></tr>
<
tr id="row20" style="display: none;"></tr>
<
tr id="row21" style="display: none;"></tr>
<
tr id="row22" style="display: none;"></tr>
<
tr id="row23" style="display: none;"></tr>
<
tr id="row24" style="display: none;"></tr>
<
tr id="row25" style="display: none;"></tr>
<
tr id="row26" style="display: none;"></tr>
<
tr id="row27" style="display: none;"></tr>
<
tr id="row28" style="display: none;"></tr>
<
tr id="row29" style="display: none;"></tr>
<
tr id="row30" style="display: none;"></tr>
<
tr id="row31" style="display: none;"></tr>
<
tr id="row32" style="display: none;"></tr>
<
tr id="row33" style="display: none;"></tr>
<
tr id="row34" style="display: none;"></tr>
<
tr id="row35" style="display: none;"></tr>
<
tr id="row36" style="display: none;"></tr>
<
tr id="row37" style="display: none;"></tr>
<
tr id="row38" style="display: none;"></tr>
<
tr id="row39" style="display: none;"></tr>
<
tr id="row40" style="display: none;"></tr>
<
tr id="row41" style="display: none; opacity:.95"></tr>
<
tr id="row42" style="display: none; opacity:.85"></tr>
<
tr id="row43" style="display: none; opacity:.75"></tr>
<
tr id="row44" style="display: none; opacity:.65"></tr>
<
tr id="row45" style="display: none; opacity:.55"></tr>
<
tr id="row46" style="display: none; opacity:.45"></tr>
<
tr id="row47" style="display: none; opacity:.35"></tr>
<
tr id="row48" style="display: none; opacity:.25"></tr>
<
tr id="row49" style="display: none; opacity:.15"></tr>
<
tr id="row45" style="display: none; opacity:.08"></tr


Lizard King 09-09-2006 09:21 AM

All the credit goes to TECK ( Floren )

In order to optimize the code Replace
Code:

    $getthreads = $db->query_read("
            SELECT thread.*, post.pagetext AS preview, post.userid AS lastpuserid
            FROM ".TABLE_PREFIX."thread AS thread
            LEFT JOIN ".TABLE_PREFIX."deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND type = 'thread')
            LEFT JOIN ".TABLE_PREFIX."post AS post ON(post.postid = thread.lastpostid)
            WHERE open <> 10 AND thread.lastpostid > $lastpostid
            AND forumid NOT IN (0$blockforums)
            AND thread.visible = '1'
            AND deletionlog.primaryid IS NULL
            ORDER BY lastpost DESC LIMIT 10");

with
Code:

        // The number of days to scan the table for ...
        // 86400 represents the number of seconds in 24hrs
        $daysprune = 1;
        $datecut = "AND thread.lastpost >= " . (TIMENOW - ($daysprune * 86400));

        $getthreads = $db->query_read("
                SELECT thread.*, post.pagetext AS preview, post.userid AS lastpuserid
                FROM " . TABLE_PREFIX . "thread AS thread
                LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON (thread.threadid = deletionlog.primaryid AND type = 'thread')
                LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.lastpostid)
                WHERE open <> 10 AND thread.lastpostid > $lastpostid
                        AND forumid NOT IN (0$blockforums)
                        AND thread.visible = '1'
                        AND deletionlog.primaryid IS NULL
                        $datecut
                ORDER BY thread.lastpost DESC LIMIT 10
        ");


MPDev 09-09-2006 09:25 PM

Just curious about adding that to the query; does that speed up the query or is it to just make sure you only grab something from the past day?

Cole2026 09-09-2006 09:32 PM

Problem here.

The query is going correctly, it has valid information in it:
http://yourconvo.com/forums/vaispy.php?do=xml

However, The actual page is not filling up with data.
http://www.yourconvo.com/forums/vaispy.php

da420 09-09-2006 09:34 PM

Quote:

Originally Posted by Cole2026
Problem here.

The query is going correctly, it has valid information in it:
http://yourconvo.com/forums/vaispy.php?do=xml

However, The actual page is not filling up with data.
http://www.yourconvo.com/forums/vaispy.php

What do you mean it's not filling up with data?

It seems to be working for me...

DementedMindz 09-09-2006 09:35 PM

yeah me too

Cole2026 09-09-2006 09:40 PM

I just figured out what's wrong.

It won't work when there is no www.

MPDev 09-10-2006 02:57 AM

I made an update with some minor changes to the JavaScript to remove the split strings.

I'm not sure what to do about Opera; I just dont use it to know enough what might need to be done. I wonder if it works like IE and we need:

Code:

if (is_ie || is_opera)
in the javascript file va_spy.js.

Wired1 09-10-2006 03:39 AM

Quote:

Originally Posted by bashy
This is mine as i have set it to 50
PHP Code:

<tr id="row49" style="display: none; opacity:.15"></tr>
<
tr id="row45" style="display: none; opacity:.08"></tr


row 49, then 45? :)


All times are GMT. The time now is 04:22 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.02392 seconds
  • Memory Usage 1,937KB
  • 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
  • (7)bbcode_code_printable
  • (13)bbcode_php_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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