Discussion:
Overriding wicket-ajax-jquery.js
avchavan
10 years ago
Permalink
Hi,
I am using AjaxSelfUpdatingTimerBehavior in my application which is for
session timeout kinda functionality. Also i have a Download functionality
using DownloadLink.
The AjaxSelfUpdatingTimerBehavior doesnt work after i download a file.
I saw a JIRA created for similar issue:
https://issues.apache.org/jira/browse/WICKET-5822
I am using wicket 6.19.0
I saw the changelog and there was some change from changing the event from
beforeunload to unload.
Now, can i just make this change in the wicket-ajax-jquery.js and use it
somehow for my project?
I am in the middle of a release and cannot upgrade to wicket7 at the moment.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Overriding-wicket-ajax-jquery-js-tp4672051.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Martin Grigorov
10 years ago
Permalink
https://issues.apache.org/jira/browse/WICKET-5822 is fixed in 6.20.0 too

But yes, you could use "monkey patching" to override it locally too. Please
search for "monkey patch javascript" in the web.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
...
avchavan
10 years ago
Permalink
I am not too good with Javascript.
What i did is made a duplicate file locally for wicket-ajax-jquery.js and
modified "beforeunload" to "unload".
Imported this duplicate file at the end (just before the Head tag closes).
But it doesn't work.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Overriding-wicket-ajax-jquery-js-tp4672051p4672056.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Martin Grigorov
10 years ago
Permalink
Time to become better with JavaScript! ;-)
Fire the debugger and see what happens.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
Post by avchavan
I am not too good with Javascript.
What i did is made a duplicate file locally for wicket-ajax-jquery.js and
modified "beforeunload" to "unload".
Imported this duplicate file at the end (just before the Head tag closes).
But it doesn't work.
--
http://apache-wicket.1842946.n4.nabble.com/Overriding-wicket-ajax-jquery-js-tp4672051p4672056.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
avchavan
10 years ago
Permalink
not working.
I added alerts inside the method to see if it gets called, but in vein.
I hope my changes are correct, here's what i changed:
Wicket.Event.add(window, "unload", function() {
var WTH = Wicket.TimerHandles;
if (WTH) {
for (var th in WTH) {
if (WTH.hasOwnProperty(th)) {
window.clearTimeout(WTH[th]);
delete WTH[th];
}
}
}
});

Only changes is the event from beforeunload to unload.
I hope i am doing it correctly.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Overriding-wicket-ajax-jquery-js-tp4672051p4672060.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Martin Grigorov
10 years ago
Permalink
Why don't you upgrade to 6.20.0 ?

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
...
avchavan
10 years ago
Permalink
We don't have time to upgrade and do a full cycle of testing of the entire
application again :(

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Overriding-wicket-ajax-jquery-js-tp4672051p4672062.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Tobias Soloschenko
10 years ago
Permalink
Hi,

because there are no API breaks an upgrade to Wicket 6.20.0 should only consist of changing the maven pom.xml.

All changes of Wicket 6.20.0 are listed in the release notes - so testing the affected components should be all you need to do.

I think this is better then implementing some workarounds.

kind regards

Tobias
Post by avchavan
We don't have time to upgrade and do a full cycle of testing of the entire
application again :(
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Overriding-wicket-ajax-jquery-js-tp4672051p4672062.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
avchavan
10 years ago
Permalink
The problem is we have to deliver tomorrow and the application is BIG, so
testing it wont be possible and we wont get a go ahead.
is there any alternative apart from upgrade (even a dirty one would do for
time being).

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Overriding-wicket-ajax-jquery-js-tp4672051p4672064.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Martin Grigorov
10 years ago
Permalink
Please explain in more details what you have done and what is the order of
.js files in your page.
It is hard for us to tell what is wrong from just "it doesn't work".

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
Post by avchavan
The problem is we have to deliver tomorrow and the application is BIG, so
testing it wont be possible and we wont get a go ahead.
is there any alternative apart from upgrade (even a dirty one would do for
time being).
--
http://apache-wicket.1842946.n4.nabble.com/Overriding-wicket-ajax-jquery-js-tp4672051p4672064.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
avchavan
10 years ago
Permalink
This is what i get from view page source.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Overriding-wicket-ajax-jquery-js-tp4672051p4672067.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Martin Grigorov
10 years ago
Permalink
Post by avchavan
This is what i get from view page source.
It looks OK.
I guess you need to unregister the old listener before registering the new
one.
Post by avchavan
--
http://apache-wicket.1842946.n4.nabble.com/Overriding-wicket-ajax-jquery-js-tp4672051p4672067.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
avchavan
10 years ago
Permalink
so, call timer.stop() before download finishes?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Overriding-wicket-ajax-jquery-js-tp4672051p4672071.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
avchavan
10 years ago
Permalink
or may be if there is a way to discard wicket-ajax-jquery.js used by wicket
and use a duplicate (with the unload event)?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Overriding-wicket-ajax-jquery-js-tp4672051p4672066.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Martin Grigorov
10 years ago
Permalink
oh, right.
See application.getJavaScriptLibrarySettings().setWicketJQueryReference()

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
Post by avchavan
or may be if there is a way to discard wicket-ajax-jquery.js used by wicket
and use a duplicate (with the unload event)?
--
http://apache-wicket.1842946.n4.nabble.com/Overriding-wicket-ajax-jquery-js-tp4672051p4672066.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
avchavan
10 years ago
Permalink
I dont see setWicketJQueryReference, but there is setJQueryReference.
I hope you meant setJQueryReference only :)

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Overriding-wicket-ajax-jquery-js-tp4672051p4672070.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
Martin Grigorov
10 years ago
Permalink
I actually mean #setWicketAjaxReference()


https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/settings/JavaScriptLibrarySettings.java#L91

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
Post by avchavan
I dont see setWicketJQueryReference, but there is setJQueryReference.
I hope you meant setJQueryReference only :)
--
http://apache-wicket.1842946.n4.nabble.com/Overriding-wicket-ajax-jquery-js-tp4672051p4672070.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
avchavan
10 years ago
Permalink
The counter doesn't stop now, but i can see javascript errors in firebug:
ReferenceError: Wicket is not defined
Wicket.Class = {
,
TypeError: Wicket.Throttler is not a constructor
throttler: new Wicket.Throttler(true),
&
TypeError: Wicket.Ajax.DebugWindow is undefined
Wicket.Ajax.DebugWindow.enabled=true;

Here's my HTML from view page source:


I have included
as well because it didn't work without it (counter doesn't increment & i get
same javascript errors in firebug).

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Overriding-wicket-ajax-jquery-js-tp4672051p4672073.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org
avchavan
10 years ago
Permalink
What's happening now is the custom js is being loaded first hence i am
getting reference error.
Is there a way that the ajax js gets loaded after wicket's jquery and event
js?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Overriding-wicket-ajax-jquery-js-tp4672051p4672080.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@wicket.apache.org
For additional commands, e-mail: users-***@wicket.apache.org

Loading...