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
| window.Sauce = { | |
| isReady: false, | |
| options: {}, | |
| object: {}, | |
| describe: function (type, data) { | |
| this.object[type] = data; |
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
| // Sample options to pass to Keen.configure | |
| // { | |
| // projectId: "your_project_id", | |
| // writeKey: "your_write_key", | |
| // } | |
| var loadKeen = function (options, cb) { | |
| var iframe = document.createElement("iframe"); | |
| iframe.style.display = "none"; |
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 indexOf = function(arr, item, fromIndex) { | |
| fromIndex = fromIndex || 0; | |
| if (arr === null) { | |
| return -1; | |
| } | |
| var len = arr.length, | |
| i = fromIndex < 0 ? len + fromIndex : fromIndex; | |
| while (i < len) { | |
| // we iterate over sparse items since there is no way to make it |
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 waitForEl = function(selector, callback) { | |
| if (jQuery(selector).length) { | |
| callback(); | |
| } else { | |
| setTimeout(function() { | |
| waitForEl(selector, callback); | |
| }, 100); | |
| } | |
| }; |
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 average = function (arr) { | |
| var total = 0; | |
| forEach(arr, function (number) { | |
| total += number; | |
| }); | |
| return total / arr.length; | |
| }; |
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 forEach = function(arr, callback, thisObj) { | |
| if (arr === null) { | |
| return; | |
| } | |
| var i = -1, | |
| len = arr.length; | |
| while (++i < len) { | |
| // we iterate over sparse items since there is no way to make it | |
| // work properly on IE 7-8. see #64 | |
| if (callback.call(thisObj, arr[i], i, arr) === false) { |
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 waitForGlobal = function(key, callback) { | |
| if (window[key]) { | |
| callback(); | |
| } else { | |
| setTimeout(function() { | |
| waitForGlobal(key, callback); | |
| }, 100); | |
| } | |
| }; | |
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 ucFirst = function (string) { | |
| return string.charAt(0).toUpperCase() + string.slice(1); | |
| }; |
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
| define(function() { | |
| var QueryString = function() { | |
| // This function is anonymous, is executed immediately and | |
| // the return value is assigned to QueryString! | |
| var query_string = {}; | |
| var query = window.location.search.substring(1); | |
| // String trailing forward slash if exists | |
| if (query.charAt(query.length - 1) == "/") { |