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

clean up application js a bit

parent 7ffec335
3 merge requests!14752.0 wip,!1403warningText and warningBackground docs fix,!13512.0 wip - relative font sizes
Showing with 136 additions and 155 deletions
+136 -155
...@@ -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,34 +27,29 @@ ...@@ -28,34 +27,29 @@
$(this).parents('.add-on')[method]('active') $(this).parents('.add-on')[method]('active')
}) })
if ($.fn.tooltip) { // position static twipsies for components page
if ($(".twipsies a").length) {
// position static twipsies for components page $(window).on('load resize', function () {
if ($(".twipsies a").length) { $(".twipsies a").each(function () {
$(window).on('load resize', function () { $(this)
$(".twipsies a").each(function () { .tooltip({
$(this) placement: $(this).attr('title')
.tooltip({ , trigger: 'manual'
placement: $(this).attr('title')
, trigger: 'manual'
})
.tooltip('show')
}) })
}) .tooltip('show')
} })
})
// add tipsies to grid for scaffolding }
if ($('#grid-system').length) {
$('#grid-system').tooltip({
selector: '.show-grid > div'
, title: function () { return $(this).width() + 'px' }
})
} // add tipsies to grid for scaffolding
if ($('#grid-system').length) {
$('#grid-system').tooltip({
selector: '.show-grid > div'
, 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]"
})
// JS for javascript demos $('.tooltip-test').tooltip({
// $(function () { 'z-index': 3000
// // tooltip demo })
// $('.tooltip-demo.well').tooltip({
// selector: "a[rel=tooltip]" $('.popover-test').popover({
// }) 'z-index': 3000
})
// $('.tooltip-test').tooltip({
// 'z-index': 3000 // popover demo
// }) $("a[rel=popover]")
.popover()
// $('.popover-test').popover({ .click(function(e) {
// 'z-index': 3000 e.preventDefault()
// }) })
// // popover demo // button state demo
// $("a[rel=popover]") $('#fat-btn')
// .popover() .click(function () {
// .click(function(e) { var btn = $(this)
// e.preventDefault() btn.button('loading')
// }) setTimeout(function () {
btn.button('reset')
// // button state demo }, 3000)
// $('#fat-btn') })
// .click(function () {
// var btn = $(this) // carousel demo
// btn.button('loading') $('#myCarousel').carousel()
// setTimeout(function () {
// btn.button('reset') // javascript build logic
// }, 3000) var inputsComponent = $("#components.download input")
// }) , inputsPlugin = $("#plugins.download input")
, inputsVariables = $("#variables.download input")
// // carousel demo
// $('#myCarousel').carousel() // toggle all plugin checkboxes
$('#components.download .toggle-all').on('click', function (e) {
// }) e.preventDefault()
inputsComponent.attr('checked', !inputsComponent.is(':checked'))
})
// // Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi
// // by the talented Ben Vinegar $('#plugins.download .toggle-all').on('click', function (e) {
// !function($) { e.preventDefault()
// $.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) { inputsPlugin.attr('checked', !inputsPlugin.is(':checked'))
// var url = opts.url; })
// return { $('#variables.download .toggle-all').on('click', function (e) {
// send: function(_, completeCallback) { e.preventDefault()
// var name = 'jQuery_iframe_' + jQuery.now() inputsVariables.val('')
// , iframe, form })
// iframe = $('<iframe>') // request built javascript
// .attr('name', name) $('.download-btn').on('click', function () {
// .appendTo('head')
var css = $("#components.download input:checked")
// form = $('<form>') .map(function () { return this.value })
// .attr('method', opts.type) // GET or POST .toArray()
// .attr('action', url) , js = $("#plugins.download input:checked")
// .attr('target', name) .map(function () { return this.value })
.toArray()
// $.each(opts.params, function(k, v) { , vars = {}
, img = ['glyphicons-halflings-sprite.png', 'glyphicons-halflings-sprite-white.png']
// $('<input>')
// .attr('type', 'hidden') $("#variables.download input")
// .attr('name', k) .each(function () {
// .attr('value', typeof v == 'string' ? v : JSON.stringify(v)) $(this).val() && (vars[ $(this).prev().text() ] = $(this).val())
// .appendTo(form) })
// })
$.ajax({
// form.appendTo('body').submit() type: 'POST'
// } , url: 'http://bootstrap.herokuapp.com'
// } , dataType: 'jsonpi'
// }) , params: {
// }(jQuery); branch: '2.0-wip'
, js: js
// // javascript build logic , css: css
, vars: vars
// $(function () { , img: img
}
// var inputsComponent = $("#components.download input") })
// , inputsPlugin = $("#plugins.download input") })
// , inputsVariables = $("#variables.download input")
})
// // toggle all plugin checkboxes
// $('#components.download .toggle-all').on('click', function (e) { // Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi
// e.preventDefault() $.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) {
// inputsComponent.attr('checked', !inputsComponent.is(':checked')) var url = opts.url;
// })
return {
// $('#plugins.download .toggle-all').on('click', function (e) { send: function(_, completeCallback) {
// e.preventDefault() var name = 'jQuery_iframe_' + jQuery.now()
// inputsPlugin.attr('checked', !inputsPlugin.is(':checked')) , iframe, form
// })
iframe = $('<iframe>')
// $('#variables.download .toggle-all').on('click', function (e) { .attr('name', name)
// e.preventDefault() .appendTo('head')
// inputsVariables.val('')
// }) form = $('<form>')
.attr('method', opts.type) // GET or POST
// // request built javascript .attr('action', url)
// $('.download-btn').on('click', function () { .attr('target', name)
// var css = $("#components.download input:checked") $.each(opts.params, function(k, v) {
// .map(function () { return this.value })
// .toArray() $('<input>')
// , js = $("#plugins.download input:checked") .attr('type', 'hidden')
// .map(function () { return this.value }) .attr('name', k)
// .toArray() .attr('value', typeof v == 'string' ? v : JSON.stringify(v))
// , vars = {} .appendTo(form)
// , img = ['glyphicons-halflings-sprite.png', 'glyphicons-halflings-sprite-white.png'] })
// $("#variables.download input") form.appendTo('body').submit()
// .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
Supports Markdown
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