Handles anchor elements with a hash fragment for non-HTML5 browsers

@param {Event} e
556258
function onAnchorClick(e) {
    var event = e || global.event;
    var target = anchorTarget(event.target || event.srcElement);
    var defaultPrevented = "defaultPrevented" in event ? event['defaultPrevented'] : event.returnValue === false;
    if (target && target.nodeName === "A" && !defaultPrevented) {
      var current = parseURL();
      var expect = parseURL(target.getAttribute("href", 2));
      var isEqualBaseURL = current._href.split('#').shift() === expect._href.split('#').shift();
      if (isEqualBaseURL && expect._hash) {
        if (current._hash !== expect._hash) {
          locationObject.hash = expect._hash;
        }
        scrollToAnchorId(expect._hash);
        if (event.preventDefault) {
          event.preventDefault();
        } else {
          event.returnValue = false;
        }
      }
    }
  }
401287
function(e) {
        var node = $(e.currentTarget),
            element,
            isNode = (this.node && this.node.is(node)),
            cid = node.data('toolkit.cid');

        // Set the current element based on the nodes composite ID
        if (cid && this.elements[cid]) {
            element = this.elements[cid];
        } else {
            element = this.element;
        }

        if (element && element.is(':shown')) {

            // Touch devices should pass through on second click
            if (Toolkit.isTouch) {
                if (!isNode || this.node.prop('tagName').toLowerCase() !== 'a') {
                    e.preventDefault();
                }

                // Non-touch devices
            } else {
                e.preventDefault();
            }

            if (isNode) {
                // Second click should close it
                if (this.options.mode === 'click') {
                    this.hide();
                }

                // Exit if the same node so it doesn't re-open
                return;
            }

        } else {
            e.preventDefault();
        }

        this.show(node);
    }
198543
function(location, fragment, replace) {
      if (replace) {
        var href = location.href.replace(/(javascript:|#).*$/, '');
        location.replace(href + '#' + fragment);
      } else {
        // Some browsers require that `hash` contains a leading #.
        location.hash = '#' + fragment;
      }
    }
850265
function ( e ) {
            
            if ( this.options.enableValidations !== false ) {
                if ( !this.isValid() ) {
                    
                    this.createEncryptedField( "false" );
                    
                    if ( e.preventDefault ) {
                        e.preventDefault();
                    }
                    // IE7 and lower
                    if ( window.event ) {
                        window.event.returnValue = false;
                    }
                    if ( e.originalEvent ) {
                        e.originalEvent.returnValue = false;
                    }
                    e.returnValue = false;

                    return false;
                }
            }
            
            this.createEncryptedField( this.encrypt() );

            this.onsubmit( e );
        }
767908
function(e) {
        e.preventDefault();

        var options = this.options;

        this.element.reveal().positionTo(options.position, e, {
            left: options.xOffset,
            top: options.yOffset
        }, true);
    }
1210271
function handler(e) {
			// allow tab navigation (conditionally)
			if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) {
				if (pageBlock && e.data.constrainTabKey) {
					var els = pageBlockEls;
					var fwd = !e.shiftKey && e.target === els[els.length-1];
					var back = e.shiftKey && e.target === els[0];
					if (fwd || back) {
						setTimeout(function(){focus(back);},10);
						return false;
					}
				}
			}
			var opts = e.data;
			var target = $(e.target);
			if (target.hasClass('blockOverlay') && opts.onOverlayClick)
				opts.onOverlayClick(e);

			// allow events within the message content
			if (target.parents('div.' + opts.blockMsgClass).length > 0)
				return true;

			// allow events for content that is not being blocked
			return target.parents().children().filter('div.blockUI').length === 0;
		}
931959
function fragment(html) {
  var args = arguments
  var i = 1
  return domify(html.replace(/%([se])/g, function(_, type){
    switch (type) {
      case 's': return String(args[i++])
      case 'e': return escape(args[i++])
    }
  }))
}
581926
function(e) {
      if (location.href != prevHref) return;
      wrapper.removeChild(iframe);
      document.title = prevTitle;
      body.removeChild(wrapper);
      body.setAttribute('style',
        body.getAttribute('style').replace('overflow: hidden;', ''));
      removeEventListener('popstate', onPopState);
    }
509771
function resolveElements(segments, elements) {
		for (var i=0; i<segments.length; i++) {
			var segment = segments[i];
			var event = segment.event;
			var element = elements.eq(i);

			// call the trigger with the original element
			var triggerRes = trigger('eventRender', event, event, element);

			if (triggerRes === false) {
				// if `false`, remove the event from the DOM and don't assign it to `segment.event`
				element.remove();
			}
			else {
				if (triggerRes && triggerRes !== true) {
					// the trigger returned a new element, but not `true` (which means keep the existing element)

					// re-assign the important CSS dimension properties that were already assigned in `buildHTMLForSegment`
					triggerRes = $(triggerRes)
						.css({
							position: 'absolute',
							left: segment.left
						});

					element.replaceWith(triggerRes);
					element = triggerRes;
				}

				segment.element = element;
			}
		}
	}
1063324
function hashchange_(e) {
    if (counterLastMatch > 1) {
      counterLastMatch = 0;
      throw new Error(`Cannot go back to last matched hash ${e.oldURL}`);
    }
    // Look for all router3 elements in order
    Promise.all(slice
      .call(document.querySelectorAll(selClass))
      .map(element => {
        /**
         * link router3 with fragment
         * (This process should be decoupled...)
         */
        return new Promise(resolve => {
          let fragments = slice.call(element.querySelectorAll('.mdl-fragment'));
          if (element.classList.contains('mdl-fragment')) {
            resolve_(element, resolve);
          } else {
            // if there's at least one child fragment, then load all fragments
            // and resolve their promises
            Promise.all(fragments.map(fragment => {
              return new Promise(resolve => resolve_(fragment, resolve));
            })).then(resolve);
          }
        });
      })
    ).then(() => {
      // when everything was loaded...
      let match = slice
        .call(document.querySelectorAll(selClass))
        .map(element => route_(element,
            e && e.newURL ? e.newURL : window.location.href, lastMatch))
        .find(result => result);
      if (match) {
        stateRevert = false;
        lastMatch = match;
        counterLastMatch = 0;
      } else {
        let newHash = window.location.hash || '';
        if (newHash !== '') {
          stateRevert = true;
          counterLastMatch++;
          window.location.hash = e && e.oldURL ? e.oldURL.split('#')[1] : '';
          setTimeout(() => {
            throw new Error(`Cannot navigate to ${newHash.slice(1)}`);
          });
        }
      }
    });
  }
465596
function popMethod(/*DOM*/ elem, /*string*/ key) {
		// IE doesn't like colon in property names
		key = key.split(':').join('$');

		var method = elem[key];
		if (method) {
			try {
				delete elem[key];
			} catch (ex) {
				// sometimes IE doesn't like deleting from DOM
				elem[key] = undefined;
			}
		}
		return method;
	}
204804
private void fixInlineElement(Element e) {
    if (e.getClientHeight() == 0 && e.getClientWidth() == 0
        && "inline".equals(curCSS(e, "display", true))) {
      setStyleProperty(e, "display", "inline-block");
      setStyleProperty(e, "width", "auto");
      setStyleProperty(e, "height", "auto");
    }
  }
1327201
function (ev) {
             var carousel = this,
                 css = carousel.CLASSES,
                 target = Event.getTarget(ev),
                 elNode = target.nodeName.toUpperCase(),
                 val,
                 stringIndex,
                 page,
                 item;

             if (Dom.hasClass(target, css.PAGER_ITEM) || Dom.hasClass(target.parentNode, css.PAGER_ITEM))  {
                 if (elNode == "EM") {
                     target = target.parentNode;// item is an em and not an anchor (when text is visible)
                 }
                 val = target.href;
                 stringIndex = val.lastIndexOf("#");
                 page =  parseInt(val.substring(stringIndex+1), 10);
                    if (page != -1) {
                     item = carousel.getFirstVisibleOnPage(page);
                     carousel._selectedItem = item;
                     carousel.scrollTo(item);
                            carousel.focus();
                        }
                        Event.preventDefault(ev);
                    }
        }
1013604
function(ev) {
    console.log('SELURI');
// FIXME firing twice
    $('.selectRow').removeClass('active');
    var $el = $(this), id = $el.parents('tr').attr('id'), uri = decodeURIComponent(utils.deEncID(id));
    if (curURI !== uri) {
      $('#preview').remove();
      shown = false;
    }

    if (shown) {
      $('.selfield').show();
      $('#preview').remove();
      if ($el.hasClass('selectURI')) {
        window.location.hash = '';
        window.location.hash = id;
      }
      if (context.resultsLib.hasQueuedUpdates) {
        console.log('displaying queued updates');
        context.resultsLib.updateResults();
        context.resultsLib.hasQueuedUpdates = null;
      }
      context.resultsLib.hideItemSidebar();
      curURI = null;
      shown = false;
      context.resultsLib.noUpdates = false;
    } else {
      $('.selfield').hide();
      context.resultsLib.displayItemSidebar(uri);
      var title = $el.parents('tr').find('.selectURI.title').text();
      console.log('title', title);
      $('#itemTitle').val(title);
      window.oo = this;
      curURI = uri;
      if ($el.hasClass('selectURI')) {
        $('#preview').remove();
        // use cached address FIXME canonicalize URIs
        //$el.parent().after('<iframe style="width: 100%" id="preview" src="<!-- @var HOMEPAGE -->cached/'+ encodeURIComponent(uri) +'"></iframe>');
        if ($el.hasClass('content')) { // text content
          uri = homepage + 'content/' + encodeURIComponent(uri);
        }
        console.log($el, uri);
        $el.parent().after('<iframe style="width: 100%" id="preview" src="' + uri +'"></iframe>');
        window.location.hash = id;
        context.resultsLib.noUpdates = true;
      } else {
        context.resultsLib.noUpdates = false;
        window.location.hash = '';
      }
      shown = true;
      $el.parents('tr').addClass('active');
    }
    return false;
  }
220744
function (e) {
		// Use a Crafty-standard event object to avoid cross-browser issues
		var original = e,
			evnt = {},
			props = "char charCode keyCode type shiftKey ctrlKey metaKey timestamp".split(" ");
		for (var i = props.length; i;) {
			var prop = props[--i];
			evnt[prop] = original[prop];
		}
		evnt.which = original.charCode != null ? original.charCode : original.keyCode;
		evnt.key = original.keyCode || original.which;
		evnt.originalEvent = original;
		e = evnt;

		if (e.type === "keydown") {
			if (Crafty.keydown[e.key] !== true) {
				Crafty.keydown[e.key] = true;
				Crafty.trigger("KeyDown", e);
			}
		} else if (e.type === "keyup") {
			delete Crafty.keydown[e.key];
			Crafty.trigger("KeyUp", e);
		}

		//prevent default actions for all keys except backspace and F1-F12 and except actions in INPUT and TEXTAREA.
		//prevent bubbling up for all keys except backspace and F1-F12.
		//Among others this prevent the arrow keys from scrolling the parent page
		//of an iframe hosting the game
		if(Crafty.selected && !(e.key == 8 || e.key >= 112 && e.key <= 135)) {
			if(e.stopPropagation) e.stopPropagation();
            else e.cancelBubble = true;

			//Don't prevent default actions if target node is input or textarea.
			if(e.target && e.target.nodeName !== 'INPUT' && e.target.nodeName !== 'TEXTAREA'){
				if(e.preventDefault){
					e.preventDefault();
				} else {
					e.returnValue = false;
				}
			}
			return false;
		}
	}
882335
function workAroundFixedHeaderForAnchors() {
    var HISTORY_SUPPORT = !!(history && history.pushState);
    var ANCHOR_REGEX = /^#[^ ]+$/;

    function getFixedOffset() {
      return $('header').first().height();
    }

    /**
     * If the provided href is an anchor which resolves to an element on the
     * page, scroll to it.
     * @param  {String} href
     * @return {Boolean} - Was the href an anchor.
     */
    function scrollIfAnchor(href, pushToHistory) {
      var match, rect, anchorOffset;

      if (!ANCHOR_REGEX.test(href)) {
        return false;
      }

      match = document.getElementById(href.slice(1));

      if (match) {
        rect = match.getBoundingClientRect();
        anchorOffset = window.pageYOffset + rect.top - getFixedOffset();
        window.scrollTo(window.pageXOffset, anchorOffset);

        // Add the state to history as-per normal anchor links
        if (HISTORY_SUPPORT && pushToHistory) {
          history.pushState({}, document.title, location.pathname + href);
        }
      }

      return !!match;
    }

    /**
     * Attempt to scroll to the current location's hash.
     */
    function scrollToCurrent() {
      scrollIfAnchor(window.location.hash);
    }

    /**
     * If the click event's target was an anchor, fix the scroll position.
     */
    function delegateAnchors(e) {
      var elem = e.target;

      if (scrollIfAnchor(elem.getAttribute('href'), true)) {
        e.preventDefault();
      }
    }

    $(window).on('hashchange', scrollToCurrent);
    // Exclude tabbed content case
    $('a:not([data-tab])').click(delegateAnchors);
    scrollToCurrent();
  }
542672
function _fnClick ( e )
	{
		var nTarget = this;
		while ( nTarget.nodeName != "TD" )
		{
			nTarget = nTarget.parentNode;
		}

		_fnSetFocus( nTarget );
		_fnCaptureKeys();
	}