This repository has been archived by the owner on Mar 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Davide Gheri
committed
Oct 17, 2018
1 parent
2086bcf
commit c1e27b9
Showing
41 changed files
with
16,726 additions
and
4 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
1,835 changes: 1,835 additions & 0 deletions
1,835
docs/1.0.1/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 not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1,830 changes: 1,830 additions & 0 deletions
1,830
docs/1.0.1/fonts/OpenSans-SemiboldItalic-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 not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
<title>getQueryParams/index.js - Documentation</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="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||
</head> | ||
<body> | ||
|
||
<input type="checkbox" id="nav-trigger" class="nav-trigger" /> | ||
<label for="nav-trigger" class="navicon-button x"> | ||
<div class="navicon"></div> | ||
</label> | ||
|
||
<label for="nav-trigger" class="overlay"></label> | ||
|
||
<nav> | ||
<li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Classes</li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="JsBrowser.html">JsBrowser</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="JsBrowser.html#.getPrevPage">getPrevPage</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="JsBrowser.html#.getQueryParams">getQueryParams</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="JsBrowser.html#.shiftPage">shiftPage</a></span></li> | ||
</nav> | ||
|
||
<div id="main"> | ||
|
||
<h1 class="page-title">getQueryParams/index.js</h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<section> | ||
<article> | ||
<pre class="prettyprint source linenums"><code>/** | ||
* @memberof JsBrowser | ||
* @function getQueryParams | ||
* @description Return the query params object (this will work only if query params | ||
* are after the hashbang) | ||
* @returns {Object} {queryParamsKey1: queryParamsValue1, queryParamsKey2: queryParamsValue2... } | ||
|
||
* | ||
* @example | ||
* import Browser from 'js-browser'; | ||
* | ||
* | ||
* const queryParams = Browser.getQueryParams(); | ||
*/ | ||
|
||
export default () => { | ||
// take from BarneyBrowser.getQueryParams, we can change this after | ||
const url = window.location.href; | ||
const vars = {}; | ||
let hash; | ||
|
||
if (url.indexOf('?') !== -1) { | ||
const querystring = url.slice(url.indexOf('?') + 1); | ||
if (querystring) { | ||
const hashes = querystring.split('&'); | ||
|
||
for (let i = 0; i < hashes.length; i += 1) { | ||
if (hashes[i].indexOf('=') !== -1) { | ||
hash = hashes[i].split('='); | ||
|
||
vars[hash[0]] = window.decodeURIComponent(hash[1]); | ||
} | ||
} | ||
} | ||
} | ||
return vars; | ||
};</code></pre> | ||
</article> | ||
</section> | ||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Oct 17 2018 12:20:13 GMT+0200 (CEST) using the Minami theme. | ||
</footer> | ||
|
||
<script>prettyPrint();</script> | ||
<script src="scripts/linenumber.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
<title>Home - Documentation</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="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||
</head> | ||
<body> | ||
|
||
<input type="checkbox" id="nav-trigger" class="nav-trigger" /> | ||
<label for="nav-trigger" class="navicon-button x"> | ||
<div class="navicon"></div> | ||
</label> | ||
|
||
<label for="nav-trigger" class="overlay"></label> | ||
|
||
<nav> | ||
<li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Classes</li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="JsBrowser.html">JsBrowser</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="JsBrowser.html#.getPrevPage">getPrevPage</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="JsBrowser.html#.getQueryParams">getQueryParams</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="JsBrowser.html#.shiftPage">shiftPage</a></span></li> | ||
</nav> | ||
|
||
<div id="main"> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<section class="readme"> | ||
<article><h2>js-browser</h2><p><a href="https://travis-ci.com/docomodigital/js-browser"><img src="https://travis-ci.com/docomodigital/js-browser.svg?branch=master" alt="Build Status"></a> | ||
<a href="https://coveralls.io/github/docomodigital/js-browser?branch=master"><img src="https://coveralls.io/repos/github/docomodigital/js-browser/badge.svg?branch=master" alt="Coverage Status"></a> | ||
<a href="https://badge.fury.io/js/%40docomodigital%2Fjs-browser"><img src="https://badge.fury.io/js/%40docomodigital%2Fjs-browser.svg" alt="npm version"></a> | ||
<a href="https://greenkeeper.io/"><img src="https://badges.greenkeeper.io/docomodigital/js-browser.svg" alt="Greenkeeper badge"></a></p> | ||
<p>Provides you an alternative method to manage previous and current page changements.</p> | ||
<p>Is particularly used to get query params as object and to get the previous page in order to implement an easy and basic history in your routing.</p> | ||
<h2>Usage</h2><pre class="prettyprint source lang-javascript"><code>import { Browser } from 'js-browser'; | ||
|
||
// Get previous page | ||
const prevPage = Browser.getPrevPage(); | ||
|
||
// Set browser new state | ||
Browser.shiftPage('/home'); | ||
|
||
// Get query params in your url | ||
const queryParams = Browser.getQueryParams();</code></pre><h2>Installation</h2><h3>NPM</h3><pre class="prettyprint source lang-bash"><code>npm install --save @docomodigital/js-browser</code></pre><h2>Documentation</h2><p>To read documentation, go to:</p> | ||
<p><a href="http://docomodigital.github.io/js-browser/latest">http://docomodigital.github.io/js-browser/latest</a></p> | ||
<p>or run the following command insite the js-browser folder: </p> | ||
<pre class="prettyprint source lang-bash"><code>npm run doc:open</code></pre></article> | ||
</section> | ||
|
||
|
||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Oct 17 2018 12:20:13 GMT+0200 (CEST) using the Minami theme. | ||
</footer> | ||
|
||
<script>prettyPrint();</script> | ||
<script src="scripts/linenumber.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
<title>index.js - Documentation</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="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||
</head> | ||
<body> | ||
|
||
<input type="checkbox" id="nav-trigger" class="nav-trigger" /> | ||
<label for="nav-trigger" class="navicon-button x"> | ||
<div class="navicon"></div> | ||
</label> | ||
|
||
<label for="nav-trigger" class="overlay"></label> | ||
|
||
<nav> | ||
<li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Classes</li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="JsBrowser.html">JsBrowser</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="JsBrowser.html#.getPrevPage">getPrevPage</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="JsBrowser.html#.getQueryParams">getQueryParams</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="JsBrowser.html#.shiftPage">shiftPage</a></span></li> | ||
</nav> | ||
|
||
<div id="main"> | ||
|
||
<h1 class="page-title">index.js</h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<section> | ||
<article> | ||
<pre class="prettyprint source linenums"><code>/** | ||
* @class JsBrowser | ||
* @description JsBrowser provides you an alternative method to manage previous | ||
* and current page changements. Is particularly used to get query params as | ||
* object and to get the previous page in order to implement an easy and basic history | ||
* in your routing | ||
*/ | ||
|
||
import getQueryParams from './getQueryParams'; | ||
|
||
class Browser { | ||
constructor() { | ||
this.currentPage = null; | ||
this.prevPage = null; | ||
|
||
/** | ||
* @see modules/getQueryParams | ||
*/ | ||
this.getQueryParams = getQueryParams; | ||
|
||
this.shiftPage = this.shiftPage.bind(this); | ||
this.getPrevPage = this.getPrevPage.bind(this); | ||
} | ||
|
||
/** | ||
* @memberof JsBrowser | ||
* @function shiftPage | ||
* @description Adapt the Browser.prevPage and Browser.currentPage | ||
* according to route's changement. | ||
* | ||
* **NB:** route changements must be specified in your routing changement function observer | ||
* @param {String} currentPage set the previous page to the actual Browser.currentPage, then | ||
* set the Browser.currentPage to the given new value | ||
* | ||
* @example | ||
* // Browser.shiftPage(); | ||
* | ||
* import Browser from 'js-browser'; | ||
* | ||
* | ||
* Browser.shiftPage('/newPage'); | ||
*/ | ||
shiftPage(currentPage) { | ||
if (currentPage && this.currentPage !== currentPage) { | ||
this.prevPage = this.currentPage; | ||
this.currentPage = currentPage; | ||
} | ||
} | ||
|
||
/** | ||
* @memberof JsBrowser | ||
* @function getPrevPage | ||
* @description Return the previous page you visited, if is empty, then returns null. | ||
* | ||
* @returns {String} previous page visited (ie: '/home') | ||
* | ||
* @example | ||
* // Browser.getPrevPage(); | ||
* | ||
* import Browser from 'js-browser'; | ||
* | ||
* | ||
* const prevPage = Browser.getPrevPage(); // '/home' | ||
*/ | ||
getPrevPage() { | ||
return this.prevPage; | ||
} | ||
} | ||
|
||
export default new Browser();</code></pre> | ||
</article> | ||
</section> | ||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Oct 17 2018 12:20:13 GMT+0200 (CEST) using the Minami theme. | ||
</footer> | ||
|
||
<script>prettyPrint();</script> | ||
<script src="scripts/linenumber.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/*global document */ | ||
(function() { | ||
var source = document.getElementsByClassName('prettyprint source linenums'); | ||
var i = 0; | ||
var lineNumber = 0; | ||
var lineId; | ||
var lines; | ||
var totalLines; | ||
var anchorHash; | ||
|
||
if (source && source[0]) { | ||
anchorHash = document.location.hash.substring(1); | ||
lines = source[0].getElementsByTagName('li'); | ||
totalLines = lines.length; | ||
|
||
for (; i < totalLines; i++) { | ||
lineNumber++; | ||
lineId = 'line' + lineNumber; | ||
lines[i].id = lineId; | ||
if (lineId === anchorHash) { | ||
lines[i].className += ' selected'; | ||
} | ||
} | ||
} | ||
})(); |
Oops, something went wrong.