Skip to content

Instantly share code, notes, and snippets.

View neodigm's full-sized avatar
๐Ÿ’ฏ
Product Designer โšก Interactive Storyteller

Scott C. Krause neodigm

๐Ÿ’ฏ
Product Designer โšก Interactive Storyteller
View GitHub Profile
@neodigm
neodigm / material_design_skin.js
Last active July 15, 2020 16:05
Another MD input box, but this one is declarative. Requires a separate CSS file. Works on IE11.
var oMDPage = ( function( _d ){ // Material Design INPUT Labels
var aInp = [], aLab = [], sBrand="", bBound = false, nCnt = -1;
function onInpFoc( _el ){ // focus
if( typeof _el.dataset.mdLabel !== "undefined" ){
var sPH = _el.getAttribute("placeholder");
if( sPH ){
_el.dataset.mdLabelPh = sPH;
_el.placeholder = "";
aLab[ _el.dataset.mdLabel ].classList.remove( "h-vs__hidden" );
}
@neodigm
neodigm / SimpleExpand.js
Last active July 12, 2020 07:42
Simple Vanilla JavaScript Expand and Collapse (async). Summary and Details paired elements 1:1
var oSimpleExpand = (function( doc ){ // Simple expand / collapse
var aSum, aDet; // Summary and Details paired elements 1:1
return {
"rebind": function(){
aSum = [].slice.call( doc.querySelectorAll("[data-expand-summary]") );
aDet = [].slice.call( doc.querySelectorAll("[data-expand-details]") );
aSum.forEach( function( aE ){
var aDecl = aE.dataset.expandSummary.split("|");
if( aDecl.length > 0 ){
aE.aDecl = aDecl;
@neodigm
neodigm / remove_all_bootstrap_stylesheets.js
Created October 29, 2019 18:15
Remove all Bootstrap CSS from a page. Useful for Tailwind migration testing. Vanilla JavaScript ES5.
var eSS = document.querySelectorAll('link[rel=stylesheet]');
for(var i=0;i<eSS.length;i++){
if( typeof eSS[i].href != "undefined" ){
if( eSS[i].href.indexOf("bootstrap") != -1 ){
eSS[i].parentNode.removeChild(eSS[i]);
}
}
}
@neodigm
neodigm / multiClick.js
Created November 12, 2019 19:01
mutiClick Super Simple Vanilla JavaScript ES5 Clicker IIFE
var multiClick = (function( _d ){ // Click lots of stuff
return {
"all": function( sQuery ){
if( sQuery ){
[].slice.call( _d.querySelectorAll( sQuery ) )
.filter(function( eL ){ eL.click() })
}
}
}
@neodigm
neodigm / order_before_xmas.js
Created December 11, 2019 16:47
Order by date logic - eComm
"use strict";
var oOrderBy = function(){
var eLink = document.querySelector("[data-reveal-id='#exp_info_modal']");
return {
init: function( _t ){
@neodigm
neodigm / a_human_typing_terminal.js
Last active July 12, 2020 07:37
Progressively type rows of text as if entered by a human into a terminal(s).
"use strict";
// Progressively type rows of text as if entered by a human
var doHumanTyping = (function(_d){
var oTerms = {}, aTerms = [];
var oSetI = null, INTERX = 38;
return {
"play": function(_query, _fCB){
var elTerm = _d.querySelector(_query);
@neodigm
neodigm / snackbar_toast.js
Last active January 17, 2024 06:20
DataVis ๐Ÿ‘๏ธ UX ๐Ÿญ PWA ๐Ÿ‘๏ธ ThreeJS โœจ Vue ๐Ÿš€ Svelte
// ๐ŸŒ‘๐ŸŒ’๐ŸŒ“๐ŸŒ”๐ŸŒ•๐ŸŒ–๐ŸŒ—๐ŸŒ˜๐ŸŒ‘ Infographics UX PWA Typescript Svelte ThreeJS Vue โœจ
let neodigmToast = (function(_d, eID, _q) {
let _nTimeout = 5800, _aQ = [], _eSb, _eSbText, _sTheme
let bIsInit = bIsPause = false
let _fOpen = function() {
_eSbText.innerHTML = _aQ[0].sMsg.replace("|", "<br>").replace("##", "")
_eSb.style.left = ((_d.body.clientWidth / 2) - (_eSb.clientWidth / 2)) + "px"
if( _aQ[0].sTheme ) _eSb.dataset.n55Theme = _aQ[0].sTheme
if( _sTheme ) {
_eSb.dataset.n55Theme = _sTheme
@neodigm
neodigm / html_data_attrib_2_javascript_dataset.js
Last active July 15, 2020 16:04
Convert HTML data attribute name to JS dataset name in camel case
function data2prop( sDset ){ // Convert HTML data attrib name to JS dataset name
sDset = sDset.replace("data-", "").toLowerCase();
let aDset = sDset.split(""), aDret = [], bUpper = false;
aDset.forEach( (sVal, nIx) => {
if( sVal == "-" ){
bUpper = true;
}else{
aDret.push( ( bUpper ) ? sVal.toUpperCase() : sVal );
bUpper = false;
}
// Desc: Asynchronous recursive crawl report the total number of products by category
// Usage: catCount.init();
var catCount = (function(_d,_q){
"use strict";
let aSub = [];
console.clear();
return {

Keybase proof

I hereby claim:

  • I am neodigm on github.
  • I am neodigm (https://keybase.io/neodigm) on keybase.
  • I have a public key ASDzn1bBMQ39o2wKC4ZvecfI8YsYBf2lxq2j0JBlXrprawo

To claim this, I am signing this object: