Travis build: 452

This commit is contained in:
Travis CI
2017-12-28 22:11:31 +00:00
parent 96c0a73d07
commit c3725284e2
4 changed files with 66 additions and 2 deletions

View File

@ -91,9 +91,11 @@
* [`elementIsVisibleInViewport`](#elementisvisibleinviewport)
* [`getScrollPosition`](#getscrollposition)
* [`getURLParameters`](#geturlparameters)
* [`hide`](#hide)
* [`httpsRedirect`](#httpsredirect)
* [`redirect`](#redirect)
* [`scrollToTop`](#scrolltotop)
* [`show`](#show)
</details>
@ -1762,6 +1764,29 @@ getURLParameters('http://url.com/page?name=Adam&surname=Smith'); // {name: 'Adam
[⬆ Back to top](#table-of-contents)
### hide
Hides all the elements specified.
Use the spread operator (`...`) and `Array.forEach()` to apply `display: none` to each element specified.
```js
const hide = (...el) => [...el].forEach(e => (e.style.display = 'none'));
```
<details>
<summary>Examples</summary>
```js
hide(document.querySelectorAll('img')); // Hides all <img> elements on the page
```
</details>
[⬆ Back to top](#table-of-contents)
### httpsRedirect
Redirects the page to HTTPS if its currently in HTTP. Also, pressing the back button doesn't take it back to the HTTP page as its replaced in the history.
@ -1835,6 +1860,29 @@ scrollToTop();
</details>
[⬆ Back to top](#table-of-contents)
### show
Shows all the elements specified.
Use the spread operator (`...`) and `Array.forEach()` to clear the `display` property for each element specified.
```js
const show = (...el) => [...el].forEach(e => (e.style.display = ''));
```
<details>
<summary>Examples</summary>
```js
show(document.querySelectorAll('img')); // Shows all <img> elements on the page
```
</details>
[⬆ Back to top](#table-of-contents)
## Date

View File

@ -160,9 +160,11 @@
<a class="sublink-1" href="#elementisvisibleinviewport">elementIsVisibleInViewport</a>
<a class="sublink-1" href="#getscrollposition">getScrollPosition</a>
<a class="sublink-1" href="#geturlparameters">getURLParameters</a>
<a class="sublink-1" href="#hide">hide</a>
<a class="sublink-1" href="#httpsredirect">httpsRedirect</a>
<a class="sublink-1" href="#redirect">redirect</a>
<a class="sublink-1" href="#scrolltotop">scrollToTop</a>
<a class="sublink-1" href="#show">show</a>
<h3>Date
</h3><a class="sublink-1" href="#getdaysdiffbetweendates">getDaysDiffBetweenDates</a>
@ -859,6 +861,13 @@ Pass <code>location.search</code> as the argument to apply to the current <code>
</code></pre>
<pre><code class="language-js">getURLParameters('http://url.com/page?name=Adam&amp;surname=Smith'); // {name: 'Adam', surname: 'Smith'}
</code></pre>
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="hide">hide</h3></div><div class="section double-padded">
<p>Hides all the elements specified.</p>
<p>Use the spread operator (<code>...</code>) and <code>Array.forEach()</code> to apply <code>display: none</code> to each element specified.</p>
<pre><code class="language-js">const hide = (...el) =&gt; [...el].forEach(e =&gt; (e.style.display = 'none'));
</code></pre>
<pre><code class="language-js">hide(document.querySelectorAll('img')); // Hides all &lt;img&gt; elements on the page
</code></pre>
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="httpsredirect">httpsRedirect</h3></div><div class="section double-padded">
<p>Redirects the page to HTTPS if its currently in HTTP. Also, pressing the back button doesn't take it back to the HTTP page as its replaced in the history.</p>
<p>Use <code>location.protocol</code> to get the protocol currently being used. If it's not HTTPS, use <code>location.replace()</code> to replace the existing page with the HTTPS version of the page. Use <code>location.href</code> to get the full address, split it with <code>String.split()</code> and remove the protocol part of the URL.</p>
@ -889,6 +898,13 @@ Scroll by a fraction of the distance from the top. Use <code>window.requestAnima
</code></pre>
<pre><code class="language-js">scrollToTop();
</code></pre>
</div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="show">show</h3></div><div class="section double-padded">
<p>Shows all the elements specified.</p>
<p>Use the spread operator (<code>...</code>) and <code>Array.forEach()</code> to clear the <code>display</code> property for each element specified.</p>
<pre><code class="language-js">const show = (...el) =&gt; [...el].forEach(e =&gt; (e.style.display = ''));
</code></pre>
<pre><code class="language-js">show(document.querySelectorAll('img')); // Shows all &lt;img&gt; elements on the page
</code></pre>
</div></div><br/><h2 style="text-align:center">Date</h2>
<div class="card fluid"><div class="section double-padded"><h3 id="getdaysdiffbetweendates">getDaysDiffBetweenDates</h3></div><div class="section double-padded">
<p>Returns the difference (in days) between two dates.</p>

View File

@ -5,7 +5,7 @@ Hides all the elements specified.
Use the spread operator (`...`) and `Array.forEach()` to apply `display: none` to each element specified.
```js
const hide = (...el) => [...el].forEach(e => e.style.display = 'none');
const hide = (...el) => [...el].forEach(e => (e.style.display = 'none'));
```
```js

View File

@ -5,7 +5,7 @@ Shows all the elements specified.
Use the spread operator (`...`) and `Array.forEach()` to clear the `display` property for each element specified.
```js
const show = (...el) => [...el].forEach(e => e.style.display = '');
const show = (...el) => [...el].forEach(e => (e.style.display = ''));
```
```js