From: Geoff Kimball Date: Mon, 29 Feb 2016 20:59:53 +0000 (-0800) Subject: Replace select docs-specific JS libraries with ones now housed in foundation-docs X-Git-Tag: v6.2.1~99 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eaff919dd807113dd1c66116f329e7f3a502a8e9;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Replace select docs-specific JS libraries with ones now housed in foundation-docs --- diff --git a/docs/assets/js/docs.copyButton.js b/docs/assets/js/docs.copyButton.js deleted file mode 100644 index 697020d9c..000000000 --- a/docs/assets/js/docs.copyButton.js +++ /dev/null @@ -1,37 +0,0 @@ -// Adds a copy button to all code examples in the docs. - -!function() { - -// Look for code samples and set up a copy button on each -$('[data-docs-code]').each(function(index, value) { - var copyBtnId = 'copy-btn-' + index.toString(); - var $button = $(''); - - var text = $(this).find('code').text() - .replace('<', '<') - .replace('>', '>'); - - $(this).prepend($button); - - var clipboard = new Clipboard('#' + copyBtnId, { - text: function() { - return text; - } - }); - - // Change the text of the copy button when it's clicked on - clipboard.on('success', function(event) { - $button.text('Copied!'); - window.setTimeout(function() { - $button.text('Copy'); - }, 3000); - }); - - // Log errors on copy failure - clipboard.on('error', function(event) { - console.error('Action:', event.action); - console.error('Trigger:', event.trigger); - }); -}); - -}() \ No newline at end of file diff --git a/docs/assets/js/docs.kitchenSink.js b/docs/assets/js/docs.kitchenSink.js deleted file mode 100644 index bd25b3e82..000000000 --- a/docs/assets/js/docs.kitchenSink.js +++ /dev/null @@ -1,17 +0,0 @@ -!function() { - -$ks = $('#docs-kitchen-sink'); -if (!$ks.length) return; - -$ks.find('[data-docs-code]').each(function() { - var $code = $(this); - - $link = $('Toggle Code'); - $link.on('click.docs', function() { - $code.slideToggle(250); - }); - $link.insertBefore(this); - $code.addClass('kitchen-sink').hide(0); -}); - -}() \ No newline at end of file diff --git a/docs/assets/js/docs.search.js b/docs/assets/js/docs.search.js deleted file mode 100644 index 820f1a0af..000000000 --- a/docs/assets/js/docs.search.js +++ /dev/null @@ -1,42 +0,0 @@ -!function() { - -var source = { - limit: 10, - source: function(query, sync, async) { - query = query.toLowerCase(); - - $.getJSON('./data/search.json', function(data, status) { - async(data.filter(function(elem, i, arr) { - var name = elem.name.toLowerCase(); - var terms = [name, name.replace('-', '')].concat(elem.tags || []); - for (var i in terms) if (terms[i].indexOf(query) > -1) return true; - return false; - })); - }); - }, - display: function(item) { - return item.name; - }, - templates: { - notFound: function(query) { - return '
No results for "' + query.query + '".
'; - }, - suggestion: function(item) { - return '
' + item.name + '' + item.type + ' ' + item.description + '
'; - } - } -} - -// Search -$('[data-docs-search]') - .typeahead({ highlight: false }, source) - .on('typeahead:select', function(e, sel) { - window.location.href = sel.link; - }); - -// Auto-highlight unless it's a phone -if (!navigator.userAgent.match(/(iP(hone|ad|od)|Android)/)) { - $('[data-docs-search]').focus(); -} - -}() \ No newline at end of file diff --git a/docs/assets/js/docs.tableOfContents.js b/docs/assets/js/docs.tableOfContents.js deleted file mode 100644 index 5098dd078..000000000 --- a/docs/assets/js/docs.tableOfContents.js +++ /dev/null @@ -1,19 +0,0 @@ -!function() { - -var $h2s = $('.docs-component h2'); -var $toc = $('[data-docs-toc]'); - -$h2s.each(function() { - if ($(this).parents('.docs-code-live').length) return; - - var text = $(this).text(); - var anchor = $(this).children('a').attr('href'); - - $toc.append('
  • '+text+'
  • '); -}); - -if ($toc.length) { - new Foundation.Magellan($toc, {}); -} - -}() diff --git a/gulp/javascript.js b/gulp/javascript.js index 246e53888..4ddcad69c 100644 --- a/gulp/javascript.js +++ b/gulp/javascript.js @@ -18,6 +18,7 @@ var DEPS = [ var DOCS = [ 'node_modules/clipboard/dist/clipboard.js', 'node_modules/corejs-typeahead/dist/typeahead.bundle.js', + 'node_modules/foundation-docs/js/**/*.js', 'docs/assets/js/docs.*.js', 'docs/assets/js/docs.js' ];