chore: update documentation

This commit is contained in:
Jacob Heun 2020-07-20 15:24:00 +02:00
parent d2024df808
commit da5150d5fe
No known key found for this signature in database
GPG Key ID: CA5A94C15809879F
3 changed files with 25 additions and 38 deletions

View File

@ -6,7 +6,7 @@
/* eslint-env amd, node */ /* eslint-env amd, node */
// https://github.com/umdjs/umd/blob/master/templates/returnExports.js // https://github.com/umdjs/umd/blob/master/templates/returnExports.js
(function(root, factory) { (function (root, factory) {
'use strict'; 'use strict';
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module. // AMD. Register as an anonymous module.
@ -21,7 +21,7 @@
root.AnchorJS = factory(); root.AnchorJS = factory();
root.anchors = new root.AnchorJS(); root.anchors = new root.AnchorJS();
} }
})(this, function() { })(this, function () {
'use strict'; 'use strict';
function AnchorJS(options) { function AnchorJS(options) {
this.options = options || {}; this.options = options || {};
@ -51,7 +51,7 @@
* https://github.com/Modernizr/Modernizr/blob/da22eb27631fc4957f67607fe6042e85c0a84656/feature-detects/touchevents.js#L40 * https://github.com/Modernizr/Modernizr/blob/da22eb27631fc4957f67607fe6042e85c0a84656/feature-detects/touchevents.js#L40
* @returns {Boolean} - true if the current device supports touch. * @returns {Boolean} - true if the current device supports touch.
*/ */
this.isTouchDevice = function() { this.isTouchDevice = function () {
return !!( return !!(
'ontouchstart' in window || 'ontouchstart' in window ||
(window.DocumentTouch && document instanceof DocumentTouch) (window.DocumentTouch && document instanceof DocumentTouch)
@ -64,7 +64,7 @@
* to. Also accepts an array or nodeList containing the relavant elements. * to. Also accepts an array or nodeList containing the relavant elements.
* @returns {this} - The AnchorJS object * @returns {this} - The AnchorJS object
*/ */
this.add = function(selector) { this.add = function (selector) {
var elements, var elements,
elsWithIds, elsWithIds,
idList, idList,
@ -193,7 +193,7 @@
* OR a nodeList / array containing the DOM elements. * OR a nodeList / array containing the DOM elements.
* @returns {this} - The AnchorJS object * @returns {this} - The AnchorJS object
*/ */
this.remove = function(selector) { this.remove = function (selector) {
var index, var index,
domAnchor, domAnchor,
elements = _getElements(selector); elements = _getElements(selector);
@ -216,7 +216,7 @@
/** /**
* Removes all anchorjs links. Mostly used for tests. * Removes all anchorjs links. Mostly used for tests.
*/ */
this.removeAll = function() { this.removeAll = function () {
this.remove(this.elements); this.remove(this.elements);
}; };
@ -229,7 +229,7 @@
* @param {String} text - Any text. Usually pulled from the webpage element we are linking to. * @param {String} text - Any text. Usually pulled from the webpage element we are linking to.
* @returns {String} - hyphen-delimited text for use in IDs and URLs. * @returns {String} - hyphen-delimited text for use in IDs and URLs.
*/ */
this.urlify = function(text) { this.urlify = function (text) {
// Regex for finding the nonsafe URL characters (many need escaping): & +$,:;=?@"#{}|^~[`%!'<>]./()*\ // Regex for finding the nonsafe URL characters (many need escaping): & +$,:;=?@"#{}|^~[`%!'<>]./()*\
var nonsafeChars = /[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\]/g, var nonsafeChars = /[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\]/g,
urlText; urlText;
@ -260,7 +260,7 @@
* @param {HTMLElemnt} el - a DOM node * @param {HTMLElemnt} el - a DOM node
* @returns {Boolean} true/false * @returns {Boolean} true/false
*/ */
this.hasAnchorJSLink = function(el) { this.hasAnchorJSLink = function (el) {
var hasLeftAnchor = var hasLeftAnchor =
el.firstChild && el.firstChild &&
(' ' + el.firstChild.className + ' ').indexOf(' anchorjs-link ') > -1, (' ' + el.firstChild.className + ' ').indexOf(' anchorjs-link ') > -1,

View File

@ -7,7 +7,7 @@ anchors.add('h3');
// Filter UI // Filter UI
var tocElements = document.getElementById('toc').getElementsByTagName('li'); var tocElements = document.getElementById('toc').getElementsByTagName('li');
document.getElementById('filter-input').addEventListener('keyup', function(e) { document.getElementById('filter-input').addEventListener('keyup', function (e) {
var i, element, children; var i, element, children;
// enter key // enter key
@ -22,14 +22,14 @@ document.getElementById('filter-input').addEventListener('keyup', function(e) {
} }
} }
var match = function() { var match = function () {
return true; return true;
}; };
var value = this.value.toLowerCase(); var value = this.value.toLowerCase();
if (!value.match(/^\s*$/)) { if (!value.match(/^\s*$/)) {
match = function(element) { match = function (element) {
var html = element.firstChild.innerHTML; var html = element.firstChild.innerHTML;
return html && html.toLowerCase().indexOf(value) !== -1; return html && html.toLowerCase().indexOf(value) !== -1;
}; };
@ -114,12 +114,12 @@ var cw_without_sb = split_left.clientWidth;
split_left.style.overflow = ''; split_left.style.overflow = '';
Split(['#split-left', '#split-right'], { Split(['#split-left', '#split-right'], {
elementStyle: function(dimension, size, gutterSize) { elementStyle: function (dimension, size, gutterSize) {
return { return {
'flex-basis': 'calc(' + size + '% - ' + gutterSize + 'px)' 'flex-basis': 'calc(' + size + '% - ' + gutterSize + 'px)'
}; };
}, },
gutterStyle: function(dimension, gutterSize) { gutterStyle: function (dimension, gutterSize) {
return { return {
'flex-basis': gutterSize + 'px' 'flex-basis': gutterSize + 'px'
}; };
@ -152,9 +152,9 @@ function loadState(ev) {
} }
} }
window.addEventListener('load', function() { window.addEventListener('load', function () {
// Restore after Firefox scrolls to hash. // Restore after Firefox scrolls to hash.
setTimeout(function() { setTimeout(function () {
loadState(); loadState();
// Update with initial scroll position. // Update with initial scroll position.
updateState(); updateState();

View File

@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset='utf-8'> <meta charset='utf-8'>
<title>libp2p-crypto 0.17.7 | Documentation</title> <title>libp2p-crypto 0.17.8 | Documentation</title>
<meta name='description' content='Crypto primitives for libp2p'> <meta name='description' content='Crypto primitives for libp2p'>
<meta name='viewport' content='width=device-width,initial-scale=1'> <meta name='viewport' content='width=device-width,initial-scale=1'>
<link href='assets/bass.css' rel='stylesheet'> <link href='assets/bass.css' rel='stylesheet'>
@ -15,7 +15,7 @@
<div id='split-left' class='overflow-auto fs0 height-viewport-100'> <div id='split-left' class='overflow-auto fs0 height-viewport-100'>
<div class='py1 px2'> <div class='py1 px2'>
<h3 class='mb0 no-anchor'>libp2p-crypto</h3> <h3 class='mb0 no-anchor'>libp2p-crypto</h3>
<div class='mb1'><code>0.17.7</code></div> <div class='mb1'><code>0.17.8</code></div>
<input <input
placeholder='Filter' placeholder='Filter'
id='filter-input' id='filter-input'
@ -145,7 +145,7 @@
</h3> </h3>
<a class='fr fill-darken0 round round pad1x quiet h5' href='https://github.com/libp2p/js-libp2p-crypto/blob/4aa77a6b121100d15bd85c700e2783df3164ef44/src/keys/rsa-class.js#L103-L106'> <a class='fr fill-darken0 round round pad1x quiet h5' href='https://github.com/libp2p/js-libp2p-crypto/blob/609297be65ceaf98b9cfb295bc9334276dccd659/src/keys/rsa-class.js#L103-L106'>
<span>src/keys/rsa-class.js</span> <span>src/keys/rsa-class.js</span>
</a> </a>
@ -210,7 +210,7 @@ of the PKCS SubjectPublicKeyInfo.</p>
</h3> </h3>
<a class='fr fill-darken0 round round pad1x quiet h5' href='https://github.com/libp2p/js-libp2p-crypto/blob/4aa77a6b121100d15bd85c700e2783df3164ef44/src/keys/rsa-class.js#L114-L134'> <a class='fr fill-darken0 round round pad1x quiet h5' href='https://github.com/libp2p/js-libp2p-crypto/blob/609297be65ceaf98b9cfb295bc9334276dccd659/src/keys/rsa-class.js#L114-L134'>
<span>src/keys/rsa-class.js</span> <span>src/keys/rsa-class.js</span>
</a> </a>
@ -288,7 +288,7 @@ of the PKCS SubjectPublicKeyInfo.</p>
</h3> </h3>
<a class='fr fill-darken0 round round pad1x quiet h5' href='https://github.com/libp2p/js-libp2p-crypto/blob/4aa77a6b121100d15bd85c700e2783df3164ef44/src/keys/rsa.js#L10-L10'> <a class='fr fill-darken0 round round pad1x quiet h5' href='https://github.com/libp2p/js-libp2p-crypto/blob/609297be65ceaf98b9cfb295bc9334276dccd659/src/keys/rsa.js#L10-L10'>
<span>src/keys/rsa.js</span> <span>src/keys/rsa.js</span>
</a> </a>
@ -346,7 +346,7 @@ of the PKCS SubjectPublicKeyInfo.</p>
</h3> </h3>
<a class='fr fill-darken0 round round pad1x quiet h5' href='https://github.com/libp2p/js-libp2p-crypto/blob/4aa77a6b121100d15bd85c700e2783df3164ef44/src/keys/ed25519-class.js#L85-L88'> <a class='fr fill-darken0 round round pad1x quiet h5' href='https://github.com/libp2p/js-libp2p-crypto/blob/609297be65ceaf98b9cfb295bc9334276dccd659/src/keys/ed25519-class.js#L85-L88'>
<span>src/keys/ed25519-class.js</span> <span>src/keys/ed25519-class.js</span>
</a> </a>
@ -411,7 +411,7 @@ of the PKCS SubjectPublicKeyInfo.</p>
</h3> </h3>
<a class='fr fill-darken0 round round pad1x quiet h5' href='https://github.com/libp2p/js-libp2p-crypto/blob/4aa77a6b121100d15bd85c700e2783df3164ef44/src/keys/secp256k1-class.js#L84-L87'> <a class='fr fill-darken0 round round pad1x quiet h5' href='https://github.com/libp2p/js-libp2p-crypto/blob/609297be65ceaf98b9cfb295bc9334276dccd659/src/keys/secp256k1-class.js#L83-L86'>
<span>src/keys/secp256k1-class.js</span> <span>src/keys/secp256k1-class.js</span>
</a> </a>
@ -423,7 +423,7 @@ of the PKCS SubjectPublicKeyInfo.</p>
The public key is a protobuf encoding containing a type and the DER encoding The public key is a protobuf encoding containing a type and the DER encoding
of the PKCS SubjectPublicKeyInfo.</p> of the PKCS SubjectPublicKeyInfo.</p>
<div class='pre p1 fill-light mt0'>id(callback: function (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error">Error</a>, id)): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a></div> <div class='pre p1 fill-light mt0'>id(): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>&#x3C;<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>></div>
@ -435,26 +435,13 @@ of the PKCS SubjectPublicKeyInfo.</p>
<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>
<div class='space-bottom0'>
<div>
<span class='code bold'>callback</span> <code class='quiet'>(function (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error">Error</a>, id))</code>
</div>
</div>
</div>
<div class='py1 quiet mt1 prose-big'>Returns</div> <div class='py1 quiet mt1 prose-big'>Returns</div>
<code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined">undefined</a></code>: <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>&#x3C;<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>></code>:
@ -489,7 +476,7 @@ of the PKCS SubjectPublicKeyInfo.</p>
</h3> </h3>
<a class='fr fill-darken0 round round pad1x quiet h5' href='https://github.com/libp2p/js-libp2p-crypto/blob/4aa77a6b121100d15bd85c700e2783df3164ef44/src/pbkdf2.js#L30-L43'> <a class='fr fill-darken0 round round pad1x quiet h5' href='https://github.com/libp2p/js-libp2p-crypto/blob/609297be65ceaf98b9cfb295bc9334276dccd659/src/pbkdf2.js#L30-L43'>
<span>src/pbkdf2.js</span> <span>src/pbkdf2.js</span>
</a> </a>