Commit 04247b75 by niskac

Updated to Bootstrap 1.4.0

parent b7b74aa8
.DS_Store
\ No newline at end of file
*~
.DS_Store
thumbs.db
VERSION=1.3.0
VERSION=1.4.0
DATE=$(shell DATE)
BOOTSTRAP = ./bootstrap.css
BOOTSTRAP_MIN = ./bootstrap.min.css
BOOTSTRAP_LESS = ./lib/bootstrap.less
LESS_COMPESSOR ?= `which lessc`
LESS_COMPRESSOR ?= `which lessc`
WATCHR ?= `which watchr`
build:
@@if test ! -z ${LESS_COMPESSOR}; then \
@@if test ! -z ${LESS_COMPRESSOR}; then \
sed -e 's/@VERSION/'"v${VERSION}"'/' -e 's/@DATE/'"${DATE}"'/' <${BOOTSTRAP_LESS} >${BOOTSTRAP_LESS}.tmp; \
lessc ${BOOTSTRAP_LESS}.tmp > ${BOOTSTRAP}; \
lessc ${BOOTSTRAP_LESS}.tmp > ${BOOTSTRAP_MIN} --compress; \
......
......@@ -97,19 +97,9 @@ Authors
+ http://github.com/fat
Copyright and license
License
---------------------
Copyright 2011 Twitter, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this work except in compliance with the License.
You may obtain a copy of the License in the LICENSE file, or at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
\ No newline at end of file
......@@ -6,18 +6,28 @@
.kwd, .tag { color: #195f91; }
.typ, .atn, .dec, .var { color: #CB4B16; }
.pln { color: #93a1a1; }
pre.prettyprint {
background: #fefbf3;
.prettyprint {
background-color: #fefbf3;
padding: 9px;
border: 1px solid rgba(0,0,0,.2);
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.1);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.1);
box-shadow: 0 1px 2px rgba(0,0,0,.1);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.1);
box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
/* Specify class=linenums on a pre to get line numbering */
ol.linenums { margin: 0 0 0 40px; } /* IE indents via margin-left */
ol.linenums li { color: rgba(0,0,0,.15); line-height: 20px; }
ol.linenums {
margin: 0 0 0 40px;
}
/* IE indents via margin-left */
ol.linenums li {
padding: 0 5px;
color: rgba(0,0,0,.15);
line-height: 20px;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
}
/* Alternate shading for lines */
li.L1, li.L3, li.L5, li.L7, li.L9 { }
......@@ -38,4 +48,47 @@ $violet: #6c71c4;
$blue: #268bd2;
$cyan: #2aa198;
$green: #859900;
*/
\ No newline at end of file
*/
/*
#1d1f21 Background
#282a2e Current Line
#373b41 Selection
#c5c8c6 Foreground
#969896 Comment
#cc6666 Red
#de935f Orange
#f0c674 Yellow
#b5bd68 Green
#8abeb7 Aqua
#81a2be Blue
#b294bb Purple
*/
/* DARK THEME */
/* ---------- */
.prettyprint-dark {
background-color: #1d1f21;
border: 0;
padding: 10px;
}
.prettyprint-dark .linenums li {
color: #444;
}
.prettyprint-dark .linenums li:hover {
background-color: #282a2e;
}
/* tags in html */
.prettyprint-dark .kwd,
.prettyprint-dark .tag { color: #cc6666; }
/* html attr */
.prettyprint-dark .typ,
.prettyprint-dark .atn,
.prettyprint-dark .dec,
.prettyprint-dark .var { color: #de935f; }
/* html attr values */
.prettyprint-dark .str,
.prettyprint-dark .atv { color: #b5bd68; }
......@@ -29,7 +29,7 @@
}
/* The white background content wrapper */
.content {
.container > .content {
background-color: #fff;
padding: 20px;
margin: 0 -20px; /* negative indent the amount of the padding to maintain the grid system */
......
......@@ -75,7 +75,6 @@
<p>Vestibulum id ligula porta felis euismod semper. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.</p>
<p><a class="btn primary large">Learn more &raquo;</a></p>
</div>
<!-- Example row of columns -->
<div class="row">
<div class="span6">
......@@ -94,9 +93,7 @@
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
</div>
<hr>
<!-- Example row of columns -->
<div class="row">
<div class="span6">
......@@ -115,7 +112,6 @@
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
</div>
<footer>
<p>&copy; Company 2011</p>
</footer>
......
......@@ -52,17 +52,17 @@
<!-- Example row of columns -->
<div class="row">
<div class="span6">
<div class="span-one-third">
<h2>Heading</h2>
<p>Etiam porta sem malesuada magna mollis euismod. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.</p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
<div class="span5">
<div class="span-one-third">
<h2>Heading</h2>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div>
<div class="span5">
<div class="span-one-third">
<h2>Heading</h2>
<p>Donec sed odio dui. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
<p><a class="btn" href="#">View details &raquo;</a></p>
......
/* ==========================================================
* bootstrap-alerts.js v1.3.0
* bootstrap-alerts.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#alerts
* ==========================================================
* Copyright 2011 Twitter, Inc.
......@@ -20,6 +20,8 @@
!function( $ ){
"use strict"
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
* ======================================================= */
......@@ -38,11 +40,11 @@
if ( $.support.transition ) {
transitionEnd = "TransitionEnd"
if ( $.browser.webkit ) {
transitionEnd = "webkitTransitionEnd"
transitionEnd = "webkitTransitionEnd"
} else if ( $.browser.mozilla ) {
transitionEnd = "transitionend"
transitionEnd = "transitionend"
} else if ( $.browser.opera ) {
transitionEnd = "oTransitionEnd"
transitionEnd = "oTransitionEnd"
}
}
......@@ -51,9 +53,10 @@
/* ALERT CLASS DEFINITION
* ====================== */
var Alert = function ( content, selector ) {
var Alert = function ( content, options ) {
this.settings = $.extend({}, $.fn.alert.defaults, options)
this.$element = $(content)
.delegate(selector || '.close', 'click', this.close)
.delegate(this.settings.selector, 'click', this.close)
}
Alert.prototype = {
......@@ -92,13 +95,19 @@
return $this.data('alert')[options]()
}
$(this).data('alert', new Alert( this ))
$(this).data('alert', new Alert( this, options ))
})
}
$.fn.alert.defaults = {
selector: '.close'
}
$(document).ready(function () {
new Alert($('body'), '.alert-message[data-alert] .close')
new Alert($('body'), {
selector: '.alert-message[data-alert] .close'
})
})
}( window.jQuery || window.ender )
\ No newline at end of file
}( window.jQuery || window.ender );
\ No newline at end of file
/* ============================================================
* bootstrap-buttons.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#buttons
* ============================================================
* Copyright 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============================================================ */
!function( $ ){
"use strict"
function setState(el, state) {
var d = 'disabled'
, $el = $(el)
, data = $el.data()
state = state + 'Text'
data.resetText || $el.data('resetText', $el.html())
$el.html( data[state] || $.fn.button.defaults[state] )
state == 'loadingText' ?
$el.addClass(d).attr(d, d) :
$el.removeClass(d).removeAttr(d)
}
function toggle(el) {
$(el).toggleClass('active')
}
$.fn.button = function(options) {
return this.each(function () {
if (options == 'toggle') {
return toggle(this)
}
options && setState(this, options)
})
}
$.fn.button.defaults = {
loadingText: 'loading...'
}
$(function () {
$('body').delegate('.btn[data-toggle]', 'click', function () {
$(this).button('toggle')
})
})
}( window.jQuery || window.ender );
\ No newline at end of file
/* ============================================================
* bootstrap-dropdown.js v1.3.0
* bootstrap-dropdown.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#dropdown
* ============================================================
* Copyright 2011 Twitter, Inc.
......@@ -20,16 +20,7 @@
!function( $ ){
var d = 'a.menu, .dropdown-toggle'
function clearMenus() {
$(d).parent('li').removeClass('open')
}
$(function () {
$('html').bind("click", clearMenus)
$('body').dropdown( '[data-dropdown] a.menu, [data-dropdown] .dropdown-toggle' )
})
"use strict"
/* DROPDOWN PLUGIN DEFINITION
* ========================== */
......@@ -47,4 +38,18 @@
})
}
}( window.jQuery || window.ender )
\ No newline at end of file
/* APPLY TO STANDARD DROPDOWN ELEMENTS
* =================================== */
var d = 'a.menu, .dropdown-toggle'
function clearMenus() {
$(d).parent('li').removeClass('open')
}
$(function () {
$('html').bind("click", clearMenus)
$('body').dropdown( '[data-dropdown] a.menu, [data-dropdown] .dropdown-toggle' )
})
}( window.jQuery || window.ender );
/* =========================================================
* bootstrap-modal.js v1.3.0
* bootstrap-modal.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#modal
* =========================================================
* Copyright 2011 Twitter, Inc.
......@@ -20,6 +20,8 @@
!function( $ ){
"use strict"
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
* ======================================================= */
......@@ -53,16 +55,12 @@
* ============================= */
var Modal = function ( content, options ) {
this.settings = $.extend({}, $.fn.modal.defaults)
this.settings = $.extend({}, $.fn.modal.defaults, options)
this.$element = $(content)
.delegate('.close', 'click.modal', $.proxy(this.hide, this))
if ( options ) {
$.extend( this.settings, options )
if ( options.show ) {
this.show()
}
if ( this.settings.show ) {
this.show()
}
return this
......@@ -81,17 +79,22 @@
escape.call(this)
backdrop.call(this, function () {
var transition = $.support.transition && that.$element.hasClass('fade')
that.$element
.appendTo(document.body)
.show()
if ($.support.transition && that.$element.hasClass('fade')) {
that.$backdrop[0].offsetWidth // force reflow
if (transition) {
that.$element[0].offsetWidth // force reflow
}
that.$element
.addClass('in')
.trigger('shown')
that.$element.addClass('in')
transition ?
that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) :
that.$element.trigger('shown')
})
return this
......@@ -100,6 +103,10 @@
, hide: function (e) {
e && e.preventDefault()
if ( !this.isShown ) {
return this
}
var that = this
this.isShown = false
......@@ -109,17 +116,9 @@
.trigger('hide')
.removeClass('in')
function removeElement () {
that.$element
.hide()
.trigger('hidden')
backdrop.call(that)
}
$.support.transition && this.$element.hasClass('fade') ?
this.$element.one(transitionEnd, removeElement) :
removeElement()
hideWithTransition.call(this) :
hideModal.call(this)
return this
}
......@@ -130,6 +129,28 @@
/* MODAL PRIVATE METHODS
* ===================== */
function hideWithTransition() {
// firefox drops transitionEnd events :{o
var that = this
, timeout = setTimeout(function () {
that.$element.unbind(transitionEnd)
hideModal.call(that)
}, 500)
this.$element.one(transitionEnd, function () {
clearTimeout(timeout)
hideModal.call(that)
})
}
function hideModal (that) {
this.$element
.hide()
.trigger('hidden')
backdrop.call(this)
}
function backdrop ( callback ) {
var that = this
, animate = this.$element.hasClass('fade') ? 'fade' : ''
......@@ -144,31 +165,32 @@
}
if ( doAnimate ) {
that.$backdrop[0].offsetWidth // force reflow
this.$backdrop[0].offsetWidth // force reflow
}
that.$backdrop && that.$backdrop.addClass('in')
this.$backdrop.addClass('in')
doAnimate ?
that.$backdrop.one(transitionEnd, callback) :
this.$backdrop.one(transitionEnd, callback) :
callback()
} else if ( !this.isShown && this.$backdrop ) {
this.$backdrop.removeClass('in')
function removeElement() {
that.$backdrop.remove()
that.$backdrop = null
}
$.support.transition && this.$element.hasClass('fade')?
this.$backdrop.one(transitionEnd, removeElement) :
removeElement()
this.$backdrop.one(transitionEnd, $.proxy(removeBackdrop, this)) :
removeBackdrop.call(this)
} else if ( callback ) {
callback()
}
}
function removeBackdrop() {
this.$backdrop.remove()
this.$backdrop = null
}
function escape() {
var that = this
if ( this.isShown && this.settings.keyboard ) {
......@@ -220,7 +242,7 @@
$.fn.modal.defaults = {
backdrop: false
, keyboard: false
, show: true
, show: false
}
......@@ -235,4 +257,4 @@
})
})
}( window.jQuery || window.ender )
\ No newline at end of file
}( window.jQuery || window.ender );
/* ===========================================================
* bootstrap-popover.js v1.3.0
* bootstrap-popover.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#popover
* ===========================================================
* Copyright 2011 Twitter, Inc.
......@@ -20,6 +20,8 @@
!function( $ ) {
"use strict"
var Popover = function ( element, options ) {
this.$element = $(element)
this.options = options
......@@ -35,27 +37,32 @@
setContent: function () {
var $tip = this.tip()
$tip.find('.title')[this.options.html ? 'html' : 'text'](this.getTitle())
$tip.find('.content p')[this.options.html ? 'html' : 'text'](this.getContent())
$tip.find('.content > *')[this.options.html ? 'html' : 'text'](this.getContent())
$tip[0].className = 'popover'
}
, hasContent: function () {
return this.getTitle() || this.getContent()
}
, getContent: function () {
var contentvar
var content
, $e = this.$element
, o = this.options
if (typeof this.options.content == 'string') {
content = $e.attr(o.content)
content = $e.attr(this.options.content)
} else if (typeof this.options.content == 'function') {
content = this.options.content.call(this.$element[0])
}
return content
}
, tip: function() {
if (!this.$tip) {
this.$tip = $('<div class="popover" />')
.html('<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>')
.html(this.options.template)
}
return this.$tip
}
......@@ -72,6 +79,12 @@
return this
}
$.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { content: 'data-content', placement: 'right'})
$.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, {
placement: 'right'
, content: 'data-content'
, template: '<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>'
})
$.fn.twipsy.rejectAttrOptions.push( 'content' )
}( window.jQuery || window.ender )
\ No newline at end of file
}( window.jQuery || window.ender );
/* =============================================================
* bootstrap-scrollspy.js v1.3.0
* bootstrap-scrollspy.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#scrollspy
* =============================================================
* Copyright 2011 Twitter, Inc.
......@@ -20,6 +20,8 @@
!function ( $ ) {
"use strict"
var $window = $(window)
function ScrollSpy( topbar, selector ) {
......@@ -102,4 +104,4 @@
$('body').scrollSpy('[data-scrollspy] li > a')
})
}( window.jQuery || window.ender )
\ No newline at end of file
}( window.jQuery || window.ender );
\ No newline at end of file
/* ========================================================
* bootstrap-tabs.js v1.3.0
* bootstrap-tabs.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#tabs
* ========================================================
* Copyright 2011 Twitter, Inc.
......@@ -20,28 +20,46 @@
!function( $ ){
"use strict"
function activate ( element, container ) {
container.find('.active').removeClass('active')
container
.find('> .active')
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
element.addClass('active')
if ( element.parent('.dropdown-menu') ) {
element.closest('li.dropdown').addClass('active')
}
}
function tab( e ) {
var $this = $(this)
, $ul = $this.closest('ul:not(.dropdown-menu)')
, href = $this.attr('href')
, $ul = $this.closest('ul')
, $controlled
, previous
, $href
if (/^#\w+/.test(href)) {
if ( /^#\w+/.test(href) ) {
e.preventDefault()
if ($this.hasClass('active')) {
if ( $this.parent('li').hasClass('active') ) {
return
}
previous = $ul.find('.active a').last()[0]
$href = $(href)
activate($this.parent('li'), $ul)
activate($href, $href.parent())
$this.trigger({
type: 'change'
, relatedTarget: previous
})
}
}
......@@ -59,4 +77,4 @@
$('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a')
})
}( window.jQuery || window.ender )
\ No newline at end of file
}( window.jQuery || window.ender );
/* ==========================================================
* bootstrap-twipsy.js v1.3.0
* bootstrap-twipsy.js v1.4.0
* http://twitter.github.com/bootstrap/javascript.html#twipsy
* Adapted from the original jQuery.tipsy by Jason Frame
* ==========================================================
......@@ -21,6 +21,8 @@
!function( $ ) {
"use strict"
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
* ======================================================= */
......@@ -70,7 +72,7 @@
, $tip
, tp
if (this.getTitle() && this.enabled) {
if (this.hasContent() && this.enabled) {
$tip = this.tip()
this.setContent()
......@@ -90,7 +92,8 @@
actualWidth = $tip[0].offsetWidth
actualHeight = $tip[0].offsetHeight
placement = _.maybeCall(this.options.placement, this.$element[0])
placement = maybeCall(this.options.placement, this, [ $tip[0], this.$element[0] ])
switch (placement) {
case 'below':
......@@ -142,6 +145,10 @@
}
}
, hasContent: function () {
return this.getTitle()
}
, getTitle: function() {
var title
, $e = this.$element
......@@ -161,10 +168,7 @@
}
, tip: function() {
if (!this.$tip) {
this.$tip = $('<div class="twipsy" />').html('<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>')
}
return this.$tip
return this.$tip = this.$tip || $('<div class="twipsy" />').html(this.options.template)
}
, validate: function() {
......@@ -187,21 +191,20 @@
this.enabled = !this.enabled
}
, toggle: function () {
this[this.tip().hasClass('in') ? 'hide' : 'show']()
}
}
/* TWIPSY PRIVATE METHODS
* ====================== */
var _ = {
maybeCall: function ( thing, ctx ) {
return (typeof thing == 'function') ? (thing.call(ctx)) : thing
}
function maybeCall ( thing, ctx, args ) {
return typeof thing == 'function' ? thing.apply(ctx, args) : thing
}
/* TWIPSY PLUGIN DEFINITION
* ======================== */
......@@ -298,10 +301,21 @@
, offset: 0
, title: 'title'
, trigger: 'hover'
, template: '<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>'
}
$.fn.twipsy.rejectAttrOptions = [ 'title' ]
$.fn.twipsy.elementOptions = function(ele, options) {
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options
var data = $(ele).data()
, rejects = $.fn.twipsy.rejectAttrOptions
, i = rejects.length
while (i--) {
delete data[rejects[i]]
}
return $.extend({}, options, data)
}
}( window.jQuery || window.ender )
\ No newline at end of file
}( window.jQuery || window.ender );
\ No newline at end of file
......@@ -4,7 +4,7 @@
<title>Bootstrap Plugin Test Suite</title>
<!-- jquery -->
<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<!-- qunit -->
<link rel="stylesheet" href="vendor/qunit.css" type="text/css" media="screen" />
......@@ -17,6 +17,7 @@
<script src="../../js/bootstrap-tabs.js"></script>
<script src="../../js/bootstrap-twipsy.js"></script>
<script src="../../js/bootstrap-popover.js"></script>
<script src="../../js/bootstrap-buttons.js"></script>
<!-- unit tests -->
<script src="unit/bootstrap-alerts.js"></script>
......@@ -25,6 +26,7 @@
<script src="unit/bootstrap-popover.js"></script>
<script src="unit/bootstrap-tabs.js"></script>
<script src="unit/bootstrap-twipsy.js"></script>
<script src="unit/bootstrap-buttons.js"></script>
<body>
<div>
......
$(function () {
module("bootstrap-buttons")
test("should be defined on jquery object", function () {
ok($(document.body).button, 'tabs method is defined')
})
test("should return element", function () {
ok($(document.body).button()[0] == document.body, 'document.body returned')
})
test("should return set state to loading", function () {
var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
equals(btn.html(), 'mdo', 'btn text equals mdo')
btn.button('loading')
equals(btn.html(), 'fat', 'btn text equals fat')
ok(btn.attr('disabled'), 'btn is disabled')
ok(btn.hasClass('disabled'), 'btn has disabled class')
})
test("should return reset state", function () {
var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
equals(btn.html(), 'mdo', 'btn text equals mdo')
btn.button('loading')
equals(btn.html(), 'fat', 'btn text equals fat')
ok(btn.attr('disabled'), 'btn is disabled')
ok(btn.hasClass('disabled'), 'btn is disabled')
btn.button('reset')
equals(btn.html(), 'mdo', 'btn text equals mdo')
ok(!btn.attr('disabled'), 'btn is not disabled')
ok(!btn.hasClass('disabled'), 'btn does not have disabled class')
})
test("should toggle active", function () {
var btn = $('<button class="btn" data-loading-text="fat">mdo</button>')
ok(!btn.hasClass('active'), 'btn does not have active class')
btn.button('toggle')
ok(btn.hasClass('active'), 'btn has class active')
})
})
\ No newline at end of file
......@@ -73,4 +73,4 @@ $(function () {
$('#qunit-runoff').empty()
})
})
\ No newline at end of file
})
......@@ -11,39 +11,67 @@ $(function () {
})
test("should activate element by tab id", function () {
var tabsHTML = '<ul class="tabs">'
var $tabsHTML = $('<ul class="tabs">'
+ '<li class="active"><a href="#home">Home</a></li>'
+ '<li><a href="#profile">Profile</a></li>'
+ '</ul>'
+ '</ul>')
$('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-runoff")
$(tabsHTML).tabs().find('a').last().click()
$tabsHTML.tabs().find('a').last().click()
equals($("#qunit-runoff").find('.active').attr('id'), "profile")
$(tabsHTML).tabs().find('a').first().click()
$tabsHTML.tabs().find('a').first().click()
equals($("#qunit-runoff").find('.active').attr('id'), "home")
$("#qunit-runoff").empty()
})
test("should activate element by pill id", function () {
var pillsHTML = '<ul class="pills">'
var $pillsHTML = $('<ul class="pills">'
+ '<li class="active"><a href="#home">Home</a></li>'
+ '<li><a href="#profile">Profile</a></li>'
+ '</ul>'
+ '</ul>')
$('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-runoff")
$(pillsHTML).pills().find('a').last().click()
$pillsHTML.pills().find('a').last().click()
equals($("#qunit-runoff").find('.active').attr('id'), "profile")
$(pillsHTML).pills().find('a').first().click()
$pillsHTML.pills().find('a').first().click()
equals($("#qunit-runoff").find('.active').attr('id'), "home")
$("#qunit-runoff").empty()
})
test( "should trigger change event on activate", function () {
var $tabsHTML = $('<ul class="tabs">'
+ '<li class="active"><a href="#home">Home</a></li>'
+ '<li><a href="#profile">Profile</a></li>'
+ '</ul>')
, $target
, count = 0
, relatedTarget
, target
$tabsHTML
.tabs()
.bind( "change", function (e) {
target = e.target
relatedTarget = e.relatedTarget
count++
})
$target = $tabsHTML
.find('a')
.last()
.click()
equals(relatedTarget, $tabsHTML.find('a').first()[0])
equals(target, $target[0])
equals(count, 1)
})
})
\ No newline at end of file
// Forms.less
// Base styles for various input types, form layouts, and states
// -------------------------------------------------------------
/* Forms.less
* Base styles for various input types, form layouts, and states
* ------------------------------------------------------------- */
// FORM STYLES
......@@ -77,7 +77,12 @@ select,
.border-radius(3px);
}
/* mini reset for non-html5 file types */
// remove padding from select
select {
padding: initial;
}
// mini reset for non-html5 file types
input[type=checkbox],
input[type=radio] {
width: auto;
......@@ -107,6 +112,7 @@ input[type=submit] {
select,
input[type=file] {
height: @baseline * 1.5; // In IE7, the height of the select element cannot be changed by height, only font-size
*height: auto; // Reset for IE7
line-height: @baseline * 1.5;
*margin-top: 4px; /* For IE7, add top margin to align select with labels */
}
......@@ -114,6 +120,7 @@ input[type=file] {
// Make multiple select elements height not fixed
select[multiple] {
height: inherit;
background-color: @white; // Fixes Chromium bug of unreadable items
}
textarea {
......@@ -158,36 +165,49 @@ select:focus {
outline: 1px dotted #666; // Selet elements don't get box-shadow styles, so instead we do outline
}
// Error styles
form div.clearfix.error {
background: lighten(@red, 57%);
padding: 10px 0;
margin: -10px 0 10px;
.border-radius(4px);
@error-text: desaturate(lighten(@red, 25%), 25%);
// FORM FIELD FEEDBACK STATES
// --------------------------
// Mixin for form field states
.formFieldState(@textColor: #555, @borderColor: #ccc, @backgroundColor: #f5f5f5) {
// Set the text color
> label,
span.help-inline,
span.help-block {
color: @red;
.help-block,
.help-inline {
color: @textColor;
}
// Style inputs accordingly
input,
textarea {
border-color: @error-text;
.box-shadow(0 0 3px rgba(171,41,32,.25));
color: @textColor;
border-color: @borderColor;
&:focus {
border-color: darken(@error-text, 10%);
.box-shadow(0 0 6px rgba(171,41,32,.5));
border-color: darken(@borderColor, 10%);
.box-shadow(0 0 6px lighten(@borderColor, 20%));
}
}
.input-prepend,
.input-append {
span.add-on {
background: lighten(@red, 50%);
border-color: @error-text;
color: darken(@error-text, 10%);
}
// Give a small background color for input-prepend/-append
.input-prepend .add-on,
.input-append .add-on {
color: @textColor;
background-color: @backgroundColor;
border-color: @textColor;
}
}
// Error
form .clearfix.error {
.formFieldState(#b94a48, #ee5f5b, lighten(#ee5f5b, 30%));
}
// Warning
form .clearfix.warning {
.formFieldState(#c09853, #ccae64, lighten(#CCAE64, 5%));
}
// Success
form .clearfix.success {
.formFieldState(#468847, #57a957, lighten(#57a957, 30%));
}
// Form element sizes
// TODO v2: remove duplication here and just stick to .input-[size] in light of adding .spanN sizes
......@@ -236,12 +256,11 @@ textarea.xxlarge {
.formColumns(@columnSpan: 1) {
display: inline-block;
float: none;
width: ((@gridColumnWidth - 10) * @columnSpan) + ((@gridColumnWidth - 10) * (@columnSpan - 1));
width: ((@gridColumnWidth) * @columnSpan) + (@gridGutterWidth * (@columnSpan - 1)) - 10;
margin-left: 0;
}
input,
textarea,
select {
textarea {
// Default columns
&.span1 { .formColumns(1); }
&.span2 { .formColumns(2); }
......@@ -293,9 +312,10 @@ textarea[readonly] {
}
// Help Text
// TODO: Do we need to set basefont and baseline here?
.help-inline,
.help-block {
font-size: @basefont - 2;
font-size: @basefont;
line-height: @baseline;
color: @grayLight;
}
......@@ -314,15 +334,6 @@ textarea[readonly] {
// Inline Fields (input fields that appear as inline objects
.inline-inputs {
color: @gray;
span, input {
display: inline-block;
}
input.mini {
width: 60px;
}
input.small {
width: 90px;
}
span {
padding: 0 2px 0 1px;
}
......@@ -389,6 +400,7 @@ textarea[readonly] {
float: none;
width: auto;
padding: 0;
margin-left: 20px;
line-height: @baseline;
text-align: left;
white-space: normal;
......@@ -414,6 +426,8 @@ textarea[readonly] {
input[type=radio],
input[type=checkbox] {
margin-bottom: 0;
margin-left: -20px;
float: left;
}
}
......
// Variables.less
// Snippets of reusable CSS to develop faster and keep code readable
// -----------------------------------------------------------------
/* Mixins.less
* Snippets of reusable CSS to develop faster and keep code readable
* ----------------------------------------------------------------- */
// Clearfix for clearing floats like a boss h5bp.com/q
.clearfix() {
zoom: 1;
&:before,
&:before,
&:after {
display: table;
content: "";
zoom: 1;
*display: inline;
}
&:after {
}
&:after {
clear: both;
}
}
}
// Center-align a block level element
.center-block() {
display: block;
display: block;
margin-left: auto;
margin-right: auto;
}
// Sizing shortcuts
.size(@height: 5px, @width: 5px) {
height: @height;
width: @width;
height: @height;
width: @width;
}
.square(@size: 5px) {
.size(@size, @size);
.size(@size, @size);
}
// Input placeholder text
......@@ -112,39 +111,45 @@
// Transitions
.transition(@transition) {
-webkit-transition: @transition;
-moz-transition: @transition;
-ms-transition: @transition;
-o-transition: @transition;
transition: @transition;
-webkit-transition: @transition;
-moz-transition: @transition;
-ms-transition: @transition;
-o-transition: @transition;
transition: @transition;
}
// Background clipping
.background-clip(@clip) {
-webkit-background-clip: @clip;
-moz-background-clip: @clip;
background-clip: @clip;
-webkit-background-clip: @clip;
-moz-background-clip: @clip;
background-clip: @clip;
}
// CSS3 Content Columns
.content-columns(@columnCount, @columnGap: 20px) {
-webkit-column-count: @columnCount;
-moz-column-count: @columnCount;
-webkit-column-count: @columnCount;
-moz-column-count: @columnCount;
column-count: @columnCount;
-webkit-column-gap: @columnGap;
-moz-column-gap: @columnGap;
-moz-column-gap: @columnGap;
column-gap: @columnGap;
}
// Make any element resizable for prototyping
.resizable(@direction: both) {
resize: @direction; // Options are horizontal, vertical, both
overflow: auto; // Safari fix
}
// Add an alphatransparency value to any background or border color (via Elyse Holladay)
#translucent {
.background(@color: @white, @alpha: 1) {
background-color: hsla(hue(@color), saturation(@color), lightness(@color), @alpha);
}
.border(@color: @white, @alpha: 1) {
border-color: hsla(hue(@color), saturation(@color), lightness(@color), @alpha);
background-clip: padding-box;
}
}
.border(@color: @white, @alpha: 1) {
border-color: hsla(hue(@color), saturation(@color), lightness(@color), @alpha);
background-clip: padding-box;
}
}
// Gradient Bar Colors for buttons and allerts
......@@ -210,8 +215,8 @@
// Opacity
.opacity(@opacity: 100) {
filter: e(%("alpha(opacity=%d)", @opacity));
-khtml-opacity: @opacity / 100;
-moz-opacity: @opacity / 100;
opacity: @opacity / 100;
filter: e(%("alpha(opacity=%d)", @opacity));
-khtml-opacity: @opacity / 100;
-moz-opacity: @opacity / 100;
opacity: @opacity / 100;
}
\ No newline at end of file
// Patterns.less
// Repeatable UI elements outside the base styles provided from the scaffolding
// ----------------------------------------------------------------------------
/* Patterns.less
* Repeatable UI elements outside the base styles provided from the scaffolding
* ---------------------------------------------------------------------------- */
// TOPBAR
......@@ -25,7 +25,7 @@
// Hover and active states
// h3 for backwards compatibility
h3 a:hover,
.brand a:hover,
.brand:hover,
ul .active > a {
background-color: #333;
background-color: rgba(255,255,255,.05);
......@@ -278,7 +278,8 @@ a.menu:after,
}
}
.topbar .dropdown-menu, .dropdown-menu {
.topbar .dropdown-menu,
.dropdown-menu {
// Links within the dropdown menu
a {
display: block;
......@@ -289,7 +290,8 @@ a.menu:after,
color: @gray;
text-shadow: 0 1px 0 @white;
// Hover state
&:hover {
&:hover,
&.hover {
#gradient > .vertical(#eeeeee, #dddddd);
color: @grayDark;
text-decoration: none;
......@@ -318,10 +320,13 @@ a.menu:after,
}
// Tabs and Pills
// TABS AND PILLS
// --------------
// Common styles
.tabs,
.pills {
margin: 0 0 20px;
margin: 0 0 @baseline;
padding: 0;
list-style: none;
.clearfix();
......@@ -333,18 +338,18 @@ a.menu:after,
}
}
// Basic Tabs
// Tabs
.tabs {
float: left;
width: 100%;
border-bottom: 1px solid #ddd;
border-color: #ddd;
border-style: solid;
border-width: 0 0 1px;
> li {
position: relative; // For the dropdowns mostly
top: 1px;
margin-bottom: -1px;
> a {
padding: 0 15px;
margin-right: 2px;
line-height: @baseline * 2;
line-height: (@baseline * 2) - 2;
border: 1px solid transparent;
.border-radius(4px 4px 0 0);
&:hover {
......@@ -353,13 +358,20 @@ a.menu:after,
border-color: #eee #eee #ddd;
}
}
&.active > a {
color: @gray;
background-color: @white;
border: 1px solid #ddd;
border-bottom-color: transparent;
}
}
// Active state, and it's :hover to override normal :hover
.active > a,
.active > a:hover {
color: @gray;
background-color: @white;
border: 1px solid #ddd;
border-bottom-color: transparent;
cursor: default;
}
}
// Dropdowns in tabs
.tabs {
// first one for backwards compatibility
.menu-dropdown,
.dropdown-menu {
......@@ -385,40 +397,47 @@ a.menu:after,
border-top-color: #555;
}
}
.tab-content {
clear: both;
}
// Basic pill nav
// Pills
.pills {
a {
margin: 5px 3px 5px 0;
margin: 5px 3px 5px 0;
padding: 0 15px;
text-shadow: 0 1px 1px @white;
line-height: 30px;
text-shadow: 0 1px 1px @white;
.border-radius(15px);
&:hover {
background: @linkColorHover;
color: @white;
text-decoration: none;
text-shadow: 0 1px 1px rgba(0,0,0,.25);
background-color: @linkColorHover;
}
}
.active a {
background: @linkColor;
color: @white;
text-shadow: 0 1px 1px rgba(0,0,0,.25);
background-color: @linkColor;
}
}
.tab-content > *,
.pill-content > * {
display: none;
// Stacked pills
.pills-vertical > li {
float: none;
}
// Tabbable areas
.tab-content,
.pill-content {
}
.tab-content > .tab-pane,
.pill-content > .pill-pane,
.tab-content > div,
.pill-content > div {
display: none;
}
.tab-content > .active,
.pill-content > .active {
display:block;
display: block;
}
......@@ -426,8 +445,8 @@ a.menu:after,
// -----------
.breadcrumb {
margin: 0 0 @baseline;
padding: 7px 14px;
margin: 0 0 @baseline;
#gradient > .vertical(#ffffff, #f5f5f5);
border: 1px solid #ddd;
.border-radius(3px);
......@@ -440,8 +459,6 @@ a.menu:after,
padding: 0 5px;
color: @grayLight;
}
a {
}
.active a {
color: @grayDark;
}
......@@ -505,6 +522,11 @@ footer {
&.info:hover {
color: @white
}
// Sets the close button to the middle of message
.close{
font-family: Arial, sans-serif;
line-height: 18px;
}
// Danger and error appear as red
&.danger,
&.error {
......@@ -558,6 +580,7 @@ footer {
.transition(.1s linear all);
// Active and Disabled states
&.active,
&:active {
@shadow: inset 0 2px 4px rgba(0,0,0,.25), 0 1px 2px rgba(0,0,0,.05);
.box-shadow(@shadow);
......@@ -616,7 +639,7 @@ input[type=submit].btn {
font-weight: bold;
line-height: @baseline * .75;
text-shadow: 0 1px 0 rgba(255,255,255,1);
.opacity(20);
.opacity(25);
&:hover {
color: @black;
text-decoration: none;
......@@ -643,7 +666,20 @@ input[type=submit].btn {
// Adjust close icon
.close {
*margin-top: 3px; /* IE7 spacing */
margin-top: 1px;
*margin-top: 0; // For IE7
}
// Make links same color as text and stand out more
a {
font-weight: bold;
color: @grayDark;
}
&.danger p a,
&.error p a,
&.success p a,
&.info p a {
color: @white;
}
// Remove extra margin from content
......@@ -700,6 +736,14 @@ input[type=submit].btn {
background-color: lighten(#6bd0ee, 25%);
border-color: lighten(#6bd0ee, 20%);
}
// Change link color back
&.danger p a,
&.error p a,
&.success p a,
&.info p a {
color: @grayDark;
}
}
}
......@@ -780,7 +824,8 @@ input[type=submit].btn {
&.fade { opacity: 0; }
}
.modal-backdrop, .modal-backdrop.fade.in {
.modal-backdrop,
.modal-backdrop.fade.in {
.opacity(80);
}
......@@ -790,7 +835,7 @@ input[type=submit].btn {
left: 50%;
z-index: 11000;
width: 560px;
margin: -250px 0 0 -250px;
margin: -250px 0 0 -280px;
background-color: @white;
border: 1px solid #999;
border: 1px solid rgba(0,0,0,.3);
......@@ -812,6 +857,9 @@ input[type=submit].btn {
.modal-body {
padding: 15px;
}
.modal-body form {
margin-bottom: 0;
}
.modal-footer {
background-color: #f5f5f5;
padding: 14px 15px 15px;
......@@ -826,6 +874,12 @@ input[type=submit].btn {
}
}
// Fix the stacking of these components when in modals
.modal .popover,
.modal .twipsy {
z-index: 12000;
}
// POPOVER ARROWS
// --------------
......@@ -920,8 +974,8 @@ input[type=submit].btn {
height: 0;
}
.inner {
background-color: @black;
background-color: rgba(0,0,0,.8);
background: @black;
background: rgba(0,0,0,.8);
padding: 3px;
overflow: hidden;
width: 280px;
......@@ -964,11 +1018,12 @@ input[type=submit].btn {
.label {
padding: 1px 3px 2px;
background-color: @grayLight;
font-size: @basefont * .75;
font-weight: bold;
color: @white;
text-transform: uppercase;
white-space: nowrap;
background-color: @grayLight;
.border-radius(3px);
&.important { background-color: #c43c35; }
&.warning { background-color: @orange; }
......@@ -981,7 +1036,7 @@ input[type=submit].btn {
// -----------
.media-grid {
margin-left: -20px;
margin-left: -@gridGutterWidth;
margin-bottom: 0;
.clearfix();
li {
......@@ -990,7 +1045,7 @@ input[type=submit].btn {
a {
float: left;
padding: 4px;
margin: 0 0 20px 20px;
margin: 0 0 @baseline @gridGutterWidth;
border: 1px solid #ddd;
.border-radius(4px);
.box-shadow(0 1px 1px rgba(0,0,0,.075));
......
// Reset.less
// Props to Eric Meyer (meyerweb.com) for his CSS reset file. We're using an adapted version here that cuts out some of the reset HTML elements we will never need here (i.e., dfn, samp, etc).
// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/* Reset.less
* Props to Eric Meyer (meyerweb.com) for his CSS reset file. We're using an adapted version here that cuts out some of the reset HTML elements we will never need here (i.e., dfn, samp, etc).
* ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
// ERIC MEYER RESET
......
// Scaffolding
// Basic and global styles for generating a grid system, structural layout, and page templates
// -------------------------------------------------------------------------------------------
/*
* Scaffolding
* Basic and global styles for generating a grid system, structural layout, and page templates
* ------------------------------------------------------------------------------------------- */
// STRUCTURAL LAYOUT
// -----------------
html, body {
background-color: @white;
}
body {
background-color: @white;
margin: 0;
#font > .sans-serif(normal,@basefont,@baseline);
color: @grayDark;
......@@ -28,7 +27,9 @@ body {
padding-right: 20px;
.clearfix();
> .sidebar {
float: left;
position: absolute;
top: 0;
left: 20px;
width: 220px;
}
// TODO in v2: rename this and .popover .content to be more specific
......@@ -76,12 +77,12 @@ a {
.row {
.clearfix();
margin-left: -1 * @gridGutterWidth;
margin-left: -@gridGutterWidth;
}
// Find all .span# classes within .row and give them the necessary properties for grid columns (supported by all browsers back to IE7)
// Credit to @dhg for the idea
[class*="span"] {
.row > [class*="span"] {
.gridColumn();
}
......@@ -114,21 +115,25 @@ a {
.span24 { .columns(24); }
// Offset column options
.offset1 { .offset(1); }
.offset2 { .offset(2); }
.offset3 { .offset(3); }
.offset4 { .offset(4); }
.offset5 { .offset(5); }
.offset6 { .offset(6); }
.offset7 { .offset(7); }
.offset8 { .offset(8); }
.offset9 { .offset(9); }
.offset10 { .offset(10); }
.offset11 { .offset(11); }
.offset12 { .offset(12); }
.row {
> .offset1 { .offset(1); }
> .offset2 { .offset(2); }
> .offset3 { .offset(3); }
> .offset4 { .offset(4); }
> .offset5 { .offset(5); }
> .offset6 { .offset(6); }
> .offset7 { .offset(7); }
> .offset8 { .offset(8); }
> .offset9 { .offset(9); }
> .offset10 { .offset(10); }
> .offset11 { .offset(11); }
> .offset12 { .offset(12); }
}
// Unique column sizes for 16-column grid
.span-one-third { width: 300px; }
.span-two-thirds { width: 620px; }
.offset-one-third { margin-left: 340px; }
.offset-two-thirds { margin-left: 660px; }
.row {
> .offset-one-third { margin-left: 340px; }
> .offset-two-thirds { margin-left: 660px; }
}
\ No newline at end of file
// Tables.less
// Tables for, you guessed it, tabular data
// ----------------------------------------
/*
* Tables.less
* Tables for, you guessed it, tabular data
* ---------------------------------------- */
// BASELINE STYLES
......@@ -10,12 +11,10 @@ table {
width: 100%;
margin-bottom: @baseline;
padding: 0;
border-collapse: separate; // Done so we can round those corners!
*border-collapse: collapse; /* IE7, collapse table to remove spacing */
font-size: @basefont;
border: 1px solid #ddd;
.border-radius(4px);
th, td {
border-collapse: collapse;
th,
td {
padding: 10px 10px 9px;
line-height: @baseline;
text-align: left;
......@@ -24,21 +23,47 @@ table {
padding-top: 9px;
font-weight: bold;
vertical-align: middle;
border-bottom: 1px solid #ddd;
}
td {
vertical-align: top;
border-top: 1px solid #ddd;
}
// When scoped to row, fix th in tbody
tbody th {
border-top: 1px solid #ddd;
vertical-align: top;
}
}
// CONDENSED VERSION
// -----------------
.condensed-table {
th,
td {
padding: 5px 5px 4px;
}
}
// BORDERED VERSION
// ----------------
.bordered-table {
border: 1px solid #ddd;
border-collapse: separate; // Done so we can round those corners!
*border-collapse: collapse; /* IE7, collapse table to remove spacing */
.border-radius(4px);
th + th,
td + td {
td + td,
th + td {
border-left: 1px solid #ddd;
}
tr + tr td {
border-top: 1px solid #ddd;
}
thead tr:first-child th:first-child,
tbody tr:first-child td:first-child {
.border-radius(4px 0 0 0);
}
thead tr:first-child th:last-child,
tbody tr:first-child td:last-child {
.border-radius(0 4px 0 0);
}
......@@ -51,20 +76,52 @@ table {
}
// TABLE CELL SIZES
// ----------------
// This is a duplication of the main grid .columns() mixin, but subtracts 20px to account for input padding and border
.tableColumns(@columnSpan: 1) {
width: ((@gridColumnWidth - 20) * @columnSpan) + ((@gridColumnWidth - 20) * (@columnSpan - 1));
}
table {
// Default columns
.span1 { .tableColumns(1); }
.span2 { .tableColumns(2); }
.span3 { .tableColumns(3); }
.span4 { .tableColumns(4); }
.span5 { .tableColumns(5); }
.span6 { .tableColumns(6); }
.span7 { .tableColumns(7); }
.span8 { .tableColumns(8); }
.span9 { .tableColumns(9); }
.span10 { .tableColumns(10); }
.span11 { .tableColumns(11); }
.span12 { .tableColumns(12); }
.span13 { .tableColumns(13); }
.span14 { .tableColumns(14); }
.span15 { .tableColumns(15); }
.span16 { .tableColumns(16); }
}
// ZEBRA-STRIPING
// --------------
// Default zebra-stripe styles (alternating gray and transparent backgrounds)
.zebra-striped {
tbody {
tr:nth-child(odd) td {
tr:nth-child(odd) td,
tr:nth-child(odd) th {
background-color: #f9f9f9;
}
tr:hover td {
tr:hover td,
tr:hover th {
background-color: #f5f5f5;
}
}
}
table {
// Tablesorting styles w/ jQuery plugin
.header {
cursor: pointer;
......@@ -110,9 +167,6 @@ table {
.opacity(60);
}
}
}
table {
// Blue Table Headings
.blue {
color: @blue;
......
// Typography.less
// Headings, body text, lists, code, and more for a versatile and durable typography system
// ----------------------------------------------------------------------------------------
/* Typography.less
* Headings, body text, lists, code, and more for a versatile and durable typography system
* ---------------------------------------------------------------------------------------- */
// BODY TEXT
......
// Variables.less
// Variables to customize the look and feel of Bootstrap
// -----------------------------------------------------
/* Variables.less
* Variables to customize the look and feel of Bootstrap
* ----------------------------------------------------- */
// Links
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment