jQuery history plugin (repost)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

jQuery history plugin (repost)

Jan van de Sandt
Hello list,

I am trying to add support for the jQuery history plugin (http://github.com/tkyk/jquery-history-plugin) to Seaside. The API of the plugin looks pretty simple but I don't know how to integrate it with the Seaside jQuery support.

In the onLoad on ready function you should register a callback function using $.history.init(callback). This callback function gets called with a url hash value as an argument. This function should get the new content from the server using an AJAX request.

For the AJAX links on your page that should be bookmarkable and should support the backbutton you must use the $.history.load('#some_anchor') function.

In Seaside this should look something like:

    html anchor 
        onClick: (html jQuery history load: '#link1');
        with: 'Link 1'.

And the init function can be called as part of the onLoad scripts:

    html document addLoadScript: 
        (html jQuery history init: [ :anchor | self updateUsingAnchor: anchor ])

This second fragment is probably totally wrong. The update method needs something to render on. Can anybody push me in the right direction?

Jan.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: jQuery history plugin (repost)

Bart Veenstra
Hi Jan,

I have wrapped the excellent jquery plugin JQuery Address. The api looks like the following:

html document addLoadScript: (html jQuery address onChangeCallback: 
[:event :s |
s << (s jQuery id: #log)
append: [:h | html paragraph: event printString]]).

This binds a callback to the address change event. You could also use the init for handling the event once, or bind an event handler to the externalpagechanged event as described on http://www.asual.com/jquery/address/docs/

To bind history support to jquery elements:

html document addLoadScript: (html jQuery expression: 'a') address.

The event passed to the callback consists of the following fields: value path pathNames parameters queryString 

I plan to release it in the pharo jqwidget-box project, but still a n00b on Pharo and monticello (too difficult compared with cincom), so i have put it into the cincom public repository. 

Packages:
JQWidgetbox-JQAddress  -> core libraries
JQWidgetBox-JQAddress-Dev -> demo app

Regards,

Bart 











2010/9/14 Jan van de Sandt <[hidden email]>
Hello list,

I am trying to add support for the jQuery history plugin (http://github.com/tkyk/jquery-history-plugin) to Seaside. The API of the plugin looks pretty simple but I don't know how to integrate it with the Seaside jQuery support.

In the onLoad on ready function you should register a callback function using $.history.init(callback). This callback function gets called with a url hash value as an argument. This function should get the new content from the server using an AJAX request.

For the AJAX links on your page that should be bookmarkable and should support the backbutton you must use the $.history.load('#some_anchor') function.

In Seaside this should look something like:

    html anchor 
        onClick: (html jQuery history load: '#link1');
        with: 'Link 1'.

And the init function can be called as part of the onLoad scripts:

    html document addLoadScript: 
        (html jQuery history init: [ :anchor | self updateUsingAnchor: anchor ])

This second fragment is probably totally wrong. The update method needs something to render on. Can anybody push me in the right direction?

Jan.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: jQuery history plugin (repost)

Bart Veenstra
I managed to export it with the monticello plugin in VW. 

Attached as a mcz.

Regards,

Bart



2010/9/14 Bart Veenstra <[hidden email]>
Hi Jan,

I have wrapped the excellent jquery plugin JQuery Address. The api looks like the following:

html document addLoadScript: (html jQuery address onChangeCallback: 
[:event :s |
s << (s jQuery id: #log)
append: [:h | html paragraph: event printString]]).

This binds a callback to the address change event. You could also use the init for handling the event once, or bind an event handler to the externalpagechanged event as described on http://www.asual.com/jquery/address/docs/

To bind history support to jquery elements:

html document addLoadScript: (html jQuery expression: 'a') address.

The event passed to the callback consists of the following fields: value path pathNames parameters queryString 

I plan to release it in the pharo jqwidget-box project, but still a n00b on Pharo and monticello (too difficult compared with cincom), so i have put it into the cincom public repository. 

Packages:
JQWidgetbox-JQAddress  -> core libraries
JQWidgetBox-JQAddress-Dev -> demo app

Regards,

Bart 











2010/9/14 Jan van de Sandt <[hidden email]>
Hello list,

I am trying to add support for the jQuery history plugin (http://github.com/tkyk/jquery-history-plugin) to Seaside. The API of the plugin looks pretty simple but I don't know how to integrate it with the Seaside jQuery support.

In the onLoad on ready function you should register a callback function using $.history.init(callback). This callback function gets called with a url hash value as an argument. This function should get the new content from the server using an AJAX request.

For the AJAX links on your page that should be bookmarkable and should support the backbutton you must use the $.history.load('#some_anchor') function.

In Seaside this should look something like:

    html anchor 
        onClick: (html jQuery history load: '#link1');
        with: 'Link 1'.

And the init function can be called as part of the onLoad scripts:

    html document addLoadScript: 
        (html jQuery history init: [ :anchor | self updateUsingAnchor: anchor ])

This second fragment is probably totally wrong. The update method needs something to render on. Can anybody push me in the right direction?

Jan.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

JQuery-WidgetBox-tbn.42.mcz (560K) Download Attachment
JQWidgetBox-JQAddress-Dev-bveenstra.1.mcz (1K) Download Attachment