mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-25 21:09:06 +02:00
clean up all the js across all the doc pages
This commit is contained in:
@@ -1,52 +1,64 @@
|
||||
$(function(){
|
||||
|
||||
// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
|
||||
// IT'S ALL JUST JUNK FOR OUR DOCS!
|
||||
// ++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
// make code pretty
|
||||
prettyPrint && prettyPrint()
|
||||
|
||||
// table sort example
|
||||
// ==================
|
||||
|
||||
$("#sortTableExample").tablesorter( { sortList: [[ 1, 0 ]] } )
|
||||
|
||||
if ($.fn.tableSorter) {
|
||||
$("#sortTableExample").tablesorter( { sortList: [[ 1, 0 ]] } )
|
||||
}
|
||||
|
||||
// add on logic
|
||||
// ============
|
||||
|
||||
$('.add-on :checkbox').click(function () {
|
||||
if ($(this).attr('checked')) {
|
||||
$(this).parents('.add-on').addClass('active')
|
||||
} else {
|
||||
$(this).parents('.add-on').removeClass('active')
|
||||
}
|
||||
$('.add-on :checkbox').on('click', function () {
|
||||
var $this = $(this)
|
||||
, method = $this.attr('checked') ? 'addClass' : 'removeClass'
|
||||
$(this).parents('.add-on')[method]('active')
|
||||
})
|
||||
|
||||
|
||||
// Disable certain links in docs
|
||||
// =============================
|
||||
// Please do not carry these styles over to your projects, it's merely here to prevent button clicks form taking you away from your spot on page
|
||||
// Please do not carry these styles over to your projects
|
||||
// it's merely here to prevent button clicks form taking you
|
||||
// away from your spot on page!!
|
||||
|
||||
$('ul.tabs a, ul.pills a, .pagination a, .well .btn, .actions .btn, .alert-message .btn, a.close').click(function (e) {
|
||||
$('[href^=#]').click(function (e) {
|
||||
e.preventDefault()
|
||||
})
|
||||
|
||||
// Copy code blocks in docs
|
||||
$(".copy-code").focus(function () {
|
||||
var el = this;
|
||||
// push select to event loop for chrome :{o
|
||||
setTimeout(function () { $(el).select(); }, 1);
|
||||
});
|
||||
|
||||
|
||||
// POSITION STATIC TWIPSIES
|
||||
// ========================
|
||||
|
||||
$(window).on('load resize', function () {
|
||||
$(".twipsies a").each(function () {
|
||||
$(this)
|
||||
.twipsy({
|
||||
live: false
|
||||
, placement: $(this).attr('title')
|
||||
, trigger: 'manual'
|
||||
, offset: 2
|
||||
})
|
||||
.twipsy('show')
|
||||
})
|
||||
$(".copy-code").on('focus', function () {
|
||||
var el = this
|
||||
setTimeout(function () { $(el).select() }, 0)
|
||||
})
|
||||
});
|
||||
|
||||
if ($.fn.twipsy) {
|
||||
|
||||
// position static twipsies for components page
|
||||
if ($(".twipsies a").length) {
|
||||
$(window).on('load resize', function () {
|
||||
$(".twipsies a").each(function () {
|
||||
$(this)
|
||||
.twipsy({
|
||||
placement: $(this).attr('title')
|
||||
, trigger: 'manual'
|
||||
})
|
||||
.twipsy('show')
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// add tipsies to grid for scaffolding
|
||||
if ($('#grid-system').length) {
|
||||
|
||||
$('#grid-system').twipsy({
|
||||
selector: '.show-grid > div'
|
||||
, title: function () { return $(this).width() + 'px' }
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
})
|
Reference in New Issue
Block a user