he */ cache: {}, /** * Create a wrapper that extend the event and triggers the callback * called with the given context or node (W3C). * * @return function */ createResponder: function ( uid, type, originalType, handler, context ) { return function ( event ) { event = _Event.extend( event, uid ); if( !_Event.supportsMouseenterMouseleave && originalType === 'mouseleave' ) { if( event.currentTarget.contains(event.relatedTarget) ) { return; } } handler.call( context || _Event.cache[uid].node, event ); }; }, /** * Purge events from given element * * @param number * @return void */ purge: function ( uid ) { var cache = _Event.cache[uid], element, key; if( !cache ) { return; } element = PB(cache.node); for( key in cache ) { if( cache.hasOwnProperty(key) && key !== 'node' ) { element.off( key ); } } delete _Event.cache[uid]; cache.node = null; return; }, /** * Extend event object with functionality, on event fire * this function will be called. * * For legacy browsers this also extend the event object with * with de Event specications. * * Returns an extended Event object * * @param Event * @param number * @return Event */ extend: function ( event, uid ) { if( event.type.indexOf('touch') === 0 && event.touches[0] ) { event.touchX = event.touches[0].pageX; event.touchY = event.touches[0].pageY; } if( event.type === 'DOMMouseScroll' || event.type === 'mousewheel' || event.type === 'wheel' ) { event.wheel = event.wheelDelta ? event.wheelDelta / 120 : -(event.detail || 0) / 3; } if( _Event.manualExtend === false ) { return event; } PB.overwrite( event, _Event.methods ); event.target = event.srcElement || _Event.cache[uid].node; event.currentTarget = _Event.cache[uid].node; switch ( event.type ) { case 'mouseover': case 'mouseenter': event.relatedTarget = event.fromElement; break; case 'mouseout': case 'mouseleave': event.relatedTarget = event.toElement; break; } if( event.pageX === undefined ) { event.pageX = event.clientX + (docElement.scrollLeft || body.scrollLeft) - (docElement.clientLeft || 0); event.pageY = event.clientY + (docElement.scrollTop || body.scrollTop) - (docElement.clientTop || 0); } event.which = (event.keyCode === undefined) ? event.charCode : event.keyCode; event.which = (event.which === 0 ? 1 : (event.which === 4 ? 2: (event.which === 2 ? 3 : event.which))); return event; } }; /** * */ _Event.methods = { /** * Short for preventDefault and stopPropagation * * Tnx prototypejs! :) */ stop: function () { this.preventDefault(); this.stopPropagation(); } }; /** * Extend event prototype with DOM level 2 events */ if (window.addEventListener) { PB.overwrite(Event.prototype, _Event.methods); } /** * Add methods for non DOM level 2 events */ if( window.attachEvent && !window.addEventListener ) { _Event.manualExtend = true; PB.overwrite(_Event.methods, { /** * Normalize stopPropagation */ stopPropagation: function () { this.cancelBubble = true; }, /** * Normalize stopPropagation */ preventDefault: function () { this.returnValue = false; } }); } /** * */ PB.overwrite(PB.dom, { /** * DOM event binding * * Example * PB('element').on('click', function ( e ){ alert(e.type) }) * * @param string * @param Function * @param Object * @return Dom */ on: function ( type, handler, context ) { var types = type.split(' '); if ( typeof handler !== 'function' ) { throw new TypeError('element.on(\''+type+'\'), handler is not a function'); } if( types.length > 1 ) { types.forEach(function ( type ) { this.on( type, handler, context ); }, this); return this; } var node = this.node, uid = node.__PBJS_ID__, events = _Event.cache[uid], originalType = type, eventsType, i; if( _Event.supportsMouseenterMouseleave === false ) { type = (type === 'mouseenter' ? 'mouseover' : (type === 'mouseleave' ? 'mouseout' : type)); } if( !events ) { _Event.cache[uid] = events = {node: node}; } if( !events[type] ) { events[type] = []; } eventsType = events[type]; i = eventsType.length; while( i-- ) { if( eventsType[i].handler === handler ) { return this; } } var entry = { handler: handler, responder: _Event.createResponder( uid, type, originalType, handler, context ) }; eventsType.push( entry ); if( node.addEventListener ) { node.addEventListener( type, entry.responder, false ); } else { node.attachEvent( 'on'+type, entry.responder ); } node = null; return this; }, /** * Bind the event, and removes it after use * * @param string * @param Function * @param Object * @return Dom */ once: function ( types, handler, context ) { var me = this; types.split(' ').forEach(function ( type ) { var _handler = function () { me.off( type, _handler ); handler.apply( context || me.node, PB.toArray(arguments) ); }; me.on(type, _handler); }); return this; }, /** * Removes the given: (type + handler) or (type) or (all) * * @param string * @param Function * @return Dom */ off: function ( type, handler ) { var node = this.node, uid = node.__PBJS_ID__, events = _Event.cache[uid], eventsType, entry, i; if( !events ) { return this; } if( !type ) { _Event.purge( uid ); return this; } eventsType = events[type]; if( !eventsType ) { return this; } i = eventsType.length; if( !handler ) { while( i-- ) { this.off( type, eventsType[i].handler ); } return this; } while( i-- ) { if( eventsType[i].handler === handler ) { entry = eventsType[i]; eventsType.splice( i, 1 ); if( !eventsType.length ) { delete _Event.cache[uid][type]; } break; } } if( !entry ) { return this; } if( node.removeEventListener ) { node.removeEventListener( type, entry.responder, false ); } else { node.detachEvent( 'on'+type, entry.responder ); } node = null; return this; }, /** * Dispatch the event on the element * * @param string * @return Dom */ emit: function ( type ) { var evt; if( _Event.HTMLEvents.test(type) || this.nodeName === 'INPUT' ) { this.node[type](); } else if( doc.createEvent ) { if ( _Event.MouseEvents.test(type) ) { evt = doc.createEvent('MouseEvents'); evt.initMouseEvent( type, true, true, window, // type, canBubble, cancelable, view, 0, 0, 0, 0, 0, // detail, screenX, screenY, clientX, clientY, false, false, false, false, // ctrlKey, altKey, shiftKey, metaKey, 0, null); // button, relatedTarget this.node.dispatchEvent(evt); } else { evt = doc.createEvent('Events'); evt.initEvent( type, true, true ); this.node.dispatchEvent(evt); } } else { evt = doc.createEventObject(); this.node.fireEvent('on'+type, evt); } return this; } }); /** * */ PB.ready = (function () { var ready = doc.readyState === 'complete', queue = []; function execQueue () { var callback; ready = true; body = doc.body; while( callback = queue.shift() ) { callback(); } } function domready () { try { doc.body.scrollLeft; execQueue(); } catch ( e ) { setTimeout(domready, 16.7); return; } } if( doc.addEventListener ) { PB(doc).once('DOMContentLoaded', execQueue); } else { domready(); } return function ( callback ) { if( !ready ) { return queue.push( callback ); } callback(); }; })(); PB.overwrite(PB.dom, { set: function ( key, value ) { this.storage[key] = value; return this; }, get: function ( key ) { return this.storage[key]; }, unset: function ( key ) { return delete this.storage[key]; }, isset: function ( key ) { return this.storage[key] !== undefined; } }); PB.overwrite(PB.dom, { /** * Set/get/remove attribute * null values will remove attribute * * @return mixed */ attr: function ( key, value ) { if( PB.type(key) === 'object' ) { PB.each(key, this.attr, this); return this; } if( value === undefined ) { return this.node.getAttribute(key); } else if ( value === null ) { this.node.removeAttribute(key); } else { this.node.setAttribute(key, value); } return this; }, /** * Set / get value from form element */ val: function ( value ) { if( value === undefined ) { return this.node.value; } this.node.value = value; return this; }, /** * Set or retrieve 'data-' attribute */ data: function ( key, value ) { return this.attr( 'data-'+key, value ); }, /** * Select the content in the provided range */ select: function( start, length ) { var node = this.node, value = this.val(), range; if ( value ) { if ( !length ){ // default: select all length = ( start ) ? start : value.length; start = 0; } if ( node.createTextRange ) { document.selection.empty(); range = node.createTextRange(); range.collapse( true ); range.moveStart( 'character', start ); range.moveEnd( 'character', start + length ); range.select(); } else { window.getSelection().removeAllRanges(); node.setSelectionRange( start, start+length ); } } } }); var unit = /^-?[\d.]+px$/i, opacity = /alpha\(opacity=(.*)\)/i, noPixel = /(thin|medium|thick|em|ex|pt|%)$/, computedStyle = doc.defaultView && doc.defaultView.getComputedStyle, vendorDiv = doc.createElement('div'), supportsOpacity = vendorDiv.style.opacity !== undefined, supportsCssFloat = vendorDiv.style.cssFloat !== undefined, skipUnits = 'zIndex zoom fontWeight opacity', cssPrefixProperties = 'animationName transform transition transitionProperty transitionDuration transitionTimingFunction boxSizing backgroundSize boxReflect'.split(' '), cssPropertyMap = {}, vendorPrefixes = 'O ms Moz Webkit'.split(' '), i = vendorPrefixes.length; /** * Add prefixes to cssPropertyMap map if needed/supported */ cssPrefixProperties.forEach(function ( property ) { if( property in vendorDiv.style ) { return cssPropertyMap[property] = property; } var j = i, prop = property.charAt(0).toUpperCase()+property.substr(1); while( j-- ) { if( vendorPrefixes[j]+prop in vendorDiv.style ) { return cssPropertyMap[property] = vendorPrefixes[j]+prop; } } }); cssPrefixProperties = vendorDiv = null; PB.support.CSSTransition = !!cssPropertyMap.transition; PB.support.CSSAnimation = !!cssPropertyMap.animationName; /** * Add px numeric values */ function addUnits ( property, value ) { if( skipUnits.indexOf(property) >= 0 ) { return value; } return typeof value === 'string' ? value : value+'px'; } /** * Remove units from px values */ function removeUnits ( value ) { return unit.test( value ) ? parseInt( value, 10 ) : value; } /** * Get the right property name for this browser */ function getCssProperty ( property ) { if( property === 'float' ) { property = supportsCssFloat ? 'cssFloat' : 'styleFloat'; } return cssPropertyMap[property] || property; } PB.overwrite(PB.dom, { /** * Set CSS styles * * @param object * @return PB.Dom */ setStyle: function ( values ) { var property; if( arguments.length === 2 ) { var property = values; values = {}; values[property] = arguments[1]; } for( property in values ) { if( values.hasOwnProperty(property) ) { if( property === 'opacity' && !supportsOpacity ) { if( !this.node.currentStyle || !this.node.currentStyle.hasLayout ) { this.node.style.zoom = 1; } this.node.style.filter = 'alpha(opacity='+(values[property]*100)+')'; } else { this.node.style[getCssProperty( property )] = addUnits( property, values[property] ); } } } return this; }, /** * Get CSS style * * @param string * @return number/string */ getStyle: function ( property, calculated ) { property = getCssProperty( property ); var node = this.node, value = node.style[property], o; if( calculated || !value || value === 'auto' ) { if( computedStyle ) { value = doc.defaultView.getComputedStyle( node, null )[property]; } else { value = node.currentStyle[property]; if( noPixel.test(value) ) { var style = value.lastIndexOf('%') > -1 ? 'height: '+value : 'border: '+value+' solid #000; border-bottom-width: 0', div = PB('
') .appendTo(body); value = div.node.offsetHeight; div.remove(); return value; } } } if( property === 'opacity' ) { if( node.style.filter && (o = node.style.filter.match(opacity)) && o[1] ) { return parseFloat(o[1]) / 100; } return value ? parseFloat(value) : 1.0; } return value === 'auto' ? 0 : removeUnits(value); } }); PB.browser.supportsCSSAnimation = !!cssPropertyMap['animationName']; function morphArgs ( args ) { var options = { duration: .4, effect: 'ease' }; for( var i = 1 ; i < args.length; i++ ) { switch( typeof args[i] ) { iv class="dropmenu">*
The Great British Bake Off
The Kennedys
The Queen's Palaces
*
Zwarte Zwanen
Archief
Overzicht
|
|
|
|
|
|
Home > Televisie > Nederland in Beweging! > Archief > Nederland in Beweging!
 

Omroep MAX