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($){ | |
$.extend($, { | |
// expects n == positive; returns 0 to n exclusive | |
rand: function(n){ | |
return Math.floor(n * Math.random()); | |
} | |
}) | |
})(jQuery); |
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($){ | |
$.extend($.fn, { | |
subscribe: function(el, evt, cb){ | |
var self = this; | |
if(!self.length) { return self; } | |
el.bind(evt, function(){ cb.apply(self, arguments); }); | |
return self; | |
} | |
}); | |
})(jQuery); |
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($){ | |
$.overlay = (function(){ | |
var f = function(params){ | |
var opts = $.extend({}, f.defaults, params), | |
$window = $(window), | |
winHeight = $window.height(), | |
$elem = $("<div>").css(opts.css); |
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
/* Was getzidx.js */ | |
/* Now a custom selector, gives you more flexibility */ | |
/* Use ala: $("*:z-indexed"); */ | |
(function($){ | |
$.extend( | |
$.expr[":"], { "z-indexed": function(e){ return $(e).css("zIndex") != "auto" } } | |
); | |
})(jQuery); |
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.watermark = function(){ | |
return this.each(function(){ | |
var $this = $(this), | |
tag = this.nodeName.toLowerCase(), | |
txt; | |
if(tag == "input" || tag == "textarea"){ | |
txt = $this.val(); | |
$this.bind("focus.watermark", function(){ | |
if($this.val() == txt){ $this.val(""); } |
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
// Simple JavaScript Templating | |
// John Resig - http://ejohn.org/ - MIT Licensed | |
(function(){ | |
var cache = {}; | |
this.tmpl = function tmpl(str, data){ | |
// Figure out if we're getting a template, or if we need to | |
// load the template - and be sure to cache the result. | |
var fn = !/\W/.test(str) ? | |
cache[str] = cache[str] || |
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($){ | |
// silly shortcut to get/set opacity | |
$.extend($.fn, { | |
opacity: function(n){ | |
return n ? this.css("opacity",n) : this.css("opacity"); | |
} | |
}); | |
})(jQuery); |
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
// Triggers "updated.maxlength" event when updated (post-keyup) | |
// evt sends: { maxlength: Number, remaining: Number } | |
(function($){ | |
var f = function(num){ | |
return this.each(function(){ | |
var $this = $(this), | |
chars = num || $this.attr("data-maxlength") || f.num, | |
remaining = function(){ return chars - $this.val().length }; | |
if(this.nodeName.toLowerCase() == "textarea"){ |
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($){ | |
// check if arg is a string | |
$.extend($, { | |
isString: function(s){ | |
return (typeof s == "string" || s instanceof String) | |
} | |
}); | |
})(jQuery); |
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
// Simple YQL helper: | |
// $.yql({q: strQuery, callback: fnCallback }); | |
(function($){ | |
$.yql = function(o){ | |
var params = $.extend({}, $.yql.options, o), | |
q = encodeURIComponent(o.query.toLowerCase()), | |
url = $.yql._url + "?q=" + q + "&format=json&callback=?"; | |
$.getJSON(url, params.callback) |
OlderNewer