Javascript and you

Discuss the development of future releases of phpBB (phpBB 3.x minor releases) and MODing/Coding related questions.
User avatar
Obsidian
Supporter
Supporter
Posts: 736
Joined: 13 May 2008, 15:20
Real name: Damian
Contact:

Re: Javascript and you

Post by Obsidian »

Is that what you use to generate the whois listing live, for the AJAX refresh? That's what it pulls from?
User avatar
RMcGirr83
Supporter
Supporter
Posts: 6243
Joined: 30 Nov 2006, 14:23
Real name: Rich McGirr

Re: Javascript and you

Post by RMcGirr83 »

Obsidian wrote:Is that what you use to generate the whois listing live, for the AJAX refresh? That's what it pulls from?


Yes...from the js file

Code: Select all

// whois chatting Refresh function
 
  stats_refresh : function()
   {
      // If not custom page...do nothing
    if(!mChatCustomWhois)
    {
      // Stop
      return;
    }
      // AJAX request
        $jQ.ajax({
          url: mChatFile,
          timeout: 10000,
          type: 'POST',
          async: false,
          data: {mode: 'stats'},
            dataType: 'html',
       
            success: function(html)
            {
              // If not empty run its part
              if(html != '')
              {         
            
            // Replace old edited message to new with animation
            $jQ('#mChatStats').fadeOut('slow', function(){
                // overwrite data to chatting
                $jQ('#mChatStats').replaceWith(html);
                // Animation ;)
                $jQ('#mChatStats').css('display', 'none').fadeIn('slow');
            });
           }
          },
          error: function(XMLHttpRequest)
          {
            if(XMLHttpRequest.status == 403)
            {
              // No access alert
              alert(mChatNoAccess);
            }
          },
          beforeSend: function()
          {
            // Refresh stop
            window.clearInterval(stats_interval);
          },
          complete: function()
          {
            // Start refresh
            stats_interval = setInterval(function(){mChat.stats_refresh()}, mChatRefresh);
          }       
        });
  }
User avatar
Obsidian
Supporter
Supporter
Posts: 736
Joined: 13 May 2008, 15:20
Real name: Damian
Contact:

Re: Javascript and you

Post by Obsidian »

There is something else that is running within the page that is causing this, looks like. You need to check all your break; calls, see if there is one missing. Also, you may need to introduce a call to exit_handler();
User avatar
RMcGirr83
Supporter
Supporter
Posts: 6243
Joined: 30 Nov 2006, 14:23
Real name: Rich McGirr

Re: Javascript and you

Post by RMcGirr83 »

Damian,

Really want to thank you for sticking with me through this.

[url=http://rmcgirr83.org/mchat/mchat_ajax_mini.js]here is the current js file[/url]

If you wouldn't mind taking a look. It's from taking over the mini chat mod released at phpbb.com but my js skillz are weak and I'm just trying to follow the logic.

It has changed since the last time I code pasted because I was thinking about what you had said about something else already being run...so tried to add the ajax call for the stats within the refresh function of the js file. The result is the same :(.

FWIW, the php file can be found [url=http://www.rmcgirr83.org/pastebin.php?mode=view&s=8]here[/url].
User avatar
Obsidian
Supporter
Supporter
Posts: 736
Joined: 13 May 2008, 15:20
Real name: Damian
Contact:

Re: Javascript and you

Post by Obsidian »

It's more about the PHP file. I checked it directly, and the output included that extra HTML -- somewhere along the line that is getting echoed or something.

Will take a look later -- I have dishes to do. :roll:
User avatar
RMcGirr83
Supporter
Supporter
Posts: 6243
Joined: 30 Nov 2006, 14:23
Real name: Rich McGirr

Re: Javascript and you

Post by RMcGirr83 »

Obsidian wrote:Will take a look later


Thanks

-- I have dishes to do. :roll:


First and last time you will hear me say this...get married. :)
User avatar
Obsidian
Supporter
Supporter
Posts: 736
Joined: 13 May 2008, 15:20
Real name: Damian
Contact:

Re: Javascript and you

Post by Obsidian »

Try this? http://phpbbmodders.net/pastebin/view/18/
My comments are marked with //++

RMcGirr83 wrote:First and last time you will hear me say this...get married. :)


Meh. :|
User avatar
RMcGirr83
Supporter
Supporter
Posts: 6243
Joined: 30 Nov 2006, 14:23
Real name: Rich McGirr

Re: Javascript and you

Post by RMcGirr83 »

Obsidian wrote:
RMcGirr83 wrote:First and last time you will hear me say this...get married. :)


Meh. :|


It was another poor attempt by me at a joke. :(

Anyway, with that code the stats section refreshes once so that's better than what I had but then it doesn't seem to reset/refresh again.
User avatar
Obsidian
Supporter
Supporter
Posts: 736
Joined: 13 May 2008, 15:20
Real name: Damian
Contact:

Re: Javascript and you

Post by Obsidian »

Odd. That makes me think the JS timer isn't resetting itself now -- you may have caused an issue with JS edits there.

As far as that code goes, just do a diff between my code and yours, and revert back to what you had earlier. That may work out a little better.
User avatar
RMcGirr83
Supporter
Supporter
Posts: 6243
Joined: 30 Nov 2006, 14:23
Real name: Rich McGirr

Re: Javascript and you

Post by RMcGirr83 »

Hey Damian,

Just a shout to let you know got it sorted...really appreciate your help btw.

Thanks. :)
Post Reply