Skip to content

Instantly share code, notes, and snippets.

View robert-blankenship's full-sized avatar

Robert A. Blankenship robert-blankenship

View GitHub Profile
function formatUrl(linkUrl) {
if (linkUrl[0] == "/") {
var append1 = "http://";
var originalUrl = linkUrl;
var newUrl = linkUrl.replace("//", append1); // this doesn't actually change linkUrl
if (originalUrl !== newUrl) {
console.log("linkUrl: ", linkUrl);
console.log("originalUrl: ", originalUrl);
@robert-blankenship
robert-blankenship / mail-munch-integration.js
Created December 2, 2015 00:36
Mail Munch Integration
function createMailMunchScriptTag() {
var script = document.createElement('script');
script.setAttribute('src', "//s3.amazonaws.com/mailmunch/static/site.js");
script.setAttribute('id', "mailmunch-script");
script.setAttribute('data-mailmunch-site-id', 147159);
script.setAttribute('async', "async");
return script;
}
@robert-blankenship
robert-blankenship / change-drawer-elements-order.js
Last active December 1, 2015 21:00
Change Order of Drawer Elements
console.log("Running Gist at https://gist.github.com/robert-blankenship/bc1f262dca08943c00cb");
function when(selector, callback) {
var interval = window.setInterval(function () {
if (document.querySelectorAll(selector).length > 0) {
var err = null;
function throwAfter() {
if (err) throw err;
}
@robert-blankenship
robert-blankenship / hide-drawer-titles.js
Last active November 30, 2015 22:54
Hide Drawer Titles
console.log("Running Gist at https://gist.github.com/robert-blankenship/b01ba24de2b060b8c89f");
function when(selector, callback) {
var interval = window.setInterval(function () {
if (document.querySelectorAll(selector).length > 0) {
callback();
window.clearInterval(interval);
}
}, 200);
}
@robert-blankenship
robert-blankenship / required-options-snippet.html
Created November 17, 2015 00:04
Required Fields in Infinite Options
<script>
// To change what your customers would see if they try to
// add to cart without completing an option, edit the yellow text enclosed within the quotation marks.
var errorMessages = {
for_text_inputs : "Please add your personalized text before adding to cart.",
for_number_inputs: "Please enter a custom quantity.",
for_checkboxes : "Please select your options before adding to cart",
for_dropdowns : "Please select an option before adding to cart"
};
var pixel = document.createElement('img');
pixel.src = 'https://ct.pinterest.com/?tid=gzRugJJBQLL';
pixel.width = 1;
pixel.height = 1;
document.body.appendChild(pixel);
@robert-blankenship
robert-blankenship / shoppad-ga.js
Last active September 9, 2015 17:24
ShopPad google analytics
(function () {
function getScriptURL() {
var scripts = document.getElementsByTagName('script');
return scripts[scripts.length - 1].src;
}
function getParameterByName(name, url) {
var parser = document.createElement('a');
parser.href = url;
@robert-blankenship
robert-blankenship / faux-shopify-minijoops.js
Last active August 29, 2015 14:27
faux-shopify-minijoops.js
Shopify = {}
Shopify.shop = "minijoops.myshopify.com";
@robert-blankenship
robert-blankenship / karlkani-styles.js
Last active August 29, 2015 14:27
karlkani-styles.js
function when(selector, callback) {
var interval = window.setInterval(function () {
if (document.querySelectorAll(selector).length > 0) {
callback();
window.clearInterval(interval);
}
}, 200);
}
when('#drawer h6', function () {
@robert-blankenship
robert-blankenship / test.js
Created May 7, 2015 20:39
testing ShopPad scripts
console.log(Date.now());