You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1343 lines
78 KiB

10 years ago
// $Id: jquery.js,v 1.12.2.3 2008/06/25 09:38:39 goba Exp $
/*
* jQuery 1.2.6 - New Wave Javascript
*
* Copyright (c) 2008 John Resig (jquery.com)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008)
* Rev: 5685
*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(H(){J w=1b.4M,3m$=1b.$;J D=1b.4M=1b.$=H(a,b){I 2B D.17.5j(a,b)};J u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/,62=/^.[^:#\\[\\.]*$/,12;D.17=D.44={5j:H(d,b){d=d||S;G(d.16){7[0]=d;7.K=1;I 7}G(1j d=="23"){J c=u.2D(d);G(c&&(c[1]||!b)){G(c[1])d=D.4h([c[1]],b);N{J a=S.61(c[3]);G(a){G(a.2v!=c[3])I D().2q(d);I D(a)}d=[]}}N I D(b).2q(d)}N G(D.1D(d))I D(S)[D.17.27?"27":"43"](d);I 7.6Y(D.2d(d))},5w:"1.2.6",8G:H(){I 7.K},K:0,3p:H(a){I a==12?D.2d(7):7[a]},2I:H(b){J a=D(b);a.5n=7;I a},6Y:H(a){7.K=0;2p.44.1p.1w(7,a);I 7},P:H(a,b){I D.P(7,a,b)},5i:H(b){J a=-1;I D.2L(b&&b.5w?b[0]:b,7)},1K:H(c,a,b){J d=c;G(c.1q==56)G(a===12)I 7[0]&&D[b||"1K"](7[0],c);N{d={};d[c]=a}I 7.P(H(i){R(c 1n d)D.1K(b?7.V:7,c,D.1i(7,d[c],b,i,c))})},1g:H(b,a){G((b==\'2h\'||b==\'1Z\')&&3d(a)<0)a=12;I 7.1K(b,a,"2a")},1r:H(b){G(1j b!="49"&&b!=U)I 7.4E().3v((7[0]&&7[0].2z||S).5F(b));J a="";D.P(b||7,H(){D.P(7.3t,H(){G(7.16!=8)a+=7.16!=1?7.76:D.17.1r([7])})});I a},5z:H(b){G(7[0])D(b,7[0].2z).5y().39(7[0]).2l(H(){J a=7;1B(a.1x)a=a.1x;I a}).3v(7);I 7},8Y:H(a){I 7.P(H(){D(7).6Q().5z(a)})},8R:H(a){I 7.P(H(){D(7).5z(a)})},3v:H(){I 7.3W(19,M,Q,H(a){G(7.16==1)7.3U(a)})},6F:H(){I 7.3W(19,M,M,H(a){G(7.16==1)7.39(a,7.1x)})},6E:H(){I 7.3W(19,Q,Q,H(a){7.1d.39(a,7)})},5q:H(){I 7.3W(19,Q,M,H(a){7.1d.39(a,7.2H)})},3l:H(){I 7.5n||D([])},2q:H(b){J c=D.2l(7,H(a){I D.2q(b,a)});I 7.2I(/[^+>] [^+>]/.11(b)||b.1h("..")>-1?D.4r(c):c)},5y:H(e){J f=7.2l(H(){G(D.14.1f&&!D.4n(7)){J a=7.6o(M),5h=S.3h("1v");5h.3U(a);I D.4h([5h.4H])[0]}N I 7.6o(M)});J d=f.2q("*").5c().P(H(){G(7[E]!=12)7[E]=U});G(e===M)7.2q("*").5c().P(H(i){G(7.16==3)I;J c=D.L(7,"3w");R(J a 1n c)R(J b 1n c[a])D.W.1e(d[i],a,c[a][b],c[a][b].L)});I f},1E:H(b){I 7.2I(D.1D(b)&&D.3C(7,H(a,i){I b.1k(a,i)})||D.3g(b,7))},4Y:H(b){G(b.1q==56)G(62.11(b))I 7.2I(D.3g(b,7,M));N b=D.3g(b,7);J a=b.K&&b[b.K-1]!==12&&!b.16;I 7.1E(H(){I a?D.2L(7,b)<0:7!=b})},1e:H(a){I 7.2I(D.4r(D.2R(7.3p(),1j a==\'23\'?D(a):D.2d(a))))},3F:H(a){I!!a&&D.3g(a,7).K>0},7T:H(a){I 7.3F("."+a)},6e:H(b){G(b==12){G(7.K){J c=7[0];G(D.Y(c,"2A")){J e=c.64,63=[],15=c.15,2V=c.O=="2A-2V";G(e<0)I U;R(J i=2V?e:0,2f=2V?e+1:15.K;i<2f;i++){J d=15[i];G(d.2W){b=D.14.1f&&!d.at.2x.an?d.1r:d.2x;G(2V)I b;63.1p(b)}}I 63}N I(7[0].2x||"").1o(/\\r/g,"")}I 12}G(b.1q==4L)b+=\'\';I 7.P(H(){G(7.16!=1)I;G(b.1q==2p&&/5O|5L/.11(7.O))7.4J=(D.2L(7.2x,b)>=0||D.2L(7.34,b)>=0);N G(D.Y(7,"2A")){J a=D.2d(b);D("9R",7).P(H(){7.2W=(D.2L(7.2x,a)>=0||D.2L(7.1r,a)>=0)});G(!a.K)7.64=-1}N 7.2x=b})},2K:H(a){I a==12?(7[0]?7[0].4H:U):7.4E().3v(a)},7b:H(a){I 7.5q(a).21()},79:H(i){I 7.3s(i,i+1)},3s:H(){I 7.2I(2p.44.3s.1w(7,19))},2l:H(b){I 7.2I(D.2l(7,H(a,i){I b.1k(a,i,a)}))},5c:H(){I 7.1e(7.5n)},L:H(d,b){J a=d.1R(".");a[1]=a[1]?"."+a[1]:"";G(b===12){J c=7.5C("9z"+a[1]+"!",[a[0]]);G(c===12&&7.K)c=D.L(7[0],d);I c===12&&a[1]?7.L(a[0]):c}N I 7.1P("9u"+a[1]+"!",[a[0],b]).P(H(){D.L(7,d,b)})},3b:H(a){I 7.P(H(){D.3b(7,a)})},3W:H(g,f,h,d){J e=7.K>1,3x;I 7.P(H(){G(!3x){3x=D.4h(g,7.2z);G(h)3x.9o()}J b=7;G(f&&D.Y(7,"1T")&&D.Y(3x[0],"4F"))b=7.3H("22")[0]||7.3U(7.2z.3h("22"));J c=D([]);D.P(3x,H(){J a=e?D(7).5y(M)[0]:7;G(D.Y(a,"1m"))c=c.1e(a);N{G(a.16==1)c=c.1e(D("1m",a).21());d.1k(b,a)}});c.P(6T)})}};D.17.5j.44=D.17;H 6T(i,a){G(a.4d)D.3Y({1a:a.4d,31:Q,1O:"1m"});N D.5u(a.1r||a.6O||a.4H||"");G(a.1d)a.1d.37(a)}H 1z(){I+2B 8J}D.1l=D.17.1l=H(){J b=19[0]||{},i=1,K=19.K,4x=Q,15;G(b.1q==8I){4x=b;b=19[1]||{};i=2}G(1j b!="49"&&1j b!="H")b={};G(K==i){b=7;--i}R(;i<K;i++)G((15=19[i])!=U)R(J c 1n 15){J a=b[c],2w=15[c];G(b===2w)6M;G(4x&&2w&&1j 2w=="49"&&!2w.16)b[c]=D.1l(4x,a||(2w.K!=U?[]:{}),2w);N G(2w!==12)b[c]=2w}I b};J E="4M"+1z(),6K=0,5r={},6G=/z-?5i|8B-?8A|1y|6B|8v-?1Z/i,3P=S.3P||{};D.1l({8u:H(a){1b.$=3m$;G(a)1b.4M=w;I D},1D:H(a){I!!a&&1j a!="23"&&!a.Y&&a.1q!=2p&&/^[\\s[]?H/.11(a+"")},4n:H(a){I a.1C&&!a.1c||a.2j&&a.2z&&!a.2z.1c},5u:H(a){a
var Drupal = Drupal || { 'settings': {}, 'behaviors': {}, 'themes': {}, 'locale': {} };
/**
* Set the variable that indicates if JavaScript behaviors should be applied
*/
Drupal.jsEnabled = document.getElementsByTagName && document.createElement && document.createTextNode && document.documentElement && document.getElementById;
/**
* Attach all registered behaviors to a page element.
*
* Behaviors are event-triggered actions that attach to page elements, enhancing
* default non-Javascript UIs. Behaviors are registered in the Drupal.behaviors
* object as follows:
* @code
* Drupal.behaviors.behaviorName = function () {
* ...
* };
* @endcode
*
* Drupal.attachBehaviors is added below to the jQuery ready event and so
* runs on initial page load. Developers implementing AHAH/AJAX in their
* solutions should also call this function after new page content has been
* loaded, feeding in an element to be processed, in order to attach all
* behaviors to the new content.
*
* Behaviors should use a class in the form behaviorName-processed to ensure
* the behavior is attached only once to a given element. (Doing so enables
* the reprocessing of given elements, which may be needed on occasion despite
* the ability to limit behavior attachment to a particular element.)
*
* @param context
* An element to attach behaviors to. If none is given, the document element
* is used.
*/
Drupal.attachBehaviors = function(context) {
context = context || document;
if (Drupal.jsEnabled) {
// Execute all of them.
jQuery.each(Drupal.behaviors, function() {
this(context);
});
}
};
/**
* Encode special characters in a plain-text string for display as HTML.
*/
Drupal.checkPlain = function(str) {
str = String(str);
var replace = { '&': '&amp;', '"': '&quot;', '<': '&lt;', '>': '&gt;' };
for (var character in replace) {
var regex = new RegExp(character, 'g');
str = str.replace(regex, replace[character]);
}
return str;
};
/**
* Translate strings to the page language or a given language.
*
* See the documentation of the server-side t() function for further details.
*
* @param str
* A string containing the English string to translate.
* @param args
* An object of replacements pairs to make after translation. Incidences
* of any key in this array are replaced with the corresponding value.
* Based on the first character of the key, the value is escaped and/or themed:
* - !variable: inserted as is
* - @variable: escape plain text to HTML (Drupal.checkPlain)
* - %variable: escape text and theme as a placeholder for user-submitted
* content (checkPlain + Drupal.theme('placeholder'))
* @return
* The translated string.
*/
Drupal.t = function(str, args) {
// Fetch the localized version of the string.
if (Drupal.locale.strings && Drupal.locale.strings[str]) {
str = Drupal.locale.strings[str];
}
if (args) {
// Transform arguments before inserting them
for (var key in args) {
switch (key.charAt(0)) {
// Escaped only
case '@':
args[key] = Drupal.checkPlain(args[key]);
break;
// Pass-through
case '!':
break;
// Escaped and placeholder
case '%':
default:
args[key] = Drupal.theme('placeholder', args[key]);
break;
}
str = str.replace(key, args[key]);
}
}
return str;
};
/**
* Format a string containing a count of items.
*
* This function ensures that the string is pluralized correctly. Since Drupal.t() is
* called by this function, make sure not to pass already-localized strings to it.
*
* See the documentation of the server-side format_plural() function for further details.
*
* @param count
* The item count to display.
* @param singular
* The string for the singular case. Please make sure it is clear this is
* singular, to ease translation (e.g. use "1 new comment" instead of "1 new").
* Do not use @count in the singular string.
* @param plural
* The string for the plural case. Please make sure it is clear this is plural,
* to ease translation. Use @count in place of the item count, as in "@count
* new comments".
* @param args
* An object of replacements pairs to make after translation. Incidences
* of any key in this array are replaced with the corresponding value.
* Based on the first character of the key, the value is escaped and/or themed:
* - !variable: inserted as is
* - @variable: escape plain text to HTML (Drupal.checkPlain)
* - %variable: escape text and theme as a placeholder for user-submitted
* content (checkPlain + Drupal.theme('placeholder'))
* Note that you do not need to include @count in this array.
* This replacement is done automatically for the plural case.
* @return
* A translated string.
*/
Drupal.formatPlural = function(count, singular, plural, args) {
var args = args || {};
args['@count'] = count;
// Determine the index of the plural form.
var index = Drupal.locale.pluralFormula ? Drupal.locale.pluralFormula(args['@count']) : ((args['@count'] == 1) ? 0 : 1);
if (index == 0) {
return Drupal.t(singular, args);
}
else if (index == 1) {
return Drupal.t(plural, args);
}
else {
args['@count['+ index +']'] = args['@count'];
delete args['@count'];
return Drupal.t(plural.replace('@count', '@count['+ index +']'));
}
};
/**
* Generate the themed representation of a Drupal object.
*
* All requests for themed output must go through this function. It examines
* the request and routes it to the appropriate theme function. If the current
* theme does not provide an override function, the generic theme function is
* called.
*
* For example, to retrieve the HTML that is output by theme_placeholder(text),
* call Drupal.theme('placeholder', text).
*
* @param func
* The name of the theme function to call.
* @param ...
* Additional arguments to pass along to the theme function.
* @return
* Any data the theme function returns. This could be a plain HTML string,
* but also a complex object.
*/
Drupal.theme = function(func) {
for (var i = 1, args = []; i < arguments.length; i++) {
args.push(arguments[i]);
}
return (Drupal.theme[func] || Drupal.theme.prototype[func]).apply(this, args);
};
/**
* Parse a JSON response.
*
* The result is either the JSON object, or an object with 'status' 0 and 'data' an error message.
*/
Drupal.parseJson = function (data) {
if ((data.substring(0, 1) != '{') && (data.substring(0, 1) != '[')) {
return { status: 0, data: data.length ? data : Drupal.t('Unspecified error') };
}
return eval('(' + data + ');');
};
/**
* Freeze the current body height (as minimum height). Used to prevent
* unnecessary upwards scrolling when doing DOM manipulations.
*/
Drupal.freezeHeight = function () {
Drupal.unfreezeHeight();
var div = document.createElement('div');
$(div).css({
position: 'absolute',
top: '0px',
left: '0px',
width: '1px',
height: $('body').css('height')
}).attr('id', 'freeze-height');
$('body').append(div);
};
/**
* Unfreeze the body height
*/
Drupal.unfreezeHeight = function () {
$('#freeze-height').remove();
};
/**
* Wrapper to address the mod_rewrite url encoding bug
* (equivalent of drupal_urlencode() in PHP).
*/
Drupal.encodeURIComponent = function (item, uri) {
uri = uri || location.href;
item = encodeURIComponent(item).replace(/%2F/g, '/');
return (uri.indexOf('?q=') != -1) ? item : item.replace(/%26/g, '%2526').replace(/%23/g, '%2523').replace(/\/\//g, '/%252F');
};
/**
* Get the text selection in a textarea.
*/
Drupal.getSelection = function (element) {
if (typeof(element.selectionStart) != 'number' && document.selection) {
// The current selection
var range1 = document.selection.createRange();
var range2 = range1.duplicate();
// Select all text.
range2.moveToElementText(element);
// Now move 'dummy' end point to end point of original range.
range2.setEndPoint('EndToEnd', range1);
// Now we can calculate start and end points.
var start = range2.text.length - range1.text.length;
var end = start + range1.text.length;
return { 'start': start, 'end': end };
}
return { 'start': element.selectionStart, 'end': element.selectionEnd };
};
/**
* Build an error message from ahah response.
*/
Drupal.ahahError = function(xmlhttp, uri) {
if (xmlhttp.status == 200) {
if (jQuery.trim($(xmlhttp.responseText).text())) {
var message = Drupal.t("An error occurred. \n@uri\n@text", {'@uri': uri, '@text': xmlhttp.responseText });
}
else {
var message = Drupal.t("An error occurred. \n@uri\n(no information available).", {'@uri': uri, '@text': xmlhttp.responseText });
}
}
else {
var message = Drupal.t("An HTTP error @status occurred. \n@uri", {'@uri': uri, '@status': xmlhttp.status });
}
return message;
}
// Global Killswitch on the <html> element
if (Drupal.jsEnabled) {
// Global Killswitch on the <html> element
$(document.documentElement).addClass('js');
// 'js enabled' cookie
document.cookie = 'has_js=1; path=/';
// Attach all behaviors.
$(document).ready(function() {
Drupal.attachBehaviors(this);
});
}
/**
* The default themes.
*/
Drupal.theme.prototype = {
/**
* Formats text for emphasized display in a placeholder inside a sentence.
*
* @param str
* The text to format (plain-text).
* @return
* The formatted text (html).
*/
placeholder: function(str) {
return '<em>' + Drupal.checkPlain(str) + '</em>';
}
};
;/* $Id: lightbox.js,v 1.5.2.6.2.73 2008/06/29 15:25:12 snpower Exp $ */
/**
* jQuery Lightbox
* @author
* Stella Power, <http://drupal.org/user/66894>
*
* Based on Lightbox v2.03.3 by Lokesh Dhakar
* <http://www.huddletogether.com/projects/lightbox2/>
* Also partially based on the jQuery Lightbox by Warren Krewenki
* <http://warren.mesozen.com>
*
* Permission has been granted to Mark Ashmead & other Drupal Lightbox2 module
* maintainers to distribute this file via Drupal.org
* Under GPL license.
*
* Slideshow, iframe and video functionality added by Stella Power.
*/
var Lightbox = {
overlayOpacity : 0.8, // Controls transparency of shadow overlay.
overlayColor : '000', // Controls colour of shadow overlay.
// Controls the order of the lightbox resizing animation sequence.
resizeSequence: 0, // 0: simultaneous, 1: width then height, 2: height then width.
resizeSpeed: 'normal', // Controls the speed of the lightbox resizing animation.
fadeInSpeed: 'normal', // Controls the speed of the image appearance.
slideDownSpeed: 'slow', // Controls the speed of the image details appearance.
borderSize : 10,
boxColor : 'fff',
fontColor : '000',
topPosition : '',
infoHeight: 20,
alternative_layout : false,
imageArray : [],
imageNum : null,
total : 0,
activeImage : null,
inprogress : false,
disableResize : false,
disableZoom : false,
isZoomedIn : false,
rtl : false,
loopItems : false,
// Slideshow options.
slideInterval : 5000, // In milliseconds.
showPlayPause : true,
autoExit : true,
pauseOnNextClick : false, // True to pause the slideshow when the "Next" button is clicked.
pauseOnPrevClick : true, // True to pause the slideshow when the "Prev" button is clicked.
slideIdArray : [],
slideIdCount : 0,
isSlideshow : false,
isPaused : false,
loopSlides : false,
// Iframe options.
isLightframe : false,
iframe_width : 600,
iframe_height : 400,
iframe_border : 1,
// Video and modal options.
enableVideo : false,
isModal : false,
isVideo : false,
videoId : false,
modalWidth : 400,
modalHeight : 400,
modalHTML : null,
// initialize()
// Constructor runs on completion of the DOM loading. Calls initList
// and then the function inserts html at the bottom of the page which is used
// to display the shadow overlay and the image container.
initialize: function() {
var s = Drupal.settings.lightbox2;
Lightbox.overlayOpacity = s.overlay_opacity;
Lightbox.overlayColor = s.overlay_color;
Lightbox.resizeSequence = s.resize_sequence;
Lightbox.resizeSpeed = s.resize_speed;
Lightbox.fadeInSpeed = s.fade_in_speed;
Lightbox.slideDownSpeed = s.slide_down_speed;
Lightbox.borderSize = s.border_size;
Lightbox.boxColor = s.box_color;
Lightbox.fontColor = s.font_color;
Lightbox.topPosition = s.top_position;
Lightbox.rtl = s.rtl;
Lightbox.loopItems = s.loop_items;
Lightbox.disableResize = s.disable_resize;
Lightbox.disableZoom = s.disable_zoom;
Lightbox.slideInterval = s.slideshow_interval;
Lightbox.showPlayPause = s.show_play_pause;
Lightbox.autoExit = s.slideshow_automatic_exit;
Lightbox.pauseOnNextClick = s.pause_on_next_click;
Lightbox.pauseOnPrevClick = s.pause_on_previous_click;
Lightbox.loopSlides = s.loop_slides;
Lightbox.alternative_layout = s.use_alt_layout;
Lightbox.iframe_width = s.iframe_width;
Lightbox.iframe_height = s.iframe_height;
Lightbox.iframe_border = s.iframe_border;
Lightbox.enableVideo = s.enable_video;
// Attach lightbox to any links with lightbox rels.
Lightbox.initList();
// Make the lightbox divs.
var output = '<div id="overlay" style="display: none;"></div>\
<div id="lightbox" style="display: none;">\
<div id="outerImageContainer"></div>\
<div id="imageDataContainer" class="clearfix">\
<div id="imageData"></div>\
</div>\
</div>';
var loading = '<div id="loading"><a href="#" id="loadingLink"></a></div>';
var modal = '<div id="modalContainer" style="display: none;"></div>';
var frame = '<div id="frameContainer" style="display: none;"><iframe id="lightboxFrame" style="display: none;"></iframe></div>';
var imageContainer = '<div id="imageContainer" style="display: none;"></div>';
var details = '<div id="imageDetails"></div>';
var bottomNav = '<div id="bottomNav"></div>';
var image = '<img id="lightboxImage" />';
var hoverNav = '<div id="hoverNav"><a id="prevLink" href="#"></a><a id="nextLink" href="#"></a></div>';
var frameNav = '<div id="frameHoverNav"><a id="framePrevLink" href="#"></a><a id="frameNextLink" href="#"></a></div>';
var caption = '<span id="caption"></span>';
var numberDisplay = '<span id="numberDisplay"></span>';
var close = '<a id="bottomNavClose" href="#"></a>';
var zoom = '<a id="bottomNavZoom" href="#"></a>';
var zoomOut = '<a id="bottomNavZoomOut" href="#"></a>';
var pause = '<a id="lightshowPause" href="#" style="display: none;"></a>';
var play = '<a id="lightshowPlay" href="#" style="display: none;"></a>';
$("body").append(output);
$('#outerImageContainer').append(modal + frame + imageContainer + loading);
if (!s.use_alt_layout) {
$('#imageContainer').append(image + hoverNav);
$('#imageData').append(frameNav + details + bottomNav);
$('#imageDetails').append(caption + numberDisplay);
$('#bottomNav').append(close + zoom + zoomOut + pause + play);
}
else {
$('#imageContainer').append(image + bottomNav);
$('#bottomNav').append(close + zoom + zoomOut);
$('#imageData').append(hoverNav + details);
$('#imageDetails').append(caption + numberDisplay + pause + play);
}
// Setup onclick handlers.
$('#overlay').click(function() { Lightbox.end(); return false; } ).hide();
$('#loadingLink, #bottomNavClose').click(function() { Lightbox.end('forceClose'); return false; } );
$('#prevLink, #framePrevLink').click(function() { Lightbox.changeData(Lightbox.activeImage - 1); return false; } );
$('#nextLink, #frameNextLink').click(function() { Lightbox.changeData(Lightbox.activeImage + 1); return false; } );
$('#bottomNavZoom').click(function() { Lightbox.changeData(Lightbox.activeImage, true); return false; } );
$('#bottomNavZoomOut').click(function() { Lightbox.changeData(Lightbox.activeImage, false); return false; } );
$('#lightshowPause').click(function() { Lightbox.togglePlayPause("lightshowPause", "lightshowPlay"); return false; } );
$('#lightshowPlay').click(function() { Lightbox.togglePlayPause("lightshowPlay", "lightshowPause"); return false; } );
// Fix positioning.
$('#prevLink, #nextLink, #framePrevLink, #frameNextLink').css({ paddingTop: Lightbox.borderSize + 'px'});
$('#imageContainer, #frameContainer, #modalContainer').css({ padding: Lightbox.borderSize + 'px'});
$('#outerImageContainer, #imageDataContainer, #bottomNavClose').css({backgroundColor: '#' + Lightbox.boxColor, color: '#'+Lightbox.fontColor});
if (!Lightbox.iframe_border) {
$('#lightboxFrame').css({border: 'none'});
$('#lightboxFrame').attr("frameborder", '0');
}
// Force navigation links to always be displayed
if (s.force_show_nav) {
$('#prevLink, #nextLink').addClass("force_show_nav");
}
},
// initList()
// Loops through anchor tags looking for 'lightbox', 'lightshow' and
// 'lightframe', etc, references and applies onclick events to appropriate
// links. You can rerun after dynamically adding images w/ajax.
initList : function() {
// Attach lightbox to any links with rel 'lightbox', 'lightshow' or
// 'lightframe', etc.
$("a[@rel^='lightbox'], area[@rel^='lightbox']").click(function(e) {
$('#lightbox').click(function() { Lightbox.end('forceClose'); } );
Lightbox.start(this, false, false, false, false);
if (e.preventDefault) { e.preventDefault(); }
return false;
});
$("a[@rel^='lightshow'], area[@rel^='lightshow']").click(function(e) {
$('#lightbox').click(function() { Lightbox.end('forceClose'); } );
Lightbox.start(this, true, false, false, false);
if (e.preventDefault) { e.preventDefault(); }
return false;
});
$("a[@rel^='lightframe'], area[@rel^='lightframe']").click(function(e) {
$('#lightbox').click(function() { Lightbox.end('forceClose'); } );
Lightbox.start(this, false, true, false, false);
if (e.preventDefault) { e.preventDefault(); }
return false;
});
$("a[@rel^='lightvideo'], area[@rel^='lightvideo']").click(function(e) {
$('#lightbox').click(function() { Lightbox.end('forceClose'); } );
Lightbox.start(this, false, false, true, false);
if (e.preventDefault) { e.preventDefault(); }
return false;
});
$("a[@rel^='lightmodal'], area[@rel^='lightmodal']").click(function(e) {
$('#lightbox').unbind('click');
Lightbox.start(this, false, false, false, true);
if (e.preventDefault) { e.preventDefault(); }
return false;
});
},
// start()
// Display overlay and lightbox. If image is part of a set, add siblings to
// imageArray.
start: function(imageLink, slideshow, lightframe, lightvideo, lightmodal) {
Lightbox.isPaused = false;
// Replaces hideSelectBoxes() and hideFlash() calls in original lightbox2.
Lightbox.toggleSelectsFlash('hide');
// Stretch overlay to fill page and fade in.
var arrayPageSize = Lightbox.getPageSize();
$("#overlay").hide().css({
width: '100%',
zIndex: '10090',
height: arrayPageSize[1] + 'px',
backgroundColor : '#' + Lightbox.overlayColor,
opacity : Lightbox.overlayOpacity
}).fadeIn(Lightbox.fadeInSpeed);
Lightbox.isSlideshow = slideshow;
Lightbox.isLightframe = lightframe;
Lightbox.isVideo = lightvideo;
Lightbox.isModal = lightmodal;
Lightbox.imageArray = [];
Lightbox.imageNum = 0;
var anchors = $(imageLink.tagName);
var anchor = null;
var rel_parts = Lightbox.parseRel(imageLink);
var rel = rel_parts["rel"];
var rel_group = rel_parts["group"];
var title = (rel_parts["title"] ? rel_parts["title"] : imageLink.title);
var rel_style = null;
var i = 0;
// Handle lightbox images with no grouping.
if ((rel == 'lightbox' || rel == 'lightshow') && !rel_group) {
Lightbox.imageArray.push([imageLink.href, title]);
}
// Handle iframes with no grouping.
else if ((rel == 'lightframe' || rel == 'lightmodal') && !rel_group) {
rel_style = (!rel_parts["style"] ? 'width: '+ Lightbox.iframe_width +'px; height: '+ Lightbox.iframe_height +'px; scrolling: auto;' : rel_parts["style"]);
Lightbox.imageArray.push([imageLink.href, title, rel_style]);
}
// Handle video.
else if (rel == "lightvideo") {
// rel_group contains style information for videos.
rel_style = (!rel_group ? 'width: 400px; height: 400px;' : rel_group);
Lightbox.imageArray.push([imageLink.href, title, rel_style]);
}
// Handle iframes and lightbox & slideshow images.
else if (rel == 'lightbox' || rel == 'lightshow' || rel == 'lightframe' || rel == 'lightmodal') {
// Loop through anchors and add them to imageArray.
for (i = 0; i < anchors.length; i++) {
anchor = anchors[i];
if (anchor.href && $(anchor).attr('rel')) {
var rel_data = Lightbox.parseRel(anchor);
var anchor_title = (rel_data["title"] ? rel_data["title"] : anchor.title);
if (rel_data["rel"] == rel) {
if (rel_data["group"] == rel_group) {
if (Lightbox.isLightframe || Lightbox.isModal) {
rel_style = (!rel_data["style"] ? 'width: '+ Lightbox.iframe_width +'px; height: '+ Lightbox.iframe_height +'px; scrolling: auto;' : rel_data["style"]);
}
Lightbox.imageArray.push([anchor.href, anchor_title, rel_style]);
}
}
}
}
// Remove duplicates.
for (i = 0; i < Lightbox.imageArray.length; i++) {
for (j = Lightbox.imageArray.length-1; j > i; j--) {
if (Lightbox.imageArray[i][0] == Lightbox.imageArray[j][0]) {
Lightbox.imageArray.splice(j,1);
}
}
}
while (Lightbox.imageArray[Lightbox.imageNum][0] != imageLink.href) {
Lightbox.imageNum++;
}
}
if (Lightbox.isSlideshow && Lightbox.showPlayPause && Lightbox.isPaused) {
$('#lightshowPlay').show();
$('#lightshowPause').hide();
}
// Calculate top and left offset for the lightbox.
var arrayPageScroll = Lightbox.getPageScroll();
var lightboxTop = arrayPageScroll[1] + (Lightbox.topPosition == '' ? (arrayPageSize[3] / 10) : Lightbox.topPosition) * 1;
var lightboxLeft = arrayPageScroll[0];
$('#lightbox').css({
zIndex: '10500',
top: lightboxTop + 'px',
left: lightboxLeft + 'px'
}).show();
Lightbox.total = Lightbox.imageArray.length;
Lightbox.changeData(Lightbox.imageNum);
},
// changeData()
// Hide most elements and preload image in preparation for resizing image
// container.
changeData: function(imageNum, zoomIn) {
if (Lightbox.inprogress === false) {
if (Lightbox.total > 1 && ((Lightbox.isSlideshow && Lightbox.loopSlides) || (!Lightbox.isSlideshow && Lightbox.loopItems))) {
if (imageNum >= Lightbox.total) imageNum = 0;
if (imageNum < 0) imageNum = Lightbox.total - 1;
}
if (Lightbox.isSlideshow) {
for (var i = 0; i < Lightbox.slideIdCount; i++) {
window.clearTimeout(Lightbox.slideIdArray[i]);
}
}
Lightbox.inprogress = true;
Lightbox.activeImage = imageNum;
if (Lightbox.disableResize && !Lightbox.isSlideshow) {
zoomIn = true;
}
Lightbox.isZoomedIn = zoomIn;
// Hide elements during transition.
$('#loading').css({zIndex: '10500'}).show();
if (!Lightbox.alternative_layout) {
$('#imageContainer').hide();
}
$('#frameContainer, #modalContainer, #lightboxImage, #lightboxFrame').hide();
$('#hoverNav, #prevLink, #nextLink, #frameHoverNav, #framePrevLink, #frameNextLink').hide();
$('#imageDataContainer, #numberDisplay, #bottomNavZoom, #bottomNavZoomOut').hide();
// Preload image content, but not iframe pages.
if (!Lightbox.isLightframe && !Lightbox.isVideo && !Lightbox.isModal) {
imgPreloader = new Image();
imgPreloader.onerror = function() { Lightbox.imgNodeLoadingError(this); };
imgPreloader.onload = function() {
var photo = document.getElementById('lightboxImage');
photo.src = Lightbox.imageArray[Lightbox.activeImage][0];
photo.alt = Lightbox.imageArray[Lightbox.activeImage][1];
var imageWidth = imgPreloader.width;
var imageHeight = imgPreloader.height;
// Resize code.
var arrayPageSize = Lightbox.getPageSize();
var targ = { w:arrayPageSize[2] - (Lightbox.borderSize * 2), h:arrayPageSize[3] - (Lightbox.borderSize * 6) - (Lightbox.infoHeight * 4) - (arrayPageSize[3] / 10) };
var orig = { w:imgPreloader.width, h:imgPreloader.height };
// Image is very large, so show a smaller version of the larger image
// with zoom button.
if (zoomIn !== true) {
var ratio = 1.0; // Shrink image with the same aspect.
$('#bottomNavZoomOut, #bottomNavZoom').hide();
if ((orig.w >= targ.w || orig.h >= targ.h) && orig.h && orig.w) {
ratio = ((targ.w / orig.w) < (targ.h / orig.h)) ? targ.w / orig.w : targ.h / orig.h;
if (!Lightbox.disableZoom && !Lightbox.isSlideshow) {
$('#bottomNavZoom').css({zIndex: '10500'}).show();
}
}
imageWidth = Math.floor(orig.w * ratio);
imageHeight = Math.floor(orig.h * ratio);
}
else {
$('#bottomNavZoom').hide();
// Only display zoom out button if the image is zoomed in already.
if ((orig.w >= targ.w || orig.h >= targ.h) && orig.h && orig.w) {
// Only display zoom out button if not a slideshow and if the
// buttons aren't disabled.
if (!Lightbox.disableResize && Lightbox.isSlideshow === false && !Lightbox.disableZoom) {
$('#bottomNavZoomOut').css({zIndex: '10500'}).show();
}
}
}
photo.style.width = (imageWidth) + 'px';
photo.style.height = (imageHeight) + 'px';
Lightbox.resizeContainer(imageWidth, imageHeight);
// Clear onLoad, IE behaves irratically with animated gifs otherwise.
imgPreloader.onload = function() {};
};
imgPreloader.src = Lightbox.imageArray[Lightbox.activeImage][0];
imgPreloader.alt = Lightbox.imageArray[Lightbox.activeImage][1];
}
// Set up frame size, etc.
else if (Lightbox.isLightframe) {
var iframe = document.getElementById('lightboxFrame');
var iframeStyles = Lightbox.imageArray[Lightbox.activeImage][2];
iframe = Lightbox.setStyles(iframe, iframeStyles);
Lightbox.resizeContainer(parseInt(iframe.width, 10), parseInt(iframe.height, 10));
}
else if (Lightbox.isVideo || Lightbox.isModal) {
var container = document.getElementById('modalContainer');
var modalStyles = Lightbox.imageArray[Lightbox.activeImage][2];
container = Lightbox.setStyles(container, modalStyles);
if (Lightbox.isVideo) {
Lightbox.modalHeight = parseInt(container.height, 10);
Lightbox.modalWidth = parseInt(container.width, 10);
Lightvideo.startVideo(Lightbox.imageArray[Lightbox.activeImage][0]);
}
Lightbox.resizeContainer(parseInt(container.width, 10), parseInt(container.height, 10));
}
}
},
// imgNodeLoadingError()
imgNodeLoadingError: function(image) {
var s = Drupal.settings.lightbox2;
var original_image = Lightbox.imageArray[Lightbox.activeImage][0];
if (s.display_image_size !== "") {
original_image = original_image.replace(new RegExp("."+s.display_image_size), "");
}
Lightbox.imageArray[Lightbox.activeImage][0] = original_image;
image.onerror = function() { Lightbox.imgLoadingError(image); };
image.src = original_image;
},
// imgLoadingError()
imgLoadingError: function(image) {
var s = Drupal.settings.lightbox2;
Lightbox.imageArray[Lightbox.activeImage][0] = s.default_image;
image.src = s.default_image;
},
// resizeContainer()
resizeContainer: function(imgWidth, imgHeight) {
this.widthCurrent = $('#outerImageContainer').width();
this.heightCurrent = $('#outerImageContainer').height();
var widthNew = (imgWidth + (Lightbox.borderSize * 2));
var heightNew = (imgHeight + (Lightbox.borderSize * 2));
// Scalars based on change from old to new.
this.xScale = ( widthNew / this.widthCurrent) * 100;
this.yScale = ( heightNew / this.heightCurrent) * 100;
// Calculate size difference between new and old image, and resize if
// necessary.
wDiff = this.widthCurrent - widthNew;
hDiff = this.heightCurrent - heightNew;
// Detect animation sequence.
if (Lightbox.resizeSequence) {
var animate1 = {width: widthNew};
var animate2 = {height: heightNew};
if (Lightbox.resizeSequence == 2) {
animate1 = {height: heightNew};
animate2 = {width: widthNew};
}
$('#outerImageContainer').animate(animate1, Lightbox.resizeSpeed).animate(animate2, Lightbox.resizeSpeed, 'linear', function() { Lightbox.showData(); });
}
// Simultaneous.
else {
$('#outerImageContainer').animate({width: widthNew, height: heightNew}, Lightbox.resizeSpeed, 'linear', function() { Lightbox.showData(); });
}
// If new and old image are same size and no scaling transition is necessary
// do a quick pause to prevent image flicker.
if ((hDiff === 0) && (wDiff === 0)) {
if ($.browser.msie) {
Lightbox.pause(250);
}
else {
Lightbox.pause(100);
}
}
var s = Drupal.settings.lightbox2;
if (!s.use_alt_layout) {
$('#prevLink, #nextLink').css({height: imgHeight + 'px'});
}
$('#imageDataContainer').css({width: widthNew + 'px'});
},
// showData()
// Display image and begin preloading neighbors.
showData: function() {
$('#loading').hide();
if (Lightbox.isLightframe || Lightbox.isVideo || Lightbox.isModal) {
Lightbox.updateDetails();
if (Lightbox.isLightframe) {
$('#frameContainer').show();
if ($.browser.safari) {
$('#lightboxFrame').css({zIndex: '10500'}).show();
}
else {
$('#lightboxFrame').css({zIndex: '10500'}).fadeIn(Lightbox.fadeInSpeed);
}
try {
document.getElementById("lightboxFrame").src = Lightbox.imageArray[Lightbox.activeImage][0];
} catch(e) {}
}
else {
if (Lightbox.isVideo) {
$("#modalContainer").html(Lightbox.modalHTML);
$("#modalContainer").click(function() { return false; } );
}
else {
$("#modalContainer").load(Lightbox.imageArray[Lightbox.activeImage][0]);
$('#modalContainer').unbind('click');
}
$('#modalContainer').css({zIndex: '10500'}).show();
}
}
// Handle display of image content.
else {
$('#imageContainer').show();
if($.browser.safari) {
$('#lightboxImage').css({zIndex: '10500'}).show();
}
else {
$('#lightboxImage').css({zIndex: '10500'}).fadeIn(Lightbox.fadeInSpeed);
}
Lightbox.updateDetails();
this.preloadNeighborImages();
}
Lightbox.inprogress = false;
// Slideshow specific stuff.
if (Lightbox.isSlideshow) {
if (!Lightbox.loopSlides && Lightbox.activeImage == (Lightbox.total - 1)) {
if (Lightbox.autoExit) {
Lightbox.slideIdArray[Lightbox.slideIdCount++] = setTimeout(function () {Lightbox.end('slideshow');}, Lightbox.slideInterval);
}
}
else {
if (!Lightbox.isPaused) {
Lightbox.slideIdArray[Lightbox.slideIdCount++] = setTimeout(function () {Lightbox.changeData(Lightbox.activeImage + 1);}, Lightbox.slideInterval);
}
}
if (Lightbox.showPlayPause && Lightbox.total > 1 && !Lightbox.isPaused) {
$('#lightshowPause').show();
$('#lightshowPlay').hide();
}
else if (Lightbox.showPlayPause && Lightbox.total > 1) {
$('#lightshowPause').hide();
$('#lightshowPlay').show();
}
}
// Adjust the page overlay size.
var arrayPageSize = Lightbox.getPageSize();
var arrayPageScroll = Lightbox.getPageScroll();
var pageHeight = arrayPageSize[1];
if (Lightbox.isZoomedIn && arrayPageSize[1] > arrayPageSize[3]) {
var lightboxTop = (Lightbox.topPosition == '' ? (arrayPageSize[3] / 10) : Lightbox.topPosition) * 1;
pageHeight = pageHeight + arrayPageScroll[1] + lightboxTop;
}
$('#overlay').css({height: pageHeight + 'px', width: arrayPageSize[0] + 'px'});
// Gecko browsers (e.g. Firefox, SeaMonkey, etc) don't handle pdfs as
// expected.
if ($.browser.mozilla) {
if (Lightbox.imageArray[Lightbox.activeImage][0].indexOf(".pdf") != -1) {
setTimeout(function () {
document.getElementById("lightboxFrame").src = Lightbox.imageArray[Lightbox.activeImage][0];
}, 1000);
}
}
},
// updateDetails()
// Display caption, image number, and bottom nav.
updateDetails: function() {
$("#imageDataContainer").hide();
var caption = Lightbox.imageArray[Lightbox.activeImage][1];
if (!caption) caption = '&nbsp;';
$('#caption').html(caption).css({zIndex: '10500'}).show();
// If image is part of set display 'Image x of x'.
var s = Drupal.settings.lightbox2;
var numberDisplay = null;
if (Lightbox.total > 1) {
var currentImage = Lightbox.activeImage + 1;
if (!Lightbox.isLightframe) {
numberDisplay = s.image_count.replace(/\!current/, currentImage).replace(/\!total/, Lightbox.total);
}
else {
numberDisplay = s.page_count.replace(/\!current/, currentImage).replace(/\!total/, Lightbox.total);
}
$('#numberDisplay').html(numberDisplay).css({zIndex: '10500'}).show();
}
$("#imageDataContainer").hide().slideDown(Lightbox.slideDownSpeed);
if (Lightbox.rtl) {
$("#bottomNav").css({float: 'left'});
}
Lightbox.updateNav();
},
// updateNav()
// Display appropriate previous and next hover navigation.
updateNav: function() {
$('#hoverNav').css({zIndex: '10500'}).show();
var prevLink = '#prevLink';
var nextLink = '#nextLink';
// Slideshow is separated as we need to show play / pause button.
if (Lightbox.isSlideshow) {
if ((Lightbox.total > 1 && Lightbox.loopSlides) || Lightbox.activeImage !== 0) {
$(prevLink).css({zIndex: '10500'}).show().click(function() {
if (Lightbox.pauseOnPrevClick) {
Lightbox.togglePlayPause("lightshowPause", "lightshowPlay");
}
Lightbox.changeData(Lightbox.activeImage - 1); return false;
});
}
else {
$(prevLink).hide();
}
// If not last image in set, display next image button.
if ((Lightbox.total > 1 && Lightbox.loopSlides) || Lightbox.activeImage != (Lightbox.total - 1)) {
$(nextLink).css({zIndex: '10500'}).show().click(function() {
if (Lightbox.pauseOnNextClick) {
Lightbox.togglePlayPause("lightshowPause", "lightshowPlay");
}
Lightbox.changeData(Lightbox.activeImage + 1); return false;
});
}
// Safari browsers need to have hide() called again.
else {
$(nextLink).hide();
}
}
// All other types of content.
else {
if (Lightbox.isLightframe && !Lightbox.alternative_layout) {
$('#frameHoverNav').css({zIndex: '10500'}).show();
$('#hoverNav').css({zIndex: '10500'}).hide();
prevLink = '#framePrevLink';
nextLink = '#frameNextLink';
}
// If not first image in set, display prev image button.
if ((Lightbox.total > 1 && Lightbox.loopItems) || Lightbox.activeImage !== 0) {
$(prevLink).css({zIndex: '10500'}).show().click(function() {
Lightbox.changeData(Lightbox.activeImage - 1); return false;
});
}
// Safari browsers need to have hide() called again.
else {
$(prevLink).hide();
}
// If not last image in set, display next image button.
if ((Lightbox.total > 1 && Lightbox.loopItems) || Lightbox.activeImage != (Lightbox.total - 1)) {
$(nextLink).css({zIndex: '10500'}).show().click(function() {
Lightbox.changeData(Lightbox.activeImage + 1); return false;
});
}
// Safari browsers need to have hide() called again.
else {
$(nextLink).hide();
}
}
if (!Lightbox.isModal) {
this.enableKeyboardNav();
}
},
// enableKeyboardNav()
enableKeyboardNav: function() {
$(document).bind("keydown", this.keyboardAction);
},
// disableKeyboardNav()
disableKeyboardNav: function() {
$(document).unbind("keydown", this.keyboardAction);
},
// keyboardAction()
keyboardAction: function(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();
// Close lightbox.
if (key == 'x' || key == 'o' || key == 'c' || keycode == escapeKey) {
Lightbox.end('forceClose');
// Display previous image (p, <-).
}
else if (key == 'p' || keycode == 37) {
if ((Lightbox.total > 1 && ((Lightbox.isSlideshow && Lightbox.loopSlides) || (!Lightbox.isSlideshow && Lightbox.loopItems))) || Lightbox.activeImage !== 0) {
Lightbox.changeData(Lightbox.activeImage - 1);
}
// Display next image (n, ->).
}
else if (key == 'n' || keycode == 39) {
if ((Lightbox.total > 1 && ((Lightbox.isSlideshow && Lightbox.loopSlides) || (!Lightbox.isSlideshow && Lightbox.loopItems))) || Lightbox.activeImage != (Lightbox.total - 1)) {
Lightbox.changeData(Lightbox.activeImage + 1);
}
}
// Zoom in.
else if (key == 'z' && !Lightbox.disableResize && !Lightbox.disableZoom && !Lightbox.isSlideshow && !Lightbox.isLightframe) {
if (Lightbox.isZoomedIn) {
Lightbox.changeData(Lightbox.activeImage, false);
}
else if (!Lightbox.isZoomedIn) {
Lightbox.changeData(Lightbox.activeImage, true);
}
return false;
}
// Toggle play / pause (space).
else if (keycode == 32 && Lightbox.isSlideshow) {
if (Lightbox.isPaused) {
Lightbox.togglePlayPause("lightshowPlay", "lightshowPause");
}
else {
Lightbox.togglePlayPause("lightshowPause", "lightshowPlay");
}
return false;
}
},
preloadNeighborImages: function() {
if ((Lightbox.total - 1) > Lightbox.activeImage) {
preloadNextImage = new Image();
preloadNextImage.src = Lightbox.imageArray[Lightbox.activeImage + 1][0];
}
if (Lightbox.activeImage > 0) {
preloadPrevImage = new Image();
preloadPrevImage.src = Lightbox.imageArray[Lightbox.activeImage - 1][0];
}
},
end: function(caller) {
var closeClick = (caller == 'slideshow' ? false : true);
if (Lightbox.isSlideshow && Lightbox.isPaused && !closeClick) {
return;
}
// To prevent double clicks on navigation links.
if (Lightbox.inprogress === true && caller != 'forceClose') {
return;
}
Lightbox.disableKeyboardNav();
$('#lightbox').hide();
$("#overlay").fadeOut();
Lightbox.isPaused = true;
Lightbox.inprogress = false;
// Replaces calls to showSelectBoxes() and showFlash() in original
// lightbox2.
Lightbox.toggleSelectsFlash('visible');
if (Lightbox.isSlideshow) {
for (var i = 0; i < Lightbox.slideIdCount; i++) {
window.clearTimeout(Lightbox.slideIdArray[i]);
}
$('#lightshowPause, #lightshowPlay').hide();
}
else if (Lightbox.isLightframe) {
document.getElementById("lightboxFrame").src = '';
if ($.browser.safari) {
var iFrame = document.getElementById("lightboxFrame");
var parent = iFrame.parentNode;
parent.removeChild(iFrame);
parent.appendChild(iFrame);
}
$('#lightboxFrame, #frameContainer').hide();
}
else if (Lightbox.isVideo || Lightbox.isModal) {
$('#modalContainer').hide();
$('#modalContainer').html("");
}
},
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.com.
getPageScroll : function() {
var xScroll, yScroll;
if (self.pageYOffset) {
yScroll = self.pageYOffset;
xScroll = self.pageXOffset;
}
else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict.
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.com.
// Edit for Firefox by pHaez.
getPageSize : function() {
var xScroll, yScroll;
if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
}
else if (window.innerHeight && window.scrollMaxY) {
xScroll = window.innerWidth + window.scrollMaxX;
yScroll = window.innerHeight + window.scrollMaxY;
}
// 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.clientWidth) {
windowWidth = document.documentElement.clientWidth;
}
else {
windowWidth = self.innerWidth;
}
windowHeight = self.innerHeight;
}
// Explorer 6 Strict Mode.
else if (document.documentElement && document.documentElement.clientHeight) {
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 = windowWidth;
}
else {
pageWidth = xScroll;
}
arrayPageSize = [pageWidth, pageHeight, windowWidth, windowHeight];
return arrayPageSize;
},
// pause(numberMillis)
pause : function(ms) {
var date = new Date();
var curDate = null;
do { curDate = new Date(); }
while (curDate - date < ms);
},
// toggleSelectsFlash()
// Hide / unhide select lists and flash objects as they appear above the
// lightbox in some browsers.
toggleSelectsFlash: function (state) {
if (state == 'visible') {
$("select.lightbox_hidden, embed.lightbox_hidden, object.lightbox_hidden").show();
}
else if (state == 'hide') {
$("select:visible, embed:visible, object:visible").addClass("lightbox_hidden");
$("select.lightbox_hidden, embed.lightbox_hidden, object.lightbox_hidden").hide();
}
},
// parseRel()
parseRel: function (link) {
var parts = [];
parts["rel"] = $(link).attr('rel').match(/\w+/)[0];
parts["title"] = parts["group"] = parts["style"] = null;
if ($(link).attr('rel').match(/\[(.*)\]/)) {
var info = $(link).attr('rel').match(/\[(.*?)\]/)[1].split('|');
parts["group"] = info[0];
parts["style"] = info[1];
}
if ($(link).attr('rel').match(/\[.*\]\[(.*)\]/)) {
parts["title"] = $(link).attr('rel').match(/\[.*\]\[(.*)\]/)[1];
}
return parts;
},
// setStyles()
setStyles: function(item, styles) {
var stylesArray = styles.split(';');
for (var i = 0; i< stylesArray.length; i++) {
if (stylesArray[i].indexOf('width:') >= 0) {
var w = stylesArray[i].replace('width:', '');
item.width = jQuery.trim(w);
}
else if (stylesArray[i].indexOf('height:') >= 0) {
var h = stylesArray[i].replace('height:', '');
item.height = jQuery.trim(h);
}
else if (stylesArray[i].indexOf('scrolling:') >= 0) {
var scrolling = stylesArray[i].replace('scrolling:', '');
item.scrolling = jQuery.trim(scrolling);
}
else if (stylesArray[i].indexOf('overflow:') >= 0) {
var overflow = stylesArray[i].replace('overflow:', '');
item.overflow = jQuery.trim(overflow);
}
}
return item;
},
// togglePlayPause()
// Hide the pause / play button as appropriate. If pausing the slideshow also
// clear the timers, otherwise move onto the next image.
togglePlayPause: function(hideId, showId) {
if (Lightbox.isSlideshow && hideId == "lightshowPause") {
for (var i = 0; i < Lightbox.slideIdCount; i++) {
window.clearTimeout(Lightbox.slideIdArray[i]);
}
}
$('#' + hideId).hide();
$('#' + showId).show();
if (hideId == "lightshowPlay") {
Lightbox.isPaused = false;
if (!Lightbox.loopSlides && Lightbox.activeImage == (Lightbox.total - 1)) {
Lightbox.end();
}
else {
Lightbox.changeData(Lightbox.activeImage + 1);
}
}
else {
Lightbox.isPaused = true;
}
}
};
// Initialize the lightbox.
Drupal.behaviors.initLightbox = function (context) {
Lightbox.initialize();
};
;// $Id: panels.js,v 1.2.4.1 2009/10/05 22:40:35 merlinofchaos Exp $
(function ($) {
Drupal.Panels = {};
Drupal.Panels.autoAttach = function() {
if ($.browser.msie) {
// If IE, attach a hover event so we can see our admin links.
$("div.panel-pane").hover(
function() {
$('div.panel-hide', this).addClass("panel-hide-hover"); return true;
},
function() {
$('div.panel-hide', this).removeClass("panel-hide-hover"); return true;
}
);
$("div.admin-links").hover(
function() {
$(this).addClass("admin-links-hover"); return true;
},
function(){
$(this).removeClass("admin-links-hover"); return true;
}
);
}
};
$(Drupal.Panels.autoAttach);
})(jQuery);
;