aboutsummaryrefslogtreecommitdiff
path: root/docs/assets
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2011-09-09 22:47:49 -0700
committerJacob Thornton <[email protected]>2011-09-09 22:47:49 -0700
commit5f4e30ed1d33f83b0fad3afc9174e193e6c3fdf4 (patch)
tree105cd02ae9923fb2171f695e261e5311c81786b3 /docs/assets
parentdf3ca4d94a69436c1d6c53f5559aefca98fb2232 (diff)
downloadbootstrap-5f4e30ed1d33f83b0fad3afc9174e193e6c3fdf4.tar.xz
bootstrap-5f4e30ed1d33f83b0fad3afc9174e193e6c3fdf4.zip
move js plugins to root dir, begin writing tests, and change modal plugin to be more boss like
Diffstat (limited to 'docs/assets')
-rw-r--r--docs/assets/js/application.js2
-rw-r--r--docs/assets/js/bootstrap-alerts.js72
-rw-r--r--docs/assets/js/bootstrap-dropdown.js26
-rw-r--r--docs/assets/js/bootstrap-modal.js157
-rw-r--r--docs/assets/js/bootstrap-popover.js67
-rw-r--r--docs/assets/js/bootstrap-scrollspy.js0
-rw-r--r--docs/assets/js/bootstrap-tabs.js38
-rw-r--r--docs/assets/js/bootstrap-twipsy.js288
8 files changed, 1 insertions, 649 deletions
diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js
index 475329398..db59c79f9 100644
--- a/docs/assets/js/application.js
+++ b/docs/assets/js/application.js
@@ -3,7 +3,7 @@ $(document).ready(function(){
// Dropdown example for topbar nav
// ===============================
- $(".topbar").dropdown() // catch any dropdowns on the page
+ $('body').dropdown() // catch any dropdowns on the page
// table sort example
diff --git a/docs/assets/js/bootstrap-alerts.js b/docs/assets/js/bootstrap-alerts.js
deleted file mode 100644
index e27ac6482..000000000
--- a/docs/assets/js/bootstrap-alerts.js
+++ /dev/null
@@ -1,72 +0,0 @@
-(function( $ ){
-
- /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
- * ======================================================= */
-
- var transitionEnd
-
- $(function () {
-
- $.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
- })()
-
- // set CSS transition event type
- if ( $.support.transition ) {
- transitionEnd = "TransitionEnd"
- if ( $.browser.webkit ) {
- transitionEnd = "webkitTransitionEnd"
- } else if ( $.browser.mozilla ) {
- transitionEnd = "transitionend"
- } else if ( $.browser.opera ) {
- transitionEnd = "oTransitionEnd"
- }
- }
-
- })
-
- /* ALERT CLASS DEFINITION
- * ====================== */
-
- var Alert = function ( content ) {
- var that = this
- this.$element = $(content)
- this.$element.delegate('.close', 'click', function (e) {
- e.preventDefault()
- that.close()
- })
- }
-
- Alert.prototype = {
-
- close: function () {
- var that = this
-
- this.$element.removeClass('in')
-
- function removeElement () {
- that.$element.remove()
- that.$element = null
- }
-
- $.support.transition && this.$element.hasClass('fade') ?
- this.$element.bind(transitionEnd, removeElement) :
- removeElement()
- }
-
- }
-
-
- /* ALERT PLUGIN DEFINITION
- * ======================= */
-
- $.fn.alert = function ( options ) {
- return this.each(function () {
- new Alert(this)
- })
- }
-
-})( jQuery || ender ) \ No newline at end of file
diff --git a/docs/assets/js/bootstrap-dropdown.js b/docs/assets/js/bootstrap-dropdown.js
deleted file mode 100644
index fe73e7994..000000000
--- a/docs/assets/js/bootstrap-dropdown.js
+++ /dev/null
@@ -1,26 +0,0 @@
-(function( $ ){
-
- /* DROPDOWN PLUGIN DEFINITION
- * ========================== */
-
- var selector = 'a.menu, .dropdown-toggle'
-
- function clearMenus() {
- $(selector).parent('li').removeClass('open')
- }
-
- $(function () {
- $('body').bind("click", clearMenus)
- })
-
- $.fn.dropdown = function ( options ) {
- return this.each(function () {
- $(this).delegate(selector, 'click', function (e) {
- clearMenus()
- $(this).parent('li').toggleClass('open')
- return false
- })
- })
- }
-
-})( jQuery || ender ) \ No newline at end of file
diff --git a/docs/assets/js/bootstrap-modal.js b/docs/assets/js/bootstrap-modal.js
deleted file mode 100644
index 4bc395e1c..000000000
--- a/docs/assets/js/bootstrap-modal.js
+++ /dev/null
@@ -1,157 +0,0 @@
-(function( $ ){
-
- /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
- * ======================================================= */
-
- var transitionEnd
-
- $(function () {
-
- $.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
- })()
-
- // set CSS transition event type
- if ( $.support.transition ) {
- transitionEnd = "TransitionEnd"
- if ( $.browser.webkit ) {
- transitionEnd = "webkitTransitionEnd"
- } else if ( $.browser.mozilla ) {
- transitionEnd = "transitionend"
- } else if ( $.browser.opera ) {
- transitionEnd = "oTransitionEnd"
- }
- }
-
- })
-
-
- /* MODAL PUBLIC CLASS DEFINITION
- * ============================= */
-
- var Modal = function ( options ) {
- this.settings = $.extend({}, $.fn.modal.defaults)
-
- if ( typeof options == 'string' ) {
- this.settings.content = options
- } else if ( options ) {
- $.extend( this.settings, options )
- }
-
- return this
- }
-
- Modal.prototype = {
-
- toggle: function () {
- return this[!this.isOpen ? 'open' : 'close']()
- }
-
- , open: function () {
- var that = this
- this.isOpen = true
-
- this.$element = $(this.settings.content)
-
- _.escape.call(this)
- _.backdrop.call(this)
-
- this.$element
- .delegate('.close', 'click', function (e) { e.preventDefault(); that.close() })
- .appendTo(document.body)
- .show()
-
- setTimeout(function () {
- that.$element.addClass('in')
- that.$backdrop && that.$backdrop.addClass('in')
- }, 1)
-
- return this
- }
-
- , close: function () {
- var that = this
-
- this.isOpen = false
-
- _.escape.call(this)
- _.backdrop.call(this)
-
- this.$element.removeClass('in')
-
- function removeElement () {
- that.$element.remove()
- that.$element = null
- }
-
- $.support.transition && this.$element.hasClass('fade') ?
- this.$element.bind(transitionEnd, removeElement) :
- removeElement()
-
- return this
- }
-
- }
-
-
- /* MODAL PRIVATE METHODS
- * ===================== */
-
- var _ = {
-
- backdrop: function () {
- var that = this
- , animate = this.$element.hasClass('fade') ? 'fade' : ''
- if ( this.isOpen && this.settings.backdrop ) {
- this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
- .click(function () { that.close() })
- .appendTo(document.body)
- } else if ( !this.isOpen && this.$backdrop ) {
- this.$backdrop.removeClass('in')
-
- function removeElement() {
- that.$backdrop.remove()
- that.$backdrop = null
- }
-
- $.support.transition && this.$element.hasClass('fade')?
- this.$backdrop.bind(transitionEnd, removeElement) :
- removeElement()
- }
- }
-
- , escape: function () {
- var that = this
- if ( this.isOpen && this.settings.closeOnEscape ) {
- $('body').bind('keyup.modal.escape', function ( e ) {
- if ( e.which == 27 ) {
- that.close()
- }
- })
- } else if ( !this.isOpen ) {
- $('body').unbind('keyup.modal.escape')
- }
- }
-
- }
-
-
- /* MODAL PLUGIN DEFINITION
- * ======================= */
-
- $.fn.modal = function ( options ) {
- options = options || {}
- options.content = this
- return new Modal(options)
- }
-
- $.fn.modal.defaults = {
- backdrop: false
- , closeOnEscape: false
- , content: false
- }
-
-})( jQuery || ender ) \ No newline at end of file
diff --git a/docs/assets/js/bootstrap-popover.js b/docs/assets/js/bootstrap-popover.js
deleted file mode 100644
index 53284806f..000000000
--- a/docs/assets/js/bootstrap-popover.js
+++ /dev/null
@@ -1,67 +0,0 @@
- /* EXTENDS BOOTSTRAP-TWIPSY.js
- =========================== */
-
-(function( $ ) {
-
- /* POPOVER PUBLIC CLASS DEFINITION
- * ============================== */
-
- var Popover = function ( element, options ) {
- this.$element = $(element)
- this.options = options
- this.enabled = true
- }
-
- Popover.prototype = $.extend({}, $.fn.twipsy.Twipsy.prototype, {
-
- setContent: function () {
- var $tip = this.tip()
- $tip.find('.title')[this.options.html ? 'html' : 'text'](this.getTitle())
- $tip.find('.content p')[this.options.html ? 'html' : 'text'](this.getContent())
- $tip[0].className = 'popover'
- }
-
- , fixTitle: function () {}
-
- , getTitle: function () {
- var title
- if (typeof this.options.title == 'string') {
- title = this.$element.attr('data-title') || this.options.title
- } else if (typeof this.options.title == 'function') {
- title = this.options.title.call(this.$element[0])
- }
- return title
- }
-
- , getContent: function () {content
- var content
- if (typeof this.options.content == 'string') {
- content = this.$element.attr('data-content') || this.options.content
- } else if (typeof this.options.content == 'function') {
- content = this.options.content.call(this.$element[0])
- }
- return content
- }
-
- , tip: function() {
- if (!this.$tip) {
- this.$tip = $('<div class="popover" />')
- .html('<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>')
- }
- return this.$tip
- }
-
- })
-
-
- /* POPOVER PLUGIN DEFINITION
- * ======================= */
-
- $.fn.popover = function (options) {
- if (typeof options == 'object') options = $.extend({}, $.fn.popover.defaults, options)
- $.fn.twipsy.initWith.call(this, options, Popover)
- }
-
- $.fn.popover.defaults = $.extend({}, $.fn.twipsy.defaults, { content: '', placement: 'right'})
-
-})( jQuery || ender ) \ No newline at end of file
diff --git a/docs/assets/js/bootstrap-scrollspy.js b/docs/assets/js/bootstrap-scrollspy.js
deleted file mode 100644
index e69de29bb..000000000
--- a/docs/assets/js/bootstrap-scrollspy.js
+++ /dev/null
diff --git a/docs/assets/js/bootstrap-tabs.js b/docs/assets/js/bootstrap-tabs.js
deleted file mode 100644
index 029ccc65c..000000000
--- a/docs/assets/js/bootstrap-tabs.js
+++ /dev/null
@@ -1,38 +0,0 @@
-(function( $ ){
-
- function activate ( element, container ) {
- container.find('.active').removeClass('active')
- element.addClass('active')
- }
-
- function tab( e ) {
- var $this = $(this)
- , href = $this.attr('href')
- , $ul = $(e.liveFired)
- , $controlled
-
- if (/^#\w+/.test(href)) {
- e.preventDefault()
-
- if ($this.hasClass('active')) {
- return
- }
-
- $href = $(href)
-
- activate($this.parent('li'), $ul)
- activate($href, $href.parent())
- }
- }
-
-
- /* TABS/PILLS PLUGIN DEFINITION
- * ============================ */
-
- $.fn.tabs = $.fn.pills = function () {
- return this.each(function () {
- $(this).delegate('.tabs > li > a, .pills > li > a, .dropdown-menu > li > a', 'click', tab)
- })
- }
-
-})( jQuery || ender ) \ No newline at end of file
diff --git a/docs/assets/js/bootstrap-twipsy.js b/docs/assets/js/bootstrap-twipsy.js
deleted file mode 100644
index 3d117a445..000000000
--- a/docs/assets/js/bootstrap-twipsy.js
+++ /dev/null
@@ -1,288 +0,0 @@
-/* Adapted from the original jQuery.tipsy by Jason Frame */
-
-(function( $ ) {
-
- /* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
- * ======================================================= */
-
- var transitionEnd
-
- $(function () {
-
- $.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
- })()
-
- // set CSS transition event type
- if ( $.support.transition ) {
- transitionEnd = "TransitionEnd"
- if ( $.browser.webkit ) {
- transitionEnd = "webkitTransitionEnd"
- } else if ( $.browser.mozilla ) {
- transitionEnd = "transitionend"
- } else if ( $.browser.opera ) {
- transitionEnd = "oTransitionEnd"
- }
- }
-
- })
-
-
- /* TWIPSY PUBLIC CLASS DEFINITION
- * ============================== */
-
- var Twipsy = function ( element, options ) {
- this.$element = $(element)
- this.options = options
- this.enabled = true
- this.fixTitle()
- }
-
- Twipsy.prototype = {
-
- show: function() {
- var pos
- , actualWidth
- , actualHeight
- , placement
- , $tip
- , tp
-
- if (this.getTitle() && this.enabled) {
- $tip = this.tip()
- this.setContent()
-
- if (this.options.animate) {
- $tip.addClass('fade')
- }
-
- $tip
- .remove()
- .css({ top: 0, left: 0, display: 'block' })
- .prependTo(document.body)
-
- pos = $.extend({}, this.$element.offset(), {
- width: this.$element[0].offsetWidth
- , height: this.$element[0].offsetHeight
- })
-
- actualWidth = $tip[0].offsetWidth
- actualHeight = $tip[0].offsetHeight
- placement = _.maybeCall(this.options.placement, this.$element[0])
-
- switch (placement) {
- case 'below':
- tp = {top: pos.top + pos.height + this.options.offset, 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}
- break
- case 'left':
- tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset}
- break
- case 'right':
- tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset}
- break
- }
-
- $tip
- .css(tp)
- .addClass(placement)
- .addClass('in')
- }
- }
-
- , setContent: function () {
- var $tip = this.tip()
- $tip.find('.twipsy-inner')[this.options.html ? 'html' : 'text'](this.getTitle())
- $tip[0].className = 'twipsy'
- }
-
- , hide: function() {
- var that = this
- , $tip = this.tip()
-
- $tip.removeClass('in')
-
- function removeElement () {
- $tip.remove()
- }
-
- $.support.transition && this.$tip.hasClass('fade') ?
- $tip.bind(transitionEnd, removeElement) :
- removeElement()
- }
-
- , 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')
- }
- }
-
- , getTitle: function() {
- var title
- , $e = this.$element
- , o = this.options
-
- this.fixTitle()
-
- 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).replace(/(^\s*|\s*$)/, "")
-
- return title || o.fallback
- }
-
- , tip: function() {
- if (!this.$tip) {
- this.$tip = $('<div class="twipsy" />').html('<div class="twipsy-arrow"></div><div class="twipsy-inner"></div>')
- }
- return this.$tip
- }
-
- , validate: function() {
- if (!this.$element[0].parentNode) {
- this.hide()
- this.$element = null
- this.options = null
- }
- }
-
- , enable: function() {
- this.enabled = true
- }
-
- , disable: function() {
- this.enabled = false
- }
-
- , toggleEnabled: function() {
- this.enabled = !this.enabled
- }
-
- }
-
-
- /* TWIPSY PRIVATE METHODS
- * ====================== */
-
- var _ = {
-
- maybeCall: function ( thing, ctx ) {
- return (typeof thing == 'function') ? (thing.call(ctx)) : thing
- }
-
- }
-
-
- /* TWIPSY PLUGIN DEFINITION
- * ======================== */
-
- $.fn.twipsy = function (options) {
- $.fn.twipsy.initWith.call(this, options, Twipsy)
- }
-
- $.fn.twipsy.initWith = function (options, Constructor) {
-
- var twipsy
- , binder
- , eventIn
- , eventOut
-
- if (options === true) {
- return this.data('twipsy')
- } else if (typeof options == 'string') {
- twipsy = this.data('twipsy')
- if (twipsy) {
- twipsy[options]()
- }
- return this
- }
-
- options = $.extend({}, $.fn.twipsy.defaults, options)
-
- function get(ele) {
- var twipsy = $.data(ele, 'twipsy')
-
- if (!twipsy) {
- twipsy = new Constructor(ele, $.fn.twipsy.elementOptions(ele, options))
- $.data(ele, 'twipsy', twipsy)
- }
-
- return twipsy
- }
-
- function enter() {
- var twipsy = get(this)
- twipsy.hoverState = 'in'
-
- if (options.delayIn == 0) {
- twipsy.show()
- } else {
- twipsy.fixTitle()
- setTimeout(function() {
- if (twipsy.hoverState == 'in') {
- twipsy.show()
- }
- }, options.delayIn)
- }
- }
-
- function leave() {
- var twipsy = get(this)
- twipsy.hoverState = 'out'
- if (options.delayOut == 0) {
- twipsy.hide()
- } else {
- setTimeout(function() {
- if (twipsy.hoverState == 'out') {
- twipsy.hide()
- }
- }, options.delayOut)
- }
- }
-
- 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.defaults = {
- animate: true
- , delayIn: 0
- , delayOut: 0
- , fallback: ''
- , placement: 'above'
- , html: false
- , live: false
- , offset: 0
- , title: 'title'
- , trigger: 'hover'
- }
-
- $.fn.twipsy.elementOptions = function(ele, options) {
- return $.metadata ? $.extend({}, options, $(ele).metadata()) : options
- }
-
-})( jQuery || ender ) \ No newline at end of file