aboutsummaryrefslogtreecommitdiff
path: root/docs/assets/js
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2012-01-31 13:18:34 -0800
committerJacob Thornton <[email protected]>2012-01-31 13:18:34 -0800
commit0bfbe5058d61ae93d82b09f1dff7eb30dc22426e (patch)
tree6ccf3dd9c36ff4b1f6cde5edbce21cdf0de78497 /docs/assets/js
parent43cbc9440425b7c97c943690eefd14520de708e1 (diff)
parent4bd1ba4e0dc44d1d16161306576548f378ab1f8a (diff)
downloadbootstrap-0bfbe5058d61ae93d82b09f1dff7eb30dc22426e.tar.xz
bootstrap-0bfbe5058d61ae93d82b09f1dff7eb30dc22426e.zip
Merge branch '2.0-wip'
Conflicts: .gitignore LICENSE Makefile bootstrap.css bootstrap.min.css docs/assets/js/application.js docs/assets/js/google-code-prettify/prettify.css docs/index.html docs/javascript.html examples/container-app.html examples/fluid.html examples/hero.html js/bootstrap-alerts.js js/bootstrap-dropdown.js js/bootstrap-modal.js js/bootstrap-popover.js js/bootstrap-scrollspy.js js/bootstrap-tabs.js js/bootstrap-twipsy.js js/tests/index.html js/tests/unit/bootstrap-modal.js js/tests/unit/bootstrap-popover.js js/tests/unit/bootstrap-tabs.js lib/forms.less lib/mixins.less lib/patterns.less lib/scaffolding.less lib/tables.less
Diffstat (limited to 'docs/assets/js')
-rw-r--r--docs/assets/js/application.js209
-rw-r--r--docs/assets/js/google-code-prettify/prettify.css104
2 files changed, 189 insertions, 124 deletions
diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js
index 5beba46e1..b29b63aee 100644
--- a/docs/assets/js/application.js
+++ b/docs/assets/js/application.js
@@ -1,52 +1,181 @@
-$(document).ready(function(){
+// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT
+// IT'S ALL JUST JUNK FOR OUR DOCS!
+// ++++++++++++++++++++++++++++++++++++++++++
- // table sort example
- // ==================
+!function ($) {
- $("#sortTableExample").tablesorter( { sortList: [[ 1, 0 ]] } )
+ $(function(){
+ // Disable certain links in docs
+ $('section [href^=#]').click(function (e) {
+ e.preventDefault()
+ })
- // add on logic
- // ============
+ // make code pretty
+ window.prettyPrint && prettyPrint()
- $('.add-on :checkbox').click(function () {
- if ($(this).attr('checked')) {
- $(this).parents('.add-on').addClass('active')
- } else {
- $(this).parents('.add-on').removeClass('active')
+ // add-ons
+ $('.add-on :checkbox').on('click', function () {
+ var $this = $(this)
+ , method = $this.attr('checked') ? 'addClass' : 'removeClass'
+ $(this).parents('.add-on')[method]('active')
+ })
+
+ // position static twipsies for components page
+ if ($(".twipsies a").length) {
+ $(window).on('load resize', function () {
+ $(".twipsies a").each(function () {
+ $(this)
+ .tooltip({
+ placement: $(this).attr('title')
+ , trigger: 'manual'
+ })
+ .tooltip('show')
+ })
+ })
}
- })
+ // add tipsies to grid for scaffolding
+ if ($('#grid-system').length) {
+ $('#grid-system').tooltip({
+ selector: '.show-grid > div'
+ , title: function () { return $(this).width() + 'px' }
+ })
+ }
- // Disable certain links in docs
- // =============================
- // Please do not carry these styles over to your projects, it's merely here to prevent button clicks form taking you away from your spot on page
+ // fix sub nav on scroll
+ var $win = $(window)
+ , $nav = $('.subnav')
+ , navTop = $('.subnav').length && $('.subnav').offset().top - 40
+ , isFixed = 0
- $('ul.tabs a, ul.pills a, .pagination a, .well .btn, .actions .btn, .alert-message .btn, a.close').click(function (e) {
- e.preventDefault()
- })
+ processScroll()
+
+ $win.on('scroll', processScroll)
+
+ function processScroll() {
+ var i, scrollTop = $win.scrollTop()
+ if (scrollTop >= navTop && !isFixed) {
+ isFixed = 1
+ $nav.addClass('subnav-fixed')
+ } else if (scrollTop <= navTop && isFixed) {
+ isFixed = 0
+ $nav.removeClass('subnav-fixed')
+ }
+ }
- // Copy code blocks in docs
- $(".copy-code").focus(function () {
- var el = this;
- // push select to event loop for chrome :{o
- setTimeout(function () { $(el).select(); }, 0);
- });
-
-
- // POSITION STATIC TWIPSIES
- // ========================
-
- $(window).bind( 'load resize', function () {
- $(".twipsies a").each(function () {
- $(this)
- .twipsy({
- live: false
- , placement: $(this).attr('title')
- , trigger: 'manual'
- , offset: 2
- })
- .twipsy('show')
+ // tooltip demo
+ $('.tooltip-demo.well').tooltip({
+ selector: "a[rel=tooltip]"
+ })
+
+ $('.tooltip-test').tooltip()
+ $('.popover-test').popover()
+
+ // popover demo
+ $("a[rel=popover]")
+ .popover()
+ .click(function(e) {
+ e.preventDefault()
})
+
+ // button state demo
+ $('#fat-btn')
+ .click(function () {
+ var btn = $(this)
+ btn.button('loading')
+ setTimeout(function () {
+ btn.button('reset')
+ }, 3000)
+ })
+
+ // carousel demo
+ $('#myCarousel').carousel()
+
+ // javascript build logic
+ var inputsComponent = $("#components.download input")
+ , inputsPlugin = $("#plugins.download input")
+ , inputsVariables = $("#variables.download input")
+
+ // toggle all plugin checkboxes
+ $('#components.download .toggle-all').on('click', function (e) {
+ e.preventDefault()
+ inputsComponent.attr('checked', !inputsComponent.is(':checked'))
+ })
+
+ $('#plugins.download .toggle-all').on('click', function (e) {
+ e.preventDefault()
+ inputsPlugin.attr('checked', !inputsPlugin.is(':checked'))
+ })
+
+ $('#variables.download .toggle-all').on('click', function (e) {
+ e.preventDefault()
+ inputsVariables.val('')
+ })
+
+ // request built javascript
+ $('.download-btn').on('click', function () {
+
+ var css = $("#components.download input:checked")
+ .map(function () { return this.value })
+ .toArray()
+ , js = $("#plugins.download input:checked")
+ .map(function () { return this.value })
+ .toArray()
+ , vars = {}
+ , img = ['glyphicons-halflings.png', 'glyphicons-halflings-white.png']
+
+ $("#variables.download input")
+ .each(function () {
+ $(this).val() && (vars[ $(this).prev().text() ] = $(this).val())
+ })
+
+ $.ajax({
+ type: 'POST'
+ , url: 'http://bootstrap.herokuapp.com'
+ , dataType: 'jsonpi'
+ , params: {
+ branch: '2.0-wip'
+ , js: js
+ , css: css
+ , vars: vars
+ , img: img
+ }
+ })
+ })
+
})
-});
+
+// Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi
+$.ajaxTransport('jsonpi', function(opts, originalOptions, jqXHR) {
+ var url = opts.url;
+
+ return {
+ send: function(_, completeCallback) {
+ var name = 'jQuery_iframe_' + jQuery.now()
+ , iframe, form
+
+ iframe = $('<iframe>')
+ .attr('name', name)
+ .appendTo('head')
+
+ form = $('<form>')
+ .attr('method', opts.type) // GET or POST
+ .attr('action', url)
+ .attr('target', name)
+
+ $.each(opts.params, function(k, v) {
+
+ $('<input>')
+ .attr('type', 'hidden')
+ .attr('name', k)
+ .attr('value', typeof v == 'string' ? v : JSON.stringify(v))
+ .appendTo(form)
+ })
+
+ form.appendTo('body').submit()
+ }
+ }
+})
+
+}(window.jQuery) \ No newline at end of file
diff --git a/docs/assets/js/google-code-prettify/prettify.css b/docs/assets/js/google-code-prettify/prettify.css
index f9fd622a1..aedd8d1a9 100644
--- a/docs/assets/js/google-code-prettify/prettify.css
+++ b/docs/assets/js/google-code-prettify/prettify.css
@@ -2,93 +2,29 @@
.lit { color: #195f91; }
.pun, .opn, .clo { color: #93a1a1; }
.fun { color: #dc322f; }
-.str, .atv { color: #268bd2; }
-.kwd, .tag { color: #195f91; }
-.typ, .atn, .dec, .var { color: #CB4B16; }
-.pln { color: #93a1a1; }
+.str, .atv { color: #D14; }
+.kwd, .linenums .tag { color: #1e347b; }
+.typ, .atn, .dec, .var { color: teal; }
+.pln { color: #48484c; }
+
.prettyprint {
- background-color: #fefbf3;
- padding: 9px;
- border: 1px solid rgba(0,0,0,.2);
- -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.1);
- -moz-box-shadow: 0 1px 2px rgba(0,0,0,.1);
- box-shadow: 0 1px 2px rgba(0,0,0,.1);
+ padding: 8px;
+ background-color: #f7f7f9;
+ border: 1px solid #e1e1e8;
+}
+.prettyprint.linenums {
+ -webkit-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
+ -moz-box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
+ box-shadow: inset 40px 0 0 #fbfbfc, inset 41px 0 0 #ececf0;
}
/* Specify class=linenums on a pre to get line numbering */
ol.linenums {
- margin: 0 0 0 40px;
-}
-/* IE indents via margin-left */
+ margin: 0 0 0 33px; /* IE indents via margin-left */
+}
ol.linenums li {
- padding: 0 5px;
- color: rgba(0,0,0,.15);
- line-height: 20px;
- -webkit-border-radius: 2px;
- -moz-border-radius: 2px;
- border-radius: 2px;
-}
-/* Alternate shading for lines */
-li.L1, li.L3, li.L5, li.L7, li.L9 { }
-
-/*
-$base03: #002b36;
-$base02: #073642;
-$base01: #586e75;
-$base00: #657b83;
-$base0: #839496;
-$base1: #93a1a1;
-$base2: #eee8d5;
-$base3: #fdf6e3;
-$yellow: #b58900;
-$orange: #cb4b16;
-$red: #dc322f;
-$magenta: #d33682;
-$violet: #6c71c4;
-$blue: #268bd2;
-$cyan: #2aa198;
-$green: #859900;
-*/
-
-
-/*
-#1d1f21 Background
-#282a2e Current Line
-#373b41 Selection
-#c5c8c6 Foreground
-#969896 Comment
-#cc6666 Red
-#de935f Orange
-#f0c674 Yellow
-#b5bd68 Green
-#8abeb7 Aqua
-#81a2be Blue
-#b294bb Purple
-*/
-
-
-/* DARK THEME */
-/* ---------- */
-
-.prettyprint-dark {
- background-color: #1d1f21;
- border: 0;
- padding: 10px;
-}
-.prettyprint-dark .linenums li {
- color: #444;
-}
-.prettyprint-dark .linenums li:hover {
- background-color: #282a2e;
-}
-/* tags in html */
-.prettyprint-dark .kwd,
-.prettyprint-dark .tag { color: #cc6666; }
-/* html attr */
-.prettyprint-dark .typ,
-.prettyprint-dark .atn,
-.prettyprint-dark .dec,
-.prettyprint-dark .var { color: #de935f; }
-/* html attr values */
-.prettyprint-dark .str,
-.prettyprint-dark .atv { color: #b5bd68; }
+ padding-left: 12px;
+ color: #bebec5;
+ line-height: 18px;
+ text-shadow: 0 1px 0 #fff;
+} \ No newline at end of file