re staged lightbox2 to git tree

This commit is contained in:
2021-05-11 10:01:05 +02:00
parent 1be79e1e06
commit 7b1e954f7f
49 changed files with 12825 additions and 0 deletions

View File

@@ -0,0 +1,226 @@
// Image Node Auto-Format with Auto Image Grouping.
// Original version by Steve McKenzie.
// Altered by Stella Power for jQuery version.
(function ($) {
function parse_url(url, param) {
param = param.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
url = url.replace(/&/, "&");
var regexS = "[\\?&]"+param+"=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(url);
if (results === null) {
return "";
}
else {
return results[1];
}
}
function lightbox2_init_triggers(classes, rel_type, custom_class) {
if (classes == '' || rel_type == 0) {
return;
}
var settings = Drupal.settings.lightbox2;
var link_target = "";
if (settings.node_link_target !== 0) {
link_target = 'target="'+ settings.node_link_target +'"';
}
$("a:has("+classes+")").each(function(i) {
if ((!settings.disable_for_gallery_lists && !settings.disable_for_acidfree_gallery_lists) || (!$(this).parents("td.giAlbumCell").attr("class") && !$(this).parents(".galleries").length && !$(this).parents(".acidfree-folder").length && !$(this).parents(".acidfree-list").length) || ($(this).parents(".galleries").length && !settings.disable_for_gallery_lists) || (($(this).parents(".acidfree-folder").length || $(this).parents(".acidfree-list").length) && !settings.disable_for_acidfree_gallery_lists)) {
var child = $(this).find(classes);
// Ensure the child has a class attribute we can work with.
if ($(child).attr("class")) {
// Set the alt text.
var alt = $(child).attr("alt");
if (!alt) {
alt = "";
}
// Set the image node link text.
var link_text = settings.node_link_text;
var download_link_text = settings.download_link_text;
var rewrite = 1;
// Set the rel attribute.
var rel = "lightbox";
var lightframe = false;
if (rel_type == "lightframe_ungrouped") {
rel = "lightframe[]";
lightframe = true;
}
else if (rel_type == "lightframe") {
lightframe = true;
}
else if (rel_type == "lightbox_ungrouped") {
rel = "lightbox[]";
}
if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") {
rel = rel_type + "[" + $(child).attr("class") + "]";
}
// Set the basic href attribute - need to ensure there's no language
// string (e.g. /en) prepended to the URL.
var id = null;
var href = $(child).attr("src");
var download = null;
var orig_href = $(this).attr("href");
var pattern = new RegExp(settings.file_path);
if (orig_href.match(pattern)) {
var lang_pattern = new RegExp(Drupal.settings.basePath + "\\w\\w\\/");
orig_href = orig_href.replace(lang_pattern, Drupal.settings.basePath);
}
var frame_href = orig_href;
// Handle flickr images.
if ($(child).attr("class").match("flickr-photo-img") ||
$(child).attr("class").match("flickr-photoset-img")) {
href = $(child).attr("src").replace("_s.", ".").replace("_t.", ".").replace("_m.", ".").replace("_b.", ".");
if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") {
rel = rel_type + "[flickr]";
if ($(child).parents("div.block-flickr").attr("class")) {
id = $(child).parents("div.block-flickr").attr("id");
rel = rel_type + "["+ id +"]";
}
}
download = href;
}
// Handle "image-img_assist_custom" images.
else if ($(child).filter("img[class*=img_assist_custom]").size()) {
// Image assist uses "+" signs for spaces which doesn't work for
// normal links.
if (settings.display_image_size != "original") {
orig_href = orig_href.replace(/\+/, " ");
href = $(child).attr("src").replace(new RegExp("\\.img_assist_custom-[0-9]+x[0-9]+"), ((settings.display_image_size === "")?settings.display_image_size:"."+ settings.display_image_size));
if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") {
rel = rel_type + "[node_images]";
}
if (lightframe) {
frame_href = orig_href + "/lightbox2";
}
}
else {
rewrite = 0;
}
}
// Handle "inline" images.
else if ($(child).attr("class").match("inline")) {
href = orig_href;
}
// Handle gallery2 block images.
else if ($(child).attr("class").match("ImageFrame_image") || $(child).attr("class").match("ImageFrame_none")) {
var thumb_id = parse_url(href, "g2_itemId");
var new_id = parse_url(orig_href, "g2_itemId");
if (new_id && thumb_id) {
var g2pattern = new RegExp("g2_itemId="+thumb_id);
var replacement = "g2_itemId="+ new_id;
href = href.replace(g2pattern, replacement);
}
rel = rel_type + "[gallery2]";
if ($(child).parents("div.block-gallery").attr("class")) {
id = $(child).parents("div.block-gallery").attr("id");
rel = rel_type + "["+ id +"]";
}
download = href;
}
// Set the href attribute.
else if (settings.image_node_sizes != '()' && !custom_class) {
if (settings.display_image_size != "original") {
href = $(child).attr("src").replace(new RegExp(settings.image_node_sizes), ((settings.display_image_size === "")?settings.display_image_size:"."+ settings.display_image_size)).replace(/(image\/view\/\d+)(\/[\w\-]*)/, ((settings.display_image_size === "")?"$1/_original":"$1/"+ settings.display_image_size));
if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") {
rel = rel_type + "[node_images]";
if ($(child).parents("div.block-multiblock,div.block-image").attr("class")) {
id = $(child).parents("div.block-multiblock,div.block-image").attr("id");
rel = rel_type + "["+ id +"]";
}
}
download = $(child).attr("src").replace(new RegExp(settings.image_node_sizes), "").replace(/(image\/view\/\d+)(\/[\w\-]*)/, "$1/_original");
if (lightframe) {
frame_href = orig_href + "/lightbox2";
}
}
else {
rewrite = 0;
}
}
// Modify the image url.
var img_title = $(child).attr("title");
if (!img_title) {
img_title = $(this).attr("title");
if (!img_title) {
img_title = $(child).attr("alt");
}
$(child).attr({title: img_title});
}
if (lightframe) {
href = frame_href;
}
if (rewrite) {
if (!custom_class) {
var title_link = "";
if (link_text.length) {
title_link = "<br /><br /><a href=\"" + orig_href + "\" id=\"lightbox2-node-link-text\" "+ link_target +" >"+ link_text + "</a>";
}
if (download_link_text.length && download) {
title_link = title_link + " - <a href=\"" + download + "\" id=\"lightbox2-download-link-text\" target=\"_blank\">" + download_link_text + "</a>";
}
rel = rel + "[" + img_title + title_link + "]";
$(this).attr({
rel: rel,
href: href
});
}
else {
if (rel_type != "lightbox_ungrouped" && rel_type != "lightframe_ungrouped") {
rel = rel_type + "[" + $(child).attr("class") + "]";
if ($(child).parents("div.block-image").attr("class")) {
id = $(child).parents("div.block-image").attr("id");
rel = rel_type + "["+ id +"]";
}
}
rel = rel + "[" + img_title + "]";
$(this).attr({
rel: rel,
href: orig_href
});
}
}
}
}
});
}
function lightbox2_image_nodes() {
var settings = Drupal.settings.lightbox2;
// Don't do it on the image assist popup selection screen.
var img_assist = document.getElementById("img_assist_thumbs");
if (!img_assist) {
// Select the enabled image types.
lightbox2_init_triggers(settings.trigger_lightbox_classes, "lightbox_ungrouped");
lightbox2_init_triggers(settings.custom_trigger_classes, settings.custom_class_handler, true);
lightbox2_init_triggers(settings.trigger_lightbox_group_classes, "lightbox");
lightbox2_init_triggers(settings.trigger_slideshow_classes, "lightshow");
lightbox2_init_triggers(settings.trigger_lightframe_classes, "lightframe_ungrouped");
lightbox2_init_triggers(settings.trigger_lightframe_group_classes, "lightframe");
}
}
Drupal.behaviors.initAutoLightbox = {
attach: function(context, settings) {
lightbox2_image_nodes();
}
};
//End jQuery block
}(jQuery));

View File

@@ -0,0 +1,136 @@
// script.aculo.us builder.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/
var Builder = {
NODEMAP: {
AREA: 'map',
CAPTION: 'table',
COL: 'table',
COLGROUP: 'table',
LEGEND: 'fieldset',
OPTGROUP: 'select',
OPTION: 'select',
PARAM: 'object',
TBODY: 'table',
TD: 'table',
TFOOT: 'table',
TH: 'table',
THEAD: 'table',
TR: 'table'
},
// note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken,
// due to a Firefox bug
node: function(elementName) {
elementName = elementName.toUpperCase();
// try innerHTML approach
var parentTag = this.NODEMAP[elementName] || 'div';
var parentElement = document.createElement(parentTag);
try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
parentElement.innerHTML = "<" + elementName + "></" + elementName + ">";
} catch(e) {}
var element = parentElement.firstChild || null;
// see if browser added wrapping tags
if(element && (element.tagName.toUpperCase() != elementName))
element = element.getElementsByTagName(elementName)[0];
// fallback to createElement approach
if(!element) element = document.createElement(elementName);
// abort if nothing could be created
if(!element) return;
// attributes (or text)
if(arguments[1])
if(this._isStringOrNumber(arguments[1]) ||
(arguments[1] instanceof Array) ||
arguments[1].tagName) {
this._children(element, arguments[1]);
} else {
var attrs = this._attributes(arguments[1]);
if(attrs.length) {
try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
parentElement.innerHTML = "<" +elementName + " " +
attrs + "></" + elementName + ">";
} catch(e) {}
element = parentElement.firstChild || null;
// workaround firefox 1.0.X bug
if(!element) {
element = document.createElement(elementName);
for(attr in arguments[1])
element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
}
if(element.tagName.toUpperCase() != elementName)
element = parentElement.getElementsByTagName(elementName)[0];
}
}
// text, or array of children
if(arguments[2])
this._children(element, arguments[2]);
return element;
},
_text: function(text) {
return document.createTextNode(text);
},
ATTR_MAP: {
'className': 'class',
'htmlFor': 'for'
},
_attributes: function(attributes) {
var attrs = [];
for(attribute in attributes)
attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) +
'="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'&quot;') + '"');
return attrs.join(" ");
},
_children: function(element, children) {
if(children.tagName) {
element.appendChild(children);
return;
}
if(typeof children=='object') { // array can hold nodes and text
children.flatten().each( function(e) {
if(typeof e=='object')
element.appendChild(e)
else
if(Builder._isStringOrNumber(e))
element.appendChild(Builder._text(e));
});
} else
if(Builder._isStringOrNumber(children))
element.appendChild(Builder._text(children));
},
_isStringOrNumber: function(param) {
return(typeof param=='string' || typeof param=='number');
},
build: function(html) {
var element = this.node('div');
$(element).update(html.strip());
return element.down();
},
dump: function(scope) {
if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope
var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " +
"BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " +
"FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+
"KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+
"PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+
"TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);
tags.each( function(tag){
scope[tag] = function() {
return Builder.node.apply(Builder, [tag].concat($A(arguments)));
}
});
}
}

1122
sites/all/modules/lightbox2/js/effects.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,192 @@
/* $Id: lightbox2.js,v 1.1.4.39 2010/06/07 15:24:24 snpower Exp $ */
// start jQuery block
(function ($) {
function alt_layout_handler(event) {
if ($("input[name=lightbox2_lite]:checked").val() != 1) {
if ($("input[name=lightbox2_use_alt_layout]:checked").val() == 1) {
$("input[name=lightbox2_force_show_nav]").attr("disabled", "disabled");
}
else {
$("input[name=lightbox2_force_show_nav]").removeAttr("disabled");
}
}
}
function zoom_handler(event) {
if ($("input[name=lightbox2_disable_resize]:checked").val() == 1) {
$("input[name=lightbox2_disable_zoom]").attr("disabled", "disabled");
}
else {
$("input[name=lightbox2_disable_zoom]").removeAttr("disabled");
}
}
function lightbox2_lite_general_handler(event) {
// Enable / disable the non-lightbox2-lite options.
if ($("input[name=lightbox2_lite]:checked").val() == 1) {
$("input[name=lightbox2_use_alt_layout]").attr("disabled", "disabled");
$("input[name=lightbox2_force_show_nav]").attr("disabled", "disabled");
$("input[name=lightbox2_loop_items]").attr("disabled", "disabled");
$("input[name=lightbox2_disable_resize]").attr("disabled", "disabled");
$("input[name=lightbox2_disable_zoom]").attr("disabled", "disabled");
$("input[name=lightbox2_enable_video]").attr("disabled", "disabled");
$("input[name=lightbox2_enable_login]").attr("disabled", "disabled");
$("input[name=lightbox2_enable_contact]").attr("disabled", "disabled");
$("input[name=lightbox2_node_link_text]").attr("disabled", "disabled");
$("input[name=lightbox2_download_link_text]").attr("disabled", "disabled");
$("input[name=lightbox2_node_link_target]").attr("disabled", "disabled");
$("input[name=lightbox2_image_count_str]").attr("disabled", "disabled");
$("input[name=lightbox2_video_count_str]").attr("disabled", "disabled");
$("input[name=lightbox2_page_count_str]").attr("disabled", "disabled");
$("select[name=lightbox2_display_image_size]").attr("disabled", "disabled");
$("select[name='lightbox2_trigger_image_size[]']").attr("disabled", "disabled");
$("select[name=lightbox2_image_ncck_group_node_id]").attr("disabled", "disabled");
$("select[name=lightbox2_imagefield_group_node_id]").attr("disabled", "disabled");
$("input[name=lightbox2_imagefield_use_node_title]").attr("disabled", "disabled");
$("input[name=lightbox2_disable_close_click]").attr("disabled", "disabled");
$("input[name=lightbox2_border_size]").attr("disabled", "disabled");
$("input[name=lightbox2_box_color]").attr("disabled", "disabled");
$("input[name=lightbox2_font_color]").attr("disabled", "disabled");
$("input[name=lightbox2_top_position]").attr("disabled", "disabled");
$("select[name=lightbox2_resize_sequence]").attr("disabled", "disabled");
$("input[name=lightbox2_resize_speed]").attr("disabled", "disabled");
$("input[name=lightbox2_fadein_speed]").attr("disabled", "disabled");
$("input[name=lightbox2_slidedown_speed]").attr("disabled", "disabled");
}
else {
$("input[name=lightbox2_use_alt_layout]").removeAttr("disabled");
$("input[name=lightbox2_force_show_nav]").removeAttr("disabled");
$("input[name=lightbox2_loop_items]").removeAttr("disabled");
$("input[name=lightbox2_disable_resize]").removeAttr("disabled");
$("input[name=lightbox2_disable_zoom]").removeAttr("disabled");
$("input[name=lightbox2_node_link_text]").removeAttr("disabled");
$("input[name=lightbox2_download_link_text]").removeAttr("disabled");
$("input[name=lightbox2_node_link_target]").removeAttr("disabled");
$("input[name=lightbox2_enable_video]").removeAttr("disabled");
$("input[name=lightbox2_enable_login]").removeAttr("disabled");
$("input[name=lightbox2_enable_contact]").removeAttr("disabled");
$("input[name=lightbox2_image_count_str]").removeAttr("disabled");
$("input[name=lightbox2_video_count_str]").removeAttr("disabled");
$("input[name=lightbox2_page_count_str]").removeAttr("disabled");
$("select[name=lightbox2_display_image_size]").removeAttr("disabled");
$("select[name='lightbox2_trigger_image_size[]']").removeAttr("disabled");
$("select[name=lightbox2_image_ncck_group_node_id]").removeAttr("disabled");
$("select[name=lightbox2_imagefield_group_node_id]").removeAttr("disabled");
$("input[name=lightbox2_imagefield_use_node_title]").removeAttr("disabled");
$("input[name=lightbox2_disable_close_click]").removeAttr("disabled");
$("input[name=lightbox2_border_size]").removeAttr("disabled");
$("input[name=lightbox2_box_color]").removeAttr("disabled");
$("input[name=lightbox2_font_color]").removeAttr("disabled");
$("input[name=lightbox2_top_position]").removeAttr("disabled");
$("select[name=lightbox2_resize_sequence]").removeAttr("disabled");
$("input[name=lightbox2_resize_speed]").removeAttr("disabled");
$("input[name=lightbox2_fadein_speed]").removeAttr("disabled");
$("input[name=lightbox2_slidedown_speed]").removeAttr("disabled");
alt_layout_handler();
zoom_handler();
}
}
function image_node_handler(event) {
// Image node, flickr, gallery2, inline and custom images stuff.
if ($("input[name=lightbox2_lite]").val() != 1) {
// Image node only stuff.
if ($("select[name=lightbox2_image_node]").val() !== 0) {
$("input[name=lightbox2_disable_nested_galleries]").removeAttr("disabled");
$("select[name=lightbox2_display_image_size]").removeAttr("disabled");
$("select[name='lightbox2_trigger_image_size[]']").removeAttr("disabled");
}
else {
$("input[name=lightbox2_disable_nested_galleries]").attr("disabled", "disabled");
$("select[name=lightbox2_display_image_size]").attr("disabled", "disabled");
$("select[name='lightbox2_trigger_image_size[]']").attr("disabled", "disabled");
}
}
}
function lightbox2_lite_auto_handler(event) {
// Enable / disable the image node options.
if ($("input[name=lightbox2_lite]").val() == 1) {
// Disable iframe options.
$("input[name=lightbox2_default_frame_width]").attr("disabled", "disabled");
$("input[name=lightbox2_default_frame_height]").attr("disabled", "disabled");
$("input[name=lightbox2_frame_border]").attr("disabled", "disabled");
// Disable slideshow options.
$("input[name=lightbox2_slideshow_interval]").attr("disabled", "disabled");
$("input[name=lightbox2_slideshow_automatic_start]").attr("disabled", "disabled");
$("input[name=lightbox2_slideshow_automatic_exit]").attr("disabled", "disabled");
$("input[name=lightbox2_slideshow_show_play_pause]").attr("disabled", "disabled");
$("input[name=lightbox2_slideshow_pause_on_next_click]").attr("disabled", "disabled");
$("input[name=lightbox2_slideshow_pause_on_previous_click]").attr("disabled", "disabled");
$("input[name=lightbox2_loop_slides]").attr("disabled", "disabled");
// Disable automatic image handling options.
$("select[name=lightbox2_image_node]").attr("disabled", "disabled");
$("select[name=lightbox2_display_image_size]").attr("disabled", "disabled");
$("select[name='lightbox2_trigger_image_size[]']").attr("disabled", "disabled");
$("select[name=lightbox2_flickr]").attr("disabled", "disabled");
$("select[name=lightbox2_gallery2_blocks]").attr("disabled", "disabled");
$("select[name=lightbox2_image_assist_custom]").attr("disabled", "disabled");
$("select[name=lightbox2_inline]").attr("disabled", "disabled");
$("select[name=lightbox2_custom_class_handler]").attr("disabled", "disabled");
$("textarea[name=lightbox2_custom_trigger_classes]").attr("disabled", "disabled");
$("input[name=lightbox2_disable_nested_galleries]").attr("disabled", "disabled");
$("input[name=lightbox2_disable_nested_acidfree_galleries]").attr("disabled", "disabled");
$("input[name=lightbox2_enable_acidfree_videos]").attr("disabled", "disabled");
}
else {
// Enable iframe options.
$("input[name=lightbox2_default_frame_width]").removeAttr("disabled");
$("input[name=lightbox2_default_frame_height]").removeAttr("disabled");
$("input[name=lightbox2_frame_border]").removeAttr("disabled");
// Enable slideshow options.
$("input[name=lightbox2_slideshow_interval]").removeAttr("disabled");
$("input[name=lightbox2_slideshow_automatic_start]").removeAttr("disabled");
$("input[name=lightbox2_slideshow_automatic_exit]").removeAttr("disabled");
$("input[name=lightbox2_slideshow_show_play_pause]").removeAttr("disabled");
$("input[name=lightbox2_slideshow_pause_on_next_click]").removeAttr("disabled");
$("input[name=lightbox2_slideshow_pause_on_previous_click]").removeAttr("disabled");
$("input[name=lightbox2_loop_slides]").removeAttr("disabled");
// Enable automatic image handling options.
$("select[name=lightbox2_image_node]").removeAttr("disabled");
$("select[name=lightbox2_flickr]").removeAttr("disabled");
$("select[name=lightbox2_gallery2_blocks]").removeAttr("disabled");
$("select[name=lightbox2_image_assist_custom]").removeAttr("disabled");
$("select[name=lightbox2_inline]").removeAttr("disabled");
$("select[name=lightbox2_custom_class_handler]").removeAttr("disabled");
$("textarea[name=lightbox2_custom_trigger_classes]").removeAttr("disabled");
$("select[name=lightbox2_display_image_size]").removeAttr("disabled");
$("select[name='lightbox2_trigger_image_size[]']").removeAttr("disabled");
$("input[name=lightbox2_disable_nested_galleries]").removeAttr("disabled");
$("input[name=lightbox2_disable_nested_acidfree_galleries]").removeAttr("disabled");
$("input[name=lightbox2_enable_acidfree_videos]").removeAttr("disabled");
image_node_handler();
}
}
$(document).ready(function () {
// Handle lightbox2_settings_form.
lightbox2_lite_general_handler();
lightbox2_lite_auto_handler();
image_node_handler();
$("input[name=lightbox2_lite]").bind("click", lightbox2_lite_general_handler);
$("input[name=lightbox2_use_alt_layout]").bind("click", alt_layout_handler);
$("input[name=lightbox2_disable_resize]").bind("click", zoom_handler);
$("select[name=lightbox2_image_node]").bind("click", image_node_handler);
$("select[name=lightbox2_flickr]").bind("click", image_node_handler);
$("select[name=lightbox2_gallery2_blocks]").bind("click", image_node_handler);
$("select[name=lightbox2_image_assist_custom]").bind("click", image_node_handler);
$("select[name=lightbox2_inline]").bind("click", image_node_handler);
$("select[name=lightbox2_custom_class_handler]").bind("change", image_node_handler);
$("textarea[name=lightbox2_custom_trigger_classes]").bind("change", image_node_handler);
});
//End jQuery block
}(jQuery));

View File

@@ -0,0 +1,394 @@
/* $Id: lightbox_lite.js,v 1.1.2.2.2.19 2010/06/07 14:54:30 snpower Exp $ */
/**
* Lightbox JS: Fullsize Image Overlays
* by Lokesh Dhakar - http://www.huddletogether.com
*
* For more information on this script, visit:
* http://huddletogether.com/projects/lightbox/
*
* This script is distributed via Drupal.org with permission from Lokesh Dhakar.
* Under GPL license.
* Mailto: bugzie@gmail.com
*/
// start jQuery block
(function ($) {
//
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.org
//
function getPageScroll() {
var xScroll, yScroll;
if (self.pageYOffset) {
yScroll = self.pageYOffset;
xScroll = self.pageXOffset;
// Explorer 6 Strict
}
else if (document.documentElement && document.documentElement.scrollTop) {
yScroll = document.documentElement.scrollTop;
xScroll = document.documentElement.scrollLeft;
}
else if (document.body) {// all other Explorers
yScroll = document.body.scrollTop;
xScroll = document.body.scrollLeft;
}
arrayPageScroll = [xScroll, yScroll];
return arrayPageScroll;
}
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
function getPageSize() {
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = window.innerWidth + window.scrollMaxX;
yScroll = window.innerHeight + window.scrollMaxY;
// all but Explorer Mac
}
else if (document.body.scrollHeight > document.body.offsetHeight) {
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
// Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
}
else {
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) { // all except Explorer
if (document.documentElement.clientHeight) {
windowWidth = document.documentElement.clientWidth;
}
else {
windowWidth = self.innerWidth;
}
windowHeight = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
}
else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport
if (yScroll < windowHeight) {
pageHeight = windowHeight;
}
else {
pageHeight = yScroll;
}
// for small pages with total width less then width of the viewport
if (xScroll < windowWidth) {
pageWidth = xScroll;
}
else {
pageWidth = windowWidth;
}
arrayPageSize = [pageWidth, pageHeight, windowWidth, windowHeight];
return arrayPageSize;
}
// pause(numberMillis)
function pause(ms) {
var date = new Date();
var curDate = null;
do { curDate = new Date(); }
while (curDate - date < ms);
}
// hideLightbox()
function hideLightbox() {
// get objects
objOverlay = document.getElementById('lightbox2-overlay');
objLightbox = document.getElementById('lightbox');
// hide lightbox and overlay
objOverlay.style.display = 'none';
objLightbox.style.display = 'none';
// make select boxes visible
selects = document.getElementsByTagName("select");
for (i = 0; i != selects.length; i++) {
if (selects[i].style.display != "none") {
selects[i].style.visibility = "visible";
}
}
// make flash objects visible
embed = document.getElementsByTagName("embed");
for (i = 0; i != embed.length; i++) {
if (embed[i].style.display != "none") {
embed[i].style.visibility = "visible";
}
}
objects = document.getElementsByTagName("object");
for (i = 0; i != objects.length; i++) {
if (objects[i].style.display != "none") {
objects[i].style.visibility = "visible";
}
}
// disable keydown listener
document.onkeydown = '';
}
// getKey(key)
// Gets keycode. If 'x' is pressed then it hides the lightbox.
function getKey(e) {
if (e === null) { // ie
keycode = event.keyCode;
escapeKey = 27;
}
else { // mozilla
keycode = e.keyCode;
escapeKey = e.DOM_VK_ESCAPE;
}
key = String.fromCharCode(keycode).toLowerCase();
if (key == 'x' || key == 'c' || keycode == escapeKey) { hideLightbox(); }
}
// listenKey()
function listenKey () { document.onkeydown = getKey; }
function imgLoadingError(image, objImage, objLink) {
var settings = Drupal.settings.lightbox2;
image.src = settings.default_image;
objImage.src = settings.default_image;
objLink.href = settings.default_image;
}
// showLightbox()
// Preloads images. Pleaces new image in lightbox then centers and displays.
function showLightbox(objLink) {
var settings = Drupal.settings.lightbox2;
// prep objects
var objOverlay = document.getElementById('lightbox2-overlay');
var objLightbox = document.getElementById('lightbox');
var objCaption = document.getElementById('lightboxCaption');
var objImage = document.getElementById('lightboxImage');
var objLoadingImage = document.getElementById('loadingImage');
var objLightboxDetails = document.getElementById('lightboxDetails');
var arrayPageSize = getPageSize();
var arrayPageScroll = getPageScroll();
// set height of Overlay to take up whole page and show
objOverlay.style.height = (arrayPageSize[1] + 'px');
objOverlay.style.display = 'block';
objOverlay.style.opacity = settings.overlay_opacity;
objOverlay.style.backgroundColor = '#' + settings.overlay_color;
// preload image
imgPreload = new Image();
imgPreload.onerror = function() { imgLoadingError(this, objImage, objLink); };
imgPreload.onload = function() {
objImage.src = objLink.href;
// center lightbox and make sure that the top and left values are not
// negative and the image placed outside the viewport
var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - imgPreload.height) / 2);
var lightboxLeft = ((arrayPageSize[0] - 20 - imgPreload.width) / 2);
objLightbox.style.top = (lightboxTop < 0) ? "0px" : lightboxTop + "px";
objLightbox.style.left = (lightboxLeft < 0) ? "0px" : lightboxLeft + "px";
//objLightboxDetails.style.width = imgPreload.width + 'px';
objLightbox.style.width = imgPreload.width + 'px';
if (objLink.getAttribute('title')) {
objCaption.style.display = 'block';
//objCaption.style.width = imgPreload.width + 'px';
objCaption.innerHTML = objLink.getAttribute('title');
}
else {
objCaption.style.display = 'none';
}
// A small pause between the image loading and displaying is required with
// IE, this prevents the previous image displaying for a short burst
// causing flicker.
if (navigator.appVersion.indexOf("MSIE") != -1) {
pause(250);
}
if (objLoadingImage) { objLoadingImage.style.display = 'none'; }
// Hide select boxes as they will 'peek' through the image in IE
selects = document.getElementsByTagName("select");
for (i = 0; i != selects.length; i++) {
if (selects[i].style.display != "none") {
selects[i].style.visibility = "hidden";
}
}
// Hide flash objects as they will 'peek' through the image in IE
embed = document.getElementsByTagName("embed");
for (i = 0; i != embed.length; i++) {
if (embed[i].style.display != "none") {
embed[i].style.visibility = "hidden";
}
}
objects = document.getElementsByTagName("object");
for (i = 0; i != objects.length; i++) {
if (objects[i].style.display != "none") {
objects[i].style.visibility = "hidden";
}
}
objLightbox.style.display = 'block';
// After image is loaded, update the overlay height as the new image might
// have increased the overall page height.
arrayPageSize = getPageSize();
objOverlay.style.height = (arrayPageSize[1] + 'px');
// Check for 'x' keydown
listenKey();
return false;
};
imgPreload.src = objLink.href;
}
// initLightbox()
// Function runs on window load, going through link tags looking for
// rel="lightbox". These links receive onclick events that enable the lightbox
// display for their targets. The function also inserts html markup at the top
// of the page which will be used as a container for the overlay pattern and
// the inline image.
function initLightbox() {
if (!document.getElementsByTagName) { return; }
var anchors = document.getElementsByTagName("a");
// loop through all anchor tags
for (var i = 0; i < anchors.length; i++) {
var anchor = anchors[i];
var relAttribute = String(anchor.getAttribute("rel"));
if (anchor.getAttribute("href") && relAttribute.toLowerCase().match("lightbox")) {
$(anchor).click(function(e) { showLightbox(this); if (e.preventDefault) { e.preventDefault(); } return false; });
}
}
// the rest of this code inserts html at the top of the page that looks like
// this:
// <div id="lightbox2-overlay">
// <a href="#" onclick="hideLightbox(); return false;"><img id="loadingImage" /></a>
// </div>
// <div id="lightbox">
// <a href="#" onclick="hideLightbox(); return false;" title="Click anywhere to close image">
// <img id="closeButton" />
// <img id="lightboxImage" />
// </a>
// <div id="lightboxDetails">
// <div id="lightboxCaption"></div>
// <div id="keyboardMsg"></div>
// </div>
// </div>
var objBody = document.getElementsByTagName("body").item(0);
// create overlay div and hardcode some functional styles (aesthetic styles are in CSS file)
var objOverlay = document.createElement("div");
objOverlay.setAttribute('id', 'lightbox2-overlay');
objOverlay.onclick = function () { hideLightbox(); return false; };
objOverlay.style.display = 'none';
objOverlay.style.position = 'absolute';
objOverlay.style.top = '0';
objOverlay.style.left = '0';
objOverlay.style.zIndex = '90';
objOverlay.style.width = '100%';
objBody.insertBefore(objOverlay, objBody.firstChild);
var arrayPageSize = getPageSize();
var arrayPageScroll = getPageScroll();
// create loader image
var objLoadingImage = document.createElement("span");
objLoadingImage.setAttribute('id', 'loadingImage');
objOverlay.appendChild(objLoadingImage);
// create lightbox div, same note about styles as above
var objLightbox = document.createElement("div");
objLightbox.setAttribute('id', 'lightbox');
objLightbox.style.display = 'none';
objLightbox.style.position = 'absolute';
objLightbox.style.zIndex = '100';
objBody.insertBefore(objLightbox, objOverlay.nextSibling);
// create link
var objLink = document.createElement("a");
objLink.setAttribute('href', '#');
objLink.setAttribute('title', 'Click to close');
objLink.onclick = function () { hideLightbox(); return false; };
objLightbox.appendChild(objLink);
// create close button image
var objCloseButton = document.createElement("span");
objCloseButton.setAttribute('id', 'closeButton');
objLink.appendChild(objCloseButton);
// create image
var objImage = document.createElement("img");
objImage.setAttribute('id', 'lightboxImage');
objLink.appendChild(objImage);
// create details div, a container for the caption and keyboard message
var objLightboxDetails = document.createElement("div");
objLightboxDetails.setAttribute('id', 'lightboxDetails');
objLightbox.appendChild(objLightboxDetails);
// create caption
var objCaption = document.createElement("div");
objCaption.setAttribute('id', 'lightboxCaption');
objCaption.style.display = 'none';
objLightboxDetails.appendChild(objCaption);
// create keyboard message
var settings = Drupal.settings.lightbox2;
var objKeyboardMsg = document.createElement("div");
objKeyboardMsg.setAttribute('id', 'keyboardMsg');
objKeyboardMsg.innerHTML = settings.lite_press_x_close;
objLightboxDetails.appendChild(objKeyboardMsg);
}
Drupal.behaviors.initLightbox2 = {
attach: function(context) {
initLightbox();
}
};
//End jQuery block
}(jQuery));

View File

@@ -0,0 +1,37 @@
(function ($) {
function lightbox2_login() {
$("a[href*='/user/login'], a[href*='?q=user/login']").each(function() {
$(this).attr({
href: this.href.replace(/user\/login?/,"user/login/lightbox2"),
rel: 'lightmodal[|width:250px; height:210px;]'
});
$(this).addClass('lightmodal-login');
});
}
function lightbox2_contact() {
$("a[href$='/contact'], a[href$='?q=contact']").each(function() {
if (!this.href.match('admin/build/contact')) {
$(this).attr({
href: this.href.replace(/contact?/,"contact/lightbox2"),
rel: 'lightmodal[|width:450px; height:450px;]'
});
$(this).addClass('lightmodal-contact');
}
});
}
Drupal.behaviors.initLightboxModal = {
attach: function(context, settings) {
if (settings.lightbox2.enable_login) {
lightbox2_login();
}
if (settings.lightbox2.enable_contact) {
lightbox2_contact();
}
}
};
//End jQuery block
}(jQuery));

View File

@@ -0,0 +1,213 @@
/* $Id: lightbox_video.js,v 1.1.4.20 2010/09/21 17:57:22 snpower Exp $ */
/**
* Lightbox video
* @author
* Stella Power, <http://drupal.org/user/66894>
*/
var Lightvideo;
// start jQuery block
(function ($) {
Lightvideo = {
// startVideo()
startVideo: function (href) {
if (Lightvideo.checkKnownVideos(href)) {
return;
}
else if (href.match(/\.mov$/i)) {
if (navigator.plugins && navigator.plugins.length) {
Lightbox.modalHTML ='<object id="qtboxMovie" type="video/quicktime" codebase="http://www.apple.com/qtactivex/qtplugin.cab" data="'+href+'" width="'+Lightbox.modalWidth+'" height="'+Lightbox.modalHeight+'"><param name="allowFullScreen" value="true"></param><param name="src" value="'+href+'" /><param name="scale" value="aspect" /><param name="controller" value="true" /><param name="autoplay" value="true" /><param name="bgcolor" value="#000000" /><param name="enablejavascript" value="true" /></object>';
} else {
Lightbox.modalHTML = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="'+Lightbox.modalWidth+'" height="'+Lightbox.modalHeight+'" id="qtboxMovie"><param name="allowFullScreen" value="true"></param><param name="src" value="'+href+'" /><param name="scale" value="aspect" /><param name="controller" value="true" /><param name="autoplay" value="true" /><param name="bgcolor" value="#000000" /><param name="enablejavascript" value="true" /></object>';
}
}
else if (href.match(/\.wmv$/i) || href.match(/\.asx$/i)) {
Lightbox.modalHTML = '<object NAME="Player" WIDTH="'+Lightbox.modalWidth+'" HEIGHT="'+Lightbox.modalHeight+'" align="left" hspace="0" type="application/x-oleobject" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"><param name="allowFullScreen" value="true"></param><param NAME="URL" VALUE="'+href+'"></param><param NAME="AUTOSTART" VALUE="true"></param><param name="showControls" value="true"></param><embed WIDTH="'+Lightbox.modalWidth+'" HEIGHT="'+Lightbox.modalHeight+'" align="left" hspace="0" SRC="'+href+'" TYPE="application/x-oleobject" AUTOSTART="false"></embed></object>';
}
else {
Lightbox.videoId = href;
variables = '';
if (!href.match(/\.swf$/i)) {
href = Lightbox.flvPlayer + '?file=' + href;
if (Lightbox.flvFlashvars.length) {
variables = Lightbox.flvFlashvars;
}
}
Lightvideo.createEmbed(href, "flvplayer", "#ffffff", variables);
}
},
// createEmbed()
createEmbed: function(href, id, color, variables) {
var bgcolor = 'bgcolor="' + color + '"';
var flashvars = '';
if (variables) {
flashvars = 'flashvars="' + variables + '"';
}
Lightbox.modalHTML = '<embed type="application/x-shockwave-flash" ' +
'src="' + href + '" ' +
'id="' + id + '" name="' + id + '" ' + bgcolor + ' ' +
'quality="high" wmode="transparent" ' + flashvars + ' ' +
'height="' + Lightbox.modalHeight + '" ' +
'width="' + Lightbox.modalWidth + '" ' +
'allowfullscreen="true" ' +
'></embed>';
},
// checkKnownVideos()
checkKnownVideos: function(href) {
if (Lightvideo.checkYouTubeVideo(href) || Lightvideo.checkGoogleVideo(href) ||
Lightvideo.checkMySpaceVideo(href) || Lightvideo.checkLiveVideo(href) ||
Lightvideo.checkMetacafeVideo(href) ||
Lightvideo.checkIFilmSpikeVideo(href)
) {
return true;
}
return false;
},
// checkYouTubeVideo()
checkYouTubeVideo: function(href) {
var patterns = [
'youtube.com/v/([^"&]+)',
'youtube.com/watch\\?v=([^"&]+)',
'youtube.com/\\?v=([^"&]+)'
];
for (var i = 0; i < patterns.length; i++) {
var pattern = new RegExp(patterns[i], "i");
var results = pattern.exec(href);
if (results !== null) {
Lightbox.videoId = results[1];
var href = "http://www.youtube.com/v/"+Lightbox.videoId;
var variables = 'fs=1';
if (Lightbox.flvFlashvars.length) {
variables = variables + '&' + Lightbox.flvFlashvars;
href = href + '&' + variables;
}
Lightvideo.createEmbed(href, "flvvideo", "#ffffff", variables);
return true;
}
}
return false;
},
// checkGoogleVideo()
checkGoogleVideo: function(href) {
var patterns = [
'http://video.google.[a-z]{2,4}/googleplayer.swf\\?docId=(-?\\d*)',
'http://video.google.[a-z]{2,4}/videoplay\\?docid=([^&]*)&',
'http://video.google.[a-z]{2,4}/videoplay\\?docid=(.*)'
];
for (var i = 0; i < patterns.length; i++) {
var pattern = new RegExp(patterns[i], "i");
var results = pattern.exec(href);
if (results !== null) {
Lightbox.videoId = results[1];
var href = "http://video.google.com/googleplayer.swf?docId="+Lightbox.videoId+"&hl=en";
var variables = 'fs=true';
if (Lightbox.flvFlashvars.length) {
variables = variables + '&' + Lightbox.flvFlashvars;
href = href + '&' + variables;
}
Lightvideo.createEmbed(href, "flvvideo", "#ffffff", variables);
return true;
}
}
return false;
},
// checkMetacafeVideo()
checkMetacafeVideo: function(href) {
var patterns = [
'metacafe.com/watch/(\.[^/]*)/(\.[^/]*)/',
'metacafe.com/watch/(\.[^/]*)/(\.*)',
'metacafe.com/fplayer/(\.[^/]*)/(\.[^.]*).'
];
for (var i = 0; i < patterns.length; i++) {
var pattern = new RegExp(patterns[i], "i");
var results = pattern.exec(href);
if (results !== null) {
Lightbox.videoId = results[1];
Lightvideo.createEmbed("http://www.metacafe.com/fplayer/"+Lightbox.videoId+"/.swf", "flvvideo", "#ffffff");
return true;
}
}
return false;
},
// checkIFilmSpikeVideo()
checkIFilmSpikeVideo: function(href) {
var patterns = [
'spike.com/video/[^/&"]*?/(\\d+)',
'ifilm.com/video/[^/&"]*?/(\\d+)',
'spike.com/video/([^/&"]*)',
'ifilm.com/video/([^/&"]*)'
];
for (var i = 0; i < patterns.length; i++) {
var pattern = new RegExp(patterns[i], "i");
var results = pattern.exec(href);
if (results !== null) {
Lightbox.videoId = results[1];
Lightvideo.createEmbed("http://www.spike.com/efp", "flvvideo", "#000", "flvbaseclip="+Lightbox.videoId+"&amp;");
return true;
}
}
return false;
},
// checkMySpaceVideo()
checkMySpaceVideo: function(href) {
var patterns = [
'src="myspace.com/index.cfm\\?fuseaction=vids.individual&videoid=([^&"]+)',
'myspace.com/index.cfm\\?fuseaction=vids.individual&videoid=([^&"]+)',
'src="myspacetv.com/index.cfm\\?fuseaction=vids.individual&videoid=([^&"]+)"',
'myspacetv.com/index.cfm\\?fuseaction=vids.individual&videoid=([^&"]+)'
];
for (var i = 0; i < patterns.length; i++) {
var pattern = new RegExp(patterns[i], "i");
var results = pattern.exec(href);
if (results !== null) {
Lightbox.videoId = results[1];
Lightvideo.createEmbed("http://lads.myspace.com/videos/vplayer.swf", "flvvideo", "#ffffff", "m="+Lightbox.videoId);
return true;
}
}
return false;
},
// checkLiveVideo()
checkLiveVideo: function(href) {
var patterns = [
'livevideo.com/flvplayer/embed/([^"]*)"',
'livevideo.com/video/[^/]*?/([^/]*)/',
'livevideo.com/video/([^/]*)/'
];
for (var i = 0; i < patterns.length; i++) {
var pattern = new RegExp(patterns[i], "i");
var results = pattern.exec(href);
if (results !== null) {
Lightbox.videoId = results[1];
Lightvideo.createEmbed("http://www.livevideo.com/flvplayer/embed/"+Lightbox.videoId, "flvvideo", "#ffffff");
return true;
}
}
return false;
}
};
//End jQuery block
}(jQuery));

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,58 @@
// script.aculo.us scriptaculous.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// For details, see the script.aculo.us web site: http://script.aculo.us/
var Scriptaculous = {
Version: '1.8.1',
require: function(libraryName) {
// inserting via DOM fails in Safari 2.0, so brute force approach
document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
},
REQUIRED_PROTOTYPE: '1.6.0',
load: function() {
function convertVersionString(versionString){
var r = versionString.split('.');
return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
}
if((typeof Prototype=='undefined') ||
(typeof Element == 'undefined') ||
(typeof Element.Methods=='undefined') ||
(convertVersionString(Prototype.Version) <
convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
throw("script.aculo.us requires the Prototype JavaScript framework >= " +
Scriptaculous.REQUIRED_PROTOTYPE);
$A(document.getElementsByTagName("script")).findAll( function(s) {
return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
}).each( function(s) {
var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
var includes = s.src.match(/\?.*load=([a-z,]*)/);
(includes ? includes[1] : 'builder,effects').split(',').each(
function(include) { Scriptaculous.require(path+include+'.js') });
});
}
}
Scriptaculous.load();