diff options
author | Stephane Desneux <stephane.desneux@iot.bzh> | 2016-05-31 18:16:48 +0200 |
---|---|---|
committer | Stephane Desneux <stephane.desneux@iot.bzh> | 2016-05-31 18:16:48 +0200 |
commit | 5b1e6cc132f44262a873fa8296a2a3e1017b0278 (patch) | |
tree | 43b2cd54e2e300b399ff3f2af4458a2c4ed8a144 /afb-client/bower_components/tether | |
parent | f7d2f9ac4168ee5064580c666d508667a73cefc0 (diff) | |
parent | 85ace9c1ce9a98e9b8a22f045c7dd752b38d9129 (diff) |
Merge afb-client
Diffstat (limited to 'afb-client/bower_components/tether')
84 files changed, 31521 insertions, 0 deletions
diff --git a/afb-client/bower_components/tether/.bower.json b/afb-client/bower_components/tether/.bower.json new file mode 100644 index 0000000..9186152 --- /dev/null +++ b/afb-client/bower_components/tether/.bower.json @@ -0,0 +1,31 @@ +{ + "name": "tether", + "version": "0.6.5", + "main": "tether.js", + "homepage": "https://github.hubspot.com/tether", + "authors": [ + "Zack Bloom <zackbloom@gmail.com>", + "Adam Schwartz <adam.flynn.schwartz@gmail.com>" + ], + "description": "Tether elements together", + "keywords": [ + "javascript" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "_release": "0.6.5", + "_resolution": { + "type": "version", + "tag": "v0.6.5", + "commit": "783528dac760cb0023e5bd02d63c79ec54b9fc25" + }, + "_source": "git://github.com/HubSpot/tether.git", + "_target": "~0.6.5", + "_originalSource": "tether" +}
\ No newline at end of file diff --git a/afb-client/bower_components/tether/LICENSE b/afb-client/bower_components/tether/LICENSE new file mode 100644 index 0000000..2b88ccf --- /dev/null +++ b/afb-client/bower_components/tether/LICENSE @@ -0,0 +1,8 @@ +Copyright (c) 2014 HubSpot, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/afb-client/bower_components/tether/README.md b/afb-client/bower_components/tether/README.md new file mode 100644 index 0000000..3a92b87 --- /dev/null +++ b/afb-client/bower_components/tether/README.md @@ -0,0 +1,11 @@ +## Tether + +Tether is a JavaScript library for efficiently making an absolutely positioned element stay next to another element on the page. + +It aims to be the canonical implementation of this type of positioning, such that you can build products, not positioning libraries. + +Take a look at the documentation for a more detailed explanation of why you should star it now to remember it for your next project. + +[![Tether Docs](http://i.imgur.com/YCx8cLr.png)](http://github.hubspot.com/tether/#usage) + +### [Demo & Documentation](http://github.hubspot.com/tether/) diff --git a/afb-client/bower_components/tether/bower.json b/afb-client/bower_components/tether/bower.json new file mode 100644 index 0000000..49765fa --- /dev/null +++ b/afb-client/bower_components/tether/bower.json @@ -0,0 +1,22 @@ +{ + "name": "tether", + "version": "0.6.5", + "main": "tether.js", + "homepage": "https://github.hubspot.com/tether", + "authors": [ + "Zack Bloom <zackbloom@gmail.com>", + "Adam Schwartz <adam.flynn.schwartz@gmail.com>" + ], + "description": "Tether elements together", + "keywords": [ + "javascript" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/afb-client/bower_components/tether/coffee/abutment.coffee b/afb-client/bower_components/tether/coffee/abutment.coffee new file mode 100644 index 0000000..5f331e4 --- /dev/null +++ b/afb-client/bower_components/tether/coffee/abutment.coffee @@ -0,0 +1,40 @@ +{getBounds, updateClasses, defer} = @Tether.Utils + +@Tether.modules.push + position: ({top, left}) -> + {height, width} = @cache 'element-bounds', => getBounds @element + + targetPos = @getTargetBounds() + + bottom = top + height + right = left + width + + abutted = [] + if top <= targetPos.bottom and bottom >= targetPos.top + for side in ['left', 'right'] + if targetPos[side] in [left, right] + abutted.push side + + if left <= targetPos.right and right >= targetPos.left + for side in ['top', 'bottom'] + if targetPos[side] in [top, bottom] + abutted.push side + + allClasses = [] + addClasses = [] + + sides = ['left', 'top', 'right', 'bottom'] + allClasses.push @getClass('abutted') + for side in sides + allClasses.push "#{ @getClass('abutted') }-#{ side }" + + if abutted.length + addClasses.push @getClass('abutted') + for side in abutted + addClasses.push "#{ @getClass('abutted') }-#{ side }" + + defer => + updateClasses @target, addClasses, allClasses + updateClasses @element, addClasses, allClasses + + true diff --git a/afb-client/bower_components/tether/coffee/constraint.coffee b/afb-client/bower_components/tether/coffee/constraint.coffee new file mode 100644 index 0000000..d27c1c9 --- /dev/null +++ b/afb-client/bower_components/tether/coffee/constraint.coffee @@ -0,0 +1,260 @@ +{getOuterSize, getBounds, getSize, extend, updateClasses, defer} = @Tether.Utils + +MIRROR_ATTACH = + left: 'right' + right: 'left' + top: 'bottom' + bottom: 'top' + middle: 'middle' + +BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom'] + +getBoundingRect = (tether, to) -> + if to is 'scrollParent' + to = tether.scrollParent + else if to is 'window' + to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset] + + if to is document + to = to.documentElement + + if to.nodeType? + pos = size = getBounds to + style = getComputedStyle to + + to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top] + + for side, i in BOUNDS_FORMAT + side = side[0].toUpperCase() + side.substr(1) + if side in ['Top', 'Left'] + to[i] += parseFloat style["border#{ side }Width"] + else + to[i] -= parseFloat style["border#{ side }Width"] + + to + +@Tether.modules.push + position: ({top, left, targetAttachment}) -> + return true unless @options.constraints + + removeClass = (prefix) => + @removeClass prefix + for side in BOUNDS_FORMAT + @removeClass "#{ prefix }-#{ side }" + + {height, width} = @cache 'element-bounds', => getBounds @element + + if width is 0 and height is 0 and @lastSize? + # Handle the item getting hidden as a result of our positioning without glitching + # the classes in and out + {width, height} = @lastSize + + targetSize = @cache 'target-bounds', => @getTargetBounds() + targetHeight = targetSize.height + targetWidth = targetSize.width + + tAttachment = {} + eAttachment = {} + + allClasses = [@getClass('pinned'), @getClass('out-of-bounds')] + for constraint in @options.constraints + allClasses.push(constraint.outOfBoundsClass) if constraint.outOfBoundsClass + allClasses.push(constraint.pinnedClass) if constraint.pinnedClass + + for cls in allClasses + for side in ['left', 'top', 'right', 'bottom'] + allClasses.push "#{ cls }-#{ side }" + + addClasses = [] + + tAttachment = extend {}, targetAttachment + eAttachment = extend {}, @attachment + + for constraint in @options.constraints + {to, attachment, pin} = constraint + + attachment ?= '' + + if ' ' in attachment + [changeAttachY, changeAttachX] = attachment.split(' ') + else + changeAttachX = changeAttachY = attachment + + bounds = getBoundingRect @, to + + if changeAttachY in ['target', 'both'] + if (top < bounds[1] and tAttachment.top is 'top') + top += targetHeight + tAttachment.top = 'bottom' + + if (top + height > bounds[3] and tAttachment.top is 'bottom') + top -= targetHeight + tAttachment.top = 'top' + + if changeAttachY is 'together' + if top < bounds[1] and tAttachment.top is 'top' + if eAttachment.top is 'bottom' + top += targetHeight + tAttachment.top = 'bottom' + + top += height + eAttachment.top = 'top' + else if eAttachment.top is 'top' + top += targetHeight + tAttachment.top = 'bottom' + + top -= height + eAttachment.top = 'bottom' + + if top + height > bounds[3] and tAttachment.top is 'bottom' + if eAttachment.top is 'top' + top -= targetHeight + tAttachment.top = 'top' + + top -= height + eAttachment.top = 'bottom' + else if eAttachment.top is 'bottom' + top -= targetHeight + tAttachment.top = 'top' + + top += height + eAttachment.top = 'top' + + if tAttachment.top is 'middle' + if top + height > bounds[3] and eAttachment.top is 'top' + top -= height + eAttachment.top = 'bottom' + + else if top < bounds[1] and eAttachment.top is 'bottom' + top += height + eAttachment.top = 'top' + + if changeAttachX in ['target', 'both'] + if (left < bounds[0] and tAttachment.left is 'left') + left += targetWidth + tAttachment.left = 'right' + + if (left + width > bounds[2] and tAttachment.left is 'right') + left -= targetWidth + tAttachment.left = 'left' + + if changeAttachX is 'together' + if left < bounds[0] and tAttachment.left is 'left' + if eAttachment.left is 'right' + left += targetWidth + tAttachment.left = 'right' + + left += width + eAttachment.left = 'left' + + else if eAttachment.left is 'left' + left += targetWidth + tAttachment.left = 'right' + + left -= width + eAttachment.left = 'right' + + else if left + width > bounds[2] and tAttachment.left is 'right' + if eAttachment.left is 'left' + left -= targetWidth + tAttachment.left = 'left' + + left -= width + eAttachment.left = 'right' + + else if eAttachment.left is 'right' + left -= targetWidth + tAttachment.left = 'left' + + left += width + eAttachment.left = 'left' + + else if tAttachment.left is 'center' + if left + width > bounds[2] and eAttachment.left is 'left' + left -= width + eAttachment.left = 'right' + + else if left < bounds[0] and eAttachment.left is 'right' + left += width + eAttachment.left = 'left' + + if changeAttachY in ['element', 'both'] + if (top < bounds[1] and eAttachment.top is 'bottom') + top += height + eAttachment.top = 'top' + + if (top + height > bounds[3] and eAttachment.top is 'top') + top -= height + eAttachment.top = 'bottom' + + if changeAttachX in ['element', 'both'] + if (left < bounds[0] and eAttachment.left is 'right') + left += width + eAttachment.left = 'left' + + if (left + width > bounds[2] and eAttachment.left is 'left') + left -= width + eAttachment.left = 'right' + + if typeof pin is 'string' + pin = (p.trim() for p in pin.split ',') + else if pin is true + pin = ['top', 'left', 'right', 'bottom'] + + pin or= [] + + pinned = [] + oob = [] + if top < bounds[1] + if 'top' in pin + top = bounds[1] + pinned.push 'top' + else + oob.push 'top' + + if top + height > bounds[3] + if 'bottom' in pin + top = bounds[3] - height + pinned.push 'bottom' + else + oob.push 'bottom' + + if left < bounds[0] + if 'left' in pin + left = bounds[0] + pinned.push 'left' + else + oob.push 'left' + + if left + width > bounds[2] + if 'right' in pin + left = bounds[2] - width + pinned.push 'right' + else + oob.push 'right' + + if pinned.length + pinnedClass = @options.pinnedClass ? @getClass('pinned') + addClasses.push pinnedClass + for side in pinned + addClasses.push "#{ pinnedClass }-#{ side }" + + if oob.length + oobClass = @options.outOfBoundsClass ? @getClass('out-of-bounds') + addClasses.push oobClass + for side in oob + addClasses.push "#{ oobClass }-#{ side }" + + if 'left' in pinned or 'right' in pinned + eAttachment.left = tAttachment.left = false + if 'top' in pinned or 'bottom' in pinned + eAttachment.top = tAttachment.top = false + + if tAttachment.top isnt targetAttachment.top or tAttachment.left isnt targetAttachment.left or eAttachment.top isnt @attachment.top or eAttachment.left isnt @attachment.left + @updateAttachClasses eAttachment, tAttachment + + defer => + updateClasses @target, addClasses, allClasses + updateClasses @element, addClasses, allClasses + + {top, left} diff --git a/afb-client/bower_components/tether/coffee/markAttachment.coffee b/afb-client/bower_components/tether/coffee/markAttachment.coffee new file mode 100644 index 0000000..b29c9ef --- /dev/null +++ b/afb-client/bower_components/tether/coffee/markAttachment.coffee @@ -0,0 +1,30 @@ +@Tether.modules.push + initialize: -> + @markers = {} + + for type in ['target', 'element'] + el = document.createElement 'div' + el.className = @getClass("#{ type }-marker") + + dot = document.createElement 'div' + dot.className = @getClass('marker-dot') + el.appendChild dot + + @[type].appendChild el + + @markers[type] = {dot, el} + + position: ({manualOffset, manualTargetOffset}) -> + offsets = + element: manualOffset + target: manualTargetOffset + + for type, offset of offsets + for side, val of offset + if typeof val isnt 'string' or (val.indexOf('%') is -1 and val.indexOf('px') is -1) + val += 'px' + + if @markers[type].dot.style[side] isnt val + @markers[type].dot.style[side] = val + + true diff --git a/afb-client/bower_components/tether/coffee/shift.coffee b/afb-client/bower_components/tether/coffee/shift.coffee new file mode 100644 index 0000000..4dede41 --- /dev/null +++ b/afb-client/bower_components/tether/coffee/shift.coffee @@ -0,0 +1,27 @@ +@Tether.modules.push + position: ({top, left}) -> + return unless @options.shift + + result = (val) -> + if typeof val is 'function' + val.call @, {top, left} + else + val + + shift = result @options.shift + + if typeof shift is 'string' + shift = shift.split(' ') + shift[1] or= shift[0] + + [shiftTop, shiftLeft] = shift + + shiftTop = parseFloat shiftTop, 10 + shiftLeft = parseFloat shiftLeft, 10 + else + [shiftTop, shiftLeft] = [shift.top, shift.left] + + top += shiftTop + left += shiftLeft + + {top, left} diff --git a/afb-client/bower_components/tether/coffee/tether.coffee b/afb-client/bower_components/tether/coffee/tether.coffee new file mode 100644 index 0000000..3df246f --- /dev/null +++ b/afb-client/bower_components/tether/coffee/tether.coffee @@ -0,0 +1,573 @@ +if not @Tether? + throw new Error "You must include the utils.js file before tether.js" + +Tether = @Tether + +{getScrollParent, getSize, getOuterSize, getBounds, getOffsetParent, extend, addClass, removeClass, updateClasses, defer, flush, getScrollBarSize} = Tether.Utils + +within = (a, b, diff=1) -> + a + diff >= b >= a - diff + +transformKey = do -> + el = document.createElement 'div' + + for key in ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform'] + if el.style[key] isnt undefined + return key + +tethers = [] + +position = -> + for tether in tethers + tether.position(false) + + flush() + +now = -> + performance?.now?() ? +new Date + +do -> + lastCall = null + lastDuration = null + pendingTimeout = null + + tick = -> + if lastDuration? and lastDuration > 16 + # We voluntarily throttle ourselves if we can't manage 60fps + lastDuration = Math.min(lastDuration - 16, 250) + + # Just in case this is the last event, remember to position just once more + pendingTimeout = setTimeout tick, 250 + return + + if lastCall? and (now() - lastCall) < 10 + # Some browsers call events a little too frequently, refuse to run more than is reasonable + return + + if pendingTimeout? + clearTimeout pendingTimeout + pendingTimeout = null + + lastCall = now() + + position() + + lastDuration = now() - lastCall + + for event in ['resize', 'scroll', 'touchmove'] + window.addEventListener event, tick + +MIRROR_LR = + center: 'center' + left: 'right' + right: 'left' + +MIRROR_TB = + middle: 'middle' + top: 'bottom' + bottom: 'top' + +OFFSET_MAP = + top: 0 + left: 0 + middle: '50%' + center: '50%' + bottom: '100%' + right: '100%' + +autoToFixedAttachment = (attachment, relativeToAttachment) -> + {left, top} = attachment + + if left is 'auto' + left = MIRROR_LR[relativeToAttachment.left] + + if top is 'auto' + top = MIRROR_TB[relativeToAttachment.top] + + {left, top} + +attachmentToOffset = (attachment) -> + return { + left: OFFSET_MAP[attachment.left] ? attachment.left + top: OFFSET_MAP[attachment.top] ? attachment.top + } + +addOffset = (offsets...) -> + out = {top: 0, left: 0} + + for {top, left} in offsets + if typeof top is 'string' + top = parseFloat(top, 10) + if typeof left is 'string' + left = parseFloat(left, 10) + + out.top += top + out.left += left + + out + +offsetToPx = (offset, size) -> + if typeof offset.left is 'string' and offset.left.indexOf('%') isnt -1 + offset.left = parseFloat(offset.left, 10) / 100 * size.width + if typeof offset.top is 'string' and offset.top.indexOf('%') isnt -1 + offset.top = parseFloat(offset.top, 10) / 100 * size.height + + offset + +parseAttachment = parseOffset = (value) -> + [top, left] = value.split(' ') + + {top, left} + +class _Tether + @modules: [] + + constructor: (options) -> + tethers.push @ + + @history = [] + + @setOptions options, false + + for module in Tether.modules + module.initialize?.call(@) + + @position() + + getClass: (key) -> + if @options.classes?[key] + @options.classes[key] + else if @options.classes?[key] isnt false + if @options.classPrefix + "#{ @options.classPrefix }-#{ key }" + else + key + else + '' + + setOptions: (@options, position=true) -> + defaults = + offset: '0 0' + targetOffset: '0 0' + targetAttachment: 'auto auto' + classPrefix: 'tether' + + @options = extend defaults, @options + + {@element, @target, @targetModifier} = @options + + if @target is 'viewport' + @target = document.body + @targetModifier = 'visible' + else if @target is 'scroll-handle' + @target = document.body + @targetModifier = 'scroll-handle' + + for key in ['element', 'target'] + if not @[key]? + throw new Error "Tether Error: Both element and target must be defined" + + if @[key].jquery? + @[key] = @[key][0] + else if typeof @[key] is 'string' + @[key] = document.querySelector @[key] + + addClass @element, @getClass 'element' + addClass @target, @getClass 'target' + + if not @options.attachment + throw new Error "Tether Error: You must provide an attachment" + + @targetAttachment = parseAttachment @options.targetAttachment + @attachment = parseAttachment @options.attachment + @offset = parseOffset @options.offset + @targetOffset = parseOffset @options.targetOffset + + if @scrollParent? + @disable() + + if @targetModifier is 'scroll-handle' + @scrollParent = @target + else + @scrollParent = getScrollParent @target + + unless @options.enabled is false + @enable(position) + + getTargetBounds: -> + if @targetModifier? + switch @targetModifier + when 'visible' + if @target is document.body + {top: pageYOffset, left: pageXOffset, height: innerHeight, width: innerWidth} + else + bounds = getBounds @target + + out = + height: bounds.height + width: bounds.width + top: bounds.top + left: bounds.left + + out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top)) + out.height = Math.min(out.height, bounds.height - ((bounds.top + bounds.height) - (pageYOffset + innerHeight))) + out.height = Math.min(innerHeight, out.height) + out.height -= 2 + + out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left)) + out.width = Math.min(out.width, bounds.width - ((bounds.left + bounds.width) - (pageXOffset + innerWidth))) + out.width = Math.min(innerWidth, out.width) + out.width -= 2 + + if out.top < pageYOffset + out.top = pageYOffset + if out.left < pageXOffset + out.left = pageXOffset + + out + + when 'scroll-handle' + target = @target + if target is document.body + target = document.documentElement + + bounds = + left: pageXOffset + top: pageYOffset + height: innerHeight + width: innerWidth + else + bounds = getBounds target + + style = getComputedStyle target + + hasBottomScroll = target.scrollWidth > target.clientWidth or 'scroll' is [style.overflow, style.overflowX] or @target isnt document.body + + scrollBottom = 0 + if hasBottomScroll + scrollBottom = 15 + + height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom + + out = + width: 15 + height: height * 0.975 * (height / target.scrollHeight) + left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15 + + fitAdj = 0 + if height < 408 and @target is document.body + fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58 + + if @target isnt document.body + out.height = Math.max out.height, 24 + + scrollPercentage = @target.scrollTop / (target.scrollHeight - height) + out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth) + + if @target is document.body + out.height = Math.max out.height, 24 + + out + else + getBounds @target + + clearCache: -> + @_cache = {} + + cache: (k, getter) -> + # More than one module will often need the same DOM info, so + # we keep a cache which is cleared on each position call + @_cache ?= {} + + if not @_cache[k]? + @_cache[k] = getter.call(@) + + @_cache[k] + + enable: (position=true) -> + addClass @target, @getClass 'enabled' + addClass @element, @getClass 'enabled' + @enabled = true + + if @scrollParent isnt document + @scrollParent.addEventListener 'scroll', @position + + if position + @position() + + disable: -> + removeClass @target, @getClass 'enabled' + removeClass @element, @getClass 'enabled' + @enabled = false + + if @scrollParent? + @scrollParent.removeEventListener 'scroll', @position + + destroy: -> + @disable() + + for tether, i in tethers + if tether is @ + tethers.splice i, 1 + break + + updateAttachClasses: (elementAttach=@attachment, targetAttach=@targetAttachment) -> + sides = ['left', 'top', 'bottom', 'right', 'middle', 'center'] + + if @_addAttachClasses?.length + # updateAttachClasses can be called more than once in a position call, so + # we need to clean up after ourselves such that when the last defer gets + # ran it doesn't add any extra classes from previous calls. + @_addAttachClasses.splice 0, @_addAttachClasses.length + + add = @_addAttachClasses ?= [] + add.push "#{ @getClass('element-attached') }-#{ elementAttach.top }" if elementAttach.top + add.push "#{ @getClass('element-attached') }-#{ elementAttach.left }" if elementAttach.left + add.push "#{ @getClass('target-attached') }-#{ targetAttach.top }" if targetAttach.top + add.push "#{ @getClass('target-attached') }-#{ targetAttach.left }" if targetAttach.left + + all = [] + all.push "#{ @getClass('element-attached') }-#{ side }" for side in sides + all.push "#{ @getClass('target-attached') }-#{ side }" for side in sides + + defer => + return unless @_addAttachClasses? + + updateClasses @element, @_addAttachClasses, all + updateClasses @target, @_addAttachClasses, all + + @_addAttachClasses = undefined + + position: (flushChanges=true) => + # flushChanges commits the changes immediately, leave true unless you are positioning multiple + # tethers (in which case call Tether.Utils.flush yourself when you're done) + + return unless @enabled + + @clearCache() + + # Turn 'auto' attachments into the appropriate corner or edge + targetAttachment = autoToFixedAttachment(@targetAttachment, @attachment) + + @updateAttachClasses @attachment, targetAttachment + + elementPos = @cache 'element-bounds', => getBounds @element + {width, height} = elementPos + + if width is 0 and height is 0 and @lastSize? + # We cache the height and width to make it possible to position elements that are + # getting hidden. + {width, height} = @lastSize + else + @lastSize = {width, height} + + targetSize = targetPos = @cache 'target-bounds', => @getTargetBounds() + + # Get an actual px offset from the attachment + offset = offsetToPx attachmentToOffset(@attachment), {width, height} + targetOffset = offsetToPx attachmentToOffset(targetAttachment), targetSize + + manualOffset = offsetToPx(@offset, {width, height}) + manualTargetOffset = offsetToPx(@targetOffset, targetSize) + + # Add the manually provided offset + offset = addOffset offset, manualOffset + targetOffset = addOffset targetOffset, manualTargetOffset + + # It's now our goal to make (element position + offset) == (target position + target offset) + left = targetPos.left + targetOffset.left - offset.left + top = targetPos.top + targetOffset.top - offset.top + + for module in Tether.modules + ret = module.position.call(@, {left, top, targetAttachment, targetPos, @attachment, elementPos, offset, targetOffset, manualOffset, manualTargetOffset, scrollbarSize}) + + if not ret? or typeof ret isnt 'object' + continue + else if ret is false + return false + else + {top, left} = ret + + # We describe the position three different ways to give the optimizer + # a chance to decide the best possible way to position the element + # with the fewest repaints. + next = { + # It's position relative to the page (absolute positioning when + # the element is a child of the body) + page: + top: top + left: left + + # It's position relative to the viewport (fixed positioning) + viewport: + top: top - pageYOffset + bottom: pageYOffset - top - height + innerHeight + left: left - pageXOffset + right: pageXOffset - left - width + innerWidth + } + + if document.body.scrollWidth > window.innerWidth + scrollbarSize = @cache 'scrollbar-size', getScrollBarSize + next.viewport.bottom -= scrollbarSize.height + + if document.body.scrollHeight > window.innerHeight + scrollbarSize = @cache 'scrollbar-size', getScrollBarSize + next.viewport.right -= scrollbarSize.width + + if document.body.style.position not in ['', 'static'] or document.body.parentElement.style.position not in ['', 'static'] + # Absolute positioning in the body will be relative to the page, not the 'initial containing block' + next.page.bottom = document.body.scrollHeight - top - height + next.page.right = document.body.scrollWidth - left - width + + if @options.optimizations?.moveElement isnt false and not @targetModifier? + offsetParent = @cache 'target-offsetparent', => getOffsetParent @target + offsetPosition = @cache 'target-offsetparent-bounds', -> getBounds offsetParent + offsetParentStyle = getComputedStyle offsetParent + elementStyle = getComputedStyle @element + offsetParentSize = offsetPosition + + offsetBorder = {} + for side in ['Top', 'Left', 'Bottom', 'Right'] + offsetBorder[side.toLowerCase()] = parseFloat offsetParentStyle["border#{ side }Width"] + + offsetPosition.right = document.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right + offsetPosition.bottom = document.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom + + if next.page.top >= (offsetPosition.top + offsetBorder.top) and next.page.bottom >= offsetPosition.bottom + if next.page.left >= (offsetPosition.left + offsetBorder.left) and next.page.right >= offsetPosition.right + # We're within the visible part of the target's scroll parent + + scrollTop = offsetParent.scrollTop + scrollLeft = offsetParent.scrollLeft + + # It's position relative to the target's offset parent (absolute positioning when + # the element is moved to be a child of the target's offset parent). + next.offset = + top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top + left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left + + + # We could also travel up the DOM and try each containing context, rather than only + # looking at the body, but we're gonna get diminishing returns. + + @move next + + @history.unshift next + + if @history.length > 3 + @history.pop() + + if flushChanges + flush() + + true + + move: (position) -> + return if not @element.parentNode? + + same = {} + + for type of position + same[type] = {} + + for key of position[type] + found = false + + for point in @history + unless within(point[type]?[key], position[type][key]) + found = true + break + + if not found + same[type][key] = true + + css = {top: '', left: '', right: '', bottom: ''} + + transcribe = (same, pos) => + if @options.optimizations?.gpu isnt false + if same.top + css.top = 0 + yPos = pos.top + else + css.bottom = 0 + yPos = -pos.bottom + + if same.left + css.left = 0 + xPos = pos.left + else + css.right = 0 + xPos = -pos.right + + + css[transformKey] = "translateX(#{ Math.round xPos }px) translateY(#{ Math.round yPos }px)" + + if transformKey isnt 'msTransform' + # The Z transform will keep this in the GPU (faster, and prevents artifacts), + # but IE9 doesn't support 3d transforms and will choke. + css[transformKey] += " translateZ(0)" + + else + if same.top + css.top = "#{ pos.top }px" + else + css.bottom = "#{ pos.bottom }px" + + if same.left + css.left = "#{ pos.left }px" + else + css.right = "#{ pos.right }px" + + moved = false + if (same.page.top or same.page.bottom) and (same.page.left or same.page.right) + css.position = 'absolute' + transcribe same.page, position.page + + else if (same.viewport.top or same.viewport.bottom) and (same.viewport.left or same.viewport.right) + css.position = 'fixed' + + transcribe same.viewport, position.viewport + + else if same.offset? and same.offset.top and same.offset.left + css.position = 'absolute' + + offsetParent = @cache 'target-offsetparent', => getOffsetParent @target + + if getOffsetParent(@element) isnt offsetParent + defer => + @element.parentNode.removeChild @element + offsetParent.appendChild @element + + transcribe same.offset, position.offset + + moved = true + + else + css.position = 'absolute' + transcribe {top: true, left: true}, position.page + + if not moved and @element.parentNode.tagName isnt 'BODY' + @element.parentNode.removeChild @element + document.body.appendChild @element + + # Any css change will trigger a repaint, so let's avoid one if nothing changed + writeCSS = {} + write = false + for key, val of css + elVal = @element.style[key] + + if elVal isnt '' and val isnt '' and key in ['top', 'left', 'bottom', 'right'] + elVal = parseFloat elVal + val = parseFloat val + + if elVal isnt val + write = true + writeCSS[key] = css[key] + + if write + defer => + extend @element.style, writeCSS + +Tether.position = position + +@Tether = extend _Tether, Tether diff --git a/afb-client/bower_components/tether/coffee/utils.coffee b/afb-client/bower_components/tether/coffee/utils.coffee new file mode 100644 index 0000000..ef1c0ed --- /dev/null +++ b/afb-client/bower_components/tether/coffee/utils.coffee @@ -0,0 +1,211 @@ +@Tether ?= {modules: []} + +getScrollParent = (el) -> + position = getComputedStyle(el).position + + if position is 'fixed' + return el + + scrollParent = undefined + + parent = el + while parent = parent.parentNode + try + style = getComputedStyle parent + + return parent if not style? + + if /(auto|scroll)/.test(style['overflow'] + style['overflow-y'] + style['overflow-x']) + if position isnt 'absolute' or style['position'] in ['relative', 'absolute', 'fixed'] + return parent + + return document.body + +uniqueId = do -> + id = 0 + -> + id++ + +zeroPosCache = {} +getOrigin = (doc) -> + # getBoundingClientRect is unfortunately too accurate. It introduces a pixel or two of + # jitter as the user scrolls that messes with our ability to detect if two positions + # are equivilant or not. We place an element at the top left of the page that will + # get the same jitter, so we can cancel the two out. + node = doc._tetherZeroElement + if not node? + node = doc.createElement 'div' + node.setAttribute 'data-tether-id', uniqueId() + extend node.style, + top: 0 + left: 0 + position: 'absolute' + + doc.body.appendChild node + + doc._tetherZeroElement = node + + id = node.getAttribute 'data-tether-id' + if not zeroPosCache[id]? + zeroPosCache[id] = {} + for k, v of node.getBoundingClientRect() + # Can't use extend, as on IE9, elements don't resolve to be hasOwnProperty + zeroPosCache[id][k] = v + + # Clear the cache when this position call is done + defer -> + zeroPosCache[id] = undefined + + return zeroPosCache[id] + +node = null +getBounds = (el) -> + if el is document + doc = document + el = document.documentElement + else + doc = el.ownerDocument + + docEl = doc.documentElement + + box = {} + # The original object returned by getBoundingClientRect is immutable, so we clone it + # We can't use extend because the properties are not considered part of the object by hasOwnProperty in IE9 + for k, v of el.getBoundingClientRect() + box[k] = v + + origin = getOrigin doc + + box.top -= origin.top + box.left -= origin.left + + box.width ?= document.body.scrollWidth - box.left - box.right + box.height ?= document.body.scrollHeight - box.top - box.bottom + + box.top = box.top - docEl.clientTop + box.left = box.left - docEl.clientLeft + box.right = doc.body.clientWidth - box.width - box.left + box.bottom = doc.body.clientHeight - box.height - box.top + + box + +getOffsetParent = (el) -> + el.offsetParent or document.documentElement + +getScrollBarSize = -> + inner = document.createElement 'div' + inner.style.width = '100%' + inner.style.height = '200px' + + outer = document.createElement 'div' + extend outer.style, + position: 'absolute' + top: 0 + left: 0 + pointerEvents: 'none' + visibility: 'hidden' + width: '200px' + height: '150px' + overflow: 'hidden' + + outer.appendChild inner + + document.body.appendChild outer + + widthContained = inner.offsetWidth + outer.style.overflow = 'scroll' + widthScroll = inner.offsetWidth + + if widthContained is widthScroll + widthScroll = outer.clientWidth + + document.body.removeChild outer + + width = widthContained - widthScroll + + {width, height: width} + +extend = (out={}) -> + args = [] + Array::push.apply(args, arguments) + + for obj in args[1..] when obj + for own key, val of obj + out[key] = val + + out + +removeClass = (el, name) -> + if el.classList? + el.classList.remove(cls) for cls in name.split(' ') when cls.trim() + else + el.className = el.className.replace new RegExp("(^| )#{ name.split(' ').join('|') }( |$)", 'gi'), ' ' + +addClass = (el, name) -> + if el.classList? + el.classList.add(cls) for cls in name.split(' ') when cls.trim() + else + removeClass el, name + el.className += " #{ name }" + +hasClass = (el, name) -> + if el.classList? + el.classList.contains(name) + else + new RegExp("(^| )#{ name }( |$)", 'gi').test(el.className) + +updateClasses = (el, add, all) -> + # Of the set of 'all' classes, we need the 'add' classes, and only the + # 'add' classes to be set. + for cls in all when cls not in add + if hasClass(el, cls) + removeClass el, cls + + for cls in add + if not hasClass(el, cls) + addClass el, cls + +deferred = [] + +defer = (fn) -> + deferred.push fn + +flush = -> + fn() while fn = deferred.pop() + +class Evented + on: (event, handler, ctx, once=false) -> + @bindings ?= {} + @bindings[event] ?= [] + @bindings[event].push {handler, ctx, once} + + once: (event, handler, ctx) -> + @on(event, handler, ctx, true) + + off: (event, handler) -> + return unless @bindings?[event]? + + if not handler? + delete @bindings[event] + else + i = 0 + while i < @bindings[event].length + if @bindings[event][i].handler is handler + @bindings[event].splice i, 1 + else + i++ + + trigger: (event, args...) -> + if @bindings?[event] + i = 0 + while i < @bindings[event].length + {handler, ctx, once} = @bindings[event][i] + + handler.apply(ctx ? @, args) + + if once + @bindings[event].splice i, 1 + else + i++ + +@Tether.Utils = {getScrollParent, getBounds, getOffsetParent, extend, addClass, removeClass, hasClass, updateClasses, defer, flush, uniqueId, Evented, getScrollBarSize} diff --git a/afb-client/bower_components/tether/component.json b/afb-client/bower_components/tether/component.json new file mode 100644 index 0000000..e593901 --- /dev/null +++ b/afb-client/bower_components/tether/component.json @@ -0,0 +1,19 @@ +{ + "name": "tether", + "repo": "HubSpot/tether", + "version": "0.6.5", + "description": "A client-side library to make absolutely positioned elements attach to elements in the page efficiently.", + "authors": [ + "Zack Bloom <zackbloom@gmail.com>", + "Adam Schwartz <adam.flynn.schwartz@gmail.com>" + ], + "license": "MIT", + "demo": "http://github.hubspot.com/tether/docs/welcome/", + "main": "tether.js", + "styles": [ + "css/tether.css" + ], + "scripts": [ + "tether.js" + ] +} diff --git a/afb-client/bower_components/tether/css/tether-theme-arrows-dark.css b/afb-client/bower_components/tether/css/tether-theme-arrows-dark.css new file mode 100644 index 0000000..2576f19 --- /dev/null +++ b/afb-client/bower_components/tether/css/tether-theme-arrows-dark.css @@ -0,0 +1,112 @@ +.tether-element, .tether-element:after, .tether-element:before, .tether-element *, .tether-element *:after, .tether-element *:before { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; } + +.tether-element { + position: absolute; + display: none; } + .tether-element.tether-open { + display: block; } + +.tether-element.tether-theme-arrows-dark { + max-width: 100%; + max-height: 100%; } + .tether-element.tether-theme-arrows-dark .tether-content { + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + -ms-border-radius: 5px; + -o-border-radius: 5px; + border-radius: 5px; + position: relative; + font-family: inherit; + background: black; + color: white; + padding: 1em; + font-size: 1.1em; + line-height: 1.5em; } + .tether-element.tether-theme-arrows-dark .tether-content:before { + content: ""; + display: block; + position: absolute; + width: 0; + height: 0; + border-color: transparent; + border-width: 16px; + border-style: solid; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-center .tether-content { + margin-bottom: 16px; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-center .tether-content:before { + top: 100%; + left: 50%; + margin-left: -16px; + border-top-color: black; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-center .tether-content { + margin-top: 16px; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-center .tether-content:before { + bottom: 100%; + left: 50%; + margin-left: -16px; + border-bottom-color: black; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-right.tether-element-attached-middle .tether-content { + margin-right: 16px; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-right.tether-element-attached-middle .tether-content:before { + left: 100%; + top: 50%; + margin-top: -16px; + border-left-color: black; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-left.tether-element-attached-middle .tether-content { + margin-left: 16px; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-left.tether-element-attached-middle .tether-content:before { + right: 100%; + top: 50%; + margin-top: -16px; + border-right-color: black; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-left.tether-target-attached-bottom .tether-content { + margin-top: 16px; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-left.tether-target-attached-bottom .tether-content:before { + bottom: 100%; + left: 16px; + border-bottom-color: black; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-right.tether-target-attached-bottom .tether-content { + margin-top: 16px; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-right.tether-target-attached-bottom .tether-content:before { + bottom: 100%; + right: 16px; + border-bottom-color: black; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-top .tether-content { + margin-bottom: 16px; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-top .tether-content:before { + top: 100%; + left: 16px; + border-top-color: black; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-top .tether-content { + margin-bottom: 16px; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-top .tether-content:before { + top: 100%; + right: 16px; + border-top-color: black; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-right.tether-target-attached-left .tether-content { + margin-right: 16px; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-right.tether-target-attached-left .tether-content:before { + top: 16px; + left: 100%; + border-left-color: black; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-left.tether-target-attached-right .tether-content { + margin-left: 16px; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-left.tether-target-attached-right .tether-content:before { + top: 16px; + right: 100%; + border-right-color: black; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-left .tether-content { + margin-right: 16px; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-left .tether-content:before { + bottom: 16px; + left: 100%; + border-left-color: black; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-right .tether-content { + margin-left: 16px; } + .tether-element.tether-theme-arrows-dark.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-right .tether-content:before { + bottom: 16px; + right: 100%; + border-right-color: black; } diff --git a/afb-client/bower_components/tether/css/tether-theme-arrows.css b/afb-client/bower_components/tether/css/tether-theme-arrows.css new file mode 100644 index 0000000..a3fb100 --- /dev/null +++ b/afb-client/bower_components/tether/css/tether-theme-arrows.css @@ -0,0 +1,120 @@ +.tether-element, .tether-element:after, .tether-element:before, .tether-element *, .tether-element *:after, .tether-element *:before { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; } + +.tether-element { + position: absolute; + display: none; } + .tether-element.tether-open { + display: block; } + +.tether-element.tether-theme-arrows { + max-width: 100%; + max-height: 100%; } + .tether-element.tether-theme-arrows .tether-content { + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + -ms-border-radius: 5px; + -o-border-radius: 5px; + border-radius: 5px; + position: relative; + font-family: inherit; + background: white; + color: inherit; + padding: 1em; + font-size: 1.1em; + line-height: 1.5em; + -webkit-transform: translateZ(0); + -moz-transform: translateZ(0); + -ms-transform: translateZ(0); + -o-transform: translateZ(0); + transform: translateZ(0); + -webkit-filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2)); + -moz-filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2)); + filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.2)); } + .tether-element.tether-theme-arrows .tether-content:before { + content: ""; + display: block; + position: absolute; + width: 0; + height: 0; + border-color: transparent; + border-width: 16px; + border-style: solid; } + .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-center .tether-content { + margin-bottom: 16px; } + .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-center .tether-content:before { + top: 100%; + left: 50%; + margin-left: -16px; + border-top-color: white; } + .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-center .tether-content { + margin-top: 16px; } + .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-center .tether-content:before { + bottom: 100%; + left: 50%; + margin-left: -16px; + border-bottom-color: white; } + .tether-element.tether-theme-arrows.tether-element-attached-right.tether-element-attached-middle .tether-content { + margin-right: 16px; } + .tether-element.tether-theme-arrows.tether-element-attached-right.tether-element-attached-middle .tether-content:before { + left: 100%; + top: 50%; + margin-top: -16px; + border-left-color: white; } + .tether-element.tether-theme-arrows.tether-element-attached-left.tether-element-attached-middle .tether-content { + margin-left: 16px; } + .tether-element.tether-theme-arrows.tether-element-attached-left.tether-element-attached-middle .tether-content:before { + right: 100%; + top: 50%; + margin-top: -16px; + border-right-color: white; } + .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-left.tether-target-attached-bottom .tether-content { + margin-top: 16px; } + .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-left.tether-target-attached-bottom .tether-content:before { + bottom: 100%; + left: 16px; + border-bottom-color: white; } + .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-right.tether-target-attached-bottom .tether-content { + margin-top: 16px; } + .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-right.tether-target-attached-bottom .tether-content:before { + bottom: 100%; + right: 16px; + border-bottom-color: white; } + .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-top .tether-content { + margin-bottom: 16px; } + .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-top .tether-content:before { + top: 100%; + left: 16px; + border-top-color: white; } + .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-top .tether-content { + margin-bottom: 16px; } + .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-top .tether-content:before { + top: 100%; + right: 16px; + border-top-color: white; } + .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-right.tether-target-attached-left .tether-content { + margin-right: 16px; } + .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-right.tether-target-attached-left .tether-content:before { + top: 16px; + left: 100%; + border-left-color: white; } + .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-left.tether-target-attached-right .tether-content { + margin-left: 16px; } + .tether-element.tether-theme-arrows.tether-element-attached-top.tether-element-attached-left.tether-target-attached-right .tether-content:before { + top: 16px; + right: 100%; + border-right-color: white; } + .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-left .tether-content { + margin-right: 16px; } + .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-right.tether-target-attached-left .tether-content:before { + bottom: 16px; + left: 100%; + border-left-color: white; } + .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-right .tether-content { + margin-left: 16px; } + .tether-element.tether-theme-arrows.tether-element-attached-bottom.tether-element-attached-left.tether-target-attached-right .tether-content:before { + bottom: 16px; + right: 100%; + border-right-color: white; } diff --git a/afb-client/bower_components/tether/css/tether-theme-basic.css b/afb-client/bower_components/tether/css/tether-theme-basic.css new file mode 100644 index 0000000..95bc689 --- /dev/null +++ b/afb-client/bower_components/tether/css/tether-theme-basic.css @@ -0,0 +1,29 @@ +.tether-element, .tether-element:after, .tether-element:before, .tether-element *, .tether-element *:after, .tether-element *:before { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; } + +.tether-element { + position: absolute; + display: none; } + .tether-element.tether-open { + display: block; } + +.tether-element.tether-theme-basic { + max-width: 100%; + max-height: 100%; } + .tether-element.tether-theme-basic .tether-content { + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + -ms-border-radius: 5px; + -o-border-radius: 5px; + border-radius: 5px; + -webkit-box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); + font-family: inherit; + background: white; + color: inherit; + padding: 1em; + font-size: 1.1em; + line-height: 1.5em; } diff --git a/afb-client/bower_components/tether/css/tether.css b/afb-client/bower_components/tether/css/tether.css new file mode 100644 index 0000000..3372a2b --- /dev/null +++ b/afb-client/bower_components/tether/css/tether.css @@ -0,0 +1,10 @@ +.tether-element, .tether-element:after, .tether-element:before, .tether-element *, .tether-element *:after, .tether-element *:before { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; } + +.tether-element { + position: absolute; + display: none; } + .tether-element.tether-open { + display: block; } diff --git a/afb-client/bower_components/tether/docs/1-Overview/1-why_you_should_use_tether.md b/afb-client/bower_components/tether/docs/1-Overview/1-why_you_should_use_tether.md new file mode 100644 index 0000000..6147d25 --- /dev/null +++ b/afb-client/bower_components/tether/docs/1-Overview/1-why_you_should_use_tether.md @@ -0,0 +1,43 @@ +## Why You Should Use Tether + +Virtually every app includes some sort of overlay attached to an element on the page. +Things like [tooltips](http://github.hubspot.com/tooltip/docs/welcome), +[dropdowns](http://github.hubspot.com/select/docs/welcome), [hover-activated info boxes](http://github.hubspot.com/drop/docs/welcome), etc. + +Those elements need to be attached to something on the page. Actually placing them next to +the element in the DOM causes problems though, if any parent element is anything +but `overflow: visible`, the element gets cut off. So you need absolute positioning +in the body. + +Some of the time absolute positioning is right, but what about if the thing we're +attached to is fixed to the center of the screen? We'll have to move it every +time the user scrolls. What about if the element is in a scrollable container, +if the overlay is inside of it (so no clipping), it would be cool if the code +were smart enough to move it inside when that area is scrolled. That way we +need to reposition it even less. + +It would also be nice if the code could somehow figure out whether positioning it +from the top, bottom, left, or right would result in the fewest repositionings +as the user scrolls or resizes. + +Most of the time you're building these elements it would be nice for the element to +flip to the other side of the element if it hits the edge of the screen, or a scrollable +container it might be in. It would be nice if we could confine the element +to within some area, or even hide it when it leaves. + +It would be nice for the element to be repositioned with CSS transforms +rather than top and left when possible, to allow the positioning to be done entirely +in the GPU. + +Now that the positioning is so fancy, you're going to use it for more and more +elements. It would be cool if the library could optimize all of their repositioning +into a single repaint. + +All of that is baked into Tether. + +### tl;dr + +- Optimized GPU-accelerated repositioning for 60fps scrolling +- Reliable positioning on any possible corner, edge or point in between. +- Support for repositioning or pinning the element when it would be offscreen +- Designed to be embeddable in other libraries diff --git a/afb-client/bower_components/tether/docs/1-Overview/2-repositioning.md b/afb-client/bower_components/tether/docs/1-Overview/2-repositioning.md new file mode 100644 index 0000000..6c02483 --- /dev/null +++ b/afb-client/bower_components/tether/docs/1-Overview/2-repositioning.md @@ -0,0 +1,46 @@ +Repositioning +----- + +Tethers will be automatically repositioned when the page is resized, and when any element containing the Tether is scrolled. +If the element moves for some other reason (e.g. with JavaScript), Tether won't know to reposition the element. + +#### Manually Repositioning + +The simplest way to reposition every Tether on the page is to call `Tether.position()`. It will efficiently reposition every +Tether in a single repaint, making it more efficient than manually repositioning many Tethers individually. + +```javascript +Tether.position() +``` + +#### Repositioning a Single Tether + +If you have many Tethers on screen, it may be more efficient to just reposition the tether that needs it. You can do this +by calling the `.position` method on the Tether instance: + +```javascript +tether = new Tether({ ... }) + +// Later: +tether.position() +``` + +#### Tethering Hidden Elements + +If you are creating a tether involving elements which are `display: none`, or not actually in the DOM, +your Tether may not be able to position itself properly. One way around this is to +ensure that a position call happens after all layouts have finished: + +```javascript +myElement.style.display = 'block' + +tether = new Tether({ ... }) + +setTimeout(function(){ + tether.position(); +}) +``` + +In general however, you shouldn't have any trouble if both the element and the target are visible and in the DOM when you +create the Tether. If that is not the case, create the Tether disabled (option `enabled`: `false`), and enable it when +the elements are ready. diff --git a/afb-client/bower_components/tether/docs/1-Overview/3-why_we_dont_support_IE_8.md b/afb-client/bower_components/tether/docs/1-Overview/3-why_we_dont_support_IE_8.md new file mode 100644 index 0000000..841de9e --- /dev/null +++ b/afb-client/bower_components/tether/docs/1-Overview/3-why_we_dont_support_IE_8.md @@ -0,0 +1,47 @@ +Why we don't support IE 8 +------------------------- + +We've been living in 2007 for a while now, pretending that new browser features don't +exist because they aren't in IE8. You might not even know about some of these features, +or think they are only enabled by jQuery or underscore, simply because it hasn't +been an option to rely upon them. + +Here is the list of features you don't have if you choose to support IE 8: + +- HTML5 audio and video +- SVG +- Canvas +- TrueType fonts +- Media Queries +- CSS Transforms +- Multiple Backgrounds +- CSS3 Units (vh, vw, rem) +- Custom DOM events +- Hardware accelerated graphics +- The DOMContentLoaded event +- addEventListener +- Object.create, .seal, .freeze, .defineProperty +- Array.isArray, .indexOf, .every, .some, .forEach, .map, .filter, .reduce +- A modern JavaScript engine +- A real developer tools +- A consistent box model +- jQuery 2 +- Google Apps +- Tether + +It's true that IE 8 still holds a big chunk of the browsing population, but the reasons +why they can't update are dwindling. There are two big reasons for continuing IE 8 support. + +#### Enterprises + + Microsoft is dropping support for XP in April, organizations who want security updates will have to upgrade. + +#### China uses XP + + Chrome, Firefox and Opera all support XP. Nothing prevents users from upgrading, except the inertia of + organizations who still support IE 8. + +#### The Future + +We are skating towards where the puck will be, and we hope that as you decide to drop IE 8 support, +you choose to add Tether to the list of awesome things you can do. diff --git a/afb-client/bower_components/tether/docs/2-Examples/1-list_of_examples.md b/afb-client/bower_components/tether/docs/2-Examples/1-list_of_examples.md new file mode 100644 index 0000000..bbb7fd5 --- /dev/null +++ b/afb-client/bower_components/tether/docs/2-Examples/1-list_of_examples.md @@ -0,0 +1,27 @@ +### Examples + +It's our goal to create a wide variety of example of how Tether +can be used. Here's what we have so far, please send a PR with +any examples you might create. + +#### Beginner + +- [simple](../../examples/simple): A simple example to get you started +- [out-of-bounds](../../examples/out-of-bounds): How to hide the element when it would +otherwise be offscreen +- [pin](../../examples/pin): How to pin the element so it never goes offscreen +- [enable-disable](../../examples/enable-disable): How to enable and disable the Tether +in JavaScript + +#### Advanced + +- [content-visible](../../examples/content-visible): Demonstrates using the `'visible'` +`targetModifier` to align an element with the visible portion of another. +- [dolls](../../examples/dolls): A performance test to show several dozen elements, +each tethered to the previous. Try dragging the top left tether. +- [element-scroll](../../examples/element-scroll): Demonstrates using the `'scroll-handle'` +`targetModifier` to align an element with the scrollbar of an element. +- [scroll](../../examples/scroll): Demonstrates using the `'scroll-handle'` `targetModifier` +to align an element with the body's scroll handle. +- [viewport](../../examples/viewport): Demonstrates aligning an element with the +viewport by using the `'visible'` `targetModifier` when tethered to the body. diff --git a/afb-client/bower_components/tether/docs/2-Examples/2-projects_using_tether.md b/afb-client/bower_components/tether/docs/2-Examples/2-projects_using_tether.md new file mode 100644 index 0000000..b668a03 --- /dev/null +++ b/afb-client/bower_components/tether/docs/2-Examples/2-projects_using_tether.md @@ -0,0 +1,29 @@ +## Projects Using Tether + +Here at HubSpot we have built a bunch of libraries on top of Tether, +both because we wanted Tether-performance, and because we saw opportunities +to improve on what was available in the client-side ecosystem. + +### [Select](http://github.hubspot.com/select/docs/welcome) + +Select is a replacement for native browser select elements that is fully stylable. + +### [Shepherd](http://github.hubspot.com/shepherd/docs/welcome) + +Shepherd is a library for making tours of your app to help onboard users and show off +new features. + +### [Tooltip](http://github.hubspot.com/tooltip/docs/welcome) + +A simple, easy-to-use implementation of tooltips that works well. + +### [Drop](http://github.hubspot.com/drop/docs/welcome) + +Where Tether does general-purpose positioning, Drop assumes that you are interested +in making something which pops up next to something the user clicks or hovers on. + +If your building something that fits that pattern, Drop can make things a little easier. + +### Your Project Here + +If you have a cool open-source library built on Tether, PR this doc, or [get in touch](mailto:zbloom@hubspot.com). diff --git a/afb-client/bower_components/tether/docs/3-Advanced/1-embedding_tether.md b/afb-client/bower_components/tether/docs/3-Advanced/1-embedding_tether.md new file mode 100644 index 0000000..f47be16 --- /dev/null +++ b/afb-client/bower_components/tether/docs/3-Advanced/1-embedding_tether.md @@ -0,0 +1,9 @@ +## Embedding Tether + +Tether is designed to be embeddable in other libraries. + +There is one thing you should think about doing to create an embedded Tether: + +- Set the `classPrefix` of the tethers you create. That prefix will replace `'tether'` in +all of the classes. You can also disable classes you don't intend on using with the `classes` +option. diff --git a/afb-client/bower_components/tether/docs/3-Advanced/2-extending_tether.md b/afb-client/bower_components/tether/docs/3-Advanced/2-extending_tether.md new file mode 100644 index 0000000..6a13e68 --- /dev/null +++ b/afb-client/bower_components/tether/docs/3-Advanced/2-extending_tether.md @@ -0,0 +1,54 @@ +Extending Tether +----- + +Tether has a module system which can be used to modify Tether's positioning, or just do something each time the Tether is moved. + +Tether has an array called `Tether.modules`, push onto it to add a module: + +```coffeescript +Tether.modules.push + position: ({top, left}) -> + top += 10 + + {top, left} +``` + +#### Position + +Your position function can either return a new object with `top` and `left`, `null`/`undefined` to leave the coordinates unchanged, or +`false` to cancel the positioning. + +The position function is passed an object with the following elements: + +```javascript +{ + left, // The element's new position, from the top left corner of the page + top, + targetAttachment, // The targetAttachment, with 'auto' resolved to an actual attachment + targetPos, // The coordinates of the target + attachment, // The attachment, as passed in the option + elementPos, // The coordinates of the element + offset, // The offset, after it's converted into pixels and the manual offset is added + targetOffset, // The attachment is converted into an offset and is included in these values + manualOffset, // The manual offset, in pixels + manualTargetOffset +} +``` + +It is called with the Tether instance as its context (`this`). + +#### Initialize + +Modules can also have an `initialize` function which will be called when a new tether is created. The initialize function +is also called with the Tether instance as its context. + +```coffeescript +Tether.modules.push + initialize: -> + console.log "New Tether Created!", @ +``` + +#### Examples + +[Constraints](https://github.com/HubSpot/tether/blob/master/coffee/constraint.coffee) and [shift](https://github.com/HubSpot/tether/blob/master/coffee/shift.coffee) are both implemented as modules. +[Mark Attachment](https://github.com/HubSpot/tether/blob/master/coffee/markAttachment.coffee) is used by the docs. diff --git a/afb-client/bower_components/tether/docs/coffee/intro.coffee b/afb-client/bower_components/tether/docs/coffee/intro.coffee new file mode 100644 index 0000000..52a305d --- /dev/null +++ b/afb-client/bower_components/tether/docs/coffee/intro.coffee @@ -0,0 +1,113 @@ +{uniqueId} = Tether.Utils + +SETUP_JS = """ +yellowBox = $('.yellow-box', $output); +greenBox = $('.green-box', $output); +scrollBox = $('.scroll-box', $output); +""" + +OUTPUT_HTML = (key) -> """ +<div class="scroll-box"> + <div class="scroll-content"> + <div class="yellow-box" data-example="#{ key }"></div> + <div class="green-box" data-example="#{ key }"></div> + </div> +</div> +""" + +tethers = {} + +getOutput = ($block) -> + key = $block.data('example') + if key and typeof key is 'string' + return $("output[data-example='#{ key }']") + else + return $block.parents('pre').nextAll('output').first() + +run = (key) -> + if typeof key is 'string' + $block = $("code[data-example='#{ key }']") + else + $block = key + + key = $block.attr('data-example') + + $output = getOutput $block + + code = $block.text() + code = SETUP_JS + code + + window.$output = $output + tethers[key] = eval code + +setupBlock = ($block) -> + key = $block.data('example') + + $output = getOutput $block + + if not key + key = uniqueId() + $block.attr('data-example', key) + $output.attr('data-example', key) + $output.find('.tether-element').attr('data-example', key) + + $output.html OUTPUT_HTML(key) + + $scrollBox = $output.find('.scroll-box') + $scrollContent = $scrollBox.find('.scroll-content') + $scrollBox.scrollTop(parseInt($scrollContent.css('height')) / 2 - $scrollBox.height() / 2) + $scrollBox.scrollLeft(parseInt($scrollContent.css('width')) / 2 - $scrollBox.width() / 2) + setTimeout -> + $scrollBox.on 'scroll', -> + $output.addClass 'scrolled' + + $scrollBox.css 'height', "#{ $block.parent().outerHeight() }px" + + if not $output.attr('deactivated')? + run $block + +$(document.body).on 'click', (e) -> + if $(e.target).is('output[deactivated]') + activate $(e.target) + false + else if $(e.target).is('output[activated]') + deactivate $(e.target) + false + +activate = ($output) -> + $block = $output.prev().find('code') + + run $block + + $output.find('.tether-element').show() + + key = $output.data('example') + $(tethers[key].element).show() + tethers[key].enable() + + $output.removeAttr('deactivated') + $output.attr('activated', true) + +deactivate = ($output) -> + $block = $output.prev().find('code') + key = $output.data('example') + + tethers[key].disable() + + $el = $(tethers[key].element) + $el.detach() + $output.find('.scroll-content').append $el + $el.hide() + + $output.removeAttr('activated') + $output.attr('deactivated', true) + +init = -> + $blocks = $('code[data-example]') + + setupBlock($ block) for block in $blocks + +window.EXECUTR_OPTIONS = + codeSelector: 'code[executable]' + +$ init diff --git a/afb-client/bower_components/tether/docs/css/intro.css b/afb-client/bower_components/tether/docs/css/intro.css new file mode 100644 index 0000000..46a9ce9 --- /dev/null +++ b/afb-client/bower_components/tether/docs/css/intro.css @@ -0,0 +1,219 @@ +@charset "UTF-8"; +*, *:after, *:before { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; } + +body { + position: relative; } + +.yellow-box { + width: 100px; + height: 100px; + background-color: #ffee88; + pointer-events: none; } + +.green-box { + margin-top: 65px; + margin-left: 100px; + width: 200px; + height: 50px; + background-color: #44ee99; } + .no-green .green-box { + display: none; } + +.scroll-box { + height: 150px; + border: 10px solid #eeeeee; + background: #fbfbfb; + overflow: auto; + position: relative; } + +.scroll-content { + height: 2000px; + width: 2000px; + padding: 910px 809px; } + +pre.pre-with-output { + margin: 0; + width: 50%; + float: left; } + pre.pre-with-output code mark { + background: #b8daff; + color: black; } + +p, h2, h3 { + clear: both; } + +output { + display: block; + position: relative; + width: 50%; + float: right; + margin-bottom: 15px; } + output.scroll-page .scroll-box { + overflow: hidden; } + output.scroll-page:after { + content: "↕ scroll the page ↕"; } + output:after { + content: "↕ scroll this area ↕"; + position: absolute; + bottom: 25px; + width: 100%; + text-align: center; + font-size: 16px; + font-variant: small-caps; + color: #777777; + opacity: 1; + transition: opacity 0.2s; } + output.scrolled:after { + opacity: 0; } + output[deactivated], output[activated] { + cursor: pointer; } + output[deactivated] .scroll-box, output[activated] .scroll-box { + pointer-events: none; } + output[deactivated]:after, output[activated]:after { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + opacity: 1; + content: "Click To Show"; + background-color: #aaaaaa; + border-left: 10px solid #eeeeee; + color: white; + font-size: 24px; + font-variant: normal; + padding-top: 80px; } + output[activated]:after { + content: "Click To Hide"; } + output[activated].visible-enabled:after { + height: 35px; + padding-top: 5px; } + +.attachment-mark, .tether-marker-dot { + position: relative; } + .attachment-mark:after, .tether-marker-dot:after { + content: "A"; + width: 10px; + height: 10px; + background-color: red; + display: inline-block; + line-height: 10px; + font-size: 9px; + color: white; + text-align: center; + position: absolute; } + +span.attachment-mark:after, span.tether-marker-dot:after { + position: relative; + top: -1px; + margin-right: 1px; } + +.tether-marker-dot { + position: absolute; } + .tether-marker-dot:after { + top: -5px; + left: -5px; } + +.tether-target-marker { + position: absolute; } + div.tether-target-attached-left .tether-target-marker { + left: 0; } + div.tether-target-attached-top .tether-target-marker { + top: 0; } + div.tether-target-attached-bottom .tether-target-marker { + bottom: 0; } + div.tether-target-attached-right .tether-target-marker { + right: 0; } + div.tether-target-attached-center .tether-target-marker { + left: 50%; } + +.tether-element-marker { + position: absolute; } + div.tether-element-attached-left .tether-element-marker { + left: 0; } + div.tether-element-attached-top .tether-element-marker { + top: 0; } + div.tether-element-attached-bottom .tether-element-marker { + bottom: 0; } + div.tether-element-attached-right .tether-element-marker { + right: 0; } + div.tether-element-attached-center .tether-element-marker { + left: 50%; } + +.tether-element-attached-middle .tether-element-marker { + top: 50px; } + +.tether-target-attached-middle .tether-target-marker { + top: 25px; } + +.tether-element { + position: relative; } + .tether-element.tether-pinned-left { + box-shadow: inset 2px 0 0 0 red; } + .tether-element.tether-pinned-right { + box-shadow: inset -2px 0 0 0 red; } + .tether-element.tether-pinned-top { + box-shadow: inset 0 2px 0 0 red; } + .tether-element.tether-pinned-bottom { + box-shadow: inset 0 -2px 0 0 red; } + +.tether-target { + position: relative; } + +.tether-element.tether-out-of-bounds[data-example="hide"] { + display: none; } + +[data-example^="optimizer"].lang-javascript { + /* This should just be a `code` selector, but sass doesn't allow that with & */ + min-height: 220px; } +[data-example^="optimizer"].tether-element:before { + margin-top: 26px; + display: block; + text-align: center; + content: "I'm in the body"; + line-height: 1.2; + font-size: 15px; + padding: 4px; + color: #666666; } +[data-example^="optimizer"] .scroll-box .tether-element:before { + content: "I'm in my scroll parent!"; } + +.tether-element[data-example="scroll-visible"] { + height: 30px; } + .tether-element[data-example="scroll-visible"] .tether-marker-dot { + display: none; } + +.hs-doc-content h2.projects-header { + text-align: center; + font-weight: 300; } + +.projects-paragraph { + text-align: center; } + .projects-paragraph a { + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + *vertical-align: auto; + zoom: 1; + *display: inline; + text-align: center; + margin-right: 30px; + color: inherit; } + .projects-paragraph a span { + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + *vertical-align: auto; + zoom: 1; + *display: inline; + margin-bottom: 20px; + font-size: 20px; + color: inherit; + font-weight: 300; } + .projects-paragraph a img { + display: block; + max-width: 100%; + width: 100px; } diff --git a/afb-client/bower_components/tether/docs/intro.md b/afb-client/bower_components/tether/docs/intro.md new file mode 100644 index 0000000..3681d29 --- /dev/null +++ b/afb-client/bower_components/tether/docs/intro.md @@ -0,0 +1,600 @@ +<script src="tether.js"></script> +<script src="js/markAttachment.js"></script> +<script src="docs/js/intro.js"></script> +<link rel="stylesheet" href="docs/css/intro.css"></link> + +Tether +====== + +Tether is a JavaScript library for efficiently making an absolutely positioned +element stay next to another element on the page. For example, you might +want a tooltip or dialog to open, and remain, next to the relevant item +on the page. + +Tether includes the ability to constrain the element within the viewport, its +scroll parent, any other element on the page, or a fixed bounding box. When it +exceeds those constraints it can be pinned to the edge, flip to the other +side of its target, or hide itself. + +Tether optimizes its location placement to result in the minimum amount of +'jankyness' as the page is scrolled and resized. The page can maintain 60fps +scrolling even with dozens or hundreds of tethers on screen (pop open the +devtools timeline as you scroll this page). + +Tether is 5kb minified and gzipped, and supports IE9+, and all modern +browsers. + +<h2 class="projects-header">Projects Built With Tether</h2> +<p class="projects-paragraph"> +<a href="http://github.hubspot.com/select/docs/welcome"><span>Select</span><img src="http://github.hubspot.com/os-icons/select-icon.png" /></a> +<a href="http://github.hubspot.com/drop/docs/welcome"><span>Drop</span><img src="http://github.hubspot.com/os-icons/drop-icon.png" /></a> +<a href="http://github.hubspot.com/tooltip/docs/welcome"><span>Tooltip</span><img src="http://github.hubspot.com/os-icons/tooltip-icon.png" /></a> +<a href="http://github.hubspot.com/shepherd/docs/welcome"><span>Shepherd</span><img src="http://github.hubspot.com/os-icons/shepherd-icon.png" /></a> +</p> + +Usage +----- + +The element to be moved is called the 'element'. +The element in the page it's to be attached to is called the 'target'. + +To use Tether, you define a point on the target and a point on the element. +Tether moves the element to keep those two points on top of each other. + +That point is called the attachment (we've marked it in the examples with +a red <span class="attachment-mark"></span>). For example, if you'd like +the element to sit on the left of the target: + +<pre class="pre-with-output"><code class="lang-javascript" data-example='usage'>new Tether({ + element: yellowBox, + target: greenBox, + attachment: 'top right', + targetAttachment: 'top left' +}); +</code></pre><output data-example='usage'></output> + +Attachment +---------- + +You can move the attachment points of both the element and the target. + +For example, lets move the element's attachment: + +<pre class="pre-with-output"><code class="lang-javascript" data-example>new Tether({ + element: yellowBox, + target: greenBox, + attachment: <mark>'bottom left'</mark>, + targetAttachment: 'top left' +}); +</code></pre><output></output> + +We can also change the target's attachment point: + +<pre class="pre-with-output"><code class="lang-javascript" data-example>new Tether({ + element: yellowBox, + target: greenBox, + attachment: 'bottom left', + targetAttachment: <mark>'bottom right'</mark> +}); +</code></pre><output></output> + +There are two more attachment points we haven't seen yet, center and middle: + +<pre class="pre-with-output"><code class="lang-javascript" data-example>new Tether({ + element: yellowBox, + target: greenBox, + attachment: <mark>'middle center'</mark>, + targetAttachment: <mark>'middle center'</mark> +}); +</code></pre><output></output> + +All told, Tether provides six built in attachment positions: + +- left +- center +- right +- top +- middle +- bottom + +The syntax of the attachment properties is: `"vertical-attachment horizontal-attachment"` + +You must always supply an `attachment`. If you don't supply a `target-attachment`, it is +assumed to be the mirror image of `attachment`. + +### Offset + +The six attachment points we provide are not always enough to place the element +exactly where you want it. To correct this, we provide two more properties, +`offset` and `targetOffset`. + +<pre class="pre-with-output"><code class="lang-javascript" data-example>new Tether({ + element: yellowBox, + target: greenBox, + attachment: 'top right', + targetAttachment: 'top left', + <mark>offset: '0 10px'</mark> +}); +</code></pre><output></output> + +As you can see, we've moved the attachment point of the element 10px to the right. +We can also move the attachment point of the target: + +<pre class="pre-with-output"><code class="lang-javascript" data-example>new Tether({ + element: yellowBox, + target: greenBox, + attachment: 'top right', + targetAttachment: 'top left', + offset: '0 10px', + <mark>targetOffset: '20px 0'</mark> +}); +</code></pre><output></output> + +The offset properties also accept percentages. Percentages in `offset` refer to +the height and width of the element, `targetOffset` the height and width of +the target. + +<pre class="pre-with-output"><code class="lang-javascript" data-example>new Tether({ + element: yellowBox, + target: greenBox, + attachment: 'top right', + targetAttachment: 'top left', + targetOffset: <mark>'0 75%'</mark> +}); +</code></pre><output></output> + +The syntax of the offset properties is `"vertical-offset horizontal-offset"` + +Tether offers a couple of special attachments, using the `targetModifier` +option: + +<pre class="pre-with-output"><code class="lang-javascript" data-example>new Tether({ + element: yellowBox, + target: scrollBox, + attachment: 'middle right', + targetAttachment: 'middle left', + targetModifier: 'scroll-handle' +}); +</code></pre><output></output> + +Set the target to `document.body` to have the element follow the page's scroll bar. + +The `targetModifier` `visible` can be used to attach an element to the visible part +of an element: + +<pre class="pre-with-output"><code class="lang-javascript" data-example>new Tether({ + element: yellowBox, + target: document.body, + attachment: 'middle center', + targetAttachment: 'middle center', + <mark>targetModifier: 'visible'</mark> +}); +</code></pre><output deactivated></output> + +<pre class="pre-with-output"><code class="lang-javascript" data-example="scroll-visible">new Tether({ + element: yellowBox, + <mark>target: scrollBox</mark>, + attachment: 'middle center', + targetAttachment: 'middle center', + targetModifier: 'visible' +}); +</code></pre><output class="no-green scroll-page" data-example="scroll-visible"></output> + +Constraints +----------- + +If you have tried any of the previous examples, you'll notice that it's pretty +easy to scroll the regions in such a way that the element is hanging out on +its own, with no target in sight. + +Constraints allow you to control what happens when the tethered element would +have to fall outside of a defined region to maintain the attachment. + +<pre class="pre-with-output"><code class="lang-javascript" data-example>new Tether({ + element: yellowBox, + target: greenBox, + attachment: 'middle left', + targetAttachment: 'middle left', + <mark>constraints</mark>: [ + { + to: 'scrollParent', + pin: true + } + ] +}); +</code></pre><output></output> + +We've created a constraint which will keep the element within its scroll +parent by 'pinning' it to the edges if it tries to escape. For the sake +of the example, we're also highlighting the pinned edge in red. + +Specify an array of sides if you'd only like to pin those edges: + +<pre class="pre-with-output"><code class="lang-javascript" data-example>new Tether({ + element: yellowBox, + target: greenBox, + attachment: 'middle left', + targetAttachment: 'middle left', + constraints: [ + { + to: 'scrollParent', + pin: <mark>['top']</mark> + } + ] +}); +</code></pre><output></output> + +You might want to allow the element to change its attachment, if doing so +would keep more of it within its assigned region: + +<pre class="pre-with-output"><code class="lang-javascript" data-example>new Tether({ + element: yellowBox, + target: greenBox, + attachment: 'top left', + targetAttachment: 'bottom left', + constraints: [ + { + to: 'scrollParent', + <mark>attachment: 'together'</mark> + } + ] +}); +</code></pre><output></output> + +If you scroll the example a bit, you'll see it flip the attachment when necessary. +You can combine `pin` and `attachment` as well: + +<pre class="pre-with-output"><code class="lang-javascript" data-example>new Tether({ + element: yellowBox, + target: greenBox, + attachment: 'top left', + targetAttachment: 'bottom left', + constraints: [ + { + to: 'scrollParent', + attachment: 'together', + <mark>pin: true</mark> + } + ] +}); +</code></pre><output></output> + +Attachment will accept any of these values: + +- `element`: Only change the element's attachment +- `target`: Only change the target's attachment +- `both`: Change either's attachment (or both), as needed +- `together`: Change both the element's and target's attachment at the same time (to +'flip' the element to the other side of the attachment) +- `none`: Don't allow changes to attachment (the default) + +Together is the option you will use most commonly: + +<pre class="pre-with-output"><code class="lang-javascript" data-example>new Tether({ + element: yellowBox, + target: greenBox, + attachment: 'top right', + targetAttachment: 'bottom left', + constraints: [ + { + to: 'scrollParent', + attachment: <mark>'together'</mark> + } + ] +}); +</code></pre><output></output> + +You can also provide different settings for the horizontal +and vertical attachments: + +<pre class="pre-with-output"><code class="lang-javascript" data-example>new Tether({ + element: yellowBox, + target: greenBox, + attachment: 'top left', + targetAttachment: 'bottom left', + constraints: [ + { + to: 'scrollParent', + attachment: <mark>'together none'</mark> + } + ] +}); +</code></pre><output></output> + +Whenever the element is out of the constrained area, we add the `tether-out-of-bounds` +class to it. If you add some CSS to make items with that class `display: none`, the +tether will hide. + +<pre class="pre-with-output"><code class="lang-javascript" data-example="hide">new Tether({ + element: yellowBox, + target: greenBox, + attachment: 'middle center', + targetAttachment: 'middle center', + constraints: [ + { + to: 'scrollParent' + } + ] +}); +</code></pre><output data-example="hide"></output> + +You can also constrain the element to the viewport, you'll have to scroll the +page to see this one. + +<pre class="pre-with-output"><code class="lang-javascript" data-example="window">new Tether({ + element: yellowBox, + target: greenBox, + attachment: 'top left', + targetAttachment: 'bottom left', + constraints: [ + { + to: <mark>'window'</mark>, + attachment: 'together' + } + ] +}); +</code></pre><output data-example="window" class="scroll-page"></output> + +You can, of course, use pin with the window as well to +make it always visible no matter where the user scrolls: + +<pre class="pre-with-output"><code class="lang-javascript" data-example>new Tether({ + element: yellowBox, + target: greenBox, + attachment: 'top left', + targetAttachment: 'bottom left', + constraints: [ + { + to: 'window', + attachment: 'together', + <mark>pin: true</mark> + } + ] +}); +</code></pre><output deactivated class="scroll-page visible-enabled"></output> + +`to` can be any of: + +- `'scrollParent'` +- `'window'` +- any DOM element +- an array of bound points relative to the body `[X1, Y1, X2, Y2]` + +You can also provide multiple constraints, keeping in mind that they are +processed in the order supplied (the last one always has the final word). + +<pre class="pre-with-output"><code class="lang-javascript" data-example>new Tether({ + element: yellowBox, + target: greenBox, + attachment: 'top left', + targetAttachment: 'bottom left', + constraints: [ + { + to: <mark>'scrollParent'</mark>, + pin: true + }, + { + to: <mark>'window'</mark>, + attachment: 'together' + } + ] +}); +</code></pre><output></output> + +Optimization +------------ + +### Element Moving + +The goal of Tether's optimizer is to not have to change the positioning +CSS as the page is scrolled or resized. To accomplish this it looks at the +last few positions, finds commonalities, and uses them to decide whether to +position the element absolutely or with fixed positioning. + +If the element is fully contained within its scroll parent, its DOM node +can also be moved inside the scroll parent, to avoid repaints as the +container is scrolled. + +<pre class="pre-with-output"><code class="lang-javascript" data-example="optimizer">new Tether({ + element: yellowBox, + target: greenBox, + attachment: 'top left', + targetAttachment: 'bottom left' +}); +</code></pre><output data-example="optimizer"></output> + +We are moving where the DOM node is, so if you have CSS which styles elements +within the offset parent, you may see some rendering changes. Also note +that this optimization works best if the scroll parent is the offset parent. +In other words, **the scroll parent should be made position relative, fixed or +absolute to enable this optimization.** + +If you do see stylistic changes occur when the element is moved, +you might want to disable this optimization. You can do that by +setting `optimizations.moveElement` to false. + +<pre class="pre-with-output"><code class="lang-javascript" data-example="optimizer2">new Tether({ + element: yellowBox, + target: greenBox, + attachment: 'top left', + targetAttachment: 'bottom left', + optimizations: { + <mark>moveElement: false</mark> + } +}); +</code></pre><output data-example="optimizer2"></output> + +### GPU + +By default tether positions elements using CSS transforms. These transforms allow the +tethered element to be moved as its own layer to not force a repaint of the underlying +page. + +This method of positioning can cause some issues however, including color shifts and artifacts. + +If you experience these issues, you can disable this optimization by setting `optimizations.gpu` +to false: + +<pre class="pre-with-output"><code class="lang-javascript" data-example>new Tether({ + element: yellowBox, + target: greenBox, + attachment: 'top left', + optimizations: { + <mark>gpu: false</mark> + } +}); +</code></pre><output></output> + +Methods +------- + +The `Tether` constructor we've been using in these examples returns us a +`Tether` object. + +The `Tether` object has these methods: + +- `setOptions({ options })` - Update any of the options (such as attachment) +- `disable()` - Disable the tethering +- `enable()` - Enable the tethering +- `destroy()` - Disable and remove all references +- `position()` - Manually trigger a repositioning + +Options +------- + +The full list of options which can be passed to the `Tether` constructor and +`setOptions`: + +- `element`: The DOM element, jQuery element, or a selector string of an element which will be moved +- `target`: The DOM element, jQuery element, or a selector string of an element which the `element` will be attached to +- `attachment`: A string of the form `'vert-attachment horiz-attachment'` + - `vert-attachment` can be any of `'top'`, `'middle'`, `'bottom'` + - `horiz-attachment` can be any of `'left'`, `'center'`, `'right'` +- `targetAttachment`: A string similar to `attachment`. + The one difference is that, if it's not provided, targetAttachment will assume the mirror + image of `attachment`. +- `offset`: A string of the form `'vert-offset horiz-offset'` + - `vert-offset` and `horiz-offset` can be of the form `"20px"` or `"55%"` +- `targetOffset`: A string similar to `offset`, but refering to the offset of the target +- `targetModifier`: Can be set to `'visible'` or `'scroll-handle'` +- `enabled`: Should the tether be enabled initially? Defaults to `true`. +- `classes`: A hash of classes which should be changed or disabled +- `classPrefix`: The prefix placed at the beginning of the default classes, defaults to `'tether'` +- `optimizations`: A hash of optimizations, used to disable them +- `constraints`: An array of constraint definition objects. Each definition is of the form: + - `to`: A DOM element, bounding box, the string `'window'`, or the string `'scrollParent'` + - `pin`: `true` or an array of strings representing the sides of the constraint + - `attachment`: A string of the form `"vert-modifier horiz-modifier"`, or a single value + representing both + - Each modifier should be one of `"none"`, `"together"`, `"element"`, `"target"`, or `"both"`. + - `outOfBoundsClass`: An alternative to `"tether-out-of-bounds"`, useful if the class + needs to be differentiated from that of another constraint. + - `pinnedClass`: An alternative to `"tether-pinned"`, similar to `outOfBoundsClass`. + +Classes +------- + +Tether adds a variety of classes to the element and target to allow you to style +them based on their tethering. + +You can change the prefix of the classes with the `classPrefix` option. It is `'tether'` by +default, but you could, for example, change it to be `'bill'` if you were building the bill +library and all the classes would be `'bill-*'`. + +```javascript +new Tether({ + classPrefix: 'bill' +}); +``` + +The sass/css is similarily configurable, see +[tooltip](https://github.com/HubSpot/tooltip/blob/master/sass/tooltip-theme-arrows.sass#L14) for +an example of how to make your own prefixed css file. + +All classes can be changed or disabled with the `classes` option. For example, to change the +`tether-element` class to be `my-box`: + +```javascript +new Tether({ + classes: { + element: 'my-box' + } +}); +``` + +You can also disable classes you're not going to use: + +```javascript +new Tether({ + classes: { + out-of-bounds: false + } +}); +``` + +- `tether-element` is added to the element +- `tether-target` is added to the target +- `tether-enabled` is added to both elements when tether is not disabled +- `tether-element-attached-[left,right,top,bottom,middle,center]` is added to both +elements based on the elements attachment, if the element becomes detached (for +example, if it's pinned), that class is removed. The class reflects how the +element is actually attached, so if a constraint changes the attachment, that +change will be reflected in the class. +- `tether-target-attached-[left,right,top,bottom,middle,center]` is added to both +elements based on the target's attachment. All of the characteristics are the +same as for element-attached. + +### Constraint-related Classes + +- `tether-out-of-bounds`, `tether-out-of-bounds-[side]` are added to both the element and the target +when the element is placed outside of its constraint. +- `tether-pinned`, `tether-pinned-[side]` are added to both the element and target when a constraint +has pinned the element to the [side] of the container. + +Browser Support +--------------- + +Tether supports IE9+, and all modern browsers. + +Google doesn't support IE8, Microsoft is dropping support in a few months, and not supporting it saves +us a whole lot of trouble. If you are interested in adding support, get in touch, we're happy to accept +a PR. + +Contributing +------------ + +Please contribute! Tether is developed in Coffeescript, but if that's problematic for you, feel free +to submit pull requests which just change the JavaScript files, we can adapt them as needed. + +To build Tether, you need: + +- Node.js +- Ruby (for compass) + +#### Instructions + +- Install compass (if you don't have it already) + +```bash +gem update --system +gem install compass +``` + +- Install the build tool + +```bash +npm install -g gulp +``` + +- Install the project + +```bash +# In the project directory +npm install +``` + +- Build / Watch + +```bash +gulp +``` diff --git a/afb-client/bower_components/tether/docs/js/intro.js b/afb-client/bower_components/tether/docs/js/intro.js new file mode 100644 index 0000000..47ed6e5 --- /dev/null +++ b/afb-client/bower_components/tether/docs/js/intro.js @@ -0,0 +1,117 @@ +(function() { + var OUTPUT_HTML, SETUP_JS, activate, deactivate, getOutput, init, run, setupBlock, tethers, uniqueId; + + uniqueId = Tether.Utils.uniqueId; + + SETUP_JS = "yellowBox = $('.yellow-box', $output);\ngreenBox = $('.green-box', $output);\nscrollBox = $('.scroll-box', $output);"; + + OUTPUT_HTML = function(key) { + return "<div class=\"scroll-box\">\n <div class=\"scroll-content\">\n <div class=\"yellow-box\" data-example=\"" + key + "\"></div>\n <div class=\"green-box\" data-example=\"" + key + "\"></div>\n </div>\n</div>"; + }; + + tethers = {}; + + getOutput = function($block) { + var key; + key = $block.data('example'); + if (key && typeof key === 'string') { + return $("output[data-example='" + key + "']"); + } else { + return $block.parents('pre').nextAll('output').first(); + } + }; + + run = function(key) { + var $block, $output, code; + if (typeof key === 'string') { + $block = $("code[data-example='" + key + "']"); + } else { + $block = key; + } + key = $block.attr('data-example'); + $output = getOutput($block); + code = $block.text(); + code = SETUP_JS + code; + window.$output = $output; + return tethers[key] = eval(code); + }; + + setupBlock = function($block) { + var $output, $scrollBox, $scrollContent, key; + key = $block.data('example'); + $output = getOutput($block); + if (!key) { + key = uniqueId(); + $block.attr('data-example', key); + $output.attr('data-example', key); + $output.find('.tether-element').attr('data-example', key); + } + $output.html(OUTPUT_HTML(key)); + $scrollBox = $output.find('.scroll-box'); + $scrollContent = $scrollBox.find('.scroll-content'); + $scrollBox.scrollTop(parseInt($scrollContent.css('height')) / 2 - $scrollBox.height() / 2); + $scrollBox.scrollLeft(parseInt($scrollContent.css('width')) / 2 - $scrollBox.width() / 2); + setTimeout(function() { + return $scrollBox.on('scroll', function() { + return $output.addClass('scrolled'); + }); + }); + $scrollBox.css('height', "" + ($block.parent().outerHeight()) + "px"); + if ($output.attr('deactivated') == null) { + return run($block); + } + }; + + $(document.body).on('click', function(e) { + if ($(e.target).is('output[deactivated]')) { + activate($(e.target)); + return false; + } else if ($(e.target).is('output[activated]')) { + deactivate($(e.target)); + return false; + } + }); + + activate = function($output) { + var $block, key; + $block = $output.prev().find('code'); + run($block); + $output.find('.tether-element').show(); + key = $output.data('example'); + $(tethers[key].element).show(); + tethers[key].enable(); + $output.removeAttr('deactivated'); + return $output.attr('activated', true); + }; + + deactivate = function($output) { + var $block, $el, key; + $block = $output.prev().find('code'); + key = $output.data('example'); + tethers[key].disable(); + $el = $(tethers[key].element); + $el.detach(); + $output.find('.scroll-content').append($el); + $el.hide(); + $output.removeAttr('activated'); + return $output.attr('deactivated', true); + }; + + init = function() { + var $blocks, block, _i, _len, _results; + $blocks = $('code[data-example]'); + _results = []; + for (_i = 0, _len = $blocks.length; _i < _len; _i++) { + block = $blocks[_i]; + _results.push(setupBlock($(block))); + } + return _results; + }; + + window.EXECUTR_OPTIONS = { + codeSelector: 'code[executable]' + }; + + $(init); + +}).call(this); diff --git a/afb-client/bower_components/tether/docs/sass/intro.sass b/afb-client/bower_components/tether/docs/sass/intro.sass new file mode 100644 index 0000000..6088a41 --- /dev/null +++ b/afb-client/bower_components/tether/docs/sass/intro.sass @@ -0,0 +1,228 @@ +@import compass/css3 + +$scrollableArea: 2000px +$exampleWidth: 400px +$exampleHeight: 180px + +*, *:after, *:before + +box-sizing(border-box) + +body + position: relative + +.yellow-box + width: 100px + height: 100px + background-color: #fe8 + pointer-events: none + +.green-box + margin-top: ($exampleHeight - 50px) / 2 + margin-left: ($exampleWidth - 200px) / 2 + width: 200px + height: 50px + background-color: #4e9 + + .no-green & + display: none + +.scroll-box + height: 150px + border: 10px solid #eee + background: #fbfbfb + overflow: auto + position: relative + +.scroll-content + height: $scrollableArea + width: $scrollableArea + padding: ($scrollableArea - $exampleHeight)/2 ($scrollableArea - $exampleWidth)/2 + 9 + +pre.pre-with-output + margin: 0 + width: 50% + float: left + + code mark + background: #b8daff + color: #000 + +p, h2, h3 + clear: both + +output + display: block + position: relative + width: 50% + float: right + margin-bottom: 15px + + &.scroll-page + .scroll-box + overflow: hidden + + &:after + content: "↕ scroll the page ↕" + + &:after + content: "↕ scroll this area ↕" + position: absolute + bottom: 25px + width: 100% + text-align: center + font-size: 16px + font-variant: small-caps + color: #777 + opacity: 1 + transition: opacity 0.2s + + &.scrolled:after + opacity: 0 + + &[deactivated], &[activated] + .scroll-box + pointer-events: none + + cursor: pointer + + &:after + position: absolute + top: 0 + left: 0 + right: 0 + bottom: 0 + opacity: 1 + content: "Click To Show" + background-color: #AAA + border-left: 10px solid #EEE + color: white + font-size: 24px + font-variant: normal + padding-top: 80px + + &[activated] + &:after + content: "Click To Hide" + + &.visible-enabled + &:after + height: 35px + padding-top: 5px + +.attachment-mark + position: relative + + &:after + content: "A" + width: 10px + height: 10px + background-color: red + display: inline-block + + line-height: 10px + font-size: 9px + color: white + text-align: center + + position: absolute + +span.attachment-mark + &:after + position: relative + top: -1px + margin-right: 1px + +.tether-marker-dot + @extend .attachment-mark + + position: absolute + + &:after + top: -5px + left: -5px + +@each $type in target, element + .tether-#{ $type }-marker + position: absolute + + @each $side in left, top, bottom, right + div.tether-#{ $type }-attached-#{ $side } & + #{ $side }: 0 + + div.tether-#{ $type }-attached-center & + left: 50% + +.tether-element-attached-middle .tether-element-marker + top: 50px + +.tether-target-attached-middle .tether-target-marker + top: 25px + +.tether-element + position: relative + + &.tether-pinned-left + box-shadow: inset 2px 0 0 0 red + &.tether-pinned-right + box-shadow: inset -2px 0 0 0 red + &.tether-pinned-top + box-shadow: inset 0 2px 0 0 red + &.tether-pinned-bottom + box-shadow: inset 0 -2px 0 0 red + +.tether-target + position: relative + +.tether-element.tether-out-of-bounds[data-example="hide"] + display: none + +[data-example^="optimizer"] + &.lang-javascript + /* This should just be a `code` selector, but sass doesn't allow that with & */ + min-height: 220px + + &.tether-element + + &:before + margin-top: 26px + display: block + text-align: center + content: "I'm in the body" + line-height: 1.2 + font-size: 15px + padding: 4px + color: #666 + + .scroll-box .tether-element:before + content: "I'm in my scroll parent!" + +.tether-element[data-example="scroll-visible"] + height: 30px + + .tether-marker-dot + display: none + +.hs-doc-content h2.projects-header + text-align: center + font-weight: 300 + +.projects-paragraph + text-align: center + + a + +inline-block + text-align: center + margin-right: 30px + color: inherit + + span + +inline-block + margin-bottom: 20px + font-size: 20px + color: inherit + font-weight: 300 + + img + display: block + max-width: 100% + width: 100px
\ No newline at end of file diff --git a/afb-client/bower_components/tether/docs/welcome/browser-demo.html b/afb-client/bower_components/tether/docs/welcome/browser-demo.html new file mode 100644 index 0000000..4915b77 --- /dev/null +++ b/afb-client/bower_components/tether/docs/welcome/browser-demo.html @@ -0,0 +1,76 @@ +<!doctype html> +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <title>Drop – Browser Demo</title> + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> + <link rel="icon" href="http://static.hubspot.com/favicon.ico"> + + <script type="text/javascript" src="//use.typekit.net/ghy0wve.js"></script> + <script type="text/javascript">try{Typekit.load();}catch(e){}</script> + + <!-- Drop themes --> + <link rel="stylesheet" href="/tether/css/tether-theme-arrows-dark.css" /> + + <!-- Browser demo styles --> + <link rel="stylesheet" href="/tether/docs/welcome/css/browser-demo.css" /> +</head> +<body> + <div class="browser-demo"> + <div class="top"><div class="title"></div></div> + <div class="bottom"> + <div class="left"> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + <div class="item"></div> + </div> + <div class="right"> + <div class="title"></div> + <p> + <div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div> + </p> + <p> + <div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div><div class="word"></div> + </p> + </div> + </div> + </div> + + <!-- Tether javascript --> + <script src="/tether/tether.min.js"></script> + + <!-- Welcome docs javascript --> + <script src="/tether/docs/welcome/js/log.js"></script> + <script src="/tether/docs/welcome/js/jquery.js"></script> + <script src="/tether/docs/welcome/js/drop.js"></script> +</body> +</html> diff --git a/afb-client/bower_components/tether/docs/welcome/coffee/welcome.coffee b/afb-client/bower_components/tether/docs/welcome/coffee/welcome.coffee new file mode 100644 index 0000000..a431602 --- /dev/null +++ b/afb-client/bower_components/tether/docs/welcome/coffee/welcome.coffee @@ -0,0 +1,212 @@ +_Drop = Drop.createContext classPrefix: 'tether' + +isMobile = $(window).width() < 567 + +init = -> + setupHero() + setupBrowserDemo() + +setupHero = -> + $target = $('.tether-target-demo') + + positions = [ + 'top left' + 'left top' + 'left middle' + 'left bottom' + 'bottom left' + 'bottom center' + 'bottom right' + 'right bottom' + 'right middle' + 'right top' + 'top right' + 'top center' + ] + + if isMobile + positions = [ + 'top left' + 'bottom left' + 'bottom right' + 'top right' + ] + + window.drops = {} + + for position in positions + drops[position] = new _Drop + target: $target[0] + classes: 'tether-theme-arrows-dark' + position: position + constrainToWindow: false + openOn: '' + content: '<div style="height: 50px; width: 50px"></div>' + + openIndex = 0 + frames = 0 + frameLengthMS = 10 + + openAllDrops = -> + for position, drop of drops + drop.open() + + openNextDrop = -> + for position, drop of drops + drop.close() + + drops[positions[openIndex]].open() + drops[positions[(openIndex + 6) % positions.length]].open() + + openIndex = (openIndex + 1) % positions.length + + if frames > 5 + finalDropState() + return + + frames += 1 + + setTimeout openNextDrop, frameLengthMS * frames + + finalDropState = -> + $(drops['top left'].dropContent).html('Marrying DOM elements for life.') + $(drops['bottom right'].dropContent).html('<a class="button" href="http://github.com/HubSpot/tether">★ On Github</a>') + drops['top left'].open() + drops['bottom right'].open() + + if true or isMobile + drops['top left'].open() + drops['top left'].tether.position() + drops['bottom right'].open() + drops['bottom right'].tether.position() + finalDropState() + + else + openNextDrop() + +setupBrowserDemo = -> + $browserDemo = $('.browser-demo.showcase') + + $startPoint = $('.browser-demo-start-point') + $stopPoint = $('.browser-demo-stop-point') + + $iframe = $('.browser-window iframe') + $browserContents = $('.browser-content .browser-demo-inner') + + $sections = $('.browser-demo-section') + + $('body').append """ + <style> + table.showcase.browser-demo.fixed-bottom { + top: #{ $sections.length }00% + } + </style> + """ + + $(window).scroll -> + scrollTop = $(window).scrollTop() + + if $startPoint.position().top < scrollTop and scrollTop + window.innerHeight < $stopPoint.position().top + $browserDemo.removeClass('fixed-bottom') + $browserDemo.addClass('fixed') + + $sections.each -> + $section = $ @ + + if $section.position().top < scrollTop < $section.position().top + $section.outerHeight() + setSection $section.data('section') + + return true + + else + $browserDemo.removeAttr('data-section') + $browserDemo.removeClass('fixed') + + if scrollTop + window.innerHeight > $stopPoint.position().top + $browserDemo.addClass('fixed-bottom') + else + $browserDemo.removeClass('fixed-bottom') + + $iframe.load -> + iframeWindow = $iframe[0].contentWindow + + $items = $iframe.contents().find('.item') + + $items.each (i) -> + $item = $(@) + + _iframeWindowDrop = iframeWindow.Drop.createContext classPrefix: 'tether' + + drop = new _iframeWindowDrop + target: $item[0] + classes: 'tether-theme-arrows-dark' + position: 'right top' + constrainToWindow: true + openOn: 'click' + content: ''' + <ul> + <li>Action 1</li> + <li>Action 2</li> + <li>Action 3</li> + </ul> + ''' + + $item.data('drop', drop) + + scrollInterval = undefined + scrollTop = 0 + scrollTopDirection = 1 + + setSection = (section) -> + $browserDemo.attr('data-section', section) + + $('.section-copy').removeClass('active') + $(""".section-copy[data-section="#{ section }"]""").addClass('active') + + openExampleItem = -> + if isMobile + $iframe.contents().find('.item:first').data().drop.open() + else + $iframe.contents().find('.item:eq(2)').data().drop.open() + + closeAllItems = -> + $iframe.contents().find('.item').each -> $(@).data().drop.close() or true + + scrollLeftSection = -> + scrollInterval = setInterval -> + $iframe.contents().find('.left').scrollTop scrollTop + scrollTop += scrollTopDirection + if scrollTop > 50 + scrollTopDirection = -1 + if scrollTop < 0 + scrollTopDirection = 1 + , 30 + + stopScrollingLeftSection = -> + clearInterval scrollInterval + + switch section + + when 'what' + closeAllItems() + openExampleItem() + stopScrollingLeftSection() + + when 'how' + closeAllItems() + openExampleItem() + stopScrollingLeftSection() + scrollLeftSection() + + when 'why' + closeAllItems() + openExampleItem() + stopScrollingLeftSection() + scrollLeftSection() + + when 'outro' + closeAllItems() + openExampleItem() + stopScrollingLeftSection() + +init()
\ No newline at end of file diff --git a/afb-client/bower_components/tether/docs/welcome/css/browser-demo.css b/afb-client/bower_components/tether/docs/welcome/css/browser-demo.css new file mode 100644 index 0000000..c41b020 --- /dev/null +++ b/afb-client/bower_components/tether/docs/welcome/css/browser-demo.css @@ -0,0 +1,91 @@ +html, body { + height: 100%; + overflow: hidden; + font-family: "proxima-nova", sans-serif; } + +.tether.tether-theme-arrows-dark .tether-content { + -webkit-filter: none; + -moz-filter: none; + filter: none; + background: black; } + .tether.tether-theme-arrows-dark .tether-content ul { + color: white; + list-style: none; + padding: 0; + margin: 0; } + +.tether.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-left.tether-target-attached-right .tether-content:before { + border-right-color: black; } + +.browser-demo { + position: absolute; + top: 0; + left: 0; + bottom: 0; + right: 0; } + .browser-demo *, .browser-demo *:after, .browser-demo *:before { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; } + .browser-demo .top { + position: absolute; + height: 60px; + padding: 20px; + line-height: 40px; + width: 100%; + border-bottom: 1px solid rgba(0, 0, 0, 0.1); } + .browser-demo .bottom { + position: absolute; + top: 60px; + bottom: 0; + width: 100%; } + .browser-demo .bottom .left { + border-right: 1px solid rgba(0, 0, 0, 0.1); + position: absolute; + width: 30%; + height: 100%; + overflow: auto; } + .browser-demo .bottom .left .item { + height: 64px; + border-bottom: 1px solid rgba(0, 0, 0, 0.1); + cursor: pointer; } + .browser-demo .bottom .left .item:hover, .browser-demo .bottom .left .item.tether-open { + background: rgba(0, 0, 0, 0.1); + border-bottom: 1px solid rgba(0, 0, 0, 0); } + .browser-demo .bottom .left .item:last-child { + border-bottom: 0; } + .browser-demo .bottom .right { + position: absolute; + width: 70%; + right: 0; + height: 100%; + padding: 20px; } + .browser-demo .title { + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + *vertical-align: auto; + zoom: 1; + *display: inline; + background: rgba(0, 0, 0, 0.1); + width: 150px; + height: 15px; + margin-bottom: 20px; } + .browser-demo .word { + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + *vertical-align: auto; + zoom: 1; + *display: inline; + background: rgba(0, 0, 0, 0.1); + width: 50px; + height: 8px; + margin-right: 5px; + margin-bottom: 5px; } + .browser-demo .word:nth-last-child(4n+1) { + width: 73px; } + .browser-demo .word:nth-last-child(10n+1) { + width: 14px; } + .browser-demo .word:nth-last-child(9n+1) { + width: 80px; } diff --git a/afb-client/bower_components/tether/docs/welcome/css/prism.css b/afb-client/bower_components/tether/docs/welcome/css/prism.css new file mode 100644 index 0000000..b86d1c2 --- /dev/null +++ b/afb-client/bower_components/tether/docs/welcome/css/prism.css @@ -0,0 +1,2 @@ +/* Prism.js */ +code[class*="language-"], pre[class*="language-"] {color: black; font-family: Consolas, Monaco, 'Andale Mono', monospace; direction: ltr; text-align: left; white-space: pre; word-spacing: normal; -moz-tab-size: 4; -o-tab-size: 4; tab-size: 4; -webkit-hyphens: none; -moz-hyphens: none; -ms-hyphens: none; hyphens: none; } /* Code blocks */ pre[class*="language-"] {padding: 1em; margin: .5em 0; overflow: auto; font-size: 14px; } :not(pre) > code[class*="language-"], pre[class*="language-"] {background: rgba(0, 0, 0, .05); } /* Inline code */ :not(pre) > code[class*="language-"] {padding: .1em; border-radius: .3em; } .token.comment, .token.prolog, .token.doctype, .token.cdata {color: slategray; } .token.punctuation {color: #999; } .namespace {opacity: .7; } .token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol {color: #905; } .token.selector, .token.attr-name, .token.string, .token.builtin {color: #690; } .token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string, .token.variable {color: #a67f59; } .token.atrule, .token.attr-value, .token.keyword {color: #07a; } .token.regex, .token.important {color: #e90; } .token.important {font-weight: bold; } .token.entity {cursor: help; }
\ No newline at end of file diff --git a/afb-client/bower_components/tether/docs/welcome/css/welcome.css b/afb-client/bower_components/tether/docs/welcome/css/welcome.css new file mode 100644 index 0000000..7db9b3b --- /dev/null +++ b/afb-client/bower_components/tether/docs/welcome/css/welcome.css @@ -0,0 +1,272 @@ +html, body { + height: 100%; } + +body { + margin: 0; + font-family: "proxima-nova", "Helvetica Neue", sans-serif; } + +.button { + display: inline-block; + border: 2px solid #333333; + color: #333333; + padding: 1em 1.25em; + font-weight: 500; + text-transform: uppercase; + letter-spacing: 3px; + text-decoration: none; + cursor: pointer; + width: 140px; + font-size: 0.8em; + line-height: 1.3em; + text-align: center; } + +.tether-element.tether-theme-arrows-dark .tether-content { + padding: 1em; + font-size: 1.1em; } + .tether-element.tether-theme-arrows-dark .tether-content .button { + border-color: white; + color: white; + width: 170px; + pointer-events: all; } + +.mobile-copy { + display: none; } + @media (max-width: 568px) { + .mobile-copy { + display: block; } } + +.button.dark { + background: #333333; + color: white; } + +.hero-wrap { + height: 100%; + overflow: hidden; } + +table.showcase { + height: 100%; + width: 100%; + position: relative; } + table.showcase:after { + content: ""; + display: block; + position: absolute; + left: 0; + right: 0; + bottom: 20px; + margin: auto; + height: 0; + width: 0; + border-width: 18px; + border-style: solid; + border-color: transparent; + border-top-color: rgba(0, 0, 0, 0.2); } + table.showcase.no-next-arrow:after { + display: none; } + table.showcase .showcase-inner { + margin: 40px auto 60px; + padding: 10px; } + table.showcase .showcase-inner h1 { + font-size: 50px; + text-align: center; + font-weight: 300; } + @media (max-width: 567px) { + table.showcase .showcase-inner h1 { + font-size: 40px; } } + table.showcase .showcase-inner h2 { + font-size: 24px; + text-align: center; + font-weight: 300; + margin: 1em 0 1em; } + @media (max-width: 567px) { + table.showcase .showcase-inner h2 { + font-size: 14px; } } + table.showcase .showcase-inner p { + text-align: center; } + table.showcase.hero { + text-align: center; } + table.showcase.hero .tether-target-demo { + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + *vertical-align: auto; + zoom: 1; + *display: inline; + border: 2px dotted black; + margin: 5rem auto; + padding: 5rem; } + @media (max-width: 567px) { + table.showcase.hero .tether-target-demo { + padding: 1rem; } } + table.showcase.share { + background: #f3f3f3; } + table.showcase.projects-showcase .showcase-inner .projects-list { + width: 80%; + max-width: 1200px; + margin: 0 auto; } + table.showcase.projects-showcase .showcase-inner .projects-list .project { + color: inherit; + text-decoration: none; + position: relative; + width: 50%; + float: left; + text-align: center; + margin-bottom: 2rem; } + table.showcase.projects-showcase .showcase-inner .projects-list .os-icon { + width: 8rem; + height: 8rem; + margin-bottom: 1rem; + background-size: 100%; } + table.showcase.projects-showcase .showcase-inner .projects-list h1 { + font-size: 2.5rem; } + table.showcase.projects-showcase .showcase-inner .projects-list p { + font-size: 1.3rem; } + table.showcase.browser-demo { + background-image: -webkit-gradient(linear, 0% 0%, 100% 100%, color-stop(0%, #723362), color-stop(100%, #9d223c)); + background-image: -webkit-linear-gradient(top left, #723362 0%, #9d223c 100%); + background-image: -moz-linear-gradient(top left, #723362 0%, #9d223c 100%); + background-image: -o-linear-gradient(top left, #723362 0%, #9d223c 100%); + background-image: linear-gradient(top left, #723362 0%, #9d223c 100%); + background-color: #9d223c; + position: absolute; + top: 100%; } + table.showcase.browser-demo.fixed { + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + z-index: 1; } + table.showcase.browser-demo.fixed .browser-demo-inner { + -webkit-transition: width 2s ease-in-out, height 2s ease-in-out; + -moz-transition: width 2s ease-in-out, height 2s ease-in-out; + -o-transition: width 2s ease-in-out, height 2s ease-in-out; + transition: width 2s ease-in-out, height 2s ease-in-out; } + table.showcase.browser-demo.fixed[data-section="what"] { + box-shadow: 0 0 0 0; } + table.showcase.browser-demo.fixed[data-section="why"] .browser-demo-inner { + width: 70%; } + table.showcase.browser-demo.fixed[data-section="outro"] .showcase-inner { + pointer-events: all; } + table.showcase.browser-demo .showcase-inner { + pointer-events: none; + position: absolute; + left: 10%; + right: 40%; + top: 220px; + bottom: 120px; + margin: 0; + padding: 0; } + @media (max-width: 567px) { + table.showcase.browser-demo .showcase-inner { + bottom: 90px; + top: 180px; } } + table.showcase.browser-demo .browser-demo-inner { + height: 100%; + width: 100%; } + table.showcase.browser-demo .section-copy { + -webkit-transition: opacity 0.5s ease-in-out, top 0.5s ease-in-out; + -moz-transition: opacity 0.5s ease-in-out, top 0.5s ease-in-out; + -o-transition: opacity 0.5s ease-in-out, top 0.5s ease-in-out; + transition: opacity 0.5s ease-in-out, top 0.5s ease-in-out; + filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); + opacity: 0; + position: absolute; + top: 0; + position: absolute; + height: 200px; + color: white; + text-align: center; + width: 100%; } + table.showcase.browser-demo .section-copy.active { + filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); + opacity: 1; + top: -150px; } + @media (max-width: 567px) { + table.showcase.browser-demo .section-copy.active { + top: -130px; } } + table.showcase.browser-demo .section-copy h2 { + font-size: 40px; + font-weight: bold; + line-height: 1; + margin: 25px 0 15px; } + @media (max-width: 567px) { + table.showcase.browser-demo .section-copy h2 { + font-size: 30px; } } + table.showcase.browser-demo .browser-window { + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + -ms-border-radius: 4px; + -o-border-radius: 4px; + border-radius: 4px; + background: white; + position: relative; + height: 100%; + width: 100%; + max-width: 1200px; + margin: 0 auto; } + table.showcase.browser-demo .browser-window .browser-titlebar { + position: absolute; + top: 0; + left: 0; + right: 0; + border-bottom: 1px solid #eeeeee; + height: 55px; } + table.showcase.browser-demo .browser-window .browser-titlebar .browser-dots { + padding: 16px; } + table.showcase.browser-demo .browser-window .browser-titlebar .browser-dots b { + -webkit-border-radius: 50%; + -moz-border-radius: 50%; + -ms-border-radius: 50%; + -o-border-radius: 50%; + border-radius: 50%; + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + *vertical-align: auto; + zoom: 1; + *display: inline; + width: 10px; + height: 10px; + margin-right: 7px; + background: rgba(0, 0, 0, 0.1); } + table.showcase.browser-demo .browser-window .browser-frame { + position: absolute; + top: 55px; + left: 0; + right: 0; + bottom: 0; } + table.showcase.browser-demo .browser-window .browser-frame iframe { + -webkit-border-radius: 0 0 4px 4px; + -moz-border-radius: 0 0 4px 4px; + -ms-border-radius: 0 0 4px 4px; + -o-border-radius: 0 0 4px 4px; + border-radius: 0 0 4px 4px; + border: 0; + width: 100%; + height: 100%; } + table.showcase.browser-demo-section .section-scroll-copy { + position: relative; + z-index: 10; + color: white; + width: 100%; + font-size: 22px; } + table.showcase.browser-demo-section .section-scroll-copy .section-scroll-copy-inner { + position: absolute; + z-index: 10; + color: white; + right: 10%; + width: 23%; } + table.showcase.browser-demo-section .section-scroll-copy .section-scroll-copy-inner a { + color: inherit; } + table.showcase.browser-demo-section .section-scroll-copy .section-scroll-copy-inner .example-paragraph { + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + -ms-border-radius: 4px; + -o-border-radius: 4px; + border-radius: 4px; + background: black; + padding: 1rem; } + +.browser-content { + display: none; } diff --git a/afb-client/bower_components/tether/docs/welcome/index.html b/afb-client/bower_components/tether/docs/welcome/index.html new file mode 100644 index 0000000..856d58e --- /dev/null +++ b/afb-client/bower_components/tether/docs/welcome/index.html @@ -0,0 +1,227 @@ +<!doctype html> +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <title>Tether – Marrying elements for life</title> + <meta name="description" content="Tether is a JavaScript and CSS library. It is free and open source and was developed by HubSpot developers Adam Schwartz (@adamfschwartz) and Zack Bloom (@zackbloom)."> + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> + <link rel="icon" href="http://static.hubspot.com/favicon.ico"> + + <script type="text/javascript" src="//use.typekit.net/ghy0wve.js"></script> + <script type="text/javascript">try{Typekit.load();}catch(e){}</script> + + <!-- Tether themes --> + <link rel="stylesheet" href="/tether/css/tether-theme-arrows-dark.css" /> + + <!-- Welcome docs styles --> + <link rel="stylesheet" href="/tether/docs/welcome/css/prism.css" /> + <link rel="stylesheet" href="/tether/docs/welcome/css/welcome.css" /> + + <!-- OS icons --> + <link rel="stylesheet" href="http://github.hubspot.com/os-icons/os-icons.css" /> +</head> +<body> + <div class="hero-wrap"> + <table class="showcase hero"><tr><td> + <div class="showcase-inner"> + <div class="tether-target-demo"> + <h1>Tether</h1> + <div class="mobile-copy"> + <h2>Marrying elements for life</h2> + <p> + <a class="button" href="http://github.com/HubSpot/tether">★ On Github</a> + </p> + </div> + </div> + </div> + </td></tr></table> + </div> + + <div class="browser-demo-start-point"></div> + + <table class="showcase browser-demo"><tr><td> + <div class="showcase-inner"> + <div class="section-copy" data-section="what"> + <h2>What is Tether?</h2> + </div> + <div class="section-copy" data-section="how"> + <h2>How Tether works.</h2> + </div> + <div class="section-copy" data-section="why"> + <h2>Tether is powerful.</h2> + </div> + <div class="section-copy" data-section="outro"> + <h2>Play with Tether</h2> + </div> + <div class="browser-demo-inner"> + <div class="browser-window"> + <div class="browser-titlebar"> + <div class="browser-dots"><b></b><b></b><b></b></div> + </div> + <div class="browser-frame"> + <iframe src="browser-demo.html"></iframe> + </div> + </div> + </div> + </div> + </td></tr></table> + + <table class="showcase browser-demo-section no-next-arrow" data-section="what"><tr><td> + <div class="section-scroll-copy"> + <div class="section-scroll-copy-inner"> + <p>Tether is a low-level UI library that can be used to position any element on a page <i>next to any other element</i>.</p> + <p>It can be used for dropdown menus, tooltips, popovers, tours, help information, scroll guides, autocompletes, etc. The possibilities are endless.</p> + <p class="example-paragraph">In this example we're showing an action menu <em>tethered</em> to a list item.</p> + </div> + </div> + </td></tr></table> + + <table class="showcase browser-demo-section no-next-arrow" data-section="how"><tr><td> + <div class="section-scroll-copy"> + <div class="section-scroll-copy-inner"> + <p>Tether works by creating an absolutely positioned element and meticulously tracking the movements of a <i>target</i> which you specify.</p> + <p>The <i>target</i> and <i>element</i> can be tethered together in a variety of different ways.</p> + <p class="example-paragraph">Notice how the <i>tethered element</i> stays tethered to its <i>target</i> list item even as the left pane is scrolled up and down.</p> + </div> + </div> + </td></tr></table> + + <table class="showcase browser-demo-section no-next-arrow" data-section="why"><tr><td> + <div class="section-scroll-copy"> + <div class="section-scroll-copy-inner"> + <p>Tether can keep your element positioned properly even in some tough situations.</p> + <p>Tether handles all of the common pain points:</p> + <ul> + <li>Automatically detect collisions with the edge of the page or edge of the scrollParent</li> + <li>Automatically reposition on browser resize, scroll, and other events,</li> + <li>Constrain the position to any bounding box,</li> + </ul> + <p>...and a lot more.</p> + </div> + </div> + </td></tr></table> + + <table class="showcase browser-demo-section no-next-arrow" data-section="outro"><tr><td> + <div class="section-scroll-copy"> + <div class="section-scroll-copy-inner"> + <p class="example-paragraph">Interact with this demo.</p> + <p> </p> + <p>To learn more, check out our <a href="/tether">documentation</a>.</p> + </div> + </div> + </td></tr></table> + + <table class="showcase browser-demo-section no-next-arrow" data-section="__empty"><tr><td></td></tr></table> + + <div class="browser-demo-stop-point"></div> + + <table class="showcase projects-showcase no-next-arrow"><tr><td> + <div class="showcase-inner"> + <h1>Tether Family</h1> + <h2>These projects are all powered by Tether's positioning engine.</h2> + <div class="projects-list"> + <a href="/drop/docs/welcome" class="project"> + <h1>Drop</h1> + <span class="os-icon drop-icon"></span> + <p>Create dropdowns, popovers, and more.</p> + </a> + <a href="/tooltip/docs/welcome" class="project"> + <h1>Tooltip</h1> + <span class="os-icon tooltip-icon"></span> + <p>Stylable tooltips built on Tether.</p> + </a> + <a href="/select/docs/welcome" class="project"> + <h1>Select</h1> + <span class="os-icon select-icon"></span> + <p>Stylable select elements built on Tether.</p> + </a> + <a href="/shepherd/docs/welcome" class="project"> + <h1>Shepherd</h1> + <span class="os-icon shepherd-icon"></span> + <p>Guide your users through a tour of your app.</p> + </a> + </div> + </div> + </td></tr></table> + + <table class="showcase last-showcase no-next-arrow share"><tr><td> + <div class="showcase-inner"> + <h1>Share</h1> + <h2>Help us spread the word.</h2> + <!-- Share --> + <style> + .share-buttons { + margin: 4em auto; + text-align: center; + } + .share-button { + display: inline-block; + } + .retweet-button { + width: 100px; + margin-left: 20px; + } + .github-stars { + width: 100px; + } + </style> + <div class="share-buttons"> + <div class="share-button retweet-button"> + <a href="http://twitter.com/share" class="twitter-share-button" data-url="http://github.hubspot.com/tether/docs/welcome" data-text="Tether.js - A positioning engine for JavaScript" data-count="horizontal" data-via="HubSpotDev">Tweet</a> + <script> + (function(){ + var recommends, button; + + if (Math.random() >= 0.5) { + recommends = ['hubspotdev', 'zackbloom', 'adamfschwartz']; + } else { + recommends = ['hubspotdev', 'adamfschwartz', 'zackbloom']; + } + + button = document.querySelector('.twitter-share-button'); + + if (button) { + button.setAttribute('data-related', recommends.join(',')); + } + })(); + </script> + <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> + </div> + <div class="share-button github-stars-button"> + <iframe src="http://ghbtns.com/github-btn.html?user=HubSpot&repo=tether&type=watch&count=true&size=small" allowtransparency="true" frameborder="0" scrolling="0" width="100" height="20"></iframe> + </div> + </p> + </div> + </td></tr></table> + + <!-- Tether javascript --> + <script src="/tether/tether.min.js"></script> + + <!-- Welcome docs javascript --> + <script src="/tether/docs/welcome/js/log.js"></script> + <script src="/tether/docs/welcome/js/jquery.js"></script> + <script src="/tether/docs/welcome/js/drop.js"></script> + <script src="/tether/docs/welcome/js/welcome.js"></script> + + <!-- HubSpot analytics --> + <script type="text/javascript"> + (function(d,s,i,r) { + if (d.getElementById(i)){return;} + var n=d.createElement(s),e=d.getElementsByTagName(s)[0]; + n.id=i;n.src='//js.hubspot.com/analytics/'+(Math.ceil(new Date()/r)*r)+'/51294.js'; + e.parentNode.insertBefore(n, e); + })(document,"script","hs-analytics",300000); + </script> + + <!-- Google analytics --> + <script> + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + + ga('create', 'UA-45159009-1', 'auto'); + ga('send', 'pageview'); + </script> +</body> +</html> diff --git a/afb-client/bower_components/tether/docs/welcome/js/drop.js b/afb-client/bower_components/tether/docs/welcome/js/drop.js new file mode 100644 index 0000000..0058819 --- /dev/null +++ b/afb-client/bower_components/tether/docs/welcome/js/drop.js @@ -0,0 +1,239 @@ +(function() { + var Evented, MIRROR_ATTACH, addClass, allDrops, clickEvent, createContext, extend, hasClass, removeClass, sortAttach, touchDevice, _ref, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + + _ref = Tether.Utils, extend = _ref.extend, addClass = _ref.addClass, removeClass = _ref.removeClass, hasClass = _ref.hasClass, Evented = _ref.Evented; + + touchDevice = 'ontouchstart' in document.documentElement; + + clickEvent = touchDevice ? 'touchstart' : 'click'; + + sortAttach = function(str) { + var first, second, _ref1, _ref2; + _ref1 = str.split(' '), first = _ref1[0], second = _ref1[1]; + if (first === 'left' || first === 'right') { + _ref2 = [second, first], first = _ref2[0], second = _ref2[1]; + } + return [first, second].join(' '); + }; + + MIRROR_ATTACH = { + left: 'right', + right: 'left', + top: 'bottom', + bottom: 'top', + middle: 'middle', + center: 'center' + }; + + allDrops = {}; + + createContext = function(options) { + var DropInstance, defaultOptions, drop, _name; + if (options == null) { + options = {}; + } + drop = function() { + return (function(func, args, ctor) { + ctor.prototype = func.prototype; + var child = new ctor, result = func.apply(child, args); + return Object(result) === result ? result : child; + })(DropInstance, arguments, function(){}); + }; + extend(drop, { + createContext: createContext, + drops: [], + defaults: {} + }); + defaultOptions = { + classPrefix: 'drop', + defaults: { + attach: 'bottom left', + openOn: 'click', + constrainToScrollParent: true, + constrainToWindow: true, + classes: '', + tetherOptions: {} + } + }; + extend(drop, defaultOptions, options); + extend(drop.defaults, defaultOptions.defaults, options.defaults); + if (allDrops[_name = drop.classPrefix] == null) { + allDrops[_name] = []; + } + drop.updateBodyClasses = function() { + var anyOpen, _drop, _i, _len, _ref1; + anyOpen = false; + _ref1 = allDrops[drop.classPrefix]; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + _drop = _ref1[_i]; + if (!(_drop.isOpened())) { + continue; + } + anyOpen = true; + break; + } + if (anyOpen) { + return addClass(document.body, "" + drop.classPrefix + "-open"); + } else { + return removeClass(document.body, "" + drop.classPrefix + "-open"); + } + }; + DropInstance = (function(_super) { + __extends(DropInstance, _super); + + function DropInstance(options) { + this.options = options; + this.options = extend({}, drop.defaults, this.options); + this.target = this.options.target; + if (this.target == null) { + throw new Error('Drop Error: You must provide a target.'); + } + drop.drops.push(this); + allDrops[drop.classPrefix].push(this); + this.setupElements(); + this.setupEvents(); + this.setupTether(); + } + + DropInstance.prototype.setupElements = function() { + this.drop = document.createElement('div'); + addClass(this.drop, drop.classPrefix); + if (this.options.classes) { + addClass(this.drop, this.options.classes); + } + this.dropContent = document.createElement('div'); + addClass(this.dropContent, "" + drop.classPrefix + "-content"); + if (typeof this.options.content === 'object') { + this.dropContent.appendChild(this.options.content); + } else { + this.dropContent.innerHTML = this.options.content; + } + return this.drop.appendChild(this.dropContent); + }; + + DropInstance.prototype.setupTether = function() { + var constraints, dropAttach; + dropAttach = this.options.position.split(' '); + dropAttach[0] = MIRROR_ATTACH[dropAttach[0]]; + dropAttach = dropAttach.join(' '); + constraints = []; + if (this.options.constrainToScrollParent) { + constraints.push({ + to: 'scrollParent', + pin: 'top, bottom', + attachment: 'together none' + }); + } + if (this.options.constrainToWindow !== false) { + constraints.push({ + to: 'window', + pin: true, + attachment: 'together' + }); + } + constraints.push({ + to: 'scrollParent' + }); + options = { + element: this.drop, + target: this.target, + attachment: sortAttach(dropAttach), + targetAttachment: sortAttach(this.options.position), + classPrefix: drop.classPrefix, + offset: '0 0', + targetOffset: '0 0', + enabled: false, + constraints: constraints + }; + if (this.options.tether !== false) { + return this.tether = new Tether(extend({}, options, this.options.tether)); + } + }; + + DropInstance.prototype.setupEvents = function() { + var events, + _this = this; + if (!this.options.openOn) { + return; + } + events = this.options.openOn.split(' '); + if (__indexOf.call(events, 'click') >= 0) { + this.target.addEventListener(clickEvent, function() { + return _this.toggle(); + }); + document.addEventListener(clickEvent, function(event) { + if (!_this.isOpened()) { + return; + } + if (event.target === _this.drop || _this.drop.contains(event.target)) { + return; + } + if (event.target === _this.target || _this.target.contains(event.target)) { + return; + } + return _this.close(); + }); + } + if (__indexOf.call(events, 'hover') >= 0) { + this.target.addEventListener('mouseover', function() { + return _this.open(); + }); + return this.target.addEventListener('mouseout', function() { + return _this.close(); + }); + } + }; + + DropInstance.prototype.isOpened = function() { + return hasClass(this.drop, "" + drop.classPrefix + "-open"); + }; + + DropInstance.prototype.toggle = function() { + if (this.isOpened()) { + return this.close(); + } else { + return this.open(); + } + }; + + DropInstance.prototype.open = function() { + var _ref1; + if (!this.drop.parentNode) { + document.body.appendChild(this.drop); + } + addClass(this.target, "" + drop.classPrefix + "-open"); + addClass(this.drop, "" + drop.classPrefix + "-open"); + if ((_ref1 = this.tether) != null) { + _ref1.enable(); + } + this.trigger('open'); + return drop.updateBodyClasses(); + }; + + DropInstance.prototype.close = function() { + var _ref1; + removeClass(this.target, "" + drop.classPrefix + "-open"); + removeClass(this.drop, "" + drop.classPrefix + "-open"); + this.trigger('close'); + if ((_ref1 = this.tether) != null) { + _ref1.disable(); + } + return drop.updateBodyClasses(); + }; + + return DropInstance; + + })(Evented); + return drop; + }; + + window.Drop = createContext(); + + document.addEventListener('DOMContentLoaded', function() { + return Drop.updateBodyClasses(); + }); + +}).call(this);
\ No newline at end of file diff --git a/afb-client/bower_components/tether/docs/welcome/js/jquery.js b/afb-client/bower_components/tether/docs/welcome/js/jquery.js new file mode 100644 index 0000000..3f70a60 --- /dev/null +++ b/afb-client/bower_components/tether/docs/welcome/js/jquery.js @@ -0,0 +1,9597 @@ +/*! + * jQuery JavaScript Library v1.9.1 + * http://jquery.com/ + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * + * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2013-2-4 + */ +(function( window, undefined ) { + +// Can't do this because several apps including ASP.NET trace +// the stack via arguments.caller.callee and Firefox dies if +// you try to trace through "use strict" call chains. (#13335) +// Support: Firefox 18+ +//"use strict"; +var + // The deferred used on DOM ready + readyList, + + // A central reference to the root jQuery(document) + rootjQuery, + + // Support: IE<9 + // For `typeof node.method` instead of `node.method !== undefined` + core_strundefined = typeof undefined, + + // Use the correct document accordingly with window argument (sandbox) + document = window.document, + location = window.location, + + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$, + + // [[Class]] -> type pairs + class2type = {}, + + // List of deleted data cache ids, so we can reuse them + core_deletedIds = [], + + core_version = "1.9.1", + + // Save a reference to some core methods + core_concat = core_deletedIds.concat, + core_push = core_deletedIds.push, + core_slice = core_deletedIds.slice, + core_indexOf = core_deletedIds.indexOf, + core_toString = class2type.toString, + core_hasOwn = class2type.hasOwnProperty, + core_trim = core_version.trim, + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context, rootjQuery ); + }, + + // Used for matching numbers + core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, + + // Used for splitting on whitespace + core_rnotwhite = /\S+/g, + + // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // A simple way to check for HTML strings + // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/, + + // Match a standalone tag + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, + + // JSON RegExp + rvalidchars = /^[\],:{}\s]*$/, + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, + rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, + rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([\da-z])/gi, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }, + + // The ready event handler + completed = function( event ) { + + // readyState === "complete" is good enough for us to call the dom ready in oldIE + if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { + detach(); + jQuery.ready(); + } + }, + // Clean-up method for dom ready events + detach = function() { + if ( document.addEventListener ) { + document.removeEventListener( "DOMContentLoaded", completed, false ); + window.removeEventListener( "load", completed, false ); + + } else { + document.detachEvent( "onreadystatechange", completed ); + window.detachEvent( "onload", completed ); + } + }; + +jQuery.fn = jQuery.prototype = { + // The current version of jQuery being used + jquery: core_version, + + constructor: jQuery, + init: function( selector, context, rootjQuery ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + + // scripts is true for back-compat + jQuery.merge( this, jQuery.parseHTML( + match[1], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + // Properties of context are called as methods if possible + if ( jQuery.isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return rootjQuery.ready( selector ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }, + + // Start with an empty selector + selector: "", + + // The default length of a jQuery object is 0 + length: 0, + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + toArray: function() { + return core_slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + ( num < 0 ? this[ this.length + num ] : this[ num ] ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + ret.context = this.context; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + ready: function( fn ) { + // Add the callback + jQuery.ready.promise().done( fn ); + + return this; + }, + + slice: function() { + return this.pushStack( core_slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: core_push, + sort: [].sort, + splice: [].splice +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +jQuery.extend = jQuery.fn.extend = function() { + var src, copyIsArray, copy, name, options, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( length === i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + noConflict: function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; + }, + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger("ready").off("ready"); + } + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + isWindow: function( obj ) { + return obj != null && obj == obj.window; + }, + + isNumeric: function( obj ) { + return !isNaN( parseFloat(obj) ) && isFinite( obj ); + }, + + type: function( obj ) { + if ( obj == null ) { + return String( obj ); + } + return typeof obj === "object" || typeof obj === "function" ? + class2type[ core_toString.call(obj) ] || "object" : + typeof obj; + }, + + isPlainObject: function( obj ) { + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + try { + // Not own constructor property must be Object + if ( obj.constructor && + !core_hasOwn.call(obj, "constructor") && + !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + + var key; + for ( key in obj ) {} + + return key === undefined || core_hasOwn.call( obj, key ); + }, + + isEmptyObject: function( obj ) { + var name; + for ( name in obj ) { + return false; + } + return true; + }, + + error: function( msg ) { + throw new Error( msg ); + }, + + // data: string of html + // context (optional): If specified, the fragment will be created in this context, defaults to document + // keepScripts (optional): If true, will include scripts passed in the html string + parseHTML: function( data, context, keepScripts ) { + if ( !data || typeof data !== "string" ) { + return null; + } + if ( typeof context === "boolean" ) { + keepScripts = context; + context = false; + } + context = context || document; + + var parsed = rsingleTag.exec( data ), + scripts = !keepScripts && []; + + // Single tag + if ( parsed ) { + return [ context.createElement( parsed[1] ) ]; + } + + parsed = jQuery.buildFragment( [ data ], context, scripts ); + if ( scripts ) { + jQuery( scripts ).remove(); + } + return jQuery.merge( [], parsed.childNodes ); + }, + + parseJSON: function( data ) { + // Attempt to parse using the native JSON parser first + if ( window.JSON && window.JSON.parse ) { + return window.JSON.parse( data ); + } + + if ( data === null ) { + return data; + } + + if ( typeof data === "string" ) { + + // Make sure leading/trailing whitespace is removed (IE can't handle it) + data = jQuery.trim( data ); + + if ( data ) { + // Make sure the incoming data is actual JSON + // Logic borrowed from http://json.org/json2.js + if ( rvalidchars.test( data.replace( rvalidescape, "@" ) + .replace( rvalidtokens, "]" ) + .replace( rvalidbraces, "")) ) { + + return ( new Function( "return " + data ) )(); + } + } + } + + jQuery.error( "Invalid JSON: " + data ); + }, + + // Cross-browser xml parsing + parseXML: function( data ) { + var xml, tmp; + if ( !data || typeof data !== "string" ) { + return null; + } + try { + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + } catch( e ) { + xml = undefined; + } + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; + }, + + noop: function() {}, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + globalEval: function( data ) { + if ( data && jQuery.trim( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + // args is for internal usage only + each: function( obj, callback, args ) { + var value, + i = 0, + length = obj.length, + isArray = isArraylike( obj ); + + if ( args ) { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } + } + + return obj; + }, + + // Use native String.trim function wherever possible + trim: core_trim && !core_trim.call("\uFEFF\xA0") ? + function( text ) { + return text == null ? + "" : + core_trim.call( text ); + } : + + // Otherwise use our own trimming functionality + function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArraylike( Object(arr) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + core_push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + var len; + + if ( arr ) { + if ( core_indexOf ) { + return core_indexOf.call( arr, elem, i ); + } + + len = arr.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in arr && arr[ i ] === elem ) { + return i; + } + } + } + + return -1; + }, + + merge: function( first, second ) { + var l = second.length, + i = first.length, + j = 0; + + if ( typeof l === "number" ) { + for ( ; j < l; j++ ) { + first[ i++ ] = second[ j ]; + } + } else { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, inv ) { + var retVal, + ret = [], + i = 0, + length = elems.length; + inv = !!inv; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + retVal = !!callback( elems[ i ], i ); + if ( inv !== retVal ) { + ret.push( elems[ i ] ); + } + } + + return ret; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, + i = 0, + length = elems.length, + isArray = isArraylike( elems ), + ret = []; + + // Go through the array, translating each of the items to their + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + } + + // Flatten any nested arrays + return core_concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var args, proxy, tmp; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = core_slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + // Multifunctional method to get and set values of a collection + // The value/s can optionally be executed if it's a function + access: function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + length = elems.length, + bulk = key == null; + + // Sets many values + if ( jQuery.type( key ) === "object" ) { + chainable = true; + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !jQuery.isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < length; i++ ) { + fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); + } + } + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + length ? fn( elems[0], key ) : emptyGet; + }, + + now: function() { + return ( new Date() ).getTime(); + } +}); + +jQuery.ready.promise = function( obj ) { + if ( !readyList ) { + + readyList = jQuery.Deferred(); + + // Catch cases where $(document).ready() is called after the browser event has already occurred. + // we once tried to use readyState "interactive" here, but it caused issues like the one + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + setTimeout( jQuery.ready ); + + // Standards-based browsers support DOMContentLoaded + } else if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed, false ); + + // If IE event model is used + } else { + // Ensure firing before onload, maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", completed ); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", completed ); + + // If IE and not a frame + // continually check to see if the document is ready + var top = false; + + try { + top = window.frameElement == null && document.documentElement; + } catch(e) {} + + if ( top && top.doScroll ) { + (function doScrollCheck() { + if ( !jQuery.isReady ) { + + try { + // Use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + top.doScroll("left"); + } catch(e) { + return setTimeout( doScrollCheck, 50 ); + } + + // detach all dom ready events + detach(); + + // and execute any waiting functions + jQuery.ready(); + } + })(); + } + } + } + return readyList.promise( obj ); +}; + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +function isArraylike( obj ) { + var length = obj.length, + type = jQuery.type( obj ); + + if ( jQuery.isWindow( obj ) ) { + return false; + } + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === "array" || type !== "function" && + ( length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj ); +} + +// All jQuery objects should point back to these +rootjQuery = jQuery(document); +// String to Object options format cache +var optionsCache = {}; + +// Convert String-formatted options into Object-formatted ones and store in cache +function createOptions( options ) { + var object = optionsCache[ options ] = {}; + jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { + object[ flag ] = true; + }); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + ( optionsCache[ options ] || createOptions( options ) ) : + jQuery.extend( {}, options ); + + var // Flag to know if list is currently firing + firing, + // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list was already fired + fired, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // First callback to fire (used internally by add and fireWith) + firingStart, + // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = !options.once && [], + // Fire callbacks + fire = function( data ) { + memory = options.memory && data; + fired = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + firing = true; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { + memory = false; // To prevent further calls using add + break; + } + } + firing = false; + if ( list ) { + if ( stack ) { + if ( stack.length ) { + fire( stack.shift() ); + } + } else if ( memory ) { + list = []; + } else { + self.disable(); + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + // First, we save the current length + var start = list.length; + (function add( args ) { + jQuery.each( args, function( _, arg ) { + var type = jQuery.type( arg ); + if ( type === "function" ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && type !== "string" ) { + // Inspect recursively + add( arg ); + } + }); + })( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away + } else if ( memory ) { + firingStart = start; + fire( memory ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + jQuery.each( arguments, function( _, arg ) { + var index; + while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + // Handle firing indexes + if ( firing ) { + if ( index <= firingLength ) { + firingLength--; + } + if ( index <= firingIndex ) { + firingIndex--; + } + } + } + }); + } + return this; + }, + // Check if a given callback is in the list. + // If no argument is given, return whether or not list has callbacks attached. + has: function( fn ) { + return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); + }, + // Remove all callbacks from the list + empty: function() { + list = []; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + if ( list && ( !fired || stack ) ) { + if ( firing ) { + stack.push( args ); + } else { + fire( args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; +jQuery.extend({ + + Deferred: function( func ) { + var tuples = [ + // action, add listener, listener list, final state + [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], + [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], + [ "notify", "progress", jQuery.Callbacks("memory") ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + return jQuery.Deferred(function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + var action = tuple[ 0 ], + fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; + // deferred[ done | fail | progress ] for forwarding actions to newDefer + deferred[ tuple[1] ](function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .done( newDefer.resolve ) + .fail( newDefer.reject ) + .progress( newDefer.notify ); + } else { + newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); + } + }); + }); + fns = null; + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Keep pipe for back-compat + promise.pipe = promise.then; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 3 ]; + + // promise[ done | fail | progress ] = list.add + promise[ tuple[1] ] = list.add; + + // Handle state + if ( stateString ) { + list.add(function() { + // state = [ resolved | rejected ] + state = stateString; + + // [ reject_list | resolve_list ].disable; progress_list.lock + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); + } + + // deferred[ resolve | reject | notify ] + deferred[ tuple[0] ] = function() { + deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); + return this; + }; + deferred[ tuple[0] + "With" ] = list.fireWith; + }); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( subordinate /* , ..., subordinateN */ ) { + var i = 0, + resolveValues = core_slice.call( arguments ), + length = resolveValues.length, + + // the count of uncompleted subordinates + remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, + + // the master Deferred. If resolveValues consist of only a single Deferred, just use that. + deferred = remaining === 1 ? subordinate : jQuery.Deferred(), + + // Update function for both resolve and progress values + updateFunc = function( i, contexts, values ) { + return function( value ) { + contexts[ i ] = this; + values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; + if( values === progressValues ) { + deferred.notifyWith( contexts, values ); + } else if ( !( --remaining ) ) { + deferred.resolveWith( contexts, values ); + } + }; + }, + + progressValues, progressContexts, resolveContexts; + + // add listeners to Deferred subordinates; treat others as resolved + if ( length > 1 ) { + progressValues = new Array( length ); + progressContexts = new Array( length ); + resolveContexts = new Array( length ); + for ( ; i < length; i++ ) { + if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { + resolveValues[ i ].promise() + .done( updateFunc( i, resolveContexts, resolveValues ) ) + .fail( deferred.reject ) + .progress( updateFunc( i, progressContexts, progressValues ) ); + } else { + --remaining; + } + } + } + + // if we're not waiting on anything, resolve the master + if ( !remaining ) { + deferred.resolveWith( resolveContexts, resolveValues ); + } + + return deferred.promise(); + } +}); +jQuery.support = (function() { + + var support, all, a, + input, select, fragment, + opt, eventName, isSupported, i, + div = document.createElement("div"); + + // Setup + div.setAttribute( "className", "t" ); + div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; + + // Support tests won't run in some limited or non-browser environments + all = div.getElementsByTagName("*"); + a = div.getElementsByTagName("a")[ 0 ]; + if ( !all || !a || !all.length ) { + return {}; + } + + // First batch of tests + select = document.createElement("select"); + opt = select.appendChild( document.createElement("option") ); + input = div.getElementsByTagName("input")[ 0 ]; + + a.style.cssText = "top:1px;float:left;opacity:.5"; + support = { + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) + getSetAttribute: div.className !== "t", + + // IE strips leading whitespace when .innerHTML is used + leadingWhitespace: div.firstChild.nodeType === 3, + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + tbody: !div.getElementsByTagName("tbody").length, + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + htmlSerialize: !!div.getElementsByTagName("link").length, + + // Get the style information from getAttribute + // (IE uses .cssText instead) + style: /top/.test( a.getAttribute("style") ), + + // Make sure that URLs aren't manipulated + // (IE normalizes it by default) + hrefNormalized: a.getAttribute("href") === "/a", + + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + opacity: /^0.5/.test( a.style.opacity ), + + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + cssFloat: !!a.style.cssFloat, + + // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) + checkOn: !!input.value, + + // Make sure that a selected-by-default option has a working selected property. + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) + optSelected: opt.selected, + + // Tests for enctype support on a form (#6743) + enctype: !!document.createElement("form").enctype, + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>", + + // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode + boxModel: document.compatMode === "CSS1Compat", + + // Will be defined later + deleteExpando: true, + noCloneEvent: true, + inlineBlockNeedsLayout: false, + shrinkWrapBlocks: false, + reliableMarginRight: true, + boxSizingReliable: true, + pixelPosition: false + }; + + // Make sure checked status is properly cloned + input.checked = true; + support.noCloneChecked = input.cloneNode( true ).checked; + + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as disabled) + select.disabled = true; + support.optDisabled = !opt.disabled; + + // Support: IE<9 + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + + // Check if we can trust getAttribute("value") + input = document.createElement("input"); + input.setAttribute( "value", "" ); + support.input = input.getAttribute( "value" ) === ""; + + // Check if an input maintains its value after becoming a radio + input.value = "t"; + input.setAttribute( "type", "radio" ); + support.radioValue = input.value === "t"; + + // #11217 - WebKit loses check when the name is after the checked attribute + input.setAttribute( "checked", "t" ); + input.setAttribute( "name", "t" ); + + fragment = document.createDocumentFragment(); + fragment.appendChild( input ); + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + support.appendChecked = input.checked; + + // WebKit doesn't clone checked state correctly in fragments + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE<9 + // Opera does not clone events (and typeof div.attachEvent === undefined). + // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() + if ( div.attachEvent ) { + div.attachEvent( "onclick", function() { + support.noCloneEvent = false; + }); + + div.cloneNode( true ).click(); + } + + // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event) + // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php + for ( i in { submit: true, change: true, focusin: true }) { + div.setAttribute( eventName = "on" + i, "t" ); + + support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false; + } + + div.style.backgroundClip = "content-box"; + div.cloneNode( true ).style.backgroundClip = ""; + support.clearCloneStyle = div.style.backgroundClip === "content-box"; + + // Run tests that need a body at doc ready + jQuery(function() { + var container, marginDiv, tds, + divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", + body = document.getElementsByTagName("body")[0]; + + if ( !body ) { + // Return for frameset docs that don't have a body + return; + } + + container = document.createElement("div"); + container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; + + body.appendChild( container ).appendChild( div ); + + // Support: IE8 + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; + tds = div.getElementsByTagName("td"); + tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; + isSupported = ( tds[ 0 ].offsetHeight === 0 ); + + tds[ 0 ].style.display = ""; + tds[ 1 ].style.display = "none"; + + // Support: IE8 + // Check if empty table cells still have offsetWidth/Height + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); + + // Check box-sizing and margin behavior + div.innerHTML = ""; + div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; + support.boxSizing = ( div.offsetWidth === 4 ); + support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); + + // Use window.getComputedStyle because jsdom on node.js will break without it. + if ( window.getComputedStyle ) { + support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; + support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; + + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. (#3333) + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + marginDiv = div.appendChild( document.createElement("div") ); + marginDiv.style.cssText = div.style.cssText = divReset; + marginDiv.style.marginRight = marginDiv.style.width = "0"; + div.style.width = "1px"; + + support.reliableMarginRight = + !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); + } + + if ( typeof div.style.zoom !== core_strundefined ) { + // Support: IE<8 + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + div.innerHTML = ""; + div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; + support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); + + // Support: IE6 + // Check if elements with layout shrink-wrap their children + div.style.display = "block"; + div.innerHTML = "<div></div>"; + div.firstChild.style.width = "5px"; + support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); + + if ( support.inlineBlockNeedsLayout ) { + // Prevent IE 6 from affecting layout for positioned elements #11048 + // Prevent IE from shrinking the body in IE 7 mode #12869 + // Support: IE<8 + body.style.zoom = 1; + } + } + + body.removeChild( container ); + + // Null elements to avoid leaks in IE + container = div = tds = marginDiv = null; + }); + + // Null elements to avoid leaks in IE + all = select = fragment = opt = a = input = null; + + return support; +})(); + +var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, + rmultiDash = /([A-Z])/g; + +function internalData( elem, name, data, pvt /* Internal Use Only */ ){ + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, ret, + internalKey = jQuery.expando, + getByName = typeof name === "string", + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { + return; + } + + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++; + } else { + id = internalKey; + } + } + + if ( !cache[ id ] ) { + cache[ id ] = {}; + + // Avoids exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + if ( !isNode ) { + cache[ id ].toJSON = jQuery.noop; + } + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } + + thisCache = cache[ id ]; + + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; + } + + thisCache = thisCache.data; + } + + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } + + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( getByName ) { + + // First Try to find as-is property data + ret = thisCache[ name ]; + + // Test for null|undefined property data + if ( ret == null ) { + + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } + + return ret; +} + +function internalRemoveData( elem, name, pvt ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var i, l, thisCache, + isNode = elem.nodeType, + + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + id = isNode ? elem[ jQuery.expando ] : jQuery.expando; + + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } + + if ( name ) { + + thisCache = pvt ? cache[ id ] : cache[ id ].data; + + if ( thisCache ) { + + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split(" "); + } + } + } else { + // If "name" is an array of keys... + // When data is initially created, via ("key", "val") signature, + // keys will be converted to camelCase. + // Since there is no way to tell _how_ a key was added, remove + // both plain key and camelCase key. #12786 + // This will only penalize the array argument path. + name = name.concat( jQuery.map( name, jQuery.camelCase ) ); + } + + for ( i = 0, l = name.length; i < l; i++ ) { + delete thisCache[ name[i] ]; + } + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject( cache[ id ] ) ) { + return; + } + } + + // Destroy the cache + if ( isNode ) { + jQuery.cleanData( [ elem ], true ); + + // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) + } else if ( jQuery.support.deleteExpando || cache != cache.window ) { + delete cache[ id ]; + + // When all else fails, null + } else { + cache[ id ] = null; + } +} + +jQuery.extend({ + cache: {}, + + // Unique for each copy of jQuery on the page + // Non-digits removed to match rinlinejQuery + expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), + + // The following elements throw uncatchable exceptions if you + // attempt to add expando properties to them. + noData: { + "embed": true, + // Ban all objects except for Flash (which handle expandos) + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", + "applet": true + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, + + data: function( elem, name, data ) { + return internalData( elem, name, data ); + }, + + removeData: function( elem, name ) { + return internalRemoveData( elem, name ); + }, + + // For internal use only. + _data: function( elem, name, data ) { + return internalData( elem, name, data, true ); + }, + + _removeData: function( elem, name ) { + return internalRemoveData( elem, name, true ); + }, + + // A method for determining if a DOM node can handle the data expando + acceptData: function( elem ) { + // Do not set data on non-element because it will not be cleared (#8335). + if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) { + return false; + } + + var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; + + // nodes accept data unless otherwise specified; rejection can be conditional + return !noData || noData !== true && elem.getAttribute("classid") === noData; + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var attrs, name, + elem = this[0], + i = 0, + data = null; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = jQuery.data( elem ); + + if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { + attrs = elem.attributes; + for ( ; i < attrs.length; i++ ) { + name = attrs[i].name; + + if ( !name.indexOf( "data-" ) ) { + name = jQuery.camelCase( name.slice(5) ); + + dataAttr( elem, name, data[ name ] ); + } + } + jQuery._data( elem, "parsedAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + return jQuery.access( this, function( value ) { + + if ( value === undefined ) { + // Try to fetch any internally stored data first + return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null; + } + + this.each(function() { + jQuery.data( this, key, value ); + }); + }, null, value, arguments.length > 1, null, true ); + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); + +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; +} + +// checks a cache object for emptiness +function isEmptyDataObject( obj ) { + var name; + for ( name in obj ) { + + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== "toJSON" ) { + return false; + } + } + + return true; +} +jQuery.extend({ + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || jQuery.isArray(data) ) { + queue = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + hooks.cur = fn; + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // not intended for public consumption - generates a queueHooks object, or returns the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return jQuery._data( elem, key ) || jQuery._data( elem, key, { + empty: jQuery.Callbacks("once memory").add(function() { + jQuery._removeData( elem, type + "queue" ); + jQuery._removeData( elem, key ); + }) + }); + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[0], type ); + } + + return data === undefined ? + this : + this.each(function() { + var queue = jQuery.queue( this, type, data ); + + // ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + // Based off of the plugin by Clint Helfers, with permission. + // http://blindsignals.com/index.php/2009/07/jquery-delay/ + delay: function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = setTimeout( next, time ); + hooks.stop = function() { + clearTimeout( timeout ); + }; + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while( i-- ) { + tmp = jQuery._data( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +}); +var nodeHook, boolHook, + rclass = /[\t\r\n]/g, + rreturn = /\r/g, + rfocusable = /^(?:input|select|textarea|button|object)$/i, + rclickable = /^(?:a|area)$/i, + rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i, + ruseDefault = /^(?:checked|selected)$/i, + getSetAttribute = jQuery.support.getSetAttribute, + getSetInput = jQuery.support.input; + +jQuery.fn.extend({ + attr: function( name, value ) { + return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each(function() { + jQuery.removeAttr( this, name ); + }); + }, + + prop: function( name, value ) { + return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + name = jQuery.propFix[ name ] || name; + return this.each(function() { + // try/catch handles cases where IE balks (such as removing a property on window) + try { + this[ name ] = undefined; + delete this[ name ]; + } catch( e ) {} + }); + }, + + addClass: function( value ) { + var classes, elem, cur, clazz, j, + i = 0, + len = this.length, + proceed = typeof value === "string" && value; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).addClass( value.call( this, j, this.className ) ); + }); + } + + if ( proceed ) { + // The disjunction here is for better compressibility (see removeClass) + classes = ( value || "" ).match( core_rnotwhite ) || []; + + for ( ; i < len; i++ ) { + elem = this[ i ]; + cur = elem.nodeType === 1 && ( elem.className ? + ( " " + elem.className + " " ).replace( rclass, " " ) : + " " + ); + + if ( cur ) { + j = 0; + while ( (clazz = classes[j++]) ) { + if ( cur.indexOf( " " + clazz + " " ) < 0 ) { + cur += clazz + " "; + } + } + elem.className = jQuery.trim( cur ); + + } + } + } + + return this; + }, + + removeClass: function( value ) { + var classes, elem, cur, clazz, j, + i = 0, + len = this.length, + proceed = arguments.length === 0 || typeof value === "string" && value; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).removeClass( value.call( this, j, this.className ) ); + }); + } + if ( proceed ) { + classes = ( value || "" ).match( core_rnotwhite ) || []; + + for ( ; i < len; i++ ) { + elem = this[ i ]; + // This expression is here for better compressibility (see addClass) + cur = elem.nodeType === 1 && ( elem.className ? + ( " " + elem.className + " " ).replace( rclass, " " ) : + "" + ); + + if ( cur ) { + j = 0; + while ( (clazz = classes[j++]) ) { + // Remove *all* instances + while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { + cur = cur.replace( " " + clazz + " ", " " ); + } + } + elem.className = value ? jQuery.trim( cur ) : ""; + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value, + isBool = typeof stateVal === "boolean"; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( i ) { + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); + }); + } + + return this.each(function() { + if ( type === "string" ) { + // toggle individual class names + var className, + i = 0, + self = jQuery( this ), + state = stateVal, + classNames = value.match( core_rnotwhite ) || []; + + while ( (className = classNames[ i++ ]) ) { + // check each className given, space separated list + state = isBool ? state : !self.hasClass( className ); + self[ state ? "addClass" : "removeClass" ]( className ); + } + + // Toggle whole class name + } else if ( type === core_strundefined || type === "boolean" ) { + if ( this.className ) { + // store className if set + jQuery._data( this, "__className__", this.className ); + } + + // If the element has a class name or if we're passed "false", + // then remove the whole classname (if there was one, the above saved it). + // Otherwise bring back whatever was previously saved (if anything), + // falling back to the empty string if nothing was stored. + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; + } + }); + }, + + hasClass: function( selector ) { + var className = " " + selector + " ", + i = 0, + l = this.length; + for ( ; i < l; i++ ) { + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { + return true; + } + } + + return false; + }, + + val: function( value ) { + var ret, hooks, isFunction, + elem = this[0]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { + return ret; + } + + ret = elem.value; + + return typeof ret === "string" ? + // handle most common string cases + ret.replace(rreturn, "") : + // handle cases where value is null/undef or number + ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each(function( i ) { + var val, + self = jQuery(this); + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, self.val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { + val += ""; + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map(val, function ( value ) { + return value == null ? "" : value + ""; + }); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + }); + } +}); + +jQuery.extend({ + valHooks: { + option: { + get: function( elem ) { + // attributes.value is undefined in Blackberry 4.7 but + // uses .value. See #6932 + var val = elem.attributes.value; + return !val || val.specified ? elem.value : elem.text; + } + }, + select: { + get: function( elem ) { + var value, option, + options = elem.options, + index = elem.selectedIndex, + one = elem.type === "select-one" || index < 0, + values = one ? null : [], + max = one ? index + 1 : options.length, + i = index < 0 ? + max : + one ? index : 0; + + // Loop through all the selected options + for ( ; i < max; i++ ) { + option = options[ i ]; + + // oldIE doesn't update selected after form reset (#2551) + if ( ( option.selected || i === index ) && + // Don't return options that are disabled or in a disabled optgroup + ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && + ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + }, + + set: function( elem, value ) { + var values = jQuery.makeArray( value ); + + jQuery(elem).find("option").each(function() { + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; + }); + + if ( !values.length ) { + elem.selectedIndex = -1; + } + return values; + } + } + }, + + attr: function( elem, name, value ) { + var hooks, notxml, ret, + nType = elem.nodeType; + + // don't get/set attributes on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === core_strundefined ) { + return jQuery.prop( elem, name, value ); + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + // All attributes are lowercase + // Grab necessary hook if one is defined + if ( notxml ) { + name = name.toLowerCase(); + hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); + } + + if ( value !== undefined ) { + + if ( value === null ) { + jQuery.removeAttr( elem, name ); + + } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + elem.setAttribute( name, value + "" ); + return value; + } + + } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + + // In IE9+, Flash objects don't have .getAttribute (#12945) + // Support: IE9+ + if ( typeof elem.getAttribute !== core_strundefined ) { + ret = elem.getAttribute( name ); + } + + // Non-existent attributes return null, we normalize to undefined + return ret == null ? + undefined : + ret; + } + }, + + removeAttr: function( elem, value ) { + var name, propName, + i = 0, + attrNames = value && value.match( core_rnotwhite ); + + if ( attrNames && elem.nodeType === 1 ) { + while ( (name = attrNames[i++]) ) { + propName = jQuery.propFix[ name ] || name; + + // Boolean attributes get special treatment (#10870) + if ( rboolean.test( name ) ) { + // Set corresponding property to false for boolean attributes + // Also clear defaultChecked/defaultSelected (if appropriate) for IE<8 + if ( !getSetAttribute && ruseDefault.test( name ) ) { + elem[ jQuery.camelCase( "default-" + name ) ] = + elem[ propName ] = false; + } else { + elem[ propName ] = false; + } + + // See #9699 for explanation of this approach (setting first, then removal) + } else { + jQuery.attr( elem, name, "" ); + } + + elem.removeAttribute( getSetAttribute ? name : propName ); + } + } + }, + + attrHooks: { + type: { + set: function( elem, value ) { + if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { + // Setting the type on a radio button after the value resets the value in IE6-9 + // Reset value to default in case type is set after value during creation + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + } + }, + + propFix: { + tabindex: "tabIndex", + readonly: "readOnly", + "for": "htmlFor", + "class": "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + cellpadding: "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + contenteditable: "contentEditable" + }, + + prop: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set properties on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + if ( notxml ) { + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + return ( elem[ name ] = value ); + } + + } else { + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + return elem[ name ]; + } + } + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + var attributeNode = elem.getAttributeNode("tabindex"); + + return attributeNode && attributeNode.specified ? + parseInt( attributeNode.value, 10 ) : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + undefined; + } + } + } +}); + +// Hook for boolean attributes +boolHook = { + get: function( elem, name ) { + var + // Use .prop to determine if this attribute is understood as boolean + prop = jQuery.prop( elem, name ), + + // Fetch it accordingly + attr = typeof prop === "boolean" && elem.getAttribute( name ), + detail = typeof prop === "boolean" ? + + getSetInput && getSetAttribute ? + attr != null : + // oldIE fabricates an empty string for missing boolean attributes + // and conflates checked/selected into attroperties + ruseDefault.test( name ) ? + elem[ jQuery.camelCase( "default-" + name ) ] : + !!attr : + + // fetch an attribute node for properties not recognized as boolean + elem.getAttributeNode( name ); + + return detail && detail.value !== false ? + name.toLowerCase() : + undefined; + }, + set: function( elem, value, name ) { + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { + // IE<8 needs the *property* name + elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); + + // Use defaultChecked and defaultSelected for oldIE + } else { + elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; + } + + return name; + } +}; + +// fix oldIE value attroperty +if ( !getSetInput || !getSetAttribute ) { + jQuery.attrHooks.value = { + get: function( elem, name ) { + var ret = elem.getAttributeNode( name ); + return jQuery.nodeName( elem, "input" ) ? + + // Ignore the value *property* by using defaultValue + elem.defaultValue : + + ret && ret.specified ? ret.value : undefined; + }, + set: function( elem, value, name ) { + if ( jQuery.nodeName( elem, "input" ) ) { + // Does not return so that setAttribute is also used + elem.defaultValue = value; + } else { + // Use nodeHook if defined (#1954); otherwise setAttribute is fine + return nodeHook && nodeHook.set( elem, value, name ); + } + } + }; +} + +// IE6/7 do not support getting/setting some attributes with get/setAttribute +if ( !getSetAttribute ) { + + // Use this for any attribute in IE6/7 + // This fixes almost every IE6/7 issue + nodeHook = jQuery.valHooks.button = { + get: function( elem, name ) { + var ret = elem.getAttributeNode( name ); + return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ? + ret.value : + undefined; + }, + set: function( elem, value, name ) { + // Set the existing or create a new attribute node + var ret = elem.getAttributeNode( name ); + if ( !ret ) { + elem.setAttributeNode( + (ret = elem.ownerDocument.createAttribute( name )) + ); + } + + ret.value = value += ""; + + // Break association with cloned elements by also using setAttribute (#9646) + return name === "value" || value === elem.getAttribute( name ) ? + value : + undefined; + } + }; + + // Set contenteditable to false on removals(#10429) + // Setting to empty string throws an error as an invalid value + jQuery.attrHooks.contenteditable = { + get: nodeHook.get, + set: function( elem, value, name ) { + nodeHook.set( elem, value === "" ? false : value, name ); + } + }; + + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) + // This is for removals + jQuery.each([ "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + set: function( elem, value ) { + if ( value === "" ) { + elem.setAttribute( name, "auto" ); + return value; + } + } + }); + }); +} + + +// Some attributes require a special call on IE +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !jQuery.support.hrefNormalized ) { + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + get: function( elem ) { + var ret = elem.getAttribute( name, 2 ); + return ret == null ? undefined : ret; + } + }); + }); + + // href/src property should get the full normalized URL (#10299/#12915) + jQuery.each([ "href", "src" ], function( i, name ) { + jQuery.propHooks[ name ] = { + get: function( elem ) { + return elem.getAttribute( name, 4 ); + } + }; + }); +} + +if ( !jQuery.support.style ) { + jQuery.attrHooks.style = { + get: function( elem ) { + // Return undefined in the case of empty string + // Note: IE uppercases css property names, but if we were to .toLowerCase() + // .cssText, that would destroy case senstitivity in URL's, like in "background" + return elem.style.cssText || undefined; + }, + set: function( elem, value ) { + return ( elem.style.cssText = value + "" ); + } + }; +} + +// Safari mis-reports the default selected property of an option +// Accessing the parent's selectedIndex property fixes it +if ( !jQuery.support.optSelected ) { + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { + get: function( elem ) { + var parent = elem.parentNode; + + if ( parent ) { + parent.selectedIndex; + + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + return null; + } + }); +} + +// IE6/7 call enctype encoding +if ( !jQuery.support.enctype ) { + jQuery.propFix.enctype = "encoding"; +} + +// Radios and checkboxes getter/setter +if ( !jQuery.support.checkOn ) { + jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + get: function( elem ) { + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + } + }; + }); +} +jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); + } + } + }); +}); +var rformElems = /^(?:input|select|textarea)$/i, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + var tmp, events, t, handleObjIn, + special, eventHandle, handleObj, + handlers, type, namespaces, origType, + elemData = jQuery._data( elem ); + + // Don't attach events to noData or text/comment nodes (but allow plain objects) + if ( !elemData ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !(events = elemData.events) ) { + events = elemData.events = {}; + } + if ( !(eventHandle = elemData.handle) ) { + eventHandle = elemData.handle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + // jQuery(...).bind("mouseover mouseout", fn); + types = ( types || "" ).match( core_rnotwhite ) || [""]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !(handlers = events[ type ]) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + var j, handleObj, tmp, + origCount, t, events, + special, handlers, type, + namespaces, origType, + elemData = jQuery.hasData( elem ) && jQuery._data( elem ); + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( core_rnotwhite ) || [""]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + delete elemData.handle; + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery._removeData( elem, "events" ); + } + }, + + trigger: function( event, data, elem, onlyHandlers ) { + var handle, ontype, cur, + bubbleType, special, tmp, i, + eventPath = [ elem || document ], + type = core_hasOwn.call( event, "type" ) ? event.type : event, + namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; + + cur = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf(".") >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf(":") < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + event.isTrigger = true; + event.namespace = namespaces.join("."); + event.namespace_re = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === (elem.ownerDocument || document) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { + + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { + event.preventDefault(); + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && + !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + try { + elem[ type ](); + } catch ( e ) { + // IE<9 dies on focus/blur to hidden element (#1486,#12518) + // only reproducible on winXP IE8 native, not IE9 in IE8 mode + } + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event ); + + var i, ret, handleObj, matched, j, + handlerQueue = [], + args = core_slice.call( arguments ), + handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( (event.result = ret) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var sel, handleObj, matches, i, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Find delegate handlers + // Black-hole SVG <use> instance trees (#13180) + // Avoid non-left-click bubbling in Firefox (#3861) + if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { + + for ( ; cur != this; cur = cur.parentNode || this ) { + + // Don't check non-elements (#13208) + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matches[ sel ] === undefined ) { + matches[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) >= 0 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matches[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, handlers: matches }); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( delegateCount < handlers.length ) { + handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); + } + + return handlerQueue; + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, copy, + type = event.type, + originalEvent = event, + fixHook = this.fixHooks[ type ]; + + if ( !fixHook ) { + this.fixHooks[ type ] = fixHook = + rmouseEvent.test( type ) ? this.mouseHooks : + rkeyEvent.test( type ) ? this.keyHooks : + {}; + } + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = new jQuery.Event( originalEvent ); + + i = copy.length; + while ( i-- ) { + prop = copy[ i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Support: IE<9 + // Fix target property (#1925) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Support: Chrome 23+, Safari? + // Target should not be a text node (#504, #13143) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // Support: IE<9 + // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) + event.metaKey = !!event.metaKey; + + return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var body, eventDoc, doc, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + special: { + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + click: { + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { + this.click(); + return false; + } + } + }, + focus: { + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== document.activeElement && this.focus ) { + try { + this.focus(); + return false; + } catch ( e ) { + // Support: IE<9 + // If we error on focus to hidden element (#1486, #12518), + // let .trigger() run the handlers + } + } + }, + delegateType: "focusin" + }, + blur: { + trigger: function() { + if ( this === document.activeElement && this.blur ) { + this.blur(); + return false; + } + }, + delegateType: "focusout" + }, + + beforeunload: { + postDispatch: function( event ) { + + // Even when returnValue equals to undefined Firefox will still show alert + if ( event.result !== undefined ) { + event.originalEvent.returnValue = event.result; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + var name = "on" + type; + + if ( elem.detachEvent ) { + + // #8545, #7054, preventing memory leaks for custom events in IE6-8 + // detachEvent needed property on element, by name of that event, to properly expose it to GC + if ( typeof elem[ name ] === core_strundefined ) { + elem[ name ] = null; + } + + elem.detachEvent( name, handle ); + } + }; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || + src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + if ( !e ) { + return; + } + + // If preventDefault exists, run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // Support: IE + // Otherwise set the returnValue property of the original event to false + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + if ( !e ) { + return; + } + // If stopPropagation exists, run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + + // Support: IE + // Set the cancelBubble property of the original event to true + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + } +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// IE submit delegation +if ( !jQuery.support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !jQuery._data( form, "submitBubbles" ) ) { + jQuery.event.add( form, "submit._submit", function( event ) { + event._submit_bubble = true; + }); + jQuery._data( form, "submitBubbles", true ); + } + }); + // return undefined since we don't need an event listener + }, + + postDispatch: function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( event._submit_bubble ) { + delete event._submit_bubble; + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + } + }, + + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; +} + +// IE change delegation and checkbox/radio fix +if ( !jQuery.support.changeBubbles ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + } + // Allow triggered, simulated change events (#11500) + jQuery.event.simulate( "change", this, event, true ); + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + jQuery._data( elem, "changeBubbles", true ); + } + }); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); + + return !rformElems.test( this.nodeName ); + } + }; +} + +// Create "bubbling" focus and blur events +if ( !jQuery.support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler while someone wants focusin/focusout + var attaches = 0, + handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + if ( attaches++ === 0 ) { + document.addEventListener( orig, handler, true ); + } + }, + teardown: function() { + if ( --attaches === 0 ) { + document.removeEventListener( orig, handler, true ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var type, origFn; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on( types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + bind: function( types, data, fn ) { + return this.on( types, null, data, fn ); + }, + unbind: function( types, fn ) { + return this.off( types, null, fn ); + }, + + delegate: function( selector, types, data, fn ) { + return this.on( types, selector, data, fn ); + }, + undelegate: function( selector, types, fn ) { + // ( namespace ) or ( selector, types [, fn] ) + return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + var elem = this[0]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } +}); +/*! + * Sizzle CSS Selector Engine + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license + * http://sizzlejs.com/ + */ +(function( window, undefined ) { + +var i, + cachedruns, + Expr, + getText, + isXML, + compile, + hasDuplicate, + outermostContext, + + // Local document vars + setDocument, + document, + docElem, + documentIsXML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + sortOrder, + + // Instance-specific data + expando = "sizzle" + -(new Date()), + preferredDoc = window.document, + support = {}, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + + // General-purpose constants + strundefined = typeof undefined, + MAX_NEGATIVE = 1 << 31, + + // Array methods + arr = [], + pop = arr.pop, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf if we can't use a native one + indexOf = arr.indexOf || function( elem ) { + var i = 0, + len = this.length; + for ( ; i < len; i++ ) { + if ( this[i] === elem ) { + return i; + } + } + return -1; + }, + + + // Regular expressions + + // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + // http://www.w3.org/TR/css3-syntax/#characters + characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", + + // Loosely modeled on CSS identifier characters + // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors + // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = characterEncoding.replace( "w", "w#" ), + + // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors + operators = "([*^$|!~]?=)", + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", + + // Prefer arguments quoted, + // then not containing pseudos/brackets, + // then attribute selectors/non-parenthetical expressions, + // then anything else + // These preferences are here to reduce the number of selectors + // needing tokenize in the PSEUDO preFilter + pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + characterEncoding + ")" ), + "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), + "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), + "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rsibling = /[\x20\t\r\n\f]*[+~]/, + + rnative = /^[^{]+\{\s*\[native code/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rescape = /'|\\/g, + rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, + + // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g, + funescape = function( _, escaped ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + return high !== high ? + escaped : + // BMP codepoint + high < 0 ? + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }; + +// Use a stripped-down slice if we can't use a native one +try { + slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType; +} catch ( e ) { + slice = function( i ) { + var elem, + results = []; + while ( (elem = this[i++]) ) { + results.push( elem ); + } + return results; + }; +} + +/** + * For feature detection + * @param {Function} fn The function to test for native support + */ +function isNative( fn ) { + return rnative.test( fn + "" ); +} + +/** + * Create key-value caches of limited size + * @returns {Function(string, Object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var cache, + keys = []; + + return (cache = function( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key += " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key ] = value); + }); +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created div and expects a boolean result + */ +function assert( fn ) { + var div = document.createElement("div"); + + try { + return fn( div ); + } catch (e) { + return false; + } finally { + // release memory in IE + div = null; + } +} + +function Sizzle( selector, context, results, seed ) { + var match, elem, m, nodeType, + // QSA vars + i, groups, old, nid, newContext, newSelector; + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + + context = context || document; + results = results || []; + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { + return []; + } + + if ( !documentIsXML && !seed ) { + + // Shortcuts + if ( (match = rquickExpr.exec( selector )) ) { + // Speed-up: Sizzle("#ID") + if ( (m = match[1]) ) { + if ( nodeType === 9 ) { + elem = context.getElementById( m ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE, Opera, and Webkit return items + // by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + } else { + // Context is not a document + if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && + contains( context, elem ) && elem.id === m ) { + results.push( elem ); + return results; + } + } + + // Speed-up: Sizzle("TAG") + } else if ( match[2] ) { + push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); + return results; + + // Speed-up: Sizzle(".CLASS") + } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) { + push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); + return results; + } + } + + // QSA path + if ( support.qsa && !rbuggyQSA.test(selector) ) { + old = true; + nid = expando; + newContext = context; + newSelector = nodeType === 9 && selector; + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + groups = tokenize( selector ); + + if ( (old = context.getAttribute("id")) ) { + nid = old.replace( rescape, "\\$&" ); + } else { + context.setAttribute( "id", nid ); + } + nid = "[id='" + nid + "'] "; + + i = groups.length; + while ( i-- ) { + groups[i] = nid + toSelector( groups[i] ); + } + newContext = rsibling.test( selector ) && context.parentNode || context; + newSelector = groups.join(","); + } + + if ( newSelector ) { + try { + push.apply( results, slice.call( newContext.querySelectorAll( + newSelector + ), 0 ) ); + return results; + } catch(qsaError) { + } finally { + if ( !old ) { + context.removeAttribute("id"); + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Detect xml + * @param {Element|Object} elem An element or a document + */ +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [doc] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +setDocument = Sizzle.setDocument = function( node ) { + var doc = node ? node.ownerDocument || node : preferredDoc; + + // If no document and documentElement is available, return + if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Set our document + document = doc; + docElem = doc.documentElement; + + // Support tests + documentIsXML = isXML( doc ); + + // Check if getElementsByTagName("*") returns only elements + support.tagNameNoComments = assert(function( div ) { + div.appendChild( doc.createComment("") ); + return !div.getElementsByTagName("*").length; + }); + + // Check if attributes should be retrieved by attribute nodes + support.attributes = assert(function( div ) { + div.innerHTML = "<select></select>"; + var type = typeof div.lastChild.getAttribute("multiple"); + // IE8 returns a string for some attributes even when not present + return type !== "boolean" && type !== "string"; + }); + + // Check if getElementsByClassName can be trusted + support.getByClassName = assert(function( div ) { + // Opera can't find a second classname (in 9.6) + div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>"; + if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { + return false; + } + + // Safari 3.2 caches class attributes and doesn't catch changes + div.lastChild.className = "e"; + return div.getElementsByClassName("e").length === 2; + }); + + // Check if getElementById returns elements by name + // Check if getElementsByName privileges form controls or returns elements by ID + support.getByName = assert(function( div ) { + // Inject content + div.id = expando + 0; + div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>"; + docElem.insertBefore( div, docElem.firstChild ); + + // Test + var pass = doc.getElementsByName && + // buggy browsers will return fewer than the correct 2 + doc.getElementsByName( expando ).length === 2 + + // buggy browsers will return more than the correct 0 + doc.getElementsByName( expando + 0 ).length; + support.getIdNotName = !doc.getElementById( expando ); + + // Cleanup + docElem.removeChild( div ); + + return pass; + }); + + // IE6/7 return modified attributes + Expr.attrHandle = assert(function( div ) { + div.innerHTML = "<a href='#'></a>"; + return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && + div.firstChild.getAttribute("href") === "#"; + }) ? + {} : + { + "href": function( elem ) { + return elem.getAttribute( "href", 2 ); + }, + "type": function( elem ) { + return elem.getAttribute("type"); + } + }; + + // ID find and filter + if ( support.getIdNotName ) { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== strundefined && !documentIsXML ) { + var m = context.getElementById( id ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; + } + }; + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute("id") === attrId; + }; + }; + } else { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== strundefined && !documentIsXML ) { + var m = context.getElementById( id ); + + return m ? + m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? + [m] : + undefined : + []; + } + }; + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); + return node && node.value === attrId; + }; + }; + } + + // Tag + Expr.find["TAG"] = support.tagNameNoComments ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== strundefined ) { + return context.getElementsByTagName( tag ); + } + } : + function( tag, context ) { + var elem, + tmp = [], + i = 0, + results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + while ( (elem = results[i++]) ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Name + Expr.find["NAME"] = support.getByName && function( tag, context ) { + if ( typeof context.getElementsByName !== strundefined ) { + return context.getElementsByName( name ); + } + }; + + // Class + Expr.find["CLASS"] = support.getByClassName && function( className, context ) { + if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) { + return context.getElementsByClassName( className ); + } + }; + + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21), + // no need to also add to buggyMatches since matches checks buggyQSA + // A support test would require too much code (would include document ready) + rbuggyQSA = [ ":focus" ]; + + if ( (support.qsa = isNative(doc.querySelectorAll)) ) { + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( div ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explictly + // setting a boolean content attribute, + // since its presence should be enough + // http://bugs.jquery.com/ticket/12359 + div.innerHTML = "<select><option selected=''></option></select>"; + + // IE8 - Some boolean attributes are not treated correctly + if ( !div.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + }); + + assert(function( div ) { + + // Opera 10-12/IE8 - ^= $= *= and empty values + // Should not select anything + div.innerHTML = "<input type='hidden' i=''/>"; + if ( div.querySelectorAll("[i^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":enabled").length ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Opera 10-11 does not throw on post-comma invalid pseudos + div.querySelectorAll("*,:x"); + rbuggyQSA.push(",.*:"); + }); + } + + if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector || + docElem.mozMatchesSelector || + docElem.webkitMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector) )) ) { + + assert(function( div ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( div, "div" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( div, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + }); + } + + rbuggyQSA = new RegExp( rbuggyQSA.join("|") ); + rbuggyMatches = new RegExp( rbuggyMatches.join("|") ); + + // Element contains another + // Purposefully does not implement inclusive descendent + // As in, an element does not contain itself + contains = isNative(docElem.contains) || docElem.compareDocumentPosition ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + // Document order sorting + sortOrder = docElem.compareDocumentPosition ? + function( a, b ) { + var compare; + + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) { + if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) { + if ( a === doc || contains( preferredDoc, a ) ) { + return -1; + } + if ( b === doc || contains( preferredDoc, b ) ) { + return 1; + } + return 0; + } + return compare & 4 ? -1 : 1; + } + + return a.compareDocumentPosition ? -1 : 1; + } : + function( a, b ) { + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + + // Parentless nodes are either documents or disconnected + } else if ( !aup || !bup ) { + return a === doc ? -1 : + b === doc ? 1 : + aup ? -1 : + bup ? 1 : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( (cur = cur.parentNode) ) { + ap.unshift( cur ); + } + cur = b; + while ( (cur = cur.parentNode) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[i] === bp[i] ) { + i++; + } + + return i ? + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[i], bp[i] ) : + + // Otherwise nodes in our document sort first + ap[i] === preferredDoc ? -1 : + bp[i] === preferredDoc ? 1 : + 0; + }; + + // Always assume the presence of duplicates if sort doesn't + // pass them to our comparison function (as in Google Chrome). + hasDuplicate = false; + [0, 0].sort( sortOrder ); + support.detectDuplicates = hasDuplicate; + + return document; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + // rbuggyQSA always contains :focus, so no need for an existence check + if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) { + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch(e) {} + } + + return Sizzle( expr, document, null, [elem] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + // Set document vars if needed + if ( ( context.ownerDocument || context ) !== document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + var val; + + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + if ( !documentIsXML ) { + name = name.toLowerCase(); + } + if ( (val = Expr.attrHandle[ name ]) ) { + return val( elem ); + } + if ( documentIsXML || support.attributes ) { + return elem.getAttribute( name ); + } + return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ? + name : + val && val.specified ? val.value : null; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +// Document sorting and removing duplicates +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + i = 1, + j = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + results.sort( sortOrder ); + + if ( hasDuplicate ) { + for ( ; (elem = results[i]); i++ ) { + if ( elem === results[ i - 1 ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + return results; +}; + +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +// Returns a function to use in pseudos for input types +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +// Returns a function to use in pseudos for buttons +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +// Returns a function to use in pseudos for positionals +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + // If no nodeType, this is expected to be an array + for ( ; (node = elem[i]); i++ ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (see #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1].slice( 0, 3 ) === "nth" ) { + // nth-* requires argument + if ( !match[3] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); + match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); + + // other types prohibit arguments + } else if ( match[3] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[5] && match[2]; + + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[4] ) { + match[2] = match[4]; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + match[0] = match[0].slice( 0, excess ); + match[2] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeName ) { + if ( nodeName === "*" ) { + return function() { return true; }; + } + + nodeName = nodeName.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.slice( -check.length ) === check : + operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, what, argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, context, xml ) { + var cache, outerCache, node, diff, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( (node = node[ dir ]) ) { + if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { + return false; + } + } + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + // Seek `elem` from a previously-cached index + outerCache = parent[ expando ] || (parent[ expando ] = {}); + cache = outerCache[ type ] || []; + nodeIndex = cache[0] === dirruns && cache[1]; + diff = cache[0] === dirruns && cache[2]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( (node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + (diff = nodeIndex = 0) || start.pop()) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + outerCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + // Use previously-cached element index if available + } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { + diff = cache[1]; + + // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) + } else { + // Use the same loop as above to seek `elem` from the start + while ( (node = ++nodeIndex && node && node[ dir ] || + (diff = nodeIndex = 0) || start.pop()) ) { + + if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { + // Cache the index of each encountered element + if ( useCache ) { + (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf.call( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + // Potentially complex pseudos + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + // lang value must be a valid identifider + if ( !ridentifier.test(lang || "") ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( (elemLang = documentIsXML ? + elem.getAttribute("xml:lang") || elem.getAttribute("lang") : + elem.lang) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); + return false; + }; + }), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + // Boolean properties + "enabled": function( elem ) { + return elem.disabled === false; + }, + + "disabled": function( elem ) { + return elem.disabled === true; + }, + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), + // not comment, processing instructions, or others + // Thanks to Diego Perini for the nodeName shortcut + // Greater than "@" means alpha characters (specifically not starting with "#" or "?") + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) + // use getAttribute instead to test this case + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); + }, + + // Position-in-collection + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +function tokenize( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( tokens = [] ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + matched = match.shift(); + tokens.push( { + value: matched, + // Cast descendant combinators to space + type: match[0].replace( rtrim, " " ) + } ); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + matched = match.shift(); + tokens.push( { + value: matched, + type: type, + matches: match + } ); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +} + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[i].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + checkNonElements = base && dir === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var data, cache, outerCache, + dirkey = dirruns + " " + doneName; + + // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching + if ( xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || (elem[ expando ] = {}); + if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { + if ( (data = cache[1]) === true || data === cachedruns ) { + return data === true; + } + } else { + cache = outerCache[ dir ] = [ dirkey ]; + cache[1] = matcher( elem, context, xml ) || cachedruns; + if ( cache[1] === true ) { + return true; + } + } + } + } + } + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf.call( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + // A counter to specify which element is currently being matched + var matcherCachedRuns = 0, + bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, expandContext ) { + var elem, j, matcher, + setMatched = [], + matchedCount = 0, + i = "0", + unmatched = seed && [], + outermost = expandContext != null, + contextBackup = outermostContext, + // We must always have either seed elements or context + elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), + // Use integer dirruns iff this is the outermost matcher + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); + + if ( outermost ) { + outermostContext = context !== document && context; + cachedruns = matcherCachedRuns; + } + + // Add elements passing elementMatchers directly to results + // Keep `i` a string if there are no elements so `matchedCount` will be "00" below + for ( ; (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + while ( (matcher = elementMatchers[j++]) ) { + if ( matcher( elem, context, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + cachedruns = ++matcherCachedRuns; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // Apply set filters to unmatched elements + matchedCount += i; + if ( bySet && i !== matchedCount ) { + j = 0; + while ( (matcher = setMatchers[j++]) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !group ) { + group = tokenize( selector ); + } + i = group.length; + while ( i-- ) { + cached = matcherFromTokens( group[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + } + return cached; +}; + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function select( selector, context, results, seed ) { + var i, tokens, token, type, find, + match = tokenize( selector ); + + if ( !seed ) { + // Try to minimize operations if there is only one group + if ( match.length === 1 ) { + + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + context.nodeType === 9 && !documentIsXML && + Expr.relative[ tokens[1].type ] ) { + + context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0]; + if ( !context ) { + return results; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && context.parentNode || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, slice.call( seed, 0 ) ); + return results; + } + + break; + } + } + } + } + } + + // Compile and execute a filtering function + // Provide `match` to avoid retokenization if we modified the selector above + compile( selector, match )( + seed, + context, + documentIsXML, + results, + rsibling.test( selector ) + ); + return results; +} + +// Deprecated +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Easy API for creating new setFilters +function setFilters() {} +Expr.filters = setFilters.prototype = Expr.pseudos; +Expr.setFilters = new setFilters(); + +// Initialize with the default document +setDocument(); + +// Override sizzle attribute retrieval +Sizzle.attr = jQuery.attr; +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.pseudos; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + +})( window ); +var runtil = /Until$/, + rparentsprev = /^(?:parents|prev(?:Until|All))/, + isSimple = /^.[^:#\[\.,]*$/, + rneedsContext = jQuery.expr.match.needsContext, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend({ + find: function( selector ) { + var i, ret, self, + len = this.length; + + if ( typeof selector !== "string" ) { + self = this; + return this.pushStack( jQuery( selector ).filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }) ); + } + + ret = []; + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, this[ i ], ret ); + } + + // Needed because $( selector, context ) becomes $( context ).find( selector ) + ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); + ret.selector = ( this.selector ? this.selector + " " : "" ) + selector; + return ret; + }, + + has: function( target ) { + var i, + targets = jQuery( target, this ), + len = targets.length; + + return this.filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + not: function( selector ) { + return this.pushStack( winnow(this, selector, false) ); + }, + + filter: function( selector ) { + return this.pushStack( winnow(this, selector, true) ); + }, + + is: function( selector ) { + return !!selector && ( + typeof selector === "string" ? + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + rneedsContext.test( selector ) ? + jQuery( selector, this.context ).index( this[0] ) >= 0 : + jQuery.filter( selector, this ).length > 0 : + this.filter( selector ).length > 0 ); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + ret = [], + pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( ; i < l; i++ ) { + cur = this[i]; + + while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { + if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { + ret.push( cur ); + break; + } + cur = cur.parentNode; + } + } + + return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; + } + + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + var set = typeof selector === "string" ? + jQuery( selector, context ) : + jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), + all = jQuery.merge( this.get(), set ); + + return this.pushStack( jQuery.unique(all) ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter(selector) + ); + } +}); + +jQuery.fn.andSelf = jQuery.fn.addBack; + +function sibling( cur, dir ) { + do { + cur = cur[ dir ]; + } while ( cur && cur.nodeType !== 1 ); + + return cur; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( !runtil.test( name ) ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; + + if ( this.length > 1 && rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + + return this.pushStack( ret ); + }; +}); + +jQuery.extend({ + filter: function( expr, elems, not ) { + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 ? + jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : + jQuery.find.matches(expr, elems); + }, + + dir: function( elem, dir, until ) { + var matched = [], + cur = elem[ dir ]; + + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, keep ) { + + // Can't pass null or undefined to indexOf in Firefox 4 + // Set to 0 to skip string check + qualifier = qualifier || 0; + + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep(elements, function( elem, i ) { + var retVal = !!qualifier.call( elem, i, elem ); + return retVal === keep; + }); + + } else if ( qualifier.nodeType ) { + return jQuery.grep(elements, function( elem ) { + return ( elem === qualifier ) === keep; + }); + + } else if ( typeof qualifier === "string" ) { + var filtered = jQuery.grep(elements, function( elem ) { + return elem.nodeType === 1; + }); + + if ( isSimple.test( qualifier ) ) { + return jQuery.filter(qualifier, filtered, !keep); + } else { + qualifier = jQuery.filter( qualifier, filtered ); + } + } + + return jQuery.grep(elements, function( elem ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; + }); +} +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, + rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + rtagName = /<([\w:]+)/, + rtbody = /<tbody/i, + rhtml = /<|&#?\w+;/, + rnoInnerhtml = /<(?:script|style|link)/i, + manipulation_rcheckableType = /^(?:checkbox|radio)$/i, + // checked="checked" or checked + rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, + rscriptType = /^$|\/(?:java|ecma)script/i, + rscriptTypeMasked = /^true\/(.*)/, + rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, + + // We have to close these tags to support XHTML (#13200) + wrapMap = { + option: [ 1, "<select multiple='multiple'>", "</select>" ], + legend: [ 1, "<fieldset>", "</fieldset>" ], + area: [ 1, "<map>", "</map>" ], + param: [ 1, "<object>", "</object>" ], + thead: [ 1, "<table>", "</table>" ], + tr: [ 2, "<table><tbody>", "</tbody></table>" ], + col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], + td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], + + // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, + // unless wrapped in a div with non-breaking characters in front of it. + _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ] + }, + safeFragment = createSafeFragment( document ), + fragmentDiv = safeFragment.appendChild( document.createElement("div") ); + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +jQuery.fn.extend({ + text: function( value ) { + return jQuery.access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); + }, null, value, arguments.length ); + }, + + wrapAll: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapAll( html.call(this, i) ); + }); + } + + if ( this[0] ) { + // The elements to wrap the target around + var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); + + if ( this[0].parentNode ) { + wrap.insertBefore( this[0] ); + } + + wrap.map(function() { + var elem = this; + + while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { + elem = elem.firstChild; + } + + return elem; + }).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapInner( html.call(this, i) ); + }); + } + + return this.each(function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + }); + }, + + wrap: function( html ) { + var isFunction = jQuery.isFunction( html ); + + return this.each(function(i) { + jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); + }); + }, + + unwrap: function() { + return this.parent().each(function() { + if ( !jQuery.nodeName( this, "body" ) ) { + jQuery( this ).replaceWith( this.childNodes ); + } + }).end(); + }, + + append: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.insertBefore( elem, this.firstChild ); + } + }); + }, + + before: function() { + return this.domManip( arguments, false, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + }); + }, + + after: function() { + return this.domManip( arguments, false, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + }); + }, + + // keepData is for internal use only--do not document + remove: function( selector, keepData ) { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) { + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem ) ); + } + + if ( elem.parentNode ) { + if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { + setGlobalEval( getAll( elem, "script" ) ); + } + elem.parentNode.removeChild( elem ); + } + } + } + + return this; + }, + + empty: function() { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + } + + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } + + // If this is a select, ensure that it displays empty (#12336) + // Support: IE<9 + if ( elem.options && jQuery.nodeName( elem, "select" ) ) { + elem.options.length = 0; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function () { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, + + html: function( value ) { + return jQuery.access( this, function( value ) { + var elem = this[0] || {}, + i = 0, + l = this.length; + + if ( value === undefined ) { + return elem.nodeType === 1 ? + elem.innerHTML.replace( rinlinejQuery, "" ) : + undefined; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && + ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && + !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { + + value = value.replace( rxhtmlTag, "<$1></$2>" ); + + try { + for (; i < l; i++ ) { + // Remove element nodes and prevent memory leaks + elem = this[i] || {}; + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch(e) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function( value ) { + var isFunc = jQuery.isFunction( value ); + + // Make sure that the elements are removed from the DOM before they are inserted + // this can help fix replacing a parent with child elements + if ( !isFunc && typeof value !== "string" ) { + value = jQuery( value ).not( this ).detach(); + } + + return this.domManip( [ value ], true, function( elem ) { + var next = this.nextSibling, + parent = this.parentNode; + + if ( parent ) { + jQuery( this ).remove(); + parent.insertBefore( elem, next ); + } + }); + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, table, callback ) { + + // Flatten any nested arrays + args = core_concat.apply( [], args ); + + var first, node, hasScripts, + scripts, doc, fragment, + i = 0, + l = this.length, + set = this, + iNoClone = l - 1, + value = args[0], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { + return this.each(function( index ) { + var self = set.eq( index ); + if ( isFunction ) { + args[0] = value.call( this, index, table ? self.html() : undefined ); + } + self.domManip( args, table, callback ); + }); + } + + if ( l ) { + fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + if ( first ) { + table = table && jQuery.nodeName( first, "tr" ); + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( + table && jQuery.nodeName( this[i], "table" ) ? + findOrAppend( this[i], "tbody" ) : + this[i], + node, + i + ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { + + if ( node.src ) { + // Hope ajax is available... + jQuery.ajax({ + url: node.src, + type: "GET", + dataType: "script", + async: false, + global: false, + "throws": true + }); + } else { + jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); + } + } + } + } + + // Fix #11809: Avoid leaking memory + fragment = first = null; + } + } + + return this; + } +}); + +function findOrAppend( elem, tag ) { + return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + var attr = elem.getAttributeNode("type"); + elem.type = ( attr && attr.specified ) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + if ( match ) { + elem.type = match[1]; + } else { + elem.removeAttribute("type"); + } + return elem; +} + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var elem, + i = 0; + for ( ; (elem = elems[i]) != null; i++ ) { + jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); + } +} + +function cloneCopyEvent( src, dest ) { + + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } + + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; + + if ( events ) { + delete curData.handle; + curData.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } +} + +function fixCloneNodeIssues( src, dest ) { + var nodeName, e, data; + + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } + + nodeName = dest.nodeName.toLowerCase(); + + // IE6-8 copies events bound via attachEvent when using cloneNode. + if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { + data = jQuery._data( dest ); + + for ( e in data.events ) { + jQuery.removeEvent( dest, e, data.handle ); + } + + // Event data gets referenced instead of copied if the expando gets copied too + dest.removeAttribute( jQuery.expando ); + } + + // IE blanks contents when cloning scripts, and tries to evaluate newly-set text + if ( nodeName === "script" && dest.text !== src.text ) { + disableScript( dest ).text = src.text; + restoreScript( dest ); + + // IE6-10 improperly clones children of object elements using classid. + // IE10 throws NoModificationAllowedError if parent is null, #12132. + } else if ( nodeName === "object" ) { + if ( dest.parentNode ) { + dest.outerHTML = src.outerHTML; + } + + // This path appears unavoidable for IE9. When cloning an object + // element in IE9, the outerHTML strategy above is not sufficient. + // If the src has innerHTML and the destination does not, + // copy the src.innerHTML into the dest.innerHTML. #10324 + if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { + dest.innerHTML = src.innerHTML; + } + + } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { + // IE6-8 fails to persist the checked state of a cloned checkbox + // or radio button. Worse, IE6-7 fail to give the cloned element + // a checked appearance if the defaultChecked value isn't also set + + dest.defaultChecked = dest.checked = src.checked; + + // IE6-7 get confused and end up setting the value of a cloned + // checkbox/radio button to an empty string instead of "on" + if ( dest.value !== src.value ) { + dest.value = src.value; + } + + // IE6-8 fails to return the selected option to the default selected + // state when cloning options + } else if ( nodeName === "option" ) { + dest.defaultSelected = dest.selected = src.defaultSelected; + + // IE6-8 fails to set the defaultValue to the correct value when + // cloning other types of input fields + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + i = 0, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone(true); + jQuery( insert[i] )[ original ]( elems ); + + // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() + core_push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +}); + +function getAll( context, tag ) { + var elems, elem, + i = 0, + found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) : + typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) : + undefined; + + if ( !found ) { + for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { + if ( !tag || jQuery.nodeName( elem, tag ) ) { + found.push( elem ); + } else { + jQuery.merge( found, getAll( elem, tag ) ); + } + } + } + + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], found ) : + found; +} + +// Used in buildFragment, fixes the defaultChecked property +function fixDefaultChecked( elem ) { + if ( manipulation_rcheckableType.test( elem.type ) ) { + elem.defaultChecked = elem.checked; + } +} + +jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var destElements, node, clone, i, srcElements, + inPage = jQuery.contains( elem.ownerDocument, elem ); + + if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { + clone = elem.cloneNode( true ); + + // IE<=8 does not properly clone detached, unknown element nodes + } else { + fragmentDiv.innerHTML = elem.outerHTML; + fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); + } + + if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && + (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { + + // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + // Fix all IE cloning issues + for ( i = 0; (node = srcElements[i]) != null; ++i ) { + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + fixCloneNodeIssues( node, destElements[i] ); + } + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0; (node = srcElements[i]) != null; i++ ) { + cloneCopyEvent( node, destElements[i] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + destElements = srcElements = node = null; + + // Return the cloned set + return clone; + }, + + buildFragment: function( elems, context, scripts, selection ) { + var j, elem, contains, + tmp, tag, tbody, wrap, + l = elems.length, + + // Ensure a safe fragment + safe = createSafeFragment( context ), + + nodes = [], + i = 0; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || safe.appendChild( context.createElement("div") ); + + // Deserialize a standard representation + tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + + tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2]; + + // Descend through wrappers to the right content + j = wrap[0]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Manually add leading whitespace removed by IE + if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); + } + + // Remove IE's autoinserted <tbody> from table fragments + if ( !jQuery.support.tbody ) { + + // String was a <table>, *may* have spurious <tbody> + elem = tag === "table" && !rtbody.test( elem ) ? + tmp.firstChild : + + // String was a bare <thead> or <tfoot> + wrap[1] === "<table>" && !rtbody.test( elem ) ? + tmp : + 0; + + j = elem && elem.childNodes.length; + while ( j-- ) { + if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { + elem.removeChild( tbody ); + } + } + } + + jQuery.merge( nodes, tmp.childNodes ); + + // Fix #12392 for WebKit and IE > 9 + tmp.textContent = ""; + + // Fix #12392 for oldIE + while ( tmp.firstChild ) { + tmp.removeChild( tmp.firstChild ); + } + + // Remember the top-level container for proper cleanup + tmp = safe.lastChild; + } + } + } + + // Fix #11356: Clear elements from fragment + if ( tmp ) { + safe.removeChild( tmp ); + } + + // Reset defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + if ( !jQuery.support.appendChecked ) { + jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); + } + + i = 0; + while ( (elem = nodes[ i++ ]) ) { + + // #4087 - If origin and destination elements are the same, and this is + // that element, do not do anything + if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( safe.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( (elem = tmp[ j++ ]) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + tmp = null; + + return safe; + }, + + cleanData: function( elems, /* internal */ acceptData ) { + var elem, type, id, data, + i = 0, + internalKey = jQuery.expando, + cache = jQuery.cache, + deleteExpando = jQuery.support.deleteExpando, + special = jQuery.event.special; + + for ( ; (elem = elems[i]) != null; i++ ) { + + if ( acceptData || jQuery.acceptData( elem ) ) { + + id = elem[ internalKey ]; + data = id && cache[ id ]; + + if ( data ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Remove cache only if it was not already removed by jQuery.event.remove + if ( cache[ id ] ) { + + delete cache[ id ]; + + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( deleteExpando ) { + delete elem[ internalKey ]; + + } else if ( typeof elem.removeAttribute !== core_strundefined ) { + elem.removeAttribute( internalKey ); + + } else { + elem[ internalKey ] = null; + } + + core_deletedIds.push( id ); + } + } + } + } + } +}); +var iframe, getStyles, curCSS, + ralpha = /alpha\([^)]*\)/i, + ropacity = /opacity\s*=\s*([^)]*)/, + rposition = /^(top|right|bottom|left)$/, + // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" + // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + rmargin = /^margin/, + rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), + rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), + rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), + elemdisplay = { BODY: "block" }, + + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: 0, + fontWeight: 400 + }, + + cssExpand = [ "Top", "Right", "Bottom", "Left" ], + cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; + +// return a css property mapped to a potentially vendor prefixed property +function vendorPropName( style, name ) { + + // shortcut for names that are not vendor prefixed + if ( name in style ) { + return name; + } + + // check for vendor prefixed names + var capName = name.charAt(0).toUpperCase() + name.slice(1), + origName = name, + i = cssPrefixes.length; + + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in style ) { + return name; + } + } + + return origName; +} + +function isHidden( elem, el ) { + // isHidden might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); +} + +function showHide( elements, show ) { + var display, elem, hidden, + values = [], + index = 0, + length = elements.length; + + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + + values[ index ] = jQuery._data( elem, "olddisplay" ); + display = elem.style.display; + if ( show ) { + // Reset the inline display of this element to learn if it is + // being hidden by cascaded rules or not + if ( !values[ index ] && display === "none" ) { + elem.style.display = ""; + } + + // Set elements which have been overridden with display: none + // in a stylesheet to whatever the default browser style is + // for such an element + if ( elem.style.display === "" && isHidden( elem ) ) { + values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); + } + } else { + + if ( !values[ index ] ) { + hidden = isHidden( elem ); + + if ( display && display !== "none" || !hidden ) { + jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); + } + } + } + } + + // Set the display of most of the elements in a second loop + // to avoid the constant reflow + for ( index = 0; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + if ( !show || elem.style.display === "none" || elem.style.display === "" ) { + elem.style.display = show ? values[ index ] || "" : "none"; + } + } + + return elements; +} + +jQuery.fn.extend({ + css: function( name, value ) { + return jQuery.access( this, function( elem, name, value ) { + var len, styles, + map = {}, + i = 0; + + if ( jQuery.isArray( name ) ) { + styles = getStyles( elem ); + len = name.length; + + for ( ; i < len; i++ ) { + map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); + } + + return map; + } + + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + }, + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state ) { + var bool = typeof state === "boolean"; + + return this.each(function() { + if ( bool ? state : isHidden( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + }); + } +}); + +jQuery.extend({ + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + } + } + } + }, + + // Exclude the following css properties to add px + cssNumber: { + "columnCount": true, + "fillOpacity": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + // normalize float css property + "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" + }, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, hooks, + origName = jQuery.camelCase( name ), + style = elem.style; + + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // convert relative number strings (+= or -=) to relative numbers. #7345 + if ( type === "string" && (ret = rrelNum.exec( value )) ) { + value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); + // Fixes bug #9237 + type = "number"; + } + + // Make sure that NaN and null values aren't set. See: #7116 + if ( value == null || type === "number" && isNaN( value ) ) { + return; + } + + // If a number was passed in, add 'px' to the (except for certain CSS properties) + if ( type === "number" && !jQuery.cssNumber[ origName ] ) { + value += "px"; + } + + // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, + // but it would mean to define eight (for every problematic property) identical functions + if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { + style[ name ] = "inherit"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { + + // Wrapped to prevent IE from throwing errors when 'invalid' values are provided + // Fixes bug #5509 + try { + style[ name ] = value; + } catch(e) {} + } + + } else { + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, extra, styles ) { + var num, val, hooks, + origName = jQuery.camelCase( name ); + + // Make sure that we're working with the right name + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } + + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name, styles ); + } + + //convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } + + // Return, converting to number if forced or a qualifier was provided and val looks numeric + if ( extra === "" || extra ) { + num = parseFloat( val ); + return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; + } + return val; + }, + + // A method for quickly swapping in/out CSS properties to get correct calculations + swap: function( elem, options, callback, args ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.apply( elem, args || [] ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; + } +}); + +// NOTE: we've included the "window" in window.getComputedStyle +// because jsdom on node.js will break without it. +if ( window.getComputedStyle ) { + getStyles = function( elem ) { + return window.getComputedStyle( elem, null ); + }; + + curCSS = function( elem, name, _computed ) { + var width, minWidth, maxWidth, + computed = _computed || getStyles( elem ), + + // getPropertyValue is only needed for .css('filter') in IE9, see #12537 + ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, + style = elem.style; + + if ( computed ) { + + if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + ret = jQuery.style( elem, name ); + } + + // A tribute to the "awesome hack by Dean Edwards" + // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right + // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels + // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values + if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { + + // Remember the original values + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + // Put in the new values to get a computed value out + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + // Revert the changed values + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret; + }; +} else if ( document.documentElement.currentStyle ) { + getStyles = function( elem ) { + return elem.currentStyle; + }; + + curCSS = function( elem, name, _computed ) { + var left, rs, rsLeft, + computed = _computed || getStyles( elem ), + ret = computed ? computed[ name ] : undefined, + style = elem.style; + + // Avoid setting ret to empty string here + // so we don't default to auto + if ( ret == null && style && style[ name ] ) { + ret = style[ name ]; + } + + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + // but not position css attributes, as those are proportional to the parent element instead + // and we can't measure the parent instead because it might trigger a "stacking dolls" problem + if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { + + // Remember the original values + left = style.left; + rs = elem.runtimeStyle; + rsLeft = rs && rs.left; + + // Put in the new values to get a computed value out + if ( rsLeft ) { + rs.left = elem.currentStyle.left; + } + style.left = name === "fontSize" ? "1em" : ret; + ret = style.pixelLeft + "px"; + + // Revert the changed values + style.left = left; + if ( rsLeft ) { + rs.left = rsLeft; + } + } + + return ret === "" ? "auto" : ret; + }; +} + +function setPositiveNumber( elem, value, subtract ) { + var matches = rnumsplit.exec( value ); + return matches ? + // Guard against undefined "subtract", e.g., when used as in cssHooks + Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : + value; +} + +function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { + var i = extra === ( isBorderBox ? "border" : "content" ) ? + // If we already have the right measurement, avoid augmentation + 4 : + // Otherwise initialize for horizontal or vertical properties + name === "width" ? 1 : 0, + + val = 0; + + for ( ; i < 4; i += 2 ) { + // both box models exclude margin, so add it if we want it + if ( extra === "margin" ) { + val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); + } + + if ( isBorderBox ) { + // border-box includes padding, so remove it if we want content + if ( extra === "content" ) { + val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + } + + // at this point, extra isn't border nor margin, so remove border + if ( extra !== "margin" ) { + val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } else { + // at this point, extra isn't content, so add padding + val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + + // at this point, extra isn't content nor padding, so add border + if ( extra !== "padding" ) { + val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } + } + + return val; +} + +function getWidthOrHeight( elem, name, extra ) { + + // Start with offset property, which is equivalent to the border-box value + var valueIsBorderBox = true, + val = name === "width" ? elem.offsetWidth : elem.offsetHeight, + styles = getStyles( elem ), + isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + + // some non-html elements return undefined for offsetWidth, so check for null/undefined + // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 + // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 + if ( val <= 0 || val == null ) { + // Fall back to computed then uncomputed css if necessary + val = curCSS( elem, name, styles ); + if ( val < 0 || val == null ) { + val = elem.style[ name ]; + } + + // Computed unit is not pixels. Stop here and return. + if ( rnumnonpx.test(val) ) { + return val; + } + + // we need the check for style in case a browser which returns unreliable values + // for getComputedStyle silently falls back to the reliable elem.style + valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); + + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + } + + // use the active box-sizing model to add/subtract irrelevant styles + return ( val + + augmentWidthOrHeight( + elem, + name, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox, + styles + ) + ) + "px"; +} + +// Try to determine the default display value of an element +function css_defaultDisplay( nodeName ) { + var doc = document, + display = elemdisplay[ nodeName ]; + + if ( !display ) { + display = actualDisplay( nodeName, doc ); + + // If the simple way fails, read from inside an iframe + if ( display === "none" || !display ) { + // Use the already-created iframe if possible + iframe = ( iframe || + jQuery("<iframe frameborder='0' width='0' height='0'/>") + .css( "cssText", "display:block !important" ) + ).appendTo( doc.documentElement ); + + // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse + doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document; + doc.write("<!doctype html><html><body>"); + doc.close(); + + display = actualDisplay( nodeName, doc ); + iframe.detach(); + } + + // Store the correct default display + elemdisplay[ nodeName ] = display; + } + + return display; +} + +// Called ONLY from within css_defaultDisplay +function actualDisplay( name, doc ) { + var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), + display = jQuery.css( elem[0], "display" ); + elem.remove(); + return display; +} + +jQuery.each([ "height", "width" ], function( i, name ) { + jQuery.cssHooks[ name ] = { + get: function( elem, computed, extra ) { + if ( computed ) { + // certain elements can have dimension info if we invisibly show them + // however, it must have a current display style that would benefit from this + return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ? + jQuery.swap( elem, cssShow, function() { + return getWidthOrHeight( elem, name, extra ); + }) : + getWidthOrHeight( elem, name, extra ); + } + }, + + set: function( elem, value, extra ) { + var styles = extra && getStyles( elem ); + return setPositiveNumber( elem, value, extra ? + augmentWidthOrHeight( + elem, + name, + extra, + jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box", + styles + ) : 0 + ); + } + }; +}); + +if ( !jQuery.support.opacity ) { + jQuery.cssHooks.opacity = { + get: function( elem, computed ) { + // IE uses filters for opacity + return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? + ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : + computed ? "1" : ""; + }, + + set: function( elem, value ) { + var style = elem.style, + currentStyle = elem.currentStyle, + opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", + filter = currentStyle && currentStyle.filter || style.filter || ""; + + // IE has trouble with opacity if it does not have layout + // Force it by setting the zoom level + style.zoom = 1; + + // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 + // if value === "", then remove inline opacity #12685 + if ( ( value >= 1 || value === "" ) && + jQuery.trim( filter.replace( ralpha, "" ) ) === "" && + style.removeAttribute ) { + + // Setting style.filter to null, "" & " " still leave "filter:" in the cssText + // if "filter:" is present at all, clearType is disabled, we want to avoid this + // style.removeAttribute is IE Only, but so apparently is this code path... + style.removeAttribute( "filter" ); + + // if there is no filter style applied in a css rule or unset inline opacity, we are done + if ( value === "" || currentStyle && !currentStyle.filter ) { + return; + } + } + + // otherwise, set new filter values + style.filter = ralpha.test( filter ) ? + filter.replace( ralpha, opacity ) : + filter + " " + opacity; + } + }; +} + +// These hooks cannot be added until DOM ready because the support test +// for it is not run until after DOM ready +jQuery(function() { + if ( !jQuery.support.reliableMarginRight ) { + jQuery.cssHooks.marginRight = { + get: function( elem, computed ) { + if ( computed ) { + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + // Work around by temporarily setting element display to inline-block + return jQuery.swap( elem, { "display": "inline-block" }, + curCSS, [ elem, "marginRight" ] ); + } + } + }; + } + + // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 + // getComputedStyle returns percent when specified for top/left/bottom/right + // rather than make the css module depend on the offset module, we just check for it here + if ( !jQuery.support.pixelPosition && jQuery.fn.position ) { + jQuery.each( [ "top", "left" ], function( i, prop ) { + jQuery.cssHooks[ prop ] = { + get: function( elem, computed ) { + if ( computed ) { + computed = curCSS( elem, prop ); + // if curCSS returns percentage, fallback to offset + return rnumnonpx.test( computed ) ? + jQuery( elem ).position()[ prop ] + "px" : + computed; + } + } + }; + }); + } + +}); + +if ( jQuery.expr && jQuery.expr.filters ) { + jQuery.expr.filters.hidden = function( elem ) { + // Support: Opera <= 12.12 + // Opera reports offsetWidths and offsetHeights less than zero on some elements + return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 || + (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none"); + }; + + jQuery.expr.filters.visible = function( elem ) { + return !jQuery.expr.filters.hidden( elem ); + }; +} + +// These hooks are used by animate to expand properties +jQuery.each({ + margin: "", + padding: "", + border: "Width" +}, function( prefix, suffix ) { + jQuery.cssHooks[ prefix + suffix ] = { + expand: function( value ) { + var i = 0, + expanded = {}, + + // assumes a single number if not a string + parts = typeof value === "string" ? value.split(" ") : [ value ]; + + for ( ; i < 4; i++ ) { + expanded[ prefix + cssExpand[ i ] + suffix ] = + parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; + } + + return expanded; + } + }; + + if ( !rmargin.test( prefix ) ) { + jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; + } +}); +var r20 = /%20/g, + rbracket = /\[\]$/, + rCRLF = /\r?\n/g, + rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, + rsubmittable = /^(?:input|select|textarea|keygen)/i; + +jQuery.fn.extend({ + serialize: function() { + return jQuery.param( this.serializeArray() ); + }, + serializeArray: function() { + return this.map(function(){ + // Can add propHook for "elements" to filter or add form elements + var elements = jQuery.prop( this, "elements" ); + return elements ? jQuery.makeArray( elements ) : this; + }) + .filter(function(){ + var type = this.type; + // Use .is(":disabled") so that fieldset[disabled] works + return this.name && !jQuery( this ).is( ":disabled" ) && + rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && + ( this.checked || !manipulation_rcheckableType.test( type ) ); + }) + .map(function( i, elem ){ + var val = jQuery( this ).val(); + + return val == null ? + null : + jQuery.isArray( val ) ? + jQuery.map( val, function( val ){ + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + }) : + { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + }).get(); + } +}); + +//Serialize an array of form elements or a set of +//key/values into a query string +jQuery.param = function( a, traditional ) { + var prefix, + s = [], + add = function( key, value ) { + // If value is a function, invoke it and return its value + value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); + s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); + }; + + // Set traditional to true for jQuery <= 1.3.2 behavior. + if ( traditional === undefined ) { + traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; + } + + // If an array was passed in, assume that it is an array of form elements. + if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { + // Serialize the form elements + jQuery.each( a, function() { + add( this.name, this.value ); + }); + + } else { + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for ( prefix in a ) { + buildParams( prefix, a[ prefix ], traditional, add ); + } + } + + // Return the resulting serialization + return s.join( "&" ).replace( r20, "+" ); +}; + +function buildParams( prefix, obj, traditional, add ) { + var name; + + if ( jQuery.isArray( obj ) ) { + // Serialize array item. + jQuery.each( obj, function( i, v ) { + if ( traditional || rbracket.test( prefix ) ) { + // Treat each array item as a scalar. + add( prefix, v ); + + } else { + // Item is non-scalar (array or object), encode its numeric index. + buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); + } + }); + + } else if ( !traditional && jQuery.type( obj ) === "object" ) { + // Serialize object item. + for ( name in obj ) { + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); + } + + } else { + // Serialize scalar item. + add( prefix, obj ); + } +} +jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; +}); + +jQuery.fn.hover = function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); +}; +var + // Document location + ajaxLocParts, + ajaxLocation, + ajax_nonce = jQuery.now(), + + ajax_rquery = /\?/, + rhash = /#.*$/, + rts = /([?&])_=[^&]*/, + rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL + // #7653, #8125, #8152: local protocol detection + rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, + rnoContent = /^(?:GET|HEAD)$/, + rprotocol = /^\/\//, + rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, + + // Keep a copy of the old load method + _load = jQuery.fn.load, + + /* Prefilters + * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) + * 2) These are called: + * - BEFORE asking for a transport + * - AFTER param serialization (s.data is a string if s.processData is true) + * 3) key is the dataType + * 4) the catchall symbol "*" can be used + * 5) execution will start with transport dataType and THEN continue down to "*" if needed + */ + prefilters = {}, + + /* Transports bindings + * 1) key is the dataType + * 2) the catchall symbol "*" can be used + * 3) selection will start with transport dataType and THEN go to "*" if needed + */ + transports = {}, + + // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression + allTypes = "*/".concat("*"); + +// #8138, IE may throw an exception when accessing +// a field from window.location if document.domain has been set +try { + ajaxLocation = location.href; +} catch( e ) { + // Use the href attribute of an A element + // since IE will modify it given document.location + ajaxLocation = document.createElement( "a" ); + ajaxLocation.href = ""; + ajaxLocation = ajaxLocation.href; +} + +// Segment location into parts +ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; + +// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport +function addToPrefiltersOrTransports( structure ) { + + // dataTypeExpression is optional and defaults to "*" + return function( dataTypeExpression, func ) { + + if ( typeof dataTypeExpression !== "string" ) { + func = dataTypeExpression; + dataTypeExpression = "*"; + } + + var dataType, + i = 0, + dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || []; + + if ( jQuery.isFunction( func ) ) { + // For each dataType in the dataTypeExpression + while ( (dataType = dataTypes[i++]) ) { + // Prepend if requested + if ( dataType[0] === "+" ) { + dataType = dataType.slice( 1 ) || "*"; + (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); + + // Otherwise append + } else { + (structure[ dataType ] = structure[ dataType ] || []).push( func ); + } + } + } + }; +} + +// Base inspection function for prefilters and transports +function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { + + var inspected = {}, + seekingTransport = ( structure === transports ); + + function inspect( dataType ) { + var selected; + inspected[ dataType ] = true; + jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { + var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); + if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { + options.dataTypes.unshift( dataTypeOrTransport ); + inspect( dataTypeOrTransport ); + return false; + } else if ( seekingTransport ) { + return !( selected = dataTypeOrTransport ); + } + }); + return selected; + } + + return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); +} + +// A special extend for ajax options +// that takes "flat" options (not to be deep extended) +// Fixes #9887 +function ajaxExtend( target, src ) { + var deep, key, + flatOptions = jQuery.ajaxSettings.flatOptions || {}; + + for ( key in src ) { + if ( src[ key ] !== undefined ) { + ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; + } + } + if ( deep ) { + jQuery.extend( true, target, deep ); + } + + return target; +} + +jQuery.fn.load = function( url, params, callback ) { + if ( typeof url !== "string" && _load ) { + return _load.apply( this, arguments ); + } + + var selector, response, type, + self = this, + off = url.indexOf(" "); + + if ( off >= 0 ) { + selector = url.slice( off, url.length ); + url = url.slice( 0, off ); + } + + // If it's a function + if ( jQuery.isFunction( params ) ) { + + // We assume that it's the callback + callback = params; + params = undefined; + + // Otherwise, build a param string + } else if ( params && typeof params === "object" ) { + type = "POST"; + } + + // If we have elements to modify, make the request + if ( self.length > 0 ) { + jQuery.ajax({ + url: url, + + // if "type" variable is undefined, then "GET" method will be used + type: type, + dataType: "html", + data: params + }).done(function( responseText ) { + + // Save response for use in complete callback + response = arguments; + + self.html( selector ? + + // If a selector was specified, locate the right elements in a dummy div + // Exclude scripts to avoid IE 'Permission Denied' errors + jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) : + + // Otherwise use the full result + responseText ); + + }).complete( callback && function( jqXHR, status ) { + self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); + }); + } + + return this; +}; + +// Attach a bunch of functions for handling common AJAX events +jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){ + jQuery.fn[ type ] = function( fn ){ + return this.on( type, fn ); + }; +}); + +jQuery.each( [ "get", "post" ], function( i, method ) { + jQuery[ method ] = function( url, data, callback, type ) { + // shift arguments if data argument was omitted + if ( jQuery.isFunction( data ) ) { + type = type || callback; + callback = data; + data = undefined; + } + + return jQuery.ajax({ + url: url, + type: method, + dataType: type, + data: data, + success: callback + }); + }; +}); + +jQuery.extend({ + + // Counter for holding the number of active queries + active: 0, + + // Last-Modified header cache for next request + lastModified: {}, + etag: {}, + + ajaxSettings: { + url: ajaxLocation, + type: "GET", + isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), + global: true, + processData: true, + async: true, + contentType: "application/x-www-form-urlencoded; charset=UTF-8", + /* + timeout: 0, + data: null, + dataType: null, + username: null, + password: null, + cache: null, + throws: false, + traditional: false, + headers: {}, + */ + + accepts: { + "*": allTypes, + text: "text/plain", + html: "text/html", + xml: "application/xml, text/xml", + json: "application/json, text/javascript" + }, + + contents: { + xml: /xml/, + html: /html/, + json: /json/ + }, + + responseFields: { + xml: "responseXML", + text: "responseText" + }, + + // Data converters + // Keys separate source (or catchall "*") and destination types with a single space + converters: { + + // Convert anything to text + "* text": window.String, + + // Text to html (true = no transformation) + "text html": true, + + // Evaluate text as a json expression + "text json": jQuery.parseJSON, + + // Parse text as xml + "text xml": jQuery.parseXML + }, + + // For options that shouldn't be deep extended: + // you can add your own custom options here if + // and when you create one that shouldn't be + // deep extended (see ajaxExtend) + flatOptions: { + url: true, + context: true + } + }, + + // Creates a full fledged settings object into target + // with both ajaxSettings and settings fields. + // If target is omitted, writes into ajaxSettings. + ajaxSetup: function( target, settings ) { + return settings ? + + // Building a settings object + ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : + + // Extending ajaxSettings + ajaxExtend( jQuery.ajaxSettings, target ); + }, + + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), + ajaxTransport: addToPrefiltersOrTransports( transports ), + + // Main method + ajax: function( url, options ) { + + // If url is an object, simulate pre-1.5 signature + if ( typeof url === "object" ) { + options = url; + url = undefined; + } + + // Force options to be an object + options = options || {}; + + var // Cross-domain detection vars + parts, + // Loop variable + i, + // URL without anti-cache param + cacheURL, + // Response headers as string + responseHeadersString, + // timeout handle + timeoutTimer, + + // To know if global events are to be dispatched + fireGlobals, + + transport, + // Response headers + responseHeaders, + // Create the final options object + s = jQuery.ajaxSetup( {}, options ), + // Callbacks context + callbackContext = s.context || s, + // Context for global events is callbackContext if it is a DOM node or jQuery collection + globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? + jQuery( callbackContext ) : + jQuery.event, + // Deferreds + deferred = jQuery.Deferred(), + completeDeferred = jQuery.Callbacks("once memory"), + // Status-dependent callbacks + statusCode = s.statusCode || {}, + // Headers (they are sent all at once) + requestHeaders = {}, + requestHeadersNames = {}, + // The jqXHR state + state = 0, + // Default abort message + strAbort = "canceled", + // Fake xhr + jqXHR = { + readyState: 0, + + // Builds headers hashtable if needed + getResponseHeader: function( key ) { + var match; + if ( state === 2 ) { + if ( !responseHeaders ) { + responseHeaders = {}; + while ( (match = rheaders.exec( responseHeadersString )) ) { + responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; + } + } + match = responseHeaders[ key.toLowerCase() ]; + } + return match == null ? null : match; + }, + + // Raw string + getAllResponseHeaders: function() { + return state === 2 ? responseHeadersString : null; + }, + + // Caches the header + setRequestHeader: function( name, value ) { + var lname = name.toLowerCase(); + if ( !state ) { + name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; + requestHeaders[ name ] = value; + } + return this; + }, + + // Overrides response content-type header + overrideMimeType: function( type ) { + if ( !state ) { + s.mimeType = type; + } + return this; + }, + + // Status-dependent callbacks + statusCode: function( map ) { + var code; + if ( map ) { + if ( state < 2 ) { + for ( code in map ) { + // Lazy-add the new callback in a way that preserves old ones + statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; + } + } else { + // Execute the appropriate callbacks + jqXHR.always( map[ jqXHR.status ] ); + } + } + return this; + }, + + // Cancel the request + abort: function( statusText ) { + var finalText = statusText || strAbort; + if ( transport ) { + transport.abort( finalText ); + } + done( 0, finalText ); + return this; + } + }; + + // Attach deferreds + deferred.promise( jqXHR ).complete = completeDeferred.add; + jqXHR.success = jqXHR.done; + jqXHR.error = jqXHR.fail; + + // Remove hash character (#7531: and string promotion) + // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) + // Handle falsy url in the settings object (#10093: consistency with old signature) + // We also use the url parameter if available + s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); + + // Alias method option to type as per ticket #12004 + s.type = options.method || options.type || s.method || s.type; + + // Extract dataTypes list + s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""]; + + // A cross-domain request is in order when we have a protocol:host:port mismatch + if ( s.crossDomain == null ) { + parts = rurl.exec( s.url.toLowerCase() ); + s.crossDomain = !!( parts && + ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || + ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != + ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) + ); + } + + // Convert data if not already a string + if ( s.data && s.processData && typeof s.data !== "string" ) { + s.data = jQuery.param( s.data, s.traditional ); + } + + // Apply prefilters + inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); + + // If request was aborted inside a prefilter, stop there + if ( state === 2 ) { + return jqXHR; + } + + // We can fire global events as of now if asked to + fireGlobals = s.global; + + // Watch for a new set of requests + if ( fireGlobals && jQuery.active++ === 0 ) { + jQuery.event.trigger("ajaxStart"); + } + + // Uppercase the type + s.type = s.type.toUpperCase(); + + // Determine if request has content + s.hasContent = !rnoContent.test( s.type ); + + // Save the URL in case we're toying with the If-Modified-Since + // and/or If-None-Match header later on + cacheURL = s.url; + + // More options handling for requests with no content + if ( !s.hasContent ) { + + // If data is available, append data to url + if ( s.data ) { + cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); + // #9682: remove data so that it's not used in an eventual retry + delete s.data; + } + + // Add anti-cache in url if needed + if ( s.cache === false ) { + s.url = rts.test( cacheURL ) ? + + // If there is already a '_' parameter, set its value + cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) : + + // Otherwise add one to the end + cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++; + } + } + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + if ( jQuery.lastModified[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); + } + if ( jQuery.etag[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); + } + } + + // Set the correct header, if data is being sent + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + jqXHR.setRequestHeader( "Content-Type", s.contentType ); + } + + // Set the Accepts header for the server, depending on the dataType + jqXHR.setRequestHeader( + "Accept", + s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? + s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : + s.accepts[ "*" ] + ); + + // Check for headers option + for ( i in s.headers ) { + jqXHR.setRequestHeader( i, s.headers[ i ] ); + } + + // Allow custom headers/mimetypes and early abort + if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { + // Abort if not done already and return + return jqXHR.abort(); + } + + // aborting is no longer a cancellation + strAbort = "abort"; + + // Install callbacks on deferreds + for ( i in { success: 1, error: 1, complete: 1 } ) { + jqXHR[ i ]( s[ i ] ); + } + + // Get transport + transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); + + // If no transport, we auto-abort + if ( !transport ) { + done( -1, "No Transport" ); + } else { + jqXHR.readyState = 1; + + // Send global event + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); + } + // Timeout + if ( s.async && s.timeout > 0 ) { + timeoutTimer = setTimeout(function() { + jqXHR.abort("timeout"); + }, s.timeout ); + } + + try { + state = 1; + transport.send( requestHeaders, done ); + } catch ( e ) { + // Propagate exception as error if not done + if ( state < 2 ) { + done( -1, e ); + // Simply rethrow otherwise + } else { + throw e; + } + } + } + + // Callback for when everything is done + function done( status, nativeStatusText, responses, headers ) { + var isSuccess, success, error, response, modified, + statusText = nativeStatusText; + + // Called once + if ( state === 2 ) { + return; + } + + // State is "done" now + state = 2; + + // Clear timeout if it exists + if ( timeoutTimer ) { + clearTimeout( timeoutTimer ); + } + + // Dereference transport for early garbage collection + // (no matter how long the jqXHR object will be used) + transport = undefined; + + // Cache response headers + responseHeadersString = headers || ""; + + // Set readyState + jqXHR.readyState = status > 0 ? 4 : 0; + + // Get response data + if ( responses ) { + response = ajaxHandleResponses( s, jqXHR, responses ); + } + + // If successful, handle type chaining + if ( status >= 200 && status < 300 || status === 304 ) { + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + modified = jqXHR.getResponseHeader("Last-Modified"); + if ( modified ) { + jQuery.lastModified[ cacheURL ] = modified; + } + modified = jqXHR.getResponseHeader("etag"); + if ( modified ) { + jQuery.etag[ cacheURL ] = modified; + } + } + + // if no content + if ( status === 204 ) { + isSuccess = true; + statusText = "nocontent"; + + // if not modified + } else if ( status === 304 ) { + isSuccess = true; + statusText = "notmodified"; + + // If we have data, let's convert it + } else { + isSuccess = ajaxConvert( s, response ); + statusText = isSuccess.state; + success = isSuccess.data; + error = isSuccess.error; + isSuccess = !error; + } + } else { + // We extract error from statusText + // then normalize statusText and status for non-aborts + error = statusText; + if ( status || !statusText ) { + statusText = "error"; + if ( status < 0 ) { + status = 0; + } + } + } + + // Set data for the fake xhr object + jqXHR.status = status; + jqXHR.statusText = ( nativeStatusText || statusText ) + ""; + + // Success/Error + if ( isSuccess ) { + deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); + } else { + deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); + } + + // Status-dependent callbacks + jqXHR.statusCode( statusCode ); + statusCode = undefined; + + if ( fireGlobals ) { + globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", + [ jqXHR, s, isSuccess ? success : error ] ); + } + + // Complete + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); + + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); + // Handle the global AJAX counter + if ( !( --jQuery.active ) ) { + jQuery.event.trigger("ajaxStop"); + } + } + } + + return jqXHR; + }, + + getScript: function( url, callback ) { + return jQuery.get( url, undefined, callback, "script" ); + }, + + getJSON: function( url, data, callback ) { + return jQuery.get( url, data, callback, "json" ); + } +}); + +/* Handles responses to an ajax request: + * - sets all responseXXX fields accordingly + * - finds the right dataType (mediates between content-type and expected dataType) + * - returns the corresponding response + */ +function ajaxHandleResponses( s, jqXHR, responses ) { + var firstDataType, ct, finalDataType, type, + contents = s.contents, + dataTypes = s.dataTypes, + responseFields = s.responseFields; + + // Fill responseXXX fields + for ( type in responseFields ) { + if ( type in responses ) { + jqXHR[ responseFields[type] ] = responses[ type ]; + } + } + + // Remove auto dataType and get content-type in the process + while( dataTypes[ 0 ] === "*" ) { + dataTypes.shift(); + if ( ct === undefined ) { + ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); + } + } + + // Check if we're dealing with a known content-type + if ( ct ) { + for ( type in contents ) { + if ( contents[ type ] && contents[ type ].test( ct ) ) { + dataTypes.unshift( type ); + break; + } + } + } + + // Check to see if we have a response for the expected dataType + if ( dataTypes[ 0 ] in responses ) { + finalDataType = dataTypes[ 0 ]; + } else { + // Try convertible dataTypes + for ( type in responses ) { + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { + finalDataType = type; + break; + } + if ( !firstDataType ) { + firstDataType = type; + } + } + // Or just use first one + finalDataType = finalDataType || firstDataType; + } + + // If we found a dataType + // We add the dataType to the list if needed + // and return the corresponding response + if ( finalDataType ) { + if ( finalDataType !== dataTypes[ 0 ] ) { + dataTypes.unshift( finalDataType ); + } + return responses[ finalDataType ]; + } +} + +// Chain conversions given the request and the original response +function ajaxConvert( s, response ) { + var conv2, current, conv, tmp, + converters = {}, + i = 0, + // Work with a copy of dataTypes in case we need to modify it for conversion + dataTypes = s.dataTypes.slice(), + prev = dataTypes[ 0 ]; + + // Apply the dataFilter if provided + if ( s.dataFilter ) { + response = s.dataFilter( response, s.dataType ); + } + + // Create converters map with lowercased keys + if ( dataTypes[ 1 ] ) { + for ( conv in s.converters ) { + converters[ conv.toLowerCase() ] = s.converters[ conv ]; + } + } + + // Convert to each sequential dataType, tolerating list modification + for ( ; (current = dataTypes[++i]); ) { + + // There's only work to do if current dataType is non-auto + if ( current !== "*" ) { + + // Convert response if prev dataType is non-auto and differs from current + if ( prev !== "*" && prev !== current ) { + + // Seek a direct converter + conv = converters[ prev + " " + current ] || converters[ "* " + current ]; + + // If none found, seek a pair + if ( !conv ) { + for ( conv2 in converters ) { + + // If conv2 outputs current + tmp = conv2.split(" "); + if ( tmp[ 1 ] === current ) { + + // If prev can be converted to accepted input + conv = converters[ prev + " " + tmp[ 0 ] ] || + converters[ "* " + tmp[ 0 ] ]; + if ( conv ) { + // Condense equivalence converters + if ( conv === true ) { + conv = converters[ conv2 ]; + + // Otherwise, insert the intermediate dataType + } else if ( converters[ conv2 ] !== true ) { + current = tmp[ 0 ]; + dataTypes.splice( i--, 0, current ); + } + + break; + } + } + } + } + + // Apply converter (if not an equivalence) + if ( conv !== true ) { + + // Unless errors are allowed to bubble, catch and return them + if ( conv && s["throws"] ) { + response = conv( response ); + } else { + try { + response = conv( response ); + } catch ( e ) { + return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; + } + } + } + } + + // Update prev for next iteration + prev = current; + } + } + + return { state: "success", data: response }; +} +// Install script dataType +jQuery.ajaxSetup({ + accepts: { + script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" + }, + contents: { + script: /(?:java|ecma)script/ + }, + converters: { + "text script": function( text ) { + jQuery.globalEval( text ); + return text; + } + } +}); + +// Handle cache's special case and global +jQuery.ajaxPrefilter( "script", function( s ) { + if ( s.cache === undefined ) { + s.cache = false; + } + if ( s.crossDomain ) { + s.type = "GET"; + s.global = false; + } +}); + +// Bind script tag hack transport +jQuery.ajaxTransport( "script", function(s) { + + // This transport only deals with cross domain requests + if ( s.crossDomain ) { + + var script, + head = document.head || jQuery("head")[0] || document.documentElement; + + return { + + send: function( _, callback ) { + + script = document.createElement("script"); + + script.async = true; + + if ( s.scriptCharset ) { + script.charset = s.scriptCharset; + } + + script.src = s.url; + + // Attach handlers for all browsers + script.onload = script.onreadystatechange = function( _, isAbort ) { + + if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { + + // Handle memory leak in IE + script.onload = script.onreadystatechange = null; + + // Remove the script + if ( script.parentNode ) { + script.parentNode.removeChild( script ); + } + + // Dereference the script + script = null; + + // Callback if not abort + if ( !isAbort ) { + callback( 200, "success" ); + } + } + }; + + // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending + // Use native DOM manipulation to avoid our domManip AJAX trickery + head.insertBefore( script, head.firstChild ); + }, + + abort: function() { + if ( script ) { + script.onload( undefined, true ); + } + } + }; + } +}); +var oldCallbacks = [], + rjsonp = /(=)\?(?=&|$)|\?\?/; + +// Default jsonp settings +jQuery.ajaxSetup({ + jsonp: "callback", + jsonpCallback: function() { + var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) ); + this[ callback ] = true; + return callback; + } +}); + +// Detect, normalize options and install callbacks for jsonp requests +jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { + + var callbackName, overwritten, responseContainer, + jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? + "url" : + typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" + ); + + // Handle iff the expected data type is "jsonp" or we have a parameter to set + if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { + + // Get callback name, remembering preexisting value associated with it + callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? + s.jsonpCallback() : + s.jsonpCallback; + + // Insert callback into url or form data + if ( jsonProp ) { + s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); + } else if ( s.jsonp !== false ) { + s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; + } + + // Use data converter to retrieve json after script execution + s.converters["script json"] = function() { + if ( !responseContainer ) { + jQuery.error( callbackName + " was not called" ); + } + return responseContainer[ 0 ]; + }; + + // force json dataType + s.dataTypes[ 0 ] = "json"; + + // Install callback + overwritten = window[ callbackName ]; + window[ callbackName ] = function() { + responseContainer = arguments; + }; + + // Clean-up function (fires after converters) + jqXHR.always(function() { + // Restore preexisting value + window[ callbackName ] = overwritten; + + // Save back as free + if ( s[ callbackName ] ) { + // make sure that re-using the options doesn't screw things around + s.jsonpCallback = originalSettings.jsonpCallback; + + // save the callback name for future use + oldCallbacks.push( callbackName ); + } + + // Call if it was a function and we have a response + if ( responseContainer && jQuery.isFunction( overwritten ) ) { + overwritten( responseContainer[ 0 ] ); + } + + responseContainer = overwritten = undefined; + }); + + // Delegate to script + return "script"; + } +}); +var xhrCallbacks, xhrSupported, + xhrId = 0, + // #5280: Internet Explorer will keep connections alive if we don't abort on unload + xhrOnUnloadAbort = window.ActiveXObject && function() { + // Abort all pending requests + var key; + for ( key in xhrCallbacks ) { + xhrCallbacks[ key ]( undefined, true ); + } + }; + +// Functions to create xhrs +function createStandardXHR() { + try { + return new window.XMLHttpRequest(); + } catch( e ) {} +} + +function createActiveXHR() { + try { + return new window.ActiveXObject("Microsoft.XMLHTTP"); + } catch( e ) {} +} + +// Create the request object +// (This is still attached to ajaxSettings for backward compatibility) +jQuery.ajaxSettings.xhr = window.ActiveXObject ? + /* Microsoft failed to properly + * implement the XMLHttpRequest in IE7 (can't request local files), + * so we use the ActiveXObject when it is available + * Additionally XMLHttpRequest can be disabled in IE7/IE8 so + * we need a fallback. + */ + function() { + return !this.isLocal && createStandardXHR() || createActiveXHR(); + } : + // For all other browsers, use the standard XMLHttpRequest object + createStandardXHR; + +// Determine support properties +xhrSupported = jQuery.ajaxSettings.xhr(); +jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); +xhrSupported = jQuery.support.ajax = !!xhrSupported; + +// Create transport if the browser can provide an xhr +if ( xhrSupported ) { + + jQuery.ajaxTransport(function( s ) { + // Cross domain only allowed if supported through XMLHttpRequest + if ( !s.crossDomain || jQuery.support.cors ) { + + var callback; + + return { + send: function( headers, complete ) { + + // Get a new xhr + var handle, i, + xhr = s.xhr(); + + // Open the socket + // Passing null username, generates a login popup on Opera (#2865) + if ( s.username ) { + xhr.open( s.type, s.url, s.async, s.username, s.password ); + } else { + xhr.open( s.type, s.url, s.async ); + } + + // Apply custom fields if provided + if ( s.xhrFields ) { + for ( i in s.xhrFields ) { + xhr[ i ] = s.xhrFields[ i ]; + } + } + + // Override mime type if needed + if ( s.mimeType && xhr.overrideMimeType ) { + xhr.overrideMimeType( s.mimeType ); + } + + // X-Requested-With header + // For cross-domain requests, seeing as conditions for a preflight are + // akin to a jigsaw puzzle, we simply never set it to be sure. + // (it can always be set on a per-request basis or even using ajaxSetup) + // For same-domain requests, won't change header if already provided. + if ( !s.crossDomain && !headers["X-Requested-With"] ) { + headers["X-Requested-With"] = "XMLHttpRequest"; + } + + // Need an extra try/catch for cross domain requests in Firefox 3 + try { + for ( i in headers ) { + xhr.setRequestHeader( i, headers[ i ] ); + } + } catch( err ) {} + + // Do send the request + // This may raise an exception which is actually + // handled in jQuery.ajax (so no try/catch here) + xhr.send( ( s.hasContent && s.data ) || null ); + + // Listener + callback = function( _, isAbort ) { + var status, responseHeaders, statusText, responses; + + // Firefox throws exceptions when accessing properties + // of an xhr when a network error occurred + // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) + try { + + // Was never called and is aborted or complete + if ( callback && ( isAbort || xhr.readyState === 4 ) ) { + + // Only called once + callback = undefined; + + // Do not keep as active anymore + if ( handle ) { + xhr.onreadystatechange = jQuery.noop; + if ( xhrOnUnloadAbort ) { + delete xhrCallbacks[ handle ]; + } + } + + // If it's an abort + if ( isAbort ) { + // Abort it manually if needed + if ( xhr.readyState !== 4 ) { + xhr.abort(); + } + } else { + responses = {}; + status = xhr.status; + responseHeaders = xhr.getAllResponseHeaders(); + + // When requesting binary data, IE6-9 will throw an exception + // on any attempt to access responseText (#11426) + if ( typeof xhr.responseText === "string" ) { + responses.text = xhr.responseText; + } + + // Firefox throws an exception when accessing + // statusText for faulty cross-domain requests + try { + statusText = xhr.statusText; + } catch( e ) { + // We normalize with Webkit giving an empty statusText + statusText = ""; + } + + // Filter status for non standard behaviors + + // If the request is local and we have data: assume a success + // (success with no data won't get notified, that's the best we + // can do given current implementations) + if ( !status && s.isLocal && !s.crossDomain ) { + status = responses.text ? 200 : 404; + // IE - #1450: sometimes returns 1223 when it should be 204 + } else if ( status === 1223 ) { + status = 204; + } + } + } + } catch( firefoxAccessException ) { + if ( !isAbort ) { + complete( -1, firefoxAccessException ); + } + } + + // Call complete if needed + if ( responses ) { + complete( status, statusText, responses, responseHeaders ); + } + }; + + if ( !s.async ) { + // if we're in sync mode we fire the callback + callback(); + } else if ( xhr.readyState === 4 ) { + // (IE6 & IE7) if it's in cache and has been + // retrieved directly we need to fire the callback + setTimeout( callback ); + } else { + handle = ++xhrId; + if ( xhrOnUnloadAbort ) { + // Create the active xhrs callbacks list if needed + // and attach the unload handler + if ( !xhrCallbacks ) { + xhrCallbacks = {}; + jQuery( window ).unload( xhrOnUnloadAbort ); + } + // Add to list of active xhrs callbacks + xhrCallbacks[ handle ] = callback; + } + xhr.onreadystatechange = callback; + } + }, + + abort: function() { + if ( callback ) { + callback( undefined, true ); + } + } + }; + } + }); +} +var fxNow, timerId, + rfxtypes = /^(?:toggle|show|hide)$/, + rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), + rrun = /queueHooks$/, + animationPrefilters = [ defaultPrefilter ], + tweeners = { + "*": [function( prop, value ) { + var end, unit, + tween = this.createTween( prop, value ), + parts = rfxnum.exec( value ), + target = tween.cur(), + start = +target || 0, + scale = 1, + maxIterations = 20; + + if ( parts ) { + end = +parts[2]; + unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + + // We need to compute starting value + if ( unit !== "px" && start ) { + // Iteratively approximate from a nonzero starting point + // Prefer the current property, because this process will be trivial if it uses the same units + // Fallback to end or a simple constant + start = jQuery.css( tween.elem, prop, true ) || end || 1; + + do { + // If previous iteration zeroed out, double until we get *something* + // Use a string for doubling factor so we don't accidentally see scale as unchanged below + scale = scale || ".5"; + + // Adjust and apply + start = start / scale; + jQuery.style( tween.elem, prop, start + unit ); + + // Update scale, tolerating zero or NaN from tween.cur() + // And breaking the loop if scale is unchanged or perfect, or if we've just had enough + } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); + } + + tween.unit = unit; + tween.start = start; + // If a +=/-= token was provided, we're doing a relative animation + tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; + } + return tween; + }] + }; + +// Animations created synchronously will run synchronously +function createFxNow() { + setTimeout(function() { + fxNow = undefined; + }); + return ( fxNow = jQuery.now() ); +} + +function createTweens( animation, props ) { + jQuery.each( props, function( prop, value ) { + var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), + index = 0, + length = collection.length; + for ( ; index < length; index++ ) { + if ( collection[ index ].call( animation, prop, value ) ) { + + // we're done with this property + return; + } + } + }); +} + +function Animation( elem, properties, options ) { + var result, + stopped, + index = 0, + length = animationPrefilters.length, + deferred = jQuery.Deferred().always( function() { + // don't match elem in the :animated selector + delete tick.elem; + }), + tick = function() { + if ( stopped ) { + return false; + } + var currentTime = fxNow || createFxNow(), + remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), + // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) + temp = remaining / animation.duration || 0, + percent = 1 - temp, + index = 0, + length = animation.tweens.length; + + for ( ; index < length ; index++ ) { + animation.tweens[ index ].run( percent ); + } + + deferred.notifyWith( elem, [ animation, percent, remaining ]); + + if ( percent < 1 && length ) { + return remaining; + } else { + deferred.resolveWith( elem, [ animation ] ); + return false; + } + }, + animation = deferred.promise({ + elem: elem, + props: jQuery.extend( {}, properties ), + opts: jQuery.extend( true, { specialEasing: {} }, options ), + originalProperties: properties, + originalOptions: options, + startTime: fxNow || createFxNow(), + duration: options.duration, + tweens: [], + createTween: function( prop, end ) { + var tween = jQuery.Tween( elem, animation.opts, prop, end, + animation.opts.specialEasing[ prop ] || animation.opts.easing ); + animation.tweens.push( tween ); + return tween; + }, + stop: function( gotoEnd ) { + var index = 0, + // if we are going to the end, we want to run all the tweens + // otherwise we skip this part + length = gotoEnd ? animation.tweens.length : 0; + if ( stopped ) { + return this; + } + stopped = true; + for ( ; index < length ; index++ ) { + animation.tweens[ index ].run( 1 ); + } + + // resolve when we played the last frame + // otherwise, reject + if ( gotoEnd ) { + deferred.resolveWith( elem, [ animation, gotoEnd ] ); + } else { + deferred.rejectWith( elem, [ animation, gotoEnd ] ); + } + return this; + } + }), + props = animation.props; + + propFilter( props, animation.opts.specialEasing ); + + for ( ; index < length ; index++ ) { + result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); + if ( result ) { + return result; + } + } + + createTweens( animation, props ); + + if ( jQuery.isFunction( animation.opts.start ) ) { + animation.opts.start.call( elem, animation ); + } + + jQuery.fx.timer( + jQuery.extend( tick, { + elem: elem, + anim: animation, + queue: animation.opts.queue + }) + ); + + // attach callbacks from options + return animation.progress( animation.opts.progress ) + .done( animation.opts.done, animation.opts.complete ) + .fail( animation.opts.fail ) + .always( animation.opts.always ); +} + +function propFilter( props, specialEasing ) { + var value, name, index, easing, hooks; + + // camelCase, specialEasing and expand cssHook pass + for ( index in props ) { + name = jQuery.camelCase( index ); + easing = specialEasing[ name ]; + value = props[ index ]; + if ( jQuery.isArray( value ) ) { + easing = value[ 1 ]; + value = props[ index ] = value[ 0 ]; + } + + if ( index !== name ) { + props[ name ] = value; + delete props[ index ]; + } + + hooks = jQuery.cssHooks[ name ]; + if ( hooks && "expand" in hooks ) { + value = hooks.expand( value ); + delete props[ name ]; + + // not quite $.extend, this wont overwrite keys already present. + // also - reusing 'index' from above because we have the correct "name" + for ( index in value ) { + if ( !( index in props ) ) { + props[ index ] = value[ index ]; + specialEasing[ index ] = easing; + } + } + } else { + specialEasing[ name ] = easing; + } + } +} + +jQuery.Animation = jQuery.extend( Animation, { + + tweener: function( props, callback ) { + if ( jQuery.isFunction( props ) ) { + callback = props; + props = [ "*" ]; + } else { + props = props.split(" "); + } + + var prop, + index = 0, + length = props.length; + + for ( ; index < length ; index++ ) { + prop = props[ index ]; + tweeners[ prop ] = tweeners[ prop ] || []; + tweeners[ prop ].unshift( callback ); + } + }, + + prefilter: function( callback, prepend ) { + if ( prepend ) { + animationPrefilters.unshift( callback ); + } else { + animationPrefilters.push( callback ); + } + } +}); + +function defaultPrefilter( elem, props, opts ) { + /*jshint validthis:true */ + var prop, index, length, + value, dataShow, toggle, + tween, hooks, oldfire, + anim = this, + style = elem.style, + orig = {}, + handled = [], + hidden = elem.nodeType && isHidden( elem ); + + // handle queue: false promises + if ( !opts.queue ) { + hooks = jQuery._queueHooks( elem, "fx" ); + if ( hooks.unqueued == null ) { + hooks.unqueued = 0; + oldfire = hooks.empty.fire; + hooks.empty.fire = function() { + if ( !hooks.unqueued ) { + oldfire(); + } + }; + } + hooks.unqueued++; + + anim.always(function() { + // doing this makes sure that the complete handler will be called + // before this completes + anim.always(function() { + hooks.unqueued--; + if ( !jQuery.queue( elem, "fx" ).length ) { + hooks.empty.fire(); + } + }); + }); + } + + // height/width overflow pass + if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { + // Make sure that nothing sneaks out + // Record all 3 overflow attributes because IE does not + // change the overflow attribute when overflowX and + // overflowY are set to the same value + opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; + + // Set display property to inline-block for height/width + // animations on inline elements that are having width/height animated + if ( jQuery.css( elem, "display" ) === "inline" && + jQuery.css( elem, "float" ) === "none" ) { + + // inline-level elements accept inline-block; + // block-level elements need to be inline with layout + if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { + style.display = "inline-block"; + + } else { + style.zoom = 1; + } + } + } + + if ( opts.overflow ) { + style.overflow = "hidden"; + if ( !jQuery.support.shrinkWrapBlocks ) { + anim.always(function() { + style.overflow = opts.overflow[ 0 ]; + style.overflowX = opts.overflow[ 1 ]; + style.overflowY = opts.overflow[ 2 ]; + }); + } + } + + + // show/hide pass + for ( index in props ) { + value = props[ index ]; + if ( rfxtypes.exec( value ) ) { + delete props[ index ]; + toggle = toggle || value === "toggle"; + if ( value === ( hidden ? "hide" : "show" ) ) { + continue; + } + handled.push( index ); + } + } + + length = handled.length; + if ( length ) { + dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} ); + if ( "hidden" in dataShow ) { + hidden = dataShow.hidden; + } + + // store state if its toggle - enables .stop().toggle() to "reverse" + if ( toggle ) { + dataShow.hidden = !hidden; + } + if ( hidden ) { + jQuery( elem ).show(); + } else { + anim.done(function() { + jQuery( elem ).hide(); + }); + } + anim.done(function() { + var prop; + jQuery._removeData( elem, "fxshow" ); + for ( prop in orig ) { + jQuery.style( elem, prop, orig[ prop ] ); + } + }); + for ( index = 0 ; index < length ; index++ ) { + prop = handled[ index ]; + tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 ); + orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop ); + + if ( !( prop in dataShow ) ) { + dataShow[ prop ] = tween.start; + if ( hidden ) { + tween.end = tween.start; + tween.start = prop === "width" || prop === "height" ? 1 : 0; + } + } + } + } +} + +function Tween( elem, options, prop, end, easing ) { + return new Tween.prototype.init( elem, options, prop, end, easing ); +} +jQuery.Tween = Tween; + +Tween.prototype = { + constructor: Tween, + init: function( elem, options, prop, end, easing, unit ) { + this.elem = elem; + this.prop = prop; + this.easing = easing || "swing"; + this.options = options; + this.start = this.now = this.cur(); + this.end = end; + this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + }, + cur: function() { + var hooks = Tween.propHooks[ this.prop ]; + + return hooks && hooks.get ? + hooks.get( this ) : + Tween.propHooks._default.get( this ); + }, + run: function( percent ) { + var eased, + hooks = Tween.propHooks[ this.prop ]; + + if ( this.options.duration ) { + this.pos = eased = jQuery.easing[ this.easing ]( + percent, this.options.duration * percent, 0, 1, this.options.duration + ); + } else { + this.pos = eased = percent; + } + this.now = ( this.end - this.start ) * eased + this.start; + + if ( this.options.step ) { + this.options.step.call( this.elem, this.now, this ); + } + + if ( hooks && hooks.set ) { + hooks.set( this ); + } else { + Tween.propHooks._default.set( this ); + } + return this; + } +}; + +Tween.prototype.init.prototype = Tween.prototype; + +Tween.propHooks = { + _default: { + get: function( tween ) { + var result; + + if ( tween.elem[ tween.prop ] != null && + (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { + return tween.elem[ tween.prop ]; + } + + // passing an empty string as a 3rd parameter to .css will automatically + // attempt a parseFloat and fallback to a string if the parse fails + // so, simple values such as "10px" are parsed to Float. + // complex values such as "rotate(1rad)" are returned as is. + result = jQuery.css( tween.elem, tween.prop, "" ); + // Empty strings, null, undefined and "auto" are converted to 0. + return !result || result === "auto" ? 0 : result; + }, + set: function( tween ) { + // use step hook for back compat - use cssHook if its there - use .style if its + // available and use plain properties where available + if ( jQuery.fx.step[ tween.prop ] ) { + jQuery.fx.step[ tween.prop ]( tween ); + } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { + jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); + } else { + tween.elem[ tween.prop ] = tween.now; + } + } + } +}; + +// Remove in 2.0 - this supports IE8's panic based approach +// to setting things on disconnected nodes + +Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { + set: function( tween ) { + if ( tween.elem.nodeType && tween.elem.parentNode ) { + tween.elem[ tween.prop ] = tween.now; + } + } +}; + +jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { + var cssFn = jQuery.fn[ name ]; + jQuery.fn[ name ] = function( speed, easing, callback ) { + return speed == null || typeof speed === "boolean" ? + cssFn.apply( this, arguments ) : + this.animate( genFx( name, true ), speed, easing, callback ); + }; +}); + +jQuery.fn.extend({ + fadeTo: function( speed, to, easing, callback ) { + + // show any hidden elements after setting opacity to 0 + return this.filter( isHidden ).css( "opacity", 0 ).show() + + // animate to the value specified + .end().animate({ opacity: to }, speed, easing, callback ); + }, + animate: function( prop, speed, easing, callback ) { + var empty = jQuery.isEmptyObject( prop ), + optall = jQuery.speed( speed, easing, callback ), + doAnimation = function() { + // Operate on a copy of prop so per-property easing won't be lost + var anim = Animation( this, jQuery.extend( {}, prop ), optall ); + doAnimation.finish = function() { + anim.stop( true ); + }; + // Empty animations, or finishing resolves immediately + if ( empty || jQuery._data( this, "finish" ) ) { + anim.stop( true ); + } + }; + doAnimation.finish = doAnimation; + + return empty || optall.queue === false ? + this.each( doAnimation ) : + this.queue( optall.queue, doAnimation ); + }, + stop: function( type, clearQueue, gotoEnd ) { + var stopQueue = function( hooks ) { + var stop = hooks.stop; + delete hooks.stop; + stop( gotoEnd ); + }; + + if ( typeof type !== "string" ) { + gotoEnd = clearQueue; + clearQueue = type; + type = undefined; + } + if ( clearQueue && type !== false ) { + this.queue( type || "fx", [] ); + } + + return this.each(function() { + var dequeue = true, + index = type != null && type + "queueHooks", + timers = jQuery.timers, + data = jQuery._data( this ); + + if ( index ) { + if ( data[ index ] && data[ index ].stop ) { + stopQueue( data[ index ] ); + } + } else { + for ( index in data ) { + if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { + stopQueue( data[ index ] ); + } + } + } + + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { + timers[ index ].anim.stop( gotoEnd ); + dequeue = false; + timers.splice( index, 1 ); + } + } + + // start the next in the queue if the last step wasn't forced + // timers currently will call their complete callbacks, which will dequeue + // but only if they were gotoEnd + if ( dequeue || !gotoEnd ) { + jQuery.dequeue( this, type ); + } + }); + }, + finish: function( type ) { + if ( type !== false ) { + type = type || "fx"; + } + return this.each(function() { + var index, + data = jQuery._data( this ), + queue = data[ type + "queue" ], + hooks = data[ type + "queueHooks" ], + timers = jQuery.timers, + length = queue ? queue.length : 0; + + // enable finishing flag on private data + data.finish = true; + + // empty the queue first + jQuery.queue( this, type, [] ); + + if ( hooks && hooks.cur && hooks.cur.finish ) { + hooks.cur.finish.call( this ); + } + + // look for any active animations, and finish them + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && timers[ index ].queue === type ) { + timers[ index ].anim.stop( true ); + timers.splice( index, 1 ); + } + } + + // look for any animations in the old queue and finish them + for ( index = 0; index < length; index++ ) { + if ( queue[ index ] && queue[ index ].finish ) { + queue[ index ].finish.call( this ); + } + } + + // turn off finishing flag + delete data.finish; + }); + } +}); + +// Generate parameters to create a standard animation +function genFx( type, includeWidth ) { + var which, + attrs = { height: type }, + i = 0; + + // if we include width, step value is 1 to do all cssExpand values, + // if we don't include width, step value is 2 to skip over Left and Right + includeWidth = includeWidth? 1 : 0; + for( ; i < 4 ; i += 2 - includeWidth ) { + which = cssExpand[ i ]; + attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; + } + + if ( includeWidth ) { + attrs.opacity = attrs.width = type; + } + + return attrs; +} + +// Generate shortcuts for custom animations +jQuery.each({ + slideDown: genFx("show"), + slideUp: genFx("hide"), + slideToggle: genFx("toggle"), + fadeIn: { opacity: "show" }, + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } +}, function( name, props ) { + jQuery.fn[ name ] = function( speed, easing, callback ) { + return this.animate( props, speed, easing, callback ); + }; +}); + +jQuery.speed = function( speed, easing, fn ) { + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { + complete: fn || !fn && easing || + jQuery.isFunction( speed ) && speed, + duration: speed, + easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing + }; + + opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : + opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; + + // normalize opt.queue - true/undefined/null -> "fx" + if ( opt.queue == null || opt.queue === true ) { + opt.queue = "fx"; + } + + // Queueing + opt.old = opt.complete; + + opt.complete = function() { + if ( jQuery.isFunction( opt.old ) ) { + opt.old.call( this ); + } + + if ( opt.queue ) { + jQuery.dequeue( this, opt.queue ); + } + }; + + return opt; +}; + +jQuery.easing = { + linear: function( p ) { + return p; + }, + swing: function( p ) { + return 0.5 - Math.cos( p*Math.PI ) / 2; + } +}; + +jQuery.timers = []; +jQuery.fx = Tween.prototype.init; +jQuery.fx.tick = function() { + var timer, + timers = jQuery.timers, + i = 0; + + fxNow = jQuery.now(); + + for ( ; i < timers.length; i++ ) { + timer = timers[ i ]; + // Checks the timer has not already been removed + if ( !timer() && timers[ i ] === timer ) { + timers.splice( i--, 1 ); + } + } + + if ( !timers.length ) { + jQuery.fx.stop(); + } + fxNow = undefined; +}; + +jQuery.fx.timer = function( timer ) { + if ( timer() && jQuery.timers.push( timer ) ) { + jQuery.fx.start(); + } +}; + +jQuery.fx.interval = 13; + +jQuery.fx.start = function() { + if ( !timerId ) { + timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); + } +}; + +jQuery.fx.stop = function() { + clearInterval( timerId ); + timerId = null; +}; + +jQuery.fx.speeds = { + slow: 600, + fast: 200, + // Default speed + _default: 400 +}; + +// Back Compat <1.8 extension point +jQuery.fx.step = {}; + +if ( jQuery.expr && jQuery.expr.filters ) { + jQuery.expr.filters.animated = function( elem ) { + return jQuery.grep(jQuery.timers, function( fn ) { + return elem === fn.elem; + }).length; + }; +} +jQuery.fn.offset = function( options ) { + if ( arguments.length ) { + return options === undefined ? + this : + this.each(function( i ) { + jQuery.offset.setOffset( this, options, i ); + }); + } + + var docElem, win, + box = { top: 0, left: 0 }, + elem = this[ 0 ], + doc = elem && elem.ownerDocument; + + if ( !doc ) { + return; + } + + docElem = doc.documentElement; + + // Make sure it's not a disconnected DOM node + if ( !jQuery.contains( docElem, elem ) ) { + return box; + } + + // If we don't have gBCR, just use 0,0 rather than error + // BlackBerry 5, iOS 3 (original iPhone) + if ( typeof elem.getBoundingClientRect !== core_strundefined ) { + box = elem.getBoundingClientRect(); + } + win = getWindow( doc ); + return { + top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), + left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) + }; +}; + +jQuery.offset = { + + setOffset: function( elem, options, i ) { + var position = jQuery.css( elem, "position" ); + + // set position first, in-case top/left are set even on static elem + if ( position === "static" ) { + elem.style.position = "relative"; + } + + var curElem = jQuery( elem ), + curOffset = curElem.offset(), + curCSSTop = jQuery.css( elem, "top" ), + curCSSLeft = jQuery.css( elem, "left" ), + calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, + props = {}, curPosition = {}, curTop, curLeft; + + // need to be able to calculate position if either top or left is auto and position is either absolute or fixed + if ( calculatePosition ) { + curPosition = curElem.position(); + curTop = curPosition.top; + curLeft = curPosition.left; + } else { + curTop = parseFloat( curCSSTop ) || 0; + curLeft = parseFloat( curCSSLeft ) || 0; + } + + if ( jQuery.isFunction( options ) ) { + options = options.call( elem, i, curOffset ); + } + + if ( options.top != null ) { + props.top = ( options.top - curOffset.top ) + curTop; + } + if ( options.left != null ) { + props.left = ( options.left - curOffset.left ) + curLeft; + } + + if ( "using" in options ) { + options.using.call( elem, props ); + } else { + curElem.css( props ); + } + } +}; + + +jQuery.fn.extend({ + + position: function() { + if ( !this[ 0 ] ) { + return; + } + + var offsetParent, offset, + parentOffset = { top: 0, left: 0 }, + elem = this[ 0 ]; + + // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent + if ( jQuery.css( elem, "position" ) === "fixed" ) { + // we assume that getBoundingClientRect is available when computed position is fixed + offset = elem.getBoundingClientRect(); + } else { + // Get *real* offsetParent + offsetParent = this.offsetParent(); + + // Get correct offsets + offset = this.offset(); + if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { + parentOffset = offsetParent.offset(); + } + + // Add offsetParent borders + parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); + parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); + } + + // Subtract parent offsets and element margins + // note: when an element has margin: auto the offsetLeft and marginLeft + // are the same in Safari causing offset.left to incorrectly be 0 + return { + top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), + left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true) + }; + }, + + offsetParent: function() { + return this.map(function() { + var offsetParent = this.offsetParent || document.documentElement; + while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) { + offsetParent = offsetParent.offsetParent; + } + return offsetParent || document.documentElement; + }); + } +}); + + +// Create scrollLeft and scrollTop methods +jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { + var top = /Y/.test( prop ); + + jQuery.fn[ method ] = function( val ) { + return jQuery.access( this, function( elem, method, val ) { + var win = getWindow( elem ); + + if ( val === undefined ) { + return win ? (prop in win) ? win[ prop ] : + win.document.documentElement[ method ] : + elem[ method ]; + } + + if ( win ) { + win.scrollTo( + !top ? val : jQuery( win ).scrollLeft(), + top ? val : jQuery( win ).scrollTop() + ); + + } else { + elem[ method ] = val; + } + }, method, val, arguments.length, null ); + }; +}); + +function getWindow( elem ) { + return jQuery.isWindow( elem ) ? + elem : + elem.nodeType === 9 ? + elem.defaultView || elem.parentWindow : + false; +} +// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods +jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { + jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { + // margin is only for outerHeight, outerWidth + jQuery.fn[ funcName ] = function( margin, value ) { + var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), + extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); + + return jQuery.access( this, function( elem, type, value ) { + var doc; + + if ( jQuery.isWindow( elem ) ) { + // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there + // isn't a whole lot we can do. See pull request at this URL for discussion: + // https://github.com/jquery/jquery/pull/764 + return elem.document.documentElement[ "client" + name ]; + } + + // Get document width or height + if ( elem.nodeType === 9 ) { + doc = elem.documentElement; + + // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest + // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. + return Math.max( + elem.body[ "scroll" + name ], doc[ "scroll" + name ], + elem.body[ "offset" + name ], doc[ "offset" + name ], + doc[ "client" + name ] + ); + } + + return value === undefined ? + // Get width or height on the element, requesting but not forcing parseFloat + jQuery.css( elem, type, extra ) : + + // Set width or height on the element + jQuery.style( elem, type, value, extra ); + }, type, chainable ? margin : undefined, chainable, null ); + }; + }); +}); +// Limit scope pollution from any deprecated API +// (function() { + +// })(); +// Expose jQuery to the global object +window.jQuery = window.$ = jQuery; + +// Expose jQuery as an AMD module, but only for AMD loaders that +// understand the issues with loading multiple versions of jQuery +// in a page that all might call define(). The loader will indicate +// they have special allowances for multiple jQuery versions by +// specifying define.amd.jQuery = true. Register as a named module, +// since jQuery can be concatenated with other files that may use define, +// but not use a proper concatenation script that understands anonymous +// AMD modules. A named AMD is safest and most robust way to register. +// Lowercase jquery is used because AMD module names are derived from +// file names, and jQuery is normally delivered in a lowercase file name. +// Do this after creating the global so that if an AMD module wants to call +// noConflict to hide this version of jQuery, it will work. +if ( typeof define === "function" && define.amd && define.amd.jQuery ) { + define( "jquery", [], function () { return jQuery; } ); +} + +})( window );
\ No newline at end of file diff --git a/afb-client/bower_components/tether/docs/welcome/js/log.js b/afb-client/bower_components/tether/docs/welcome/js/log.js new file mode 100644 index 0000000..6acd4fd --- /dev/null +++ b/afb-client/bower_components/tether/docs/welcome/js/log.js @@ -0,0 +1,134 @@ +(function() { + var ffSupport, formats, getOrderedMatches, hasMatches, isFF, isIE, isOpera, isSafari, log, makeArray, operaSupport, safariSupport, stringToArgs, _log; + if (!(window.console && window.console.log)) { + return; + } + log = function() { + var args; + args = []; + makeArray(arguments).forEach(function(arg) { + if (typeof arg === 'string') { + return args = args.concat(stringToArgs(arg)); + } else { + return args.push(arg); + } + }); + return _log.apply(window, args); + }; + _log = function() { + return console.log.apply(console, makeArray(arguments)); + }; + makeArray = function(arrayLikeThing) { + return Array.prototype.slice.call(arrayLikeThing); + }; + formats = [ + { + regex: /\*([^\*]+)\*/, + replacer: function(m, p1) { + return "%c" + p1 + "%c"; + }, + styles: function() { + return ['font-style: italic', '']; + } + }, { + regex: /\_([^\_]+)\_/, + replacer: function(m, p1) { + return "%c" + p1 + "%c"; + }, + styles: function() { + return ['font-weight: bold', '']; + } + }, { + regex: /\`([^\`]+)\`/, + replacer: function(m, p1) { + return "%c" + p1 + "%c"; + }, + styles: function() { + return ['background: rgb(255, 255, 219); padding: 1px 5px; border: 1px solid rgba(0, 0, 0, 0.1)', '']; + } + }, { + regex: /\[c\=(?:\"|\')?((?:(?!(?:\"|\')\]).)*)(?:\"|\')?\]((?:(?!\[c\]).)*)\[c\]/, + replacer: function(m, p1, p2) { + return "%c" + p2 + "%c"; + }, + styles: function(match) { + return [match[1], '']; + } + } + ]; + hasMatches = function(str) { + var _hasMatches; + _hasMatches = false; + formats.forEach(function(format) { + if (format.regex.test(str)) { + return _hasMatches = true; + } + }); + return _hasMatches; + }; + getOrderedMatches = function(str) { + var matches; + matches = []; + formats.forEach(function(format) { + var match; + match = str.match(format.regex); + if (match) { + return matches.push({ + format: format, + match: match + }); + } + }); + return matches.sort(function(a, b) { + return a.match.index - b.match.index; + }); + }; + stringToArgs = function(str) { + var firstMatch, matches, styles; + styles = []; + while (hasMatches(str)) { + matches = getOrderedMatches(str); + firstMatch = matches[0]; + str = str.replace(firstMatch.format.regex, firstMatch.format.replacer); + styles = styles.concat(firstMatch.format.styles(firstMatch.match)); + } + return [str].concat(styles); + }; + isSafari = function() { + return /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor); + }; + isOpera = function() { + return /OPR/.test(navigator.userAgent) && /Opera/.test(navigator.vendor); + }; + isFF = function() { + return /Firefox/.test(navigator.userAgent); + }; + isIE = function() { + return /MSIE/.test(navigator.userAgent); + }; + safariSupport = function() { + var m; + m = navigator.userAgent.match(/AppleWebKit\/(\d+)\.(\d+)(\.|\+|\s)/); + if (!m) { + return false; + } + return 537.38 <= parseInt(m[1], 10) + (parseInt(m[2], 10) / 100); + }; + operaSupport = function() { + var m; + m = navigator.userAgent.match(/OPR\/(\d+)\./); + if (!m) { + return false; + } + return 15 <= parseInt(m[1], 10); + }; + ffSupport = function() { + return window.console.firebug || window.console.exception; + }; + if (isIE() || (isFF() && !ffSupport()) || (isOpera() && !operaSupport()) || (isSafari() && !safariSupport())) { + window.log = _log; + } else { + window.log = log; + } + window.log.l = _log; +}).call(this);
\ No newline at end of file diff --git a/afb-client/bower_components/tether/docs/welcome/js/tether-v0.1.3.js b/afb-client/bower_components/tether/docs/welcome/js/tether-v0.1.3.js new file mode 100644 index 0000000..98af16f --- /dev/null +++ b/afb-client/bower_components/tether/docs/welcome/js/tether-v0.1.3.js @@ -0,0 +1,2 @@ +/*! tether.js 0.1.3 */ +(function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r=[].slice,s=function(a,b){return function(){return a.apply(b,arguments)}};a=jQuery,l=/msie [\w.]+/.test(navigator.userAgent.toLowerCase()),k=function(b){var c,d;return c=b.css("position"),"fixed"===c?b:(d=void 0,d="absolute"===c||l&&("static"===c||"relative"===c)?b.parents().filter(function(){var b;return("relative"===(b=a.css(this,"position"))||"absolute"===b||"fixed"===b)&&/(auto|scroll)/.test(a.css(this,"overflow")+a.css(this,"overflow-y")+a.css(this,"overflow-x"))}).first():b.parents().filter(function(){return/(auto|scroll)/.test(a.css(this,"overflow")+a.css(this,"overflow-y")+a.css(this,"overflow-x"))}).first(),d.length?d:a("html"))},b=16,j=function(a,c){var d;return null==c&&(c=b),d=!1,function(){var b,e=this;if(!d)return b=arguments,d=!0,setTimeout(function(){return d=!1,a.apply(e,b)},c),!0}},q=[],p=function(){var a,b,c;for(b=0,c=q.length;c>b;b++)a=q[b],a.position();return!0},l&&(p=j(p)),a(window).on("resize scroll",p),c={center:"center",left:"right",right:"left"},d={middle:"middle",top:"bottom",bottom:"top"},e={top:"0",left:"0",middle:"50%",center:"50%",bottom:"100%",right:"100%"},i=function(a,b){var e,f;return e=a.left,f=a.top,"auto"===e&&(e=c[b.left]),"auto"===f&&(f=d[b.top]),{left:e,top:f}},h=function(a){var b,c;return{left:null!=(b=e[a.left])?b:a.left,top:null!=(c=e[a.top])?c:a.top}},g=function(){var a,b,c,d,e,f,g;for(b=1<=arguments.length?r.call(arguments,0):[],c={top:0,left:0},e=0,f=b.length;f>e;e++)g=b[e],d=g.top,a=g.left,"string"==typeof d&&(d=parseFloat(d,10)),"string"==typeof a&&(a=parseFloat(a,10)),c.top+=d,c.left+=a;return c},m=function(b,c){return"string"==typeof b.left&&-1!==b.left.indexOf("%")&&(b.left=parseFloat(b.left,10)/100*a(c).outerWidth()),"string"==typeof b.top&&-1!==b.top.indexOf("%")&&(b.top=parseFloat(b.top,10)/100*a(c).outerHeight()),b},n=o=function(a){var b,c,d;return d=a.split(" "),c=d[0],b=d[1],{top:c,left:b}},f=function(){function b(a){this.position=s(this.position,this);var c,d,e,f,g;for(q.push(this),this.history=[],this.setOptions(a,!1),f=b.modules,d=0,e=f.length;e>d;d++)c=f[d],null!=(g=c.initialize)&&g.call(this);this.position()}return b.modules=[],b.prototype.setOptions=function(b,c){var d,e;return this.options=b,null==c&&(c=!0),d={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto"},this.options=a.extend(d,this.options),e=this.options,this.element=e.element,this.target=e.target,this.element.jquery&&(this.$element=this.element,this.element=this.element[0]),this.target.jquery&&(this.$target=this.target,this.target=this.target[0]),null==this.$element&&(this.$element=a(this.element)),null==this.$target&&(this.$target=a(this.target)),this.$element.addClass("tether-element"),this.$target.addClass("tether-target"),this.targetAttachment=n(this.options.targetAttachment),this.attachment=n(this.options.attachment),this.offset=o(this.options.offset),this.targetOffset=o(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent=k(a(this.target)),this.options.enabled!==!1?this.enable(c):void 0},b.prototype.enable=function(a){return null==a&&(a=!0),this.addClass("tether-enabled"),this.enabled=!0,this.scrollParent.on("scroll",this.position),a?this.position():void 0},b.prototype.disable=function(){return this.removeClass("tether-enabled"),this.enabled=!1,null!=this.scrollParent?this.scrollParent.off("scroll",this.position):void 0},b.prototype.destroy=function(){var a,b,c,d,e;for(this.disable(),e=[],a=c=0,d=q.length;d>c;a=++c){if(b=q[a],b===this){q.splice(a,1);break}e.push(void 0)}return e},b.prototype.updateAttachClasses=function(a,b){var c,d,e,f,g,h;for(null==a&&(a=this.attachment),null==b&&(b=this.targetAttachment),d=["left","top","bottom","right","middle","center"],e=0,g=d.length;g>e;e++)c=d[e],this.removeClass("tether-element-attached-"+c);for(a.top&&this.addClass("tether-element-attached-"+a.top),a.left&&this.addClass("tether-element-attached-"+a.left),f=0,h=d.length;h>f;f++)c=d[f],this.removeClass("tether-target-attached-"+c);return b.top&&this.addClass("tether-target-attached-"+b.top),b.left?this.addClass("tether-target-attached-"+b.left):void 0},b.prototype.addClass=function(a){return this.$element.addClass(a),this.$target.addClass(a)},b.prototype.removeClass=function(a){return this.$element.removeClass(a),this.$target.removeClass(a)},b.prototype.position=function(){var a,c,d,e,f,j,k,l,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F;if(this.enabled){for(u=i(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,u),n=m(h(this.attachment),this.element),v=m(h(u),this.target),f=m(this.offset,this.element),j=m(this.targetOffset,this.target),n=g(n,f),v=g(v,j),w=this.$target.offset(),c=this.$element.offset(),e=w.left+v.left-n.left,x=w.top+v.top-n.top,D=b.modules,z=0,B=D.length;B>z;z++)if(k=D[z],q=k.position.call(this,{left:e,top:x,targetAttachment:u,targetPos:w,elementPos:c,offset:n,targetOffset:v,manualOffset:f,manualTargetOffset:j}),null!=q&&"object"==typeof q){if(q===!1)return!1;x=q.top,e=q.left}if(y=this.$element.outerWidth(),d=this.$element.outerHeight(),l={page:{top:x,bottom:document.body.scrollHeight-x-d,left:e,right:document.body.scrollWidth-e-y},viewport:{top:x-pageYOffset,bottom:pageYOffset-x-d+innerHeight,left:e-pageXOffset,right:pageXOffset-e-y+innerWidth}},(null!=(E=this.options.optimizations)?E.moveElement:void 0)!==!1){for(a=this.$target.offsetParent(),p=a.offset(),o={},F=["top","left","bottom","right"],A=0,C=F.length;C>A;A++)t=F[A],o[t]=parseFloat(a.css("border-"+t+"-width"));p.left+=o.left,p.top+=o.top,p.right=document.body.scrollWidth-p.left-a.width(),p.bottom=document.body.scrollHeight-p.top-a.height(),l.page.top>=p.top&&l.page.bottom>=p.bottom&&l.page.left>=p.left&&l.page.right>=p.right&&(s=a.scrollTop(),r=a.scrollLeft(),l.offset={top:l.page.top-p.top+s+o.top,left:l.page.left-p.left+r+o.left,right:l.page.right-p.right-r+o.right,bottom:l.page.bottom-p.bottom-s+o.bottom})}return this.move(l),this.history.unshift(l),this.history.length>3&&this.history.pop(),!0}},b.prototype.move=function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v;j={};for(m in b){j[m]={};for(f in b[m]){for(e=!1,t=this.history,p=0,r=t.length;r>p;p++)if(i=t[p],(null!=(u=i[m])?u[f]:void 0)!==b[m][f]){e=!0;break}e||(j[m][f]=!0)}}if(d={top:"",left:"",right:"",bottom:""},l=function(a,b){return a.top?d.top=""+b.top+"px":d.bottom=""+b.bottom+"px",a.left?d.left=""+b.left+"px":d.right=""+b.right+"px"},g=!1,(j.page.top||j.page.bottom)&&(j.page.left||j.page.right))d.position="absolute",l(j.page,b.page);else if((j.viewport.top||j.viewport.bottom)&&(j.viewport.left||j.viewport.right))d.position="fixed",l(j.viewport,b.viewport);else if(null!=j.offset&&(j.offset.top||j.offset.bottom)&&(j.offset.left||j.offset.right)){for(d.position="absolute",c=this.$target.offsetParent(),this.$element.offsetParent()[0]!==c[0]&&(this.$element.detach(),c.append(this.$element)),h=a.extend({},b.offset),v=["top","left","bottom","right"],q=0,s=v.length;s>q;q++)k=v[q],h[k]-=parseFloat(c.css("border-"+k+"-width"),10);l(j.offset,h),g=!0}else d.position="absolute",d.top=""+b.page.top+"px",d.left=""+b.page.left+"px";g||this.$element.parent().is("body")||(this.$element.detach(),a(document.body).append(this.$element)),o=!1;for(f in d)if(n=d[f],this.$element.css(f)!==n){o=!0;break}return o?this.$element.css(d):void 0},b}(),window.Tether=f}).call(this),function(){var a,b,c,d,e=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};a=jQuery,c={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},b=["left","top","right","bottom"],d=function(c,d){var e,f,g,h,i,j;if("scrollParent"===d?d=c.scrollParent[0]:"window"===d&&(d=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),null!=d.nodeType)for(e=a(d),g=e.offset(),d=[g.left,g.top,e.width()+g.left,e.height()+g.top],f=i=0,j=b.length;j>i;f=++i)h=b[f],d[f]+=parseFloat(e.css("border-"+h+"-width"),10);return d},Tether.modules.push({position:function(c){var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T=this;if(C=c.top,n=c.left,y=c.targetAttachment,this.options.constraints){for(u=function(a){var c,d,e,f;for(T.removeClass(a),f=[],d=0,e=b.length;e>d;d++)c=b[d],f.push(T.removeClass(""+a+"-"+c));return f},m=this.$element.outerHeight(),D=this.$element.outerWidth(),z=this.$target.outerHeight(),A=this.$target.outerWidth(),x={},l={},v=["tether-pinned","tether-out-of-bounds"],O=this.options.constraints,E=0,I=O.length;I>E;E++)k=O[E],k.outOfBoundsClass&&v.push(k.outOfBoundsClass),k.pinnedClass&&v.push(k.pinnedClass);for(F=0,J=v.length;J>F;F++)j=v[F],u(j);for(x=a.extend({},y),l=a.extend({},this.attachment),P=this.options.constraints,G=0,K=P.length;K>G;G++){if(k=P[G],B=k.to,f=k.attachment,r=k.pin,null==f&&(f=""),e.call(f," ")>=0?(Q=f.split(" "),i=Q[0],h=Q[1]):h=i=f,g=d(this,B),("target"===i||"both"===i)&&(C<g[1]&&"top"===x.top&&(C+=z,x.top="bottom"),C+m>g[3]&&"bottom"===x.top&&(C-=z,x.top="top")),"together"===i&&(C<g[1]&&"top"===x.top&&("bottom"===l.top?(C+=z,x.top="bottom",C+=m,l.top="top"):"top"===l.top&&(C+=z,x.top="bottom",C-=m,l.top="bottom")),C+m>g[3]&&"bottom"===x.top&&("top"===l.top?(C-=z,x.top="top",C-=m,l.top="bottom"):"bottom"===l.top&&(C-=z,x.top="top",C+=m,l.top="top"))),("target"===h||"both"===h)&&(n<g[0]&&"left"===x.left&&(n+=A,x.left="right"),n+D>g[2]&&"right"===x.left&&(n-=A,x.left="left")),"together"===h&&(n<g[0]&&"left"===x.left?"right"===l.left?(n+=A,x.left="right",n+=D,l.left="left"):"left"===l.left&&(n+=A,x.left="right",n-=D,l.left="right"):n+D>g[2]&&"right"===x.left&&("left"===l.left?(n-=A,x.left="left",n-=D,l.left="right"):"right"===l.left&&(n-=A,x.left="left",n+=D,l.left="left"))),("element"===i||"both"===i)&&(C<g[1]&&"bottom"===l.top&&(C+=m,l.top="top"),C+m>g[3]&&"top"===l.top&&(C-=m,l.top="bottom")),("element"===h||"both"===h)&&(n<g[0]&&"right"===l.left&&(n+=D,l.left="left"),n+D>g[2]&&"left"===l.left&&(n-=D,l.left="right")),"string"==typeof r?r=function(){var a,b,c,d;for(c=r.split(","),d=[],a=0,b=c.length;b>a;a++)q=c[a],d.push(q.trim());return d}():r===!0&&(r=["top","left","right","bottom"]),r||(r=[]),s=[],o=[],C<g[1]&&(e.call(r,"top")>=0?(C=g[1],s.push("top")):o.push("top")),C+m>g[3]&&(e.call(r,"bottom")>=0?(C=g[3]-m,s.push("bottom")):o.push("bottom")),n<g[0]&&(e.call(r,"left")>=0?(n=g[0],s.push("left")):o.push("left")),n+D>g[2]&&(e.call(r,"right")>=0?(n=g[2]-D,s.push("right")):o.push("right")),s.length)for(t=null!=(R=this.options.pinnedClass)?R:"tether-pinned",this.addClass(t),H=0,L=s.length;L>H;H++)w=s[H],this.addClass(""+t+"-"+w);if(o.length)for(p=null!=(S=this.options.outOfBoundsClass)?S:"tether-out-of-bounds",this.addClass(p),N=0,M=o.length;M>N;N++)w=o[N],this.addClass(""+p+"-"+w);(e.call(s,"left")>=0||e.call(s,"right")>=0)&&(l.left=x.left=!1),(e.call(s,"top")>=0||e.call(s,"bottom")>=0)&&(l.top=x.top=!1),(x.top!==y.top||x.left!==y.left||l.top!==this.attachment.top||l.left!==this.attachment.left)&&this.updateAttachClasses(l,x)}return{top:C,left:n}}}})}.call(this),function(){var a;a=jQuery,Tether.modules.push({position:function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;if(l=a.top,e=a.left,d=this.$element.outerHeight(),m=this.$element.outerWidth(),i=this.$target.outerHeight(),k=this.$target.outerWidth(),j=this.$target.offset(),j.bottom=j.top+i,j.right=j.left+k,c=l+d,f=e+m,b=[],l<=j.bottom&&c>=j.top)for(v=["left","right"],n=0,r=v.length;r>n;n++)g=v[n],((w=j[g])===e||w===f)&&b.push(g);if(e<=j.right&&f>=j.left)for(x=["top","bottom"],o=0,s=x.length;s>o;o++)g=x[o],((y=j[g])===l||y===c)&&b.push(g);for(h=["left","top","right","bottom"],this.removeClass("tether-abutted"),p=0,t=h.length;t>p;p++)g=h[p],this.removeClass("tether-abutted-"+g);for(b.length&&this.addClass("tether-abutted"),q=0,u=b.length;u>q;q++)g=b[q],this.addClass("tether-abutted-"+g);return!0}})}.call(this),function(){Tether.modules.push({position:function(a){var b,c,d,e,f,g,h;return g=a.top,b=a.left,this.options.shift?(c=function(a){return"function"==typeof a?a.call(this,{top:g,left:b}):a},d=c(this.options.shift),"string"==typeof d?(d=d.split(" "),d[1]||(d[1]=d[0]),f=d[0],e=d[1],f=parseFloat(f,10),e=parseFloat(e,10)):(h=[d.top,d.left],f=h[0],e=h[1]),g+=f,b+=e,{top:g,left:b}):void 0}})}.call(this);
\ No newline at end of file diff --git a/afb-client/bower_components/tether/docs/welcome/js/welcome.js b/afb-client/bower_components/tether/docs/welcome/js/welcome.js new file mode 100644 index 0000000..6f587e6 --- /dev/null +++ b/afb-client/bower_components/tether/docs/welcome/js/welcome.js @@ -0,0 +1,193 @@ +(function() { + var init, isMobile, setupBrowserDemo, setupHero, _Drop; + + _Drop = Drop.createContext({ + classPrefix: 'tether' + }); + + isMobile = $(window).width() < 567; + + init = function() { + setupHero(); + return setupBrowserDemo(); + }; + + setupHero = function() { + var $target, finalDropState, frameLengthMS, frames, openAllDrops, openIndex, openNextDrop, position, positions, _i, _len; + $target = $('.tether-target-demo'); + positions = ['top left', 'left top', 'left middle', 'left bottom', 'bottom left', 'bottom center', 'bottom right', 'right bottom', 'right middle', 'right top', 'top right', 'top center']; + if (isMobile) { + positions = ['top left', 'bottom left', 'bottom right', 'top right']; + } + window.drops = {}; + for (_i = 0, _len = positions.length; _i < _len; _i++) { + position = positions[_i]; + drops[position] = new _Drop({ + target: $target[0], + classes: 'tether-theme-arrows-dark', + position: position, + constrainToWindow: false, + openOn: '', + content: '<div style="height: 50px; width: 50px"></div>' + }); + } + openIndex = 0; + frames = 0; + frameLengthMS = 10; + openAllDrops = function() { + var drop, _results; + _results = []; + for (position in drops) { + drop = drops[position]; + _results.push(drop.open()); + } + return _results; + }; + openNextDrop = function() { + var drop; + for (position in drops) { + drop = drops[position]; + drop.close(); + } + drops[positions[openIndex]].open(); + drops[positions[(openIndex + 6) % positions.length]].open(); + openIndex = (openIndex + 1) % positions.length; + if (frames > 5) { + finalDropState(); + return; + } + frames += 1; + return setTimeout(openNextDrop, frameLengthMS * frames); + }; + finalDropState = function() { + $(drops['top left'].dropContent).html('Marrying DOM elements for life.'); + $(drops['bottom right'].dropContent).html('<a class="button" href="http://github.com/HubSpot/tether">★ On Github</a>'); + drops['top left'].open(); + return drops['bottom right'].open(); + }; + if (true || isMobile) { + drops['top left'].open(); + drops['top left'].tether.position(); + drops['bottom right'].open(); + drops['bottom right'].tether.position(); + return finalDropState(); + } else { + return openNextDrop(); + } + }; + + setupBrowserDemo = function() { + var $browserContents, $browserDemo, $iframe, $sections, $startPoint, $stopPoint, scrollInterval, scrollTop, scrollTopDirection, setSection; + $browserDemo = $('.browser-demo.showcase'); + $startPoint = $('.browser-demo-start-point'); + $stopPoint = $('.browser-demo-stop-point'); + $iframe = $('.browser-window iframe'); + $browserContents = $('.browser-content .browser-demo-inner'); + $sections = $('.browser-demo-section'); + $('body').append("<style>\n table.showcase.browser-demo.fixed-bottom {\n top: " + $sections.length + "00%\n }\n</style>"); + $(window).scroll(function() { + var scrollTop; + scrollTop = $(window).scrollTop(); + if ($startPoint.position().top < scrollTop && scrollTop + window.innerHeight < $stopPoint.position().top) { + $browserDemo.removeClass('fixed-bottom'); + $browserDemo.addClass('fixed'); + return $sections.each(function() { + var $section; + $section = $(this); + if (($section.position().top < scrollTop && scrollTop < $section.position().top + $section.outerHeight())) { + setSection($section.data('section')); + } + return true; + }); + } else { + $browserDemo.removeAttr('data-section'); + $browserDemo.removeClass('fixed'); + if (scrollTop + window.innerHeight > $stopPoint.position().top) { + return $browserDemo.addClass('fixed-bottom'); + } else { + return $browserDemo.removeClass('fixed-bottom'); + } + } + }); + $iframe.load(function() { + var $items, iframeWindow; + iframeWindow = $iframe[0].contentWindow; + $items = $iframe.contents().find('.item'); + return $items.each(function(i) { + var $item, drop, _iframeWindowDrop; + $item = $(this); + _iframeWindowDrop = iframeWindow.Drop.createContext({ + classPrefix: 'tether' + }); + drop = new _iframeWindowDrop({ + target: $item[0], + classes: 'tether-theme-arrows-dark', + position: 'right top', + constrainToWindow: true, + openOn: 'click', + content: '<ul>\n <li>Action 1</li>\n <li>Action 2</li>\n <li>Action 3</li>\n</ul>' + }); + return $item.data('drop', drop); + }); + }); + scrollInterval = void 0; + scrollTop = 0; + scrollTopDirection = 1; + return setSection = function(section) { + var closeAllItems, openExampleItem, scrollLeftSection, stopScrollingLeftSection; + $browserDemo.attr('data-section', section); + $('.section-copy').removeClass('active'); + $(".section-copy[data-section=\"" + section + "\"]").addClass('active'); + openExampleItem = function() { + if (isMobile) { + return $iframe.contents().find('.item:first').data().drop.open(); + } else { + return $iframe.contents().find('.item:eq(2)').data().drop.open(); + } + }; + closeAllItems = function() { + return $iframe.contents().find('.item').each(function() { + return $(this).data().drop.close() || true; + }); + }; + scrollLeftSection = function() { + return scrollInterval = setInterval(function() { + $iframe.contents().find('.left').scrollTop(scrollTop); + scrollTop += scrollTopDirection; + if (scrollTop > 50) { + scrollTopDirection = -1; + } + if (scrollTop < 0) { + return scrollTopDirection = 1; + } + }, 30); + }; + stopScrollingLeftSection = function() { + return clearInterval(scrollInterval); + }; + switch (section) { + case 'what': + closeAllItems(); + openExampleItem(); + return stopScrollingLeftSection(); + case 'how': + closeAllItems(); + openExampleItem(); + stopScrollingLeftSection(); + return scrollLeftSection(); + case 'why': + closeAllItems(); + openExampleItem(); + stopScrollingLeftSection(); + return scrollLeftSection(); + case 'outro': + closeAllItems(); + openExampleItem(); + return stopScrollingLeftSection(); + } + }; + }; + + init(); + +}).call(this); diff --git a/afb-client/bower_components/tether/docs/welcome/sass/browser-demo.sass b/afb-client/bower_components/tether/docs/welcome/sass/browser-demo.sass new file mode 100644 index 0000000..e0347f5 --- /dev/null +++ b/afb-client/bower_components/tether/docs/welcome/sass/browser-demo.sass @@ -0,0 +1,93 @@ +@import compass/css3 + +html, body + height: 100% + overflow: hidden + font-family: "proxima-nova", sans-serif + +.tether.tether-theme-arrows-dark .tether-content + +filter(none) + background: #000 + + ul + color: #fff + list-style: none + padding: 0 + margin: 0 + +.tether.tether-theme-arrows-dark.tether-element-attached-top.tether-element-attached-left.tether-target-attached-right .tether-content:before + border-right-color: #000 + +.browser-demo + position: absolute + top: 0 + left: 0 + bottom: 0 + right: 0 + + *, *:after, *:before + +box-sizing(border-box) + + .top + position: absolute + height: 60px + padding: 20px + line-height: 40px + width: 100% + border-bottom: 1px solid rgba(0, 0, 0, .1) + + .bottom + position: absolute + top: 60px + bottom: 0 + width: 100% + + .left + border-right: 1px solid rgba(0, 0, 0, .1) + position: absolute + width: 30% + height: 100% + overflow: auto + + .item + height: 64px + border-bottom: 1px solid rgba(0, 0, 0, .1) + cursor: pointer + + &:hover, &.tether-open + background: rgba(0, 0, 0, .1) + border-bottom: 1px solid rgba(0, 0, 0, 0) + + &:last-child + border-bottom: 0 + + .right + position: absolute + width: 70% + right: 0 + height: 100% + padding: 20px + + .title + +inline-block + background: rgba(0, 0, 0, .1) + width: 150px + height: 15px + margin-bottom: 20px + + .word + +inline-block + background: rgba(0, 0, 0, .1) + width: 50px + height: 8px + margin-right: 5px + margin-bottom: 5px + + &:nth-last-child(4n+1) + width: 73px + + &:nth-last-child(10n+1) + width: 14px + + &:nth-last-child(9n+1) + width: 80px
\ No newline at end of file diff --git a/afb-client/bower_components/tether/docs/welcome/sass/welcome.sass b/afb-client/bower_components/tether/docs/welcome/sass/welcome.sass new file mode 100644 index 0000000..7a75238 --- /dev/null +++ b/afb-client/bower_components/tether/docs/welcome/sass/welcome.sass @@ -0,0 +1,282 @@ +@import compass/css3 + +html, body + height: 100% + +body + margin: 0 + font-family: "proxima-nova", "Helvetica Neue", sans-serif + +.button + display: inline-block + border: 2px solid #333 + color: #333 + padding: 1em 1.25em + font-weight: 500 + text-transform: uppercase + letter-spacing: 3px + text-decoration: none + cursor: pointer + width: 140px + font-size: .8em + line-height: 1.3em + text-align: center + +.tether-element.tether-theme-arrows-dark .tether-content + padding: 1em + font-size: 1.1em + + .button + border-color: #fff + color: #fff + width: 170px + pointer-events: all + +.mobile-copy + display: none + + @media (max-width: 568px) + display: block + +.button.dark + background: #333 + color: #fff + +.hero-wrap + height: 100% + overflow: hidden + +table.showcase + height: 100% + width: 100% + position: relative + + &:after + content: "" + display: block + position: absolute + left: 0 + right: 0 + bottom: 20px + margin: auto + height: 0 + width: 0 + border-width: 18px + border-style: solid + border-color: transparent + border-top-color: rgba(0, 0, 0, 0.2) + + &.no-next-arrow:after + display: none + + .showcase-inner + margin: 40px auto 60px + padding: 10px + + h1 + font-size: 50px + text-align: center + font-weight: 300 + + @media (max-width: 567px) + font-size: 40px + + h2 + font-size: 24px + text-align: center + font-weight: 300 + margin: 1em 0 1em + + @media (max-width: 567px) + font-size: 14px + + p + text-align: center + + &.hero + text-align: center + + .tether-target-demo + +inline-block + border: 2px dotted #000 + margin: 5rem auto + padding: 5rem + + @media (max-width: 567px) + padding: 1rem + + &.share + background: #f3f3f3 + + &.projects-showcase .showcase-inner + + .projects-list + width: 80% + max-width: 1200px + margin: 0 auto + + .project + color: inherit + text-decoration: none + position: relative + width: 50% + float: left + text-align: center + margin-bottom: 2rem + + .os-icon + width: 8rem + height: 8rem + margin-bottom: 1rem + background-size: 100% + + h1 + font-size: 2.5rem + + p + font-size: 1.3rem + + &.browser-demo + +background-image(linear-gradient(top left, #723362 0%, #9d223c 100%)) + background-color: #9d223c + position: absolute + top: 100% + + &.fixed + position: fixed + top: 0 + bottom: 0 + left: 0 + right: 0 + z-index: 1 + + .browser-demo-inner + +transition(width 2s ease-in-out, height 2s ease-in-out) + + // Sections + + &[data-section="what"] + box-shadow: 0 0 0 0 + + &[data-section="why"] + + .browser-demo-inner + width: 70% + + &[data-section="outro"] + + .showcase-inner + pointer-events: all + + .showcase-inner + pointer-events: none + position: absolute + left: 10% + right: 40% + top: 220px + bottom: 120px + margin: 0 + padding: 0 + + @media (max-width: 567px) + bottom: 90px + top: 180px + + .browser-demo-inner + height: 100% + width: 100% + + .section-copy + +transition(opacity .5s ease-in-out, top .5s ease-in-out) + +opacity(0) + position: absolute + top: 0 + position: absolute + height: 200px + color: #fff + text-align: center + width: 100% + + &.active + +opacity(1) + top: -150px + + @media (max-width: 567px) + top: -130px + + h2 + font-size: 40px + font-weight: bold + line-height: 1 + margin: 25px 0 15px + + @media (max-width: 567px) + font-size: 30px + + .browser-window + +border-radius(4px) + background: #fff + position: relative + height: 100% + width: 100% + max-width: 1200px + margin: 0 auto + + .browser-titlebar + position: absolute + top: 0 + left: 0 + right: 0 + border-bottom: 1px solid #eee + height: 55px + + .browser-dots + padding: 16px + + b + +border-radius(50%) + +inline-block + width: 10px + height: 10px + margin-right: 7px + background: rgba(0, 0, 0, .1) + + .browser-frame + position: absolute + top: 55px + left: 0 + right: 0 + bottom: 0 + + iframe + +border-radius(0 0 4px 4px) + border: 0 + width: 100% + height: 100% + + &.browser-demo-section + + .section-scroll-copy + position: relative + z-index: 10 + color: #fff + width: 100% + font-size: 22px + + .section-scroll-copy-inner + position: absolute + z-index: 10 + color: #fff + right: 10% + width: 23% + + a + color: inherit + + .example-paragraph + +border-radius(4px) + background: #000 + padding: 1rem + +.browser-content + display: none diff --git a/afb-client/bower_components/tether/examples/chosen/chosen-sprite.png b/afb-client/bower_components/tether/examples/chosen/chosen-sprite.png Binary files differnew file mode 100644 index 0000000..3611ae4 --- /dev/null +++ b/afb-client/bower_components/tether/examples/chosen/chosen-sprite.png diff --git a/afb-client/bower_components/tether/examples/chosen/chosen.css b/afb-client/bower_components/tether/examples/chosen/chosen.css new file mode 100644 index 0000000..828fe1f --- /dev/null +++ b/afb-client/bower_components/tether/examples/chosen/chosen.css @@ -0,0 +1,430 @@ +/* @group Base */ +.chosen-container { + position: relative; + display: inline-block; + vertical-align: middle; + font-size: 13px; + zoom: 1; + *display: inline; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; +} +.chosen-container .chosen-drop { + position: absolute; + top: 100%; + left: -9999px; + z-index: 1010; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 100%; + border: 1px solid #aaa; + border-top: 0; + background: #fff; + box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15); +} +.chosen-container.chosen-with-drop .chosen-drop { + left: 0; +} +.chosen-container a { + cursor: pointer; +} + +/* @end */ +/* @group Single Chosen */ +.chosen-container-single .chosen-single { + position: relative; + display: block; + overflow: hidden; + padding: 0 0 0 8px; + height: 23px; + border: 1px solid #aaa; + border-radius: 5px; + background-color: #fff; + background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4)); + background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%); + background-clip: padding-box; + box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1); + color: #444; + text-decoration: none; + white-space: nowrap; + line-height: 24px; +} +.chosen-container-single .chosen-default { + color: #999; +} +.chosen-container-single .chosen-single span { + display: block; + overflow: hidden; + margin-right: 26px; + text-overflow: ellipsis; + white-space: nowrap; +} +.chosen-container-single .chosen-single-with-deselect span { + margin-right: 38px; +} +.chosen-container-single .chosen-single abbr { + position: absolute; + top: 6px; + right: 26px; + display: block; + width: 12px; + height: 12px; + background: url('chosen-sprite.png') -42px 1px no-repeat; + font-size: 1px; +} +.chosen-container-single .chosen-single abbr:hover { + background-position: -42px -10px; +} +.chosen-container-single.chosen-disabled .chosen-single abbr:hover { + background-position: -42px -10px; +} +.chosen-container-single .chosen-single div { + position: absolute; + top: 0; + right: 0; + display: block; + width: 18px; + height: 100%; +} +.chosen-container-single .chosen-single div b { + display: block; + width: 100%; + height: 100%; + background: url('chosen-sprite.png') no-repeat 0px 2px; +} +.chosen-container-single .chosen-search { + position: relative; + z-index: 1010; + margin: 0; + padding: 3px 4px; + white-space: nowrap; +} +.chosen-container-single .chosen-search input[type="text"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + margin: 1px 0; + padding: 4px 20px 4px 5px; + width: 100%; + height: auto; + outline: 0; + border: 1px solid #aaa; + background: white url('chosen-sprite.png') no-repeat 100% -20px; + background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); + background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat 100% -20px, -moz-linear-gradient(#eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat 100% -20px, -o-linear-gradient(#eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat 100% -20px, linear-gradient(#eeeeee 1%, #ffffff 15%); + font-size: 1em; + font-family: sans-serif; + line-height: normal; + border-radius: 0; +} +.chosen-container-single .chosen-drop { + margin-top: -1px; + border-radius: 0 0 4px 4px; + background-clip: padding-box; +} +.chosen-container-single.chosen-container-single-nosearch .chosen-search { + position: absolute; + left: -9999px; +} + +/* @end */ +/* @group Results */ +.chosen-container .chosen-results { + position: relative; + overflow-x: hidden; + overflow-y: auto; + margin: 0 4px 4px 0; + padding: 0 0 0 4px; + max-height: 240px; + -webkit-overflow-scrolling: touch; +} +.chosen-container .chosen-results li { + display: none; + margin: 0; + padding: 5px 6px; + list-style: none; + line-height: 15px; +} +.chosen-container .chosen-results li.active-result { + display: list-item; + cursor: pointer; +} +.chosen-container .chosen-results li.disabled-result { + display: list-item; + color: #ccc; + cursor: default; +} +.chosen-container .chosen-results li.highlighted { + background-color: #3875d7; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc)); + background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%); + background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%); + background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%); + background-image: linear-gradient(#3875d7 20%, #2a62bc 90%); + color: #fff; +} +.chosen-container .chosen-results li.no-results { + display: list-item; + background: #f4f4f4; +} +.chosen-container .chosen-results li.group-result { + display: list-item; + font-weight: bold; + cursor: default; +} +.chosen-container .chosen-results li.group-option { + padding-left: 15px; +} +.chosen-container .chosen-results li em { + font-style: normal; + text-decoration: underline; +} + +/* @end */ +/* @group Multi Chosen */ +.chosen-container-multi .chosen-choices { + position: relative; + overflow: hidden; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + margin: 0; + padding: 0; + width: 100%; + height: auto !important; + height: 1%; + border: 1px solid #aaa; + background-color: #fff; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); + background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%); + background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%); + background-image: -o-linear-gradient(#eeeeee 1%, #ffffff 15%); + background-image: linear-gradient(#eeeeee 1%, #ffffff 15%); + cursor: text; +} +.chosen-container-multi .chosen-choices li { + float: left; + list-style: none; +} +.chosen-container-multi .chosen-choices li.search-field { + margin: 0; + padding: 0; + white-space: nowrap; +} +.chosen-container-multi .chosen-choices li.search-field input[type="text"] { + margin: 1px 0; + padding: 5px; + height: 15px; + outline: 0; + border: 0 !important; + background: transparent !important; + box-shadow: none; + color: #666; + font-size: 100%; + font-family: sans-serif; + line-height: normal; + border-radius: 0; +} +.chosen-container-multi .chosen-choices li.search-field .default { + color: #999; +} +.chosen-container-multi .chosen-choices li.search-choice { + position: relative; + margin: 3px 0 3px 5px; + padding: 3px 20px 3px 5px; + border: 1px solid #aaa; + border-radius: 3px; + background-color: #e4e4e4; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee)); + background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-clip: padding-box; + box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05); + color: #333; + line-height: 13px; + cursor: default; +} +.chosen-container-multi .chosen-choices li.search-choice .search-choice-close { + position: absolute; + top: 4px; + right: 3px; + display: block; + width: 12px; + height: 12px; + background: url('chosen-sprite.png') -42px 1px no-repeat; + font-size: 1px; +} +.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover { + background-position: -42px -10px; +} +.chosen-container-multi .chosen-choices li.search-choice-disabled { + padding-right: 5px; + border: 1px solid #ccc; + background-color: #e4e4e4; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee)); + background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%); + color: #666; +} +.chosen-container-multi .chosen-choices li.search-choice-focus { + background: #d4d4d4; +} +.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close { + background-position: -42px -10px; +} +.chosen-container-multi .chosen-results { + margin: 0; + padding: 0; +} +.chosen-container-multi .chosen-drop .result-selected { + display: list-item; + color: #ccc; + cursor: default; +} + +/* @end */ +/* @group Active */ +.chosen-container-active .chosen-single { + border: 1px solid #5897fb; + box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); +} +.chosen-container-active.chosen-with-drop .chosen-single { + border: 1px solid #aaa; + -moz-border-radius-bottomright: 0; + border-bottom-right-radius: 0; + -moz-border-radius-bottomleft: 0; + border-bottom-left-radius: 0; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff)); + background-image: -webkit-linear-gradient(#eeeeee 20%, #ffffff 80%); + background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%); + background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%); + background-image: linear-gradient(#eeeeee 20%, #ffffff 80%); + box-shadow: 0 1px 0 #fff inset; +} +.chosen-container-active.chosen-with-drop .chosen-single div { + border-left: none; + background: transparent; +} +.chosen-container-active.chosen-with-drop .chosen-single div b { + background-position: -18px 2px; +} +.chosen-container-active .chosen-choices { + border: 1px solid #5897fb; + box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); +} +.chosen-container-active .chosen-choices li.search-field input[type="text"] { + color: #111 !important; +} + +/* @end */ +/* @group Disabled Support */ +.chosen-disabled { + opacity: 0.5 !important; + cursor: default; +} +.chosen-disabled .chosen-single { + cursor: default; +} +.chosen-disabled .chosen-choices .search-choice .search-choice-close { + cursor: default; +} + +/* @end */ +/* @group Right to Left */ +.chosen-rtl { + text-align: right; +} +.chosen-rtl .chosen-single { + overflow: visible; + padding: 0 8px 0 0; +} +.chosen-rtl .chosen-single span { + margin-right: 0; + margin-left: 26px; + direction: rtl; +} +.chosen-rtl .chosen-single-with-deselect span { + margin-left: 38px; +} +.chosen-rtl .chosen-single div { + right: auto; + left: 3px; +} +.chosen-rtl .chosen-single abbr { + right: auto; + left: 26px; +} +.chosen-rtl .chosen-choices li { + float: right; +} +.chosen-rtl .chosen-choices li.search-field input[type="text"] { + direction: rtl; +} +.chosen-rtl .chosen-choices li.search-choice { + margin: 3px 5px 3px 0; + padding: 3px 5px 3px 19px; +} +.chosen-rtl .chosen-choices li.search-choice .search-choice-close { + right: auto; + left: 4px; +} +.chosen-rtl.chosen-container-single-nosearch .chosen-search, +.chosen-rtl .chosen-drop { + left: 9999px; +} +.chosen-rtl.chosen-container-single .chosen-results { + margin: 0 0 4px 4px; + padding: 0 4px 0 0; +} +.chosen-rtl .chosen-results li.group-option { + padding-right: 15px; + padding-left: 0; +} +.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div { + border-right: none; +} +.chosen-rtl .chosen-search input[type="text"] { + padding: 4px 5px 4px 20px; + background: white url('chosen-sprite.png') no-repeat -30px -20px; + background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff)); + background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat -30px -20px, -moz-linear-gradient(#eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat -30px -20px, -o-linear-gradient(#eeeeee 1%, #ffffff 15%); + background: url('chosen-sprite.png') no-repeat -30px -20px, linear-gradient(#eeeeee 1%, #ffffff 15%); + direction: rtl; +} +.chosen-rtl.chosen-container-single .chosen-single div b { + background-position: 6px 2px; +} +.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b { + background-position: -12px 2px; +} + +/* @end */ +/* @group Retina compatibility */ +@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) { + .chosen-rtl .chosen-search input[type="text"], + .chosen-container-single .chosen-single abbr, + .chosen-container-single .chosen-single div b, + .chosen-container-single .chosen-search input[type="text"], + .chosen-container-multi .chosen-choices .search-choice .search-choice-close, + .chosen-container .chosen-results-scroll-down span, + .chosen-container .chosen-results-scroll-up span { + background-image: url('chosen-sprite@2x.png') !important; + background-size: 52px 37px !important; + background-repeat: no-repeat !important; + } +} +/* @end */
\ No newline at end of file diff --git a/afb-client/bower_components/tether/examples/chosen/chosen.js b/afb-client/bower_components/tether/examples/chosen/chosen.js new file mode 100644 index 0000000..521556b --- /dev/null +++ b/afb-client/bower_components/tether/examples/chosen/chosen.js @@ -0,0 +1,1166 @@ +// Chosen, a Select Box Enhancer for jQuery and Prototype +// by Patrick Filler for Harvest, http://getharvest.com +// +// Version 1.0.0 +// Full source at https://github.com/harvesthq/chosen +// Copyright (c) 2011 Harvest http://getharvest.com + +// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md +// This file is generated by `grunt build`, do not edit it by hand. +(function() { + var $, AbstractChosen, Chosen, SelectParser, _ref, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + SelectParser = (function() { + function SelectParser() { + this.options_index = 0; + this.parsed = []; + } + + SelectParser.prototype.add_node = function(child) { + if (child.nodeName.toUpperCase() === "OPTGROUP") { + return this.add_group(child); + } else { + return this.add_option(child); + } + }; + + SelectParser.prototype.add_group = function(group) { + var group_position, option, _i, _len, _ref, _results; + + group_position = this.parsed.length; + this.parsed.push({ + array_index: group_position, + group: true, + label: this.escapeExpression(group.label), + children: 0, + disabled: group.disabled + }); + _ref = group.childNodes; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + option = _ref[_i]; + _results.push(this.add_option(option, group_position, group.disabled)); + } + return _results; + }; + + SelectParser.prototype.add_option = function(option, group_position, group_disabled) { + if (option.nodeName.toUpperCase() === "OPTION") { + if (option.text !== "") { + if (group_position != null) { + this.parsed[group_position].children += 1; + } + this.parsed.push({ + array_index: this.parsed.length, + options_index: this.options_index, + value: option.value, + text: option.text, + html: option.innerHTML, + selected: option.selected, + disabled: group_disabled === true ? group_disabled : option.disabled, + group_array_index: group_position, + classes: option.className, + style: option.style.cssText + }); + } else { + this.parsed.push({ + array_index: this.parsed.length, + options_index: this.options_index, + empty: true + }); + } + return this.options_index += 1; + } + }; + + SelectParser.prototype.escapeExpression = function(text) { + var map, unsafe_chars; + + if ((text == null) || text === false) { + return ""; + } + if (!/[\&\<\>\"\'\`]/.test(text)) { + return text; + } + map = { + "<": "<", + ">": ">", + '"': """, + "'": "'", + "`": "`" + }; + unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g; + return text.replace(unsafe_chars, function(chr) { + return map[chr] || "&"; + }); + }; + + return SelectParser; + + })(); + + SelectParser.select_to_array = function(select) { + var child, parser, _i, _len, _ref; + + parser = new SelectParser(); + _ref = select.childNodes; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + parser.add_node(child); + } + return parser.parsed; + }; + + AbstractChosen = (function() { + function AbstractChosen(form_field, options) { + this.form_field = form_field; + this.options = options != null ? options : {}; + if (!AbstractChosen.browser_is_supported()) { + return; + } + this.is_multiple = this.form_field.multiple; + this.set_default_text(); + this.set_default_values(); + this.setup(); + this.set_up_html(); + this.register_observers(); + } + + AbstractChosen.prototype.set_default_values = function() { + var _this = this; + + this.click_test_action = function(evt) { + return _this.test_active_click(evt); + }; + this.activate_action = function(evt) { + return _this.activate_field(evt); + }; + this.active_field = false; + this.mouse_on_container = false; + this.results_showing = false; + this.result_highlighted = null; + this.result_single_selected = null; + this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false; + this.disable_search_threshold = this.options.disable_search_threshold || 0; + this.disable_search = this.options.disable_search || false; + this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true; + this.group_search = this.options.group_search != null ? this.options.group_search : true; + this.search_contains = this.options.search_contains || false; + this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true; + this.max_selected_options = this.options.max_selected_options || Infinity; + this.inherit_select_classes = this.options.inherit_select_classes || false; + this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true; + return this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true; + }; + + AbstractChosen.prototype.set_default_text = function() { + if (this.form_field.getAttribute("data-placeholder")) { + this.default_text = this.form_field.getAttribute("data-placeholder"); + } else if (this.is_multiple) { + this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text; + } else { + this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text; + } + return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text; + }; + + AbstractChosen.prototype.mouse_enter = function() { + return this.mouse_on_container = true; + }; + + AbstractChosen.prototype.mouse_leave = function() { + return this.mouse_on_container = false; + }; + + AbstractChosen.prototype.input_focus = function(evt) { + var _this = this; + + if (this.is_multiple) { + if (!this.active_field) { + return setTimeout((function() { + return _this.container_mousedown(); + }), 50); + } + } else { + if (!this.active_field) { + return this.activate_field(); + } + } + }; + + AbstractChosen.prototype.input_blur = function(evt) { + var _this = this; + + if (!this.mouse_on_container) { + this.active_field = false; + return setTimeout((function() { + return _this.blur_test(); + }), 100); + } + }; + + AbstractChosen.prototype.results_option_build = function(options) { + var content, data, _i, _len, _ref; + + content = ''; + _ref = this.results_data; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + data = _ref[_i]; + if (data.group) { + content += this.result_add_group(data); + } else { + content += this.result_add_option(data); + } + if (options != null ? options.first : void 0) { + if (data.selected && this.is_multiple) { + this.choice_build(data); + } else if (data.selected && !this.is_multiple) { + this.single_set_selected_text(data.text); + } + } + } + return content; + }; + + AbstractChosen.prototype.result_add_option = function(option) { + var classes, style; + + if (!option.search_match) { + return ''; + } + if (!this.include_option_in_results(option)) { + return ''; + } + classes = []; + if (!option.disabled && !(option.selected && this.is_multiple)) { + classes.push("active-result"); + } + if (option.disabled && !(option.selected && this.is_multiple)) { + classes.push("disabled-result"); + } + if (option.selected) { + classes.push("result-selected"); + } + if (option.group_array_index != null) { + classes.push("group-option"); + } + if (option.classes !== "") { + classes.push(option.classes); + } + style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : ""; + return "<li class=\"" + (classes.join(' ')) + "\"" + style + " data-option-array-index=\"" + option.array_index + "\">" + option.search_text + "</li>"; + }; + + AbstractChosen.prototype.result_add_group = function(group) { + if (!(group.search_match || group.group_match)) { + return ''; + } + if (!(group.active_options > 0)) { + return ''; + } + return "<li class=\"group-result\">" + group.search_text + "</li>"; + }; + + AbstractChosen.prototype.results_update_field = function() { + this.set_default_text(); + if (!this.is_multiple) { + this.results_reset_cleanup(); + } + this.result_clear_highlight(); + this.result_single_selected = null; + this.results_build(); + if (this.results_showing) { + return this.winnow_results(); + } + }; + + AbstractChosen.prototype.results_toggle = function() { + if (this.results_showing) { + return this.results_hide(); + } else { + return this.results_show(); + } + }; + + AbstractChosen.prototype.results_search = function(evt) { + if (this.results_showing) { + return this.winnow_results(); + } else { + return this.results_show(); + } + }; + + AbstractChosen.prototype.winnow_results = function() { + var escapedSearchText, option, regex, regexAnchor, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref; + + this.no_results_clear(); + results = 0; + searchText = this.get_search_text(); + escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); + regexAnchor = this.search_contains ? "" : "^"; + regex = new RegExp(regexAnchor + escapedSearchText, 'i'); + zregex = new RegExp(escapedSearchText, 'i'); + _ref = this.results_data; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + option = _ref[_i]; + option.search_match = false; + results_group = null; + if (this.include_option_in_results(option)) { + if (option.group) { + option.group_match = false; + option.active_options = 0; + } + if ((option.group_array_index != null) && this.results_data[option.group_array_index]) { + results_group = this.results_data[option.group_array_index]; + if (results_group.active_options === 0 && results_group.search_match) { + results += 1; + } + results_group.active_options += 1; + } + if (!(option.group && !this.group_search)) { + option.search_text = option.group ? option.label : option.html; + option.search_match = this.search_string_match(option.search_text, regex); + if (option.search_match && !option.group) { + results += 1; + } + if (option.search_match) { + if (searchText.length) { + startpos = option.search_text.search(zregex); + text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length); + option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos); + } + if (results_group != null) { + results_group.group_match = true; + } + } else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) { + option.search_match = true; + } + } + } + } + this.result_clear_highlight(); + if (results < 1 && searchText.length) { + this.update_results_content(""); + return this.no_results(searchText); + } else { + this.update_results_content(this.results_option_build()); + return this.winnow_results_set_highlight(); + } + }; + + AbstractChosen.prototype.search_string_match = function(search_string, regex) { + var part, parts, _i, _len; + + if (regex.test(search_string)) { + return true; + } else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) { + parts = search_string.replace(/\[|\]/g, "").split(" "); + if (parts.length) { + for (_i = 0, _len = parts.length; _i < _len; _i++) { + part = parts[_i]; + if (regex.test(part)) { + return true; + } + } + } + } + }; + + AbstractChosen.prototype.choices_count = function() { + var option, _i, _len, _ref; + + if (this.selected_option_count != null) { + return this.selected_option_count; + } + this.selected_option_count = 0; + _ref = this.form_field.options; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + option = _ref[_i]; + if (option.selected) { + this.selected_option_count += 1; + } + } + return this.selected_option_count; + }; + + AbstractChosen.prototype.choices_click = function(evt) { + evt.preventDefault(); + if (!(this.results_showing || this.is_disabled)) { + return this.results_show(); + } + }; + + AbstractChosen.prototype.keyup_checker = function(evt) { + var stroke, _ref; + + stroke = (_ref = evt.which) != null ? _ref : evt.keyCode; + this.search_field_scale(); + switch (stroke) { + case 8: + if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) { + return this.keydown_backstroke(); + } else if (!this.pending_backstroke) { + this.result_clear_highlight(); + return this.results_search(); + } + break; + case 13: + evt.preventDefault(); + if (this.results_showing) { + return this.result_select(evt); + } + break; + case 27: + if (this.results_showing) { + this.results_hide(); + } + return true; + case 9: + case 38: + case 40: + case 16: + case 91: + case 17: + break; + default: + return this.results_search(); + } + }; + + AbstractChosen.prototype.container_width = function() { + if (this.options.width != null) { + return this.options.width; + } else { + return "" + this.form_field.offsetWidth + "px"; + } + }; + + AbstractChosen.prototype.include_option_in_results = function(option) { + if (this.is_multiple && (!this.display_selected_options && option.selected)) { + return false; + } + if (!this.display_disabled_options && option.disabled) { + return false; + } + if (option.empty) { + return false; + } + return true; + }; + + AbstractChosen.browser_is_supported = function() { + if (window.navigator.appName === "Microsoft Internet Explorer") { + return document.documentMode >= 8; + } + if (/iP(od|hone)/i.test(window.navigator.userAgent)) { + return false; + } + if (/Android/i.test(window.navigator.userAgent)) { + if (/Mobile/i.test(window.navigator.userAgent)) { + return false; + } + } + return true; + }; + + AbstractChosen.default_multiple_text = "Select Some Options"; + + AbstractChosen.default_single_text = "Select an Option"; + + AbstractChosen.default_no_result_text = "No results match"; + + return AbstractChosen; + + })(); + + $ = jQuery; + + $.fn.extend({ + chosen: function(options) { + if (!AbstractChosen.browser_is_supported()) { + return this; + } + return this.each(function(input_field) { + var $this, chosen; + + $this = $(this); + chosen = $this.data('chosen'); + if (options === 'destroy' && chosen) { + chosen.destroy(); + } else if (!chosen) { + $this.data('chosen', new Chosen(this, options)); + } + }); + } + }); + + Chosen = (function(_super) { + __extends(Chosen, _super); + + function Chosen() { + _ref = Chosen.__super__.constructor.apply(this, arguments); + return _ref; + } + + Chosen.prototype.setup = function() { + this.form_field_jq = $(this.form_field); + this.current_selectedIndex = this.form_field.selectedIndex; + return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl"); + }; + + Chosen.prototype.set_up_html = function() { + var container_classes, container_props; + + container_classes = ["chosen-container"]; + container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single")); + if (this.inherit_select_classes && this.form_field.className) { + container_classes.push(this.form_field.className); + } + if (this.is_rtl) { + container_classes.push("chosen-rtl"); + } + container_props = { + 'class': container_classes.join(' '), + 'style': "width: " + (this.container_width()) + ";", + 'title': this.form_field.title + }; + if (this.form_field.id.length) { + container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen"; + } + this.container = $("<div />", container_props); + if (this.is_multiple) { + this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'); + } else { + this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'); + } + this.form_field_jq.hide().after(this.container); + this.dropdown = this.container.find('div.chosen-drop').first(); + this.search_field = this.container.find('input').first(); + this.search_results = this.container.find('ul.chosen-results').first(); + this.search_field_scale(); + this.search_no_results = this.container.find('li.no-results').first(); + if (this.is_multiple) { + this.search_choices = this.container.find('ul.chosen-choices').first(); + this.search_container = this.container.find('li.search-field').first(); + } else { + this.search_container = this.container.find('div.chosen-search').first(); + this.selected_item = this.container.find('.chosen-single').first(); + } + this.results_build(); + this.set_tab_index(); + this.set_label_behavior(); + return this.form_field_jq.trigger("chosen:ready", { + chosen: this + }); + }; + + Chosen.prototype.register_observers = function() { + var _this = this; + + this.container.bind('mousedown.chosen', function(evt) { + _this.container_mousedown(evt); + }); + this.container.bind('mouseup.chosen', function(evt) { + _this.container_mouseup(evt); + }); + this.container.bind('mouseenter.chosen', function(evt) { + _this.mouse_enter(evt); + }); + this.container.bind('mouseleave.chosen', function(evt) { + _this.mouse_leave(evt); + }); + this.search_results.bind('mouseup.chosen', function(evt) { + _this.search_results_mouseup(evt); + }); + this.search_results.bind('mouseover.chosen', function(evt) { + _this.search_results_mouseover(evt); + }); + this.search_results.bind('mouseout.chosen', function(evt) { + _this.search_results_mouseout(evt); + }); + this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) { + _this.search_results_mousewheel(evt); + }); + this.form_field_jq.bind("chosen:updated.chosen", function(evt) { + _this.results_update_field(evt); + }); + this.form_field_jq.bind("chosen:activate.chosen", function(evt) { + _this.activate_field(evt); + }); + this.form_field_jq.bind("chosen:open.chosen", function(evt) { + _this.container_mousedown(evt); + }); + this.search_field.bind('blur.chosen', function(evt) { + _this.input_blur(evt); + }); + this.search_field.bind('keyup.chosen', function(evt) { + _this.keyup_checker(evt); + }); + this.search_field.bind('keydown.chosen', function(evt) { + _this.keydown_checker(evt); + }); + this.search_field.bind('focus.chosen', function(evt) { + _this.input_focus(evt); + }); + if (this.is_multiple) { + return this.search_choices.bind('click.chosen', function(evt) { + _this.choices_click(evt); + }); + } else { + return this.container.bind('click.chosen', function(evt) { + evt.preventDefault(); + }); + } + }; + + Chosen.prototype.destroy = function() { + $(document).unbind("click.chosen", this.click_test_action); + if (this.search_field[0].tabIndex) { + this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex; + } + this.container.remove(); + this.form_field_jq.removeData('chosen'); + return this.form_field_jq.show(); + }; + + Chosen.prototype.search_field_disabled = function() { + this.is_disabled = this.form_field_jq[0].disabled; + if (this.is_disabled) { + this.container.addClass('chosen-disabled'); + this.search_field[0].disabled = true; + if (!this.is_multiple) { + this.selected_item.unbind("focus.chosen", this.activate_action); + } + return this.close_field(); + } else { + this.container.removeClass('chosen-disabled'); + this.search_field[0].disabled = false; + if (!this.is_multiple) { + return this.selected_item.bind("focus.chosen", this.activate_action); + } + } + }; + + Chosen.prototype.container_mousedown = function(evt) { + if (!this.is_disabled) { + if (evt && evt.type === "mousedown" && !this.results_showing) { + evt.preventDefault(); + } + if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) { + if (!this.active_field) { + if (this.is_multiple) { + this.search_field.val(""); + } + $(document).bind('click.chosen', this.click_test_action); + this.results_show(); + } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) { + evt.preventDefault(); + this.results_toggle(); + } + return this.activate_field(); + } + } + }; + + Chosen.prototype.container_mouseup = function(evt) { + if (evt.target.nodeName === "ABBR" && !this.is_disabled) { + return this.results_reset(evt); + } + }; + + Chosen.prototype.search_results_mousewheel = function(evt) { + var delta, _ref1, _ref2; + + delta = -((_ref1 = evt.originalEvent) != null ? _ref1.wheelDelta : void 0) || ((_ref2 = evt.originialEvent) != null ? _ref2.detail : void 0); + if (delta != null) { + evt.preventDefault(); + if (evt.type === 'DOMMouseScroll') { + delta = delta * 40; + } + return this.search_results.scrollTop(delta + this.search_results.scrollTop()); + } + }; + + Chosen.prototype.blur_test = function(evt) { + if (!this.active_field && this.container.hasClass("chosen-container-active")) { + return this.close_field(); + } + }; + + Chosen.prototype.close_field = function() { + $(document).unbind("click.chosen", this.click_test_action); + this.active_field = false; + this.results_hide(); + this.container.removeClass("chosen-container-active"); + this.clear_backstroke(); + this.show_search_field_default(); + return this.search_field_scale(); + }; + + Chosen.prototype.activate_field = function() { + this.container.addClass("chosen-container-active"); + this.active_field = true; + this.search_field.val(this.search_field.val()); + return this.search_field.focus(); + }; + + Chosen.prototype.test_active_click = function(evt) { + if (this.container.is($(evt.target).closest('.chosen-container'))) { + return this.active_field = true; + } else { + return this.close_field(); + } + }; + + Chosen.prototype.results_build = function() { + this.parsing = true; + this.selected_option_count = null; + this.results_data = SelectParser.select_to_array(this.form_field); + if (this.is_multiple) { + this.search_choices.find("li.search-choice").remove(); + } else if (!this.is_multiple) { + this.single_set_selected_text(); + if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) { + this.search_field[0].readOnly = true; + this.container.addClass("chosen-container-single-nosearch"); + } else { + this.search_field[0].readOnly = false; + this.container.removeClass("chosen-container-single-nosearch"); + } + } + this.update_results_content(this.results_option_build({ + first: true + })); + this.search_field_disabled(); + this.show_search_field_default(); + this.search_field_scale(); + return this.parsing = false; + }; + + Chosen.prototype.result_do_highlight = function(el) { + var high_bottom, high_top, maxHeight, visible_bottom, visible_top; + + if (el.length) { + this.result_clear_highlight(); + this.result_highlight = el; + this.result_highlight.addClass("highlighted"); + maxHeight = parseInt(this.search_results.css("maxHeight"), 10); + visible_top = this.search_results.scrollTop(); + visible_bottom = maxHeight + visible_top; + high_top = this.result_highlight.position().top + this.search_results.scrollTop(); + high_bottom = high_top + this.result_highlight.outerHeight(); + if (high_bottom >= visible_bottom) { + return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0); + } else if (high_top < visible_top) { + return this.search_results.scrollTop(high_top); + } + } + }; + + Chosen.prototype.result_clear_highlight = function() { + if (this.result_highlight) { + this.result_highlight.removeClass("highlighted"); + } + return this.result_highlight = null; + }; + + Chosen.prototype.results_show = function() { + if (this.is_multiple && this.max_selected_options <= this.choices_count()) { + this.form_field_jq.trigger("chosen:maxselected", { + chosen: this + }); + return false; + } + this.container.addClass("chosen-with-drop"); + this.form_field_jq.trigger("chosen:showing_dropdown", { + chosen: this + }); + this.results_showing = true; + this.search_field.focus(); + this.search_field.val(this.search_field.val()); + return this.winnow_results(); + }; + + Chosen.prototype.update_results_content = function(content) { + return this.search_results.html(content); + }; + + Chosen.prototype.results_hide = function() { + if (this.results_showing) { + this.result_clear_highlight(); + this.container.removeClass("chosen-with-drop"); + this.form_field_jq.trigger("chosen:hiding_dropdown", { + chosen: this + }); + } + return this.results_showing = false; + }; + + Chosen.prototype.set_tab_index = function(el) { + var ti; + + if (this.form_field.tabIndex) { + ti = this.form_field.tabIndex; + this.form_field.tabIndex = -1; + return this.search_field[0].tabIndex = ti; + } + }; + + Chosen.prototype.set_label_behavior = function() { + var _this = this; + + this.form_field_label = this.form_field_jq.parents("label"); + if (!this.form_field_label.length && this.form_field.id.length) { + this.form_field_label = $("label[for='" + this.form_field.id + "']"); + } + if (this.form_field_label.length > 0) { + return this.form_field_label.bind('click.chosen', function(evt) { + if (_this.is_multiple) { + return _this.container_mousedown(evt); + } else { + return _this.activate_field(); + } + }); + } + }; + + Chosen.prototype.show_search_field_default = function() { + if (this.is_multiple && this.choices_count() < 1 && !this.active_field) { + this.search_field.val(this.default_text); + return this.search_field.addClass("default"); + } else { + this.search_field.val(""); + return this.search_field.removeClass("default"); + } + }; + + Chosen.prototype.search_results_mouseup = function(evt) { + var target; + + target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first(); + if (target.length) { + this.result_highlight = target; + this.result_select(evt); + return this.search_field.focus(); + } + }; + + Chosen.prototype.search_results_mouseover = function(evt) { + var target; + + target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first(); + if (target) { + return this.result_do_highlight(target); + } + }; + + Chosen.prototype.search_results_mouseout = function(evt) { + if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) { + return this.result_clear_highlight(); + } + }; + + Chosen.prototype.choice_build = function(item) { + var choice, close_link, + _this = this; + + choice = $('<li />', { + "class": "search-choice" + }).html("<span>" + item.html + "</span>"); + if (item.disabled) { + choice.addClass('search-choice-disabled'); + } else { + close_link = $('<a />', { + "class": 'search-choice-close', + 'data-option-array-index': item.array_index + }); + close_link.bind('click.chosen', function(evt) { + return _this.choice_destroy_link_click(evt); + }); + choice.append(close_link); + } + return this.search_container.before(choice); + }; + + Chosen.prototype.choice_destroy_link_click = function(evt) { + evt.preventDefault(); + evt.stopPropagation(); + if (!this.is_disabled) { + return this.choice_destroy($(evt.target)); + } + }; + + Chosen.prototype.choice_destroy = function(link) { + if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) { + this.show_search_field_default(); + if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) { + this.results_hide(); + } + link.parents('li').first().remove(); + return this.search_field_scale(); + } + }; + + Chosen.prototype.results_reset = function() { + this.form_field.options[0].selected = true; + this.selected_option_count = null; + this.single_set_selected_text(); + this.show_search_field_default(); + this.results_reset_cleanup(); + this.form_field_jq.trigger("change"); + if (this.active_field) { + return this.results_hide(); + } + }; + + Chosen.prototype.results_reset_cleanup = function() { + this.current_selectedIndex = this.form_field.selectedIndex; + return this.selected_item.find("abbr").remove(); + }; + + Chosen.prototype.result_select = function(evt) { + var high, item, selected_index; + + if (this.result_highlight) { + high = this.result_highlight; + this.result_clear_highlight(); + if (this.is_multiple && this.max_selected_options <= this.choices_count()) { + this.form_field_jq.trigger("chosen:maxselected", { + chosen: this + }); + return false; + } + if (this.is_multiple) { + high.removeClass("active-result"); + } else { + if (this.result_single_selected) { + this.result_single_selected.removeClass("result-selected"); + selected_index = this.result_single_selected[0].getAttribute('data-option-array-index'); + this.results_data[selected_index].selected = false; + } + this.result_single_selected = high; + } + high.addClass("result-selected"); + item = this.results_data[high[0].getAttribute("data-option-array-index")]; + item.selected = true; + this.form_field.options[item.options_index].selected = true; + this.selected_option_count = null; + if (this.is_multiple) { + this.choice_build(item); + } else { + this.single_set_selected_text(item.text); + } + if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) { + this.results_hide(); + } + this.search_field.val(""); + if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) { + this.form_field_jq.trigger("change", { + 'selected': this.form_field.options[item.options_index].value + }); + } + this.current_selectedIndex = this.form_field.selectedIndex; + return this.search_field_scale(); + } + }; + + Chosen.prototype.single_set_selected_text = function(text) { + if (text == null) { + text = this.default_text; + } + if (text === this.default_text) { + this.selected_item.addClass("chosen-default"); + } else { + this.single_deselect_control_build(); + this.selected_item.removeClass("chosen-default"); + } + return this.selected_item.find("span").text(text); + }; + + Chosen.prototype.result_deselect = function(pos) { + var result_data; + + result_data = this.results_data[pos]; + if (!this.form_field.options[result_data.options_index].disabled) { + result_data.selected = false; + this.form_field.options[result_data.options_index].selected = false; + this.selected_option_count = null; + this.result_clear_highlight(); + if (this.results_showing) { + this.winnow_results(); + } + this.form_field_jq.trigger("change", { + deselected: this.form_field.options[result_data.options_index].value + }); + this.search_field_scale(); + return true; + } else { + return false; + } + }; + + Chosen.prototype.single_deselect_control_build = function() { + if (!this.allow_single_deselect) { + return; + } + if (!this.selected_item.find("abbr").length) { + this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>"); + } + return this.selected_item.addClass("chosen-single-with-deselect"); + }; + + Chosen.prototype.get_search_text = function() { + if (this.search_field.val() === this.default_text) { + return ""; + } else { + return $('<div/>').text($.trim(this.search_field.val())).html(); + } + }; + + Chosen.prototype.winnow_results_set_highlight = function() { + var do_high, selected_results; + + selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : []; + do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first(); + if (do_high != null) { + return this.result_do_highlight(do_high); + } + }; + + Chosen.prototype.no_results = function(terms) { + var no_results_html; + + no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>'); + no_results_html.find("span").first().html(terms); + return this.search_results.append(no_results_html); + }; + + Chosen.prototype.no_results_clear = function() { + return this.search_results.find(".no-results").remove(); + }; + + Chosen.prototype.keydown_arrow = function() { + var next_sib; + + if (this.results_showing && this.result_highlight) { + next_sib = this.result_highlight.nextAll("li.active-result").first(); + if (next_sib) { + return this.result_do_highlight(next_sib); + } + } else { + return this.results_show(); + } + }; + + Chosen.prototype.keyup_arrow = function() { + var prev_sibs; + + if (!this.results_showing && !this.is_multiple) { + return this.results_show(); + } else if (this.result_highlight) { + prev_sibs = this.result_highlight.prevAll("li.active-result"); + if (prev_sibs.length) { + return this.result_do_highlight(prev_sibs.first()); + } else { + if (this.choices_count() > 0) { + this.results_hide(); + } + return this.result_clear_highlight(); + } + } + }; + + Chosen.prototype.keydown_backstroke = function() { + var next_available_destroy; + + if (this.pending_backstroke) { + this.choice_destroy(this.pending_backstroke.find("a").first()); + return this.clear_backstroke(); + } else { + next_available_destroy = this.search_container.siblings("li.search-choice").last(); + if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) { + this.pending_backstroke = next_available_destroy; + if (this.single_backstroke_delete) { + return this.keydown_backstroke(); + } else { + return this.pending_backstroke.addClass("search-choice-focus"); + } + } + } + }; + + Chosen.prototype.clear_backstroke = function() { + if (this.pending_backstroke) { + this.pending_backstroke.removeClass("search-choice-focus"); + } + return this.pending_backstroke = null; + }; + + Chosen.prototype.keydown_checker = function(evt) { + var stroke, _ref1; + + stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode; + this.search_field_scale(); + if (stroke !== 8 && this.pending_backstroke) { + this.clear_backstroke(); + } + switch (stroke) { + case 8: + this.backstroke_length = this.search_field.val().length; + break; + case 9: + if (this.results_showing && !this.is_multiple) { + this.result_select(evt); + } + this.mouse_on_container = false; + break; + case 13: + evt.preventDefault(); + break; + case 38: + evt.preventDefault(); + this.keyup_arrow(); + break; + case 40: + evt.preventDefault(); + this.keydown_arrow(); + break; + } + }; + + Chosen.prototype.search_field_scale = function() { + var div, f_width, h, style, style_block, styles, w, _i, _len; + + if (this.is_multiple) { + h = 0; + w = 0; + style_block = "position:absolute; left: -1000px; top: -1000px; display:none;"; + styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing']; + for (_i = 0, _len = styles.length; _i < _len; _i++) { + style = styles[_i]; + style_block += style + ":" + this.search_field.css(style) + ";"; + } + div = $('<div />', { + 'style': style_block + }); + div.text(this.search_field.val()); + $('body').append(div); + w = div.width() + 25; + div.remove(); + f_width = this.container.outerWidth(); + if (w > f_width - 10) { + w = f_width - 10; + } + return this.search_field.css({ + 'width': w + 'px' + }); + } + }; + + return Chosen; + + })(AbstractChosen); + +}).call(this);
\ No newline at end of file diff --git a/afb-client/bower_components/tether/examples/chosen/index.html b/afb-client/bower_components/tether/examples/chosen/index.html new file mode 100644 index 0000000..cf5b490 --- /dev/null +++ b/afb-client/bower_components/tether/examples/chosen/index.html @@ -0,0 +1,110 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="chrome=1"> + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> + <link rel="stylesheet" href="../../css/drop.css" /> + <link rel="stylesheet" href="../resources/css/base.css" /> + <link rel="stylesheet" href="chosen.css" /> + </head> + <body> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + <br/> + Favorite pizza style: <br/> + <div class="drop-chosen-target chosen-container chosen-container-single chosen-with-drop" style="width: 350px"> + <a class="chosen-single chosen-default" tabindex="-1"><span>Choose a style...</span><div><b></b></div></a> + </div> + <br/> + <br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + text<br/> + <script src="../resources/js/log.js"></script> + <script src="../resources/js/jquery.js"></script> + <script src="chosen.js"></script> + <script src="../../drop.js"></script> + <script> + $(function(){ + var $target, $drop; + + $target = $('.drop-chosen-target').drop({ + className: 'drop-chosen', + attach: 'bottom-left', + content: '' + }); + + $drop = $target.data().drop.$drop; + + $drop.append('<select><option>Plain</option><option>Pepperoni</option><option>Supreme</option></select>'); + + $drop.on('openDrop', function(event){ + $target.addClass('chosen-container-active'); + }).on('closeDrop', function(event){ + $target.removeClass('chosen-container-active'); + }); + + $drop.on('openDrop', function(event) { + var $select = $drop.find('select'); + + if (!$drop.find('.chosen-container').length) { + $select + .css('width', $target.outerWidth()) + .chosen({ + allow_single_deselect: true, + disable_search_threshold: 0 + }) + ; + } + + setTimeout(function(){ + $drop.find('.chosen-search input').click().focus().keyup(); + $target.drop('positionDrop'); + }, 0); + }); + }); + </script> + <style> + .drop-chosen-target > a { + outline: none; + } + + .drop.drop-chosen { + background: transparent; + } + + .drop.drop-chosen .chosen-container > .chosen-single { + display: none; + } + + .drop.drop-chosen .chosen-container .chosen-drop { + position: static; + } + </style> + </body> +</html>
\ No newline at end of file diff --git a/afb-client/bower_components/tether/examples/common/css/style.css b/afb-client/bower_components/tether/examples/common/css/style.css new file mode 100644 index 0000000..2d82380 --- /dev/null +++ b/afb-client/bower_components/tether/examples/common/css/style.css @@ -0,0 +1,48 @@ +body { + min-height: 3000px; +} +.element { + width: 200px; + height: 200px; + background-color: #fe8; + position: absolute; + z-index: 6; +} + +.target { + width: 300px; + height: 50px; + margin: 0 35%; + background-color: #4e9; +} + +.container { + height: 600px; + overflow: scroll; + width: 600px; + border: 20px solid #CCC; + margin-top: 100px; +} + +body { + padding: 15px; +} + +body > .container { + margin: 0 auto; +} + +.pad { + height: 400px; + width: 100px; +} + +.instructions { + width: 100%; + text-align: center; + font-size: 24px; + padding: 15px; + background-color: rgba(210, 180, 140, 0.4); + margin: -15px -15px 0 -15px; +} + diff --git a/afb-client/bower_components/tether/examples/content-visible/index.html b/afb-client/bower_components/tether/examples/content-visible/index.html new file mode 100644 index 0000000..94e2176 --- /dev/null +++ b/afb-client/bower_components/tether/examples/content-visible/index.html @@ -0,0 +1,64 @@ +<!DOCTYPE html> +<html> + <head> + <link rel="stylesheet" href="../resources/css/base.css" /> + </head> + <body> + + <div class="instructions">Scroll the page</div> + + <style> + .instructions { + width: 100%; + text-align: center; + font-size: 24px; + padding: 15px; + background-color: rgba(210, 180, 140, 0.4); + } + + * { + box-sizing: border-box; + } + body { + min-height: 1200vh; + height: 100%; + } + + .content-box { + width: 600px; + border: 10px solid #999; + height: 600vh; + background-color: #439CCC; + margin: 200vh auto; + } + .element { + border: 10px solid #999; + background-color: #FFDC00; + width: 300px; + height: 200px; + padding: 0 15px; + font-size: 20px; + font-weight: bold; + } + </style> + + <div class="content-box"> + <div class="element"> + <p>This is some sort of crazy dialog.</p> + + <p>It's setup to align with the center of the visible part of the blue area.</p> + </div> + </div> + + <script src="../../tether.js"></script> + <script> + new Tether({ + element: '.element', + target: '.content-box', + attachment: 'middle center', + targetAttachment: 'middle center', + targetModifier: 'visible' + }); + </script> + </body> +</html> diff --git a/afb-client/bower_components/tether/examples/dolls/dolls.css b/afb-client/bower_components/tether/examples/dolls/dolls.css new file mode 100644 index 0000000..931c0de --- /dev/null +++ b/afb-client/bower_components/tether/examples/dolls/dolls.css @@ -0,0 +1,18 @@ +.tether-element, .tether-target { + width: 200px; + height: 50px; + background-color: #4cc; + position: absolute; +} +body { + width: 100%; + height: 100%; + overflow: scroll; +} +.scroll { + width: 400%; + height: 400%; +} +.tether-target:not(.tether-element) { + cursor: move; +} diff --git a/afb-client/bower_components/tether/examples/dolls/dolls.js b/afb-client/bower_components/tether/examples/dolls/dolls.js new file mode 100644 index 0000000..5d0b06b --- /dev/null +++ b/afb-client/bower_components/tether/examples/dolls/dolls.js @@ -0,0 +1,83 @@ +var tethers = []; + +document.addEventListener('DOMContentLoaded', function(){ + dragging = null; + + document.body.addEventListener('mouseup', function(){ + dragging = null; + }); + + document.body.addEventListener('mousemove', function(e){ + if (dragging){ + dragging.style.top = e.clientY + 'px'; + dragging.style.left = e.clientX + 'px'; + + Tether.position() + } + }); + + document.body.addEventListener('mousedown', function(e){ + if (e.target.getAttribute('data-index')) + dragging = e.target; + }) + + var count = 60; + var parent = null; + var dir = 'left'; + var first = null; + + while (count--){ + var el = document.createElement('div'); + el.setAttribute('data-index', count); + document.querySelector('.scroll').appendChild(el); + + if (!first) + first = el; + + if (count % 10 === 0) + dir = dir == 'right' ? 'left' : 'right'; + + if (parent){ + tethers.push(new Tether({ + element: el, + target: parent, + attachment: 'middle ' + dir, + targetOffset: (dir == 'left' ? '10px 10px' : '10px -10px') + })); + + } + + parent = el; + } + + initAnim(first); +}); + +function initAnim(el){ + var start = performance.now() + var last = 0; + var lastTop = 0; + var tick = function(){ + var diff = performance.now() - last; + + if (!last || diff > 50){ + last = performance.now(); + + var nextTop = 50 * Math.sin((last - start) / 1000); + + var curTop = parseFloat(el.style.top || 0); + var topChange = nextTop - lastTop; + lastTop = nextTop; + + var top = curTop + topChange; + + el.style.top = top + 'px'; + + Tether.position(); + } + + requestAnimationFrame(tick); + }; + + tick(); +} diff --git a/afb-client/bower_components/tether/examples/dolls/index.html b/afb-client/bower_components/tether/examples/dolls/index.html new file mode 100644 index 0000000..610fb34 --- /dev/null +++ b/afb-client/bower_components/tether/examples/dolls/index.html @@ -0,0 +1,7 @@ +<link rel="stylesheet" href="./dolls.css" /> +<script src="../../tether.js"></script> +<script src="./dolls.js"></script> +<body> + <div class="scroll"> + </div> +</body> diff --git a/afb-client/bower_components/tether/examples/element-scroll/index.html b/afb-client/bower_components/tether/examples/element-scroll/index.html new file mode 100644 index 0000000..1eb6f1e --- /dev/null +++ b/afb-client/bower_components/tether/examples/element-scroll/index.html @@ -0,0 +1,499 @@ +<!DOCTYPE html> +<html> + <head> + <link rel="stylesheet" href="../resources/css/base.css" /> + </head> + <body> + + <div class="scroll"> + <p>For a long time after the course of the steamer <em>Sofala</em> had been + altered for the land, the low swampy coast had retained its appearance + of a mere smudge of darkness beyond a belt of glitter. The sunrays + seemed to fall violently upon the calm sea--seemed to shatter themselves + upon an adamantine surface into sparkling dust, into a dazzling vapor + of light that blinded the eye and wearied the brain with its unsteady + brightness.</p> + + <p>Captain Whalley did not look at it. When his Serang, approaching the + roomy cane arm-chair which he filled capably, had informed him in a low + voice that the course was to be altered, he had risen at once and had + remained on his feet, face forward, while the head of his ship swung + through a quarter of a circle. He had not uttered a single word, not + even the word to steady the helm. It was the Serang, an elderly, alert, + little Malay, with a very dark skin, who murmured the order to the + helmsman. And then slowly Captain Whalley sat down again in the + arm-chair on the bridge and fixed his eyes on the deck between his feet.</p> + + <p>He could not hope to see anything new upon this lane of the sea. He had + been on these coasts for the last three years. From Low Cape to Malantan + the distance was fifty miles, six hours' steaming for the old ship with + the tide, or seven against. Then you steered straight for the land, and + by-and-by three palms would appear on the sky, tall and slim, and with + their disheveled heads in a bunch, as if in confidential criticism of + the dark mangroves. The Sofala would be headed towards the somber + strip of the coast, which at a given moment, as the ship closed with + it obliquely, would show several clean shining fractures--the brimful + estuary of a river. Then on through a brown liquid, three parts water + and one part black earth, on and on between the low shores, three parts + black earth and one part brackish water, the Sofala would plow her way + up-stream, as she had done once every month for these seven years or + more, long before he was aware of her existence, long before he had ever + thought of having anything to do with her and her invariable voyages. + The old ship ought to have known the road better than her men, who had + not been kept so long at it without a change; better than the faithful + Serang, whom he had brought over from his last ship to keep the + captain's watch; better than he himself, who had been her captain for + the last three years only. She could always be depended upon to make her + courses. Her compasses were never out. She was no trouble at all to + take about, as if her great age had given her knowledge, wisdom, and + steadiness. She made her landfalls to a degree of the bearing, and + almost to a minute of her allowed time. At any moment, as he sat on + the bridge without looking up, or lay sleepless in his bed, simply by + reckoning the days and the hours he could tell where he was--the precise + spot of the beat. He knew it well too, this monotonous huckster's + round, up and down the Straits; he knew its order and its sights and its + people. Malacca to begin with, in at daylight and out at dusk, to cross + over with a rigid phosphorescent wake this highway of the Far East. + Darkness and gleams on the water, clear stars on a black sky, perhaps + the lights of a home steamer keeping her unswerving course in the + middle, or maybe the elusive shadow of a native craft with her mat sails + flitting by silently--and the low land on the other side in sight + at daylight. At noon the three palms of the next place of call, up a + sluggish river. The only white man residing there was a retired young + sailor, with whom he had become friendly in the course of many voyages. + Sixty miles farther on there was another place of call, a deep bay with + only a couple of houses on the beach. And so on, in and out, picking + up coastwise cargo here and there, and finishing with a hundred miles' + steady steaming through the maze of an archipelago of small islands up + to a large native town at the end of the beat. There was a three days' + rest for the old ship before he started her again in inverse order, + seeing the same shores from another bearing, hearing the same voices + in the same places, back again to the Sofala's port of registry on + the great highway to the East, where he would take up a berth nearly + opposite the big stone pile of the harbor office till it was time to + start again on the old round of 1600 miles and thirty days. Not a very + enterprising life, this, for Captain Whalley, Henry Whalley, otherwise + Dare-devil Harry--Whalley of the Condor, a famous clipper in her day. + No. Not a very enterprising life for a man who had served famous firms, + who had sailed famous ships (more than one or two of them his own); who + had made famous passages, had been the pioneer of new routes and new + trades; who had steered across the unsurveyed tracts of the South Seas, + and had seen the sun rise on uncharted islands. Fifty years at sea, and + forty out in the East ("a pretty thorough apprenticeship," he used + to remark smilingly), had made him honorably known to a generation of + shipowners and merchants in all the ports from Bombay clear over to + where the East merges into the West upon the coast of the two Americas. + His fame remained writ, not very large but plain enough, on the + Admiralty charts. Was there not somewhere between Australia and China a + Whalley Island and a Condor Reef? On that dangerous coral formation the + celebrated clipper had hung stranded for three days, her captain and + crew throwing her cargo overboard with one hand and with the other, as + it were, keeping off her a flotilla of savage war-canoes. At that time + neither the island nor the reef had any official existence. Later the + officers of her Majesty's steam vessel Fusilier, dispatched to make a + survey of the route, recognized in the adoption of these two names the + enterprise of the man and the solidity of the ship. Besides, as anyone + who cares may see, the "General Directory," vol. ii. p. 410, begins the + description of the "Malotu or Whalley Passage" with the words: "This + advantageous route, first discovered in 1850 by Captain Whalley in the + ship Condor," &c., and ends by recommending it warmly to sailing vessels + leaving the China ports for the south in the months from December to + April inclusive.</p> + + <p>This was the clearest gain he had out of life. Nothing could rob him + of this kind of fame. The piercing of the Isthmus of Suez, like the + breaking of a dam, had let in upon the East a flood of new ships, new + men, new methods of trade. It had changed the face of the Eastern seas + and the very spirit of their life; so that his early experiences meant + nothing whatever to the new generation of seamen.</p> + + <p>In those bygone days he had handled many thousands of pounds of his + employers' money and of his own; he had attended faithfully, as by law + a shipmaster is expected to do, to the conflicting interests of owners, + charterers, and underwriters. He had never lost a ship or consented to + a shady transaction; and he had lasted well, outlasting in the end the + conditions that had gone to the making of his name. He had buried his + wife (in the Gulf of Petchili), had married off his daughter to the man + of her unlucky choice, and had lost more than an ample competence in the + crash of the notorious Travancore and Deccan Banking Corporation, whose + downfall had shaken the East like an earthquake. And he was sixty-five + years old.</p> + + <p>His age sat lightly enough on him; and of his ruin he was not ashamed. + He had not been alone to believe in the stability of the Banking + Corporation. Men whose judgment in matters of finance was as expert as + his seamanship had commended the prudence of his investments, and had + themselves lost much money in the great failure. The only difference + between him and them was that he had lost his all. And yet not his all. + There had remained to him from his lost fortune a very pretty little + bark, Fair Maid, which he had bought to occupy his leisure of a retired + sailor--"to play with," as he expressed it himself.</p> + + <p>He had formally declared himself tired of the sea the year preceding his + daughter's marriage. But after the young couple had gone to settle in + Melbourne he found out that he could not make himself happy on shore. He + was too much of a merchant sea-captain for mere yachting to satisfy him. + He wanted the illusion of affairs; and his acquisition of the Fair + Maid preserved the continuity of his life. He introduced her to his + acquaintances in various ports as "my last command." When he grew too + old to be trusted with a ship, he would lay her up and go ashore to be + buried, leaving directions in his will to have the bark towed out and + scuttled decently in deep water on the day of the funeral. His daughter + would not grudge him the satisfaction of knowing that no stranger would + handle his last command after him. With the fortune he was able to leave + her, the value of a 500-ton bark was neither here nor there. All this + would be said with a jocular twinkle in his eye: the vigorous old man + had too much vitality for the sentimentalism of regret; and a little + wistfully withal, because he was at home in life, taking a genuine + pleasure in its feelings and its possessions; in the dignity of his + reputation and his wealth, in his love for his daughter, and in his + satisfaction with the ship--the plaything of his lonely leisure.</p> + + <p>He had the cabin arranged in accordance with his simple ideal of comfort + at sea. A big bookcase (he was a great reader) occupied one side of his + stateroom; the portrait of his late wife, a flat bituminous oil-painting + representing the profile and one long black ringlet of a young woman, + faced his bed-place. Three chronometers ticked him to sleep and greeted + him on waking with the tiny competition of their beats. He rose at five + every day. The officer of the morning watch, drinking his early cup + of coffee aft by the wheel, would hear through the wide orifice of the + copper ventilators all the splashings, blowings, and splutterings of + his captain's toilet. These noises would be followed by a sustained + deep murmur of the Lord's Prayer recited in a loud earnest voice. Five + minutes afterwards the head and shoulders of Captain Whalley emerged + out of the companion-hatchway. Invariably he paused for a while on the + stairs, looking all round at the horizon; upwards at the trim of the + sails; inhaling deep draughts of the fresh air. Only then he would step + out on the poop, acknowledging the hand raised to the peak of the cap + with a majestic and benign "Good morning to you." He walked the deck + till eight scrupulously. Sometimes, not above twice a year, he had to + use a thick cudgel-like stick on account of a stiffness in the hip--a + slight touch of rheumatism, he supposed. Otherwise he knew nothing of + the ills of the flesh. At the ringing of the breakfast bell he went + below to feed his canaries, wind up the chronometers, and take the + head of the table. From there he had before his eyes the big carbon + photographs of his daughter, her husband, and two fat-legged babies + --his grandchildren--set in black frames into the maplewood bulkheads + of the cuddy. After breakfast he dusted the glass over these portraits + himself with a cloth, and brushed the oil painting of his wife with a + plumate kept suspended from a small brass hook by the side of the heavy + gold frame. Then with the door of his stateroom shut, he would sit down + on the couch under the portrait to read a chapter out of a thick pocket + Bible--her Bible. But on some days he only sat there for half an hour + with his finger between the leaves and the closed book resting on his + knees. Perhaps he had remembered suddenly how fond of boat-sailing she + used to be.</p> + + <p>She had been a real shipmate and a true woman too. It was like an + article of faith with him that there never had been, and never could be, + a brighter, cheerier home anywhere afloat or ashore than his home under + the poop-deck of the Condor, with the big main cabin all white and gold, + garlanded as if for a perpetual festival with an unfading wreath. She + had decorated the center of every panel with a cluster of home flowers. + It took her a twelvemonth to go round the cuddy with this labor of love. + To him it had remained a marvel of painting, the highest achievement of + taste and skill; and as to old Swinburne, his mate, every time he + came down to his meals he stood transfixed with admiration before the + progress of the work. You could almost smell these roses, he declared, + sniffing the faint flavor of turpentine which at that time pervaded the + saloon, and (as he confessed afterwards) made him somewhat less hearty + than usual in tackling his food. But there was nothing of the sort to + interfere with his enjoyment of her singing. "Mrs. Whalley is a regular + out-and-out nightingale, sir," he would pronounce with a judicial air + after listening profoundly over the skylight to the very end of the + piece. In fine weather, in the second dog-watch, the two men could hear + her trills and roulades going on to the accompaniment of the piano in + the cabin. On the very day they got engaged he had written to London + for the instrument; but they had been married for over a year before it + reached them, coming out round the Cape. The big case made part of the + first direct general cargo landed in Hong-kong harbor--an event that to + the men who walked the busy quays of to-day seemed as hazily remote as + the dark ages of history. But Captain Whalley could in a half hour of + solitude live again all his life, with its romance, its idyl, and its + sorrow. He had to close her eyes himself. She went away from under the + ensign like a sailor's wife, a sailor herself at heart. He had read + the service over her, out of her own prayer-book, without a break in his + voice. When he raised his eyes he could see old Swinburne facing him + with his cap pressed to his breast, and his rugged, weather-beaten, + impassive face streaming with drops of water like a lump of chipped red + granite in a shower. It was all very well for that old sea-dog to cry. + He had to read on to the end; but after the splash he did not remember + much of what happened for the next few days. An elderly sailor of the + crew, deft at needlework, put together a mourning frock for the child + out of one of her black skirts.</p> + + <p>He was not likely to forget; but you cannot dam up life like a sluggish + stream. It will break out and flow over a man's troubles, it will close + upon a sorrow like the sea upon a dead body, no matter how much love has + gone to the bottom. And the world is not bad. People had been very + kind to him; especially Mrs. Gardner, the wife of the senior partner + in Gardner, Patteson, & Co., the owners of the Condor. It was she who + volunteered to look after the little one, and in due course took her to + England (something of a journey in those days, even by the overland + mail route) with her own girls to finish her education. It was ten years + before he saw her again.</p> + + <p>As a little child she had never been frightened of bad weather; she + would beg to be taken up on deck in the bosom of his oilskin coat to + watch the big seas hurling themselves upon the Condor. The swirl and + crash of the waves seemed to fill her small soul with a breathless + delight. "A good boy spoiled," he used to say of her in joke. He had + named her Ivy because of the sound of the word, and obscurely fascinated + by a vague association of ideas. She had twined herself tightly round + his heart, and he intended her to cling close to her father as to a + tower of strength; forgetting, while she was little, that in the nature + of things she would probably elect to cling to someone else. But + he loved life well enough for even that event to give him a certain + satisfaction, apart from his more intimate feeling of loss.</p> + + <p>After he had purchased the Fair Maid to occupy his loneliness, he + hastened to accept a rather unprofitable freight to Australia simply for + the opportunity of seeing his daughter in her own home. What made him + dissatisfied there was not to see that she clung now to somebody else, + but that the prop she had selected seemed on closer examination "a + rather poor stick"--even in the matter of health. He disliked his + son-in-law's studied civility perhaps more than his method of + handling the sum of money he had given Ivy at her marriage. But of his + apprehensions he said nothing. Only on the day of his departure, with + the hall-door open already, holding her hands and looking steadily into + her eyes, he had said, "You know, my dear, all I have is for you and the + chicks. Mind you write to me openly." She had answered him by an almost + imperceptible movement of her head. She resembled her mother in + the color of her eyes, and in character--and also in this, that she + understood him without many words.</p> + + <p>Sure enough she had to write; and some of these letters made Captain + Whalley lift his white eye-brows. For the rest he considered he was + reaping the true reward of his life by being thus able to produce on + demand whatever was needed. He had not enjoyed himself so much in a + way since his wife had died. Characteristically enough his son-in-law's + punctuality in failure caused him at a distance to feel a sort of + kindness towards the man. The fellow was so perpetually being jammed on + a lee shore that to charge it all to his reckless navigation would be + manifestly unfair. No, no! He knew well what that meant. It was bad + luck. His own had been simply marvelous, but he had seen in his life too + many good men--seamen and others--go under with the sheer weight of bad + luck not to recognize the fatal signs. For all that, he was cogitating + on the best way of tying up very strictly every penny he had to leave, + when, with a preliminary rumble of rumors (whose first sound reached + him in Shanghai as it happened), the shock of the big failure came; + and, after passing through the phases of stupor, of incredulity, of + indignation, he had to accept the fact that he had nothing to speak of + to leave.</p> + + <p>Upon that, as if he had only waited for this catastrophe, the unlucky + man, away there in Melbourne, gave up his unprofitable game, and sat + down--in an invalid's bath-chair at that too. "He will never walk + again," wrote the wife. For the first time in his life Captain Whalley + was a bit staggered.</p> + + <p>The Fair Maid had to go to work in bitter earnest now. It was no longer + a matter of preserving alive the memory of Dare-devil Harry Whalley in + the Eastern Seas, or of keeping an old man in pocket-money and clothes, + with, perhaps, a bill for a few hundred first-class cigars thrown in at + the end of the year. He would have to buckle-to, and keep her going hard + on a scant allowance of gilt for the ginger-bread scrolls at her stem + and stern.</p> + + <p>This necessity opened his eyes to the fundamental changes of the world. + Of his past only the familiar names remained, here and there, but + the things and the men, as he had known them, were gone. The name of + Gardner, Patteson, & Co. was still displayed on the walls of warehouses + by the waterside, on the brass plates and window-panes in the business + quarters of more than one Eastern port, but there was no longer a + Gardner or a Patteson in the firm. There was no longer for Captain + Whalley an arm-chair and a welcome in the private office, with a bit of + business ready to be put in the way of an old friend, for the sake of + bygone services. The husbands of the Gardner girls sat behind the desks + in that room where, long after he had left the employ, he had kept his + right of entrance in the old man's time. Their ships now had yellow + funnels with black tops, and a time-table of appointed routes like a + confounded service of tramways. The winds of December and June were all + one to them; their captains (excellent young men he doubted not) were, + to be sure, familiar with Whalley Island, because of late years the + Government had established a white fixed light on the north end (with + a red danger sector over the Condor Reef), but most of them would have + been extremely surprised to hear that a flesh-and-blood Whalley still + existed--an old man going about the world trying to pick up a cargo here + and there for his little bark.</p> + + <p>And everywhere it was the same. Departed the men who would have nodded + appreciatively at the mention of his name, and would have thought + themselves bound in honor to do something for Dare-devil Harry Whalley. + Departed the opportunities which he would have known how to seize; and + gone with them the white-winged flock of clippers that lived in the + boisterous uncertain life of the winds, skimming big fortunes out of + the foam of the sea. In a world that pared down the profits to an + irreducible minimum, in a world that was able to count its disengaged + tonnage twice over every day, and in which lean charters were snapped up + by cable three months in advance, there were no chances of fortune for + an individual wandering haphazard with a little bark--hardly indeed any + room to exist.</p> + + <p>He found it more difficult from year to year. He suffered greatly from + the smallness of remittances he was able to send his daughter. Meantime + he had given up good cigars, and even in the matter of inferior cheroots + limited himself to six a day. He never told her of his difficulties, and + she never enlarged upon her struggle to live. Their confidence in each + other needed no explanations, and their perfect understanding endured + without protestations of gratitude or regret. He would have been shocked + if she had taken it into her head to thank him in so many words, but + he found it perfectly natural that she should tell him she needed two + hundred pounds.</p> + + <p>He had come in with the Fair Maid in ballast to look for a freight in + the Sofala's port of registry, and her letter met him there. Its tenor + was that it was no use mincing matters. Her only resource was in opening + a boarding-house, for which the prospects, she judged, were good. Good + enough, at any rate, to make her tell him frankly that with two hundred + pounds she could make a start. He had torn the envelope open, hastily, + on deck, where it was handed to him by the ship-chandler's runner, who + had brought his mail at the moment of anchoring. For the second time + in his life he was appalled, and remained stock-still at the cabin door + with the paper trembling between his fingers. Open a boarding-house! Two + hundred pounds for a start! The only resource! And he did not know where + to lay his hands on two hundred pence.</p> + + <p>All that night Captain Whalley walked the poop of his anchored ship, as + though he had been about to close with the land in thick weather, and + uncertain of his position after a run of many gray days without a sight + of sun, moon, or stars. The black night twinkled with the guiding lights + of seamen and the steady straight lines of lights on shore; and all + around the Fair Maid the riding lights of ships cast trembling trails + upon the water of the roadstead. Captain Whalley saw not a gleam + anywhere till the dawn broke and he found out that his clothing was + soaked through with the heavy dew.</p> + + <p>His ship was awake. He stopped short, stroked his wet beard, and + descended the poop ladder backwards, with tired feet. At the sight + of him the chief officer, lounging about sleepily on the quarterdeck, + remained open-mouthed in the middle of a great early-morning yawn.</p> + + <p>"Good morning to you," pronounced Captain Whalley solemnly, passing into + the cabin. But he checked himself in the doorway, and without looking + back, "By the bye," he said, "there should be an empty wooden case put + away in the lazarette. It has not been broken up--has it?"</p> + + <p>The mate shut his mouth, and then asked as if dazed, "What empty case, + sir?"</p> + + <p>"A big flat packing-case belonging to that painting in my room. Let it + be taken up on deck and tell the carpenter to look it over. I may want + to use it before long."</p> + + <p>The chief officer did not stir a limb till he had heard the door of the + captain's state-room slam within the cuddy. Then he beckoned aft the + second mate with his forefinger to tell him that there was something "in + the wind."</p> + + <p>When the bell rang Captain Whalley's authoritative voice boomed out + through a closed door, "Sit down and don't wait for me." And his + impressed officers took their places, exchanging looks and whispers + across the table. What! No breakfast? And after apparently knocking + about all night on deck, too! Clearly, there was something in the wind. + In the skylight above their heads, bowed earnestly over the plates, + three wire cages rocked and rattled to the restless jumping of the + hungry canaries; and they could detect the sounds of their "old + man's" deliberate movements within his state-room. Captain Whalley was + methodically winding up the chronometers, dusting the portrait of + his late wife, getting a clean white shirt out of the drawers, making + himself ready in his punctilious unhurried manner to go ashore. He could + not have swallowed a single mouthful of food that morning. He had made + up his mind to sell the Fair Maid.</p> + </div> + + <div class="pointer"></div> + + <style> + body { + cursor: pointer; + } + .scroll { + height: 80vh; + width: 80vw; + max-height: 600px; + position: fixed; + top: 5em; + left: 10vw; + + overflow-y: scroll; + padding: 4em; + box-sizing: border-box; + line-height: 1.2; + } + .scroll::-webkit-scrollbar, .scroll::-webkit-scrollbar-track, .scroll::-webkit-scrollbar-thumb { + display: none; + } + + .pointer { + height: 3.6em; + width: 77vw; + border: 5px solid #CCC; + border-radius: 15px; + background-color: rgba(0, 0, 0, 0.05); + pointer-events: none; + } + .highlight { + background-color: rgba(255, 255, 0, 0.3); + } + .hover { + background-color: rgba(0, 255, 255, 0.2); + } + </style> + + <script src="../../tether.js"></script> + <script> + var pointer = document.querySelector('.pointer'); + var scroll = document.querySelector('.scroll'); + + // This creates the pointer tether and links it up + // with the scroll handle + new Tether({ + element: pointer, + target: scroll, + attachment: 'middle right', + targetAttachment: 'middle left', + targetModifier: 'scroll-handle' + }); + + // Everything after this is for the highlighting effect + var paras = document.querySelectorAll('p'); + for(var i=paras.length; i--;){ + var sents = paras[i].innerHTML.split('.'); + for (var j=sents.length; j--;){ + if (sents[j].trim().length) + sents[j] = '<span>' + sents[j] + '.</span>'; + } + paras[i].innerHTML = sents.join(''); + } + + var spans = document.querySelectorAll('p span'); + + function highlight(){ + if (!spans) return; + + var bar = pointer.getBoundingClientRect(); + + for (var i=spans.length; i--;){ + var coord = spans[i].getBoundingClientRect(); + + if (bar.top < coord.top && bar.bottom > coord.top){ + spans[i].classList.add('hover'); + } else if (spans[i].classList.contains('hover')) { + spans[i].classList.remove('hover'); + } + } + + requestAnimationFrame(highlight); + } + + highlight(); + + document.body.addEventListener('click', function(){ + var els = document.querySelectorAll('.hover'); + for (var i=els.length; i--;) + els[i].classList.toggle('highlight'); + }); + </script> + </body> +</html> diff --git a/afb-client/bower_components/tether/examples/enable-disable/index.html b/afb-client/bower_components/tether/examples/enable-disable/index.html new file mode 100644 index 0000000..c962adf --- /dev/null +++ b/afb-client/bower_components/tether/examples/enable-disable/index.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="chrome=1"> + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> + <link rel="stylesheet" href="../resources/css/base.css" /> + <link rel="stylesheet" href="../common/css/style.css" /> + </head> + <body> + <div class="instructions">Click the green target to enable/disable the tethering.</div> + + <div class="element"></div> + <div class="container"> + <div class="pad"></div> + <div class="target"></div> + <div class="pad"></div> + </div> + + <script src="../../tether.js"></script> + <script> + var tether = new Tether({ + element: '.element', + target: '.target', + attachment: 'top left', + targetAttachment: 'top right' + }); + + document.querySelector('.target').addEventListener('click', function(){ + if (tether.enabled) + tether.disable(); + else + tether.enable(); + }); + </script> + </body> +</html> diff --git a/afb-client/bower_components/tether/examples/facebook/facebook.css b/afb-client/bower_components/tether/examples/facebook/facebook.css new file mode 100644 index 0000000..eae1508 --- /dev/null +++ b/afb-client/bower_components/tether/examples/facebook/facebook.css @@ -0,0 +1,86 @@ +.drop-target.drop-open { + outline: 2px solid; +} + +.body { + position: relative; + margin-right: 300px; +} + +.page { + max-width: 100%; + width: 1080px; + padding: 0 10px; + box-sizing: border-box; + margin: 0 auto; +} + +.navigation { + background: blue; + color: #fff; + margin-right: 300px; + margin-bottom: 30px; +} + +.navigation .item a { + padding: 30px 20px; + display: inline-block; +} + +.navigation .item a { + color: inherit; +} + +.navigation .drop-target.drop-open { + background: #fff; + color: blue; + outline: none; +} + +.right-sidebar { + position: fixed; + height: 50%; + width: 300px; + background: #eee; + overflow: auto; + right: 0; +} + +.right-sidebar .drop-target.drop-open { + background: blue; + color: #fff; + outline: none; +} + +.right-sidebar .item a { + display: block; + padding: 20px; + margin-bottom: 10px; + background: rgba(0, 0, 0, .1); +} + +.right-sidebar-top { + top: 0; +} + +.right-sidebar-bottom { + top: 50%; + background: #ccc; +} + +.scroll-container { + position: relative; + overflow: auto; + background: #eee; + padding: 20px; + margin-bottom: 20px; + margin-right: 20px; + height: 200px; + width: 200px; +} + +.absolute-container { + position: absolute; + top: 20px; + right: 300px; +} diff --git a/afb-client/bower_components/tether/examples/facebook/index.html b/afb-client/bower_components/tether/examples/facebook/index.html new file mode 100644 index 0000000..d4bcf8e --- /dev/null +++ b/afb-client/bower_components/tether/examples/facebook/index.html @@ -0,0 +1,209 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="chrome=1"> + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> + <link rel="stylesheet" href="../../css/drop.css" /> + <link rel="stylesheet" href="../../css/drop-theme-default.css" /> + <link rel="stylesheet" href="../../css/drop-theme-arrows.css" /> + <link rel="stylesheet" href="../resources/css/base.css" /> + <link rel="stylesheet" href="facebook.css" /> + </head> + <body> + <div class="navigation"> + <div class="page"> + <span class="item">DROPBOOK</span> + <span class="item"> + <a class="drop-target" data-constrain="false" data-attach="bottom left">DROP</a> + </span> + <span class="item"> + <a class="drop-target" data-constrain="false" data-attach="bottom left">DROP</a> + </span> + <span class="item"> + <a class="drop-target" data-constrain="false" data-attach="bottom left">DROP</a> + </span> + </div> + </div> + <div class="right-sidebar right-sidebar-top"> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left top">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left top">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="true" data-class="drop-theme-arrows" data-attach="left top">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left top">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left top">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left top">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left top">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left top">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left top">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left top">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left top">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left top">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left top">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left top">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left top">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left top">DROP</a> + </div> + </div> + <div class="right-sidebar right-sidebar-bottom"> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left bottom">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left bottom">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="true" data-class="drop-theme-arrows" data-attach="left bottom">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left bottom">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left bottom">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left bottom">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left bottom">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left bottom">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left bottom">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left bottom">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left bottom">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left bottom">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left bottom">DROP</a> + </div> + <div class="item"> + <a class="drop-target" data-constrain="false" data-class="drop-theme-arrows" data-attach="left bottom">DROP</a> + </div> + </div> + <div class="body"> + <div class="page"> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor<br/> + incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud<br/> + exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<br/><br/> + + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor<br/> + incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud<br/> + exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<br/><br/> + + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor<br/> + incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud<br/> + exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<br/><br/> + + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor<br/> + incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud<br/> + exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<br/><br/> + + <a class="drop-target" data-constrain="true" data-attach="bottom left">DROP</a><br/><br/> + <div class="scroll-container"> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, + Lorem ipsum dolor sit amet, consectetur adipisicing elit, + Lorem ipsum dolor sit amet, consectetur adipisicing elit, + Lorem ipsum dolor sit amet, consectetur adipisicing elit, + Lorem ipsum dolor sit amet, consectetur adipisicing elit, + Lorem ipsum dolor sit amet, consectetur adipisicing elit, + Lorem ipsum dolor sit amet, consectetur adipisicing elit, + <br/><br/><a class="drop-target" data-constrain="true" data-attach="bottom left">DROP</a><br/><br/> sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<br/> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br/> + </div> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br/><br/> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br/><br/> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br/><br/> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br/><br/> + <div class="scroll-container"> + <br/> + <a class="drop-target" data-constrain="true" data-attach="bottom left">DROP</a><br/> + <br/> + <div style="width: 150%; background: #ccc; height: 1px"></div> + </div> + <div class="scroll-container"> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<br/> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<br/> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<br/> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<br/> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<br/> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<br/> + <br/><br/> + <div style="width: 150%; background: #ccc; height: 1px"> + <div style="margin-left: 100%"> + <a class="drop-target" data-constrain="true" data-attach="bottom left">DROP</a> + </div> + </div> + <br/><br/> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br/> + </div> + <div class="scroll-container absolute-container"> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, <br/><br/><a class="drop-target" data-constrain="false" data-attach="left top">DROP</a><br/><br/> sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<br/> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br/> + </div> + </div> + </div> + + <script src="../resources/js/log.js"></script> + <script src="../resources/js/jquery.js"></script> + <script src="../../utils.js"></script> + <script src="../../tether.js"></script> + <script src="../../drop.js"></script> + <script src="../../constraint.js"></script> + <style> + .drop .drop-content { + min-height: 100px; + min-width: 100px; + } + </style> + <script> + $('.drop-target').each(function(){ + new Drop({ + target: this, + className: $(this).data().class || 'drop-theme-default', + attach: $(this).data().attach, + constrainToScrollParent: $(this).data().constrain, + openOn: 'click' + }); + }); + </script> + </body> +</html> diff --git a/afb-client/bower_components/tether/examples/out-of-bounds/index.html b/afb-client/bower_components/tether/examples/out-of-bounds/index.html new file mode 100644 index 0000000..f8aa6ab --- /dev/null +++ b/afb-client/bower_components/tether/examples/out-of-bounds/index.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="chrome=1"> + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> + <link rel="stylesheet" href="../resources/css/base.css" /> + <link rel="stylesheet" href="../common/css/style.css" /> + <style> + .tether-element.tether-out-of-bounds { + display: none; + } + </style> + </head> + <body> + <div class="instructions">Resize the screen to see the tethered element disappear when it can't fit.</div> + + <div class="element"></div> + <div class="target"></div> + + <script src="../../tether.js"></script> + <script> + new Tether({ + element: '.element', + target: '.target', + attachment: 'top left', + targetAttachment: 'top right', + constraints: [{ + to: 'window', + attachment: 'together' + }] + }); + </script> + </body> +</html> diff --git a/afb-client/bower_components/tether/examples/pin/index.html b/afb-client/bower_components/tether/examples/pin/index.html new file mode 100644 index 0000000..9ed4a88 --- /dev/null +++ b/afb-client/bower_components/tether/examples/pin/index.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="chrome=1"> + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> + <link rel="stylesheet" href="../resources/css/base.css" /> + <link rel="stylesheet" href="../common/css/style.css" /> + </head> + <body> + <div class="instructions">Resize the screen to see the tethered element stick to the edges of the screen when it's resized.</div> + + <div class="element"></div> + <div class="target"></div> + + <script src="../../tether.js"></script> + <script> + new Tether({ + element: '.element', + target: '.target', + attachment: 'top left', + targetAttachment: 'top right', + constraints: [{ + to: 'window', + pin: true + }] + }); + </script> + </body> +</html> diff --git a/afb-client/bower_components/tether/examples/resources/css/base.css b/afb-client/bower_components/tether/examples/resources/css/base.css new file mode 100644 index 0000000..8006e9d --- /dev/null +++ b/afb-client/bower_components/tether/examples/resources/css/base.css @@ -0,0 +1,10 @@ +body { + font-family: "Helvetica Neue", sans-serif; + color: #444; + margin: 0px; +} + +a { + cursor: pointer; + color: blue; +}
\ No newline at end of file diff --git a/afb-client/bower_components/tether/examples/resources/js/jquery.js b/afb-client/bower_components/tether/examples/resources/js/jquery.js new file mode 100644 index 0000000..11be4b4 --- /dev/null +++ b/afb-client/bower_components/tether/examples/resources/js/jquery.js @@ -0,0 +1,9597 @@ +/*! + * jQuery JavaScript Library v1.9.1 + * http://jquery.com/ + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * + * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2013-2-4 + */ +(function( window, undefined ) { + +// Can't do this because several apps including ASP.NET trace +// the stack via arguments.caller.callee and Firefox dies if +// you try to trace through "use strict" call chains. (#13335) +// Support: Firefox 18+ +//"use strict"; +var + // The deferred used on DOM ready + readyList, + + // A central reference to the root jQuery(document) + rootjQuery, + + // Support: IE<9 + // For `typeof node.method` instead of `node.method !== undefined` + core_strundefined = typeof undefined, + + // Use the correct document accordingly with window argument (sandbox) + document = window.document, + location = window.location, + + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$, + + // [[Class]] -> type pairs + class2type = {}, + + // List of deleted data cache ids, so we can reuse them + core_deletedIds = [], + + core_version = "1.9.1", + + // Save a reference to some core methods + core_concat = core_deletedIds.concat, + core_push = core_deletedIds.push, + core_slice = core_deletedIds.slice, + core_indexOf = core_deletedIds.indexOf, + core_toString = class2type.toString, + core_hasOwn = class2type.hasOwnProperty, + core_trim = core_version.trim, + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context, rootjQuery ); + }, + + // Used for matching numbers + core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, + + // Used for splitting on whitespace + core_rnotwhite = /\S+/g, + + // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // A simple way to check for HTML strings + // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/, + + // Match a standalone tag + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, + + // JSON RegExp + rvalidchars = /^[\],:{}\s]*$/, + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, + rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, + rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([\da-z])/gi, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }, + + // The ready event handler + completed = function( event ) { + + // readyState === "complete" is good enough for us to call the dom ready in oldIE + if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { + detach(); + jQuery.ready(); + } + }, + // Clean-up method for dom ready events + detach = function() { + if ( document.addEventListener ) { + document.removeEventListener( "DOMContentLoaded", completed, false ); + window.removeEventListener( "load", completed, false ); + + } else { + document.detachEvent( "onreadystatechange", completed ); + window.detachEvent( "onload", completed ); + } + }; + +jQuery.fn = jQuery.prototype = { + // The current version of jQuery being used + jquery: core_version, + + constructor: jQuery, + init: function( selector, context, rootjQuery ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + + // scripts is true for back-compat + jQuery.merge( this, jQuery.parseHTML( + match[1], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + // Properties of context are called as methods if possible + if ( jQuery.isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return rootjQuery.ready( selector ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }, + + // Start with an empty selector + selector: "", + + // The default length of a jQuery object is 0 + length: 0, + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + toArray: function() { + return core_slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + ( num < 0 ? this[ this.length + num ] : this[ num ] ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + ret.context = this.context; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + ready: function( fn ) { + // Add the callback + jQuery.ready.promise().done( fn ); + + return this; + }, + + slice: function() { + return this.pushStack( core_slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: core_push, + sort: [].sort, + splice: [].splice +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +jQuery.extend = jQuery.fn.extend = function() { + var src, copyIsArray, copy, name, options, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( length === i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + noConflict: function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; + }, + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger("ready").off("ready"); + } + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + isWindow: function( obj ) { + return obj != null && obj == obj.window; + }, + + isNumeric: function( obj ) { + return !isNaN( parseFloat(obj) ) && isFinite( obj ); + }, + + type: function( obj ) { + if ( obj == null ) { + return String( obj ); + } + return typeof obj === "object" || typeof obj === "function" ? + class2type[ core_toString.call(obj) ] || "object" : + typeof obj; + }, + + isPlainObject: function( obj ) { + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + try { + // Not own constructor property must be Object + if ( obj.constructor && + !core_hasOwn.call(obj, "constructor") && + !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + + var key; + for ( key in obj ) {} + + return key === undefined || core_hasOwn.call( obj, key ); + }, + + isEmptyObject: function( obj ) { + var name; + for ( name in obj ) { + return false; + } + return true; + }, + + error: function( msg ) { + throw new Error( msg ); + }, + + // data: string of html + // context (optional): If specified, the fragment will be created in this context, defaults to document + // keepScripts (optional): If true, will include scripts passed in the html string + parseHTML: function( data, context, keepScripts ) { + if ( !data || typeof data !== "string" ) { + return null; + } + if ( typeof context === "boolean" ) { + keepScripts = context; + context = false; + } + context = context || document; + + var parsed = rsingleTag.exec( data ), + scripts = !keepScripts && []; + + // Single tag + if ( parsed ) { + return [ context.createElement( parsed[1] ) ]; + } + + parsed = jQuery.buildFragment( [ data ], context, scripts ); + if ( scripts ) { + jQuery( scripts ).remove(); + } + return jQuery.merge( [], parsed.childNodes ); + }, + + parseJSON: function( data ) { + // Attempt to parse using the native JSON parser first + if ( window.JSON && window.JSON.parse ) { + return window.JSON.parse( data ); + } + + if ( data === null ) { + return data; + } + + if ( typeof data === "string" ) { + + // Make sure leading/trailing whitespace is removed (IE can't handle it) + data = jQuery.trim( data ); + + if ( data ) { + // Make sure the incoming data is actual JSON + // Logic borrowed from http://json.org/json2.js + if ( rvalidchars.test( data.replace( rvalidescape, "@" ) + .replace( rvalidtokens, "]" ) + .replace( rvalidbraces, "")) ) { + + return ( new Function( "return " + data ) )(); + } + } + } + + jQuery.error( "Invalid JSON: " + data ); + }, + + // Cross-browser xml parsing + parseXML: function( data ) { + var xml, tmp; + if ( !data || typeof data !== "string" ) { + return null; + } + try { + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + } catch( e ) { + xml = undefined; + } + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; + }, + + noop: function() {}, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + globalEval: function( data ) { + if ( data && jQuery.trim( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + // args is for internal usage only + each: function( obj, callback, args ) { + var value, + i = 0, + length = obj.length, + isArray = isArraylike( obj ); + + if ( args ) { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } + } + + return obj; + }, + + // Use native String.trim function wherever possible + trim: core_trim && !core_trim.call("\uFEFF\xA0") ? + function( text ) { + return text == null ? + "" : + core_trim.call( text ); + } : + + // Otherwise use our own trimming functionality + function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArraylike( Object(arr) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + core_push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + var len; + + if ( arr ) { + if ( core_indexOf ) { + return core_indexOf.call( arr, elem, i ); + } + + len = arr.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in arr && arr[ i ] === elem ) { + return i; + } + } + } + + return -1; + }, + + merge: function( first, second ) { + var l = second.length, + i = first.length, + j = 0; + + if ( typeof l === "number" ) { + for ( ; j < l; j++ ) { + first[ i++ ] = second[ j ]; + } + } else { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, inv ) { + var retVal, + ret = [], + i = 0, + length = elems.length; + inv = !!inv; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + retVal = !!callback( elems[ i ], i ); + if ( inv !== retVal ) { + ret.push( elems[ i ] ); + } + } + + return ret; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, + i = 0, + length = elems.length, + isArray = isArraylike( elems ), + ret = []; + + // Go through the array, translating each of the items to their + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + } + + // Flatten any nested arrays + return core_concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var args, proxy, tmp; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = core_slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + // Multifunctional method to get and set values of a collection + // The value/s can optionally be executed if it's a function + access: function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + length = elems.length, + bulk = key == null; + + // Sets many values + if ( jQuery.type( key ) === "object" ) { + chainable = true; + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !jQuery.isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < length; i++ ) { + fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); + } + } + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + length ? fn( elems[0], key ) : emptyGet; + }, + + now: function() { + return ( new Date() ).getTime(); + } +}); + +jQuery.ready.promise = function( obj ) { + if ( !readyList ) { + + readyList = jQuery.Deferred(); + + // Catch cases where $(document).ready() is called after the browser event has already occurred. + // we once tried to use readyState "interactive" here, but it caused issues like the one + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + setTimeout( jQuery.ready ); + + // Standards-based browsers support DOMContentLoaded + } else if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed, false ); + + // If IE event model is used + } else { + // Ensure firing before onload, maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", completed ); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", completed ); + + // If IE and not a frame + // continually check to see if the document is ready + var top = false; + + try { + top = window.frameElement == null && document.documentElement; + } catch(e) {} + + if ( top && top.doScroll ) { + (function doScrollCheck() { + if ( !jQuery.isReady ) { + + try { + // Use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + top.doScroll("left"); + } catch(e) { + return setTimeout( doScrollCheck, 50 ); + } + + // detach all dom ready events + detach(); + + // and execute any waiting functions + jQuery.ready(); + } + })(); + } + } + } + return readyList.promise( obj ); +}; + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +function isArraylike( obj ) { + var length = obj.length, + type = jQuery.type( obj ); + + if ( jQuery.isWindow( obj ) ) { + return false; + } + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === "array" || type !== "function" && + ( length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj ); +} + +// All jQuery objects should point back to these +rootjQuery = jQuery(document); +// String to Object options format cache +var optionsCache = {}; + +// Convert String-formatted options into Object-formatted ones and store in cache +function createOptions( options ) { + var object = optionsCache[ options ] = {}; + jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { + object[ flag ] = true; + }); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + ( optionsCache[ options ] || createOptions( options ) ) : + jQuery.extend( {}, options ); + + var // Flag to know if list is currently firing + firing, + // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list was already fired + fired, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // First callback to fire (used internally by add and fireWith) + firingStart, + // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = !options.once && [], + // Fire callbacks + fire = function( data ) { + memory = options.memory && data; + fired = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + firing = true; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { + memory = false; // To prevent further calls using add + break; + } + } + firing = false; + if ( list ) { + if ( stack ) { + if ( stack.length ) { + fire( stack.shift() ); + } + } else if ( memory ) { + list = []; + } else { + self.disable(); + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + // First, we save the current length + var start = list.length; + (function add( args ) { + jQuery.each( args, function( _, arg ) { + var type = jQuery.type( arg ); + if ( type === "function" ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && type !== "string" ) { + // Inspect recursively + add( arg ); + } + }); + })( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away + } else if ( memory ) { + firingStart = start; + fire( memory ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + jQuery.each( arguments, function( _, arg ) { + var index; + while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + // Handle firing indexes + if ( firing ) { + if ( index <= firingLength ) { + firingLength--; + } + if ( index <= firingIndex ) { + firingIndex--; + } + } + } + }); + } + return this; + }, + // Check if a given callback is in the list. + // If no argument is given, return whether or not list has callbacks attached. + has: function( fn ) { + return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); + }, + // Remove all callbacks from the list + empty: function() { + list = []; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + if ( list && ( !fired || stack ) ) { + if ( firing ) { + stack.push( args ); + } else { + fire( args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; +jQuery.extend({ + + Deferred: function( func ) { + var tuples = [ + // action, add listener, listener list, final state + [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], + [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], + [ "notify", "progress", jQuery.Callbacks("memory") ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + return jQuery.Deferred(function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + var action = tuple[ 0 ], + fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; + // deferred[ done | fail | progress ] for forwarding actions to newDefer + deferred[ tuple[1] ](function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .done( newDefer.resolve ) + .fail( newDefer.reject ) + .progress( newDefer.notify ); + } else { + newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); + } + }); + }); + fns = null; + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Keep pipe for back-compat + promise.pipe = promise.then; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 3 ]; + + // promise[ done | fail | progress ] = list.add + promise[ tuple[1] ] = list.add; + + // Handle state + if ( stateString ) { + list.add(function() { + // state = [ resolved | rejected ] + state = stateString; + + // [ reject_list | resolve_list ].disable; progress_list.lock + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); + } + + // deferred[ resolve | reject | notify ] + deferred[ tuple[0] ] = function() { + deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); + return this; + }; + deferred[ tuple[0] + "With" ] = list.fireWith; + }); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( subordinate /* , ..., subordinateN */ ) { + var i = 0, + resolveValues = core_slice.call( arguments ), + length = resolveValues.length, + + // the count of uncompleted subordinates + remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, + + // the master Deferred. If resolveValues consist of only a single Deferred, just use that. + deferred = remaining === 1 ? subordinate : jQuery.Deferred(), + + // Update function for both resolve and progress values + updateFunc = function( i, contexts, values ) { + return function( value ) { + contexts[ i ] = this; + values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; + if( values === progressValues ) { + deferred.notifyWith( contexts, values ); + } else if ( !( --remaining ) ) { + deferred.resolveWith( contexts, values ); + } + }; + }, + + progressValues, progressContexts, resolveContexts; + + // add listeners to Deferred subordinates; treat others as resolved + if ( length > 1 ) { + progressValues = new Array( length ); + progressContexts = new Array( length ); + resolveContexts = new Array( length ); + for ( ; i < length; i++ ) { + if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { + resolveValues[ i ].promise() + .done( updateFunc( i, resolveContexts, resolveValues ) ) + .fail( deferred.reject ) + .progress( updateFunc( i, progressContexts, progressValues ) ); + } else { + --remaining; + } + } + } + + // if we're not waiting on anything, resolve the master + if ( !remaining ) { + deferred.resolveWith( resolveContexts, resolveValues ); + } + + return deferred.promise(); + } +}); +jQuery.support = (function() { + + var support, all, a, + input, select, fragment, + opt, eventName, isSupported, i, + div = document.createElement("div"); + + // Setup + div.setAttribute( "className", "t" ); + div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; + + // Support tests won't run in some limited or non-browser environments + all = div.getElementsByTagName("*"); + a = div.getElementsByTagName("a")[ 0 ]; + if ( !all || !a || !all.length ) { + return {}; + } + + // First batch of tests + select = document.createElement("select"); + opt = select.appendChild( document.createElement("option") ); + input = div.getElementsByTagName("input")[ 0 ]; + + a.style.cssText = "top:1px;float:left;opacity:.5"; + support = { + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) + getSetAttribute: div.className !== "t", + + // IE strips leading whitespace when .innerHTML is used + leadingWhitespace: div.firstChild.nodeType === 3, + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + tbody: !div.getElementsByTagName("tbody").length, + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + htmlSerialize: !!div.getElementsByTagName("link").length, + + // Get the style information from getAttribute + // (IE uses .cssText instead) + style: /top/.test( a.getAttribute("style") ), + + // Make sure that URLs aren't manipulated + // (IE normalizes it by default) + hrefNormalized: a.getAttribute("href") === "/a", + + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + opacity: /^0.5/.test( a.style.opacity ), + + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + cssFloat: !!a.style.cssFloat, + + // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) + checkOn: !!input.value, + + // Make sure that a selected-by-default option has a working selected property. + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) + optSelected: opt.selected, + + // Tests for enctype support on a form (#6743) + enctype: !!document.createElement("form").enctype, + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>", + + // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode + boxModel: document.compatMode === "CSS1Compat", + + // Will be defined later + deleteExpando: true, + noCloneEvent: true, + inlineBlockNeedsLayout: false, + shrinkWrapBlocks: false, + reliableMarginRight: true, + boxSizingReliable: true, + pixelPosition: false + }; + + // Make sure checked status is properly cloned + input.checked = true; + support.noCloneChecked = input.cloneNode( true ).checked; + + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as disabled) + select.disabled = true; + support.optDisabled = !opt.disabled; + + // Support: IE<9 + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + + // Check if we can trust getAttribute("value") + input = document.createElement("input"); + input.setAttribute( "value", "" ); + support.input = input.getAttribute( "value" ) === ""; + + // Check if an input maintains its value after becoming a radio + input.value = "t"; + input.setAttribute( "type", "radio" ); + support.radioValue = input.value === "t"; + + // #11217 - WebKit loses check when the name is after the checked attribute + input.setAttribute( "checked", "t" ); + input.setAttribute( "name", "t" ); + + fragment = document.createDocumentFragment(); + fragment.appendChild( input ); + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + support.appendChecked = input.checked; + + // WebKit doesn't clone checked state correctly in fragments + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE<9 + // Opera does not clone events (and typeof div.attachEvent === undefined). + // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() + if ( div.attachEvent ) { + div.attachEvent( "onclick", function() { + support.noCloneEvent = false; + }); + + div.cloneNode( true ).click(); + } + + // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event) + // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php + for ( i in { submit: true, change: true, focusin: true }) { + div.setAttribute( eventName = "on" + i, "t" ); + + support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false; + } + + div.style.backgroundClip = "content-box"; + div.cloneNode( true ).style.backgroundClip = ""; + support.clearCloneStyle = div.style.backgroundClip === "content-box"; + + // Run tests that need a body at doc ready + jQuery(function() { + var container, marginDiv, tds, + divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", + body = document.getElementsByTagName("body")[0]; + + if ( !body ) { + // Return for frameset docs that don't have a body + return; + } + + container = document.createElement("div"); + container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; + + body.appendChild( container ).appendChild( div ); + + // Support: IE8 + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; + tds = div.getElementsByTagName("td"); + tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; + isSupported = ( tds[ 0 ].offsetHeight === 0 ); + + tds[ 0 ].style.display = ""; + tds[ 1 ].style.display = "none"; + + // Support: IE8 + // Check if empty table cells still have offsetWidth/Height + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); + + // Check box-sizing and margin behavior + div.innerHTML = ""; + div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; + support.boxSizing = ( div.offsetWidth === 4 ); + support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); + + // Use window.getComputedStyle because jsdom on node.js will break without it. + if ( window.getComputedStyle ) { + support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; + support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; + + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. (#3333) + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + marginDiv = div.appendChild( document.createElement("div") ); + marginDiv.style.cssText = div.style.cssText = divReset; + marginDiv.style.marginRight = marginDiv.style.width = "0"; + div.style.width = "1px"; + + support.reliableMarginRight = + !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); + } + + if ( typeof div.style.zoom !== core_strundefined ) { + // Support: IE<8 + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + div.innerHTML = ""; + div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; + support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); + + // Support: IE6 + // Check if elements with layout shrink-wrap their children + div.style.display = "block"; + div.innerHTML = "<div></div>"; + div.firstChild.style.width = "5px"; + support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); + + if ( support.inlineBlockNeedsLayout ) { + // Prevent IE 6 from affecting layout for positioned elements #11048 + // Prevent IE from shrinking the body in IE 7 mode #12869 + // Support: IE<8 + body.style.zoom = 1; + } + } + + body.removeChild( container ); + + // Null elements to avoid leaks in IE + container = div = tds = marginDiv = null; + }); + + // Null elements to avoid leaks in IE + all = select = fragment = opt = a = input = null; + + return support; +})(); + +var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, + rmultiDash = /([A-Z])/g; + +function internalData( elem, name, data, pvt /* Internal Use Only */ ){ + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, ret, + internalKey = jQuery.expando, + getByName = typeof name === "string", + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { + return; + } + + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++; + } else { + id = internalKey; + } + } + + if ( !cache[ id ] ) { + cache[ id ] = {}; + + // Avoids exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + if ( !isNode ) { + cache[ id ].toJSON = jQuery.noop; + } + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } + + thisCache = cache[ id ]; + + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; + } + + thisCache = thisCache.data; + } + + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } + + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( getByName ) { + + // First Try to find as-is property data + ret = thisCache[ name ]; + + // Test for null|undefined property data + if ( ret == null ) { + + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } + + return ret; +} + +function internalRemoveData( elem, name, pvt ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var i, l, thisCache, + isNode = elem.nodeType, + + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + id = isNode ? elem[ jQuery.expando ] : jQuery.expando; + + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } + + if ( name ) { + + thisCache = pvt ? cache[ id ] : cache[ id ].data; + + if ( thisCache ) { + + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split(" "); + } + } + } else { + // If "name" is an array of keys... + // When data is initially created, via ("key", "val") signature, + // keys will be converted to camelCase. + // Since there is no way to tell _how_ a key was added, remove + // both plain key and camelCase key. #12786 + // This will only penalize the array argument path. + name = name.concat( jQuery.map( name, jQuery.camelCase ) ); + } + + for ( i = 0, l = name.length; i < l; i++ ) { + delete thisCache[ name[i] ]; + } + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject( cache[ id ] ) ) { + return; + } + } + + // Destroy the cache + if ( isNode ) { + jQuery.cleanData( [ elem ], true ); + + // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) + } else if ( jQuery.support.deleteExpando || cache != cache.window ) { + delete cache[ id ]; + + // When all else fails, null + } else { + cache[ id ] = null; + } +} + +jQuery.extend({ + cache: {}, + + // Unique for each copy of jQuery on the page + // Non-digits removed to match rinlinejQuery + expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), + + // The following elements throw uncatchable exceptions if you + // attempt to add expando properties to them. + noData: { + "embed": true, + // Ban all objects except for Flash (which handle expandos) + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", + "applet": true + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, + + data: function( elem, name, data ) { + return internalData( elem, name, data ); + }, + + removeData: function( elem, name ) { + return internalRemoveData( elem, name ); + }, + + // For internal use only. + _data: function( elem, name, data ) { + return internalData( elem, name, data, true ); + }, + + _removeData: function( elem, name ) { + return internalRemoveData( elem, name, true ); + }, + + // A method for determining if a DOM node can handle the data expando + acceptData: function( elem ) { + // Do not set data on non-element because it will not be cleared (#8335). + if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) { + return false; + } + + var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; + + // nodes accept data unless otherwise specified; rejection can be conditional + return !noData || noData !== true && elem.getAttribute("classid") === noData; + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var attrs, name, + elem = this[0], + i = 0, + data = null; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = jQuery.data( elem ); + + if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { + attrs = elem.attributes; + for ( ; i < attrs.length; i++ ) { + name = attrs[i].name; + + if ( !name.indexOf( "data-" ) ) { + name = jQuery.camelCase( name.slice(5) ); + + dataAttr( elem, name, data[ name ] ); + } + } + jQuery._data( elem, "parsedAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + return jQuery.access( this, function( value ) { + + if ( value === undefined ) { + // Try to fetch any internally stored data first + return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null; + } + + this.each(function() { + jQuery.data( this, key, value ); + }); + }, null, value, arguments.length > 1, null, true ); + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); + +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; +} + +// checks a cache object for emptiness +function isEmptyDataObject( obj ) { + var name; + for ( name in obj ) { + + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== "toJSON" ) { + return false; + } + } + + return true; +} +jQuery.extend({ + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || jQuery.isArray(data) ) { + queue = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + hooks.cur = fn; + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // not intended for public consumption - generates a queueHooks object, or returns the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return jQuery._data( elem, key ) || jQuery._data( elem, key, { + empty: jQuery.Callbacks("once memory").add(function() { + jQuery._removeData( elem, type + "queue" ); + jQuery._removeData( elem, key ); + }) + }); + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[0], type ); + } + + return data === undefined ? + this : + this.each(function() { + var queue = jQuery.queue( this, type, data ); + + // ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + // Based off of the plugin by Clint Helfers, with permission. + // http://blindsignals.com/index.php/2009/07/jquery-delay/ + delay: function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = setTimeout( next, time ); + hooks.stop = function() { + clearTimeout( timeout ); + }; + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while( i-- ) { + tmp = jQuery._data( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +}); +var nodeHook, boolHook, + rclass = /[\t\r\n]/g, + rreturn = /\r/g, + rfocusable = /^(?:input|select|textarea|button|object)$/i, + rclickable = /^(?:a|area)$/i, + rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i, + ruseDefault = /^(?:checked|selected)$/i, + getSetAttribute = jQuery.support.getSetAttribute, + getSetInput = jQuery.support.input; + +jQuery.fn.extend({ + attr: function( name, value ) { + return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each(function() { + jQuery.removeAttr( this, name ); + }); + }, + + prop: function( name, value ) { + return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + name = jQuery.propFix[ name ] || name; + return this.each(function() { + // try/catch handles cases where IE balks (such as removing a property on window) + try { + this[ name ] = undefined; + delete this[ name ]; + } catch( e ) {} + }); + }, + + addClass: function( value ) { + var classes, elem, cur, clazz, j, + i = 0, + len = this.length, + proceed = typeof value === "string" && value; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).addClass( value.call( this, j, this.className ) ); + }); + } + + if ( proceed ) { + // The disjunction here is for better compressibility (see removeClass) + classes = ( value || "" ).match( core_rnotwhite ) || []; + + for ( ; i < len; i++ ) { + elem = this[ i ]; + cur = elem.nodeType === 1 && ( elem.className ? + ( " " + elem.className + " " ).replace( rclass, " " ) : + " " + ); + + if ( cur ) { + j = 0; + while ( (clazz = classes[j++]) ) { + if ( cur.indexOf( " " + clazz + " " ) < 0 ) { + cur += clazz + " "; + } + } + elem.className = jQuery.trim( cur ); + + } + } + } + + return this; + }, + + removeClass: function( value ) { + var classes, elem, cur, clazz, j, + i = 0, + len = this.length, + proceed = arguments.length === 0 || typeof value === "string" && value; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).removeClass( value.call( this, j, this.className ) ); + }); + } + if ( proceed ) { + classes = ( value || "" ).match( core_rnotwhite ) || []; + + for ( ; i < len; i++ ) { + elem = this[ i ]; + // This expression is here for better compressibility (see addClass) + cur = elem.nodeType === 1 && ( elem.className ? + ( " " + elem.className + " " ).replace( rclass, " " ) : + "" + ); + + if ( cur ) { + j = 0; + while ( (clazz = classes[j++]) ) { + // Remove *all* instances + while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { + cur = cur.replace( " " + clazz + " ", " " ); + } + } + elem.className = value ? jQuery.trim( cur ) : ""; + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value, + isBool = typeof stateVal === "boolean"; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( i ) { + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); + }); + } + + return this.each(function() { + if ( type === "string" ) { + // toggle individual class names + var className, + i = 0, + self = jQuery( this ), + state = stateVal, + classNames = value.match( core_rnotwhite ) || []; + + while ( (className = classNames[ i++ ]) ) { + // check each className given, space separated list + state = isBool ? state : !self.hasClass( className ); + self[ state ? "addClass" : "removeClass" ]( className ); + } + + // Toggle whole class name + } else if ( type === core_strundefined || type === "boolean" ) { + if ( this.className ) { + // store className if set + jQuery._data( this, "__className__", this.className ); + } + + // If the element has a class name or if we're passed "false", + // then remove the whole classname (if there was one, the above saved it). + // Otherwise bring back whatever was previously saved (if anything), + // falling back to the empty string if nothing was stored. + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; + } + }); + }, + + hasClass: function( selector ) { + var className = " " + selector + " ", + i = 0, + l = this.length; + for ( ; i < l; i++ ) { + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { + return true; + } + } + + return false; + }, + + val: function( value ) { + var ret, hooks, isFunction, + elem = this[0]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { + return ret; + } + + ret = elem.value; + + return typeof ret === "string" ? + // handle most common string cases + ret.replace(rreturn, "") : + // handle cases where value is null/undef or number + ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each(function( i ) { + var val, + self = jQuery(this); + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, self.val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { + val += ""; + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map(val, function ( value ) { + return value == null ? "" : value + ""; + }); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + }); + } +}); + +jQuery.extend({ + valHooks: { + option: { + get: function( elem ) { + // attributes.value is undefined in Blackberry 4.7 but + // uses .value. See #6932 + var val = elem.attributes.value; + return !val || val.specified ? elem.value : elem.text; + } + }, + select: { + get: function( elem ) { + var value, option, + options = elem.options, + index = elem.selectedIndex, + one = elem.type === "select-one" || index < 0, + values = one ? null : [], + max = one ? index + 1 : options.length, + i = index < 0 ? + max : + one ? index : 0; + + // Loop through all the selected options + for ( ; i < max; i++ ) { + option = options[ i ]; + + // oldIE doesn't update selected after form reset (#2551) + if ( ( option.selected || i === index ) && + // Don't return options that are disabled or in a disabled optgroup + ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && + ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + }, + + set: function( elem, value ) { + var values = jQuery.makeArray( value ); + + jQuery(elem).find("option").each(function() { + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; + }); + + if ( !values.length ) { + elem.selectedIndex = -1; + } + return values; + } + } + }, + + attr: function( elem, name, value ) { + var hooks, notxml, ret, + nType = elem.nodeType; + + // don't get/set attributes on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === core_strundefined ) { + return jQuery.prop( elem, name, value ); + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + // All attributes are lowercase + // Grab necessary hook if one is defined + if ( notxml ) { + name = name.toLowerCase(); + hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); + } + + if ( value !== undefined ) { + + if ( value === null ) { + jQuery.removeAttr( elem, name ); + + } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + elem.setAttribute( name, value + "" ); + return value; + } + + } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + + // In IE9+, Flash objects don't have .getAttribute (#12945) + // Support: IE9+ + if ( typeof elem.getAttribute !== core_strundefined ) { + ret = elem.getAttribute( name ); + } + + // Non-existent attributes return null, we normalize to undefined + return ret == null ? + undefined : + ret; + } + }, + + removeAttr: function( elem, value ) { + var name, propName, + i = 0, + attrNames = value && value.match( core_rnotwhite ); + + if ( attrNames && elem.nodeType === 1 ) { + while ( (name = attrNames[i++]) ) { + propName = jQuery.propFix[ name ] || name; + + // Boolean attributes get special treatment (#10870) + if ( rboolean.test( name ) ) { + // Set corresponding property to false for boolean attributes + // Also clear defaultChecked/defaultSelected (if appropriate) for IE<8 + if ( !getSetAttribute && ruseDefault.test( name ) ) { + elem[ jQuery.camelCase( "default-" + name ) ] = + elem[ propName ] = false; + } else { + elem[ propName ] = false; + } + + // See #9699 for explanation of this approach (setting first, then removal) + } else { + jQuery.attr( elem, name, "" ); + } + + elem.removeAttribute( getSetAttribute ? name : propName ); + } + } + }, + + attrHooks: { + type: { + set: function( elem, value ) { + if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { + // Setting the type on a radio button after the value resets the value in IE6-9 + // Reset value to default in case type is set after value during creation + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + } + }, + + propFix: { + tabindex: "tabIndex", + readonly: "readOnly", + "for": "htmlFor", + "class": "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + cellpadding: "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + contenteditable: "contentEditable" + }, + + prop: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set properties on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + if ( notxml ) { + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + return ( elem[ name ] = value ); + } + + } else { + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + return elem[ name ]; + } + } + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + var attributeNode = elem.getAttributeNode("tabindex"); + + return attributeNode && attributeNode.specified ? + parseInt( attributeNode.value, 10 ) : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + undefined; + } + } + } +}); + +// Hook for boolean attributes +boolHook = { + get: function( elem, name ) { + var + // Use .prop to determine if this attribute is understood as boolean + prop = jQuery.prop( elem, name ), + + // Fetch it accordingly + attr = typeof prop === "boolean" && elem.getAttribute( name ), + detail = typeof prop === "boolean" ? + + getSetInput && getSetAttribute ? + attr != null : + // oldIE fabricates an empty string for missing boolean attributes + // and conflates checked/selected into attroperties + ruseDefault.test( name ) ? + elem[ jQuery.camelCase( "default-" + name ) ] : + !!attr : + + // fetch an attribute node for properties not recognized as boolean + elem.getAttributeNode( name ); + + return detail && detail.value !== false ? + name.toLowerCase() : + undefined; + }, + set: function( elem, value, name ) { + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { + // IE<8 needs the *property* name + elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); + + // Use defaultChecked and defaultSelected for oldIE + } else { + elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; + } + + return name; + } +}; + +// fix oldIE value attroperty +if ( !getSetInput || !getSetAttribute ) { + jQuery.attrHooks.value = { + get: function( elem, name ) { + var ret = elem.getAttributeNode( name ); + return jQuery.nodeName( elem, "input" ) ? + + // Ignore the value *property* by using defaultValue + elem.defaultValue : + + ret && ret.specified ? ret.value : undefined; + }, + set: function( elem, value, name ) { + if ( jQuery.nodeName( elem, "input" ) ) { + // Does not return so that setAttribute is also used + elem.defaultValue = value; + } else { + // Use nodeHook if defined (#1954); otherwise setAttribute is fine + return nodeHook && nodeHook.set( elem, value, name ); + } + } + }; +} + +// IE6/7 do not support getting/setting some attributes with get/setAttribute +if ( !getSetAttribute ) { + + // Use this for any attribute in IE6/7 + // This fixes almost every IE6/7 issue + nodeHook = jQuery.valHooks.button = { + get: function( elem, name ) { + var ret = elem.getAttributeNode( name ); + return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ? + ret.value : + undefined; + }, + set: function( elem, value, name ) { + // Set the existing or create a new attribute node + var ret = elem.getAttributeNode( name ); + if ( !ret ) { + elem.setAttributeNode( + (ret = elem.ownerDocument.createAttribute( name )) + ); + } + + ret.value = value += ""; + + // Break association with cloned elements by also using setAttribute (#9646) + return name === "value" || value === elem.getAttribute( name ) ? + value : + undefined; + } + }; + + // Set contenteditable to false on removals(#10429) + // Setting to empty string throws an error as an invalid value + jQuery.attrHooks.contenteditable = { + get: nodeHook.get, + set: function( elem, value, name ) { + nodeHook.set( elem, value === "" ? false : value, name ); + } + }; + + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) + // This is for removals + jQuery.each([ "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + set: function( elem, value ) { + if ( value === "" ) { + elem.setAttribute( name, "auto" ); + return value; + } + } + }); + }); +} + + +// Some attributes require a special call on IE +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !jQuery.support.hrefNormalized ) { + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + get: function( elem ) { + var ret = elem.getAttribute( name, 2 ); + return ret == null ? undefined : ret; + } + }); + }); + + // href/src property should get the full normalized URL (#10299/#12915) + jQuery.each([ "href", "src" ], function( i, name ) { + jQuery.propHooks[ name ] = { + get: function( elem ) { + return elem.getAttribute( name, 4 ); + } + }; + }); +} + +if ( !jQuery.support.style ) { + jQuery.attrHooks.style = { + get: function( elem ) { + // Return undefined in the case of empty string + // Note: IE uppercases css property names, but if we were to .toLowerCase() + // .cssText, that would destroy case senstitivity in URL's, like in "background" + return elem.style.cssText || undefined; + }, + set: function( elem, value ) { + return ( elem.style.cssText = value + "" ); + } + }; +} + +// Safari mis-reports the default selected property of an option +// Accessing the parent's selectedIndex property fixes it +if ( !jQuery.support.optSelected ) { + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { + get: function( elem ) { + var parent = elem.parentNode; + + if ( parent ) { + parent.selectedIndex; + + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + return null; + } + }); +} + +// IE6/7 call enctype encoding +if ( !jQuery.support.enctype ) { + jQuery.propFix.enctype = "encoding"; +} + +// Radios and checkboxes getter/setter +if ( !jQuery.support.checkOn ) { + jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + get: function( elem ) { + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + } + }; + }); +} +jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); + } + } + }); +}); +var rformElems = /^(?:input|select|textarea)$/i, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + var tmp, events, t, handleObjIn, + special, eventHandle, handleObj, + handlers, type, namespaces, origType, + elemData = jQuery._data( elem ); + + // Don't attach events to noData or text/comment nodes (but allow plain objects) + if ( !elemData ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !(events = elemData.events) ) { + events = elemData.events = {}; + } + if ( !(eventHandle = elemData.handle) ) { + eventHandle = elemData.handle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + // jQuery(...).bind("mouseover mouseout", fn); + types = ( types || "" ).match( core_rnotwhite ) || [""]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !(handlers = events[ type ]) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + var j, handleObj, tmp, + origCount, t, events, + special, handlers, type, + namespaces, origType, + elemData = jQuery.hasData( elem ) && jQuery._data( elem ); + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( core_rnotwhite ) || [""]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + delete elemData.handle; + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery._removeData( elem, "events" ); + } + }, + + trigger: function( event, data, elem, onlyHandlers ) { + var handle, ontype, cur, + bubbleType, special, tmp, i, + eventPath = [ elem || document ], + type = core_hasOwn.call( event, "type" ) ? event.type : event, + namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; + + cur = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf(".") >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf(":") < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + event.isTrigger = true; + event.namespace = namespaces.join("."); + event.namespace_re = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === (elem.ownerDocument || document) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { + + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { + event.preventDefault(); + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && + !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + try { + elem[ type ](); + } catch ( e ) { + // IE<9 dies on focus/blur to hidden element (#1486,#12518) + // only reproducible on winXP IE8 native, not IE9 in IE8 mode + } + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event ); + + var i, ret, handleObj, matched, j, + handlerQueue = [], + args = core_slice.call( arguments ), + handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( (event.result = ret) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var sel, handleObj, matches, i, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Find delegate handlers + // Black-hole SVG <use> instance trees (#13180) + // Avoid non-left-click bubbling in Firefox (#3861) + if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { + + for ( ; cur != this; cur = cur.parentNode || this ) { + + // Don't check non-elements (#13208) + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matches[ sel ] === undefined ) { + matches[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) >= 0 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matches[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, handlers: matches }); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( delegateCount < handlers.length ) { + handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); + } + + return handlerQueue; + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, copy, + type = event.type, + originalEvent = event, + fixHook = this.fixHooks[ type ]; + + if ( !fixHook ) { + this.fixHooks[ type ] = fixHook = + rmouseEvent.test( type ) ? this.mouseHooks : + rkeyEvent.test( type ) ? this.keyHooks : + {}; + } + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = new jQuery.Event( originalEvent ); + + i = copy.length; + while ( i-- ) { + prop = copy[ i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Support: IE<9 + // Fix target property (#1925) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Support: Chrome 23+, Safari? + // Target should not be a text node (#504, #13143) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // Support: IE<9 + // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) + event.metaKey = !!event.metaKey; + + return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var body, eventDoc, doc, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + special: { + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + click: { + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { + this.click(); + return false; + } + } + }, + focus: { + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== document.activeElement && this.focus ) { + try { + this.focus(); + return false; + } catch ( e ) { + // Support: IE<9 + // If we error on focus to hidden element (#1486, #12518), + // let .trigger() run the handlers + } + } + }, + delegateType: "focusin" + }, + blur: { + trigger: function() { + if ( this === document.activeElement && this.blur ) { + this.blur(); + return false; + } + }, + delegateType: "focusout" + }, + + beforeunload: { + postDispatch: function( event ) { + + // Even when returnValue equals to undefined Firefox will still show alert + if ( event.result !== undefined ) { + event.originalEvent.returnValue = event.result; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + var name = "on" + type; + + if ( elem.detachEvent ) { + + // #8545, #7054, preventing memory leaks for custom events in IE6-8 + // detachEvent needed property on element, by name of that event, to properly expose it to GC + if ( typeof elem[ name ] === core_strundefined ) { + elem[ name ] = null; + } + + elem.detachEvent( name, handle ); + } + }; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || + src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + if ( !e ) { + return; + } + + // If preventDefault exists, run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // Support: IE + // Otherwise set the returnValue property of the original event to false + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + if ( !e ) { + return; + } + // If stopPropagation exists, run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + + // Support: IE + // Set the cancelBubble property of the original event to true + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + } +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// IE submit delegation +if ( !jQuery.support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !jQuery._data( form, "submitBubbles" ) ) { + jQuery.event.add( form, "submit._submit", function( event ) { + event._submit_bubble = true; + }); + jQuery._data( form, "submitBubbles", true ); + } + }); + // return undefined since we don't need an event listener + }, + + postDispatch: function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( event._submit_bubble ) { + delete event._submit_bubble; + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + } + }, + + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; +} + +// IE change delegation and checkbox/radio fix +if ( !jQuery.support.changeBubbles ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + } + // Allow triggered, simulated change events (#11500) + jQuery.event.simulate( "change", this, event, true ); + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + jQuery._data( elem, "changeBubbles", true ); + } + }); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); + + return !rformElems.test( this.nodeName ); + } + }; +} + +// Create "bubbling" focus and blur events +if ( !jQuery.support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler while someone wants focusin/focusout + var attaches = 0, + handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + if ( attaches++ === 0 ) { + document.addEventListener( orig, handler, true ); + } + }, + teardown: function() { + if ( --attaches === 0 ) { + document.removeEventListener( orig, handler, true ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var type, origFn; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on( types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + bind: function( types, data, fn ) { + return this.on( types, null, data, fn ); + }, + unbind: function( types, fn ) { + return this.off( types, null, fn ); + }, + + delegate: function( selector, types, data, fn ) { + return this.on( types, selector, data, fn ); + }, + undelegate: function( selector, types, fn ) { + // ( namespace ) or ( selector, types [, fn] ) + return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + var elem = this[0]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } +}); +/*! + * Sizzle CSS Selector Engine + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license + * http://sizzlejs.com/ + */ +(function( window, undefined ) { + +var i, + cachedruns, + Expr, + getText, + isXML, + compile, + hasDuplicate, + outermostContext, + + // Local document vars + setDocument, + document, + docElem, + documentIsXML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + sortOrder, + + // Instance-specific data + expando = "sizzle" + -(new Date()), + preferredDoc = window.document, + support = {}, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + + // General-purpose constants + strundefined = typeof undefined, + MAX_NEGATIVE = 1 << 31, + + // Array methods + arr = [], + pop = arr.pop, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf if we can't use a native one + indexOf = arr.indexOf || function( elem ) { + var i = 0, + len = this.length; + for ( ; i < len; i++ ) { + if ( this[i] === elem ) { + return i; + } + } + return -1; + }, + + + // Regular expressions + + // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + // http://www.w3.org/TR/css3-syntax/#characters + characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", + + // Loosely modeled on CSS identifier characters + // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors + // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = characterEncoding.replace( "w", "w#" ), + + // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors + operators = "([*^$|!~]?=)", + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", + + // Prefer arguments quoted, + // then not containing pseudos/brackets, + // then attribute selectors/non-parenthetical expressions, + // then anything else + // These preferences are here to reduce the number of selectors + // needing tokenize in the PSEUDO preFilter + pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + characterEncoding + ")" ), + "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), + "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), + "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rsibling = /[\x20\t\r\n\f]*[+~]/, + + rnative = /^[^{]+\{\s*\[native code/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rescape = /'|\\/g, + rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, + + // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g, + funescape = function( _, escaped ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + return high !== high ? + escaped : + // BMP codepoint + high < 0 ? + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }; + +// Use a stripped-down slice if we can't use a native one +try { + slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType; +} catch ( e ) { + slice = function( i ) { + var elem, + results = []; + while ( (elem = this[i++]) ) { + results.push( elem ); + } + return results; + }; +} + +/** + * For feature detection + * @param {Function} fn The function to test for native support + */ +function isNative( fn ) { + return rnative.test( fn + "" ); +} + +/** + * Create key-value caches of limited size + * @returns {Function(string, Object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var cache, + keys = []; + + return (cache = function( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key += " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key ] = value); + }); +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created div and expects a boolean result + */ +function assert( fn ) { + var div = document.createElement("div"); + + try { + return fn( div ); + } catch (e) { + return false; + } finally { + // release memory in IE + div = null; + } +} + +function Sizzle( selector, context, results, seed ) { + var match, elem, m, nodeType, + // QSA vars + i, groups, old, nid, newContext, newSelector; + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + + context = context || document; + results = results || []; + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { + return []; + } + + if ( !documentIsXML && !seed ) { + + // Shortcuts + if ( (match = rquickExpr.exec( selector )) ) { + // Speed-up: Sizzle("#ID") + if ( (m = match[1]) ) { + if ( nodeType === 9 ) { + elem = context.getElementById( m ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE, Opera, and Webkit return items + // by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + } else { + // Context is not a document + if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && + contains( context, elem ) && elem.id === m ) { + results.push( elem ); + return results; + } + } + + // Speed-up: Sizzle("TAG") + } else if ( match[2] ) { + push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); + return results; + + // Speed-up: Sizzle(".CLASS") + } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) { + push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); + return results; + } + } + + // QSA path + if ( support.qsa && !rbuggyQSA.test(selector) ) { + old = true; + nid = expando; + newContext = context; + newSelector = nodeType === 9 && selector; + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + groups = tokenize( selector ); + + if ( (old = context.getAttribute("id")) ) { + nid = old.replace( rescape, "\\$&" ); + } else { + context.setAttribute( "id", nid ); + } + nid = "[id='" + nid + "'] "; + + i = groups.length; + while ( i-- ) { + groups[i] = nid + toSelector( groups[i] ); + } + newContext = rsibling.test( selector ) && context.parentNode || context; + newSelector = groups.join(","); + } + + if ( newSelector ) { + try { + push.apply( results, slice.call( newContext.querySelectorAll( + newSelector + ), 0 ) ); + return results; + } catch(qsaError) { + } finally { + if ( !old ) { + context.removeAttribute("id"); + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Detect xml + * @param {Element|Object} elem An element or a document + */ +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [doc] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +setDocument = Sizzle.setDocument = function( node ) { + var doc = node ? node.ownerDocument || node : preferredDoc; + + // If no document and documentElement is available, return + if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Set our document + document = doc; + docElem = doc.documentElement; + + // Support tests + documentIsXML = isXML( doc ); + + // Check if getElementsByTagName("*") returns only elements + support.tagNameNoComments = assert(function( div ) { + div.appendChild( doc.createComment("") ); + return !div.getElementsByTagName("*").length; + }); + + // Check if attributes should be retrieved by attribute nodes + support.attributes = assert(function( div ) { + div.innerHTML = "<select></select>"; + var type = typeof div.lastChild.getAttribute("multiple"); + // IE8 returns a string for some attributes even when not present + return type !== "boolean" && type !== "string"; + }); + + // Check if getElementsByClassName can be trusted + support.getByClassName = assert(function( div ) { + // Opera can't find a second classname (in 9.6) + div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>"; + if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { + return false; + } + + // Safari 3.2 caches class attributes and doesn't catch changes + div.lastChild.className = "e"; + return div.getElementsByClassName("e").length === 2; + }); + + // Check if getElementById returns elements by name + // Check if getElementsByName privileges form controls or returns elements by ID + support.getByName = assert(function( div ) { + // Inject content + div.id = expando + 0; + div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>"; + docElem.insertBefore( div, docElem.firstChild ); + + // Test + var pass = doc.getElementsByName && + // buggy browsers will return fewer than the correct 2 + doc.getElementsByName( expando ).length === 2 + + // buggy browsers will return more than the correct 0 + doc.getElementsByName( expando + 0 ).length; + support.getIdNotName = !doc.getElementById( expando ); + + // Cleanup + docElem.removeChild( div ); + + return pass; + }); + + // IE6/7 return modified attributes + Expr.attrHandle = assert(function( div ) { + div.innerHTML = "<a href='#'></a>"; + return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && + div.firstChild.getAttribute("href") === "#"; + }) ? + {} : + { + "href": function( elem ) { + return elem.getAttribute( "href", 2 ); + }, + "type": function( elem ) { + return elem.getAttribute("type"); + } + }; + + // ID find and filter + if ( support.getIdNotName ) { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== strundefined && !documentIsXML ) { + var m = context.getElementById( id ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; + } + }; + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute("id") === attrId; + }; + }; + } else { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== strundefined && !documentIsXML ) { + var m = context.getElementById( id ); + + return m ? + m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? + [m] : + undefined : + []; + } + }; + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); + return node && node.value === attrId; + }; + }; + } + + // Tag + Expr.find["TAG"] = support.tagNameNoComments ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== strundefined ) { + return context.getElementsByTagName( tag ); + } + } : + function( tag, context ) { + var elem, + tmp = [], + i = 0, + results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + while ( (elem = results[i++]) ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Name + Expr.find["NAME"] = support.getByName && function( tag, context ) { + if ( typeof context.getElementsByName !== strundefined ) { + return context.getElementsByName( name ); + } + }; + + // Class + Expr.find["CLASS"] = support.getByClassName && function( className, context ) { + if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) { + return context.getElementsByClassName( className ); + } + }; + + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21), + // no need to also add to buggyMatches since matches checks buggyQSA + // A support test would require too much code (would include document ready) + rbuggyQSA = [ ":focus" ]; + + if ( (support.qsa = isNative(doc.querySelectorAll)) ) { + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( div ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explictly + // setting a boolean content attribute, + // since its presence should be enough + // http://bugs.jquery.com/ticket/12359 + div.innerHTML = "<select><option selected=''></option></select>"; + + // IE8 - Some boolean attributes are not treated correctly + if ( !div.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + }); + + assert(function( div ) { + + // Opera 10-12/IE8 - ^= $= *= and empty values + // Should not select anything + div.innerHTML = "<input type='hidden' i=''/>"; + if ( div.querySelectorAll("[i^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":enabled").length ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Opera 10-11 does not throw on post-comma invalid pseudos + div.querySelectorAll("*,:x"); + rbuggyQSA.push(",.*:"); + }); + } + + if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector || + docElem.mozMatchesSelector || + docElem.webkitMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector) )) ) { + + assert(function( div ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( div, "div" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( div, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + }); + } + + rbuggyQSA = new RegExp( rbuggyQSA.join("|") ); + rbuggyMatches = new RegExp( rbuggyMatches.join("|") ); + + // Element contains another + // Purposefully does not implement inclusive descendent + // As in, an element does not contain itself + contains = isNative(docElem.contains) || docElem.compareDocumentPosition ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + // Document order sorting + sortOrder = docElem.compareDocumentPosition ? + function( a, b ) { + var compare; + + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) { + if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) { + if ( a === doc || contains( preferredDoc, a ) ) { + return -1; + } + if ( b === doc || contains( preferredDoc, b ) ) { + return 1; + } + return 0; + } + return compare & 4 ? -1 : 1; + } + + return a.compareDocumentPosition ? -1 : 1; + } : + function( a, b ) { + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + + // Parentless nodes are either documents or disconnected + } else if ( !aup || !bup ) { + return a === doc ? -1 : + b === doc ? 1 : + aup ? -1 : + bup ? 1 : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( (cur = cur.parentNode) ) { + ap.unshift( cur ); + } + cur = b; + while ( (cur = cur.parentNode) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[i] === bp[i] ) { + i++; + } + + return i ? + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[i], bp[i] ) : + + // Otherwise nodes in our document sort first + ap[i] === preferredDoc ? -1 : + bp[i] === preferredDoc ? 1 : + 0; + }; + + // Always assume the presence of duplicates if sort doesn't + // pass them to our comparison function (as in Google Chrome). + hasDuplicate = false; + [0, 0].sort( sortOrder ); + support.detectDuplicates = hasDuplicate; + + return document; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + // rbuggyQSA always contains :focus, so no need for an existence check + if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) { + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch(e) {} + } + + return Sizzle( expr, document, null, [elem] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + // Set document vars if needed + if ( ( context.ownerDocument || context ) !== document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + var val; + + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + if ( !documentIsXML ) { + name = name.toLowerCase(); + } + if ( (val = Expr.attrHandle[ name ]) ) { + return val( elem ); + } + if ( documentIsXML || support.attributes ) { + return elem.getAttribute( name ); + } + return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ? + name : + val && val.specified ? val.value : null; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +// Document sorting and removing duplicates +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + i = 1, + j = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + results.sort( sortOrder ); + + if ( hasDuplicate ) { + for ( ; (elem = results[i]); i++ ) { + if ( elem === results[ i - 1 ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + return results; +}; + +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +// Returns a function to use in pseudos for input types +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +// Returns a function to use in pseudos for buttons +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +// Returns a function to use in pseudos for positionals +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + // If no nodeType, this is expected to be an array + for ( ; (node = elem[i]); i++ ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (see #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1].slice( 0, 3 ) === "nth" ) { + // nth-* requires argument + if ( !match[3] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); + match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); + + // other types prohibit arguments + } else if ( match[3] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[5] && match[2]; + + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[4] ) { + match[2] = match[4]; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + match[0] = match[0].slice( 0, excess ); + match[2] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeName ) { + if ( nodeName === "*" ) { + return function() { return true; }; + } + + nodeName = nodeName.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.slice( -check.length ) === check : + operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, what, argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, context, xml ) { + var cache, outerCache, node, diff, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( (node = node[ dir ]) ) { + if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { + return false; + } + } + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + // Seek `elem` from a previously-cached index + outerCache = parent[ expando ] || (parent[ expando ] = {}); + cache = outerCache[ type ] || []; + nodeIndex = cache[0] === dirruns && cache[1]; + diff = cache[0] === dirruns && cache[2]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( (node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + (diff = nodeIndex = 0) || start.pop()) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + outerCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + // Use previously-cached element index if available + } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { + diff = cache[1]; + + // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) + } else { + // Use the same loop as above to seek `elem` from the start + while ( (node = ++nodeIndex && node && node[ dir ] || + (diff = nodeIndex = 0) || start.pop()) ) { + + if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { + // Cache the index of each encountered element + if ( useCache ) { + (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf.call( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + // Potentially complex pseudos + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + // lang value must be a valid identifider + if ( !ridentifier.test(lang || "") ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( (elemLang = documentIsXML ? + elem.getAttribute("xml:lang") || elem.getAttribute("lang") : + elem.lang) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); + return false; + }; + }), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + // Boolean properties + "enabled": function( elem ) { + return elem.disabled === false; + }, + + "disabled": function( elem ) { + return elem.disabled === true; + }, + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), + // not comment, processing instructions, or others + // Thanks to Diego Perini for the nodeName shortcut + // Greater than "@" means alpha characters (specifically not starting with "#" or "?") + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) + // use getAttribute instead to test this case + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); + }, + + // Position-in-collection + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +function tokenize( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( tokens = [] ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + matched = match.shift(); + tokens.push( { + value: matched, + // Cast descendant combinators to space + type: match[0].replace( rtrim, " " ) + } ); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + matched = match.shift(); + tokens.push( { + value: matched, + type: type, + matches: match + } ); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +} + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[i].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + checkNonElements = base && dir === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var data, cache, outerCache, + dirkey = dirruns + " " + doneName; + + // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching + if ( xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || (elem[ expando ] = {}); + if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { + if ( (data = cache[1]) === true || data === cachedruns ) { + return data === true; + } + } else { + cache = outerCache[ dir ] = [ dirkey ]; + cache[1] = matcher( elem, context, xml ) || cachedruns; + if ( cache[1] === true ) { + return true; + } + } + } + } + } + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf.call( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + // A counter to specify which element is currently being matched + var matcherCachedRuns = 0, + bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, expandContext ) { + var elem, j, matcher, + setMatched = [], + matchedCount = 0, + i = "0", + unmatched = seed && [], + outermost = expandContext != null, + contextBackup = outermostContext, + // We must always have either seed elements or context + elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), + // Use integer dirruns iff this is the outermost matcher + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); + + if ( outermost ) { + outermostContext = context !== document && context; + cachedruns = matcherCachedRuns; + } + + // Add elements passing elementMatchers directly to results + // Keep `i` a string if there are no elements so `matchedCount` will be "00" below + for ( ; (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + while ( (matcher = elementMatchers[j++]) ) { + if ( matcher( elem, context, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + cachedruns = ++matcherCachedRuns; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // Apply set filters to unmatched elements + matchedCount += i; + if ( bySet && i !== matchedCount ) { + j = 0; + while ( (matcher = setMatchers[j++]) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !group ) { + group = tokenize( selector ); + } + i = group.length; + while ( i-- ) { + cached = matcherFromTokens( group[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + } + return cached; +}; + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function select( selector, context, results, seed ) { + var i, tokens, token, type, find, + match = tokenize( selector ); + + if ( !seed ) { + // Try to minimize operations if there is only one group + if ( match.length === 1 ) { + + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + context.nodeType === 9 && !documentIsXML && + Expr.relative[ tokens[1].type ] ) { + + context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0]; + if ( !context ) { + return results; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && context.parentNode || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, slice.call( seed, 0 ) ); + return results; + } + + break; + } + } + } + } + } + + // Compile and execute a filtering function + // Provide `match` to avoid retokenization if we modified the selector above + compile( selector, match )( + seed, + context, + documentIsXML, + results, + rsibling.test( selector ) + ); + return results; +} + +// Deprecated +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Easy API for creating new setFilters +function setFilters() {} +Expr.filters = setFilters.prototype = Expr.pseudos; +Expr.setFilters = new setFilters(); + +// Initialize with the default document +setDocument(); + +// Override sizzle attribute retrieval +Sizzle.attr = jQuery.attr; +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.pseudos; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + +})( window ); +var runtil = /Until$/, + rparentsprev = /^(?:parents|prev(?:Until|All))/, + isSimple = /^.[^:#\[\.,]*$/, + rneedsContext = jQuery.expr.match.needsContext, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend({ + find: function( selector ) { + var i, ret, self, + len = this.length; + + if ( typeof selector !== "string" ) { + self = this; + return this.pushStack( jQuery( selector ).filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }) ); + } + + ret = []; + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, this[ i ], ret ); + } + + // Needed because $( selector, context ) becomes $( context ).find( selector ) + ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); + ret.selector = ( this.selector ? this.selector + " " : "" ) + selector; + return ret; + }, + + has: function( target ) { + var i, + targets = jQuery( target, this ), + len = targets.length; + + return this.filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + not: function( selector ) { + return this.pushStack( winnow(this, selector, false) ); + }, + + filter: function( selector ) { + return this.pushStack( winnow(this, selector, true) ); + }, + + is: function( selector ) { + return !!selector && ( + typeof selector === "string" ? + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + rneedsContext.test( selector ) ? + jQuery( selector, this.context ).index( this[0] ) >= 0 : + jQuery.filter( selector, this ).length > 0 : + this.filter( selector ).length > 0 ); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + ret = [], + pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( ; i < l; i++ ) { + cur = this[i]; + + while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { + if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { + ret.push( cur ); + break; + } + cur = cur.parentNode; + } + } + + return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; + } + + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + var set = typeof selector === "string" ? + jQuery( selector, context ) : + jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), + all = jQuery.merge( this.get(), set ); + + return this.pushStack( jQuery.unique(all) ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter(selector) + ); + } +}); + +jQuery.fn.andSelf = jQuery.fn.addBack; + +function sibling( cur, dir ) { + do { + cur = cur[ dir ]; + } while ( cur && cur.nodeType !== 1 ); + + return cur; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( !runtil.test( name ) ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; + + if ( this.length > 1 && rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + + return this.pushStack( ret ); + }; +}); + +jQuery.extend({ + filter: function( expr, elems, not ) { + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 ? + jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : + jQuery.find.matches(expr, elems); + }, + + dir: function( elem, dir, until ) { + var matched = [], + cur = elem[ dir ]; + + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, keep ) { + + // Can't pass null or undefined to indexOf in Firefox 4 + // Set to 0 to skip string check + qualifier = qualifier || 0; + + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep(elements, function( elem, i ) { + var retVal = !!qualifier.call( elem, i, elem ); + return retVal === keep; + }); + + } else if ( qualifier.nodeType ) { + return jQuery.grep(elements, function( elem ) { + return ( elem === qualifier ) === keep; + }); + + } else if ( typeof qualifier === "string" ) { + var filtered = jQuery.grep(elements, function( elem ) { + return elem.nodeType === 1; + }); + + if ( isSimple.test( qualifier ) ) { + return jQuery.filter(qualifier, filtered, !keep); + } else { + qualifier = jQuery.filter( qualifier, filtered ); + } + } + + return jQuery.grep(elements, function( elem ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; + }); +} +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, + rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + rtagName = /<([\w:]+)/, + rtbody = /<tbody/i, + rhtml = /<|&#?\w+;/, + rnoInnerhtml = /<(?:script|style|link)/i, + manipulation_rcheckableType = /^(?:checkbox|radio)$/i, + // checked="checked" or checked + rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, + rscriptType = /^$|\/(?:java|ecma)script/i, + rscriptTypeMasked = /^true\/(.*)/, + rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, + + // We have to close these tags to support XHTML (#13200) + wrapMap = { + option: [ 1, "<select multiple='multiple'>", "</select>" ], + legend: [ 1, "<fieldset>", "</fieldset>" ], + area: [ 1, "<map>", "</map>" ], + param: [ 1, "<object>", "</object>" ], + thead: [ 1, "<table>", "</table>" ], + tr: [ 2, "<table><tbody>", "</tbody></table>" ], + col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], + td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], + + // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, + // unless wrapped in a div with non-breaking characters in front of it. + _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ] + }, + safeFragment = createSafeFragment( document ), + fragmentDiv = safeFragment.appendChild( document.createElement("div") ); + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +jQuery.fn.extend({ + text: function( value ) { + return jQuery.access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); + }, null, value, arguments.length ); + }, + + wrapAll: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapAll( html.call(this, i) ); + }); + } + + if ( this[0] ) { + // The elements to wrap the target around + var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); + + if ( this[0].parentNode ) { + wrap.insertBefore( this[0] ); + } + + wrap.map(function() { + var elem = this; + + while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { + elem = elem.firstChild; + } + + return elem; + }).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapInner( html.call(this, i) ); + }); + } + + return this.each(function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + }); + }, + + wrap: function( html ) { + var isFunction = jQuery.isFunction( html ); + + return this.each(function(i) { + jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); + }); + }, + + unwrap: function() { + return this.parent().each(function() { + if ( !jQuery.nodeName( this, "body" ) ) { + jQuery( this ).replaceWith( this.childNodes ); + } + }).end(); + }, + + append: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.insertBefore( elem, this.firstChild ); + } + }); + }, + + before: function() { + return this.domManip( arguments, false, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + }); + }, + + after: function() { + return this.domManip( arguments, false, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + }); + }, + + // keepData is for internal use only--do not document + remove: function( selector, keepData ) { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) { + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem ) ); + } + + if ( elem.parentNode ) { + if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { + setGlobalEval( getAll( elem, "script" ) ); + } + elem.parentNode.removeChild( elem ); + } + } + } + + return this; + }, + + empty: function() { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + } + + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } + + // If this is a select, ensure that it displays empty (#12336) + // Support: IE<9 + if ( elem.options && jQuery.nodeName( elem, "select" ) ) { + elem.options.length = 0; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function () { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, + + html: function( value ) { + return jQuery.access( this, function( value ) { + var elem = this[0] || {}, + i = 0, + l = this.length; + + if ( value === undefined ) { + return elem.nodeType === 1 ? + elem.innerHTML.replace( rinlinejQuery, "" ) : + undefined; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && + ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && + !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { + + value = value.replace( rxhtmlTag, "<$1></$2>" ); + + try { + for (; i < l; i++ ) { + // Remove element nodes and prevent memory leaks + elem = this[i] || {}; + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch(e) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function( value ) { + var isFunc = jQuery.isFunction( value ); + + // Make sure that the elements are removed from the DOM before they are inserted + // this can help fix replacing a parent with child elements + if ( !isFunc && typeof value !== "string" ) { + value = jQuery( value ).not( this ).detach(); + } + + return this.domManip( [ value ], true, function( elem ) { + var next = this.nextSibling, + parent = this.parentNode; + + if ( parent ) { + jQuery( this ).remove(); + parent.insertBefore( elem, next ); + } + }); + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, table, callback ) { + + // Flatten any nested arrays + args = core_concat.apply( [], args ); + + var first, node, hasScripts, + scripts, doc, fragment, + i = 0, + l = this.length, + set = this, + iNoClone = l - 1, + value = args[0], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { + return this.each(function( index ) { + var self = set.eq( index ); + if ( isFunction ) { + args[0] = value.call( this, index, table ? self.html() : undefined ); + } + self.domManip( args, table, callback ); + }); + } + + if ( l ) { + fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + if ( first ) { + table = table && jQuery.nodeName( first, "tr" ); + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( + table && jQuery.nodeName( this[i], "table" ) ? + findOrAppend( this[i], "tbody" ) : + this[i], + node, + i + ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { + + if ( node.src ) { + // Hope ajax is available... + jQuery.ajax({ + url: node.src, + type: "GET", + dataType: "script", + async: false, + global: false, + "throws": true + }); + } else { + jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); + } + } + } + } + + // Fix #11809: Avoid leaking memory + fragment = first = null; + } + } + + return this; + } +}); + +function findOrAppend( elem, tag ) { + return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + var attr = elem.getAttributeNode("type"); + elem.type = ( attr && attr.specified ) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + if ( match ) { + elem.type = match[1]; + } else { + elem.removeAttribute("type"); + } + return elem; +} + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var elem, + i = 0; + for ( ; (elem = elems[i]) != null; i++ ) { + jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); + } +} + +function cloneCopyEvent( src, dest ) { + + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } + + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; + + if ( events ) { + delete curData.handle; + curData.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } +} + +function fixCloneNodeIssues( src, dest ) { + var nodeName, e, data; + + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } + + nodeName = dest.nodeName.toLowerCase(); + + // IE6-8 copies events bound via attachEvent when using cloneNode. + if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { + data = jQuery._data( dest ); + + for ( e in data.events ) { + jQuery.removeEvent( dest, e, data.handle ); + } + + // Event data gets referenced instead of copied if the expando gets copied too + dest.removeAttribute( jQuery.expando ); + } + + // IE blanks contents when cloning scripts, and tries to evaluate newly-set text + if ( nodeName === "script" && dest.text !== src.text ) { + disableScript( dest ).text = src.text; + restoreScript( dest ); + + // IE6-10 improperly clones children of object elements using classid. + // IE10 throws NoModificationAllowedError if parent is null, #12132. + } else if ( nodeName === "object" ) { + if ( dest.parentNode ) { + dest.outerHTML = src.outerHTML; + } + + // This path appears unavoidable for IE9. When cloning an object + // element in IE9, the outerHTML strategy above is not sufficient. + // If the src has innerHTML and the destination does not, + // copy the src.innerHTML into the dest.innerHTML. #10324 + if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { + dest.innerHTML = src.innerHTML; + } + + } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { + // IE6-8 fails to persist the checked state of a cloned checkbox + // or radio button. Worse, IE6-7 fail to give the cloned element + // a checked appearance if the defaultChecked value isn't also set + + dest.defaultChecked = dest.checked = src.checked; + + // IE6-7 get confused and end up setting the value of a cloned + // checkbox/radio button to an empty string instead of "on" + if ( dest.value !== src.value ) { + dest.value = src.value; + } + + // IE6-8 fails to return the selected option to the default selected + // state when cloning options + } else if ( nodeName === "option" ) { + dest.defaultSelected = dest.selected = src.defaultSelected; + + // IE6-8 fails to set the defaultValue to the correct value when + // cloning other types of input fields + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + i = 0, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone(true); + jQuery( insert[i] )[ original ]( elems ); + + // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() + core_push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +}); + +function getAll( context, tag ) { + var elems, elem, + i = 0, + found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) : + typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) : + undefined; + + if ( !found ) { + for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { + if ( !tag || jQuery.nodeName( elem, tag ) ) { + found.push( elem ); + } else { + jQuery.merge( found, getAll( elem, tag ) ); + } + } + } + + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], found ) : + found; +} + +// Used in buildFragment, fixes the defaultChecked property +function fixDefaultChecked( elem ) { + if ( manipulation_rcheckableType.test( elem.type ) ) { + elem.defaultChecked = elem.checked; + } +} + +jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var destElements, node, clone, i, srcElements, + inPage = jQuery.contains( elem.ownerDocument, elem ); + + if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { + clone = elem.cloneNode( true ); + + // IE<=8 does not properly clone detached, unknown element nodes + } else { + fragmentDiv.innerHTML = elem.outerHTML; + fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); + } + + if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && + (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { + + // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + // Fix all IE cloning issues + for ( i = 0; (node = srcElements[i]) != null; ++i ) { + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + fixCloneNodeIssues( node, destElements[i] ); + } + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0; (node = srcElements[i]) != null; i++ ) { + cloneCopyEvent( node, destElements[i] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + destElements = srcElements = node = null; + + // Return the cloned set + return clone; + }, + + buildFragment: function( elems, context, scripts, selection ) { + var j, elem, contains, + tmp, tag, tbody, wrap, + l = elems.length, + + // Ensure a safe fragment + safe = createSafeFragment( context ), + + nodes = [], + i = 0; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || safe.appendChild( context.createElement("div") ); + + // Deserialize a standard representation + tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + + tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2]; + + // Descend through wrappers to the right content + j = wrap[0]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Manually add leading whitespace removed by IE + if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); + } + + // Remove IE's autoinserted <tbody> from table fragments + if ( !jQuery.support.tbody ) { + + // String was a <table>, *may* have spurious <tbody> + elem = tag === "table" && !rtbody.test( elem ) ? + tmp.firstChild : + + // String was a bare <thead> or <tfoot> + wrap[1] === "<table>" && !rtbody.test( elem ) ? + tmp : + 0; + + j = elem && elem.childNodes.length; + while ( j-- ) { + if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { + elem.removeChild( tbody ); + } + } + } + + jQuery.merge( nodes, tmp.childNodes ); + + // Fix #12392 for WebKit and IE > 9 + tmp.textContent = ""; + + // Fix #12392 for oldIE + while ( tmp.firstChild ) { + tmp.removeChild( tmp.firstChild ); + } + + // Remember the top-level container for proper cleanup + tmp = safe.lastChild; + } + } + } + + // Fix #11356: Clear elements from fragment + if ( tmp ) { + safe.removeChild( tmp ); + } + + // Reset defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + if ( !jQuery.support.appendChecked ) { + jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); + } + + i = 0; + while ( (elem = nodes[ i++ ]) ) { + + // #4087 - If origin and destination elements are the same, and this is + // that element, do not do anything + if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( safe.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( (elem = tmp[ j++ ]) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + tmp = null; + + return safe; + }, + + cleanData: function( elems, /* internal */ acceptData ) { + var elem, type, id, data, + i = 0, + internalKey = jQuery.expando, + cache = jQuery.cache, + deleteExpando = jQuery.support.deleteExpando, + special = jQuery.event.special; + + for ( ; (elem = elems[i]) != null; i++ ) { + + if ( acceptData || jQuery.acceptData( elem ) ) { + + id = elem[ internalKey ]; + data = id && cache[ id ]; + + if ( data ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Remove cache only if it was not already removed by jQuery.event.remove + if ( cache[ id ] ) { + + delete cache[ id ]; + + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( deleteExpando ) { + delete elem[ internalKey ]; + + } else if ( typeof elem.removeAttribute !== core_strundefined ) { + elem.removeAttribute( internalKey ); + + } else { + elem[ internalKey ] = null; + } + + core_deletedIds.push( id ); + } + } + } + } + } +}); +var iframe, getStyles, curCSS, + ralpha = /alpha\([^)]*\)/i, + ropacity = /opacity\s*=\s*([^)]*)/, + rposition = /^(top|right|bottom|left)$/, + // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" + // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + rmargin = /^margin/, + rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), + rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), + rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), + elemdisplay = { BODY: "block" }, + + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: 0, + fontWeight: 400 + }, + + cssExpand = [ "Top", "Right", "Bottom", "Left" ], + cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; + +// return a css property mapped to a potentially vendor prefixed property +function vendorPropName( style, name ) { + + // shortcut for names that are not vendor prefixed + if ( name in style ) { + return name; + } + + // check for vendor prefixed names + var capName = name.charAt(0).toUpperCase() + name.slice(1), + origName = name, + i = cssPrefixes.length; + + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in style ) { + return name; + } + } + + return origName; +} + +function isHidden( elem, el ) { + // isHidden might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); +} + +function showHide( elements, show ) { + var display, elem, hidden, + values = [], + index = 0, + length = elements.length; + + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + + values[ index ] = jQuery._data( elem, "olddisplay" ); + display = elem.style.display; + if ( show ) { + // Reset the inline display of this element to learn if it is + // being hidden by cascaded rules or not + if ( !values[ index ] && display === "none" ) { + elem.style.display = ""; + } + + // Set elements which have been overridden with display: none + // in a stylesheet to whatever the default browser style is + // for such an element + if ( elem.style.display === "" && isHidden( elem ) ) { + values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); + } + } else { + + if ( !values[ index ] ) { + hidden = isHidden( elem ); + + if ( display && display !== "none" || !hidden ) { + jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); + } + } + } + } + + // Set the display of most of the elements in a second loop + // to avoid the constant reflow + for ( index = 0; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + if ( !show || elem.style.display === "none" || elem.style.display === "" ) { + elem.style.display = show ? values[ index ] || "" : "none"; + } + } + + return elements; +} + +jQuery.fn.extend({ + css: function( name, value ) { + return jQuery.access( this, function( elem, name, value ) { + var len, styles, + map = {}, + i = 0; + + if ( jQuery.isArray( name ) ) { + styles = getStyles( elem ); + len = name.length; + + for ( ; i < len; i++ ) { + map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); + } + + return map; + } + + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + }, + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state ) { + var bool = typeof state === "boolean"; + + return this.each(function() { + if ( bool ? state : isHidden( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + }); + } +}); + +jQuery.extend({ + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + } + } + } + }, + + // Exclude the following css properties to add px + cssNumber: { + "columnCount": true, + "fillOpacity": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + // normalize float css property + "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" + }, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, hooks, + origName = jQuery.camelCase( name ), + style = elem.style; + + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // convert relative number strings (+= or -=) to relative numbers. #7345 + if ( type === "string" && (ret = rrelNum.exec( value )) ) { + value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); + // Fixes bug #9237 + type = "number"; + } + + // Make sure that NaN and null values aren't set. See: #7116 + if ( value == null || type === "number" && isNaN( value ) ) { + return; + } + + // If a number was passed in, add 'px' to the (except for certain CSS properties) + if ( type === "number" && !jQuery.cssNumber[ origName ] ) { + value += "px"; + } + + // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, + // but it would mean to define eight (for every problematic property) identical functions + if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { + style[ name ] = "inherit"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { + + // Wrapped to prevent IE from throwing errors when 'invalid' values are provided + // Fixes bug #5509 + try { + style[ name ] = value; + } catch(e) {} + } + + } else { + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, extra, styles ) { + var num, val, hooks, + origName = jQuery.camelCase( name ); + + // Make sure that we're working with the right name + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } + + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name, styles ); + } + + //convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } + + // Return, converting to number if forced or a qualifier was provided and val looks numeric + if ( extra === "" || extra ) { + num = parseFloat( val ); + return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; + } + return val; + }, + + // A method for quickly swapping in/out CSS properties to get correct calculations + swap: function( elem, options, callback, args ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.apply( elem, args || [] ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; + } +}); + +// NOTE: we've included the "window" in window.getComputedStyle +// because jsdom on node.js will break without it. +if ( window.getComputedStyle ) { + getStyles = function( elem ) { + return window.getComputedStyle( elem, null ); + }; + + curCSS = function( elem, name, _computed ) { + var width, minWidth, maxWidth, + computed = _computed || getStyles( elem ), + + // getPropertyValue is only needed for .css('filter') in IE9, see #12537 + ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, + style = elem.style; + + if ( computed ) { + + if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + ret = jQuery.style( elem, name ); + } + + // A tribute to the "awesome hack by Dean Edwards" + // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right + // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels + // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values + if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { + + // Remember the original values + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + // Put in the new values to get a computed value out + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + // Revert the changed values + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret; + }; +} else if ( document.documentElement.currentStyle ) { + getStyles = function( elem ) { + return elem.currentStyle; + }; + + curCSS = function( elem, name, _computed ) { + var left, rs, rsLeft, + computed = _computed || getStyles( elem ), + ret = computed ? computed[ name ] : undefined, + style = elem.style; + + // Avoid setting ret to empty string here + // so we don't default to auto + if ( ret == null && style && style[ name ] ) { + ret = style[ name ]; + } + + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + // but not position css attributes, as those are proportional to the parent element instead + // and we can't measure the parent instead because it might trigger a "stacking dolls" problem + if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { + + // Remember the original values + left = style.left; + rs = elem.runtimeStyle; + rsLeft = rs && rs.left; + + // Put in the new values to get a computed value out + if ( rsLeft ) { + rs.left = elem.currentStyle.left; + } + style.left = name === "fontSize" ? "1em" : ret; + ret = style.pixelLeft + "px"; + + // Revert the changed values + style.left = left; + if ( rsLeft ) { + rs.left = rsLeft; + } + } + + return ret === "" ? "auto" : ret; + }; +} + +function setPositiveNumber( elem, value, subtract ) { + var matches = rnumsplit.exec( value ); + return matches ? + // Guard against undefined "subtract", e.g., when used as in cssHooks + Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : + value; +} + +function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { + var i = extra === ( isBorderBox ? "border" : "content" ) ? + // If we already have the right measurement, avoid augmentation + 4 : + // Otherwise initialize for horizontal or vertical properties + name === "width" ? 1 : 0, + + val = 0; + + for ( ; i < 4; i += 2 ) { + // both box models exclude margin, so add it if we want it + if ( extra === "margin" ) { + val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); + } + + if ( isBorderBox ) { + // border-box includes padding, so remove it if we want content + if ( extra === "content" ) { + val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + } + + // at this point, extra isn't border nor margin, so remove border + if ( extra !== "margin" ) { + val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } else { + // at this point, extra isn't content, so add padding + val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + + // at this point, extra isn't content nor padding, so add border + if ( extra !== "padding" ) { + val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } + } + + return val; +} + +function getWidthOrHeight( elem, name, extra ) { + + // Start with offset property, which is equivalent to the border-box value + var valueIsBorderBox = true, + val = name === "width" ? elem.offsetWidth : elem.offsetHeight, + styles = getStyles( elem ), + isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + + // some non-html elements return undefined for offsetWidth, so check for null/undefined + // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 + // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 + if ( val <= 0 || val == null ) { + // Fall back to computed then uncomputed css if necessary + val = curCSS( elem, name, styles ); + if ( val < 0 || val == null ) { + val = elem.style[ name ]; + } + + // Computed unit is not pixels. Stop here and return. + if ( rnumnonpx.test(val) ) { + return val; + } + + // we need the check for style in case a browser which returns unreliable values + // for getComputedStyle silently falls back to the reliable elem.style + valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); + + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + } + + // use the active box-sizing model to add/subtract irrelevant styles + return ( val + + augmentWidthOrHeight( + elem, + name, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox, + styles + ) + ) + "px"; +} + +// Try to determine the default display value of an element +function css_defaultDisplay( nodeName ) { + var doc = document, + display = elemdisplay[ nodeName ]; + + if ( !display ) { + display = actualDisplay( nodeName, doc ); + + // If the simple way fails, read from inside an iframe + if ( display === "none" || !display ) { + // Use the already-created iframe if possible + iframe = ( iframe || + jQuery("<iframe frameborder='0' width='0' height='0'/>") + .css( "cssText", "display:block !important" ) + ).appendTo( doc.documentElement ); + + // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse + doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document; + doc.write("<!doctype html><html><body>"); + doc.close(); + + display = actualDisplay( nodeName, doc ); + iframe.detach(); + } + + // Store the correct default display + elemdisplay[ nodeName ] = display; + } + + return display; +} + +// Called ONLY from within css_defaultDisplay +function actualDisplay( name, doc ) { + var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), + display = jQuery.css( elem[0], "display" ); + elem.remove(); + return display; +} + +jQuery.each([ "height", "width" ], function( i, name ) { + jQuery.cssHooks[ name ] = { + get: function( elem, computed, extra ) { + if ( computed ) { + // certain elements can have dimension info if we invisibly show them + // however, it must have a current display style that would benefit from this + return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ? + jQuery.swap( elem, cssShow, function() { + return getWidthOrHeight( elem, name, extra ); + }) : + getWidthOrHeight( elem, name, extra ); + } + }, + + set: function( elem, value, extra ) { + var styles = extra && getStyles( elem ); + return setPositiveNumber( elem, value, extra ? + augmentWidthOrHeight( + elem, + name, + extra, + jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box", + styles + ) : 0 + ); + } + }; +}); + +if ( !jQuery.support.opacity ) { + jQuery.cssHooks.opacity = { + get: function( elem, computed ) { + // IE uses filters for opacity + return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? + ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : + computed ? "1" : ""; + }, + + set: function( elem, value ) { + var style = elem.style, + currentStyle = elem.currentStyle, + opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", + filter = currentStyle && currentStyle.filter || style.filter || ""; + + // IE has trouble with opacity if it does not have layout + // Force it by setting the zoom level + style.zoom = 1; + + // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 + // if value === "", then remove inline opacity #12685 + if ( ( value >= 1 || value === "" ) && + jQuery.trim( filter.replace( ralpha, "" ) ) === "" && + style.removeAttribute ) { + + // Setting style.filter to null, "" & " " still leave "filter:" in the cssText + // if "filter:" is present at all, clearType is disabled, we want to avoid this + // style.removeAttribute is IE Only, but so apparently is this code path... + style.removeAttribute( "filter" ); + + // if there is no filter style applied in a css rule or unset inline opacity, we are done + if ( value === "" || currentStyle && !currentStyle.filter ) { + return; + } + } + + // otherwise, set new filter values + style.filter = ralpha.test( filter ) ? + filter.replace( ralpha, opacity ) : + filter + " " + opacity; + } + }; +} + +// These hooks cannot be added until DOM ready because the support test +// for it is not run until after DOM ready +jQuery(function() { + if ( !jQuery.support.reliableMarginRight ) { + jQuery.cssHooks.marginRight = { + get: function( elem, computed ) { + if ( computed ) { + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + // Work around by temporarily setting element display to inline-block + return jQuery.swap( elem, { "display": "inline-block" }, + curCSS, [ elem, "marginRight" ] ); + } + } + }; + } + + // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 + // getComputedStyle returns percent when specified for top/left/bottom/right + // rather than make the css module depend on the offset module, we just check for it here + if ( !jQuery.support.pixelPosition && jQuery.fn.position ) { + jQuery.each( [ "top", "left" ], function( i, prop ) { + jQuery.cssHooks[ prop ] = { + get: function( elem, computed ) { + if ( computed ) { + computed = curCSS( elem, prop ); + // if curCSS returns percentage, fallback to offset + return rnumnonpx.test( computed ) ? + jQuery( elem ).position()[ prop ] + "px" : + computed; + } + } + }; + }); + } + +}); + +if ( jQuery.expr && jQuery.expr.filters ) { + jQuery.expr.filters.hidden = function( elem ) { + // Support: Opera <= 12.12 + // Opera reports offsetWidths and offsetHeights less than zero on some elements + return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 || + (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none"); + }; + + jQuery.expr.filters.visible = function( elem ) { + return !jQuery.expr.filters.hidden( elem ); + }; +} + +// These hooks are used by animate to expand properties +jQuery.each({ + margin: "", + padding: "", + border: "Width" +}, function( prefix, suffix ) { + jQuery.cssHooks[ prefix + suffix ] = { + expand: function( value ) { + var i = 0, + expanded = {}, + + // assumes a single number if not a string + parts = typeof value === "string" ? value.split(" ") : [ value ]; + + for ( ; i < 4; i++ ) { + expanded[ prefix + cssExpand[ i ] + suffix ] = + parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; + } + + return expanded; + } + }; + + if ( !rmargin.test( prefix ) ) { + jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; + } +}); +var r20 = /%20/g, + rbracket = /\[\]$/, + rCRLF = /\r?\n/g, + rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, + rsubmittable = /^(?:input|select|textarea|keygen)/i; + +jQuery.fn.extend({ + serialize: function() { + return jQuery.param( this.serializeArray() ); + }, + serializeArray: function() { + return this.map(function(){ + // Can add propHook for "elements" to filter or add form elements + var elements = jQuery.prop( this, "elements" ); + return elements ? jQuery.makeArray( elements ) : this; + }) + .filter(function(){ + var type = this.type; + // Use .is(":disabled") so that fieldset[disabled] works + return this.name && !jQuery( this ).is( ":disabled" ) && + rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && + ( this.checked || !manipulation_rcheckableType.test( type ) ); + }) + .map(function( i, elem ){ + var val = jQuery( this ).val(); + + return val == null ? + null : + jQuery.isArray( val ) ? + jQuery.map( val, function( val ){ + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + }) : + { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + }).get(); + } +}); + +//Serialize an array of form elements or a set of +//key/values into a query string +jQuery.param = function( a, traditional ) { + var prefix, + s = [], + add = function( key, value ) { + // If value is a function, invoke it and return its value + value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); + s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); + }; + + // Set traditional to true for jQuery <= 1.3.2 behavior. + if ( traditional === undefined ) { + traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; + } + + // If an array was passed in, assume that it is an array of form elements. + if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { + // Serialize the form elements + jQuery.each( a, function() { + add( this.name, this.value ); + }); + + } else { + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for ( prefix in a ) { + buildParams( prefix, a[ prefix ], traditional, add ); + } + } + + // Return the resulting serialization + return s.join( "&" ).replace( r20, "+" ); +}; + +function buildParams( prefix, obj, traditional, add ) { + var name; + + if ( jQuery.isArray( obj ) ) { + // Serialize array item. + jQuery.each( obj, function( i, v ) { + if ( traditional || rbracket.test( prefix ) ) { + // Treat each array item as a scalar. + add( prefix, v ); + + } else { + // Item is non-scalar (array or object), encode its numeric index. + buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); + } + }); + + } else if ( !traditional && jQuery.type( obj ) === "object" ) { + // Serialize object item. + for ( name in obj ) { + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); + } + + } else { + // Serialize scalar item. + add( prefix, obj ); + } +} +jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { + + // Handle event binding + jQuery.fn[ name ] = function( data, fn ) { + return arguments.length > 0 ? + this.on( name, null, data, fn ) : + this.trigger( name ); + }; +}); + +jQuery.fn.hover = function( fnOver, fnOut ) { + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); +}; +var + // Document location + ajaxLocParts, + ajaxLocation, + ajax_nonce = jQuery.now(), + + ajax_rquery = /\?/, + rhash = /#.*$/, + rts = /([?&])_=[^&]*/, + rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL + // #7653, #8125, #8152: local protocol detection + rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, + rnoContent = /^(?:GET|HEAD)$/, + rprotocol = /^\/\//, + rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, + + // Keep a copy of the old load method + _load = jQuery.fn.load, + + /* Prefilters + * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) + * 2) These are called: + * - BEFORE asking for a transport + * - AFTER param serialization (s.data is a string if s.processData is true) + * 3) key is the dataType + * 4) the catchall symbol "*" can be used + * 5) execution will start with transport dataType and THEN continue down to "*" if needed + */ + prefilters = {}, + + /* Transports bindings + * 1) key is the dataType + * 2) the catchall symbol "*" can be used + * 3) selection will start with transport dataType and THEN go to "*" if needed + */ + transports = {}, + + // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression + allTypes = "*/".concat("*"); + +// #8138, IE may throw an exception when accessing +// a field from window.location if document.domain has been set +try { + ajaxLocation = location.href; +} catch( e ) { + // Use the href attribute of an A element + // since IE will modify it given document.location + ajaxLocation = document.createElement( "a" ); + ajaxLocation.href = ""; + ajaxLocation = ajaxLocation.href; +} + +// Segment location into parts +ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; + +// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport +function addToPrefiltersOrTransports( structure ) { + + // dataTypeExpression is optional and defaults to "*" + return function( dataTypeExpression, func ) { + + if ( typeof dataTypeExpression !== "string" ) { + func = dataTypeExpression; + dataTypeExpression = "*"; + } + + var dataType, + i = 0, + dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || []; + + if ( jQuery.isFunction( func ) ) { + // For each dataType in the dataTypeExpression + while ( (dataType = dataTypes[i++]) ) { + // Prepend if requested + if ( dataType[0] === "+" ) { + dataType = dataType.slice( 1 ) || "*"; + (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); + + // Otherwise append + } else { + (structure[ dataType ] = structure[ dataType ] || []).push( func ); + } + } + } + }; +} + +// Base inspection function for prefilters and transports +function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { + + var inspected = {}, + seekingTransport = ( structure === transports ); + + function inspect( dataType ) { + var selected; + inspected[ dataType ] = true; + jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { + var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); + if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { + options.dataTypes.unshift( dataTypeOrTransport ); + inspect( dataTypeOrTransport ); + return false; + } else if ( seekingTransport ) { + return !( selected = dataTypeOrTransport ); + } + }); + return selected; + } + + return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); +} + +// A special extend for ajax options +// that takes "flat" options (not to be deep extended) +// Fixes #9887 +function ajaxExtend( target, src ) { + var deep, key, + flatOptions = jQuery.ajaxSettings.flatOptions || {}; + + for ( key in src ) { + if ( src[ key ] !== undefined ) { + ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; + } + } + if ( deep ) { + jQuery.extend( true, target, deep ); + } + + return target; +} + +jQuery.fn.load = function( url, params, callback ) { + if ( typeof url !== "string" && _load ) { + return _load.apply( this, arguments ); + } + + var selector, response, type, + self = this, + off = url.indexOf(" "); + + if ( off >= 0 ) { + selector = url.slice( off, url.length ); + url = url.slice( 0, off ); + } + + // If it's a function + if ( jQuery.isFunction( params ) ) { + + // We assume that it's the callback + callback = params; + params = undefined; + + // Otherwise, build a param string + } else if ( params && typeof params === "object" ) { + type = "POST"; + } + + // If we have elements to modify, make the request + if ( self.length > 0 ) { + jQuery.ajax({ + url: url, + + // if "type" variable is undefined, then "GET" method will be used + type: type, + dataType: "html", + data: params + }).done(function( responseText ) { + + // Save response for use in complete callback + response = arguments; + + self.html( selector ? + + // If a selector was specified, locate the right elements in a dummy div + // Exclude scripts to avoid IE 'Permission Denied' errors + jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) : + + // Otherwise use the full result + responseText ); + + }).complete( callback && function( jqXHR, status ) { + self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); + }); + } + + return this; +}; + +// Attach a bunch of functions for handling common AJAX events +jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){ + jQuery.fn[ type ] = function( fn ){ + return this.on( type, fn ); + }; +}); + +jQuery.each( [ "get", "post" ], function( i, method ) { + jQuery[ method ] = function( url, data, callback, type ) { + // shift arguments if data argument was omitted + if ( jQuery.isFunction( data ) ) { + type = type || callback; + callback = data; + data = undefined; + } + + return jQuery.ajax({ + url: url, + type: method, + dataType: type, + data: data, + success: callback + }); + }; +}); + +jQuery.extend({ + + // Counter for holding the number of active queries + active: 0, + + // Last-Modified header cache for next request + lastModified: {}, + etag: {}, + + ajaxSettings: { + url: ajaxLocation, + type: "GET", + isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), + global: true, + processData: true, + async: true, + contentType: "application/x-www-form-urlencoded; charset=UTF-8", + /* + timeout: 0, + data: null, + dataType: null, + username: null, + password: null, + cache: null, + throws: false, + traditional: false, + headers: {}, + */ + + accepts: { + "*": allTypes, + text: "text/plain", + html: "text/html", + xml: "application/xml, text/xml", + json: "application/json, text/javascript" + }, + + contents: { + xml: /xml/, + html: /html/, + json: /json/ + }, + + responseFields: { + xml: "responseXML", + text: "responseText" + }, + + // Data converters + // Keys separate source (or catchall "*") and destination types with a single space + converters: { + + // Convert anything to text + "* text": window.String, + + // Text to html (true = no transformation) + "text html": true, + + // Evaluate text as a json expression + "text json": jQuery.parseJSON, + + // Parse text as xml + "text xml": jQuery.parseXML + }, + + // For options that shouldn't be deep extended: + // you can add your own custom options here if + // and when you create one that shouldn't be + // deep extended (see ajaxExtend) + flatOptions: { + url: true, + context: true + } + }, + + // Creates a full fledged settings object into target + // with both ajaxSettings and settings fields. + // If target is omitted, writes into ajaxSettings. + ajaxSetup: function( target, settings ) { + return settings ? + + // Building a settings object + ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : + + // Extending ajaxSettings + ajaxExtend( jQuery.ajaxSettings, target ); + }, + + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), + ajaxTransport: addToPrefiltersOrTransports( transports ), + + // Main method + ajax: function( url, options ) { + + // If url is an object, simulate pre-1.5 signature + if ( typeof url === "object" ) { + options = url; + url = undefined; + } + + // Force options to be an object + options = options || {}; + + var // Cross-domain detection vars + parts, + // Loop variable + i, + // URL without anti-cache param + cacheURL, + // Response headers as string + responseHeadersString, + // timeout handle + timeoutTimer, + + // To know if global events are to be dispatched + fireGlobals, + + transport, + // Response headers + responseHeaders, + // Create the final options object + s = jQuery.ajaxSetup( {}, options ), + // Callbacks context + callbackContext = s.context || s, + // Context for global events is callbackContext if it is a DOM node or jQuery collection + globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? + jQuery( callbackContext ) : + jQuery.event, + // Deferreds + deferred = jQuery.Deferred(), + completeDeferred = jQuery.Callbacks("once memory"), + // Status-dependent callbacks + statusCode = s.statusCode || {}, + // Headers (they are sent all at once) + requestHeaders = {}, + requestHeadersNames = {}, + // The jqXHR state + state = 0, + // Default abort message + strAbort = "canceled", + // Fake xhr + jqXHR = { + readyState: 0, + + // Builds headers hashtable if needed + getResponseHeader: function( key ) { + var match; + if ( state === 2 ) { + if ( !responseHeaders ) { + responseHeaders = {}; + while ( (match = rheaders.exec( responseHeadersString )) ) { + responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; + } + } + match = responseHeaders[ key.toLowerCase() ]; + } + return match == null ? null : match; + }, + + // Raw string + getAllResponseHeaders: function() { + return state === 2 ? responseHeadersString : null; + }, + + // Caches the header + setRequestHeader: function( name, value ) { + var lname = name.toLowerCase(); + if ( !state ) { + name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; + requestHeaders[ name ] = value; + } + return this; + }, + + // Overrides response content-type header + overrideMimeType: function( type ) { + if ( !state ) { + s.mimeType = type; + } + return this; + }, + + // Status-dependent callbacks + statusCode: function( map ) { + var code; + if ( map ) { + if ( state < 2 ) { + for ( code in map ) { + // Lazy-add the new callback in a way that preserves old ones + statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; + } + } else { + // Execute the appropriate callbacks + jqXHR.always( map[ jqXHR.status ] ); + } + } + return this; + }, + + // Cancel the request + abort: function( statusText ) { + var finalText = statusText || strAbort; + if ( transport ) { + transport.abort( finalText ); + } + done( 0, finalText ); + return this; + } + }; + + // Attach deferreds + deferred.promise( jqXHR ).complete = completeDeferred.add; + jqXHR.success = jqXHR.done; + jqXHR.error = jqXHR.fail; + + // Remove hash character (#7531: and string promotion) + // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) + // Handle falsy url in the settings object (#10093: consistency with old signature) + // We also use the url parameter if available + s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); + + // Alias method option to type as per ticket #12004 + s.type = options.method || options.type || s.method || s.type; + + // Extract dataTypes list + s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""]; + + // A cross-domain request is in order when we have a protocol:host:port mismatch + if ( s.crossDomain == null ) { + parts = rurl.exec( s.url.toLowerCase() ); + s.crossDomain = !!( parts && + ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || + ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != + ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) + ); + } + + // Convert data if not already a string + if ( s.data && s.processData && typeof s.data !== "string" ) { + s.data = jQuery.param( s.data, s.traditional ); + } + + // Apply prefilters + inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); + + // If request was aborted inside a prefilter, stop there + if ( state === 2 ) { + return jqXHR; + } + + // We can fire global events as of now if asked to + fireGlobals = s.global; + + // Watch for a new set of requests + if ( fireGlobals && jQuery.active++ === 0 ) { + jQuery.event.trigger("ajaxStart"); + } + + // Uppercase the type + s.type = s.type.toUpperCase(); + + // Determine if request has content + s.hasContent = !rnoContent.test( s.type ); + + // Save the URL in case we're toying with the If-Modified-Since + // and/or If-None-Match header later on + cacheURL = s.url; + + // More options handling for requests with no content + if ( !s.hasContent ) { + + // If data is available, append data to url + if ( s.data ) { + cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); + // #9682: remove data so that it's not used in an eventual retry + delete s.data; + } + + // Add anti-cache in url if needed + if ( s.cache === false ) { + s.url = rts.test( cacheURL ) ? + + // If there is already a '_' parameter, set its value + cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) : + + // Otherwise add one to the end + cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++; + } + } + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + if ( jQuery.lastModified[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); + } + if ( jQuery.etag[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); + } + } + + // Set the correct header, if data is being sent + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + jqXHR.setRequestHeader( "Content-Type", s.contentType ); + } + + // Set the Accepts header for the server, depending on the dataType + jqXHR.setRequestHeader( + "Accept", + s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? + s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : + s.accepts[ "*" ] + ); + + // Check for headers option + for ( i in s.headers ) { + jqXHR.setRequestHeader( i, s.headers[ i ] ); + } + + // Allow custom headers/mimetypes and early abort + if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { + // Abort if not done already and return + return jqXHR.abort(); + } + + // aborting is no longer a cancellation + strAbort = "abort"; + + // Install callbacks on deferreds + for ( i in { success: 1, error: 1, complete: 1 } ) { + jqXHR[ i ]( s[ i ] ); + } + + // Get transport + transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); + + // If no transport, we auto-abort + if ( !transport ) { + done( -1, "No Transport" ); + } else { + jqXHR.readyState = 1; + + // Send global event + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); + } + // Timeout + if ( s.async && s.timeout > 0 ) { + timeoutTimer = setTimeout(function() { + jqXHR.abort("timeout"); + }, s.timeout ); + } + + try { + state = 1; + transport.send( requestHeaders, done ); + } catch ( e ) { + // Propagate exception as error if not done + if ( state < 2 ) { + done( -1, e ); + // Simply rethrow otherwise + } else { + throw e; + } + } + } + + // Callback for when everything is done + function done( status, nativeStatusText, responses, headers ) { + var isSuccess, success, error, response, modified, + statusText = nativeStatusText; + + // Called once + if ( state === 2 ) { + return; + } + + // State is "done" now + state = 2; + + // Clear timeout if it exists + if ( timeoutTimer ) { + clearTimeout( timeoutTimer ); + } + + // Dereference transport for early garbage collection + // (no matter how long the jqXHR object will be used) + transport = undefined; + + // Cache response headers + responseHeadersString = headers || ""; + + // Set readyState + jqXHR.readyState = status > 0 ? 4 : 0; + + // Get response data + if ( responses ) { + response = ajaxHandleResponses( s, jqXHR, responses ); + } + + // If successful, handle type chaining + if ( status >= 200 && status < 300 || status === 304 ) { + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + modified = jqXHR.getResponseHeader("Last-Modified"); + if ( modified ) { + jQuery.lastModified[ cacheURL ] = modified; + } + modified = jqXHR.getResponseHeader("etag"); + if ( modified ) { + jQuery.etag[ cacheURL ] = modified; + } + } + + // if no content + if ( status === 204 ) { + isSuccess = true; + statusText = "nocontent"; + + // if not modified + } else if ( status === 304 ) { + isSuccess = true; + statusText = "notmodified"; + + // If we have data, let's convert it + } else { + isSuccess = ajaxConvert( s, response ); + statusText = isSuccess.state; + success = isSuccess.data; + error = isSuccess.error; + isSuccess = !error; + } + } else { + // We extract error from statusText + // then normalize statusText and status for non-aborts + error = statusText; + if ( status || !statusText ) { + statusText = "error"; + if ( status < 0 ) { + status = 0; + } + } + } + + // Set data for the fake xhr object + jqXHR.status = status; + jqXHR.statusText = ( nativeStatusText || statusText ) + ""; + + // Success/Error + if ( isSuccess ) { + deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); + } else { + deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); + } + + // Status-dependent callbacks + jqXHR.statusCode( statusCode ); + statusCode = undefined; + + if ( fireGlobals ) { + globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", + [ jqXHR, s, isSuccess ? success : error ] ); + } + + // Complete + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); + + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); + // Handle the global AJAX counter + if ( !( --jQuery.active ) ) { + jQuery.event.trigger("ajaxStop"); + } + } + } + + return jqXHR; + }, + + getScript: function( url, callback ) { + return jQuery.get( url, undefined, callback, "script" ); + }, + + getJSON: function( url, data, callback ) { + return jQuery.get( url, data, callback, "json" ); + } +}); + +/* Handles responses to an ajax request: + * - sets all responseXXX fields accordingly + * - finds the right dataType (mediates between content-type and expected dataType) + * - returns the corresponding response + */ +function ajaxHandleResponses( s, jqXHR, responses ) { + var firstDataType, ct, finalDataType, type, + contents = s.contents, + dataTypes = s.dataTypes, + responseFields = s.responseFields; + + // Fill responseXXX fields + for ( type in responseFields ) { + if ( type in responses ) { + jqXHR[ responseFields[type] ] = responses[ type ]; + } + } + + // Remove auto dataType and get content-type in the process + while( dataTypes[ 0 ] === "*" ) { + dataTypes.shift(); + if ( ct === undefined ) { + ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); + } + } + + // Check if we're dealing with a known content-type + if ( ct ) { + for ( type in contents ) { + if ( contents[ type ] && contents[ type ].test( ct ) ) { + dataTypes.unshift( type ); + break; + } + } + } + + // Check to see if we have a response for the expected dataType + if ( dataTypes[ 0 ] in responses ) { + finalDataType = dataTypes[ 0 ]; + } else { + // Try convertible dataTypes + for ( type in responses ) { + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { + finalDataType = type; + break; + } + if ( !firstDataType ) { + firstDataType = type; + } + } + // Or just use first one + finalDataType = finalDataType || firstDataType; + } + + // If we found a dataType + // We add the dataType to the list if needed + // and return the corresponding response + if ( finalDataType ) { + if ( finalDataType !== dataTypes[ 0 ] ) { + dataTypes.unshift( finalDataType ); + } + return responses[ finalDataType ]; + } +} + +// Chain conversions given the request and the original response +function ajaxConvert( s, response ) { + var conv2, current, conv, tmp, + converters = {}, + i = 0, + // Work with a copy of dataTypes in case we need to modify it for conversion + dataTypes = s.dataTypes.slice(), + prev = dataTypes[ 0 ]; + + // Apply the dataFilter if provided + if ( s.dataFilter ) { + response = s.dataFilter( response, s.dataType ); + } + + // Create converters map with lowercased keys + if ( dataTypes[ 1 ] ) { + for ( conv in s.converters ) { + converters[ conv.toLowerCase() ] = s.converters[ conv ]; + } + } + + // Convert to each sequential dataType, tolerating list modification + for ( ; (current = dataTypes[++i]); ) { + + // There's only work to do if current dataType is non-auto + if ( current !== "*" ) { + + // Convert response if prev dataType is non-auto and differs from current + if ( prev !== "*" && prev !== current ) { + + // Seek a direct converter + conv = converters[ prev + " " + current ] || converters[ "* " + current ]; + + // If none found, seek a pair + if ( !conv ) { + for ( conv2 in converters ) { + + // If conv2 outputs current + tmp = conv2.split(" "); + if ( tmp[ 1 ] === current ) { + + // If prev can be converted to accepted input + conv = converters[ prev + " " + tmp[ 0 ] ] || + converters[ "* " + tmp[ 0 ] ]; + if ( conv ) { + // Condense equivalence converters + if ( conv === true ) { + conv = converters[ conv2 ]; + + // Otherwise, insert the intermediate dataType + } else if ( converters[ conv2 ] !== true ) { + current = tmp[ 0 ]; + dataTypes.splice( i--, 0, current ); + } + + break; + } + } + } + } + + // Apply converter (if not an equivalence) + if ( conv !== true ) { + + // Unless errors are allowed to bubble, catch and return them + if ( conv && s["throws"] ) { + response = conv( response ); + } else { + try { + response = conv( response ); + } catch ( e ) { + return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; + } + } + } + } + + // Update prev for next iteration + prev = current; + } + } + + return { state: "success", data: response }; +} +// Install script dataType +jQuery.ajaxSetup({ + accepts: { + script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" + }, + contents: { + script: /(?:java|ecma)script/ + }, + converters: { + "text script": function( text ) { + jQuery.globalEval( text ); + return text; + } + } +}); + +// Handle cache's special case and global +jQuery.ajaxPrefilter( "script", function( s ) { + if ( s.cache === undefined ) { + s.cache = false; + } + if ( s.crossDomain ) { + s.type = "GET"; + s.global = false; + } +}); + +// Bind script tag hack transport +jQuery.ajaxTransport( "script", function(s) { + + // This transport only deals with cross domain requests + if ( s.crossDomain ) { + + var script, + head = document.head || jQuery("head")[0] || document.documentElement; + + return { + + send: function( _, callback ) { + + script = document.createElement("script"); + + script.async = true; + + if ( s.scriptCharset ) { + script.charset = s.scriptCharset; + } + + script.src = s.url; + + // Attach handlers for all browsers + script.onload = script.onreadystatechange = function( _, isAbort ) { + + if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { + + // Handle memory leak in IE + script.onload = script.onreadystatechange = null; + + // Remove the script + if ( script.parentNode ) { + script.parentNode.removeChild( script ); + } + + // Dereference the script + script = null; + + // Callback if not abort + if ( !isAbort ) { + callback( 200, "success" ); + } + } + }; + + // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending + // Use native DOM manipulation to avoid our domManip AJAX trickery + head.insertBefore( script, head.firstChild ); + }, + + abort: function() { + if ( script ) { + script.onload( undefined, true ); + } + } + }; + } +}); +var oldCallbacks = [], + rjsonp = /(=)\?(?=&|$)|\?\?/; + +// Default jsonp settings +jQuery.ajaxSetup({ + jsonp: "callback", + jsonpCallback: function() { + var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) ); + this[ callback ] = true; + return callback; + } +}); + +// Detect, normalize options and install callbacks for jsonp requests +jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { + + var callbackName, overwritten, responseContainer, + jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? + "url" : + typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" + ); + + // Handle iff the expected data type is "jsonp" or we have a parameter to set + if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { + + // Get callback name, remembering preexisting value associated with it + callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? + s.jsonpCallback() : + s.jsonpCallback; + + // Insert callback into url or form data + if ( jsonProp ) { + s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); + } else if ( s.jsonp !== false ) { + s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; + } + + // Use data converter to retrieve json after script execution + s.converters["script json"] = function() { + if ( !responseContainer ) { + jQuery.error( callbackName + " was not called" ); + } + return responseContainer[ 0 ]; + }; + + // force json dataType + s.dataTypes[ 0 ] = "json"; + + // Install callback + overwritten = window[ callbackName ]; + window[ callbackName ] = function() { + responseContainer = arguments; + }; + + // Clean-up function (fires after converters) + jqXHR.always(function() { + // Restore preexisting value + window[ callbackName ] = overwritten; + + // Save back as free + if ( s[ callbackName ] ) { + // make sure that re-using the options doesn't screw things around + s.jsonpCallback = originalSettings.jsonpCallback; + + // save the callback name for future use + oldCallbacks.push( callbackName ); + } + + // Call if it was a function and we have a response + if ( responseContainer && jQuery.isFunction( overwritten ) ) { + overwritten( responseContainer[ 0 ] ); + } + + responseContainer = overwritten = undefined; + }); + + // Delegate to script + return "script"; + } +}); +var xhrCallbacks, xhrSupported, + xhrId = 0, + // #5280: Internet Explorer will keep connections alive if we don't abort on unload + xhrOnUnloadAbort = window.ActiveXObject && function() { + // Abort all pending requests + var key; + for ( key in xhrCallbacks ) { + xhrCallbacks[ key ]( undefined, true ); + } + }; + +// Functions to create xhrs +function createStandardXHR() { + try { + return new window.XMLHttpRequest(); + } catch( e ) {} +} + +function createActiveXHR() { + try { + return new window.ActiveXObject("Microsoft.XMLHTTP"); + } catch( e ) {} +} + +// Create the request object +// (This is still attached to ajaxSettings for backward compatibility) +jQuery.ajaxSettings.xhr = window.ActiveXObject ? + /* Microsoft failed to properly + * implement the XMLHttpRequest in IE7 (can't request local files), + * so we use the ActiveXObject when it is available + * Additionally XMLHttpRequest can be disabled in IE7/IE8 so + * we need a fallback. + */ + function() { + return !this.isLocal && createStandardXHR() || createActiveXHR(); + } : + // For all other browsers, use the standard XMLHttpRequest object + createStandardXHR; + +// Determine support properties +xhrSupported = jQuery.ajaxSettings.xhr(); +jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); +xhrSupported = jQuery.support.ajax = !!xhrSupported; + +// Create transport if the browser can provide an xhr +if ( xhrSupported ) { + + jQuery.ajaxTransport(function( s ) { + // Cross domain only allowed if supported through XMLHttpRequest + if ( !s.crossDomain || jQuery.support.cors ) { + + var callback; + + return { + send: function( headers, complete ) { + + // Get a new xhr + var handle, i, + xhr = s.xhr(); + + // Open the socket + // Passing null username, generates a login popup on Opera (#2865) + if ( s.username ) { + xhr.open( s.type, s.url, s.async, s.username, s.password ); + } else { + xhr.open( s.type, s.url, s.async ); + } + + // Apply custom fields if provided + if ( s.xhrFields ) { + for ( i in s.xhrFields ) { + xhr[ i ] = s.xhrFields[ i ]; + } + } + + // Override mime type if needed + if ( s.mimeType && xhr.overrideMimeType ) { + xhr.overrideMimeType( s.mimeType ); + } + + // X-Requested-With header + // For cross-domain requests, seeing as conditions for a preflight are + // akin to a jigsaw puzzle, we simply never set it to be sure. + // (it can always be set on a per-request basis or even using ajaxSetup) + // For same-domain requests, won't change header if already provided. + if ( !s.crossDomain && !headers["X-Requested-With"] ) { + headers["X-Requested-With"] = "XMLHttpRequest"; + } + + // Need an extra try/catch for cross domain requests in Firefox 3 + try { + for ( i in headers ) { + xhr.setRequestHeader( i, headers[ i ] ); + } + } catch( err ) {} + + // Do send the request + // This may raise an exception which is actually + // handled in jQuery.ajax (so no try/catch here) + xhr.send( ( s.hasContent && s.data ) || null ); + + // Listener + callback = function( _, isAbort ) { + var status, responseHeaders, statusText, responses; + + // Firefox throws exceptions when accessing properties + // of an xhr when a network error occurred + // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) + try { + + // Was never called and is aborted or complete + if ( callback && ( isAbort || xhr.readyState === 4 ) ) { + + // Only called once + callback = undefined; + + // Do not keep as active anymore + if ( handle ) { + xhr.onreadystatechange = jQuery.noop; + if ( xhrOnUnloadAbort ) { + delete xhrCallbacks[ handle ]; + } + } + + // If it's an abort + if ( isAbort ) { + // Abort it manually if needed + if ( xhr.readyState !== 4 ) { + xhr.abort(); + } + } else { + responses = {}; + status = xhr.status; + responseHeaders = xhr.getAllResponseHeaders(); + + // When requesting binary data, IE6-9 will throw an exception + // on any attempt to access responseText (#11426) + if ( typeof xhr.responseText === "string" ) { + responses.text = xhr.responseText; + } + + // Firefox throws an exception when accessing + // statusText for faulty cross-domain requests + try { + statusText = xhr.statusText; + } catch( e ) { + // We normalize with Webkit giving an empty statusText + statusText = ""; + } + + // Filter status for non standard behaviors + + // If the request is local and we have data: assume a success + // (success with no data won't get notified, that's the best we + // can do given current implementations) + if ( !status && s.isLocal && !s.crossDomain ) { + status = responses.text ? 200 : 404; + // IE - #1450: sometimes returns 1223 when it should be 204 + } else if ( status === 1223 ) { + status = 204; + } + } + } + } catch( firefoxAccessException ) { + if ( !isAbort ) { + complete( -1, firefoxAccessException ); + } + } + + // Call complete if needed + if ( responses ) { + complete( status, statusText, responses, responseHeaders ); + } + }; + + if ( !s.async ) { + // if we're in sync mode we fire the callback + callback(); + } else if ( xhr.readyState === 4 ) { + // (IE6 & IE7) if it's in cache and has been + // retrieved directly we need to fire the callback + setTimeout( callback ); + } else { + handle = ++xhrId; + if ( xhrOnUnloadAbort ) { + // Create the active xhrs callbacks list if needed + // and attach the unload handler + if ( !xhrCallbacks ) { + xhrCallbacks = {}; + jQuery( window ).unload( xhrOnUnloadAbort ); + } + // Add to list of active xhrs callbacks + xhrCallbacks[ handle ] = callback; + } + xhr.onreadystatechange = callback; + } + }, + + abort: function() { + if ( callback ) { + callback( undefined, true ); + } + } + }; + } + }); +} +var fxNow, timerId, + rfxtypes = /^(?:toggle|show|hide)$/, + rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), + rrun = /queueHooks$/, + animationPrefilters = [ defaultPrefilter ], + tweeners = { + "*": [function( prop, value ) { + var end, unit, + tween = this.createTween( prop, value ), + parts = rfxnum.exec( value ), + target = tween.cur(), + start = +target || 0, + scale = 1, + maxIterations = 20; + + if ( parts ) { + end = +parts[2]; + unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + + // We need to compute starting value + if ( unit !== "px" && start ) { + // Iteratively approximate from a nonzero starting point + // Prefer the current property, because this process will be trivial if it uses the same units + // Fallback to end or a simple constant + start = jQuery.css( tween.elem, prop, true ) || end || 1; + + do { + // If previous iteration zeroed out, double until we get *something* + // Use a string for doubling factor so we don't accidentally see scale as unchanged below + scale = scale || ".5"; + + // Adjust and apply + start = start / scale; + jQuery.style( tween.elem, prop, start + unit ); + + // Update scale, tolerating zero or NaN from tween.cur() + // And breaking the loop if scale is unchanged or perfect, or if we've just had enough + } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); + } + + tween.unit = unit; + tween.start = start; + // If a +=/-= token was provided, we're doing a relative animation + tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; + } + return tween; + }] + }; + +// Animations created synchronously will run synchronously +function createFxNow() { + setTimeout(function() { + fxNow = undefined; + }); + return ( fxNow = jQuery.now() ); +} + +function createTweens( animation, props ) { + jQuery.each( props, function( prop, value ) { + var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), + index = 0, + length = collection.length; + for ( ; index < length; index++ ) { + if ( collection[ index ].call( animation, prop, value ) ) { + + // we're done with this property + return; + } + } + }); +} + +function Animation( elem, properties, options ) { + var result, + stopped, + index = 0, + length = animationPrefilters.length, + deferred = jQuery.Deferred().always( function() { + // don't match elem in the :animated selector + delete tick.elem; + }), + tick = function() { + if ( stopped ) { + return false; + } + var currentTime = fxNow || createFxNow(), + remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), + // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) + temp = remaining / animation.duration || 0, + percent = 1 - temp, + index = 0, + length = animation.tweens.length; + + for ( ; index < length ; index++ ) { + animation.tweens[ index ].run( percent ); + } + + deferred.notifyWith( elem, [ animation, percent, remaining ]); + + if ( percent < 1 && length ) { + return remaining; + } else { + deferred.resolveWith( elem, [ animation ] ); + return false; + } + }, + animation = deferred.promise({ + elem: elem, + props: jQuery.extend( {}, properties ), + opts: jQuery.extend( true, { specialEasing: {} }, options ), + originalProperties: properties, + originalOptions: options, + startTime: fxNow || createFxNow(), + duration: options.duration, + tweens: [], + createTween: function( prop, end ) { + var tween = jQuery.Tween( elem, animation.opts, prop, end, + animation.opts.specialEasing[ prop ] || animation.opts.easing ); + animation.tweens.push( tween ); + return tween; + }, + stop: function( gotoEnd ) { + var index = 0, + // if we are going to the end, we want to run all the tweens + // otherwise we skip this part + length = gotoEnd ? animation.tweens.length : 0; + if ( stopped ) { + return this; + } + stopped = true; + for ( ; index < length ; index++ ) { + animation.tweens[ index ].run( 1 ); + } + + // resolve when we played the last frame + // otherwise, reject + if ( gotoEnd ) { + deferred.resolveWith( elem, [ animation, gotoEnd ] ); + } else { + deferred.rejectWith( elem, [ animation, gotoEnd ] ); + } + return this; + } + }), + props = animation.props; + + propFilter( props, animation.opts.specialEasing ); + + for ( ; index < length ; index++ ) { + result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); + if ( result ) { + return result; + } + } + + createTweens( animation, props ); + + if ( jQuery.isFunction( animation.opts.start ) ) { + animation.opts.start.call( elem, animation ); + } + + jQuery.fx.timer( + jQuery.extend( tick, { + elem: elem, + anim: animation, + queue: animation.opts.queue + }) + ); + + // attach callbacks from options + return animation.progress( animation.opts.progress ) + .done( animation.opts.done, animation.opts.complete ) + .fail( animation.opts.fail ) + .always( animation.opts.always ); +} + +function propFilter( props, specialEasing ) { + var value, name, index, easing, hooks; + + // camelCase, specialEasing and expand cssHook pass + for ( index in props ) { + name = jQuery.camelCase( index ); + easing = specialEasing[ name ]; + value = props[ index ]; + if ( jQuery.isArray( value ) ) { + easing = value[ 1 ]; + value = props[ index ] = value[ 0 ]; + } + + if ( index !== name ) { + props[ name ] = value; + delete props[ index ]; + } + + hooks = jQuery.cssHooks[ name ]; + if ( hooks && "expand" in hooks ) { + value = hooks.expand( value ); + delete props[ name ]; + + // not quite $.extend, this wont overwrite keys already present. + // also - reusing 'index' from above because we have the correct "name" + for ( index in value ) { + if ( !( index in props ) ) { + props[ index ] = value[ index ]; + specialEasing[ index ] = easing; + } + } + } else { + specialEasing[ name ] = easing; + } + } +} + +jQuery.Animation = jQuery.extend( Animation, { + + tweener: function( props, callback ) { + if ( jQuery.isFunction( props ) ) { + callback = props; + props = [ "*" ]; + } else { + props = props.split(" "); + } + + var prop, + index = 0, + length = props.length; + + for ( ; index < length ; index++ ) { + prop = props[ index ]; + tweeners[ prop ] = tweeners[ prop ] || []; + tweeners[ prop ].unshift( callback ); + } + }, + + prefilter: function( callback, prepend ) { + if ( prepend ) { + animationPrefilters.unshift( callback ); + } else { + animationPrefilters.push( callback ); + } + } +}); + +function defaultPrefilter( elem, props, opts ) { + /*jshint validthis:true */ + var prop, index, length, + value, dataShow, toggle, + tween, hooks, oldfire, + anim = this, + style = elem.style, + orig = {}, + handled = [], + hidden = elem.nodeType && isHidden( elem ); + + // handle queue: false promises + if ( !opts.queue ) { + hooks = jQuery._queueHooks( elem, "fx" ); + if ( hooks.unqueued == null ) { + hooks.unqueued = 0; + oldfire = hooks.empty.fire; + hooks.empty.fire = function() { + if ( !hooks.unqueued ) { + oldfire(); + } + }; + } + hooks.unqueued++; + + anim.always(function() { + // doing this makes sure that the complete handler will be called + // before this completes + anim.always(function() { + hooks.unqueued--; + if ( !jQuery.queue( elem, "fx" ).length ) { + hooks.empty.fire(); + } + }); + }); + } + + // height/width overflow pass + if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { + // Make sure that nothing sneaks out + // Record all 3 overflow attributes because IE does not + // change the overflow attribute when overflowX and + // overflowY are set to the same value + opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; + + // Set display property to inline-block for height/width + // animations on inline elements that are having width/height animated + if ( jQuery.css( elem, "display" ) === "inline" && + jQuery.css( elem, "float" ) === "none" ) { + + // inline-level elements accept inline-block; + // block-level elements need to be inline with layout + if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { + style.display = "inline-block"; + + } else { + style.zoom = 1; + } + } + } + + if ( opts.overflow ) { + style.overflow = "hidden"; + if ( !jQuery.support.shrinkWrapBlocks ) { + anim.always(function() { + style.overflow = opts.overflow[ 0 ]; + style.overflowX = opts.overflow[ 1 ]; + style.overflowY = opts.overflow[ 2 ]; + }); + } + } + + + // show/hide pass + for ( index in props ) { + value = props[ index ]; + if ( rfxtypes.exec( value ) ) { + delete props[ index ]; + toggle = toggle || value === "toggle"; + if ( value === ( hidden ? "hide" : "show" ) ) { + continue; + } + handled.push( index ); + } + } + + length = handled.length; + if ( length ) { + dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} ); + if ( "hidden" in dataShow ) { + hidden = dataShow.hidden; + } + + // store state if its toggle - enables .stop().toggle() to "reverse" + if ( toggle ) { + dataShow.hidden = !hidden; + } + if ( hidden ) { + jQuery( elem ).show(); + } else { + anim.done(function() { + jQuery( elem ).hide(); + }); + } + anim.done(function() { + var prop; + jQuery._removeData( elem, "fxshow" ); + for ( prop in orig ) { + jQuery.style( elem, prop, orig[ prop ] ); + } + }); + for ( index = 0 ; index < length ; index++ ) { + prop = handled[ index ]; + tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 ); + orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop ); + + if ( !( prop in dataShow ) ) { + dataShow[ prop ] = tween.start; + if ( hidden ) { + tween.end = tween.start; + tween.start = prop === "width" || prop === "height" ? 1 : 0; + } + } + } + } +} + +function Tween( elem, options, prop, end, easing ) { + return new Tween.prototype.init( elem, options, prop, end, easing ); +} +jQuery.Tween = Tween; + +Tween.prototype = { + constructor: Tween, + init: function( elem, options, prop, end, easing, unit ) { + this.elem = elem; + this.prop = prop; + this.easing = easing || "swing"; + this.options = options; + this.start = this.now = this.cur(); + this.end = end; + this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + }, + cur: function() { + var hooks = Tween.propHooks[ this.prop ]; + + return hooks && hooks.get ? + hooks.get( this ) : + Tween.propHooks._default.get( this ); + }, + run: function( percent ) { + var eased, + hooks = Tween.propHooks[ this.prop ]; + + if ( this.options.duration ) { + this.pos = eased = jQuery.easing[ this.easing ]( + percent, this.options.duration * percent, 0, 1, this.options.duration + ); + } else { + this.pos = eased = percent; + } + this.now = ( this.end - this.start ) * eased + this.start; + + if ( this.options.step ) { + this.options.step.call( this.elem, this.now, this ); + } + + if ( hooks && hooks.set ) { + hooks.set( this ); + } else { + Tween.propHooks._default.set( this ); + } + return this; + } +}; + +Tween.prototype.init.prototype = Tween.prototype; + +Tween.propHooks = { + _default: { + get: function( tween ) { + var result; + + if ( tween.elem[ tween.prop ] != null && + (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { + return tween.elem[ tween.prop ]; + } + + // passing an empty string as a 3rd parameter to .css will automatically + // attempt a parseFloat and fallback to a string if the parse fails + // so, simple values such as "10px" are parsed to Float. + // complex values such as "rotate(1rad)" are returned as is. + result = jQuery.css( tween.elem, tween.prop, "" ); + // Empty strings, null, undefined and "auto" are converted to 0. + return !result || result === "auto" ? 0 : result; + }, + set: function( tween ) { + // use step hook for back compat - use cssHook if its there - use .style if its + // available and use plain properties where available + if ( jQuery.fx.step[ tween.prop ] ) { + jQuery.fx.step[ tween.prop ]( tween ); + } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { + jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); + } else { + tween.elem[ tween.prop ] = tween.now; + } + } + } +}; + +// Remove in 2.0 - this supports IE8's panic based approach +// to setting things on disconnected nodes + +Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { + set: function( tween ) { + if ( tween.elem.nodeType && tween.elem.parentNode ) { + tween.elem[ tween.prop ] = tween.now; + } + } +}; + +jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { + var cssFn = jQuery.fn[ name ]; + jQuery.fn[ name ] = function( speed, easing, callback ) { + return speed == null || typeof speed === "boolean" ? + cssFn.apply( this, arguments ) : + this.animate( genFx( name, true ), speed, easing, callback ); + }; +}); + +jQuery.fn.extend({ + fadeTo: function( speed, to, easing, callback ) { + + // show any hidden elements after setting opacity to 0 + return this.filter( isHidden ).css( "opacity", 0 ).show() + + // animate to the value specified + .end().animate({ opacity: to }, speed, easing, callback ); + }, + animate: function( prop, speed, easing, callback ) { + var empty = jQuery.isEmptyObject( prop ), + optall = jQuery.speed( speed, easing, callback ), + doAnimation = function() { + // Operate on a copy of prop so per-property easing won't be lost + var anim = Animation( this, jQuery.extend( {}, prop ), optall ); + doAnimation.finish = function() { + anim.stop( true ); + }; + // Empty animations, or finishing resolves immediately + if ( empty || jQuery._data( this, "finish" ) ) { + anim.stop( true ); + } + }; + doAnimation.finish = doAnimation; + + return empty || optall.queue === false ? + this.each( doAnimation ) : + this.queue( optall.queue, doAnimation ); + }, + stop: function( type, clearQueue, gotoEnd ) { + var stopQueue = function( hooks ) { + var stop = hooks.stop; + delete hooks.stop; + stop( gotoEnd ); + }; + + if ( typeof type !== "string" ) { + gotoEnd = clearQueue; + clearQueue = type; + type = undefined; + } + if ( clearQueue && type !== false ) { + this.queue( type || "fx", [] ); + } + + return this.each(function() { + var dequeue = true, + index = type != null && type + "queueHooks", + timers = jQuery.timers, + data = jQuery._data( this ); + + if ( index ) { + if ( data[ index ] && data[ index ].stop ) { + stopQueue( data[ index ] ); + } + } else { + for ( index in data ) { + if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { + stopQueue( data[ index ] ); + } + } + } + + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { + timers[ index ].anim.stop( gotoEnd ); + dequeue = false; + timers.splice( index, 1 ); + } + } + + // start the next in the queue if the last step wasn't forced + // timers currently will call their complete callbacks, which will dequeue + // but only if they were gotoEnd + if ( dequeue || !gotoEnd ) { + jQuery.dequeue( this, type ); + } + }); + }, + finish: function( type ) { + if ( type !== false ) { + type = type || "fx"; + } + return this.each(function() { + var index, + data = jQuery._data( this ), + queue = data[ type + "queue" ], + hooks = data[ type + "queueHooks" ], + timers = jQuery.timers, + length = queue ? queue.length : 0; + + // enable finishing flag on private data + data.finish = true; + + // empty the queue first + jQuery.queue( this, type, [] ); + + if ( hooks && hooks.cur && hooks.cur.finish ) { + hooks.cur.finish.call( this ); + } + + // look for any active animations, and finish them + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && timers[ index ].queue === type ) { + timers[ index ].anim.stop( true ); + timers.splice( index, 1 ); + } + } + + // look for any animations in the old queue and finish them + for ( index = 0; index < length; index++ ) { + if ( queue[ index ] && queue[ index ].finish ) { + queue[ index ].finish.call( this ); + } + } + + // turn off finishing flag + delete data.finish; + }); + } +}); + +// Generate parameters to create a standard animation +function genFx( type, includeWidth ) { + var which, + attrs = { height: type }, + i = 0; + + // if we include width, step value is 1 to do all cssExpand values, + // if we don't include width, step value is 2 to skip over Left and Right + includeWidth = includeWidth? 1 : 0; + for( ; i < 4 ; i += 2 - includeWidth ) { + which = cssExpand[ i ]; + attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; + } + + if ( includeWidth ) { + attrs.opacity = attrs.width = type; + } + + return attrs; +} + +// Generate shortcuts for custom animations +jQuery.each({ + slideDown: genFx("show"), + slideUp: genFx("hide"), + slideToggle: genFx("toggle"), + fadeIn: { opacity: "show" }, + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } +}, function( name, props ) { + jQuery.fn[ name ] = function( speed, easing, callback ) { + return this.animate( props, speed, easing, callback ); + }; +}); + +jQuery.speed = function( speed, easing, fn ) { + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { + complete: fn || !fn && easing || + jQuery.isFunction( speed ) && speed, + duration: speed, + easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing + }; + + opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : + opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; + + // normalize opt.queue - true/undefined/null -> "fx" + if ( opt.queue == null || opt.queue === true ) { + opt.queue = "fx"; + } + + // Queueing + opt.old = opt.complete; + + opt.complete = function() { + if ( jQuery.isFunction( opt.old ) ) { + opt.old.call( this ); + } + + if ( opt.queue ) { + jQuery.dequeue( this, opt.queue ); + } + }; + + return opt; +}; + +jQuery.easing = { + linear: function( p ) { + return p; + }, + swing: function( p ) { + return 0.5 - Math.cos( p*Math.PI ) / 2; + } +}; + +jQuery.timers = []; +jQuery.fx = Tween.prototype.init; +jQuery.fx.tick = function() { + var timer, + timers = jQuery.timers, + i = 0; + + fxNow = jQuery.now(); + + for ( ; i < timers.length; i++ ) { + timer = timers[ i ]; + // Checks the timer has not already been removed + if ( !timer() && timers[ i ] === timer ) { + timers.splice( i--, 1 ); + } + } + + if ( !timers.length ) { + jQuery.fx.stop(); + } + fxNow = undefined; +}; + +jQuery.fx.timer = function( timer ) { + if ( timer() && jQuery.timers.push( timer ) ) { + jQuery.fx.start(); + } +}; + +jQuery.fx.interval = 13; + +jQuery.fx.start = function() { + if ( !timerId ) { + timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); + } +}; + +jQuery.fx.stop = function() { + clearInterval( timerId ); + timerId = null; +}; + +jQuery.fx.speeds = { + slow: 600, + fast: 200, + // Default speed + _default: 400 +}; + +// Back Compat <1.8 extension point +jQuery.fx.step = {}; + +if ( jQuery.expr && jQuery.expr.filters ) { + jQuery.expr.filters.animated = function( elem ) { + return jQuery.grep(jQuery.timers, function( fn ) { + return elem === fn.elem; + }).length; + }; +} +jQuery.fn.offset = function( options ) { + if ( arguments.length ) { + return options === undefined ? + this : + this.each(function( i ) { + jQuery.offset.setOffset( this, options, i ); + }); + } + + var docElem, win, + box = { top: 0, left: 0 }, + elem = this[ 0 ], + doc = elem && elem.ownerDocument; + + if ( !doc ) { + return; + } + + docElem = doc.documentElement; + + // Make sure it's not a disconnected DOM node + if ( !jQuery.contains( docElem, elem ) ) { + return box; + } + + // If we don't have gBCR, just use 0,0 rather than error + // BlackBerry 5, iOS 3 (original iPhone) + if ( typeof elem.getBoundingClientRect !== core_strundefined ) { + box = elem.getBoundingClientRect(); + } + win = getWindow( doc ); + return { + top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), + left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) + }; +}; + +jQuery.offset = { + + setOffset: function( elem, options, i ) { + var position = jQuery.css( elem, "position" ); + + // set position first, in-case top/left are set even on static elem + if ( position === "static" ) { + elem.style.position = "relative"; + } + + var curElem = jQuery( elem ), + curOffset = curElem.offset(), + curCSSTop = jQuery.css( elem, "top" ), + curCSSLeft = jQuery.css( elem, "left" ), + calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, + props = {}, curPosition = {}, curTop, curLeft; + + // need to be able to calculate position if either top or left is auto and position is either absolute or fixed + if ( calculatePosition ) { + curPosition = curElem.position(); + curTop = curPosition.top; + curLeft = curPosition.left; + } else { + curTop = parseFloat( curCSSTop ) || 0; + curLeft = parseFloat( curCSSLeft ) || 0; + } + + if ( jQuery.isFunction( options ) ) { + options = options.call( elem, i, curOffset ); + } + + if ( options.top != null ) { + props.top = ( options.top - curOffset.top ) + curTop; + } + if ( options.left != null ) { + props.left = ( options.left - curOffset.left ) + curLeft; + } + + if ( "using" in options ) { + options.using.call( elem, props ); + } else { + curElem.css( props ); + } + } +}; + + +jQuery.fn.extend({ + + position: function() { + if ( !this[ 0 ] ) { + return; + } + + var offsetParent, offset, + parentOffset = { top: 0, left: 0 }, + elem = this[ 0 ]; + + // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent + if ( jQuery.css( elem, "position" ) === "fixed" ) { + // we assume that getBoundingClientRect is available when computed position is fixed + offset = elem.getBoundingClientRect(); + } else { + // Get *real* offsetParent + offsetParent = this.offsetParent(); + + // Get correct offsets + offset = this.offset(); + if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { + parentOffset = offsetParent.offset(); + } + + // Add offsetParent borders + parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); + parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); + } + + // Subtract parent offsets and element margins + // note: when an element has margin: auto the offsetLeft and marginLeft + // are the same in Safari causing offset.left to incorrectly be 0 + return { + top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), + left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true) + }; + }, + + offsetParent: function() { + return this.map(function() { + var offsetParent = this.offsetParent || document.documentElement; + while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) { + offsetParent = offsetParent.offsetParent; + } + return offsetParent || document.documentElement; + }); + } +}); + + +// Create scrollLeft and scrollTop methods +jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { + var top = /Y/.test( prop ); + + jQuery.fn[ method ] = function( val ) { + return jQuery.access( this, function( elem, method, val ) { + var win = getWindow( elem ); + + if ( val === undefined ) { + return win ? (prop in win) ? win[ prop ] : + win.document.documentElement[ method ] : + elem[ method ]; + } + + if ( win ) { + win.scrollTo( + !top ? val : jQuery( win ).scrollLeft(), + top ? val : jQuery( win ).scrollTop() + ); + + } else { + elem[ method ] = val; + } + }, method, val, arguments.length, null ); + }; +}); + +function getWindow( elem ) { + return jQuery.isWindow( elem ) ? + elem : + elem.nodeType === 9 ? + elem.defaultView || elem.parentWindow : + false; +} +// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods +jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { + jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { + // margin is only for outerHeight, outerWidth + jQuery.fn[ funcName ] = function( margin, value ) { + var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), + extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); + + return jQuery.access( this, function( elem, type, value ) { + var doc; + + if ( jQuery.isWindow( elem ) ) { + // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there + // isn't a whole lot we can do. See pull request at this URL for discussion: + // https://github.com/jquery/jquery/pull/764 + return elem.document.documentElement[ "client" + name ]; + } + + // Get document width or height + if ( elem.nodeType === 9 ) { + doc = elem.documentElement; + + // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest + // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. + return Math.max( + elem.body[ "scroll" + name ], doc[ "scroll" + name ], + elem.body[ "offset" + name ], doc[ "offset" + name ], + doc[ "client" + name ] + ); + } + + return value === undefined ? + // Get width or height on the element, requesting but not forcing parseFloat + jQuery.css( elem, type, extra ) : + + // Set width or height on the element + jQuery.style( elem, type, value, extra ); + }, type, chainable ? margin : undefined, chainable, null ); + }; + }); +}); +// Limit scope pollution from any deprecated API +// (function() { + +// })(); +// Expose jQuery to the global object +window.jQuery = window.$ = jQuery; + +// Expose jQuery as an AMD module, but only for AMD loaders that +// understand the issues with loading multiple versions of jQuery +// in a page that all might call define(). The loader will indicate +// they have special allowances for multiple jQuery versions by +// specifying define.amd.jQuery = true. Register as a named module, +// since jQuery can be concatenated with other files that may use define, +// but not use a proper concatenation script that understands anonymous +// AMD modules. A named AMD is safest and most robust way to register. +// Lowercase jquery is used because AMD module names are derived from +// file names, and jQuery is normally delivered in a lowercase file name. +// Do this after creating the global so that if an AMD module wants to call +// noConflict to hide this version of jQuery, it will work. +if ( typeof define === "function" && define.amd && define.amd.jQuery ) { + define( "jquery", [], function () { return jQuery; } ); +} + +})( window );
\ No newline at end of file diff --git a/afb-client/bower_components/tether/examples/resources/js/log.js b/afb-client/bower_components/tether/examples/resources/js/log.js new file mode 100644 index 0000000..6acd4fd --- /dev/null +++ b/afb-client/bower_components/tether/examples/resources/js/log.js @@ -0,0 +1,134 @@ +(function() { + var ffSupport, formats, getOrderedMatches, hasMatches, isFF, isIE, isOpera, isSafari, log, makeArray, operaSupport, safariSupport, stringToArgs, _log; + if (!(window.console && window.console.log)) { + return; + } + log = function() { + var args; + args = []; + makeArray(arguments).forEach(function(arg) { + if (typeof arg === 'string') { + return args = args.concat(stringToArgs(arg)); + } else { + return args.push(arg); + } + }); + return _log.apply(window, args); + }; + _log = function() { + return console.log.apply(console, makeArray(arguments)); + }; + makeArray = function(arrayLikeThing) { + return Array.prototype.slice.call(arrayLikeThing); + }; + formats = [ + { + regex: /\*([^\*]+)\*/, + replacer: function(m, p1) { + return "%c" + p1 + "%c"; + }, + styles: function() { + return ['font-style: italic', '']; + } + }, { + regex: /\_([^\_]+)\_/, + replacer: function(m, p1) { + return "%c" + p1 + "%c"; + }, + styles: function() { + return ['font-weight: bold', '']; + } + }, { + regex: /\`([^\`]+)\`/, + replacer: function(m, p1) { + return "%c" + p1 + "%c"; + }, + styles: function() { + return ['background: rgb(255, 255, 219); padding: 1px 5px; border: 1px solid rgba(0, 0, 0, 0.1)', '']; + } + }, { + regex: /\[c\=(?:\"|\')?((?:(?!(?:\"|\')\]).)*)(?:\"|\')?\]((?:(?!\[c\]).)*)\[c\]/, + replacer: function(m, p1, p2) { + return "%c" + p2 + "%c"; + }, + styles: function(match) { + return [match[1], '']; + } + } + ]; + hasMatches = function(str) { + var _hasMatches; + _hasMatches = false; + formats.forEach(function(format) { + if (format.regex.test(str)) { + return _hasMatches = true; + } + }); + return _hasMatches; + }; + getOrderedMatches = function(str) { + var matches; + matches = []; + formats.forEach(function(format) { + var match; + match = str.match(format.regex); + if (match) { + return matches.push({ + format: format, + match: match + }); + } + }); + return matches.sort(function(a, b) { + return a.match.index - b.match.index; + }); + }; + stringToArgs = function(str) { + var firstMatch, matches, styles; + styles = []; + while (hasMatches(str)) { + matches = getOrderedMatches(str); + firstMatch = matches[0]; + str = str.replace(firstMatch.format.regex, firstMatch.format.replacer); + styles = styles.concat(firstMatch.format.styles(firstMatch.match)); + } + return [str].concat(styles); + }; + isSafari = function() { + return /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor); + }; + isOpera = function() { + return /OPR/.test(navigator.userAgent) && /Opera/.test(navigator.vendor); + }; + isFF = function() { + return /Firefox/.test(navigator.userAgent); + }; + isIE = function() { + return /MSIE/.test(navigator.userAgent); + }; + safariSupport = function() { + var m; + m = navigator.userAgent.match(/AppleWebKit\/(\d+)\.(\d+)(\.|\+|\s)/); + if (!m) { + return false; + } + return 537.38 <= parseInt(m[1], 10) + (parseInt(m[2], 10) / 100); + }; + operaSupport = function() { + var m; + m = navigator.userAgent.match(/OPR\/(\d+)\./); + if (!m) { + return false; + } + return 15 <= parseInt(m[1], 10); + }; + ffSupport = function() { + return window.console.firebug || window.console.exception; + }; + if (isIE() || (isFF() && !ffSupport()) || (isOpera() && !operaSupport()) || (isSafari() && !safariSupport())) { + window.log = _log; + } else { + window.log = log; + } + window.log.l = _log; +}).call(this);
\ No newline at end of file diff --git a/afb-client/bower_components/tether/examples/scroll/index.html b/afb-client/bower_components/tether/examples/scroll/index.html new file mode 100644 index 0000000..40b0a61 --- /dev/null +++ b/afb-client/bower_components/tether/examples/scroll/index.html @@ -0,0 +1,922 @@ +<!DOCTYPE html> +<html> + <head> + <link rel="stylesheet" href="../resources/css/base.css" /> + <link rel="stylesheet" href="../common/css/style.css" /> + </head> + <body> + + <div class="instructions">Scroll the page</div> + + <h2>THE END OF THE TETHER</h2> + + <p>By Joseph Conrad</p> + + <h3>Chapter I</h3> + + <p>For a long time after the course of the steamer <em>Sofala</em> had been + altered for the land, the low swampy coast had retained its appearance + of a mere smudge of darkness beyond a belt of glitter. The sunrays + seemed to fall violently upon the calm sea--seemed to shatter themselves + upon an adamantine surface into sparkling dust, into a dazzling vapor + of light that blinded the eye and wearied the brain with its unsteady + brightness.</p> + + <p>Captain Whalley did not look at it. When his Serang, approaching the + roomy cane arm-chair which he filled capably, had informed him in a low + voice that the course was to be altered, he had risen at once and had + remained on his feet, face forward, while the head of his ship swung + through a quarter of a circle. He had not uttered a single word, not + even the word to steady the helm. It was the Serang, an elderly, alert, + little Malay, with a very dark skin, who murmured the order to the + helmsman. And then slowly Captain Whalley sat down again in the + arm-chair on the bridge and fixed his eyes on the deck between his feet.</p> + + <p>He could not hope to see anything new upon this lane of the sea. He had + been on these coasts for the last three years. From Low Cape to Malantan + the distance was fifty miles, six hours' steaming for the old ship with + the tide, or seven against. Then you steered straight for the land, and + by-and-by three palms would appear on the sky, tall and slim, and with + their disheveled heads in a bunch, as if in confidential criticism of + the dark mangroves. The Sofala would be headed towards the somber + strip of the coast, which at a given moment, as the ship closed with + it obliquely, would show several clean shining fractures--the brimful + estuary of a river. Then on through a brown liquid, three parts water + and one part black earth, on and on between the low shores, three parts + black earth and one part brackish water, the Sofala would plow her way + up-stream, as she had done once every month for these seven years or + more, long before he was aware of her existence, long before he had ever + thought of having anything to do with her and her invariable voyages. + The old ship ought to have known the road better than her men, who had + not been kept so long at it without a change; better than the faithful + Serang, whom he had brought over from his last ship to keep the + captain's watch; better than he himself, who had been her captain for + the last three years only. She could always be depended upon to make her + courses. Her compasses were never out. She was no trouble at all to + take about, as if her great age had given her knowledge, wisdom, and + steadiness. She made her landfalls to a degree of the bearing, and + almost to a minute of her allowed time. At any moment, as he sat on + the bridge without looking up, or lay sleepless in his bed, simply by + reckoning the days and the hours he could tell where he was--the precise + spot of the beat. He knew it well too, this monotonous huckster's + round, up and down the Straits; he knew its order and its sights and its + people. Malacca to begin with, in at daylight and out at dusk, to cross + over with a rigid phosphorescent wake this highway of the Far East. + Darkness and gleams on the water, clear stars on a black sky, perhaps + the lights of a home steamer keeping her unswerving course in the + middle, or maybe the elusive shadow of a native craft with her mat sails + flitting by silently--and the low land on the other side in sight + at daylight. At noon the three palms of the next place of call, up a + sluggish river. The only white man residing there was a retired young + sailor, with whom he had become friendly in the course of many voyages. + Sixty miles farther on there was another place of call, a deep bay with + only a couple of houses on the beach. And so on, in and out, picking + up coastwise cargo here and there, and finishing with a hundred miles' + steady steaming through the maze of an archipelago of small islands up + to a large native town at the end of the beat. There was a three days' + rest for the old ship before he started her again in inverse order, + seeing the same shores from another bearing, hearing the same voices + in the same places, back again to the Sofala's port of registry on + the great highway to the East, where he would take up a berth nearly + opposite the big stone pile of the harbor office till it was time to + start again on the old round of 1600 miles and thirty days. Not a very + enterprising life, this, for Captain Whalley, Henry Whalley, otherwise + Dare-devil Harry--Whalley of the Condor, a famous clipper in her day. + No. Not a very enterprising life for a man who had served famous firms, + who had sailed famous ships (more than one or two of them his own); who + had made famous passages, had been the pioneer of new routes and new + trades; who had steered across the unsurveyed tracts of the South Seas, + and had seen the sun rise on uncharted islands. Fifty years at sea, and + forty out in the East ("a pretty thorough apprenticeship," he used + to remark smilingly), had made him honorably known to a generation of + shipowners and merchants in all the ports from Bombay clear over to + where the East merges into the West upon the coast of the two Americas. + His fame remained writ, not very large but plain enough, on the + Admiralty charts. Was there not somewhere between Australia and China a + Whalley Island and a Condor Reef? On that dangerous coral formation the + celebrated clipper had hung stranded for three days, her captain and + crew throwing her cargo overboard with one hand and with the other, as + it were, keeping off her a flotilla of savage war-canoes. At that time + neither the island nor the reef had any official existence. Later the + officers of her Majesty's steam vessel Fusilier, dispatched to make a + survey of the route, recognized in the adoption of these two names the + enterprise of the man and the solidity of the ship. Besides, as anyone + who cares may see, the "General Directory," vol. ii. p. 410, begins the + description of the "Malotu or Whalley Passage" with the words: "This + advantageous route, first discovered in 1850 by Captain Whalley in the + ship Condor," &c., and ends by recommending it warmly to sailing vessels + leaving the China ports for the south in the months from December to + April inclusive.</p> + + <p>This was the clearest gain he had out of life. Nothing could rob him + of this kind of fame. The piercing of the Isthmus of Suez, like the + breaking of a dam, had let in upon the East a flood of new ships, new + men, new methods of trade. It had changed the face of the Eastern seas + and the very spirit of their life; so that his early experiences meant + nothing whatever to the new generation of seamen.</p> + + <p>In those bygone days he had handled many thousands of pounds of his + employers' money and of his own; he had attended faithfully, as by law + a shipmaster is expected to do, to the conflicting interests of owners, + charterers, and underwriters. He had never lost a ship or consented to + a shady transaction; and he had lasted well, outlasting in the end the + conditions that had gone to the making of his name. He had buried his + wife (in the Gulf of Petchili), had married off his daughter to the man + of her unlucky choice, and had lost more than an ample competence in the + crash of the notorious Travancore and Deccan Banking Corporation, whose + downfall had shaken the East like an earthquake. And he was sixty-five + years old.</p> + + <h3>Chapter II</h3> + + <p>His age sat lightly enough on him; and of his ruin he was not ashamed. + He had not been alone to believe in the stability of the Banking + Corporation. Men whose judgment in matters of finance was as expert as + his seamanship had commended the prudence of his investments, and had + themselves lost much money in the great failure. The only difference + between him and them was that he had lost his all. And yet not his all. + There had remained to him from his lost fortune a very pretty little + bark, Fair Maid, which he had bought to occupy his leisure of a retired + sailor--"to play with," as he expressed it himself.</p> + + <p>He had formally declared himself tired of the sea the year preceding his + daughter's marriage. But after the young couple had gone to settle in + Melbourne he found out that he could not make himself happy on shore. He + was too much of a merchant sea-captain for mere yachting to satisfy him. + He wanted the illusion of affairs; and his acquisition of the Fair + Maid preserved the continuity of his life. He introduced her to his + acquaintances in various ports as "my last command." When he grew too + old to be trusted with a ship, he would lay her up and go ashore to be + buried, leaving directions in his will to have the bark towed out and + scuttled decently in deep water on the day of the funeral. His daughter + would not grudge him the satisfaction of knowing that no stranger would + handle his last command after him. With the fortune he was able to leave + her, the value of a 500-ton bark was neither here nor there. All this + would be said with a jocular twinkle in his eye: the vigorous old man + had too much vitality for the sentimentalism of regret; and a little + wistfully withal, because he was at home in life, taking a genuine + pleasure in its feelings and its possessions; in the dignity of his + reputation and his wealth, in his love for his daughter, and in his + satisfaction with the ship--the plaything of his lonely leisure.</p> + + <p>He had the cabin arranged in accordance with his simple ideal of comfort + at sea. A big bookcase (he was a great reader) occupied one side of his + stateroom; the portrait of his late wife, a flat bituminous oil-painting + representing the profile and one long black ringlet of a young woman, + faced his bed-place. Three chronometers ticked him to sleep and greeted + him on waking with the tiny competition of their beats. He rose at five + every day. The officer of the morning watch, drinking his early cup + of coffee aft by the wheel, would hear through the wide orifice of the + copper ventilators all the splashings, blowings, and splutterings of + his captain's toilet. These noises would be followed by a sustained + deep murmur of the Lord's Prayer recited in a loud earnest voice. Five + minutes afterwards the head and shoulders of Captain Whalley emerged + out of the companion-hatchway. Invariably he paused for a while on the + stairs, looking all round at the horizon; upwards at the trim of the + sails; inhaling deep draughts of the fresh air. Only then he would step + out on the poop, acknowledging the hand raised to the peak of the cap + with a majestic and benign "Good morning to you." He walked the deck + till eight scrupulously. Sometimes, not above twice a year, he had to + use a thick cudgel-like stick on account of a stiffness in the hip--a + slight touch of rheumatism, he supposed. Otherwise he knew nothing of + the ills of the flesh. At the ringing of the breakfast bell he went + below to feed his canaries, wind up the chronometers, and take the + head of the table. From there he had before his eyes the big carbon + photographs of his daughter, her husband, and two fat-legged babies + --his grandchildren--set in black frames into the maplewood bulkheads + of the cuddy. After breakfast he dusted the glass over these portraits + himself with a cloth, and brushed the oil painting of his wife with a + plumate kept suspended from a small brass hook by the side of the heavy + gold frame. Then with the door of his stateroom shut, he would sit down + on the couch under the portrait to read a chapter out of a thick pocket + Bible--her Bible. But on some days he only sat there for half an hour + with his finger between the leaves and the closed book resting on his + knees. Perhaps he had remembered suddenly how fond of boat-sailing she + used to be.</p> + + <p>She had been a real shipmate and a true woman too. It was like an + article of faith with him that there never had been, and never could be, + a brighter, cheerier home anywhere afloat or ashore than his home under + the poop-deck of the Condor, with the big main cabin all white and gold, + garlanded as if for a perpetual festival with an unfading wreath. She + had decorated the center of every panel with a cluster of home flowers. + It took her a twelvemonth to go round the cuddy with this labor of love. + To him it had remained a marvel of painting, the highest achievement of + taste and skill; and as to old Swinburne, his mate, every time he + came down to his meals he stood transfixed with admiration before the + progress of the work. You could almost smell these roses, he declared, + sniffing the faint flavor of turpentine which at that time pervaded the + saloon, and (as he confessed afterwards) made him somewhat less hearty + than usual in tackling his food. But there was nothing of the sort to + interfere with his enjoyment of her singing. "Mrs. Whalley is a regular + out-and-out nightingale, sir," he would pronounce with a judicial air + after listening profoundly over the skylight to the very end of the + piece. In fine weather, in the second dog-watch, the two men could hear + her trills and roulades going on to the accompaniment of the piano in + the cabin. On the very day they got engaged he had written to London + for the instrument; but they had been married for over a year before it + reached them, coming out round the Cape. The big case made part of the + first direct general cargo landed in Hong-kong harbor--an event that to + the men who walked the busy quays of to-day seemed as hazily remote as + the dark ages of history. But Captain Whalley could in a half hour of + solitude live again all his life, with its romance, its idyl, and its + sorrow. He had to close her eyes himself. She went away from under the + ensign like a sailor's wife, a sailor herself at heart. He had read + the service over her, out of her own prayer-book, without a break in his + voice. When he raised his eyes he could see old Swinburne facing him + with his cap pressed to his breast, and his rugged, weather-beaten, + impassive face streaming with drops of water like a lump of chipped red + granite in a shower. It was all very well for that old sea-dog to cry. + He had to read on to the end; but after the splash he did not remember + much of what happened for the next few days. An elderly sailor of the + crew, deft at needlework, put together a mourning frock for the child + out of one of her black skirts.</p> + + <p>He was not likely to forget; but you cannot dam up life like a sluggish + stream. It will break out and flow over a man's troubles, it will close + upon a sorrow like the sea upon a dead body, no matter how much love has + gone to the bottom. And the world is not bad. People had been very + kind to him; especially Mrs. Gardner, the wife of the senior partner + in Gardner, Patteson, & Co., the owners of the Condor. It was she who + volunteered to look after the little one, and in due course took her to + England (something of a journey in those days, even by the overland + mail route) with her own girls to finish her education. It was ten years + before he saw her again.</p> + + <p>As a little child she had never been frightened of bad weather; she + would beg to be taken up on deck in the bosom of his oilskin coat to + watch the big seas hurling themselves upon the Condor. The swirl and + crash of the waves seemed to fill her small soul with a breathless + delight. "A good boy spoiled," he used to say of her in joke. He had + named her Ivy because of the sound of the word, and obscurely fascinated + by a vague association of ideas. She had twined herself tightly round + his heart, and he intended her to cling close to her father as to a + tower of strength; forgetting, while she was little, that in the nature + of things she would probably elect to cling to someone else. But + he loved life well enough for even that event to give him a certain + satisfaction, apart from his more intimate feeling of loss.</p> + + <p>After he had purchased the Fair Maid to occupy his loneliness, he + hastened to accept a rather unprofitable freight to Australia simply for + the opportunity of seeing his daughter in her own home. What made him + dissatisfied there was not to see that she clung now to somebody else, + but that the prop she had selected seemed on closer examination "a + rather poor stick"--even in the matter of health. He disliked his + son-in-law's studied civility perhaps more than his method of + handling the sum of money he had given Ivy at her marriage. But of his + apprehensions he said nothing. Only on the day of his departure, with + the hall-door open already, holding her hands and looking steadily into + her eyes, he had said, "You know, my dear, all I have is for you and the + chicks. Mind you write to me openly." She had answered him by an almost + imperceptible movement of her head. She resembled her mother in + the color of her eyes, and in character--and also in this, that she + understood him without many words.</p> + + <p>Sure enough she had to write; and some of these letters made Captain + Whalley lift his white eye-brows. For the rest he considered he was + reaping the true reward of his life by being thus able to produce on + demand whatever was needed. He had not enjoyed himself so much in a + way since his wife had died. Characteristically enough his son-in-law's + punctuality in failure caused him at a distance to feel a sort of + kindness towards the man. The fellow was so perpetually being jammed on + a lee shore that to charge it all to his reckless navigation would be + manifestly unfair. No, no! He knew well what that meant. It was bad + luck. His own had been simply marvelous, but he had seen in his life too + many good men--seamen and others--go under with the sheer weight of bad + luck not to recognize the fatal signs. For all that, he was cogitating + on the best way of tying up very strictly every penny he had to leave, + when, with a preliminary rumble of rumors (whose first sound reached + him in Shanghai as it happened), the shock of the big failure came; + and, after passing through the phases of stupor, of incredulity, of + indignation, he had to accept the fact that he had nothing to speak of + to leave.</p> + + <p>Upon that, as if he had only waited for this catastrophe, the unlucky + man, away there in Melbourne, gave up his unprofitable game, and sat + down--in an invalid's bath-chair at that too. "He will never walk + again," wrote the wife. For the first time in his life Captain Whalley + was a bit staggered.</p> + + <p>The Fair Maid had to go to work in bitter earnest now. It was no longer + a matter of preserving alive the memory of Dare-devil Harry Whalley in + the Eastern Seas, or of keeping an old man in pocket-money and clothes, + with, perhaps, a bill for a few hundred first-class cigars thrown in at + the end of the year. He would have to buckle-to, and keep her going hard + on a scant allowance of gilt for the ginger-bread scrolls at her stem + and stern.</p> + + <p>This necessity opened his eyes to the fundamental changes of the world. + Of his past only the familiar names remained, here and there, but + the things and the men, as he had known them, were gone. The name of + Gardner, Patteson, & Co. was still displayed on the walls of warehouses + by the waterside, on the brass plates and window-panes in the business + quarters of more than one Eastern port, but there was no longer a + Gardner or a Patteson in the firm. There was no longer for Captain + Whalley an arm-chair and a welcome in the private office, with a bit of + business ready to be put in the way of an old friend, for the sake of + bygone services. The husbands of the Gardner girls sat behind the desks + in that room where, long after he had left the employ, he had kept his + right of entrance in the old man's time. Their ships now had yellow + funnels with black tops, and a time-table of appointed routes like a + confounded service of tramways. The winds of December and June were all + one to them; their captains (excellent young men he doubted not) were, + to be sure, familiar with Whalley Island, because of late years the + Government had established a white fixed light on the north end (with + a red danger sector over the Condor Reef), but most of them would have + been extremely surprised to hear that a flesh-and-blood Whalley still + existed--an old man going about the world trying to pick up a cargo here + and there for his little bark.</p> + + <p>And everywhere it was the same. Departed the men who would have nodded + appreciatively at the mention of his name, and would have thought + themselves bound in honor to do something for Dare-devil Harry Whalley. + Departed the opportunities which he would have known how to seize; and + gone with them the white-winged flock of clippers that lived in the + boisterous uncertain life of the winds, skimming big fortunes out of + the foam of the sea. In a world that pared down the profits to an + irreducible minimum, in a world that was able to count its disengaged + tonnage twice over every day, and in which lean charters were snapped up + by cable three months in advance, there were no chances of fortune for + an individual wandering haphazard with a little bark--hardly indeed any + room to exist.</p> + + <p>He found it more difficult from year to year. He suffered greatly from + the smallness of remittances he was able to send his daughter. Meantime + he had given up good cigars, and even in the matter of inferior cheroots + limited himself to six a day. He never told her of his difficulties, and + she never enlarged upon her struggle to live. Their confidence in each + other needed no explanations, and their perfect understanding endured + without protestations of gratitude or regret. He would have been shocked + if she had taken it into her head to thank him in so many words, but + he found it perfectly natural that she should tell him she needed two + hundred pounds.</p> + + <p>He had come in with the Fair Maid in ballast to look for a freight in + the Sofala's port of registry, and her letter met him there. Its tenor + was that it was no use mincing matters. Her only resource was in opening + a boarding-house, for which the prospects, she judged, were good. Good + enough, at any rate, to make her tell him frankly that with two hundred + pounds she could make a start. He had torn the envelope open, hastily, + on deck, where it was handed to him by the ship-chandler's runner, who + had brought his mail at the moment of anchoring. For the second time + in his life he was appalled, and remained stock-still at the cabin door + with the paper trembling between his fingers. Open a boarding-house! Two + hundred pounds for a start! The only resource! And he did not know where + to lay his hands on two hundred pence.</p> + + <p>All that night Captain Whalley walked the poop of his anchored ship, as + though he had been about to close with the land in thick weather, and + uncertain of his position after a run of many gray days without a sight + of sun, moon, or stars. The black night twinkled with the guiding lights + of seamen and the steady straight lines of lights on shore; and all + around the Fair Maid the riding lights of ships cast trembling trails + upon the water of the roadstead. Captain Whalley saw not a gleam + anywhere till the dawn broke and he found out that his clothing was + soaked through with the heavy dew.</p> + + <p>His ship was awake. He stopped short, stroked his wet beard, and + descended the poop ladder backwards, with tired feet. At the sight + of him the chief officer, lounging about sleepily on the quarterdeck, + remained open-mouthed in the middle of a great early-morning yawn.</p> + + <p>"Good morning to you," pronounced Captain Whalley solemnly, passing into + the cabin. But he checked himself in the doorway, and without looking + back, "By the bye," he said, "there should be an empty wooden case put + away in the lazarette. It has not been broken up--has it?"</p> + + <p>The mate shut his mouth, and then asked as if dazed, "What empty case, + sir?"</p> + + <p>"A big flat packing-case belonging to that painting in my room. Let it + be taken up on deck and tell the carpenter to look it over. I may want + to use it before long."</p> + + <p>The chief officer did not stir a limb till he had heard the door of the + captain's state-room slam within the cuddy. Then he beckoned aft the + second mate with his forefinger to tell him that there was something "in + the wind."</p> + + <p>When the bell rang Captain Whalley's authoritative voice boomed out + through a closed door, "Sit down and don't wait for me." And his + impressed officers took their places, exchanging looks and whispers + across the table. What! No breakfast? And after apparently knocking + about all night on deck, too! Clearly, there was something in the wind. + In the skylight above their heads, bowed earnestly over the plates, + three wire cages rocked and rattled to the restless jumping of the + hungry canaries; and they could detect the sounds of their "old + man's" deliberate movements within his state-room. Captain Whalley was + methodically winding up the chronometers, dusting the portrait of + his late wife, getting a clean white shirt out of the drawers, making + himself ready in his punctilious unhurried manner to go ashore. He could + not have swallowed a single mouthful of food that morning. He had made + up his mind to sell the Fair Maid.</p> + + <h3>Chapter III</h3> + + <p>Just at that time the Japanese were casting far and wide for ships + of European build, and he had no difficulty in finding a purchaser, a + speculator who drove a hard bargain, but paid cash down for the Fair + Maid, with a view to a profitable resale. Thus it came about that + Captain Whalley found himself on a certain afternoon descending the + steps of one of the most important post-offices of the East with a slip + of bluish paper in his hand. This was the receipt of a registered letter + enclosing a draft for two hundred pounds, and addressed to Melbourne. + Captain Whalley pushed the paper into his waistcoat-pocket, took his + stick from under his arm, and walked down the street.</p> + + <p>It was a recently opened and untidy thoroughfare with rudimentary + side-walks and a soft layer of dust cushioning the whole width of + the road. One end touched the slummy street of Chinese shops near the + harbor, the other drove straight on, without houses, for a couple of + miles, through patches of jungle-like vegetation, to the yard gates + of the new Consolidated Docks Company. The crude frontages of the new + Government buildings alternated with the blank fencing of vacant plots, + and the view of the sky seemed to give an added spaciousness to the + broad vista. It was empty and shunned by natives after business + hours, as though they had expected to see one of the tigers from the + neighborhood of the New Waterworks on the hill coming at a loping canter + down the middle to get a Chinese shopkeeper for supper. Captain Whalley + was not dwarfed by the solitude of the grandly planned street. He + had too fine a presence for that. He was only a lonely figure walking + purposefully, with a great white beard like a pilgrim, and with a thick + stick that resembled a weapon. On one side the new Courts of Justice had + a low and unadorned portico of squat columns half concealed by a few old + trees left in the approach. On the other the pavilion wings of the + new Colonial Treasury came out to the line of the street. But Captain + Whalley, who had now no ship and no home, remembered in passing that + on that very site when he first came out from England there had stood a + fishing village, a few mat huts erected on piles between a muddy tidal + creek and a miry pathway that went writhing into a tangled wilderness + without any docks or waterworks.</p> + + <p>No ship--no home. And his poor Ivy away there had no home either. A + boarding-house is no sort of home though it may get you a living. His + feelings were horribly rasped by the idea of the boarding-house. In his + rank of life he had that truly aristocratic temperament characterized by + a scorn of vulgar gentility and by prejudiced views as to the derogatory + nature of certain occupations. For his own part he had always preferred + sailing merchant ships (which is a straightforward occupation) to buying + and selling merchandise, of which the essence is to get the better of + somebody in a bargain--an undignified trial of wits at best. His father + had been Colonel Whalley (retired) of the H. E. I. Company's service, + with very slender means besides his pension, but with distinguished + connections. He could remember as a boy how frequently waiters at the + inns, country tradesmen and small people of that sort, used to "My lord" + the old warrior on the strength of his appearance.</p> + + <p>Captain Whalley himself (he would have entered the Navy if his father + had not died before he was fourteen) had something of a grand air which + would have suited an old and glorious admiral; but he became lost like + a straw in the eddy of a brook amongst the swarm of brown and yellow + humanity filling a thoroughfare, that by contrast with the vast and + empty avenue he had left seemed as narrow as a lane and absolutely + riotous with life. The walls of the houses were blue; the shops of the + Chinamen yawned like cavernous lairs; heaps of nondescript merchandise + overflowed the gloom of the long range of arcades, and the fiery + serenity of sunset took the middle of the street from end to end with a + glow like the reflection of a fire. It fell on the bright colors and the + dark faces of the bare-footed crowd, on the pallid yellow backs of the + half-naked jostling coolies, on the accouterments of a tall Sikh trooper + with a parted beard and fierce mustaches on sentry before the gate of + the police compound. Looming very big above the heads in a red haze of + dust, the tightly packed car of the cable tramway navigated cautiously + up the human stream, with the incessant blare of its horn, in the manner + of a steamer groping in a fog.</p> + + <p>Captain Whalley emerged like a diver on the other side, and in the + desert shade between the walls of closed warehouses removed his hat to + cool his brow. A certain disrepute attached to the calling of a + landlady of a boarding-house. These women were said to be rapacious, + unscrupulous, untruthful; and though he contemned no class of his + fellow-creatures--God forbid!--these were suspicions to which it was + unseemly that a Whalley should lay herself open. He had not expostulated + with her, however. He was confident she shared his feelings; he was + sorry for her; he trusted her judgment; he considered it a merciful + dispensation that he could help her once more,--but in his aristocratic + heart of hearts he would have found it more easy to reconcile himself to + the idea of her turning seamstress. Vaguely he remembered reading years + ago a touching piece called the "Song of the Shirt." It was all very + well making songs about poor women. The granddaughter of Colonel + Whalley, the landlady of a boarding-house! Pooh! He replaced his hat, + dived into two pockets, and stopping a moment to apply a flaring match + to the end of a cheap cheroot, blew an embittered cloud of smoke at a + world that could hold such surprises.</p> + + <p>Of one thing he was certain--that she was the own child of a clever + mother. Now he had got over the wrench of parting with his ship, he + perceived clearly that such a step had been unavoidable. Perhaps he had + been growing aware of it all along with an unconfessed knowledge. But + she, far away there, must have had an intuitive perception of it, with + the pluck to face that truth and the courage to speak out--all the + qualities which had made her mother a woman of such excellent counsel.</p> + + <p>It would have had to come to that in the end! It was fortunate she had + forced his hand. In another year or two it would have been an utterly + barren sale. To keep the ship going he had been involving himself deeper + every year. He was defenseless before the insidious work of adversity, + to whose more open assaults he could present a firm front; like a + cliff that stands unmoved the open battering of the sea, with a lofty + ignorance of the treacherous backwash undermining its base. As it was, + every liability satisfied, her request answered, and owing no man a + penny, there remained to him from the proceeds a sum of five hundred + pounds put away safely. In addition he had upon his person some forty + odd dollars--enough to pay his hotel bill, providing he did not linger + too long in the modest bedroom where he had taken refuge.</p> + + <p>Scantily furnished, and with a waxed floor, it opened into one of + the side-verandas. The straggling building of bricks, as airy as a + bird-cage, resounded with the incessant flapping of rattan screens + worried by the wind between the white-washed square pillars of the + sea-front. The rooms were lofty, a ripple of sunshine flowed over the + ceilings; and the periodical invasions of tourists from some passenger + steamer in the harbor flitted through the wind-swept dusk of the + apartments with the tumult of their unfamiliar voices and impermanent + presences, like relays of migratory shades condemned to speed headlong + round the earth without leaving a trace. The babble of their irruptions + ebbed out as suddenly as it had arisen; the draughty corridors and + the long chairs of the verandas knew their sight-seeing hurry or + their prostrate repose no more; and Captain Whalley, substantial and + dignified, left well-nigh alone in the vast hotel by each light-hearted + skurry, felt more and more like a stranded tourist with no aim in view, + like a forlorn traveler without a home. In the solitude of his room he + smoked thoughtfully, gazing at the two sea-chests which held all that he + could call his own in this world. A thick roll of charts in a sheath + of sailcloth leaned in a corner; the flat packing-case containing the + portrait in oils and the three carbon photographs had been pushed under + the bed. He was tired of discussing terms, of assisting at surveys, of + all the routine of the business. What to the other parties was merely + the sale of a ship was to him a momentous event involving a radically + new view of existence. He knew that after this ship there would be no + other; and the hopes of his youth, the exercise of his abilities, every + feeling and achievement of his manhood, had been indissolubly connected + with ships. He had served ships; he had owned ships; and even the years + of his actual retirement from the sea had been made bearable by the idea + that he had only to stretch out his hand full of money to get a ship. He + had been at liberty to feel as though he were the owner of all the + ships in the world. The selling of this one was weary work; but when + she passed from him at last, when he signed the last receipt, it was as + though all the ships had gone out of the world together, leaving him on + the shore of inaccessible oceans with seven hundred pounds in his hands.</p> + + <p>Striding firmly, without haste, along the quay, Captain Whalley averted + his glances from the familiar roadstead. Two generations of seamen born + since his first day at sea stood between him and all these ships at the + anchorage. His own was sold, and he had been asking himself, What next?</p> + + <p>From the feeling of loneliness, of inward emptiness,--and of loss + too, as if his very soul had been taken out of him forcibly,--there had + sprung at first a desire to start right off and join his daughter. + "Here are the last pence," he would say to her; "take them, my dear. And + here's your old father: you must take him too."</p> + + <p>His soul recoiled, as if afraid of what lay hidden at the bottom of + this impulse. Give up! Never! When one is thoroughly weary all sorts of + nonsense come into one's head. A pretty gift it would have been for a + poor woman--this seven hundred pounds with the incumbrance of a hale old + fellow more than likely to last for years and years to come. Was he not + as fit to die in harness as any of the youngsters in charge of these + anchored ships out yonder? He was as solid now as ever he had been. But + as to who would give him work to do, that was another matter. Were he, + with his appearance and antecedents, to go about looking for a junior's + berth, people, he was afraid, would not take him seriously; or else if + he succeeded in impressing them, he would maybe obtain their pity, which + would be like stripping yourself naked to be kicked. He was not anxious + to give himself away for less than nothing. He had no use for anybody's + pity. On the other hand, a command--the only thing he could try for with + due regard for common decency--was not likely to be lying in wait + for him at the corner of the next street. Commands don't go a-begging + nowadays. Ever since he had come ashore to carry out the business of + the sale he had kept his ears open, but had heard no hint of one being + vacant in the port. And even if there had been one, his successful past + itself stood in his way. He had been his own employer too long. The only + credential he could produce was the testimony of his whole life. What + better recommendation could anyone require? But vaguely he felt that + the unique document would be looked upon as an archaic curiosity of the + Eastern waters, a screed traced in obsolete words--in a half-forgotten + language.</p> + + <h3>Chapter IV</h3> + + <p>Revolving these thoughts, he strolled on near the railings of the quay, + broad-chested, without a stoop, as though his big shoulders had never + felt the burden of the loads that must be carried between the cradle + and the grave. No single betraying fold or line of care disfigured the + reposeful modeling of his face. It was full and untanned; and the upper + part emerged, massively quiet, out of the downward flow of silvery hair, + with the striking delicacy of its clear complexion and the powerful + width of the forehead. The first cast of his glance fell on you candid + and swift, like a boy's; but because of the ragged snowy thatch of the + eyebrows the affability of his attention acquired the character of a + dark and searching scrutiny. With age he had put on flesh a little, had + increased his girth like an old tree presenting no symptoms of decay; + and even the opulent, lustrous ripple of white hairs upon his chest + seemed an attribute of unquenchable vitality and vigor.</p> + + <p>Once rather proud of his great bodily strength, and even of his personal + appearance, conscious of his worth, and firm in his rectitude, there had + remained to him, like the heritage of departed prosperity, the tranquil + bearing of a man who had proved himself fit in every sort of way for the + life of his choice. He strode on squarely under the projecting brim of + an ancient Panama hat. It had a low crown, a crease through its whole + diameter, a narrow black ribbon. Imperishable and a little discolored, + this headgear made it easy to pick him out from afar on thronged wharves + and in the busy streets. He had never adopted the comparatively modern + fashion of pipeclayed cork helmets. He disliked the form; and he hoped + he could manage to keep a cool head to the end of his life without all + these contrivances for hygienic ventilation. His hair was cropped close, + his linen always of immaculate whiteness; a suit of thin gray flannel, + worn threadbare but scrupulously brushed, floated about his burly limbs, + adding to his bulk by the looseness of its cut. The years had mellowed + the good-humored, imperturbable audacity of his prime into a temper + carelessly serene; and the leisurely tapping of his iron-shod stick + accompanied his footfalls with a self-confident sound on the flagstones. + It was impossible to connect such a fine presence and this unruffled + aspect with the belittling troubles of poverty; the man's whole + existence appeared to pass before you, facile and large, in the freedom + of means as ample as the clothing of his body.</p> + + <p>The irrational dread of having to break into his five hundred pounds for + personal expenses in the hotel disturbed the steady poise of his mind. + There was no time to lose. The bill was running up. He nourished the + hope that this five hundred would perhaps be the means, if everything + else failed, of obtaining some work which, keeping his body and soul + together (not a matter of great outlay), would enable him to be of use + to his daughter. To his mind it was her own money which he employed, as + it were, in backing her father and solely for her benefit. Once at work, + he would help her with the greater part of his earnings; he was good for + many years yet, and this boarding-house business, he argued to himself, + whatever the prospects, could not be much of a gold-mine from the first + start. But what work? He was ready to lay hold of anything in an honest + way so that it came quickly to his hand; because the five hundred pounds + must be preserved intact for eventual use. That was the great point. + With the entire five hundred one felt a substance at one's back; but + it seemed to him that should he let it dwindle to four-fifty or even + four-eighty, all the efficiency would be gone out of the money, as though + there were some magic power in the round figure. But what sort of work?</p> + + <p>Confronted by that haunting question as by an uneasy ghost, for whom he + had no exorcising formula, Captain Whalley stopped short on the apex + of a small bridge spanning steeply the bed of a canalized creek with + granite shores. Moored between the square blocks a seagoing Malay prau + floated half hidden under the arch of masonry, with her spars lowered + down, without a sound of life on board, and covered from stem to stern + with a ridge of palm-leaf mats. He had left behind him the overheated + pavements bordered by the stone frontages that, like the sheer face of + cliffs, followed the sweep of the quays; and an unconfined spaciousness + of orderly and sylvan aspect opened before him its wide plots of rolled + grass, like pieces of green carpet smoothly pegged out, its long ranges + of trees lined up in colossal porticos of dark shafts roofed with a + vault of branches.</p> + + <p>Some of these avenues ended at the sea. It was a terraced shore; and + beyond, upon the level expanse, profound and glistening like the gaze + of a dark-blue eye, an oblique band of stippled purple lengthened itself + indefinitely through the gap between a couple of verdant twin islets. + The masts and spars of a few ships far away, hull down in the outer + roads, sprang straight from the water in a fine maze of rosy lines + penciled on the clear shadow of the eastern board. Captain Whalley gave + them a long glance. The ship, once his own, was anchored out there. It + was staggering to think that it was open to him no longer to take a boat + at the jetty and get himself pulled off to her when the evening came. To + no ship. Perhaps never more. Before the sale was concluded, and till the + purchase-money had been paid, he had spent daily some time on board the + Fair Maid. The money had been paid this very morning, and now, all at + once, there was positively no ship that he could go on board of when he + liked; no ship that would need his presence in order to do her work--to + live. It seemed an incredible state of affairs, something too bizarre + to last. And the sea was full of craft of all sorts. There was that prau + lying so still swathed in her shroud of sewn palm-leaves--she too had + her indispensable man. They lived through each other, this Malay he had + never seen, and this high-sterned thing of no size that seemed to be + resting after a long journey. And of all the ships in sight, near and + far, each was provided with a man, the man without whom the finest ship + is a dead thing, a floating and purposeless log.</p> + + <p>After his one glance at the roadstead he went on, since there was + nothing to turn back for, and the time must be got through somehow. The + avenues of big trees ran straight over the Esplanade, cutting each other + at diverse angles, columnar below and luxuriant above. The interlaced + boughs high up there seemed to slumber; not a leaf stirred overhead: + and the reedy cast-iron lampposts in the middle of the road, gilt like + scepters, diminished in a long perspective, with their globes of white + porcelain atop, resembling a barbarous decoration of ostriches' eggs + displayed in a row. The flaming sky kindled a tiny crimson spark upon + the glistening surface of each glassy shell.</p> + + <p>With his chin sunk a little, his hands behind his back, and the end of + his stick marking the gravel with a faint wavering line at his heels, + Captain Whalley reflected that if a ship without a man was like a body + without a soul, a sailor without a ship was of not much more account + in this world than an aimless log adrift upon the sea. The log might be + sound enough by itself, tough of fiber, and hard to destroy--but what of + that! And a sudden sense of irremediable idleness weighted his feet like + a great fatigue.</p> + + <p>A succession of open carriages came bowling along the newly opened + sea-road. You could see across the wide grass-plots the discs of + vibration made by the spokes. The bright domes of the parasols swayed + lightly outwards like full-blown blossoms on the rim of a vase; and + the quiet sheet of dark-blue water, crossed by a bar of purple, made a + background for the spinning wheels and the high action of the horses, + whilst the turbaned heads of the Indian servants elevated above the line + of the sea horizon glided rapidly on the paler blue of the sky. In an + open space near the little bridge each turn-out trotted smartly in a + wide curve away from the sunset; then pulling up sharp, entered the main + alley in a long slow-moving file with the great red stillness of the sky + at the back. The trunks of mighty trees stood all touched with red on + the same side, the air seemed aflame under the high foliage, the + very ground under the hoofs of the horses was red. The wheels turned + solemnly; one after another the sunshades drooped, folding their colors + like gorgeous flowers shutting their petals at the end of the day. In + the whole half-mile of human beings no voice uttered a distinct word, + only a faint thudding noise went on mingled with slight jingling sounds, + and the motionless heads and shoulders of men and women sitting in + couples emerged stolidly above the lowered hoods--as if wooden. But one + carriage and pair coming late did not join the line.</p> + + <p>It fled along in a noiseless roll; but on entering the avenue one of the + dark bays snorted, arching his neck and shying against the steel-tipped + pole; a flake of foam fell from the bit upon the point of a satiny + shoulder, and the dusky face of the coachman leaned forward at once over + the hands taking a fresh grip of the reins. It was a long dark-green + landau, having a dignified and buoyant motion between the sharply + curved C-springs, and a sort of strictly official majesty in its supreme + elegance. It seemed more roomy than is usual, its horses seemed slightly + bigger, the appointments a shade more perfect, the servants perched + somewhat higher on the box. The dresses of three women--two young + and pretty, and one, handsome, large, of mature age--seemed to fill + completely the shallow body of the carriage. The fourth face was that + of a man, heavy lidded, distinguished and sallow, with a somber, thick, + iron-gray imperial and mustaches, which somehow had the air of solid + appendages. His Excellency--</p> + + <p>The rapid motion of that one equipage made all the others appear utterly + inferior, blighted, and reduced to crawl painfully at a snail's pace. + The landau distanced the whole file in a sort of sustained rush; the + features of the occupant whirling out of sight left behind an impression + of fixed stares and impassive vacancy; and after it had vanished in full + flight as it were, notwithstanding the long line of vehicles hugging the + curb at a walk, the whole lofty vista of the avenue seemed to lie open + and emptied of life in the enlarged impression of an august solitude.</p> + + <p>Captain Whalley had lifted his head to look, and his mind, disturbed in + its meditation, turned with wonder (as men's minds will do) to matters + of no importance. It struck him that it was to this port, where he had + just sold his last ship, that he had come with the very first he had + ever owned, and with his head full of a plan for opening a new trade + with a distant part of the Archipelago. The then governor had given + him no end of encouragement. No Excellency he--this Mr. Denham--this + governor with his jacket off; a man who tended night and day, so to + speak, the growing prosperity of the settlement with the self-forgetful + devotion of a nurse for a child she loves; a lone bachelor who lived as + in a camp with the few servants and his three dogs in what was called + then the Government Bungalow: a low-roofed structure on the half-cleared + slope of a hill, with a new flagstaff in front and a police orderly on + the veranda. He remembered toiling up that hill under a heavy sun for + his audience; the unfurnished aspect of the cool shaded room; the long + table covered at one end with piles of papers, and with two guns, a + brass telescope, a small bottle of oil with a feather stuck in the neck + at the other--and the flattering attention given to him by the man in + power. It was an undertaking full of risk he had come to expound, but a + twenty minutes' talk in the Government Bungalow on the hill had made it + go smoothly from the start. And as he was retiring Mr. Denham, already + seated before the papers, called out after him, "Next month the Dido + starts for a cruise that way, and I shall request her captain officially + to give you a look in and see how you get on." The Dido was one of the + smart frigates on the China station--and five-and-thirty years make a + big slice of time. Five-and-thirty years ago an enterprise like his had + for the colony enough importance to be looked after by a Queen's ship. + A big slice of time. Individuals were of some account then. Men like + himself; men, too, like poor Evans, for instance, with his red face, + his coal-black whiskers, and his restless eyes, who had set up the first + patent slip for repairing small ships, on the edge of the forest, in + a lonely bay three miles up the coast. Mr. Denham had encouraged that + enterprise too, and yet somehow poor Evans had ended by dying at + home deucedly hard up. His son, they said, was squeezing oil out of + cocoa-nuts for a living on some God-forsaken islet of the Indian Ocean; + but it was from that patent slip in a lonely wooded bay that had sprung + the workshops of the Consolidated Docks Company, with its three + graving basins carved out of solid rock, its wharves, its jetties, + its electric-light plant, its steam-power houses--with its gigantic + sheer-legs, fit to lift the heaviest weight ever carried afloat, and + whose head could be seen like the top of a queer white monument peeping + over bushy points of land and sandy promontories, as you approached the + New Harbor from the west.</p> + + <p>There had been a time when men counted: there were not so many carriages + in the colony then, though Mr. Denham, he fancied, had a buggy. And + Captain Whalley seemed to be swept out of the great avenue by the swirl + of a mental backwash. He remembered muddy shores, a harbor without + quays, the one solitary wooden pier (but that was a public work) jutting + out crookedly, the first coal-sheds erected on Monkey Point, that caught + fire mysteriously and smoldered for days, so that amazed ships came + into a roadstead full of sulphurous smoke, and the sun hung blood-red + at midday. He remembered the things, the faces, and something more + besides--like the faint flavor of a cup quaffed to the bottom, like a + subtle sparkle of the air that was not to be found in the atmosphere of + to-day.</p> + + <p>In this evocation, swift and full of detail like a flash of magnesium + light into the niches of a dark memorial hall, Captain Whalley + contemplated things once important, the efforts of small men, the growth + of a great place, but now robbed of all consequence by the greatness + of accomplished facts, by hopes greater still; and they gave him for a + moment such an almost physical grip upon time, such a comprehension of + our unchangeable feelings, that he stopped short, struck the ground with + his stick, and ejaculated mentally, "What the devil am I doing here!" He + seemed lost in a sort of surprise; but he heard his name called out in + wheezy tones once, twice--and turned on his heels slowly.</p> + + <p>He beheld then, waddling towards him autocratically, a man of an + old-fashioned and gouty aspect, with hair as white as his own, but with + shaved, florid cheeks, wearing a necktie--almost a neckcloth--whose + stiff ends projected far beyond his chin; with round legs, round arms, + a round body, a round face--generally producing the effect of his short + figure having been distended by means of an air-pump as much as the + seams of his clothing would stand. This was the Master-Attendant of the + port. A master-attendant is a superior sort of harbor-master; a person, + out in the East, of some consequence in his sphere; a Government + official, a magistrate for the waters of the port, and possessed of vast + but ill-defined disciplinary authority over seamen of all classes. + This particular Master-Attendant was reported to consider it miserably + inadequate, on the ground that it did not include the power of life + and death. This was a jocular exaggeration. Captain Eliott was fairly + satisfied with his position, and nursed no inconsiderable sense of such + power as he had. His conceited and tyrannical disposition did not allow + him to let it dwindle in his hands for want of use. The uproarious, + choleric frankness of his comments on people's character and conduct + caused him to be feared at bottom; though in conversation many pretended + not to mind him in the least, others would only smile sourly at the + mention of his name, and there were even some who dared to pronounce him + "a meddlesome old ruffian." But for almost all of them one of Captain + Eliott's outbreaks was nearly as distasteful to face as a chance of + annihilation.</p> + + <style> + body { + padding: 15px; + } + + .pointer { + padding: 15px; + background-color: rgba(0, 0, 0, 0.4); + color: white; + border-radius: 10px; + pointer-events: none; + opacity: 0; + + transition: opacity 300ms; + -webkit-transition: opacity 300ms; + } + + .pointer.show { + opacity: 1; + } + </style> + + + <div class="pointer"></div> + + <script src="../../tether.js"></script> + <script> + new Tether({ + element: '.pointer', + attachment: 'middle right', + targetAttachment: 'middle left', + targetModifier: 'scroll-handle', + target: document.body + }); + + var headers = document.querySelectorAll('h1,h2,h3,h4,h5,h6'); + var hideTimeout = null; + var pointer = document.querySelector('.pointer') + + var getSection = function(){ + var closest, closestTop; + for (var i=0; i < headers.length; i++){ + var rect = headers[i].getBoundingClientRect(); + + if (closestTop === undefined || (rect.top < 0 && rect.top > closestTop)){ + closestTop = rect.top; + closest = headers[i]; + } + } + return closest.innerHTML; + } + + document.addEventListener('scroll', function(){ + var percentage = Math.floor((100 * Math.max(0, pageYOffset)) / (document.body.scrollHeight - innerHeight)) + '%' + pointer.innerHTML = getSection() + ' - ' + percentage + + pointer.classList.add('show'); + + if (hideTimeout) + clearTimeout(hideTimeout); + + hideTimeout = setTimeout(function(){ + pointer.classList.remove('show'); + }, 1000); + }); + </script> + </body> +</html> diff --git a/afb-client/bower_components/tether/examples/simple/index.html b/afb-client/bower_components/tether/examples/simple/index.html new file mode 100644 index 0000000..de3ac1e --- /dev/null +++ b/afb-client/bower_components/tether/examples/simple/index.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="chrome=1"> + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> + <link rel="stylesheet" href="../resources/css/base.css" /> + <link rel="stylesheet" href="../common/css/style.css" /> + </head> + <body> + <div class="instructions">Resize the page to see the Tether flip.</div> + + <div class="element"></div> + <div class="target"></div> + + <script src="../../tether.js"></script> + <script> + new Tether({ + element: '.element', + target: '.target', + attachment: 'top left', + targetAttachment: 'top right', + constraints: [{ + to: 'window', + attachment: 'together' + }] + }); + </script> + </body> +</html> diff --git a/afb-client/bower_components/tether/examples/testbed/index.html b/afb-client/bower_components/tether/examples/testbed/index.html new file mode 100644 index 0000000..720ce73 --- /dev/null +++ b/afb-client/bower_components/tether/examples/testbed/index.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="chrome=1"> + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> + <link rel="stylesheet" href="../resources/css/base.css" /> + <link rel="stylesheet" href="../common/css/style.css" /> + </head> + <body> + + <div class="element"> + </div> + + <div class="container"> + <div class="pad"></div> + <div class="target"></div> + <div class="pad"></div> + <div class="pad"></div> + </div> + + <script src="../../tether.js"></script> + <script> + new Tether({ + element: '.element', + target: '.target', + attachment: 'top center', + targetAttachment: 'bottom center', + constraints: [{ + to: 'scrollParent', + attachment: 'together' + }] + }); + </script> + </body> + </html> diff --git a/afb-client/bower_components/tether/examples/tooltip/index.html b/afb-client/bower_components/tether/examples/tooltip/index.html new file mode 100644 index 0000000..fbf247f --- /dev/null +++ b/afb-client/bower_components/tether/examples/tooltip/index.html @@ -0,0 +1,86 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="chrome=1"> + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> + <script type="text/javascript" src="//use.typekit.net/jbn8qxr.js"></script> + <script type="text/javascript">try{Typekit.load();}catch(e){}</script> + <link rel="stylesheet" href="../../css/drop.css" /> + <link rel="stylesheet" href="../../css/drop-tooltip-theme-arrows.css" /> + <style> + body { + font-family: "proxima-nova", "Helvetica Neue", sans-serif; + color: #444; + } + + .scroll-parent { + margin: 200px; + height: 300px; + width: 300px; + display: inline-block; + overflow: auto; + border: 2px solid #eee; + padding: 40px; + } + </style> + </head> + <body> + <div class="scroll-parent"> + <p>This is a paragraph of text</p> + <p>This is a paragraph of text</p> + <p><a href="javascript:;" class="drop-tooltip" data-tooltip-content="Whoa, I'm a tooltip" data-attach="top center">Tooltip on Top</a></p> + <p>This is a paragraph of text</p> + <p>This is a paragraph of text</p> + <p><a href="javascript:;" class="drop-tooltip" data-tooltip-content="Whoa, I'm a tooltip" data-attach="bottom center">Tooltip on Bottom</a></p> + <p>This is a paragraph of text</p> + <p>This is a paragraph of text</p> + <p><a href="javascript:;" class="drop-tooltip" data-tooltip-content="Whoa, I'm a tooltip" data-attach="left middle">Tooltip on Left</a></p> + <p>This is a paragraph of text</p> + <p>This is a paragraph of text</p> + <p><a href="javascript:;" class="drop-tooltip" data-tooltip-content="Whoa, I'm a tooltip" data-attach="right middle">Tooltip on Right</a></p> + <p>This is a paragraph of text</p> + <p>This is a paragraph of text</p> + <p><a href="javascript:;" class="drop-tooltip" data-tooltip-content="Whoa, I'm a tooltip" data-attach="bottom left">Tooltip on Bottom Left</a></p> + <p>This is a paragraph of text</p> + <p>This is a paragraph of text</p> + <p><a href="javascript:;" class="drop-tooltip" data-tooltip-content="Whoa, I'm a tooltip" data-attach="bottom right">Tooltip on Bottom Right</a></p> + <p>This is a paragraph of text</p> + <p>This is a paragraph of text</p> + <p><a href="javascript:;" class="drop-tooltip" data-tooltip-content="Whoa, I'm a tooltip" data-attach="top left">Tooltip on Top Left</a></p> + <p>This is a paragraph of text</p> + <p>This is a paragraph of text</p> + <p><a href="javascript:;" class="drop-tooltip" data-tooltip-content="Whoa, I'm a tooltip" data-attach="top right">Tooltip on Top Right</a></p> + <p>This is a paragraph of text</p> + <p>This is a paragraph of text</p> + <p><a href="javascript:;" class="drop-tooltip" data-tooltip-content="Whoa, I'm a tooltip" data-attach="left bottom">Tooltip on Left Bottom</a></p> + <p>This is a paragraph of text</p> + <p>This is a paragraph of text</p> + <p><a href="javascript:;" class="drop-tooltip" data-tooltip-content="Whoa, I'm a tooltip" data-attach="left top">Tooltip on Left Top</a></p> + <p>This is a paragraph of text</p> + <p>This is a paragraph of text</p> + <p><a href="javascript:;" class="drop-tooltip" data-tooltip-content="Whoa, I'm a tooltip" data-attach="right bottom">Tooltip on Right Bottom</a></p> + <p>This is a paragraph of text</p> + <p>This is a paragraph of text</p> + <p><a href="javascript:;" class="drop-tooltip" data-tooltip-content="Whoa, I'm a tooltip" data-attach="right top">Tooltip on Right Top</a></p> + <p>This is a paragraph of text</p> + <p>This is a paragraph of text</p> + </div> + + <script src="../resources/js/log.js"></script> + <script src="../resources/js/jquery.js"></script> + <script src="../../utils.js"></script> + <script src="../../tether.js"></script> + <script src="/drop/drop.min.js"></script> + <script src="../../tooltip.js"></script> + <script src="../../constraint.js"></script> + <script> + $('.drop-tooltip').each(function(){ + new Tooltip({ + el: this, + attach: $(this).data('attach') + }); + }); + </script> + </body> +</html> diff --git a/afb-client/bower_components/tether/examples/viewport/colors.css b/afb-client/bower_components/tether/examples/viewport/colors.css new file mode 100644 index 0000000..64f8c1c --- /dev/null +++ b/afb-client/bower_components/tether/examples/viewport/colors.css @@ -0,0 +1,145 @@ +@charset "UTF-8"; +/**** + + colors.css v1.0 For a friendlier looking web + MIT License • http://clrs.cc • http://github.com/mrmrs/colors + + Author: mrmrs + http://mrmrs.cc + @mrmrs_ + +****/ +/* + + SKINS + • Backgrounds + • Colors + +*/ +/* Backgrounds */ +.bg-navy { + background-color: #001f3f; } + +.bg-blue { + background-color: #0074d9; } + +.bg-aqua { + background-color: #7fdbff; } + +.bg-teal { + background-color: #39cccc; } + +.bg-olive { + background-color: #3d9970; } + +.bg-green { + background-color: #2ecc40; } + +.bg-lime { + background-color: #01ff70; } + +.bg-yellow { + background-color: #ffdc00; } + +.bg-orange { + background-color: #ff851b; } + +.bg-red { + background-color: #ff4136; } + +.bg-fuchsia { + background-color: #f012be; } + +.bg-purple { + background-color: #b10dc9; } + +.bg-maroon { + background-color: #85144b; } + +.bg-white { + background-color: white; } + +.bg-gray { + background-color: #aaaaaa; } + +.bg-silver { + background-color: #dddddd; } + +.bg-black { + background-color: #111111; } + +/* Colors */ +.navy { + color: #001f3f; } + +.blue { + color: #0074d9; } + +.aqua { + color: #7fdbff; } + +.teal { + color: #39cccc; } + +.olive { + color: #3d9970; } + +.green { + color: #2ecc40; } + +.lime { + color: #01ff70; } + +.yellow { + color: #ffdc00; } + +.orange { + color: #ff851b; } + +.red { + color: #ff4136; } + +.fuchsia { + color: #f012be; } + +.purple { + color: #b10dc9; } + +.maroon { + color: #85144b; } + +.white { + color: white; } + +.silver { + color: #dddddd; } + +.gray { + color: #aaaaaa; } + +.black { + color: #111111; } + +/* PRETTIER LINKS */ +a { + text-decoration: none; + -webkit-transition: color .3s ease-in-out; + transition: color .3s ease-in-out; } + +a:link { + color: #0074d9; + -webkit-transition: color .3s ease-in-out; + transition: color .3s ease-in-out; } + +a:visited { + color: #b10dc9; } + +a:hover { + color: #7fdbff; + -webkit-transition: color .3s ease-in-out; + transition: color .3s ease-in-out; } + +a:active { + color: #ff851b; + -webkit-transition: color .3s ease-in-out; + transition: color .3s ease-in-out; } diff --git a/afb-client/bower_components/tether/examples/viewport/index.html b/afb-client/bower_components/tether/examples/viewport/index.html new file mode 100644 index 0000000..ac0711b --- /dev/null +++ b/afb-client/bower_components/tether/examples/viewport/index.html @@ -0,0 +1,70 @@ +<!DOCTYPE html> +<html> + <head> + <link rel="stylesheet" href="../resources/css/base.css" /> + <link rel="stylesheet" href="./colors.css" /> + <style> + * { + box-sizing: border-box; + } + + .element { + background-color: #FFDC00; + width: 80%; + max-width: 300px; + padding: 0 15px; + font-size: 20px; + box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3); + } + + @media (max-width: 380px) { + .element { + font-size: 16px; + } + } + + .bit { + width: 10vw; + height: 10vw; + float: left; + } + </style> + </head> + <body> + <div class="element"> + <p>This element is tethered to the middle of the visible part of the body.</p> + + <p>Inspect the element to see how Tether decided + to use <code>position: fixed</code>.</p> + </div> + + <script src="../../tether.js"></script> + <script> + new Tether({ + element: '.element', + target: document.body, + attachment: 'middle center', + targetAttachment: 'middle center', + targetModifier: 'visible' + }); + </script> + + <script> + // Random colors bit, don't mind this + colors = ['navy', 'blue', 'aqua', 'teal', 'olive', 'green', 'lime', + 'yellow', 'orange', 'red', 'fuchsia', 'purple', 'maroon']; + + curColors = null; + for(var i=300; i--;){ + if (!curColors || !curColors.length) + curColors = colors.slice(0); + + var bit = document.createElement('div') + var index = (Math.random() * curColors.length)|0; + bit.className = 'bit bg-' + curColors[index] + curColors.splice(index, 1); + document.body.appendChild(bit); + } + </script> + </body> +</html> diff --git a/afb-client/bower_components/tether/gulpfile.coffee b/afb-client/bower_components/tether/gulpfile.coffee new file mode 100644 index 0000000..5b09c2b --- /dev/null +++ b/afb-client/bower_components/tether/gulpfile.coffee @@ -0,0 +1,65 @@ +gulp = require('gulp') +coffee = require('gulp-coffee') +compass = require('gulp-compass') +concat = require('gulp-concat') +uglify = require('gulp-uglify') +header = require('gulp-header') +rename = require('gulp-rename') +wrap = require('gulp-wrap-umd') + +pkg = require('./package.json') +banner = "/*! #{ pkg.name } #{ pkg.version } */\n" + +gulp.task 'coffee', -> + gulp.src('./coffee/*') + .pipe(coffee()) + .pipe(gulp.dest('./js/')) + + gulp.src('./docs/coffee/*') + .pipe(coffee()) + .pipe(gulp.dest('./docs/js/')) + + gulp.src('./docs/welcome/coffee/*') + .pipe(coffee()) + .pipe(gulp.dest('./docs/welcome/js/')) + +gulp.task 'concat', -> + gulp.src(['./js/utils.js', './js/tether.js', './js/constraint.js', './js/abutment.js', './js/shift.js']) + .pipe(concat('tether.js')) + .pipe(wrap( + namespace: 'Tether' + exports: 'this.Tether' + )) + .pipe(header(banner)) + .pipe(gulp.dest('./')) + +gulp.task 'uglify', -> + gulp.src('./tether.js') + .pipe(uglify()) + .pipe(header(banner)) + .pipe(rename('tether.min.js')) + .pipe(gulp.dest('./')) + +gulp.task 'js', -> + gulp.run 'coffee', -> + gulp.run 'concat', -> + gulp.run 'uglify', -> + +gulp.task 'compass', -> + for path in ['', 'docs/', 'docs/welcome/'] + gulp.src("./#{ path }sass/*") + .pipe(compass( + sass: "#{ path }sass" + css: "#{ path }css" + comments: false + )) + .pipe(gulp.dest("./#{ path }css")) + +gulp.task 'default', -> + gulp.run 'js', 'compass' + + gulp.watch './**/*.coffee', -> + gulp.run 'js' + + gulp.watch './**/*.sass', -> + gulp.run 'compass' diff --git a/afb-client/bower_components/tether/gulpfile.js b/afb-client/bower_components/tether/gulpfile.js new file mode 100644 index 0000000..cfbdf87 --- /dev/null +++ b/afb-client/bower_components/tether/gulpfile.js @@ -0,0 +1,2 @@ +require('coffee-script') +require('./gulpfile.coffee') diff --git a/afb-client/bower_components/tether/js/abutment.js b/afb-client/bower_components/tether/js/abutment.js new file mode 100644 index 0000000..b3acaa0 --- /dev/null +++ b/afb-client/bower_components/tether/js/abutment.js @@ -0,0 +1,59 @@ +(function() { + var defer, getBounds, updateClasses, _ref; + + _ref = this.Tether.Utils, getBounds = _ref.getBounds, updateClasses = _ref.updateClasses, defer = _ref.defer; + + this.Tether.modules.push({ + position: function(_arg) { + var abutted, addClasses, allClasses, bottom, height, left, right, side, sides, targetPos, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5, + _this = this; + top = _arg.top, left = _arg.left; + _ref1 = this.cache('element-bounds', function() { + return getBounds(_this.element); + }), height = _ref1.height, width = _ref1.width; + targetPos = this.getTargetBounds(); + bottom = top + height; + right = left + width; + abutted = []; + if (top <= targetPos.bottom && bottom >= targetPos.top) { + _ref2 = ['left', 'right']; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + side = _ref2[_i]; + if ((_ref3 = targetPos[side]) === left || _ref3 === right) { + abutted.push(side); + } + } + } + if (left <= targetPos.right && right >= targetPos.left) { + _ref4 = ['top', 'bottom']; + for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) { + side = _ref4[_j]; + if ((_ref5 = targetPos[side]) === top || _ref5 === bottom) { + abutted.push(side); + } + } + } + allClasses = []; + addClasses = []; + sides = ['left', 'top', 'right', 'bottom']; + allClasses.push(this.getClass('abutted')); + for (_k = 0, _len2 = sides.length; _k < _len2; _k++) { + side = sides[_k]; + allClasses.push("" + (this.getClass('abutted')) + "-" + side); + } + if (abutted.length) { + addClasses.push(this.getClass('abutted')); + } + for (_l = 0, _len3 = abutted.length; _l < _len3; _l++) { + side = abutted[_l]; + addClasses.push("" + (this.getClass('abutted')) + "-" + side); + } + defer(function() { + updateClasses(_this.target, addClasses, allClasses); + return updateClasses(_this.element, addClasses, allClasses); + }); + return true; + } + }); + +}).call(this); diff --git a/afb-client/bower_components/tether/js/constraint.js b/afb-client/bower_components/tether/js/constraint.js new file mode 100644 index 0000000..69a2bde --- /dev/null +++ b/afb-client/bower_components/tether/js/constraint.js @@ -0,0 +1,308 @@ +(function() { + var BOUNDS_FORMAT, MIRROR_ATTACH, defer, extend, getBoundingRect, getBounds, getOuterSize, getSize, updateClasses, _ref, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + + _ref = this.Tether.Utils, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getSize = _ref.getSize, extend = _ref.extend, updateClasses = _ref.updateClasses, defer = _ref.defer; + + MIRROR_ATTACH = { + left: 'right', + right: 'left', + top: 'bottom', + bottom: 'top', + middle: 'middle' + }; + + BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom']; + + getBoundingRect = function(tether, to) { + var i, pos, side, size, style, _i, _len; + if (to === 'scrollParent') { + to = tether.scrollParent; + } else if (to === 'window') { + to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset]; + } + if (to === document) { + to = to.documentElement; + } + if (to.nodeType != null) { + pos = size = getBounds(to); + style = getComputedStyle(to); + to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top]; + for (i = _i = 0, _len = BOUNDS_FORMAT.length; _i < _len; i = ++_i) { + side = BOUNDS_FORMAT[i]; + side = side[0].toUpperCase() + side.substr(1); + if (side === 'Top' || side === 'Left') { + to[i] += parseFloat(style["border" + side + "Width"]); + } else { + to[i] -= parseFloat(style["border" + side + "Width"]); + } + } + } + return to; + }; + + this.Tether.modules.push({ + position: function(_arg) { + var addClasses, allClasses, attachment, bounds, changeAttachX, changeAttachY, cls, constraint, eAttachment, height, left, oob, oobClass, p, pin, pinned, pinnedClass, removeClass, side, tAttachment, targetAttachment, targetHeight, targetSize, targetWidth, to, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, + _this = this; + top = _arg.top, left = _arg.left, targetAttachment = _arg.targetAttachment; + if (!this.options.constraints) { + return true; + } + removeClass = function(prefix) { + var side, _i, _len, _results; + _this.removeClass(prefix); + _results = []; + for (_i = 0, _len = BOUNDS_FORMAT.length; _i < _len; _i++) { + side = BOUNDS_FORMAT[_i]; + _results.push(_this.removeClass("" + prefix + "-" + side)); + } + return _results; + }; + _ref1 = this.cache('element-bounds', function() { + return getBounds(_this.element); + }), height = _ref1.height, width = _ref1.width; + if (width === 0 && height === 0 && (this.lastSize != null)) { + _ref2 = this.lastSize, width = _ref2.width, height = _ref2.height; + } + targetSize = this.cache('target-bounds', function() { + return _this.getTargetBounds(); + }); + targetHeight = targetSize.height; + targetWidth = targetSize.width; + tAttachment = {}; + eAttachment = {}; + allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')]; + _ref3 = this.options.constraints; + for (_i = 0, _len = _ref3.length; _i < _len; _i++) { + constraint = _ref3[_i]; + if (constraint.outOfBoundsClass) { + allClasses.push(constraint.outOfBoundsClass); + } + if (constraint.pinnedClass) { + allClasses.push(constraint.pinnedClass); + } + } + for (_j = 0, _len1 = allClasses.length; _j < _len1; _j++) { + cls = allClasses[_j]; + _ref4 = ['left', 'top', 'right', 'bottom']; + for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) { + side = _ref4[_k]; + allClasses.push("" + cls + "-" + side); + } + } + addClasses = []; + tAttachment = extend({}, targetAttachment); + eAttachment = extend({}, this.attachment); + _ref5 = this.options.constraints; + for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) { + constraint = _ref5[_l]; + to = constraint.to, attachment = constraint.attachment, pin = constraint.pin; + if (attachment == null) { + attachment = ''; + } + if (__indexOf.call(attachment, ' ') >= 0) { + _ref6 = attachment.split(' '), changeAttachY = _ref6[0], changeAttachX = _ref6[1]; + } else { + changeAttachX = changeAttachY = attachment; + } + bounds = getBoundingRect(this, to); + if (changeAttachY === 'target' || changeAttachY === 'both') { + if (top < bounds[1] && tAttachment.top === 'top') { + top += targetHeight; + tAttachment.top = 'bottom'; + } + if (top + height > bounds[3] && tAttachment.top === 'bottom') { + top -= targetHeight; + tAttachment.top = 'top'; + } + } + if (changeAttachY === 'together') { + if (top < bounds[1] && tAttachment.top === 'top') { + if (eAttachment.top === 'bottom') { + top += targetHeight; + tAttachment.top = 'bottom'; + top += height; + eAttachment.top = 'top'; + } else if (eAttachment.top === 'top') { + top += targetHeight; + tAttachment.top = 'bottom'; + top -= height; + eAttachment.top = 'bottom'; + } + } + if (top + height > bounds[3] && tAttachment.top === 'bottom') { + if (eAttachment.top === 'top') { + top -= targetHeight; + tAttachment.top = 'top'; + top -= height; + eAttachment.top = 'bottom'; + } else if (eAttachment.top === 'bottom') { + top -= targetHeight; + tAttachment.top = 'top'; + top += height; + eAttachment.top = 'top'; + } + } + if (tAttachment.top === 'middle') { + if (top + height > bounds[3] && eAttachment.top === 'top') { + top -= height; + eAttachment.top = 'bottom'; + } else if (top < bounds[1] && eAttachment.top === 'bottom') { + top += height; + eAttachment.top = 'top'; + } + } + } + if (changeAttachX === 'target' || changeAttachX === 'both') { + if (left < bounds[0] && tAttachment.left === 'left') { + left += targetWidth; + tAttachment.left = 'right'; + } + if (left + width > bounds[2] && tAttachment.left === 'right') { + left -= targetWidth; + tAttachment.left = 'left'; + } + } + if (changeAttachX === 'together') { + if (left < bounds[0] && tAttachment.left === 'left') { + if (eAttachment.left === 'right') { + left += targetWidth; + tAttachment.left = 'right'; + left += width; + eAttachment.left = 'left'; + } else if (eAttachment.left === 'left') { + left += targetWidth; + tAttachment.left = 'right'; + left -= width; + eAttachment.left = 'right'; + } + } else if (left + width > bounds[2] && tAttachment.left === 'right') { + if (eAttachment.left === 'left') { + left -= targetWidth; + tAttachment.left = 'left'; + left -= width; + eAttachment.left = 'right'; + } else if (eAttachment.left === 'right') { + left -= targetWidth; + tAttachment.left = 'left'; + left += width; + eAttachment.left = 'left'; + } + } else if (tAttachment.left === 'center') { + if (left + width > bounds[2] && eAttachment.left === 'left') { + left -= width; + eAttachment.left = 'right'; + } else if (left < bounds[0] && eAttachment.left === 'right') { + left += width; + eAttachment.left = 'left'; + } + } + } + if (changeAttachY === 'element' || changeAttachY === 'both') { + if (top < bounds[1] && eAttachment.top === 'bottom') { + top += height; + eAttachment.top = 'top'; + } + if (top + height > bounds[3] && eAttachment.top === 'top') { + top -= height; + eAttachment.top = 'bottom'; + } + } + if (changeAttachX === 'element' || changeAttachX === 'both') { + if (left < bounds[0] && eAttachment.left === 'right') { + left += width; + eAttachment.left = 'left'; + } + if (left + width > bounds[2] && eAttachment.left === 'left') { + left -= width; + eAttachment.left = 'right'; + } + } + if (typeof pin === 'string') { + pin = (function() { + var _len4, _m, _ref7, _results; + _ref7 = pin.split(','); + _results = []; + for (_m = 0, _len4 = _ref7.length; _m < _len4; _m++) { + p = _ref7[_m]; + _results.push(p.trim()); + } + return _results; + })(); + } else if (pin === true) { + pin = ['top', 'left', 'right', 'bottom']; + } + pin || (pin = []); + pinned = []; + oob = []; + if (top < bounds[1]) { + if (__indexOf.call(pin, 'top') >= 0) { + top = bounds[1]; + pinned.push('top'); + } else { + oob.push('top'); + } + } + if (top + height > bounds[3]) { + if (__indexOf.call(pin, 'bottom') >= 0) { + top = bounds[3] - height; + pinned.push('bottom'); + } else { + oob.push('bottom'); + } + } + if (left < bounds[0]) { + if (__indexOf.call(pin, 'left') >= 0) { + left = bounds[0]; + pinned.push('left'); + } else { + oob.push('left'); + } + } + if (left + width > bounds[2]) { + if (__indexOf.call(pin, 'right') >= 0) { + left = bounds[2] - width; + pinned.push('right'); + } else { + oob.push('right'); + } + } + if (pinned.length) { + pinnedClass = (_ref7 = this.options.pinnedClass) != null ? _ref7 : this.getClass('pinned'); + addClasses.push(pinnedClass); + for (_m = 0, _len4 = pinned.length; _m < _len4; _m++) { + side = pinned[_m]; + addClasses.push("" + pinnedClass + "-" + side); + } + } + if (oob.length) { + oobClass = (_ref8 = this.options.outOfBoundsClass) != null ? _ref8 : this.getClass('out-of-bounds'); + addClasses.push(oobClass); + for (_n = 0, _len5 = oob.length; _n < _len5; _n++) { + side = oob[_n]; + addClasses.push("" + oobClass + "-" + side); + } + } + if (__indexOf.call(pinned, 'left') >= 0 || __indexOf.call(pinned, 'right') >= 0) { + eAttachment.left = tAttachment.left = false; + } + if (__indexOf.call(pinned, 'top') >= 0 || __indexOf.call(pinned, 'bottom') >= 0) { + eAttachment.top = tAttachment.top = false; + } + if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== this.attachment.top || eAttachment.left !== this.attachment.left) { + this.updateAttachClasses(eAttachment, tAttachment); + } + } + defer(function() { + updateClasses(_this.target, addClasses, allClasses); + return updateClasses(_this.element, addClasses, allClasses); + }); + return { + top: top, + left: left + }; + } + }); + +}).call(this); diff --git a/afb-client/bower_components/tether/js/markAttachment.js b/afb-client/bower_components/tether/js/markAttachment.js new file mode 100644 index 0000000..a6d8f80 --- /dev/null +++ b/afb-client/bower_components/tether/js/markAttachment.js @@ -0,0 +1,46 @@ +(function() { + this.Tether.modules.push({ + initialize: function() { + var dot, el, type, _i, _len, _ref, _results; + this.markers = {}; + _ref = ['target', 'element']; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + type = _ref[_i]; + el = document.createElement('div'); + el.className = this.getClass("" + type + "-marker"); + dot = document.createElement('div'); + dot.className = this.getClass('marker-dot'); + el.appendChild(dot); + this[type].appendChild(el); + _results.push(this.markers[type] = { + dot: dot, + el: el + }); + } + return _results; + }, + position: function(_arg) { + var manualOffset, manualTargetOffset, offset, offsets, side, type, val; + manualOffset = _arg.manualOffset, manualTargetOffset = _arg.manualTargetOffset; + offsets = { + element: manualOffset, + target: manualTargetOffset + }; + for (type in offsets) { + offset = offsets[type]; + for (side in offset) { + val = offset[side]; + if (typeof val !== 'string' || (val.indexOf('%') === -1 && val.indexOf('px') === -1)) { + val += 'px'; + } + if (this.markers[type].dot.style[side] !== val) { + this.markers[type].dot.style[side] = val; + } + } + } + return true; + } + }); + +}).call(this); diff --git a/afb-client/bower_components/tether/js/shift.js b/afb-client/bower_components/tether/js/shift.js new file mode 100644 index 0000000..58b935f --- /dev/null +++ b/afb-client/bower_components/tether/js/shift.js @@ -0,0 +1,38 @@ +(function() { + this.Tether.modules.push({ + position: function(_arg) { + var left, result, shift, shiftLeft, shiftTop, top, _ref; + top = _arg.top, left = _arg.left; + if (!this.options.shift) { + return; + } + result = function(val) { + if (typeof val === 'function') { + return val.call(this, { + top: top, + left: left + }); + } else { + return val; + } + }; + shift = result(this.options.shift); + if (typeof shift === 'string') { + shift = shift.split(' '); + shift[1] || (shift[1] = shift[0]); + shiftTop = shift[0], shiftLeft = shift[1]; + shiftTop = parseFloat(shiftTop, 10); + shiftLeft = parseFloat(shiftLeft, 10); + } else { + _ref = [shift.top, shift.left], shiftTop = _ref[0], shiftLeft = _ref[1]; + } + top += shiftTop; + left += shiftLeft; + return { + top: top, + left: left + }; + } + }); + +}).call(this); diff --git a/afb-client/bower_components/tether/js/tether.js b/afb-client/bower_components/tether/js/tether.js new file mode 100644 index 0000000..92f6485 --- /dev/null +++ b/afb-client/bower_components/tether/js/tether.js @@ -0,0 +1,686 @@ +(function() { + var MIRROR_LR, MIRROR_TB, OFFSET_MAP, Tether, addClass, addOffset, attachmentToOffset, autoToFixedAttachment, defer, extend, flush, getBounds, getOffsetParent, getOuterSize, getScrollBarSize, getScrollParent, getSize, now, offsetToPx, parseAttachment, parseOffset, position, removeClass, tethers, transformKey, updateClasses, within, _Tether, _ref, + __slice = [].slice, + __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; + + if (this.Tether == null) { + throw new Error("You must include the utils.js file before tether.js"); + } + + Tether = this.Tether; + + _ref = Tether.Utils, getScrollParent = _ref.getScrollParent, getSize = _ref.getSize, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getOffsetParent = _ref.getOffsetParent, extend = _ref.extend, addClass = _ref.addClass, removeClass = _ref.removeClass, updateClasses = _ref.updateClasses, defer = _ref.defer, flush = _ref.flush, getScrollBarSize = _ref.getScrollBarSize; + + within = function(a, b, diff) { + if (diff == null) { + diff = 1; + } + return (a + diff >= b && b >= a - diff); + }; + + transformKey = (function() { + var el, key, _i, _len, _ref1; + el = document.createElement('div'); + _ref1 = ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform']; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + key = _ref1[_i]; + if (el.style[key] !== void 0) { + return key; + } + } + })(); + + tethers = []; + + position = function() { + var tether, _i, _len; + for (_i = 0, _len = tethers.length; _i < _len; _i++) { + tether = tethers[_i]; + tether.position(false); + } + return flush(); + }; + + now = function() { + var _ref1; + return (_ref1 = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref1 : +(new Date); + }; + + (function() { + var event, lastCall, lastDuration, pendingTimeout, tick, _i, _len, _ref1, _results; + lastCall = null; + lastDuration = null; + pendingTimeout = null; + tick = function() { + if ((lastDuration != null) && lastDuration > 16) { + lastDuration = Math.min(lastDuration - 16, 250); + pendingTimeout = setTimeout(tick, 250); + return; + } + if ((lastCall != null) && (now() - lastCall) < 10) { + return; + } + if (pendingTimeout != null) { + clearTimeout(pendingTimeout); + pendingTimeout = null; + } + lastCall = now(); + position(); + return lastDuration = now() - lastCall; + }; + _ref1 = ['resize', 'scroll', 'touchmove']; + _results = []; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + event = _ref1[_i]; + _results.push(window.addEventListener(event, tick)); + } + return _results; + })(); + + MIRROR_LR = { + center: 'center', + left: 'right', + right: 'left' + }; + + MIRROR_TB = { + middle: 'middle', + top: 'bottom', + bottom: 'top' + }; + + OFFSET_MAP = { + top: 0, + left: 0, + middle: '50%', + center: '50%', + bottom: '100%', + right: '100%' + }; + + autoToFixedAttachment = function(attachment, relativeToAttachment) { + var left, top; + left = attachment.left, top = attachment.top; + if (left === 'auto') { + left = MIRROR_LR[relativeToAttachment.left]; + } + if (top === 'auto') { + top = MIRROR_TB[relativeToAttachment.top]; + } + return { + left: left, + top: top + }; + }; + + attachmentToOffset = function(attachment) { + var _ref1, _ref2; + return { + left: (_ref1 = OFFSET_MAP[attachment.left]) != null ? _ref1 : attachment.left, + top: (_ref2 = OFFSET_MAP[attachment.top]) != null ? _ref2 : attachment.top + }; + }; + + addOffset = function() { + var left, offsets, out, top, _i, _len, _ref1; + offsets = 1 <= arguments.length ? __slice.call(arguments, 0) : []; + out = { + top: 0, + left: 0 + }; + for (_i = 0, _len = offsets.length; _i < _len; _i++) { + _ref1 = offsets[_i], top = _ref1.top, left = _ref1.left; + if (typeof top === 'string') { + top = parseFloat(top, 10); + } + if (typeof left === 'string') { + left = parseFloat(left, 10); + } + out.top += top; + out.left += left; + } + return out; + }; + + offsetToPx = function(offset, size) { + if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) { + offset.left = parseFloat(offset.left, 10) / 100 * size.width; + } + if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) { + offset.top = parseFloat(offset.top, 10) / 100 * size.height; + } + return offset; + }; + + parseAttachment = parseOffset = function(value) { + var left, top, _ref1; + _ref1 = value.split(' '), top = _ref1[0], left = _ref1[1]; + return { + top: top, + left: left + }; + }; + + _Tether = (function() { + _Tether.modules = []; + + function _Tether(options) { + this.position = __bind(this.position, this); + var module, _i, _len, _ref1, _ref2; + tethers.push(this); + this.history = []; + this.setOptions(options, false); + _ref1 = Tether.modules; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + module = _ref1[_i]; + if ((_ref2 = module.initialize) != null) { + _ref2.call(this); + } + } + this.position(); + } + + _Tether.prototype.getClass = function(key) { + var _ref1, _ref2; + if ((_ref1 = this.options.classes) != null ? _ref1[key] : void 0) { + return this.options.classes[key]; + } else if (((_ref2 = this.options.classes) != null ? _ref2[key] : void 0) !== false) { + if (this.options.classPrefix) { + return "" + this.options.classPrefix + "-" + key; + } else { + return key; + } + } else { + return ''; + } + }; + + _Tether.prototype.setOptions = function(options, position) { + var defaults, key, _i, _len, _ref1, _ref2; + this.options = options; + if (position == null) { + position = true; + } + defaults = { + offset: '0 0', + targetOffset: '0 0', + targetAttachment: 'auto auto', + classPrefix: 'tether' + }; + this.options = extend(defaults, this.options); + _ref1 = this.options, this.element = _ref1.element, this.target = _ref1.target, this.targetModifier = _ref1.targetModifier; + if (this.target === 'viewport') { + this.target = document.body; + this.targetModifier = 'visible'; + } else if (this.target === 'scroll-handle') { + this.target = document.body; + this.targetModifier = 'scroll-handle'; + } + _ref2 = ['element', 'target']; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + key = _ref2[_i]; + if (this[key] == null) { + throw new Error("Tether Error: Both element and target must be defined"); + } + if (this[key].jquery != null) { + this[key] = this[key][0]; + } else if (typeof this[key] === 'string') { + this[key] = document.querySelector(this[key]); + } + } + addClass(this.element, this.getClass('element')); + addClass(this.target, this.getClass('target')); + if (!this.options.attachment) { + throw new Error("Tether Error: You must provide an attachment"); + } + this.targetAttachment = parseAttachment(this.options.targetAttachment); + this.attachment = parseAttachment(this.options.attachment); + this.offset = parseOffset(this.options.offset); + this.targetOffset = parseOffset(this.options.targetOffset); + if (this.scrollParent != null) { + this.disable(); + } + if (this.targetModifier === 'scroll-handle') { + this.scrollParent = this.target; + } else { + this.scrollParent = getScrollParent(this.target); + } + if (this.options.enabled !== false) { + return this.enable(position); + } + }; + + _Tether.prototype.getTargetBounds = function() { + var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target; + if (this.targetModifier != null) { + switch (this.targetModifier) { + case 'visible': + if (this.target === document.body) { + return { + top: pageYOffset, + left: pageXOffset, + height: innerHeight, + width: innerWidth + }; + } else { + bounds = getBounds(this.target); + out = { + height: bounds.height, + width: bounds.width, + top: bounds.top, + left: bounds.left + }; + out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top)); + out.height = Math.min(out.height, bounds.height - ((bounds.top + bounds.height) - (pageYOffset + innerHeight))); + out.height = Math.min(innerHeight, out.height); + out.height -= 2; + out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left)); + out.width = Math.min(out.width, bounds.width - ((bounds.left + bounds.width) - (pageXOffset + innerWidth))); + out.width = Math.min(innerWidth, out.width); + out.width -= 2; + if (out.top < pageYOffset) { + out.top = pageYOffset; + } + if (out.left < pageXOffset) { + out.left = pageXOffset; + } + return out; + } + break; + case 'scroll-handle': + target = this.target; + if (target === document.body) { + target = document.documentElement; + bounds = { + left: pageXOffset, + top: pageYOffset, + height: innerHeight, + width: innerWidth + }; + } else { + bounds = getBounds(target); + } + style = getComputedStyle(target); + hasBottomScroll = target.scrollWidth > target.clientWidth || 'scroll' === [style.overflow, style.overflowX] || this.target !== document.body; + scrollBottom = 0; + if (hasBottomScroll) { + scrollBottom = 15; + } + height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom; + out = { + width: 15, + height: height * 0.975 * (height / target.scrollHeight), + left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15 + }; + fitAdj = 0; + if (height < 408 && this.target === document.body) { + fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58; + } + if (this.target !== document.body) { + out.height = Math.max(out.height, 24); + } + scrollPercentage = this.target.scrollTop / (target.scrollHeight - height); + out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth); + if (this.target === document.body) { + out.height = Math.max(out.height, 24); + } + return out; + } + } else { + return getBounds(this.target); + } + }; + + _Tether.prototype.clearCache = function() { + return this._cache = {}; + }; + + _Tether.prototype.cache = function(k, getter) { + if (this._cache == null) { + this._cache = {}; + } + if (this._cache[k] == null) { + this._cache[k] = getter.call(this); + } + return this._cache[k]; + }; + + _Tether.prototype.enable = function(position) { + if (position == null) { + position = true; + } + addClass(this.target, this.getClass('enabled')); + addClass(this.element, this.getClass('enabled')); + this.enabled = true; + if (this.scrollParent !== document) { + this.scrollParent.addEventListener('scroll', this.position); + } + if (position) { + return this.position(); + } + }; + + _Tether.prototype.disable = function() { + removeClass(this.target, this.getClass('enabled')); + removeClass(this.element, this.getClass('enabled')); + this.enabled = false; + if (this.scrollParent != null) { + return this.scrollParent.removeEventListener('scroll', this.position); + } + }; + + _Tether.prototype.destroy = function() { + var i, tether, _i, _len, _results; + this.disable(); + _results = []; + for (i = _i = 0, _len = tethers.length; _i < _len; i = ++_i) { + tether = tethers[i]; + if (tether === this) { + tethers.splice(i, 1); + break; + } else { + _results.push(void 0); + } + } + return _results; + }; + + _Tether.prototype.updateAttachClasses = function(elementAttach, targetAttach) { + var add, all, side, sides, _i, _j, _len, _len1, _ref1, + _this = this; + if (elementAttach == null) { + elementAttach = this.attachment; + } + if (targetAttach == null) { + targetAttach = this.targetAttachment; + } + sides = ['left', 'top', 'bottom', 'right', 'middle', 'center']; + if ((_ref1 = this._addAttachClasses) != null ? _ref1.length : void 0) { + this._addAttachClasses.splice(0, this._addAttachClasses.length); + } + add = this._addAttachClasses != null ? this._addAttachClasses : this._addAttachClasses = []; + if (elementAttach.top) { + add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.top); + } + if (elementAttach.left) { + add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.left); + } + if (targetAttach.top) { + add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.top); + } + if (targetAttach.left) { + add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.left); + } + all = []; + for (_i = 0, _len = sides.length; _i < _len; _i++) { + side = sides[_i]; + all.push("" + (this.getClass('element-attached')) + "-" + side); + } + for (_j = 0, _len1 = sides.length; _j < _len1; _j++) { + side = sides[_j]; + all.push("" + (this.getClass('target-attached')) + "-" + side); + } + return defer(function() { + if (_this._addAttachClasses == null) { + return; + } + updateClasses(_this.element, _this._addAttachClasses, all); + updateClasses(_this.target, _this._addAttachClasses, all); + return _this._addAttachClasses = void 0; + }); + }; + + _Tether.prototype.position = function(flushChanges) { + var elementPos, elementStyle, height, left, manualOffset, manualTargetOffset, module, next, offset, offsetBorder, offsetParent, offsetParentSize, offsetParentStyle, offsetPosition, ret, scrollLeft, scrollTop, scrollbarSize, side, targetAttachment, targetOffset, targetPos, targetSize, top, width, _i, _j, _len, _len1, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, + _this = this; + if (flushChanges == null) { + flushChanges = true; + } + if (!this.enabled) { + return; + } + this.clearCache(); + targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment); + this.updateAttachClasses(this.attachment, targetAttachment); + elementPos = this.cache('element-bounds', function() { + return getBounds(_this.element); + }); + width = elementPos.width, height = elementPos.height; + if (width === 0 && height === 0 && (this.lastSize != null)) { + _ref1 = this.lastSize, width = _ref1.width, height = _ref1.height; + } else { + this.lastSize = { + width: width, + height: height + }; + } + targetSize = targetPos = this.cache('target-bounds', function() { + return _this.getTargetBounds(); + }); + offset = offsetToPx(attachmentToOffset(this.attachment), { + width: width, + height: height + }); + targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize); + manualOffset = offsetToPx(this.offset, { + width: width, + height: height + }); + manualTargetOffset = offsetToPx(this.targetOffset, targetSize); + offset = addOffset(offset, manualOffset); + targetOffset = addOffset(targetOffset, manualTargetOffset); + left = targetPos.left + targetOffset.left - offset.left; + top = targetPos.top + targetOffset.top - offset.top; + _ref2 = Tether.modules; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + module = _ref2[_i]; + ret = module.position.call(this, { + left: left, + top: top, + targetAttachment: targetAttachment, + targetPos: targetPos, + attachment: this.attachment, + elementPos: elementPos, + offset: offset, + targetOffset: targetOffset, + manualOffset: manualOffset, + manualTargetOffset: manualTargetOffset, + scrollbarSize: scrollbarSize + }); + if ((ret == null) || typeof ret !== 'object') { + continue; + } else if (ret === false) { + return false; + } else { + top = ret.top, left = ret.left; + } + } + next = { + page: { + top: top, + left: left + }, + viewport: { + top: top - pageYOffset, + bottom: pageYOffset - top - height + innerHeight, + left: left - pageXOffset, + right: pageXOffset - left - width + innerWidth + } + }; + if (document.body.scrollWidth > window.innerWidth) { + scrollbarSize = this.cache('scrollbar-size', getScrollBarSize); + next.viewport.bottom -= scrollbarSize.height; + } + if (document.body.scrollHeight > window.innerHeight) { + scrollbarSize = this.cache('scrollbar-size', getScrollBarSize); + next.viewport.right -= scrollbarSize.width; + } + if (((_ref3 = document.body.style.position) !== '' && _ref3 !== 'static') || ((_ref4 = document.body.parentElement.style.position) !== '' && _ref4 !== 'static')) { + next.page.bottom = document.body.scrollHeight - top - height; + next.page.right = document.body.scrollWidth - left - width; + } + if (((_ref5 = this.options.optimizations) != null ? _ref5.moveElement : void 0) !== false && (this.targetModifier == null)) { + offsetParent = this.cache('target-offsetparent', function() { + return getOffsetParent(_this.target); + }); + offsetPosition = this.cache('target-offsetparent-bounds', function() { + return getBounds(offsetParent); + }); + offsetParentStyle = getComputedStyle(offsetParent); + elementStyle = getComputedStyle(this.element); + offsetParentSize = offsetPosition; + offsetBorder = {}; + _ref6 = ['Top', 'Left', 'Bottom', 'Right']; + for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) { + side = _ref6[_j]; + offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle["border" + side + "Width"]); + } + offsetPosition.right = document.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right; + offsetPosition.bottom = document.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom; + if (next.page.top >= (offsetPosition.top + offsetBorder.top) && next.page.bottom >= offsetPosition.bottom) { + if (next.page.left >= (offsetPosition.left + offsetBorder.left) && next.page.right >= offsetPosition.right) { + scrollTop = offsetParent.scrollTop; + scrollLeft = offsetParent.scrollLeft; + next.offset = { + top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top, + left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left + }; + } + } + } + this.move(next); + this.history.unshift(next); + if (this.history.length > 3) { + this.history.pop(); + } + if (flushChanges) { + flush(); + } + return true; + }; + + _Tether.prototype.move = function(position) { + var css, elVal, found, key, moved, offsetParent, point, same, transcribe, type, val, write, writeCSS, _i, _len, _ref1, _ref2, + _this = this; + if (this.element.parentNode == null) { + return; + } + same = {}; + for (type in position) { + same[type] = {}; + for (key in position[type]) { + found = false; + _ref1 = this.history; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + point = _ref1[_i]; + if (!within((_ref2 = point[type]) != null ? _ref2[key] : void 0, position[type][key])) { + found = true; + break; + } + } + if (!found) { + same[type][key] = true; + } + } + } + css = { + top: '', + left: '', + right: '', + bottom: '' + }; + transcribe = function(same, pos) { + var xPos, yPos, _ref3; + if (((_ref3 = _this.options.optimizations) != null ? _ref3.gpu : void 0) !== false) { + if (same.top) { + css.top = 0; + yPos = pos.top; + } else { + css.bottom = 0; + yPos = -pos.bottom; + } + if (same.left) { + css.left = 0; + xPos = pos.left; + } else { + css.right = 0; + xPos = -pos.right; + } + css[transformKey] = "translateX(" + (Math.round(xPos)) + "px) translateY(" + (Math.round(yPos)) + "px)"; + if (transformKey !== 'msTransform') { + return css[transformKey] += " translateZ(0)"; + } + } else { + if (same.top) { + css.top = "" + pos.top + "px"; + } else { + css.bottom = "" + pos.bottom + "px"; + } + if (same.left) { + return css.left = "" + pos.left + "px"; + } else { + return css.right = "" + pos.right + "px"; + } + } + }; + moved = false; + if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) { + css.position = 'absolute'; + transcribe(same.page, position.page); + } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) { + css.position = 'fixed'; + transcribe(same.viewport, position.viewport); + } else if ((same.offset != null) && same.offset.top && same.offset.left) { + css.position = 'absolute'; + offsetParent = this.cache('target-offsetparent', function() { + return getOffsetParent(_this.target); + }); + if (getOffsetParent(this.element) !== offsetParent) { + defer(function() { + _this.element.parentNode.removeChild(_this.element); + return offsetParent.appendChild(_this.element); + }); + } + transcribe(same.offset, position.offset); + moved = true; + } else { + css.position = 'absolute'; + transcribe({ + top: true, + left: true + }, position.page); + } + if (!moved && this.element.parentNode.tagName !== 'BODY') { + this.element.parentNode.removeChild(this.element); + document.body.appendChild(this.element); + } + writeCSS = {}; + write = false; + for (key in css) { + val = css[key]; + elVal = this.element.style[key]; + if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) { + elVal = parseFloat(elVal); + val = parseFloat(val); + } + if (elVal !== val) { + write = true; + writeCSS[key] = css[key]; + } + } + if (write) { + return defer(function() { + return extend(_this.element.style, writeCSS); + }); + } + }; + + return _Tether; + + })(); + + Tether.position = position; + + this.Tether = extend(_Tether, Tether); + +}).call(this); diff --git a/afb-client/bower_components/tether/js/tether.min.js b/afb-client/bower_components/tether/js/tether.min.js new file mode 100644 index 0000000..e8993a1 --- /dev/null +++ b/afb-client/bower_components/tether/js/tether.min.js @@ -0,0 +1,2 @@ +/*! tether.js 0.2.9 */ +(function(){var a,b,c,d,e,f,g,h,i={}.hasOwnProperty,j=[].slice;null==window.Tether&&(window.Tether={}),f=function(a){var b,c,d,e,f;if(c=getComputedStyle(a).position,"fixed"===c)return a;for(d=void 0,b=a;b=b.parentNode;){if(!(e=getComputedStyle(b)))return b;if(/(auto|scroll)/.test(e.overflow+e["overflow-y"]+e["overflow-x"])&&("absolute"!==c||"relative"===(f=e.position)||"absolute"===f||"fixed"===f))return b}return document.body},d=function(a){var b,d,e,f;return d=a.ownerDocument,e=d.documentElement,b=c({},a.getBoundingClientRect()),b.top=b.top+window.pageYOffset-e.clientTop,b.left=b.left+window.pageXOffset-e.clientLeft,b.right=d.body.clientWidth-b.width-b.left,b.bottom=d.body.clientHeight-b.height-b.top,b.height&&b.width||(f=getComputedStyle(a),b.height||(b.height=parseFloat(f.height)),b.width||(b.width=parseFloat(f.width))),b},e=function(a){return a.offsetParent||document.documentElement},c=function(a){var b,c,d,e,f,g,h;for(null==a&&(a={}),b=[],Array.prototype.push.apply(b,arguments),h=b.slice(1),f=0,g=h.length;g>f;f++)if(d=h[f])for(c in d)i.call(d,c)&&(e=d[c],a[c]=e);return a},h=function(a,b){var c,d,e,f,g;if(null!=a.classList){for(f=b.split(" "),g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(a.classList.remove(c));return g}return a.className=a.className.replace(new RegExp("(^| )"+b.split(" ").join("|")+"( |$)","gi")," ")},b=function(a,b){var c,d,e,f,g;if(null!=a.classList){for(f=b.split(" "),g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(a.classList.add(c));return g}return h(a,b),a.className+=" "+b},g=function(a,b){return null!=a.classList?a.classList.contains(b):new RegExp("(^| )"+b+"( |$)","gi").test(a.className)},a=function(){function a(){}return a.prototype.on=function(a,b,c,d){var e;return null==d&&(d=!1),null==this.bindings&&(this.bindings={}),null==(e=this.bindings)[a]&&(e[a]=[]),this.bindings[a].push({handler:b,ctx:c,once:d})},a.prototype.once=function(a,b,c){return this.on(a,b,c,!0)},a.prototype.off=function(a,b){var c,d,e;if(null!=(null!=(d=this.bindings)?d[a]:void 0)){if(null==b)return delete this.bindings[a];for(c=0,e=[];c<this.bindings[a].length;)this.bindings[a][c].handler===b?e.push(this.bindings[a].splice(c,1)):e.push(c++);return e}},a.prototype.trigger=function(){var a,b,c,d,e,f,g,h,i;if(c=arguments[0],a=2<=arguments.length?j.call(arguments,1):[],null!=(g=this.bindings)?g[c]:void 0){for(e=0,i=[];e<this.bindings[c].length;)h=this.bindings[c][e],d=h.handler,b=h.ctx,f=h.once,d.apply(null!=b?b:this,a),f?i.push(this.bindings[c].splice(e,1)):i.push(e++);return i}},a}(),Tether.Utils={getScrollParent:f,getBounds:d,getOffsetParent:e,extend:c,addClass:b,removeClass:h,hasClass:g,Evented:a}}).call(this),function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B=[].slice,C=function(a,b){return function(){return a.apply(b,arguments)}};for(z=Tether.Utils,n=z.getScrollParent,o=z.getSize,m=z.getOuterSize,k=z.getBounds,l=z.getOffsetParent,j=z.extend,d=z.addClass,u=z.removeClass,h=function(a,b){var c;return null==b&&(b=16),c=!1,function(){var d,e=this;if(!c)return d=arguments,c=!0,setTimeout(function(){return c=!1,a.apply(e,d)},b)}},v=[],t=function(){var a,b,c,d;for(d=[],b=0,c=v.length;c>b;b++)a=v[b],d.push(a.position());return d},p=null,A=["resize","scroll"],x=0,y=A.length;y>x;x++)i=A[x],window.addEventListener(i,function(){return null==p||new Date-p>16?(p=+new Date,t()):void 0});a={center:"center",left:"right",right:"left"},b={middle:"middle",top:"bottom",bottom:"top"},c={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},g=function(c,d){var e,f;return e=c.left,f=c.top,"auto"===e&&(e=a[d.left]),"auto"===f&&(f=b[d.top]),{left:e,top:f}},f=function(a){var b,d;return{left:null!=(b=c[a.left])?b:a.left,top:null!=(d=c[a.top])?d:a.top}},e=function(){var a,b,c,d,e,f,g;for(b=1<=arguments.length?B.call(arguments,0):[],c={top:0,left:0},e=0,f=b.length;f>e;e++)g=b[e],d=g.top,a=g.left,"string"==typeof d&&(d=parseFloat(d,10)),"string"==typeof a&&(a=parseFloat(a,10)),c.top+=d,c.left+=a;return c},q=function(a,b){return"string"==typeof a.left&&-1!==a.left.indexOf("%")&&(a.left=parseFloat(a.left,10)/100*b.width),"string"==typeof a.top&&-1!==a.top.indexOf("%")&&(a.top=parseFloat(a.top,10)/100*b.height),a},r=s=function(a){var b,c,d;return d=a.split(" "),c=d[0],b=d[1],{top:c,left:b}},w=function(){function a(a){this.position=C(this.position,this);var b,c,d,e,f;for(v.push(this),this.history=[],this.setOptions(a,!1),e=Tether.modules,c=0,d=e.length;d>c;c++)b=e[c],null!=(f=b.initialize)&&f.call(this);this.position()}return a.modules=[],a.prototype.getClass=function(a){var b,c;return(null!=(b=this.options.classes)?b[a]:void 0)?this.options.classes[a]:(null!=(c=this.options.classes)?c[a]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+a:a:""},a.prototype.setOptions=function(a,b){var c,e,f,g,h,i;for(this.options=a,null==b&&(b=!0),c={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=j(c,this.options),h=this.options,this.element=h.element,this.target=h.target,this.targetModifier=h.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),i=["element","target"],f=0,g=i.length;g>f;f++)if(e=i[f],null!=this[e].jquery?this[e]=this[e][0]:"string"==typeof this[e]&&(this[e]=document.querySelector(this[e])),null==this[e])throw new Error("Tether Error: Both element and target must be defined");if(d(this.element,this.getClass("element")),d(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=r(this.options.targetAttachment),this.attachment=r(this.options.attachment),this.offset=s(this.options.offset),this.targetOffset=s(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent=n(this.target),this.options.enabled!==!1?this.enable(b):void 0},a.prototype.getTargetBounds=function(){if(null==this.targetModifier)return k(this.target);switch(this.targetModifier){case"visible":return{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth};case"scroll-handle":return{top:pageYOffset+innerHeight*(pageYOffset/document.body.scrollHeight),left:innerWidth-15,height:.98*innerHeight*(innerHeight/document.body.scrollHeight),width:15}}},a.prototype.clearCache=function(){return this._cache={}},a.prototype.cache=function(a,b){return null==this._cache&&(this._cache={}),null==this._cache[a]&&(this._cache[a]=b.call(this)),this._cache[a]},a.prototype.enable=function(a){var b=this;return null==a&&(a=!0),this.addClass(this.getClass("enabled")),this.enabled=!0,this.scrollParent.addEventListener("scroll",this.position),a?setTimeout(function(){return b.position()}):void 0},a.prototype.disable=function(){return this.removeClass(this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},a.prototype.destroy=function(){var a,b,c,d,e;for(this.disable(),e=[],a=c=0,d=v.length;d>c;a=++c){if(b=v[a],b===this){v.splice(a,1);break}e.push(void 0)}return e},a.prototype.updateAttachClasses=function(a,b){var c,d,e,f,g,h;for(null==a&&(a=this.attachment),null==b&&(b=this.targetAttachment),d=["left","top","bottom","right","middle","center"],e=0,g=d.length;g>e;e++)c=d[e],this.removeClass(""+this.getClass("element-attached")+"-"+c);for(a.top&&this.addClass(""+this.getClass("element-attached")+"-"+a.top),a.left&&this.addClass(""+this.getClass("element-attached")+"-"+a.left),f=0,h=d.length;h>f;f++)c=d[f],this.removeClass(""+this.getClass("target-attached")+"-"+c);return b.top&&this.addClass(""+this.getClass("target-attached")+"-"+b.top),b.left?this.addClass(""+this.getClass("target-attached")+"-"+b.left):void 0},a.prototype.addClass=function(a){return d(this.element,a),d(this.target,a)},a.prototype.removeClass=function(a){return u(this.element,a),u(this.target,a)},a.prototype.position=function(){var a,b,c,d,h,i,j,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K=this;if(this.enabled){for(this.clearCache(),x=g(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,x),a=this.cache("element-bounds",function(){return k(K.element)}),C=a.width,b=a.height,A=z=this.cache("target-bounds",function(){return K.getTargetBounds()}),m=q(f(this.attachment),{width:C,height:b}),y=q(f(x),A),d=q(this.offset,{width:C,height:b}),h=q(this.targetOffset,A),m=e(m,d),c=z.left+y.left-m.left,B=z.top+y.top-m.top,H=Tether.modules,D=0,F=H.length;F>D;D++)if(i=H[D],t=i.position.call(this,{left:c,top:B,targetAttachment:x,targetPos:z,elementPos:a,offset:m,targetOffset:y,manualOffset:d,manualTargetOffset:h}),null!=t&&"object"==typeof t){if(t===!1)return!1;B=t.top,c=t.left}if(j={page:{top:B,bottom:document.body.scrollHeight-B-b,left:c,right:document.body.scrollWidth-c-C},viewport:{top:B-pageYOffset,bottom:pageYOffset-B-b+innerHeight,left:c-pageXOffset,right:pageXOffset-c-C+innerWidth}},(null!=(I=this.options.optimizations)?I.moveElement:void 0)!==!1&&null==this.targetModifier){for(o=this.cache("target-offsetparent",function(){return l(K.target)}),s=this.cache("target-offsetparent-bounds",function(){return k(o)}),r=getComputedStyle(o),p=s,n={},J=["top","left","bottom","right"],E=0,G=J.length;G>E;E++)w=J[E],n[w]=parseFloat(r["border-"+w+"-width"]);s.left+=n.left,s.top+=n.top,s.right=document.body.scrollWidth-s.left-p.width,s.bottom=document.body.scrollHeight-s.top-p.height,j.page.top>=s.top&&j.page.bottom>=s.bottom&&j.page.left>=s.left&&j.page.right>=s.right&&(v=o.scrollTop,u=o.scrollLeft,j.offset={top:j.page.top-s.top+v+n.top,left:j.page.left-s.left+u+n.left,right:j.page.right-s.right+o.scrollWidth-u+n.right,bottom:j.page.bottom-s.bottom+o.scrollHeight-v+n.bottom})}return this.move(j),this.history.unshift(j),this.history.length>3&&this.history.pop(),!0}},a.prototype.move=function(a){var b,c,d,e,f,g,h,i,k,m,n,o,p,q,r,s,t,u,v,w,x,y=this;if(null!=this.element.parentNode){k={};for(o in a){k[o]={};for(d in a[o]){for(c=!1,v=this.history,r=0,t=v.length;t>r;r++)if(i=v[r],(null!=(w=i[o])?w[d]:void 0)!==a[o][d]){c=!0;break}c||(k[o][d]=!0)}}if(b={top:"",left:"",right:"",bottom:""},n=function(a,c){return a.top?b.top=""+c.top+"px":b.bottom=""+c.bottom+"px",a.left?b.left=""+c.left+"px":b.right=""+c.right+"px"},e=!1,(k.page.top||k.page.bottom)&&(k.page.left||k.page.right))b.position="absolute",n(k.page,a.page);else if((k.viewport.top||k.viewport.bottom)&&(k.viewport.left||k.viewport.right))b.position="fixed",n(k.viewport,a.viewport);else if(null!=k.offset&&(k.offset.top||k.offset.bottom)&&(k.offset.left||k.offset.right)){for(b.position="absolute",g=this.cache("target-offsetparent",function(){return l(y.target)}),l(this.element)!==g&&(this.element.parentNode.removeChild(this.element),g.appendChild(this.element)),h=getComputedStyle(g),f=j({},a.offset),x=["top","left","bottom","right"],s=0,u=x.length;u>s;s++)m=x[s],f[m]-=parseFloat(h["border-"+m+"-width"]);n(k.offset,f),e=!0}else b.position="absolute",b.top=""+a.page.top+"px",b.left=""+a.page.left+"px";e||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),q=!1;for(d in b)if(p=b[d],this.element.style[d]!==p){q=!0;break}return q?j(this.element.style,b):void 0}},a}(),window.Tether=j(w,Tether)}.call(this),function(){var a,b,c,d,e,f,g,h,i=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};h=Tether.Utils,f=h.getOuterSize,e=h.getBounds,g=h.getSize,c=h.extend,b={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},a=["left","top","right","bottom"],d=function(b,c){var d,f,g,h,i,j,k;if("scrollParent"===c?c=b.scrollParent:"window"===c&&(c=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),null!=c.nodeType)for(f=h=e(c),i=getComputedStyle(c),c=[f.left,f.top,h.width+f.left,h.height+f.top],d=j=0,k=a.length;k>j;d=++j)g=a[d],"top"===g||"left"===g?c[d]+=parseFloat(i["border-"+g+"-width"]):c[d]-=parseFloat(i["border-"+g+"-width"]);return c},Tether.modules.push({position:function(b){var f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W=this;if(E=b.top,o=b.left,z=b.targetAttachment,!this.options.constraints)return!0;for(v=function(b){var c,d,e,f;for(W.removeClass(b),f=[],d=0,e=a.length;e>d;d++)c=a[d],f.push(W.removeClass(""+b+"-"+c));return f},Q=this.cache("element-bounds",function(){return e(W.element)}),n=Q.height,F=Q.width,B=this.cache("target-bounds",function(){return W.getTargetBounds()}),A=B.height,C=B.width,y={},m={},w=[this.getClass("pinned"),this.getClass("out-of-bounds")],R=this.options.constraints,G=0,K=R.length;K>G;G++)l=R[G],l.outOfBoundsClass&&w.push(l.outOfBoundsClass),l.pinnedClass&&w.push(l.pinnedClass);for(H=0,L=w.length;L>H;H++)k=w[H],v(k);for(y=c({},z),m=c({},this.attachment),S=this.options.constraints,I=0,M=S.length;M>I;I++){if(l=S[I],D=l.to,f=l.attachment,s=l.pin,null==f&&(f=""),i.call(f," ")>=0?(T=f.split(" "),j=T[0],h=T[1]):h=j=f,g=d(this,D),("target"===j||"both"===j)&&(E<g[1]&&"top"===y.top&&(E+=A,y.top="bottom"),E+n>g[3]&&"bottom"===y.top&&(E-=A,y.top="top")),"together"===j&&(E<g[1]&&"top"===y.top&&("bottom"===m.top?(E+=A,y.top="bottom",E+=n,m.top="top"):"top"===m.top&&(E+=A,y.top="bottom",E-=n,m.top="bottom")),E+n>g[3]&&"bottom"===y.top&&("top"===m.top?(E-=A,y.top="top",E-=n,m.top="bottom"):"bottom"===m.top&&(E-=A,y.top="top",E+=n,m.top="top"))),("target"===h||"both"===h)&&(o<g[0]&&"left"===y.left&&(o+=C,y.left="right"),o+F>g[2]&&"right"===y.left&&(o-=C,y.left="left")),"together"===h&&(o<g[0]&&"left"===y.left?"right"===m.left?(o+=C,y.left="right",o+=F,m.left="left"):"left"===m.left&&(o+=C,y.left="right",o-=F,m.left="right"):o+F>g[2]&&"right"===y.left&&("left"===m.left?(o-=C,y.left="left",o-=F,m.left="right"):"right"===m.left&&(o-=C,y.left="left",o+=F,m.left="left"))),("element"===j||"both"===j)&&(E<g[1]&&"bottom"===m.top&&(E+=n,m.top="top"),E+n>g[3]&&"top"===m.top&&(E-=n,m.top="bottom")),("element"===h||"both"===h)&&(o<g[0]&&"right"===m.left&&(o+=F,m.left="left"),o+F>g[2]&&"left"===m.left&&(o-=F,m.left="right")),"string"==typeof s?s=function(){var a,b,c,d;for(c=s.split(","),d=[],a=0,b=c.length;b>a;a++)r=c[a],d.push(r.trim());return d}():s===!0&&(s=["top","left","right","bottom"]),s||(s=[]),t=[],p=[],E<g[1]&&(i.call(s,"top")>=0?(E=g[1],t.push("top")):p.push("top")),E+n>g[3]&&(i.call(s,"bottom")>=0?(E=g[3]-n,t.push("bottom")):p.push("bottom")),o<g[0]&&(i.call(s,"left")>=0?(o=g[0],t.push("left")):p.push("left")),o+F>g[2]&&(i.call(s,"right")>=0?(o=g[2]-F,t.push("right")):p.push("right")),t.length)for(u=null!=(U=this.options.pinnedClass)?U:this.getClass("pinned"),this.addClass(u),J=0,N=t.length;N>J;J++)x=t[J],this.addClass(""+u+"-"+x);if(p.length)for(q=null!=(V=this.options.outOfBoundsClass)?V:this.getClass("out-of-bounds"),this.addClass(q),P=0,O=p.length;O>P;P++)x=p[P],this.addClass(""+q+"-"+x);(i.call(t,"left")>=0||i.call(t,"right")>=0)&&(m.left=y.left=!1),(i.call(t,"top")>=0||i.call(t,"bottom")>=0)&&(m.top=y.top=!1),(y.top!==z.top||y.left!==z.left||m.top!==this.attachment.top||m.left!==this.attachment.left)&&this.updateAttachClasses(m,y)}return{top:E,left:o}}})}.call(this),function(){var a;a=Tether.Utils.getBounds,Tether.modules.push({position:function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z=this;if(k=b.top,f=b.left,u=this.cache("element-bounds",function(){return a(z.element)}),e=u.height,l=u.width,j=this.getTargetBounds(),d=k+e,g=f+l,c=[],k<=j.bottom&&d>=j.top)for(v=["left","right"],m=0,q=v.length;q>m;m++)h=v[m],((w=j[h])===f||w===g)&&c.push(h);if(f<=j.right&&g>=j.left)for(x=["top","bottom"],n=0,r=x.length;r>n;n++)h=x[n],((y=j[h])===k||y===d)&&c.push(h);for(i=["left","top","right","bottom"],this.removeClass(this.getClass("abutted")),o=0,s=i.length;s>o;o++)h=i[o],this.removeClass(""+this.getClass("abutted")+"-"+h);for(c.length&&this.addClass(this.getClass("abutted")),p=0,t=c.length;t>p;p++)h=c[p],this.addClass(""+this.getClass("abutted")+"-"+h);return!0}})}.call(this),function(){Tether.modules.push({position:function(a){var b,c,d,e,f,g,h;return g=a.top,b=a.left,this.options.shift?(c=function(a){return"function"==typeof a?a.call(this,{top:g,left:b}):a},d=c(this.options.shift),"string"==typeof d?(d=d.split(" "),d[1]||(d[1]=d[0]),f=d[0],e=d[1],f=parseFloat(f,10),e=parseFloat(e,10)):(h=[d.top,d.left],f=h[0],e=h[1]),g+=f,b+=e,{top:g,left:b}):void 0}})}.call(this);
\ No newline at end of file diff --git a/afb-client/bower_components/tether/js/utils.js b/afb-client/bower_components/tether/js/utils.js new file mode 100644 index 0000000..b255103 --- /dev/null +++ b/afb-client/bower_components/tether/js/utils.js @@ -0,0 +1,331 @@ +(function() { + var Evented, addClass, defer, deferred, extend, flush, getBounds, getOffsetParent, getOrigin, getScrollBarSize, getScrollParent, hasClass, node, removeClass, uniqueId, updateClasses, zeroPosCache, + __hasProp = {}.hasOwnProperty, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, + __slice = [].slice; + + if (this.Tether == null) { + this.Tether = { + modules: [] + }; + } + + getScrollParent = function(el) { + var parent, position, scrollParent, style, _ref; + position = getComputedStyle(el).position; + if (position === 'fixed') { + return el; + } + scrollParent = void 0; + parent = el; + while (parent = parent.parentNode) { + try { + style = getComputedStyle(parent); + } catch (_error) {} + if (style == null) { + return parent; + } + if (/(auto|scroll)/.test(style['overflow'] + style['overflow-y'] + style['overflow-x'])) { + if (position !== 'absolute' || ((_ref = style['position']) === 'relative' || _ref === 'absolute' || _ref === 'fixed')) { + return parent; + } + } + } + return document.body; + }; + + uniqueId = (function() { + var id; + id = 0; + return function() { + return id++; + }; + })(); + + zeroPosCache = {}; + + getOrigin = function(doc) { + var id, k, node, v, _ref; + node = doc._tetherZeroElement; + if (node == null) { + node = doc.createElement('div'); + node.setAttribute('data-tether-id', uniqueId()); + extend(node.style, { + top: 0, + left: 0, + position: 'absolute' + }); + doc.body.appendChild(node); + doc._tetherZeroElement = node; + } + id = node.getAttribute('data-tether-id'); + if (zeroPosCache[id] == null) { + zeroPosCache[id] = {}; + _ref = node.getBoundingClientRect(); + for (k in _ref) { + v = _ref[k]; + zeroPosCache[id][k] = v; + } + defer(function() { + return zeroPosCache[id] = void 0; + }); + } + return zeroPosCache[id]; + }; + + node = null; + + getBounds = function(el) { + var box, doc, docEl, k, origin, v, _ref; + if (el === document) { + doc = document; + el = document.documentElement; + } else { + doc = el.ownerDocument; + } + docEl = doc.documentElement; + box = {}; + _ref = el.getBoundingClientRect(); + for (k in _ref) { + v = _ref[k]; + box[k] = v; + } + origin = getOrigin(doc); + box.top -= origin.top; + box.left -= origin.left; + if (box.width == null) { + box.width = document.body.scrollWidth - box.left - box.right; + } + if (box.height == null) { + box.height = document.body.scrollHeight - box.top - box.bottom; + } + box.top = box.top - docEl.clientTop; + box.left = box.left - docEl.clientLeft; + box.right = doc.body.clientWidth - box.width - box.left; + box.bottom = doc.body.clientHeight - box.height - box.top; + return box; + }; + + getOffsetParent = function(el) { + return el.offsetParent || document.documentElement; + }; + + getScrollBarSize = function() { + var inner, outer, width, widthContained, widthScroll; + inner = document.createElement('div'); + inner.style.width = '100%'; + inner.style.height = '200px'; + outer = document.createElement('div'); + extend(outer.style, { + position: 'absolute', + top: 0, + left: 0, + pointerEvents: 'none', + visibility: 'hidden', + width: '200px', + height: '150px', + overflow: 'hidden' + }); + outer.appendChild(inner); + document.body.appendChild(outer); + widthContained = inner.offsetWidth; + outer.style.overflow = 'scroll'; + widthScroll = inner.offsetWidth; + if (widthContained === widthScroll) { + widthScroll = outer.clientWidth; + } + document.body.removeChild(outer); + width = widthContained - widthScroll; + return { + width: width, + height: width + }; + }; + + extend = function(out) { + var args, key, obj, val, _i, _len, _ref; + if (out == null) { + out = {}; + } + args = []; + Array.prototype.push.apply(args, arguments); + _ref = args.slice(1); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + obj = _ref[_i]; + if (obj) { + for (key in obj) { + if (!__hasProp.call(obj, key)) continue; + val = obj[key]; + out[key] = val; + } + } + } + return out; + }; + + removeClass = function(el, name) { + var cls, _i, _len, _ref, _results; + if (el.classList != null) { + _ref = name.split(' '); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + cls = _ref[_i]; + if (cls.trim()) { + _results.push(el.classList.remove(cls)); + } + } + return _results; + } else { + return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' '); + } + }; + + addClass = function(el, name) { + var cls, _i, _len, _ref, _results; + if (el.classList != null) { + _ref = name.split(' '); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + cls = _ref[_i]; + if (cls.trim()) { + _results.push(el.classList.add(cls)); + } + } + return _results; + } else { + removeClass(el, name); + return el.className += " " + name; + } + }; + + hasClass = function(el, name) { + if (el.classList != null) { + return el.classList.contains(name); + } else { + return new RegExp("(^| )" + name + "( |$)", 'gi').test(el.className); + } + }; + + updateClasses = function(el, add, all) { + var cls, _i, _j, _len, _len1, _results; + for (_i = 0, _len = all.length; _i < _len; _i++) { + cls = all[_i]; + if (__indexOf.call(add, cls) < 0) { + if (hasClass(el, cls)) { + removeClass(el, cls); + } + } + } + _results = []; + for (_j = 0, _len1 = add.length; _j < _len1; _j++) { + cls = add[_j]; + if (!hasClass(el, cls)) { + _results.push(addClass(el, cls)); + } else { + _results.push(void 0); + } + } + return _results; + }; + + deferred = []; + + defer = function(fn) { + return deferred.push(fn); + }; + + flush = function() { + var fn, _results; + _results = []; + while (fn = deferred.pop()) { + _results.push(fn()); + } + return _results; + }; + + Evented = (function() { + function Evented() {} + + Evented.prototype.on = function(event, handler, ctx, once) { + var _base; + if (once == null) { + once = false; + } + if (this.bindings == null) { + this.bindings = {}; + } + if ((_base = this.bindings)[event] == null) { + _base[event] = []; + } + return this.bindings[event].push({ + handler: handler, + ctx: ctx, + once: once + }); + }; + + Evented.prototype.once = function(event, handler, ctx) { + return this.on(event, handler, ctx, true); + }; + + Evented.prototype.off = function(event, handler) { + var i, _ref, _results; + if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) { + return; + } + if (handler == null) { + return delete this.bindings[event]; + } else { + i = 0; + _results = []; + while (i < this.bindings[event].length) { + if (this.bindings[event][i].handler === handler) { + _results.push(this.bindings[event].splice(i, 1)); + } else { + _results.push(i++); + } + } + return _results; + } + }; + + Evented.prototype.trigger = function() { + var args, ctx, event, handler, i, once, _ref, _ref1, _results; + event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + if ((_ref = this.bindings) != null ? _ref[event] : void 0) { + i = 0; + _results = []; + while (i < this.bindings[event].length) { + _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once; + handler.apply(ctx != null ? ctx : this, args); + if (once) { + _results.push(this.bindings[event].splice(i, 1)); + } else { + _results.push(i++); + } + } + return _results; + } + }; + + return Evented; + + })(); + + this.Tether.Utils = { + getScrollParent: getScrollParent, + getBounds: getBounds, + getOffsetParent: getOffsetParent, + extend: extend, + addClass: addClass, + removeClass: removeClass, + hasClass: hasClass, + updateClasses: updateClasses, + defer: defer, + flush: flush, + uniqueId: uniqueId, + Evented: Evented, + getScrollBarSize: getScrollBarSize + }; + +}).call(this); diff --git a/afb-client/bower_components/tether/package.json b/afb-client/bower_components/tether/package.json new file mode 100644 index 0000000..ca4b80d --- /dev/null +++ b/afb-client/bower_components/tether/package.json @@ -0,0 +1,21 @@ +{ + "name": "tether", + "version": "0.6.5", + "description": "A client-side library to make absolutely positioned elements attach to elements in the page efficiently.", + "authors": [ + "Zack Bloom <zackbloom@gmail.com>", + "Adam Schwartz <adam.flynn.schwartz@gmail.com>" + ], + "license": "MIT", + "devDependencies": { + "coffee-script": "~1.6.3", + "gulp": "~3.3.0", + "gulp-header": "~1.0.2", + "gulp-uglify": "~0.1.0", + "gulp-compass": "~1.0.3", + "gulp-coffee": "~1.2.5", + "gulp-concat": "~2.1.7", + "gulp-rename": "~0.2.1", + "gulp-wrap-umd": "~0.1.0" + } +} diff --git a/afb-client/bower_components/tether/sass/helpers/_tether-theme-arrows.sass b/afb-client/bower_components/tether/sass/helpers/_tether-theme-arrows.sass new file mode 100644 index 0000000..999ae4c --- /dev/null +++ b/afb-client/bower_components/tether/sass/helpers/_tether-theme-arrows.sass @@ -0,0 +1,136 @@ +@import compass/css3 + +=tether-theme-arrows($themePrefix: "tether", $themeName: "arrows", $arrowSize: 16px, $backgroundColor: #fff, $color: inherit, $useDropShadow: false) + .#{ $themePrefix }-element.#{ $themePrefix }-theme-#{ $themeName } + max-width: 100% + max-height: 100% + + .#{ $themePrefix }-content + +border-radius(5px) + position: relative + font-family: inherit + background: $backgroundColor + color: $color + padding: 1em + font-size: 1.1em + line-height: 1.5em + + @if $useDropShadow + +transform(translateZ(0)) + +filter(drop-shadow(0 1px 4px rgba(0, 0, 0, .2))) + + &:before + content: "" + display: block + position: absolute + width: 0 + height: 0 + border-color: transparent + border-width: $arrowSize + border-style: solid + + // Centers and middles + + &.#{ $themePrefix }-element-attached-bottom.#{ $themePrefix }-element-attached-center .#{ $themePrefix }-content + margin-bottom: $arrowSize + + &:before + top: 100% + left: 50% + margin-left: - $arrowSize + border-top-color: $backgroundColor + + &.#{ $themePrefix }-element-attached-top.#{ $themePrefix }-element-attached-center .#{ $themePrefix }-content + margin-top: $arrowSize + + &:before + bottom: 100% + left: 50% + margin-left: - $arrowSize + border-bottom-color: $backgroundColor + + &.#{ $themePrefix }-element-attached-right.#{ $themePrefix }-element-attached-middle .#{ $themePrefix }-content + margin-right: $arrowSize + + &:before + left: 100% + top: 50% + margin-top: - $arrowSize + border-left-color: $backgroundColor + + &.#{ $themePrefix }-element-attached-left.#{ $themePrefix }-element-attached-middle .#{ $themePrefix }-content + margin-left: $arrowSize + + &:before + right: 100% + top: 50% + margin-top: - $arrowSize + border-right-color: $backgroundColor + + // Top and bottom corners + + &.#{ $themePrefix }-element-attached-top.#{ $themePrefix }-element-attached-left.#{ $themePrefix }-target-attached-bottom .#{ $themePrefix }-content + margin-top: $arrowSize + + &:before + bottom: 100% + left: $arrowSize + border-bottom-color: $backgroundColor + + &.#{ $themePrefix }-element-attached-top.#{ $themePrefix }-element-attached-right.#{ $themePrefix }-target-attached-bottom .#{ $themePrefix }-content + margin-top: $arrowSize + + &:before + bottom: 100% + right: $arrowSize + border-bottom-color: $backgroundColor + + &.#{ $themePrefix }-element-attached-bottom.#{ $themePrefix }-element-attached-left.#{ $themePrefix }-target-attached-top .#{ $themePrefix }-content + margin-bottom: $arrowSize + + &:before + top: 100% + left: $arrowSize + border-top-color: $backgroundColor + + &.#{ $themePrefix }-element-attached-bottom.#{ $themePrefix }-element-attached-right.#{ $themePrefix }-target-attached-top .#{ $themePrefix }-content + margin-bottom: $arrowSize + + &:before + top: 100% + right: $arrowSize + border-top-color: $backgroundColor + + // Side corners + + &.#{ $themePrefix }-element-attached-top.#{ $themePrefix }-element-attached-right.#{ $themePrefix }-target-attached-left .#{ $themePrefix }-content + margin-right: $arrowSize + + &:before + top: $arrowSize + left: 100% + border-left-color: $backgroundColor + + &.#{ $themePrefix }-element-attached-top.#{ $themePrefix }-element-attached-left.#{ $themePrefix }-target-attached-right .#{ $themePrefix }-content + margin-left: $arrowSize + + &:before + top: $arrowSize + right: 100% + border-right-color: $backgroundColor + + &.#{ $themePrefix }-element-attached-bottom.#{ $themePrefix }-element-attached-right.#{ $themePrefix }-target-attached-left .#{ $themePrefix }-content + margin-right: $arrowSize + + &:before + bottom: $arrowSize + left: 100% + border-left-color: $backgroundColor + + &.#{ $themePrefix }-element-attached-bottom.#{ $themePrefix }-element-attached-left.#{ $themePrefix }-target-attached-right .#{ $themePrefix }-content + margin-left: $arrowSize + + &:before + bottom: $arrowSize + right: 100% + border-right-color: $backgroundColor diff --git a/afb-client/bower_components/tether/sass/helpers/_tether-theme-basic.sass b/afb-client/bower_components/tether/sass/helpers/_tether-theme-basic.sass new file mode 100644 index 0000000..34642c2 --- /dev/null +++ b/afb-client/bower_components/tether/sass/helpers/_tether-theme-basic.sass @@ -0,0 +1,16 @@ +@import compass/css3 + +=tether-theme-basic($themePrefix: "tether", $themeName: "basic", $backgroundColor: #fff, $color: inherit) + .#{ $themePrefix }-element.#{ $themePrefix }-theme-#{ $themeName } + max-width: 100% + max-height: 100% + + .#{ $themePrefix }-content + +border-radius(5px) + +box-shadow(0 2px 8px rgba(0, 0, 0, .2)) + font-family: inherit + background: $backgroundColor + color: $color + padding: 1em + font-size: 1.1em + line-height: 1.5em
\ No newline at end of file diff --git a/afb-client/bower_components/tether/sass/helpers/_tether.sass b/afb-client/bower_components/tether/sass/helpers/_tether.sass new file mode 100644 index 0000000..fc50993 --- /dev/null +++ b/afb-client/bower_components/tether/sass/helpers/_tether.sass @@ -0,0 +1,14 @@ +@import compass/css3 + +=tether($themePrefix: "tether") + .#{ $themePrefix }-element, .#{ $themePrefix }-element * + + &, &:after, &:before + +box-sizing(border-box) + + .#{ $themePrefix }-element + position: absolute + display: none + + &.#{ $themePrefix }-open + display: block diff --git a/afb-client/bower_components/tether/sass/mixins/_pointer-events.scss b/afb-client/bower_components/tether/sass/mixins/_pointer-events.scss new file mode 100644 index 0000000..66c7e77 --- /dev/null +++ b/afb-client/bower_components/tether/sass/mixins/_pointer-events.scss @@ -0,0 +1,6 @@ +@mixin pointer-events($type: none) { + $type: unquote($type); + @include experimental(pointer-events, $type, + -moz, -webkit, not -o, not -ms, -khtml, official + ); +}
\ No newline at end of file diff --git a/afb-client/bower_components/tether/sass/tether-theme-arrows-dark.sass b/afb-client/bower_components/tether/sass/tether-theme-arrows-dark.sass new file mode 100644 index 0000000..ad1caf0 --- /dev/null +++ b/afb-client/bower_components/tether/sass/tether-theme-arrows-dark.sass @@ -0,0 +1,12 @@ +@import helpers/tether +@import helpers/tether-theme-arrows + +$themePrefix: "tether" +$themeName: "arrows-dark" +$arrowSize: 16px +$backgroundColor: #000 +$color: #fff +$useDropShadow: false + ++tether($themePrefix: $themePrefix) ++tether-theme-arrows($themePrefix: $themePrefix, $themeName: $themeName, $arrowSize: $arrowSize, $backgroundColor: $backgroundColor, $color: $color, $useDropShadow: $useDropShadow) diff --git a/afb-client/bower_components/tether/sass/tether-theme-arrows.sass b/afb-client/bower_components/tether/sass/tether-theme-arrows.sass new file mode 100644 index 0000000..87765b2 --- /dev/null +++ b/afb-client/bower_components/tether/sass/tether-theme-arrows.sass @@ -0,0 +1,12 @@ +@import helpers/tether +@import helpers/tether-theme-arrows + +$themePrefix: "tether" +$themeName: "arrows" +$arrowSize: 16px +$backgroundColor: #fff +$color: inherit +$useDropShadow: true + ++tether($themePrefix: $themePrefix) ++tether-theme-arrows($themePrefix: $themePrefix, $themeName: $themeName, $arrowSize: $arrowSize, $backgroundColor: $backgroundColor, $color: $color, $useDropShadow: $useDropShadow) diff --git a/afb-client/bower_components/tether/sass/tether-theme-basic.sass b/afb-client/bower_components/tether/sass/tether-theme-basic.sass new file mode 100644 index 0000000..9a2be06 --- /dev/null +++ b/afb-client/bower_components/tether/sass/tether-theme-basic.sass @@ -0,0 +1,10 @@ +@import helpers/tether +@import helpers/tether-theme-basic + +$themePrefix: "tether" +$themeName: "basic" +$backgroundColor: #fff +$color: inherit + ++tether($themePrefix: $themePrefix) ++tether-theme-basic($themePrefix: $themePrefix, $themeName: $themeName, $backgroundColor: $backgroundColor, $color: $color)
\ No newline at end of file diff --git a/afb-client/bower_components/tether/sass/tether.sass b/afb-client/bower_components/tether/sass/tether.sass new file mode 100644 index 0000000..6421016 --- /dev/null +++ b/afb-client/bower_components/tether/sass/tether.sass @@ -0,0 +1,5 @@ +@import helpers/tether + +$themePrefix: "tether" + ++tether($themePrefix: $themePrefix)
\ No newline at end of file diff --git a/afb-client/bower_components/tether/tether.js b/afb-client/bower_components/tether/tether.js new file mode 100644 index 0000000..d5d0261 --- /dev/null +++ b/afb-client/bower_components/tether/tether.js @@ -0,0 +1,1443 @@ +/*! tether 0.6.5 */ + + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + define(factory); + } else if (typeof exports === 'object') { + module.exports = factory(require,exports,module); + } else { + root.Tether = factory(); + } +}(this, function(require,exports,module) { + +(function() { + var Evented, addClass, defer, deferred, extend, flush, getBounds, getOffsetParent, getOrigin, getScrollBarSize, getScrollParent, hasClass, node, removeClass, uniqueId, updateClasses, zeroPosCache, + __hasProp = {}.hasOwnProperty, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, + __slice = [].slice; + + if (this.Tether == null) { + this.Tether = { + modules: [] + }; + } + + getScrollParent = function(el) { + var parent, position, scrollParent, style, _ref; + position = getComputedStyle(el).position; + if (position === 'fixed') { + return el; + } + scrollParent = void 0; + parent = el; + while (parent = parent.parentNode) { + try { + style = getComputedStyle(parent); + } catch (_error) {} + if (style == null) { + return parent; + } + if (/(auto|scroll)/.test(style['overflow'] + style['overflow-y'] + style['overflow-x'])) { + if (position !== 'absolute' || ((_ref = style['position']) === 'relative' || _ref === 'absolute' || _ref === 'fixed')) { + return parent; + } + } + } + return document.body; + }; + + uniqueId = (function() { + var id; + id = 0; + return function() { + return id++; + }; + })(); + + zeroPosCache = {}; + + getOrigin = function(doc) { + var id, k, node, v, _ref; + node = doc._tetherZeroElement; + if (node == null) { + node = doc.createElement('div'); + node.setAttribute('data-tether-id', uniqueId()); + extend(node.style, { + top: 0, + left: 0, + position: 'absolute' + }); + doc.body.appendChild(node); + doc._tetherZeroElement = node; + } + id = node.getAttribute('data-tether-id'); + if (zeroPosCache[id] == null) { + zeroPosCache[id] = {}; + _ref = node.getBoundingClientRect(); + for (k in _ref) { + v = _ref[k]; + zeroPosCache[id][k] = v; + } + defer(function() { + return zeroPosCache[id] = void 0; + }); + } + return zeroPosCache[id]; + }; + + node = null; + + getBounds = function(el) { + var box, doc, docEl, k, origin, v, _ref; + if (el === document) { + doc = document; + el = document.documentElement; + } else { + doc = el.ownerDocument; + } + docEl = doc.documentElement; + box = {}; + _ref = el.getBoundingClientRect(); + for (k in _ref) { + v = _ref[k]; + box[k] = v; + } + origin = getOrigin(doc); + box.top -= origin.top; + box.left -= origin.left; + if (box.width == null) { + box.width = document.body.scrollWidth - box.left - box.right; + } + if (box.height == null) { + box.height = document.body.scrollHeight - box.top - box.bottom; + } + box.top = box.top - docEl.clientTop; + box.left = box.left - docEl.clientLeft; + box.right = doc.body.clientWidth - box.width - box.left; + box.bottom = doc.body.clientHeight - box.height - box.top; + return box; + }; + + getOffsetParent = function(el) { + return el.offsetParent || document.documentElement; + }; + + getScrollBarSize = function() { + var inner, outer, width, widthContained, widthScroll; + inner = document.createElement('div'); + inner.style.width = '100%'; + inner.style.height = '200px'; + outer = document.createElement('div'); + extend(outer.style, { + position: 'absolute', + top: 0, + left: 0, + pointerEvents: 'none', + visibility: 'hidden', + width: '200px', + height: '150px', + overflow: 'hidden' + }); + outer.appendChild(inner); + document.body.appendChild(outer); + widthContained = inner.offsetWidth; + outer.style.overflow = 'scroll'; + widthScroll = inner.offsetWidth; + if (widthContained === widthScroll) { + widthScroll = outer.clientWidth; + } + document.body.removeChild(outer); + width = widthContained - widthScroll; + return { + width: width, + height: width + }; + }; + + extend = function(out) { + var args, key, obj, val, _i, _len, _ref; + if (out == null) { + out = {}; + } + args = []; + Array.prototype.push.apply(args, arguments); + _ref = args.slice(1); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + obj = _ref[_i]; + if (obj) { + for (key in obj) { + if (!__hasProp.call(obj, key)) continue; + val = obj[key]; + out[key] = val; + } + } + } + return out; + }; + + removeClass = function(el, name) { + var cls, _i, _len, _ref, _results; + if (el.classList != null) { + _ref = name.split(' '); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + cls = _ref[_i]; + if (cls.trim()) { + _results.push(el.classList.remove(cls)); + } + } + return _results; + } else { + return el.className = el.className.replace(new RegExp("(^| )" + (name.split(' ').join('|')) + "( |$)", 'gi'), ' '); + } + }; + + addClass = function(el, name) { + var cls, _i, _len, _ref, _results; + if (el.classList != null) { + _ref = name.split(' '); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + cls = _ref[_i]; + if (cls.trim()) { + _results.push(el.classList.add(cls)); + } + } + return _results; + } else { + removeClass(el, name); + return el.className += " " + name; + } + }; + + hasClass = function(el, name) { + if (el.classList != null) { + return el.classList.contains(name); + } else { + return new RegExp("(^| )" + name + "( |$)", 'gi').test(el.className); + } + }; + + updateClasses = function(el, add, all) { + var cls, _i, _j, _len, _len1, _results; + for (_i = 0, _len = all.length; _i < _len; _i++) { + cls = all[_i]; + if (__indexOf.call(add, cls) < 0) { + if (hasClass(el, cls)) { + removeClass(el, cls); + } + } + } + _results = []; + for (_j = 0, _len1 = add.length; _j < _len1; _j++) { + cls = add[_j]; + if (!hasClass(el, cls)) { + _results.push(addClass(el, cls)); + } else { + _results.push(void 0); + } + } + return _results; + }; + + deferred = []; + + defer = function(fn) { + return deferred.push(fn); + }; + + flush = function() { + var fn, _results; + _results = []; + while (fn = deferred.pop()) { + _results.push(fn()); + } + return _results; + }; + + Evented = (function() { + function Evented() {} + + Evented.prototype.on = function(event, handler, ctx, once) { + var _base; + if (once == null) { + once = false; + } + if (this.bindings == null) { + this.bindings = {}; + } + if ((_base = this.bindings)[event] == null) { + _base[event] = []; + } + return this.bindings[event].push({ + handler: handler, + ctx: ctx, + once: once + }); + }; + + Evented.prototype.once = function(event, handler, ctx) { + return this.on(event, handler, ctx, true); + }; + + Evented.prototype.off = function(event, handler) { + var i, _ref, _results; + if (((_ref = this.bindings) != null ? _ref[event] : void 0) == null) { + return; + } + if (handler == null) { + return delete this.bindings[event]; + } else { + i = 0; + _results = []; + while (i < this.bindings[event].length) { + if (this.bindings[event][i].handler === handler) { + _results.push(this.bindings[event].splice(i, 1)); + } else { + _results.push(i++); + } + } + return _results; + } + }; + + Evented.prototype.trigger = function() { + var args, ctx, event, handler, i, once, _ref, _ref1, _results; + event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + if ((_ref = this.bindings) != null ? _ref[event] : void 0) { + i = 0; + _results = []; + while (i < this.bindings[event].length) { + _ref1 = this.bindings[event][i], handler = _ref1.handler, ctx = _ref1.ctx, once = _ref1.once; + handler.apply(ctx != null ? ctx : this, args); + if (once) { + _results.push(this.bindings[event].splice(i, 1)); + } else { + _results.push(i++); + } + } + return _results; + } + }; + + return Evented; + + })(); + + this.Tether.Utils = { + getScrollParent: getScrollParent, + getBounds: getBounds, + getOffsetParent: getOffsetParent, + extend: extend, + addClass: addClass, + removeClass: removeClass, + hasClass: hasClass, + updateClasses: updateClasses, + defer: defer, + flush: flush, + uniqueId: uniqueId, + Evented: Evented, + getScrollBarSize: getScrollBarSize + }; + +}).call(this); + +(function() { + var MIRROR_LR, MIRROR_TB, OFFSET_MAP, Tether, addClass, addOffset, attachmentToOffset, autoToFixedAttachment, defer, extend, flush, getBounds, getOffsetParent, getOuterSize, getScrollBarSize, getScrollParent, getSize, now, offsetToPx, parseAttachment, parseOffset, position, removeClass, tethers, transformKey, updateClasses, within, _Tether, _ref, + __slice = [].slice, + __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; + + if (this.Tether == null) { + throw new Error("You must include the utils.js file before tether.js"); + } + + Tether = this.Tether; + + _ref = Tether.Utils, getScrollParent = _ref.getScrollParent, getSize = _ref.getSize, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getOffsetParent = _ref.getOffsetParent, extend = _ref.extend, addClass = _ref.addClass, removeClass = _ref.removeClass, updateClasses = _ref.updateClasses, defer = _ref.defer, flush = _ref.flush, getScrollBarSize = _ref.getScrollBarSize; + + within = function(a, b, diff) { + if (diff == null) { + diff = 1; + } + return (a + diff >= b && b >= a - diff); + }; + + transformKey = (function() { + var el, key, _i, _len, _ref1; + el = document.createElement('div'); + _ref1 = ['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform']; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + key = _ref1[_i]; + if (el.style[key] !== void 0) { + return key; + } + } + })(); + + tethers = []; + + position = function() { + var tether, _i, _len; + for (_i = 0, _len = tethers.length; _i < _len; _i++) { + tether = tethers[_i]; + tether.position(false); + } + return flush(); + }; + + now = function() { + var _ref1; + return (_ref1 = typeof performance !== "undefined" && performance !== null ? typeof performance.now === "function" ? performance.now() : void 0 : void 0) != null ? _ref1 : +(new Date); + }; + + (function() { + var event, lastCall, lastDuration, pendingTimeout, tick, _i, _len, _ref1, _results; + lastCall = null; + lastDuration = null; + pendingTimeout = null; + tick = function() { + if ((lastDuration != null) && lastDuration > 16) { + lastDuration = Math.min(lastDuration - 16, 250); + pendingTimeout = setTimeout(tick, 250); + return; + } + if ((lastCall != null) && (now() - lastCall) < 10) { + return; + } + if (pendingTimeout != null) { + clearTimeout(pendingTimeout); + pendingTimeout = null; + } + lastCall = now(); + position(); + return lastDuration = now() - lastCall; + }; + _ref1 = ['resize', 'scroll', 'touchmove']; + _results = []; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + event = _ref1[_i]; + _results.push(window.addEventListener(event, tick)); + } + return _results; + })(); + + MIRROR_LR = { + center: 'center', + left: 'right', + right: 'left' + }; + + MIRROR_TB = { + middle: 'middle', + top: 'bottom', + bottom: 'top' + }; + + OFFSET_MAP = { + top: 0, + left: 0, + middle: '50%', + center: '50%', + bottom: '100%', + right: '100%' + }; + + autoToFixedAttachment = function(attachment, relativeToAttachment) { + var left, top; + left = attachment.left, top = attachment.top; + if (left === 'auto') { + left = MIRROR_LR[relativeToAttachment.left]; + } + if (top === 'auto') { + top = MIRROR_TB[relativeToAttachment.top]; + } + return { + left: left, + top: top + }; + }; + + attachmentToOffset = function(attachment) { + var _ref1, _ref2; + return { + left: (_ref1 = OFFSET_MAP[attachment.left]) != null ? _ref1 : attachment.left, + top: (_ref2 = OFFSET_MAP[attachment.top]) != null ? _ref2 : attachment.top + }; + }; + + addOffset = function() { + var left, offsets, out, top, _i, _len, _ref1; + offsets = 1 <= arguments.length ? __slice.call(arguments, 0) : []; + out = { + top: 0, + left: 0 + }; + for (_i = 0, _len = offsets.length; _i < _len; _i++) { + _ref1 = offsets[_i], top = _ref1.top, left = _ref1.left; + if (typeof top === 'string') { + top = parseFloat(top, 10); + } + if (typeof left === 'string') { + left = parseFloat(left, 10); + } + out.top += top; + out.left += left; + } + return out; + }; + + offsetToPx = function(offset, size) { + if (typeof offset.left === 'string' && offset.left.indexOf('%') !== -1) { + offset.left = parseFloat(offset.left, 10) / 100 * size.width; + } + if (typeof offset.top === 'string' && offset.top.indexOf('%') !== -1) { + offset.top = parseFloat(offset.top, 10) / 100 * size.height; + } + return offset; + }; + + parseAttachment = parseOffset = function(value) { + var left, top, _ref1; + _ref1 = value.split(' '), top = _ref1[0], left = _ref1[1]; + return { + top: top, + left: left + }; + }; + + _Tether = (function() { + _Tether.modules = []; + + function _Tether(options) { + this.position = __bind(this.position, this); + var module, _i, _len, _ref1, _ref2; + tethers.push(this); + this.history = []; + this.setOptions(options, false); + _ref1 = Tether.modules; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + module = _ref1[_i]; + if ((_ref2 = module.initialize) != null) { + _ref2.call(this); + } + } + this.position(); + } + + _Tether.prototype.getClass = function(key) { + var _ref1, _ref2; + if ((_ref1 = this.options.classes) != null ? _ref1[key] : void 0) { + return this.options.classes[key]; + } else if (((_ref2 = this.options.classes) != null ? _ref2[key] : void 0) !== false) { + if (this.options.classPrefix) { + return "" + this.options.classPrefix + "-" + key; + } else { + return key; + } + } else { + return ''; + } + }; + + _Tether.prototype.setOptions = function(options, position) { + var defaults, key, _i, _len, _ref1, _ref2; + this.options = options; + if (position == null) { + position = true; + } + defaults = { + offset: '0 0', + targetOffset: '0 0', + targetAttachment: 'auto auto', + classPrefix: 'tether' + }; + this.options = extend(defaults, this.options); + _ref1 = this.options, this.element = _ref1.element, this.target = _ref1.target, this.targetModifier = _ref1.targetModifier; + if (this.target === 'viewport') { + this.target = document.body; + this.targetModifier = 'visible'; + } else if (this.target === 'scroll-handle') { + this.target = document.body; + this.targetModifier = 'scroll-handle'; + } + _ref2 = ['element', 'target']; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + key = _ref2[_i]; + if (this[key] == null) { + throw new Error("Tether Error: Both element and target must be defined"); + } + if (this[key].jquery != null) { + this[key] = this[key][0]; + } else if (typeof this[key] === 'string') { + this[key] = document.querySelector(this[key]); + } + } + addClass(this.element, this.getClass('element')); + addClass(this.target, this.getClass('target')); + if (!this.options.attachment) { + throw new Error("Tether Error: You must provide an attachment"); + } + this.targetAttachment = parseAttachment(this.options.targetAttachment); + this.attachment = parseAttachment(this.options.attachment); + this.offset = parseOffset(this.options.offset); + this.targetOffset = parseOffset(this.options.targetOffset); + if (this.scrollParent != null) { + this.disable(); + } + if (this.targetModifier === 'scroll-handle') { + this.scrollParent = this.target; + } else { + this.scrollParent = getScrollParent(this.target); + } + if (this.options.enabled !== false) { + return this.enable(position); + } + }; + + _Tether.prototype.getTargetBounds = function() { + var bounds, fitAdj, hasBottomScroll, height, out, scrollBottom, scrollPercentage, style, target; + if (this.targetModifier != null) { + switch (this.targetModifier) { + case 'visible': + if (this.target === document.body) { + return { + top: pageYOffset, + left: pageXOffset, + height: innerHeight, + width: innerWidth + }; + } else { + bounds = getBounds(this.target); + out = { + height: bounds.height, + width: bounds.width, + top: bounds.top, + left: bounds.left + }; + out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top)); + out.height = Math.min(out.height, bounds.height - ((bounds.top + bounds.height) - (pageYOffset + innerHeight))); + out.height = Math.min(innerHeight, out.height); + out.height -= 2; + out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left)); + out.width = Math.min(out.width, bounds.width - ((bounds.left + bounds.width) - (pageXOffset + innerWidth))); + out.width = Math.min(innerWidth, out.width); + out.width -= 2; + if (out.top < pageYOffset) { + out.top = pageYOffset; + } + if (out.left < pageXOffset) { + out.left = pageXOffset; + } + return out; + } + break; + case 'scroll-handle': + target = this.target; + if (target === document.body) { + target = document.documentElement; + bounds = { + left: pageXOffset, + top: pageYOffset, + height: innerHeight, + width: innerWidth + }; + } else { + bounds = getBounds(target); + } + style = getComputedStyle(target); + hasBottomScroll = target.scrollWidth > target.clientWidth || 'scroll' === [style.overflow, style.overflowX] || this.target !== document.body; + scrollBottom = 0; + if (hasBottomScroll) { + scrollBottom = 15; + } + height = bounds.height - parseFloat(style.borderTopWidth) - parseFloat(style.borderBottomWidth) - scrollBottom; + out = { + width: 15, + height: height * 0.975 * (height / target.scrollHeight), + left: bounds.left + bounds.width - parseFloat(style.borderLeftWidth) - 15 + }; + fitAdj = 0; + if (height < 408 && this.target === document.body) { + fitAdj = -0.00011 * Math.pow(height, 2) - 0.00727 * height + 22.58; + } + if (this.target !== document.body) { + out.height = Math.max(out.height, 24); + } + scrollPercentage = this.target.scrollTop / (target.scrollHeight - height); + out.top = scrollPercentage * (height - out.height - fitAdj) + bounds.top + parseFloat(style.borderTopWidth); + if (this.target === document.body) { + out.height = Math.max(out.height, 24); + } + return out; + } + } else { + return getBounds(this.target); + } + }; + + _Tether.prototype.clearCache = function() { + return this._cache = {}; + }; + + _Tether.prototype.cache = function(k, getter) { + if (this._cache == null) { + this._cache = {}; + } + if (this._cache[k] == null) { + this._cache[k] = getter.call(this); + } + return this._cache[k]; + }; + + _Tether.prototype.enable = function(position) { + if (position == null) { + position = true; + } + addClass(this.target, this.getClass('enabled')); + addClass(this.element, this.getClass('enabled')); + this.enabled = true; + if (this.scrollParent !== document) { + this.scrollParent.addEventListener('scroll', this.position); + } + if (position) { + return this.position(); + } + }; + + _Tether.prototype.disable = function() { + removeClass(this.target, this.getClass('enabled')); + removeClass(this.element, this.getClass('enabled')); + this.enabled = false; + if (this.scrollParent != null) { + return this.scrollParent.removeEventListener('scroll', this.position); + } + }; + + _Tether.prototype.destroy = function() { + var i, tether, _i, _len, _results; + this.disable(); + _results = []; + for (i = _i = 0, _len = tethers.length; _i < _len; i = ++_i) { + tether = tethers[i]; + if (tether === this) { + tethers.splice(i, 1); + break; + } else { + _results.push(void 0); + } + } + return _results; + }; + + _Tether.prototype.updateAttachClasses = function(elementAttach, targetAttach) { + var add, all, side, sides, _i, _j, _len, _len1, _ref1, + _this = this; + if (elementAttach == null) { + elementAttach = this.attachment; + } + if (targetAttach == null) { + targetAttach = this.targetAttachment; + } + sides = ['left', 'top', 'bottom', 'right', 'middle', 'center']; + if ((_ref1 = this._addAttachClasses) != null ? _ref1.length : void 0) { + this._addAttachClasses.splice(0, this._addAttachClasses.length); + } + add = this._addAttachClasses != null ? this._addAttachClasses : this._addAttachClasses = []; + if (elementAttach.top) { + add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.top); + } + if (elementAttach.left) { + add.push("" + (this.getClass('element-attached')) + "-" + elementAttach.left); + } + if (targetAttach.top) { + add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.top); + } + if (targetAttach.left) { + add.push("" + (this.getClass('target-attached')) + "-" + targetAttach.left); + } + all = []; + for (_i = 0, _len = sides.length; _i < _len; _i++) { + side = sides[_i]; + all.push("" + (this.getClass('element-attached')) + "-" + side); + } + for (_j = 0, _len1 = sides.length; _j < _len1; _j++) { + side = sides[_j]; + all.push("" + (this.getClass('target-attached')) + "-" + side); + } + return defer(function() { + if (_this._addAttachClasses == null) { + return; + } + updateClasses(_this.element, _this._addAttachClasses, all); + updateClasses(_this.target, _this._addAttachClasses, all); + return _this._addAttachClasses = void 0; + }); + }; + + _Tether.prototype.position = function(flushChanges) { + var elementPos, elementStyle, height, left, manualOffset, manualTargetOffset, module, next, offset, offsetBorder, offsetParent, offsetParentSize, offsetParentStyle, offsetPosition, ret, scrollLeft, scrollTop, scrollbarSize, side, targetAttachment, targetOffset, targetPos, targetSize, top, width, _i, _j, _len, _len1, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, + _this = this; + if (flushChanges == null) { + flushChanges = true; + } + if (!this.enabled) { + return; + } + this.clearCache(); + targetAttachment = autoToFixedAttachment(this.targetAttachment, this.attachment); + this.updateAttachClasses(this.attachment, targetAttachment); + elementPos = this.cache('element-bounds', function() { + return getBounds(_this.element); + }); + width = elementPos.width, height = elementPos.height; + if (width === 0 && height === 0 && (this.lastSize != null)) { + _ref1 = this.lastSize, width = _ref1.width, height = _ref1.height; + } else { + this.lastSize = { + width: width, + height: height + }; + } + targetSize = targetPos = this.cache('target-bounds', function() { + return _this.getTargetBounds(); + }); + offset = offsetToPx(attachmentToOffset(this.attachment), { + width: width, + height: height + }); + targetOffset = offsetToPx(attachmentToOffset(targetAttachment), targetSize); + manualOffset = offsetToPx(this.offset, { + width: width, + height: height + }); + manualTargetOffset = offsetToPx(this.targetOffset, targetSize); + offset = addOffset(offset, manualOffset); + targetOffset = addOffset(targetOffset, manualTargetOffset); + left = targetPos.left + targetOffset.left - offset.left; + top = targetPos.top + targetOffset.top - offset.top; + _ref2 = Tether.modules; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + module = _ref2[_i]; + ret = module.position.call(this, { + left: left, + top: top, + targetAttachment: targetAttachment, + targetPos: targetPos, + attachment: this.attachment, + elementPos: elementPos, + offset: offset, + targetOffset: targetOffset, + manualOffset: manualOffset, + manualTargetOffset: manualTargetOffset, + scrollbarSize: scrollbarSize + }); + if ((ret == null) || typeof ret !== 'object') { + continue; + } else if (ret === false) { + return false; + } else { + top = ret.top, left = ret.left; + } + } + next = { + page: { + top: top, + left: left + }, + viewport: { + top: top - pageYOffset, + bottom: pageYOffset - top - height + innerHeight, + left: left - pageXOffset, + right: pageXOffset - left - width + innerWidth + } + }; + if (document.body.scrollWidth > window.innerWidth) { + scrollbarSize = this.cache('scrollbar-size', getScrollBarSize); + next.viewport.bottom -= scrollbarSize.height; + } + if (document.body.scrollHeight > window.innerHeight) { + scrollbarSize = this.cache('scrollbar-size', getScrollBarSize); + next.viewport.right -= scrollbarSize.width; + } + if (((_ref3 = document.body.style.position) !== '' && _ref3 !== 'static') || ((_ref4 = document.body.parentElement.style.position) !== '' && _ref4 !== 'static')) { + next.page.bottom = document.body.scrollHeight - top - height; + next.page.right = document.body.scrollWidth - left - width; + } + if (((_ref5 = this.options.optimizations) != null ? _ref5.moveElement : void 0) !== false && (this.targetModifier == null)) { + offsetParent = this.cache('target-offsetparent', function() { + return getOffsetParent(_this.target); + }); + offsetPosition = this.cache('target-offsetparent-bounds', function() { + return getBounds(offsetParent); + }); + offsetParentStyle = getComputedStyle(offsetParent); + elementStyle = getComputedStyle(this.element); + offsetParentSize = offsetPosition; + offsetBorder = {}; + _ref6 = ['Top', 'Left', 'Bottom', 'Right']; + for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) { + side = _ref6[_j]; + offsetBorder[side.toLowerCase()] = parseFloat(offsetParentStyle["border" + side + "Width"]); + } + offsetPosition.right = document.body.scrollWidth - offsetPosition.left - offsetParentSize.width + offsetBorder.right; + offsetPosition.bottom = document.body.scrollHeight - offsetPosition.top - offsetParentSize.height + offsetBorder.bottom; + if (next.page.top >= (offsetPosition.top + offsetBorder.top) && next.page.bottom >= offsetPosition.bottom) { + if (next.page.left >= (offsetPosition.left + offsetBorder.left) && next.page.right >= offsetPosition.right) { + scrollTop = offsetParent.scrollTop; + scrollLeft = offsetParent.scrollLeft; + next.offset = { + top: next.page.top - offsetPosition.top + scrollTop - offsetBorder.top, + left: next.page.left - offsetPosition.left + scrollLeft - offsetBorder.left + }; + } + } + } + this.move(next); + this.history.unshift(next); + if (this.history.length > 3) { + this.history.pop(); + } + if (flushChanges) { + flush(); + } + return true; + }; + + _Tether.prototype.move = function(position) { + var css, elVal, found, key, moved, offsetParent, point, same, transcribe, type, val, write, writeCSS, _i, _len, _ref1, _ref2, + _this = this; + if (this.element.parentNode == null) { + return; + } + same = {}; + for (type in position) { + same[type] = {}; + for (key in position[type]) { + found = false; + _ref1 = this.history; + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + point = _ref1[_i]; + if (!within((_ref2 = point[type]) != null ? _ref2[key] : void 0, position[type][key])) { + found = true; + break; + } + } + if (!found) { + same[type][key] = true; + } + } + } + css = { + top: '', + left: '', + right: '', + bottom: '' + }; + transcribe = function(same, pos) { + var xPos, yPos, _ref3; + if (((_ref3 = _this.options.optimizations) != null ? _ref3.gpu : void 0) !== false) { + if (same.top) { + css.top = 0; + yPos = pos.top; + } else { + css.bottom = 0; + yPos = -pos.bottom; + } + if (same.left) { + css.left = 0; + xPos = pos.left; + } else { + css.right = 0; + xPos = -pos.right; + } + css[transformKey] = "translateX(" + (Math.round(xPos)) + "px) translateY(" + (Math.round(yPos)) + "px)"; + if (transformKey !== 'msTransform') { + return css[transformKey] += " translateZ(0)"; + } + } else { + if (same.top) { + css.top = "" + pos.top + "px"; + } else { + css.bottom = "" + pos.bottom + "px"; + } + if (same.left) { + return css.left = "" + pos.left + "px"; + } else { + return css.right = "" + pos.right + "px"; + } + } + }; + moved = false; + if ((same.page.top || same.page.bottom) && (same.page.left || same.page.right)) { + css.position = 'absolute'; + transcribe(same.page, position.page); + } else if ((same.viewport.top || same.viewport.bottom) && (same.viewport.left || same.viewport.right)) { + css.position = 'fixed'; + transcribe(same.viewport, position.viewport); + } else if ((same.offset != null) && same.offset.top && same.offset.left) { + css.position = 'absolute'; + offsetParent = this.cache('target-offsetparent', function() { + return getOffsetParent(_this.target); + }); + if (getOffsetParent(this.element) !== offsetParent) { + defer(function() { + _this.element.parentNode.removeChild(_this.element); + return offsetParent.appendChild(_this.element); + }); + } + transcribe(same.offset, position.offset); + moved = true; + } else { + css.position = 'absolute'; + transcribe({ + top: true, + left: true + }, position.page); + } + if (!moved && this.element.parentNode.tagName !== 'BODY') { + this.element.parentNode.removeChild(this.element); + document.body.appendChild(this.element); + } + writeCSS = {}; + write = false; + for (key in css) { + val = css[key]; + elVal = this.element.style[key]; + if (elVal !== '' && val !== '' && (key === 'top' || key === 'left' || key === 'bottom' || key === 'right')) { + elVal = parseFloat(elVal); + val = parseFloat(val); + } + if (elVal !== val) { + write = true; + writeCSS[key] = css[key]; + } + } + if (write) { + return defer(function() { + return extend(_this.element.style, writeCSS); + }); + } + }; + + return _Tether; + + })(); + + Tether.position = position; + + this.Tether = extend(_Tether, Tether); + +}).call(this); + +(function() { + var BOUNDS_FORMAT, MIRROR_ATTACH, defer, extend, getBoundingRect, getBounds, getOuterSize, getSize, updateClasses, _ref, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + + _ref = this.Tether.Utils, getOuterSize = _ref.getOuterSize, getBounds = _ref.getBounds, getSize = _ref.getSize, extend = _ref.extend, updateClasses = _ref.updateClasses, defer = _ref.defer; + + MIRROR_ATTACH = { + left: 'right', + right: 'left', + top: 'bottom', + bottom: 'top', + middle: 'middle' + }; + + BOUNDS_FORMAT = ['left', 'top', 'right', 'bottom']; + + getBoundingRect = function(tether, to) { + var i, pos, side, size, style, _i, _len; + if (to === 'scrollParent') { + to = tether.scrollParent; + } else if (to === 'window') { + to = [pageXOffset, pageYOffset, innerWidth + pageXOffset, innerHeight + pageYOffset]; + } + if (to === document) { + to = to.documentElement; + } + if (to.nodeType != null) { + pos = size = getBounds(to); + style = getComputedStyle(to); + to = [pos.left, pos.top, size.width + pos.left, size.height + pos.top]; + for (i = _i = 0, _len = BOUNDS_FORMAT.length; _i < _len; i = ++_i) { + side = BOUNDS_FORMAT[i]; + side = side[0].toUpperCase() + side.substr(1); + if (side === 'Top' || side === 'Left') { + to[i] += parseFloat(style["border" + side + "Width"]); + } else { + to[i] -= parseFloat(style["border" + side + "Width"]); + } + } + } + return to; + }; + + this.Tether.modules.push({ + position: function(_arg) { + var addClasses, allClasses, attachment, bounds, changeAttachX, changeAttachY, cls, constraint, eAttachment, height, left, oob, oobClass, p, pin, pinned, pinnedClass, removeClass, side, tAttachment, targetAttachment, targetHeight, targetSize, targetWidth, to, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _len5, _m, _n, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, + _this = this; + top = _arg.top, left = _arg.left, targetAttachment = _arg.targetAttachment; + if (!this.options.constraints) { + return true; + } + removeClass = function(prefix) { + var side, _i, _len, _results; + _this.removeClass(prefix); + _results = []; + for (_i = 0, _len = BOUNDS_FORMAT.length; _i < _len; _i++) { + side = BOUNDS_FORMAT[_i]; + _results.push(_this.removeClass("" + prefix + "-" + side)); + } + return _results; + }; + _ref1 = this.cache('element-bounds', function() { + return getBounds(_this.element); + }), height = _ref1.height, width = _ref1.width; + if (width === 0 && height === 0 && (this.lastSize != null)) { + _ref2 = this.lastSize, width = _ref2.width, height = _ref2.height; + } + targetSize = this.cache('target-bounds', function() { + return _this.getTargetBounds(); + }); + targetHeight = targetSize.height; + targetWidth = targetSize.width; + tAttachment = {}; + eAttachment = {}; + allClasses = [this.getClass('pinned'), this.getClass('out-of-bounds')]; + _ref3 = this.options.constraints; + for (_i = 0, _len = _ref3.length; _i < _len; _i++) { + constraint = _ref3[_i]; + if (constraint.outOfBoundsClass) { + allClasses.push(constraint.outOfBoundsClass); + } + if (constraint.pinnedClass) { + allClasses.push(constraint.pinnedClass); + } + } + for (_j = 0, _len1 = allClasses.length; _j < _len1; _j++) { + cls = allClasses[_j]; + _ref4 = ['left', 'top', 'right', 'bottom']; + for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) { + side = _ref4[_k]; + allClasses.push("" + cls + "-" + side); + } + } + addClasses = []; + tAttachment = extend({}, targetAttachment); + eAttachment = extend({}, this.attachment); + _ref5 = this.options.constraints; + for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) { + constraint = _ref5[_l]; + to = constraint.to, attachment = constraint.attachment, pin = constraint.pin; + if (attachment == null) { + attachment = ''; + } + if (__indexOf.call(attachment, ' ') >= 0) { + _ref6 = attachment.split(' '), changeAttachY = _ref6[0], changeAttachX = _ref6[1]; + } else { + changeAttachX = changeAttachY = attachment; + } + bounds = getBoundingRect(this, to); + if (changeAttachY === 'target' || changeAttachY === 'both') { + if (top < bounds[1] && tAttachment.top === 'top') { + top += targetHeight; + tAttachment.top = 'bottom'; + } + if (top + height > bounds[3] && tAttachment.top === 'bottom') { + top -= targetHeight; + tAttachment.top = 'top'; + } + } + if (changeAttachY === 'together') { + if (top < bounds[1] && tAttachment.top === 'top') { + if (eAttachment.top === 'bottom') { + top += targetHeight; + tAttachment.top = 'bottom'; + top += height; + eAttachment.top = 'top'; + } else if (eAttachment.top === 'top') { + top += targetHeight; + tAttachment.top = 'bottom'; + top -= height; + eAttachment.top = 'bottom'; + } + } + if (top + height > bounds[3] && tAttachment.top === 'bottom') { + if (eAttachment.top === 'top') { + top -= targetHeight; + tAttachment.top = 'top'; + top -= height; + eAttachment.top = 'bottom'; + } else if (eAttachment.top === 'bottom') { + top -= targetHeight; + tAttachment.top = 'top'; + top += height; + eAttachment.top = 'top'; + } + } + if (tAttachment.top === 'middle') { + if (top + height > bounds[3] && eAttachment.top === 'top') { + top -= height; + eAttachment.top = 'bottom'; + } else if (top < bounds[1] && eAttachment.top === 'bottom') { + top += height; + eAttachment.top = 'top'; + } + } + } + if (changeAttachX === 'target' || changeAttachX === 'both') { + if (left < bounds[0] && tAttachment.left === 'left') { + left += targetWidth; + tAttachment.left = 'right'; + } + if (left + width > bounds[2] && tAttachment.left === 'right') { + left -= targetWidth; + tAttachment.left = 'left'; + } + } + if (changeAttachX === 'together') { + if (left < bounds[0] && tAttachment.left === 'left') { + if (eAttachment.left === 'right') { + left += targetWidth; + tAttachment.left = 'right'; + left += width; + eAttachment.left = 'left'; + } else if (eAttachment.left === 'left') { + left += targetWidth; + tAttachment.left = 'right'; + left -= width; + eAttachment.left = 'right'; + } + } else if (left + width > bounds[2] && tAttachment.left === 'right') { + if (eAttachment.left === 'left') { + left -= targetWidth; + tAttachment.left = 'left'; + left -= width; + eAttachment.left = 'right'; + } else if (eAttachment.left === 'right') { + left -= targetWidth; + tAttachment.left = 'left'; + left += width; + eAttachment.left = 'left'; + } + } else if (tAttachment.left === 'center') { + if (left + width > bounds[2] && eAttachment.left === 'left') { + left -= width; + eAttachment.left = 'right'; + } else if (left < bounds[0] && eAttachment.left === 'right') { + left += width; + eAttachment.left = 'left'; + } + } + } + if (changeAttachY === 'element' || changeAttachY === 'both') { + if (top < bounds[1] && eAttachment.top === 'bottom') { + top += height; + eAttachment.top = 'top'; + } + if (top + height > bounds[3] && eAttachment.top === 'top') { + top -= height; + eAttachment.top = 'bottom'; + } + } + if (changeAttachX === 'element' || changeAttachX === 'both') { + if (left < bounds[0] && eAttachment.left === 'right') { + left += width; + eAttachment.left = 'left'; + } + if (left + width > bounds[2] && eAttachment.left === 'left') { + left -= width; + eAttachment.left = 'right'; + } + } + if (typeof pin === 'string') { + pin = (function() { + var _len4, _m, _ref7, _results; + _ref7 = pin.split(','); + _results = []; + for (_m = 0, _len4 = _ref7.length; _m < _len4; _m++) { + p = _ref7[_m]; + _results.push(p.trim()); + } + return _results; + })(); + } else if (pin === true) { + pin = ['top', 'left', 'right', 'bottom']; + } + pin || (pin = []); + pinned = []; + oob = []; + if (top < bounds[1]) { + if (__indexOf.call(pin, 'top') >= 0) { + top = bounds[1]; + pinned.push('top'); + } else { + oob.push('top'); + } + } + if (top + height > bounds[3]) { + if (__indexOf.call(pin, 'bottom') >= 0) { + top = bounds[3] - height; + pinned.push('bottom'); + } else { + oob.push('bottom'); + } + } + if (left < bounds[0]) { + if (__indexOf.call(pin, 'left') >= 0) { + left = bounds[0]; + pinned.push('left'); + } else { + oob.push('left'); + } + } + if (left + width > bounds[2]) { + if (__indexOf.call(pin, 'right') >= 0) { + left = bounds[2] - width; + pinned.push('right'); + } else { + oob.push('right'); + } + } + if (pinned.length) { + pinnedClass = (_ref7 = this.options.pinnedClass) != null ? _ref7 : this.getClass('pinned'); + addClasses.push(pinnedClass); + for (_m = 0, _len4 = pinned.length; _m < _len4; _m++) { + side = pinned[_m]; + addClasses.push("" + pinnedClass + "-" + side); + } + } + if (oob.length) { + oobClass = (_ref8 = this.options.outOfBoundsClass) != null ? _ref8 : this.getClass('out-of-bounds'); + addClasses.push(oobClass); + for (_n = 0, _len5 = oob.length; _n < _len5; _n++) { + side = oob[_n]; + addClasses.push("" + oobClass + "-" + side); + } + } + if (__indexOf.call(pinned, 'left') >= 0 || __indexOf.call(pinned, 'right') >= 0) { + eAttachment.left = tAttachment.left = false; + } + if (__indexOf.call(pinned, 'top') >= 0 || __indexOf.call(pinned, 'bottom') >= 0) { + eAttachment.top = tAttachment.top = false; + } + if (tAttachment.top !== targetAttachment.top || tAttachment.left !== targetAttachment.left || eAttachment.top !== this.attachment.top || eAttachment.left !== this.attachment.left) { + this.updateAttachClasses(eAttachment, tAttachment); + } + } + defer(function() { + updateClasses(_this.target, addClasses, allClasses); + return updateClasses(_this.element, addClasses, allClasses); + }); + return { + top: top, + left: left + }; + } + }); + +}).call(this); + +(function() { + var defer, getBounds, updateClasses, _ref; + + _ref = this.Tether.Utils, getBounds = _ref.getBounds, updateClasses = _ref.updateClasses, defer = _ref.defer; + + this.Tether.modules.push({ + position: function(_arg) { + var abutted, addClasses, allClasses, bottom, height, left, right, side, sides, targetPos, top, width, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5, + _this = this; + top = _arg.top, left = _arg.left; + _ref1 = this.cache('element-bounds', function() { + return getBounds(_this.element); + }), height = _ref1.height, width = _ref1.width; + targetPos = this.getTargetBounds(); + bottom = top + height; + right = left + width; + abutted = []; + if (top <= targetPos.bottom && bottom >= targetPos.top) { + _ref2 = ['left', 'right']; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + side = _ref2[_i]; + if ((_ref3 = targetPos[side]) === left || _ref3 === right) { + abutted.push(side); + } + } + } + if (left <= targetPos.right && right >= targetPos.left) { + _ref4 = ['top', 'bottom']; + for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) { + side = _ref4[_j]; + if ((_ref5 = targetPos[side]) === top || _ref5 === bottom) { + abutted.push(side); + } + } + } + allClasses = []; + addClasses = []; + sides = ['left', 'top', 'right', 'bottom']; + allClasses.push(this.getClass('abutted')); + for (_k = 0, _len2 = sides.length; _k < _len2; _k++) { + side = sides[_k]; + allClasses.push("" + (this.getClass('abutted')) + "-" + side); + } + if (abutted.length) { + addClasses.push(this.getClass('abutted')); + } + for (_l = 0, _len3 = abutted.length; _l < _len3; _l++) { + side = abutted[_l]; + addClasses.push("" + (this.getClass('abutted')) + "-" + side); + } + defer(function() { + updateClasses(_this.target, addClasses, allClasses); + return updateClasses(_this.element, addClasses, allClasses); + }); + return true; + } + }); + +}).call(this); + +(function() { + this.Tether.modules.push({ + position: function(_arg) { + var left, result, shift, shiftLeft, shiftTop, top, _ref; + top = _arg.top, left = _arg.left; + if (!this.options.shift) { + return; + } + result = function(val) { + if (typeof val === 'function') { + return val.call(this, { + top: top, + left: left + }); + } else { + return val; + } + }; + shift = result(this.options.shift); + if (typeof shift === 'string') { + shift = shift.split(' '); + shift[1] || (shift[1] = shift[0]); + shiftTop = shift[0], shiftLeft = shift[1]; + shiftTop = parseFloat(shiftTop, 10); + shiftLeft = parseFloat(shiftLeft, 10); + } else { + _ref = [shift.top, shift.left], shiftTop = _ref[0], shiftLeft = _ref[1]; + } + top += shiftTop; + left += shiftLeft; + return { + top: top, + left: left + }; + } + }); + +}).call(this); + +return this.Tether; + +})); diff --git a/afb-client/bower_components/tether/tether.min.js b/afb-client/bower_components/tether/tether.min.js new file mode 100644 index 0000000..065085e --- /dev/null +++ b/afb-client/bower_components/tether/tether.min.js @@ -0,0 +1,2 @@ +/*! tether 0.6.5 */ +!function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e(require,exports,module):t.Tether=e()}(this,function(){return function(){var t,e,o,i,n,s,l,r,h,a,f,p,u,d,g,c,m,b={}.hasOwnProperty,v=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1},y=[].slice;null==this.Tether&&(this.Tether={modules:[]}),f=function(t){var e,o,i,n,s;if(o=getComputedStyle(t).position,"fixed"===o)return t;for(i=void 0,e=t;e=e.parentNode;){try{n=getComputedStyle(e)}catch(l){}if(null==n)return e;if(/(auto|scroll)/.test(n.overflow+n["overflow-y"]+n["overflow-x"])&&("absolute"!==o||"relative"===(s=n.position)||"absolute"===s||"fixed"===s))return e}return document.body},g=function(){var t;return t=0,function(){return t++}}(),m={},h=function(t){var e,i,s,l,r;if(s=t._tetherZeroElement,null==s&&(s=t.createElement("div"),s.setAttribute("data-tether-id",g()),n(s.style,{top:0,left:0,position:"absolute"}),t.body.appendChild(s),t._tetherZeroElement=s),e=s.getAttribute("data-tether-id"),null==m[e]){m[e]={},r=s.getBoundingClientRect();for(i in r)l=r[i],m[e][i]=l;o(function(){return m[e]=void 0})}return m[e]},u=null,l=function(t){var e,o,i,n,s,l,r;t===document?(o=document,t=document.documentElement):o=t.ownerDocument,i=o.documentElement,e={},r=t.getBoundingClientRect();for(n in r)l=r[n],e[n]=l;return s=h(o),e.top-=s.top,e.left-=s.left,null==e.width&&(e.width=document.body.scrollWidth-e.left-e.right),null==e.height&&(e.height=document.body.scrollHeight-e.top-e.bottom),e.top=e.top-i.clientTop,e.left=e.left-i.clientLeft,e.right=o.body.clientWidth-e.width-e.left,e.bottom=o.body.clientHeight-e.height-e.top,e},r=function(t){return t.offsetParent||document.documentElement},a=function(){var t,e,o,i,s;return t=document.createElement("div"),t.style.width="100%",t.style.height="200px",e=document.createElement("div"),n(e.style,{position:"absolute",top:0,left:0,pointerEvents:"none",visibility:"hidden",width:"200px",height:"150px",overflow:"hidden"}),e.appendChild(t),document.body.appendChild(e),i=t.offsetWidth,e.style.overflow="scroll",s=t.offsetWidth,i===s&&(s=e.clientWidth),document.body.removeChild(e),o=i-s,{width:o,height:o}},n=function(t){var e,o,i,n,s,l,r;for(null==t&&(t={}),e=[],Array.prototype.push.apply(e,arguments),r=e.slice(1),s=0,l=r.length;l>s;s++)if(i=r[s])for(o in i)b.call(i,o)&&(n=i[o],t[o]=n);return t},d=function(t,e){var o,i,n,s,l;if(null!=t.classList){for(s=e.split(" "),l=[],i=0,n=s.length;n>i;i++)o=s[i],o.trim()&&l.push(t.classList.remove(o));return l}return t.className=t.className.replace(new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi")," ")},e=function(t,e){var o,i,n,s,l;if(null!=t.classList){for(s=e.split(" "),l=[],i=0,n=s.length;n>i;i++)o=s[i],o.trim()&&l.push(t.classList.add(o));return l}return d(t,e),t.className+=" "+e},p=function(t,e){return null!=t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},c=function(t,o,i){var n,s,l,r,h,a;for(s=0,r=i.length;r>s;s++)n=i[s],v.call(o,n)<0&&p(t,n)&&d(t,n);for(a=[],l=0,h=o.length;h>l;l++)n=o[l],a.push(p(t,n)?void 0:e(t,n));return a},i=[],o=function(t){return i.push(t)},s=function(){var t,e;for(e=[];t=i.pop();)e.push(t());return e},t=function(){function t(){}return t.prototype.on=function(t,e,o,i){var n;return null==i&&(i=!1),null==this.bindings&&(this.bindings={}),null==(n=this.bindings)[t]&&(n[t]=[]),this.bindings[t].push({handler:e,ctx:o,once:i})},t.prototype.once=function(t,e,o){return this.on(t,e,o,!0)},t.prototype.off=function(t,e){var o,i,n;if(null!=(null!=(i=this.bindings)?i[t]:void 0)){if(null==e)return delete this.bindings[t];for(o=0,n=[];o<this.bindings[t].length;)n.push(this.bindings[t][o].handler===e?this.bindings[t].splice(o,1):o++);return n}},t.prototype.trigger=function(){var t,e,o,i,n,s,l,r,h;if(o=arguments[0],t=2<=arguments.length?y.call(arguments,1):[],null!=(l=this.bindings)?l[o]:void 0){for(n=0,h=[];n<this.bindings[o].length;)r=this.bindings[o][n],i=r.handler,e=r.ctx,s=r.once,i.apply(null!=e?e:this,t),h.push(s?this.bindings[o].splice(n,1):n++);return h}},t}(),this.Tether.Utils={getScrollParent:f,getBounds:l,getOffsetParent:r,extend:n,addClass:e,removeClass:d,hasClass:p,updateClasses:c,defer:o,flush:s,uniqueId:g,Evented:t,getScrollBarSize:a}}.call(this),function(){var t,e,o,i,n,s,l,r,h,a,f,p,u,d,g,c,m,b,v,y,w,C,O,T,x,E,W,A,S,M=[].slice,z=function(t,e){return function(){return t.apply(e,arguments)}};if(null==this.Tether)throw new Error("You must include the utils.js file before tether.js");i=this.Tether,S=i.Utils,c=S.getScrollParent,m=S.getSize,d=S.getOuterSize,p=S.getBounds,u=S.getOffsetParent,a=S.extend,n=S.addClass,O=S.removeClass,E=S.updateClasses,h=S.defer,f=S.flush,g=S.getScrollBarSize,W=function(t,e,o){return null==o&&(o=1),t+o>=e&&e>=t-o},x=function(){var t,e,o,i,n;for(t=document.createElement("div"),n=["transform","webkitTransform","OTransform","MozTransform","msTransform"],o=0,i=n.length;i>o;o++)if(e=n[o],void 0!==t.style[e])return e}(),T=[],C=function(){var t,e,o;for(e=0,o=T.length;o>e;e++)t=T[e],t.position(!1);return f()},b=function(){var t;return null!=(t="undefined"!=typeof performance&&null!==performance?"function"==typeof performance.now?performance.now():void 0:void 0)?t:+new Date},function(){var t,e,o,i,n,s,l,r,h;for(e=null,o=null,i=null,n=function(){if(null!=o&&o>16)return o=Math.min(o-16,250),void(i=setTimeout(n,250));if(!(null!=e&&b()-e<10))return null!=i&&(clearTimeout(i),i=null),e=b(),C(),o=b()-e},r=["resize","scroll","touchmove"],h=[],s=0,l=r.length;l>s;s++)t=r[s],h.push(window.addEventListener(t,n));return h}(),t={center:"center",left:"right",right:"left"},e={middle:"middle",top:"bottom",bottom:"top"},o={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},r=function(o,i){var n,s;return n=o.left,s=o.top,"auto"===n&&(n=t[i.left]),"auto"===s&&(s=e[i.top]),{left:n,top:s}},l=function(t){var e,i;return{left:null!=(e=o[t.left])?e:t.left,top:null!=(i=o[t.top])?i:t.top}},s=function(){var t,e,o,i,n,s,l;for(e=1<=arguments.length?M.call(arguments,0):[],o={top:0,left:0},n=0,s=e.length;s>n;n++)l=e[n],i=l.top,t=l.left,"string"==typeof i&&(i=parseFloat(i,10)),"string"==typeof t&&(t=parseFloat(t,10)),o.top+=i,o.left+=t;return o},v=function(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t},y=w=function(t){var e,o,i;return i=t.split(" "),o=i[0],e=i[1],{top:o,left:e}},A=function(){function t(t){this.position=z(this.position,this);var e,o,n,s,l;for(T.push(this),this.history=[],this.setOptions(t,!1),s=i.modules,o=0,n=s.length;n>o;o++)e=s[o],null!=(l=e.initialize)&&l.call(this);this.position()}return t.modules=[],t.prototype.getClass=function(t){var e,o;return(null!=(e=this.options.classes)?e[t]:void 0)?this.options.classes[t]:(null!=(o=this.options.classes)?o[t]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+t:t:""},t.prototype.setOptions=function(t,e){var o,i,s,l,r,h;for(this.options=t,null==e&&(e=!0),o={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=a(o,this.options),r=this.options,this.element=r.element,this.target=r.target,this.targetModifier=r.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),h=["element","target"],s=0,l=h.length;l>s;s++){if(i=h[s],null==this[i])throw new Error("Tether Error: Both element and target must be defined");null!=this[i].jquery?this[i]=this[i][0]:"string"==typeof this[i]&&(this[i]=document.querySelector(this[i]))}if(n(this.element,this.getClass("element")),n(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=y(this.options.targetAttachment),this.attachment=y(this.options.attachment),this.offset=w(this.options.offset),this.targetOffset=w(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent="scroll-handle"===this.targetModifier?this.target:c(this.target),this.options.enabled!==!1?this.enable(e):void 0},t.prototype.getTargetBounds=function(){var t,e,o,i,n,s,l,r,h;if(null==this.targetModifier)return p(this.target);switch(this.targetModifier){case"visible":return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:(t=p(this.target),n={height:t.height,width:t.width,top:t.top,left:t.left},n.height=Math.min(n.height,t.height-(pageYOffset-t.top)),n.height=Math.min(n.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),n.height=Math.min(innerHeight,n.height),n.height-=2,n.width=Math.min(n.width,t.width-(pageXOffset-t.left)),n.width=Math.min(n.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),n.width=Math.min(innerWidth,n.width),n.width-=2,n.top<pageYOffset&&(n.top=pageYOffset),n.left<pageXOffset&&(n.left=pageXOffset),n);case"scroll-handle":return h=this.target,h===document.body?(h=document.documentElement,t={left:pageXOffset,top:pageYOffset,height:innerHeight,width:innerWidth}):t=p(h),r=getComputedStyle(h),o=h.scrollWidth>h.clientWidth||"scroll"===[r.overflow,r.overflowX]||this.target!==document.body,s=0,o&&(s=15),i=t.height-parseFloat(r.borderTopWidth)-parseFloat(r.borderBottomWidth)-s,n={width:15,height:.975*i*(i/h.scrollHeight),left:t.left+t.width-parseFloat(r.borderLeftWidth)-15},e=0,408>i&&this.target===document.body&&(e=-11e-5*Math.pow(i,2)-.00727*i+22.58),this.target!==document.body&&(n.height=Math.max(n.height,24)),l=this.target.scrollTop/(h.scrollHeight-i),n.top=l*(i-n.height-e)+t.top+parseFloat(r.borderTopWidth),this.target===document.body&&(n.height=Math.max(n.height,24)),n}},t.prototype.clearCache=function(){return this._cache={}},t.prototype.cache=function(t,e){return null==this._cache&&(this._cache={}),null==this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]},t.prototype.enable=function(t){return null==t&&(t=!0),n(this.target,this.getClass("enabled")),n(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParent!==document&&this.scrollParent.addEventListener("scroll",this.position),t?this.position():void 0},t.prototype.disable=function(){return O(this.target,this.getClass("enabled")),O(this.element,this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},t.prototype.destroy=function(){var t,e,o,i,n;for(this.disable(),n=[],t=o=0,i=T.length;i>o;t=++o){if(e=T[t],e===this){T.splice(t,1);break}n.push(void 0)}return n},t.prototype.updateAttachClasses=function(t,e){var o,i,n,s,l,r,a,f,p,u=this;for(null==t&&(t=this.attachment),null==e&&(e=this.targetAttachment),s=["left","top","bottom","right","middle","center"],(null!=(p=this._addAttachClasses)?p.length:void 0)&&this._addAttachClasses.splice(0,this._addAttachClasses.length),o=null!=this._addAttachClasses?this._addAttachClasses:this._addAttachClasses=[],t.top&&o.push(""+this.getClass("element-attached")+"-"+t.top),t.left&&o.push(""+this.getClass("element-attached")+"-"+t.left),e.top&&o.push(""+this.getClass("target-attached")+"-"+e.top),e.left&&o.push(""+this.getClass("target-attached")+"-"+e.left),i=[],l=0,a=s.length;a>l;l++)n=s[l],i.push(""+this.getClass("element-attached")+"-"+n);for(r=0,f=s.length;f>r;r++)n=s[r],i.push(""+this.getClass("target-attached")+"-"+n);return h(function(){return null!=u._addAttachClasses?(E(u.element,u._addAttachClasses,i),E(u.target,u._addAttachClasses,i),u._addAttachClasses=void 0):void 0})},t.prototype.position=function(t){var e,o,n,h,a,d,c,m,b,y,w,C,O,T,x,E,W,A,S,M,z,B,P,_,F,L,H,Y,X,N,j,R,U,q,k,D=this;if(null==t&&(t=!0),this.enabled){for(this.clearCache(),M=r(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,M),e=this.cache("element-bounds",function(){return p(D.element)}),F=e.width,n=e.height,0===F&&0===n&&null!=this.lastSize?(N=this.lastSize,F=N.width,n=N.height):this.lastSize={width:F,height:n},P=B=this.cache("target-bounds",function(){return D.getTargetBounds()}),b=v(l(this.attachment),{width:F,height:n}),z=v(l(M),P),a=v(this.offset,{width:F,height:n}),d=v(this.targetOffset,P),b=s(b,a),z=s(z,d),h=B.left+z.left-b.left,_=B.top+z.top-b.top,j=i.modules,L=0,Y=j.length;Y>L;L++)if(c=j[L],x=c.position.call(this,{left:h,top:_,targetAttachment:M,targetPos:B,attachment:this.attachment,elementPos:e,offset:b,targetOffset:z,manualOffset:a,manualTargetOffset:d,scrollbarSize:A}),null!=x&&"object"==typeof x){if(x===!1)return!1;_=x.top,h=x.left}if(m={page:{top:_,left:h},viewport:{top:_-pageYOffset,bottom:pageYOffset-_-n+innerHeight,left:h-pageXOffset,right:pageXOffset-h-F+innerWidth}},document.body.scrollWidth>window.innerWidth&&(A=this.cache("scrollbar-size",g),m.viewport.bottom-=A.height),document.body.scrollHeight>window.innerHeight&&(A=this.cache("scrollbar-size",g),m.viewport.right-=A.width),(""!==(R=document.body.style.position)&&"static"!==R||""!==(U=document.body.parentElement.style.position)&&"static"!==U)&&(m.page.bottom=document.body.scrollHeight-_-n,m.page.right=document.body.scrollWidth-h-F),(null!=(q=this.options.optimizations)?q.moveElement:void 0)!==!1&&null==this.targetModifier){for(w=this.cache("target-offsetparent",function(){return u(D.target)}),T=this.cache("target-offsetparent-bounds",function(){return p(w)}),O=getComputedStyle(w),o=getComputedStyle(this.element),C=T,y={},k=["Top","Left","Bottom","Right"],H=0,X=k.length;X>H;H++)S=k[H],y[S.toLowerCase()]=parseFloat(O["border"+S+"Width"]);T.right=document.body.scrollWidth-T.left-C.width+y.right,T.bottom=document.body.scrollHeight-T.top-C.height+y.bottom,m.page.top>=T.top+y.top&&m.page.bottom>=T.bottom&&m.page.left>=T.left+y.left&&m.page.right>=T.right&&(W=w.scrollTop,E=w.scrollLeft,m.offset={top:m.page.top-T.top+W-y.top,left:m.page.left-T.left+E-y.left})}return this.move(m),this.history.unshift(m),this.history.length>3&&this.history.pop(),t&&f(),!0}},t.prototype.move=function(t){var e,o,i,n,s,l,r,f,p,d,g,c,m,b,v,y,w,C=this;if(null!=this.element.parentNode){f={};for(d in t){f[d]={};for(n in t[d]){for(i=!1,y=this.history,b=0,v=y.length;v>b;b++)if(r=y[b],!W(null!=(w=r[d])?w[n]:void 0,t[d][n])){i=!0;break}i||(f[d][n]=!0)}}e={top:"",left:"",right:"",bottom:""},p=function(t,o){var i,n,s;return(null!=(s=C.options.optimizations)?s.gpu:void 0)===!1?(t.top?e.top=""+o.top+"px":e.bottom=""+o.bottom+"px",t.left?e.left=""+o.left+"px":e.right=""+o.right+"px"):(t.top?(e.top=0,n=o.top):(e.bottom=0,n=-o.bottom),t.left?(e.left=0,i=o.left):(e.right=0,i=-o.right),e[x]="translateX("+Math.round(i)+"px) translateY("+Math.round(n)+"px)","msTransform"!==x?e[x]+=" translateZ(0)":void 0)},s=!1,(f.page.top||f.page.bottom)&&(f.page.left||f.page.right)?(e.position="absolute",p(f.page,t.page)):(f.viewport.top||f.viewport.bottom)&&(f.viewport.left||f.viewport.right)?(e.position="fixed",p(f.viewport,t.viewport)):null!=f.offset&&f.offset.top&&f.offset.left?(e.position="absolute",l=this.cache("target-offsetparent",function(){return u(C.target)}),u(this.element)!==l&&h(function(){return C.element.parentNode.removeChild(C.element),l.appendChild(C.element)}),p(f.offset,t.offset),s=!0):(e.position="absolute",p({top:!0,left:!0},t.page)),s||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),m={},c=!1;for(n in e)g=e[n],o=this.element.style[n],""===o||""===g||"top"!==n&&"left"!==n&&"bottom"!==n&&"right"!==n||(o=parseFloat(o),g=parseFloat(g)),o!==g&&(c=!0,m[n]=e[n]);return c?h(function(){return a(C.element.style,m)}):void 0}},t}(),i.position=C,this.Tether=a(A,i)}.call(this),function(){var t,e,o,i,n,s,l,r,h,a,f=[].indexOf||function(t){for(var e=0,o=this.length;o>e;e++)if(e in this&&this[e]===t)return e;return-1};a=this.Tether.Utils,l=a.getOuterSize,s=a.getBounds,r=a.getSize,i=a.extend,h=a.updateClasses,o=a.defer,e={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},t=["left","top","right","bottom"],n=function(e,o){var i,n,l,r,h,a,f;if("scrollParent"===o?o=e.scrollParent:"window"===o&&(o=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),o===document&&(o=o.documentElement),null!=o.nodeType)for(n=r=s(o),h=getComputedStyle(o),o=[n.left,n.top,r.width+n.left,r.height+n.top],i=a=0,f=t.length;f>a;i=++a)l=t[i],l=l[0].toUpperCase()+l.substr(1),"Top"===l||"Left"===l?o[i]+=parseFloat(h["border"+l+"Width"]):o[i]-=parseFloat(h["border"+l+"Width"]);return o},this.Tether.modules.push({position:function(e){var l,r,a,p,u,d,g,c,m,b,v,y,w,C,O,T,x,E,W,A,S,M,z,B,P,_,F,L,H,Y,X,N,j,R,U,q,k,D,Z,$,I,G,J,K,Q,V,te,ee=this;if(_=e.top,v=e.left,S=e.targetAttachment,!this.options.constraints)return!0;for(E=function(e){var o,i,n,s;for(ee.removeClass(e),s=[],i=0,n=t.length;n>i;i++)o=t[i],s.push(ee.removeClass(""+e+"-"+o));return s},$=this.cache("element-bounds",function(){return s(ee.element)}),b=$.height,F=$.width,0===F&&0===b&&null!=this.lastSize&&(I=this.lastSize,F=I.width,b=I.height),z=this.cache("target-bounds",function(){return ee.getTargetBounds()}),M=z.height,B=z.width,A={},m={},r=[this.getClass("pinned"),this.getClass("out-of-bounds")],G=this.options.constraints,L=0,N=G.length;N>L;L++)c=G[L],c.outOfBoundsClass&&r.push(c.outOfBoundsClass),c.pinnedClass&&r.push(c.pinnedClass);for(H=0,j=r.length;j>H;H++)for(g=r[H],J=["left","top","right","bottom"],Y=0,R=J.length;R>Y;Y++)W=J[Y],r.push(""+g+"-"+W);for(l=[],A=i({},S),m=i({},this.attachment),K=this.options.constraints,X=0,U=K.length;U>X;X++){if(c=K[X],P=c.to,a=c.attachment,O=c.pin,null==a&&(a=""),f.call(a," ")>=0?(Q=a.split(" "),d=Q[0],u=Q[1]):u=d=a,p=n(this,P),("target"===d||"both"===d)&&(_<p[1]&&"top"===A.top&&(_+=M,A.top="bottom"),_+b>p[3]&&"bottom"===A.top&&(_-=M,A.top="top")),"together"===d&&(_<p[1]&&"top"===A.top&&("bottom"===m.top?(_+=M,A.top="bottom",_+=b,m.top="top"):"top"===m.top&&(_+=M,A.top="bottom",_-=b,m.top="bottom")),_+b>p[3]&&"bottom"===A.top&&("top"===m.top?(_-=M,A.top="top",_-=b,m.top="bottom"):"bottom"===m.top&&(_-=M,A.top="top",_+=b,m.top="top")),"middle"===A.top&&(_+b>p[3]&&"top"===m.top?(_-=b,m.top="bottom"):_<p[1]&&"bottom"===m.top&&(_+=b,m.top="top"))),("target"===u||"both"===u)&&(v<p[0]&&"left"===A.left&&(v+=B,A.left="right"),v+F>p[2]&&"right"===A.left&&(v-=B,A.left="left")),"together"===u&&(v<p[0]&&"left"===A.left?"right"===m.left?(v+=B,A.left="right",v+=F,m.left="left"):"left"===m.left&&(v+=B,A.left="right",v-=F,m.left="right"):v+F>p[2]&&"right"===A.left?"left"===m.left?(v-=B,A.left="left",v-=F,m.left="right"):"right"===m.left&&(v-=B,A.left="left",v+=F,m.left="left"):"center"===A.left&&(v+F>p[2]&&"left"===m.left?(v-=F,m.left="right"):v<p[0]&&"right"===m.left&&(v+=F,m.left="left"))),("element"===d||"both"===d)&&(_<p[1]&&"bottom"===m.top&&(_+=b,m.top="top"),_+b>p[3]&&"top"===m.top&&(_-=b,m.top="bottom")),("element"===u||"both"===u)&&(v<p[0]&&"right"===m.left&&(v+=F,m.left="left"),v+F>p[2]&&"left"===m.left&&(v-=F,m.left="right")),"string"==typeof O?O=function(){var t,e,o,i;for(o=O.split(","),i=[],e=0,t=o.length;t>e;e++)C=o[e],i.push(C.trim());return i}():O===!0&&(O=["top","left","right","bottom"]),O||(O=[]),T=[],y=[],_<p[1]&&(f.call(O,"top")>=0?(_=p[1],T.push("top")):y.push("top")),_+b>p[3]&&(f.call(O,"bottom")>=0?(_=p[3]-b,T.push("bottom")):y.push("bottom")),v<p[0]&&(f.call(O,"left")>=0?(v=p[0],T.push("left")):y.push("left")),v+F>p[2]&&(f.call(O,"right")>=0?(v=p[2]-F,T.push("right")):y.push("right")),T.length)for(x=null!=(V=this.options.pinnedClass)?V:this.getClass("pinned"),l.push(x),D=0,q=T.length;q>D;D++)W=T[D],l.push(""+x+"-"+W);if(y.length)for(w=null!=(te=this.options.outOfBoundsClass)?te:this.getClass("out-of-bounds"),l.push(w),Z=0,k=y.length;k>Z;Z++)W=y[Z],l.push(""+w+"-"+W);(f.call(T,"left")>=0||f.call(T,"right")>=0)&&(m.left=A.left=!1),(f.call(T,"top")>=0||f.call(T,"bottom")>=0)&&(m.top=A.top=!1),(A.top!==S.top||A.left!==S.left||m.top!==this.attachment.top||m.left!==this.attachment.left)&&this.updateAttachClasses(m,A)}return o(function(){return h(ee.target,l,r),h(ee.element,l,r)}),{top:_,left:v}}})}.call(this),function(){var t,e,o,i;i=this.Tether.Utils,e=i.getBounds,o=i.updateClasses,t=i.defer,this.Tether.modules.push({position:function(i){var n,s,l,r,h,a,f,p,u,d,g,c,m,b,v,y,w,C,O,T,x,E,W,A,S,M=this;if(g=i.top,a=i.left,x=this.cache("element-bounds",function(){return e(M.element)}),h=x.height,c=x.width,d=this.getTargetBounds(),r=g+h,f=a+c,n=[],g<=d.bottom&&r>=d.top)for(E=["left","right"],m=0,w=E.length;w>m;m++)p=E[m],((W=d[p])===a||W===f)&&n.push(p);if(a<=d.right&&f>=d.left)for(A=["top","bottom"],b=0,C=A.length;C>b;b++)p=A[b],((S=d[p])===g||S===r)&&n.push(p);for(l=[],s=[],u=["left","top","right","bottom"],l.push(this.getClass("abutted")),v=0,O=u.length;O>v;v++)p=u[v],l.push(""+this.getClass("abutted")+"-"+p);for(n.length&&s.push(this.getClass("abutted")),y=0,T=n.length;T>y;y++)p=n[y],s.push(""+this.getClass("abutted")+"-"+p);return t(function(){return o(M.target,s,l),o(M.element,s,l)}),!0}})}.call(this),function(){this.Tether.modules.push({position:function(t){var e,o,i,n,s,l,r;return l=t.top,e=t.left,this.options.shift?(o=function(t){return"function"==typeof t?t.call(this,{top:l,left:e}):t},i=o(this.options.shift),"string"==typeof i?(i=i.split(" "),i[1]||(i[1]=i[0]),s=i[0],n=i[1],s=parseFloat(s,10),n=parseFloat(n,10)):(r=[i.top,i.left],s=r[0],n=r[1]),l+=s,e+=n,{top:l,left:e}):void 0}})}.call(this),this.Tether});
\ No newline at end of file |