Created
November 8, 2012 14:55
-
-
Save seyDoggy/4039252 to your computer and use it in GitHub Desktop.
Common script used in seydesign showcase files.
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() { var DomReady = window.DomReady = {}; var userAgent = navigator.userAgent.toLowerCase(); var browser = { version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1], safari: /webkit/.test(userAgent), opera: /opera/.test(userAgent), msie: (/msie/.test(userAgent)) && (!/opera/.test(userAgent)), mozilla: (/mozilla/.test(userAgent)) && (!/(compatible|webkit)/.test(userAgent)) }; var readyBound = false; var isReady = false; var readyList = []; function domReady() { if (!isReady) { isReady = true; if (readyList) { for (var fn = 0; fn < readyList.length; fn++) { readyList[fn].call(window, []); } readyList = []; } } }; function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } }; function bindReady() { if (readyBound) { return; } readyBound = true; if (document.addEventListener && !browser.opera) { document.addEventListener("DOMContentLoaded", domReady, false); } if (browser.msie && window == top)(function() { if (isReady) return; try { document.documentElement.doScroll("left"); } catch(error) { setTimeout(arguments.callee, 0); return; } domReady(); })(); if (browser.opera) { document.addEventListener("DOMContentLoaded", function() { if (isReady) return; for (var i = 0; i < document.styleSheets.length; i++) if (document.styleSheets[i].disabled) { setTimeout(arguments.callee, 0); return; } domReady(); }, false); } if (browser.safari) { var numStyles; (function() { if (isReady) return; if (document.readyState != "loaded" && document.readyState != "complete") { setTimeout(arguments.callee, 0); return; } if (numStyles === undefined) { var links = document.getElementsByTagName("link"); for (var i = 0; i < links.length; i++) { if (links[i].getAttribute('rel') == 'stylesheet') { numStyles++; } } var styles = document.getElementsByTagName("style"); numStyles += styles.length; } if (document.styleSheets.length != numStyles) { setTimeout(arguments.callee, 0); return; } domReady(); })(); } addLoadEvent(domReady); }; DomReady.ready = function(fn, args) { bindReady(); if (isReady) { fn.call(window, []); } else { readyList.push(function() { return fn.call(window, []); }); } }; bindReady(); })(); | |
DomReady.ready(function() { | |
jQuery(document).ready(function($){ | |
// make last link a buy-now link. | |
if (sdNav.tb1.find('> ul > li > a:contains("Buy")').length > 0) { | |
sdNav.tb1.find('> ul > li > a:contains("Buy")').addClass('ydcl-addtocart'); | |
} | |
}); | |
}); | |
var sdCartloomHack = (function(){ | |
var d = this.window.document, | |
js = d.createElement('script'), | |
filename = 'https://seydoggy.cartloom.com/cart/cl?dr=1&ol=1'; | |
js.setAttribute('type', 'text/javascript'); | |
js.setAttribute('src', filename); | |
js.setAttribute('id', 'cljs'); | |
d.getElementsByTagName('head')[0].insertBefore(js, d.getElementsByTagName('title')[0]); | |
var cur_file = {}; | |
cur_file[this.window.location.href] = 1; | |
// BEGIN REDUNDANT | |
this.php_js = this.php_js || {}; | |
// END REDUNDANT | |
if (!this.php_js.includes) { | |
this.php_js.includes = cur_file; | |
} | |
if (!this.php_js.includes[filename]) { | |
this.php_js.includes[filename] = 1; | |
} else { | |
this.php_js.includes[filename]++; | |
} | |
return this.php_js.includes[filename]; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment