-/**
+/**
* Name: Highslide JS
* Version: 4.1.13 (2011-10-06)
- * Config: default +slideshow +positioning +transitions +viewport +thumbstrip
+ * Config: default +events +slideshow +positioning +transitions +viewport +thumbstrip
* Author: Torstein Hønsi
* Support: www.highslide.com/support
* License: www.highslide.com/#license
creditsText : 'Powered by <i>Highslide JS</i>',
creditsTitle : 'Go to the Highslide JS homepage',
previousText : 'Previous',
- nextText : 'Next',
+ nextText : 'Next',
moveText : 'Move',
- closeText : 'Close',
- closeTitle : 'Close (esc)',
+ closeText : 'Close',
+ closeTitle : 'Close (esc)',
resizeTitle : 'Resize',
playText : 'Play',
playTitle : 'Play slideshow (spacebar)',
number: 'Image %1 of %2',
restoreTitle : 'Click to close image, click and drag to move. Use arrow keys for next and previous.'
},
-// See http://highslide.com/ref for examples of settings
+// See http://highslide.com/ref for examples of settings
graphicsDir : 'highslide/graphics/',
expandCursor : 'zoomin.cur', // null disables
restoreCursor : 'zoomout.cur', // null disables
loadingOpacity : 0.75,
allowMultipleInstances: true,
numberOfImagesToPreload : 5,
-outlineWhileAnimating : 2, // 0 = never, 1 = always, 2 = HTML only
+outlineWhileAnimating : 2, // 0 = never, 1 = always, 2 = HTML only
outlineStartOffset : 3, // ends at 10
padToMinWidth : false, // pad the popup width to make room for wide caption
fullExpandPosition : 'bottom right',
'numberPosition',
'transitions',
'dimmingOpacity',
-
+
'width',
'height',
-
+
'wrapperClassName',
'minWidth',
'minHeight',
if (attribs) hs.extend(el, attribs);
if (nopad) hs.setStyles(el, {padding: 0, border: 'none', margin: 0});
if (styles) hs.setStyles(el, styles);
- if (parent) parent.appendChild(el);
+ if (parent) parent.appendChild(el);
return el;
},
if (styles[x] > 0.99) el.style.removeAttribute('filter');
else el.style.filter = 'alpha(opacity='+ (styles[x] * 100) +')';
}
- else el.style[x] = styles[x];
+ else el.style[x] = styles[x];
}
},
animate: function(el, prop, opt) {
opt.curAnim = hs.extend({}, prop);
for (var name in prop) {
var e = new hs.fx(el, opt , name );
-
+
start = parseFloat(hs.css(el, name)) || 0;
end = parseFloat(prop[name]);
unit = name != 'opacity' ? 'px' : '';
-
+
e.custom( start, end, unit );
- }
+ }
},
css: function(el, prop) {
if (el.style[prop]) {
} else {
if (prop == 'opacity') prop = 'filter';
var val = el.currentStyle[prop.replace(/\-(\w)/g, function (a, b){ return b.toUpperCase(); })];
- if (prop == 'filter')
- val = val.replace(/alpha\(opacity=([0-9]+)\)/,
+ if (prop == 'filter')
+ val = val.replace(/alpha\(opacity=([0-9]+)\)/,
function (a, b) { return b / 100 });
return val === '' ? 1 : val;
- }
+ }
},
getPageSize : function () {
- var d = document, w = window, iebody = d.compatMode && d.compatMode != 'BackCompat'
+ var d = document, w = window, iebody = d.compatMode && d.compatMode != 'BackCompat'
? d.documentElement : d.body,
ieLt9 = hs.ie && (hs.uaVersion < 9 || typeof pageXOffset == 'undefined');
-
- var width = ieLt9 ? iebody.clientWidth :
+
+ var width = ieLt9 ? iebody.clientWidth :
(d.documentElement.clientWidth || self.innerWidth),
height = ieLt9 ? iebody.clientHeight : self.innerHeight;
hs.page = {
width: width,
- height: height,
+ height: height,
scrollLeft: ieLt9 ? iebody.scrollLeft : pageXOffset,
scrollTop: ieLt9 ? iebody.scrollTop : pageYOffset
};
expand : function(a, params, custom, type) {
if (!a) a = hs.createElement('a', null, { display: 'none' }, hs.container);
- if (typeof a.getParams == 'function') return params;
- try {
+ if (typeof a.getParams == 'function') return params;
+ try {
new hs.Expander(a, params, custom);
return false;
} catch (e) { return true; }
getElementByClass : function (el, tagName, className) {
var els = el.getElementsByTagName(tagName);
for (var i = 0; i < els.length; i++) {
- if ((new RegExp(className)).test(els[i].className)) {
+ if ((new RegExp(className)).test(els[i].className)) {
return els[i];
}
}
focusTopmost : function() {
- var topZ = 0,
+ var topZ = 0,
topmostKey = -1,
expanders = hs.expanders,
exp,
if (exp) {
zIndex = exp.wrapper.style.zIndex;
if (zIndex && zIndex > topZ) {
- topZ = zIndex;
+ topZ = zIndex;
topmostKey = i;
}
}
a.getParams = a.onclick;
var p = a.getParams ? a.getParams() : null;
a.getParams = null;
-
- return (p && typeof p[param] != 'undefined') ? p[param] :
+
+ return (p && typeof p[param] != 'undefined') ? p[param] :
(typeof hs[param] != 'undefined' ? hs[param] : null);
},
className: 'highslide-dimming highslide-viewport-size',
owner: '',
onclick: function() {
-
+ if (hs.fireEvent(hs, 'onDimmerClick'))
+
hs.close();
}
}, {
- visibility: 'visible',
+ visibility: 'visible',
opacity: 0
}, hs.container, true);
-
+
if (/(Android|iPad|iPhone|iPod)/.test(navigator.userAgent)) {
var body = document.body;
function pixDimmerSize() {
var isNew = hs.dimmer.owner == '';
hs.dimmer.owner += '|'+ exp.key;
-
+
if (isNew) {
if (hs.geckoMac && hs.dimmingGeckoFix)
hs.setStyles(hs.dimmer, {
hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
try {
hs.upcoming = adj;
- adj.onclick();
+ adj.onclick();
} catch (e){
hs.last = hs.upcoming = null;
}
},
next : function (el) {
- return hs.previousOrNext(el, 1);
+ return hs.previousOrNext(el, 1);
},
keyHandler : function(e) {
if (!e) e = window.event;
if (!e.target) e.target = e.srcElement; // ie
if (typeof e.target.form != 'undefined') return true; // form element has focus
+ if (!hs.fireEvent(hs, 'onKeyDown', e)) return true;
var exp = hs.getExpander();
-
+
var op = null;
switch (e.keyCode) {
case 70: // f
}
if (op !== null) {if (op != 2)hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
if (!hs.enableKeyListener) return true;
-
+
if (e.preventDefault) e.preventDefault();
- else e.returnValue = false;
- if (exp) {
+ else e.returnValue = false;
+ if (exp) {
if (op == 0) {
exp.close();
} else if (op == 2) {
el = el.parentNode;
}
}
- return null;
+ return null;
},
getExpander : function (el, expOnly) {
for (var i = 0; i < hs.expanders.length; i++)
if (hs.expanders[i] && hs.expanders[i].isExpanded) hs.focusTopmost();
},
+fireEvent : function (obj, evt, args) {
+ return obj && obj[evt] ? (obj[evt](obj, args) !== false) : true;
+},
-mouseClickHandler : function(e)
-{
+mouseClickHandler : function(e)
+{
if (!e) e = window.event;
if (e.button > 1) return true;
if (!e.target) e.target = e.srcElement;
-
+
var el = e.target;
while (el.parentNode
&& !(/highslide-(image|move|html|resize)/.test(el.className)))
}
var exp = hs.getExpander(el);
if (exp && (exp.isClosing || !exp.isExpanded)) return true;
-
+
if (exp && e.type == 'mousedown') {
if (e.target.form) return true;
var match = el.className.match(/highslide-(image|move|resize)/);
if (match) {
- hs.dragArgs = {
- exp: exp ,
- type: match[1],
- left: exp.x.pos,
- width: exp.x.size,
- top: exp.y.pos,
- height: exp.y.size,
- clickX: e.clientX,
+ hs.dragArgs = {
+ exp: exp ,
+ type: match[1],
+ left: exp.x.pos,
+ width: exp.x.size,
+ top: exp.y.pos,
+ height: exp.y.size,
+ clickX: e.clientX,
clickY: e.clientY
};
-
-
+
+
hs.addEventListener(document, 'mousemove', hs.dragHandler);
if (e.preventDefault) e.preventDefault(); // FF
-
+
if (/highslide-(image|html)-blur/.test(exp.content.className)) {
exp.focus();
hs.hasFocused = true;
return false;
}
} else if (e.type == 'mouseup') {
-
+
hs.removeEventListener(document, 'mousemove', hs.dragHandler);
-
+
if (hs.dragArgs) {
- if (hs.styleRestoreCursor && hs.dragArgs.type == 'image')
+ if (hs.styleRestoreCursor && hs.dragArgs.type == 'image')
hs.dragArgs.exp.content.style.cursor = hs.styleRestoreCursor;
var hasDragged = hs.dragArgs.hasDragged;
-
+
if (!hasDragged &&!hs.hasFocused && !/(move|resize)/.test(hs.dragArgs.type)) {
+ if (hs.fireEvent(exp, 'onImageClick'))
exp.close();
- }
+ }
else if (hasDragged || (!hasDragged && hs.hasHtmlExpanders)) {
hs.dragArgs.exp.doShowHide('hidden');
}
+
+ if (hasDragged) hs.fireEvent(hs.dragArgs.exp, 'onDrop', hs.dragArgs);
hs.hasFocused = false;
hs.dragArgs = null;
-
+
} else if (/highslide-image-blur/.test(el.className)) {
- el.style.cursor = hs.styleRestoreCursor;
+ el.style.cursor = hs.styleRestoreCursor;
}
}
return false;
if (!hs.dragArgs) return true;
if (!e) e = window.event;
var a = hs.dragArgs, exp = a.exp;
-
+
a.dX = e.clientX - a.clickX;
- a.dY = e.clientY - a.clickY;
-
+ a.dY = e.clientY - a.clickY;
+
var distance = Math.sqrt(Math.pow(a.dX, 2) + Math.pow(a.dY, 2));
if (!a.hasDragged) a.hasDragged = (a.type != 'image' && distance > 0)
|| (distance > (hs.dragSensitivity || 5));
-
+
if (a.hasDragged && e.clientX > 5 && e.clientY > 5) {
-
+ if (!hs.fireEvent(exp, 'onDrag', a)) return false;
+
if (a.type == 'resize') exp.resize(a);
else {
exp.moveTo(a.left + a.dX, a.top + a.dY);
wrapperMouseHandler : function (e) {
try {
if (!e) e = window.event;
- var over = /mouseover/i.test(e.type);
+ var over = /mouseover/i.test(e.type);
if (!e.target) e.target = e.srcElement; // ie
- if (!e.relatedTarget) e.relatedTarget =
+ if (!e.relatedTarget) e.relatedTarget =
over ? e.fromElement : e.toElement; // ie
var exp = hs.getExpander(e.target);
if (!exp.isExpanded) return;
- if (!exp || !e.relatedTarget || hs.getExpander(e.relatedTarget, true) == exp
+ if (!exp || !e.relatedTarget || hs.getExpander(e.relatedTarget, true) == exp
|| hs.dragArgs) return;
+ hs.fireEvent(exp, over ? 'onMouseOver' : 'onMouseOut', e);
for (var i = 0; i < exp.overlays.length; i++) (function() {
var o = hs.$('hsId'+ exp.overlays[i]);
if (o && o.hideOnMouseOut) {
if (over) hs.setStyles(o, { visibility: 'visible', display: '' });
hs.animate(o, { opacity: over ? o.opacity : 0 }, o.dur);
}
- })();
+ })();
} catch (e) {}
},
addEventListener : function (el, event, func) {
} catch (e) {
el['on'+ event] = func;
}
- }
+ }
},
removeEventListener : function (el, event, func) {
preloadFullImage : function (i) {
if (hs.continuePreloading && hs.preloadTheseImages[i] && hs.preloadTheseImages[i] != 'undefined') {
var img = document.createElement('img');
- img.onload = function() {
+ img.onload = function() {
img = null;
hs.preloadFullImage(i + 1);
};
},
preloadImages : function (number) {
if (number && typeof number != 'object') hs.numberOfImagesToPreload = number;
-
+
var arr = hs.getAnchors();
for (var i = 0; i < arr.images.length && i < hs.numberOfImagesToPreload; i++) {
hs.push(hs.preloadTheseImages, hs.getSrc(arr.images[i]));
}
-
+
// preload outlines
if (hs.outlineType) new hs.Outline(hs.outlineType, function () { hs.preloadFullImage(0)} );
else
-
+
hs.preloadFullImage(0);
-
+
// preload cursor
if (hs.restoreCursor) var cur = hs.createElement('img', { src: hs.graphicsDir + hs.restoreCursor });
},
init : function () {
if (!hs.container) {
-
+
hs.ieLt7 = hs.ie && hs.uaVersion < 7;
hs.ieLt9 = hs.ie && hs.uaVersion < 9;
-
+
hs.getPageSize();
for (var x in hs.langDefaults) {
if (typeof hs[x] != 'undefined') hs.lang[x] = hs[x];
- else if (typeof hs.lang[x] == 'undefined' && typeof hs.langDefaults[x] != 'undefined')
+ else if (typeof hs.lang[x] == 'undefined' && typeof hs.langDefaults[x] != 'undefined')
hs.lang[x] = hs.langDefaults[x];
}
-
+
hs.container = hs.createElement('div', {
className: 'highslide-container'
}, {
position: 'absolute',
- left: 0,
- top: 0,
- width: '100%',
+ left: 0,
+ top: 0,
+ width: '100%',
zIndex: hs.zIndexCounter,
direction: 'ltr'
- },
+ },
document.body,
true
);
visibility: (hs.safari && hs.uaVersion < 525) ? 'visible' : 'hidden'
}, hs.container, 1
);
-
- // http://www.robertpenner.com/easing/
+
+ // http://www.robertpenner.com/easing/
Math.linearTween = function (t, b, c, d) {
return c*t/d + b;
};
Math.easeOutQuad = function (t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
};
-
+
hs.hideSelects = hs.ieLt7;
- hs.hideIframes = ((window.opera && hs.uaVersion < 9) || navigator.vendor == 'KDE'
+ hs.hideIframes = ((window.opera && hs.uaVersion < 9) || navigator.vendor == 'KDE'
|| (hs.ieLt7 && hs.uaVersion < 5.5));
+ hs.fireEvent(this, 'onActivate');
}
},
ready : function() {
updateAnchors : function() {
var el, els, all = [], images = [],groups = {}, re;
-
+
for (var i = 0; i < hs.openerTagNames.length; i++) {
els = document.getElementsByTagName(hs.openerTagNames[i]);
for (var j = 0; j < els.length; j++) {
}
hs.anchors = { all: all, groups: groups, images: images };
return hs.anchors;
-
+
},
getAnchors : function() {
hs.fx.prototype = {
update: function(){
(hs.fx.step[this.prop] || hs.fx.step._default)(this);
-
+
if (this.options.step)
this.options.step.call(this.elem, this.now, this);
this.onLoad = onLoad;
this.outlineType = outlineType;
var v = hs.uaVersion, tr;
-
+
this.hasAlphaImageLoader = hs.ie && hs.uaVersion < 7;
if (!outlineType) {
if (onLoad) onLoad();
return;
}
-
+
hs.init();
this.table = hs.createElement(
- 'table', {
- cellSpacing: 0
+ 'table', {
+ cellSpacing: 0
}, {
visibility: 'hidden',
position: 'absolute',
true
);
var tbody = hs.createElement('tbody', null, null, this.table, 1);
-
+
this.td = [];
for (var i = 0; i <= 8; i++) {
if (i % 3 == 0) tr = hs.createElement('tr', null, { height: 'auto' }, tbody, true);
hs.setStyles(this.td[i], style);
}
this.td[4].className = outlineType +' highslide-outline';
-
- this.preloadGraphic();
+
+ this.preloadGraphic();
};
hs.Outline.prototype = {
preloadGraphic : function () {
var src = hs.graphicsDir + (hs.outlinesDir || "outlines/")+ this.outlineType +".png";
-
+
var appendTo = hs.safari && hs.uaVersion < 525 ? hs.container : null;
- this.graphic = hs.createElement('img', null, { position: 'absolute',
+ this.graphic = hs.createElement('img', null, { position: 'absolute',
top: '-9999px' }, appendTo, true); // for onload trigger
-
+
var pThis = this;
this.graphic.onload = function() { pThis.onGraphicLoad(); };
-
+
this.graphic.src = src;
},
if (this.hasAlphaImageLoader) {
var w = (i == 1 || i == 7) ? '100%' : this.graphic.width +'px';
var div = hs.createElement('div', null, { width: '100%', height: '100%', position: 'relative', overflow: 'hidden'}, this.td[i], true);
- hs.createElement ('div', null, {
- filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='"+ this.graphic.src + "')",
+ hs.createElement ('div', null, {
+ filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='"+ this.graphic.src + "')",
position: 'absolute',
- width: w,
+ width: w,
height: this.graphic.height +'px',
left: (pos[i][0]*o)+'px',
top: (pos[i][1]*o)+'px'
- },
+ },
div,
true);
} else {
hs.setStyles(this.td[i], { background: 'url('+ this.graphic.src +') '+ (pos[i][0]*o)+'px '+(pos[i][1]*o)+'px'});
}
-
- if (window.opera && (i == 3 || i ==5))
+
+ if (window.opera && (i == 3 || i ==5))
hs.createElement('div', null, dim, this.td[i], true);
-
+
hs.setStyles (this.td[i], dim);
}
}
hs.pendingOutlines[this.outlineType] = this;
if (this.onLoad) this.onLoad();
},
-
+
setPosition : function (pos, offset, vis, dur, easing) {
var exp = this.exp,
stl = exp.wrapper.style,
w: exp.x.get('wsize') - 2 * offset,
h: exp.y.get('wsize') - 2 * offset
};
- if (vis) this.table.style.visibility = (pos.h >= 4 * this.offset)
+ if (vis) this.table.style.visibility = (pos.h >= 4 * this.offset)
? 'visible' : 'hidden';
hs.setStyles(this.table, {
left: (pos.x - this.offset) +'px',
top: (pos.y - this.offset) +'px',
width: (pos.w + 2 * this.offset) +'px'
});
-
+
pos.w -= 2 * this.offset;
pos.h -= 2 * this.offset;
hs.setStyles (this.td[4], {
width: pos.w >= 0 ? pos.w +'px' : 0,
height: pos.h >= 0 ? pos.h +'px' : 0
});
- if (this.hasAlphaImageLoader) this.td[3].style.height
- = this.td[5].style.height = this.td[4].style.height;
-
+ if (this.hasAlphaImageLoader) this.td[3].style.height
+ = this.td[5].style.height = this.td[4].style.height;
+
},
-
+
destroy : function(hide) {
if (hide) this.table.style.visibility = 'hidden';
else hs.discardElement(this.table);
return this.get('wsize') + (this.exp.outline ? 2*this.exp.outline.offset : 0);
case 'imgPad':
return this.imgSize ? Math.round((this.size - this.imgSize) / 2) : 0;
-
+
}
},
calcBorders: function() {
// correct for borders
this.cb = (this.exp.content['offset'+ this.ucwh] - this.t) / 2;
-
+
this.marginMax = hs['margin'+ this.ucrb];
},
calcThumb: function() {
- this.t = this.exp.el[this.wh] ? parseInt(this.exp.el[this.wh]) :
+ this.t = this.exp.el[this.wh] ? parseInt(this.exp.el[this.wh]) :
this.exp.el['offset'+ this.ucwh];
this.tpos = this.exp.tpos[this.dim];
this.tb = (this.exp.el['offset'+ this.ucwh] - this.t) / 2;
if (this.tpos == 0 || this.tpos == -1) {
- this.tpos = (hs.page[this.wh] / 2) + hs.page['scroll'+ this.uclt];
+ this.tpos = (hs.page[this.wh] / 2) + hs.page['scroll'+ this.uclt];
};
},
calcExpanded: function() {
var exp = this.exp;
this.justify = 'auto';
-
+
// get alignment
if (exp.align == 'center') this.justify = 'center';
else if (new RegExp(this.lt).test(exp.anchor)) this.justify = null;
else if (new RegExp(this.rb).test(exp.anchor)) this.justify = 'max';
-
-
+
+
// size and position
this.pos = this.tpos - this.cb + this.tb;
-
+
if (this.maxHeight && this.dim == 'x')
- exp.maxWidth = Math.min(exp.maxWidth || this.full, exp.maxHeight * this.full / exp.y.full);
-
+ exp.maxWidth = Math.min(exp.maxWidth || this.full, exp.maxHeight * this.full / exp.y.full);
+
this.size = Math.min(this.full, exp['max'+ this.ucwh] || this.full);
- this.minSize = exp.allowSizeReduction ?
+ this.minSize = exp.allowSizeReduction ?
Math.min(exp['min'+ this.ucwh], this.full) :this.full;
if (exp.isImage && exp.useBox) {
this.size = exp[this.wh];
exp.content.style[this.lt] = this.get('imgPad')+'px';
} else
this.size = i;
-
+
exp.content.style[this.wh] = i +'px';
exp.wrapper.style[this.wh] = this.get('wsize') +'px';
if (exp.outline) exp.outline.setPosition();
},
setPos: function(i) {
this.pos = i;
- this.exp.wrapper.style[this.lt] = i +'px';
-
+ this.exp.wrapper.style[this.lt] = i +'px';
+
if (this.exp.outline) this.exp.outline.setPosition();
-
+
}
};
new hs.Expander(a, params, custom, contentType);
});
return;
- }
+ }
this.a = a;
this.custom = custom;
this.contentType = contentType || 'image';
this.isImage = !this.isHtml;
-
+
hs.continuePreloading = false;
this.overlays = [];
this.last = hs.last;
params[name] : hs[name];
}
if (!this.src) this.src = a.href;
-
+
// get thumb
var el = (params && params.thumbnailId) ? hs.$(params.thumbnailId) : a;
el = this.thumb = el.getElementsByTagName('img')[0] || el;
this.thumbsUserSetId = el.id || a.id;
-
+ if (!hs.fireEvent(this, 'onInit')) return true;
+
// check if already open
for (var i = 0; i < hs.expanders.length; i++) {
- if (hs.expanders[i] && hs.expanders[i].a == a
+ if (hs.expanders[i] && hs.expanders[i].a == a
&& !(this.last && this.transitions[1] == 'crossfade')) {
hs.expanders[i].focus();
return false;
}
- }
+ }
// cancel other
if (!hs.allowSimultaneousLoading) for (var i = 0; i < hs.expanders.length; i++) {
if (typeof hs.focusKey != 'undefined' && hs.expanders[hs.focusKey])
hs.expanders[hs.focusKey].close();
}
-
+
// initiate metrics
this.el = el;
this.tpos = this.pageOrigin || hs.getPosition(el);
position: 'absolute',
zIndex: hs.zIndexCounter += 2
}, null, true );
-
+
this.wrapper.onmouseover = this.wrapper.onmouseout = hs.wrapperMouseHandler;
if (this.contentType == 'image' && this.outlineWhileAnimating == 2)
this.outlineWhileAnimating = 0;
-
+
// get the outline
- if (!this.outlineType
+ if (!this.outlineType
|| (this.last && this.isImage && this.transitions[1] == 'crossfade')) {
this[this.contentType +'Create']();
-
+
} else if (hs.pendingOutlines[this.outlineType]) {
this.connectOutline();
this[this.contentType +'Create']();
-
+
} else {
this.showLoading();
var exp = this;
- new hs.Outline(this.outlineType,
+ new hs.Outline(this.outlineType,
function () {
exp.connectOutline();
exp[exp.contentType +'Create']();
- }
+ }
);
}
return true;
showLoading : function() {
if (this.onLoadStarted || this.loading) return;
-
+
this.loading = hs.loading;
var exp = this;
this.loading.onclick = function() {
exp.cancelLoading();
};
- var exp = this,
+
+
+ if (!hs.fireEvent(this, 'onShowLoading')) return;
+ var exp = this,
l = this.x.get('loadingPos') +'px',
t = this.y.get('loadingPos') +'px';
- if (!tgt && this.last && this.transitions[1] == 'crossfade')
- var tgt = this.last;
+ if (!tgt && this.last && this.transitions[1] == 'crossfade')
+ var tgt = this.last;
if (tgt) {
l = tgt.x.get('loadingPosXfade') +'px';
t = tgt.y.get('loadingPosXfade') +'px';
this.loading.style.zIndex = hs.zIndexCounter++;
}
- setTimeout(function () {
+ setTimeout(function () {
if (exp.loading) hs.setStyles(exp.loading, { left: l, top: t, zIndex: hs.zIndexCounter++ })}
, 100);
},
imageCreate : function() {
var exp = this;
-
+
var img = document.createElement('img');
- this.content = img;
- img.onload = function () {
- if (hs.expanders[exp.key]) exp.contentLoaded();
+ this.content = img;
+ img.onload = function () {
+ if (hs.expanders[exp.key]) exp.contentLoaded();
};
- if (hs.blockRightClick) img.oncontextmenu = function() { return false; };
- img.className = 'highslide-image';
- hs.setStyles(img, {
- visibility: 'hidden',
- display: 'block',
- position: 'absolute',
+ if (hs.blockRightClick) img.oncontextmenu = function() { return false; };
+ img.className = 'highslide-image';
+ hs.setStyles(img, {
+ visibility: 'hidden',
+ display: 'block',
+ position: 'absolute',
maxWidth: '9999px',
zIndex: 3
});
- img.title = hs.lang.restoreTitle;
+ img.title = hs.lang.restoreTitle;
if (hs.safari && hs.uaVersion < 525) hs.container.appendChild(img);
- if (hs.ie && hs.flushImgSize) img.src = null;
+ if (hs.ie && hs.flushImgSize) img.src = null;
img.src = this.src;
-
+
this.showLoading();
},
contentLoaded : function() {
- try {
+ try {
if (!this.content) return;
this.content.onload = null;
if (this.onLoadStarted) return;
else this.onLoadStarted = true;
-
+
var x = this.x, y = this.y;
-
+
if (this.loading) {
hs.setStyles(this.loading, { top: '-9999px' });
this.loading = null;
- }
+ hs.fireEvent(this, 'onHideLoading');
+ }
x.full = this.content.width;
y.full = this.content.height;
-
+
hs.setStyles(this.content, {
width: x.t +'px',
height: y.t +'px'
});
this.wrapper.appendChild(this.content);
hs.container.appendChild(this.wrapper);
-
+
x.calcBorders();
y.calcBorders();
-
+
hs.setStyles (this.wrapper, {
left: (x.tpos + x.tb - x.cb) +'px',
top: (y.tpos + x.tb - y.cb) +'px'
});
-
-
+
+
this.initSlideshow();
this.getOverlays();
-
+
var ratio = x.full / y.full;
x.calcExpanded();
this.justify(x);
-
+
y.calcExpanded();
this.justify(y);
if (this.overlayBox) this.sizeOverlayBox(0, 1);
-
+
if (this.allowSizeReduction) {
this.correctRatio(ratio);
- var ss = this.slideshow;
+ var ss = this.slideshow;
if (ss && this.last && ss.controls && ss.fixedControls) {
var pos = ss.overlayOptions.position || '', p;
for (var dim in hs.oPos) for (var i = 0; i < 5; i++) {
p = this[dim];
if (pos.match(hs.oPos[dim][i])) {
- p.pos = this.last[dim].pos
+ p.pos = this.last[dim].pos
+ (this.last[dim].p1 - p.p1)
+ (this.last[dim].size - p.size) * [0, 0, .5, 1, 1][i];
if (ss.fixedControls == 'fit') {
if (p.pos + p.size + p.p1 + p.p2 > p.scroll + p.clientSize - p.marginMax)
p.pos = p.scroll + p.clientSize - p.size - p.marginMin - p.marginMax - p.p1 - p.p2;
- if (p.pos < p.scroll + p.marginMin) p.pos = p.scroll + p.marginMin;
- }
+ if (p.pos < p.scroll + p.marginMin) p.pos = p.scroll + p.marginMin;
+ }
}
}
}
}
}
this.show();
-
+
} catch (e) {
this.error(e);
}
justify : function (p, moveOnly) {
var tgtArr, tgt = p.target, dim = p == this.x ? 'x' : 'y';
-
+
if (tgt && tgt.match(/ /)) {
tgtArr = tgt.split(' ');
tgt = tgtArr[0];
}
if (tgt && hs.$(tgt)) {
p.pos = hs.getPosition(hs.$(tgt))[dim];
- if (tgtArr && tgtArr[1] && tgtArr[1].match(/^[-]?[0-9]+px$/))
+ if (tgtArr && tgtArr[1] && tgtArr[1].match(/^[-]?[0-9]+px$/))
p.pos += parseInt(tgtArr[1]);
if (p.size < p.minSize) p.size = p.minSize;
-
+
} else if (p.justify == 'auto' || p.justify == 'center') {
-
+
var hasMovedMin = false;
-
+
var allowReduce = p.exp.allowSizeReduction;
if (p.justify == 'center')
p.pos = Math.round(p.scroll + (p.clientSize + p.marginMin - p.marginMax - p.get('wsize')) / 2);
p.pos = Math.round(p.pos - ((p.get('wsize') - p.t) / 2));
if (p.pos < p.scroll + p.marginMin) {
p.pos = p.scroll + p.marginMin;
- hasMovedMin = true;
+ hasMovedMin = true;
}
if (!moveOnly && p.size < p.minSize) {
p.size = p.minSize;
} else { // image larger than viewport
p.pos = p.scroll + p.marginMin;
if (!moveOnly && allowReduce) p.size = p.get(dim == 'y' ? 'fitsize' : 'maxsize');
- }
+ }
}
-
+
if (!moveOnly && p.size < p.minSize) {
p.size = p.minSize;
allowReduce = false;
}
-
-
+
+
} else if (p.justify == 'max') {
p.pos = Math.floor(p.pos - p.size + p.t);
}
-
-
+
+
if (p.pos < p.marginMin) {
var tmpMin = p.pos;
- p.pos = p.marginMin;
-
+ p.pos = p.marginMin;
+
if (allowReduce && !moveOnly) p.size = p.size - (p.pos - tmpMin);
-
+
}
},
correctRatio : function(ratio) {
- var x = this.x,
+ var x = this.x,
y = this.y,
changed = false,
xSize = Math.min(x.full, x.size),
ySize = Math.min(y.full, y.size),
useBox = (this.useBox || hs.padToMinWidth);
-
+
if (xSize / ySize > ratio) { // width greater
xSize = ySize * ratio;
if (xSize < x.minSize) { // below minWidth
ySize = xSize / ratio;
}
changed = true;
-
+
} else if (xSize / ySize < ratio) { // height greater
ySize = xSize / ratio;
changed = true;
}
-
+
if (hs.padToMinWidth && x.full < x.minSize) {
x.imgSize = x.full;
y.size = y.imgSize = y.full;
x.pos = x.tpos - x.cb + x.tb;
x.minSize = x.size;
this.justify(x, true);
-
+
y.pos = y.tpos - y.cb + y.tb;
y.minSize = y.size;
this.justify(y, true);
if (this.overlayBox) this.sizeOverlayBox();
}
-
-
+
+
},
fitOverlayBox : function(ratio, changed) {
var x = this.x, y = this.y;
if (this.overlayBox) {
- while (y.size > this.minHeight && x.size > this.minWidth
+ while (y.size > this.minHeight && x.size > this.minWidth
&& y.get('wsize') > y.get('fitsize')) {
y.size -= 10;
if (ratio) x.size = y.size * ratio;
show : function () {
var x = this.x, y = this.y;
this.doShowHide('hidden');
+ hs.fireEvent(this, 'onBeforeExpand');
if (this.slideshow && this.slideshow.thumbstrip) this.slideshow.thumbstrip.selectThumb();
-
+
// Apply size change
this.changeSize(
1, {
// transition
var trans = this.transitions,
other = up ? (this.last ? this.last.a : null) : hs.upcoming,
- t = (trans[1] && other
+ t = (trans[1] && other
&& hs.getParam(other, 'transitions')[1] == trans[1]) ?
trans[1] : trans[0];
-
+
if (this[t] && t != 'expand') {
this[t](up, to);
return;
}
-
+
if (this.outline && !this.outlineWhileAnimating) {
if (up) this.outline.setPosition();
else this.outline.destroy();
}
-
-
+
+
if (!up) this.destroyOverlays();
-
+
var exp = this,
x = exp.x,
y = exp.y,
if (!up) easing = this.easingClose || easing;
var after = up ?
function() {
-
+
if (exp.outline) exp.outline.table.style.visibility = "visible";
setTimeout(function() {
exp.afterExpand();
x: x.tpos + (x.pos - x.tpos) * fac,
y: y.tpos + (y.pos - y.tpos) * fac
};
- exp.outline.setPosition(pos, 0, 1);
+ exp.outline.setPosition(pos, 0, 1);
}
}
});
fade : function(up, to) {
this.outlineWhileAnimating = false;
var exp = this, t = up ? hs.expandDuration : 0;
-
+
if (up) {
hs.animate(this.wrapper, to.wrapper, 0);
hs.setStyles(this.wrapper, { opacity: 0, visibility: 'visible' });
hs.animate(this.content, to.content, 0);
this.content.style.visibility = 'visible';
- hs.animate(this.wrapper, { opacity: 1 }, t, null,
+ hs.animate(this.wrapper, { opacity: 1 }, t, null,
function() { exp.afterExpand(); });
}
-
+
if (this.outline) {
this.outline.table.style.zIndex = this.wrapper.style.zIndex;
- var dir = up || -1,
+ var dir = up || -1,
offset = this.outline.offset,
startOff = up ? 3 : offset,
endOff = up? offset : 3;
})();
}
}
-
-
+
+
if (up) {}//setTimeout(function() { exp.afterExpand(); }, t+50);
else {
setTimeout( function() {
if (exp.outline) exp.outline.destroy(exp.preserveContent);
-
+
exp.destroyOverlays();
-
+
hs.animate( exp.wrapper, { opacity: 0 }, hs.restoreDuration, null, function(){
exp.afterClose();
});
- }, t);
+ }, t);
}
},
crossfade : function (up, to, from) {
if (!up) return;
- var exp = this,
+ var exp = this,
last = this.last,
x = this.x,
y = this.y,
content = this.content,
overlayBox = this.overlayBox;
hs.removeEventListener(document, 'mousemove', hs.dragHandler);
-
- hs.setStyles(content, {
- width: (x.imgSize || x.size) +'px',
- height: (y.imgSize || y.size) +'px'
+
+ hs.setStyles(content, {
+ width: (x.imgSize || x.size) +'px',
+ height: (y.imgSize || y.size) +'px'
});
if (overlayBox) overlayBox.style.overflow = 'visible';
this.outline = last.outline;
last.outline = null;
var fadeBox = hs.createElement('div', {
className: 'highslide-'+ this.contentType
- }, {
- position: 'absolute',
+ }, {
+ position: 'absolute',
zIndex: 4,
overflow: 'hidden',
display: 'none'
}
);
var names = { oldImg: last, newImg: this };
- for (var n in names) {
+ for (var n in names) {
this[n] = names[n].content.cloneNode(1);
hs.setStyles(this[n], {
position: 'absolute',
}
fadeBox.style.display = '';
last.content.style.display = 'none';
-
-
+
+
if (hs.safari && hs.uaVersion < 525) {
this.wrapper.style.visibility = 'visible';
}
hs.animate(wrapper, {
width: x.size
}, {
- duration: hs.transitionDuration,
+ duration: hs.transitionDuration,
step: function(val, args) {
var pos = args.pos,
invPos = 1 - pos;
var prop,
- size = {},
+ size = {},
props = ['pos', 'size', 'p1', 'p2'];
for (var n in props) {
prop = props[n];
invPos * (lastY.imgSize || lastY.size) + pos * (y.imgSize || y.size));
size.yimgPad = Math.round(invPos * lastY.get('imgPad') + pos * y.get('imgPad'));
}
- if (exp.outline) exp.outline.setPosition({
- x: size.xpos,
- y: size.ypos,
- w: size.xsize + size.xp1 + size.xp2 + 2 * x.cb,
+ if (exp.outline) exp.outline.setPosition({
+ x: size.xpos,
+ y: size.ypos,
+ w: size.xsize + size.xp1 + size.xp2 + 2 * x.cb,
h: size.ysize + size.yp1 + size.yp2 + 2 * y.cb
});
last.wrapper.style.clip = 'rect('
+ (size.xsize + size.xp1 + size.xp2 + size.xpos + 2 * lastX.cb - lastX.pos) +'px, '
+ (size.ysize + size.yp1 + size.yp2 + size.ypos + 2 * lastY.cb - lastY.pos) +'px, '
+ (size.xpos - lastX.pos)+'px)';
-
+
hs.setStyles(content, {
top: (size.yp1 + y.get('imgPad')) +'px',
left: (size.xp1 + x.get('imgPad')) +'px',
top: (size.yp1 + size.yimgPad) +'px',
visibility: 'visible'
});
-
+
hs.setStyles(exp.oldImg, {
top: (lastY.pos - size.ypos + lastY.p1 - size.yp1 + lastY.get('imgPad') - size.yimgPad)+'px',
left: (lastX.pos - size.xpos + lastX.p1 - size.xp1 + lastX.get('imgPad') - size.ximgPad)+'px'
- });
-
+ });
+
hs.setStyles(exp.newImg, {
opacity: pos,
top: (y.pos - size.ypos + y.p1 - size.yp1 + y.get('imgPad') - size.yimgPad) +'px',
last.afterClose();
exp.last = null;
}
-
+
});
},
reuseOverlay : function(o, el) {
afterExpand : function() {
- this.isExpanded = true;
+ this.isExpanded = true;
this.focus();
if (this.dimmingOpacity) hs.dim(this);
if (hs.upcoming && hs.upcoming == this.a) hs.upcoming = null;
this.prepareNextOutline();
var p = hs.page, mX = hs.mouse.x + p.scrollLeft, mY = hs.mouse.y + p.scrollTop;
this.mouseIsOver = this.x.pos < mX && mX < this.x.pos + this.x.get('wsize')
- && this.y.pos < mY && mY < this.y.pos + this.y.get('wsize');
+ && this.y.pos < mY && mY < this.y.pos + this.y.get('wsize');
if (this.overlayBox) this.showOverlays();
-
+ hs.fireEvent(this, 'onAfterExpand');
+
},
prepareNextOutline : function() {
var key = this.key;
var outlineType = this.outlineType;
- new hs.Outline(outlineType,
+ new hs.Outline(outlineType,
function () { try { hs.expanders[key].preloadNext(); } catch (e) {} });
},
preloadNext : function() {
var next = this.getAdjacentAnchor(1);
- if (next && next.onclick.toString().match(/hs\.expand/))
+ if (next && next.onclick.toString().match(/hs\.expand/))
var img = hs.createElement('img', { src: hs.getSrc(next) });
},
getAnchorIndex : function() {
var arr = hs.getAnchors().groups[this.slideshowGroup || 'none'];
if (arr) for (var i = 0; i < arr.length; i++) {
- if (arr[i] == this.a) return i;
+ if (arr[i] == this.a) return i;
}
return null;
},
var arr = hs.anchors.groups[this.slideshowGroup || 'none'];
if (arr) {
var s = hs.lang.number.replace('%1', this.getAnchorIndex() + 1).replace('%2', arr.length);
- this[this.numberPosition].innerHTML =
+ this[this.numberPosition].innerHTML =
'<div class="highslide-number">'+ s +'</div>'+ this[this.numberPosition].innerHTML;
}
}
if (!this.last) {
for (var i = 0; i < hs.slideshows.length; i++) {
var ss = hs.slideshows[i], sg = ss.slideshowGroup;
- if (typeof sg == 'undefined' || sg === null || sg === this.slideshowGroup)
+ if (typeof sg == 'undefined' || sg === null || sg === this.slideshowGroup)
this.slideshow = new hs.Slideshow(this.key, ss);
- }
+ }
} else {
this.slideshow = this.last.slideshow;
}
var ss = this.slideshow;
if (!ss) return;
var key = ss.expKey = this.key;
-
+
ss.checkFirstAndLast();
ss.disable('full-expand');
if (ss.controls) {
if (hs.upcoming == this.a) hs.upcoming = null;
hs.undim(this.key);
if (this.loading) hs.loading.style.left = '-9999px';
+ hs.fireEvent(this, 'onHideLoading');
},
writeCredits : function () {
innerHTML: hs.lang.creditsText,
title: hs.lang.creditsTitle
});
- this.createOverlay({
- overlayId: this.credits,
- position: this.creditsPosition || 'top left',
- hsId: 'credits'
+ this.createOverlay({
+ overlayId: this.credits,
+ position: this.creditsPosition || 'top left',
+ hsId: 'credits'
});
},
getInline : function(types, addOverlay) {
for (var i = 0; i < types.length; i++) {
var type = types[i], s = null;
- if (!this[type +'Id'] && this.thumbsUserSetId)
+ if (type == 'caption' && !hs.fireEvent(this, 'onBeforeGetCaption')) return;
+ else if (type == 'heading' && !hs.fireEvent(this, 'onBeforeGetHeading')) return;
+ if (!this[type +'Id'] && this.thumbsUserSetId)
this[type +'Id'] = type +'-for-'+ this.thumbsUserSetId;
if (this[type +'Id']) this[type] = hs.getNode(this[type +'Id']);
if (!this[type] && !this[type +'Text'] && this[type +'Eval']) try {
}
}
if (!this[type] && !s && this.numberPosition == type) s = '\n';
-
- if (!this[type] && s) this[type] = hs.createElement('div',
+
+ if (!this[type] && s) this[type] = hs.createElement('div',
{ className: 'highslide-'+ type, innerHTML: s } );
-
+
if (addOverlay && this[type]) {
var o = { position: (type == 'heading') ? 'above' : 'below' };
for (var x in this[type+'Overlay']) o[x] = this[type+'Overlay'][x];
elPos.w = els[i].offsetWidth;
elPos.h = els[i].offsetHeight;
if (!this.dimmingOpacity) { // hide all if dimming
-
- var clearsX = (elPos.x + elPos.w < this.x.get('opos')
+
+ var clearsX = (elPos.x + elPos.w < this.x.get('opos')
|| elPos.x > this.x.get('opos') + this.x.get('osize'));
- var clearsY = (elPos.y + elPos.h < this.y.get('opos')
+ var clearsY = (elPos.y + elPos.h < this.y.get('opos')
|| elPos.y > this.y.get('opos') + this.y.get('osize'));
}
var wrapperKey = hs.getWrapperKey(els[i]);
els[i].setAttribute('hidden-by', '['+ this.key +']');
els[i].origProp = els[i].style[prop];
els[i].style[prop] = 'hidden';
-
+
} else if (hiddenBy.indexOf('['+ this.key +']') == -1) {
els[i].setAttribute('hidden-by', hiddenBy + '['+ this.key +']');
}
} else if (hiddenBy && hiddenBy.indexOf('['+ this.key +']') > -1) {
els[i].setAttribute('hidden-by', hiddenBy.replace('['+ this.key +']', ''));
}
-
+
}
}
}
blurExp.content.className += ' highslide-'+ blurExp.contentType +'-blur';
blurExp.content.style.cursor = hs.ieLt7 ? 'hand' : 'pointer';
blurExp.content.title = hs.lang.focusTitle;
+ hs.fireEvent(blurExp, 'onBlur');
}
}
-
+
// focus this
- if (this.outline) this.outline.table.style.zIndex
+ if (this.outline) this.outline.table.style.zIndex
= this.wrapper.style.zIndex - 1;
this.content.className = 'highslide-'+ this.contentType;
this.content.title = hs.lang.restoreTitle;
-
+
if (hs.restoreCursor) {
hs.styleRestoreCursor = window.opera ? 'pointer' : 'url('+ hs.graphicsDir + hs.restoreCursor +'), pointer';
if (hs.ieLt7 && hs.uaVersion < 6) hs.styleRestoreCursor = 'hand';
this.content.style.cursor = hs.styleRestoreCursor;
}
-
- hs.focusKey = this.key;
- hs.addEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
+
+ hs.focusKey = this.key;
+ hs.addEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
+ hs.fireEvent(this, 'onFocus');
},
moveTo: function(x, y) {
this.x.setPos(x);
hs.getExpander(hs.upcoming).cancelLoading();
hs.upcoming = null;
}
+ if (!hs.fireEvent(this, 'onBeforeClose')) return;
this.isClosing = true;
if (this.slideshow && !hs.upcoming) this.slideshow.pause();
-
+
hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler);
-
+
try {
this.content.style.cursor = 'default';
this.changeSize(
},
createOverlay : function (o) {
- var el = o.overlayId,
+ var el = o.overlayId,
relToVP = (o.relativeTo == 'viewport' && !/panel$/.test(o.position));
if (typeof el == 'string') el = hs.getNode(el);
if (o.html) el = hs.createElement('div', { innerHTML: o.html });
if (!el || typeof el == 'string') return;
+ if (!hs.fireEvent(this, 'onCreateOverlay', { overlay: el })) return;
el.style.display = 'block';
- o.hsId = o.hsId || o.overlayId;
+ o.hsId = o.hsId || o.overlayId;
if (this.transitions[1] == 'crossfade' && this.reuseOverlay(o, el)) return;
this.genOverlayBox();
var width = o.width && /^[0-9]+(px|%)$/.test(o.width) ? o.width : 'auto';
true
);
if (relToVP) overlay.hsKey = this.key;
-
+
overlay.appendChild(el);
hs.extend(overlay, {
opacity: 1,
dur: (o.fade === 0 || o.fade === false || (o.fade == 2 && hs.ie)) ? 0 : 250
});
hs.extend(overlay, o);
-
-
+
+
if (this.gotOverlays) {
this.positionOverlay(overlay);
- if (!overlay.hideOnMouseOut || this.mouseIsOver)
+ if (!overlay.hideOnMouseOut || this.mouseIsOver)
hs.animate(overlay, { opacity: overlay.opacity }, overlay.dur);
}
hs.push(this.overlays, hs.idCounter - 1);
overlay.style.width = '100%';
} else
if (overlay.parentNode != this.overlayBox) this.overlayBox.appendChild(overlay);
- if (/left$/.test(p)) overlay.style.left = offX +'px';
-
- if (/center$/.test(p)) hs.setStyles (overlay, {
+ if (/left$/.test(p)) overlay.style.left = offX +'px';
+
+ if (/center$/.test(p)) hs.setStyles (overlay, {
left: '50%',
marginLeft: (offX - Math.round(overlay.offsetWidth / 2)) +'px'
- });
-
+ });
+
if (/right$/.test(p)) overlay.style.right = - offX +'px';
-
- if (/^leftpanel$/.test(p)) {
+
+ if (/^leftpanel$/.test(p)) {
hs.setStyles(overlay, {
right: '100%',
marginRight: this.x.cb +'px',
top: - this.y.cb +'px',
bottom: - this.y.cb +'px',
overflow: 'auto'
- });
+ });
this.x.p1 = overlay.offsetWidth;
-
+
} else if (/^rightpanel$/.test(p)) {
hs.setStyles(overlay, {
left: '100%',
if (relToVP && overlay.offsetHeight > parOff)
overlay.style.height = hs.ieLt7 ? parOff +'px' : '100%';
- if (/^top/.test(p)) overlay.style.top = offY +'px';
- if (/^middle/.test(p)) hs.setStyles (overlay, {
- top: '50%',
+ if (/^top/.test(p)) overlay.style.top = offY +'px';
+ if (/^middle/.test(p)) hs.setStyles (overlay, {
+ top: '50%',
marginTop: (offY - Math.round(overlay.offsetHeight / 2)) +'px'
- });
+ });
if (/^bottom/.test(p)) overlay.style.bottom = - offY +'px';
if (/^above$/.test(p)) {
hs.setStyles(overlay, {
width: 'auto'
});
this.y.p1 = overlay.offsetHeight;
-
+
} else if (/^below$/.test(p)) {
hs.setStyles(overlay, {
position: 'relative',
}
},
-getOverlays : function() {
+getOverlays : function() {
this.getInline(['heading', 'caption'], true);
this.getNumber();
+ if (this.caption) hs.fireEvent(this, 'onAfterGetCaption');
+ if (this.heading) hs.fireEvent(this, 'onAfterGetHeading');
if (this.heading && this.dragByHeading) this.heading.className += ' highslide-move';
if (hs.showCredits) this.writeCredits();
for (var i = 0; i < hs.overlays.length; i++) {
className: this.wrapperClassName
}, {
position : 'absolute',
- width: (this.x.size || (this.useBox ? this.width : null)
+ width: (this.x.size || (this.useBox ? this.width : null)
|| this.x.full) +'px',
height: (this.y.size || this.y.full) +'px',
visibility : 'hidden',
);
},
sizeOverlayBox : function(doWrapper, doPanels) {
- var overlayBox = this.overlayBox,
+ var overlayBox = this.overlayBox,
x = this.x,
y = this.y;
hs.setStyles( overlayBox, {
- width: x.size +'px',
+ width: x.size +'px',
height: y.size +'px'
});
if (doWrapper || doPanels) {
className: 'highslide-full-expand'
}
);
-
- this.createOverlay({
- overlayId: this.fullExpandLabel,
- position: hs.fullExpandPosition,
- hideOnMouseOut: true,
+ if (!hs.fireEvent(this, 'onCreateFullExpand')) return;
+
+ this.createOverlay({
+ overlayId: this.fullExpandLabel,
+ position: hs.fullExpandPosition,
+ hideOnMouseOut: true,
opacity: hs.fullExpandOpacity
});
},
doFullExpand : function () {
try {
+ if (!hs.fireEvent(this, 'onDoFullExpand')) return;
if (this.fullExpandLabel) hs.discardElement(this.fullExpandLabel);
-
+
this.focus();
var xSize = this.x.size,
- ySize = this.y.size;
- this.resizeTo(this.x.full, this.y.full);
-
- var xpos = this.x.pos - (this.x.size - xSize) / 2;
- if (xpos < hs.marginLeft) xpos = hs.marginLeft;
-
- var ypos = this.y.pos - (this.y.size - ySize) / 2;
- if (ypos < hs.marginTop) ypos = hs.marginTop;
-
- this.moveTo(xpos, ypos);
+ ySize = this.y.size;
+ this.resizeTo(this.x.full, this.y.full);
+
+ var xpos = this.x.pos - (this.x.size - xSize) / 2;
+ if (xpos < hs.marginLeft) xpos = hs.marginLeft;
+
+ var ypos = this.y.pos - (this.y.size - ySize) / 2;
+ if (ypos < hs.marginTop) ypos = hs.marginTop;
+
+ this.moveTo(xpos, ypos);
this.doShowHide('hidden');
-
+
} catch (e) {
this.error(e);
}
afterClose : function () {
this.a.className = this.a.className.replace('highslide-active-anchor', '');
-
+
this.doShowHide('visible');
if (this.outline && this.outlineWhileAnimating) this.outline.destroy();
-
+
hs.discardElement(this.wrapper);
this.destroyOverlays();
if (!hs.viewport.childNodes.length) hs.viewport.style.display = 'none';
-
+
if (this.dimmingOpacity) hs.undim(this.key);
- hs.expanders[this.key] = null;
+ hs.fireEvent(this, 'onAfterClose');
+ hs.expanders[this.key] = null;
hs.reOrder();
}
};
hs.Slideshow.prototype = {
getControls: function() {
- this.controls = hs.createElement('div', { innerHTML: hs.replaceLang(hs.skin.controls) },
+ this.controls = hs.createElement('div', { innerHTML: hs.replaceLang(hs.skin.controls) },
null, hs.container);
-
+
var buttons = ['play', 'pause', 'previous', 'next', 'move', 'full-expand', 'close'];
this.btn = {};
var pThis = this;
checkFirstAndLast: function() {
if (this.repeat || !this.controls) return;
var exp = hs.expanders[this.expKey],
- cur = exp.getAnchorIndex(),
+ cur = exp.getAnchorIndex(),
re = /disabled$/;
- if (cur == 0)
+ if (cur == 0)
this.disable('previous');
else if (re.test(this.btn.previous.getElementsByTagName('a')[0].className))
this.enable('previous');
this.btn.play.style.display = 'none';
this.btn.pause.style.display = '';
}
-
- this.autoplay = true;
+
+ this.autoplay = true;
if (!wait) hs.next(this.expKey);
},
pause: function() {
this.btn.pause.style.display = 'none';
this.btn.play.style.display = '';
}
-
+
clearTimeout(this.autoplay);
this.autoplay = null;
},
exp.createOverlay(options);
hs.setStyles(dom.parentNode, { overflow: 'hidden' });
};
-
- function scroll (delta) {
+
+ function scroll (delta) {
selectThumb(undefined, Math.round(delta * dom[isX ? 'offsetWidth' : 'offsetHeight'] * 0.7));
};
-
+
function selectThumb (i, scrollBy) {
if (i === undefined) for (var j = 0; j < group.length; j++) {
if (group[j] == hs.expanders[slideshow.expKey].a) {
mgnRight = 20;
if (scrollBy !== undefined) {
tblPos = curTblPos - scrollBy;
-
+
if (minTblPos > 0) minTblPos = 0;
if (tblPos > 0) tblPos = 0;
if (tblPos < minTblPos) tblPos = minTblPos;
-
-
+
+
} else {
for (var j = 0; j < as.length; j++) as[j].className = '';
active.className = 'highslide-active-anchor';
var activeLeft = i > 0 ? as[i - 1].parentNode[offsetLeft] : cell[offsetLeft],
- activeRight = cell[offsetLeft] + cell[offsetWidth] +
+ activeRight = cell[offsetLeft] + cell[offsetWidth] +
(as[i + 1] ? as[i + 1].parentNode[offsetWidth] : 0);
if (activeRight > overlayWidth - curTblPos) tblPos = overlayWidth - activeRight;
else if (activeLeft < -curTblPos) tblPos = -activeLeft;
hs.animate(marker, isX ? { left: markerPos } : { top: markerPos }, null, 'easeOutQuad');
scrollUp.style.display = tblPos < 0 ? 'block' : 'none';
scrollDown.style.display = (tblPos > minTblPos) ? 'block' : 'none';
-
+
};
-
+
// initialize
var group = hs.anchors.groups[hs.expanders[slideshow.expKey].slideshowGroup || 'none'],
if (!floatMode) {
scrollUp.onclick = function () { scroll(-1); };
scrollDown.onclick = function() { scroll(1); };
- hs.addEventListener(tbody, document.onmousewheel !== undefined ?
- 'mousewheel' : 'DOMMouseScroll', function(e) {
+ hs.addEventListener(tbody, document.onmousewheel !== undefined ?
+ 'mousewheel' : 'DOMMouseScroll', function(e) {
var delta = 0;
- e = e || window.event;
- if (e.wheelDelta) {
+ e = e || window.event;
+ if (e.wheelDelta) {
delta = e.wheelDelta/120;
if (hs.opera) delta = -delta;
- } else if (e.detail) {
+ } else if (e.detail) {
delta = -e.detail/3;
- }
- if (delta) scroll(-delta * 0.2);
+ }
+ if (delta) scroll(-delta * 0.2);
if (e.preventDefault) e.preventDefault();
e.returnValue = false;
});
}
-
+
return {
add: add,
selectThumb: selectThumb
// set handlers
hs.addEventListener(document, 'ready', function() {
if (hs.expandCursor || hs.dimmingOpacity) {
- var style = hs.createElement('style', { type: 'text/css' }, null,
- document.getElementsByTagName('HEAD')[0]),
+ var style = hs.createElement('style', { type: 'text/css' }, null,
+ document.getElementsByTagName('HEAD')[0]),
backCompat = document.compatMode == 'BackCompat';
-
-
+
+
function addRule(sel, dec) {
if (hs.ie && (hs.uaVersion < 9 || backCompat)) {
var last = document.styleSheets[document.styleSheets.length - 1];
return 'expression( ( ( ignoreMe = document.documentElement.'+ prop +
' ? document.documentElement.'+ prop +' : document.body.'+ prop +' ) ) + \'px\' );';
}
- if (hs.expandCursor) addRule ('.highslide img',
+ if (hs.expandCursor) addRule ('.highslide img',
'cursor: url('+ hs.graphicsDir + hs.expandCursor +'), pointer !important;');
addRule ('.highslide-viewport-size',
hs.ie && (hs.uaVersion < 7 || backCompat) ?