From galleryformatter.js:

/*
* @FIXME
* Need to figure out a way to update the location bar of the browser, for bookmarking etc, without making the scroll jump
* window.location.hash = this.hash; solution below does update the location, but makes the scroll jump.
*/

We need this functionality, so I'm rolling it. What I did was change the hashtags just a bit in the theme, by adding "-slide" to the li id. The link does not have the additional "-slide", so it doesn't trigger a scrolling jump. However, I've modified the js to go ahead and look for "-slide", so the gallery functionality still works. Then I removed preventDefault() to allow the hashtag to go through to the browser. Presto!

Comments

srjosh’s picture

Status: Active » Needs review
manuel garcia’s picture

Version: 6.x-1.0-rc3 » 6.x-1.x-dev
Status: Needs review » Needs work
Issue tags: -hashtag

Indeed that's something waiting to be fixed for some time!

Thanks for the patch srjosh, but patch doesn't apply properly against 6.x-1.x-dev (new features are done allways against dev):

patching file ./theme/galleryformatter.js
Hunk #1 FAILED at 42.
Hunk #2 FAILED at 66.
2 out of 2 hunks FAILED -- saving rejects to file ./theme/galleryformatter.js.rej
patching file ./theme/galleryformatter.tpl.php
Hunk #1 succeeded at 28 with fuzz 2.

I think its because you created a new dir theme.new?

The easiest way to create a patch is:

  1. checkout form cvs the appropriate branch: http://drupal.org/node/794682/cvs-instructions/DRUPAL-6--1
  2. Make the changes you need to every file.
  3. Run the following command form the module's root directory: cvs diff -up > ~/galleryformatter-[issue-number].patch
manuel garcia’s picture

StatusFileSize
new2.17 KB

I was curious as to test this myself, so I made the few changes, and created a proper patch if anyone else wants to test this.

Although I admit it's a clever way to do it, I don't like the way we are tricking the browser, seems to me like a hack - a clever hack =)

The main reason not to commit this is that the deep linking would not work without JS turned on, since its the JS that gets the proper hash. In fact, this patch totaly breaks the gallery without JS turned on.

So I'm reluctant to commit this to the module, let's try find a cleaner way perhaps?

Anyone has a better idea?

srjosh’s picture

If by deep linking you mean that the url can be used to pick which image is showing on page load, then the changes I made account for that... as does the patch that you posted.

manuel garcia’s picture

Yes srjosh, that works great, but the gallery doesn't work at all with JS turned off.

manuel garcia’s picture

Status: Needs work » Needs review
StatusFileSize
new2.55 KB

OK, I gave this a bit more thought, and it could be implemented, but doing the heavy lifting on the JS side, to keep the gallery working without JS enabled, and the deeplinking without js enabled also working.

Here is an updated patch, basicaly adding the sufix to slide ids with JS instead of in the source markup throug the tpl.

I find it works perfectly on chrome, and on FF also if you open a deeplinked gallery, but, weirdly, in FF if I hit refresh on a gallery page that has a hash in the url, it doesnt show the appropiate image, and shows none. Very weird, can anyone else confirm this? I couldn't track down why.

Testers very welcome!

srjosh’s picture

This works really well. I experienced the same issue. It seems to have something to do with inheritance/cascading of the css positioning.

in galleryformatter.css, line 2:

.galleryformatter { margin: 0 auto; position: relative; }

This seems to fix it.

srjosh’s picture

Assigned: srjosh » Unassigned
astonvictor’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

I'm closing it because the issue was created a long time ago without any further steps.

if you still need it then raise a new one.
thanks