Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Thornton <jacobthornton@gmail.com>2012-01-12 09:42:55 +0400
committerJacob Thornton <jacobthornton@gmail.com>2012-01-12 09:42:55 +0400
commit6f2f947a4309a8fdeb7067612447c0f1a15dcfd9 (patch)
treed634c55bd53f807a4c6d5265462bcf1b03cbfe24 /docs/assets/js/application.js
parent51e4e77034e14074cb442138e84b98efd288ccfd (diff)
add build tool for js + rename twipsy to tooltip + lots of little doc cleanup
Diffstat (limited to 'docs/assets/js/application.js')
-rw-r--r--docs/assets/js/application.js83
1 files changed, 79 insertions, 4 deletions
diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js
index c31fc97a06..0e14a53508 100644
--- a/docs/assets/js/application.js
+++ b/docs/assets/js/application.js
@@ -48,18 +48,18 @@ $(function(){
setTimeout(function () { $(el).select() }, 0)
})
- if ($.fn.twipsy) {
+ if ($.fn.tooltip) {
// position static twipsies for components page
if ($(".twipsies a").length) {
$(window).on('load resize', function () {
$(".twipsies a").each(function () {
$(this)
- .twipsy({
+ .tooltip({
placement: $(this).attr('title')
, trigger: 'manual'
})
- .twipsy('show')
+ .tooltip('show')
})
})
}
@@ -67,7 +67,7 @@ $(function(){
// add tipsies to grid for scaffolding
if ($('#grid-system').length) {
- $('#grid-system').twipsy({
+ $('#grid-system').tooltip({
selector: '.show-grid > div'
, title: function () { return $(this).width() + 'px' }
})
@@ -75,4 +75,79 @@ $(function(){
}
}
+ // javascript build logic
+
+ var inputs = $("#javascript input")
+
+ // toggle all plugin checkboxes
+ $('#selectAll').on('click', function (e) {
+ e.preventDefault()
+ inputs.attr('checked', !inputs.is(':checked'))
+ })
+
+ // handle build button dropdown
+ var buildTypes = $('#javascriptBuilder .dropdown-menu li').on('click', function () {
+ buildTypes.removeClass('active')
+ $(this).addClass('active')
+ })
+
+ // request built javascript
+ $('#javascriptBuild').on('click', function () {
+
+ var names = $("#javascript input:checked")
+ .map(function () { return this.value })
+ .toArray()
+
+ if (names[names.length - 1] == 'bootstrap-transition.js') {
+ names.unshift(names.pop())
+ }
+
+ $.ajax({
+ type: 'POST'
+ , dataType: 'jsonpi'
+ , params: {
+ branch: '2.0-wip'
+ , dir: 'js'
+ , filenames: names
+ , compress: buildTypes.first().hasClass('active')
+ }
+ , url: "http://bootstrap.herokuapp.com"
+ })
+ })
+
})
+
+
+// Modified from the original jsonpi https://github.com/benvinegar/jquery-jsonpi
+// by the talented Ben Vinegar
+!function($) {
+ $.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', v)
+ .appendTo(form);
+ });
+
+ form.appendTo('body').submit();
+ }
+ };
+ });
+}(jQuery); \ No newline at end of file