').appendTo('body').alert()
+ throw err
+ }
+
+ 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) {
+ var data = {
+ "description": "Bootstrap Customizer Config",
+ "public": true,
+ "files": {
+ "config.json": {
+ "content": JSON.stringify(configData)
+ }
+ }
+ }
+ $.ajax({
+ url: 'https://api.github.com/gists',
+ type: 'POST',
+ dataType: 'json',
+ data: JSON.stringify(data)
+ })
+ .success(function(result) {
+ history.replaceState(false, document.title, window.location.origin + window.location.pathname + '?id=' + result.id)
+ })
+ .error(function(err) {
+ showError('Error Could not save gist file, configuration not saved.', err)
+ })
+ }
+
function generateUrl() {
var vars = {}
@@ -11,39 +52,50 @@ window.onload = function () { // wait for load in a dumb way because B-0
var data = {
vars: vars,
- css: $('#less-section input:not(:checked)').map(function () { return this.value }).toArray(),
- js: $('#plugin-section input:not(:checked)').map(function () { return this.value }).toArray()
+ css: $('#less-section input:checked') .map(function () { return this.value }).toArray(),
+ js: $('#plugin-section input:checked').map(function () { return this.value }).toArray()
}
if ($.isEmptyObject(data.vars) && !data.css.length && !data.js.length) return
- window.location = jQuery.param.querystring('/customize/', data)
+ createGist(data)
}
function parseUrl() {
- var data = jQuery.deparam.querystring()
+ var id = getQueryParam('id')
- if (data.js) {
- for (var i = 0; i < data.js.length; i++) {
- var input = $('input[value="'+data.js[i]+'"]')
- input && input.prop('checked', false)
+ if (!id) return
+
+ $.ajax({
+ url: 'https://api.github.com/gists/' + id,
+ type: 'GET',
+ dataType: 'json'
+ })
+ .success(function(result) {
+ var data = JSON.parse(result.files['config.json'].content)
+ if (data.js) {
+ $('#plugin-section input').each(function () {
+ $(this).prop('checked', ~$.inArray(this.value, data.js))
+ })
}
- }
-
- if (data.css) {
- for (var i = 0; i < data.css.length; i++) {
- var input = $('input[value="'+data.css[i]+'"]')
- input && input.prop('checked', false)
+ if (data.css) {
+ $('#less-section input').each(function () {
+ $(this).prop('checked', ~$.inArray(this.value, data.css))
+ })
}
- }
-
- if (data.vars) {
- // todo (fat): vars
- }
+ if (data.vars) {
+ for (var i in data.vars) {
+ $('input[data-var="' + i + '"]').val(data.vars[i])
+ }
+ }
+ })
+ .error(function(err) {
+ showError('Error fetching bootstrap config file', err)
+ })
}
function generateZip(css, js, complete) {
- if (!css && !js) return alert('you want to build nothing… o_O')
+ if (!css && !js) return showError('Error No Bootstrap files selected.', new Error('no Bootstrap'))
var zip = new JSZip()
@@ -62,9 +114,7 @@ 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()
}
@@ -108,15 +158,16 @@ window.onload = function () { // wait for load in a dumb way because B-0
, optimization: 0
, filename: 'bootstrap.css'
}).parse(css, function (err, tree) {
- if (err) return alert(err)
-
+ if (err) {
+ return showError('Error Could not parse less files.', err)
+ }
result = {
'bootstrap.css' : cw + tree.toCSS(),
'bootstrap.min.css' : cw + tree.toCSS({ compress: true })
}
})
} catch (err) {
- return alert(err)
+ return showError('Error Could not parse less files.', err)
}
return result
@@ -142,9 +193,7 @@ window.onload = function () { // wait for load in a dumb way because B-0
$downloadBtn.addClass('loading')
generateZip(generateCSS(), generateJavascript(), function () {
$downloadBtn.removeClass('loading')
- setTimeout(function () {
- generateUrl()
- }, 1)
+ setTimeout(generateUrl, 500)
})
})
@@ -167,9 +216,27 @@ window.onload = function () { // wait for load in a dumb way because B-0
inputsVariables.val('')
})
- try {
- parseUrl()
- } catch (e) {
- // maybe alert user that we can't parse their url
- }
+ $('[data-dependencies]').on('click', function () {
+ if (!$(this).is(':checked')) return
+ var dependencies = this.getAttribute('data-dependencies')
+ if (!dependencies) return
+ dependencies = dependencies.split(',')
+ for (var i = 0; i < dependencies.length; i++) {
+ var dependency = $('[value="' + dependencies[i] + '"]')
+ dependency && dependency.prop('checked', true)
+ }
+ })
+
+ $('[data-dependents]').on('click', function () {
+ if ($(this).is(':checked')) return
+ var dependents = this.getAttribute('data-dependents')
+ if (!dependents) return
+ dependents = dependents.split(',')
+ for (var i = 0; i < dependents.length; i++) {
+ var dependent = $('[value="' + dependents[i] + '"]')
+ dependent && dependent.prop('checked', false)
+ }
+ })
+
+ parseUrl()
}
\ No newline at end of file
diff --git a/assets/js/jquery.bbq.min.js b/assets/js/jquery.bbq.min.js
deleted file mode 100644
index e9cacd988..000000000
--- a/assets/js/jquery.bbq.min.js
+++ /dev/null
@@ -1,1287 +0,0 @@
-/*!
- * jQuery BBQ: Back Button & Query Library - v1.3pre - 8/26/2010
- * http://benalman.com/projects/jquery-bbq-plugin/
- *
- * Copyright (c) 2010 "Cowboy" Ben Alman
- * Dual licensed under the MIT and GPL licenses.
- * http://benalman.com/about/license/
- */
-
-// Script: jQuery BBQ: Back Button & Query Library
-//
-// *Version: 1.3pre, Last updated: 8/26/2010*
-//
-// Project Home - http://benalman.com/projects/jquery-bbq-plugin/
-// GitHub - http://github.com/cowboy/jquery-bbq/
-// Source - http://github.com/cowboy/jquery-bbq/raw/master/jquery.ba-bbq.js
-// (Minified) - http://github.com/cowboy/jquery-bbq/raw/master/jquery.ba-bbq.min.js (2.2kb gzipped)
-//
-// About: License
-//
-// Copyright (c) 2010 "Cowboy" Ben Alman,
-// Dual licensed under the MIT and GPL licenses.
-// http://benalman.com/about/license/
-//
-// About: Examples
-//
-// These working examples, complete with fully commented code, illustrate a few
-// ways in which this plugin can be used.
-//
-// Basic AJAX - http://benalman.com/code/projects/jquery-bbq/examples/fragment-basic/
-// Advanced AJAX - http://benalman.com/code/projects/jquery-bbq/examples/fragment-advanced/
-// jQuery UI Tabs - http://benalman.com/code/projects/jquery-bbq/examples/fragment-jquery-ui-tabs/
-// Deparam - http://benalman.com/code/projects/jquery-bbq/examples/deparam/
-//
-// About: Support and Testing
-//
-// Information about what version or versions of jQuery this plugin has been
-// tested with, what browsers it has been tested in, and where the unit tests
-// reside (so you can test it yourself).
-//
-// jQuery Versions - 1.2.6, 1.3.2, 1.4.1, 1.4.2
-// Browsers Tested - Internet Explorer 6-8, Firefox 2-4, Chrome 5-6, Safari 3.2-5,
-// Opera 9.6-10.60, iPhone 3.1, Android 1.6-2.2, BlackBerry 4.6-5.
-// Unit Tests - http://benalman.com/code/projects/jquery-bbq/unit/
-//
-// About: Release History
-//
-// 1.3pre - (8/26/2010) Integrated v1.3, which adds
-// document.title and document.domain support in IE6/7, BlackBerry
-// support, better Iframe hiding for accessibility reasons, and the new
-// "shortcut" method. Added the
-// method which reduces the possibility of
-// extraneous hashchange event triggering. Added the
-// method which can be used to
-// enable Google "AJAX Crawlable mode."
-// 1.2.1 - (2/17/2010) Actually fixed the stale window.location Safari bug from
-// in BBQ, which was the main reason for the
-// previous release!
-// 1.2 - (2/16/2010) Integrated v1.2, which fixes a
-// Safari bug, the event can now be bound before DOM ready, and IE6/7
-// page should no longer scroll when the event is first bound. Also
-// added the method, and reworked the
-// internal "add" method to be compatible with
-// changes made to the jQuery 1.4.2 special events API.
-// 1.1.1 - (1/22/2010) Integrated v1.1, which fixes an
-// obscure IE8 EmulateIE7 meta tag compatibility mode bug.
-// 1.1 - (1/9/2010) Broke out the jQuery BBQ event.special
-// functionality into a separate plugin for users who want just the
-// basic event & back button support, without all the extra awesomeness
-// that BBQ provides. This plugin will be included as part of jQuery BBQ,
-// but also be available separately. See
-// plugin for more information. Also added the
-// method and added additional examples.
-// 1.0.3 - (12/2/2009) Fixed an issue in IE 6 where location.search and
-// location.hash would report incorrectly if the hash contained the ?
-// character. Also and
-// will no longer parse params out of a URL that doesn't contain ? or #,
-// respectively.
-// 1.0.2 - (10/10/2009) Fixed an issue in IE 6/7 where the hidden IFRAME caused
-// a "This page contains both secure and nonsecure items." warning when
-// used on an https:// page.
-// 1.0.1 - (10/7/2009) Fixed an issue in IE 8. Since both "IE7" and "IE8
-// Compatibility View" modes erroneously report that the browser
-// supports the native window.onhashchange event, a slightly more
-// robust test needed to be added.
-// 1.0 - (10/2/2009) Initial release
-
-(function($,window){
- '$:nomunge'; // Used by YUI compressor.
-
- // Some convenient shortcuts.
- var undefined,
- aps = Array.prototype.slice,
- decode = decodeURIComponent,
-
- // Method / object references.
- jq_param = $.param,
- jq_param_sorted,
- jq_param_fragment,
- jq_deparam,
- jq_deparam_fragment,
- jq_bbq = $.bbq = $.bbq || {},
- jq_bbq_pushState,
- jq_bbq_getState,
- jq_elemUrlAttr,
- special = $.event.special,
-
- // Reused strings.
- str_hashchange = 'hashchange',
- str_querystring = 'querystring',
- str_fragment = 'fragment',
- str_elemUrlAttr = 'elemUrlAttr',
- str_href = 'href',
- str_src = 'src',
-
- // Reused RegExp.
- re_params_querystring = /^.*\?|#.*$/g,
- re_params_fragment,
- re_fragment,
- re_no_escape,
-
- ajax_crawlable,
- fragment_prefix,
-
- // Used by jQuery.elemUrlAttr.
- elemUrlAttr_cache = {};
-
- // A few commonly used bits, broken out to help reduce minified file size.
-
- function is_string( arg ) {
- return typeof arg === 'string';
- };
-
- // Why write the same function twice? Let's curry! Mmmm, curry..
-
- function curry( func ) {
- var args = aps.call( arguments, 1 );
-
- return function() {
- return func.apply( this, args.concat( aps.call( arguments ) ) );
- };
- };
-
- // Get location.hash (or what you'd expect location.hash to be) sans any
- // leading #. Thanks for making this necessary, Firefox!
- function get_fragment( url ) {
- return url.replace( re_fragment, '$2' );
- };
-
- // Get location.search (or what you'd expect location.search to be) sans any
- // leading #. Thanks for making this necessary, IE6!
- function get_querystring( url ) {
- return url.replace( /(?:^[^?#]*\?([^#]*).*$)?.*/, '$1' );
- };
-
- // Section: Param (to string)
- //
- // Method: jQuery.param.querystring
- //
- // Retrieve the query string from a URL or if no arguments are passed, the
- // current window.location.href.
- //
- // Usage:
- //
- // > jQuery.param.querystring( [ url ] );
- //
- // Arguments:
- //
- // url - (String) A URL containing query string params to be parsed. If url
- // is not passed, the current window.location.href is used.
- //
- // Returns:
- //
- // (String) The parsed query string, with any leading "?" removed.
- //
-
- // Method: jQuery.param.querystring (build url)
- //
- // Merge a URL, with or without pre-existing query string params, plus any
- // object, params string or URL containing query string params into a new URL.
- //
- // Usage:
- //
- // > jQuery.param.querystring( url, params [, merge_mode ] );
- //
- // Arguments:
- //
- // url - (String) A valid URL for params to be merged into. This URL may
- // contain a query string and/or fragment (hash).
- // params - (String) A params string or URL containing query string params to
- // be merged into url.
- // params - (Object) A params object to be merged into url.
- // merge_mode - (Number) Merge behavior defaults to 0 if merge_mode is not
- // specified, and is as-follows:
- //
- // * 0: params in the params argument will override any query string
- // params in url.
- // * 1: any query string params in url will override params in the params
- // argument.
- // * 2: params argument will completely replace any query string in url.
- //
- // Returns:
- //
- // (String) A URL with a urlencoded query string in the format '?a=b&c=d&e=f'.
-
- // Method: jQuery.param.fragment
- //
- // Retrieve the fragment (hash) from a URL or if no arguments are passed, the
- // current window.location.href.
- //
- // Usage:
- //
- // > jQuery.param.fragment( [ url ] );
- //
- // Arguments:
- //
- // url - (String) A URL containing fragment (hash) params to be parsed. If
- // url is not passed, the current window.location.href is used.
- //
- // Returns:
- //
- // (String) The parsed fragment (hash) string, with any leading "#" removed.
-
- // Method: jQuery.param.fragment (build url)
- //
- // Merge a URL, with or without pre-existing fragment (hash) params, plus any
- // object, params string or URL containing fragment (hash) params into a new
- // URL.
- //
- // Usage:
- //
- // > jQuery.param.fragment( url, params [, merge_mode ] );
- //
- // Arguments:
- //
- // url - (String) A valid URL for params to be merged into. This URL may
- // contain a query string and/or fragment (hash).
- // params - (String) A params string or URL containing fragment (hash) params
- // to be merged into url.
- // params - (Object) A params object to be merged into url.
- // merge_mode - (Number) Merge behavior defaults to 0 if merge_mode is not
- // specified, and is as-follows:
- //
- // * 0: params in the params argument will override any fragment (hash)
- // params in url.
- // * 1: any fragment (hash) params in url will override params in the
- // params argument.
- // * 2: params argument will completely replace any query string in url.
- //
- // Returns:
- //
- // (String) A URL with a urlencoded fragment (hash) in the format '#a=b&c=d&e=f'.
-
- function jq_param_sub( is_fragment, get_func, url, params, merge_mode ) {
- var result,
- qs,
- matches,
- url_params,
- hash;
-
- if ( params !== undefined ) {
- // Build URL by merging params into url string.
-
- // matches[1] = url part that precedes params, not including trailing ?/#
- // matches[2] = params, not including leading ?/#
- // matches[3] = if in 'querystring' mode, hash including leading #, otherwise ''
- matches = url.match( is_fragment ? re_fragment : /^([^#?]*)\??([^#]*)(#?.*)/ );
-
- // Get the hash if in 'querystring' mode, and it exists.
- hash = matches[3] || '';
-
- if ( merge_mode === 2 && is_string( params ) ) {
- // If merge_mode is 2 and params is a string, merge the fragment / query
- // string into the URL wholesale, without converting it into an object.
- qs = params.replace( is_fragment ? re_params_fragment : re_params_querystring, '' );
-
- } else {
- // Convert relevant params in url to object.
- url_params = jq_deparam( matches[2] );
-
- params = is_string( params )
-
- // Convert passed params string into object.
- ? jq_deparam[ is_fragment ? str_fragment : str_querystring ]( params )
-
- // Passed params object.
- : params;
-
- qs = merge_mode === 2 ? params // passed params replace url params
- : merge_mode === 1 ? $.extend( {}, params, url_params ) // url params override passed params
- : $.extend( {}, url_params, params ); // passed params override url params
-
- // Convert params object into a sorted params string.
- qs = jq_param_sorted( qs );
-
- // Unescape characters specified via $.param.noEscape. Since only hash-
- // history users have requested this feature, it's only enabled for
- // fragment-related params strings.
- if ( is_fragment ) {
- qs = qs.replace( re_no_escape, decode );
- }
- }
-
- // Build URL from the base url, querystring and hash. In 'querystring'
- // mode, ? is only added if a query string exists. In 'fragment' mode, #
- // is always added.
- result = matches[1] + ( is_fragment ? fragment_prefix : qs || !matches[1] ? '?' : '' ) + qs + hash;
-
- } else {
- // If URL was passed in, parse params from URL string, otherwise parse
- // params from window.location.href.
- result = get_func( url !== undefined ? url : location.href );
- }
-
- return result;
- };
-
- jq_param[ str_querystring ] = curry( jq_param_sub, 0, get_querystring );
- jq_param[ str_fragment ] = jq_param_fragment = curry( jq_param_sub, 1, get_fragment );
-
- // Method: jQuery.param.sorted
- //
- // Returns a params string equivalent to that returned by the internal
- // jQuery.param method, but sorted, which makes it suitable for use as a
- // cache key.
- //
- // For example, in most browsers jQuery.param({z:1,a:2}) returns "z=1&a=2"
- // and jQuery.param({a:2,z:1}) returns "a=2&z=1". Even though both the
- // objects being serialized and the resulting params strings are equivalent,
- // if these params strings were set into the location.hash fragment
- // sequentially, the hashchange event would be triggered unnecessarily, since
- // the strings are different (even though the data described by them is the
- // same). By sorting the params string, unecessary hashchange event triggering
- // can be avoided.
- //
- // Usage:
- //
- // > jQuery.param.sorted( obj [, traditional ] );
- //
- // Arguments:
- //
- // obj - (Object) An object to be serialized.
- // traditional - (Boolean) Params deep/shallow serialization mode. See the
- // documentation at http://api.jquery.com/jQuery.param/ for more detail.
- //
- // Returns:
- //
- // (String) A sorted params string.
-
- jq_param.sorted = jq_param_sorted = function( a, traditional ) {
- var arr = [],
- obj = {};
-
- $.each( jq_param( a, traditional ).split( '&' ), function(i,v){
- var key = v.replace( /(?:%5B|=).*$/, '' ),
- key_obj = obj[ key ];
-
- if ( !key_obj ) {
- key_obj = obj[ key ] = [];
- arr.push( key );
- }
-
- key_obj.push( v );
- });
-
- return $.map( arr.sort(), function(v){
- return obj[ v ];
- }).join( '&' );
- };
-
- // Method: jQuery.param.fragment.noEscape
- //
- // Specify characters that will be left unescaped when fragments are created
- // or merged using , or when the fragment is modified
- // using . This option only applies to serialized data
- // object fragments, and not set-as-string fragments. Does not affect the
- // query string. Defaults to ",/" (comma, forward slash).
- //
- // Note that this is considered a purely aesthetic option, and will help to
- // create URLs that "look pretty" in the address bar or bookmarks, without
- // affecting functionality in any way. That being said, be careful to not
- // unescape characters that are used as delimiters or serve a special
- // purpose, such as the "#?&=+" (octothorpe, question mark, ampersand,
- // equals, plus) characters.
- //
- // Usage:
- //
- // > jQuery.param.fragment.noEscape( [ chars ] );
- //
- // Arguments:
- //
- // chars - (String) The characters to not escape in the fragment. If
- // unspecified, defaults to empty string (escape all characters).
- //
- // Returns:
- //
- // Nothing.
-
- jq_param_fragment.noEscape = function( chars ) {
- chars = chars || '';
- var arr = $.map( chars.split(''), encodeURIComponent );
- re_no_escape = new RegExp( arr.join('|'), 'g' );
- };
-
- // A sensible default. These are the characters people seem to complain about
- // "uglifying up the URL" the most.
- jq_param_fragment.noEscape( ',/' );
-
- // Method: jQuery.param.fragment.ajaxCrawlable
- //
- // TODO: DESCRIBE
- //
- // Usage:
- //
- // > jQuery.param.fragment.ajaxCrawlable( [ state ] );
- //
- // Arguments:
- //
- // state - (Boolean) TODO: DESCRIBE
- //
- // Returns:
- //
- // (Boolean) The current ajaxCrawlable state.
-
- jq_param_fragment.ajaxCrawlable = function( state ) {
- if ( state !== undefined ) {
- if ( state ) {
- re_params_fragment = /^.*(?:#!|#)/;
- re_fragment = /^([^#]*)(?:#!|#)?(.*)$/;
- fragment_prefix = '#!';
- } else {
- re_params_fragment = /^.*#/;
- re_fragment = /^([^#]*)#?(.*)$/;
- fragment_prefix = '#';
- }
- ajax_crawlable = !!state;
- }
-
- return ajax_crawlable;
- };
-
- jq_param_fragment.ajaxCrawlable( 0 );
-
- // Section: Deparam (from string)
- //
- // Method: jQuery.deparam
- //
- // Deserialize a params string into an object, optionally coercing numbers,
- // booleans, null and undefined values; this method is the counterpart to the
- // internal jQuery.param method.
- //
- // Usage:
- //
- // > jQuery.deparam( params [, coerce ] );
- //
- // Arguments:
- //
- // params - (String) A params string to be parsed.
- // coerce - (Boolean) If true, coerces any numbers or true, false, null, and
- // undefined to their actual value. Defaults to false if omitted.
- //
- // Returns:
- //
- // (Object) An object representing the deserialized params string.
-
- $.deparam = jq_deparam = function( params, coerce ) {
- var obj = {},
- coerce_types = { 'true': !0, 'false': !1, 'null': null };
-
- // Iterate over all name=value pairs.
- $.each( params.replace( /\+/g, ' ' ).split( '&' ), function(j,v){
- var param = v.split( '=' ),
- key = decode( param[0] ),
- val,
- cur = obj,
- i = 0,
-
- // If key is more complex than 'foo', like 'a[]' or 'a[b][c]', split it
- // into its component parts.
- keys = key.split( '][' ),
- keys_last = keys.length - 1;
-
- // If the first keys part contains [ and the last ends with ], then []
- // are correctly balanced.
- if ( /\[/.test( keys[0] ) && /\]$/.test( keys[ keys_last ] ) ) {
- // Remove the trailing ] from the last keys part.
- keys[ keys_last ] = keys[ keys_last ].replace( /\]$/, '' );
-
- // Split first keys part into two parts on the [ and add them back onto
- // the beginning of the keys array.
- keys = keys.shift().split('[').concat( keys );
-
- keys_last = keys.length - 1;
- } else {
- // Basic 'foo' style key.
- keys_last = 0;
- }
-
- // Are we dealing with a name=value pair, or just a name?
- if ( param.length === 2 ) {
- val = decode( param[1] );
-
- // Coerce values.
- if ( coerce ) {
- val = val && !isNaN(val) ? +val // number
- : val === 'undefined' ? undefined // undefined
- : coerce_types[val] !== undefined ? coerce_types[val] // true, false, null
- : val; // string
- }
-
- if ( keys_last ) {
- // Complex key, build deep object structure based on a few rules:
- // * The 'cur' pointer starts at the object top-level.
- // * [] = array push (n is set to array length), [n] = array if n is
- // numeric, otherwise object.
- // * If at the last keys part, set the value.
- // * For each keys part, if the current level is undefined create an
- // object or array based on the type of the next keys part.
- // * Move the 'cur' pointer to the next level.
- // * Rinse & repeat.
- for ( ; i <= keys_last; i++ ) {
- key = keys[i] === '' ? cur.length : keys[i];
- cur = cur[key] = i < keys_last
- ? cur[key] || ( keys[i+1] && isNaN( keys[i+1] ) ? {} : [] )
- : val;
- }
-
- } else {
- // Simple key, even simpler rules, since only scalars and shallow
- // arrays are allowed.
-
- if ( $.isArray( obj[key] ) ) {
- // val is already an array, so push on the next value.
- obj[key].push( val );
-
- } else if ( obj[key] !== undefined ) {
- // val isn't an array, but since a second value has been specified,
- // convert val into an array.
- obj[key] = [ obj[key], val ];
-
- } else {
- // val is a scalar.
- obj[key] = val;
- }
- }
-
- } else if ( key ) {
- // No value was defined, so set something meaningful.
- obj[key] = coerce
- ? undefined
- : '';
- }
- });
-
- return obj;
- };
-
- // Method: jQuery.deparam.querystring
- //
- // Parse the query string from a URL or the current window.location.href,
- // deserializing it into an object, optionally coercing numbers, booleans,
- // null and undefined values.
- //
- // Usage:
- //
- // > jQuery.deparam.querystring( [ url ] [, coerce ] );
- //
- // Arguments:
- //
- // url - (String) An optional params string or URL containing query string
- // params to be parsed. If url is omitted, the current
- // window.location.href is used.
- // coerce - (Boolean) If true, coerces any numbers or true, false, null, and
- // undefined to their actual value. Defaults to false if omitted.
- //
- // Returns:
- //
- // (Object) An object representing the deserialized params string.
-
- // Method: jQuery.deparam.fragment
- //
- // Parse the fragment (hash) from a URL or the current window.location.href,
- // deserializing it into an object, optionally coercing numbers, booleans,
- // null and undefined values.
- //
- // Usage:
- //
- // > jQuery.deparam.fragment( [ url ] [, coerce ] );
- //
- // Arguments:
- //
- // url - (String) An optional params string or URL containing fragment (hash)
- // params to be parsed. If url is omitted, the current window.location.href
- // is used.
- // coerce - (Boolean) If true, coerces any numbers or true, false, null, and
- // undefined to their actual value. Defaults to false if omitted.
- //
- // Returns:
- //
- // (Object) An object representing the deserialized params string.
-
- function jq_deparam_sub( is_fragment, url_or_params, coerce ) {
- if ( url_or_params === undefined || typeof url_or_params === 'boolean' ) {
- // url_or_params not specified.
- coerce = url_or_params;
- url_or_params = jq_param[ is_fragment ? str_fragment : str_querystring ]();
- } else {
- url_or_params = is_string( url_or_params )
- ? url_or_params.replace( is_fragment ? re_params_fragment : re_params_querystring, '' )
- : url_or_params;
- }
-
- return jq_deparam( url_or_params, coerce );
- };
-
- jq_deparam[ str_querystring ] = curry( jq_deparam_sub, 0 );
- jq_deparam[ str_fragment ] = jq_deparam_fragment = curry( jq_deparam_sub, 1 );
-
- // Section: Element manipulation
- //
- // Method: jQuery.elemUrlAttr
- //
- // Get the internal "Default URL attribute per tag" list, or augment the list
- // with additional tag-attribute pairs, in case the defaults are insufficient.
- //
- // In the and methods, this list
- // is used to determine which attribute contains the URL to be modified, if
- // an "attr" param is not specified.
- //
- // Default Tag-Attribute List:
- //
- // a - href
- // base - href
- // iframe - src
- // img - src
- // input - src
- // form - action
- // link - href
- // script - src
- //
- // Usage:
- //
- // > jQuery.elemUrlAttr( [ tag_attr ] );
- //
- // Arguments:
- //
- // tag_attr - (Object) An object containing a list of tag names and their
- // associated default attribute names in the format { tag: 'attr', ... } to
- // be merged into the internal tag-attribute list.
- //
- // Returns:
- //
- // (Object) An object containing all stored tag-attribute values.
-
- // Only define function and set defaults if function doesn't already exist, as
- // the urlInternal plugin will provide this method as well.
- $[ str_elemUrlAttr ] || ($[ str_elemUrlAttr ] = function( obj ) {
- return $.extend( elemUrlAttr_cache, obj );
- })({
- a: str_href,
- base: str_href,
- iframe: str_src,
- img: str_src,
- input: str_src,
- form: 'action',
- link: str_href,
- script: str_src
- });
-
- jq_elemUrlAttr = $[ str_elemUrlAttr ];
-
- // Method: jQuery.fn.querystring
- //
- // Update URL attribute in one or more elements, merging the current URL (with
- // or without pre-existing query string params) plus any params object or
- // string into a new URL, which is then set into that attribute. Like
- // , but for all elements in a jQuery
- // collection.
- //
- // Usage:
- //
- // > jQuery('selector').querystring( [ attr, ] params [, merge_mode ] );
- //
- // Arguments:
- //
- // attr - (String) Optional name of an attribute that will contain a URL to
- // merge params or url into. See for a list of default
- // attributes.
- // params - (Object) A params object to be merged into the URL attribute.
- // params - (String) A URL containing query string params, or params string
- // to be merged into the URL attribute.
- // merge_mode - (Number) Merge behavior defaults to 0 if merge_mode is not
- // specified, and is as-follows:
- //
- // * 0: params in the params argument will override any params in attr URL.
- // * 1: any params in attr URL will override params in the params argument.
- // * 2: params argument will completely replace any query string in attr
- // URL.
- //
- // Returns:
- //
- // (jQuery) The initial jQuery collection of elements, but with modified URL
- // attribute values.
-
- // Method: jQuery.fn.fragment
- //
- // Update URL attribute in one or more elements, merging the current URL (with
- // or without pre-existing fragment/hash params) plus any params object or
- // string into a new URL, which is then set into that attribute. Like
- // , but for all elements in a jQuery
- // collection.
- //
- // Usage:
- //
- // > jQuery('selector').fragment( [ attr, ] params [, merge_mode ] );
- //
- // Arguments:
- //
- // attr - (String) Optional name of an attribute that will contain a URL to
- // merge params into. See for a list of default
- // attributes.
- // params - (Object) A params object to be merged into the URL attribute.
- // params - (String) A URL containing fragment (hash) params, or params
- // string to be merged into the URL attribute.
- // merge_mode - (Number) Merge behavior defaults to 0 if merge_mode is not
- // specified, and is as-follows:
- //
- // * 0: params in the params argument will override any params in attr URL.
- // * 1: any params in attr URL will override params in the params argument.
- // * 2: params argument will completely replace any fragment (hash) in attr
- // URL.
- //
- // Returns:
- //
- // (jQuery) The initial jQuery collection of elements, but with modified URL
- // attribute values.
-
- function jq_fn_sub( mode, force_attr, params, merge_mode ) {
- if ( !is_string( params ) && typeof params !== 'object' ) {
- // force_attr not specified.
- merge_mode = params;
- params = force_attr;
- force_attr = undefined;
- }
-
- return this.each(function(){
- var that = $(this),
-
- // Get attribute specified, or default specified via $.elemUrlAttr.
- attr = force_attr || jq_elemUrlAttr()[ ( this.nodeName || '' ).toLowerCase() ] || '',
-
- // Get URL value.
- url = attr && that.attr( attr ) || '';
-
- // Update attribute with new URL.
- that.attr( attr, jq_param[ mode ]( url, params, merge_mode ) );
- });
-
- };
-
- $.fn[ str_querystring ] = curry( jq_fn_sub, str_querystring );
- $.fn[ str_fragment ] = curry( jq_fn_sub, str_fragment );
-
- // Section: History, hashchange event
- //
- // Method: jQuery.bbq.pushState
- //
- // Adds a 'state' into the browser history at the current position, setting
- // location.hash and triggering any bound callbacks
- // (provided the new state is different than the previous state).
- //
- // If no arguments are passed, an empty state is created, which is just a
- // shortcut for jQuery.bbq.pushState( {}, 2 ).
- //
- // Usage:
- //
- // > jQuery.bbq.pushState( [ params [, merge_mode ] ] );
- //
- // Arguments:
- //
- // params - (String) A serialized params string or a hash string beginning
- // with # to merge into location.hash.
- // params - (Object) A params object to merge into location.hash.
- // merge_mode - (Number) Merge behavior defaults to 0 if merge_mode is not
- // specified (unless a hash string beginning with # is specified, in which
- // case merge behavior defaults to 2), and is as-follows:
- //
- // * 0: params in the params argument will override any params in the
- // current state.
- // * 1: any params in the current state will override params in the params
- // argument.
- // * 2: params argument will completely replace current state.
- //
- // Returns:
- //
- // Nothing.
- //
- // Additional Notes:
- //
- // * Setting an empty state may cause the browser to scroll.
- // * Unlike the fragment and querystring methods, if a hash string beginning
- // with # is specified as the params agrument, merge_mode defaults to 2.
-
- jq_bbq.pushState = jq_bbq_pushState = function( params, merge_mode ) {
- if ( is_string( params ) && /^#/.test( params ) && merge_mode === undefined ) {
- // Params string begins with # and merge_mode not specified, so completely
- // overwrite window.location.hash.
- merge_mode = 2;
- }
-
- var has_args = params !== undefined,
- // Merge params into window.location using $.param.fragment.
- url = jq_param_fragment( location.href,
- has_args ? params : {}, has_args ? merge_mode : 2 );
-
- // Set new window.location.href. Note that Safari 3 & Chrome barf on
- // location.hash = '#' so the entire URL is set.
- location.href = url;
- };
-
- // Method: jQuery.bbq.getState
- //
- // Retrieves the current 'state' from the browser history, parsing
- // location.hash for a specific key or returning an object containing the
- // entire state, optionally coercing numbers, booleans, null and undefined
- // values.
- //
- // Usage:
- //
- // > jQuery.bbq.getState( [ key ] [, coerce ] );
- //
- // Arguments:
- //
- // key - (String) An optional state key for which to return a value.
- // coerce - (Boolean) If true, coerces any numbers or true, false, null, and
- // undefined to their actual value. Defaults to false.
- //
- // Returns:
- //
- // (Anything) If key is passed, returns the value corresponding with that key
- // in the location.hash 'state', or undefined. If not, an object
- // representing the entire 'state' is returned.
-
- jq_bbq.getState = jq_bbq_getState = function( key, coerce ) {
- return key === undefined || typeof key === 'boolean'
- ? jq_deparam_fragment( key ) // 'key' really means 'coerce' here
- : jq_deparam_fragment( coerce )[ key ];
- };
-
- // Method: jQuery.bbq.removeState
- //
- // Remove one or more keys from the current browser history 'state', creating
- // a new state, setting location.hash and triggering any bound
- // callbacks (provided the new state is different than
- // the previous state).
- //
- // If no arguments are passed, an empty state is created, which is just a
- // shortcut for jQuery.bbq.pushState( {}, 2 ).
- //
- // Usage:
- //
- // > jQuery.bbq.removeState( [ key [, key ... ] ] );
- //
- // Arguments:
- //
- // key - (String) One or more key values to remove from the current state,
- // passed as individual arguments.
- // key - (Array) A single array argument that contains a list of key values
- // to remove from the current state.
- //
- // Returns:
- //
- // Nothing.
- //
- // Additional Notes:
- //
- // * Setting an empty state may cause the browser to scroll.
-
- jq_bbq.removeState = function( arr ) {
- var state = {};
-
- // If one or more arguments is passed..
- if ( arr !== undefined ) {
-
- // Get the current state.
- state = jq_bbq_getState();
-
- // For each passed key, delete the corresponding property from the current
- // state.
- $.each( $.isArray( arr ) ? arr : arguments, function(i,v){
- delete state[ v ];
- });
- }
-
- // Set the state, completely overriding any existing state.
- jq_bbq_pushState( state, 2 );
- };
-
- // Event: hashchange event (BBQ)
- //
- // Usage in jQuery 1.4 and newer:
- //
- // In jQuery 1.4 and newer, the event object passed into any hashchange event
- // callback is augmented with a copy of the location.hash fragment at the time
- // the event was triggered as its event.fragment property. In addition, the
- // event.getState method operates on this property (instead of location.hash)
- // which allows this fragment-as-a-state to be referenced later, even after
- // window.location may have changed.
- //
- // Note that event.fragment and event.getState are not defined according to
- // W3C (or any other) specification, but will still be available whether or
- // not the hashchange event exists natively in the browser, because of the
- // utility they provide.
- //
- // The event.fragment property contains the output of
- // and the event.getState method is equivalent to the
- // method.
- //
- // > $(window).bind( 'hashchange', function( event ) {
- // > var hash_str = event.fragment,
- // > param_obj = event.getState(),
- // > param_val = event.getState( 'param_name' ),
- // > param_val_coerced = event.getState( 'param_name', true );
- // > ...
- // > });
- //
- // Usage in jQuery 1.3.2:
- //
- // In jQuery 1.3.2, the event object cannot to be augmented as in jQuery 1.4+,
- // so the fragment state isn't bound to the event object and must instead be
- // parsed using the and methods.
- //
- // > $(window).bind( 'hashchange', function( event ) {
- // > var hash_str = $.param.fragment(),
- // > param_obj = $.bbq.getState(),
- // > param_val = $.bbq.getState( 'param_name' ),
- // > param_val_coerced = $.bbq.getState( 'param_name', true );
- // > ...
- // > });
- //
- // Additional Notes:
- //
- // * Due to changes in the special events API, jQuery BBQ v1.2 or newer is
- // required to enable the augmented event object in jQuery 1.4.2 and newer.
- // * See for more detailed information.
-
- special[ str_hashchange ] = $.extend( special[ str_hashchange ], {
-
- // Augmenting the event object with the .fragment property and .getState
- // method requires jQuery 1.4 or newer. Note: with 1.3.2, everything will
- // work, but the event won't be augmented)
- add: function( handleObj ) {
- var old_handler;
-
- function new_handler(e) {
- // e.fragment is set to the value of location.hash (with any leading #
- // removed) at the time the event is triggered.
- var hash = e[ str_fragment ] = jq_param_fragment();
-
- // e.getState() works just like $.bbq.getState(), but uses the
- // e.fragment property stored on the event object.
- e.getState = function( key, coerce ) {
- return key === undefined || typeof key === 'boolean'
- ? jq_deparam( hash, key ) // 'key' really means 'coerce' here
- : jq_deparam( hash, coerce )[ key ];
- };
-
- old_handler.apply( this, arguments );
- };
-
- // This may seem a little complicated, but it normalizes the special event
- // .add method between jQuery 1.4/1.4.1 and 1.4.2+
- if ( $.isFunction( handleObj ) ) {
- // 1.4, 1.4.1
- old_handler = handleObj;
- return new_handler;
- } else {
- // 1.4.2+
- old_handler = handleObj.handler;
- handleObj.handler = new_handler;
- }
- }
-
- });
-
-})(jQuery,this);
-
-/*!
- * jQuery hashchange event - v1.3 - 7/21/2010
- * http://benalman.com/projects/jquery-hashchange-plugin/
- *
- * Copyright (c) 2010 "Cowboy" Ben Alman
- * Dual licensed under the MIT and GPL licenses.
- * http://benalman.com/about/license/
- */
-
-// Script: jQuery hashchange event
-//
-// *Version: 1.3, Last updated: 7/21/2010*
-//
-// Project Home - http://benalman.com/projects/jquery-hashchange-plugin/
-// GitHub - http://github.com/cowboy/jquery-hashchange/
-// Source - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.js
-// (Minified) - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.min.js (0.8kb gzipped)
-//
-// About: License
-//
-// Copyright (c) 2010 "Cowboy" Ben Alman,
-// Dual licensed under the MIT and GPL licenses.
-// http://benalman.com/about/license/
-//
-// About: Examples
-//
-// These working examples, complete with fully commented code, illustrate a few
-// ways in which this plugin can be used.
-//
-// hashchange event - http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/
-// document.domain - http://benalman.com/code/projects/jquery-hashchange/examples/document_domain/
-//
-// About: Support and Testing
-//
-// Information about what version or versions of jQuery this plugin has been
-// tested with, what browsers it has been tested in, and where the unit tests
-// reside (so you can test it yourself).
-//
-// jQuery Versions - 1.2.6, 1.3.2, 1.4.1, 1.4.2
-// Browsers Tested - Internet Explorer 6-8, Firefox 2-4, Chrome 5-6, Safari 3.2-5,
-// Opera 9.6-10.60, iPhone 3.1, Android 1.6-2.2, BlackBerry 4.6-5.
-// Unit Tests - http://benalman.com/code/projects/jquery-hashchange/unit/
-//
-// About: Known issues
-//
-// While this jQuery hashchange event implementation is quite stable and
-// robust, there are a few unfortunate browser bugs surrounding expected
-// hashchange event-based behaviors, independent of any JavaScript
-// window.onhashchange abstraction. See the following examples for more
-// information:
-//
-// Chrome: Back Button - http://benalman.com/code/projects/jquery-hashchange/examples/bug-chrome-back-button/
-// Firefox: Remote XMLHttpRequest - http://benalman.com/code/projects/jquery-hashchange/examples/bug-firefox-remote-xhr/
-// WebKit: Back Button in an Iframe - http://benalman.com/code/projects/jquery-hashchange/examples/bug-webkit-hash-iframe/
-// Safari: Back Button from a different domain - http://benalman.com/code/projects/jquery-hashchange/examples/bug-safari-back-from-diff-domain/
-//
-// Also note that should a browser natively support the window.onhashchange
-// event, but not report that it does, the fallback polling loop will be used.
-//
-// About: Release History
-//
-// 1.3 - (7/21/2010) Reorganized IE6/7 Iframe code to make it more
-// "removable" for mobile-only development. Added IE6/7 document.title
-// support. Attempted to make Iframe as hidden as possible by using
-// techniques from http://www.paciellogroup.com/blog/?p=604. Added
-// support for the "shortcut" format $(window).hashchange( fn ) and
-// $(window).hashchange() like jQuery provides for built-in events.
-// Renamed jQuery.hashchangeDelay to and
-// lowered its default value to 50. Added
-// and properties plus document-domain.html
-// file to address access denied issues when setting document.domain in
-// IE6/7.
-// 1.2 - (2/11/2010) Fixed a bug where coming back to a page using this plugin
-// from a page on another domain would cause an error in Safari 4. Also,
-// IE6/7 Iframe is now inserted after the body (this actually works),
-// which prevents the page from scrolling when the event is first bound.
-// Event can also now be bound before DOM ready, but it won't be usable
-// before then in IE6/7.
-// 1.1 - (1/21/2010) Incorporated document.documentMode test to fix IE8 bug
-// where browser version is incorrectly reported as 8.0, despite
-// inclusion of the X-UA-Compatible IE=EmulateIE7 meta tag.
-// 1.0 - (1/9/2010) Initial Release. Broke out the jQuery BBQ event.special
-// window.onhashchange functionality into a separate plugin for users
-// who want just the basic event & back button support, without all the
-// extra awesomeness that BBQ provides. This plugin will be included as
-// part of jQuery BBQ, but also be available separately.
-
-(function($,window,undefined){
- '$:nomunge'; // Used by YUI compressor.
-
- // Reused string.
- var str_hashchange = 'hashchange',
-
- // Method / object references.
- doc = document,
- fake_onhashchange,
- special = $.event.special,
-
- // Does the browser support window.onhashchange? Note that IE8 running in
- // IE7 compatibility mode reports true for 'onhashchange' in window, even
- // though the event isn't supported, so also test document.documentMode.
- doc_mode = doc.documentMode,
- supports_onhashchange = 'on' + str_hashchange in window && ( doc_mode === undefined || doc_mode > 7 );
-
- // Get location.hash (or what you'd expect location.hash to be) sans any
- // leading #. Thanks for making this necessary, Firefox!
- function get_fragment( url ) {
- url = url || location.href;
- return '#' + url.replace( /^[^#]*#?(.*)$/, '$1' );
- };
-
- // Method: jQuery.fn.hashchange
- //
- // Bind a handler to the window.onhashchange event or trigger all bound
- // window.onhashchange event handlers. This behavior is consistent with
- // jQuery's built-in event handlers.
- //
- // Usage:
- //
- // > jQuery(window).hashchange( [ handler ] );
- //
- // Arguments:
- //
- // handler - (Function) Optional handler to be bound to the hashchange
- // event. This is a "shortcut" for the more verbose form:
- // jQuery(window).bind( 'hashchange', handler ). If handler is omitted,
- // all bound window.onhashchange event handlers will be triggered. This
- // is a shortcut for the more verbose
- // jQuery(window).trigger( 'hashchange' ). These forms are described in
- // the section.
- //
- // Returns:
- //
- // (jQuery) The initial jQuery collection of elements.
-
- // Allow the "shortcut" format $(elem).hashchange( fn ) for binding and
- // $(elem).hashchange() for triggering, like jQuery does for built-in events.
- $.fn[ str_hashchange ] = function( fn ) {
- return fn ? this.bind( str_hashchange, fn ) : this.trigger( str_hashchange );
- };
-
- // Property: jQuery.fn.hashchange.delay
- //
- // The numeric interval (in milliseconds) at which the
- // polling loop executes. Defaults to 50.
-
- // Property: jQuery.fn.hashchange.domain
- //
- // If you're setting document.domain in your JavaScript, and you want hash
- // history to work in IE6/7, not only must this property be set, but you must
- // also set document.domain BEFORE jQuery is loaded into the page. This
- // property is only applicable if you are supporting IE6/7 (or IE8 operating
- // in "IE7 compatibility" mode).
- //
- // In addition, the property must be set to the
- // path of the included "document-domain.html" file, which can be renamed or
- // modified if necessary (note that the document.domain specified must be the
- // same in both your main JavaScript as well as in this file).
- //
- // Usage:
- //
- // jQuery.fn.hashchange.domain = document.domain;
-
- // Property: jQuery.fn.hashchange.src
- //
- // If, for some reason, you need to specify an Iframe src file (for example,
- // when setting document.domain as in ), you can
- // do so using this property. Note that when using this property, history
- // won't be recorded in IE6/7 until the Iframe src file loads. This property
- // is only applicable if you are supporting IE6/7 (or IE8 operating in "IE7
- // compatibility" mode).
- //
- // Usage:
- //
- // jQuery.fn.hashchange.src = 'path/to/file.html';
-
- $.fn[ str_hashchange ].delay = 50;
- /*
- $.fn[ str_hashchange ].domain = null;
- $.fn[ str_hashchange ].src = null;
- */
-
- // Event: hashchange event
- //
- // Fired when location.hash changes. In browsers that support it, the native
- // HTML5 window.onhashchange event is used, otherwise a polling loop is
- // initialized, running every milliseconds to
- // see if the hash has changed. In IE6/7 (and IE8 operating in "IE7
- // compatibility" mode), a hidden Iframe is created to allow the back button
- // and hash-based history to work.
- //
- // Usage as described in :
- //
- // > // Bind an event handler.
- // > jQuery(window).hashchange( function(e) {
- // > var hash = location.hash;
- // > ...
- // > });
- // >
- // > // Manually trigger the event handler.
- // > jQuery(window).hashchange();
- //
- // A more verbose usage that allows for event namespacing:
- //
- // > // Bind an event handler.
- // > jQuery(window).bind( 'hashchange', function(e) {
- // > var hash = location.hash;
- // > ...
- // > });
- // >
- // > // Manually trigger the event handler.
- // > jQuery(window).trigger( 'hashchange' );
- //
- // Additional Notes:
- //
- // * The polling loop and Iframe are not created until at least one handler
- // is actually bound to the 'hashchange' event.
- // * If you need the bound handler(s) to execute immediately, in cases where
- // a location.hash exists on page load, via bookmark or page refresh for
- // example, use jQuery(window).hashchange() or the more verbose
- // jQuery(window).trigger( 'hashchange' ).
- // * The event can be bound before DOM ready, but since it won't be usable
- // before then in IE6/7 (due to the necessary Iframe), recommended usage is
- // to bind it inside a DOM ready handler.
-
- // Override existing $.event.special.hashchange methods (allowing this plugin
- // to be defined after jQuery BBQ in BBQ's source code).
- special[ str_hashchange ] = $.extend( special[ str_hashchange ], {
-
- // Called only when the first 'hashchange' event is bound to window.
- setup: function() {
- // If window.onhashchange is supported natively, there's nothing to do..
- if ( supports_onhashchange ) { return false; }
-
- // Otherwise, we need to create our own. And we don't want to call this
- // until the user binds to the event, just in case they never do, since it
- // will create a polling loop and possibly even a hidden Iframe.
- $( fake_onhashchange.start );
- },
-
- // Called only when the last 'hashchange' event is unbound from window.
- teardown: function() {
- // If window.onhashchange is supported natively, there's nothing to do..
- if ( supports_onhashchange ) { return false; }
-
- // Otherwise, we need to stop ours (if possible).
- $( fake_onhashchange.stop );
- }
-
- });
-
- // fake_onhashchange does all the work of triggering the window.onhashchange
- // event for browsers that don't natively support it, including creating a
- // polling loop to watch for hash changes and in IE 6/7 creating a hidden
- // Iframe to enable back and forward.
- fake_onhashchange = (function(){
- var self = {},
- timeout_id,
-
- // Remember the initial hash so it doesn't get triggered immediately.
- last_hash = get_fragment(),
-
- fn_retval = function(val){ return val; },
- history_set = fn_retval,
- history_get = fn_retval;
-
- // Start the polling loop.
- self.start = function() {
- timeout_id || poll();
- };
-
- // Stop the polling loop.
- self.stop = function() {
- timeout_id && clearTimeout( timeout_id );
- timeout_id = undefined;
- };
-
- // This polling loop checks every $.fn.hashchange.delay milliseconds to see
- // if location.hash has changed, and triggers the 'hashchange' event on
- // window when necessary.
- function poll() {
- var hash = get_fragment(),
- history_hash = history_get( last_hash );
-
- if ( hash !== last_hash ) {
- history_set( last_hash = hash, history_hash );
-
- $(window).trigger( str_hashchange );
-
- } else if ( history_hash !== last_hash ) {
- location.href = location.href.replace( /#.*/, '' ) + history_hash;
- }
-
- timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay );
- };
-
- return self;
- })();
-
-})(jQuery,this);
\ No newline at end of file
diff --git a/assets/js/jquery.js b/assets/js/jquery.js
index 32d50cb0e..76d21a465 100644
--- a/assets/js/jquery.js
+++ b/assets/js/jquery.js
@@ -1,5 +1,6 @@
-/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license
-//@ sourceMappingURL=jquery.min.map
-*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="
a",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="
a",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="
Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.
This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.
diff --git a/examples/jumbotron/jumbotron.css b/examples/jumbotron/jumbotron.css
index 594e2c794..f14b34c36 100644
--- a/examples/jumbotron/jumbotron.css
+++ b/examples/jumbotron/jumbotron.css
@@ -13,10 +13,6 @@ body {
/* Responsive: Portrait tablets and up */
@media screen and (min-width: 768px) {
- /* Let the jumbotron breathe */
- .jumbotron {
- margin-top: 20px;
- }
/* Remove padding from wrapping element since we kick in the grid classes here */
.body-content {
padding: 0;
diff --git a/examples/justified-nav/index.html b/examples/justified-nav/index.html
index 431b2780d..46ebb6d69 100644
--- a/examples/justified-nav/index.html
+++ b/examples/justified-nav/index.html
@@ -36,7 +36,7 @@
Marketing stuff!
Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet.
This example is a quick exercise to illustrate how the default, static and fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.
To see the difference between static and fixed top navbars, just scroll.
This example is a quick exercise to illustrate how the default, static and fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.
To see the difference between static and fixed top navbars, just scroll.
This example is a quick exercise to illustrate how the default, static navbar and fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.
Disable the responsiveness of Bootstrap by fixing the width of the container and using the first grid system tier.
+
+
+
What changes
+
Note the lack of the <meta name="viewport" content="width=device-width, initial-scale=1.0">, which disables the zooming aspect of sites in mobile devices. In addition, we reset our container's width and are basically good to go.
+
+
Non-responsive grid system
+
+
One third
+
One third
+
One third
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/non-responsive/non-responsive.css b/examples/non-responsive/non-responsive.css
new file mode 100644
index 000000000..2864ca1c5
--- /dev/null
+++ b/examples/non-responsive/non-responsive.css
@@ -0,0 +1,13 @@
+.container {
+ max-width: none !important;
+ width: 970px;
+}
+
+.col-xs-4 {
+ padding-top: 15px;
+ padding-bottom: 15px;
+ background-color: #eee;
+ border: 1px solid #ddd;
+ background-color: rgba(86,61,124,.15);
+ border: 1px solid rgba(86,61,124,.2);
+}
diff --git a/examples/screenshots/carousel.jpg b/examples/screenshots/carousel.jpg
index 8c545c100..a63a1ba9d 100644
Binary files a/examples/screenshots/carousel.jpg and b/examples/screenshots/carousel.jpg differ
diff --git a/examples/screenshots/grid.jpg b/examples/screenshots/grid.jpg
index 5aafbf478..2407cf293 100644
Binary files a/examples/screenshots/grid.jpg and b/examples/screenshots/grid.jpg differ
diff --git a/examples/screenshots/jumbotron-narrow.jpg b/examples/screenshots/jumbotron-narrow.jpg
index e9338b777..915d10f4c 100644
Binary files a/examples/screenshots/jumbotron-narrow.jpg and b/examples/screenshots/jumbotron-narrow.jpg differ
diff --git a/examples/screenshots/jumbotron.jpg b/examples/screenshots/jumbotron.jpg
index bb996135b..46bce0c53 100644
Binary files a/examples/screenshots/jumbotron.jpg and b/examples/screenshots/jumbotron.jpg differ
diff --git a/examples/screenshots/justified-nav.jpg b/examples/screenshots/justified-nav.jpg
index 01689c3ca..5f57923e6 100644
Binary files a/examples/screenshots/justified-nav.jpg and b/examples/screenshots/justified-nav.jpg differ
diff --git a/examples/screenshots/navbar-fixed.jpg b/examples/screenshots/navbar-fixed.jpg
index cac325f41..16a03b0bc 100644
Binary files a/examples/screenshots/navbar-fixed.jpg and b/examples/screenshots/navbar-fixed.jpg differ
diff --git a/examples/screenshots/navbar-static.jpg b/examples/screenshots/navbar-static.jpg
index 460624b63..8fe3529fb 100644
Binary files a/examples/screenshots/navbar-static.jpg and b/examples/screenshots/navbar-static.jpg differ
diff --git a/examples/screenshots/navbar.jpg b/examples/screenshots/navbar.jpg
index 3bd2fe688..3120c507a 100644
Binary files a/examples/screenshots/navbar.jpg and b/examples/screenshots/navbar.jpg differ
diff --git a/examples/screenshots/non-responsive.jpg b/examples/screenshots/non-responsive.jpg
new file mode 100644
index 000000000..7642d8a34
Binary files /dev/null and b/examples/screenshots/non-responsive.jpg differ
diff --git a/examples/screenshots/offcanvas.jpg b/examples/screenshots/offcanvas.jpg
index e19850740..76b7d6702 100644
Binary files a/examples/screenshots/offcanvas.jpg and b/examples/screenshots/offcanvas.jpg differ
diff --git a/examples/screenshots/sign-in.jpg b/examples/screenshots/sign-in.jpg
index 6d5504e68..4191c33b8 100644
Binary files a/examples/screenshots/sign-in.jpg and b/examples/screenshots/sign-in.jpg differ
diff --git a/examples/screenshots/starter-template.jpg b/examples/screenshots/starter-template.jpg
index 5285a655d..2545aa32f 100644
Binary files a/examples/screenshots/starter-template.jpg and b/examples/screenshots/starter-template.jpg differ
diff --git a/examples/screenshots/sticky-footer-navbar.jpg b/examples/screenshots/sticky-footer-navbar.jpg
index f9d88cdfe..6226bf4ac 100644
Binary files a/examples/screenshots/sticky-footer-navbar.jpg and b/examples/screenshots/sticky-footer-navbar.jpg differ
diff --git a/examples/screenshots/sticky-footer.jpg b/examples/screenshots/sticky-footer.jpg
index 6bab18d99..644f6dd26 100644
Binary files a/examples/screenshots/sticky-footer.jpg and b/examples/screenshots/sticky-footer.jpg differ
diff --git a/examples/screenshots/theme.jpg b/examples/screenshots/theme.jpg
new file mode 100644
index 000000000..ef47acb9c
Binary files /dev/null and b/examples/screenshots/theme.jpg differ
diff --git a/examples/signin/index.html b/examples/signin/index.html
index fefb73386..7c491ae9c 100644
--- a/examples/signin/index.html
+++ b/examples/signin/index.html
@@ -27,7 +27,7 @@
- Sign in
+ Sign in
This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas sed diam eget risus varius blandit sit amet non magna. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Cras mattis consectetur purus sit amet fermentum. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Aenean lacinia bibendum nulla sed consectetur.
Load the optional Bootstrap theme for a visually enhanced experience.
+
@@ -242,13 +257,13 @@ bootstrap/
Disabling responsiveness
-
Don't want your site or application to be scale on different device? With a little bit of work, you can disable the responsive features of Bootstrap so that mobile users see your full desktop-version site.
+
Don't want your site or application to be scaled on different devices? With a little bit of work, you can disable the responsive features of Bootstrap so that mobile users see your full desktop-version site. Read below or check out the non-responsive example.
Steps to disable responsive views
To disable responsive features, follow these steps. See it in action in the modified template below.
Remove (or just don't add) the viewport <meta> mentioned in the CSS docs
-
Force a single max-width on the .container (e.g., .container { max-width: 940px; }). Be sure that this comes after the default Bootstrap CSS; otherwise, you'll need !important.
+
Remove the max-width on the .container for all grid tiers with max-width: none !important; and set a regular width like width: 970px;. Be sure that this comes after the default Bootstrap CSS. You can optionally avoid the !important with media queries or some selector-fu.
For grid layouts, make use of .col-xs-* classes in addition to or in place of the medium/large ones. Don't worry, the extra-small device grid scales up to all resolutions, so you're set there.
You'll still need respond.js for IE8 (since our media queries are still there and need to be picked up). This just disables the "mobile site" of Bootstrap.
We'll keep an eye on this though and update our code if we have an easy solution.
Modals and mobile devices
+
Overflow and scrolling
Support for overflow: hidden on the <body> element is quite limited in iOS and Android. To that end, when you scroll past the top or bottom of a modal in either of those devices' browsers, the <body> content will begin to scroll.
-
Also, note that if you're using inputs in your modal – iOS has a rendering bug which doesn't update the position of fixed elements when the virtual keyboard is triggered. There are a few work arounds for this including transforming your elements to position absolute or invoking a timer on focus to try to correct the positioning manually. This is not handled by Bootstrap, so it is up to you to decide which solution is best for your application.
+
Virtual keyboards
+
Also, note that if you're using inputs in your modal – iOS has a rendering bug which doesn't update the position of fixed elements when the virtual keyboard is triggered. There are a few work arounds for this, including transforming your elements to position: absolute or invoking a timer on focus to try to correct the positioning manually. This is not handled by Bootstrap, so it is up to you to decide which solution is best for your application.
Browser zooming
Page zooming inevitably presents rendering artifacts in some components, both in Bootstrap and the rest of the web. Depending on the issue, we may be able to fix it (search first and then open an issue if need be). However, we tend to ignore these as they often have no direct solution other than hacky workarounds.
@@ -541,7 +561,7 @@ img { max-width: none; }
Alternate customization methods
-
While not recommended for folks new to Bootstrap, you may use one of two alternate methods for customization. The first is modifying the source .less files (making upgrades super difficult), and the second is mapping source LESS code to your own classes via mixins. For the time being, neither options are documented here.
+
While not recommended for folks new to Bootstrap, you may use one of two alternate methods for customization. The first is modifying the source .less files (making upgrades super difficult), and the second is mapping source LESS code to your own classes via mixins. For the time being, neither of those options are documented here.
Removing potential bloat
diff --git a/javascript.html b/javascript.html
index 837d07d3a..c9228c211 100644
--- a/javascript.html
+++ b/javascript.html
@@ -541,12 +541,12 @@ $('#myDropdown').on('show.bs.dropdown', function () {
@@ -1104,7 +1104,7 @@ $('#myTooltip').on('hidden.bs.tooltip', function () {
string | false
false
-
Appends the popover to a specific element. Example: container: 'body'
+
Appends the popover to a specific element. Example: container: 'body'. This option is particularly useful in that it allows you to position the popover in the flow of the document near the triggering element -Â which will prevent the popover from floating away from the triggering element during a window resize.
@@ -1903,7 +1903,7 @@ $('#myCarousel').on('slide.bs.carousel', function () {
offset
number | function | object
10
-
Pixels to offset from screen when calculating position of scroll. If a single number is provided, the offset will be applied in both top and left directions. To provide a unique, bottom and top offset just provide an object offset: { top: 10 } or offset: { top: 10, bottom: 5 }. Use a function when you need to dynamically calculate an offset.
+
Pixels to offset from screen when calculating position of scroll. If a single number is provided, the offset will be applied in both top and bottom directions. To provide a unique, bottom and top offset just provide an object offset: { top: 10 } or offset: { top: 10, bottom: 5 }. Use a function when you need to dynamically calculate an offset.
diff --git a/js/dropdown.js b/js/dropdown.js
index 69bbd802c..6093f11a8 100644
--- a/js/dropdown.js
+++ b/js/dropdown.js
@@ -40,7 +40,7 @@
clearMenus()
if (!isActive) {
- if ('ontouchstart' in document.documentElement) {
+ if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
// if mobile we we use a backdrop because click events don't delegate
$('').insertAfter($(this)).on('click', clearMenus)
}
@@ -52,9 +52,9 @@
$parent
.toggleClass('open')
.trigger('shown.bs.dropdown')
- }
- $this.focus()
+ $this.focus()
+ }
return false
}
diff --git a/js/modal.js b/js/modal.js
index 1a692e6af..65eba481e 100644
--- a/js/modal.js
+++ b/js/modal.js
@@ -25,7 +25,7 @@
var Modal = function (element, options) {
this.options = options
- this.$element = $(element).on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
+ this.$element = $(element)
this.$backdrop =
this.isShown = null
@@ -54,6 +54,8 @@
this.escape()
+ this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
+
this.backdrop(function () {
var transition = $.support.transition && that.$element.hasClass('fade')
@@ -76,7 +78,7 @@
var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
transition ?
- that.$element
+ that.$element.find('.modal-dialog') // wait for modal to slide in
.one($.support.transition.end, function () {
that.$element.focus().trigger(e)
})
diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js
index 2c610d83d..5755d2751 100644
--- a/js/tests/unit/modal.js
+++ b/js/tests/unit/modal.js
@@ -174,4 +174,23 @@ $(function () {
})
.modal("show")
})
+
+ test("should close reopened modal with [data-dismiss=modal] click", function () {
+ stop()
+ $.support.transition = false
+ var div = $("
a",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="