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
/*! | |
* get children of a parent element by tag name | |
* no fallback to document if parent fail | |
* gist.github.com/englishextra/6d843e16c49cfde0a394bd9d76383b13 | |
* jsfiddle.net/englishextra/c2vr5gxd/ | |
* jsbin.com/xavocu/edit?html,js,output | |
*/ | |
getChildrenByTag = (function (d, m) { | |
function g(t, p, o) { | |
o = Object.create(g.fn); |
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
if (!document.querySelectorAll) { | |
document.querySelectorAll = function (selectors) { | |
var style = document.createElement('style'), elements = [], element; | |
document.documentElement.firstChild.appendChild(style); | |
document._qsa = []; | |
style.styleSheet.cssText = selectors + '{x-qsa:expression(document._qsa && document._qsa.push(this))}'; | |
window.scrollBy(0, 0); | |
style.parentNode.removeChild(style); |
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 $(sel) { | |
if (!sel) { | |
return document.body; | |
} | |
var r = document.querySelectorAll(sel); | |
return r.length == 1 ? r[0] : Array.prototype.slice.call(r); | |
} | |
$.matches = function(el, sel) { | |
var matchesSelector = el.webkitMatchesSelector || el.mozMatchesSelector || |
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
/*! | |
* implementing fadeIn and fadeOut without jQuery | |
* gist.github.com/englishextra/baaa687f6ae9c7733d560d3ec74815cd | |
* modified jsfiddle.net/LzX4s/ | |
* changed options.complete(); to: | |
* function"==typeof options.complete && options.complete(); | |
* usage: | |
* FX.fadeIn(document.getElementById('test'), | |
* {duration:2000,complete:function(){alert('Complete');}}); | |
*/ |
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
/*! | |
* Fade Out | |
* gist.github.com/englishextra/818ba5b558f9c15f9776684b8e8feaf9 | |
* youmightnotneedjquery.com | |
* chrisbuttery.com/articles/fade-in-fade-out-with-javascript/ | |
* fadeOut(el); | |
*/ | |
function fadeOut(el){el.style.opacity=1;(function fade(){if((el.style.opacity-=.1)<0){el.style.display="none";}else{requestAnimationFrame(fade);}})();} |
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
/*! | |
* Fade In | |
* gist.github.com/englishextra/cbf5137a95ed5e02927cd3e19e271bae | |
* youmightnotneedjquery.com | |
* fadeIn(el); | |
* fadeIn(el, "inline-block"); | |
*/ | |
function fadeIn(el){el.style.opacity=0;var last=+new Date();var tick=function(){el.style.opacity=+el.style.opacity+(new Date()-last)/400;last=+new Date();if(+el.style.opacity<1){(window.requestAnimationFrame&&requestAnimationFrame(tick))||setTimeout(tick,160);}};tick();} |
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
/*! | |
* modified MediaHack - (c) 2013 Pomke Nohkan MIT LICENCED. | |
* gist.github.com/englishextra/ff8c9dde94abe32a9d7c4a65e0f2ccac | |
* jsfiddle.net/englishextra/xg7ce8kc/ | |
* removed className fallback and additionally | |
* returns earlyDeviceOrientation,earlyDeviceSize | |
* Add media query classes to DOM nodes | |
* github.com/pomke/mediahack/blob/master/mediahack.js | |
*/ | |
var earlyDeviceOrientation = "", earlyDeviceSize = ""; |
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
/*! | |
* A minimal html entities decoder/encoder using DOM. | |
* gist.github.com/englishextra/737e35d19bcb4ee62ab85c9f9b292842 | |
* modified github.com/jussi-kalliokoski/htmlentities.js | |
* see issue github.com/jussi-kalliokoski/htmlentities.js/issues/1 | |
* htmlentities.encode('<&>'); returns '<&>'; | |
* htmlentities.decode('<&>'); returns '<&>'; | |
* htmlentities is a shorthand for htmlentities.encode | |
*/ | |
var htmlentities = (function (a) { |
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
/*! | |
* Adds Element AFTER NeighborElement | |
* gist.github.com/englishextra/c19556b7a61865e3631cc879aaeb314e | |
* @param {String|object} e HTML Element to append after | |
* @param {Object} a target HTML Element | |
* appendAfter(e,a) | |
*/ | |
var appendAfter=function(e,a){var p=a.parentNode||"",s=a.nextSibling||"";p&&s&&p.insertBefore(e,s);return!1;}; |