fix docs js include order

This commit is contained in:
Kevin Ross 2015-12-23 16:25:04 -06:00
parent 6f890b3ab6
commit 3c61ed426d
3 changed files with 44 additions and 46 deletions

View File

@ -18,11 +18,11 @@
<script src="{{ site.data.cdn.jquery }}"></script>
<script>window.jQuery || document.write('<script src="{{ site.baseurl }}/assets/js/vendor/jquery.min.js"><\/script>')</script>
<script src="{{ site.data.cdn.bootstrap }}"></script>
<!--<script>window.jQuery || document.write('<script src="{{ site.baseurl }}/assets/js/vendor/jquery.min.js"><\/script>')</script>-->
<script src="{{ site.baseurl }}/assets/js/vendor/tether.min.js"></script>
<script src="{{ site.data.cdn.bootstrap }}"></script>
{% if site.data.minified %}
<script src="{{ site.baseurl }}/dist/js/{{ site.data.name }}.min.js"></script>
<script src="{{ site.baseurl }}/assets/js/docs.min.js"></script>

View File

@ -51,10 +51,11 @@ module Variables
}
#
puts "\n---------------------"
puts "site.config: #{site.config.to_yaml}"
puts "baseurl: #{baseurl}"
puts "minified: #{site.data['minified']}"
# puts "\n---------------------"
# puts "site.config: #{site.config.to_yaml}"
# puts "baseurl: #{baseurl}"
# puts "minified: #{site.data['minified']}"
# puts "site: #{site.to_yaml}"
# puts site.data[:package]['version']
# puts site.data.to_yaml

View File

@ -4,7 +4,6 @@ import Clipboard from 'clipboard'
class Application {
constructor() {
}
initializeDemos() {
@ -24,9 +23,44 @@ class Application {
$('.bd-example-indeterminate [type="checkbox"]').prop('indeterminate', true)
// Disable empty links in docs examples
$('.bd-example [href=#]').click((e) => {
$('.bd-example [href=#]').click(function (e) {
e.preventDefault()
})
// Insert copy to clipboard button before .highlight
$('.highlight').each(function () {
var btnHtml = '<div class="bd-clipboard"><span class="btn-clipboard" title="Copy to clipboard">Copy</span></div>'
$(this).before(btnHtml)
$('.btn-clipboard').tooltip()
})
var clipboard = new Clipboard('.btn-clipboard', {
target: function (trigger) {
return trigger.parentNode.nextElementSibling
}
})
clipboard.on('success', function (e) {
$(e.trigger)
.attr('title', 'Copied!')
.tooltip('_fixTitle')
.tooltip('show')
.attr('title', 'Copy to clipboard')
.tooltip('_fixTitle')
e.clearSelection()
})
clipboard.on('error', function (e) {
var fallbackMsg = /Mac/i.test(navigator.userAgent) ? 'Press \u2318 to copy' : 'Press Ctrl-C to copy'
$(e.trigger)
.attr('title', fallbackMsg)
.tooltip('_fixTitle')
.tooltip('show')
.attr('title', 'Copy to clipboard')
.tooltip('_fixTitle')
})
}
// Add dynamic display of font properties to the existing documentation
@ -75,42 +109,6 @@ class Application {
}, false, true)
}
initializeClipboard() {
// Insert copy to clipboard button before .highlight
$('.highlight').each(function () {
let btnHtml = '<div class="bd-clipboard"><span class="btn-clipboard" title="Copy to clipboard">Copy</span></div>'
$(this).before(btnHtml)
$('.btn-clipboard').tooltip()
})
let clipboard = new Clipboard('.btn-clipboard', {
target: (trigger) => {
return trigger.parentNode.nextElementSibling
}
})
clipboard.on('success', (e) => {
$(e.triggerStart)
.attr('title', 'Copied!')
.tooltip('_fixTitle')
.tooltip('show')
.attr('title', 'Copy to clipboard')
.tooltip('_fixTitle')
e.clearSelection()
})
clipboard.on('error', (e) => {
let fallbackMsg = /Mac/i.test(navigator.userAgent) ? 'Press \u2318 to copy' : 'Press Ctrl-C to copy'
$(e.triggerStart)
.attr('title', fallbackMsg)
.tooltip('_fixTitle')
.tooltip('show')
.attr('title', 'Copy to clipboard')
.tooltip('_fixTitle')
})
}
}
$(() => {
@ -123,6 +121,5 @@ $(() => {
$('body').bootstrapMaterialDesign()
app.initializeClipboard()
app.initializeDemos()
})