Skip to content

Commit

Permalink
add jsdoc to the page
Browse files Browse the repository at this point in the history
  • Loading branch information
Haroenv committed Jun 5, 2016
1 parent 930deb0 commit 2f0daac
Show file tree
Hide file tree
Showing 31 changed files with 12,495 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ holmes({
});
```

[full documentation](https://haroen.me/holmes/doc)

### Questions?

Compatible up to IE9.
Expand Down
Binary file added doc/fonts/OpenSans-Bold-webfont.eot
Binary file not shown.
1,830 changes: 1,830 additions & 0 deletions doc/fonts/OpenSans-Bold-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/fonts/OpenSans-Bold-webfont.woff
Binary file not shown.
Binary file added doc/fonts/OpenSans-BoldItalic-webfont.eot
Binary file not shown.
1,830 changes: 1,830 additions & 0 deletions doc/fonts/OpenSans-BoldItalic-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/fonts/OpenSans-BoldItalic-webfont.woff
Binary file not shown.
Binary file added doc/fonts/OpenSans-Italic-webfont.eot
Binary file not shown.
1,830 changes: 1,830 additions & 0 deletions doc/fonts/OpenSans-Italic-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/fonts/OpenSans-Italic-webfont.woff
Binary file not shown.
Binary file added doc/fonts/OpenSans-Light-webfont.eot
Binary file not shown.
1,831 changes: 1,831 additions & 0 deletions doc/fonts/OpenSans-Light-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/fonts/OpenSans-Light-webfont.woff
Binary file not shown.
Binary file added doc/fonts/OpenSans-LightItalic-webfont.eot
Binary file not shown.
1,835 changes: 1,835 additions & 0 deletions doc/fonts/OpenSans-LightItalic-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/fonts/OpenSans-LightItalic-webfont.woff
Binary file not shown.
Binary file added doc/fonts/OpenSans-Regular-webfont.eot
Binary file not shown.
1,831 changes: 1,831 additions & 0 deletions doc/fonts/OpenSans-Regular-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/fonts/OpenSans-Regular-webfont.woff
Binary file not shown.
129 changes: 129 additions & 0 deletions doc/holmes.js.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: holmes.js</title>

<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

<h1 class="page-title">Source: holmes.js</h1>






<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* search for dom elements on your page
* @module holmes
*/
(function(root, factory) {
'use strict';

if (typeof define === 'function' &amp;&amp; define.amd) {
// AMD. Register as an anonymous module.
define([], function() {
return (root.holmes = factory());
});
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals
root.holmes = factory();
}
})(this, function() {
// UMD Definition above, do not remove this line

// To get to know more about the Universal Module Definition
// visit: https://github.com/umdjs/umd

'use strict';

/**
* search for dom elements on your page
* @alias module:holmes
* @param {Object} options
* @param {string} [options.input='input[type=search]']
* A querySelector to find the input
* @param {string} options.find
* A querySelectorAll rule to find each of the find terms
* @param {string=} options.placeholder
* Text to show when there are no results (innerHTML)
*/
function holmes(options) {
window.addEventListener('DOMContentLoaded',function(){
options.parents = options.parents || 0;
options.input = options.input || 'input[type=search]';
options.placeholder = options.placeholder || false;
var search = document.querySelector(options.input);
var elements = document.querySelectorAll(options.find);

if (options.placeholder) {
var placeholder = document.createElement('span');
placeholder.classList.add('hidden');
placeholder.innerHTML = options.placeholder;
elements[0].parentNode.appendChild(placeholder);
}

search.addEventListener('input',function(){
var found = false;
for (var i = 0; i &lt; elements.length; i++) {
var searchString = search.value.toLowerCase();
if (elements[i].textContent.toLowerCase().indexOf(searchString) === -1) {
elements[i].classList.add('hidden');
} else {
elements[i].classList.remove('hidden');
found = true;
}
};
if (!found &amp;&amp; options.placeholder) {
placeholder.classList.remove('hidden');
} else {
placeholder.classList.add('hidden');
}
});
});
};

return holmes;

});
</code></pre>
</article>
</section>




</div>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-holmes.html">holmes</a></li></ul>
</nav>

<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun Jun 05 2016 15:24:20 GMT+0200 (CEST)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>
86 changes: 86 additions & 0 deletions doc/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Home</title>

<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

<h1 class="page-title">Home</h1>








<h3> </h3>















<section>
<article><h1><a href="https://www.npmjs.com/package/holmes.js"><img alt="Holmes.js" src="https://haroen.me/holmes/images/logo.png" height="50px"></img></a></h1><blockquote>
<p>Fast and easy searching inside a page.</p>
</blockquote>
<p><a href="https://travis-ci.org/Haroenv/holmes"><img src="https://travis-ci.org/Haroenv/holmes.svg?branch=gh-pages" alt="Build Status"></a><a href="https://www.npmjs.com/package/holmes.js"><img src="https://badge.fury.io/js/holmes.js.svg" alt="npm version"></a></p>
<h2>Installation</h2><pre class="prettyprint source"><code>$ npm install --save holmes.js</code></pre><p>After which you can add it in your page with i.e. browserify or loading the module in a different script tag.</p>
<p>You have to make sure that you have a <code>css</code> rule for the class <code>.hidden</code> that hides elements however you want. One option is to have this:</p>
<pre class="prettyprint source lang-css"><code>.hidden {
display: none;
}</code></pre><p>but this could be any <code>css</code> you want.</p>
<h2>Usage</h2><p><a href="https://haroen.me/holmes/">demo</a></p>
<pre class="prettyprint source lang-js"><code>holmes({
input: '.search input', // queryselector for the input
find: '.results article', // queryselector for element to search in
placeholder: 'no results' // (optional) text to show when no results
});</code></pre><p><a href="https://haroen.me/holmes/doc">full documentation</a></p>
<h3>Questions?</h3><p>Compatible up to IE9.</p>
<p>Let me know on twitter: <a href="https://twitter.com/haroenv">@haroenv</a>.</p>
<h2>License</h2><p>Apache 2.0</p></article>
</section>






</div>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-holmes.html">holmes</a></li></ul>
</nav>

<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sun Jun 05 2016 15:24:20 GMT+0200 (CEST)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>
Loading

0 comments on commit 2f0daac

Please sign in to comment.