joeblack9988 / slideshow

Automatically exported from code.google.com/p/slideshow
0 stars 0 forks source link

Enhancement for href behavior #192

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This code in function load() could be enhanced:

     href = obj.href ? obj.href.trim() : (this.options.linked ? image : this.options.href),

I would like a flag to easily choose the behaviour of the mouse click, whether 
that is Nothing, Linking to the global href, linking to the image href, or 
linking to the image source. The above "do this if this is set, or do this if 
it isn't set unless we do this" makes it more complicated than it needs to be 
when combining different options and different data sets.

I have a suggestion below, and it is backwards compatible with existing 
configurations. It only becomes active if someone uses linked = "none" for 
example, instead of the default linked = false.

if(this.options.linked == "none") {
  href = '';
} else if(this.options.linked == "global_href") {
  href = this.options.href;
} else if(this.options.linked == "image_href") {
  href = obj.href;
} else if(this.options.linked == "image_src") {
  href = image;
} else {
  href = obj.href ? obj.href.trim() : (this.options.linked ? image : this.options.href)
}

BTW Aaron, this is for my WordPress plugin based on Slideshow2! - it reads all 
data from RSS feeds - which I just released today:  :-)
http://wordpress.org/extend/plugins/blip-slideshow/

Original issue reported on code.google.com by jason%he...@gtempaccount.com on 17 Apr 2011 at 7:07

GoogleCodeExporter commented 8 years ago
Thanks! So the current setup works a bit differently - there is a priority:

- If that image has an "href" parameter set in the data object, use that, 
otherwise...
- If the slideshow "linked" option is set, automatically link each slide to the 
image, otherwise...
- Use the slideshow "href" (default is empty string)

During playback if the href is an empty string (falsey) it removes the "href" 
attribute for that slide. These are the use case scenarios:

- I want every slide to link to the same place => use the slideshow "href"
- I want every slide to link to the same place, except for n slides => use the 
slideshow "href" and then individual "href" parameters in the data object
- I want every slide to link to the image (typical for integration with 
lightbox) => use the slideshow "linked"
- I want every slide to link to the image, except for n slides => use the 
slideshow "linked" and then individual "href" parameters in the data object
- I want every slide to link to a different, arbitrary place, or nowhere => use 
the "href" parameters in the data object

I think the current code achieves that with minimal "bytes" (filesize is always 
a concern in javascript-land).

BTW great work on the plugin - I added it to the home page on Google Code!

Original comment by aeron.gl...@gmail.com on 17 Apr 2011 at 2:55

GoogleCodeExporter commented 8 years ago
thanks for the feedback! Yes my code is definitely bigger. I have been accused 
of code bloat before :-D

allow me to explain my case one more time..  as an example let's say the 
slideshow is activated on a SmugMug gallery of 200 photos in wordpress with a 
shortcode like this:

[slideshow]

I can do scenario 1: [slideshow href='']
I can not do scanario 2: [slideshow href='' slide1_href='' slide2_href''] - 
because who knows which photos i am referring to; they are grabbed from RSS not 
hardcoded by the user and the RSS has its own hrefs
I can do scenario 3: [slideshow linked]
I can not do scnaerio 4, same reason, [slideshow linked slide1_href='' 
slide2_href'']
I can not do scenario 5, same reason: [slideshow slide1_href='' slide2_href'']

But I admit this a problem implicit to my plugin's use, where overriding hrefs 
is not easily described... so I can just analyze the contents of the linked 
parameter in my code, and pass on the data the way Slideshow2 wants it. I just 
felt it was better for Slideshow2 to have the data and not need it then to not 
have it.

[slideshow linked="none"]
[slideshow linked="http://someurl"]
[slideshow linked="image_src"]
[slideshow linked="image_href"]
[slideshow linked]
[slideshow linked=false]

thank-you for listing my plugin... 120 downloads in 12 hours! Would you mind 
adding "WordPress plugin" to the end of the link so people know what they're 
linking to? Thanks :-)

Original comment by jason%he...@gtempaccount.com on 17 Apr 2011 at 3:59