https://codehandbook.org/how-to-remove-duplicates-from-javascript-array/
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
//place script in head and after modernizr. | |
(function(){ | |
var html = document.getElementsByTagName('HTML')[0]; | |
if("ActiveXObject" in window){ | |
html.className += ' is-IE'; | |
} | |
})() |
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
(function(){ | |
/* | |
Use this only if really really necessary. | |
This plugin tries to detect android stock browser. | |
Place it in the head tag. And after Modernizr. | |
https://developer.chrome.com/multidevice/user-agent#webview_user_agent | |
*/ |
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
'use strict'; | |
(function(){ | |
window.NIJS = window.NIJS || {}; | |
NIJS.detection = NIJS.detection || {}; | |
var html = document.getElementsByTagName('html')[0], | |
removeClass = function(str, className){ | |
var classArr = str.split(' '), |
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
/* GENERAL DEVICE CONSTANTS | |
##################################################################################################################### */ | |
/* | |
* iOS | |
*/ | |
// iOS metrics | |
$ios-status-bar-height: em-calc(20); | |
$ios-nav-bar-height: em-calc(44); |
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
const store = { | |
storageIndex: undefined, | |
debug: false, | |
state: Object.freeze({ | |
}), | |
setState(keyword, value) { | |
if (this.debug) console.log(`STATE: ${keyword}:`, value); // eslint-disable-line no-console | |
const newObject = Object.assign({}, this.state, { [keyword]: value }); | |
this.state = Object.freeze(newObject); | |
if (this.storageIndex) localStorage.setItem(this.storageIndex, JSON.stringify(newObject)); |
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
const l = localStorage | |
const crappyStore = { | |
get: (key) => JSON.parse(l.getItem(key)), | |
set: (key, data) => l.setItem(key, JSON.stringify(data)), | |
rm: (key) => l.removeItem(key), | |
getKeysFor: (prefix) => { | |
const ret = [] | |
for (let key in l) { | |
ret.push(key) |
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
// based on https://github.com/arasatasaygin/is.js/blob/master/is.js | |
// this is a cut off minimal version | |
const userAgent = (navigator && navigator.userAgent.toLowerCase()) || ''; | |
const vendor = (navigator && navigator.vendor || '').toLowerCase(); | |
// build a 'comparator' object for various comparison checks | |
const comparator = { | |
'<': (a, b) => a < b, | |
'<=': (a, b) => a <= b, |
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
/** | |
* based on | |
* @url https://github.com/rstacruz/details-polyfill | |
* @todo https://www.sitepoint.com/fixing-the-details-element/ | |
* @todo https://www.smashingmagazine.com/2014/11/complete-polyfill-html5-details-element/ | |
*/ | |
const detailsPolyfillEs6 = ({ | |
CSS_CLASS = 'no-details', | |
CSS_STRING = false, |