From 229e88892913d5c8b712510c28b78bfa114596e5 Mon Sep 17 00:00:00 2001 From: Mark Tareshawty Date: Wed, 15 Apr 2015 20:19:27 -0400 Subject: Update ZeroClipboard and remove Copy buttons when Flash is unavailable Fixes #16269. Closes #16301 by merging a rebased version of it. --- docs/assets/js/src/application.js | 43 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'docs/assets/js/src/application.js') diff --git a/docs/assets/js/src/application.js b/docs/assets/js/src/application.js index 161f3d002..7d9b226bc 100644 --- a/docs/assets/js/src/application.js +++ b/docs/assets/js/src/application.js @@ -127,7 +127,7 @@ // Config ZeroClipboard ZeroClipboard.config({ - moviePath: '/assets/flash/ZeroClipboard.swf', + swfPath: '/assets/flash/ZeroClipboard.swf', hoverClass: 'btn-clipboard-hover' }) @@ -136,39 +136,38 @@ var btnHtml = '
Copy
' $(this).before(btnHtml) }) + var zeroClipboard = new ZeroClipboard($('.btn-clipboard')) var htmlBridge = $('#global-zeroclipboard-html-bridge') // Handlers for ZeroClipboard - zeroClipboard.on('load', function () { + zeroClipboard.on('ready', function () { htmlBridge .data('placement', 'top') .attr('title', 'Copy to clipboard') .tooltip() - }) - // Copy to clipboard - zeroClipboard.on('dataRequested', function (client) { - var highlight = $(this).parent().nextAll('.highlight').first() - client.setText(highlight.text()) - }) + // Copy to clipboard + zeroClipboard.on('copy', function (event) { + var highlight = $(event.target).parent().nextAll('.highlight').first() + event.clipboardData.setData('text/plain', highlight.text()) + }) - // Notify copy success and reset tooltip title - zeroClipboard.on('complete', function () { - htmlBridge - .attr('title', 'Copied!') - .tooltip('fixTitle') - .tooltip('show') - .attr('title', 'Copy to clipboard') - .tooltip('fixTitle') + // Notify copy success and reset tooltip title + zeroClipboard.on('aftercopy', function () { + htmlBridge + .attr('title', 'Copied!') + .tooltip('fixTitle') + .tooltip('show') + .attr('title', 'Copy to clipboard') + .tooltip('fixTitle') + }) }) - // Notify copy failure - zeroClipboard.on('noflash wrongflash', function () { - htmlBridge - .attr('title', 'Flash required') - .tooltip('fixTitle') - .tooltip('show') + // Hide copy button on error + zeroClipboard.on('error', function () { + $('.zero-clipboard').remove() + ZeroClipboard.destroy() }) }) -- cgit v1.2.3 From dab6a4f0e3af750f5b1c7b88db1e7d14a15eb8b0 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Mon, 27 Apr 2015 14:16:27 -0700 Subject: scope anchorjs to immediate children, fixes #16129 --- docs/assets/js/src/application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/assets/js/src/application.js') diff --git a/docs/assets/js/src/application.js b/docs/assets/js/src/application.js index 7d9b226bc..3a3632415 100644 --- a/docs/assets/js/src/application.js +++ b/docs/assets/js/src/application.js @@ -176,5 +176,5 @@ ;(function () { 'use strict'; - addAnchors('.bs-docs-container h1, .bs-docs-container h2, .bs-docs-container h3, .bs-docs-container h4, .bs-docs-container h5'); + addAnchors('.bs-docs-container > h1, .bs-docs-container > h2, .bs-docs-container > h3, .bs-docs-container > h4, .bs-docs-container > h5'); })(); -- cgit v1.2.3 From 86400070b5a10d4c013f1f8b72d7d170888031fb Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 28 Apr 2015 11:11:49 +0300 Subject: Bump copyright year. [ci skip] --- docs/assets/js/src/application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/assets/js/src/application.js') diff --git a/docs/assets/js/src/application.js b/docs/assets/js/src/application.js index 3a3632415..8aff80afd 100644 --- a/docs/assets/js/src/application.js +++ b/docs/assets/js/src/application.js @@ -4,7 +4,7 @@ /*! * JavaScript for Bootstrap's docs (http://getbootstrap.com) - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under the Creative Commons Attribution 3.0 Unported License. For * details, see http://creativecommons.org/licenses/by/3.0/. */ -- cgit v1.2.3 From 16a44c208d5ea2709d832535f695554e4cdd8bf4 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 29 Apr 2015 08:53:11 +0300 Subject: Fix dab6a4f0e3af750f5b1c7b88db1e7d14a15eb8b0. --- docs/assets/js/src/application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/assets/js/src/application.js') diff --git a/docs/assets/js/src/application.js b/docs/assets/js/src/application.js index 8aff80afd..801d6390d 100644 --- a/docs/assets/js/src/application.js +++ b/docs/assets/js/src/application.js @@ -176,5 +176,5 @@ ;(function () { 'use strict'; - addAnchors('.bs-docs-container > h1, .bs-docs-container > h2, .bs-docs-container > h3, .bs-docs-container > h4, .bs-docs-container > h5'); + addAnchors('.bs-docs-section > h1, .bs-docs-section > h2, .bs-docs-section > h3, .bs-docs-section > h4, .bs-docs-section > h5'); })(); -- cgit v1.2.3 From 438cae9d90449403c470686852b95934067f2c4d Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 28 Apr 2015 14:27:09 +0300 Subject: Revert "Update ZeroClipboard and remove Copy buttons when Flash is unavailable" This reverts commit 229e88892913d5c8b712510c28b78bfa114596e5. ZeroClipboard v2.x drops IE < 9 support. --- docs/assets/js/src/application.js | 43 ++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'docs/assets/js/src/application.js') diff --git a/docs/assets/js/src/application.js b/docs/assets/js/src/application.js index 801d6390d..465e1386b 100644 --- a/docs/assets/js/src/application.js +++ b/docs/assets/js/src/application.js @@ -127,7 +127,7 @@ // Config ZeroClipboard ZeroClipboard.config({ - swfPath: '/assets/flash/ZeroClipboard.swf', + moviePath: '/assets/flash/ZeroClipboard.swf', hoverClass: 'btn-clipboard-hover' }) @@ -136,38 +136,39 @@ var btnHtml = '
Copy
' $(this).before(btnHtml) }) - var zeroClipboard = new ZeroClipboard($('.btn-clipboard')) var htmlBridge = $('#global-zeroclipboard-html-bridge') // Handlers for ZeroClipboard - zeroClipboard.on('ready', function () { + zeroClipboard.on('load', function () { htmlBridge .data('placement', 'top') .attr('title', 'Copy to clipboard') .tooltip() + }) - // Copy to clipboard - zeroClipboard.on('copy', function (event) { - var highlight = $(event.target).parent().nextAll('.highlight').first() - event.clipboardData.setData('text/plain', highlight.text()) - }) + // Copy to clipboard + zeroClipboard.on('dataRequested', function (client) { + var highlight = $(this).parent().nextAll('.highlight').first() + client.setText(highlight.text()) + }) - // Notify copy success and reset tooltip title - zeroClipboard.on('aftercopy', function () { - htmlBridge - .attr('title', 'Copied!') - .tooltip('fixTitle') - .tooltip('show') - .attr('title', 'Copy to clipboard') - .tooltip('fixTitle') - }) + // Notify copy success and reset tooltip title + zeroClipboard.on('complete', function () { + htmlBridge + .attr('title', 'Copied!') + .tooltip('fixTitle') + .tooltip('show') + .attr('title', 'Copy to clipboard') + .tooltip('fixTitle') }) - // Hide copy button on error - zeroClipboard.on('error', function () { - $('.zero-clipboard').remove() - ZeroClipboard.destroy() + // Notify copy failure + zeroClipboard.on('noflash wrongflash', function () { + htmlBridge + .attr('title', 'Flash required') + .tooltip('fixTitle') + .tooltip('show') }) }) -- cgit v1.2.3 From 07e76a571de1df4d92376d72a07000cd6d440789 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 28 Apr 2015 14:57:27 +0300 Subject: Redo changes needed to hide Copy button. --- docs/assets/js/src/application.js | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'docs/assets/js/src/application.js') diff --git a/docs/assets/js/src/application.js b/docs/assets/js/src/application.js index 465e1386b..56528367c 100644 --- a/docs/assets/js/src/application.js +++ b/docs/assets/js/src/application.js @@ -145,30 +145,30 @@ .data('placement', 'top') .attr('title', 'Copy to clipboard') .tooltip() - }) - // Copy to clipboard - zeroClipboard.on('dataRequested', function (client) { - var highlight = $(this).parent().nextAll('.highlight').first() - client.setText(highlight.text()) - }) - // Notify copy success and reset tooltip title - zeroClipboard.on('complete', function () { - htmlBridge - .attr('title', 'Copied!') - .tooltip('fixTitle') - .tooltip('show') - .attr('title', 'Copy to clipboard') - .tooltip('fixTitle') + // Copy to clipboard + zeroClipboard.on('dataRequested', function (client) { + var highlight = $(this).parent().nextAll('.highlight').first() + client.setText(highlight.text()) + }) + + // Notify copy success and reset tooltip title + zeroClipboard.on('complete', function () { + htmlBridge + .attr('title', 'Copied!') + .tooltip('fixTitle') + .tooltip('show') + .attr('title', 'Copy to clipboard') + .tooltip('fixTitle') + }) }) - // Notify copy failure + // Hide copy button when no Flash is found + // or wrong Flash version is present zeroClipboard.on('noflash wrongflash', function () { - htmlBridge - .attr('title', 'Flash required') - .tooltip('fixTitle') - .tooltip('show') + $('.zero-clipboard').remove() + ZeroClipboard.destroy() }) }) -- cgit v1.2.3 From 49c45563546af97eaab0c6f083d68fbc3b4a0ce6 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 29 Apr 2015 12:11:58 +0300 Subject: Comply to the new JSCS rules. --- docs/assets/js/src/application.js | 41 ++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'docs/assets/js/src/application.js') diff --git a/docs/assets/js/src/application.js b/docs/assets/js/src/application.js index 56528367c..35f39f6f0 100644 --- a/docs/assets/js/src/application.js +++ b/docs/assets/js/src/application.js @@ -58,12 +58,12 @@ // theme toggler ;(function () { - var stylesheetLink = $('#bs-theme-stylesheet') - var themeBtn = $('.bs-docs-theme-toggle') + var $stylesheetLink = $('#bs-theme-stylesheet') + var $themeBtn = $('.bs-docs-theme-toggle') var activateTheme = function () { - stylesheetLink.attr('href', stylesheetLink.attr('data-href')) - themeBtn.text('Disable theme preview') + $stylesheetLink.attr('href', $stylesheetLink.attr('data-href')) + $themeBtn.text('Disable theme preview') localStorage.setItem('previewTheme', true) } @@ -71,13 +71,13 @@ activateTheme() } - themeBtn.click(function () { - var href = stylesheetLink.attr('href') + $themeBtn.click(function () { + var href = $stylesheetLink.attr('href') if (!href || href.indexOf('data') === 0) { activateTheme() } else { - stylesheetLink.attr('href', '') - themeBtn.text('Preview theme') + $stylesheetLink.attr('href', '') + $themeBtn.text('Preview theme') localStorage.removeItem('previewTheme') } }) @@ -102,22 +102,22 @@ // Button state demo $('#loading-example-btn').on('click', function () { - var btn = $(this) - btn.button('loading') + var $btn = $(this) + $btn.button('loading') setTimeout(function () { - btn.button('reset') + $btn.button('reset') }, 3000) }) // Modal relatedTarget demo $('#exampleModal').on('show.bs.modal', function (event) { - var button = $(event.relatedTarget) // Button that triggered the modal - var recipient = button.data('whatever') // Extract info from data-* attributes + var $button = $(event.relatedTarget) // Button that triggered the modal + var recipient = $button.data('whatever') // Extract info from data-* attributes // If necessary, you could initiate an AJAX request here (and then do the updating in a callback). // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead. - var modal = $(this) - modal.find('.modal-title').text('New message to ' + recipient) - modal.find('.modal-body input').val(recipient) + var $modal = $(this) + $modal.find('.modal-title').text('New message to ' + recipient) + $modal.find('.modal-body input').val(recipient) }) // Activate animated progress bar @@ -137,11 +137,11 @@ $(this).before(btnHtml) }) var zeroClipboard = new ZeroClipboard($('.btn-clipboard')) - var htmlBridge = $('#global-zeroclipboard-html-bridge') + var $htmlBridge = $('#global-zeroclipboard-html-bridge') // Handlers for ZeroClipboard zeroClipboard.on('load', function () { - htmlBridge + $htmlBridge .data('placement', 'top') .attr('title', 'Copy to clipboard') .tooltip() @@ -155,7 +155,7 @@ // Notify copy success and reset tooltip title zeroClipboard.on('complete', function () { - htmlBridge + $htmlBridge .attr('title', 'Copied!') .tooltip('fixTitle') .tooltip('show') @@ -177,5 +177,6 @@ ;(function () { 'use strict'; - addAnchors('.bs-docs-section > h1, .bs-docs-section > h2, .bs-docs-section > h3, .bs-docs-section > h4, .bs-docs-section > h5'); + + addAnchors('.bs-docs-section > h1, .bs-docs-section > h2, .bs-docs-section > h3, .bs-docs-section > h4, .bs-docs-section > h5') })(); -- cgit v1.2.3 From dec2faec3d1ebdf0f72d5814e570ebc453346cde Mon Sep 17 00:00:00 2001 From: Bryan Braun Date: Fri, 15 May 2015 00:37:07 -0400 Subject: Update Anchor.js and port over the existing styles. Anchor.js 1.0.0 drops the need to use anchor.css, so we remove it from the codebase and move any leftover styles over to docs.css. Closes #16488 by merging it. --- docs/assets/js/src/application.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'docs/assets/js/src/application.js') diff --git a/docs/assets/js/src/application.js b/docs/assets/js/src/application.js index 35f39f6f0..51f42cd05 100644 --- a/docs/assets/js/src/application.js +++ b/docs/assets/js/src/application.js @@ -9,7 +9,7 @@ * details, see http://creativecommons.org/licenses/by/3.0/. */ -/* global ZeroClipboard, addAnchors */ +/* global ZeroClipboard, anchors */ !function ($) { 'use strict'; @@ -178,5 +178,6 @@ ;(function () { 'use strict'; - addAnchors('.bs-docs-section > h1, .bs-docs-section > h2, .bs-docs-section > h3, .bs-docs-section > h4, .bs-docs-section > h5') + anchors.options.placement = 'left'; + anchors.add('.bs-docs-section > h1, .bs-docs-section > h2, .bs-docs-section > h3, .bs-docs-section > h4, .bs-docs-section > h5') })(); -- cgit v1.2.3 From 315907c97cf9e039c83cf71e3c0a049ea0e24798 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sun, 17 May 2015 12:43:04 +0300 Subject: Use `https` when possible. --- docs/assets/js/src/application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/assets/js/src/application.js') diff --git a/docs/assets/js/src/application.js b/docs/assets/js/src/application.js index 51f42cd05..0aa5ebc33 100644 --- a/docs/assets/js/src/application.js +++ b/docs/assets/js/src/application.js @@ -6,7 +6,7 @@ * JavaScript for Bootstrap's docs (http://getbootstrap.com) * Copyright 2011-2015 Twitter, Inc. * Licensed under the Creative Commons Attribution 3.0 Unported License. For - * details, see http://creativecommons.org/licenses/by/3.0/. + * details, see https://creativecommons.org/licenses/by/3.0/. */ /* global ZeroClipboard, anchors */ -- cgit v1.2.3