Skip to content

Commit

Permalink
Merge branch '3.0.0-wip' into bs3_homepage
Browse files Browse the repository at this point in the history
Conflicts:
	customize.html
	examples/justified-nav/justified-nav.css
  • Loading branch information
mdo committed Aug 19, 2013
2 parents 578a14e + 5bd2d7e commit 9dcae61
Show file tree
Hide file tree
Showing 59 changed files with 3,318 additions and 539 deletions.
18 changes: 15 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ module.exports = function(grunt) {
}
},

copy: {
fonts: {
expand: true,
src: ["fonts/*"],
dest: 'dist/'
}
},

qunit: {
options: {
inject: 'js/tests/unit/phantom.js'
Expand Down Expand Up @@ -147,6 +155,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-uglify');
Expand All @@ -157,10 +166,10 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('browserstack-runner');

// Docs HTML validation task
grunt.registerTask('validate-docs', ['jekyll', 'validation']);
grunt.registerTask('validate-html', ['jekyll', 'validation']);

// Test task.
var testSubtasks = ['jshint', 'qunit', 'validate-docs'];
var testSubtasks = ['dist-css', 'jshint', 'qunit', 'validate-html'];
// Only run BrowserStack tests under Travis
if (process.env.TRAVIS) {
// Only run BrowserStack tests if this is a mainline commit in twbs/bootstrap, or you have your own BrowserStack key
Expand All @@ -176,8 +185,11 @@ module.exports = function(grunt) {
// CSS distribution task.
grunt.registerTask('dist-css', ['recess']);

// Fonts distribution task.
grunt.registerTask('dist-fonts', ['copy']);

// Full distribution task.
grunt.registerTask('dist', ['clean', 'dist-css', 'dist-js']);
grunt.registerTask('dist', ['clean', 'dist-css', 'dist-fonts', 'dist-js']);

// Default task.
grunt.registerTask('default', ['test', 'dist', 'build-customizer']);
Expand Down
3 changes: 0 additions & 3 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ repo: https://github.com/twbs/bootstrap
download: https://github.com/twbs/bootstrap/archive/v3.0.0.zip
download_dist: https://github.com/twbs/bootstrap/releases/download/v3.0.0/bootstrap-3.0.0-dist.zip

glyphicons: http://glyphicons.getbootstrap.com
glyphicons_repo: https://github.com/twbs/bootstrap-glyphicons

blog: http://blog.getbootstrap.com
expo: http://expo.getbootstrap.com

Expand Down
1 change: 1 addition & 0 deletions _includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<script src="{{ page.base_url }}assets/js/less.js"></script>
<script src="{{ page.base_url }}assets/js/jszip.js"></script>
<script src="{{ page.base_url }}assets/js/uglify.js"></script>
<script src="{{ page.base_url }}assets/js/filesaver.js"></script>
<script src="{{ page.base_url }}assets/js/customizer.js"></script>
{% endif %}

Expand Down
8 changes: 8 additions & 0 deletions _includes/nav-components.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
<li>
<a href="#glyphicons">Glyphicons</a>
<ul class="nav">
<li><a href="#glyphicons-glyphs">Available glyphs</a></li>
<li><a href="#glyphicons-how-to-use">How to use</a></li>
<li><a href="#glyphicons-examples">Examples</a></li>
</ul>
</li>
<li>
<a href="#dropdowns">Dropdowns</a>
<ul class="nav">
Expand Down
3 changes: 0 additions & 3 deletions _includes/nav-css.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
<li><a href="#overview-container">Containers</a></li>
</ul>
</li>
<li>
<a href="#glyphicons">Glyphicons</a>
</li>
<li>
<a href="#grid">Grid system</a>
<ul class="nav">
Expand Down
9 changes: 9 additions & 0 deletions _includes/nav-getting-started.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
<li>
<a href="#disable-responsive">Disabling responsiveness</a>
</li>
<li>
<a href="#migration">Migrating from 2.x to 3.0</a>
<ul class="nav">
<li><a href="#migration-classes">Major class changes</a></li>
<li><a href="#migration-new">What's new</a></li>
<li><a href="#migration-dropped">What's removed</a></li>
<li><a href="#migration-notes">Additional notes</a></li>
</ul>
</li>
<li>
<a href="#browsers">Browser support</a>
</li>
Expand Down
4 changes: 2 additions & 2 deletions _layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
<a href="{{ site.repo }}" onclick="_gaq.push(['_trackEvent', 'Jumbotron actions', 'Jumbotron links', 'GitHub project']);">GitHub project</a>
</li>
<li>
<a href="{{ page.base_url }}getting-started#examples" onclick="_gaq.push(['_trackEvent', 'Jumbotron actions', 'Jumbotron links', 'Examples']);">Examples</a>
<a href="{{ page.base_url }}getting-started/#examples" onclick="_gaq.push(['_trackEvent', 'Jumbotron actions', 'Jumbotron links', 'Examples']);">Examples</a>
</li>
<li>
<a href="{{ site.glyphicons }}" onclick="_gaq.push(['_trackEvent', 'Jumbotron actions', 'Jumbotron links', 'Glyphicons']);">Glyphicons</a>
<a href="{{ page.base_url }}components/#glyphicons" onclick="_gaq.push(['_trackEvent', 'Jumbotron actions', 'Jumbotron links', 'Glyphicons']);">Glyphicons</a>
</li>
<li>
<a href="{{ site.expo }}" onclick="_gaq.push(['_trackEvent', 'Jumbotron actions', 'Jumbotron links', 'Expo']);">Expo</a>
Expand Down
Binary file modified assets/ico/apple-touch-icon-114-precomposed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/ico/apple-touch-icon-144-precomposed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/ico/apple-touch-icon-57-precomposed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/ico/apple-touch-icon-72-precomposed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/ico/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 49 additions & 17 deletions assets/js/customizer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
window.onload = function () { // wait for load in a dumb way because B-0
var cw = '/*!\n * Bootstrap v3.0.0-rc.2\n *\n * Copyright 2013 Twitter, Inc\n * Licensed under the Apache License v2.0\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Designed and built with all the love in the world @twitter by @mdo and @fat.\n */\n\n'

function showError (msg, err) {
function showError(msg, err) {
$('<div id="bsCustomizerAlert" class="bs-customizer-alert">\
<div class="container">\
<a href="#bsCustomizerAlert" data-dismiss="alert" class="close pull-right">&times;</a>\
Expand All @@ -12,19 +12,32 @@ window.onload = function () { // wait for load in a dumb way because B-0
throw err
}

function showCallout(msg, showUpTop) {
var callout = $('<div class="bs-callout bs-callout-danger">\
<h4>Attention!</h4>\
<p>' + msg + '</p>\
</div>')

if (showUpTop) {
callout.appendTo('.bs-docs-container')
} else {
callout.insertAfter('.bs-customize-download')
}
}

function getQueryParam(key) {
key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, "\\$&"); // escape RegEx meta chars
var match = location.search.match(new RegExp("[?&]"+key+"=([^&]+)(&|$)"));
return match && decodeURIComponent(match[1].replace(/\+/g, " "));
}

function createGist (configData) {
function createGist(configData) {
var data = {
"description": "Bootstrap Customizer Config",
"public": true,
"files": {
"config.json": {
"content": JSON.stringify(configData)
"content": JSON.stringify(configData, null, 2)
}
}
}
Expand All @@ -42,7 +55,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
})
}

function generateUrl() {
function getCustomizerData() {
var vars = {}

$('#less-variables-section input')
Expand All @@ -58,7 +71,7 @@ window.onload = function () { // wait for load in a dumb way because B-0

if ($.isEmptyObject(data.vars) && !data.css.length && !data.js.length) return

createGist(data)
return data
}

function parseUrl() {
Expand Down Expand Up @@ -113,9 +126,9 @@ window.onload = function () { // wait for load in a dumb way because B-0
}
}

var content = zip.generate()
location.href = 'data:application/zip;base64,' + content
complete()
var content = zip.generate({type:"blob"})

complete(content)
}

function generateCustomCSS(vars) {
Expand Down Expand Up @@ -188,15 +201,6 @@ window.onload = function () { // wait for load in a dumb way because B-0
}
}

var $downloadBtn = $('#btn-download').on('click', function (e) {
e.preventDefault()
$downloadBtn.addClass('loading')
generateZip(generateCSS(), generateJavascript(), function () {
$downloadBtn.removeClass('loading')
setTimeout(generateUrl, 500)
})
})

var inputsComponent = $('#less-section input')
var inputsPlugin = $('#plugin-section input')
var inputsVariables = $('#less-variables-section input')
Expand Down Expand Up @@ -238,5 +242,33 @@ window.onload = function () { // wait for load in a dumb way because B-0
}
})

var $compileBtn = $('#btn-compile')
var $downloadBtn = $('#btn-download')

$compileBtn.on('click', function (e) {
e.preventDefault()

$compileBtn.attr('disabled', 'disabled')

generateZip(generateCSS(), generateJavascript(), function (blob) {
$compileBtn.removeAttr('disabled')
saveAs(blob, "bootstrap.zip")
createGist(getCustomizerData())
})
})

// browser support alerts
if (!window.URL && navigator.userAgent.toLowerCase().indexOf('safari') != -1) {
showCallout("Looks like you're using safari, which sadly doesn't have the best support\
for HTML5 blobs. Because of this your file will be downloaded with the name <code>\"untitled\"</code>.\
However, if you check your downloads folder, just rename this <code>\"untitled\"</code> file\
to <code>\"bootstrap.zip\"</code> and you should be good to go!")
} else if (!window.URL && !window.webkitURL) {
$('.bs-docs-section, .bs-sidebar').css('display', 'none')

showCallout("Looks like your current browser doesn't support the Bootstrap Customizer. Please take a second\
to <a href=\"https://www.google.com/intl/en/chrome/browser/\"> upgrade to a more modern browser</a>.", true)
}

parseUrl()
}
Loading

0 comments on commit 9dcae61

Please sign in to comment.