// http://jquery14.com/day-07/jquery-1-4-hawtness-2-with-paul-irish /*d8b .d88888b. d888 d8888 Y8P d88P" "Y88b d8888 d8P888 888 888 888 d8P 888 8888 888 888 888 888 .d88b. 888d888 888 888 888 d8P 888 "888 888 888 888 888 d8P Y8b 888P" 888 888 888 d88 888 888 888 Y8b 888 888 888 88888888 888 888 888 888 8888888888 888 Y88b.Y8b88P Y88b 888 Y8b. 888 Y88b 888 888 d8b 888 888 "Y888888" "Y88888 "Y8888 888 "Y88888 8888888 Y8P 888 888 Y8b 888 d88P Y8b d88P 888P" "Y88P" 888 888 888 888 888 888 888 888 888 8888888888 8888b. 888 888 888 888888 88888b. .d88b. .d8888b .d8888b 888 888 "88b 888 888 888 888 888 "88b d8P Y8b 88K 88K 888 888 .d888888 888 888 888 888 888 888 88888888 "Y8888b. "Y8888b. 888 888 888 888 Y88b 888 d88P Y88b. 888 888 Y8b. X88 X88 888 888 "Y888888 "Y8888888P" "Y888 888 888 "Y8888 88888P' 88888P' #2: setterMethods(function(i,val){ ... }) and animation db d8b db d888888b d888888b db db 88 I8I 88 `88' `~~88~~' 88 88 88 I8I 88 88 88 88ooo88 Y8 I8I 88 88 88 88~~~88 `8b d8'8b d8' .88. 88 88 88 `8b8' `8d8' Y888888P YP YP YP d8888b. .d8b. db db db d888888b d8888b. d888888b .d8888. db db 88 `8D d8' `8b 88 88 88 `88' 88 `8D `88' 88' YP 88 88 88oodD' 88ooo88 88 88 88 88 88oobY' 88 `8bo. 88ooo88 88~~~ 88~~~88 88 88 88 88 88`8b 88 `Y8b. 88~~~88 88 88 88 88b d88 88booo. .88. 88 `88. .88. db 8D 88 88 88 YP YP ~Y8888P' Y88888P Y888888P 88 YD Y888888P `8888Y' YP YP */ /* . . .o8 .o8 .oooo.o .ooooo. .o888oo .o888oo .ooooo. oooo d8b d88( "8 d88' `88b 888 888 d88' `88b `888""8P `"Y88b. 888ooo888 888 888 888ooo888 888 o. )88b 888 .o 888 . 888 . 888 .o 888 8""888P' `Y8bod8P' "888" "888" `Y8bod8P' d888b . oooo .o8 .o8 `888 "888 ooo. .oo. .oo. .ooooo. .o888oo 888 .oo. .ooooo. .oooo888 .oooo.o `888P"Y88bP"Y88b d88' `88b 888 888P"Y88b d88' `88b d88' `888 d88( "8 888 888 888 888ooo888 888 888 888 888 888 888 888 `"Y88b. 888 888 888 888 .o 888 . 888 888 888 888 888 888 o. )88b o888o o888o o888o `Y8bod8P' "888" o888o o888o `Y8bod8P' `Y8bod88P" 8""888P' http://github.com/jquery/jquery/commit/600d3145386a9dca8143918cc3e339168f886a63#comments */ // turn <a href="brandnew.html"> to <a href="brandnew.html?0923840293"> // old 'n busted $'a#foo'eachfunction var newhref = $thisattr'href' + '?' + ; $thisattr'href'newhref ; ; // 1.3 weaksauce $'a#foo'attr'href'function return $thisattr'href' + '?' + ; ; // new hotness $'a#foo'attr'href'functionihref return href + '?' + ; ; // want some more? // fix doublefloat margin bug for IE6.. sorta. $floatedElemscss'leftMargin'functionimargin return parseFloatmargin/2 +'px'; ; // 'some thing' -> 'another thing'... 'some one' -> 'another one' $'span'text functionitext return textreplace /some (thing|one)/gi'another $1' ; ; // style ampersands with pretty font $'a'htmlfunctionihtml return htmlreplace /&/gi'<span class="amp">&</span>'; ; // politeness plugin return thistextfunctionindexvalue return "Please, " + value + ' — and thank you.'; ; $'li.commands'bePolite; // supported methods with current value // .css(), .attr(), .val(), .html(), .text(), .append(), .prepend(), .offset(), .addClass(), .removeClass(), and .toggleClass(). // function only, no currrent value // .before(), .after(), .replaceWith(), .wrap(), .wrapInner() // random colors!! // function but no value passed in $'div.random'css'backgroundColor'function return '#'+MathfloorMathrandom*16777215toString16; css'color'function return '#' + Number'0x'+colorsubstr1toString10 > 0xffffff/2 ? '000' : 'fff'; return contrast $thiscss'backgroundColor' ; ; /* o8o . o8o `"' .o8 `"' .oooo. ooo. .oo. oooo ooo. .oo. .oo. .oooo. .o888oo oooo .ooooo. ooo. .oo. `P )88b `888P"Y88b `888 `888P"Y88bP"Y88b `P )88b 888 `888 d88' `88b `888P"Y88b .oP"888 888 888 888 888 888 888 .oP"888 888 888 888 888 888 888 d8( 888 888 888 888 888 888 888 d8( 888 888 . 888 888 888 888 888 `Y888""8o o888o o888o o888o o888o o888o o888o `Y888""8o "888" o888o `Y8bod8P' o888o o888o */ // per property easing // http://james.padolsey.com/javascript/easing-in-jquery-1-4a2/ jQueryelemanimate left: 500'swing' top: 200'easeOutBounce' ; // http://james.padolsey.com/demos/jquery/easing/easing-jq14.html jQueryelemanimate left: 500 top: 200 specialEasing: left: 'swing' top: 'easeOutBounce' ; jQueryelemanimate x: 100'easeInQuad' y: 100'easeOutBounce' z: 100 1000'linear'; // go crazy $"div"animate width: "+=200px""swing" height: "+=50px""linear" 2000function $thisafter"<div>Animation complete.</div>"; ; /* .o8 oooo "888 `888 .oooo888 .ooooo. 888 .oooo. oooo ooo d88' `888 d88' `88b 888 `P )88b `88. .8' 888 888 888ooo888 888 .oP"888 `88..8' 888 888 888 .o 888 d8( 888 `888' `Y8bod88P" `Y8bod8P' o888o `Y888""8o .8' .o..P' `Y8P' */ // delay $noticefadeIndelay3000fadeOut // troll mode. $'img.thumbnail'clickfunction $thisdelay isTroll ? 5000 : 0 dialog'open'; /* oooo .oooooo. `888 d8P' `Y8b .ooooo. 888 .ooooo. .oooo. oooo d8b 888 888 oooo oooo .ooooo. oooo oooo .ooooo. d88' `"Y8 888 d88' `88b `P )88b `888""8P 888 888 `888 `888 d88' `88b `888 `888 d88' `88b 888 888 888ooo888 .oP"888 888 888 888 888 888 888ooo888 888 888 888ooo888 888 .o8 888 888 .o d8( 888 888 `88b d88b 888 888 888 .o 888 888 888 .o `Y8bod8P' o888o `Y8bod8P' `Y888""8o d888b `Y8bood8P'Ybd' `V88V"V8P' `Y8bod8P' `V88V"V8P' `Y8bod8P' */ // DEMO TIME!! // http://api.jquery.com/clearQueue/ d8b 888 Y8P 888 888 d8888b d88b 88888bd88b 888 88888b d88b d8888b d88b d88b 88888b 888 d88P" d88""88b 888 "888 "88b 888 888 "88b d88P"88b 88K d88""88b d88""88b 888 "88b 888 888 888 888 888 888 888 888 888 888 888 888 "Y8888b. 888 888 888 888 888 888 Y8P Y88b. Y88..88P 888 888 888 888 888 888 Y88b 888 X88 Y88..88P Y88..88P 888 888 " "Y8888P "Y88P" 888 888 888 888 888 888 "Y88888 88888P' "Y88P" "Y88P" 888 888 888 888 Y8b d88P "Y88P" // events! bind(). proxy(). special // traversing and manipulation // *ajax!* // utilities // what may break in 1.4 for you.'
