mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-23 18:40:03 +00:00
Merge branch '2.0-wip' of github.com:twitter/bootstrap into 2.0-wip
Conflicts: bootstrap.css docs/javascript.html
This commit is contained in:
commit
9fb380151d
26
bootstrap.css
vendored
26
bootstrap.css
vendored
@ -6,7 +6,7 @@
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Designed and built with all the love in the world @twitter by @mdo and @fat.
|
||||
* Date: Wed Dec 21 18:20:33 CST 2011
|
||||
* Date: Wed Dec 21 18:38:56 CST 2011
|
||||
*/
|
||||
html, body {
|
||||
margin: 0;
|
||||
@ -2466,6 +2466,18 @@ button.btn::-moz-focus-inner, input[type=submit].btn::-moz-focus-inner {
|
||||
-moz-opacity: 0.8;
|
||||
opacity: 0.8;
|
||||
}
|
||||
.twipsy.above {
|
||||
margin-top: -2px;
|
||||
}
|
||||
.twipsy.right {
|
||||
margin-left: 2px;
|
||||
}
|
||||
.twipsy.below {
|
||||
margin-top: 2px;
|
||||
}
|
||||
.twipsy.left {
|
||||
margin-left: -2px;
|
||||
}
|
||||
.twipsy.above .twipsy-arrow {
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
@ -2522,6 +2534,18 @@ button.btn::-moz-focus-inner, input[type=submit].btn::-moz-focus-inner {
|
||||
display: none;
|
||||
padding: 5px;
|
||||
}
|
||||
.popover.above {
|
||||
margin-top: -5px;
|
||||
}
|
||||
.popover.right {
|
||||
margin-left: 5px;
|
||||
}
|
||||
.popover.below {
|
||||
margin-top: 5px;
|
||||
}
|
||||
.popover.left {
|
||||
margin-left: -5px;
|
||||
}
|
||||
.popover.above .arrow {
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
|
10
bootstrap.min.css
vendored
10
bootstrap.min.css
vendored
@ -321,13 +321,21 @@ button.btn::-moz-focus-inner,input[type=submit].btn::-moz-focus-inner{padding:0;
|
||||
.modal-footer:after{clear:both;}
|
||||
.modal-footer .btn{float:right;margin-left:5px;}
|
||||
.twipsy{position:absolute;z-index:1000;display:block;visibility:visible;padding:5px;font-size:11px;filter:alpha(opacity=0);-moz-opacity:0;opacity:0;}.twipsy.in{filter:alpha(opacity=80);-moz-opacity:0.8;opacity:0.8;}
|
||||
.twipsy.above{margin-top:-2px;}
|
||||
.twipsy.right{margin-left:2px;}
|
||||
.twipsy.below{margin-top:2px;}
|
||||
.twipsy.left{margin-left:-2px;}
|
||||
.twipsy.above .twipsy-arrow{bottom:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #000000;}
|
||||
.twipsy.left .twipsy-arrow{top:50%;right:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid #000000;}
|
||||
.twipsy.below .twipsy-arrow{top:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #000000;}
|
||||
.twipsy.right .twipsy-arrow{top:50%;left:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-right:5px solid #000000;}
|
||||
.twipsy-inner{max-width:200px;padding:3px 8px;color:white;text-align:center;text-decoration:none;background-color:#000000;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}
|
||||
.twipsy-arrow{position:absolute;width:0;height:0;}
|
||||
.popover{position:absolute;top:0;left:0;z-index:1000;display:none;padding:5px;}.popover.above .arrow{bottom:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #000000;}
|
||||
.popover{position:absolute;top:0;left:0;z-index:1000;display:none;padding:5px;}.popover.above{margin-top:-5px;}
|
||||
.popover.right{margin-left:5px;}
|
||||
.popover.below{margin-top:5px;}
|
||||
.popover.left{margin-left:-5px;}
|
||||
.popover.above .arrow{bottom:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #000000;}
|
||||
.popover.right .arrow{top:50%;left:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-right:5px solid #000000;}
|
||||
.popover.below .arrow{top:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #000000;}
|
||||
.popover.left .arrow{top:50%;right:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid #000000;}
|
||||
|
@ -68,7 +68,7 @@ $(function(){
|
||||
// POSITION STATIC TWIPSIES
|
||||
// ========================
|
||||
|
||||
$(window).bind( 'load resize', function () {
|
||||
$(window).on('load resize', function () {
|
||||
$(".twipsies a").each(function () {
|
||||
$(this)
|
||||
.twipsy({
|
||||
|
@ -25,7 +25,8 @@
|
||||
|
||||
<!-- Le javascript -->
|
||||
<!-- placed up here so that the inline demos can be next to their markup -->
|
||||
<script src="http://code.jquery.com/jquery-1.7.min.js"></script>
|
||||
<!-- <script src="http://code.jquery.com/jquery-1.7.min.js"></script> -->
|
||||
<script src="../js/tests/vendor/jquery.js"></script>
|
||||
<script src="assets/js/google-code-prettify/prettify.js"></script>
|
||||
<script>$(function () { prettyPrint() })</script>
|
||||
<script src="../js/bootstrap-transition.js"></script>
|
||||
@ -41,15 +42,13 @@
|
||||
<script>
|
||||
$(function () {
|
||||
// twipsy demo
|
||||
$("a[rel=twipsy]").twipsy({
|
||||
live: true
|
||||
$('.twipsy-demo.well').twipsy({
|
||||
selector: "a[rel=twipsy]"
|
||||
})
|
||||
|
||||
//popover demo
|
||||
$("a[rel=popover]")
|
||||
.popover({
|
||||
offset: 10
|
||||
})
|
||||
.popover()
|
||||
.click(function(e) {
|
||||
e.preventDefault()
|
||||
})
|
||||
@ -83,7 +82,7 @@
|
||||
================================================== -->
|
||||
<header class="jumbotron subhead" id="overview">
|
||||
<h1>Javascript for Bootstrap</h1>
|
||||
<p class="lead">Bring Bootstrap's components to life with flexible, custom javascript plugins for many of our custom components that work with <a href="http://jquery.com/" target="_blank">jQuery</a> and <a href="http://ender.no.de" target="_blank">Ender</a>.</p>
|
||||
<p class="lead">Bring Bootstrap's components to life — now with 12 custom <a href="http://jquery.com/" target="_blank">jQuery</a> plugins.
|
||||
</header>
|
||||
|
||||
|
||||
@ -101,8 +100,8 @@
|
||||
</div>
|
||||
<div class="span9">
|
||||
<h3>What's included</h3>
|
||||
<p>Bring some of Bootstrap's primary components to life with new custom plugins that work with <a href="http://jquery.com/" target="_blank">jQuery</a> and <a href="http://ender.no.de" target="_blank">Ender</a>. We encourage you to extend and modify them to fit your specific development needs.</p>
|
||||
<table class="striped-table">
|
||||
<p>Bring some of Bootstrap's primary components to life with custom <a href="http://jquery.com/" target="_blank">jQuery</a> plugins. We encourage you to extend and modify them to fit your specific development needs.</p>
|
||||
<table class="bordered-table striped-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 150px;">File</th>
|
||||
@ -111,36 +110,40 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="./javascript.html#modal">bootstrap-modal.js</a></td>
|
||||
<td>Our Modal plugin is a <strong>super</strong> slim take on the traditional modal js plugin! We took special care to include only the bare functionality that we require at twitter.</td>
|
||||
<td><a href="./javascript.html#transition">bootstrap-transition.js</a></td>
|
||||
<td>The transition plugin is required for adding animation to other bootstrap plugins. Include this plugin (only once) when sliding in modals or fading out alerts.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="./javascript.html#alert">bootstrap-alert.js</a></td>
|
||||
<td>The alert plugin is a super tiny class for adding close functionality to alerts.</td>
|
||||
<td><a href="./javascript.html#modal">bootstrap-modal.js</a></td>
|
||||
<td>Our Modal plugin is a super slim take on the traditional modal js plugin! We took special care to include only the bare functionality that we require here at twitter.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="./javascript.html#dropdown">bootstrap-dropdown.js</a></td>
|
||||
<td>This plugin is for adding dropdown interaction to the bootstrap navbar or tabbed navigations.</td>
|
||||
<td>This plugin is for adding generic dropdown interactions to things like navigation top bars and tabs.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="./javascript.html#scrollspy">bootstrap-scrollspy.js</a></td>
|
||||
<td>The ScrollSpy plugin is for adding an auto updating nav based on scroll position to the bootstrap navbar.</td>
|
||||
<td>The ScrollSpy plugin is for automatically updating nav targets based on scroll position.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="./javascript.html#tabs">bootstrap-tab.js</a></td>
|
||||
<td>This plugin adds quick, dynamic tab and pill functionality for cycling through local content.</td>
|
||||
</tr>
|
||||
<td><a href="./javascript.html#tab">bootstrap-tab.js</a></td>
|
||||
<td>This plugin adds quick, dynamic tab and pill functionality for transitioning through local content.</td>
|
||||
<tr>
|
||||
<td><a href="./javascript.html#twipsy">bootstrap-twipsy.js</a></td>
|
||||
<td>Based on the excellent jQuery.tipsy plugin written by Jason Frame; twipsy is an updated version, which doesn't rely on images, uses css3 for animations, and data-attributes for local title storage!</td>
|
||||
<td>Inspired by the excellent jQuery.tipsy plugin written by Jason Frame; twipsy is an updated version, which doesn't rely on images, uses css3 for animations, data-attributes for local title storage, and now jquery 1.7's new event api!</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="./javascript.html#popover">bootstrap-popover.js</a></td>
|
||||
<td>The popover plugin provides a simple interface for adding popovers to your application. It extends the <a href="#twipsy">bootstrap-twipsy.js</a> plugin, so be sure to grab that file as well when including popovers in your project!</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="./javascript.html#alert">bootstrap-alert.js</a></td>
|
||||
<td>The alert plugin is a tiny class for adding close functionality to alerts.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="./javascript.html#button">bootstrap-button.js</a></td>
|
||||
<td>This plugin offers additional functionality for managing button state.</td>
|
||||
<td>This plugin offers additional functionality for managing button state in single buttons and button sets.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="./javascript.html#collapse">bootstrap-collapse.js</a></td>
|
||||
@ -151,7 +154,6 @@
|
||||
<h3>Is javascript necessary?</h3>
|
||||
<p><strong>Nope!</strong> Bootstrap is designed first and foremost to be a CSS library. This javascript provides a basic interactive layer on top of the included styles.</p>
|
||||
<p>However, for those who do need javascript, we've provided the plugins above to help you understand how to integrate Bootstrap with javascript and to give you a quick, lightweight option for the basic functionality right away.</p>
|
||||
<p>For more information and to see some live demos, please refer to our <a href="./javascript.html">plugin documentation page</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@ -173,7 +175,7 @@
|
||||
<h3>Using bootstrap-modal</h3>
|
||||
<pre class="prettyprint linenums">$('#myModal').modal(options)</pre>
|
||||
<h3>Options</h3>
|
||||
<table class="striped-table">
|
||||
<table class="bordered-table striped-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 100px;">Name</th>
|
||||
@ -195,16 +197,11 @@
|
||||
<td>true</td>
|
||||
<td>Closes the modal when escape key is pressed</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>show</td>
|
||||
<td>boolean</td>
|
||||
<td>true</td>
|
||||
<td>Opens modal on class initialization</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h3>Markup</h3>
|
||||
<p>You can activate modals on your page easily without having to write a single line of javascript. Just set <code>data-toggle="modal"</code> on a controller element with a <code>data-target="#foo"</code> or <code>href="#foo"</code> which corresponds to a modal element id, and when clicked, it will launch your modal. To add modal options, just include them as additoinal data attributes.</p>
|
||||
<p>You can activate modals on your page easily without having to write a single line of javascript. Just set <code>data-toggle="modal"</code> on a controller element with a <code>data-target="#foo"</code> or <code>href="#foo"</code> which corresponds to a modal element id, and when clicked, it will launch your modal.</p>
|
||||
<p>Also, to add options to your modal instance, just include them as additional data attributes on either the control element or the modal markup itself.</p>
|
||||
<pre class="prettyprint linenums">
|
||||
<a class="btn" data-toggle="modal" href="#myModal" >Launch Modal</a>
|
||||
</pre>
|
||||
@ -227,7 +224,7 @@ $('#myModal').modal({
|
||||
<pre class="prettyprint linenums">$('#myModal').modal('hide')</pre>
|
||||
<h3>Events</h3>
|
||||
<p>Bootstrap's modal class exposes a few events for hooking into modal functionality. </p>
|
||||
<table class="striped-table">
|
||||
<table class="bordered-table striped-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 150px;">Event</th>
|
||||
@ -255,7 +252,7 @@ $('#myModal').modal({
|
||||
</table>
|
||||
|
||||
<pre class="prettyprint linenums">
|
||||
$('#myModal').bind('hidden', function () {
|
||||
$('#myModal').on('hidden', function () {
|
||||
// do something ...
|
||||
})</pre>
|
||||
<h3>Demo</h3>
|
||||
@ -291,19 +288,21 @@ $('#myModal').bind('hidden', function () {
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="span3 columns">
|
||||
<p>This plugin is for adding dropdown interaction to the Bootstrap navbar or tabbed navigations.</p>
|
||||
<p>This plugin is for adding generic dropdown interactions to things like navigation top bars and tabs.</p>
|
||||
<a href="../js/bootstrap-dropdown.js" target="_blank" class="btn primary">Download</a>
|
||||
</div>
|
||||
<div class="span9 columns">
|
||||
<h3>Using bootstrap-dropdown.js</h3>
|
||||
<pre class="prettyprint linenums">$('.dropdown-toggle').dropdown()</pre>
|
||||
<h3>Markup</h3>
|
||||
<p>To quickly add dropdown functionality to any element just add <code>data-toggle="dropdown"</code>. Any valid bootstrap dropdown will automatically be activated.</p>
|
||||
<p>To quickly add dropdown functionality to any element just add <code>data-toggle="dropdown"</code> and any valid bootstrap dropdown will automatically be activated.</p>
|
||||
<p><span class="label notice">Notice</span> For added control and flexibility, optionally specify a <code>data-target="#fat"</code> or <code>href="#fat"</code> - this allows you to target specific dropdowns.</p>
|
||||
|
||||
<pre class="prettyprint linenums">
|
||||
<ul class="tabs">
|
||||
<li class="active"><a href="#">Home</a></li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>
|
||||
<li id="secondary" class="dropdown">
|
||||
<a href="#secondary" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#">Secondary link</a></li>
|
||||
<li><a href="#">Something else here</a></li>
|
||||
@ -330,7 +329,7 @@ $('#myModal').bind('hidden', function () {
|
||||
<input type="text" class="search-query span2" placeholder="Search">
|
||||
</form>
|
||||
<ul class="nav secondary-nav">
|
||||
<li class="dropdown">
|
||||
<li id="fat-menu" class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown 1</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#">Secondary link</a></li>
|
||||
@ -339,7 +338,7 @@ $('#myModal').bind('hidden', function () {
|
||||
<li><a href="#">Another link</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<li id="mdo-menu" class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown 2</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#">Secondary link</a></li>
|
||||
@ -365,7 +364,7 @@ $('#myModal').bind('hidden', function () {
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="span3 columns">
|
||||
<p>This plugin is for adding the scrollspy (auto updating nav) interaction to the bootstrap navbar.</p>
|
||||
<p>The ScrollSpy plugin is for automatically updating nav targets based on scroll position.</p>
|
||||
<a href="../js/bootstrap-scrollspy.js" target="_blank" class="btn primary">Download</a>
|
||||
</div>
|
||||
<div class="span9 columns">
|
||||
@ -433,13 +432,13 @@ $('#myModal').bind('hidden', function () {
|
||||
<!-- Tabs
|
||||
================================================== -->
|
||||
|
||||
<section id="tabs">
|
||||
<section id="tab">
|
||||
<div class="page-header">
|
||||
<h1>Tabs <small>bootstrap-tab.js</small></h1>
|
||||
<h1>Tab <small>bootstrap-tab.js</small></h1>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="span3 columns">
|
||||
<p>This plugin adds quick, dynamic tab and pill functionality.</p>
|
||||
<p>This plugin adds quick, dynamic tab and pill functionality for transitioning through local content.</p>
|
||||
<a href="../js/bootstrap-tab.js" target="_blank" class="btn primary">Download</a>
|
||||
</div>
|
||||
<div class="span9 columns">
|
||||
@ -456,7 +455,7 @@ $('#myModal').bind('hidden', function () {
|
||||
<h3>Methods</h3>
|
||||
<h4>$().tab</h4>
|
||||
<p>
|
||||
Activates tab functionality for a given element controller. Tab should have either a `data-target` or an `href` referencing a node in the dom.
|
||||
Activates a tab element and content container. Tab should have either a `data-target` or an `href` targeting a container node in the dom.
|
||||
</p>
|
||||
<pre class="prettyprint linenums">
|
||||
<ul class="tabs">
|
||||
@ -480,7 +479,7 @@ $('#myModal').bind('hidden', function () {
|
||||
</script></pre>
|
||||
</p>
|
||||
<h3>Events</h3>
|
||||
<table class="zebra-striped">
|
||||
<table class="bordered-table striped-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 150px;">Event</th>
|
||||
@ -493,14 +492,14 @@ $('#myModal').bind('hidden', function () {
|
||||
<td>This event fires on tab show, but before the new tab has been shown. Use <code>event.target</code> and <code>event.relatedTarget</code> to target the active tab and the previous active tab (if available) respectively.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>show</td>
|
||||
<td>shown</td>
|
||||
<td>This event fires on tab show after a tab has been shown. Use <code>event.target</code> and <code>event.relatedTarget</code> to target the active tab and the previous active tab (if available) respectively.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<pre class="prettyprint linenums">
|
||||
$('a[data-toggle="tab"]').bind('shown', function (e) {
|
||||
$('a[data-toggle="tab"]').on('shown', function (e) {
|
||||
e.target // activated tab
|
||||
e.relatedTarget // previous tab
|
||||
})</pre>
|
||||
@ -519,22 +518,22 @@ $('a[data-toggle="tab"]').bind('shown', function (e) {
|
||||
</li>
|
||||
</ul>
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="active tab-pane" id="home">
|
||||
<div class="tab-pane fade in active" id="home">
|
||||
<p>Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.</p>
|
||||
</div>
|
||||
<div class="tab-pane" id="profile">
|
||||
<div class="tab-pane fade" id="profile">
|
||||
<p>Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.</p>
|
||||
</div>
|
||||
<div class="tab-pane" id="messages">
|
||||
<div class="tab-pane fade" id="messages">
|
||||
<p>Banksy do proident, brooklyn photo booth delectus sunt artisan sed organic exercitation eiusmod four loko. Quis tattooed iphone esse aliqua. Master cleanse vero fixie mcsweeney's. Ethical portland aute, irony food truck pitchfork lomo eu anim. Aesthetic blog DIY, ethical beard leggings tofu consequat whatever cardigan nostrud. Helvetica you probably haven't heard of them carles, marfa veniam occaecat lomo before they sold out in shoreditch scenester sustainable thundercats. Consectetur tofu craft beer, mollit brunch fap echo park pitchfork mustache dolor.</p>
|
||||
</div>
|
||||
<div class="tab-pane" id="settings">
|
||||
<div class="tab-pane fade" id="settings">
|
||||
<p>Sunt qui biodiesel mollit officia, fanny pack put a bird on it thundercats seitan squid ad wolf bicycle rights blog. Et aute readymade farm-to-table carles 8-bit, nesciunt nulla etsy adipisicing organic ea. Master cleanse mollit high life, next level Austin nesciunt american apparel twee mustache adipisicing reprehenderit hoodie portland irony. Aliqua tofu quinoa +1 commodo eiusmod. High life williamsburg cupidatat twee homo leggings. Four loko vinyl DIY consectetur nisi, marfa retro keffiyeh vegan. Fanny pack viral retro consectetur gentrify fap.</p>
|
||||
</div>
|
||||
<div class="tab-pane" id="dropdown1">
|
||||
<div class="tab-pane fade" id="dropdown1">
|
||||
<p>Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.</p>
|
||||
</div>
|
||||
<div class="tab-pane" id="dropdown2">
|
||||
<div class="tab-pane fade" id="dropdown2">
|
||||
<p>Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.</p>
|
||||
</div>
|
||||
</div>
|
||||
@ -551,14 +550,14 @@ $('a[data-toggle="tab"]').bind('shown', function (e) {
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="span3 columns">
|
||||
<p>Based on the excellent jQuery.tipsy plugin written by Jason Frame; twipsy is an updated version, which doesn't rely on images, uses css3 for animations, and data-attributes for title storage!</p>
|
||||
<p>Inspired by the excellent jQuery.tipsy plugin written by Jason Frame; twipsy is an updated version, which doesn't rely on images, uses css3 for animations, data-attributes for local title storage, and now jquery 1.7's new event api!</p>
|
||||
<a href="../js/bootstrap-twipsy.js" target="_blank" class="btn primary">Download</a>
|
||||
</div>
|
||||
<div class="span9 columns">
|
||||
<h3>Using bootstrap-twipsy.js</h3>
|
||||
<pre class="prettyprint linenums">$('#example').twipsy(options)</pre>
|
||||
<h3>Options</h3>
|
||||
<table class="striped-table">
|
||||
<table class="bordered-table striped-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 100px;">Name</th>
|
||||
@ -569,7 +568,7 @@ $('a[data-toggle="tab"]').bind('shown', function (e) {
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>animate</td>
|
||||
<td>animation</td>
|
||||
<td>boolean</td>
|
||||
<td>true</td>
|
||||
<td>apply a css fade transition to the tooltip</td>
|
||||
@ -581,16 +580,16 @@ $('a[data-toggle="tab"]').bind('shown', function (e) {
|
||||
<td>how to position the tooltip - above | below | left | right</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>live</td>
|
||||
<td>boolean</td>
|
||||
<td>selector</td>
|
||||
<td>string</td>
|
||||
<td>false</td>
|
||||
<td>use event delegation instead of individual event handlers</td>
|
||||
<td>If a selector is provided, twipsy objects will be delegated to the specified targets.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>offset</td>
|
||||
<td>number</td>
|
||||
<td>0</td>
|
||||
<td>pixel offset of tooltip from target element</td>
|
||||
<td>title</td>
|
||||
<td>string | function</td>
|
||||
<td>''</td>
|
||||
<td>default title value if `title` tag isn't present</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>trigger</td>
|
||||
@ -612,7 +611,8 @@ $('a[data-toggle="tab"]').bind('shown', function (e) {
|
||||
</table>
|
||||
<p><span class="label notice">Notice</span> Individual twipsy instance options can alternatively be specified through the use of data attributes.</code></p>
|
||||
<h3>Markup</h3>
|
||||
For performance reasons, the Twipsy and Popover data-apis are opt in. If you would like to use them just set the live flag to true, however we recommend you know what you are doing if you do that. :)
|
||||
<p>
|
||||
For performance reasons, the Twipsy and Popover data-apis are opt in. If you would like to use them just specify a selector option.</p>
|
||||
<h3>Methods</h3>
|
||||
<h4>$().twipsy(options)</h4>
|
||||
<p>Attaches a twipsy handler to an element collection.</p>
|
||||
@ -623,8 +623,8 @@ $('a[data-toggle="tab"]').bind('shown', function (e) {
|
||||
<p>Hides an elements twipsy.</p>
|
||||
<pre class="prettyprint linenums">$('#element').twipsy('hide')</pre>
|
||||
<h3>Demo</h3>
|
||||
<div class="well">
|
||||
<p class="muted">Tight pants next level keffiyeh <a href="#" rel='twipsy' title='Some title text'>you probably</a> haven't heard of them. Photo booth beard raw denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american apparel <a href="#" rel='twipsy' title='Another twipsy'>have a</a> terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A <a href="#" rel='twipsy' title='Another one here too'>really ironic</a> artisan whatever keytar, scenester farm-to-table banksy Austin <a href="#" rel='twipsy' title='The last tip!'>twitter handle</a> freegan cred raw denim single-origin coffee viral.
|
||||
<div class="twipsy-demo well">
|
||||
<p class="muted">Tight pants next level keffiyeh <a href="#" rel='twipsy' title="first twipsy">you probably</a> haven't heard of them. Photo booth beard raw denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american apparel <a href="#" rel='twipsy' title='Another twipsy'>have a</a> terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A <a href="#" rel='twipsy' title='Another one here too'>really ironic</a> artisan whatever keytar, scenester farm-to-table banksy Austin <a href="#" rel='twipsy' title='The last tip!'>twitter handle</a> freegan cred raw denim single-origin coffee viral.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@ -647,7 +647,7 @@ $('a[data-toggle="tab"]').bind('shown', function (e) {
|
||||
<h3>Using bootstrap-popover.js</h3>
|
||||
<pre class="prettyprint linenums">$('#example').popover(options)</pre>
|
||||
<h3>Options</h3>
|
||||
<table class="striped-table">
|
||||
<table class="bordered-table striped-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 100px;">Name</th>
|
||||
@ -658,17 +658,11 @@ $('a[data-toggle="tab"]').bind('shown', function (e) {
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>animate</td>
|
||||
<td>animation</td>
|
||||
<td>boolean</td>
|
||||
<td>true</td>
|
||||
<td>apply a css fade transition to the tooltip</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>delay</td>
|
||||
<td>number | object</td>
|
||||
<td>0</td>
|
||||
<td>delay before showing/hiding the tooltip (ms)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>placement</td>
|
||||
<td>string</td>
|
||||
@ -676,16 +670,10 @@ $('a[data-toggle="tab"]').bind('shown', function (e) {
|
||||
<td>how to position the popover - above | below | left | right</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>live</td>
|
||||
<td>boolean</td>
|
||||
<td>selector</td>
|
||||
<td>string</td>
|
||||
<td>false</td>
|
||||
<td>use event delegation instead of individual event handlers</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>offset</td>
|
||||
<td>number</td>
|
||||
<td>0</td>
|
||||
<td>pixel offset of tooltip from target element</td>
|
||||
<td>if a selector is provided, twipsy objects will be delegated to the specified targets</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>trigger</td>
|
||||
@ -693,12 +681,34 @@ $('a[data-toggle="tab"]').bind('shown', function (e) {
|
||||
<td>'hover'</td>
|
||||
<td>how tooltip is triggered - hover | focus | manual</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>title</td>
|
||||
<td>string | function</td>
|
||||
<td>''</td>
|
||||
<td>default title value if `title` attribute isn't present</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>content</td>
|
||||
<td>string | function</td>
|
||||
<td>''</td>
|
||||
<td>default content value if `data-content` attribute isn't present</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>delay</td>
|
||||
<td>number | object</td>
|
||||
<td>0</td>
|
||||
<td>
|
||||
<p>delay showing/hiding the popover (ms)</p>
|
||||
<p>If a number is supplied, delay is applied to both hide/show</p>
|
||||
<p>Object structure is: <code>delay: { show: 500, hide: 100 }</code></p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><span class="label notice">Notice</span> Individual popover instance options can alternatively be specified through the use of data attributes.</code></p>
|
||||
<h3>Markup</h3>
|
||||
<p>
|
||||
For performance reasons, the Twipsy and Popover data-apis are opt in. If you would like to use them just set the live flag to true, however we recommend you know what you are doing if you do that. :)
|
||||
For performance reasons, the Twipsy and Popover data-apis are opt in. If you would like to use them just specify a the selector option.
|
||||
</p>
|
||||
<h3>Methods</h3>
|
||||
<h4>$().popover(options)</h4>
|
||||
@ -810,7 +820,7 @@ $('a[data-toggle="tab"]').bind('shown', function (e) {
|
||||
$('.btn').button('complete')
|
||||
</script></pre>
|
||||
<h3>Demo</h3>
|
||||
<table class="striped-table">
|
||||
<table class="bordered-table striped-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Stateful</td>
|
||||
@ -879,7 +889,7 @@ $('a[data-toggle="tab"]').bind('shown', function (e) {
|
||||
<h3>Using bootstrap-collapse.js</h3>
|
||||
<pre class="prettyprint linenums">$(".collapse").collapse()</pre>
|
||||
<h3>Options</h3>
|
||||
<table class="striped-table">
|
||||
<table class="bordered-table striped-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 100px;">Name</th>
|
||||
@ -929,7 +939,7 @@ $('#myCollapsible').collapse({
|
||||
<p>
|
||||
Bootstrap's collapse class exposes a few events for hooking into collapse functionality.
|
||||
</p>
|
||||
<table class="striped-table">
|
||||
<table class="bordered-table striped-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 150px;">Event</th>
|
||||
@ -959,7 +969,7 @@ $('#myCollapsible').collapse({
|
||||
</table>
|
||||
|
||||
<pre class="prettyprint linenums">
|
||||
$('#myCollapsible').bind('hidden', function () {
|
||||
$('#myCollapsible').on('hidden', function () {
|
||||
// do something ...
|
||||
})</pre>
|
||||
<h3>Demo</h3>
|
||||
|
38
js/README.md
38
js/README.md
@ -1,5 +1,5 @@
|
||||
## 2.0 BOOTSTRAP JS PHILOSOPHY
|
||||
These are the high-level design rules which guide the development of Bootstrap's JS plugins.
|
||||
These are the high-level design rules which guide the development of Bootstrap's plugin apis.
|
||||
|
||||
---
|
||||
|
||||
@ -9,11 +9,11 @@ We believe you should be able to use all plugins provided by Bootstrap purely th
|
||||
|
||||
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')
|
||||
$('body').off('.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')
|
||||
$('body').off('.alert.data-api')
|
||||
|
||||
---
|
||||
|
||||
@ -21,17 +21,19 @@ To target a specific plugin, just include the plugins name as a namespace along
|
||||
|
||||
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.
|
||||
All public APIs should be single, chainable methods, 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
|
||||
$("#myModal").modal({ keyboard: false }) // initialized with now keyboard
|
||||
$("#myModal").modal('show') // initializes and invokes show immediately afterqwe2
|
||||
|
||||
---
|
||||
|
||||
### PLUGIN OPTIONS
|
||||
### OPTIONS
|
||||
|
||||
Options should be sparse and add universal value. We should pick the right defaults.
|
||||
|
||||
@ -51,7 +53,7 @@ examples:
|
||||
|
||||
---
|
||||
|
||||
### PLUGIN EVENTS
|
||||
### 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.
|
||||
|
||||
@ -60,20 +62,36 @@ All events should have an infinitive and past participle form. The infinitive is
|
||||
|
||||
---
|
||||
|
||||
### CONSTRUCTORS
|
||||
|
||||
Each plugin should expose it's raw constructor on a `Constructor` property -- accessed in the following way:
|
||||
|
||||
|
||||
$.fn.popover.Constructor
|
||||
|
||||
---
|
||||
|
||||
### DATA ACCESSOR
|
||||
|
||||
Each plugin stores a copy of the invoked class on an object. This class instance can be accessed directly through jQuery's data api like this:
|
||||
|
||||
$('[rel=popover]').data('popover') instanceof $.fn.popover.Constructor
|
||||
|
||||
---
|
||||
|
||||
### 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
|
||||
- data-{{verb}}={{plugin}} - defines main interaction
|
||||
- data-target || href^=# - defined on "control" element (if element controls an element other than self)
|
||||
- data-{{noun}} - defines class instance options
|
||||
|
||||
examples:
|
||||
|
||||
// control other targets
|
||||
data-toggle="modal" data-target="#foo"
|
||||
data-toggle="collapse" data-target="#foo" data-parent="#foo"
|
||||
data-toggle="collapse" data-target="#foo" data-parent="#bar"
|
||||
|
||||
// defined on element they control
|
||||
data-spy="scroll"
|
||||
|
24
js/bootstrap-alert.js
vendored
24
js/bootstrap-alert.js
vendored
@ -27,7 +27,7 @@
|
||||
|
||||
var dismiss = '[data-dismiss="alert"]'
|
||||
, Alert = function ( el ) {
|
||||
$(el).delegate(dismiss, 'click', this.close)
|
||||
$(el).on('click', dismiss, this.close)
|
||||
}
|
||||
|
||||
Alert.prototype = {
|
||||
@ -35,18 +35,22 @@
|
||||
constructor: Alert
|
||||
|
||||
, close: function ( e ) {
|
||||
var $element = $(this)
|
||||
var $this = $(this)
|
||||
, selector = $this.attr('data-target') || $this.attr('href')
|
||||
, $parent = $(selector)
|
||||
|
||||
$element = $element.hasClass('alert-message') ? $element : $element.parent()
|
||||
e && e.preventDefault()
|
||||
$element.removeClass('in')
|
||||
|
||||
$parent.length || ($parent = $this.hasClass('alert-message') ? $this : $this.parent())
|
||||
|
||||
$parent.removeClass('in')
|
||||
|
||||
function removeElement() {
|
||||
$element.remove()
|
||||
$parent.remove()
|
||||
}
|
||||
|
||||
$.support.transition && $element.hasClass('fade') ?
|
||||
$element.bind($.support.transition.end, removeElement) :
|
||||
$.support.transition && $parent.hasClass('fade') ?
|
||||
$parent.on($.support.transition.end, removeElement) :
|
||||
removeElement()
|
||||
}
|
||||
|
||||
@ -65,14 +69,14 @@
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.alert.Alert = Alert
|
||||
$.fn.alert.Constructor = Alert
|
||||
|
||||
|
||||
/* ALERT DATA-API
|
||||
* ============== */
|
||||
|
||||
$(function () {
|
||||
$('body').delegate(dismiss, 'click.alert.data-api', Alert.prototype.close)
|
||||
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
|
||||
})
|
||||
|
||||
}( window.jQuery || window.ender )
|
||||
}( window.jQuery )
|
14
js/bootstrap-button.js
vendored
14
js/bootstrap-button.js
vendored
@ -24,16 +24,16 @@
|
||||
/* BUTTON PUBLIC CLASS DEFINITION
|
||||
* ============================== */
|
||||
|
||||
var Button = function (element, options) {
|
||||
var Button = function ( element, options ) {
|
||||
this.$element = $(element)
|
||||
this.settings = $.extend({}, $.fn.button.defaults, options)
|
||||
this.options = $.extend({}, $.fn.button.defaults, options)
|
||||
}
|
||||
|
||||
Button.prototype = {
|
||||
|
||||
constructor: Button
|
||||
|
||||
, setState: function (state) {
|
||||
, setState: function ( state ) {
|
||||
var d = 'disabled'
|
||||
, $el = this.$element
|
||||
, data = $el.data()
|
||||
@ -42,7 +42,7 @@
|
||||
state = state + 'Text'
|
||||
data.resetText || $el.data('resetText', $el[val]())
|
||||
|
||||
$el[val](data[state] || this.settings[state])
|
||||
$el[val](data[state] || this.options[state])
|
||||
|
||||
// push to event loop to allow forms to submit
|
||||
setTimeout(function () {
|
||||
@ -83,16 +83,16 @@
|
||||
loadingText: 'loading...'
|
||||
}
|
||||
|
||||
$.fn.button.Button = Button
|
||||
$.fn.button.Constructor = Button
|
||||
|
||||
|
||||
/* BUTTON DATA-API
|
||||
* =============== */
|
||||
|
||||
$(function () {
|
||||
$('body').delegate('[data-toggle^=button]', 'click.button.data-api', function (e) {
|
||||
$('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
|
||||
$(e.srcElement).button('toggle')
|
||||
})
|
||||
})
|
||||
|
||||
}( window.jQuery || window.ender )
|
||||
}( window.jQuery )
|
20
js/bootstrap-carousel.js
vendored
20
js/bootstrap-carousel.js
vendored
@ -25,8 +25,8 @@
|
||||
/* CAROUSEL CLASS DEFINITION
|
||||
* ========================= */
|
||||
|
||||
var Carousel = function ( el ) {
|
||||
$(el).delegate(dismiss, 'click', this.close)
|
||||
var Carousel = function () {
|
||||
|
||||
}
|
||||
|
||||
Carousel.prototype = {
|
||||
@ -40,20 +40,12 @@
|
||||
$.fn.carousel = function ( option ) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('alert')
|
||||
if (!data) $this.data('alert', (data = new Alert(this)))
|
||||
, data = $this.data('carousel')
|
||||
if (!data) $this.data('carousel', (data = new Carousel(this)))
|
||||
if (typeof option == 'string') data[option].call($this)
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.carousel.Carousel = Carousel
|
||||
$.fn.carousel.Constructor = Carousel
|
||||
|
||||
|
||||
/* CAROUSEL DATA-API
|
||||
* ================= */
|
||||
|
||||
// $(function () {
|
||||
// $('body').delegate(dismiss, 'click.alert.data-api', Alert.prototype.close)
|
||||
// })
|
||||
|
||||
}( window.jQuery || window.ender )
|
||||
}( window.jQuery )
|
16
js/bootstrap-collapse.js
vendored
16
js/bootstrap-collapse.js
vendored
@ -23,13 +23,13 @@
|
||||
|
||||
var Collapse = function ( element, options ) {
|
||||
this.$element = $(element)
|
||||
this.settings = $.extend({}, $.fn.collapse.defaults, options)
|
||||
this.options = $.extend({}, $.fn.collapse.defaults, options)
|
||||
|
||||
if (this.settings["parent"]) {
|
||||
this.$parent = $(this.settings["parent"])
|
||||
if (this.options["parent"]) {
|
||||
this.$parent = $(this.options["parent"])
|
||||
}
|
||||
|
||||
this.settings.toggle && this.toggle()
|
||||
this.options.toggle && this.toggle()
|
||||
}
|
||||
|
||||
Collapse.prototype = {
|
||||
@ -116,20 +116,20 @@
|
||||
toggle: true
|
||||
}
|
||||
|
||||
$.fn.collapse.Collapse = Collapse
|
||||
$.fn.collapse.Constructor = Collapse
|
||||
|
||||
|
||||
/* COLLAPSIBLE DATA-API
|
||||
* ==================== */
|
||||
|
||||
$(function () {
|
||||
$('body').delegate('[data-toggle=collapse]', 'click.collapse.data-api', function ( e ) {
|
||||
$('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
|
||||
var $this = $(this)
|
||||
, target = $this.attr('data-target') || $this.attr('href')
|
||||
, option = $(target).data('collapse') ? 'toggle' : $this.data()
|
||||
e.preventDefault()
|
||||
e.preventDefault()
|
||||
$(target).collapse(option)
|
||||
})
|
||||
})
|
||||
|
||||
})( window.jQuery || window.ender )
|
||||
})( window.jQuery )
|
20
js/bootstrap-dropdown.js
vendored
20
js/bootstrap-dropdown.js
vendored
@ -35,11 +35,15 @@
|
||||
constructor: Dropdown
|
||||
|
||||
, toggle: function ( e ) {
|
||||
var li = $(this).parent('li')
|
||||
, isActive = li.hasClass('open')
|
||||
var $this = $(this)
|
||||
, selector = $this.attr('data-target') || $this.attr('href')
|
||||
, $parent = $(selector)
|
||||
|
||||
$parent.length || ($parent = $this.parent())
|
||||
|
||||
clearMenus()
|
||||
!isActive && li.toggleClass('open')
|
||||
|
||||
!$parent.hasClass('open') && $parent.toggleClass('open')
|
||||
|
||||
return false
|
||||
}
|
||||
@ -47,7 +51,7 @@
|
||||
}
|
||||
|
||||
function clearMenus() {
|
||||
$(toggle).parent('li').removeClass('open')
|
||||
$(toggle).parent().removeClass('open')
|
||||
}
|
||||
|
||||
|
||||
@ -63,13 +67,15 @@
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.dropdown.Constructor = Dropdown
|
||||
|
||||
|
||||
/* APPLY TO STANDARD DROPDOWN ELEMENTS
|
||||
* =================================== */
|
||||
|
||||
$(function () {
|
||||
$('html').bind('click.dropdown.data-api', clearMenus)
|
||||
$('body').delegate(toggle, 'click.dropdown.data-api', Dropdown.prototype.toggle)
|
||||
$('html').on('click.dropdown.data-api', clearMenus)
|
||||
$('body').on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
|
||||
})
|
||||
|
||||
}( window.jQuery || window.ender )
|
||||
}( window.jQuery )
|
36
js/bootstrap-modal.js
vendored
36
js/bootstrap-modal.js
vendored
@ -26,10 +26,9 @@
|
||||
* ====================== */
|
||||
|
||||
var Modal = function ( content, options ) {
|
||||
this.settings = $.extend({}, $.fn.modal.defaults, options)
|
||||
this.options = $.extend({}, $.fn.modal.defaults, options)
|
||||
this.$element = $(content)
|
||||
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
|
||||
this.settings.show && this.show()
|
||||
}
|
||||
|
||||
Modal.prototype = {
|
||||
@ -97,7 +96,7 @@
|
||||
function hideWithTransition() {
|
||||
var that = this
|
||||
, timeout = setTimeout(function () {
|
||||
that.$element.unbind($.support.transition.end)
|
||||
that.$element.off($.support.transition.end)
|
||||
hideModal.call(that)
|
||||
}, 500)
|
||||
|
||||
@ -107,7 +106,7 @@
|
||||
})
|
||||
}
|
||||
|
||||
function hideModal (that) {
|
||||
function hideModal( that ) {
|
||||
this.$element
|
||||
.hide()
|
||||
.trigger('hidden')
|
||||
@ -115,17 +114,17 @@
|
||||
backdrop.call(this)
|
||||
}
|
||||
|
||||
function backdrop ( callback ) {
|
||||
function backdrop( callback ) {
|
||||
var that = this
|
||||
, animate = this.$element.hasClass('fade') ? 'fade' : ''
|
||||
|
||||
if (this.isShown && this.settings.backdrop) {
|
||||
if (this.isShown && this.options.backdrop) {
|
||||
var doAnimate = $.support.transition && animate
|
||||
|
||||
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
||||
.appendTo(document.body)
|
||||
|
||||
if (this.settings.backdrop != 'static') {
|
||||
if (this.options.backdrop != 'static') {
|
||||
this.$backdrop.click($.proxy(this.hide, this))
|
||||
}
|
||||
|
||||
@ -156,12 +155,12 @@
|
||||
|
||||
function escape() {
|
||||
var that = this
|
||||
if (this.isShown && this.settings.keyboard) {
|
||||
$(document).bind('keyup.dismiss.modal', function ( e ) {
|
||||
if (this.isShown && this.options.keyboard) {
|
||||
$(document).on('keyup.dismiss.modal', function ( e ) {
|
||||
e.which == 27 && that.hide()
|
||||
})
|
||||
} else if (!this.isShown) {
|
||||
$(document).unbind('keyup.dismiss.modal')
|
||||
$(document).off('keyup.dismiss.modal')
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,29 +175,30 @@
|
||||
, options = typeof option == 'object' && option
|
||||
if (!data) $this.data('modal', (data = new Modal(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
else data.show()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.modal.defaults = {
|
||||
backdrop: true
|
||||
, keyboard: true
|
||||
, show: true
|
||||
}
|
||||
|
||||
$.fn.modal.Modal = Modal
|
||||
$.fn.modal.Constructor = Modal
|
||||
|
||||
|
||||
/* MODAL DATA-API
|
||||
* ============== */
|
||||
|
||||
$(document).ready(function () {
|
||||
$('body').delegate('[data-toggle="modal"]', 'click.modal.data-api', function ( e ) {
|
||||
$(function () {
|
||||
$('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
|
||||
var $this = $(this)
|
||||
, target = $this.attr('data-target') || $this.attr('href')
|
||||
, option = $(target).data('modal') ? 'toggle' : $this.data()
|
||||
, $target = $($this.attr('data-target') || $this.attr('href'))
|
||||
, option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
|
||||
|
||||
e.preventDefault()
|
||||
$(target).modal(option)
|
||||
$target.modal(option)
|
||||
})
|
||||
})
|
||||
|
||||
}( window.jQuery || window.ender )
|
||||
}( window.jQuery )
|
45
js/bootstrap-popover.js
vendored
45
js/bootstrap-popover.js
vendored
@ -23,16 +23,13 @@
|
||||
"use strict"
|
||||
|
||||
var Popover = function ( element, options ) {
|
||||
this.$element = $(element)
|
||||
this.options = options
|
||||
this.enabled = true
|
||||
this.fixTitle()
|
||||
this.init('popover', element, options)
|
||||
}
|
||||
|
||||
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TWIPSY.js
|
||||
========================================= */
|
||||
|
||||
Popover.prototype = $.extend({}, $.fn.twipsy.Twipsy.prototype, {
|
||||
Popover.prototype = $.extend({}, $.fn.twipsy.Constructor.prototype, {
|
||||
|
||||
constructor: Popover
|
||||
|
||||
@ -53,22 +50,20 @@
|
||||
|
||||
, getContent: function () {
|
||||
var content
|
||||
, $e = this.$element
|
||||
, o = this.options
|
||||
, $e = this.$element
|
||||
, o = this.options
|
||||
|
||||
if (typeof this.options.content == 'string') {
|
||||
content = $e.attr(this.options.content)
|
||||
} else if (typeof this.options.content == 'function') {
|
||||
content = this.options.content.call(this.$element[0])
|
||||
}
|
||||
content = $e.attr('data-content')
|
||||
|| (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
|
||||
|
||||
content = content.toString().replace(/(^\s*|\s*$)/, "")
|
||||
|
||||
return content
|
||||
}
|
||||
|
||||
, tip: function() {
|
||||
if (!this.$tip) {
|
||||
this.$tip = $('<div class="popover" />')
|
||||
.html(this.options.template)
|
||||
this.$tip = $(this.options.template)
|
||||
}
|
||||
return this.$tip
|
||||
}
|
||||
@ -79,18 +74,22 @@
|
||||
/* POPOVER PLUGIN DEFINITION
|
||||
* ======================= */
|
||||
|
||||
$.fn.popover = function (options) {
|
||||
if (typeof options == 'object') options = $.extend({}, $.fn.popover.defaults, options)
|
||||
$.fn.twipsy.initWith.call(this, options, Popover, 'popover')
|
||||
return this
|
||||
$.fn.popover = function ( option ) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('popover')
|
||||
, options = typeof option == 'object' && option
|
||||
if (!data) $this.data('popover', (data = new Popover(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.popover.Constructor = Popover
|
||||
|
||||
$.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>'
|
||||
, content: ''
|
||||
, template: '<div class="popover"><div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div></div>'
|
||||
})
|
||||
|
||||
$.fn.twipsy.rejectAttrOptions.push( 'content' )
|
||||
|
||||
}( window.jQuery || window.ender )
|
||||
}( window.jQuery )
|
8
js/bootstrap-scrollspy.js
vendored
8
js/bootstrap-scrollspy.js
vendored
@ -27,11 +27,11 @@
|
||||
function ScrollSpy( element ) {
|
||||
var process = $.proxy(this.process, this)
|
||||
|
||||
this.$scrollElement = $(element).bind('scroll.scroll.data-api', process)
|
||||
this.$scrollElement = $(element).on('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.$body = $('body').on('click.scroll.data-api', this.selector, process)
|
||||
|
||||
this.refresh()
|
||||
this.process()
|
||||
@ -103,7 +103,7 @@
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.scrollspy.ScrollSpy = ScrollSpy
|
||||
$.fn.scrollspy.Constructor = ScrollSpy
|
||||
|
||||
|
||||
/* SCROLLSPY DATA-API
|
||||
@ -111,4 +111,4 @@
|
||||
|
||||
$(function () { $('[data-spy="scroll"]').scrollspy() })
|
||||
|
||||
}( window.jQuery || window.ender )
|
||||
}( window.jQuery )
|
57
js/bootstrap-tab.js
vendored
57
js/bootstrap-tab.js
vendored
@ -52,26 +52,45 @@
|
||||
$href = $(href)
|
||||
|
||||
this.activate($this.parent('li'), $ul)
|
||||
this.activate($href, $href.parent())
|
||||
|
||||
$this.trigger({
|
||||
type: 'shown'
|
||||
, relatedTarget: previous
|
||||
this.activate($href, $href.parent(), function () {
|
||||
$this.trigger({
|
||||
type: 'shown'
|
||||
, relatedTarget: previous
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
, activate: function ( element, container ) {
|
||||
container
|
||||
.find('> .active')
|
||||
.removeClass('active')
|
||||
.find('> .dropdown-menu > .active')
|
||||
.removeClass('active')
|
||||
, activate: function ( element, container, callback) {
|
||||
var $active = container.find('> .active')
|
||||
, transition = callback
|
||||
&& $.support.transition
|
||||
&& $active.hasClass('fade')
|
||||
|
||||
element.addClass('active')
|
||||
function next() {
|
||||
$active
|
||||
.removeClass('active')
|
||||
.find('> .dropdown-menu > .active')
|
||||
.removeClass('active')
|
||||
|
||||
if ( element.parent('.dropdown-menu') ) {
|
||||
element.closest('li.dropdown').addClass('active')
|
||||
element.addClass('active')
|
||||
|
||||
if (transition) {
|
||||
element[0].offsetWidth // reflow for transition
|
||||
element.addClass('in')
|
||||
}
|
||||
|
||||
if ( element.parent('.dropdown-menu') ) {
|
||||
element.closest('li.dropdown').addClass('active')
|
||||
}
|
||||
|
||||
callback && callback()
|
||||
}
|
||||
|
||||
transition ?
|
||||
$active.one($.support.transition.end, next) :
|
||||
next()
|
||||
|
||||
$active.removeClass('in')
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +98,7 @@
|
||||
/* TAB PLUGIN DEFINITION
|
||||
* ===================== */
|
||||
|
||||
$.fn.tab = function (option) {
|
||||
$.fn.tab = function ( option ) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('tab')
|
||||
@ -88,17 +107,17 @@
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.tab.Tab = Tab
|
||||
$.fn.tab.Constructor = Tab
|
||||
|
||||
|
||||
/* TAB DATA-API
|
||||
* ============ */
|
||||
|
||||
$(document).ready(function () {
|
||||
$('body').delegate('[data-toggle="tab"], [data-toggle="pill"]', 'click.tab.data-api', function (e) {
|
||||
$(function () {
|
||||
$('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
|
||||
e.preventDefault()
|
||||
$(this).tab('show')
|
||||
})
|
||||
})
|
||||
|
||||
}( window.jQuery || window.ender )
|
||||
}( window.jQuery )
|
45
js/bootstrap-transitions.js
vendored
45
js/bootstrap-transitions.js
vendored
@ -1,45 +0,0 @@
|
||||
/* ===================================================
|
||||
* bootstrap-transitions.js v2.0.0
|
||||
* http://twitter.github.com/bootstrap/javascript.html
|
||||
* ===================================================
|
||||
* 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 () {
|
||||
|
||||
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
|
||||
* ======================================================= */
|
||||
|
||||
$.support.transition = (function () {
|
||||
var thisBody = document.body || document.documentElement
|
||||
, thisStyle = thisBody.style
|
||||
, support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
|
||||
|
||||
return support && {
|
||||
end: (function () {
|
||||
var transitionEnd = "TransitionEnd"
|
||||
if ( $.browser.webkit ) {
|
||||
transitionEnd = "webkitTransitionEnd"
|
||||
} else if ( $.browser.mozilla ) {
|
||||
transitionEnd = "transitionend"
|
||||
} else if ( $.browser.opera ) {
|
||||
transitionEnd = "oTransitionEnd"
|
||||
}
|
||||
return transitionEnd
|
||||
}())
|
||||
}
|
||||
})()
|
||||
|
||||
})
|
238
js/bootstrap-twipsy.js
vendored
238
js/bootstrap-twipsy.js
vendored
@ -1,7 +1,7 @@
|
||||
/* ==========================================================
|
||||
* bootstrap-twipsy.js v2.0.0
|
||||
* http://twitter.github.com/bootstrap/javascript.html#twipsy
|
||||
* Adapted from the original jQuery.tipsy by Jason Frame
|
||||
* Inspired by the original jQuery.tipsy by Jason Frame
|
||||
* ==========================================================
|
||||
* Copyright 2011 Twitter, Inc.
|
||||
*
|
||||
@ -26,29 +26,90 @@
|
||||
* ============================== */
|
||||
|
||||
var Twipsy = function ( element, options ) {
|
||||
this.$element = $(element)
|
||||
this.options = options
|
||||
this.enabled = true
|
||||
this.fixTitle()
|
||||
this.init('twipsy', element, options)
|
||||
}
|
||||
|
||||
Twipsy.prototype = {
|
||||
|
||||
constructor: Twipsy
|
||||
|
||||
, show: function() {
|
||||
var pos
|
||||
, init: function ( type, element, options ) {
|
||||
var eventIn
|
||||
, eventOut
|
||||
|
||||
this.type = type
|
||||
this.$element = $(element)
|
||||
this.options = this.getOptions(options)
|
||||
this.enabled = true
|
||||
|
||||
if (this.options.trigger != 'manual') {
|
||||
eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
|
||||
eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
|
||||
this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this))
|
||||
this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this))
|
||||
}
|
||||
|
||||
this.options.selector ?
|
||||
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
|
||||
this.fixTitle()
|
||||
}
|
||||
|
||||
, getOptions: function ( options ) {
|
||||
options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
|
||||
|
||||
if (options.delay && typeof options.delay == 'number') {
|
||||
options.delay = {
|
||||
show: options.delay
|
||||
, hide: options.delay
|
||||
}
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
, enter: function ( e ) {
|
||||
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
|
||||
|
||||
if (!self.options.delay || !self.options.delay.show) {
|
||||
self.show()
|
||||
} else {
|
||||
self.hoverState = 'in'
|
||||
setTimeout(function() {
|
||||
if (self.hoverState == 'in') {
|
||||
self.show()
|
||||
}
|
||||
}, self.options.delay.show)
|
||||
}
|
||||
}
|
||||
|
||||
, leave: function ( e ) {
|
||||
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
|
||||
|
||||
if (!self.options.delay || !self.options.delay.hide) {
|
||||
self.hide()
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
self.hoverState = 'out'
|
||||
if (self.hoverState == 'out') {
|
||||
self.hide()
|
||||
}
|
||||
}, self.options.delay.hide)
|
||||
}
|
||||
}
|
||||
|
||||
, show: function () {
|
||||
var $tip
|
||||
, pos
|
||||
, actualWidth
|
||||
, actualHeight
|
||||
, placement
|
||||
, $tip
|
||||
, tp
|
||||
|
||||
if (this.hasContent() && this.enabled) {
|
||||
$tip = this.tip()
|
||||
this.setContent()
|
||||
|
||||
if (this.options.animate) {
|
||||
if (this.options.animation) {
|
||||
$tip.addClass('fade')
|
||||
}
|
||||
|
||||
@ -69,16 +130,16 @@
|
||||
|
||||
switch (placement) {
|
||||
case 'below':
|
||||
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
|
||||
tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
|
||||
break
|
||||
case 'above':
|
||||
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2}
|
||||
tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
|
||||
break
|
||||
case 'left':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset}
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
|
||||
break
|
||||
case 'right':
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset}
|
||||
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
|
||||
break
|
||||
}
|
||||
|
||||
@ -95,7 +156,7 @@
|
||||
$tip[0].className = 'twipsy'
|
||||
}
|
||||
|
||||
, hide: function() {
|
||||
, hide: function () {
|
||||
var that = this
|
||||
, $tip = this.tip()
|
||||
|
||||
@ -106,11 +167,11 @@
|
||||
}
|
||||
|
||||
$.support.transition && this.$tip.hasClass('fade') ?
|
||||
$tip.bind( $.support.transition.end, removeElement) :
|
||||
$tip.on($.support.transition.end, removeElement) :
|
||||
removeElement()
|
||||
}
|
||||
|
||||
, fixTitle: function() {
|
||||
, fixTitle: function () {
|
||||
var $e = this.$element
|
||||
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
|
||||
$e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
|
||||
@ -121,29 +182,24 @@
|
||||
return this.getTitle()
|
||||
}
|
||||
|
||||
, getTitle: function() {
|
||||
, getTitle: function () {
|
||||
var title
|
||||
, $e = this.$element
|
||||
, o = this.options
|
||||
|
||||
this.fixTitle()
|
||||
title = $e.attr('data-original-title')
|
||||
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
|
||||
|
||||
if (typeof o.title == 'string') {
|
||||
title = $e.attr(o.title == 'title' ? 'data-original-title' : o.title)
|
||||
} else if (typeof o.title == 'function') {
|
||||
title = o.title.call($e[0])
|
||||
}
|
||||
title = title.toString().replace(/(^\s*|\s*$)/, "")
|
||||
|
||||
title = ('' + title).replace(/(^\s*|\s*$)/, "")
|
||||
|
||||
return title
|
||||
return title
|
||||
}
|
||||
|
||||
, tip: function() {
|
||||
return this.$tip = this.$tip || $('<div class="twipsy" />').html(this.options.template)
|
||||
, tip: function () {
|
||||
return this.$tip = this.$tip || $(this.options.template)
|
||||
}
|
||||
|
||||
, validate: function() {
|
||||
, validate: function () {
|
||||
if (!this.$element[0].parentNode) {
|
||||
this.hide()
|
||||
this.$element = null
|
||||
@ -151,15 +207,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
, enable: function() {
|
||||
, enable: function () {
|
||||
this.enabled = true
|
||||
}
|
||||
|
||||
, disable: function() {
|
||||
, disable: function () {
|
||||
this.enabled = false
|
||||
}
|
||||
|
||||
, toggleEnabled: function() {
|
||||
, toggleEnabled: function () {
|
||||
this.enabled = !this.enabled
|
||||
}
|
||||
|
||||
@ -177,118 +233,30 @@
|
||||
return typeof thing == 'function' ? thing.apply(ctx, args) : thing
|
||||
}
|
||||
|
||||
|
||||
/* TWIPSY PLUGIN DEFINITION
|
||||
* ======================== */
|
||||
|
||||
$.fn.twipsy = function (options) {
|
||||
$.fn.twipsy.initWith.call(this, options, Twipsy, 'twipsy')
|
||||
return this
|
||||
$.fn.twipsy = function ( option ) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('twipsy')
|
||||
, options = typeof option == 'object' && option
|
||||
if (!data) $this.data('twipsy', (data = new Twipsy(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.twipsy.initWith = function (options, Base, name) {
|
||||
var twipsy
|
||||
, binder
|
||||
, eventIn
|
||||
, eventOut
|
||||
|
||||
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)
|
||||
|
||||
if (!twipsy) {
|
||||
twipsy = new Base(ele, $.fn.twipsy.elementOptions(ele, options))
|
||||
$.data(ele, name, twipsy)
|
||||
}
|
||||
|
||||
return twipsy
|
||||
}
|
||||
|
||||
function enter() {
|
||||
var twipsy = get(this)
|
||||
twipsy.hoverState = 'in'
|
||||
|
||||
if (!options.delay || !options.delay.show) {
|
||||
twipsy.show()
|
||||
} else {
|
||||
twipsy.fixTitle()
|
||||
setTimeout(function() {
|
||||
if (twipsy.hoverState == 'in') {
|
||||
twipsy.show()
|
||||
}
|
||||
}, options.delay.show)
|
||||
}
|
||||
}
|
||||
|
||||
function leave() {
|
||||
var twipsy = get(this)
|
||||
twipsy.hoverState = 'out'
|
||||
if (!options.delay || !options.delay.hide) {
|
||||
twipsy.hide()
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
if (twipsy.hoverState == 'out') {
|
||||
twipsy.hide()
|
||||
}
|
||||
}, options.delay.hide)
|
||||
}
|
||||
}
|
||||
|
||||
if (!options.live) {
|
||||
this.each(function() {
|
||||
get(this)
|
||||
})
|
||||
}
|
||||
|
||||
if (options.trigger != 'manual') {
|
||||
binder = options.live ? 'live' : 'bind'
|
||||
eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus'
|
||||
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur'
|
||||
this[binder](eventIn, enter)[binder](eventOut, leave)
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
$.fn.twipsy.Twipsy = Twipsy
|
||||
$.fn.twipsy.Constructor = Twipsy
|
||||
|
||||
$.fn.twipsy.defaults = {
|
||||
animate: true
|
||||
animation: true
|
||||
, delay: 0
|
||||
, selector: false
|
||||
, placement: 'above'
|
||||
, live: false
|
||||
, offset: 0
|
||||
, trigger: 'hover'
|
||||
, title: 'title'
|
||||
, template: '<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>'
|
||||
, title: ''
|
||||
, template: '<div class="twipsy"><div class="twipsy-arrow"></div><div class="twipsy-inner"></div></div>'
|
||||
}
|
||||
|
||||
$.fn.twipsy.rejectAttrOptions = [ 'title' ]
|
||||
|
||||
$.fn.twipsy.elementOptions = function(ele, 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 )
|
||||
}( window.jQuery )
|
@ -4,28 +4,36 @@
|
||||
<title>Bootstrap Plugin Test Suite</title>
|
||||
|
||||
<!-- jquery -->
|
||||
<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
|
||||
<!--<script src="http://code.jquery.com/jquery-1.7.min.js"></script>-->
|
||||
<script src="vendor/jquery.js"></script>
|
||||
|
||||
<!-- qunit -->
|
||||
<link rel="stylesheet" href="vendor/qunit.css" type="text/css" media="screen" />
|
||||
<script src="vendor/qunit.js"></script>
|
||||
|
||||
<!-- plugin sources -->
|
||||
<script src="../../js/bootstrap-transitions.js"></script>
|
||||
<script src="../../js/bootstrap-alerts.js"></script>
|
||||
<script src="../../js/bootstrap-transition.js"></script>
|
||||
<script src="../../js/bootstrap-alert.js"></script>
|
||||
<script src="../../js/bootstrap-button.js"></script>
|
||||
<script src="../../js/bootstrap-collapse.js"></script>
|
||||
<script src="../../js/bootstrap-dropdown.js"></script>
|
||||
<script src="../../js/bootstrap-modal.js"></script>
|
||||
<script src="../../js/bootstrap-tabs.js"></script>
|
||||
<script src="../../js/bootstrap-scrollspy.js"></script>
|
||||
<script src="../../js/bootstrap-tab.js"></script>
|
||||
<script src="../../js/bootstrap-twipsy.js"></script>
|
||||
<script src="../../js/bootstrap-popover.js"></script>
|
||||
|
||||
<!-- unit tests -->
|
||||
<script src="unit/bootstrap-alerts.js"></script>
|
||||
<script src="unit/bootstrap-transition.js"></script>
|
||||
<script src="unit/bootstrap-alert.js"></script>
|
||||
<script src="unit/bootstrap-button.js"></script>
|
||||
<script src="unit/bootstrap-collapse.js"></script>
|
||||
<script src="unit/bootstrap-dropdown.js"></script>
|
||||
<script src="unit/bootstrap-modal.js"></script>
|
||||
<script src="unit/bootstrap-popover.js"></script>
|
||||
<script src="unit/bootstrap-tabs.js"></script>
|
||||
<script src="unit/bootstrap-scrollspy.js"></script>
|
||||
<script src="unit/bootstrap-tab.js"></script>
|
||||
<script src="unit/bootstrap-twipsy.js"></script>
|
||||
<script src="unit/bootstrap-popover.js"></script>
|
||||
|
||||
<body>
|
||||
<div>
|
||||
@ -33,7 +41,7 @@
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="qunit-runoff"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -12,7 +12,7 @@ $(function () {
|
||||
|
||||
test("should fade element out on clicking .close", function () {
|
||||
var alertHTML = '<div class="alert-message warning fade in">'
|
||||
+ '<a class="close" href="#">×</a>'
|
||||
+ '<a class="close" href="#" data-dismiss="alert">×</a>'
|
||||
+ '<p><strong>Holy guacamole!</strong> Best check yo self, you’re not looking too good.</p>'
|
||||
+ '</div>'
|
||||
, alert = $(alertHTML).alert()
|
||||
@ -26,16 +26,16 @@ $(function () {
|
||||
$.support.transition = false
|
||||
|
||||
var alertHTML = '<div class="alert-message warning fade in">'
|
||||
+ '<a class="close" href="#">×</a>'
|
||||
+ '<a class="close" href="#" data-dismiss="alert">×</a>'
|
||||
+ '<p><strong>Holy guacamole!</strong> Best check yo self, you’re not looking too good.</p>'
|
||||
+ '</div>'
|
||||
, alert = $(alertHTML).appendTo('#qunit-runoff').alert()
|
||||
, alert = $(alertHTML).appendTo('#qunit-fixture').alert()
|
||||
|
||||
ok($('#qunit-runoff').find('.alert-message').length, 'element added to dom')
|
||||
ok($('#qunit-fixture').find('.alert-message').length, 'element added to dom')
|
||||
|
||||
alert.find('.close').click()
|
||||
|
||||
ok(!$('#qunit-runoff').find('.alert-message').length, 'element removed from dom')
|
||||
ok(!$('#qunit-fixture').find('.alert-message').length, 'element removed from dom')
|
||||
})
|
||||
|
||||
})
|
54
js/tests/unit/bootstrap-button.js
vendored
Normal file
54
js/tests/unit/bootstrap-button.js
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
$(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')
|
||||
stop()
|
||||
setTimeout(function () {
|
||||
ok(btn.attr('disabled'), 'btn is disabled')
|
||||
ok(btn.hasClass('disabled'), 'btn has disabled class')
|
||||
start()
|
||||
}, 0)
|
||||
})
|
||||
|
||||
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')
|
||||
stop()
|
||||
setTimeout(function () {
|
||||
ok(btn.attr('disabled'), 'btn is disabled')
|
||||
ok(btn.hasClass('disabled'), 'btn has disabled class')
|
||||
start()
|
||||
stop()
|
||||
}, 0)
|
||||
btn.button('reset')
|
||||
equals(btn.html(), 'mdo', 'btn text equals mdo')
|
||||
setTimeout(function () {
|
||||
ok(!btn.attr('disabled'), 'btn is not disabled')
|
||||
ok(!btn.hasClass('disabled'), 'btn does not have disabled class')
|
||||
start()
|
||||
}, 0)
|
||||
})
|
||||
|
||||
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')
|
||||
})
|
||||
|
||||
})
|
25
js/tests/unit/bootstrap-collapse.js
vendored
Normal file
25
js/tests/unit/bootstrap-collapse.js
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
$(function () {
|
||||
|
||||
module("bootstrap-collapse")
|
||||
|
||||
test("should be defined on jquery object", function () {
|
||||
ok($(document.body).collapse, 'collapse method is defined')
|
||||
})
|
||||
|
||||
test("should return element", function () {
|
||||
ok($(document.body).collapse()[0] == document.body, 'document.body returned')
|
||||
})
|
||||
|
||||
test("should show a collapsed element", function () {
|
||||
var el = $('<div class="collapse"></div>').collapse('show')
|
||||
ok(el.hasClass('in'), 'has class in')
|
||||
ok(/height/.test(el.attr('style')), 'has height set')
|
||||
})
|
||||
|
||||
test("should hide a collapsed element", function () {
|
||||
var el = $('<div class="collapse"></div>').collapse('hide')
|
||||
ok(!el.hasClass('in'), 'does not have class in')
|
||||
ok(/height/.test(el.attr('style')), 'has height set')
|
||||
})
|
||||
|
||||
})
|
21
js/tests/unit/bootstrap-dropdown.js
vendored
21
js/tests/unit/bootstrap-dropdown.js
vendored
@ -13,7 +13,7 @@ $(function () {
|
||||
test("should add class open to menu if clicked", function () {
|
||||
var dropdownHTML = '<ul class="tabs">'
|
||||
+ '<li class="dropdown">'
|
||||
+ '<a href="#" class="dropdown-toggle">Dropdown</a>'
|
||||
+ '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
|
||||
+ '<ul class="dropdown-menu">'
|
||||
+ '<li><a href="#">Secondary link</a></li>'
|
||||
+ '<li><a href="#">Something else here</a></li>'
|
||||
@ -22,16 +22,15 @@ $(function () {
|
||||
+ '</ul>'
|
||||
+ '</li>'
|
||||
+ '</ul>'
|
||||
, dropdown = $(dropdownHTML).dropdown()
|
||||
, dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click()
|
||||
|
||||
dropdown.find('.dropdown-toggle').click()
|
||||
ok(dropdown.find('.dropdown').hasClass('open'), 'open class added on click')
|
||||
ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
|
||||
})
|
||||
|
||||
test("should remove open class if body clicked", function () {
|
||||
var dropdownHTML = '<ul class="tabs">'
|
||||
+ '<li class="dropdown">'
|
||||
+ '<a href="#" class="dropdown-toggle">Dropdown</a>'
|
||||
+ '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
|
||||
+ '<ul class="dropdown-menu">'
|
||||
+ '<li><a href="#">Secondary link</a></li>'
|
||||
+ '<li><a href="#">Something else here</a></li>'
|
||||
@ -40,12 +39,14 @@ $(function () {
|
||||
+ '</ul>'
|
||||
+ '</li>'
|
||||
+ '</ul>'
|
||||
, dropdown = $(dropdownHTML).dropdown().appendTo('#qunit-runoff')
|
||||
|
||||
dropdown.find('.dropdown-toggle').click()
|
||||
ok(dropdown.find('.dropdown').hasClass('open'), 'open class added on click')
|
||||
, dropdown = $(dropdownHTML)
|
||||
.appendTo('#qunit-fixture')
|
||||
.find('[data-toggle="dropdown"]')
|
||||
.dropdown()
|
||||
.click()
|
||||
ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
|
||||
$('body').click()
|
||||
ok(!dropdown.find('.dropdown').hasClass('open'), 'open class removed')
|
||||
ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class removed')
|
||||
dropdown.remove()
|
||||
})
|
||||
|
||||
|
28
js/tests/unit/bootstrap-modal.js
vendored
28
js/tests/unit/bootstrap-modal.js
vendored
@ -10,6 +10,7 @@ $(function () {
|
||||
test("should return element", function () {
|
||||
var div = $("<div id='modal-test'></div>")
|
||||
ok(div.modal() == div, 'document.body returned')
|
||||
$('#modal-test').remove()
|
||||
})
|
||||
|
||||
test("should expose defaults var for settings", function () {
|
||||
@ -19,32 +20,29 @@ $(function () {
|
||||
test("should insert into dom when show method is called", function () {
|
||||
stop()
|
||||
$.support.transition = false
|
||||
var div = $("<div id='modal-test'></div>")
|
||||
div
|
||||
.modal()
|
||||
.modal("show")
|
||||
$("<div id='modal-test'></div>")
|
||||
.bind("shown", function () {
|
||||
ok($('#modal-test').length, 'modal insterted into dom')
|
||||
$(this).remove()
|
||||
start()
|
||||
div.remove()
|
||||
})
|
||||
.modal("show")
|
||||
})
|
||||
|
||||
test("should hide modal when hide is called", function () {
|
||||
stop()
|
||||
$.support.transition = false
|
||||
var div = $("<div id='modal-test'></div>")
|
||||
div
|
||||
.modal()
|
||||
|
||||
$("<div id='modal-test'></div>")
|
||||
.bind("shown", function () {
|
||||
ok($('#modal-test').is(":visible"), 'modal visible')
|
||||
ok($('#modal-test').length, 'modal insterted into dom')
|
||||
div.modal("hide")
|
||||
$(this).modal("hide")
|
||||
})
|
||||
.bind("hidden", function() {
|
||||
ok(!$('#modal-test').is(":visible"), 'modal hidden')
|
||||
$('#modal-test').remove()
|
||||
start()
|
||||
div.remove()
|
||||
})
|
||||
.modal("show")
|
||||
})
|
||||
@ -54,7 +52,6 @@ $(function () {
|
||||
$.support.transition = false
|
||||
var div = $("<div id='modal-test'></div>")
|
||||
div
|
||||
.modal()
|
||||
.bind("shown", function () {
|
||||
ok($('#modal-test').is(":visible"), 'modal visible')
|
||||
ok($('#modal-test').length, 'modal insterted into dom')
|
||||
@ -62,18 +59,17 @@ $(function () {
|
||||
})
|
||||
.bind("hidden", function() {
|
||||
ok(!$('#modal-test').is(":visible"), 'modal hidden')
|
||||
start()
|
||||
div.remove()
|
||||
start()
|
||||
})
|
||||
.modal("toggle")
|
||||
})
|
||||
|
||||
test("should remove from dom when click .close", function () {
|
||||
test("should remove from dom when click [data-dismiss=modal]", function () {
|
||||
stop()
|
||||
$.support.transition = false
|
||||
var div = $("<div id='modal-test'><span class='close'></span></div>")
|
||||
var div = $("<div id='modal-test'><span class='close' data-dismiss='modal'></span></div>")
|
||||
div
|
||||
.modal()
|
||||
.bind("shown", function () {
|
||||
ok($('#modal-test').is(":visible"), 'modal visible')
|
||||
ok($('#modal-test').length, 'modal insterted into dom')
|
||||
@ -81,8 +77,8 @@ $(function () {
|
||||
})
|
||||
.bind("hidden", function() {
|
||||
ok(!$('#modal-test').is(":visible"), 'modal hidden')
|
||||
start()
|
||||
div.remove()
|
||||
start()
|
||||
})
|
||||
.modal("toggle")
|
||||
})
|
||||
|
12
js/tests/unit/bootstrap-popover.js
vendored
12
js/tests/unit/bootstrap-popover.js
vendored
@ -15,14 +15,12 @@ $(function () {
|
||||
test("should render popover element", function () {
|
||||
$.support.transition = false
|
||||
var popover = $('<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>')
|
||||
.appendTo('#qunit-runoff')
|
||||
.popover()
|
||||
.appendTo('#qunit-fixture')
|
||||
.popover('show')
|
||||
|
||||
ok($('.popover').length, 'popover was inserted')
|
||||
popover.popover('hide')
|
||||
ok(!$(".popover").length, 'popover removed')
|
||||
$('#qunit-runoff').empty()
|
||||
})
|
||||
|
||||
test("should store popover instance in popover data object", function () {
|
||||
@ -36,7 +34,7 @@ $(function () {
|
||||
test("should get title and content from options", function () {
|
||||
$.support.transition = false
|
||||
var popover = $('<a href="#">@fat</a>')
|
||||
.appendTo('#qunit-runoff')
|
||||
.appendTo('#qunit-fixture')
|
||||
.popover({
|
||||
title: function () {
|
||||
return '@fat'
|
||||
@ -54,13 +52,13 @@ $(function () {
|
||||
|
||||
popover.popover('hide')
|
||||
ok(!$('.popover').length, 'popover was removed')
|
||||
$('#qunit-runoff').empty()
|
||||
$('#qunit-fixture').empty()
|
||||
})
|
||||
|
||||
test("should get title and content from attributes", function () {
|
||||
$.support.transition = false
|
||||
var popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>')
|
||||
.appendTo('#qunit-runoff')
|
||||
.appendTo('#qunit-fixture')
|
||||
.popover()
|
||||
.popover('show')
|
||||
|
||||
@ -70,7 +68,7 @@ $(function () {
|
||||
|
||||
popover.popover('hide')
|
||||
ok(!$('.popover').length, 'popover was removed')
|
||||
$('#qunit-runoff').empty()
|
||||
$('#qunit-fixture').empty()
|
||||
})
|
||||
|
||||
})
|
6
js/tests/unit/bootstrap-scrollspy.js
vendored
6
js/tests/unit/bootstrap-scrollspy.js
vendored
@ -12,7 +12,7 @@ $(function () {
|
||||
|
||||
test("should switch active class on scroll", function () {
|
||||
var sectionHTML = '<div id="masthead"></div>'
|
||||
, $section = $(sectionHTML).append('#qunit-runoff')
|
||||
, $section = $(sectionHTML).append('#qunit-fixture')
|
||||
, topbarHTML ='<div class="topbar">'
|
||||
+ '<div class="topbar-inner">'
|
||||
+ '<div class="container">'
|
||||
@ -23,9 +23,9 @@ $(function () {
|
||||
+ '</div>'
|
||||
+ '</div>'
|
||||
+ '</div>'
|
||||
, $topbar = $(topbarHTML).topbar()
|
||||
, $topbar = $(topbarHTML).scrollspy()
|
||||
|
||||
ok(topbar.find('.active', true)
|
||||
ok($topbar.find('.active', true))
|
||||
})
|
||||
|
||||
})
|
46
js/tests/unit/bootstrap-tab.js
vendored
Normal file
46
js/tests/unit/bootstrap-tab.js
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
$(function () {
|
||||
|
||||
module("bootstrap-tabs")
|
||||
|
||||
test("should be defined on jquery object", function () {
|
||||
ok($(document.body).tab, 'tabs method is defined')
|
||||
})
|
||||
|
||||
test("should return element", function () {
|
||||
ok($(document.body).tab()[0] == document.body, 'document.body returned')
|
||||
})
|
||||
|
||||
test("should activate element by tab id", function () {
|
||||
var tabsHTML =
|
||||
'<ul class="tabs">'
|
||||
+ '<li><a href="#home">Home</a></li>'
|
||||
+ '<li><a href="#profile">Profile</a></li>'
|
||||
+ '</ul>'
|
||||
|
||||
|
||||
$('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-fixture")
|
||||
|
||||
$(tabsHTML).find('li:last a').tab('show')
|
||||
equals($("#qunit-fixture").find('.active').attr('id'), "profile")
|
||||
|
||||
$(tabsHTML).find('li:first a').tab('show')
|
||||
equals($("#qunit-fixture").find('.active').attr('id'), "home")
|
||||
})
|
||||
|
||||
test("should activate element by tab id", function () {
|
||||
var pillsHTML =
|
||||
'<ul class="pills">'
|
||||
+ '<li><a href="#home">Home</a></li>'
|
||||
+ '<li><a href="#profile">Profile</a></li>'
|
||||
+ '</ul>'
|
||||
|
||||
$('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-fixture")
|
||||
|
||||
$(pillsHTML).find('li:last a').tab('show')
|
||||
equals($("#qunit-fixture").find('.active').attr('id'), "profile")
|
||||
|
||||
$(pillsHTML).find('li:first a').tab('show')
|
||||
equals($("#qunit-fixture").find('.active').attr('id'), "home")
|
||||
})
|
||||
|
||||
})
|
49
js/tests/unit/bootstrap-tabs.js
vendored
49
js/tests/unit/bootstrap-tabs.js
vendored
@ -1,49 +0,0 @@
|
||||
$(function () {
|
||||
|
||||
module("bootstrap-tabs")
|
||||
|
||||
test("should be defined on jquery object", function () {
|
||||
ok($(document.body).tabs, 'tabs method is defined')
|
||||
})
|
||||
|
||||
test("should return element", function () {
|
||||
ok($(document.body).tabs()[0] == document.body, 'document.body returned')
|
||||
})
|
||||
|
||||
test("should activate element by tab id", function () {
|
||||
var tabsHTML = '<ul class="tabs">'
|
||||
+ '<li class="active"><a href="#home">Home</a></li>'
|
||||
+ '<li><a href="#profile">Profile</a></li>'
|
||||
+ '</ul>'
|
||||
|
||||
|
||||
$('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-runoff")
|
||||
|
||||
$(tabsHTML).tabs().find('a').last().click()
|
||||
equals($("#qunit-runoff").find('.active').attr('id'), "profile")
|
||||
|
||||
$(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">'
|
||||
+ '<li class="active"><a href="#home">Home</a></li>'
|
||||
+ '<li><a href="#profile">Profile</a></li>'
|
||||
+ '</ul>'
|
||||
|
||||
|
||||
$('<ul><li id="home"></li><li id="profile"></li></ul>').appendTo("#qunit-runoff")
|
||||
|
||||
$(pillsHTML).pills().find('a').last().click()
|
||||
equals($("#qunit-runoff").find('.active').attr('id'), "profile")
|
||||
|
||||
$(pillsHTML).pills().find('a').first().click()
|
||||
equals($("#qunit-runoff").find('.active').attr('id'), "home")
|
||||
|
||||
$("#qunit-runoff").empty()
|
||||
})
|
||||
|
||||
})
|
13
js/tests/unit/bootstrap-transition.js
vendored
Normal file
13
js/tests/unit/bootstrap-transition.js
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
$(function () {
|
||||
|
||||
module("bootstrap-transition")
|
||||
|
||||
test("should be defined on jquery support object", function () {
|
||||
ok($.support.transition != undefined, 'transition object is defined')
|
||||
})
|
||||
|
||||
test("should provide an end object", function () {
|
||||
ok($.support.transition.end, 'end string is defined')
|
||||
})
|
||||
|
||||
})
|
36
js/tests/unit/bootstrap-twipsy.js
vendored
36
js/tests/unit/bootstrap-twipsy.js
vendored
@ -29,53 +29,23 @@ $(function () {
|
||||
test("should place tooltips relative to placement option", function () {
|
||||
$.support.transition = false
|
||||
var twipsy = $('<a href="#" rel="twipsy" title="Another twipsy"></a>')
|
||||
.appendTo('#qunit-runoff')
|
||||
.appendTo('#qunit-fixture')
|
||||
.twipsy({placement: 'below'})
|
||||
.twipsy('show')
|
||||
|
||||
ok($(".twipsy").hasClass('fade below in'), 'has correct classes applied')
|
||||
twipsy.twipsy('hide')
|
||||
ok(!$(".twipsy").length, 'twipsy removed')
|
||||
$('#qunit-runoff').empty()
|
||||
})
|
||||
|
||||
test("should add a fallback in cases where elements have no title tag", function () {
|
||||
$.support.transition = false
|
||||
var twipsy = $('<a href="#" rel="twipsy"></a>')
|
||||
.appendTo('#qunit-runoff')
|
||||
.twipsy({fallback: '@fat'})
|
||||
.twipsy('show')
|
||||
|
||||
equals($(".twipsy").text(), "@fat", 'has correct default text')
|
||||
twipsy.twipsy('hide')
|
||||
ok(!$(".twipsy").length, 'twipsy removed')
|
||||
$('#qunit-runoff').empty()
|
||||
})
|
||||
|
||||
test("should not allow html entities", function () {
|
||||
test("should always allow html entities", function () {
|
||||
$.support.transition = false
|
||||
var twipsy = $('<a href="#" rel="twipsy" title="<b>@fat</b>"></a>')
|
||||
.appendTo('#qunit-runoff')
|
||||
.twipsy()
|
||||
.twipsy('show')
|
||||
|
||||
ok(!$('.twipsy b').length, 'b tag was not inserted')
|
||||
twipsy.twipsy('hide')
|
||||
ok(!$(".twipsy").length, 'twipsy removed')
|
||||
$('#qunit-runoff').empty()
|
||||
})
|
||||
|
||||
test("should allow html entities if html option set to true", function () {
|
||||
$.support.transition = false
|
||||
var twipsy = $('<a href="#" rel="twipsy" title="<b>@fat</b>"></a>')
|
||||
.appendTo('#qunit-runoff')
|
||||
.twipsy({html: true})
|
||||
.appendTo('#qunit-fixture')
|
||||
.twipsy('show')
|
||||
|
||||
ok($('.twipsy b').length, 'b tag was inserted')
|
||||
twipsy.twipsy('hide')
|
||||
ok(!$(".twipsy").length, 'twipsy removed')
|
||||
$('#qunit-runoff').empty()
|
||||
})
|
||||
|
||||
})
|
9252
js/tests/vendor/jquery.js
vendored
Normal file
9252
js/tests/vendor/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
js/tests/vendor/qunit.css
vendored
2
js/tests/vendor/qunit.css
vendored
@ -227,6 +227,6 @@
|
||||
|
||||
/** Runoff */
|
||||
|
||||
#qunit-runoff {
|
||||
#qunit-fixture {
|
||||
display:none;
|
||||
}
|
@ -8,10 +8,14 @@
|
||||
z-index: 1000;
|
||||
display: none;
|
||||
padding: 5px;
|
||||
&.above { margin-top: -5px; }
|
||||
&.right { margin-left: 5px; }
|
||||
&.below { margin-top: 5px; }
|
||||
&.left { margin-left: -5px; }
|
||||
&.above .arrow { #popoverArrow > .above(); }
|
||||
&.right .arrow { #popoverArrow > .right(); }
|
||||
&.below .arrow { #popoverArrow > .below(); }
|
||||
&.left .arrow { #popoverArrow > .left(); }
|
||||
&.left .arrow { #popoverArrow > .left(); }
|
||||
.arrow {
|
||||
position: absolute;
|
||||
width: 0;
|
||||
|
@ -9,9 +9,11 @@
|
||||
padding: 5px;
|
||||
font-size: 11px;
|
||||
.opacity(0);
|
||||
&.in {
|
||||
.opacity(80);
|
||||
}
|
||||
&.in { .opacity(80); }
|
||||
&.above { margin-top: -2px; }
|
||||
&.right { margin-left: 2px; }
|
||||
&.below { margin-top: 2px; }
|
||||
&.left { margin-left: -2px; }
|
||||
&.above .twipsy-arrow { #popoverArrow > .above(); }
|
||||
&.left .twipsy-arrow { #popoverArrow > .left(); }
|
||||
&.below .twipsy-arrow { #popoverArrow > .below(); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user