]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Replace select docs-specific JS libraries with ones now housed in foundation-docs
authorGeoff Kimball <geoff@zurb.com>
Mon, 29 Feb 2016 20:59:53 +0000 (12:59 -0800)
committerGeoff Kimball <geoff@zurb.com>
Mon, 29 Feb 2016 21:02:16 +0000 (13:02 -0800)
docs/assets/js/docs.copyButton.js [deleted file]
docs/assets/js/docs.kitchenSink.js [deleted file]
docs/assets/js/docs.search.js [deleted file]
docs/assets/js/docs.tableOfContents.js [deleted file]
gulp/javascript.js

diff --git a/docs/assets/js/docs.copyButton.js b/docs/assets/js/docs.copyButton.js
deleted file mode 100644 (file)
index 697020d..0000000
+++ /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 = $('<button class="docs-code-copy" id="' + copyBtnId + '">Copy</button>');
-
-  var text = $(this).find('code').text()
-    .replace('&lt;', '<')
-    .replace('&gt;', '>');
-
-  $(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 (file)
index bd25b3e..0000000
+++ /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 = $('<a class="docs-code-toggle">Toggle Code</a>');
-  $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 (file)
index 820f1a0..0000000
+++ /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 '<div class="tt-empty">No results for "' + query.query + '".</div>';
-    },
-    suggestion: function(item) {
-      return '<div><span class="name">' + item.name + '<span class="meta">' + item.type + '</span></span> <span class="desc">' + item.description + '</span></div>';
-    }
-  }
-}
-
-// 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 (file)
index 5098dd0..0000000
+++ /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('<li><a href="'+anchor+'">'+text+'</a></li>');
-});
-
-if ($toc.length) {
-  new Foundation.Magellan($toc, {});
-}
-
-}()
index 246e53888b218338612ab9bba78d0aaaa075beac..4ddcad69c078411b9d22e95a08266aecdd67065c 100644 (file)
@@ -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'
 ];