Commit 09df780b authored by Jacob Thornton's avatar Jacob Thornton

clean up application js a bit

parent 7ffec335
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
$(function(){ $(function(){
// Disable certain links in docs // Disable certain links in docs
$('section [href^=#]').click(function (e) { $('section [href^=#]').click(function (e) {
e.preventDefault() e.preventDefault()
...@@ -28,8 +27,6 @@ ...@@ -28,8 +27,6 @@
$(this).parents('.add-on')[method]('active') $(this).parents('.add-on')[method]('active')
}) })
if ($.fn.tooltip) {
// position static twipsies for components page // position static twipsies for components page
if ($(".twipsies a").length) { if ($(".twipsies a").length) {
$(window).on('load resize', function () { $(window).on('load resize', function () {
...@@ -46,16 +43,13 @@ ...@@ -46,16 +43,13 @@
// add tipsies to grid for scaffolding // add tipsies to grid for scaffolding
if ($('#grid-system').length) { if ($('#grid-system').length) {
$('#grid-system').tooltip({ $('#grid-system').tooltip({
selector: '.show-grid > div' selector: '.show-grid > div'
, title: function () { return $(this).width() + 'px' } , title: function () { return $(this).width() + 'px' }
}) })
}
} }
// fix sub nav playa // fix sub nav on scroll
var $win = $(window) var $win = $(window)
, $nav = $('.subnav') , $nav = $('.subnav')
, navTop = $('.subnav').length && $('.subnav').offset().top - 40 , navTop = $('.subnav').length && $('.subnav').offset().top - 40
...@@ -76,136 +70,123 @@ ...@@ -76,136 +70,123 @@
} }
} }
}) // tooltip demo
$('.tooltip-demo.well').tooltip({
selector: "a[rel=tooltip]"
})
$('.tooltip-test').tooltip({
'z-index': 3000
})
// JS for javascript demos $('.popover-test').popover({
// $(function () { 'z-index': 3000
// // tooltip demo })
// $('.tooltip-demo.well').tooltip({
// selector: "a[rel=tooltip]" // popover demo
// }) $("a[rel=popover]")
.popover()
// $('.tooltip-test').tooltip({ .click(function(e) {
// 'z-index': 3000 e.preventDefault()
// }) })
// $('.popover-test').popover({ // button state demo
// 'z-index': 3000 $('#fat-btn')
// }) .click(function () {
var btn = $(this)
// // popover demo btn.button('loading')
// $("a[rel=popover]") setTimeout(function () {
// .popover() btn.button('reset')
// .click(function(e) { }, 3000)
// e.preventDefault() })
// })
// carousel demo
// // button state demo $('#myCarousel').carousel()
// $('#fat-btn')
// .click(function () { // javascript build logic
// var btn = $(this) var inputsComponent = $("#components.download input")
// btn.button('loading') , inputsPlugin = $("#plugins.download input")
// setTimeout(function () { , inputsVariables = $("#variables.download input")
// btn.button('reset')
// }, 3000) // toggle all plugin checkboxes
// }) $('#components.download .toggle-all').on('click', function (e) {
e.preventDefault()
// // carousel demo inputsComponent.attr('checked', !inputsComponent.is(':checked'))
// $('#myCarousel').carousel() })
// }) $('#plugins.download .toggle-all').on('click', function (e) {
e.preventDefault()
inputsPlugin.attr('checked', !inputsPlugin.is(':checked'))
// // Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi })
// // by the talented Ben Vinegar
// !function($) { $('#variables.download .toggle-all').on('click', function (e) {
// $.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) { e.preventDefault()
// var url = opts.url; inputsVariables.val('')
})
// return {
// send: function(_, completeCallback) { // request built javascript
// var name = 'jQuery_iframe_' + jQuery.now() $('.download-btn').on('click', function () {
// , iframe, form
var css = $("#components.download input:checked")
// iframe = $('<iframe>') .map(function () { return this.value })
// .attr('name', name) .toArray()
// .appendTo('head') , js = $("#plugins.download input:checked")
.map(function () { return this.value })
// form = $('<form>') .toArray()
// .attr('method', opts.type) // GET or POST , vars = {}
// .attr('action', url) , img = ['glyphicons-halflings-sprite.png', 'glyphicons-halflings-sprite-white.png']
// .attr('target', name)
$("#variables.download input")
// $.each(opts.params, function(k, v) { .each(function () {
$(this).val() && (vars[ $(this).prev().text() ] = $(this).val())
// $('<input>') })
// .attr('type', 'hidden')
// .attr('name', k) $.ajax({
// .attr('value', typeof v == 'string' ? v : JSON.stringify(v)) type: 'POST'
// .appendTo(form) , url: 'http://bootstrap.herokuapp.com'
// }) , dataType: 'jsonpi'
, params: {
// form.appendTo('body').submit() branch: '2.0-wip'
// } , js: js
// } , css: css
// }) , vars: vars
// }(jQuery); , img: img
}
// // javascript build logic })
})
// $(function () {
})
// var inputsComponent = $("#components.download input")
// , inputsPlugin = $("#plugins.download input") // Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi
// , inputsVariables = $("#variables.download input") $.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) {
var url = opts.url;
// // toggle all plugin checkboxes
// $('#components.download .toggle-all').on('click', function (e) { return {
// e.preventDefault() send: function(_, completeCallback) {
// inputsComponent.attr('checked', !inputsComponent.is(':checked')) var name = 'jQuery_iframe_' + jQuery.now()
// }) , iframe, form
// $('#plugins.download .toggle-all').on('click', function (e) { iframe = $('<iframe>')
// e.preventDefault() .attr('name', name)
// inputsPlugin.attr('checked', !inputsPlugin.is(':checked')) .appendTo('head')
// })
form = $('<form>')
// $('#variables.download .toggle-all').on('click', function (e) { .attr('method', opts.type) // GET or POST
// e.preventDefault() .attr('action', url)
// inputsVariables.val('') .attr('target', name)
// })
$.each(opts.params, function(k, v) {
// // request built javascript
// $('.download-btn').on('click', function () { $('<input>')
.attr('type', 'hidden')
// var css = $("#components.download input:checked") .attr('name', k)
// .map(function () { return this.value }) .attr('value', typeof v == 'string' ? v : JSON.stringify(v))
// .toArray() .appendTo(form)
// , js = $("#plugins.download input:checked") })
// .map(function () { return this.value })
// .toArray() form.appendTo('body').submit()
// , vars = {} }
// , img = ['glyphicons-halflings-sprite.png', 'glyphicons-halflings-sprite-white.png'] }
})
// $("#variables.download input")
// .each(function () {
// $(this).val() && (vars[ $(this).prev().text() ] = $(this).val())
// })
// $.ajax({
// type: 'POST'
// , url: 'http://bootstrap.herokuapp.com'
// , dataType: 'jsonpi'
// , params: {
// branch: '2.0-wip'
// , js: js
// , css: css
// , vars: vars
// , img: img
// }
// })
// })
// })
}(window.jQuery) }(window.jQuery)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment