Shadowbox with Lightbox 2.0 plugin

Creating and modifying plugins.
Post Reply
User avatar
Dergln
Regular
Posts: 54
Joined: Thu Jun 23, 2011 8:18 pm
Location: Hessen
Contact:

Shadowbox with Lightbox 2.0 plugin

Post by Dergln » Tue Oct 28, 2014 11:04 pm

Hi,

since we got ourselves an updated lightbox plugin I took the time to check for compatibility with shadowbox.

"Why another ABC123...box ?"
jquery Lightbox doesn't support videos.
Also it seems to add another layer on top of the image so users can't "Save as", which is a showstopper for me. (might be configurable via an option, didn't find anything via Google though)

Inline changes are bold, you'll get the position of the bigger block once you looked at the code in serendipity_event_lightbox.php.
$propbag->add('select_values', array('colorbox' => 'ColorBox', 'lightbox2jq' => 'Lightbox 2 jQuery', 'magnific' => 'Magnific-Popup', 'prettyPhoto' => 'prettyPhoto', 'shadowbox' => 'shadowbox'));
if ($type == 'lightbox2jq' || $type == 'shadowbox') {
// shadowbox code - http://www.shadowbox-js.com/usage.html - http://www.shadowbox-js.com/options.html
elseif ($type == 'shadowbox') {
echo ' <link rel="stylesheet" type="text/css" href="' . $pluginDir . '/shadowbox/shadowbox.css" />' . "\n";
if (!class_exists('serendipity_event_jquery') && !$serendipity['capabilities']['jquery']) {
echo ' <script type="text/javascript" src="' . $pluginDir . '/jquery-1.11.1.min.js" charset="utf-8"></script>' . "\n";
}
echo ' <script type="text/javascript" src="' . $pluginDir . '/shadowbox/shadowbox.js" charset="utf-8"></script>' . "\n";
echo ' <script type="text/javascript" charset="utf-8">Shadowbox.init({autoplayMovies: "false", continuous: true, counterType: "skip", handleOversize: "resize", overlayOpacity: "0.66"});</script>' . "\n";
}
if ($type == 'lightbox2jq' || $type == 'shadowbox') {
###
if ($type == 'lightbox2jq' || $type == 'shadowbox') {
is working because shadowbox has a compatibility check which makes it work just fine with "rel=lightbox" as it would with "rel=shadowbox".

Greetings
Oliver

PS: "Why didn't you simply do this via git ?"
The shadowbox license says I am not allowed to redistribute the code.
Last edited by Dergln on Tue Oct 28, 2014 11:08 pm, edited 1 time in total.

User avatar
Dergln
Regular
Posts: 54
Joined: Thu Jun 23, 2011 8:18 pm
Location: Hessen
Contact:

Re: Shadowbox with Lightbox 2.0 plugin

Post by Dergln » Tue Oct 28, 2014 11:06 pm

PPS: Stumbled upon an interesting site !
> http://planetozh.com/projects/lightbox-clones/

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Shadowbox with Lightbox 2.0 plugin

Post by Timbalu » Wed Oct 29, 2014 11:47 am

Dergln wrote:"Why another ABC123...box ?"
jquery Lightbox doesn't support videos.
But the others do! Actually there is no need to use another lightbox for this.
Colorbox http://www.jacklmoore.com/colorbox/example2/
Magnfic http://codepen.io/collection/nLcqo
PrettyPhoto http://www.no-margin-for-errors.com/pro ... box-clone/ (scroll down to demos, when site is available again)

About the Serendipity lightbox plugin. Please note: It is designed for image links only, as the regex to convert entry image links on the fly checks for jpe?g|gif|png only. To support other content in the lightbox would need to set the rel, link to the scripts and init them manually for specific items.
Dergln wrote:Also it seems to add another layer on top of the image so users can't "Save as", which is a showstopper for me. (might be configurable via an option, didn't find anything via Google though)
Lightbox2 does not
Colorbox does allow
PrettyPhoto does not
MagnficPopup does allow

I for myself think this is good, as you can chose if you want to use a lightbox with direct image download access allowed or not. Actually there is no real way to forbid downloads at all, since everybody knowing a little more definitely knows how to get around restrictions like that. But it keeps a bunch of direct copy users away.
I think even for lightbox2 you could (easily) find a tweak somewhere to allow this again.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
yellowled
Regular
Posts: 7005
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Shadowbox with Lightbox 2.0 plugin

Post by yellowled » Wed Oct 29, 2014 3:41 pm

Timbalu wrote:Actually there is no real way to forbid downloads at all, since everybody knowing a little more definitely knows how to get around restrictions like that.
Right, there is no way to “protect” images on the web. The “disable right click” option usually works with JS, so if the user has JS disabled … etc.

If somebody wants to get your images on the web, they will get them. The best thing you can do to protect your rights to images is to include water marks, I guess.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
Dergln
Regular
Posts: 54
Joined: Thu Jun 23, 2011 8:18 pm
Location: Hessen
Contact:

Re: Shadowbox with Lightbox 2.0 plugin

Post by Dergln » Wed Oct 29, 2014 9:03 pm

Timbalu wrote:Actually there is no need to use another lightbox for this.
There doesn't seem to be a video-capable, save-allowing box that works and looks good except shadowbox, so I don't see an alternative for my taste.

(Your taste may differ.)

User avatar
yellowled
Regular
Posts: 7005
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Shadowbox with Lightbox 2.0 plugin

Post by yellowled » Wed Oct 29, 2014 9:08 pm

Dergln wrote:There doesn't seem to be a video-capable, save-allowing box that works and looks good except shadowbox, so I don't see an alternative for my taste.
As far as I understand it (IANAL), there is no license for Shadowbox which would even allow us to bundle it with the lightbox plugin for s9y since the s9y license explicitly allows commercial use.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
Dergln
Regular
Posts: 54
Joined: Thu Jun 23, 2011 8:18 pm
Location: Hessen
Contact:

Re: Shadowbox with Lightbox 2.0 plugin

Post by Dergln » Wed Oct 29, 2014 9:16 pm

yellowled wrote:As far as I understand it (IANAL)
I see it like you.

That's why I explicitly stated:
PS: "Why didn't you simply do this via git ?"
The shadowbox license says I am not allowed to redistribute the code.
Since I already own a license I can basically do whatever I please to with shadowbox anyway ;)

And if someone would like to add it to his s9y installation, he should be able to with my post.

Post Reply