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
/*! | |
* Check if string represents a valid HTML id | |
* gist.github.com/englishextra/b5aaef8b555a3ba84c68a6e251db149d | |
* jsfiddle.net/englishextra/z19tznau/ | |
* @param {String} a text string | |
* @param {Int} [full] if true, returns with leading hash/number sign | |
* isValidId(a,full) | |
*/ | |
var isValidId = function(a, full) { | |
return full ? /^\#[A-Za-z][-A-Za-z0-9_:.]*$/.test(a) ? !0 : !1 : /^[A-Za-z][-A-Za-z0-9_:.]*$/.test(a) ? !0 : !1; |
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 for babel citojs - v0.0.3 | |
* github.com/joelrich/citojs | |
* gist.github.com/englishextra/359e2fa19c14319a385cc4b47af0b597 | |
* jsfiddle.net/englishextra/L9zrqd4L/ | |
* closure-compiler.appspot.com/code/jscb32351779a4dd18f67fc6a53c7af5d44/default.js | |
* removed UMD wrapper | |
* Copyright (c) 2015, Joel Richard | |
* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this |
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
/*! | |
* add touch support class | |
* gist.github.com/englishextra/3cb22aab31a52b6760b5921e4fe8db95 | |
* jsfiddle.net/englishextra/z5xhjde8/ | |
*/ | |
var earlyHasTouch; | |
(function (d, s) { | |
if (d) { | |
var c = "ontouchstart" in d ? s : "no-" + s; | |
earlyHasTouch = c; |
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
/*! | |
* Notifier42 | |
* Toast messages with pure JS | |
* gist.github.com/englishextra/5500a860c26d5e262ef3700d822ff698 | |
* inspired by github.com/mlcheng/js-toast | |
* @param {String|Object} m text string or HTML ELement | |
* @param {Int} [n] any positive whole number, default: 0 | |
* @param {String} t [additioal css class name] | |
* var nf=Notifier42("message",8000);setTimeout(function(){nf.destroy()},2000); | |
*/ |
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
/*! | |
* loading spinner | |
* dependent on setAutoClearedTimeout | |
* gist.github.com/englishextra/24ef040fbda405f7468da70e4f3b69e7 | |
* @param {Object} [cb] callback function | |
* @param {Int} [n] any positive whole number, default: 500 | |
* LoadingSpinner.show(); | |
* LoadingSpinner.hide(cb,n); | |
*/ | |
var LoadingSpinner = function () { |
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 as fragment AFTER NeighborElement | |
* gist.github.com/englishextra/75020c8ba3b389b19d501d8ec88e3121 | |
* @param {String|object} e HTML Element to append after | |
* @param {Object} a target HTML Element | |
* appendFragmentAfter(e,a) | |
*/ | |
var appendFragmentAfter=function(e,a){"string"===typeof e&&(e=document.createTextNode(e));var p=a.parentNode||"",s=a.nextSibling||"",df=document.createDocumentFragment();p&&s&&df.appendChild(e)&&p.insertBefore(df,s);return!1;}; |
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 BEFORE NeighborElement | |
* gist.github.com/englishextra/ad6b0ed6aa934434ddbb65d3a60ba28f | |
* @param {String|object} e HTML Element to prepend before | |
* @param {Object} a target HTML Element | |
* prependBefore(e,a) | |
*/ | |
var prependBefore=function(e,a){var p=a.parentNode||"";p&&p.insertBefore(e,a);return!1;}; |
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
/*! | |
* How can I check if a CSS file has been included already? | |
* gist.github.com/englishextra/d00e7046c9957199ff3e87af693f38be | |
* stackoverflow.com/questions/18155347/how-can-i-check-if-a-js-file-has-been-included-already | |
* @param {String} h path string | |
* styleIsLoaded(h) | |
*/ | |
var styleIsLoaded=function(h){var a=document.styleSheets||"";if(a)for(var b=0,d=a.length;b<d;b++)if(a[b].href==h)return!0;return!1}; |
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
/*! | |
* How can I check if a JS file has been included already? | |
* gist.github.com/englishextra/403a0ca44fc5f495400ed0e20bc51d47 | |
* stackoverflow.com/questions/18155347/how-can-i-check-if-a-js-file-has-been-included-already | |
* @param {String} s path string | |
* scriptIsLoaded(s) | |
*/ | |
var scriptIsLoaded=function(s){for(var b=document.getElementsByTagName("script")||"",a=0;a<b.length;a++)if(b[a].getAttribute("src")==s)return!0;return!1}; |
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
/*! | |
* parse JSON with no eval using JSON-js/json_parse.js | |
* with fallback to native JSON.parse | |
* gist.github.com/englishextra/4c0c2dec65953cae0d3b909ee64650f7 | |
* @param {String} a JSON string | |
* safelyParseJSON(a) | |
*/ | |
var safelyParseJSON=function(a){var w=window;try{return w.json_parse?json_parse(a):JSON.parse(a);}catch(e){console.log(e);}}; |