summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThe Great Git Migration2006-04-30 22:36:11 (GMT)
committerThe Great Git Migration2006-04-30 22:36:11 (GMT)
commit2c03fda6091b78539971a0c9e72d93b31f00cf46 (patch)
tree8faed046b918a2f6360e2a22c2618bd5493a6f11
parentac8f2befd5d11c83c82b54bbcbf571338507dbc5 (diff)
This commit was manufactured as part of Drupal's Great Git Migration to4.6.x-1.x
create branch 'DRUPAL-4-6'. Sprout from master 2006-04-30 22:36:10 UTC Mark A <bugz_nz@52392.no-reply.drupal.org> 'Lightbox Module V2 - Changed licensing information and added information about image bug fix.' Cherrypick from master 2006-04-18 21:03:16 UTC Mark A <bugz_nz@52392.no-reply.drupal.org> 'Lightbox Module V2 - 4.6.x - General tidy up/bug fixes.': lightbox2.module Delete: js/image_nodes.js
-rw-r--r--js/image_nodes.js15
-rw-r--r--lightbox2.module104
2 files changed, 15 insertions, 104 deletions
diff --git a/js/image_nodes.js b/js/image_nodes.js
deleted file mode 100644
index 33c111b..0000000
--- a/js/image_nodes.js
+++ /dev/null
@@ -1,15 +0,0 @@
-function lightbox2_image_nodes() {
- var nodes = document.getElementsByClassName("image");
- for (var i = 0; i < nodes.length; i++) {
- if (Element.hasClassName(nodes[i], "thumbnail")) {
- var parent = nodes[i].parentNode;
- parent.rel = "lightbox[node_thumbnails]";
- parent.href = nodes[i].src.replace(".thumbnail", "");
- parent.title = nodes[i].alt;
- }
- }
-}
-
-if (isJsEnabled()) {
- addLoadEvent(lightbox2_image_nodes);
-} \ No newline at end of file
diff --git a/lightbox2.module b/lightbox2.module
index 8563519..8ca705c 100644
--- a/lightbox2.module
+++ b/lightbox2.module
@@ -3,32 +3,36 @@
* Enables the use of lightbox V2 which places images above your current page, not within.
* This frees you from the constraints of the layout, particularly column widths.
*
- * This module is for Drupal 4.7.x only.
+ * This Module is for Drupal 4.6.x Only.
*
* Module by: Mark Ashmead
* Mailto: bugzie@gmail.com
- *
- * Image Node Support: Steve McKenzie
- *
*/
/**
- * GLOBAL VARIABLES
+ * Provides a link to the CSS stylesheet associated with this module.
+ * Provides a link to the JS file associated with this module.
*/
-$LIGHTBOX2_INCLUDE = false;
+function lightbox2_html_head() {
+ $output = '<script type="text/javascript" src="'. drupal_get_path('module', 'lightbox2') .'/js/prototype.js"></script><script type="text/javascript" src="'. drupal_get_path('module', 'lightbox2') .'/js/scriptaculous.js"></script><script type="text/javascript" src="'. drupal_get_path('module', 'lightbox2') .'/js/lightbox.js"></script>';
+ $output .= theme('stylesheet_import', drupal_get_path('module', 'lightbox2') .'/lightbox.css','screen');
+ return $output;
+}
+/*Puts the specified information into the drupal head.*/
+{
+drupal_set_html_head(lightbox2_html_head());
+ }
+
/**
* Displays the information for this module.
* Displays the help text for this module.
*
*/
-/**
- * Implementation of hook_help().
- */
function lightbox2_help($section) {
switch ($section) {
case 'admin/modules#description':
- return t('Enables Lightbox V2 for Drupal');
+ return t('Enables Lightbox V2 for Drupal 4.6.x');
case 'admin/help#lightbox2':
return t('<h3>Overview</h3>
<p align="justify">Lightbox JS V2 is a simple, unobtrusive script used to overlay images on the current page. It\'s a snap to setup and works on all modern browsers.</p>
@@ -44,83 +48,5 @@ function lightbox2_help($section) {
break;
}
}
+?>
-/**
- * Implementation of hook_nodeapi().
- */
-function lightbox2_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
- global $LIGHTBOX2_INCLUDE;
-
- if ($op == "view" && !$LIGHTBOX2_INCLUDE) {
- lightbox2_add_files();
- $LIGHTBOX2_INCLUDE = true;
- }
-}
-
-/**
- * Implementation of hook_settings().
- */
-function lightbox2_settings() {
- $form["image_node_options"] = array(
- "#type" => "fieldset",
- "#title" => t("Image Node formatting options")
- );
- // Add Checkbox for Image Node
- $form["image_node_options"]["lightbox2_image_node"] = array(
- "#type" => "checkbox",
- "#title" => t("Enable for Image Nodes"),
- "#default_value" => variable_get("lightbox2_image_node", true),
- "#return_value" => true
- );
- // Add Checkbox for Gallery2 Image Filter
- $form["image_node_options"]["lightbox2G2_image_node"] = array(
- "#type" => "checkbox",
- "#title" => t("Enable Gallery 2 Filter"),
- "#default_value" => variable_get("lightbox2G2_image_node", true),
- "#return_value" => true
- );
-
- return $form;
-}
-/**
- *Implementation of hook_filter().
- */
-function lightbox2_filter_tips($delta, $format, $long = false) {
- return t('Image links from G2 are formatted for use with Lightbox.V2');
-}
-// Check to see if the G2 Filter is Enabled in Settings
-if (variable_get("lightbox2G2_image_node", true)) {
-function lightbox2_filter($op, $delta = 0, $format = -1, $text = '') {
- switch ($op) {
- case 'list':
- return array(0 => t('Lightbox filter'));
- case 'description':
- return t('Turns g2_filter links into Lighbox.V2 appropriate links');
- case 'process':
- $text = ' ' . $text . ' ';
- $text = preg_replace('/ShowItem/','DownloadItem',$text);
- $text = preg_replace('/target=""/','rel="lightbox"',$text);
- $text = substr($text, 1, -1);
- return $text;
- default:
- return $text;
- }
- }
-}
-/**
- * Provides a link to the CSS stylesheet associated with this module.
- * Provides a link to the JS file associated with this module.
- */
-
-function lightbox2_add_files() {
- // Load required js and css files.
- $path = drupal_get_path('module', 'lightbox2');
- theme("add_style", $path . '/lightbox.css');
- drupal_add_js($path . '/js/prototype.js');
- // Check to see if the Image Node Option is Enabled in Settings
- if (variable_get("lightbox2_image_node", true)) {
- drupal_add_js(drupal_get_path("module", "lightbox2"). "/js/image_nodes.js");
- }
- drupal_add_js($path . '/js/scriptaculous.js');
- drupal_add_js($path . '/js/lightbox.js');
-}