summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--js/lightbox.js31
-rw-r--r--lightbox2.module23
2 files changed, 48 insertions, 6 deletions
diff --git a/js/lightbox.js b/js/lightbox.js
index ac28902..b3b104b 100644
--- a/js/lightbox.js
+++ b/js/lightbox.js
@@ -71,6 +71,7 @@ var Lightbox = {
// MAKE THE LIGHTBOX DIVS
// Code inserts html at the bottom of the page that looks similar to this:
+ // (default layout)
//
// <div id="overlay"></div>
// <div id="lightbox">
@@ -103,6 +104,8 @@ var Lightbox = {
// </div>
// </div>
+ var settings = Drupal.settings.lightbox2;
+
var Body = document.getElementsByTagName("body").item(0);
var Overlay = document.createElement("div");
@@ -129,7 +132,9 @@ var Lightbox = {
var HoverNav = document.createElement("div");
HoverNav.setAttribute('id', 'hoverNav');
- ImageContainer.appendChild(HoverNav);
+ if (!settings.use_alt_layout) {
+ ImageContainer.appendChild(HoverNav);
+ }
var PrevLink = document.createElement("a");
PrevLink.setAttribute('id', 'prevLink');
@@ -158,6 +163,9 @@ var Lightbox = {
var ImageData = document.createElement("div");
ImageData.setAttribute('id', 'imageData');
ImageDataContainer.appendChild(ImageData);
+ if (settings.use_alt_layout) {
+ ImageData.appendChild(HoverNav);
+ }
var ImageDetails = document.createElement("div");
ImageDetails.setAttribute('id', 'imageDetails');
@@ -173,8 +181,6 @@ var Lightbox = {
var BottomNav = document.createElement("div");
BottomNav.setAttribute('id', 'bottomNav');
- ImageData.appendChild(BottomNav);
-
var BottomNavCloseLink = document.createElement("a");
BottomNavCloseLink.setAttribute('id', 'bottomNavClose');
@@ -185,6 +191,13 @@ var Lightbox = {
BottomNavZoomLink.setAttribute('id', 'bottomNavZoom');
BottomNavZoomLink.setAttribute('href', '#');
BottomNav.appendChild(BottomNavZoomLink);
+ if (settings.use_alt_layout) {
+ ImageContainer.appendChild(BottomNav);
+ }
+ else {
+ ImageData.appendChild(BottomNav);
+ }
+
$("#overlay").click(function() { Lightbox.end(); } ).hide();
@@ -199,6 +212,11 @@ var Lightbox = {
$('#prevLink').css({ paddingTop: Lightbox.borderSize});
$('#nextLink').css({ paddingTop: Lightbox.borderSize});
+ // Force navigation links to always be displayed
+ if (settings.force_show_nav) {
+ $('#prevLink').addClass("force_show_nav");
+ $('#nextLink').addClass("force_show_nav");
+ }
},
@@ -407,8 +425,11 @@ var Lightbox = {
}
}
- $('#prevLink').css({height: imgHeight + 'px'});
- $('#nextLink').css({height: imgHeight + 'px'});
+ var settings = Drupal.settings.lightbox2;
+ if (!settings.use_alt_layout) {
+ $('#prevLink').css({height: imgHeight + 'px'});
+ $('#nextLink').css({height: imgHeight + 'px'});
+ }
$('#imageDataContainer').css({width: widthNew + 'px'});
},
diff --git a/lightbox2.module b/lightbox2.module
index f8bdbe4..03402f8 100644
--- a/lightbox2.module
+++ b/lightbox2.module
@@ -155,6 +155,22 @@ function lightbox2_settings_form() {
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
+
+ // Add Checkbox for Alternative Layout
+ $form['lightbox2_general_options']['lightbox2_use_alt_layout'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Use Alternative Layout'),
+ '#description' => t('Enabling this option alters the layout of the lightbox elements. This doesn\'t apply when using Lightbox Lite.'),
+ '#default_value' => variable_get('lightbox2_use_alt_layout', false),
+ );
+
+ // Add Checkbox for Force Navigation display
+ $form['lightbox2_general_options']['lightbox2_force_show_nav'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Force visibility of navigation links'),
+ '#description' => t('When viewing grouped images using the default layout, the navigational links to the next and previous images are only displayed when you hover over the image. Checking this box forces these links to be displayed all the time.'),
+ '#default_value' => variable_get('lightbox2_force_show_nav', false),
+ );
// Add text box for image count for grouping
$form['lightbox2_general_options']['lightbox2_image_count_str'] = array(
@@ -171,7 +187,7 @@ function lightbox2_settings_form() {
'#description' => t('By default, when the image being displayed in the lightbox is larger than the browser window, it is resized to fit within the window and a zoom button is provided for users who wish to view the image in its original size. Checking this box will disable this feature and all images will be displayed without any resizing.'),
'#default_value' => variable_get('lightbox2_disable_zoom', false),
);
-
+
// Add Checkbox for Gallery2 Image Filter.
$form['lightbox2_general_options']['lightbox2G2_filter'] = array(
'#type' => 'checkbox',
@@ -275,7 +291,9 @@ function lightbox2_add_files() {
// load the javascript settings
$js_settings = array(
+ 'use_alt_layout' => variable_get('lightbox2_use_alt_layout', false),
'disable_zoom' => variable_get('lightbox2_disable_zoom', false),
+ 'force_show_nav' => variable_get('lightbox2_force_show_nav', false),
'group_images' => variable_get('lightbox2_image_group', true),
'disable_for_gallery_lists' => variable_get('lightbox2_disable_nested_galleries', true),
'node_link_text' => t(variable_get('lightbox2_node_link_text', 'View Image Details')),
@@ -287,6 +305,9 @@ function lightbox2_add_files() {
// Lightbox2 Plus
if (!variable_get('lightbox2_lite', false)) {
$css = $path .'/css/lightbox.css';
+ if (variable_get('lightbox2_use_alt_layout', false)) {
+ $css = $path .'/css/lightbox_alt.css';
+ }
if (function_exists('drupal_add_css')) {
drupal_add_css($css);
}