? Error

User tests: Successful: Unsuccessful:

avatar KISS-Web-Design
KISS-Web-Design
11 Nov 2013

Change the keepalive function to use jQuery instead of MooTools.

Tracker http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=32665&start=600

avatar KISS-Web-Design KISS-Web-Design - open - 11 Nov 2013
avatar wilsonge
wilsonge - comment - 15 Nov 2013

You need to fix the unit tests for this :) To do so just remove the JHtml framework part of the array out here: https://github.com/KISS-Web-Design/joomla-cms/blob/feature-jquery-keepalive/tests/unit/suites/libraries/cms/html/JHtmlBehaviorTest.php#L640

If you being really good you might even add to the test to make sure jQuery is present

avatar piotr-cz
piotr-cz - comment - 15 Nov 2013

What about moving the keepAlive function to the jQuery().ready so it doesn't leak to global scope?

Also I'd like to see newlines at the beginning and end of script, otherwise rendered page source code becomes unreadable when there are few scripts placed one after another.

// Attach keep alive to document
JFactory::getDocument()->addScriptDeclaration('
    jQuery(document).ready(function() {
        window.setInterval(
            function(){ new jQuery.ajax({ type: "GET" }); },
            ' . $refreshTime . '
        );
    });
');
avatar KISS-Web-Design
KISS-Web-Design - comment - 15 Nov 2013

@wilsonge

Thanks, didn't notice the failing test (my bad). I will fix it and update this PR.

@piotr-cz I will add the newlines in, but the jQuery().ready is not the recommended syntax - according to the jQuery API.
=== http://api.jquery.com/ready/ ===
All three of the following syntaxes are equivalent:

$( document ).ready( handler )
$().ready( handler ) (this is not recommended)

$( handler )

Chris.

avatar betweenbrain
betweenbrain - comment - 11 Dec 2013

From what I can tell, the code looks good. We just need some test instructions and good tests. @KISS-Web-Design can you provide instructions on testing this?

avatar KISS-Web-Design
KISS-Web-Design - comment - 11 Dec 2013

No problem, I'll write something up and post it here and on the tracker.

Chris.

On Wednesday, 11 December 2013, Matt Thomas wrote:

From what I can tell, the code looks good. We just need some test
instructions and good tests. @KISS-Web-Designhttps://github.com/KISS-Web-Designcan you provide instructions on testing this?


Reply to this email directly or view it on GitHub#2494 (comment)
.

Chris Jones-Gill
KISS Web Design
Company number: 7486736
VAT Registration: 107800539

avatar betweenbrain
betweenbrain - comment - 11 Dec 2013

No problem, I'll write something up and post it here and on the tracker.

Awesome, thanks.

avatar KISS-Web-Design
KISS-Web-Design - comment - 11 Dec 2013

Test Instructions

You will need to be comfortable using the web inspector tools of your preferred browser, I use Chrome Inspector and Firebug (on Firefox).

1. Before applying the patch ensure that the MooTools keepAlive function is loaded.

visit yoursitename/index.php/component/users/?view=login

Check the <head> for the following code

function keepAlive() {  var myAjax = new Request({method: "get", url: "index.php"}).send();} window.addEvent("domready", function(){ keepAlive.periodical(840000); });

It will look something like this

moo-keepalive

Wait for at least 15 minutes, then use the inspector to check that the site has been reloaded in the background - evidenced by a GET of the page.

It will look something like this

moo-keepalive-evidence

2. Apply the patch, and reload the site page.

Or navigate back to yoursitename/index.php/component/users/?view=login

Check the <head> for the following code

            jQuery(document).ready(function() {
                window.setInterval(
                    function(){ new jQuery.ajax({ type: "GET" }); },
                    840000
                );
            });

It will look something like this

jquery-keepalive

Wait for at least 15 minutes, then use the inspector to check that the site has been reloaded in the background - evidenced by a GET of the page.

It will look something like this

jquery-keepalive-eveidence

3. Respond here

With a +1, success, or other positive test result affirmation.
OR
With a -1, fails, or other negative test result affirmation - along with a good description of your environment, which part doesn't work (with screenshots and/or source copy/paste), and any other helpful information.

Thanks for testing.

Chris.

avatar Bakual
Bakual - comment - 12 Dec 2013

Thanks for the instructions. Just a note: The test results should be posted in the tracker. Of course you can also add them here, but the tracker is currently still the point of thruth.

avatar KISS-Web-Design
KISS-Web-Design - comment - 12 Dec 2013

@Bakual , I have also posted the same instructions on the tracker - but there are some people that don't have tracker accounts (or refuse to use it), so I would rather have test results posted here and there than exclude people.

I don't mind doing a copy/paste from here to the tracker to keep all the results together.

avatar Bakual
Bakual - comment - 12 Dec 2013

@KISS-Web-Design agreed :)

avatar mbabker
mbabker - comment - 8 Apr 2014

Closed in favor of #3376

avatar mbabker mbabker - change - 8 Apr 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-04-08 23:31:26
avatar mbabker mbabker - change - 8 Apr 2014
Title
Feature jquery keepalive
[#32665] Feature jquery keepalive
avatar mbabker mbabker - close - 8 Apr 2014
avatar mbabker mbabker - close - 8 Apr 2014

Add a Comment

Login with GitHub to post a comment