root / docs / www / colonyscout / highslide-with-gallery.js @ f59acf11
History | View | Annotate | Download (72.7 KB)
1 |
/******************************************************************************
|
---|---|
2 |
Name: Highslide JS
|
3 |
Version: 4.1.8 (October 27 2009)
|
4 |
Config: default +slideshow +positioning +transitions +viewport +thumbstrip
|
5 |
Author: Torstein Hønsi
|
6 |
Support: http://highslide.com/support
|
7 |
|
8 |
Licence:
|
9 |
Highslide JS is licensed under a Creative Commons Attribution-NonCommercial 2.5
|
10 |
License (http://creativecommons.org/licenses/by-nc/2.5/).
|
11 |
|
12 |
You are free:
|
13 |
* to copy, distribute, display, and perform the work
|
14 |
* to make derivative works
|
15 |
|
16 |
Under the following conditions:
|
17 |
* Attribution. You must attribute the work in the manner specified by the
|
18 |
author or licensor.
|
19 |
* Noncommercial. You may not use this work for commercial purposes.
|
20 |
|
21 |
* For any reuse or distribution, you must make clear to others the license
|
22 |
terms of this work.
|
23 |
* Any of these conditions can be waived if you get permission from the
|
24 |
copyright holder.
|
25 |
|
26 |
Your fair use and other rights are in no way affected by the above.
|
27 |
******************************************************************************/
|
28 |
if (!hs) { var hs = { |
29 |
// Language strings
|
30 |
lang : {
|
31 |
cssDirection: 'ltr', |
32 |
loadingText : 'Loading...', |
33 |
loadingTitle : 'Click to cancel', |
34 |
focusTitle : 'Click to bring to front', |
35 |
fullExpandTitle : 'Expand to actual size (f)', |
36 |
creditsText : 'Powered by <i>Highslide JS</i>', |
37 |
creditsTitle : 'Go to the Highslide JS homepage', |
38 |
previousText : 'Previous', |
39 |
nextText : 'Next', |
40 |
moveText : 'Move', |
41 |
closeText : 'Close', |
42 |
closeTitle : 'Close (esc)', |
43 |
resizeTitle : 'Resize', |
44 |
playText : 'Play', |
45 |
playTitle : 'Play slideshow (spacebar)', |
46 |
pauseText : 'Pause', |
47 |
pauseTitle : 'Pause slideshow (spacebar)', |
48 |
previousTitle : 'Previous (arrow left)', |
49 |
nextTitle : 'Next (arrow right)', |
50 |
moveTitle : 'Move', |
51 |
fullExpandText : '1:1', |
52 |
number: 'Image %1 of %2', |
53 |
restoreTitle : 'Click to close image, click and drag to move. Use arrow keys for next and previous.' |
54 |
}, |
55 |
// See http://highslide.com/ref for examples of settings
|
56 |
graphicsDir : 'highslide/graphics/', |
57 |
expandCursor : 'zoomin.cur', // null disables |
58 |
restoreCursor : 'zoomout.cur', // null disables |
59 |
expandDuration : 250, // milliseconds |
60 |
restoreDuration : 250, |
61 |
marginLeft : 15, |
62 |
marginRight : 15, |
63 |
marginTop : 15, |
64 |
marginBottom : 15, |
65 |
zIndexCounter : 1001, // adjust to other absolutely positioned elements |
66 |
loadingOpacity : 0.75, |
67 |
allowMultipleInstances: true, |
68 |
numberOfImagesToPreload : 5, |
69 |
outlineWhileAnimating : 2, // 0 = never, 1 = always, 2 = HTML only |
70 |
outlineStartOffset : 3, // ends at 10 |
71 |
padToMinWidth : false, // pad the popup width to make room for wide caption |
72 |
fullExpandPosition : 'bottom right', |
73 |
fullExpandOpacity : 1, |
74 |
showCredits : true, // you can set this to false if you want |
75 |
creditsHref : 'http://highslide.com/', |
76 |
creditsTarget : '_self', |
77 |
enableKeyListener : true, |
78 |
openerTagNames : ['a'], // Add more to allow slideshow indexing |
79 |
transitions : [],
|
80 |
transitionDuration: 250, |
81 |
dimmingOpacity: 0, // Lightbox style dimming background |
82 |
dimmingDuration: 50, // 0 for instant dimming |
83 |
|
84 |
anchor : 'auto', // where the image expands from |
85 |
align : 'auto', // position in the client (overrides anchor) |
86 |
targetX: null, // the id of a target element |
87 |
targetY: null, |
88 |
dragByHeading: true, |
89 |
minWidth: 200, |
90 |
minHeight: 200, |
91 |
allowSizeReduction: true, // allow the image to reduce to fit client size. If false, this overrides minWidth and minHeight |
92 |
outlineType : 'drop-shadow', // set null to disable outlines |
93 |
skin : {
|
94 |
controls:
|
95 |
'<div class="highslide-controls"><ul>'+
|
96 |
'<li class="highslide-previous">'+
|
97 |
'<a href="#" title="{hs.lang.previousTitle}">'+
|
98 |
'<span>{hs.lang.previousText}</span></a>'+
|
99 |
'</li>'+
|
100 |
'<li class="highslide-play">'+
|
101 |
'<a href="#" title="{hs.lang.playTitle}">'+
|
102 |
'<span>{hs.lang.playText}</span></a>'+
|
103 |
'</li>'+
|
104 |
'<li class="highslide-pause">'+
|
105 |
'<a href="#" title="{hs.lang.pauseTitle}">'+
|
106 |
'<span>{hs.lang.pauseText}</span></a>'+
|
107 |
'</li>'+
|
108 |
'<li class="highslide-next">'+
|
109 |
'<a href="#" title="{hs.lang.nextTitle}">'+
|
110 |
'<span>{hs.lang.nextText}</span></a>'+
|
111 |
'</li>'+
|
112 |
'<li class="highslide-move">'+
|
113 |
'<a href="#" title="{hs.lang.moveTitle}">'+
|
114 |
'<span>{hs.lang.moveText}</span></a>'+
|
115 |
'</li>'+
|
116 |
'<li class="highslide-full-expand">'+
|
117 |
'<a href="#" title="{hs.lang.fullExpandTitle}">'+
|
118 |
'<span>{hs.lang.fullExpandText}</span></a>'+
|
119 |
'</li>'+
|
120 |
'<li class="highslide-close">'+
|
121 |
'<a href="#" title="{hs.lang.closeTitle}" >'+
|
122 |
'<span>{hs.lang.closeText}</span></a>'+
|
123 |
'</li>'+
|
124 |
'</ul></div>'
|
125 |
}, |
126 |
// END OF YOUR SETTINGS
|
127 |
|
128 |
|
129 |
// declare internal properties
|
130 |
preloadTheseImages : [],
|
131 |
continuePreloading: true, |
132 |
expanders : [],
|
133 |
overrides : [
|
134 |
'allowSizeReduction',
|
135 |
'useBox',
|
136 |
'anchor',
|
137 |
'align',
|
138 |
'targetX',
|
139 |
'targetY',
|
140 |
'outlineType',
|
141 |
'outlineWhileAnimating',
|
142 |
'captionId',
|
143 |
'captionText',
|
144 |
'captionEval',
|
145 |
'captionOverlay',
|
146 |
'headingId',
|
147 |
'headingText',
|
148 |
'headingEval',
|
149 |
'headingOverlay',
|
150 |
'creditsPosition',
|
151 |
'dragByHeading',
|
152 |
'autoplay',
|
153 |
'numberPosition',
|
154 |
'transitions',
|
155 |
'dimmingOpacity',
|
156 |
|
157 |
'width',
|
158 |
'height',
|
159 |
|
160 |
'wrapperClassName',
|
161 |
'minWidth',
|
162 |
'minHeight',
|
163 |
'maxWidth',
|
164 |
'maxHeight',
|
165 |
'slideshowGroup',
|
166 |
'easing',
|
167 |
'easingClose',
|
168 |
'fadeInOut',
|
169 |
'src'
|
170 |
], |
171 |
overlays : [],
|
172 |
idCounter : 0, |
173 |
oPos : {
|
174 |
x: ['leftpanel', 'left', 'center', 'right', 'rightpanel'], |
175 |
y: ['above', 'top', 'middle', 'bottom', 'below'] |
176 |
}, |
177 |
mouse: {},
|
178 |
headingOverlay: {},
|
179 |
captionOverlay: {},
|
180 |
timers : [],
|
181 |
|
182 |
slideshows : [],
|
183 |
|
184 |
pendingOutlines : {},
|
185 |
clones : {},
|
186 |
onReady: [],
|
187 |
uaVersion: /Trident\/4\.0/.test(navigator.userAgent) ? 8 : |
188 |
parseFloat((navigator.userAgent.toLowerCase().match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1]), |
189 |
ie : (document.all && !window.opera),
|
190 |
safari : /Safari/.test(navigator.userAgent), |
191 |
geckoMac : /Macintosh.+rv:1\.[0-8].+Gecko/.test(navigator.userAgent), |
192 |
|
193 |
$ : function (id) { |
194 |
if (id) return document.getElementById(id); |
195 |
}, |
196 |
|
197 |
push : function (arr, val) { |
198 |
arr[arr.length] = val; |
199 |
}, |
200 |
|
201 |
createElement : function (tag, attribs, styles, parent, nopad) { |
202 |
var el = document.createElement(tag);
|
203 |
if (attribs) hs.extend(el, attribs);
|
204 |
if (nopad) hs.setStyles(el, {padding: 0, border: 'none', margin: 0}); |
205 |
if (styles) hs.setStyles(el, styles);
|
206 |
if (parent) parent.appendChild(el);
|
207 |
return el;
|
208 |
}, |
209 |
|
210 |
extend : function (el, attribs) { |
211 |
for (var x in attribs) el[x] = attribs[x]; |
212 |
return el;
|
213 |
}, |
214 |
|
215 |
setStyles : function (el, styles) { |
216 |
for (var x in styles) { |
217 |
if (hs.ie && x == 'opacity') { |
218 |
if (styles[x] > 0.99) el.style.removeAttribute('filter'); |
219 |
else el.style.filter = 'alpha(opacity='+ (styles[x] * 100) +')'; |
220 |
} |
221 |
else el.style[x] = styles[x];
|
222 |
} |
223 |
}, |
224 |
animate: function(el, prop, opt) { |
225 |
var start,
|
226 |
end, |
227 |
unit; |
228 |
if (typeof opt != 'object' || opt === null) { |
229 |
var args = arguments; |
230 |
opt = { |
231 |
duration: args[2], |
232 |
easing: args[3], |
233 |
complete: args[4] |
234 |
}; |
235 |
} |
236 |
if (typeof opt.duration != 'number') opt.duration = 250; |
237 |
opt.easing = Math[opt.easing] || Math.easeInQuad; |
238 |
opt.curAnim = hs.extend({}, prop); |
239 |
for (var name in prop) { |
240 |
var e = new hs.fx(el, opt , name ); |
241 |
|
242 |
start = parseFloat(hs.css(el, name)) || 0;
|
243 |
end = parseFloat(prop[name]); |
244 |
unit = name != 'opacity' ? 'px' : ''; |
245 |
|
246 |
e.custom( start, end, unit ); |
247 |
} |
248 |
}, |
249 |
css: function(el, prop) { |
250 |
if (document.defaultView) {
|
251 |
return document.defaultView.getComputedStyle(el, null).getPropertyValue(prop); |
252 |
|
253 |
} else {
|
254 |
if (prop == 'opacity') prop = 'filter'; |
255 |
var val = el.currentStyle[prop.replace(/\-(\w)/g, function (a, b){ return b.toUpperCase(); })]; |
256 |
if (prop == 'filter') |
257 |
val = val.replace(/alpha\(opacity=([0-9]+)\)/,
|
258 |
function (a, b) { return b / 100 }); |
259 |
return val === '' ? 1 : val; |
260 |
} |
261 |
}, |
262 |
|
263 |
getPageSize : function () { |
264 |
var d = document, w = window, iebody = d.compatMode && d.compatMode != 'BackCompat' |
265 |
? d.documentElement : d.body; |
266 |
|
267 |
var width = hs.ie ? iebody.clientWidth :
|
268 |
(d.documentElement.clientWidth || self.innerWidth), |
269 |
height = hs.ie ? iebody.clientHeight : self.innerHeight; |
270 |
|
271 |
hs.page = { |
272 |
width: width,
|
273 |
height: height,
|
274 |
scrollLeft: hs.ie ? iebody.scrollLeft : pageXOffset,
|
275 |
scrollTop: hs.ie ? iebody.scrollTop : pageYOffset
|
276 |
} |
277 |
}, |
278 |
|
279 |
getPosition : function(el) { |
280 |
var p = { x: el.offsetLeft, y: el.offsetTop }; |
281 |
while (el.offsetParent) {
|
282 |
el = el.offsetParent; |
283 |
p.x += el.offsetLeft; |
284 |
p.y += el.offsetTop; |
285 |
if (el != document.body && el != document.documentElement) {
|
286 |
p.x -= el.scrollLeft; |
287 |
p.y -= el.scrollTop; |
288 |
} |
289 |
} |
290 |
return p;
|
291 |
}, |
292 |
|
293 |
expand : function(a, params, custom, type) { |
294 |
if (!a) a = hs.createElement('a', null, { display: 'none' }, hs.container); |
295 |
if (typeof a.getParams == 'function') return params; |
296 |
try {
|
297 |
new hs.Expander(a, params, custom);
|
298 |
return false; |
299 |
} catch (e) { return true; } |
300 |
}, |
301 |
getElementByClass : function (el, tagName, className) { |
302 |
var els = el.getElementsByTagName(tagName);
|
303 |
for (var i = 0; i < els.length; i++) { |
304 |
if ((new RegExp(className)).test(els[i].className)) { |
305 |
return els[i];
|
306 |
} |
307 |
} |
308 |
return null; |
309 |
}, |
310 |
replaceLang : function(s) { |
311 |
s = s.replace(/\s/g, ' '); |
312 |
var re = /{hs\.lang\.([^}]+)\}/g, |
313 |
matches = s.match(re), |
314 |
lang; |
315 |
if (matches) for (var i = 0; i < matches.length; i++) { |
316 |
lang = matches[i].replace(re, "$1");
|
317 |
if (typeof hs.lang[lang] != 'undefined') s = s.replace(matches[i], hs.lang[lang]); |
318 |
} |
319 |
return s;
|
320 |
}, |
321 |
|
322 |
|
323 |
focusTopmost : function() { |
324 |
var topZ = 0, |
325 |
topmostKey = -1,
|
326 |
expanders = hs.expanders, |
327 |
exp, |
328 |
zIndex; |
329 |
for (var i = 0; i < expanders.length; i++) { |
330 |
exp = expanders[i]; |
331 |
if (exp) {
|
332 |
zIndex = exp.wrapper.style.zIndex; |
333 |
if (zIndex && zIndex > topZ) {
|
334 |
topZ = zIndex; |
335 |
topmostKey = i; |
336 |
} |
337 |
} |
338 |
} |
339 |
if (topmostKey == -1) hs.focusKey = -1; |
340 |
else expanders[topmostKey].focus();
|
341 |
}, |
342 |
|
343 |
getParam : function (a, param) { |
344 |
a.getParams = a.onclick; |
345 |
var p = a.getParams ? a.getParams() : null; |
346 |
a.getParams = null;
|
347 |
|
348 |
return (p && typeof p[param] != 'undefined') ? p[param] : |
349 |
(typeof hs[param] != 'undefined' ? hs[param] : null); |
350 |
}, |
351 |
|
352 |
getSrc : function (a) { |
353 |
var src = hs.getParam(a, 'src'); |
354 |
if (src) return src; |
355 |
return a.href;
|
356 |
}, |
357 |
|
358 |
getNode : function (id) { |
359 |
var node = hs.$(id), clone = hs.clones[id], a = {}; |
360 |
if (!node && !clone) return null; |
361 |
if (!clone) {
|
362 |
clone = node.cloneNode(true);
|
363 |
clone.id = '';
|
364 |
hs.clones[id] = clone; |
365 |
return node;
|
366 |
} else {
|
367 |
return clone.cloneNode(true); |
368 |
} |
369 |
}, |
370 |
|
371 |
discardElement : function(d) { |
372 |
if (d) hs.garbageBin.appendChild(d);
|
373 |
hs.garbageBin.innerHTML = '';
|
374 |
}, |
375 |
dim : function(exp) { |
376 |
if (!hs.dimmer) {
|
377 |
hs.dimmer = hs.createElement ('div', {
|
378 |
className: 'highslide-dimming highslide-viewport-size', |
379 |
owner: '', |
380 |
onclick: function() { |
381 |
|
382 |
hs.close(); |
383 |
} |
384 |
}, { |
385 |
visibility: 'visible', |
386 |
opacity: 0 |
387 |
}, hs.container, true);
|
388 |
} |
389 |
|
390 |
hs.dimmer.style.display = '';
|
391 |
|
392 |
hs.dimmer.owner += '|'+ exp.key;
|
393 |
if (hs.geckoMac && hs.dimmingGeckoFix)
|
394 |
hs.setStyles(hs.dimmer, { |
395 |
background: 'url('+ hs.graphicsDir + 'geckodimmer.png)', |
396 |
opacity: 1 |
397 |
}); |
398 |
else
|
399 |
hs.animate(hs.dimmer, { opacity: exp.dimmingOpacity }, hs.dimmingDuration);
|
400 |
}, |
401 |
undim : function(key) { |
402 |
if (!hs.dimmer) return; |
403 |
if (typeof key != 'undefined') hs.dimmer.owner = hs.dimmer.owner.replace('|'+ key, ''); |
404 |
|
405 |
if (
|
406 |
(typeof key != 'undefined' && hs.dimmer.owner != '') |
407 |
|| (hs.upcoming && hs.getParam(hs.upcoming, 'dimmingOpacity'))
|
408 |
) return;
|
409 |
|
410 |
if (hs.geckoMac && hs.dimmingGeckoFix) hs.dimmer.style.display = 'none'; |
411 |
else hs.animate(hs.dimmer, { opacity: 0 }, hs.dimmingDuration, null, function() { |
412 |
hs.dimmer.style.display = 'none';
|
413 |
}); |
414 |
}, |
415 |
transit : function (adj, exp) { |
416 |
var last = exp = exp || hs.getExpander();
|
417 |
if (hs.upcoming) return false; |
418 |
else hs.last = last;
|
419 |
try {
|
420 |
hs.upcoming = adj; |
421 |
adj.onclick(); |
422 |
} catch (e){
|
423 |
hs.last = hs.upcoming = null;
|
424 |
} |
425 |
try {
|
426 |
if (!adj || exp.transitions[1] != 'crossfade') |
427 |
exp.close(); |
428 |
} catch (e) {}
|
429 |
return false; |
430 |
}, |
431 |
|
432 |
previousOrNext : function (el, op) { |
433 |
var exp = hs.getExpander(el);
|
434 |
if (exp) return hs.transit(exp.getAdjacentAnchor(op), exp); |
435 |
else return false; |
436 |
}, |
437 |
|
438 |
previous : function (el) { |
439 |
return hs.previousOrNext(el, -1); |
440 |
}, |
441 |
|
442 |
next : function (el) { |
443 |
return hs.previousOrNext(el, 1); |
444 |
}, |
445 |
|
446 |
keyHandler : function(e) { |
447 |
if (!e) e = window.event;
|
448 |
if (!e.target) e.target = e.srcElement; // ie |
449 |
if (typeof e.target.form != 'undefined') return true; // form element has focus |
450 |
var exp = hs.getExpander();
|
451 |
|
452 |
var op = null; |
453 |
switch (e.keyCode) {
|
454 |
case 70: // f |
455 |
if (exp) exp.doFullExpand();
|
456 |
return true; |
457 |
case 32: // Space |
458 |
op = 2;
|
459 |
break;
|
460 |
case 34: // Page Down |
461 |
case 39: // Arrow right |
462 |
case 40: // Arrow down |
463 |
op = 1;
|
464 |
break;
|
465 |
case 8: // Backspace |
466 |
case 33: // Page Up |
467 |
case 37: // Arrow left |
468 |
case 38: // Arrow up |
469 |
op = -1;
|
470 |
break;
|
471 |
case 27: // Escape |
472 |
case 13: // Enter |
473 |
op = 0;
|
474 |
} |
475 |
if (op !== null) {if (op != 2)hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); |
476 |
if (!hs.enableKeyListener) return true; |
477 |
|
478 |
if (e.preventDefault) e.preventDefault();
|
479 |
else e.returnValue = false; |
480 |
if (exp) {
|
481 |
if (op == 0) { |
482 |
exp.close(); |
483 |
} else if (op == 2) { |
484 |
if (exp.slideshow) exp.slideshow.hitSpace();
|
485 |
} else {
|
486 |
if (exp.slideshow) exp.slideshow.pause();
|
487 |
hs.previousOrNext(exp.key, op); |
488 |
} |
489 |
return false; |
490 |
} |
491 |
} |
492 |
return true; |
493 |
}, |
494 |
|
495 |
|
496 |
registerOverlay : function (overlay) { |
497 |
hs.push(hs.overlays, hs.extend(overlay, { hsId: 'hsId'+ hs.idCounter++ } )); |
498 |
}, |
499 |
|
500 |
|
501 |
addSlideshow : function (options) { |
502 |
var sg = options.slideshowGroup;
|
503 |
if (typeof sg == 'object') { |
504 |
for (var i = 0; i < sg.length; i++) { |
505 |
var o = {};
|
506 |
for (var x in options) o[x] = options[x]; |
507 |
o.slideshowGroup = sg[i]; |
508 |
hs.push(hs.slideshows, o); |
509 |
} |
510 |
} else {
|
511 |
hs.push(hs.slideshows, options); |
512 |
} |
513 |
}, |
514 |
|
515 |
getWrapperKey : function (element, expOnly) { |
516 |
var el, re = /^highslide-wrapper-([0-9]+)$/; |
517 |
// 1. look in open expanders
|
518 |
el = element; |
519 |
while (el.parentNode) {
|
520 |
if (el.hsKey !== undefined) return el.hsKey; |
521 |
if (el.id && re.test(el.id)) return el.id.replace(re, "$1"); |
522 |
el = el.parentNode; |
523 |
} |
524 |
// 2. look in thumbnail
|
525 |
if (!expOnly) {
|
526 |
el = element; |
527 |
while (el.parentNode) {
|
528 |
if (el.tagName && hs.isHsAnchor(el)) {
|
529 |
for (var key = 0; key < hs.expanders.length; key++) { |
530 |
var exp = hs.expanders[key];
|
531 |
if (exp && exp.a == el) return key; |
532 |
} |
533 |
} |
534 |
el = el.parentNode; |
535 |
} |
536 |
} |
537 |
return null; |
538 |
}, |
539 |
|
540 |
getExpander : function (el, expOnly) { |
541 |
if (typeof el == 'undefined') return hs.expanders[hs.focusKey] || null; |
542 |
if (typeof el == 'number') return hs.expanders[el] || null; |
543 |
if (typeof el == 'string') el = hs.$(el); |
544 |
return hs.expanders[hs.getWrapperKey(el, expOnly)] || null; |
545 |
}, |
546 |
|
547 |
isHsAnchor : function (a) { |
548 |
return (a.onclick && a.onclick.toString().replace(/\s/g, ' ').match(/hs.(htmlE|e)xpand/)); |
549 |
}, |
550 |
|
551 |
reOrder : function () { |
552 |
for (var i = 0; i < hs.expanders.length; i++) |
553 |
if (hs.expanders[i] && hs.expanders[i].isExpanded) hs.focusTopmost();
|
554 |
}, |
555 |
|
556 |
mouseClickHandler : function(e) |
557 |
{ |
558 |
if (!e) e = window.event;
|
559 |
if (e.button > 1) return true; |
560 |
if (!e.target) e.target = e.srcElement;
|
561 |
|
562 |
var el = e.target;
|
563 |
while (el.parentNode
|
564 |
&& !(/highslide-(image|move|html|resize)/.test(el.className)))
|
565 |
{ |
566 |
el = el.parentNode; |
567 |
} |
568 |
var exp = hs.getExpander(el);
|
569 |
if (exp && (exp.isClosing || !exp.isExpanded)) return true; |
570 |
|
571 |
if (exp && e.type == 'mousedown') { |
572 |
if (e.target.form) return true; |
573 |
var match = el.className.match(/highslide-(image|move|resize)/); |
574 |
if (match) {
|
575 |
hs.dragArgs = { |
576 |
exp: exp ,
|
577 |
type: match[1], |
578 |
left: exp.x.pos,
|
579 |
width: exp.x.size,
|
580 |
top: exp.y.pos,
|
581 |
height: exp.y.size,
|
582 |
clickX: e.clientX,
|
583 |
clickY: e.clientY
|
584 |
}; |
585 |
|
586 |
|
587 |
hs.addEventListener(document, 'mousemove', hs.dragHandler);
|
588 |
if (e.preventDefault) e.preventDefault(); // FF |
589 |
|
590 |
if (/highslide-(image|html)-blur/.test(exp.content.className)) { |
591 |
exp.focus(); |
592 |
hs.hasFocused = true;
|
593 |
} |
594 |
return false; |
595 |
} |
596 |
} else if (e.type == 'mouseup') { |
597 |
|
598 |
hs.removeEventListener(document, 'mousemove', hs.dragHandler);
|
599 |
|
600 |
if (hs.dragArgs) {
|
601 |
if (hs.styleRestoreCursor && hs.dragArgs.type == 'image') |
602 |
hs.dragArgs.exp.content.style.cursor = hs.styleRestoreCursor; |
603 |
var hasDragged = hs.dragArgs.hasDragged;
|
604 |
|
605 |
if (!hasDragged &&!hs.hasFocused && !/(move|resize)/.test(hs.dragArgs.type)) { |
606 |
exp.close(); |
607 |
} |
608 |
else if (hasDragged || (!hasDragged && hs.hasHtmlExpanders)) { |
609 |
hs.dragArgs.exp.doShowHide('hidden');
|
610 |
} |
611 |
hs.hasFocused = false;
|
612 |
hs.dragArgs = null;
|
613 |
|
614 |
} else if (/highslide-image-blur/.test(el.className)) { |
615 |
el.style.cursor = hs.styleRestoreCursor; |
616 |
} |
617 |
} |
618 |
return false; |
619 |
}, |
620 |
|
621 |
dragHandler : function(e) |
622 |
{ |
623 |
if (!hs.dragArgs) return true; |
624 |
if (!e) e = window.event;
|
625 |
var a = hs.dragArgs, exp = a.exp;
|
626 |
|
627 |
a.dX = e.clientX - a.clickX; |
628 |
a.dY = e.clientY - a.clickY; |
629 |
|
630 |
var distance = Math.sqrt(Math.pow(a.dX, 2) + Math.pow(a.dY, 2)); |
631 |
if (!a.hasDragged) a.hasDragged = (a.type != 'image' && distance > 0) |
632 |
|| (distance > (hs.dragSensitivity || 5));
|
633 |
|
634 |
if (a.hasDragged && e.clientX > 5 && e.clientY > 5) { |
635 |
|
636 |
if (a.type == 'resize') exp.resize(a); |
637 |
else {
|
638 |
exp.moveTo(a.left + a.dX, a.top + a.dY); |
639 |
if (a.type == 'image') exp.content.style.cursor = 'move'; |
640 |
} |
641 |
} |
642 |
return false; |
643 |
}, |
644 |
|
645 |
wrapperMouseHandler : function (e) { |
646 |
try {
|
647 |
if (!e) e = window.event;
|
648 |
var over = /mouseover/i.test(e.type); |
649 |
if (!e.target) e.target = e.srcElement; // ie |
650 |
if (hs.ie) e.relatedTarget =
|
651 |
over ? e.fromElement : e.toElement; // ie
|
652 |
var exp = hs.getExpander(e.target);
|
653 |
if (!exp.isExpanded) return; |
654 |
if (!exp || !e.relatedTarget || hs.getExpander(e.relatedTarget, true) == exp |
655 |
|| hs.dragArgs) return;
|
656 |
for (var i = 0; i < exp.overlays.length; i++) (function() { |
657 |
var o = hs.$('hsId'+ exp.overlays[i]); |
658 |
if (o && o.hideOnMouseOut) {
|
659 |
if (over) hs.setStyles(o, { visibility: 'visible', display: '' }); |
660 |
hs.animate(o, { opacity: over ? o.opacity : 0 }, o.dur); |
661 |
} |
662 |
})(); |
663 |
} catch (e) {}
|
664 |
}, |
665 |
addEventListener : function (el, event, func) { |
666 |
if (el == document && event == 'ready') hs.push(hs.onReady, func); |
667 |
try {
|
668 |
el.addEventListener(event, func, false);
|
669 |
} catch (e) {
|
670 |
try {
|
671 |
el.detachEvent('on'+ event, func);
|
672 |
el.attachEvent('on'+ event, func);
|
673 |
} catch (e) {
|
674 |
el['on'+ event] = func;
|
675 |
} |
676 |
} |
677 |
}, |
678 |
|
679 |
removeEventListener : function (el, event, func) { |
680 |
try {
|
681 |
el.removeEventListener(event, func, false);
|
682 |
} catch (e) {
|
683 |
try {
|
684 |
el.detachEvent('on'+ event, func);
|
685 |
} catch (e) {
|
686 |
el['on'+ event] = null; |
687 |
} |
688 |
} |
689 |
}, |
690 |
|
691 |
preloadFullImage : function (i) { |
692 |
if (hs.continuePreloading && hs.preloadTheseImages[i] && hs.preloadTheseImages[i] != 'undefined') { |
693 |
var img = document.createElement('img'); |
694 |
img.onload = function() { |
695 |
img = null;
|
696 |
hs.preloadFullImage(i + 1);
|
697 |
}; |
698 |
img.src = hs.preloadTheseImages[i]; |
699 |
} |
700 |
}, |
701 |
preloadImages : function (number) { |
702 |
if (number && typeof number != 'object') hs.numberOfImagesToPreload = number; |
703 |
|
704 |
var arr = hs.getAnchors();
|
705 |
for (var i = 0; i < arr.images.length && i < hs.numberOfImagesToPreload; i++) { |
706 |
hs.push(hs.preloadTheseImages, hs.getSrc(arr.images[i])); |
707 |
} |
708 |
|
709 |
// preload outlines
|
710 |
if (hs.outlineType) new hs.Outline(hs.outlineType, function () { hs.preloadFullImage(0)} ); |
711 |
else
|
712 |
|
713 |
hs.preloadFullImage(0);
|
714 |
|
715 |
// preload cursor
|
716 |
if (hs.restoreCursor) var cur = hs.createElement('img', { src: hs.graphicsDir + hs.restoreCursor }); |
717 |
}, |
718 |
|
719 |
|
720 |
init : function () { |
721 |
if (!hs.container) {
|
722 |
|
723 |
hs.getPageSize(); |
724 |
hs.ieLt7 = hs.ie && hs.uaVersion < 7;
|
725 |
for (var x in hs.langDefaults) { |
726 |
if (typeof hs[x] != 'undefined') hs.lang[x] = hs[x]; |
727 |
else if (typeof hs.lang[x] == 'undefined' && typeof hs.langDefaults[x] != 'undefined') |
728 |
hs.lang[x] = hs.langDefaults[x]; |
729 |
} |
730 |
|
731 |
hs.container = hs.createElement('div', {
|
732 |
className: 'highslide-container' |
733 |
}, { |
734 |
position: 'absolute', |
735 |
left: 0, |
736 |
top: 0, |
737 |
width: '100%', |
738 |
zIndex: hs.zIndexCounter,
|
739 |
direction: 'ltr' |
740 |
}, |
741 |
document.body, |
742 |
true
|
743 |
); |
744 |
hs.loading = hs.createElement('a', {
|
745 |
className: 'highslide-loading', |
746 |
title: hs.lang.loadingTitle,
|
747 |
innerHTML: hs.lang.loadingText,
|
748 |
href: 'javascript:;' |
749 |
}, { |
750 |
position: 'absolute', |
751 |
top: '-9999px', |
752 |
opacity: hs.loadingOpacity,
|
753 |
zIndex: 1 |
754 |
}, hs.container |
755 |
); |
756 |
hs.garbageBin = hs.createElement('div', null, { display: 'none' }, hs.container); |
757 |
hs.viewport = hs.createElement('div', {
|
758 |
className: 'highslide-viewport highslide-viewport-size' |
759 |
}, { |
760 |
visibility: (hs.safari && hs.uaVersion < 525) ? 'visible' : 'hidden' |
761 |
}, hs.container, 1
|
762 |
); |
763 |
|
764 |
// http://www.robertpenner.com/easing/
|
765 |
Math.linearTween = function (t, b, c, d) { |
766 |
return c*t/d + b;
|
767 |
}; |
768 |
Math.easeInQuad = function (t, b, c, d) { |
769 |
return c*(t/=d)*t + b;
|
770 |
}; |
771 |
Math.easeOutQuad = function (t, b, c, d) { |
772 |
return -c *(t/=d)*(t-2) + b; |
773 |
}; |
774 |
|
775 |
hs.hideSelects = hs.ieLt7; |
776 |
hs.hideIframes = ((window.opera && hs.uaVersion < 9) || navigator.vendor == 'KDE' |
777 |
|| (hs.ie && hs.uaVersion < 5.5));
|
778 |
} |
779 |
}, |
780 |
ready : function() { |
781 |
if (hs.isReady) return; |
782 |
hs.isReady = true;
|
783 |
|
784 |
for (var i = 0; i < hs.onReady.length; i++) hs.onReady[i](); |
785 |
}, |
786 |
|
787 |
updateAnchors : function() { |
788 |
var el, els, all = [], images = [],groups = {}, re;
|
789 |
|
790 |
for (var i = 0; i < hs.openerTagNames.length; i++) { |
791 |
els = document.getElementsByTagName(hs.openerTagNames[i]); |
792 |
for (var j = 0; j < els.length; j++) { |
793 |
el = els[j]; |
794 |
re = hs.isHsAnchor(el); |
795 |
if (re) {
|
796 |
hs.push(all, el); |
797 |
if (re[0] == 'hs.expand') hs.push(images, el); |
798 |
var g = hs.getParam(el, 'slideshowGroup') || 'none'; |
799 |
if (!groups[g]) groups[g] = [];
|
800 |
hs.push(groups[g], el); |
801 |
} |
802 |
} |
803 |
} |
804 |
hs.anchors = { all: all, groups: groups, images: images }; |
805 |
return hs.anchors;
|
806 |
|
807 |
}, |
808 |
|
809 |
getAnchors : function() { |
810 |
return hs.anchors || hs.updateAnchors();
|
811 |
}, |
812 |
|
813 |
|
814 |
close : function(el) { |
815 |
var exp = hs.getExpander(el);
|
816 |
if (exp) exp.close();
|
817 |
return false; |
818 |
} |
819 |
}; // end hs object
|
820 |
hs.fx = function( elem, options, prop ){ |
821 |
this.options = options;
|
822 |
this.elem = elem;
|
823 |
this.prop = prop;
|
824 |
|
825 |
if (!options.orig) options.orig = {};
|
826 |
}; |
827 |
hs.fx.prototype = { |
828 |
update: function(){ |
829 |
(hs.fx.step[this.prop] || hs.fx.step._default)(this); |
830 |
|
831 |
if (this.options.step) |
832 |
this.options.step.call(this.elem, this.now, this); |
833 |
|
834 |
}, |
835 |
custom: function(from, to, unit){ |
836 |
this.startTime = (new Date()).getTime(); |
837 |
this.start = from;
|
838 |
this.end = to;
|
839 |
this.unit = unit;// || this.unit || "px"; |
840 |
this.now = this.start; |
841 |
this.pos = this.state = 0; |
842 |
|
843 |
var self = this; |
844 |
function t(gotoEnd){ |
845 |
return self.step(gotoEnd);
|
846 |
} |
847 |
|
848 |
t.elem = this.elem;
|
849 |
|
850 |
if ( t() && hs.timers.push(t) == 1 ) { |
851 |
hs.timerId = setInterval(function(){
|
852 |
var timers = hs.timers;
|
853 |
|
854 |
for ( var i = 0; i < timers.length; i++ ) |
855 |
if ( !timers[i]() )
|
856 |
timers.splice(i--, 1);
|
857 |
|
858 |
if ( !timers.length ) {
|
859 |
clearInterval(hs.timerId); |
860 |
} |
861 |
}, 13);
|
862 |
} |
863 |
}, |
864 |
step: function(gotoEnd){ |
865 |
var t = (new Date()).getTime(); |
866 |
if ( gotoEnd || t >= this.options.duration + this.startTime ) { |
867 |
this.now = this.end; |
868 |
this.pos = this.state = 1; |
869 |
this.update();
|
870 |
|
871 |
this.options.curAnim[ this.prop ] = true; |
872 |
|
873 |
var done = true; |
874 |
for ( var i in this.options.curAnim ) |
875 |
if ( this.options.curAnim[i] !== true ) |
876 |
done = false;
|
877 |
|
878 |
if ( done ) {
|
879 |
if (this.options.complete) this.options.complete.call(this.elem); |
880 |
} |
881 |
return false; |
882 |
} else {
|
883 |
var n = t - this.startTime; |
884 |
this.state = n / this.options.duration; |
885 |
this.pos = this.options.easing(n, 0, 1, this.options.duration); |
886 |
this.now = this.start + ((this.end - this.start) * this.pos); |
887 |
this.update();
|
888 |
} |
889 |
return true; |
890 |
} |
891 |
|
892 |
}; |
893 |
|
894 |
hs.extend( hs.fx, { |
895 |
step: {
|
896 |
|
897 |
opacity: function(fx){ |
898 |
hs.setStyles(fx.elem, { opacity: fx.now });
|
899 |
}, |
900 |
|
901 |
_default: function(fx){ |
902 |
try {
|
903 |
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) |
904 |
fx.elem.style[ fx.prop ] = fx.now + fx.unit; |
905 |
else
|
906 |
fx.elem[ fx.prop ] = fx.now; |
907 |
} catch (e) {}
|
908 |
} |
909 |
} |
910 |
}); |
911 |
|
912 |
hs.Outline = function (outlineType, onLoad) { |
913 |
this.onLoad = onLoad;
|
914 |
this.outlineType = outlineType;
|
915 |
var v = hs.uaVersion, tr;
|
916 |
|
917 |
this.hasAlphaImageLoader = hs.ie && v >= 5.5 && v < 7; |
918 |
if (!outlineType) {
|
919 |
if (onLoad) onLoad();
|
920 |
return;
|
921 |
} |
922 |
|
923 |
hs.init(); |
924 |
this.table = hs.createElement(
|
925 |
'table', {
|
926 |
cellSpacing: 0 |
927 |
}, { |
928 |
visibility: 'hidden', |
929 |
position: 'absolute', |
930 |
borderCollapse: 'collapse', |
931 |
width: 0 |
932 |
}, |
933 |
hs.container, |
934 |
true
|
935 |
); |
936 |
var tbody = hs.createElement('tbody', null, null, this.table, 1); |
937 |
|
938 |
this.td = [];
|
939 |
for (var i = 0; i <= 8; i++) { |
940 |
if (i % 3 == 0) tr = hs.createElement('tr', null, { height: 'auto' }, tbody, true); |
941 |
this.td[i] = hs.createElement('td', null, null, tr, true); |
942 |
var style = i != 4 ? { lineHeight: 0, fontSize: 0} : { position : 'relative' }; |
943 |
hs.setStyles(this.td[i], style);
|
944 |
} |
945 |
this.td[4].className = outlineType +' highslide-outline'; |
946 |
|
947 |
this.preloadGraphic();
|
948 |
}; |
949 |
|
950 |
hs.Outline.prototype = { |
951 |
preloadGraphic : function () { |
952 |
var src = hs.graphicsDir + (hs.outlinesDir || "outlines/")+ this.outlineType +".png"; |
953 |
|
954 |
var appendTo = hs.safari ? hs.container : null; |
955 |
this.graphic = hs.createElement('img', null, { position: 'absolute', |
956 |
top: '-9999px' }, appendTo, true); // for onload trigger |
957 |
|
958 |
var pThis = this; |
959 |
this.graphic.onload = function() { pThis.onGraphicLoad(); }; |
960 |
|
961 |
this.graphic.src = src;
|
962 |
}, |
963 |
|
964 |
onGraphicLoad : function () { |
965 |
var o = this.offset = this.graphic.width / 4, |
966 |
pos = [[0,0],[0,-4],[-2,0],[0,-8],0,[-2,-8],[0,-2],[0,-6],[-2,-2]], |
967 |
dim = { height: (2*o) +'px', width: (2*o) +'px' }; |
968 |
for (var i = 0; i <= 8; i++) { |
969 |
if (pos[i]) {
|
970 |
if (this.hasAlphaImageLoader) { |
971 |
var w = (i == 1 || i == 7) ? '100%' : this.graphic.width +'px'; |
972 |
var div = hs.createElement('div', null, { width: '100%', height: '100%', position: 'relative', overflow: 'hidden'}, this.td[i], true); |
973 |
hs.createElement ('div', null, { |
974 |
filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='"+ this.graphic.src + "')", |
975 |
position: 'absolute', |
976 |
width: w,
|
977 |
height: this.graphic.height +'px', |
978 |
left: (pos[i][0]*o)+'px', |
979 |
top: (pos[i][1]*o)+'px' |
980 |
}, |
981 |
div, |
982 |
true);
|
983 |
} else {
|
984 |
hs.setStyles(this.td[i], { background: 'url('+ this.graphic.src +') '+ (pos[i][0]*o)+'px '+(pos[i][1]*o)+'px'}); |
985 |
} |
986 |
|
987 |
if (window.opera && (i == 3 || i ==5)) |
988 |
hs.createElement('div', null, dim, this.td[i], true); |
989 |
|
990 |
hs.setStyles (this.td[i], dim);
|
991 |
} |
992 |
} |
993 |
this.graphic = null; |
994 |
if (hs.pendingOutlines[this.outlineType]) hs.pendingOutlines[this.outlineType].destroy(); |
995 |
hs.pendingOutlines[this.outlineType] = this; |
996 |
if (this.onLoad) this.onLoad(); |
997 |
}, |
998 |
|
999 |
setPosition : function (pos, offset, vis, dur, easing) { |
1000 |
var exp = this.exp, |
1001 |
stl = exp.wrapper.style, |
1002 |
offset = offset || 0,
|
1003 |
pos = pos || { |
1004 |
x: exp.x.pos + offset,
|
1005 |
y: exp.y.pos + offset,
|
1006 |
w: exp.x.get('wsize') - 2 * offset, |
1007 |
h: exp.y.get('wsize') - 2 * offset |
1008 |
}; |
1009 |
if (vis) this.table.style.visibility = (pos.h >= 4 * this.offset) |
1010 |
? 'visible' : 'hidden'; |
1011 |
hs.setStyles(this.table, {
|
1012 |
left: (pos.x - this.offset) +'px', |
1013 |
top: (pos.y - this.offset) +'px', |
1014 |
width: (pos.w + 2 * this.offset) +'px' |
1015 |
}); |
1016 |
|
1017 |
pos.w -= 2 * this.offset; |
1018 |
pos.h -= 2 * this.offset; |
1019 |
hs.setStyles (this.td[4], { |
1020 |
width: pos.w >= 0 ? pos.w +'px' : 0, |
1021 |
height: pos.h >= 0 ? pos.h +'px' : 0 |
1022 |
}); |
1023 |
if (this.hasAlphaImageLoader) this.td[3].style.height |
1024 |
= this.td[5].style.height = this.td[4].style.height; |
1025 |
|
1026 |
}, |
1027 |
|
1028 |
destroy : function(hide) { |
1029 |
if (hide) this.table.style.visibility = 'hidden'; |
1030 |
else hs.discardElement(this.table); |
1031 |
} |
1032 |
}; |
1033 |
|
1034 |
hs.Dimension = function(exp, dim) { |
1035 |
this.exp = exp;
|
1036 |
this.dim = dim;
|
1037 |
this.ucwh = dim == 'x' ? 'Width' : 'Height'; |
1038 |
this.wh = this.ucwh.toLowerCase(); |
1039 |
this.uclt = dim == 'x' ? 'Left' : 'Top'; |
1040 |
this.lt = this.uclt.toLowerCase(); |
1041 |
this.ucrb = dim == 'x' ? 'Right' : 'Bottom'; |
1042 |
this.rb = this.ucrb.toLowerCase(); |
1043 |
this.p1 = this.p2 = 0; |
1044 |
}; |
1045 |
hs.Dimension.prototype = { |
1046 |
get : function(key) { |
1047 |
switch (key) {
|
1048 |
case 'loadingPos': |
1049 |
return this.tpos + this.tb + (this.t - hs.loading['offset'+ this.ucwh]) / 2; |
1050 |
case 'loadingPosXfade': |
1051 |
return this.pos + this.cb+ this.p1 + (this.size - hs.loading['offset'+ this.ucwh]) / 2; |
1052 |
case 'wsize': |
1053 |
return this.size + 2 * this.cb + this.p1 + this.p2; |
1054 |
case 'fitsize': |
1055 |
return this.clientSize - this.marginMin - this.marginMax; |
1056 |
case 'maxsize': |
1057 |
return this.get('fitsize') - 2 * this.cb - this.p1 - this.p2 ; |
1058 |
case 'opos': |
1059 |
return this.pos - (this.exp.outline ? this.exp.outline.offset : 0); |
1060 |
case 'osize': |
1061 |
return this.get('wsize') + (this.exp.outline ? 2*this.exp.outline.offset : 0); |
1062 |
case 'imgPad': |
1063 |
return this.imgSize ? Math.round((this.size - this.imgSize) / 2) : 0; |
1064 |
|
1065 |
} |
1066 |
}, |
1067 |
calcBorders: function() { |
1068 |
// correct for borders
|
1069 |
this.cb = (this.exp.content['offset'+ this.ucwh] - this.t) / 2; |
1070 |
|
1071 |
this.marginMax = hs['margin'+ this.ucrb]; |
1072 |
}, |
1073 |
calcThumb: function() { |
1074 |
this.t = this.exp.el[this.wh] ? parseInt(this.exp.el[this.wh]) : |
1075 |
this.exp.el['offset'+ this.ucwh]; |
1076 |
this.tpos = this.exp.tpos[this.dim]; |
1077 |
this.tb = (this.exp.el['offset'+ this.ucwh] - this.t) / 2; |
1078 |
if (this.tpos == 0 || this.tpos == -1) { |
1079 |
this.tpos = (hs.page[this.wh] / 2) + hs.page['scroll'+ this.uclt]; |
1080 |
}; |
1081 |
}, |
1082 |
calcExpanded: function() { |
1083 |
var exp = this.exp; |
1084 |
this.justify = 'auto'; |
1085 |
|
1086 |
// get alignment
|
1087 |
if (exp.align == 'center') this.justify = 'center'; |
1088 |
else if (new RegExp(this.lt).test(exp.anchor)) this.justify = null; |
1089 |
else if (new RegExp(this.rb).test(exp.anchor)) this.justify = 'max'; |
1090 |
|
1091 |
|
1092 |
// size and position
|
1093 |
this.pos = this.tpos - this.cb + this.tb; |
1094 |
|
1095 |
if (this.maxHeight && this.dim == 'x') |
1096 |
exp.maxWidth = Math.min(exp.maxWidth || this.full, exp.maxHeight * this.full / exp.y.full); |
1097 |
|
1098 |
this.size = Math.min(this.full, exp['max'+ this.ucwh] || this.full); |
1099 |
this.minSize = exp.allowSizeReduction ?
|
1100 |
Math.min(exp['min'+ this.ucwh], this.full) :this.full; |
1101 |
if (exp.isImage && exp.useBox) {
|
1102 |
this.size = exp[this.wh]; |
1103 |
this.imgSize = this.full; |
1104 |
} |
1105 |
if (this.dim == 'x' && hs.padToMinWidth) this.minSize = exp.minWidth; |
1106 |
this.target = exp['target'+ this.dim.toUpperCase()]; |
1107 |
this.marginMin = hs['margin'+ this.uclt]; |
1108 |
this.scroll = hs.page['scroll'+ this.uclt]; |
1109 |
this.clientSize = hs.page[this.wh]; |
1110 |
}, |
1111 |
setSize: function(i) { |
1112 |
var exp = this.exp; |
1113 |
if (exp.isImage && (exp.useBox || hs.padToMinWidth)) {
|
1114 |
this.imgSize = i;
|
1115 |
this.size = Math.max(this.size, this.imgSize); |
1116 |
exp.content.style[this.lt] = this.get('imgPad')+'px'; |
1117 |
} else
|
1118 |
this.size = i;
|
1119 |
|
1120 |
exp.content.style[this.wh] = i +'px'; |
1121 |
exp.wrapper.style[this.wh] = this.get('wsize') +'px'; |
1122 |
if (exp.outline) exp.outline.setPosition();
|
1123 |
if (this.dim == 'x' && exp.overlayBox) exp.sizeOverlayBox(true); |
1124 |
if (this.dim == 'x' && exp.slideshow && exp.isImage) { |
1125 |
if (i == this.full) exp.slideshow.disable('full-expand'); |
1126 |
else exp.slideshow.enable('full-expand'); |
1127 |
} |
1128 |
}, |
1129 |
setPos: function(i) { |
1130 |
this.pos = i;
|
1131 |
this.exp.wrapper.style[this.lt] = i +'px'; |
1132 |
|
1133 |
if (this.exp.outline) this.exp.outline.setPosition(); |
1134 |
|
1135 |
} |
1136 |
}; |
1137 |
|
1138 |
hs.Expander = function(a, params, custom, contentType) { |
1139 |
if (document.readyState && hs.ie && !hs.isReady) {
|
1140 |
hs.addEventListener(document, 'ready', function() { |
1141 |
new hs.Expander(a, params, custom, contentType);
|
1142 |
}); |
1143 |
return;
|
1144 |
} |
1145 |
this.a = a;
|
1146 |
this.custom = custom;
|
1147 |
this.contentType = contentType || 'image'; |
1148 |
this.isImage = !this.isHtml; |
1149 |
|
1150 |
hs.continuePreloading = false;
|
1151 |
this.overlays = [];
|
1152 |
this.last = hs.last;
|
1153 |
hs.last = null;
|
1154 |
hs.init(); |
1155 |
var key = this.key = hs.expanders.length; |
1156 |
// override inline parameters
|
1157 |
for (var i = 0; i < hs.overrides.length; i++) { |
1158 |
var name = hs.overrides[i];
|
1159 |
this[name] = params && typeof params[name] != 'undefined' ? |
1160 |
params[name] : hs[name]; |
1161 |
} |
1162 |
if (!this.src) this.src = a.href; |
1163 |
|
1164 |
// get thumb
|
1165 |
var el = (params && params.thumbnailId) ? hs.$(params.thumbnailId) : a; |
1166 |
el = this.thumb = el.getElementsByTagName('img')[0] || el; |
1167 |
this.thumbsUserSetId = el.id || a.id;
|
1168 |
|
1169 |
// check if already open
|
1170 |
for (var i = 0; i < hs.expanders.length; i++) { |
1171 |
if (hs.expanders[i] && hs.expanders[i].a == a
|
1172 |
&& !(this.last && this.transitions[1] == 'crossfade')) { |
1173 |
hs.expanders[i].focus(); |
1174 |
return false; |
1175 |
} |
1176 |
} |
1177 |
|
1178 |
// cancel other
|
1179 |
if (!hs.allowSimultaneousLoading) for (var i = 0; i < hs.expanders.length; i++) { |
1180 |
if (hs.expanders[i] && hs.expanders[i].thumb != el && !hs.expanders[i].onLoadStarted) {
|
1181 |
hs.expanders[i].cancelLoading(); |
1182 |
} |
1183 |
} |
1184 |
hs.expanders[key] = this;
|
1185 |
if (!hs.allowMultipleInstances && !hs.upcoming) {
|
1186 |
if (hs.expanders[key-1]) hs.expanders[key-1].close(); |
1187 |
if (typeof hs.focusKey != 'undefined' && hs.expanders[hs.focusKey]) |
1188 |
hs.expanders[hs.focusKey].close(); |
1189 |
} |
1190 |
|
1191 |
// initiate metrics
|
1192 |
this.el = el;
|
1193 |
this.tpos = hs.getPosition(el);
|
1194 |
hs.getPageSize(); |
1195 |
var x = this.x = new hs.Dimension(this, 'x'); |
1196 |
x.calcThumb(); |
1197 |
var y = this.y = new hs.Dimension(this, 'y'); |
1198 |
y.calcThumb(); |
1199 |
this.wrapper = hs.createElement(
|
1200 |
'div', {
|
1201 |
id: 'highslide-wrapper-'+ this.key, |
1202 |
className: 'highslide-wrapper '+ this.wrapperClassName |
1203 |
}, { |
1204 |
visibility: 'hidden', |
1205 |
position: 'absolute', |
1206 |
zIndex: hs.zIndexCounter += 2 |
1207 |
}, null, true ); |
1208 |
|
1209 |
this.wrapper.onmouseover = this.wrapper.onmouseout = hs.wrapperMouseHandler; |
1210 |
if (this.contentType == 'image' && this.outlineWhileAnimating == 2) |
1211 |
this.outlineWhileAnimating = 0; |
1212 |
|
1213 |
// get the outline
|
1214 |
if (!this.outlineType |
1215 |
|| (this.last && this.isImage && this.transitions[1] == 'crossfade')) { |
1216 |
this[this.contentType +'Create'](); |
1217 |
|
1218 |
} else if (hs.pendingOutlines[this.outlineType]) { |
1219 |
this.connectOutline();
|
1220 |
this[this.contentType +'Create'](); |
1221 |
|
1222 |
} else {
|
1223 |
this.showLoading();
|
1224 |
var exp = this; |
1225 |
new hs.Outline(this.outlineType, |
1226 |
function () {
|
1227 |
exp.connectOutline(); |
1228 |
exp[exp.contentType +'Create']();
|
1229 |
} |
1230 |
); |
1231 |
} |
1232 |
return true; |
1233 |
}; |
1234 |
|
1235 |
hs.Expander.prototype = { |
1236 |
error : function(e) { |
1237 |
// alert ('Line '+ e.lineNumber +': '+ e.message);
|
1238 |
window.location.href = this.src;
|
1239 |
}, |
1240 |
|
1241 |
connectOutline : function() { |
1242 |
var outline = this.outline = hs.pendingOutlines[this.outlineType]; |
1243 |
outline.exp = this;
|
1244 |
outline.table.style.zIndex = this.wrapper.style.zIndex - 1; |
1245 |
hs.pendingOutlines[this.outlineType] = null; |
1246 |
}, |
1247 |
|
1248 |
showLoading : function() { |
1249 |
if (this.onLoadStarted || this.loading) return; |
1250 |
|
1251 |
this.loading = hs.loading;
|
1252 |
var exp = this; |
1253 |
this.loading.onclick = function() { |
1254 |
exp.cancelLoading(); |
1255 |
}; |
1256 |
var exp = this, |
1257 |
l = this.x.get('loadingPos') +'px', |
1258 |
t = this.y.get('loadingPos') +'px'; |
1259 |
if (!tgt && this.last && this.transitions[1] == 'crossfade') |
1260 |
var tgt = this.last; |
1261 |
if (tgt) {
|
1262 |
l = tgt.x.get('loadingPosXfade') +'px'; |
1263 |
t = tgt.y.get('loadingPosXfade') +'px'; |
1264 |
this.loading.style.zIndex = hs.zIndexCounter++;
|
1265 |
} |
1266 |
setTimeout(function () {
|
1267 |
if (exp.loading) hs.setStyles(exp.loading, { left: l, top: t, zIndex: hs.zIndexCounter++ })} |
1268 |
, 100);
|
1269 |
}, |
1270 |
|
1271 |
imageCreate : function() { |
1272 |
var exp = this; |
1273 |
|
1274 |
var img = document.createElement('img'); |
1275 |
this.content = img;
|
1276 |
img.onload = function () { |
1277 |
if (hs.expanders[exp.key]) exp.contentLoaded();
|
1278 |
}; |
1279 |
if (hs.blockRightClick) img.oncontextmenu = function() { return false; }; |
1280 |
img.className = 'highslide-image';
|
1281 |
hs.setStyles(img, { |
1282 |
visibility: 'hidden', |
1283 |
display: 'block', |
1284 |
position: 'absolute', |
1285 |
maxWidth: '9999px', |
1286 |
zIndex: 3 |
1287 |
}); |
1288 |
img.title = hs.lang.restoreTitle; |
1289 |
if (hs.safari) hs.container.appendChild(img);
|
1290 |
if (hs.ie && hs.flushImgSize) img.src = null; |
1291 |
img.src = this.src;
|
1292 |
|
1293 |
this.showLoading();
|
1294 |
}, |
1295 |
|
1296 |
contentLoaded : function() { |
1297 |
try {
|
1298 |
if (!this.content) return; |
1299 |
this.content.onload = null; |
1300 |
if (this.onLoadStarted) return; |
1301 |
else this.onLoadStarted = true; |
1302 |
|
1303 |
var x = this.x, y = this.y; |
1304 |
|
1305 |
if (this.loading) { |
1306 |
hs.setStyles(this.loading, { top: '-9999px' }); |
1307 |
this.loading = null; |
1308 |
} |
1309 |
x.full = this.content.width;
|
1310 |
y.full = this.content.height;
|
1311 |
|
1312 |
hs.setStyles(this.content, {
|
1313 |
width: x.t +'px', |
1314 |
height: y.t +'px' |
1315 |
}); |
1316 |
this.wrapper.appendChild(this.content); |
1317 |
hs.container.appendChild(this.wrapper);
|
1318 |
|
1319 |
x.calcBorders(); |
1320 |
y.calcBorders(); |
1321 |
|
1322 |
hs.setStyles (this.wrapper, {
|
1323 |
left: (x.tpos + x.tb - x.cb) +'px', |
1324 |
top: (y.tpos + x.tb - y.cb) +'px' |
1325 |
}); |
1326 |
|
1327 |
|
1328 |
this.initSlideshow();
|
1329 |
this.getOverlays();
|
1330 |
|
1331 |
var ratio = x.full / y.full;
|
1332 |
x.calcExpanded(); |
1333 |
this.justify(x);
|
1334 |
|
1335 |
y.calcExpanded(); |
1336 |
this.justify(y);
|
1337 |
if (this.overlayBox) this.sizeOverlayBox(0, 1); |
1338 |
|
1339 |
|
1340 |
if (this.allowSizeReduction) { |
1341 |
this.correctRatio(ratio);
|
1342 |
var ss = this.slideshow; |
1343 |
if (ss && this.last && ss.controls && ss.fixedControls) { |
1344 |
var pos = ss.overlayOptions.position || '', p; |
1345 |
for (var dim in hs.oPos) for (var i = 0; i < 5; i++) { |
1346 |
p = this[dim];
|
1347 |
if (pos.match(hs.oPos[dim][i])) {
|
1348 |
p.pos = this.last[dim].pos
|
1349 |
+ (this.last[dim].p1 - p.p1)
|
1350 |
+ (this.last[dim].size - p.size) * [0, 0, .5, 1, 1][i]; |
1351 |
if (ss.fixedControls == 'fit') { |
1352 |
if (p.pos + p.size + p.p1 + p.p2 > p.scroll + p.clientSize - p.marginMax)
|
1353 |
p.pos = p.scroll + p.clientSize - p.size - p.marginMin - p.marginMax - p.p1 - p.p2; |
1354 |
if (p.pos < p.scroll + p.marginMin) p.pos = p.scroll + p.marginMin;
|
1355 |
} |
1356 |
} |
1357 |
} |
1358 |
} |
1359 |
if (this.isImage && this.x.full > (this.x.imgSize || this.x.size)) { |
1360 |
this.createFullExpand();
|
1361 |
if (this.overlays.length == 1) this.sizeOverlayBox(); |
1362 |
} |
1363 |
} |
1364 |
this.show();
|
1365 |
|
1366 |
} catch (e) {
|
1367 |
this.error(e);
|
1368 |
} |
1369 |
}, |
1370 |
|
1371 |
justify : function (p, moveOnly) { |
1372 |
var tgtArr, tgt = p.target, dim = p == this.x ? 'x' : 'y'; |
1373 |
|
1374 |
if (tgt && tgt.match(/ /)) { |
1375 |
tgtArr = tgt.split(' ');
|
1376 |
tgt = tgtArr[0];
|
1377 |
} |
1378 |
if (tgt && hs.$(tgt)) { |
1379 |
p.pos = hs.getPosition(hs.$(tgt))[dim];
|
1380 |
if (tgtArr && tgtArr[1] && tgtArr[1].match(/^[-]?[0-9]+px$/)) |
1381 |
p.pos += parseInt(tgtArr[1]);
|
1382 |
if (p.size < p.minSize) p.size = p.minSize;
|
1383 |
|
1384 |
} else if (p.justify == 'auto' || p.justify == 'center') { |
1385 |
|
1386 |
var hasMovedMin = false; |
1387 |
|
1388 |
var allowReduce = p.exp.allowSizeReduction;
|
1389 |
if (p.justify == 'center') |
1390 |
p.pos = Math.round(p.scroll + (p.clientSize + p.marginMin - p.marginMax - p.get('wsize')) / 2); |
1391 |
else
|
1392 |
p.pos = Math.round(p.pos - ((p.get('wsize') - p.t) / 2)); |
1393 |
if (p.pos < p.scroll + p.marginMin) {
|
1394 |
p.pos = p.scroll + p.marginMin; |
1395 |
hasMovedMin = true;
|
1396 |
} |
1397 |
if (!moveOnly && p.size < p.minSize) {
|
1398 |
p.size = p.minSize; |
1399 |
allowReduce = false;
|
1400 |
} |
1401 |
if (p.pos + p.get('wsize') > p.scroll + p.clientSize - p.marginMax) { |
1402 |
if (!moveOnly && hasMovedMin && allowReduce) {
|
1403 |
p.size = Math.min(p.size, p.get(dim == 'y' ? 'fitsize' : 'maxsize')); |
1404 |
} else if (p.get('wsize') < p.get('fitsize')) { |
1405 |
p.pos = p.scroll + p.clientSize - p.marginMax - p.get('wsize');
|
1406 |
} else { // image larger than viewport |
1407 |
p.pos = p.scroll + p.marginMin; |
1408 |
if (!moveOnly && allowReduce) p.size = p.get(dim == 'y' ? 'fitsize' : 'maxsize'); |
1409 |
} |
1410 |
} |
1411 |
|
1412 |
if (!moveOnly && p.size < p.minSize) {
|
1413 |
p.size = p.minSize; |
1414 |
allowReduce = false;
|
1415 |
} |
1416 |
|
1417 |
|
1418 |
} else if (p.justify == 'max') { |
1419 |
p.pos = Math.floor(p.pos - p.size + p.t); |
1420 |
} |
1421 |
|
1422 |
|
1423 |
if (p.pos < p.marginMin) {
|
1424 |
var tmpMin = p.pos;
|
1425 |
p.pos = p.marginMin; |
1426 |
|
1427 |
if (allowReduce && !moveOnly) p.size = p.size - (p.pos - tmpMin);
|
1428 |
|
1429 |
} |
1430 |
}, |
1431 |
|
1432 |
correctRatio : function(ratio) { |
1433 |
var x = this.x, |
1434 |
y = this.y,
|
1435 |
changed = false,
|
1436 |
xSize = Math.min(x.full, x.size), |
1437 |
ySize = Math.min(y.full, y.size), |
1438 |
useBox = (this.useBox || hs.padToMinWidth);
|
1439 |
|
1440 |
if (xSize / ySize > ratio) { // width greater |
1441 |
xSize = ySize * ratio; |
1442 |
if (xSize < x.minSize) { // below minWidth |
1443 |
xSize = x.minSize; |
1444 |
ySize = xSize / ratio; |
1445 |
} |
1446 |
changed = true;
|
1447 |
|
1448 |
} else if (xSize / ySize < ratio) { // height greater |
1449 |
ySize = xSize / ratio; |
1450 |
changed = true;
|
1451 |
} |
1452 |
|
1453 |
if (hs.padToMinWidth && x.full < x.minSize) {
|
1454 |
x.imgSize = x.full; |
1455 |
y.size = y.imgSize = y.full; |
1456 |
} else if (this.useBox) { |
1457 |
x.imgSize = xSize; |
1458 |
y.imgSize = ySize; |
1459 |
} else {
|
1460 |
x.size = xSize; |
1461 |
y.size = ySize; |
1462 |
} |
1463 |
changed = this.fitOverlayBox(useBox ? null : ratio, changed); |
1464 |
if (useBox && y.size < y.imgSize) {
|
1465 |
y.imgSize = y.size; |
1466 |
x.imgSize = y.size * ratio; |
1467 |
} |
1468 |
if (changed || useBox) {
|
1469 |
x.pos = x.tpos - x.cb + x.tb; |
1470 |
x.minSize = x.size; |
1471 |
this.justify(x, true); |
1472 |
|
1473 |
y.pos = y.tpos - y.cb + y.tb; |
1474 |
y.minSize = y.size; |
1475 |
this.justify(y, true); |
1476 |
if (this.overlayBox) this.sizeOverlayBox(); |
1477 |
} |
1478 |
}, |
1479 |
fitOverlayBox : function(ratio, changed) { |
1480 |
var x = this.x, y = this.y; |
1481 |
if (this.overlayBox) { |
1482 |
while (y.size > this.minHeight && x.size > this.minWidth |
1483 |
&& y.get('wsize') > y.get('fitsize')) { |
1484 |
y.size -= 10;
|
1485 |
if (ratio) x.size = y.size * ratio;
|
1486 |
this.sizeOverlayBox(0, 1); |
1487 |
changed = true;
|
1488 |
} |
1489 |
} |
1490 |
return changed;
|
1491 |
}, |
1492 |
|
1493 |
show : function () { |
1494 |
var x = this.x, y = this.y; |
1495 |
this.doShowHide('hidden'); |
1496 |
if (this.slideshow && this.slideshow.thumbstrip) this.slideshow.thumbstrip.selectThumb(); |
1497 |
|
1498 |
// Apply size change
|
1499 |
this.changeSize(
|
1500 |
1, {
|
1501 |
wrapper: {
|
1502 |
width : x.get('wsize'), |
1503 |
height : y.get('wsize'), |
1504 |
left: x.pos,
|
1505 |
top: y.pos
|
1506 |
}, |
1507 |
content: {
|
1508 |
left: x.p1 + x.get('imgPad'), |
1509 |
top: y.p1 + y.get('imgPad'), |
1510 |
width:x.imgSize ||x.size,
|
1511 |
height:y.imgSize ||y.size
|
1512 |
} |
1513 |
}, |
1514 |
hs.expandDuration |
1515 |
); |
1516 |
}, |
1517 |
|
1518 |
changeSize : function(up, to, dur) { |
1519 |
// transition
|
1520 |
var trans = this.transitions, |
1521 |
other = up ? (this.last ? this.last.a : null) : hs.upcoming, |
1522 |
t = (trans[1] && other
|
1523 |
&& hs.getParam(other, 'transitions')[1] == trans[1]) ? |
1524 |
trans[1] : trans[0]; |
1525 |
|
1526 |
if (this[t] && t != 'expand') { |
1527 |
this[t](up, to);
|
1528 |
return;
|
1529 |
} |
1530 |
|
1531 |
if (this.outline && !this.outlineWhileAnimating) { |
1532 |
if (up) this.outline.setPosition(); |
1533 |
else this.outline.destroy(); |
1534 |
} |
1535 |
|
1536 |
|
1537 |
if (!up) this.destroyOverlays(); |
1538 |
|
1539 |
var exp = this, |
1540 |
x = exp.x, |
1541 |
y = exp.y, |
1542 |
easing = this.easing;
|
1543 |
if (!up) easing = this.easingClose || easing; |
1544 |
var after = up ?
|
1545 |
function() {
|
1546 |
|
1547 |
if (exp.outline) exp.outline.table.style.visibility = "visible"; |
1548 |
setTimeout(function() {
|
1549 |
exp.afterExpand(); |
1550 |
}, 50);
|
1551 |
} : |
1552 |
function() {
|
1553 |
exp.afterClose(); |
1554 |
}; |
1555 |
if (up) hs.setStyles( this.wrapper, { |
1556 |
width: x.t +'px', |
1557 |
height: y.t +'px' |
1558 |
}); |
1559 |
if (this.fadeInOut) { |
1560 |
hs.setStyles(this.wrapper, { opacity: up ? 0 : 1 }); |
1561 |
hs.extend(to.wrapper, { opacity: up });
|
1562 |
} |
1563 |
hs.animate( this.wrapper, to.wrapper, {
|
1564 |
duration: dur,
|
1565 |
easing: easing,
|
1566 |
step: function(val, args) { |
1567 |
if (exp.outline && exp.outlineWhileAnimating && args.prop == 'top') { |
1568 |
var fac = up ? args.pos : 1 - args.pos; |
1569 |
var pos = {
|
1570 |
w: x.t + (x.get('wsize') - x.t) * fac, |
1571 |
h: y.t + (y.get('wsize') - y.t) * fac, |
1572 |
x: x.tpos + (x.pos - x.tpos) * fac,
|
1573 |
y: y.tpos + (y.pos - y.tpos) * fac
|
1574 |
}; |
1575 |
exp.outline.setPosition(pos, 0, 1); |
1576 |
} |
1577 |
} |
1578 |
}); |
1579 |
hs.animate( this.content, to.content, dur, easing, after);
|
1580 |
if (up) {
|
1581 |
this.wrapper.style.visibility = 'visible'; |
1582 |
this.content.style.visibility = 'visible'; |
1583 |
this.a.className += ' highslide-active-anchor'; |
1584 |
} |
1585 |
}, |
1586 |
|
1587 |
|
1588 |
|
1589 |
fade : function(up, to) { |
1590 |
this.outlineWhileAnimating = false; |
1591 |
var exp = this, t = up ? hs.expandDuration : 0; |
1592 |
|
1593 |
if (up) {
|
1594 |
hs.animate(this.wrapper, to.wrapper, 0); |
1595 |
hs.setStyles(this.wrapper, { opacity: 0, visibility: 'visible' }); |
1596 |
hs.animate(this.content, to.content, 0); |
1597 |
this.content.style.visibility = 'visible'; |
1598 |
|
1599 |
hs.animate(this.wrapper, { opacity: 1 }, t, null, |
1600 |
function() { exp.afterExpand(); });
|
1601 |
} |
1602 |
|
1603 |
if (this.outline) { |
1604 |
this.outline.table.style.zIndex = this.wrapper.style.zIndex; |
1605 |
var dir = up || -1, |
1606 |
offset = this.outline.offset,
|
1607 |
startOff = up ? 3 : offset,
|
1608 |
endOff = up? offset : 3;
|
1609 |
for (var i = startOff; dir * i <= dir * endOff; i += dir, t += 25) { |
1610 |
(function() {
|
1611 |
var o = up ? endOff - i : startOff - i;
|
1612 |
setTimeout(function() {
|
1613 |
exp.outline.setPosition(0, o, 1); |
1614 |
}, t); |
1615 |
})(); |
1616 |
} |
1617 |
} |
1618 |
|
1619 |
|
1620 |
if (up) {}//setTimeout(function() { exp.afterExpand(); }, t+50); |
1621 |
else {
|
1622 |
setTimeout( function() {
|
1623 |
if (exp.outline) exp.outline.destroy(exp.preserveContent);
|
1624 |
|
1625 |
exp.destroyOverlays(); |
1626 |
|
1627 |
hs.animate( exp.wrapper, { opacity: 0 }, hs.restoreDuration, null, function(){ |
1628 |
exp.afterClose(); |
1629 |
}); |
1630 |
}, t); |
1631 |
} |
1632 |
}, |
1633 |
crossfade : function (up, to, from) { |
1634 |
if (!up) return; |
1635 |
var exp = this, |
1636 |
last = this.last,
|
1637 |
x = this.x,
|
1638 |
y = this.y,
|
1639 |
lastX = last.x, |
1640 |
lastY = last.y, |
1641 |
wrapper = this.wrapper,
|
1642 |
content = this.content,
|
1643 |
overlayBox = this.overlayBox;
|
1644 |
hs.removeEventListener(document, 'mousemove', hs.dragHandler);
|
1645 |
|
1646 |
hs.setStyles(content, { |
1647 |
width: (x.imgSize || x.size) +'px', |
1648 |
height: (y.imgSize || y.size) +'px' |
1649 |
}); |
1650 |
if (overlayBox) overlayBox.style.overflow = 'visible'; |
1651 |
this.outline = last.outline;
|
1652 |
if (this.outline) this.outline.exp = exp; |
1653 |
last.outline = null;
|
1654 |
var fadeBox = hs.createElement('div', { |
1655 |
className: 'highslide-image' |
1656 |
}, { |
1657 |
position: 'absolute', |
1658 |
zIndex: 4, |
1659 |
overflow: 'hidden', |
1660 |
display: 'none' |
1661 |
} |
1662 |
); |
1663 |
var names = { oldImg: last, newImg: this }; |
1664 |
for (var n in names) { |
1665 |
this[n] = names[n].content.cloneNode(1); |
1666 |
hs.setStyles(this[n], {
|
1667 |
position: 'absolute', |
1668 |
border: 0, |
1669 |
visibility: 'visible' |
1670 |
}); |
1671 |
fadeBox.appendChild(this[n]);
|
1672 |
} |
1673 |
wrapper.appendChild(fadeBox); |
1674 |
if (overlayBox) {
|
1675 |
overlayBox.className = '';
|
1676 |
wrapper.appendChild(overlayBox); |
1677 |
} |
1678 |
fadeBox.style.display = '';
|
1679 |
last.content.style.display = 'none';
|
1680 |
|
1681 |
|
1682 |
if (hs.safari) {
|
1683 |
var match = navigator.userAgent.match(/Safari\/([0-9]{3})/); |
1684 |
if (match && parseInt(match[1]) < 525) this.wrapper.style.visibility = 'visible'; |
1685 |
} |
1686 |
hs.animate(wrapper, { |
1687 |
width: x.size
|
1688 |
}, { |
1689 |
duration: hs.transitionDuration,
|
1690 |
step: function(val, args) { |
1691 |
var pos = args.pos,
|
1692 |
invPos = 1 - pos;
|
1693 |
var prop,
|
1694 |
size = {}, |
1695 |
props = ['pos', 'size', 'p1', 'p2']; |
1696 |
for (var n in props) { |
1697 |
prop = props[n]; |
1698 |
size['x'+ prop] = Math.round(invPos * lastX[prop] + pos * x[prop]);
|
1699 |
size['y'+ prop] = Math.round(invPos * lastY[prop] + pos * y[prop]);
|
1700 |
size.ximgSize = Math.round( |
1701 |
invPos * (lastX.imgSize || lastX.size) + pos * (x.imgSize || x.size)); |
1702 |
size.ximgPad = Math.round(invPos * lastX.get('imgPad') + pos * x.get('imgPad')); |
1703 |
size.yimgSize = Math.round( |
1704 |
invPos * (lastY.imgSize || lastY.size) + pos * (y.imgSize || y.size)); |
1705 |
size.yimgPad = Math.round(invPos * lastY.get('imgPad') + pos * y.get('imgPad')); |
1706 |
} |
1707 |
if (exp.outline) exp.outline.setPosition({
|
1708 |
x: size.xpos,
|
1709 |
y: size.ypos,
|
1710 |
w: size.xsize + size.xp1 + size.xp2 + 2 * x.cb, |
1711 |
h: size.ysize + size.yp1 + size.yp2 + 2 * y.cb |
1712 |
}); |
1713 |
last.wrapper.style.clip = 'rect('
|
1714 |
+ (size.ypos - lastY.pos)+'px, '
|
1715 |
+ (size.xsize + size.xp1 + size.xp2 + size.xpos + 2 * lastX.cb - lastX.pos) +'px, ' |
1716 |
+ (size.ysize + size.yp1 + size.yp2 + size.ypos + 2 * lastY.cb - lastY.pos) +'px, ' |
1717 |
+ (size.xpos - lastX.pos)+'px)';
|
1718 |
|
1719 |
hs.setStyles(content, { |
1720 |
top: (size.yp1 + y.get('imgPad')) +'px', |
1721 |
left: (size.xp1 + x.get('imgPad')) +'px', |
1722 |
marginTop: (y.pos - size.ypos) +'px', |
1723 |
marginLeft: (x.pos - size.xpos) +'px' |
1724 |
}); |
1725 |
hs.setStyles(wrapper, { |
1726 |
top: size.ypos +'px', |
1727 |
left: size.xpos +'px', |
1728 |
width: (size.xp1 + size.xp2 + size.xsize + 2 * x.cb)+ 'px', |
1729 |
height: (size.yp1 + size.yp2 + size.ysize + 2 * y.cb) + 'px' |
1730 |
}); |
1731 |
hs.setStyles(fadeBox, { |
1732 |
width: (size.ximgSize || size.xsize) + 'px', |
1733 |
height: (size.yimgSize || size.ysize) +'px', |
1734 |
left: (size.xp1 + size.ximgPad) +'px', |
1735 |
top: (size.yp1 + size.yimgPad) +'px', |
1736 |
visibility: 'visible' |
1737 |
}); |
1738 |
|
1739 |
hs.setStyles(exp.oldImg, { |
1740 |
top: (lastY.pos - size.ypos + lastY.p1 - size.yp1 + lastY.get('imgPad') - size.yimgPad)+'px', |
1741 |
left: (lastX.pos - size.xpos + lastX.p1 - size.xp1 + lastX.get('imgPad') - size.ximgPad)+'px' |
1742 |
}); |
1743 |
|
1744 |
hs.setStyles(exp.newImg, { |
1745 |
opacity: pos,
|
1746 |
top: (y.pos - size.ypos + y.p1 - size.yp1 + y.get('imgPad') - size.yimgPad) +'px', |
1747 |
left: (x.pos - size.xpos + x.p1 - size.xp1 + x.get('imgPad') - size.ximgPad) +'px' |
1748 |
}); |
1749 |
if (overlayBox) hs.setStyles(overlayBox, {
|
1750 |
width: size.xsize + 'px', |
1751 |
height: size.ysize +'px', |
1752 |
left: (size.xp1 + x.cb) +'px', |
1753 |
top: (size.yp1 + y.cb) +'px' |
1754 |
}); |
1755 |
}, |
1756 |
complete: function () { |
1757 |
wrapper.style.visibility = content.style.visibility = 'visible';
|
1758 |
content.style.display = 'block';
|
1759 |
fadeBox.style.display = 'none';
|
1760 |
exp.a.className += ' highslide-active-anchor';
|
1761 |
exp.afterExpand(); |
1762 |
last.afterClose(); |
1763 |
exp.last = null;
|
1764 |
} |
1765 |
|
1766 |
}); |
1767 |
}, |
1768 |
reuseOverlay : function(o, el) { |
1769 |
if (!this.last) return false; |
1770 |
for (var i = 0; i < this.last.overlays.length; i++) { |
1771 |
var oDiv = hs.$('hsId'+ this.last.overlays[i]); |
1772 |
if (oDiv && oDiv.hsId == o.hsId) {
|
1773 |
this.genOverlayBox();
|
1774 |
oDiv.reuse = this.key;
|
1775 |
hs.push(this.overlays, this.last.overlays[i]); |
1776 |
return true; |
1777 |
} |
1778 |
} |
1779 |
return false; |
1780 |
}, |
1781 |
|
1782 |
|
1783 |
afterExpand : function() { |
1784 |
this.isExpanded = true; |
1785 |
this.focus();
|
1786 |
if (this.dimmingOpacity) hs.dim(this); |
1787 |
if (hs.upcoming && hs.upcoming == this.a) hs.upcoming = null; |
1788 |
this.prepareNextOutline();
|
1789 |
var p = hs.page, mX = hs.mouse.x + p.scrollLeft, mY = hs.mouse.y + p.scrollTop;
|
1790 |
this.mouseIsOver = this.x.pos < mX && mX < this.x.pos + this.x.get('wsize') |
1791 |
&& this.y.pos < mY && mY < this.y.pos + this.y.get('wsize'); |
1792 |
if (this.overlayBox) this.showOverlays(); |
1793 |
|
1794 |
}, |
1795 |
|
1796 |
|
1797 |
prepareNextOutline : function() { |
1798 |
var key = this.key; |
1799 |
var outlineType = this.outlineType; |
1800 |
new hs.Outline(outlineType,
|
1801 |
function () { try { hs.expanders[key].preloadNext(); } catch (e) {} }); |
1802 |
}, |
1803 |
|
1804 |
|
1805 |
preloadNext : function() { |
1806 |
var next = this.getAdjacentAnchor(1); |
1807 |
if (next && next.onclick.toString().match(/hs\.expand/)) |
1808 |
var img = hs.createElement('img', { src: hs.getSrc(next) }); |
1809 |
}, |
1810 |
|
1811 |
|
1812 |
getAdjacentAnchor : function(op) { |
1813 |
var current = this.getAnchorIndex(), as = hs.anchors.groups[this.slideshowGroup || 'none']; |
1814 |
|
1815 |
/*< ? if ($cfg->slideshow) : ?>s*/
|
1816 |
if (!as[current + op] && this.slideshow && this.slideshow.repeat) { |
1817 |
if (op == 1) return as[0]; |
1818 |
else if (op == -1) return as[as.length-1]; |
1819 |
} |
1820 |
/*< ? endif ?>s*/
|
1821 |
return as[current + op] || null; |
1822 |
}, |
1823 |
|
1824 |
getAnchorIndex : function() { |
1825 |
var arr = hs.getAnchors().groups[this.slideshowGroup || 'none']; |
1826 |
if (arr) for (var i = 0; i < arr.length; i++) { |
1827 |
if (arr[i] == this.a) return i; |
1828 |
} |
1829 |
return null; |
1830 |
}, |
1831 |
|
1832 |
|
1833 |
getNumber : function() { |
1834 |
if (this[this.numberPosition]) { |
1835 |
var arr = hs.anchors.groups[this.slideshowGroup || 'none']; |
1836 |
if (arr) {
|
1837 |
var s = hs.lang.number.replace('%1', this.getAnchorIndex() + 1).replace('%2', arr.length); |
1838 |
this[this.numberPosition].innerHTML = |
1839 |
'<div class="highslide-number">'+ s +'</div>'+ this[this.numberPosition].innerHTML; |
1840 |
} |
1841 |
} |
1842 |
}, |
1843 |
initSlideshow : function() { |
1844 |
if (!this.last) { |
1845 |
for (var i = 0; i < hs.slideshows.length; i++) { |
1846 |
var ss = hs.slideshows[i], sg = ss.slideshowGroup;
|
1847 |
if (typeof sg == 'undefined' || sg === null || sg === this.slideshowGroup) |
1848 |
this.slideshow = new hs.Slideshow(this.key, ss); |
1849 |
} |
1850 |
} else {
|
1851 |
this.slideshow = this.last.slideshow; |
1852 |
} |
1853 |
var ss = this.slideshow; |
1854 |
if (!ss) return; |
1855 |
var key = ss.expKey = this.key; |
1856 |
|
1857 |
ss.checkFirstAndLast(); |
1858 |
ss.disable('full-expand');
|
1859 |
if (ss.controls) {
|
1860 |
var o = ss.overlayOptions || {};
|
1861 |
o.overlayId = ss.controls; |
1862 |
o.hsId = 'controls';
|
1863 |
this.createOverlay(o);
|
1864 |
} |
1865 |
if (ss.thumbstrip) ss.thumbstrip.add(this); |
1866 |
if (!this.last && this.autoplay) ss.play(true); |
1867 |
if (ss.autoplay) {
|
1868 |
ss.autoplay = setTimeout(function() {
|
1869 |
hs.next(key); |
1870 |
}, (ss.interval || 500));
|
1871 |
} |
1872 |
}, |
1873 |
|
1874 |
cancelLoading : function() { |
1875 |
hs.discardElement (this.wrapper);
|
1876 |
hs.expanders[this.key] = null; |
1877 |
if (hs.upcoming == this.a) hs.upcoming = null; |
1878 |
hs.undim(this.key);
|
1879 |
if (this.loading) hs.loading.style.left = '-9999px'; |
1880 |
}, |
1881 |
|
1882 |
writeCredits : function () { |
1883 |
if (this.credits) return; |
1884 |
this.credits = hs.createElement('a', { |
1885 |
href: hs.creditsHref,
|
1886 |
target: hs.creditsTarget,
|
1887 |
className: 'highslide-credits', |
1888 |
innerHTML: hs.lang.creditsText,
|
1889 |
title: hs.lang.creditsTitle
|
1890 |
}); |
1891 |
this.createOverlay({
|
1892 |
overlayId: this.credits, |
1893 |
position: this.creditsPosition || 'top left', |
1894 |
hsId: 'credits' |
1895 |
}); |
1896 |
}, |
1897 |
|
1898 |
getInline : function(types, addOverlay) { |
1899 |
for (var i = 0; i < types.length; i++) { |
1900 |
var type = types[i], s = null; |
1901 |
if (!this[type +'Id'] && this.thumbsUserSetId) |
1902 |
this[type +'Id'] = type +'-for-'+ this.thumbsUserSetId; |
1903 |
if (this[type +'Id']) this[type] = hs.getNode(this[type +'Id']); |
1904 |
if (!this[type] && !this[type +'Text'] && this[type +'Eval']) try { |
1905 |
s = eval(this[type +'Eval']); |
1906 |
} catch (e) {}
|
1907 |
if (!this[type] && this[type +'Text']) { |
1908 |
s = this[type +'Text']; |
1909 |
} |
1910 |
if (!this[type] && !s) { |
1911 |
this[type] = hs.getNode(this.a['_'+ type + 'Id']); |
1912 |
if (!this[type]) { |
1913 |
var next = this.a.nextSibling; |
1914 |
while (next && !hs.isHsAnchor(next)) {
|
1915 |
if ((new RegExp('highslide-'+ type)).test(next.className || null)) { |
1916 |
if (!next.id) this.a['_'+ type + 'Id'] = next.id = 'hsId'+ hs.idCounter++; |
1917 |
this[type] = hs.getNode(next.id);
|
1918 |
break;
|
1919 |
} |
1920 |
next = next.nextSibling; |
1921 |
} |
1922 |
} |
1923 |
} |
1924 |
if (!this[type] && !s && this.numberPosition == type) s = '\n'; |
1925 |
|
1926 |
if (!this[type] && s) this[type] = hs.createElement('div', |
1927 |
{ className: 'highslide-'+ type, innerHTML: s } ); |
1928 |
|
1929 |
if (addOverlay && this[type]) { |
1930 |
var o = { position: (type == 'heading') ? 'above' : 'below' }; |
1931 |
for (var x in this[type+'Overlay']) o[x] = this[type+'Overlay'][x]; |
1932 |
o.overlayId = this[type];
|
1933 |
this.createOverlay(o);
|
1934 |
} |
1935 |
} |
1936 |
}, |
1937 |
|
1938 |
|
1939 |
// on end move and resize
|
1940 |
doShowHide : function(visibility) { |
1941 |
if (hs.hideSelects) this.showHideElements('SELECT', visibility); |
1942 |
if (hs.hideIframes) this.showHideElements('IFRAME', visibility); |
1943 |
if (hs.geckoMac) this.showHideElements('*', visibility); |
1944 |
}, |
1945 |
showHideElements : function (tagName, visibility) { |
1946 |
var els = document.getElementsByTagName(tagName);
|
1947 |
var prop = tagName == '*' ? 'overflow' : 'visibility'; |
1948 |
for (var i = 0; i < els.length; i++) { |
1949 |
if (prop == 'visibility' || (document.defaultView.getComputedStyle( |
1950 |
els[i], "").getPropertyValue('overflow') == 'auto' |
1951 |
|| els[i].getAttribute('hidden-by') != null)) { |
1952 |
var hiddenBy = els[i].getAttribute('hidden-by'); |
1953 |
if (visibility == 'visible' && hiddenBy) { |
1954 |
hiddenBy = hiddenBy.replace('['+ this.key +']', ''); |
1955 |
els[i].setAttribute('hidden-by', hiddenBy);
|
1956 |
if (!hiddenBy) els[i].style[prop] = els[i].origProp;
|
1957 |
} else if (visibility == 'hidden') { // hide if behind |
1958 |
var elPos = hs.getPosition(els[i]);
|
1959 |
elPos.w = els[i].offsetWidth; |
1960 |
elPos.h = els[i].offsetHeight; |
1961 |
if (!this.dimmingOpacity) { // hide all if dimming |
1962 |
|
1963 |
var clearsX = (elPos.x + elPos.w < this.x.get('opos') |
1964 |
|| elPos.x > this.x.get('opos') + this.x.get('osize')); |
1965 |
var clearsY = (elPos.y + elPos.h < this.y.get('opos') |
1966 |
|| elPos.y > this.y.get('opos') + this.y.get('osize')); |
1967 |
} |
1968 |
var wrapperKey = hs.getWrapperKey(els[i]);
|
1969 |
if (!clearsX && !clearsY && wrapperKey != this.key) { // element falls behind image |
1970 |
if (!hiddenBy) {
|
1971 |
els[i].setAttribute('hidden-by', '['+ this.key +']'); |
1972 |
els[i].origProp = els[i].style[prop]; |
1973 |
els[i].style[prop] = 'hidden';
|
1974 |
|
1975 |
} else if (hiddenBy.indexOf('['+ this.key +']') == -1) { |
1976 |
els[i].setAttribute('hidden-by', hiddenBy + '['+ this.key +']'); |
1977 |
} |
1978 |
} else if ((hiddenBy == '['+ this.key +']' || hs.focusKey == wrapperKey) |
1979 |
&& wrapperKey != this.key) { // on move |
1980 |
els[i].setAttribute('hidden-by', ''); |
1981 |
els[i].style[prop] = els[i].origProp || '';
|
1982 |
} else if (hiddenBy && hiddenBy.indexOf('['+ this.key +']') > -1) { |
1983 |
els[i].setAttribute('hidden-by', hiddenBy.replace('['+ this.key +']', '')); |
1984 |
} |
1985 |
|
1986 |
} |
1987 |
} |
1988 |
} |
1989 |
}, |
1990 |
|
1991 |
focus : function() { |
1992 |
this.wrapper.style.zIndex = hs.zIndexCounter += 2; |
1993 |
// blur others
|
1994 |
for (var i = 0; i < hs.expanders.length; i++) { |
1995 |
if (hs.expanders[i] && i == hs.focusKey) {
|
1996 |
var blurExp = hs.expanders[i];
|
1997 |
blurExp.content.className += ' highslide-'+ blurExp.contentType +'-blur'; |
1998 |
blurExp.content.style.cursor = hs.ie ? 'hand' : 'pointer'; |
1999 |
blurExp.content.title = hs.lang.focusTitle; |
2000 |
} |
2001 |
} |
2002 |
|
2003 |
// focus this
|
2004 |
if (this.outline) this.outline.table.style.zIndex |
2005 |
= this.wrapper.style.zIndex - 1; |
2006 |
this.content.className = 'highslide-'+ this.contentType; |
2007 |
this.content.title = hs.lang.restoreTitle;
|
2008 |
|
2009 |
if (hs.restoreCursor) {
|
2010 |
hs.styleRestoreCursor = window.opera ? 'pointer' : 'url('+ hs.graphicsDir + hs.restoreCursor +'), pointer'; |
2011 |
if (hs.ie && hs.uaVersion < 6) hs.styleRestoreCursor = 'hand'; |
2012 |
this.content.style.cursor = hs.styleRestoreCursor;
|
2013 |
} |
2014 |
|
2015 |
hs.focusKey = this.key;
|
2016 |
hs.addEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); |
2017 |
}, |
2018 |
moveTo: function(x, y) { |
2019 |
this.x.setPos(x);
|
2020 |
this.y.setPos(y);
|
2021 |
}, |
2022 |
resize : function (e) { |
2023 |
var w, h, r = e.width / e.height;
|
2024 |
w = Math.max(e.width + e.dX, Math.min(this.minWidth, this.x.full)); |
2025 |
if (this.isImage && Math.abs(w - this.x.full) < 12) w = this.x.full; |
2026 |
h = w / r; |
2027 |
if (h < Math.min(this.minHeight, this.y.full)) { |
2028 |
h = Math.min(this.minHeight, this.y.full); |
2029 |
if (this.isImage) w = h * r; |
2030 |
} |
2031 |
this.resizeTo(w, h);
|
2032 |
}, |
2033 |
resizeTo: function(w, h) { |
2034 |
this.y.setSize(h);
|
2035 |
this.x.setSize(w);
|
2036 |
this.wrapper.style.height = this.y.get('wsize') +'px'; |
2037 |
}, |
2038 |
|
2039 |
close : function() { |
2040 |
if (this.isClosing || !this.isExpanded) return; |
2041 |
if (this.transitions[1] == 'crossfade' && hs.upcoming) { |
2042 |
hs.getExpander(hs.upcoming).cancelLoading(); |
2043 |
hs.upcoming = null;
|
2044 |
} |
2045 |
this.isClosing = true; |
2046 |
if (this.slideshow && !hs.upcoming) this.slideshow.pause(); |
2047 |
|
2048 |
hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); |
2049 |
|
2050 |
try {
|
2051 |
this.content.style.cursor = 'default'; |
2052 |
this.changeSize(
|
2053 |
0, {
|
2054 |
wrapper: {
|
2055 |
width : this.x.t, |
2056 |
height : this.y.t, |
2057 |
left: this.x.tpos - this.x.cb + this.x.tb, |
2058 |
top: this.y.tpos - this.y.cb + this.y.tb |
2059 |
}, |
2060 |
content: {
|
2061 |
left: 0, |
2062 |
top: 0, |
2063 |
width: this.x.t, |
2064 |
height: this.y.t |
2065 |
} |
2066 |
}, hs.restoreDuration |
2067 |
); |
2068 |
} catch (e) { this.afterClose(); } |
2069 |
}, |
2070 |
|
2071 |
createOverlay : function (o) { |
2072 |
var el = o.overlayId,
|
2073 |
relToVP = (o.relativeTo == 'viewport' && !/panel$/.test(o.position)); |
2074 |
if (typeof el == 'string') el = hs.getNode(el); |
2075 |
if (o.html) el = hs.createElement('div', { innerHTML: o.html }); |
2076 |
if (!el || typeof el == 'string') return; |
2077 |
el.style.display = 'block';
|
2078 |
o.hsId = o.hsId || o.overlayId; |
2079 |
if (this.transitions[1] == 'crossfade' && this.reuseOverlay(o, el)) return; |
2080 |
this.genOverlayBox();
|
2081 |
var width = o.width && /^[0-9]+(px|%)$/.test(o.width) ? o.width : 'auto'; |
2082 |
if (/^(left|right)panel$/.test(o.position) && !/^[0-9]+px$/.test(o.width)) width = '200px'; |
2083 |
var overlay = hs.createElement(
|
2084 |
'div', {
|
2085 |
id: 'hsId'+ hs.idCounter++, |
2086 |
hsId: o.hsId
|
2087 |
}, { |
2088 |
position: 'absolute', |
2089 |
visibility: 'hidden', |
2090 |
width: width,
|
2091 |
direction: hs.lang.cssDirection || '', |
2092 |
opacity: 0 |
2093 |
}, |
2094 |
relToVP ? hs.viewport :this.overlayBox,
|
2095 |
true
|
2096 |
); |
2097 |
if (relToVP) overlay.hsKey = this.key; |
2098 |
|
2099 |
overlay.appendChild(el); |
2100 |
hs.extend(overlay, { |
2101 |
opacity: 1, |
2102 |
offsetX: 0, |
2103 |
offsetY: 0, |
2104 |
dur: (o.fade === 0 || o.fade === false || (o.fade == 2 && hs.ie)) ? 0 : 250 |
2105 |
}); |
2106 |
hs.extend(overlay, o); |
2107 |
|
2108 |
if (this.gotOverlays) { |
2109 |
this.positionOverlay(overlay);
|
2110 |
if (!overlay.hideOnMouseOut || this.mouseIsOver) |
2111 |
hs.animate(overlay, { opacity: overlay.opacity }, overlay.dur);
|
2112 |
} |
2113 |
hs.push(this.overlays, hs.idCounter - 1); |
2114 |
}, |
2115 |
positionOverlay : function(overlay) { |
2116 |
var p = overlay.position || 'middle center', |
2117 |
relToVP = (overlay.relativeTo == 'viewport'),
|
2118 |
offX = overlay.offsetX, |
2119 |
offY = overlay.offsetY; |
2120 |
if (relToVP) {
|
2121 |
hs.viewport.style.display = 'block';
|
2122 |
overlay.hsKey = this.key;
|
2123 |
if (overlay.offsetWidth > overlay.parentNode.offsetWidth)
|
2124 |
overlay.style.width = '100%';
|
2125 |
} else
|
2126 |
if (overlay.parentNode != this.overlayBox) this.overlayBox.appendChild(overlay); |
2127 |
if (/left$/.test(p)) overlay.style.left = offX +'px'; |
2128 |
|
2129 |
if (/center$/.test(p)) hs.setStyles (overlay, { |
2130 |
left: '50%', |
2131 |
marginLeft: (offX - Math.round(overlay.offsetWidth / 2)) +'px' |
2132 |
}); |
2133 |
|
2134 |
if (/right$/.test(p)) overlay.style.right = - offX +'px'; |
2135 |
|
2136 |
if (/^leftpanel$/.test(p)) { |
2137 |
hs.setStyles(overlay, { |
2138 |
right: '100%', |
2139 |
marginRight: this.x.cb +'px', |
2140 |
top: - this.y.cb +'px', |
2141 |
bottom: - this.y.cb +'px', |
2142 |
overflow: 'auto' |
2143 |
}); |
2144 |
this.x.p1 = overlay.offsetWidth;
|
2145 |
|
2146 |
} else if (/^rightpanel$/.test(p)) { |
2147 |
hs.setStyles(overlay, { |
2148 |
left: '100%', |
2149 |
marginLeft: this.x.cb +'px', |
2150 |
top: - this.y.cb +'px', |
2151 |
bottom: - this.y.cb +'px', |
2152 |
overflow: 'auto' |
2153 |
}); |
2154 |
this.x.p2 = overlay.offsetWidth;
|
2155 |
} |
2156 |
var parOff = overlay.parentNode.offsetHeight;
|
2157 |
overlay.style.height = 'auto';
|
2158 |
if (relToVP && overlay.offsetHeight > parOff)
|
2159 |
overlay.style.height = hs.ieLt7 ? parOff +'px' : '100%'; |
2160 |
|
2161 |
if (/^top/.test(p)) overlay.style.top = offY +'px'; |
2162 |
if (/^middle/.test(p)) hs.setStyles (overlay, { |
2163 |
top: '50%', |
2164 |
marginTop: (offY - Math.round(overlay.offsetHeight / 2)) +'px' |
2165 |
}); |
2166 |
if (/^bottom/.test(p)) overlay.style.bottom = - offY +'px'; |
2167 |
if (/^above$/.test(p)) { |
2168 |
hs.setStyles(overlay, { |
2169 |
left: (- this.x.p1 - this.x.cb) +'px', |
2170 |
right: (- this.x.p2 - this.x.cb) +'px', |
2171 |
bottom: '100%', |
2172 |
marginBottom: this.y.cb +'px', |
2173 |
width: 'auto' |
2174 |
}); |
2175 |
this.y.p1 = overlay.offsetHeight;
|
2176 |
|
2177 |
} else if (/^below$/.test(p)) { |
2178 |
hs.setStyles(overlay, { |
2179 |
position: 'relative', |
2180 |
left: (- this.x.p1 - this.x.cb) +'px', |
2181 |
right: (- this.x.p2 - this.x.cb) +'px', |
2182 |
top: '100%', |
2183 |
marginTop: this.y.cb +'px', |
2184 |
width: 'auto' |
2185 |
}); |
2186 |
this.y.p2 = overlay.offsetHeight;
|
2187 |
overlay.style.position = 'absolute';
|
2188 |
} |
2189 |
}, |
2190 |
|
2191 |
getOverlays : function() { |
2192 |
this.getInline(['heading', 'caption'], true); |
2193 |
this.getNumber();
|
2194 |
if (this.heading && this.dragByHeading) this.heading.className += ' highslide-move'; |
2195 |
if (hs.showCredits) this.writeCredits(); |
2196 |
for (var i = 0; i < hs.overlays.length; i++) { |
2197 |
var o = hs.overlays[i], tId = o.thumbnailId, sg = o.slideshowGroup;
|
2198 |
if ((!tId && !sg) || (tId && tId == this.thumbsUserSetId) |
2199 |
|| (sg && sg === this.slideshowGroup)) {
|
2200 |
this.createOverlay(o);
|
2201 |
} |
2202 |
} |
2203 |
var os = [];
|
2204 |
for (var i = 0; i < this.overlays.length; i++) { |
2205 |
var o = hs.$('hsId'+ this.overlays[i]); |
2206 |
if (/panel$/.test(o.position)) this.positionOverlay(o); |
2207 |
else hs.push(os, o);
|
2208 |
} |
2209 |
for (var i = 0; i < os.length; i++) this.positionOverlay(os[i]); |
2210 |
this.gotOverlays = true; |
2211 |
}, |
2212 |
genOverlayBox : function() { |
2213 |
if (!this.overlayBox) this.overlayBox = hs.createElement ( |
2214 |
'div', {
|
2215 |
className: this.wrapperClassName |
2216 |
}, { |
2217 |
position : 'absolute', |
2218 |
width: (this.x.size || (this.useBox ? this.width : null) |
2219 |
|| this.x.full) +'px', |
2220 |
height: (this.y.size || this.y.full) +'px', |
2221 |
visibility : 'hidden', |
2222 |
overflow : 'hidden', |
2223 |
zIndex : hs.ie ? 4 : 'auto' |
2224 |
}, |
2225 |
hs.container, |
2226 |
true
|
2227 |
); |
2228 |
}, |
2229 |
sizeOverlayBox : function(doWrapper, doPanels) { |
2230 |
var overlayBox = this.overlayBox, |
2231 |
x = this.x,
|
2232 |
y = this.y;
|
2233 |
hs.setStyles( overlayBox, { |
2234 |
width: x.size +'px', |
2235 |
height: y.size +'px' |
2236 |
}); |
2237 |
if (doWrapper || doPanels) {
|
2238 |
for (var i = 0; i < this.overlays.length; i++) { |
2239 |
var o = hs.$('hsId'+ this.overlays[i]); |
2240 |
var ie6 = (hs.ieLt7 || document.compatMode == 'BackCompat'); |
2241 |
if (o && /^(above|below)$/.test(o.position)) { |
2242 |
if (ie6) {
|
2243 |
o.style.width = (overlayBox.offsetWidth + 2 * x.cb
|
2244 |
+ x.p1 + x.p2) +'px';
|
2245 |
} |
2246 |
y[o.position == 'above' ? 'p1' : 'p2'] = o.offsetHeight; |
2247 |
} |
2248 |
if (o && ie6 && /^(left|right)panel$/.test(o.position)) { |
2249 |
o.style.height = (overlayBox.offsetHeight + 2* y.cb) +'px'; |
2250 |
} |
2251 |
} |
2252 |
} |
2253 |
if (doWrapper) {
|
2254 |
hs.setStyles(this.content, {
|
2255 |
top: y.p1 +'px' |
2256 |
}); |
2257 |
hs.setStyles(overlayBox, { |
2258 |
top: (y.p1 + y.cb) +'px' |
2259 |
}); |
2260 |
} |
2261 |
}, |
2262 |
|
2263 |
showOverlays : function() { |
2264 |
var b = this.overlayBox; |
2265 |
b.className = '';
|
2266 |
hs.setStyles(b, { |
2267 |
top: (this.y.p1 + this.y.cb) +'px', |
2268 |
left: (this.x.p1 + this.x.cb) +'px', |
2269 |
overflow : 'visible' |
2270 |
}); |
2271 |
if (hs.safari) b.style.visibility = 'visible'; |
2272 |
this.wrapper.appendChild (b);
|
2273 |
for (var i = 0; i < this.overlays.length; i++) { |
2274 |
var o = hs.$('hsId'+ this.overlays[i]); |
2275 |
o.style.zIndex = o.hsId == 'controls' ? 5 : 4; |
2276 |
if (!o.hideOnMouseOut || this.mouseIsOver) { |
2277 |
o.style.visibility = 'visible';
|
2278 |
hs.setStyles(o, { visibility: 'visible', display: '' }); |
2279 |
hs.animate(o, { opacity: o.opacity }, o.dur);
|
2280 |
} |
2281 |
} |
2282 |
}, |
2283 |
|
2284 |
destroyOverlays : function() { |
2285 |
if (!this.overlays.length) return; |
2286 |
if (this.slideshow) { |
2287 |
var c = this.slideshow.controls; |
2288 |
if (c && hs.getExpander(c) == this) c.parentNode.removeChild(c); |
2289 |
} |
2290 |
for (var i = 0; i < this.overlays.length; i++) { |
2291 |
var o = hs.$('hsId'+ this.overlays[i]); |
2292 |
if (o && o.parentNode == hs.viewport && hs.getExpander(o) == this) hs.discardElement(o); |
2293 |
} |
2294 |
hs.discardElement(this.overlayBox);
|
2295 |
}, |
2296 |
|
2297 |
|
2298 |
|
2299 |
createFullExpand : function () { |
2300 |
if (this.slideshow && this.slideshow.controls) { |
2301 |
this.slideshow.enable('full-expand'); |
2302 |
return;
|
2303 |
} |
2304 |
this.fullExpandLabel = hs.createElement(
|
2305 |
'a', {
|
2306 |
href: 'javascript:hs.expanders['+ this.key +'].doFullExpand();', |
2307 |
title: hs.lang.fullExpandTitle,
|
2308 |
className: 'highslide-full-expand' |
2309 |
} |
2310 |
); |
2311 |
|
2312 |
this.createOverlay({
|
2313 |
overlayId: this.fullExpandLabel, |
2314 |
position: hs.fullExpandPosition,
|
2315 |
hideOnMouseOut: true, |
2316 |
opacity: hs.fullExpandOpacity
|
2317 |
}); |
2318 |
}, |
2319 |
|
2320 |
doFullExpand : function () { |
2321 |
try {
|
2322 |
if (this.fullExpandLabel) hs.discardElement(this.fullExpandLabel); |
2323 |
|
2324 |
this.focus();
|
2325 |
var xSize = this.x.size; |
2326 |
this.resizeTo(this.x.full, this.y.full); |
2327 |
|
2328 |
var xpos = this.x.pos - (this.x.size - xSize) / 2; |
2329 |
if (xpos < hs.marginLeft) xpos = hs.marginLeft;
|
2330 |
|
2331 |
this.moveTo(xpos, this.y.pos); |
2332 |
this.doShowHide('hidden'); |
2333 |
|
2334 |
} catch (e) {
|
2335 |
this.error(e);
|
2336 |
} |
2337 |
}, |
2338 |
|
2339 |
|
2340 |
afterClose : function () { |
2341 |
this.a.className = this.a.className.replace('highslide-active-anchor', ''); |
2342 |
|
2343 |
this.doShowHide('visible'); |
2344 |
if (this.outline && this.outlineWhileAnimating) this.outline.destroy(); |
2345 |
|
2346 |
hs.discardElement(this.wrapper);
|
2347 |
this.destroyOverlays();
|
2348 |
if (!hs.viewport.childNodes.length) hs.viewport.style.display = 'none'; |
2349 |
|
2350 |
if (this.dimmingOpacity) hs.undim(this.key); |
2351 |
hs.expanders[this.key] = null; |
2352 |
hs.reOrder(); |
2353 |
} |
2354 |
|
2355 |
}; |
2356 |
|
2357 |
|
2358 |
hs.Slideshow = function (expKey, options) { |
2359 |
if (hs.dynamicallyUpdateAnchors !== false) hs.updateAnchors(); |
2360 |
this.expKey = expKey;
|
2361 |
for (var x in options) this[x] = options[x]; |
2362 |
if (this.useControls) this.getControls(); |
2363 |
if (this.thumbstrip) this.thumbstrip = hs.Thumbstrip(this); |
2364 |
}; |
2365 |
hs.Slideshow.prototype = { |
2366 |
getControls: function() { |
2367 |
this.controls = hs.createElement('div', { innerHTML: hs.replaceLang(hs.skin.controls) }, |
2368 |
null, hs.container);
|
2369 |
|
2370 |
var buttons = ['play', 'pause', 'previous', 'next', 'move', 'full-expand', 'close']; |
2371 |
this.btn = {};
|
2372 |
var pThis = this; |
2373 |
for (var i = 0; i < buttons.length; i++) { |
2374 |
this.btn[buttons[i]] = hs.getElementByClass(this.controls, 'li', 'highslide-'+ buttons[i]); |
2375 |
this.enable(buttons[i]);
|
2376 |
} |
2377 |
this.btn.pause.style.display = 'none'; |
2378 |
//this.disable('full-expand');
|
2379 |
}, |
2380 |
checkFirstAndLast: function() { |
2381 |
if (this.repeat || !this.controls) return; |
2382 |
var exp = hs.expanders[this.expKey], |
2383 |
cur = exp.getAnchorIndex(), |
2384 |
re = /disabled$/;
|
2385 |
if (cur == 0) |
2386 |
this.disable('previous'); |
2387 |
else if (re.test(this.btn.previous.getElementsByTagName('a')[0].className)) |
2388 |
this.enable('previous'); |
2389 |
if (cur + 1 == hs.anchors.groups[exp.slideshowGroup || 'none'].length) { |
2390 |
this.disable('next'); |
2391 |
this.disable('play'); |
2392 |
} else if (re.test(this.btn.next.getElementsByTagName('a')[0].className)) { |
2393 |
this.enable('next'); |
2394 |
this.enable('play'); |
2395 |
} |
2396 |
}, |
2397 |
enable: function(btn) { |
2398 |
if (!this.btn) return; |
2399 |
var sls = this, a = this.btn[btn].getElementsByTagName('a')[0], re = /disabled$/; |
2400 |
a.onclick = function() { |
2401 |
sls[btn](); |
2402 |
return false; |
2403 |
}; |
2404 |
if (re.test(a.className)) a.className = a.className.replace(re, ''); |
2405 |
}, |
2406 |
disable: function(btn) { |
2407 |
if (!this.btn) return; |
2408 |
var a = this.btn[btn].getElementsByTagName('a')[0]; |
2409 |
a.onclick = function() { return false; }; |
2410 |
if (!/disabled$/.test(a.className)) a.className += ' disabled'; |
2411 |
}, |
2412 |
hitSpace: function() { |
2413 |
if (this.autoplay) this.pause(); |
2414 |
else this.play(); |
2415 |
}, |
2416 |
play: function(wait) { |
2417 |
if (this.btn) { |
2418 |
this.btn.play.style.display = 'none'; |
2419 |
this.btn.pause.style.display = ''; |
2420 |
} |
2421 |
|
2422 |
this.autoplay = true; |
2423 |
if (!wait) hs.next(this.expKey); |
2424 |
}, |
2425 |
pause: function() { |
2426 |
if (this.btn) { |
2427 |
this.btn.pause.style.display = 'none'; |
2428 |
this.btn.play.style.display = ''; |
2429 |
} |
2430 |
|
2431 |
clearTimeout(this.autoplay);
|
2432 |
this.autoplay = null; |
2433 |
}, |
2434 |
previous: function() { |
2435 |
this.pause();
|
2436 |
hs.previous(this.btn.previous);
|
2437 |
}, |
2438 |
next: function() { |
2439 |
this.pause();
|
2440 |
hs.next(this.btn.next);
|
2441 |
}, |
2442 |
move: function() {}, |
2443 |
'full-expand': function() { |
2444 |
hs.getExpander().doFullExpand(); |
2445 |
}, |
2446 |
close: function() { |
2447 |
hs.close(this.btn.close);
|
2448 |
} |
2449 |
}; |
2450 |
hs.Thumbstrip = function(slideshow) { |
2451 |
function add (exp) { |
2452 |
hs.extend(options || {}, { |
2453 |
overlayId: dom,
|
2454 |
hsId: 'thumbstrip', |
2455 |
className: 'highslide-thumbstrip-'+ mode +'-overlay ' + (options.className || '') |
2456 |
}); |
2457 |
if (hs.ieLt7) options.fade = 0; |
2458 |
exp.createOverlay(options); |
2459 |
hs.setStyles(dom.parentNode, { overflow: 'hidden' }); |
2460 |
}; |
2461 |
|
2462 |
function scroll (delta) { |
2463 |
selectThumb(undefined, Math.round(delta * dom[isX ? 'offsetWidth' : 'offsetHeight'] * 0.7)); |
2464 |
}; |
2465 |
|
2466 |
function selectThumb (i, scrollBy) { |
2467 |
if (i === undefined) for (var j = 0; j < group.length; j++) { |
2468 |
if (group[j] == hs.expanders[slideshow.expKey].a) {
|
2469 |
i = j; |
2470 |
break;
|
2471 |
} |
2472 |
} |
2473 |
if (i === undefined) return; |
2474 |
var as = dom.getElementsByTagName('a'), |
2475 |
active = as[i], |
2476 |
cell = active.parentNode, |
2477 |
left = isX ? 'Left' : 'Top', |
2478 |
right = isX ? 'Right' : 'Bottom', |
2479 |
width = isX ? 'Width' : 'Height', |
2480 |
offsetLeft = 'offset' + left,
|
2481 |
offsetWidth = 'offset' + width,
|
2482 |
overlayWidth = div.parentNode.parentNode[offsetWidth], |
2483 |
minTblPos = overlayWidth - table[offsetWidth], |
2484 |
curTblPos = parseInt(table.style[isX ? 'left' : 'top']) || 0, |
2485 |
tblPos = curTblPos, |
2486 |
mgnRight = 20;
|
2487 |
if (scrollBy !== undefined) { |
2488 |
tblPos = curTblPos - scrollBy; |
2489 |
|
2490 |
if (minTblPos > 0) minTblPos = 0; |
2491 |
if (tblPos > 0) tblPos = 0; |
2492 |
if (tblPos < minTblPos) tblPos = minTblPos;
|
2493 |
|
2494 |
|
2495 |
} else {
|
2496 |
for (var j = 0; j < as.length; j++) as[j].className = ''; |
2497 |
active.className = 'highslide-active-anchor';
|
2498 |
var activeLeft = i > 0 ? as[i - 1].parentNode[offsetLeft] : cell[offsetLeft], |
2499 |
activeRight = cell[offsetLeft] + cell[offsetWidth] + |
2500 |
(as[i + 1] ? as[i + 1].parentNode[offsetWidth] : 0); |
2501 |
if (activeRight > overlayWidth - curTblPos) tblPos = overlayWidth - activeRight;
|
2502 |
else if (activeLeft < -curTblPos) tblPos = -activeLeft; |
2503 |
} |
2504 |
var markerPos = cell[offsetLeft] + (cell[offsetWidth] - marker[offsetWidth]) / 2 + tblPos; |
2505 |
hs.animate(table, isX ? { left: tblPos } : { top: tblPos }, null, 'easeOutQuad'); |
2506 |
hs.animate(marker, isX ? { left: markerPos } : { top: markerPos }, null, 'easeOutQuad'); |
2507 |
scrollUp.style.display = tblPos < 0 ? 'block' : 'none'; |
2508 |
scrollDown.style.display = (tblPos > minTblPos) ? 'block' : 'none'; |
2509 |
|
2510 |
}; |
2511 |
|
2512 |
|
2513 |
// initialize
|
2514 |
var group = hs.anchors.groups[hs.expanders[slideshow.expKey].slideshowGroup || 'none'], |
2515 |
options = slideshow.thumbstrip, |
2516 |
mode = options.mode || 'horizontal',
|
2517 |
floatMode = (mode == 'float'),
|
2518 |
tree = floatMode ? ['div', 'ul', 'li', 'span'] : ['table', 'tbody', 'tr', 'td'], |
2519 |
isX = (mode == 'horizontal'),
|
2520 |
dom = hs.createElement('div', {
|
2521 |
className: 'highslide-thumbstrip highslide-thumbstrip-'+ mode, |
2522 |
innerHTML:
|
2523 |
'<div class="highslide-thumbstrip-inner">'+
|
2524 |
'<'+ tree[0] +'><'+ tree[1] +'></'+ tree[1] +'></'+ tree[0] +'></div>'+ |
2525 |
'<div class="highslide-scroll-up"><div></div></div>'+
|
2526 |
'<div class="highslide-scroll-down"><div></div></div>'+
|
2527 |
'<div class="highslide-marker"><div></div></div>'
|
2528 |
}, { |
2529 |
display: 'none' |
2530 |
}, hs.container), |
2531 |
domCh = dom.childNodes, |
2532 |
div = domCh[0],
|
2533 |
scrollUp = domCh[1],
|
2534 |
scrollDown = domCh[2],
|
2535 |
marker = domCh[3],
|
2536 |
table = div.firstChild, |
2537 |
tbody = dom.getElementsByTagName(tree[1])[0], |
2538 |
tr; |
2539 |
for (var i = 0; i < group.length; i++) { |
2540 |
if (i == 0 || !isX) tr = hs.createElement(tree[2], null, null, tbody); |
2541 |
(function(){
|
2542 |
var a = group[i],
|
2543 |
cell = hs.createElement(tree[3], null, null, tr), |
2544 |
pI = i; |
2545 |
hs.createElement('a', {
|
2546 |
href: a.href,
|
2547 |
onclick: function() { |
2548 |
hs.getExpander(this).focus();
|
2549 |
return hs.transit(a);
|
2550 |
}, |
2551 |
innerHTML: hs.stripItemFormatter ? hs.stripItemFormatter(a) : a.innerHTML
|
2552 |
}, null, cell);
|
2553 |
})(); |
2554 |
} |
2555 |
if (!floatMode) {
|
2556 |
scrollUp.onclick = function () { scroll(-1); }; |
2557 |
scrollDown.onclick = function() { scroll(1); }; |
2558 |
hs.addEventListener(tbody, document.onmousewheel !== undefined ?
|
2559 |
'mousewheel' : 'DOMMouseScroll', function(e) { |
2560 |
var delta = 0; |
2561 |
e = e || window.event; |
2562 |
if (e.wheelDelta) {
|
2563 |
delta = e.wheelDelta/120;
|
2564 |
if (hs.opera) delta = -delta;
|
2565 |
} else if (e.detail) { |
2566 |
delta = -e.detail/3;
|
2567 |
} |
2568 |
if (delta) scroll(-delta * 0.2); |
2569 |
if (e.preventDefault) e.preventDefault();
|
2570 |
e.returnValue = false;
|
2571 |
}); |
2572 |
} |
2573 |
|
2574 |
return {
|
2575 |
add: add,
|
2576 |
selectThumb: selectThumb
|
2577 |
} |
2578 |
}; |
2579 |
hs.langDefaults = hs.lang; |
2580 |
// history
|
2581 |
var HsExpander = hs.Expander;
|
2582 |
if (hs.ie) {
|
2583 |
(function () {
|
2584 |
try {
|
2585 |
document.documentElement.doScroll('left');
|
2586 |
} catch (e) {
|
2587 |
setTimeout(arguments.callee, 50); |
2588 |
return;
|
2589 |
} |
2590 |
hs.ready(); |
2591 |
})(); |
2592 |
} |
2593 |
hs.addEventListener(document, 'DOMContentLoaded', hs.ready);
|
2594 |
hs.addEventListener(window, 'load', hs.ready);
|
2595 |
|
2596 |
// set handlers
|
2597 |
hs.addEventListener(document, 'ready', function() { |
2598 |
if (hs.expandCursor || hs.dimmingOpacity) {
|
2599 |
var style = hs.createElement('style', { type: 'text/css' }, null, |
2600 |
document.getElementsByTagName('HEAD')[0]); |
2601 |
|
2602 |
function addRule(sel, dec) { |
2603 |
if (!hs.ie) {
|
2604 |
style.appendChild(document.createTextNode(sel + " {" + dec + "}")); |
2605 |
} else {
|
2606 |
var last = document.styleSheets[document.styleSheets.length - 1]; |
2607 |
if (typeof(last.addRule) == "object") last.addRule(sel, dec); |
2608 |
} |
2609 |
} |
2610 |
function fix(prop) { |
2611 |
return 'expression( ( ( ignoreMe = document.documentElement.'+ prop + |
2612 |
' ? document.documentElement.'+ prop +' : document.body.'+ prop +' ) ) + \'px\' );'; |
2613 |
} |
2614 |
if (hs.expandCursor) addRule ('.highslide img', |
2615 |
'cursor: url('+ hs.graphicsDir + hs.expandCursor +'), pointer !important;'); |
2616 |
addRule ('.highslide-viewport-size',
|
2617 |
hs.ie && (hs.uaVersion < 7 || document.compatMode == 'BackCompat') ? |
2618 |
'position: absolute; '+
|
2619 |
'left:'+ fix('scrollLeft') + |
2620 |
'top:'+ fix('scrollTop') + |
2621 |
'width:'+ fix('clientWidth') + |
2622 |
'height:'+ fix('clientHeight') : |
2623 |
'position: fixed; width: 100%; height: 100%; left: 0; top: 0');
|
2624 |
} |
2625 |
}); |
2626 |
hs.addEventListener(window, 'resize', function() { |
2627 |
hs.getPageSize(); |
2628 |
if (hs.viewport) for (var i = 0; i < hs.viewport.childNodes.length; i++) { |
2629 |
var node = hs.viewport.childNodes[i],
|
2630 |
exp = hs.getExpander(node); |
2631 |
exp.positionOverlay(node); |
2632 |
if (node.hsId == 'thumbstrip') exp.slideshow.thumbstrip.selectThumb(); |
2633 |
} |
2634 |
}); |
2635 |
hs.addEventListener(document, 'mousemove', function(e) { |
2636 |
hs.mouse = { x: e.clientX, y: e.clientY }; |
2637 |
}); |
2638 |
hs.addEventListener(document, 'mousedown', hs.mouseClickHandler);
|
2639 |
hs.addEventListener(document, 'mouseup', hs.mouseClickHandler);
|
2640 |
|
2641 |
hs.addEventListener(document, 'ready', hs.getAnchors);
|
2642 |
hs.addEventListener(window, 'load', hs.preloadImages);
|
2643 |
} |