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 photos = $("div.photo"); | |
$('div.slides a').click(function() { | |
var rel = $(this).attr('rel'); | |
photos.fadeOut(800,function() { | |
$('#'+rel).fadeIn(800); | |
}); | |
return 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() { | |
function live(selector, context, event, data, handler){ | |
jQuery.each(event.split(/\s+/), function(){ | |
jQuery({length:0, selector:selector, context:context}).live(this.toString(), data, handler); | |
}); | |
} | |
function die(selector, context, event, handler){ | |
jQuery.each(event.split(/\s+/), function(){ |
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
// HTML structure | |
for( var i = 0; i < AMOUNTOFCOLORS; i++ ) { | |
$('#colors').append('<li> \ | |
<input style="width: 1em; height: 1em;" class="clickableColor" /> \ | |
</li>'); | |
} | |
$('.clickableColor :first').addClass('activeColor'); | |
// shortcuts for changing color. XXX: selector fails! |
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.pollute = function (pollution) { | |
var pollutants = { | |
air:"SMOAK", | |
water:"OIL", | |
noise:"BLAH" | |
} | |
function emit(type) { |
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
// controller that manages our UX indicators | |
var indicatorController = {}; | |
(function(c) { | |
var classes = "state-insecure state-good state-caution state-fixing state-inprogress"; | |
// helpers for changing scanner state | |
var showScannerDomAsScanning = function(dom) { | |
dom.removeClass(classes).addClass("state-inprogress") | |
}; | |
var showScannerDomAsGood = function(dom) { | |
dom.removeClass(classes).addClass("state-good"); |
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 vid = $('#product_video').toggle( | |
function() { | |
$(this).show(); | |
}, function () { | |
$(this).hide(); | |
} | |
); | |
$('#product_video_link').toggle( |
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
$('.inp input').keyup(function(e) { | |
up = $(this).val(); | |
if ((+up) > (+max)) { // +val converts string to number | |
alert('too high '+e.which); | |
return 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
// 1: how could you rewrite the following to make it shorter? | |
// Naming methods with superfluous characters that are not descriptive is a waste of time, so I would shorten the method names. | |
if (foo) { | |
bar.something(el); | |
} else { | |
bar.somethingElse(el); | |
} | |
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
// A RequireJS module that wraps the jQuery UI Dialog in a jQuery.Deferred | |
// Advantages: | |
// Reuses a single DOM element for all the dialogs | |
// Keeps the dialog out of the DOM when it is not in use | |
// A much more elegant interface for using custom modals and working with the user's resolution | |
define("bocoup.confirm",["jquery.ui.widget"],function(factory,position,dialog) { | |
var d = $("<div>"), | |
defaults = { | |
title:"Confirmation" |
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( window, document, undefined ){ | |
})( this, this.document ); | |
(function( global, undefined ){ | |
})( this ); | |
// miketaylr |
OlderNewer