Added tooltips

This commit is contained in:
Mattias Erming 2014-07-17 06:58:43 -07:00
parent d260a8fe66
commit fa2ec6de3d
6 changed files with 877 additions and 76 deletions

529
client/components/jquery/bootstrap.js vendored Normal file
View File

@ -0,0 +1,529 @@
/*!
* Bootstrap v3.2.0 (http://getbootstrap.com)
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=242b77ebf84da0cd12cf)
* Config saved to config.json and https://gist.github.com/242b77ebf84da0cd12cf
*/
if (typeof jQuery === "undefined") { throw new Error("Bootstrap's JavaScript requires jQuery") }
/* ========================================================================
* Bootstrap: tooltip.js v3.2.0
* http://getbootstrap.com/javascript/#tooltip
* Inspired by the original jQuery.tipsy by Jason Frame
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// TOOLTIP PUBLIC CLASS DEFINITION
// ===============================
var Tooltip = function (element, options) {
this.type =
this.options =
this.enabled =
this.timeout =
this.hoverState =
this.$element = null
this.init('tooltip', element, options)
}
Tooltip.VERSION = '3.2.0'
Tooltip.DEFAULTS = {
animation: true,
placement: 'top',
selector: false,
template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
trigger: 'hover focus',
title: '',
delay: 0,
html: false,
container: false,
viewport: {
selector: 'body',
padding: 0
}
}
Tooltip.prototype.init = function (type, element, options) {
this.enabled = true
this.type = type
this.$element = $(element)
this.options = this.getOptions(options)
this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
var triggers = this.options.trigger.split(' ')
for (var i = triggers.length; i--;) {
var trigger = triggers[i]
if (trigger == 'click') {
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
} else if (trigger != 'manual') {
var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
}
}
this.options.selector ?
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
this.fixTitle()
}
Tooltip.prototype.getDefaults = function () {
return Tooltip.DEFAULTS
}
Tooltip.prototype.getOptions = function (options) {
options = $.extend({}, this.getDefaults(), this.$element.data(), options)
if (options.delay && typeof options.delay == 'number') {
options.delay = {
show: options.delay,
hide: options.delay
}
}
return options
}
Tooltip.prototype.getDelegateOptions = function () {
var options = {}
var defaults = this.getDefaults()
this._options && $.each(this._options, function (key, value) {
if (defaults[key] != value) options[key] = value
})
return options
}
Tooltip.prototype.enter = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
clearTimeout(self.timeout)
self.hoverState = 'in'
if (!self.options.delay || !self.options.delay.show) return self.show()
self.timeout = setTimeout(function () {
if (self.hoverState == 'in') self.show()
}, self.options.delay.show)
}
Tooltip.prototype.leave = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
clearTimeout(self.timeout)
self.hoverState = 'out'
if (!self.options.delay || !self.options.delay.hide) return self.hide()
self.timeout = setTimeout(function () {
if (self.hoverState == 'out') self.hide()
}, self.options.delay.hide)
}
Tooltip.prototype.show = function () {
var e = $.Event('show.bs.' + this.type)
if (this.hasContent() && this.enabled) {
this.$element.trigger(e)
var inDom = $.contains(document.documentElement, this.$element[0])
if (e.isDefaultPrevented() || !inDom) return
var that = this
var $tip = this.tip()
var tipId = this.getUID(this.type)
this.setContent()
$tip.attr('id', tipId)
this.$element.attr('aria-describedby', tipId)
if (this.options.animation) $tip.addClass('fade')
var placement = typeof this.options.placement == 'function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) :
this.options.placement
var autoToken = /\s?auto?\s?/i
var autoPlace = autoToken.test(placement)
if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
$tip
.detach()
.css({ top: 0, left: 0, display: 'block' })
.addClass(placement)
.data('bs.' + this.type, this)
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
var pos = this.getPosition()
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (autoPlace) {
var orgPlacement = placement
var $parent = this.$element.parent()
var parentDim = this.getPosition($parent)
placement = placement == 'bottom' && pos.top + pos.height + actualHeight - parentDim.scroll > parentDim.height ? 'top' :
placement == 'top' && pos.top - parentDim.scroll - actualHeight < 0 ? 'bottom' :
placement == 'right' && pos.right + actualWidth > parentDim.width ? 'left' :
placement == 'left' && pos.left - actualWidth < parentDim.left ? 'right' :
placement
$tip
.removeClass(orgPlacement)
.addClass(placement)
}
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
this.applyPlacement(calculatedOffset, placement)
var complete = function () {
that.$element.trigger('shown.bs.' + that.type)
that.hoverState = null
}
$.support.transition && this.$tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(150) :
complete()
}
}
Tooltip.prototype.applyPlacement = function (offset, placement) {
var $tip = this.tip()
var width = $tip[0].offsetWidth
var height = $tip[0].offsetHeight
// manually read margins because getBoundingClientRect includes difference
var marginTop = parseInt($tip.css('margin-top'), 10)
var marginLeft = parseInt($tip.css('margin-left'), 10)
// we must check for NaN for ie 8/9
if (isNaN(marginTop)) marginTop = 0
if (isNaN(marginLeft)) marginLeft = 0
offset.top = offset.top + marginTop
offset.left = offset.left + marginLeft
// $.fn.offset doesn't round pixel values
// so we use setOffset directly with our own function B-0
$.offset.setOffset($tip[0], $.extend({
using: function (props) {
$tip.css({
top: Math.round(props.top),
left: Math.round(props.left)
})
}
}, offset), 0)
$tip.addClass('in')
// check to see if placing tip in new offset caused the tip to resize itself
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (placement == 'top' && actualHeight != height) {
offset.top = offset.top + height - actualHeight
}
var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
if (delta.left) offset.left += delta.left
else offset.top += delta.top
var arrowDelta = delta.left ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
var arrowPosition = delta.left ? 'left' : 'top'
var arrowOffsetPosition = delta.left ? 'offsetWidth' : 'offsetHeight'
$tip.offset(offset)
this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], arrowPosition)
}
Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '')
}
Tooltip.prototype.setContent = function () {
var $tip = this.tip()
var title = this.getTitle()
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
$tip.removeClass('fade in top bottom left right')
}
Tooltip.prototype.hide = function () {
var that = this
var $tip = this.tip()
var e = $.Event('hide.bs.' + this.type)
this.$element.removeAttr('aria-describedby')
function complete() {
if (that.hoverState != 'in') $tip.detach()
that.$element.trigger('hidden.bs.' + that.type)
}
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
$tip.removeClass('in')
$.support.transition && this.$tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(150) :
complete()
this.hoverState = null
return this
}
Tooltip.prototype.fixTitle = function () {
var $e = this.$element
if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') {
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
}
}
Tooltip.prototype.hasContent = function () {
return this.getTitle()
}
Tooltip.prototype.getPosition = function ($element) {
$element = $element || this.$element
var el = $element[0]
var isBody = el.tagName == 'BODY'
return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, {
scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop(),
width: isBody ? $(window).width() : $element.outerWidth(),
height: isBody ? $(window).height() : $element.outerHeight()
}, isBody ? { top: 0, left: 0 } : $element.offset())
}
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
}
Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
var delta = { top: 0, left: 0 }
if (!this.$viewport) return delta
var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
var viewportDimensions = this.getPosition(this.$viewport)
if (/right|left/.test(placement)) {
var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
if (topEdgeOffset < viewportDimensions.top) { // top overflow
delta.top = viewportDimensions.top - topEdgeOffset
} else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
}
} else {
var leftEdgeOffset = pos.left - viewportPadding
var rightEdgeOffset = pos.left + viewportPadding + actualWidth
if (leftEdgeOffset < viewportDimensions.left) { // left overflow
delta.left = viewportDimensions.left - leftEdgeOffset
} else if (rightEdgeOffset > viewportDimensions.width) { // right overflow
delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
}
}
return delta
}
Tooltip.prototype.getTitle = function () {
var title
var $e = this.$element
var o = this.options
title = $e.attr('data-original-title')
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
return title
}
Tooltip.prototype.getUID = function (prefix) {
do prefix += ~~(Math.random() * 1000000)
while (document.getElementById(prefix))
return prefix
}
Tooltip.prototype.tip = function () {
return (this.$tip = this.$tip || $(this.options.template))
}
Tooltip.prototype.arrow = function () {
return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
}
Tooltip.prototype.validate = function () {
if (!this.$element[0].parentNode) {
this.hide()
this.$element = null
this.options = null
}
}
Tooltip.prototype.enable = function () {
this.enabled = true
}
Tooltip.prototype.disable = function () {
this.enabled = false
}
Tooltip.prototype.toggleEnabled = function () {
this.enabled = !this.enabled
}
Tooltip.prototype.toggle = function (e) {
var self = this
if (e) {
self = $(e.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(e.currentTarget, this.getDelegateOptions())
$(e.currentTarget).data('bs.' + this.type, self)
}
}
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
}
Tooltip.prototype.destroy = function () {
clearTimeout(this.timeout)
this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
}
// TOOLTIP PLUGIN DEFINITION
// =========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.tooltip')
var options = typeof option == 'object' && option
if (!data && option == 'destroy') return
if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.tooltip
$.fn.tooltip = Plugin
$.fn.tooltip.Constructor = Tooltip
// TOOLTIP NO CONFLICT
// ===================
$.fn.tooltip.noConflict = function () {
$.fn.tooltip = old
return this
}
}(jQuery);
/* ========================================================================
* Bootstrap: transition.js v3.2.0
* http://getbootstrap.com/javascript/#transitions
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
// ============================================================
function transitionEnd() {
var el = document.createElement('bootstrap')
var transEndEventNames = {
WebkitTransition : 'webkitTransitionEnd',
MozTransition : 'transitionend',
OTransition : 'oTransitionEnd otransitionend',
transition : 'transitionend'
}
for (var name in transEndEventNames) {
if (el.style[name] !== undefined) {
return { end: transEndEventNames[name] }
}
}
return false // explicit for ie8 ( ._.)
}
// http://blog.alexmaccaw.com/css-transitions
$.fn.emulateTransitionEnd = function (duration) {
var called = false
var $el = this
$(this).one('bsTransitionEnd', function () { called = true })
var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
setTimeout(callback, duration)
return this
}
$(function () {
$.support.transition = transitionEnd()
if (!$.support.transition) return
$.event.special.bsTransitionEnd = {
bindType: $.support.transition.end,
delegateType: $.support.transition.end,
handle: function (e) {
if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
}
}
})
}(jQuery);

View File

@ -1,10 +1,14 @@
/*! /*!
* Bootstrap v3.1.1 (http://getbootstrap.com) * Bootstrap v3.2.0 (http://getbootstrap.com)
* Copyright 2011-2014 Twitter, Inc. * Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/ */
/*! normalize.css v3.0.0 | MIT License | git.io/normalize */ /*!
* Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=242b77ebf84da0cd12cf)
* Config saved to config.json and https://gist.github.com/242b77ebf84da0cd12cf
*/
/*! normalize.css v3.0.1 | MIT License | git.io/normalize */
html { html {
font-family: sans-serif; font-family: sans-serif;
-ms-text-size-adjust: 100%; -ms-text-size-adjust: 100%;
@ -196,7 +200,7 @@ th {
box-sizing: border-box; box-sizing: border-box;
} }
html { html {
font-size: 62.5%; font-size: 10px;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
} }
body { body {
@ -236,6 +240,7 @@ img {
} }
.img-responsive { .img-responsive {
display: block; display: block;
width: 100% \9;
max-width: 100%; max-width: 100%;
height: auto; height: auto;
} }
@ -249,8 +254,10 @@ img {
border: 1px solid #dddddd; border: 1px solid #dddddd;
border-radius: 4px; border-radius: 4px;
-webkit-transition: all 0.2s ease-in-out; -webkit-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out;
display: inline-block; display: inline-block;
width: 100% \9;
max-width: 100%; max-width: 100%;
height: auto; height: auto;
} }
@ -273,6 +280,15 @@ hr {
clip: rect(0, 0, 0, 0); clip: rect(0, 0, 0, 0);
border: 0; border: 0;
} }
.sr-only-focusable:active,
.sr-only-focusable:focus {
position: static;
width: auto;
height: auto;
margin: 0;
overflow: visible;
clip: auto;
}
h1, h1,
h2, h2,
h3, h3,
@ -316,7 +332,7 @@ h6 .small,
.h6 .small { .h6 .small {
font-weight: normal; font-weight: normal;
line-height: 1; line-height: 1;
color: #999999; color: #777777;
} }
h1, h1,
.h1, .h1,
@ -394,7 +410,7 @@ p {
.lead { .lead {
margin-bottom: 20px; margin-bottom: 20px;
font-size: 16px; font-size: 16px;
font-weight: 200; font-weight: 300;
line-height: 1.4; line-height: 1.4;
} }
@media (min-width: 768px) { @media (min-width: 768px) {
@ -409,6 +425,11 @@ small,
cite { cite {
font-style: normal; font-style: normal;
} }
mark,
.mark {
background-color: #fcf8e3;
padding: .2em;
}
.text-left { .text-left {
text-align: left; text-align: left;
} }
@ -421,8 +442,20 @@ cite {
.text-justify { .text-justify {
text-align: justify; text-align: justify;
} }
.text-nowrap {
white-space: nowrap;
}
.text-lowercase {
text-transform: lowercase;
}
.text-uppercase {
text-transform: uppercase;
}
.text-capitalize {
text-transform: capitalize;
}
.text-muted { .text-muted {
color: #999999; color: #777777;
} }
.text-primary { .text-primary {
color: #428bca; color: #428bca;
@ -546,7 +579,7 @@ dd {
abbr[title], abbr[title],
abbr[data-original-title] { abbr[data-original-title] {
cursor: help; cursor: help;
border-bottom: 1px dotted #999999; border-bottom: 1px dotted #777777;
} }
.initialism { .initialism {
font-size: 90%; font-size: 90%;
@ -569,7 +602,7 @@ blockquote .small {
display: block; display: block;
font-size: 80%; font-size: 80%;
line-height: 1.42857143; line-height: 1.42857143;
color: #999999; color: #777777;
} }
blockquote footer:before, blockquote footer:before,
blockquote small:before, blockquote small:before,
@ -722,7 +755,7 @@ address {
right: 8.33333333%; right: 8.33333333%;
} }
.col-xs-pull-0 { .col-xs-pull-0 {
right: 0%; right: auto;
} }
.col-xs-push-12 { .col-xs-push-12 {
left: 100%; left: 100%;
@ -761,7 +794,7 @@ address {
left: 8.33333333%; left: 8.33333333%;
} }
.col-xs-push-0 { .col-xs-push-0 {
left: 0%; left: auto;
} }
.col-xs-offset-12 { .col-xs-offset-12 {
margin-left: 100%; margin-left: 100%;
@ -879,7 +912,7 @@ address {
right: 8.33333333%; right: 8.33333333%;
} }
.col-sm-pull-0 { .col-sm-pull-0 {
right: 0%; right: auto;
} }
.col-sm-push-12 { .col-sm-push-12 {
left: 100%; left: 100%;
@ -918,7 +951,7 @@ address {
left: 8.33333333%; left: 8.33333333%;
} }
.col-sm-push-0 { .col-sm-push-0 {
left: 0%; left: auto;
} }
.col-sm-offset-12 { .col-sm-offset-12 {
margin-left: 100%; margin-left: 100%;
@ -960,8 +993,137 @@ address {
margin-left: 0%; margin-left: 0%;
} }
} }
.fade {
opacity: 0;
-webkit-transition: opacity 0.15s linear;
-o-transition: opacity 0.15s linear;
transition: opacity 0.15s linear;
}
.fade.in {
opacity: 1;
}
.collapse {
display: none;
}
.collapse.in {
display: block;
}
tr.collapse.in {
display: table-row;
}
tbody.collapse.in {
display: table-row-group;
}
.collapsing {
position: relative;
height: 0;
overflow: hidden;
-webkit-transition: height 0.35s ease;
-o-transition: height 0.35s ease;
transition: height 0.35s ease;
}
.tooltip {
position: absolute;
z-index: 1070;
display: block;
visibility: visible;
font-size: 12px;
line-height: 1.4;
opacity: 0;
filter: alpha(opacity=0);
}
.tooltip.in {
opacity: 0.9;
filter: alpha(opacity=90);
}
.tooltip.top {
margin-top: -3px;
padding: 5px 0;
}
.tooltip.right {
margin-left: 3px;
padding: 0 5px;
}
.tooltip.bottom {
margin-top: 3px;
padding: 5px 0;
}
.tooltip.left {
margin-left: -3px;
padding: 0 5px;
}
.tooltip-inner {
max-width: 200px;
padding: 3px 8px;
color: #ffffff;
text-align: center;
text-decoration: none;
background-color: #000000;
border-radius: 4px;
}
.tooltip-arrow {
position: absolute;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
}
.tooltip.top .tooltip-arrow {
bottom: 0;
left: 50%;
margin-left: -5px;
border-width: 5px 5px 0;
border-top-color: #000000;
}
.tooltip.top-left .tooltip-arrow {
bottom: 0;
left: 5px;
border-width: 5px 5px 0;
border-top-color: #000000;
}
.tooltip.top-right .tooltip-arrow {
bottom: 0;
right: 5px;
border-width: 5px 5px 0;
border-top-color: #000000;
}
.tooltip.right .tooltip-arrow {
top: 50%;
left: 0;
margin-top: -5px;
border-width: 5px 5px 5px 0;
border-right-color: #000000;
}
.tooltip.left .tooltip-arrow {
top: 50%;
right: 0;
margin-top: -5px;
border-width: 5px 0 5px 5px;
border-left-color: #000000;
}
.tooltip.bottom .tooltip-arrow {
top: 0;
left: 50%;
margin-left: -5px;
border-width: 0 5px 5px;
border-bottom-color: #000000;
}
.tooltip.bottom-left .tooltip-arrow {
top: 0;
left: 5px;
border-width: 0 5px 5px;
border-bottom-color: #000000;
}
.tooltip.bottom-right .tooltip-arrow {
top: 0;
right: 5px;
border-width: 0 5px 5px;
border-bottom-color: #000000;
}
.clearfix:before, .clearfix:before,
.clearfix:after, .clearfix:after,
.dl-horizontal dd:before,
.dl-horizontal dd:after,
.container:before, .container:before,
.container:after, .container:after,
.container-fluid:before, .container-fluid:before,
@ -972,6 +1134,7 @@ address {
display: table; display: table;
} }
.clearfix:after, .clearfix:after,
.dl-horizontal dd:after,
.container:after, .container:after,
.container-fluid:after, .container-fluid:after,
.row:after { .row:after {
@ -1010,6 +1173,8 @@ address {
} }
.affix { .affix {
position: fixed; position: fixed;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
} }
@-ms-viewport { @-ms-viewport {
width: device-width; width: device-width;
@ -1020,6 +1185,20 @@ address {
.visible-lg { .visible-lg {
display: none !important; display: none !important;
} }
.visible-xs-block,
.visible-xs-inline,
.visible-xs-inline-block,
.visible-sm-block,
.visible-sm-inline,
.visible-sm-inline-block,
.visible-md-block,
.visible-md-inline,
.visible-md-inline-block,
.visible-lg-block,
.visible-lg-inline,
.visible-lg-inline-block {
display: none !important;
}
@media (max-width: 767px) { @media (max-width: 767px) {
.visible-xs { .visible-xs {
display: block !important; display: block !important;
@ -1035,6 +1214,21 @@ address {
display: table-cell !important; display: table-cell !important;
} }
} }
@media (max-width: 767px) {
.visible-xs-block {
display: block !important;
}
}
@media (max-width: 767px) {
.visible-xs-inline {
display: inline !important;
}
}
@media (max-width: 767px) {
.visible-xs-inline-block {
display: inline-block !important;
}
}
@media (min-width: 768px) and (max-width: 991px) { @media (min-width: 768px) and (max-width: 991px) {
.visible-sm { .visible-sm {
display: block !important; display: block !important;
@ -1050,6 +1244,21 @@ address {
display: table-cell !important; display: table-cell !important;
} }
} }
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm-block {
display: block !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm-inline {
display: inline !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm-inline-block {
display: inline-block !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) { @media (min-width: 992px) and (max-width: 1199px) {
.visible-md { .visible-md {
display: block !important; display: block !important;
@ -1065,6 +1274,21 @@ address {
display: table-cell !important; display: table-cell !important;
} }
} }
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md-block {
display: block !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md-inline {
display: inline !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md-inline-block {
display: inline-block !important;
}
}
@media (min-width: 1200px) { @media (min-width: 1200px) {
.visible-lg { .visible-lg {
display: block !important; display: block !important;
@ -1080,6 +1304,21 @@ address {
display: table-cell !important; display: table-cell !important;
} }
} }
@media (min-width: 1200px) {
.visible-lg-block {
display: block !important;
}
}
@media (min-width: 1200px) {
.visible-lg-inline {
display: inline !important;
}
}
@media (min-width: 1200px) {
.visible-lg-inline-block {
display: inline-block !important;
}
}
@media (max-width: 767px) { @media (max-width: 767px) {
.hidden-xs { .hidden-xs {
display: none !important; display: none !important;
@ -1118,6 +1357,30 @@ address {
display: table-cell !important; display: table-cell !important;
} }
} }
.visible-print-block {
display: none !important;
}
@media print {
.visible-print-block {
display: block !important;
}
}
.visible-print-inline {
display: none !important;
}
@media print {
.visible-print-inline {
display: inline !important;
}
}
.visible-print-inline-block {
display: none !important;
}
@media print {
.visible-print-inline-block {
display: inline-block !important;
}
}
@media print { @media print {
.hidden-print { .hidden-print {
display: none !important; display: none !important;

View File

@ -39,6 +39,14 @@ button {
outline: none; outline: none;
padding: 0; padding: 0;
} }
.tooltip-inner {
background: #fff;
border-radius: 2px;
color: #262c36;
}
.tooltip.top .tooltip-arrow {
border-top-color: #fff;
}
.btn { .btn {
border: 2px solid #95a5a6; border: 2px solid #95a5a6;
border: 2px solid #84d1ff; border: 2px solid #84d1ff;
@ -257,7 +265,7 @@ button {
#header button:hover { #header button:hover {
opacity: 1; opacity: 1;
} }
#header #lt { #header #lt {
left: 4px; left: 4px;
text-align: left; text-align: left;
} }
@ -611,4 +619,4 @@ button {
#windows .title { #windows .title {
display: none; display: none;
} }
} }

View File

@ -1,23 +1,23 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimal-ui"> <meta name="viewport" content="width=device-width, user-scalable=no, minimal-ui">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Shout</title> <title>Shout</title>
<link rel="stylesheet" href="css/bootstrap.css"> <link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="css/style.css">
<link id="theme" rel="stylesheet" href="<%= typeof theme !== "undefined" ? theme : "" %>"> <link id="theme" rel="stylesheet" href="<%= typeof theme !== "undefined" ? theme : "" %>">
<link rel="apple-touch-icon" sizes="144x144" href="/img/apple-icon-144x144.png" /> <link rel="apple-touch-icon" sizes="144x144" href="/img/apple-icon-144x144.png" />
<link rel="shortcut icon" href="/img/favicon.png"> <link rel="shortcut icon" href="/img/favicon.png">
</head> </head>
<body> <body>
<div id="wrap"> <div id="wrap">
<div id="viewport"> <div id="viewport">
<aside id="sidebar"> <aside id="sidebar">
@ -27,8 +27,8 @@
</div> </div>
</div> </div>
<footer id="footer"> <footer id="footer">
<button class="connect" data-target="#connect" data-title="Connect"></button> <button class="connect" data-target="#connect" data-title="Connect" data-placement="top" title="Connect to network"></button>
<button class="settings" data-target="#settings" data-title="Settings"></button> <button class="settings" data-target="#settings" data-title="Settings" data-placement="top" title="Client settings"></button>
</footer> </footer>
</aside> </aside>
<div id="main"> <div id="main">
@ -36,7 +36,7 @@
<button id="lt"></button> <button id="lt"></button>
<button id="rt"></button> <button id="rt"></button>
<h1></h1> <h1></h1>
</header> </header>
<div id="windows"> <div id="windows">
<div id="chat"></div> <div id="chat"></div>
<div id="connect" class="window"> <div id="connect" class="window">
@ -147,7 +147,7 @@
</div> </div>
</div> </div>
</div> </div>
<div id="templates"> <div id="templates">
<script type="text/html" class="networks"> <script type="text/html" class="networks">
{{#each networks}} {{#each networks}}
@ -156,7 +156,7 @@
</section> </section>
{{/each}} {{/each}}
</script> </script>
<script type="text/html" class="channels"> <script type="text/html" class="channels">
{{#each channels}} {{#each channels}}
<button data-id="{{id}}" data-target="#chan-{{id}}" data-title="{{name}}" class="chan {{type}}"> <button data-id="{{id}}" data-target="#chan-{{id}}" data-title="{{name}}" class="chan {{type}}">
@ -166,7 +166,7 @@
</button> </button>
{{/each}} {{/each}}
</script> </script>
<script type="text/html" class="chat"> <script type="text/html" class="chat">
{{#each channels}} {{#each channels}}
<div id="chan-{{id}}" data-id="{{id}}" data-type="{{type}}" class="chan"> <div id="chan-{{id}}" data-id="{{id}}" data-type="{{type}}" class="chan">
@ -187,7 +187,7 @@
</div> </div>
{{/each}} {{/each}}
</script> </script>
<script type="text/html" class="users"> <script type="text/html" class="users">
{{#if users.length}} {{#if users.length}}
<div class="count"> <div class="count">
@ -200,7 +200,7 @@
{{/each}} {{/each}}
</div> </div>
</script> </script>
<script type="text/html" class="messages"> <script type="text/html" class="messages">
{{#each messages}} {{#each messages}}
<div class="msg {{type}}"> <div class="msg {{type}}">
@ -222,9 +222,9 @@
{{/each}} {{/each}}
</script> </script>
</div> </div>
<script src="js/components.min.js"></script> <script src="js/components.min.js"></script>
<script src="js/chat.js"></script> <script src="js/chat.js"></script>
</body> </body>
</html> </html>

View File

@ -27,25 +27,26 @@ $(function() {
"/voice", "/voice",
"/whois" "/whois"
]; ];
var sidebar = $("#sidebar"); var sidebar = $("#sidebar");
var chat = $("#chat"); var chat = $("#chat");
var pop = new Audio(); var pop = new Audio();
pop.src = "/audio/pop.ogg"; pop.src = "/audio/pop.ogg";
$("#play").on("click", function() { pop.play(); }); $("#play").on("click", function() { pop.play(); });
$("#footer button").tooltip();
var favico = new Favico({ var favico = new Favico({
animation: "none" animation: "none"
}); });
var tpl = []; var tpl = [];
function render(name, data) { function render(name, data) {
tpl[name] = tpl[name] || Handlebars.compile($("#templates ." + name).html()); tpl[name] = tpl[name] || Handlebars.compile($("#templates ." + name).html());
return tpl[name](data); return tpl[name](data);
} }
Handlebars.registerHelper( Handlebars.registerHelper(
"partial", function(id) { "partial", function(id) {
return new Handlebars.SafeString(render(id, this)); return new Handlebars.SafeString(render(id, this));
@ -55,13 +56,13 @@ $(function() {
socket.on("auth", function(data) { socket.on("auth", function(data) {
console.log(data); console.log(data);
}); });
socket.on("init", function(data) { socket.on("init", function(data) {
if (data.networks.length === 0) { if (data.networks.length === 0) {
$("#footer").find(".connect").trigger("click"); $("#footer").find(".connect").trigger("click");
return; return;
} }
sidebar.find(".networks").append( sidebar.find(".networks").append(
render("networks", { render("networks", {
networks: data.networks networks: data.networks
@ -75,7 +76,7 @@ $(function() {
channels: channels channels: channels
}) })
); );
var id = $.cookie("target"); var id = $.cookie("target");
var target = sidebar.find("[data-target=" + id + "]").trigger("click"); var target = sidebar.find("[data-target=" + id + "]").trigger("click");
if (target.length === 0) { if (target.length === 0) {
@ -87,7 +88,7 @@ $(function() {
} }
} }
}); });
socket.on("join", function(data) { socket.on("join", function(data) {
var id = data.network; var id = data.network;
var network = sidebar.find("#network-" + id); var network = sidebar.find("#network-" + id);
@ -105,7 +106,7 @@ $(function() {
.last() .last()
.trigger("click"); .trigger("click");
}); });
socket.on("msg", function(data) { socket.on("msg", function(data) {
var target = data.chan; var target = data.chan;
if (data.msg.type == "error") { if (data.msg.type == "error") {
@ -120,7 +121,7 @@ $(function() {
data.msg data.msg
]); ]);
}); });
socket.on("network", function(data) { socket.on("network", function(data) {
sidebar.find(".empty").hide(); sidebar.find(".empty").hide();
sidebar.find(".networks").append( sidebar.find(".networks").append(
@ -142,11 +143,11 @@ $(function() {
.find("input") .find("input")
.val(""); .val("");
}); });
socket.on("nick", function(data) { socket.on("nick", function(data) {
console.log(data); console.log(data);
}); });
socket.on("part", function(data) { socket.on("part", function(data) {
var id = data.chan; var id = data.chan;
sidebar.find("[data-target=#chan-" + id + "]") sidebar.find("[data-target=#chan-" + id + "]")
@ -156,7 +157,7 @@ $(function() {
.eq(0) .eq(0)
.trigger("click"); .trigger("click");
}); });
socket.on("quit", function(data) { socket.on("quit", function(data) {
var id = data.network; var id = data.network;
sidebar.find("#network-" + id) sidebar.find("#network-" + id)
@ -166,13 +167,13 @@ $(function() {
.eq(0) .eq(0)
.trigger("click"); .trigger("click");
}); });
socket.on("users", function(data) { socket.on("users", function(data) {
chat.find("#chan-" + data.chan) chat.find("#chan-" + data.chan)
.find(".users") .find(".users")
.html(render("users", data)); .html(render("users", data));
}); });
$.cookie.json = true; $.cookie.json = true;
var settings = $("#settings"); var settings = $("#settings");
var options = $.extend({ var options = $.extend({
@ -183,13 +184,13 @@ $(function() {
part: true, part: true,
quit: true, quit: true,
}, $.cookie("settings")); }, $.cookie("settings"));
for (var i in options) { for (var i in options) {
if (options[i]) { if (options[i]) {
settings.find("input[name=" + i + "]").prop("checked", true); settings.find("input[name=" + i + "]").prop("checked", true);
} }
} }
settings.on("change", "input", function() { settings.on("change", "input", function() {
var self = $(this); var self = $(this);
var name = self.attr("name"); var name = self.attr("name");
@ -207,7 +208,7 @@ $(function() {
}).find("input") }).find("input")
.eq(0) .eq(0)
.trigger("change"); .trigger("change");
var viewport = $("#viewport"); var viewport = $("#viewport");
$("#rt, #lt").on("click", function(e) { $("#rt, #lt").on("click", function(e) {
var self = $(this); var self = $(this);
@ -219,11 +220,11 @@ $(function() {
}); });
} }
}); });
var input = $("#input") var input = $("#input")
.history() .history()
.tab(complete, {hint: false}); .tab(complete, {hint: false});
var form = $("#form").on("submit", function(e) { var form = $("#form").on("submit", function(e) {
e.preventDefault(); e.preventDefault();
var text = input.val(); var text = input.val();
@ -233,7 +234,7 @@ $(function() {
text: text text: text
}); });
}); });
var top = 1; var top = 1;
sidebar.on("click", "button:not(.active)", function() { sidebar.on("click", "button:not(.active)", function() {
var self = $(this); var self = $(this);
@ -241,27 +242,27 @@ $(function() {
if (!target) { if (!target) {
return; return;
} }
$.cookie("target", target); $.cookie("target", target);
chat.data( chat.data(
"id", "id",
self.data("id") self.data("id")
); );
sidebar.find(".active").removeClass("active"); sidebar.find(".active").removeClass("active");
self.addClass("active") self.addClass("active")
.find(".badge") .find(".badge")
.removeClass("highlight") .removeClass("highlight")
.empty(); .empty();
if (sidebar.find(".highlight").length == 0) { if (sidebar.find(".highlight").length == 0) {
favico.badge(""); favico.badge("");
} }
$("#rt").toggle(self.hasClass("chan")); $("#rt").toggle(self.hasClass("chan"));
$("#header").find("h1").html(self.data("title")); $("#header").find("h1").html(self.data("title"));
viewport.removeClass(); viewport.removeClass();
$("#windows .active").removeClass("active"); $("#windows .active").removeClass("active");
var chan = $(target) var chan = $(target)
.css("z-index", top++) .css("z-index", top++)
@ -269,7 +270,7 @@ $(function() {
.find(".chat") .find(".chat")
.sticky(); .sticky();
}); });
sidebar.on("click", ".close", function() { sidebar.on("click", ".close", function() {
var cmd = "/close"; var cmd = "/close";
var chan = $(this).closest(".chan"); var chan = $(this).closest(".chan");
@ -294,7 +295,7 @@ $(function() {
}); });
return false; return false;
}); });
chat.on("input", ".search", function() { chat.on("input", ".search", function() {
var value = $(this).val(); var value = $(this).val();
var names = $(this).closest(".users").find(".names"); var names = $(this).closest(".users").find(".names");
@ -308,7 +309,7 @@ $(function() {
} }
}); });
}); });
chat.on("click", ".user", function() { chat.on("click", ".user", function() {
var user = $(this).html().trim().replace(/[+%@~]/, ""); var user = $(this).html().trim().replace(/[+%@~]/, "");
if (user.indexOf("#") !== -1) { if (user.indexOf("#") !== -1) {
@ -320,7 +321,7 @@ $(function() {
text: text text: text
}); });
}); });
chat.on("msg", ".messages", function(e, target, msg) { chat.on("msg", ".messages", function(e, target, msg) {
var type = msg.type; var type = msg.type;
var highlight = type.contains("highlight"); var highlight = type.contains("highlight");
@ -330,12 +331,12 @@ $(function() {
favico.badge("!"); favico.badge("!");
} }
} }
var btn = sidebar.find(".chan[data-target=" + target + "]:not(.active)"); var btn = sidebar.find(".chan[data-target=" + target + "]:not(.active)");
if (btn.length === 0) { if (btn.length === 0) {
return; return;
} }
var ignore = [ var ignore = [
"join", "join",
"part", "part",
@ -345,7 +346,7 @@ $(function() {
if ($.inArray(type, ignore) !== -1){ if ($.inArray(type, ignore) !== -1){
return; return;
} }
var badge = btn.find(".badge"); var badge = btn.find(".badge");
if (badge.length !== 0) { if (badge.length !== 0) {
var i = (parseInt(badge.html()) || 0) + 1; var i = (parseInt(badge.html()) || 0) + 1;
@ -355,7 +356,7 @@ $(function() {
} }
} }
}); });
var connect = $("#connect"); var connect = $("#connect");
connect.on("submit", "form", function(e) { connect.on("submit", "form", function(e) {
e.preventDefault(); e.preventDefault();
@ -363,19 +364,19 @@ $(function() {
.find(".btn") .find(".btn")
.attr("disabled", true) .attr("disabled", true)
.end(); .end();
var post = {}; var post = {};
var values = form.serializeArray(); var values = form.serializeArray();
$.each(values, function(i, obj) { $.each(values, function(i, obj) {
if (obj.value !== "") { if (obj.value !== "") {
post[obj.name] = obj.value; post[obj.name] = obj.value;
} }
}); });
socket.emit("conn", post); socket.emit("conn", post);
}); });
function complete(word) { function complete(word) {
var words = commands.slice(); var words = commands.slice();
var users = chat.find(".active") var users = chat.find(".active")
@ -396,7 +397,7 @@ $(function() {
} }
); );
} }
document.addEventListener( document.addEventListener(
"visibilitychange", "visibilitychange",
function() { function() {

File diff suppressed because one or more lines are too long