This file contains hidden or 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 squash(object) { // Deep JavaScript Object Squash | |
| return Object | |
| .entries(object) | |
| .map(([key, value]) => Object.assign({ key }, value && typeof value === "object" | |
| ? { value: '', children: squash(value) } | |
| : { value, children: [] } | |
| )); | |
| } |
This file contains hidden or 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"; | |
| // Advanced eCom UX Patterns | |
| // Show email promo image (branded) reveal once, every 7 days | |
| // Open drawer to email panel when clicked | |
| var fElmRevPromo = function( _d, _aIds ){ | |
| var _eRev = _d.getElementById( _aIds[0] ), _sBrand="LTD"; | |
| var _eRevI = _d.getElementsByClassName( _aIds[1] )[0]; | |
| return { | |
| init: function( sBrand ){ |
This file contains hidden or 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
| // Scott C. Krause 👁️ neodigm | 2021 | |
| // Wait for Vue.js to mount and make VUEX auth token available to the chrome extension. | |
| var _d = document, eScr = _d.createElement("script"); | |
| eScr.innerHTML = ` | |
| setInterval(() => { | |
| var _d = document; | |
| if( !_d.querySelector("[data-ext-auth]")){ | |
| var eV = _d.querySelector( 'DIV#app' ); | |
| if( eV?.__vue__?.$store?.state?.auth?.token ){ |
This file contains hidden or 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
| <!DOCTYPE=HTML> | |
| <html> | |
| <head> | |
| <title>Scotts Awesome Sauce Checkbox!</title> | |
| <meta name="generator" content="Hugo 0.76.4"> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="initial-scale=1, maximum-scale=2, minimum-scale=1, width=device-width, height=device-height"> | |
| </head> | |
| <body> | |
| <section role="main"> |
This file contains hidden or 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
| var doTwoTouch = (function( _d, _q){ // Capture Pinch attempt on carousel | |
| var eCntr, aEv=[]; | |
| setTimeout(function(){ | |
| if( oTopmenu && oTopmenu.isMobile() ) doTwoTouch.init(); | |
| }, 2800); | |
| return { | |
| "init": function(){ | |
| eCntr = _d.querySelector( _q[0] ); | |
| if( eCntr ){ | |
| eCntr.addEventListener("pointerdown", doTwoTouch.twoTouchDown ); |
This file contains hidden or 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 doScrollToCollections(sQuery, nOffset){ | |
| var eColl = document.querySelector( sQuery ); | |
| if( eColl && nOffset ){ | |
| window.scrollTo(0,0); | |
| if( oTopmenu.isMobile() ) nOffset += 80; // Sticky | |
| if( window.msCrypto ){ // Detect IE11 | |
| window.scrollTo(0, ( eColl.offsetTop - nOffset )); | |
| }else{ | |
| window.scrollTo({ top: ( eColl.getBoundingClientRect().top - nOffset ), behavior: "smooth" }); | |
| } |
This file contains hidden or 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
| var doRemoveSS = ( (_d, _q)=>{ | |
| let aS = [ ... _d.styleSheets]; | |
| aS.forEach( (oS)=>{ | |
| if( !oS.href ){ | |
| let aCSSR = [ ... oS.cssRules]; | |
| aCSSR.forEach( (oR)=>{ | |
| if( typeof oR.selectorText != "undefined"){ | |
| if( oR.selectorText.indexOf( _q ) != -1){ | |
| console.log( oR.selectorText ); | |
| oS.disabled = true; |
This file contains hidden or 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
| let image = document.querySelectorAll("canvas")[0].toDataURL("image/png").replace("image/png", "image/octet-stream"); | |
| window.location.href=image; |
This file contains hidden or 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
| // Vue.js Method | |
| "doHeroClick": function( ev ){ | |
| ev.preventDefault(); | |
| if( oTopmenu && !oTopmenu.isMobile() ){ | |
| var eTarget = this.$refs["pdp_zoom_reveal"]; | |
| eTarget = eTarget.parentNode; | |
| if( eTarget ){ | |
| while( eTarget.tagName !== "HTML" ){ | |
| eTarget.style.position = "relative"; | |
| eTarget = eTarget.parentNode; |
This file contains hidden or 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
| // Grab the prefers reduced media query. | |
| const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)"); | |
| // Check if the media query matches or is not available. | |
| if (!mediaQuery || mediaQuery.matches) { | |
| doSomethingWithoutAnimation(); | |
| } else { | |
| doSomethingWithAnimation(); | |
| } |