Skip to content

Instantly share code, notes, and snippets.

💭
Watching Cat Videos

scott krause neodigm

View GitHub Profile
@neodigm
neodigm / infinite_scroll_sample.html
Created Mar 20, 2019
Infinite Scroll ⚡️ Scott C. Krause, lazy load and intersection observer
View infinite_scroll_sample.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Infinite Scroll ⚡️ Scott C. Krause</title>
<style>
/* --------------------
Add your styling here
-------------------- */
.container {
View monetate_inspector.js
(function(){var a=Math.floor(((new Date).getTime()+1112009)/864E5),b=window,c=b.document,d="https://marketer.monetate.net/control/inspector/"+a+"/",e=b.__mti&&b.__mti.open;if(e)e();else if(!c.getElementById("mtInspector-script")){var f=c.getElementsByTagName("head")[0]||c.body;if(f){var g=f,h=d,i=c.createElement("link");i.href=h+"inspector.css";i.rel="stylesheet";g.insertBefore(i,g.firstChild);var j=f,k=d,l=c.createElement("script");l.src=k+"inspector.js";l.id="mtInspector-script";j.insertBefore(l,j.firstChild)}};})();
@neodigm
neodigm / canIUseWebP.js
Last active Dec 18, 2018
JavaScript WebP support detection
View canIUseWebP.js
function canIUseWebP() { // Original Author Unknown
var elem = document.createElement('canvas');
if (!!(elem.getContext && elem.getContext('2d'))) {
return elem.toDataURL('image/webp').indexOf('webp') == 0;
}
return false;
}
@neodigm
neodigm / email_popup.js
Created Dec 13, 2018
The email promo dialog script and markup are below. The markup must exist in the DOM before the JS is executed. The modal will show once every seven (7) days. The image displayed will be determined by the site brand. Clicking on the image will open the drawer and the email panel then close the reveal. If the reveal component is not on the page t…
View email_popup.js
"use strict";
// 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 ){
if( sBrand && ( typeof _eRevI != "undefined") ){
@neodigm
neodigm / blinked_class.js
Last active Dec 7, 2018
Vanilla JavaScript Blink Class
View blinked_class.js
// Add and Remove a class repeatedly for a set duration for a set number of times (blinking or animating).
// This is good for blinking an element for a few seconds to attract attention to it.
var fBlinkClass = function( _sQuery, _sClass, _nItra, _nDura ){
var eChevr = document.querySelector( _sQuery ), _nCur = 0, _si;
eChevr.classList.add( _sClass );
_si = window.setInterval(function(){
if( ++_nCur <= _nItra ){
if( eChevr.classList.contains( _sClass ) ){
eChevr.classList.remove( _sClass );
}else{
@neodigm
neodigm / page_fade.js
Created Nov 19, 2018
Fade a page so that it is difficult for shoulder surfers to see. On the DL.
View page_fade.js
// Run as a Chrome Snippet
document.body.style = "opacity: 0.2;filter:grayscale(100%);";
@neodigm
neodigm / extract_long_tail_keywords_google_ai.js
Last active Nov 11, 2018
Get Long Tail Keywords from the Google Drop-down
View extract_long_tail_keywords_google_ai.js
// Persist Long Key Words from Google
var fLong = (function(){
var _aPKW = localStorage.getItem( "gogl_ai_keywords" );
if( _aPKW ){
_aPKW = JSON.parse( _aPKW );
}else{
_aPKW = [];
}
return {
doit : function(){
View change_brand.js
// JavaScript
[].slice.call( document.querySelectorAll(".js-mybutton") ).filter( function( _e ){
_e.addEventListener("click", function( e ){
document.body.dataset.brand = ( document.body.dataset.brand == "LS" ) ? "LTD" : "LS";
}, true);
});
@neodigm
neodigm / microsoft_ie11_flexbox.css
Last active Dec 14, 2018
Microsoft IE11 Flexbox Monkey Patch
View microsoft_ie11_flexbox.css
@media screen and (-ms-high-contrast: active), screen and (-ms-high-contrast: none) { /*ms*/
.flex__item:nth-child(2) { flex-basis: 88% }
}
@supports (display: grid) {
.l-productthumb>section {
display: grid;
justify-content: center;
grid-template-columns: repeat(auto-fill, 242px);
}
}
@neodigm
neodigm / force_footer.css
Created Jun 6, 2018
Force the footer to float to the bottom post framework hack
View force_footer.css
You can’t perform that action at this time.