mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-29 21:52:22 +01:00
Merge branch '2.0-wip' of github.com:twitter/bootstrap into 2.0-wip
This commit is contained in:
commit
7c98f1e1fc
@ -12,7 +12,7 @@
|
||||
<![endif]-->
|
||||
|
||||
<!-- Le javascript -->
|
||||
<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
|
||||
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
|
||||
<script src="assets/js/google-code-prettify/prettify.js"></script>
|
||||
<script>$(function () { prettyPrint() })</script>
|
||||
<script src="../js/bootstrap-modal.js"></script>
|
||||
@ -182,7 +182,7 @@ $('#my-modal').bind('hidden', function () {
|
||||
<!-- sample modal content -->
|
||||
<div id="modal-from-dom" class="modal hide fade">
|
||||
<div class="modal-header">
|
||||
<a href="#" class="close js-dismiss">×</a>
|
||||
<a href="#" class="close" data-modal-dismiss="true" >×</a>
|
||||
<h3>Modal Heading</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
@ -190,12 +190,10 @@ $('#my-modal').bind('hidden', function () {
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn primary">Save changes</a>
|
||||
<a href="#" class="btn js-dismiss">Close</a>
|
||||
<a href="#" class="btn" data-modal-dismiss="true" >Close</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button data-controls-modal="modal-from-dom" data-backdrop="true" data-keyboard="true" class="btn danger">Launch Modal</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@ -221,7 +219,7 @@ $('#my-modal').bind('hidden', function () {
|
||||
<pre class="prettyprint linenums">
|
||||
<ul class="tabs">
|
||||
<li class="active"><a href="#">Home</a></li>
|
||||
<li class="dropdown" data-dropdown="dropdown" >
|
||||
<li class="dropdown" data-dropdown="true" >
|
||||
<a href="#" class="dropdown-toggle">Dropdown</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#">Secondary link</a></li>
|
||||
@ -231,7 +229,6 @@ $('#my-modal').bind('hidden', function () {
|
||||
</ul>
|
||||
</li>
|
||||
</ul></pre>
|
||||
<p><span class="label notice">Notice</span> If your ui has several dropdowns, consider adding the <code>data-dropdown</code> attribute to a more significant container element like <code>.tabs</code> or <code>.topbar</code>.
|
||||
<h3>Methods</h3>
|
||||
<h4>$().dropdown()</h4>
|
||||
<p>
|
||||
@ -239,7 +236,7 @@ $('#my-modal').bind('hidden', function () {
|
||||
</p>
|
||||
<h3>Demo</h3>
|
||||
<div class="topbar-wrapper">
|
||||
<div id="topbar-example" class="topbar" data-dropdown="dropdown">
|
||||
<div id="topbar-example" class="topbar">
|
||||
<div class="topbar-inner">
|
||||
<div class="container">
|
||||
<a class="brand" href="#">Project Name</a>
|
||||
@ -252,7 +249,7 @@ $('#my-modal').bind('hidden', function () {
|
||||
</form>
|
||||
<ul class="nav secondary-nav">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle">Dropdown 1</a>
|
||||
<a href="#" class="dropdown-toggle" data-dropdown="true">Dropdown 1</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#">Secondary link</a></li>
|
||||
<li><a href="#">Something else here</a></li>
|
||||
@ -261,7 +258,7 @@ $('#my-modal').bind('hidden', function () {
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle">Dropdown 2</a>
|
||||
<a href="#" class="dropdown-toggle" data-dropdown="true">Dropdown 2</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#">Secondary link</a></li>
|
||||
<li><a href="#">Something else here</a></li>
|
||||
@ -645,11 +642,11 @@ $('#my-modal').bind('hidden', function () {
|
||||
<pre class="prettyprint linenums">$(".alert-message").alert('close')</pre>
|
||||
<h3>Demo</h3>
|
||||
<div class="alert-message warning fade in" data-alert="alert" >
|
||||
<a class="close" href="#">×</a>
|
||||
<a class="close" data-alert-dismiss="true" href="#">×</a>
|
||||
<p><strong>Holy guacamole!</strong> Best check yo self, you’re not looking too good.</p>
|
||||
</div>
|
||||
<div class="alert-message block-message error fade in" data-alert="alert" >
|
||||
<a class="close" href="#">×</a>
|
||||
<a class="close" data-alert-dismiss="true" href="#">×</a>
|
||||
<p><strong>Oh snap! You got an error!</strong> Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.</p>
|
||||
<div class="alert-actions">
|
||||
<a class="btn small" href="#">Take this action</a> <a class="btn small" href="#">Or do this</a>
|
||||
|
6
js/bootstrap-alerts.js
vendored
6
js/bootstrap-alerts.js
vendored
@ -53,7 +53,7 @@
|
||||
|
||||
var Alert = function ( content, selector ) {
|
||||
this.$element = $(content)
|
||||
.delegate(selector || '.close', 'click', this.close)
|
||||
.delegate('[data-alert-dismiss]', 'click', this.close)
|
||||
}
|
||||
|
||||
Alert.prototype = {
|
||||
@ -62,6 +62,8 @@
|
||||
var $element = $(this).parent('.alert-message')
|
||||
|
||||
e && e.preventDefault()
|
||||
e && e.stopPropagation()
|
||||
|
||||
$element.removeClass('in')
|
||||
|
||||
function removeElement () {
|
||||
@ -98,7 +100,7 @@
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
new Alert($('body'), '.alert-message[data-alert] .close')
|
||||
new Alert($('body'))
|
||||
})
|
||||
|
||||
})( window.jQuery || window.ender )
|
27
js/bootstrap-dropdown.js
vendored
27
js/bootstrap-dropdown.js
vendored
@ -20,23 +20,14 @@
|
||||
|
||||
(function( $ ){
|
||||
|
||||
var d = '.dropdown-toggle'
|
||||
|
||||
function clearMenus() {
|
||||
$(d).parent('li').removeClass('open')
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$('html').bind("click", clearMenus)
|
||||
$('body').dropdown( '[data-dropdown] .dropdown-toggle' )
|
||||
})
|
||||
var d = '[data-dropdown]'
|
||||
|
||||
/* DROPDOWN PLUGIN DEFINITION
|
||||
* ========================== */
|
||||
|
||||
$.fn.dropdown = function ( selector ) {
|
||||
$.fn.dropdown = function () {
|
||||
return this.each(function () {
|
||||
$(this).delegate(selector || d, 'click', function (e) {
|
||||
$(this).delegate(d, 'click', function (e) {
|
||||
var li = $(this).parent('li')
|
||||
, isActive = li.hasClass('open')
|
||||
|
||||
@ -47,4 +38,16 @@
|
||||
})
|
||||
}
|
||||
|
||||
/* APPLY TO STANDARD DROPDOWN ELEMENTS
|
||||
* =================================== */
|
||||
|
||||
function clearMenus() {
|
||||
$(d).parent('li').removeClass('open')
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$('html').bind("click", clearMenus)
|
||||
$('body').dropdown()
|
||||
})
|
||||
|
||||
})( window.jQuery || window.ender )
|
71
js/bootstrap-modal.js
vendored
71
js/bootstrap-modal.js
vendored
@ -18,7 +18,7 @@
|
||||
* ========================================================= */
|
||||
|
||||
|
||||
(function( $ ){
|
||||
!function( $ ){
|
||||
|
||||
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
|
||||
* ======================================================= */
|
||||
@ -53,16 +53,12 @@
|
||||
* ============================= */
|
||||
|
||||
var Modal = function ( content, options ) {
|
||||
this.settings = $.extend({}, $.fn.modal.defaults)
|
||||
this.settings = $.extend({}, $.fn.modal.defaults, options)
|
||||
this.$element = $(content)
|
||||
.delegate('.js-dismiss', 'click.modal', $.proxy(this.hide, this))
|
||||
.delegate('[data-modal-dismiss]', 'click', $.proxy(this.hide, this))
|
||||
|
||||
if ( options ) {
|
||||
$.extend( this.settings, options )
|
||||
|
||||
if ( options.show ) {
|
||||
this.show()
|
||||
}
|
||||
if ( this.settings.show ) {
|
||||
this.show()
|
||||
}
|
||||
|
||||
return this
|
||||
@ -81,15 +77,23 @@
|
||||
|
||||
escape.call(this)
|
||||
backdrop.call(this, function () {
|
||||
var transition = $.support.transition && that.$element.hasClass('fade')
|
||||
|
||||
that.$element
|
||||
.appendTo(document.body)
|
||||
.show()
|
||||
|
||||
setTimeout(function () {
|
||||
that.$element
|
||||
.addClass('in')
|
||||
.trigger('shown')
|
||||
}, 1)
|
||||
if (transition) {
|
||||
that.$element[0].offsetWidth // force reflow
|
||||
}
|
||||
|
||||
that.$element
|
||||
.addClass('in')
|
||||
|
||||
transition ?
|
||||
that.$element.one(transitionEnd, function () { that.$element.trigger('shown') }) :
|
||||
that.$element.trigger('shown')
|
||||
|
||||
})
|
||||
|
||||
return this
|
||||
@ -98,6 +102,10 @@
|
||||
, hide: function (e) {
|
||||
e && e.preventDefault()
|
||||
|
||||
if ( !this.isShown ) {
|
||||
return this
|
||||
}
|
||||
|
||||
var that = this
|
||||
this.isShown = false
|
||||
|
||||
@ -132,16 +140,25 @@
|
||||
var that = this
|
||||
, animate = this.$element.hasClass('fade') ? 'fade' : ''
|
||||
if ( this.isShown && this.settings.backdrop ) {
|
||||
var doAnimate = $.support.transition && animate
|
||||
|
||||
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
||||
.click($.proxy(this.hide, this))
|
||||
.appendTo(document.body)
|
||||
|
||||
setTimeout(function () {
|
||||
that.$backdrop && that.$backdrop.addClass('in')
|
||||
$.support.transition && that.$backdrop.hasClass('fade') ?
|
||||
that.$backdrop.one(transitionEnd, callback) :
|
||||
callback()
|
||||
})
|
||||
if ( this.settings.backdrop != 'static' ) {
|
||||
this.$backdrop.click($.proxy(this.hide, this))
|
||||
}
|
||||
|
||||
if ( doAnimate ) {
|
||||
this.$backdrop[0].offsetWidth // force reflow
|
||||
}
|
||||
|
||||
this.$backdrop.addClass('in')
|
||||
|
||||
doAnimate ?
|
||||
this.$backdrop.one(transitionEnd, callback) :
|
||||
callback()
|
||||
|
||||
} else if ( !this.isShown && this.$backdrop ) {
|
||||
this.$backdrop.removeClass('in')
|
||||
|
||||
@ -161,13 +178,13 @@
|
||||
function escape() {
|
||||
var that = this
|
||||
if ( this.isShown && this.settings.keyboard ) {
|
||||
$('body').bind('keyup.modal', function ( e ) {
|
||||
$(document).bind('keyup.modal', function ( e ) {
|
||||
if ( e.which == 27 ) {
|
||||
that.hide()
|
||||
}
|
||||
})
|
||||
} else if ( !this.isShown ) {
|
||||
$('body').unbind('keyup.modal')
|
||||
$(document).unbind('keyup.modal')
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,12 +226,12 @@
|
||||
$.fn.modal.defaults = {
|
||||
backdrop: false
|
||||
, keyboard: false
|
||||
, show: true
|
||||
, show: false
|
||||
}
|
||||
|
||||
|
||||
/* MODAL DATA- IMPLEMENTATION
|
||||
* ========================== */
|
||||
/* MODAL DATA-IMPLEMENTATION
|
||||
* ========================= */
|
||||
|
||||
$(document).ready(function () {
|
||||
$('body').delegate('[data-controls-modal]', 'click', function (e) {
|
||||
@ -224,4 +241,4 @@
|
||||
})
|
||||
})
|
||||
|
||||
})( window.jQuery || window.ender )
|
||||
}( window.jQuery || window.ender );
|
6
js/bootstrap-popover.js
vendored
6
js/bootstrap-popover.js
vendored
@ -18,7 +18,7 @@
|
||||
* =========================================================== */
|
||||
|
||||
|
||||
(function( $ ) {
|
||||
!function( $ ) {
|
||||
|
||||
var Popover = function ( element, options ) {
|
||||
this.$element = $(element)
|
||||
@ -40,7 +40,7 @@
|
||||
}
|
||||
|
||||
, getContent: function () {
|
||||
var contentvar
|
||||
var content
|
||||
, $e = this.$element
|
||||
, o = this.options
|
||||
|
||||
@ -74,4 +74,4 @@
|
||||
|
||||
$.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { content: 'data-content', placement: 'right'})
|
||||
|
||||
})( window.jQuery || window.ender )
|
||||
}( window.jQuery || window.ender );
|
18
js/bootstrap-tabs.js
vendored
18
js/bootstrap-tabs.js
vendored
@ -18,30 +18,36 @@
|
||||
* ======================================================== */
|
||||
|
||||
|
||||
(function( $ ){
|
||||
!function( $ ){
|
||||
|
||||
function activate ( element, container ) {
|
||||
container.find('.active').removeClass('active')
|
||||
container.find('> .active').removeClass('active')
|
||||
element.addClass('active')
|
||||
}
|
||||
|
||||
function tab( e ) {
|
||||
var $this = $(this)
|
||||
, $ul = $this.closest('ul')
|
||||
, href = $this.attr('href')
|
||||
, $ul = $(e.liveFired)
|
||||
, $controlled
|
||||
, previous
|
||||
|
||||
if (/^#\w+/.test(href)) {
|
||||
e.preventDefault()
|
||||
|
||||
if ($this.hasClass('active')) {
|
||||
if ($this.parent('li').hasClass('active')) {
|
||||
return
|
||||
}
|
||||
|
||||
previous = $ul.find('.active a')[0]
|
||||
$href = $(href)
|
||||
|
||||
activate($this.parent('li'), $ul)
|
||||
activate($href, $href.parent())
|
||||
|
||||
$this.trigger({
|
||||
type: 'change'
|
||||
, relatedTarget: previous
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,4 +65,4 @@
|
||||
$('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a')
|
||||
})
|
||||
|
||||
})( window.jQuery || window.ender )
|
||||
}( window.jQuery || window.ender );
|
4
js/bootstrap-twipsy.js
vendored
4
js/bootstrap-twipsy.js
vendored
@ -19,7 +19,7 @@
|
||||
* ========================================================== */
|
||||
|
||||
|
||||
(function( $ ) {
|
||||
!function( $ ) {
|
||||
|
||||
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
|
||||
* ======================================================= */
|
||||
@ -304,4 +304,4 @@
|
||||
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options
|
||||
}
|
||||
|
||||
})( window.jQuery || window.ender )
|
||||
}( window.jQuery || window.ender );
|
Loading…
x
Reference in New Issue
Block a user