When I started this extension, there really was no alternative to YUI3 History.
The only jQuery alternative I can find today is jQuery Hashchange
https://github.com/cowboy/jquery-hashchange
But hasn't been maintained for 2 years.

Any ideas on doing it with jQuery? The YUI library seems overkill, and maybe a jQuery solution is better for Drupal's performance.

CommentFileSizeAuthor
#8 1668534-8.patch18.19 KBAnonymous (not verified)
#4 search_api_ajax-switch-to-bbq-1668534-4.patch6.35 KBjsacksick

Comments

jsacksick’s picture

I think we should use BBQ which is already used in Drupal, it's already in the misc folder and I think the overlay is using it.
Here are some examples :
http://benalman.com/code/projects/jquery-bbq/examples/fragment-advanced

Anonymous’s picture

That is a very good suggestion, I will check it out.

davidseth’s picture

Using BBQ (native Drupal) would be awesome! Thanks @jsacksick for the great idea. I am very happy to see this project moving forward :)

jsacksick’s picture

Ok I replaced and tested a bit, and everything seems ok. I also removed the livequery plugin as I don't really understand why we're using it.
I replace all the livequery by a jquery live and it still works.
Tested with views + facetapi.

jsacksick’s picture

Status: Active » Needs review
Anonymous’s picture

I was testing this with Facet API blocks. When I applied the patch, clicking on Facet links resulted in an incorrect request path. The query part of the path included the base path of the page, rather than just adding the query.

Reverting the patch restored the expected behavior.

Anonymous’s picture

Will be able to review this patch next week. I would like to add fragments for order, sort, page etc. as well, like I did here #1667922: Improve AJAX, implement Pretty Facet Paths #path, Views #page, etc. (need to merge that patch with this one).

Anonymous’s picture

StatusFileSize
new18.19 KB

I have an exciting patch ready. It merges jsacksick's work on jQuery BBQ, along with my improvements from #1667922.
This patch completely drops YUI and also is a "re-write" (more of a cleanup) of search_api_ajax.js.

This patch supports not just 1 hash state, but many:

  /**
   * We use the following jQuery BBQ hash states:
   *
   * #path: the pretty facet path
   * #query: search ?query=<query>
   * #sort: sort field name
   * #order: sort order
   * #items_per_page: Views items_per_page
   * #page: Views paging
   */

Important note: this patch makes facetapi_pretty_path a dependency,... because it's so much easier to work with the AJAX.

I'm eager to commit this patch soon. Maybe we can add more states? I've implement Views stuff like items_per_page and page for pagination, sort and order. This patch should support Search API Ranges, and Seach API Sorts.

So please try it...

Anonymous’s picture

Status: Needs review » Fixed

After some more testing I decided to go ahead and patch this up.
http://drupalcode.org/project/search_api_ajax.git/commit/5f08d16

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.