This file contains 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 Cache = function(pMaxSize) { | |
this.lastID = 0; | |
this.items = {}; | |
this.numItems = 0; | |
var maxSize = parseInt(pMaxSize, 10); | |
if (isNaN(maxSize)) maxSize = -1; | |
this.maxNumItems = maxSize; | |
this.itemDefault = { | |
ttl : 3600, // time to live = 1 hour | |
priority : 2 // 1=low, 2=medium, 3=high |
This file contains 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 getQueryString = function(name) { | |
var pairs = window.location.search.substring(1).split("&"), pair; | |
for ( var i = 0; i < pairs.length; i++) { | |
pair = pairs[i].split("="); | |
if (pair[0] == name) return pair[1]; | |
} | |
return null; | |
}; |
This file contains 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 toBool = function(value) { | |
switch (value.toLowerCase()) { | |
case "true": | |
case "yes": | |
case "y": | |
case "o": | |
case "off": | |
case "1": | |
return true; | |
case "false": |
This file contains 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 cssRegex = /.css$/, jsRegex=/.js$/; | |
var endsWith = function(string,pattern) { return asset.match(pattern); }; | |
var isCSS = function(filename) { return endsWith(filename,cssRegex); }; | |
var isJS = function(filename) { return endsWith(filename,jsRegex); }; | |
var loadAssets = function(assets) { | |
if (!assets) return; |
This file contains 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 addXhrProgressEvent($) { | |
var originalXhr = $.ajaxSettings.xhr; | |
$.ajaxSetup({ | |
progress: function() { console.log("standard progress callback"); }, | |
xhr: function() { | |
var req = originalXhr(), that = this; | |
if (req) { | |
if (typeof req.addEventListener == "function") { | |
req.addEventListener("progress", function(evt) { | |
that.progress(evt); |
This file contains 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 settings, defaults = { | |
prop1 : 'value1', | |
prop2 : 'value2' | |
}; | |
var methods = { |
This file contains 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($){ | |
$.fn.basicPlugin = function(options) { | |
var defaults = { | |
prop1 : 'value1', | |
prop2 : 'value2', | |
}; | |
var settings = (options) ? $.extend({},defaults,options) : defaults; |
NewerOlder