/** * @author trixta */ (function($){ $.fn.fadeInTo = function(){ var args = arguments; return this.each(function(){ var jElm = $(this); if(jElm.css('display') === 'none'){ jElm.css({opacity: '0', display: 'block'}); } $.fn.fadeTo.apply(jElm, args); }); }; var maskID = new Date().getTime(); $.overlayProto = { hideElementsOnShow: function(){ var o = this.options, that = this ; this.hiddenElements = $([]); if(o.hideWindowedFlash){ this.hiddenElements = $('object').filter('[classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000], [type=application/x-shockwave-flash]'); this.hiddenElements = this.hiddenElements.filter(function(){ return (/]*(?:name=["'?]\bwmode["'?][\s\/>]|\bvalue=["'?](?:opaque|transparent)["'?][\s\/>])[^>]*){2}/i.test(this.innerHTML)); }); } if(o.hideWhileShown){ this.hiddenElements = this.hiddenElements.add(o.hideWhileShown); } this.hiddenElements = this.hiddenElements .filter(function(){ var jElm = $(this); return (jElm.is(':visible') && jElm.css('visibility') === 'visible' && !contains(this, that.element[0])); }) .filter(o.hideFilter) .css({visibility: 'hidden'}); } }; $.widget('ui.mask', $.extend({ _init: function(){ var o = this.options, that = this, css ; maskID++; this.id = maskID; this.maskedElement = this.element.parent(); if(this.maskedElement.is('body')){ this.dimensionElement = $(document); this.calcMethod = { height: 'height', width: 'width' }; } else { this.dimensionElement = this.maskedElement.css({position: 'relative'}); this.calcMethod = { height: 'innerHeight', width: 'innerWidth' }; } if(this.maskedElement.is('body') || (parseInt($.browser.version, 10) < 7 && $.browser.msie)){ css = { display: 'none', position: 'absolute', top: '0', left: '0' }; this.calcSize = true; } else { css = { display: 'none', position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }; this.calcSize = false; } this.element.css(css); o.cssWidth = ($.curCSS(this.element[0], 'width') === '100%'); this.isVisible = false; if(o.closeOnClick){ this.element.click(function(e){ that.hide.call(that, e, this); }); } if(o.extraClass){ this.element.addClass(o.extraClass); } }, ui: function(){ return { instance: this }; }, hide: function(e, elem){ if(!this.isVisible){return;} var result = this._trigger('close', e, this.ui()), o = this.options, that = this ; if(result === false){return;} this.isVisible = false; if(o.handleDisplay){ if(o.fadeOutTime){ this.element.fadeOut(o.fadeOutTime, function(){ that.unexpose.call(that); }); } else { this.element.hide(); this.unexpose(); } } this.element.queue(function(){ if(that.hiddenElements && that.hiddenElements.css){ that.hiddenElements.css({visibility: 'visible'}); } that.maskedElement.removeClass('mask-visible'); that.element.dequeue(); }); $(document).unbind('.mask'+ this.id); $(window).unbind('.mask'+ this.id); }, resize: function(set){ var ret = { 'height': this.dimensionElement[this.calcMethod.height]() }; if(!this.options.cssWidth){ ret.width = this.dimensionElement[this.calcMethod.width](); } if(set){ this.element.css(ret); } return ret; }, show: function(e, o){ if(this.isVisible){return;} o = (o) ? $.extend({}, this.options, o) : this.options; var that = this, resize = function(e){ that.resize.call(that, true); } ; if(o.expose){ this.expose(o.expose); } this._trigger('show', e, $.extend({} , this.ui(), o)); this.isVisible = true; this.maskedElement.addClass('mask-visible'); this.hideElementsOnShow(); if(o.handleDisplay){ if(this.calcSize){ this.resize(true); } if(o.fadeInTime){ this.element.fadeInTo(o.fadeInTime, o.opacity); } else { this.element.css({opacity: o.opacity, display: 'block'}); } } if(o.closeOnEsc){ $(document).bind('keydown.mask'+ this.id, function(e){ if(e.keyCode === $.ui.keyCode.ESCAPE){ that.hide.call(that, e, this); } }); } if (that.calcSize) { $(document).bind('resize.mask'+ this.id +' emchange.mask'+ this.id, resize); $(window).bind('resize.mask'+ this.id, resize); } }, unexpose: function(elem){ if(!elem && !this.exposed){return;} var exposed = elem || this.exposed; exposed.each(function(){ $(this).css({ position: '', zIndex: '' }); }); if(!elem){ this.exposed = false; } }, expose: function(jElm){ var zIndex = parseInt(this.maskedElement.css('z-index'), 10) || 9; jElm = this.maskedElement.find(jElm); jElm.each(function(){ var jExpose = $(this); if(jExpose.css('position') === 'static'){ jExpose.css({position: 'relative'}); } zIndex++; jExpose.css({ zIndex: zIndex }); }); this.exposed = jElm; } }, $.overlayProto)); $.ui.mask.defaults = { extraClass: false, closeOnClick: true, closeOnEsc: true, handleDisplay: true, fadeInTime: 0, fadeOutTime: 0, opacity: 0.8, bgIframe: false, cssWidth: true }; })(jQuery); (function($){ $.support.ajax = !!(window.XMLHttpRequest); if(window.ActiveXObject){ try{ new ActiveXObject("Microsoft.XMLHTTP"); $.support.ajax = true; } catch(e){ if(window.XMLHttpRequest){ $.ajaxSetup({xhr: function(){ return new XMLHttpRequest(); }}); } } } window.changeURL = function(win, url){ if ($.support.ajax) { win.href = url; } }; })(jQuery); /** * @author trixta */ (function($){ /* * hover = focusblur */ $.each({ focus: 'focusin', blur: 'focusout' }, function( original, fix ){ $.event.special[fix] = { setup:function() { if ( $.browser.msie ) return false; this.addEventListener( original, $.event.special[fix].handler, true ); }, teardown:function() { if ( $.browser.msie ) return false; this.removeEventListener( original, $.event.special[fix].handler, true ); }, handler: function(e) { arguments[0] = $.event.fix(e); arguments[0].type = fix; return $.event.handle.apply(this, arguments); } }; }); $.ui = $.ui || {}; /* * HCM-Detection */ $.ui.userMode = (function(){ var userBg, timer, testDiv, boundEvents = 0; function testBg(){ testDiv = testDiv || $('
').css({position: 'absolute', left: '-999em', top: '-999px', width: '0px', height: '0px'}).appendTo('body'); var black = $.curCSS( testDiv.css({backgroundColor: '#000000'})[0], 'backgroundColor', true), white = $.curCSS( testDiv.css({backgroundColor: '#ffffff'})[0], 'backgroundColor', true), newBgStatus = (black === white || white === 'transparent'); if(newBgStatus != userBg){ userBg = newBgStatus; $.event.trigger('_internalusermode'); } return userBg; } function init(){ testBg(); timer = setInterval(testBg, 3000); } function stop(){ clearInterval(timer); (testDiv && testDiv.remove()); testDiv = null; } $.event.special.usermode = { setup: function(){ (!boundEvents && init()); boundEvents++; var jElem = $(this) .bind('_internalusermode', $.event.special.usermode.handler); //always trigger setTimeout(function(){ jElem.triggerHandler('_internalusermode'); }, 1); return true; }, teardown: function(){ boundEvents--; (!boundEvents && stop()); $(this).unbind('_internalusermode', $.event.special.usermode.handler); return true; }, handler: function(e){ e.type = 'usermode'; e.disabled = !userBg; e.enabled = userBg; return $.event.handle.apply(this, arguments); } }; return { get: testBg }; })(); $.fn.userMode = function(fn){ return this[(fn) ? 'bind' : 'trigger']('usermode', fn); }; $(function(){ $('html').userMode(function(e){ $('html')[e.enabled ? 'addClass' : 'removeClass']('hcm'); }); }); (function($){ var preventclick = false; function handleAriaClick(e){ if(!preventclick && (!e.keyCode || e.keyCode === $.ui.keyCode.ENTER || e.keyCode === $.ui.keyCode.SPACE)){ preventclick = true; setTimeout(function(){ preventclick = false; }, 1); return $.event.special.ariaclick.handler.apply(this, arguments); } else if(e.type == 'click'){ return false; } } $.event.special.ariaclick = { setup: function(){ $(this).bind('click keydown', handleAriaClick); return true; }, teardown: function(){ $(this).unbind('click keydown', handleAriaClick); return true; }, handler: function(e){ e.type = 'ariaclick'; return $.event.handle.apply(this, arguments); } }; })(jQuery); /* EM-Change */ $.testEm = (function(){ var emElem = $('
'), timer, emPx = 0, oldVal = 0, boundEvents = 0; function init(){ timer = setInterval(test, 999); } function test(){ var width = emElem.width(); if(emPx && emPx !== width){ emPx = width; $.event.trigger('_internalemchange'); } oldVal = width; emPx = width; return { type: 'emsize', emPx: emPx, oldEmPx: oldVal }; } $.event.special.emchange = { setup: function(){ (!boundEvents && init()); boundEvents++; $(this) .bind('_internalemchange', $.event.special.emchange.handler); return true; }, teardown: function(){ boundEvents--; (!boundEvents && clearInterval(timer)); $(this).unbind('_internalemchange', $.event.special.emchange.handler); return true; }, handler: function(e){ e.type = 'emchange'; e.emPx = emPx; e.oldEmPx = oldVal; return jQuery.event.handle.apply(this, arguments); } }; $(function(){ emElem .appendTo('body'); test(); }); return test; })(); (function($){ var allowFocus = true; function stopFocus(){ allowFocus = false; setTimeout(function(){ allowFocus = true; }, 1); } function testDomTarget(e){ var oE = e.originalEvent; if(e.target === document || e.target === window){ stopFocus(); return false; } if(oE){ if( allowFocus && e.target && e.target.nodeType === 1 && (oE.explicitOriginalTarget && oE.explicitOriginalTarget && oE.explicitOriginalTarget !== window && oE.explicitOriginalTarget !== document && !$(oE.explicitOriginalTarget).is('html, body') || oE.toElement || oE.fromElement) ) { return true; } else { return false; } } return true; } $.each(['focusin', 'focusout'], function(i, eType){ $.event.special['dom'+ eType] = { setup: function(){ $(this) .bind(eType, $.event.special['dom'+ eType].handler); return true; }, teardown: function(){ $(this).unbind(eType, $.event.special['dom'+ eType].handler); return true; }, handler: function(e){ if(testDomTarget(e)){ e = $.extend({}, e, {type: 'dom'+ eType}); return $.event.handle.call(this, e); } } }; }); })(jQuery); (function($){ var allowFocus = true, focusTimer, currentFocus; function stopKeyFocus(){ allowFocus = false; setTimeout(function(){ allowFocus = true; }, 1); } function addFocus(e){ currentFocus = e.target; var target = $(e.target).addClass('a11y-focus'); if(allowFocus){ target .addClass('ui-keyfocus') .trigger('keyfocus'); } } $(document) .bind('mousedown click', stopKeyFocus) .bind('domfocusin', addFocus) .bind('focusout', function(e){ $(e.target).removeClass('ui-keyfocus widget-focus a11y-focus'); }) ; function addTabindex(jElm){ if(!jElm.is('a, area, input, button, select, textarea')){ jElm.css({outline: 'none'}).attr({tabindex: '-1'}); } return jElm; } $.fn.setFocus = function(time, doTabI){ if(!this[0]){return;} var elem = this[0], jElm = $(elem), opts = {}, focusFn= function(){ stopKeyFocus(); try{ elem.focus(); jElm.addClass('widget-focus'); if(/file:|127\.0\.0\.1|localhost/.test(location.href)){ setTimeout(function(){ if(currentFocus !== elem){ throw('focus ist versprungen'); } }, 99); } complete.apply(elem, arguments); } catch(e){} }, queueFn = function(){ opts.parent.queue(function(){ focusFn(); opts.parent.dequeue(); }); } ; if(isFinite(time)){ opts.time = time; if(doTabI !== undefined){ opts.addTabindex = doTabI; } } else { opts = time; } opts = $.extend({}, $.fn.setFocus.defaults, opts); if(opts.addTabindex){ addTabindex(jElm); } clearTimeout(focusTimer); focusTimer = setTimeout(opts.parent ? queueFn : focusFn, opts.time); }; $.fn.setFocus.defaults = { time: 0, addTabindex: false, parent: false, complete: function(){} }; })(jQuery); /* hide/show */ $.fn.ariaHide = function(){ $.fn.hide.apply(this, arguments); return this.attr({'aria-hidden': 'true'}); }; $.fn.ariaShow = function(){ $.fn.show.apply(this, arguments); return this.attr({'aria-hidden': 'false'}); }; /* * SR-Update */ $.ui.SR = (function(){ var input, val = 0, alertBox, alertTimer; function init(){ alertBox = $('