vendor: 16,040 bytes, lines 1-429
1+function ($) { 2 'use strict'; 3 4 // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) 5 // ============================================================ 6 7 function transitionEnd() { 8 var el = document.createElement('gg') 9 10 var transEndEventNames = { 11 WebkitTransition: 'webkitTransitionEnd', 12 MozTransition: 'transitionend', 13 OTransition: 'oTransitionEnd otransitionend', 14 transition: 'transitionend' 15 } 16 17 for (var name in transEndEventNames) { 18 if (el.style[name] !== undefined) { 19 return { end: transEndEventNames[name] } 20 } 21 } 22 23 return false // explicit for ie8 ( ._.) 24 } 25 26 // http://blog.alexmaccaw.com/css-transitions 27 $.fn.emulateTransitionEnd = function (duration) { 28 var called = false 29 var $el = this 30 $(this).one('ggTransitionEnd', function () { called = true }) 31 var callback = function () { if (!called) $($el).trigger($.support.transition.end) } 32 setTimeout(callback, duration) 33 return this 34 } 35 36 $(function () { 37 $.support.transition = transitionEnd() 38 39 if (!$.support.transition) return 40 41 $.event.special.ggTransitionEnd = { 42 bindType: $.support.transition.end, 43 delegateType: $.support.transition.end, 44 handle: function (e) { 45 if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) 46 } 47 } 48 }) 49 50}(jQuery); 51 52+function ($) { 53 'use strict'; 54 55 // GGTOOLTIP PUBLIC CLASS DEFINITION 56 // =============================== 57 58 var ggTooltip = function (element, options) { 59 this.type = 60 this.options = 61 this.enabled = 62 this.timeout = 63 this.hoverState = 64 this.$element = null 65 66 this.init('tooltip', element, options) 67 } 68 69 ggTooltip.VERSION = '2.0' 70 71 ggTooltip.TRANSITION_DURATION = 150 72 73 ggTooltip.DEFAULTS = { 74 animation: true, 75 placement: 'top', 76 selector: false, 77 template: '<div class="ggtooltip" role="tooltip"><div class="arrow-shadow"><div class="arrow"></div></div><div class="tooltip-inner"></div></div>', 78 trigger: 'hover focus', 79 title: '', 80 delay: 0, 81 html: false, 82 container: false, 83 viewport: { 84 selector: 'body', 85 padding: 0 86 }, 87 backcolor: '#00ffcc', 88 textcolor: '#000000', 89 bordercolor: '#0066cc' 90 } 91 92 ggTooltip.prototype.init = function (type, element, options) { 93 this.enabled = true 94 this.type = type 95 this.$element = $(element) 96 this.options = this.getOptions(options) 97 this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport) 98 99 var triggers = this.options.trigger.split(' ') 100 101 for (var i = triggers.length; i--;) { 102 var trigger = triggers[i] 103 104 if (trigger == 'click') { 105 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) 106 this.$element.on('focusout.' + this.type, this.options.selector, $.proxy(this.leave, this)) 107 } else if (trigger != 'manual') { 108 var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin' 109 var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout' 110 111 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) 112 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) 113 } 114 } 115 116 this.options.selector ? 117 (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : 118 this.fixTitle() 119 } 120 121 ggTooltip.prototype.getDefaults = function () { 122 return ggTooltip.DEFAULTS 123 } 124 125 ggTooltip.prototype.getOptions = function (options) { 126 options = $.extend({}, this.getDefaults(), this.$element.data(), options) 127 128 if (options.delay && typeof options.delay == 'number') { 129 options.delay = { 130 show: options.delay, 131 hide: options.delay 132 } 133 } 134 135 return options 136 } 137 138 ggTooltip.prototype.getDelegateOptions = function () { 139 var options = {} 140 var defaults = this.getDefaults() 141 142 this._options && $.each(this._options, function (key, value) { 143 if (defaults[key] != value) options[key] = value 144 }) 145 146 return options 147 } 148 149 ggTooltip.prototype.enter = function (obj) { 150 var self = obj instanceof this.constructor ? 151 obj : $(obj.currentTarget).data('gg.' + this.type) 152 153 if (self && self.$tip && self.$tip.is(':visible')) { 154 self.hoverState = 'in' 155 return 156 } 157 158 if (!self) { 159 self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) 160 $(obj.currentTarget).data('gg.' + this.type, self) 161 } 162 163 clearTimeout(self.timeout) 164 165 self.hoverState = 'in' 166 167 if (!self.options.delay || !self.options.delay.show) return self.show() 168 169 self.timeout = setTimeout(function () { 170 if (self.hoverState == 'in') self.show() 171 }, self.options.delay.show) 172 } 173 174 ggTooltip.prototype.leave = function (obj) { 175 var self = obj instanceof this.constructor ? 176 obj : $(obj.currentTarget).data('gg.' + this.type) 177 178 if (!self) { 179 self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) 180 $(obj.currentTarget).data('gg.' + this.type, self) 181 } 182 183 clearTimeout(self.timeout) 184 185 self.hoverState = 'out' 186 187 if (!self.options.delay || !self.options.delay.hide) return self.hide() 188 189 self.timeout = setTimeout(function () { 190 if (self.hoverState == 'out') self.hide() 191 }, self.options.delay.hide) 192 } 193 194 ggTooltip.prototype.show = function () { 195 var e = $.Event('show.gg.' + this.type) 196 197 if (this.hasContent() && this.enabled) { 198 this.$element.trigger(e) 199 200 var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]) 201 if (e.isDefaultPrevented() || !inDom) return 202 var that = this 203 204 var $tip = this.tip() 205 206 var tipId = this.getUID(this.type) 207 208 this.setContent() 209 $tip.attr('id', tipId) 210 this.$element.attr('aria-describedby', tipId) 211 212 if (this.options.animation) $tip.addClass('fade') 213 214 var placement = typeof this.options.placement == 'function' ? 215 this.options.placement.call(this, $tip[0], this.$element[0]) : 216 this.options.placement 217 218 var autoToken = /\s?auto?\s?/i 219 var autoPlace = autoToken.test(placement) 220 if (autoPlace) placement = placement.replace(autoToken, '') || 'top' 221 222 $tip 223 .detach() 224 .css({ top: 0, left: 0, display: 'block' }) 225 .addClass(placement) 226 .data('gg.' + this.type, this) 227 228 this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) 229 230 var pos = this.getPosition() 231 var actualWidth = $tip[0].offsetWidth 232 var actualHeight = $tip[0].offsetHeight 233 234 if (autoPlace) { 235 var orgPlacement = placement 236 var $container = this.options.container ? $(this.options.container) : this.$element.parent() 237 var containerDim = this.getPosition($container) 238 239 placement = placement == 'bottom' && pos.bottom + actualHeight > containerDim.bottom ? 'top' : 240 placement == 'top' && pos.top - actualHeight < containerDim.top ? 'bottom' : 241 placement == 'right' && pos.right + actualWidth > containerDim.width ? 'left' : 242 placement == 'left' && pos.left - actualWidth < containerDim.left ? 'right' : 243 placement 244 245 $tip 246 .removeClass(orgPlacement) 247 .addClass(placement) 248 } 249 250 var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) 251 252 this.applyPlacement(calculatedOffset, placement) 253 254 var complete = function () { 255 var prevHoverState = that.hoverState 256 that.$element.trigger('shown.gg.' + that.type) 257 that.hoverState = null 258 259 if (prevHoverState == 'out') that.leave(that) 260 } 261 262 $.support.transition && this.$tip.hasClass('fade') ? 263 $tip 264 .one('ggTransitionEnd', complete) 265 .emulateTransitionEnd(ggTooltip.TRANSITION_DURATION) : 266 complete() 267 } 268 } 269 270 ggTooltip.prototype.applyPlacement = function (offset, placement) { 271 var $tip = this.tip() 272 var width = $tip[0].offsetWidth 273 var height = $tip[0].offsetHeight 274 275 // manually read margins because getBoundingClientRect includes difference 276 var marginTop = parseInt($tip.css('margin-top'), 10) 277 var marginLeft = parseInt($tip.css('margin-left'), 10) 278 279 // we must check for NaN for ie 8/9 280 if (isNaN(marginTop)) marginTop = 0 281 if (isNaN(marginLeft)) marginLeft = 0 282 283 offset.top = offset.top + marginTop 284 offset.left = offset.left + marginLeft 285 286 // $.fn.offset doesn't round pixel values 287 // so we use setOffset directly with our own function B-0 288 $.offset.setOffset($tip[0], $.extend({ 289 using: function (props) { 290 $tip.css({ 291 top: Math.round(props.top), 292 left: Math.round(props.left) 293 }) 294 } 295 }, offset), 0) 296 297 $tip.addClass('in') 298 299 // check to see if placing tip in new offset caused the tip to resize itself 300 var actualWidth = $tip[0].offsetWidth 301 var actualHeight = $tip[0].offsetHeight 302 303 if (placement == 'top' && actualHeight != height) { 304 offset.top = offset.top + height - actualHeight 305 } 306 307 var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight) 308 309 if (delta.left) offset.left += delta.left 310 else offset.top += delta.top 311 312 var isVertical = /top|bottom/.test(placement) 313 var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight 314 var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight' 315 316 $tip.offset(offset) 317 this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical) 318 this.setStyles(placement) 319 } 320 321 ggTooltip.prototype.replaceArrow = function (delta, dimension, isHorizontal) { 322 if (delta > 0) { 323 this.arrow() 324 .css(isHorizontal ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') 325 .css(isHorizontal ? 'top' : 'left', '') 326 327 this.arrowShadow() 328 .css(isHorizontal ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') 329 .css(isHorizontal ? 'top' : 'left', '') 330 } 331 } 332 333 ggTooltip.prototype.setContent = function () { 334 var $tip = this.tip() 335 var title = this.getTitle() 336 337 $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) 338 $tip.removeClass('fade in top bottom left right') 339 } 340 341 ggTooltip.prototype.setStyles = function (placement) { 342 var $tip = this.tip() 343 344 $tip.find('.tooltip-inner').css({ 'background': this.options.backcolor, 'color': this.options.textcolor, 'border-color': this.options.bordercolor }); 345 $tip.find('.arrow').css('border-' + placement + '-color', this.options.backcolor); 346 $tip.find('.arrow-shadow').css('border-' + placement + '-color', this.options.bordercolor); 347 } 348 349 ggTooltip.prototype.hide = function (callback) { 350 var that = this 351 var $tip = this.tip() 352 var e = $.Event('hide.gg.' + this.type) 353 354 function complete() { 355 if (that.hoverState != 'in') $tip.detach() 356 that.$element 357 .removeAttr('aria-describedby') 358 .trigger('hidden.gg.' + that.type) 359 callback && callback() 360 } 361 362 this.$element.trigger(e) 363 364 if (e.isDefaultPrevented()) return 365 366 $tip.removeClass('in') 367 368 $.support.transition && this.$tip.hasClass('fade') ? 369 $tip 370 .one('ggTransitionEnd', complete) 371 .emulateTransitionEnd(ggTooltip.TRANSITION_DURATION) : 372 complete() 373 374 this.hoverState = null 375 376 return this 377 } 378 379 ggTooltip.prototype.fixTitle = function () { 380 var $e = this.$element 381 if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') { 382 $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') 383 } 384 } 385 386 ggTooltip.prototype.hasContent = function () { 387 return this.getTitle() 388 } 389 390 ggTooltip.prototype.getPosition = function ($element) { 391 $element = $element || this.$element 392 393 var el = $element[0] 394 var isBody = el.tagName == 'BODY' 395 396 var elRect = el.getBoundingClientRect() 397 if (elRect.width == null) { 398 // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093 399 elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top }) 400 } 401 var elOffset = isBody ? { top: 0, left: 0 } : $element.offset() 402 var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() } 403 var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null 404 405 return $.extend({}, elRect, scroll, outerDims, elOffset) 406 } 407 408 ggTooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { 409 return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : 410 placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : 411 placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : 412 /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } 413 414 } 415 416 ggTooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { 417 var delta = { top: 0, left: 0 } 418 if (!this.$viewport) return delta 419 420 var viewportPadding = this.options.viewport && this.options.viewport.padding || 0 421 var viewportDimensions = this.getPosition(this.$viewport) 422 423 if (/right|left/.test(placement)) { 424 var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll 425 var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight 426 if (topEdgeOffset < viewportDimensions.top) { // top overflow 427 delta.top = viewportDimensions.top - topEdgeOffset 428 } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow 429 delta.top = viewportDimensions.top + viewportDimensions.height - bottom
429EdgeOffset 430 } 431 } else { 432 var leftEdgeOffset = pos.left - viewportPadding 433 var rightEdgeOffset = pos.left + viewportPadding + actualWidth 434 if (leftEdgeOffset < viewportDimensions.left) { // left overflow 435 delta.left = viewportDimensions.left - leftEdgeOffset 436 } else if (rightEdgeOffset > viewportDimensions.width) { // right overflow 437 delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset 438 } 439 } 440 441 return delta 442 } 443 444 ggTooltip.prototype.getTitle = function () { 445 var title 446 var $e = this.$element 447 var o = this.options 448 449 title = $e.attr('data-original-title') 450 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) 451 452 return title 453 } 454 455 ggTooltip.prototype.getUID = function (prefix) { 456 do prefix += ~~(Math.random() * 1000000) 457 while (document.getElementById(prefix)) 458 return prefix 459 } 460 461 ggTooltip.prototype.tip = function () { 462 return (this.$tip = this.$tip || $(this.options.template)) 463 } 464 465 ggTooltip.prototype.arrow = function () { 466 return (this.$arrow = this.$arrow || this.tip().find('.arrow')) 467 } 468 469 ggTooltip.prototype.arrowShadow = function () { 470 return (this.$arrowShadow = this.$arrowShadow || this.tip().find('.arrow-shadow')) 471 } 472 473 ggTooltip.prototype.enable = function () { 474 this.enabled = true 475 } 476 477 ggTooltip.prototype.disable = function () { 478 this.enabled = false 479 } 480 481 ggTooltip.prototype.toggleEnabled = function () { 482 this.enabled = !this.enabled 483 } 484 485 ggTooltip.prototype.toggle = function (e) { 486 var self = this 487 if (e) { 488 self = $(e.currentTarget).data('gg.' + this.type) 489 if (!self) { 490 self = new this.constructor(e.currentTarget, this.getDelegateOptions()) 491 $(e.currentTarget).data('gg.' + this.type, self) 492 } 493 } 494 495 self.tip().hasClass('in') ? self.leave(self) : self.enter(self) 496 } 497 498 ggTooltip.prototype.destroy = function () { 499 var that = this 500 clearTimeout(this.timeout) 501 this.hide(function () { 502 that.$element.off('.' + that.type).removeData('gg.' + that.type) 503 }) 504 } 505 506 507 // GGTOOLTIP PLUGIN DEFINITION 508 // ========================= 509 510 function Plugin(option) { 511 return this.each(function () { 512 var $this = $(this) 513 var data = $this.data('gg.tooltip') 514 var options = typeof option == 'object' && option 515 516 if (!data && option == 'destroy') return 517 if (!data) $this.data('gg.tooltip', (data = new ggTooltip(this, options))) 518 if (typeof option == 'string') data[option]() 519 }) 520 } 521 522 var old = $.fn.ggtooltip 523 524 $.fn.ggtooltip = Plugin 525 $.fn.ggtooltip.Constructor = ggTooltip 526 527 528 // GGTOOLTIP NO CONFLICT 529 // =================== 530 531 $.fn.ggtooltip.noConflict = function () { 532 $.fn.ggtooltip = old 533 return this 534 } 535 536}(jQuery); 537 538+function ($) { 539 'use strict'; 540 541 // GGPOPOVER PUBLIC CLASS DEFINITION 542 // =============================== 543 544 var ggPopover = function (element, options) { 545 this.init('popover', element, options) 546 } 547 548 if (!$.fn.ggtooltip) throw new Error('ggPopover requires ggtooltip.js') 549 550 ggPopover.VERSION = '1.0' 551 552 ggPopover.DEFAULTS = $.extend({}, $.fn.ggtooltip.Constructor.DEFAULTS, { 553 placement: 'right', 554 trigger: 'click', 555 content: '', 556 template: '<div class="ggpopover" role="tooltip"><div class="arrow"><div class="after"></div></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>', 557 titleBackcolor: '#f7f7f7', 558 titleBordercolor: '#ebebeb', 559 titleTextcolor: '#000000', 560 contentBackcolor: '#ffffff', 561 contentTextcolor: '#000000', 562 bordercolor: '#cccccc', 563 arrowcolor: '#ffffff' 564 }) 565 566 567 // NOTE: GGPOPOVER EXTENDS ggtooltip.js 568 // ================================ 569 570 ggPopover.prototype = $.extend({}, $.fn.ggtooltip.Constructor.prototype) 571 572 ggPopover.prototype.constructor = ggPopover 573 574 ggPopover.prototype.getDefaults = function () { 575 return ggPopover.DEFAULTS 576 } 577 578 ggPopover.prototype.setContent = function () { 579 var $tip = this.tip() 580 var title = this.getTitle() 581 var content = this.getContent() 582 583 $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) 584 $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events 585 this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text' 586 ](content) 587 588 $tip.removeClass('fade top bottom left right in') 589 590 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do 591 // this manually by checking the contents. 592 if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() 593 } 594 595 ggPopover.prototype.setStyles = function (placement) { 596 var $tip = this.tip() 597 var title = this.getTitle() 598 599 $tip.find('.popover-title').css({ 'background-color': this.options.titleBackcolor, 'color': this.options.titleTextcolor, 'border-bottom-color': this.options.titleBordercolor }); 600 $tip.find('.popover-content').css({ 'background-color': this.options.contentBackcolor, 'color': this.options.contentTextcolor }); 601 $tip.find('.arrow').css('border-' + placement + '-color', this.options.bordercolor); 602 $tip.find('.arrow > .after').css('border-' + placement + '-color', this.options.arrowcolor); 603 $tip.css({ 'border-color': this.options.bordercolor }); 604 605 } 606 607 ggPopover.prototype.hasContent = function () { 608 return this.getTitle() || this.getContent() 609 } 610 611 ggPopover.prototype.getContent = function () { 612 var $e = this.$element 613 var o = this.options 614 615 return $e.attr('data-content') 616 || (typeof o.content == 'function' ? 617 o.content.call($e[0]) : 618 o.content) 619 } 620 621 ggPopover.prototype.arrow = function () { 622 return (this.$arrow = this.$arrow || this.tip().find('.arrow')) 623 } 624 625 ggPopover.prototype.tip = function () { 626 if (!this.$tip) this.$tip = $(this.options.template) 627 return this.$tip 628 } 629 630 631 // GGPOPOVER PLUGIN DEFINITION 632 // ========================= 633 634 function Plugin(option) { 635 return this.each(function () { 636 var $this = $(this) 637 var data = $this.data('gg.popover') 638 var options = typeof option == 'object' && option 639 640 if (!data && option == 'destroy') return 641 if (!data) $this.data('gg.popover', (data = new ggPopover(this, options))) 642 if (typeof option == 'string') data[option]() 643 }) 644 } 645 646 var old = $.fn.ggpopover 647 648 $.fn.ggpopover = Plugin 649 $.fn.ggpopover.Constructor = ggPopover 650 651 652 // GGPOPOVER NO CONFLICT 653 // =================== 654 655 $.fn.ggpopover.noConflict = function () { 656 $.fn.ggpopover = old 657 return this 658 } 659 660}(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.