Commit cbb291b8 authored by Mark Otto's avatar Mark Otto

Merge branch '2.0-wip' of github.com:twitter/bootstrap into 2.0-wip

Conflicts:
	bootstrap.css
	bootstrap.min.css
parents b36df463 08d0aff1
.DS_Store
js/min
\ No newline at end of file
VERSION=1.2.0
VERSION=2.0.0
DATE=$(shell DATE)
BOOTSTRAP = ./bootstrap.css
BOOTSTRAP_MIN = ./bootstrap.min.css
BOOTSTRAP_LESS = ./lib/bootstrap.less
LESS_COMPESSOR ?= `which lessc`
UGLIFY_JS ?= `which uglifyjs`
WATCHR ?= `which watchr`
build:
......@@ -18,6 +19,24 @@ build:
echo "You can install it by running: npm install less -g"; \
fi
uglify:
@@if test ! -z ${UGLIFY_JS}; then \
mkdir -p js/min; \
uglifyjs -o js/min/bootstrap-accordion.js js/bootstrap-accordion.js;\
uglifyjs -o js/min/bootstrap-alerts.js js/bootstrap-alerts.js;\
uglifyjs -o js/min/bootstrap-buttons.js js/bootstrap-buttons.js;\
uglifyjs -o js/min/bootstrap-dropdown.js js/bootstrap-dropdown.js;\
uglifyjs -o js/min/bootstrap-modal.js js/bootstrap-modal.js;\
uglifyjs -o js/min/bootstrap-popover.js js/bootstrap-popover.js;\
uglifyjs -o js/min/bootstrap-scrollspy.js js/bootstrap-scrollspy.js;\
uglifyjs -o js/min/bootstrap-tabs.js js/bootstrap-tabs.js;\
uglifyjs -o js/min/bootstrap-transitions.js js/bootstrap-transitions.js;\
uglifyjs -o js/min/bootstrap-twipsy.js js/bootstrap-twipsy.js;\
else \
echo "You must have the UGLIFYJS minifier installed in order to minify Bootstrap's js."; \
echo "You can install it by running: npm install uglify-js -g"; \
fi
watch:
@@if test ! -z ${WATCHR}; then \
echo "Watching less files..."; \
......
......@@ -18,7 +18,7 @@ Here's what the LESS version looks like:
<script src="less.js" type="text/javascript"></script>
```
Or if you prefer, the standard css way:
Or if you prefer, the standard CSS way:
``` html
<link rel="stylesheet" type="text/css" href="bootstrap.css">
......@@ -72,7 +72,7 @@ http://groups.google.com/group/twitter-bootstrap
Developers
----------
We have included a makefile with convenience methods for working with the bootstrap library.
We have included a makefile with convenience methods for working with the Bootstrap library.
+ **build** - `make build`
This will run the less compiler on the bootstrap lib and generate a bootstrap.css and bootstrap.min.css file.
......
/*!
* Bootstrap v1.2.0
* Bootstrap v2.0.0
*
* Copyright 2011 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
* Date: Tue Nov 29 22:34:51 PST 2011
* Date: Tue Nov 29 22:35:45 PST 2011
*/
/* 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).
* ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
html, body {
margin: 0;
padding: 0;
......@@ -170,16 +167,6 @@ textarea {
overflow: auto;
vertical-align: top;
}
/* Variables.less
* Variables to customize the look and feel of Bootstrap
* ----------------------------------------------------- */
/* Mixins.less
* Snippets of reusable CSS to develop faster and keep code readable
* ----------------------------------------------------------------- */
/*
* Scaffolding
* Basic and global styles for generating a grid system, structural layout, and page templates
* ------------------------------------------------------------------------------------------- */
body {
margin: 0;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
......@@ -344,9 +331,6 @@ a:hover {
.offset11 {
margin-left: 900px;
}
/* Typography.less
* Headings, body text, lists, code, and more for a versatile and durable typography system
* ---------------------------------------------------------------------------------------- */
p {
margin-bottom: 9px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
......@@ -534,9 +518,6 @@ pre code {
padding: 0;
background-color: transparent;
}
/* Forms.less
* Base styles for various input types, form layouts, and states
* ------------------------------------------------------------- */
form {
margin-bottom: 18px;
}
......@@ -676,7 +657,7 @@ select.span2,
.uneditable-input.span2 {
display: inline-block;
float: none;
width: 150px;
width: 130px;
margin-left: 0;
}
input.span3,
......@@ -685,7 +666,7 @@ select.span3,
.uneditable-input.span3 {
display: inline-block;
float: none;
width: 250px;
width: 210px;
margin-left: 0;
}
input.span4,
......@@ -694,7 +675,7 @@ select.span4,
.uneditable-input.span4 {
display: inline-block;
float: none;
width: 350px;
width: 290px;
margin-left: 0;
}
input.span5,
......@@ -703,7 +684,7 @@ select.span5,
.uneditable-input.span5 {
display: inline-block;
float: none;
width: 450px;
width: 370px;
margin-left: 0;
}
input.span6,
......@@ -712,7 +693,7 @@ select.span6,
.uneditable-input.span6 {
display: inline-block;
float: none;
width: 550px;
width: 450px;
margin-left: 0;
}
input.span7,
......@@ -721,7 +702,7 @@ select.span7,
.uneditable-input.span7 {
display: inline-block;
float: none;
width: 650px;
width: 530px;
margin-left: 0;
}
input.span8,
......@@ -730,7 +711,7 @@ select.span8,
.uneditable-input.span8 {
display: inline-block;
float: none;
width: 750px;
width: 610px;
margin-left: 0;
}
input.span9,
......@@ -739,7 +720,7 @@ select.span9,
.uneditable-input.span9 {
display: inline-block;
float: none;
width: 850px;
width: 690px;
margin-left: 0;
}
input.span10,
......@@ -748,7 +729,7 @@ select.span10,
.uneditable-input.span10 {
display: inline-block;
float: none;
width: 950px;
width: 770px;
margin-left: 0;
}
input.span11,
......@@ -757,7 +738,7 @@ select.span11,
.uneditable-input.span11 {
display: inline-block;
float: none;
width: 1050px;
width: 850px;
margin-left: 0;
}
input.span12,
......@@ -766,7 +747,7 @@ select.span12,
.uneditable-input.span12 {
display: inline-block;
float: none;
width: 1150px;
width: 930px;
margin-left: 0;
}
input.span13,
......@@ -775,7 +756,7 @@ select.span13,
.uneditable-input.span13 {
display: inline-block;
float: none;
width: 1250px;
width: 1010px;
margin-left: 0;
}
input.span14,
......@@ -784,7 +765,7 @@ select.span14,
.uneditable-input.span14 {
display: inline-block;
float: none;
width: 1350px;
width: 1090px;
margin-left: 0;
}
input.span15,
......@@ -793,7 +774,7 @@ select.span15,
.uneditable-input.span15 {
display: inline-block;
float: none;
width: 1450px;
width: 1170px;
margin-left: 0;
}
input.span16,
......@@ -802,7 +783,7 @@ select.span16,
.uneditable-input.span16 {
display: inline-block;
float: none;
width: 1550px;
width: 1250px;
margin-left: 0;
}
input[disabled],
......@@ -999,10 +980,6 @@ form .clearfix.success .input-prepend .add-on, form .clearfix.success .input-app
.horizontal-form .form-actions {
padding-left: 150px;
}
/*
* Tables.less
* Tables for, you guessed it, tabular data
* ---------------------------------------- */
table {
width: 100%;
margin-bottom: 18px;
......@@ -1193,9 +1170,7 @@ table {
.headerSortDown.purple {
background-color: lighten(@purple, 40%);
}
}*//* Patterns.less
* Repeatable UI elements outside the base styles provided from the scaffolding
* ---------------------------------------------------------------------------- */
}*/
.navbar {
height: 40px;
overflow: visible;
......@@ -1638,7 +1613,7 @@ footer {
border-color: #0064cd #0064cd #003f81;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
}
.btn:active {
.btn.active, .btn:active {
-webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
-moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
......@@ -1874,6 +1849,19 @@ button.btn::-moz-focus-inner, input[type=submit].btn::-moz-focus-inner {
.fade.in {
opacity: 1;
}
.collapse {
-webkit-transition: height 0.35s ease;
-moz-transition: height 0.35s ease;
-ms-transition: height 0.35s ease;
-o-transition: height 0.35s ease;
transition: height 0.35s ease;
position: relative;
overflow: hidden;
height: 0;
}
.collapse.in {
height: auto;
}
.label {
padding: 1px 3px 2px;
font-size: 9.75px;
......@@ -2264,11 +2252,11 @@ button.btn::-moz-focus-inner, input[type=submit].btn::-moz-focus-inner {
visibility: visible;
padding: 5px;
font-size: 11px;
filter: alpha(opacity=80);
-moz-opacity: 0.8;
opacity: 0.8;
filter: alpha(opacity=0);
-moz-opacity: 0;
opacity: 0;
}
.twipsy.fade.in {
.twipsy.in {
filter: alpha(opacity=80);
-moz-opacity: 0.8;
opacity: 0.8;
......@@ -2439,9 +2427,6 @@ button.btn::-moz-focus-inner, input[type=submit].btn::-moz-focus-inner {
-moz-box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25);
box-shadow: 0 1px 4px rgba(0, 105, 214, 0.25);
}
/* Responsive.less
* For phone and tablet devices
* ------------------------------------------------------------- */
@media (max-width: 480px) {
.container {
width: auto;
......
This diff is collapsed.
......@@ -330,6 +330,13 @@ body > .navbar-fixed .brand:hover {
margin-left: 10px;
}
/* scrollspy docs */
.scrollspy-example {
overflow: auto;
height: 200px;
position: relative;
}
/* Popover docs
-------------------------------------------------- */
......@@ -492,3 +499,19 @@ h2 + table {
}
}
#accordion dt a{
display:block;
padding: 9px 15px;
line-height: 1;
background-color: whiteSmoke;
border: 1px solid #EEE;
border-top-color: #fff;
}
#accordion dt:first-child a {
border-top-color:#eee;
}
#accordion dd p {
padding: 10px;
}
......@@ -37,7 +37,7 @@
<li><a href="./scaffolding.html">Scaffolding</a></li>
<li class="active"><a href="./base-css.html">Base CSS</a></li>
<li><a href="./components.html">Components</a></li>
<li><a href="./javascript.html">Javascript</a></li>
<li><a href="./javascript.html">Javascript plugins</a></li>
<li><a href="./less.html">Using LESS</a></li>
</ul>
</div>
......
This diff is collapsed.
## 2.0 BOOTSTRAP JS PHILOSOPHY
These are the high-level design rules which guide the development of Bootstrap's JS plugins.
---
### DATA-ATTRIBUTE API
We believe you should be able to use all plugins provided by Bootstrap purely through the markup API without writing a single line of javascript.
We acknowledge that this isn't always the most performant and sometimes it may be desirable to turn this functionality off altogether. Therefore, as of 2.0 we provide the ability to disable the data attribute API by unbinding all events on the body namespaced with `'data-api'`. This looks like this:
$('body').unbind('.data-api')
To target a specific plugin, just include the plugins name as a namespace along with the data-api namespace like this:
$('body').unbind('.alert.data-api')
---
### PROGRAMATIC API
We also believe you should be able to use all plugins provided by Bootstrap purely through the JS API.
All public APIs should be a single, chainable method, and return the collection acted upon.
$(".btn.danger").button("toggle").addClass("fat")
All methods should accept an optional options object, a string which targets a particular method, or null which initiates the default behavior:
$("#myModal").modal() // initialized with defaults
---
### PLUGIN OPTIONS
Options should be sparse and add universal value. We should pick the right defaults.
All plugins should have a default object which can be modified to effect all instance's default options. The defaults object should be available via `$.fn.plugin.defaults`.
$.fn.modal.defaults = { … }
An options definition should take the following form:
*noun*: *adjective* - describes or modifies a quality of an instance
examples:
backdrop: true
keyboard: false
placement: 'above'
---
### PLUGIN EVENTS
All events should have an infinitive and past participle form. The infinitive is fired just before an action takes place, the past participle on completion of the action.
show | shown
hide | hidden
---
### DATA ATTRIBUTES
Data attributes should take the following form:
- data-*(verb)* - defines main interaction
- data-target || href^=# - defined on controller element (if element interacts with an element other than self)
- data-*(noun)* - defines options for element invocation
examples:
// control other targets
data-toggle="modal" data-target="#foo"
data-toggle="collapse" data-target="#foo" data-parent="#foo"
// defined on element they control
data-spy="scroll"
data-dismiss="modal"
data-dismiss="alert"
data-toggle="dropdown"
data-toggle="button"
data-toggle="buttons-checkbox"
data-toggle="buttons-radio"
\ No newline at end of file
/* =============================================================
* bootstrap-accordion.js v2.0.0
* http://twitter.github.com/bootstrap/javascript.html#accordion
* =============================================================
* 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( $ ){
var Accordion = function ( element, options ) {}
Accordion.prototype = {}
/* ALERT PLUGIN DEFINITION
* ======================= */
$.fn.accordion = function ( options ) {
if ( options === true ) {
return this.data('accordion')
}
return this.each(function () {
new Accordion(this, options)
})
}
})( window.jQuery || window.ender )
\ No newline at end of file
/* ==========================================================
* bootstrap-alerts.js v2.0.0
* bootstrap-alert.js v2.0.0
* http://twitter.github.com/bootstrap/javascript.html#alerts
* ==========================================================
* Copyright 2011 Twitter, Inc.
......@@ -17,18 +17,29 @@
* limitations under the License.
* ========================================================== */
(function( $ ){
!function( $ ){
"use strict"
/* ALERT CLASS DEFINITION
* ====================== */
function close(e) {
var $element = $(this).parent('.alert-message')
var dismiss = '[data-dismiss="alert"]'
, Alert = function ( el ) {
$(el).delegate(dismiss, 'click', this.close)
}
Alert.prototype = {
close: function ( e ) {
var $element = $(this)
$element = $element.hasClass('alert-message') ? $element : $element.parent()
e && e.preventDefault()
$element.removeClass('in')
function removeElement () {
function removeElement() {
$element.remove()
}
......@@ -37,12 +48,29 @@
removeElement()
}
}
/* ALERT PLUGIN DEFINITION
* ======================= */
$.fn.alert = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('alert')
if (!data) $this.data('alert', (data = new Alert(this)))
if (typeof option == 'string') data[option].call($this)
})
}
$.fn.alert.Alert = Alert
/* ALERT DATA-API
* ============== */
$(function () {
$('body').delegate('[data-alert-dismiss]', 'click', close)
$('body').delegate(dismiss, 'click.alert.data-api', Alert.prototype.close)
})
})( window.jQuery || window.ender )
\ No newline at end of file
}( window.jQuery || window.ender )
\ No newline at end of file
/* ============================================================
* bootstrap-buttons.js v2.0.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"
/* BUTTON PUBLIC CLASS DEFINITION
* ============================== */
var Button = function (element, options) {
this.$element = $(element)
this.settings = $.extend({}, $.fn.button.defaults, options)
}
Button.prototype = {
setState: function (state) {
var d = 'disabled'
, $el = this.$element
, data = $el.data()
, val = $el.is('input') ? 'val' : 'html'
state = state + 'Text'
data.resetText || $el.data('resetText', $el[val]())
$el[val](data[state] || this.settings[state])
// push to event loop to allow forms to submit
setTimeout(function () {
state == 'loadingText' ?
$el.addClass(d).attr(d, d) :
$el.removeClass(d).removeAttr(d)
}, 0)
}
, toggle: function () {
var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
$parent && $parent
.find('.active')
.removeClass('active')
this.$element.toggleClass('active')
}
}
/* BUTTON PLUGIN DEFINITION
* ======================== */
$.fn.button = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('button')
, options = typeof option == 'object' && option
if (!data) $this.data('button', (data = new Button(this, options)))
if (option == 'toggle') data.toggle()
else if (option) data.setState(option)
})
}
$.fn.button.defaults = {
loadingText: 'loading...'
}
$.fn.button.Button = Button
/* BUTTON DATA-API
* =============== */
$(function () {
$('body').delegate('[data-toggle^=button]', 'click.button.data-api', function (e) {
$(e.srcElement).button('toggle')
})
})
}( window.jQuery || window.ender )
\ No newline at end of file
/* =============================================================
* bootstrap-collapsible.js v2.0.0
* http://twitter.github.com/bootstrap/javascript.html#collapsible
* =============================================================
* 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"
var Collapse = function ( element, options ) {
this.$element = $(element)
this.settings = $.extend({}, $.fn.collapse.defaults, options)
if (this.settings["parent"]) {
this.$parent = $(this.settings["parent"])
}
this.settings.toggle && this.toggle()
}
Collapse.prototype = {
dimension: function () {
var hasWidth = this.$element.hasClass('width')
return hasWidth ? 'width' : 'height'
}
, show: function () {
var dimension = this.dimension()
, scroll = $.camelCase(['scroll', dimension].join('-'))
, actives = this.$parent && this.$parent.find('.in')
, hasData
if (actives && actives.length) {
hasData = actives.data('collapse')
actives.collapse('hide')
hasData || actives.data('collapse', null)
}
this.$element[dimension](0)
this.transition('addClass', 'show', 'shown')
this.$element[dimension](this.$element[0][scroll])
}
, hide: function () {
var dimension = this.dimension()
this.reset(this.$element[dimension]())
this.transition('removeClass', 'hide', 'hidden')
this.$element[dimension](0)
}
, reset: function ( size ) {
var dimension = this.dimension()
this.$element
.removeClass('collapse')
[dimension](size || '')
[0].offsetWidth
this.$element.addClass('collapse')
}
, transition: function ( method, startEvent, completeEvent ) {
var that = this
, complete = function () {
if (startEvent == 'show') that.reset()
that.$element.trigger(completeEvent)
}
this.$element
.trigger(startEvent)
[method]('in')
$.support.transition && this.$element.hasClass('collapse') ?
this.$element.one($.support.transition.end, complete) :
complete()
}
, toggle: function () {
this[this.$element.hasClass('in') ? 'hide' : 'show']()
}
}
/* COLLAPSIBLE PLUGIN DEFINITION
* ============================== */
$.fn.collapse = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('collapse')
, options = typeof option == 'object' && option
if (!data) $this.data('collapse', (data = new Collapse(this, options)))
if (typeof option == 'string') data[option]()
})
}
$.fn.collapse.defaults = {
toggle: true
}
$.fn.collapse.Collapse = Collapse
/* COLLAPSIBLE DATA-API
* ==================== */
$(function () {
$('body').delegate('[data-toggle=collapse]', 'click.collapse.data-api', function ( e ) {
var $this = $(this)
, target = $this.attr('data-target') || $this.attr('href')
, option = $(target).data('collapse') ? 'toggle' : $this.data()
e.preventDefault()
$(target).collapse(option)
})
})
})( window.jQuery || window.ender )
\ No newline at end of file
......@@ -18,25 +18,56 @@
* ============================================================ */
(function( $ ){
!function( $ ){
/* APPLY TO STANDARD DROPDOWN ELEMENTS
* =================================== */
var selector = '[data-dropdown]'
"use strict"
function clearMenus() {
$(selector).parent('li').removeClass('open')
/* DROPDOWN CLASS DEFINITION
* ========================= */
var toggle = '[data-toggle="dropdown"]'
, Dropdown = function ( element ) {
$(element).bind('click', this.toggle)
}
$(function () {
$('html').bind("click", clearMenus)
$('body').delegate(selector, 'click', function (e) {
Dropdown.prototype = {
toggle: function ( e ) {
var li = $(this).parent('li')
, isActive = li.hasClass('open')
clearMenus()
!isActive && li.toggleClass('open')
return false
}
}
function clearMenus() {
$(toggle).parent('li').removeClass('open')
}
/* DROPDOWN PLUGIN DEFINITION
* ========================== */
$.fn.dropdown = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('dropdown')
if (!data) $this.data('dropdown', (data = new Dropdown(this)))
if (typeof option == 'string') data[option].call($this)
})
}
/* APPLY TO STANDARD DROPDOWN ELEMENTS
* =================================== */
$(function () {
$('html').bind('click.dropdown.data-api', clearMenus)
$('body').delegate(toggle, 'click.dropdown.data-api', Dropdown.prototype.toggle)
})
})( window.jQuery || window.ender )
\ No newline at end of file
}( window.jQuery || window.ender )
\ No newline at end of file
......@@ -20,19 +20,16 @@
!function( $ ){
/* MODAL PUBLIC CLASS DEFINITION
* ============================= */
"use strict"
/* MODAL CLASS DEFINITION
* ====================== */
var Modal = function ( content, options ) {
this.settings = $.extend({}, $.fn.modal.defaults, options)
this.$element = $(content)
.delegate('[data-modal-dismiss]', 'click', $.proxy(this.hide, this))
if ( this.settings.show ) {
this.show()
}
return this
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
this.settings.show && this.show()
}
Modal.prototype = {
......@@ -43,22 +40,38 @@
, show: function () {
var that = this
if (this.isShown) return
this.isShown = true
this.$element.trigger('show')
escape.call(this)
backdrop.call(this)
backdrop.call(this, function () {
var transition = $.support.transition && that.$element.hasClass('fade')
return this
that.$element
.appendTo(document.body)
.show()
if (transition) {
that.$element[0].offsetWidth // force reflow
}
, hide: function (e) {
e && e.preventDefault()
that.$element.addClass('in')
transition ?
that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
that.$element.trigger('shown')
if ( !this.isShown ) {
return this
})
}
, hide: function ( e ) {
e && e.preventDefault()
if (!this.isShown) return
var that = this
this.isShown = false
......@@ -68,19 +81,9 @@
.trigger('hide')
.removeClass('in')
function removeElement () {
that.$element
.hide()
.trigger('hidden')
backdrop.call(that)
}
$.support.transition && this.$element.hasClass('fade') ?
this.$element.one($.support.transition.end, removeElement) :
removeElement()
return this
hideWithTransition.call(this) :
hideModal.call(this)
}
}
......@@ -89,24 +92,42 @@
/* MODAL PRIVATE METHODS
* ===================== */
function backdrop () {
function hideWithTransition() {
var that = this
, timeout = setTimeout(function () {
that.$element.unbind($.support.transition.end)
hideModal.call(that)
}, 500)
this.$element.one($.support.transition.end, 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' : ''
, callback = $.proxy(show, this)
if ( this.isShown && this.settings.backdrop ) {
if (this.isShown && this.settings.backdrop) {
var doAnimate = $.support.transition && animate
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
.appendTo(document.body)
if ( this.settings.backdrop != 'static' ) {
if (this.settings.backdrop != 'static') {
this.$backdrop.click($.proxy(this.hide, this))
}
if ( doAnimate ) {
this.$backdrop[0].offsetWidth // force reflow
}
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
this.$backdrop.addClass('in')
......@@ -114,52 +135,31 @@
this.$backdrop.one($.support.transition.end, callback) :
callback()
} else if ( !this.isShown && this.$backdrop ) {
} 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($.support.transition.end, removeElement) :
removeElement()
} else if ( callback ) {
this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
removeBackdrop.call(this)
} else if (callback) {
callback()
}
}
function show() {
var transition = $.support.transition && that.$element.hasClass('fade')
, that = this
this.$element
.appendTo(document.body)
.show()
if (transition) {
this.$element[0].offsetWidth // force reflow
}
this.$element
.addClass('in')
transition ?
this.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
this.$element.trigger('shown')
function removeBackdrop() {
this.$backdrop.remove()
this.$backdrop = null
}
function escape() {
var that = this
if ( this.isShown && this.settings.keyboard ) {
$(document).bind('keyup.modal', function ( e ) {
if ( e.which == 27 ) {
that.hide()
}
if (this.isShown && this.settings.keyboard) {
$(document).bind('keyup.dismiss.modal', function ( e ) {
e.which == 27 && that.hide()
})
} else if ( !this.isShown ) {
$(document).unbind('keyup.modal')
} else if (!this.isShown) {
$(document).unbind('keyup.dismiss.modal')
}
}
......@@ -167,53 +167,36 @@
/* MODAL PLUGIN DEFINITION
* ======================= */
$.fn.modal = function ( options ) {
var modal = this.data('modal')
if (!modal) {
if (typeof options == 'string') {
options = {
show: /show|toggle/.test(options)
}
}
$.fn.modal = function ( option ) {
return this.each(function () {
$(this).data('modal', new Modal(this, options))
var $this = $(this)
, data = $this.data('modal')
, options = typeof option == 'object' && option
if (!data) $this.data('modal', (data = new Modal(this, options)))
if (typeof option == 'string') data[option]()
})
}
if ( options === true ) {
return modal
}
if ( typeof options == 'string' ) {
modal[options]()
} else if ( modal ) {
modal.toggle()
}
return this
$.fn.modal.defaults = {
backdrop: true
, keyboard: true
, show: true
}
$.fn.modal.Modal = Modal
$.fn.modal.defaults = {
backdrop: false
, keyboard: false
, show: false
}
/* MODAL DATA-IMPLEMENTATION
* ========================= */
/* MODAL DATA-API
* ============== */
$(function () {
$('body').delegate('[data-controls-modal]', 'click', function (e) {
$(document).ready(function () {
$('body').delegate('[data-toggle="modal"]', 'click.modal.data-api', function ( e ) {
var $this = $(this)
, target = $this.attr('data-target') || $this.attr('href')
, option = $(target).data('modal') ? 'toggle' : $this.data()
e.preventDefault()
var $this = $(this).data('show', true)
$('#' + $this.attr('data-controls-modal')).modal( $this.data() )
$(target).modal(option)
})
})
}( window.jQuery || window.ender );
\ No newline at end of file
}( window.jQuery || window.ender )
\ No newline at end of file
......@@ -20,6 +20,8 @@
!function( $ ) {
"use strict"
var Popover = function ( element, options ) {
this.$element = $(element)
this.options = options
......@@ -34,34 +36,44 @@
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())
, title = this.getTitle()
, content = this.getContent()
$tip.find('.title')[ $.type(title) == 'object' ? 'append' : 'html' ](title)
$tip.find('.content > *')[ $.type(content) == 'object' ? 'append' : 'html' ](content)
$tip[0].className = 'popover'
}
, hasContent: function () {
return this.getTitle() || this.getContent()
}
, getContent: function () {
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
}
})
/* POPOVER PLUGIN DEFINITION
* ======================= */
......@@ -71,6 +83,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 )
\ No newline at end of file
......@@ -17,36 +17,43 @@
* limitations under the License.
* ============================================================== */
!function ( $ ) {
var $window = $(window)
"use strict"
/* SCROLLSPY CLASS DEFINITION
* ========================== */
function ScrollSpy() {
function ScrollSpy( element ) {
var process = $.proxy(this.process, this)
this.$topbar = $('body')
this.selector = '[data-scrollspy] li > a'
this.$scrollElement = $(element).bind('scroll.scroll.data-api', process)
this.selector = (this.$scrollElement.attr('data-target')
|| this.$scrollElement.attr('href')
|| '') + ' .nav li > a'
this.$body = $('body').delegate(this.selector, 'click.scroll.data-api', process)
this.refresh()
this.$topbar.delegate(this.selector, 'click', process)
$window.scroll(process)
this.process()
}
ScrollSpy.prototype = {
refresh: function () {
this.targets = this.$topbar.find(this.selector).map(function () {
this.targets = this.$body
.find(this.selector)
.map(function () {
var href = $(this).attr('href')
return /^#\w/.test(href) && $(href).length ? href : null
})
this.offsets = $.map(this.targets, function (id) {
return $(id).offset().top
return $(id).position().top
})
}
, process: function () {
var scrollTop = $window.scrollTop() + 10
var scrollTop = this.$scrollElement.scrollTop() + 10
, offsets = this.offsets
, targets = this.targets
, activeTarget = this.activeTarget
......@@ -65,11 +72,11 @@
this.activeTarget = target
this.$topbar
this.$body
.find(this.selector).parent('.active')
.removeClass('active')
active = this.$topbar
active = this.$body
.find(this.selector + '[href="' + target + '"]')
.parent('li')
.addClass('active')
......@@ -77,13 +84,29 @@
if ( active.parent('.dropdown-menu') ) {
active.closest('li.dropdown').addClass('active')
}
}
}
$(function () {
new ScrollSpy()
/* SCROLLSPY PLUGIN DEFINITION
* =========================== */
$.fn.scrollspy = function ( option ) {
return this.each(function () {
var $this = $(this)
, data = $this.data('scrollspy')
if (!data) $this.data('scrollspy', (data = new ScrollSpy(this)))
if (typeof option == 'string') data[option]()
})
}
$.fn.scrollspy.ScrollSpy = ScrollSpy
/* SCROLLSPY DATA-API
* ============== */
$(function () { $('[data-spy="scroll"]').scrollspy() })
}( window.jQuery || window.ender )
\ No newline at end of file
......@@ -20,7 +20,45 @@
!function( $ ){
function activate ( element, container ) {
"use strict"
/* TAB CLASS DEFINITION
* ==================== */
var Tab = function ( element ) {
this.element = $(element)
}
Tab.prototype = {
show: function () {
var $this = this.element
, $ul = $this.closest('ul:not(.dropdown-menu)')
, href = $this.attr('data-target') || $this.attr('href')
, previous
, $href
if ( $this.parent('li').hasClass('active') ) return
previous = $ul.find('.active a').last()[0]
$this.trigger({
type: 'show'
, relatedTarget: previous
})
$href = $(href)
this.activate($this.parent('li'), $ul)
this.activate($href, $href.parent())
$this.trigger({
type: 'shown'
, relatedTarget: previous
})
}
, activate: function ( element, container ) {
container
.find('> .active')
.removeClass('active')
......@@ -33,39 +71,32 @@
element.closest('li.dropdown').addClass('active')
}
}
function tab( e ) {
var $this = $(this)
, $ul = $this.closest('ul:not(.dropdown-menu)')
, href = $this.attr('href')
, previous
if ( /^#\w+/.test(href) ) {
e.preventDefault()
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())
/* TAB PLUGIN DEFINITION
* ===================== */
$this.trigger({
type: 'change'
, relatedTarget: previous
$.fn.tab = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('tab')
if (!data) $this.data('tab', (data = new Tab(this)))
if (typeof option == 'string') data[option]()
})
}
}
$.fn.tab.Tab = Tab
/* TABS/PILLS PLUGIN DEFINITION
* ============================ */
/* TAB DATA-API
* ============ */
$(function () {
$('body').delegate('ul[data-tabs] > li > a, ul[data-pills] > li > a', 'click', tab)
$(document).ready(function () {
$('body').delegate('[data-toggle="tab"], [data-toggle="pill"]', 'click.tab.data-api', function (e) {
e.preventDefault()
$(this).tab('show')
})
})
}( window.jQuery || window.ender );
\ No newline at end of file
}( window.jQuery || window.ender )
\ No newline at end of file
......@@ -38,7 +38,7 @@ $(function () {
transitionEnd = "oTransitionEnd"
}
return transitionEnd
})()
}())
}
})()
......
......@@ -18,9 +18,10 @@
* limitations under the License.
* ========================================================== */
!function( $ ) {
"use strict"
/* TWIPSY PUBLIC CLASS DEFINITION
* ============================== */
......@@ -41,7 +42,7 @@
, $tip
, tp
if (this.getTitle() && this.enabled) {
if (this.hasContent() && this.enabled) {
$tip = this.tip()
this.setContent()
......@@ -61,7 +62,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':
......@@ -87,7 +89,7 @@
, setContent: function () {
var $tip = this.tip()
$tip.find('.twipsy-inner')[this.options.html ? 'html' : 'text'](this.getTitle())
$tip.find('.twipsy-inner').html(this.getTitle())
$tip[0].className = 'twipsy'
}
......@@ -102,7 +104,7 @@
}
$.support.transition && this.$tip.hasClass('fade') ?
$tip.bind($.support.transition.end, removeElement) :
$tip.bind( $.support.transition.end, removeElement) :
removeElement()
}
......@@ -113,6 +115,10 @@
}
}
, hasContent: function () {
return this.getTitle()
}
, getTitle: function() {
var title
, $e = this.$element
......@@ -128,14 +134,11 @@
title = ('' + title).replace(/(^\s*|\s*$)/, "")
return title || o.fallback
return title
}
, 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() {
......@@ -158,21 +161,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
* ======================== */
......@@ -187,18 +189,22 @@
, eventIn
, eventOut
if (options === true) {
return this.data(name)
} else if (typeof options == 'string') {
twipsy = this.data(name)
if (twipsy) {
twipsy[options]()
}
return this
if (typeof options == 'string') {
return this.each(function (){
twipsy = $.data(this, name)
if (twipsy) twipsy[options]()
})
}
options = $.extend({}, $.fn[name].defaults, options)
if (options.delay && typeof options.delay == 'number') {
options.delay = {
show: options.delay
, hide: options.delay
}
}
function get(ele) {
var twipsy = $.data(ele, name)
......@@ -214,7 +220,7 @@
var twipsy = get(this)
twipsy.hoverState = 'in'
if (options.delayIn == 0) {
if (!options.delay || !options.delay.show) {
twipsy.show()
} else {
twipsy.fixTitle()
......@@ -222,21 +228,21 @@
if (twipsy.hoverState == 'in') {
twipsy.show()
}
}, options.delayIn)
}, options.delay.show)
}
}
function leave() {
var twipsy = get(this)
twipsy.hoverState = 'out'
if (options.delayOut == 0) {
if (!options.delay || !options.delay.hide) {
twipsy.hide()
} else {
setTimeout(function() {
if (twipsy.hoverState == 'out') {
twipsy.hide()
}
}, options.delayOut)
}, options.delay.hide)
}
}
......@@ -260,19 +266,27 @@
$.fn.twipsy.defaults = {
animate: true
, delayIn: 0
, delayOut: 0
, fallback: ''
, delay: 0
, placement: 'above'
, html: false
, live: false
, offset: 0
, title: 'title'
, trigger: 'hover'
, title: 'title'
, 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
/* Forms.less
* Base styles for various input types, form layouts, and states
* ------------------------------------------------------------- */
// Forms.less
// Base styles for various input types, form layouts, and states
// -------------------------------------------------------------
// GENERAL STYLES
......@@ -146,7 +145,7 @@ select:focus {
.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,
......
/* Mixins.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
......
/* 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
// ----------------------------------------------------------------------------
// NAVBAR (FIXED AND STATIC)
......@@ -415,6 +415,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);
......@@ -630,14 +631,6 @@ input[type=submit].btn {
}
// PATTERN ANIMATIONS
// ------------------
......@@ -649,6 +642,14 @@ input[type=submit].btn {
}
}
.collapse {
.transition(height .35s ease);
position:relative;
overflow:hidden;
height: 0;
&.in { height: auto; }
}
// LABELS
// ------
......
/* 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
......
/* Responsive.less
* For phone and tablet devices
* ------------------------------------------------------------- */
// Responsive.less
// For phone and tablet devices
// -------------------------------------------------------------
// UP TO LANDSCAPE PHONE
......
/*
* 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
......
/*
* Tables.less
* Tables for, you guessed it, tabular data
* ---------------------------------------- */
//
// Tables.less
// Tables for, you guessed it, tabular data
// ----------------------------------------
......
......@@ -8,8 +8,8 @@
visibility: visible;
padding: 5px;
font-size: 11px;
.opacity(80);
&.fade.in {
.opacity(0);
&.in {
.opacity(80);
}
&.above .twipsy-arrow { #popoverArrow > .above(); }
......
/* 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
// -----------------------------------------------------
// LINK COLORS
......
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