').find('li').each(function(i){
$(this).click(function(){
that.stopDiashow.call(that);
that.moveTo.call(that, 'goTo' + i);
return false;
});
});
}
}
},
getIndexNearPos: function(nPos){
var len = this.dims.length;
while (len--) {
if (nPos == this.dims[len]) {
return len;
}
else if(nPos > this.dims[len]) {
return len+1;
}
}
return false;
},
inView: function(atom){
var dir = this.options.direction,
stageDim = this.dims[1],
atomDim = atom[dir.outerD](),
curPos = this.hidingWrapper['scroll' + dir.dir](),
atomPos = atom[0]['offset'+ dir.dir]
;
if(curPos > atomPos || stageDim < atomDim + atomPos - curPos){
return atomPos;
}
return false;
},
scrollIntoView: function(atom){
var inView = this.inView(atom);
if(inView !== false){
this.moveTo(inView);
}
},
_setOption: function(k, v){
var o = this.options;
switch(k) {
case 'enableMwheel' :
if( !v && o.enableMwheel){
this.hidingWrapper.unmwheelIntent();
}
break;
case 'addSubPixel':
if(o.addSubPixel !== v) {
this.dims[0] -= o.addSubPixel;
o.addSubPixel = v;
this.dims[0] += o.addSubPixel;
this.update();
}
break;
}
$.Widget.prototype._setOption.apply(this, arguments);
},
startDiashow: function(){
var that = this;
clearInterval(this.diaTimer);
this.isDiashowStopped = false;
this.diaTimer = setInterval(function(){
((that.position === that.maxPos && that.options.type !== 'carousel') ? that.moveTo(0, false) : that.moveTo('-' + that.options.moveStep));
}, this.options.diashow);
this.propagate('diashowstarted');
},
stopDiashow: function(){
this.isDiashowStopped = true;
this.pauseDiashow();
this.propagate('diashowstopped');
},
pauseDiashow: function() {
clearInterval(this.diaTimer);
setTimeout(function(){
clearInterval(this.diaTimer);
}, 9);
this.isDiashowPaused = true;
this.propagate('diashowpaused');
},
updateOnImgLoad: function(){
var loadingSize = 0;
var that = this;
$('img', this.element).each(function(){
if(!this.complete){
loadingSize++;
$(this).one('load', function(){
loadingSize--;
if(!loadingSize){
that.update(true);
}
});
}
});
},
update: function(hard){
var that = this, jElm, o = this.options;
var subpixels = 0;
if (hard) {
this.dims = [0];
this.atomElem = $(o.atoms, this.element);
}
this.dims[1] = this.hidingWrapper.css({
overflow: 'hidden',
position: 'relative'
})[o.direction.dim]();
if(o.stageTeaser) {
this.atomElem.outerWidth(this.hidingWrapper.width());
}
var from = this.dims.length - 2;
for(var i = from, len = this.atomElem.length; i < len; i++){
jElm = $(this.atomElem[i]);
that.dims.push(that.dims[0]);
that.dims[0] += jElm[o.direction.outerD](true);
}
this.maxPos = (this.dims[0] - this.dims[1]);
if(o.addSubPixelPerTeaser){
subpixels = o.addSubPixelPerTeaser * this.atomElem.length;
}
var d = this.dims[0] + subpixels + o.addSubPixel;
if(o.dynamicDim) {
var newdim = d / $.testEm().emPx;
if(newdim % 1 > 0) {
d = parseInt(newdim, 10) +1;
} else {
d = newdim;
}
d += 'em';
}
this.moveElem.css(o.direction.dim, d);
if (o.pagination) {
this.createPagination(hard);
}
if(hard){
this.moveTo('goTo'+ this.atomPos, false, false);
}
this.updatePosition_Controls();
},
updatePosition_Controls: function(pos){
//calculate the curent position
var o = this.options;
var viewPos;
pos = (isNaN(pos)) ? parseInt(this.hidingWrapper[o.direction.scroll](), 10) : pos;
function changeState(elem, active){
var doo = (active) ?{
style: 'addClass'
} : {
style: 'removeClass'
};
return elem[doo.style](o.activeLinkClass);
}
if(pos !== this.position){
this.percentage = pos / (this.maxPos / 100);
this.oldPosition = this.position;
this.oldAtomPos = this.atomPos;
this.position = pos;
var num = this.getIndexNearPos(this.position);
num = (num) ? num - 2 : 0;
this.atomPos = num;
}
viewPos = this.atomPos;
this.percentage = pos / (this.maxPos / 100);
if (pos <= this.minPos && this.prevLink.hasClass(o.activeLinkClass)) {
o.linkFn.call(this.prevLink, 'hide', this.ui());
changeState(this.prevLink);
this.propagate('startreached');
} else if (pos > this.minPos && !this.prevLink.hasClass(o.activeLinkClass)) {
o.linkFn.call(this.prevLink, 'show', this.ui());
changeState(this.prevLink, true);
this.propagate('startleft');
}
if (pos >= this.maxPos && this.nextLink.hasClass(o.activeLinkClass)) {
o.linkFn.call(this.nextLink, 'hide', this.ui());
changeState(this.nextLink);
this.propagate('endreached');
} else if (pos < this.maxPos && !this.nextLink.hasClass(o.activeLinkClass)) {
o.linkFn.call(this.nextLink, 'show', this.ui());
changeState(this.nextLink, true);
this.propagate('endleft');
}
if (this.pagination) {
var oldActive = this.pagination.find('li')
.filter('.' + o.activePaginationClass)
.removeClass(o.activePaginationClass),
newActive
;
if(o.paginationType == 'view'){
if(this.maxPos == pos) {
viewPos = this.paginationSlides - 1;
} else {
viewPos = Math.round(pos / this.dims[1]);
}
}
newActive = oldActive.end().eq(viewPos).addClass(o.activePaginationClass);
if ($.isFunction(o.paginationFn)) {
o.paginationFn.call(oldActive, 'inactive');
o.paginationFn.call(newActive, 'active');
}
}
},
getNummericPosition: function(ePos){
var rel = false, num, lastDim = this.dims[this.dims.length - 1];
// handle Atom Step & goTo
if (ePos.indexOf('goTo') === 0) {
num = parseInt(/(\d+)$/.exec(ePos)[0], 10) + 2;
ePos = this.dims[num];
}
else if (ePos.indexOf('centerTo') === 0) {
num = parseInt(/(\d+)$/.exec(ePos)[0], 10) + 2;
ePos = this.dims[num] - (this.dims[1] / 2) + (this.atomElem.filter(":eq("+num+")")[this.options.direction.outerD]() / 2);
}
else if (ePos.indexOf('stageWidth') === 1) {
var that = this;
rel = ePos.slice(0, 1);
num = this.dims[1];
var amount = (function() {
var i = 2;
for(i; i < that.dims.length; i++) {
if(that.dims[i] > that.dims[1]) {
break;
}
}
return i-3; // minus 1 for the teaser that we are actually too far, and minus 2 for the first entries of dims.. makes 3
})();
if(this.atomPos === 0 && rel === '+') { return; }
ePos = rel === '+' ? (this.atomPos - amount + 2) < 2 ? 2 : (this.atomPos - amount+2) : (this.atomPos + amount + 2);
ePos = this.dims[ePos];
}
else
if (ePos == '-atom' || ePos == '-atom1') {
num = this.atomPos + 3;
ePos = (this.dims[num] || this.dims[num] === 0) ? this.dims[num] : lastDim;
}
else
if (ePos == '+atom' || ePos == '+atom1') {
ePos = (this.atomPos) ? this.dims[this.atomPos + 1] : 0;
}
else
if (ePos.indexOf('atom') == 1) {
num = parseInt(/(\d+)$/.exec(ePos)[0], 10);
if (ePos.indexOf('-') === 0) {
num += 2;
if (this.dims[this.atomPos + num]) {
ePos = this.dims[this.atomPos + num];
}
else {
ePos = lastDim;
}
}
else {
num -= 2;
var aLen = this.atomPos - num;
if (aLen > 1 && this.dims[this.atomPos - num]) {
ePos = this.dims[this.atomPos - num];
}
else {
ePos = 0;
}
}
// handle: +/-Number
}
else
if (ePos.indexOf('+') === 0 || ePos.indexOf('-') === 0) {
rel = ePos.slice(0, 1);
ePos = parseInt(ePos.slice(1), 10);
ePos = (rel == '-') ? this.position + ePos : this.position - ePos;
}
else {
// handle Percentage
var per = /(\d+)%$/.exec(ePos);
if (per && per[1]) {
ePos = this.maxPos / 100 * parseFloat(ePos);
}
}
if(this.options.stickyFirstLast){
if((ePos - this.maxPos) * -1 < this.atomElem.filter(':last')[this.options.direction.outerD]() && ePos > this.position){
ePos = this.maxPos;
} else if(ePos < this.atomElem[this.options.direction.outerD]() && ePos < this.position){
ePos = 0;
}
}
return ePos;
},
readjustPosition: function(hard){
var scroll = this.options.direction.scroll;
this.hidingWrapper[scroll](this.position);
if(hard){
this.hidingWrapper[scroll == 'scrollTop' ? 'scrollLeft' : 'scrollTop'](0);
}
},
moveTo: function(pos, anim, animOp, _initForce){
pos = (typeof pos === 'string' || isNaN(pos)) ? this.getNummericPosition(pos) : pos;
pos = (pos <= 0) ? 0 : (pos >= this.maxPos) ? this.maxPos : pos;
if (pos === this.position) {
return false;
}
var o = this.options, scroll = o.direction.scroll;
this.updatePosition_Controls(pos);
this.propagate('start', this.oldPosition);
anim = (typeof anim == 'undefined') ? o.animate : anim;
if (anim) {
//dirty break recursion
animOp = animOp ||
{};
animOp = $.extend({}, o.animateOptions, {
slide: this
}, animOp);
var animCss = (scroll == 'scrollTop') ?
{scrollerTop: pos} :
{scrollerLeft: pos}
;
this.hidingWrapper.stop().animate(animCss, animOp);
}
else {
this.hidingWrapper.stop()[scroll](pos);
if(_initForce){
var that = this;
setTimeout(function(){
if(that.hidingWrapper[scroll]() != pos){
that.hidingWrapper[scroll](pos);
}
}, 9);
}
this.propagate('end');
}
},
ui: function(){
return {
instance: this,
options: this.options,
pos: this.position,
percentPos: this.percentage,
oldIndex: this.oldAtomPos,
newIndex: this.atomPos,
size: this.dims.length - 2
};
},
propagate: function(n, pos){
var fx = {};
if(n == 'slide'){
fx = pos;
pos = fx.now;
}
var args = (pos || pos === 0) ? $.extend(this.ui(), {
'pos': pos,
'fx': fx,
percentPos: pos / (this.maxPos / 100)
}) : this.ui();
if(n === 'start'){
this.isSliding = true;
} else if(n === 'end'){
this.isSliding = false;
}
if(n == 'slide'){
this.element.triggerHandler("scroller" + n, [args]);
} else {
this.element.trigger("scroller" + n, [args]);
}
if(this.options[n]){
this.options[n].call(this.element[0], {type: 'scroller' + n}, args);
}
}
});
$.each({scrollerLeft: 'scrollLeft', scrollerTop: 'scrollTop'}, function(name, prop){
$.fx.step[name] = function(fx){
if (fx.now || fx.now === 0) {
var scroller = fx.options.slide;
if (scroller) {
if(!fx.scrollerInit){
fx.scrollerInit = true;
fx.start = scroller.hidingWrapper[prop]();
fx.now = fx.start;
}
scroller.hidingWrapper[prop](fx.now);
scroller.propagate('slide', fx);
}
}
};
});
})(jQuery);
(function($){
function numsort (a, b) {
return a - b;
}
var uniqueID = 0;
/*-
* tabtree
[ widget (ui) ]
* Generates a Tab Control UI or an accordion
* Depending on the Options you can create a classic tab Control Interface,
* where you click on a tab to show a panel, or you can create an accordion.
# ui.a11y.ext.js
> Options
- buttonSel (string) <'a'> the selector for the button
- panelSel (boolean|string) the selector for the panel. if false, the panel will be identified by href of the button @see buttonSel
- focusOnExpand (boolean) states if the panel should be focused on expand
- focusSel (boolean|string) a possible selector for the element to be focused @see focusOnExpand
- createPanelWrapper (boolean) creates a div around the panel if true
- toggleButton (boolean) if false a button can only open a panel, if true it can also close them
- multiSelectable (boolean) if true, more than just one panel can be opened at a time
- createPanelTabRelation (boolean) if true, the panels are labelled by the corresponding button
- selectEvents (string) <'ariaclick'> the event which opens (or closes) a panel
- bindStyle (string) <'bind'> ['bind','live'] the way the event should be listened to
- bindContext (boolean|string|HTMLNode) the context for the eventBinding (only relevant for live) @see bindStyle
- defaultSelected (number) <0> the index of the default selected panel
- slideShow (boolean) if true, the tabs are switched automatically
- restartSlideShow (boolean) if true the (possible) slideshow restarts
- activeButtonClass (string) <'js-selected'> the class the tab gets if selected
- activePanelClass (string) <'js-expanded'> the class the panel gets if selected
- handleDisplay (boolean|string) [true,false,'initial'] should the display be handled by the widget, initial means handling it only on init
- hideStyle (string) <'display'> ['visibility','display'] the way the panels are hidden and shown
- interceptClick (boolean) if true clicks on the tab are being prevented
- addAria (boolean) if true aria-attributes are added to the tab and panel
> Properties
- buttons (jQuery) a jQuery collection of the tabs
- panels (jQuery) a jQuery collection of the panels
- selectedIndexes (Array) the indices of the open tabs/panels
> Events
- init (object) @see function-ui
- expand (object) @see function-ui
-- button (jQuery) the button that gets opened
-- panel (jQuery) the panel that gets opened
-- collapseElements (object) only exists if not multiSelectable
--- button (jQuery) the button that gets closed
--- panel (jQuery) the panel that gets closed
- expandinit (object) @see function-ui
-- button (jQuery) the button that gets opened
-- panel (jQuery) the panel that gets opened
-- collapseElements (object) only exists if not multiSelectable
--- button (jQuery) the button that gets closed
--- panel (jQuery) the panel that gets closed
- collapse (object) @see function-ui
-- button (jQuery) the button that gets closed
-- panel (jQuery) the panel that gets closed
-- expandElements (object) only exists if not multiSelectable
--- button (jQuery) the button that gets opened
--- panel (jQuery) the panel that gets opened
- collapseinit (object) @see function-ui
-- button (jQuery) the button that gets closed
-- panel (jQuery) the panel that gets closed
-- expandElements (object) only exists if not multiSelectable
--- button (jQuery) the button that gets opened
--- panel (jQuery) the panel that gets opened
- beforeexpand (object) @see function-ui
-- button (jQuery) the button that gets opened
-- panel (jQuery) the panel that gets opened
-- collapseElements (object) only exists if not multiSelectable
--- button (jQuery) the button that gets closed
--- panel (jQuery) the panel that gets closed
> Usage
| $(elm).tabtree( options );
-*/
$.widget('ui.tabtree', {
options: {
buttonSel: 'a',
panelSel: false,
focusOnExpand: true,
focusSel: true,
createPanelwrapper: false,
toggleButton: false,
multiSelectable: false,
createPanelTabRelation: false,
selectEvents: 'ariaclick',
bindStyle: 'bind',
bindContext: false,
defaultSelected: 0,
slideShow: false,
restartSlideShow: true,
activeButtonClass: 'js-selected',
activePanelClass: 'js-expanded',
handleDisplay: true, //initial | true | false
hideStyle: 'display',
interceptClick: true,
addAria: true
},
/*-
* _createPanelAPI
[ function (private) ]
* creates the data-objects on the elements
* tabtreepanel on the panel and tabtreebutton on the button
> Parameter
- button (jQuery) a button to create an API on
- panel (jQuery) a panel to create an API on
-*/
_createPanelAPI: function(button, panel){
var that = this;
if(!panel[0]){
console.log("kein valider tabtree button", button);
}
$.data(panel[0], 'tabtreepanel', {
instance: this,
button: button,
expand: function(e){
that.expand(button, e);
},
collapse: function(e){
that.collapse(button, e);
}
});
$.data(button[0], 'tabtreebutton', {
instance: this,
panel: panel,
expand: function(e){
that.expand(button, e);
},
collapse: function(e){
that.collapse(button, e);
}
});
},
/*-
* _create
[ function (private) ]
* creates the widget
-*/
_create: function(){
this._getMarkupOptions();
var that = this,
o = this.options,
elem = this.element,
isSelectedArray = o.defaultSelected.length,
isHTMLSelected
;
this.selectedIndexes = [];
this.slideShowtimer = null;
this.buttons = $(o.buttonSel, elem[0]);
this.panels = (o.panelSel) ?
$(o.panelSel, this.element[0]).each(function(i){
var button = $(that.buttons[i]),
panel = $(this)
;
button.controlsThis(panel);
if(o.createPanelTabRelation){
panel.labelWith(button);
}
that._createPanelAPI(button, panel);
}) :
this.buttons.map(function(){
var button = $(this),
idRef = button.getHrefHash(),
panel
;
if(!idRef || idRef == '#'){
console.log('kein valider tabtree button: ', button);
}
panel = $(idRef);
if(o.createPanelTabRelation){
panel.labelWith(button);
}
button.attr({'aria-controls': idRef.replace('#', '')});
that._createPanelAPI(button, panel);
return panel[0];
});
this.panels = $($.unique(this.panels.get()));
if(o.createPanelwrapper){
this.panels.wrap('');
}
//get defaultselected
isHTMLSelected = !!this.buttons.filter('.'+ o.activeButtonClass)[0];
this.buttons
.each(function(i){
var initAction;
if(isHTMLSelected){
initAction = ($(this).hasClass(o.activeButtonClass)) ? 'expand' : 'collapse';
} else if(isSelectedArray){
initAction = ($.inArray(i, o.defaultSelected) !== -1) ? 'expand' : 'collapse';
} else {
initAction = (o.defaultSelected === i) ? 'expand' : 'collapse';
}
that[initAction].call(that, this, {type: 'init'});
})
;
if(o.addAria){
this.buttons.attr({role: 'button'});
if (this.buttons[0] && $.nodeName(this.buttons[0], 'a')) {
this.buttons.each(function(){
var jElm = $(this);
this.setAttribute('data-href', jElm.attr('href'));
if($.support.waiAria){
jElm.removeAttr('href');
}
});
}
}
this.panels.attr({role: 'group'}).addClass('a11y-js-overflow');
uniqueID++;
if(o.bindStyle === 'live'){
this.buttons.context = (o.bindContext) ? $(o.bindContext, this.element)[0] : this.element[0];
this.buttons.selector = '.tabtree-button_'+ uniqueID;
this.buttons.addClass('tabtree-button_'+ uniqueID);
if(!this.buttons.context) {
console.log(o.bindContext +' not found in tab-module');
}
}
if(o.selectEvents){
this.buttons
[o.bindStyle](o.selectEvents, function(e){
var action = (o.toggleButton) ?
'toggle' :
'expand'
;
clearInterval(that.slideShowtimer);
that[action].call(that, this, e);
return false;
})
;
}
//focus panels onclick if no click event is added
if(o.interceptClick && (!o.selectEvents || o.selectEvents.indexOf('click') == -1)){
this.buttons[o.bindStyle]('click', function(){
clearInterval(that.slideShowtimer);
if(o.focusOnExpand){
that.focusPanel.call(that, $('#'+$(this).attr('aria-controls')), 1);
}
return false;
});
}
if(o.slideShow && isFinite(o.slideShow)){
this.slideShowtimer = setInterval(function(){
that.showPrevNext.call(that, 1);
}, o.slideShow);
this.element.inOut(
function(){
clearInterval(that.slideShowtimer);
}, function(){
if(o.restartSlideShow){
clearInterval(that.slideShowtimer);
that.slideShowtimer = setInterval(function(){
that.showPrevNext.call(that, 1);
}, o.slideShow);
}
});
}
if($.fn.lazyImgLoader){
this.element.lazyImgLoader({e: 'tabtreeexpand', visible: this.panels.filter('.'+o.activePanelClass)});
}
this._trigger('init', {type: 'init'}, this.ui());
},
/*-
* getPrevNext
[ function (public) ]
* gets the next panel and button in the specified direction
* reiterates over the array (e.g. selects last if current is first and direction is -1)
> Parameter
- dir (number) [-1, 1] reflects the change of the index
= (object) the button and the panel found
== button (jQuery) the button found in the specified direction
== panel (jQuery) the panel found in the specified direction
-*/
getPrevNext: function(dir){
var index = this.buttons
.index(this.buttons.filter('.'+ this.options.activeButtonClass)[0]) + dir
;
if(index < 0){
index = this.buttons.length - 1;
} else if(index >= this.buttons.length){
index = 0;
}
return {button: this.buttons.get(index), panel: this.panels.get(index)};
},
/*-
*showPrevNext
[ function (public) ]
* shows the next panel and button in the specified direction @see getPrevNext
> Parameter
- dir (number) [-1, 1] reflects the change of the index
= (object) the button and the panel found
== button (jQuery) the button found in the specified direction
== panel (jQuery) the panel found in the specified direction
-*/
showPrevNext: function(dir){
var data = this.getPrevNext(dir);
this.expand(data.button, {type: 'show-'+ dir});
},
/*-
* toggle
[ function (public) ]
* toggles the state of the button
> Parameter
- button (jQuery) the button to toggle
- e (Event) the original Event that caused the action
-*/
toggle: function(button, e){
var action = ($(button).hasClass(this.options.activeButtonClass)) ?
'collapse' : 'expand';
this[action](button, e);
},
/*-
* selectIndexes
[ function (public) ]
* sets the selectedIndexes to the specified values
> Parameter
- indexes (number|array) the indices of open tabs
- e (Event) the original Event that caused the action
-*/
selectIndexes: function(indexes, e){
if(!$.isArray(indexes)){
indexes = [indexes];
}
var that = this;
$.each(indexes, function(i, index){
var button = that.buttons.get(index);
if(button){
that.expand(button, e);
}
});
$.each(this.selectedIndexes, function(i, index){
if($.inArray(index, indexes) == -1 && $.inArray(''+ index, indexes) == -1){
var button = that.buttons.get(index);
if(button){
that.collapse(button, e);
}
}
});
},
/*-
* collapse
[ function (public) ]
* collapses the specified panel
> Parameter
- button (jQuery) the tab which should be closed
- e (Event) the Event that caused the action
- _panel* (jQuery) the panel which should be closed
- _opener* (object) if not multiSelectable the elements which should be opened
-- panel (jQuery) the panel to be opened
-- button (jQuery) the button to be opened
= (object) the object of closed panels/buttons
== button (jQuery) the button that gets closed
== panel (jQuery) the panel that gets closed
== expandElements (object) only exists if not multiSelectable
=== button (jQuery) the button that gets opened
=== panel (jQuery) the panel that gets opened
-*/
collapse: function(button, e, _panel, _opener){
e = e || {type: 'collapse'};
button = $(button);
//if button/panel is already inactive
if(!button.hasClass(this.options.activeButtonClass) && e.type != 'init'){
return false;
}
var panel = _panel || this.getPanel(button),
buttons = this.getButtons(panel),
type = (e.type == 'init') ?
'collapseinit' :
'collapse',
that = this,
o = this.options,
uiObj = {
button: buttons,
panel: panel
}
;
if(!o.multiSelectable){
uiObj.expandElements = _opener ||
{
panel: $([]),
button: $([])
}
;
}
this.removeIndex(panel);
if(this._trigger(type, e, $.extend({}, this.ui(), uiObj)) === false){
this.addIndex(panel);
return undefined;
}
this.setState(buttons, uiObj.panel, 'inactive');
if(o.handleDisplay === true || (e.type == 'init' && o.handleDisplay)){
if(o.hideStyle === 'visibility'){
uiObj.panel
.parent()
.css({overflow: 'hidden', height: 0})
.end()
.css({visibility: 'hidden'})
;
} else {
uiObj.panel.hide();
}
}
uiObj.button = button;
$.ui.SR.update();
return uiObj;
},
/*-
* addIndex
[function (public)]
* adds an index to selectIndexes @see selectIndexes
> Parameter
- index (number) the index to add
-*/
addIndex: function(index){
if(!isFinite(index) && index.jquery){
index = this.panels.index(index[0]);
}
if($.inArray(index, this.selectedIndexes) === -1){
this.selectedIndexes.push(index);
this.selectedIndexes.sort(numsort);
}
},
/*-
* removeIndex
[function (public)]
* removes an index to selectIndexes @see selectIndexes
> Parameter
- index (number) the index to remove
-*/
removeIndex: function(index){
if(!isFinite(index) && index.jquery){
index = this.panels.index(index[0]);
}
this.selectedIndexes = $.grep(this.selectedIndexes, function(num, i){
return (index !== num);
});
},
/*-
* expand
[ function (public) ]
* expands the specified panel
> Parameter
- button (jQuery) the tab which should be expanded
- e (Event) the Event that caused the action
-*/
expand: function(button, e){
e = e ||
{type: 'expand'};
button = $(button);
//if button/panel is already active
if(e.type != 'init' && button.hasClass(this.options.activeButtonClass)){
return false;
}
var type = (e.type == 'init') ?
'expandinit' :
'expand',
that = this,
o = this.options,
uiObj = {},
panel = this.getPanel(button),
buttons = this.getButtons(panel),
collapseButton = this.buttons.filter('.'+ o.activeButtonClass),
posStyle,
panelWrapper
;
uiObj.button = buttons;
uiObj.panel = panel;
if(!o.multiSelectable){
uiObj.collapseElements = {
button: collapseButton,
panel: this.getPanel(collapseButton)
};
}
if(e.type != 'init' && this._trigger('beforeexpand', e, $.extend({}, this.ui(), uiObj)) === false){return;}
this.addIndex(panel);
//collapse all other panels, if not multiSelectable
if(e.type != 'init' && !o.multiSelectable){
collapseButton.each(function(){
that.collapse.call(that, this, e, false, {button: buttons, panel: panel});
});
}
this.setState(buttons, panel, 'active');
if(o.handleDisplay === true || (e.type == 'init' && o.handleDisplay == 'initial')){
if(o.hideStyle === 'visibility'){
panel
.parent()
.css({overflow: '', height: ''})
.end()
.css({visibility: ''})
;
} else {
panel.show();
}
}
$.ui.SR.update();
if(o.addToHistory && e.type !== 'init' && e.type !== 'hashHistoryChange'){
$.hashHistory.add('tab-'+ panel.getID());
}
this._trigger(type, e, $.extend({}, this.ui(), uiObj));
if(/click|hashHistoryChange/.test(e.type) && o.focusOnExpand){
that.focusPanel(panel);
}
return undefined;
},
/*-
* collapseAll
[function (public) ]
* collapses all open Panels
> Parameter
- e (Event) the Event that caused the action
-*/
collapseAll: function(e){
var that = this;
$.each(this.selectedIndexes, function(i, index){
that.collapse.call(that, that.buttons[index], e);
});
},
/*-
* getButtons
[ function (public) ]
* gets the button to the specified Panels
> Parameter
- panel (jQuery) the panel we want the button from
= (jQuery) the button found
-*/
getButtons: function(panel){
return this.buttons.filter('[aria-controls='+ panel.getID() +']');
},
/*-
* getPanel
[ function (public) ]
* gets the panel to the specified button
> Parameter
- button (jQuery) the button we want the panel from
= (jQuery) the panel found
-*/
getPanel: function(button){
return this.panels.filter('#'+ button.attr('aria-controls') );
},
/*-
* setState
[ function (public) ]
* sets the button and panel to the specified state
> Parameter
- button (jQuery) the button to set the state on
- panel (jQuery) the panel to set the state on
- state (string) ['active', 'inactive'] the state to set
-*/
setState: function(button, panel, state){
var o = this.options,
set = (state == 'active') ?
{
c: 'addClass',
index: '-1',
aria: 'true'
} :
{
c: 'removeClass',
index: '0',
aria: 'false'
}
;
if((!o.toggleButton)){
button.attr({'tabindex': set.index, 'aria-disabled': set.aria})[set.c]('ui-disabled');
} else {
button.attr({'tabindex': '0'});
}
button[set.c](o.activeButtonClass).attr('aria-expanded', set.aria);
panel[set.c](o.activePanelClass).attr('aria-expanded', set.aria);
},
/*-
* focusPanel
[ function (public) ]
* focuses the specified panel
> Parameter
- panel (jQuery) the panel to focus
-*/
focusPanel: function(panel){
var o = this.options,
focusElem = (o.focusSel === true || !o.focusSel) ? panel.firstExpOf('focusPoint') : $(o.focusSel, panel)
;
focusElem.setFocus({context: (panel[0].parentNode || {}).parentNode});
return undefined;
},
/*-
* ui
[ function (public) ]
* returns the important things of the widget
= (object) the UI
== instance (object) the instance of this widget
== panels (jQuery) a jQuery collection of all panels
== buttons (jQuery) a jQuery collection of all buttonSel
== selectedIndexes (Array) an Array containing selected Indexes
-*/
ui: function(){
return {
instance: this,
panels: this.panels,
buttons: this.buttons,
selectedIndexes: this.selectedIndexes
};
}
});
})(jQuery);/**
* @author alexander.farkas
*/
(function($){
var uID = new Date().getTime();
$.fn.embedSWF = function(o){
var ret = [],
reservedParams = ['width', 'height', 'expressInstall', 'version'];
o = $.extend(true, {}, $.fn.embedSWF.defaults, o);
function getId(jElem){
var id = jElem.attr('id');
if(!id){
id = 'id-' + String(uID++);
jElem.attr({id: id});
}
return id;
}
function strToObj(str){
var obj = {};
if(str){
str = str.replace(/^\?/,'').replace(/&/g, '&').split(/&/);
$.each(str, function(i, param){
queryPair = param.split(/\=/);
obj[decodeURIComponent(queryPair[0])] = (queryPair[1]) ?
decodeURIComponent(queryPair[1]) :
'';
});
}
return obj;
}
this.each(function(){
var jElem = $(this),
classes = this.className,
linkSrc = $('a', this).filter('[href*=".swf"], [href*=".flv"]'),
id = getId(jElem),
src = linkSrc.attr('href').split('?'),
params = strToObj(src[1]),
width = params.width ||
jElem.width(),
height = params.height ||
jElem.height(),
version = params.version ||
o.version,
expressInstall,
flash;
if(params.expressInstall == 'false'){
expressInstall = false;
} else if(!params.expressInstall){
expressInstall = o.expressInstall;
} else {
expressInstall = params.expressInstall;
}
$.each(reservedParams, function(i, reservedParam){
delete params[reservedParam];
});
$.extend({}, o.parameters, params);
swfobject.embedSWF(src[0], id, width, height, version, expressInstall, false, params);
flash = document.getElementById(id);
flash.className = classes;
ret.push(flash);
});
return this.pushStack(ret);
};
$.fn.embedSWF.defaults = {
expressInstall: false,
version: "9.0.124",
parameters: {}
};
})(jQuery);
/*! SWFObject v2.2
is released under the MIT License
*/
var swfobject = function() {
var UNDEF = "undefined",
OBJECT = "object",
SHOCKWAVE_FLASH = "Shockwave Flash",
SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
FLASH_MIME_TYPE = "application/x-shockwave-flash",
EXPRESS_INSTALL_ID = "SWFObjectExprInst",
ON_READY_STATE_CHANGE = "onreadystatechange",
win = window,
doc = document,
nav = navigator,
plugin = false,
domLoadFnArr = [main],
regObjArr = [],
objIdArr = [],
listenersArr = [],
storedAltContent,
storedAltContentId,
storedCallbackFn,
storedCallbackObj,
isDomLoaded = false,
isExpressInstallActive = false,
dynamicStylesheet,
dynamicStylesheetMedia,
autoHideShow = true,
/* Centralized function for browser feature detection
- User agent string detection is only used when no good alternative is possible
- Is executed directly for optimal performance
*/
ua = function() {
var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
u = nav.userAgent.toLowerCase(),
p = nav.platform.toLowerCase(),
windows = p ? /win/.test(p) : /win/.test(u),
mac = p ? /mac/.test(p) : /mac/.test(u),
webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
playerVersion = [0,0,0],
d = null;
if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
d = nav.plugins[SHOCKWAVE_FLASH].description;
if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
plugin = true;
ie = false; // cascaded feature detection for Internet Explorer
d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
}
}
else if (typeof win.ActiveXObject != UNDEF) {
try {
var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
if (a) { // a will return null when ActiveX is disabled
d = a.GetVariable("$version");
if (d) {
ie = true; // cascaded feature detection for Internet Explorer
d = d.split(" ")[1].split(",");
playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
}
}
}
catch(e) {}
}
return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
}(),
/* Cross-browser onDomLoad
- Will fire an event as soon as the DOM of a web page is loaded
- Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- Regular onload serves as fallback
*/
onDomLoad = function() {
if (!ua.w3) { return; }
if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
callDomLoadFunctions();
}
if (!isDomLoaded) {
if (typeof doc.addEventListener != UNDEF) {
doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
}
if (ua.ie && ua.win) {
doc.attachEvent(ON_READY_STATE_CHANGE, function() {
if (doc.readyState == "complete") {
doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
callDomLoadFunctions();
}
});
if (win == top) { // if not inside an iframe
(function(){
if (isDomLoaded) { return; }
try {
doc.documentElement.doScroll("left");
}
catch(e) {
setTimeout(arguments.callee, 0);
return;
}
callDomLoadFunctions();
})();
}
}
if (ua.wk) {
(function(){
if (isDomLoaded) { return; }
if (!/loaded|complete/.test(doc.readyState)) {
setTimeout(arguments.callee, 0);
return;
}
callDomLoadFunctions();
})();
}
addLoadEvent(callDomLoadFunctions);
}
}();
function callDomLoadFunctions() {
if (isDomLoaded) { return; }
try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
t.parentNode.removeChild(t);
}
catch (e) { return; }
isDomLoaded = true;
var dl = domLoadFnArr.length;
for (var i = 0; i < dl; i++) {
domLoadFnArr[i]();
}
}
function addDomLoadEvent(fn) {
if (isDomLoaded) {
fn();
}
else {
domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
}
}
/* Cross-browser onload
- Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- Will fire an event as soon as a web page including all of its assets are loaded
*/
function addLoadEvent(fn) {
if (typeof win.addEventListener != UNDEF) {
win.addEventListener("load", fn, false);
}
else if (typeof doc.addEventListener != UNDEF) {
doc.addEventListener("load", fn, false);
}
else if (typeof win.attachEvent != UNDEF) {
addListener(win, "onload", fn);
}
else if (typeof win.onload == "function") {
var fnOld = win.onload;
win.onload = function() {
fnOld();
fn();
};
}
else {
win.onload = fn;
}
}
/* Main function
- Will preferably execute onDomLoad, otherwise onload (as a fallback)
*/
function main() {
if (plugin) {
testPlayerVersion();
}
else {
matchVersions();
}
}
/* Detect the Flash Player version for non-Internet Explorer browsers
- Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
a. Both release and build numbers can be detected
b. Avoid wrong descriptions by corrupt installers provided by Adobe
c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
*/
function testPlayerVersion() {
var b = doc.getElementsByTagName("body")[0];
var o = createElement(OBJECT);
o.setAttribute("type", FLASH_MIME_TYPE);
var t = b.appendChild(o);
if (t) {
var counter = 0;
(function(){
if (typeof t.GetVariable != UNDEF) {
var d = t.GetVariable("$version");
if (d) {
d = d.split(" ")[1].split(",");
ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
}
}
else if (counter < 10) {
counter++;
setTimeout(arguments.callee, 10);
return;
}
b.removeChild(o);
t = null;
matchVersions();
})();
}
else {
matchVersions();
}
}
/* Perform Flash Player and SWF version matching; static publishing only
*/
function matchVersions() {
var rl = regObjArr.length;
if (rl > 0) {
for (var i = 0; i < rl; i++) { // for each registered object element
var id = regObjArr[i].id;
var cb = regObjArr[i].callbackFn;
var cbObj = {success:false, id:id};
if (ua.pv[0] > 0) {
var obj = getElementById(id);
if (obj) {
if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
setVisibility(id, true);
if (cb) {
cbObj.success = true;
cbObj.ref = getObjectById(id);
cb(cbObj);
}
}
else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
var att = {};
att.data = regObjArr[i].expressInstall;
att.width = obj.getAttribute("width") || "0";
att.height = obj.getAttribute("height") || "0";
if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
// parse HTML object param element's name-value pairs
var par = {};
var p = obj.getElementsByTagName("param");
var pl = p.length;
for (var j = 0; j < pl; j++) {
if (p[j].getAttribute("name").toLowerCase() != "movie") {
par[p[j].getAttribute("name")] = p[j].getAttribute("value");
}
}
showExpressInstall(att, par, id, cb);
}
else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
displayAltContent(obj);
if (cb) { cb(cbObj); }
}
}
}
else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
setVisibility(id, true);
if (cb) {
var o = getObjectById(id); // test whether there is an HTML object element or not
if (o && typeof o.SetVariable != UNDEF) {
cbObj.success = true;
cbObj.ref = o;
}
cb(cbObj);
}
}
}
}
}
function getObjectById(objectIdStr) {
var r = null;
var o = getElementById(objectIdStr);
if (o && o.nodeName == "OBJECT") {
if (typeof o.SetVariable != UNDEF) {
r = o;
}
else {
var n = o.getElementsByTagName(OBJECT)[0];
if (n) {
r = n;
}
}
}
return r;
}
/* Requirements for Adobe Express Install
- only one instance can be active at a time
- fp 6.0.65 or higher
- Win/Mac OS only
- no Webkit engines older than version 312
*/
function canExpressInstall() {
return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
}
/* Show the Adobe Express Install dialog
- Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
*/
function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
isExpressInstallActive = true;
storedCallbackFn = callbackFn || null;
storedCallbackObj = {success:false, id:replaceElemIdStr};
var obj = getElementById(replaceElemIdStr);
if (obj) {
if (obj.nodeName == "OBJECT") { // static publishing
storedAltContent = abstractAltContent(obj);
storedAltContentId = null;
}
else { // dynamic publishing
storedAltContent = obj;
storedAltContentId = replaceElemIdStr;
}
att.id = EXPRESS_INSTALL_ID;
if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
fv = "MMredirectURL=" + win.location.toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
if (typeof par.flashvars != UNDEF) {
par.flashvars += "&" + fv;
}
else {
par.flashvars = fv;
}
// IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
// because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
if (ua.ie && ua.win && obj.readyState != 4) {
var newObj = createElement("div");
replaceElemIdStr += "SWFObjectNew";
newObj.setAttribute("id", replaceElemIdStr);
obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
obj.style.display = "none";
(function(){
if (obj.readyState == 4) {
obj.parentNode.removeChild(obj);
}
else {
setTimeout(arguments.callee, 10);
}
})();
}
createSWF(att, par, replaceElemIdStr);
}
}
/* Functions to abstract and display alternative content
*/
function displayAltContent(obj) {
if (ua.ie && ua.win && obj.readyState != 4) {
// IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
// because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
var el = createElement("div");
obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
el.parentNode.replaceChild(abstractAltContent(obj), el);
obj.style.display = "none";
(function(){
if (obj.readyState == 4) {
obj.parentNode.removeChild(obj);
}
else {
setTimeout(arguments.callee, 10);
}
})();
}
else {
obj.parentNode.replaceChild(abstractAltContent(obj), obj);
}
}
function abstractAltContent(obj) {
var ac = createElement("div");
if (ua.win && ua.ie) {
ac.innerHTML = obj.innerHTML;
}
else {
var nestedObj = obj.getElementsByTagName(OBJECT)[0];
if (nestedObj) {
var c = nestedObj.childNodes;
if (c) {
var cl = c.length;
for (var i = 0; i < cl; i++) {
if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
ac.appendChild(c[i].cloneNode(true));
}
}
}
}
}
return ac;
}
/* Cross-browser dynamic SWF creation
*/
function createSWF(attObj, parObj, id) {
var r, el = getElementById(id);
if (ua.wk && ua.wk < 312) { return r; }
if (el) {
if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
attObj.id = id;
}
if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
var att = "";
for (var i in attObj) {
if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
if (i.toLowerCase() == "data") {
parObj.movie = attObj[i];
}
else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
att += ' class="' + attObj[i] + '"';
}
else if (i.toLowerCase() != "classid") {
att += ' ' + i + '="' + attObj[i] + '"';
}
}
}
var par = "";
for (var j in parObj) {
if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
par += '';
}
}
el.outerHTML = '';
objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
r = getElementById(attObj.id);
}
else { // well-behaving browsers
var o = createElement(OBJECT);
o.setAttribute("type", FLASH_MIME_TYPE);
for (var m in attObj) {
if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
o.setAttribute("class", attObj[m]);
}
else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
o.setAttribute(m, attObj[m]);
}
}
}
for (var n in parObj) {
if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
createObjParam(o, n, parObj[n]);
}
}
el.parentNode.replaceChild(o, el);
r = o;
}
}
return r;
}
function createObjParam(el, pName, pValue) {
var p = createElement("param");
p.setAttribute("name", pName);
p.setAttribute("value", pValue);
el.appendChild(p);
}
/* Cross-browser SWF removal
- Especially needed to safely and completely remove a SWF in Internet Explorer
*/
function removeSWF(id) {
var obj = getElementById(id);
if (obj && obj.nodeName == "OBJECT") {
if (ua.ie && ua.win) {
obj.style.display = "none";
(function(){
if (obj.readyState == 4) {
removeObjectInIE(id);
}
else {
setTimeout(arguments.callee, 10);
}
})();
}
else {
obj.parentNode.removeChild(obj);
}
}
}
function removeObjectInIE(id) {
var obj = getElementById(id);
if (obj) {
for (var i in obj) {
if (typeof obj[i] == "function") {
obj[i] = null;
}
}
obj.parentNode.removeChild(obj);
}
}
/* Functions to optimize JavaScript compression
*/
function getElementById(id) {
var el = null;
try {
el = doc.getElementById(id);
}
catch (e) {}
return el;
}
function createElement(el) {
return doc.createElement(el);
}
/* Updated attachEvent function for Internet Explorer
- Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
*/
function addListener(target, eventType, fn) {
target.attachEvent(eventType, fn);
listenersArr[listenersArr.length] = [target, eventType, fn];
}
/* Flash Player and SWF content version matching
*/
function hasPlayerVersion(rv) {
var pv = ua.pv, v = rv.split(".");
v[0] = parseInt(v[0], 10);
v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
v[2] = parseInt(v[2], 10) || 0;
return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
}
/* Cross-browser dynamic CSS creation
- Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
*/
function createCSS(sel, decl, media, newStyle) {
if (ua.ie && ua.mac) { return; }
var h = doc.getElementsByTagName("head")[0];
if (!h) { return; } // to also support badly authored HTML pages that lack a head element
var m = (media && typeof media == "string") ? media : "screen";
if (newStyle) {
dynamicStylesheet = null;
dynamicStylesheetMedia = null;
}
if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
// create dynamic stylesheet + get a global reference to it
var s = createElement("style");
s.setAttribute("type", "text/css");
s.setAttribute("media", m);
dynamicStylesheet = h.appendChild(s);
if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
}
dynamicStylesheetMedia = m;
}
// add style rule
if (ua.ie && ua.win) {
if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
dynamicStylesheet.addRule(sel, decl);
}
}
else {
if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
}
}
}
function setVisibility(id, isVisible) {
if (!autoHideShow) { return; }
var v = isVisible ? "visible" : "hidden";
if (isDomLoaded && getElementById(id)) {
getElementById(id).style.visibility = v;
}
else {
createCSS("#" + id, "visibility:" + v);
}
}
/* Filter to avoid XSS attacks
*/
function urlEncodeIfNecessary(s) {
var regex = /[\\\"<>\.;]/;
var hasBadChars = regex.exec(s) != null;
return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
}
/* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
*/
var cleanup = function() {
if (ua.ie && ua.win) {
window.attachEvent("onunload", function() {
// remove listeners to avoid memory leaks
var ll = listenersArr.length;
for (var i = 0; i < ll; i++) {
listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
}
// cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
var il = objIdArr.length;
for (var j = 0; j < il; j++) {
removeSWF(objIdArr[j]);
}
// cleanup library's main closures to avoid memory leaks
for (var k in ua) {
ua[k] = null;
}
ua = null;
for (var l in swfobject) {
swfobject[l] = null;
}
swfobject = null;
});
}
}();
return {
/* Public API
- Reference: http://code.google.com/p/swfobject/wiki/documentation
*/
registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
if (ua.w3 && objectIdStr && swfVersionStr) {
var regObj = {};
regObj.id = objectIdStr;
regObj.swfVersion = swfVersionStr;
regObj.expressInstall = xiSwfUrlStr;
regObj.callbackFn = callbackFn;
regObjArr[regObjArr.length] = regObj;
setVisibility(objectIdStr, false);
}
else if (callbackFn) {
callbackFn({success:false, id:objectIdStr});
}
},
getObjectById: function(objectIdStr) {
if (ua.w3) {
return getObjectById(objectIdStr);
}
},
embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
var callbackObj = {success:false, id:replaceElemIdStr};
if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
setVisibility(replaceElemIdStr, false);
addDomLoadEvent(function() {
widthStr += ""; // auto-convert to string
heightStr += "";
var att = {};
if (attObj && typeof attObj === OBJECT) {
for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
att[i] = attObj[i];
}
}
att.data = swfUrlStr;
att.width = widthStr;
att.height = heightStr;
var par = {};
if (parObj && typeof parObj === OBJECT) {
for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
par[j] = parObj[j];
}
}
if (flashvarsObj && typeof flashvarsObj === OBJECT) {
for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
if (typeof par.flashvars != UNDEF) {
par.flashvars += "&" + k + "=" + flashvarsObj[k];
}
else {
par.flashvars = k + "=" + flashvarsObj[k];
}
}
}
if (hasPlayerVersion(swfVersionStr)) { // create SWF
var obj = createSWF(att, par, replaceElemIdStr);
if (att.id == replaceElemIdStr) {
setVisibility(replaceElemIdStr, true);
}
callbackObj.success = true;
callbackObj.ref = obj;
}
else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
att.data = xiSwfUrlStr;
showExpressInstall(att, par, replaceElemIdStr, callbackFn);
return;
}
else { // show alternative content
setVisibility(replaceElemIdStr, true);
}
if (callbackFn) { callbackFn(callbackObj); }
});
}
else if (callbackFn) { callbackFn(callbackObj); }
},
switchOffAutoHideShow: function() {
autoHideShow = false;
},
ua: ua,
getFlashPlayerVersion: function() {
return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
},
hasFlashPlayerVersion: hasPlayerVersion,
createSWF: function(attObj, parObj, replaceElemIdStr) {
if (ua.w3) {
return createSWF(attObj, parObj, replaceElemIdStr);
}
else {
return undefined;
}
},
showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
if (ua.w3 && canExpressInstall()) {
showExpressInstall(att, par, replaceElemIdStr, callbackFn);
}
},
removeSWF: function(objElemIdStr) {
if (ua.w3) {
removeSWF(objElemIdStr);
}
},
createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
if (ua.w3) {
createCSS(selStr, declStr, mediaStr, newStyleBoolean);
}
},
addDomLoadEvent: addDomLoadEvent,
addLoadEvent: addLoadEvent,
getQueryParamValue: function(param) {
var q = doc.location.search || doc.location.hash;
if (q) {
if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
if (param == null) {
return urlEncodeIfNecessary(q);
}
var pairs = q.split("&");
for (var i = 0; i < pairs.length; i++) {
if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
}
}
}
return "";
},
// For internal usage only
expressInstallCallback: function() {
if (isExpressInstallActive) {
var obj = getElementById(EXPRESS_INSTALL_ID);
if (obj && storedAltContent) {
obj.parentNode.replaceChild(storedAltContent, obj);
if (storedAltContentId) {
setVisibility(storedAltContentId, true);
if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
}
if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
}
isExpressInstallActive = false;
}
}
};
}();
// Bookmarks
(function($){
$.socialbookmark={
findRelElm: function(elm){
var jelm = $(elm),
ref = jelm.attr('href'),
find = ref.indexOf('#');
ref = ref.substr(find);
return ref;
},
handler: function(){
if($.socialbookmark.actElm && !$($.socialbookmark.actElm).is(':hidden')){
$.socialbookmark.hide();
} else {
$.socialbookmark.show.call(this);
}
return false;
},
hideNotinActElm: function(e){
var jElm = $(e.target);
if(jElm.is($.socialbookmark.actElm) || jElm.parents($.socialbookmark.actElm).size()){
return;
}
$.socialbookmark.hide();
},
show:function(){
var ref = $.socialbookmark.findRelElm(this);
$(ref).animate({height: 'show',opacity: 'show'}, {duration: 400});
$.socialbookmark.actElm = ref;
$(document).bind('click', $.socialbookmark.hideNotinActElm);
return false;
},
actElm: null,
hide: function(){
$($.socialbookmark.actElm).animate({height: "hide", opacity: "hide"});
$('body').unbind('click', $.socialbookmark.hideNotinActElm);
},
init: function(sel){
var jElm = $(sel);
if(jElm.size()){
var ref = $.socialbookmark.findRelElm(jElm[0]);
$(ref).css({display: 'none'});
jElm.click($.socialbookmark.handler);
}
}
};
})(jQuery);
/**
* @author alexander.farkas
*/
/**
* JS-Singelton-Klasse um Objekte (zum Beispiel Bilder) zu skalieren
* @id objScaleModule
* @alias $.objScale
* @alias jQuery.objScale
*/
/**
* Berechnet die Höhe und Breite von DOM-Objekten
*
* @id getDim
* @method
* @alias $.objScale.getDim
* @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein Objekt mit den Eigenschaften width und height.
* @return {Object} gibt ein Objekt mit höhe und Breite zurück. Beispiel. {height: 200, width: 300}
*/
/**
* Berechnet eine verhältnismäßige Skalierung eines Objekts.
* siehe auch: $.objScale.scaleHeightTo und $.objScale.scaleWidthTo
*
* @id scaleTo
* @method
* @alias $.objScale.scaleTo
* @see #scaleHeightTo
* @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein Objekt welches skaliert werden soll.
* @param {Number} num num erwartet die neue Grösse, welche das Objekt haben soll (Breite oder Höhe)
* @param {String} side gibt an welche Seite (Höhe oder Breite) man im 2. Parameter angegeben hat
* @return {Number} gibt die neue Länge zurück (Wenn man unter num/side 'width' angegeben hat, wird die Höhe zurückgeliefert).
*/
/**
* Skaliert die Höhe eines Objekts und gibt die verhältnismäßige Breite zurück.
* (Shorthand für $.objScale.scaleTo(obj, num, 'height');)
*
* @id scaleHeightTo
* @method
* @alias $.objScale.scaleHeightTo
* @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein Objekt welches skaliert werden soll.
* @param {Number} num num erwartet die neue Höhe, welche das Objekt haben soll
* @return {Number} gibt die neue Breite zurück
*/
/**
* Skaliert die Breite eines Objekts und gibt die verhältnismäßige Höhe zurück.
* (Shorthand für $.objScale.scaleTo(obj, num, 'width');)
*
* @id scaleWidthTo
* @method
* @alias $.objScale.scaleWidthTo
* @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein Objekt welches skaliert werden soll.
* @param {Number} num num erwartet die neue Breite, welche das Objekt haben soll
* @return {Number} gibt die neue Höhe zurück
*/
/**
* Skaliert die Breite eines Objekts und gibt die verhältnismäßige Höhe zurück.
* (Shorthand für $.objScale.scaleTo(obj, num, 'width');)
*
* @id scaleWidthTo
* @method
* @alias $.objScale.scaleWidthTo
* @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein Objekt welches skaliert werden soll.
* @param {Number} num num erwartet die neue Breite, welche das Objekt haben soll
* @return {Number} gibt die neue Höhe zurück
*/
/**
* Zentriert ein kleineres Objekt in einem Grösseren.
* siehe auch: $.objScale.constrainObjTo();
*
* @id centerObjTo
* @method
* @alias $.objScale.centerObjTo
* @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein anderes Objekt mit Höhen und Breiten-Eigenschaften, welches zentriert werden soll.
* @param {Object} container erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein anderes Objekt mit Höhen und Breiten-Eigenschaften, in welches das andere Objekt zentriert werden soll
* @param {Object, Options} opts stellt Optionen bereit so kann angegeben werden, ob es einen Mindest nach oben bzw. links geben soll (margin: [10, false]) und, ob vertical und / oder horizontal zentriert werden soll
* Beispiel:
* $.objScale.centerObjTo(img, container, {margin: [10, 0], horizontal: false};
* Es soll nur vertical und nicht horizontal zentriert werden, ausserdem soll der Mindestabstand nach oben 10 Einheiten betragen
* $.objScale.centerObjTo(img, container, {margin: [false, 0]};
* Es soll vertical und horizontal zentriert werden, ausserdem soll der Mindestabstand nach links 0 Einheiten betragen und nach oben existiert keine Mindestbeschränkung (Es können negative Werte auftreten).
* defaults: {margin: [0, 0], vertical: true, horizontal: true}
* @return {Object} gibt ein Objekt mit top und left Eigenschaften zurück
*/
/**
* Zentriert ein Objekt in einem anderen Objekt. Ist das zu skalierende Objekt grösser, wird es zusätzlich verkleinert.
* siehe auch: $.objScale.centerObjTo(); und $.objScale.scaleObjTo();
* @id constrainObjTo
* @method
* @alias $.objScale.constrainObjTo
* @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein anderes Objekt mit Höhen und Breiten-Eigenschaften, welches angepasst und zentriert werden soll.
* @param {Object} container erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein anderes Objekt mit Höhen und Breiten-Eigenschaften, in welches das andere Objekt zentriert werden soll
* @param {Object, Options} opts stellt Optionen bereit so kann angegeben werden, ob es einen Mindestabstand nach oben bzw. links geben soll (margin: [10, false], padding: [10, 0]) und ob vertical und / oder horizontal zentriert werden soll
* Unterschied zwischen padding und margin: Die margin- und padding-Angaben werden für die evtl. Verkleinerung des Objekts berücksichtigt. Bei einer möglichen Zentrierung wird dagegen ausschließlich der margin-Wert berücksichtigt. Das padding-Array darf daher nur Zahlen enthalten, das margin-Array darf daneben noch den booleschen Wert false enthalten.
* Beispiel:
* $.objScale.constrainObjTo(img, container, {margin: [10, 0], horizontal: false};
* Es soll nur vertical und nicht horizontal zentriert werden, ausserdem soll der Mindestabstand nach oben 10 Einheiten betragen
* defaults: {margin: [0, 0], padding: [0, 0], vertical: true, horizontal: true}
* @return {Object} gibt ein Objekt mit width, height, top und left Eigenschaften zurück
*/
/**
* Skaliert ein Objekt, so dass es perfekt in ein anderes Objekt passt und zentriert es. (Ist es kleiner, wird es vergrössert bzw. ist grösser, wird es verkleinert).
* siehe auch: $.objScale.centerObjTo(); und $.objScale.constrainObjTo();
* @id scaleObjTo
* @method
* @alias $.objScale.scaleObjTo
* @param {Object} obj obj erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein anderes Objekt mit Höhen und Breiten-Eigenschaften, welches skaliert und zentriert werden soll.
* @param {Object} container erwartet ein DOM-Objekt, ein jQuery-Objekt oder ein anderes Objekt mit Höhen und Breiten-Eigenschaften, in welches das andere Objekt zentriert/skaliert werden soll
* @param {Object, Options} opts stellt Optionen bereit so kann angegeben werden, ob es einen Mindestabstand nach oben bzw. links geben soll (margin: [10, false], padding: [10, 0]), ob vertical und / oder horizontal zentriert werden soll. Die scaleToFit-Eigenschaft gibt an, ob bei unterschiedlichen Seitenverhältnissen das innere Objekt vollständig zu sehen sein soll oder ob es das äußere Objekt vollständig ausfüllen soll
* Unterschied zwischen padding und margin: Die margin- und padding-Angaben werden für die evtl. Skalierung des Objekts berücksichtigt. Bei einer möglichen Zentrierung wird dagegen ausschließlich der margin-Wert berücksichtigt. Das padding-Array darf daher nur Zahlen enthalten, das margin-Array darf daneben noch den booleschen Wert false enthalten.
* Beispiel:
* $.objScale.scaleObjTo(img, container, {margin: [10, 0], horizontal: false};
* Es soll nur vertical und nicht horizontal zentriert werden, ausserdem soll der Mindestabstand nach oben 10 Einheiten betragen
',
getTextContent: 'standard',
addKeyNav: true,
addLiveRegion: true,
showContentAnim: function(ui, img, e, extras){
var contentBox = $('div.content-box', ui.element);
contentBox
.queue(function(){
ui.fillContent();
ui.widthElement.css({width: ui.calcWidth(img)});
contentBox.fadeTo(300, 1);
contentBox.dequeue();
});
},
hideContentAnim: function(ui){
var contentBox = $('div.content-box', ui.element);
contentBox.fadeTo(300, 0);
},
animHide: function(jElm, data){//Hide-Animation
var hiddenStyle = (data.instance.options.hideStyle == 'visibility') ? {visibility: 'hidden'} : {display: 'none'};
jElm.css(hiddenStyle);
var mm = $('div.multimedia-box', jElm);
if(window.swfobject && $('object', mm)[0]){
swfobject.removeSWF($('object', mm).getID());
} else {
mm.empty();
}
},
controlsWrapper: '.showbox-toolbar', // versteckt toolar wenn nur ein Bild - optionen: false
slideShowAutostart: false,
slideshowDelay: 4000,
playTitle: '', // title text play button
playText: 'play',
pauseText: 'pause',
pauseTitle: '', // title text Pause button
generateScroller: false,
scrollerOpts: {
prevLink: 'div.pg-prev span',
nextLink: 'div.pg-next span',
hidingWrapper: 'div.pg-rack',
moveWrapper: 'div.pg-rack-design'
},
getScrollerTeaser: function(inst){
return inst.uniqueOpeners.closest('dl').clone();
},
scrollerTemplate: '
'
};
$.fn.showbox.getContentMethods = {
standard: function(opener, content, ui){
content['text-content'] = opener.prop('title') || "";
},
dl: function(opener, content, ui){
// Um Text aus einer dl-Structure zu holen (Magnolia-Style)
var dl = opener.closest('dl'), //hole das nächst höhere dl
dds = $('dd', dl), // hole die dd
img = $('img', dl), // hole das img
extraContent = ''
;
//content objekt dient zur befüllung der lightbox mit weiterem content
//die eigenschaftsnamen stimmen mit den Klassen-Namen überein
//content['multimedia-box'] ist bereits mit dem grossen Bild vorbelegt
//und wird nun mit dem alt Attribut des kleinen Bildes versehen
if(content['multimedia-box'] && content['multimedia-box'].attr){
content['multimedia-box'].attr('alt', img.attr('alt'));
}
content['text-content'] = ''; // String in dem wir unser gesamt content zusammefügen
dds.each(function(){
var dd = $(this),
html = dd.html()
;
if(dd.is('.caption')){
content['text-content'] += '