2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-05 16:42:29 +03:00

Try updating docs

This commit is contained in:
Julian Thilo
2015-06-16 18:50:35 +02:00
parent dc25a6cef8
commit c85fdda6f8
52 changed files with 4116 additions and 2858 deletions
+45 -43
View File
@@ -4,12 +4,12 @@
/*!
* JavaScript for Bootstrap's docs (http://getbootstrap.com)
* Copyright 2011-2014 Twitter, Inc.
* Copyright 2011-2015 Twitter, Inc.
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
* details, see http://creativecommons.org/licenses/by/3.0/.
* details, see https://creativecommons.org/licenses/by/3.0/.
*/
/* global ZeroClipboard, addAnchors */
/* global ZeroClipboard, anchors */
!function ($) {
'use strict';
@@ -58,12 +58,12 @@
// theme toggler
;(function () {
var stylesheetLink = $('#bs-theme-stylesheet')
var themeBtn = $('.bs-docs-theme-toggle')
var $stylesheetLink = $('#bs-theme-stylesheet')
var $themeBtn = $('.bs-docs-theme-toggle')
var activateTheme = function () {
stylesheetLink.attr('href', stylesheetLink.attr('data-href'))
themeBtn.text('Disable theme preview')
$stylesheetLink.attr('href', $stylesheetLink.attr('data-href'))
$themeBtn.text('Disable theme preview')
localStorage.setItem('previewTheme', true)
}
@@ -71,13 +71,13 @@
activateTheme()
}
themeBtn.click(function () {
var href = stylesheetLink.attr('href')
$themeBtn.click(function () {
var href = $stylesheetLink.attr('href')
if (!href || href.indexOf('data') === 0) {
activateTheme()
} else {
stylesheetLink.attr('href', '')
themeBtn.text('Preview theme')
$stylesheetLink.attr('href', '')
$themeBtn.text('Preview theme')
localStorage.removeItem('previewTheme')
}
})
@@ -102,22 +102,22 @@
// Button state demo
$('#loading-example-btn').on('click', function () {
var btn = $(this)
btn.button('loading')
var $btn = $(this)
$btn.button('loading')
setTimeout(function () {
btn.button('reset')
$btn.button('reset')
}, 3000)
})
// Modal relatedTarget demo
$('#exampleModal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var recipient = button.data('whatever') // Extract info from data-* attributes
var $button = $(event.relatedTarget) // Button that triggered the modal
var recipient = $button.data('whatever') // Extract info from data-* attributes
// If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
// Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
var modal = $(this)
modal.find('.modal-title').text('New message to ' + recipient)
modal.find('.modal-body input').val(recipient)
var $modal = $(this)
$modal.find('.modal-title').text('New message to ' + recipient)
$modal.find('.modal-body input').val(recipient)
})
// Activate animated progress bar
@@ -137,38 +137,38 @@
$(this).before(btnHtml)
})
var zeroClipboard = new ZeroClipboard($('.btn-clipboard'))
var htmlBridge = $('#global-zeroclipboard-html-bridge')
var $htmlBridge = $('#global-zeroclipboard-html-bridge')
// Handlers for ZeroClipboard
zeroClipboard.on('load', function () {
htmlBridge
$htmlBridge
.data('placement', 'top')
.attr('title', 'Copy to clipboard')
.tooltip()
// Copy to clipboard
zeroClipboard.on('dataRequested', function (client) {
var highlight = $(this).parent().nextAll('.highlight').first()
client.setText(highlight.text())
})
// Notify copy success and reset tooltip title
zeroClipboard.on('complete', function () {
$htmlBridge
.attr('title', 'Copied!')
.tooltip('fixTitle')
.tooltip('show')
.attr('title', 'Copy to clipboard')
.tooltip('fixTitle')
})
})
// Copy to clipboard
zeroClipboard.on('dataRequested', function (client) {
var highlight = $(this).parent().nextAll('.highlight').first()
client.setText(highlight.text())
})
// Notify copy success and reset tooltip title
zeroClipboard.on('complete', function () {
htmlBridge
.attr('title', 'Copied!')
.tooltip('fixTitle')
.tooltip('show')
.attr('title', 'Copy to clipboard')
.tooltip('fixTitle')
})
// Notify copy failure
// Hide copy button when no Flash is found
// or wrong Flash version is present
zeroClipboard.on('noflash wrongflash', function () {
htmlBridge
.attr('title', 'Flash required')
.tooltip('fixTitle')
.tooltip('show')
$('.zero-clipboard').remove()
ZeroClipboard.destroy()
})
})
@@ -177,5 +177,7 @@
;(function () {
'use strict';
addAnchors('.bs-docs-container h1, .bs-docs-container h2, .bs-docs-container h3, .bs-docs-container h4, .bs-docs-container h5');
anchors.options.placement = 'left';
anchors.add('.bs-docs-section > h1, .bs-docs-section > h2, .bs-docs-section > h3, .bs-docs-section > h4, .bs-docs-section > h5')
})();
+33 -31
View File
@@ -1,9 +1,9 @@
/*!
* Bootstrap Customizer (http://getbootstrap.com/customize/)
* Copyright 2011-2014 Twitter, Inc.
* Copyright 2011-2015 Twitter, Inc.
*
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
* details, see http://creativecommons.org/licenses/by/3.0/.
* details, see https://creativecommons.org/licenses/by/3.0/.
*/
/* jshint es3:false */
@@ -11,14 +11,15 @@
window.onload = function () { // wait for load in a dumb way because B-0
'use strict';
var cw = '/*!\n' +
' * Bootstrap v3.3.4 (http://getbootstrap.com)\n' +
' * Bootstrap v3.3.5 (http://getbootstrap.com)\n' +
' * Copyright 2011-' + new Date().getFullYear() + ' Twitter, Inc.\n' +
' * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n' +
' */\n\n'
var supportsFile = (window.File && window.FileReader && window.FileList && window.Blob)
var importDropTarget = $('#import-drop-target')
var supportsFile = window.File && window.FileReader && window.FileList && window.Blob
var $importDropTarget = $('#import-drop-target')
function showError(msg, err) {
$('<div id="bsCustomizerAlert" class="bs-customizer-alert">' +
@@ -39,15 +40,15 @@ window.onload = function () { // wait for load in a dumb way because B-0
}
function showCallout(msg, showUpTop) {
var callout = $('<div class="bs-callout bs-callout-danger">' +
var $callout = $('<div class="bs-callout bs-callout-danger">' +
'<h4>Attention!</h4>' +
'<p>' + msg + '</p>' +
'</div>')
if (showUpTop) {
callout.appendTo('.bs-docs-container')
$callout.appendTo('.bs-docs-container')
} else {
callout.insertAfter('.bs-customize-download')
$callout.insertAfter('.bs-customize-download')
}
}
@@ -112,7 +113,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
js: $('#plugin-section input:checked').map(function () { return this.value }).toArray()
}
if ($.isEmptyObject(data.vars) && !data.css.length && !data.js.length) return
if ($.isEmptyObject(data.vars) && !data.css.length && !data.js.length) return null
return data
}
@@ -200,8 +201,8 @@ window.onload = function () { // wait for load in a dumb way because B-0
}
function generateFonts() {
var glyphicons = $('#less-section [value="glyphicons.less"]:checked')
if (glyphicons.length) {
var $glyphicons = $('#less-section [value="glyphicons.less"]:checked')
if ($glyphicons.length) {
return __fonts
}
}
@@ -241,11 +242,11 @@ window.onload = function () { // wait for load in a dumb way because B-0
// Core stylesheets like 'normalize.less' are not included in the form
// since disabling them would wreck everything, and so their 'fileInclude'
// will be 'undefined'.
if (fileInclude || (fileInclude == null)) lessSource += __less[filename]
if (fileInclude || fileInclude == null) lessSource += __less[filename]
// Custom variables are added after Bootstrap variables so the custom
// ones take precedence.
if (('variables.less' === filename) && vars) lessSource += generateCustomLess(vars)
if (filename === 'variables.less' && vars) lessSource += generateCustomLess(vars)
})
lessSource = lessSource.replace(/@import[^\n]*/gi, '') // strip any imports
@@ -267,8 +268,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
try {
intoResult[baseFilename + '.css'] = cw + tree.toCSS()
intoResult[baseFilename + '.min.css'] = cw + tree.toCSS({ compress: true })
}
catch (compileErr) {
} catch (compileErr) {
return promise.reject(compileErr)
}
promise.resolve()
@@ -359,14 +359,14 @@ window.onload = function () { // wait for load in a dumb way because B-0
}
function removeImportAlerts() {
importDropTarget.nextAll('.alert').remove()
$importDropTarget.nextAll('.alert').remove()
}
function handleConfigFileSelect(e) {
e.stopPropagation()
e.preventDefault()
var file = (e.originalEvent.hasOwnProperty('dataTransfer')) ? e.originalEvent.dataTransfer.files[0] : e.originalEvent.target.files[0]
var file = e.originalEvent.hasOwnProperty('dataTransfer') ? e.originalEvent.dataTransfer.files[0] : e.originalEvent.target.files[0]
var reader = new FileReader()
@@ -381,9 +381,9 @@ window.onload = function () { // wait for load in a dumb way because B-0
}
updateCustomizerFromJson(json)
showAlert('success', '<strong>Woohoo!</strong> Your configuration was successfully uploaded. Tweak your settings, then hit Download.', importDropTarget)
showAlert('success', '<strong>Woohoo!</strong> Your configuration was successfully uploaded. Tweak your settings, then hit Download.', $importDropTarget)
} catch (err) {
return showAlert('danger', '<strong>Shucks.</strong> We can only read valid <code>.json</code> files. Please try again.', importDropTarget)
return showAlert('danger', '<strong>Shucks.</strong> We can only read valid <code>.json</code> files. Please try again.', $importDropTarget)
}
}
@@ -399,7 +399,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
}
if (supportsFile) {
importDropTarget
$importDropTarget
.on('dragover', handleConfigDragOver)
.on('drop', handleConfigFileSelect)
}
@@ -407,23 +407,23 @@ window.onload = function () { // wait for load in a dumb way because B-0
$('#import-file-select').on('change', handleConfigFileSelect)
$('#import-manual-trigger').on('click', removeImportAlerts)
var inputsComponent = $('#less-section input')
var inputsPlugin = $('#plugin-section input')
var inputsVariables = $('#less-variables-section input')
var $inputsComponent = $('#less-section input')
var $inputsPlugin = $('#plugin-section input')
var $inputsVariables = $('#less-variables-section input')
$('#less-section .toggle').on('click', function (e) {
e.preventDefault()
inputsComponent.prop('checked', !inputsComponent.is(':checked'))
$inputsComponent.prop('checked', !$inputsComponent.is(':checked'))
})
$('#plugin-section .toggle').on('click', function (e) {
e.preventDefault()
inputsPlugin.prop('checked', !inputsPlugin.is(':checked'))
$inputsPlugin.prop('checked', !$inputsPlugin.is(':checked'))
})
$('#less-variables-section .toggle').on('click', function (e) {
e.preventDefault()
inputsVariables.val('')
$inputsVariables.val('')
})
$('[data-dependencies]').on('click', function () {
@@ -432,8 +432,8 @@ window.onload = function () { // wait for load in a dumb way because B-0
if (!dependencies) return
dependencies = dependencies.split(',')
for (var i = 0; i < dependencies.length; i++) {
var dependency = $('[value="' + dependencies[i] + '"]')
dependency && dependency.prop('checked', true)
var $dependency = $('[value="' + dependencies[i] + '"]')
$dependency && $dependency.prop('checked', true)
}
})
@@ -443,8 +443,8 @@ window.onload = function () { // wait for load in a dumb way because B-0
if (!dependents) return
dependents = dependents.split(',')
for (var i = 0; i < dependents.length; i++) {
var dependent = $('[value="' + dependents[i] + '"]')
dependent && dependent.prop('checked', false)
var $dependent = $('[value="' + dependents[i] + '"]')
$dependent && $dependent.prop('checked', false)
}
})
@@ -474,7 +474,9 @@ window.onload = function () { // wait for load in a dumb way because B-0
).done(function (css, js, fonts) {
generateZip(css, js, fonts, configJson, function (blob) {
$compileBtn.removeAttr('disabled')
setTimeout(function () { saveAs(blob, 'bootstrap.zip') }, 0)
setTimeout(function () {
saveAs(blob, 'bootstrap.zip')
}, 0)
})
})
})