Index: trunk/extensions/Tooltips/Tooltips.body.php |
— | — | @@ -0,0 +1,47 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class Tooltips { |
| 5 | + static function setupParserFunctions( $parser ) { |
| 6 | + $parser->setFunctionHook( |
| 7 | + 'tooltip', |
| 8 | + array( 'Tooltips', 'tooltip') |
| 9 | + ); |
| 10 | + |
| 11 | + return true; |
| 12 | + } |
| 13 | + |
| 14 | + static function tooltip( $parser, $tooltip = null, $text = null ) { |
| 15 | + if ( !$text ) { |
| 16 | + return; |
| 17 | + } |
| 18 | + |
| 19 | + $tooltip = Xml::tags( 'span', |
| 20 | + array( 'style' => 'display: none', 'class' => 'mw-tooltip' ), |
| 21 | + $tooltip ); |
| 22 | + |
| 23 | + $text .= "\n$tooltip"; |
| 24 | + $text = Xml::tags( 'span', |
| 25 | + array( 'class' => 'mw-tooltip-text' ), $text ); |
| 26 | + |
| 27 | + // Script for hover behaviour hacked in by Andrew Garrett, 2010-08-09 |
| 28 | + static $scriptDone = false; |
| 29 | + if ( ! $scriptDone ) { |
| 30 | + $scriptDone = true; |
| 31 | + global $wgOut, $IP, $wgScriptPath; |
| 32 | + $output = $parser->getOutput(); |
| 33 | + |
| 34 | + // Figure out the web-accessible path to the extension. |
| 35 | + $dir = dirname( __FILE__ ); |
| 36 | + if ( strpos( $dir, $IP ) === 0 ) { |
| 37 | + $dir = substr( $dir, strlen($IP) ); |
| 38 | + $dir = $wgScriptPath . $dir; |
| 39 | + |
| 40 | + $output->addHeadItem( "<link rel=\"stylesheet\" type=\"text/css\" href=\"$dir/jquery-tooltip/jquery.tooltip.css\"/>" ); |
| 41 | + $output->addHeadItem( Html::linkedScript( "$dir/jquery-tooltip/jquery.tooltip.pack.js" ) ); |
| 42 | + $output->addHeadItem( Html::linkedScript( "$dir/hover.js" ) ); |
| 43 | + } |
| 44 | + } |
| 45 | + |
| 46 | + return $text; |
| 47 | + } |
| 48 | +} |
Index: trunk/extensions/Tooltips/Tooltips.i18n.php |
— | — | @@ -0,0 +1,15 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +// Internationalisation file for Tooltips extension |
| 5 | + |
| 6 | +$messages = array(); |
| 7 | + |
| 8 | +$messages['en'] = array( |
| 9 | + 'tooltips-desc' => 'Adds the #tooltips parser function', |
| 10 | +); |
| 11 | + |
| 12 | +$magicWords = array(); |
| 13 | + |
| 14 | +$magicWords['en'] = array( |
| 15 | + 'tooltip' => array( 0, 'tooltip' ), |
| 16 | +); |
Index: trunk/extensions/Tooltips/Tooltips.php |
— | — | @@ -0,0 +1,20 @@ |
| 2 | +<?php |
| 3 | +// Tooltips extension |
| 4 | +// Adds the #tooltip parser function, which adds a tooltip to the enclosed text. |
| 5 | +// Andrew Garrett, September 2010 |
| 6 | + |
| 7 | +$wgExtensionCredits['other'][] = array( |
| 8 | + 'path' => __FILE__, |
| 9 | + 'name' => 'Tooltips', |
| 10 | + 'version' => '1.0', |
| 11 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:Tooltips', |
| 12 | + 'author' => array( 'Andrew Garrett' ), |
| 13 | + 'descriptionmsg' => 'tooltips-desc', |
| 14 | +); |
| 15 | + |
| 16 | +$wgExtensionMessagesFiles['Tooltips'] = dirname(__FILE__) . "/Tooltips.i18n.php"; |
| 17 | + |
| 18 | +$wgAutoloadClasses['Tooltips'] = dirname( __FILE__ ) . "/Tooltips.body.php"; |
| 19 | + |
| 20 | +// Parser Function Setup |
| 21 | +$wgHooks['ParserFirstCallInit'][] = 'Tooltips::setupParserFunctions'; |
Index: trunk/extensions/Tooltips/jquery-tooltip/jquery.tooltip.css |
— | — | @@ -0,0 +1,9 @@ |
| 2 | +#tooltip {
|
| 3 | + position: absolute;
|
| 4 | + z-index: 3000;
|
| 5 | + border: 1px solid #111;
|
| 6 | + background-color: #eee;
|
| 7 | + padding: 5px; |
| 8 | + opacity: 0.85; |
| 9 | +}
|
| 10 | +#tooltip h3, #tooltip div { margin: 0; }
|
Index: trunk/extensions/Tooltips/jquery-tooltip/jquery.tooltip.pack.js |
— | — | @@ -0,0 +1,15 @@ |
| 2 | +/* |
| 3 | + * jQuery Tooltip plugin 1.3 |
| 4 | + * |
| 5 | + * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ |
| 6 | + * http://docs.jquery.com/Plugins/Tooltip |
| 7 | + * |
| 8 | + * Copyright (c) 2006 - 2008 Jörn Zaefferer |
| 9 | + * |
| 10 | + * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $ |
| 11 | + * |
| 12 | + * Dual licensed under the MIT and GPL licenses: |
| 13 | + * http://www.opensource.org/licenses/mit-license.php |
| 14 | + * http://www.gnu.org/licenses/gpl.html |
| 15 | + */ |
| 16 | +eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';(8($){j e={},9,m,B,A=$.2u.2g&&/29\\s(5\\.5|6\\.)/.1M(1H.2t),M=12;$.k={w:12,1h:{Z:25,r:12,1d:19,X:"",G:15,E:15,16:"k"},2s:8(){$.k.w=!$.k.w}};$.N.1v({k:8(a){a=$.1v({},$.k.1h,a);1q(a);g 2.F(8(){$.1j(2,"k",a);2.11=e.3.n("1g");2.13=2.m;$(2).24("m");2.22=""}).21(1e).1U(q).1S(q)},H:A?8(){g 2.F(8(){j b=$(2).n(\'Y\');4(b.1J(/^o\\(["\']?(.*\\.1I)["\']?\\)$/i)){b=1F.$1;$(2).n({\'Y\':\'1D\',\'1B\':"2r:2q.2m.2l(2j=19, 2i=2h, 1p=\'"+b+"\')"}).F(8(){j a=$(2).n(\'1o\');4(a!=\'2f\'&&a!=\'1u\')$(2).n(\'1o\',\'1u\')})}})}:8(){g 2},1l:A?8(){g 2.F(8(){$(2).n({\'1B\':\'\',Y:\'\'})})}:8(){g 2},1x:8(){g 2.F(8(){$(2)[$(2).D()?"l":"q"]()})},o:8(){g 2.1k(\'28\')||2.1k(\'1p\')}});8 1q(a){4(e.3)g;e.3=$(\'<t 16="\'+a.16+\'"><10></10><t 1i="f"></t><t 1i="o"></t></t>\').27(K.f).q();4($.N.L)e.3.L();e.m=$(\'10\',e.3);e.f=$(\'t.f\',e.3);e.o=$(\'t.o\',e.3)}8 7(a){g $.1j(a,"k")}8 1f(a){4(7(2).Z)B=26(l,7(2).Z);p l();M=!!7(2).M;$(K.f).23(\'W\',u);u(a)}8 1e(){4($.k.w||2==9||(!2.13&&!7(2).U))g;9=2;m=2.13;4(7(2).U){e.m.q();j a=7(2).U.1Z(2);4(a.1Y||a.1V){e.f.1c().T(a)}p{e.f.D(a)}e.f.l()}p 4(7(2).18){j b=m.1T(7(2).18);e.m.D(b.1R()).l();e.f.1c();1Q(j i=0,R;(R=b[i]);i++){4(i>0)e.f.T("<1P/>");e.f.T(R)}e.f.1x()}p{e.m.D(m).l();e.f.q()}4(7(2).1d&&$(2).o())e.o.D($(2).o().1O(\'1N://\',\'\')).l();p e.o.q();e.3.P(7(2).X);4(7(2).H)e.3.H();1f.1L(2,1K)}8 l(){B=S;4((!A||!$.N.L)&&7(9).r){4(e.3.I(":17"))e.3.Q().l().O(7(9).r,9.11);p e.3.I(\':1a\')?e.3.O(7(9).r,9.11):e.3.1G(7(9).r)}p{e.3.l()}u()}8 u(c){4($.k.w)g;4(c&&c.1W.1X=="1E"){g}4(!M&&e.3.I(":1a")){$(K.f).1b(\'W\',u)}4(9==S){$(K.f).1b(\'W\',u);g}e.3.V("z-14").V("z-1A");j b=e.3[0].1z;j a=e.3[0].1y;4(c){b=c.2o+7(9).E;a=c.2n+7(9).G;j d=\'1w\';4(7(9).2k){d=$(C).1r()-b;b=\'1w\'}e.3.n({E:b,14:d,G:a})}j v=z(),h=e.3[0];4(v.x+v.1s<h.1z+h.1n){b-=h.1n+20+7(9).E;e.3.n({E:b+\'1C\'}).P("z-14")}4(v.y+v.1t<h.1y+h.1m){a-=h.1m+20+7(9).G;e.3.n({G:a+\'1C\'}).P("z-1A")}}8 z(){g{x:$(C).2e(),y:$(C).2d(),1s:$(C).1r(),1t:$(C).2p()}}8 q(a){4($.k.w)g;4(B)2c(B);9=S;j b=7(2);8 J(){e.3.V(b.X).q().n("1g","")}4((!A||!$.N.L)&&b.r){4(e.3.I(\':17\'))e.3.Q().O(b.r,0,J);p e.3.Q().2b(b.r,J)}p J();4(7(2).H)e.3.1l()}})(2a);',62,155,'||this|parent|if|||settings|function|current||||||body|return|||var|tooltip|show|title|css|url|else|hide|fade||div|update||blocked|||viewport|IE|tID|window|html|left|each|top|fixPNG|is|complete|document|bgiframe|track|fn|fadeTo|addClass|stop|part|null|append|bodyHandler|removeClass|mousemove|extraClass|backgroundImage|delay|h3|tOpacity|false|tooltipText|right||id|animated|showBody|true|visible|unbind|empty|showURL|save|handle|opacity|defaults|class|data|attr|unfixPNG|offsetHeight|offsetWidth|position|src|createHelper|width|cx|cy|relative|extend|auto|hideWhenEmpty|offsetTop|offsetLeft|bottom|filter|px|none|OPTION|RegExp|fadeIn|navigator|png|match|arguments|apply|test|http|replace|br|for|shift|click|split|mouseout|jquery|target|tagName|nodeType|call||mouseover|alt|bind|removeAttr|200|setTimeout|appendTo|href|MSIE|jQuery|fadeOut|clearTimeout|scrollTop|scrollLeft|absolute|msie|crop|sizingMethod|enabled|positionLeft|AlphaImageLoader|Microsoft|pageY|pageX|height|DXImageTransform|progid|block|userAgent|browser'.split('|'),0,{})) |
\ No newline at end of file |
Index: trunk/extensions/Tooltips/jquery-tooltip/jquery.tooltip.js |
— | — | @@ -0,0 +1,294 @@ |
| 2 | +/* |
| 3 | + * jQuery Tooltip plugin 1.3 |
| 4 | + * |
| 5 | + * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ |
| 6 | + * http://docs.jquery.com/Plugins/Tooltip |
| 7 | + * |
| 8 | + * Copyright (c) 2006 - 2008 Jörn Zaefferer |
| 9 | + * |
| 10 | + * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $ |
| 11 | + * |
| 12 | + * Dual licensed under the MIT and GPL licenses: |
| 13 | + * http://www.opensource.org/licenses/mit-license.php |
| 14 | + * http://www.gnu.org/licenses/gpl.html |
| 15 | + */ |
| 16 | + |
| 17 | +;(function($) { |
| 18 | + |
| 19 | + // the tooltip element |
| 20 | + var helper = {}, |
| 21 | + // the current tooltipped element |
| 22 | + current, |
| 23 | + // the title of the current element, used for restoring |
| 24 | + title, |
| 25 | + // timeout id for delayed tooltips |
| 26 | + tID, |
| 27 | + // IE 5.5 or 6 |
| 28 | + IE = $.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent), |
| 29 | + // flag for mouse tracking |
| 30 | + track = false; |
| 31 | + |
| 32 | + $.tooltip = { |
| 33 | + blocked: false, |
| 34 | + defaults: { |
| 35 | + delay: 200, |
| 36 | + fade: false, |
| 37 | + showURL: true, |
| 38 | + extraClass: "", |
| 39 | + top: 15, |
| 40 | + left: 15, |
| 41 | + id: "tooltip" |
| 42 | + }, |
| 43 | + block: function() { |
| 44 | + $.tooltip.blocked = !$.tooltip.blocked; |
| 45 | + } |
| 46 | + }; |
| 47 | + |
| 48 | + $.fn.extend({ |
| 49 | + tooltip: function(settings) { |
| 50 | + settings = $.extend({}, $.tooltip.defaults, settings); |
| 51 | + createHelper(settings); |
| 52 | + return this.each(function() { |
| 53 | + $.data(this, "tooltip", settings); |
| 54 | + this.tOpacity = helper.parent.css("opacity"); |
| 55 | + // copy tooltip into its own expando and remove the title |
| 56 | + this.tooltipText = this.title; |
| 57 | + $(this).removeAttr("title"); |
| 58 | + // also remove alt attribute to prevent default tooltip in IE |
| 59 | + this.alt = ""; |
| 60 | + }) |
| 61 | + .mouseover(save) |
| 62 | + .mouseout(hide) |
| 63 | + .click(hide); |
| 64 | + }, |
| 65 | + fixPNG: IE ? function() { |
| 66 | + return this.each(function () { |
| 67 | + var image = $(this).css('backgroundImage'); |
| 68 | + if (image.match(/^url\(["']?(.*\.png)["']?\)$/i)) { |
| 69 | + image = RegExp.$1; |
| 70 | + $(this).css({ |
| 71 | + 'backgroundImage': 'none', |
| 72 | + 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')" |
| 73 | + }).each(function () { |
| 74 | + var position = $(this).css('position'); |
| 75 | + if (position != 'absolute' && position != 'relative') |
| 76 | + $(this).css('position', 'relative'); |
| 77 | + }); |
| 78 | + } |
| 79 | + }); |
| 80 | + } : function() { return this; }, |
| 81 | + unfixPNG: IE ? function() { |
| 82 | + return this.each(function () { |
| 83 | + $(this).css({'filter': '', backgroundImage: ''}); |
| 84 | + }); |
| 85 | + } : function() { return this; }, |
| 86 | + hideWhenEmpty: function() { |
| 87 | + return this.each(function() { |
| 88 | + $(this)[ $(this).html() ? "show" : "hide" ](); |
| 89 | + }); |
| 90 | + }, |
| 91 | + url: function() { |
| 92 | + return this.attr('href') || this.attr('src'); |
| 93 | + } |
| 94 | + }); |
| 95 | + |
| 96 | + function createHelper(settings) { |
| 97 | + // there can be only one tooltip helper |
| 98 | + if( helper.parent ) |
| 99 | + return; |
| 100 | + // create the helper, h3 for title, div for url |
| 101 | + helper.parent = $('<div id="' + settings.id + '"><h3></h3><div class="body"></div><div class="url"></div></div>') |
| 102 | + // add to document |
| 103 | + .appendTo(document.body) |
| 104 | + // hide it at first |
| 105 | + .hide(); |
| 106 | + |
| 107 | + // apply bgiframe if available |
| 108 | + if ( $.fn.bgiframe ) |
| 109 | + helper.parent.bgiframe(); |
| 110 | + |
| 111 | + // save references to title and url elements |
| 112 | + helper.title = $('h3', helper.parent); |
| 113 | + helper.body = $('div.body', helper.parent); |
| 114 | + helper.url = $('div.url', helper.parent); |
| 115 | + } |
| 116 | + |
| 117 | + function settings(element) { |
| 118 | + return $.data(element, "tooltip"); |
| 119 | + } |
| 120 | + |
| 121 | + // main event handler to start showing tooltips |
| 122 | + function handle(event) { |
| 123 | + // show helper, either with timeout or on instant |
| 124 | + if( settings(this).delay ) |
| 125 | + tID = setTimeout(show, settings(this).delay); |
| 126 | + else |
| 127 | + show(); |
| 128 | + |
| 129 | + // if selected, update the helper position when the mouse moves |
| 130 | + track = !!settings(this).track; |
| 131 | + $(document.body).bind('mousemove', update); |
| 132 | + |
| 133 | + // update at least once |
| 134 | + update(event); |
| 135 | + } |
| 136 | + |
| 137 | + // save elements title before the tooltip is displayed |
| 138 | + function save() { |
| 139 | + // if this is the current source, or it has no title (occurs with click event), stop |
| 140 | + if ( $.tooltip.blocked || this == current || (!this.tooltipText && !settings(this).bodyHandler) ) |
| 141 | + return; |
| 142 | + |
| 143 | + // save current |
| 144 | + current = this; |
| 145 | + title = this.tooltipText; |
| 146 | + |
| 147 | + if ( settings(this).bodyHandler ) { |
| 148 | + helper.title.hide(); |
| 149 | + var bodyContent = settings(this).bodyHandler.call(this); |
| 150 | + if (bodyContent.nodeType || bodyContent.jquery) { |
| 151 | + helper.body.empty().append(bodyContent) |
| 152 | + } else { |
| 153 | + helper.body.html( bodyContent ); |
| 154 | + } |
| 155 | + helper.body.show(); |
| 156 | + } else if ( settings(this).showBody ) { |
| 157 | + var parts = title.split(settings(this).showBody); |
| 158 | + helper.title.html(parts.shift()).show(); |
| 159 | + helper.body.empty(); |
| 160 | + for(var i = 0, part; (part = parts[i]); i++) { |
| 161 | + if(i > 0) |
| 162 | + helper.body.append("<br/>"); |
| 163 | + helper.body.append(part); |
| 164 | + } |
| 165 | + helper.body.hideWhenEmpty(); |
| 166 | + } else { |
| 167 | + helper.title.html(title).show(); |
| 168 | + helper.body.hide(); |
| 169 | + } |
| 170 | + |
| 171 | + // if element has href or src, add and show it, otherwise hide it |
| 172 | + if( settings(this).showURL && $(this).url() ) |
| 173 | + helper.url.html( $(this).url().replace('http://', '') ).show(); |
| 174 | + else |
| 175 | + helper.url.hide(); |
| 176 | + |
| 177 | + // add an optional class for this tip |
| 178 | + helper.parent.addClass(settings(this).extraClass); |
| 179 | + |
| 180 | + // fix PNG background for IE |
| 181 | + if (settings(this).fixPNG ) |
| 182 | + helper.parent.fixPNG(); |
| 183 | + |
| 184 | + handle.apply(this, arguments); |
| 185 | + } |
| 186 | + |
| 187 | + // delete timeout and show helper |
| 188 | + function show() { |
| 189 | + tID = null; |
| 190 | + if ((!IE || !$.fn.bgiframe) && settings(current).fade) { |
| 191 | + if (helper.parent.is(":animated")) |
| 192 | + helper.parent.stop().show().fadeTo(settings(current).fade, current.tOpacity); |
| 193 | + else |
| 194 | + helper.parent.is(':visible') ? helper.parent.fadeTo(settings(current).fade, current.tOpacity) : helper.parent.fadeIn(settings(current).fade); |
| 195 | + } else { |
| 196 | + helper.parent.show(); |
| 197 | + } |
| 198 | + update(); |
| 199 | + } |
| 200 | + |
| 201 | + /** |
| 202 | + * callback for mousemove |
| 203 | + * updates the helper position |
| 204 | + * removes itself when no current element |
| 205 | + */ |
| 206 | + function update(event) { |
| 207 | + if($.tooltip.blocked) |
| 208 | + return; |
| 209 | + |
| 210 | + if (event && event.target.tagName == "OPTION") { |
| 211 | + return; |
| 212 | + } |
| 213 | + |
| 214 | + // stop updating when tracking is disabled and the tooltip is visible |
| 215 | + if ( !track && helper.parent.is(":visible")) { |
| 216 | + $(document.body).unbind('mousemove', update) |
| 217 | + } |
| 218 | + |
| 219 | + // if no current element is available, remove this listener |
| 220 | + if( current == null ) { |
| 221 | + $(document.body).unbind('mousemove', update); |
| 222 | + return; |
| 223 | + } |
| 224 | + |
| 225 | + // remove position helper classes |
| 226 | + helper.parent.removeClass("viewport-right").removeClass("viewport-bottom"); |
| 227 | + |
| 228 | + var left = helper.parent[0].offsetLeft; |
| 229 | + var top = helper.parent[0].offsetTop; |
| 230 | + if (event) { |
| 231 | + // position the helper 15 pixel to bottom right, starting from mouse position |
| 232 | + left = event.pageX + settings(current).left; |
| 233 | + top = event.pageY + settings(current).top; |
| 234 | + var right='auto'; |
| 235 | + if (settings(current).positionLeft) { |
| 236 | + right = $(window).width() - left; |
| 237 | + left = 'auto'; |
| 238 | + } |
| 239 | + helper.parent.css({ |
| 240 | + left: left, |
| 241 | + right: right, |
| 242 | + top: top |
| 243 | + }); |
| 244 | + } |
| 245 | + |
| 246 | + var v = viewport(), |
| 247 | + h = helper.parent[0]; |
| 248 | + // check horizontal position |
| 249 | + if (v.x + v.cx < h.offsetLeft + h.offsetWidth) { |
| 250 | + left -= h.offsetWidth + 20 + settings(current).left; |
| 251 | + helper.parent.css({left: left + 'px'}).addClass("viewport-right"); |
| 252 | + } |
| 253 | + // check vertical position |
| 254 | + if (v.y + v.cy < h.offsetTop + h.offsetHeight) { |
| 255 | + top -= h.offsetHeight + 20 + settings(current).top; |
| 256 | + helper.parent.css({top: top + 'px'}).addClass("viewport-bottom"); |
| 257 | + } |
| 258 | + } |
| 259 | + |
| 260 | + function viewport() { |
| 261 | + return { |
| 262 | + x: $(window).scrollLeft(), |
| 263 | + y: $(window).scrollTop(), |
| 264 | + cx: $(window).width(), |
| 265 | + cy: $(window).height() |
| 266 | + }; |
| 267 | + } |
| 268 | + |
| 269 | + // hide helper and restore added classes and the title |
| 270 | + function hide(event) { |
| 271 | + if($.tooltip.blocked) |
| 272 | + return; |
| 273 | + // clear timeout if possible |
| 274 | + if(tID) |
| 275 | + clearTimeout(tID); |
| 276 | + // no more current element |
| 277 | + current = null; |
| 278 | + |
| 279 | + var tsettings = settings(this); |
| 280 | + function complete() { |
| 281 | + helper.parent.removeClass( tsettings.extraClass ).hide().css("opacity", ""); |
| 282 | + } |
| 283 | + if ((!IE || !$.fn.bgiframe) && tsettings.fade) { |
| 284 | + if (helper.parent.is(':animated')) |
| 285 | + helper.parent.stop().fadeTo(tsettings.fade, 0, complete); |
| 286 | + else |
| 287 | + helper.parent.stop().fadeOut(tsettings.fade, complete); |
| 288 | + } else |
| 289 | + complete(); |
| 290 | + |
| 291 | + if( settings(this).fixPNG ) |
| 292 | + helper.parent.unfixPNG(); |
| 293 | + } |
| 294 | + |
| 295 | +})(jQuery); |
Index: trunk/extensions/Tooltips/jquery-tooltip/demo/chili-1.7.pack.js |
— | — | @@ -0,0 +1 @@ |
| 2 | +eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('8={3b:"1.6",2o:"1B.1Y,1B.23,1B.2e",2i:"",2H:1a,12:"",2C:1a,Z:"",2a:\'<H V="$0">$$</H>\',R:"&#F;",1j:"&#F;&#F;&#F;&#F;",1f:"&#F;<1W/>",3c:5(){9 $(y).39("1k")[0]},I:{},N:{}};(5($){$(5(){5 1J(l,a){5 2I(A,h){4 3=(1v h.3=="1h")?h.3:h.3.1w;k.1m({A:A,3:"("+3+")",u:1+(3.c(/\\\\./g,"%").c(/\\[.*?\\]/g,"%").3a(/\\((?!\\?)/g)||[]).u,z:(h.z)?h.z:8.2a})}5 2z(){4 1E=0;4 1x=x 2A;Q(4 i=0;i<k.u;i++){4 3=k[i].3;3=3.c(/\\\\\\\\|\\\\(\\d+)/g,5(m,1F){9!1F?m:"\\\\"+(1E+1+1t(1F))});1x.1m(3);1E+=k[i].u}4 1w=1x.3d("|");9 x 1u(1w,(a.3g)?"2j":"g")}5 1S(o){9 o.c(/&/g,"&3h;").c(/</g,"&3e;")}5 1R(o){9 o.c(/ +/g,5(1X){9 1X.c(/ /g,R)})}5 G(o){o=1S(o);7(R){o=1R(o)}9 o}5 2m(2E){4 i=0;4 j=1;4 h;19(h=k[i++]){4 1b=D;7(1b[j]){4 1U=/(\\\\\\$)|(?:\\$\\$)|(?:\\$(\\d+))/g;4 z=h.z.c(1U,5(m,1V,K){4 3f=\'\';7(1V){9"$"}v 7(!K){9 G(1b[j])}v 7(K=="0"){9 h.A}v{9 G(1b[j+1t(K,10)])}});4 1A=D[D.u-2];4 2h=D[D.u-1];4 2G=2h.2v(11,1A);11=1A+2E.u;14+=G(2G)+z;9 z}v{j+=h.u}}}4 R=8.R;4 k=x 2A;Q(4 A 2r a.k){2I(A,a.k[A])}4 14="";4 11=0;l.c(2z(),2m);4 2y=l.2v(11,l.u);14+=G(2y);9 14}5 2B(X){7(!8.N[X]){4 Y=\'<Y 32="1p" 33="p/2u"\'+\' 30="\'+X+\'">\';8.N[X]=1H;7($.31.34){4 W=J.1L(Y);4 $W=$(W);$("2d").1O($W)}v{$("2d").1O(Y)}}}5 1q(e,a){4 l=e&&e.1g&&e.1g[0]&&e.1g[0].37;7(!l)l="";l=l.c(/\\r\\n?/g,"\\n");4 C=1J(l,a);7(8.1j){C=C.c(/\\t/g,8.1j)}7(8.1f){C=C.c(/\\n/g,8.1f)}$(e).38(C)}5 1o(q,13){4 1l={12:8.12,2x:q+".1d",Z:8.Z,2w:q+".2u"};4 B;7(13&&1v 13=="2l")B=$.35(1l,13);v B=1l;9{a:B.12+B.2x,1p:B.Z+B.2w}}7($.2q)$.2q({36:"2l.15"});4 2n=x 1u("\\\\b"+8.2i+"\\\\b","2j");4 1e=[];$(8.2o).2D(5(){4 e=y;4 1n=$(e).3i("V");7(!1n){9}4 q=$.3u(1n.c(2n,""));7(\'\'!=q){1e.1m(e);4 f=1o(q,e.15);7(8.2H||e.15){7(!8.N[f.a]){1D{8.N[f.a]=1H;$.3v(f.a,5(M){M.f=f.a;8.I[f.a]=M;7(8.2C){2B(f.1p)}$("."+q).2D(5(){4 f=1o(q,y.15);7(M.f==f.a){1q(y,M)}})})}1I(3s){3t("a 3w Q: "+q+\'@\'+3z)}}}v{4 a=8.I[f.a];7(a){1q(e,a)}}}});7(J.1i&&J.1i.29){5 22(p){7(\'\'==p){9""}1z{4 16=(x 3A()).2k()}19(p.3x(16)>-1);p=p.c(/\\<1W[^>]*?\\>/3y,16);4 e=J.1L(\'<1k>\');e.3l=p;p=e.3m.c(x 1u(16,"g"),\'\\r\\n\');9 p}4 T="";4 18=1G;$(1e).3j().G("1k").U("2c",5(){18=y}).U("1M",5(){7(18==y)T=J.1i.29().3k});$("3n").U("3q",5(){7(\'\'!=T){2p.3r.3o(\'3p\',22(T));2V.2R=1a}}).U("2c",5(){T=""}).U("1M",5(){18=1G})}})})(1Z);8.I["1Y.1d"]={k:{2M:{3:/\\/\\*[^*]*\\*+(?:[^\\/][^*]*\\*+)*\\//},25:{3:/\\<!--(?:.|\\n)*?--\\>/},2f:{3:/\\/\\/.*/},2P:{3:/2L|2T|2J|2O|2N|2X|2K|2Z|2U|2S|2W|2Y|2Q|51|c-50/},53:{3:/\\/[^\\/\\\\\\n]*(?:\\\\.[^\\/\\\\\\n]*)*\\/[52]*/},1h:{3:/(?:\\\'[^\\\'\\\\\\n]*(?:\\\\.[^\\\'\\\\\\n]*)*\\\')|(?:\\"[^\\"\\\\\\n]*(?:\\\\.[^\\"\\\\\\n]*)*\\")/},27:{3:/\\b[+-]?(?:\\d*\\.?\\d+|\\d+\\.?\\d*)(?:[1r][+-]?\\d+)?\\b/},4X:{3:/\\b(D|1N|1K|1I|2t|2s|4W|1z|v|1a|Q|5|7|2r|4Z|x|1G|9|1Q|y|1H|1D|1v|4|4Y|19|59)\\b/},1y:{3:/\\b(58|2k|2p|5b|5a|55|J|54|57|1t|56|4L|4K|4N|4M|4H|4G|4J)\\b/},1C:{3:/(?:\\<\\w+)|(?:\\>)|(?:\\<\\/\\w+\\>)|(?:\\/\\>)/},26:{3:/\\s+\\w+(?=\\s*=)/},20:{3:/([\\"\\\'])(?:(?:[^\\1\\\\\\r\\n]*?(?:\\1\\1|\\\\.))*[^\\1\\\\\\r\\n]*?)\\1/},21:{3:/&[\\w#]+?;/},4I:{3:/(\\$|1Z)/}}};8.I["23.1d"]={k:{25:{3:/\\<!--(?:.|\\n)*?--\\>/},1h:{3:/(?:\\\'[^\\\'\\\\\\n]*(?:\\\\.[^\\\'\\\\\\n]*)*\\\')|(?:\\"[^\\"\\\\\\n]*(?:\\\\.[^\\"\\\\\\n]*)*\\")/},27:{3:/\\b[+-]?(?:\\d*\\.?\\d+|\\d+\\.?\\d*)(?:[1r][+-]?\\d+)?\\b/},1C:{3:/(?:\\<\\w+)|(?:\\>)|(?:\\<\\/\\w+\\>)|(?:\\/\\>)/},26:{3:/\\s+\\w+(?=\\s*=)/},20:{3:/([\\"\\\'])(?:(?:[^\\1\\\\\\r\\n]*?(?:\\1\\1|\\\\.))*[^\\1\\\\\\r\\n]*?)\\1/},21:{3:/&[\\w#]+?;/}}};8.I["2e.1d"]={k:{4S:{3:/\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\//},2f:{3:/(?:\\/\\/.*)|(?:[^\\\\]\\#.*)/},4V:{3:/\\\'[^\\\'\\\\]*(?:\\\\.[^\\\'\\\\]*)*\\\'/},4U:{3:/\\"[^\\"\\\\]*(?:\\\\.[^\\"\\\\]*)*\\"/},4P:{3:/\\b(?:[4O][2b][1s][1s]|[4R][4Q][2b][1P]|[5c][5v][1s][5u][1P])\\b/},5x:{3:/\\b[+-]?(\\d*\\.?\\d+|\\d+\\.?\\d*)([1r][+-]?\\d+)?\\b/},5y:{3:/\\b(?:5z|5w(?:5A|5E(?:5F(?:17|1c)|5G(?:17|1c))|17|1T|5B|5C|5D(?:17|1T|1c)|1c)|P(?:5h(?:5k|5j)|5e(?:5d|5g(?:5f|5l)|5r|E(?:5t|5s)|5n(?:5m|5p)|L(?:3X|3W)|O(?:S|3Y(?:3T|3S|3V))|3U|S(?:44|47|46)|41))|40)\\b/},1y:{3:/(?:\\$43|\\$42|\\$3R|\\$3G|\\$3F|\\$3I|\\$3H|\\$3C|\\$3B|\\$3D)\\b/},28:{3:/\\b(?:3O|3N|3P|3K|3J|3M|3L|48|4v|1N|1K|1I|4u|V|4x|4w|2t|4r|2s|4q|1z|4t|v|4s|4D|4C|4F|4E|4z|4y|4B|4A|4p|4d|2F|2F|4g|Q|4f|5|1y|7|4a|4m|4l|4o|4i|4k|x|4j|4h|4n|4b|4c|49|4e|3Q|3E|9|45|1Q|y|3Z|1D|5o|5q|4|19|5i)\\b/},2g:{3:/\\$(\\w+)/,z:\'<H V="28">$</H><H V="2g">$1</H>\'},1C:{3:/(?:\\<\\?[24][4T][24])|(?:\\<\\?)|(?:\\?\\>)/}}}',62,353,'|||exp|var|function||if|ChiliBook|return|recipe||replace||el|path||step|||steps|ingredients|||str|text|recipeName||||length|else||new|this|replacement|stepName|settings|dish|arguments||160|filter|span|recipes|document|||recipeLoaded|required|||for|replaceSpace||insidePRE|bind|class|domLink|stylesheetPath|link|stylesheetFolder||lastIndex|recipeFolder|options|perfect|chili|newline|ERROR|downPRE|while|false|aux|WARNING|js|codes|replaceNewLine|childNodes|string|selection|replaceTab|pre|settingsDef|push|elClass|getPath|stylesheet|makeDish|eE|Ll|parseInt|RegExp|typeof|source|exps|global|do|offset|code|tag|try|prevLength|aNum|null|true|catch|cook|case|createElement|mouseup|break|append|Ee|switch|replaceSpaces|escapeHTML|NOTICE|pattern|escaped|br|spaces|mix|jQuery|avalue|entity|preformatted|xml|Pp|htcom|aname|numbers|keyword|createRange|defaultReplacement|Uu|mousedown|head|php|com|variable|input|elementClass|gi|valueOf|object|chef|selectClass|elementPath|window|metaobjects|in|default|continue|css|substring|stylesheetFile|recipeFile|lastUnmatched|knowHow|Array|checkCSS|stylesheetLoading|each|matched|extends|unmatched|recipeLoading|prepareStep|unblockUI|ajaxSubmit|silverlight|jscom|unblock|block|plugin|clearFields|returnValue|fieldValue|blockUI|formSerialize|event|resetForm|ajaxForm|clearForm|fieldSerialize|href|browser|rel|type|msie|extend|selector|data|html|next|match|version|getPRE|join|lt|bit|ignoreCase|amp|attr|parents|htmlText|innerHTML|innerText|body|setData|Text|copy|clipboardData|recipeNotAvailable|alert|trim|getJSON|unavailable|indexOf|ig|recipePath|Date|_SESSION|_SERVER|php_errormsg|require_once|_GET|_FILES|_REQUEST|_POST|__METHOD__|__LINE__|and|abstract|__FILE__|__CLASS__|__FUNCTION__|require|_ENV|END|CONT|PREFIX|START|OCALSTATEDIR|IBDIR|UTPUT_HANDLER_|throw|__COMPILER_HALT_OFFSET__|VERSION|_COOKIE|GLOBALS|API|static|YSCONFDIR|HLIB_SUFFIX|array|protected|implements|print|private|exit|public|foreach|final|or|isset|old_function|list|include_once|include|php_user_filter|interface|exception|die|declare|elseif|echo|cfunction|as|const|clone|endswitch|endif|eval|endwhile|enddeclare|empty|endforeach|endfor|isNaN|NaN|jquery|Infinity|clearTimeout|setTimeout|clearInterval|setInterval|Nn|value|Rr|Tt|mlcom|Hh|string2|string1|delete|keywords|void|instanceof|content|taconite|gim|regexp|escape|constructor|parseFloat|unescape|toString|with|prototype|element|Ff|BINDIR|HP_|PATH|CONFIG_FILE_|EAR_|xor|INSTALL_DIR|EXTENSION_DIR|SCAN_DIR|MAX|INT_|unset|SIZE|use|DATADIR|XTENSION_DIR|OL|Ss|Aa|E_|number|const1|DEFAULT_INCLUDE_PATH|ALL|PARSE|STRICT|USER_|CO|MPILE_|RE_'.split('|'),0,{}))
|
Index: trunk/extensions/Tooltips/jquery-tooltip/demo/formtip.html |
— | — | @@ -0,0 +1,86 @@ |
| 2 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 | +<html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | +<head> |
| 5 | +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> |
| 6 | +<title>jQuery Tooltip Plugin Demo</title> |
| 7 | +
|
| 8 | +<link rel="stylesheet" href="../jquery.formtip.css" />
|
| 9 | +<link rel="stylesheet" href="screen.css" />
|
| 10 | +<script src="../lib/jquery.js" type="text/javascript"></script>
|
| 11 | +<script src="../lib/jquery.bgiframe.js" type="text/javascript"></script>
|
| 12 | +<script src="../lib/jquery.dimensions.js" type="text/javascript"></script>
|
| 13 | +<script src="../lib/jquery.delegate.js" type="text/javascript"></script>
|
| 14 | +<script src="../jquery.formtip.js" type="text/javascript"></script>
|
| 15 | +
|
| 16 | +<script src="chili-1.7.pack.js" type="text/javascript"></script>
|
| 17 | + |
| 18 | +<script type="text/javascript"> |
| 19 | +$(function() { |
| 20 | + $("form:first").formtip(); |
| 21 | + $("form.test").formtip({ |
| 22 | + positionParent: function(element) { |
| 23 | + return element.parent(); |
| 24 | + }, |
| 25 | + left: -5 |
| 26 | + });
|
| 27 | +});
|
| 28 | +</script> |
| 29 | + |
| 30 | +<style type="text/css"> |
| 31 | +form.test div { |
| 32 | + width: 250px; |
| 33 | + border: 1px solid black; |
| 34 | + float: left; |
| 35 | + margin: 1em; |
| 36 | +} |
| 37 | +form.test p { |
| 38 | + border: 1px solid #999; |
| 39 | +} |
| 40 | +</style>
|
| 41 | +
|
| 42 | +</head> |
| 43 | +<body>
|
| 44 | +<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/">jQuery Tooltip Plugin</a> Demo</h1>
|
| 45 | +<div id="main"> |
| 46 | + <form> |
| 47 | + <fieldset id="set1"> |
| 48 | + <legend>Three elements with tooltips, default settings</legend> |
| 49 | + <a title="A tooltip with default settings, the href is displayed below the title" href="http://google.de">Link to google</a> |
| 50 | + <br/> |
| 51 | + <label title="A label with a title and default settings, no href here" for="text1">Input something please!</label> |
| 52 | + <br/> |
| 53 | + <input title="Note that the tooltip disappears when clicking the input elementthe input elementthe input element" type="text" value="Test" name="action" id="text1"/> |
| 54 | + |
| 55 | + <h3>Code</h3>
|
| 56 | + <pre><code class="mix">$('#set1 *').tooltip();</code></pre>
|
| 57 | + <input title="Another tooltip element I" type="text" value="Test"/>
|
| 58 | + </fieldset> |
| 59 | + </form> |
| 60 | + |
| 61 | + <form class="test"> |
| 62 | + <div> |
| 63 | + <p> |
| 64 | + <label>II</label><input title="Another tooltip element II" type="text" value="Test"/> |
| 65 | + </p> |
| 66 | + <p> |
| 67 | + <label>III</label><input title="Another tooltip element III" type="text" value="Test"/> |
| 68 | + </p> |
| 69 | + </div> |
| 70 | + <div style="width: 200px"> |
| 71 | + <input title="Another tooltip element IV" type="text" value="Test"/> |
| 72 | + <br/> |
| 73 | + <input type="text" value="Test"/> |
| 74 | + <br/> |
| 75 | + <input title="Another tooltip element VI" type="text" value="Test"/> |
| 76 | + </div> |
| 77 | + </form>
|
| 78 | +
|
| 79 | +</div> |
| 80 | +<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> |
| 81 | +</script> |
| 82 | +<script type="text/javascript"> |
| 83 | +_uacct = "UA-2623402-1"; |
| 84 | +urchinTracker(); |
| 85 | +</script>
|
| 86 | +</body> |
| 87 | +</html> |
\ No newline at end of file |
Index: trunk/extensions/Tooltips/jquery-tooltip/demo/shadow2-reverse.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/Tooltips/jquery-tooltip/demo/shadow2-reverse.png |
___________________________________________________________________ |
Added: svn:mime-type |
1 | 88 | + application/octet-stream |
Index: trunk/extensions/Tooltips/jquery-tooltip/demo/image.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/Tooltips/jquery-tooltip/demo/image.png |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 89 | + application/octet-stream |
Index: trunk/extensions/Tooltips/jquery-tooltip/demo/screen.css |
— | — | @@ -0,0 +1,102 @@ |
| 2 | +html, body, div, span, applet, object, iframe,
|
| 3 | +h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
| 4 | +a, abbr, acronym, address, big, cite, code,
|
| 5 | +del, dfn, em, font, img, ins, kbd, q, s, samp,
|
| 6 | +small, strike, strong, sub, sup, tt, var,
|
| 7 | +dl, dt, dd, ol, ul, li,
|
| 8 | +fieldset, form, label, legend,
|
| 9 | +table, caption, tbody, tfoot, thead, tr, th, td {
|
| 10 | + margin: 0;
|
| 11 | + padding: 0;
|
| 12 | + border: 0;
|
| 13 | + outline: 0;
|
| 14 | + font-weight: inherit;
|
| 15 | + font-style: inherit;
|
| 16 | + font-size: 100%;
|
| 17 | + font-family: inherit;
|
| 18 | + vertical-align: baseline;
|
| 19 | +}
|
| 20 | +fieldset {
|
| 21 | + border: 1px solid black; padding: 8px; margin: 8px 0;
|
| 22 | +}
|
| 23 | +/* remember to define focus styles! */
|
| 24 | +:focus {
|
| 25 | + outline: 0;
|
| 26 | +}
|
| 27 | +body {
|
| 28 | + line-height: 1;
|
| 29 | + color: black;
|
| 30 | + background: white;
|
| 31 | +}
|
| 32 | +
|
| 33 | +body, div { font-family: 'lucida grande', helvetica, verdana, arial, sans-serif }
|
| 34 | +body { margin: 0; padding: 0; font-size: small; color: #333 }
|
| 35 | +h1, h2 { font-family: 'trebuchet ms', verdana, arial; padding: 10px; margin: 0 }
|
| 36 | +h1 { font-size: large }
|
| 37 | +#main { padding: 1em; }
|
| 38 | +#banner { padding: 15px; background-color: #06b; color: white; font-size: large; border-bottom: 1px solid #ccc;
|
| 39 | + background: url(bg.gif) repeat-x; text-align: center }
|
| 40 | +#banner a { color: white; }
|
| 41 | +legend { font-weight: bold; }
|
| 42 | +
|
| 43 | +button { padding: 0 6px; margin: 0; }
|
| 44 | +
|
| 45 | +pre, code { white-space: pre; font-family: "Courier New"; }
|
| 46 | +pre { margin: 8px 0; }
|
| 47 | +h3 {
|
| 48 | + font-size: 110%;
|
| 49 | + font-weight: bold;
|
| 50 | + margin: .2em 0 .5em 0;
|
| 51 | +}
|
| 52 | +p { margin: 1em 0; }
|
| 53 | +strong { font-weight: bolder; }
|
| 54 | +em { font-style: italic; }
|
| 55 | +
|
| 56 | +.jscom, .mix htcom { color: #4040c2; }
|
| 57 | +.com { color: green; }
|
| 58 | +.regexp { color: maroon; }
|
| 59 | +.string { color: teal; }
|
| 60 | +.keywords { color: blue; }
|
| 61 | +.global { color: #008; }
|
| 62 | +.numbers { color: #880; }
|
| 63 | +.comm { color: green; }
|
| 64 | +.tag { color: blue; }
|
| 65 | +.entity { color: blue; }
|
| 66 | +.string { color: teal; }
|
| 67 | +.aname { color: maroon; }
|
| 68 | +.avalue { color: maroon; }
|
| 69 | +.jquery { color: #00a; }
|
| 70 | +.plugin { color: red; }
|
| 71 | +
|
| 72 | +#tooltip.pretty {
|
| 73 | + font-family: Arial;
|
| 74 | + border: none;
|
| 75 | + width: 210px;
|
| 76 | + padding:20px;
|
| 77 | + height: 135px;
|
| 78 | + opacity: 0.8;
|
| 79 | + background: url('shadow.png');
|
| 80 | +}
|
| 81 | +#tooltip.pretty h3 {
|
| 82 | + margin-bottom: 0.75em;
|
| 83 | + font-size: 12pt;
|
| 84 | + width: 220px;
|
| 85 | + text-align: center;
|
| 86 | +}
|
| 87 | +#tooltip.pretty div { width: 220px; text-align: left; }
|
| 88 | +
|
| 89 | +#tooltip.fancy {
|
| 90 | + background: url('shadow2.png');
|
| 91 | + padding-top: 5em;
|
| 92 | + height: 100px;
|
| 93 | +}
|
| 94 | +#tooltip.fancy.viewport-right {
|
| 95 | + background: url('shadow2-reverse.png');
|
| 96 | +}
|
| 97 | +
|
| 98 | +#extended { margin: 2em 0; }
|
| 99 | +#extended label { text-decoration: underline; }
|
| 100 | +#yahoo { width: 7em; }
|
| 101 | +#right, #right2 { text-align: right; }
|
| 102 | +#tooltip.right { width: 250px; }
|
| 103 | +#fancy2 { float: right; } |
\ No newline at end of file |
Index: trunk/extensions/Tooltips/jquery-tooltip/demo/shadow.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/Tooltips/jquery-tooltip/demo/shadow.png |
___________________________________________________________________ |
Added: svn:mime-type |
1 | 104 | + application/octet-stream |
Index: trunk/extensions/Tooltips/jquery-tooltip/demo/karte.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/Tooltips/jquery-tooltip/demo/karte.png |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 105 | + application/octet-stream |
Index: trunk/extensions/Tooltips/jquery-tooltip/demo/index.html |
— | — | @@ -0,0 +1,270 @@ |
| 2 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 | +<html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | +<head> |
| 5 | +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> |
| 6 | +<title>jQuery Tooltip Plugin Demo</title> |
| 7 | +
|
| 8 | +<link rel="stylesheet" href="../jquery.tooltip.css" />
|
| 9 | +<link rel="stylesheet" href="screen.css" />
|
| 10 | +<script src="../lib/jquery.js" type="text/javascript"></script>
|
| 11 | +<script src="../lib/jquery.bgiframe.js" type="text/javascript"></script>
|
| 12 | +<script src="../lib/jquery.dimensions.js" type="text/javascript"></script>
|
| 13 | +<script src="../jquery.tooltip.js" type="text/javascript"></script>
|
| 14 | +
|
| 15 | +<script src="chili-1.7.pack.js" type="text/javascript"></script>
|
| 16 | + |
| 17 | +<script type="text/javascript"> |
| 18 | +$(function() { |
| 19 | +$('#set1 *').tooltip();
|
| 20 | +
|
| 21 | +$("#foottip a").tooltip({
|
| 22 | + bodyHandler: function() {
|
| 23 | + return $($(this).attr("href")).html();
|
| 24 | + },
|
| 25 | + showURL: false
|
| 26 | +});
|
| 27 | + |
| 28 | +$('#tonus').tooltip({ |
| 29 | + delay: 0, |
| 30 | + showURL: false,
|
| 31 | + bodyHandler: function() {
|
| 32 | + return $("<img/>").attr("src", this.src);
|
| 33 | + } |
| 34 | +});
|
| 35 | +
|
| 36 | +$('#yahoo a').tooltip({
|
| 37 | + track: true,
|
| 38 | + delay: 0,
|
| 39 | + showURL: false,
|
| 40 | + showBody: " - ", |
| 41 | + fade: 250
|
| 42 | +}); |
| 43 | + |
| 44 | +$("select").tooltip({ |
| 45 | + left: 25 |
| 46 | +}); |
| 47 | + |
| 48 | +$("map > area").tooltip({ positionLeft: true }); |
| 49 | +
|
| 50 | +$("#fancy, #fancy2").tooltip({
|
| 51 | + track: true,
|
| 52 | + delay: 0,
|
| 53 | + showURL: false,
|
| 54 | + fixPNG: true,
|
| 55 | + showBody: " - ",
|
| 56 | + extraClass: "pretty fancy",
|
| 57 | + top: -15,
|
| 58 | + left: 5
|
| 59 | +}); |
| 60 | + |
| 61 | +$('#pretty').tooltip({
|
| 62 | + track: true,
|
| 63 | + delay: 0,
|
| 64 | + showURL: false,
|
| 65 | + showBody: " - ",
|
| 66 | + extraClass: "pretty",
|
| 67 | + fixPNG: true, |
| 68 | + left: -120 |
| 69 | +}); |
| 70 | +
|
| 71 | +$('#right a').tooltip({
|
| 72 | + track: true,
|
| 73 | + delay: 0,
|
| 74 | + showURL: false, |
| 75 | + extraClass: "right"
|
| 76 | +});
|
| 77 | +$('#right2 a').tooltip({ showURL: false, positionLeft: true });
|
| 78 | +
|
| 79 | +$("#block").click($.tooltip.block);
|
| 80 | +
|
| 81 | +});
|
| 82 | +</script>
|
| 83 | +
|
| 84 | +</head> |
| 85 | +<body>
|
| 86 | +<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/">jQuery Tooltip Plugin</a> Demo</h1>
|
| 87 | +<div id="main"> |
| 88 | + <fieldset id="set1"> |
| 89 | + <legend>Three elements with tooltips, default settings</legend> |
| 90 | + <a title="A tooltip with default settings, the href is displayed below the title" href="http://google.de">Link to google</a> |
| 91 | + <br/> |
| 92 | + <label title="A label with a title and default settings, no href here" for="text1">Input something please!</label> |
| 93 | + <br/> |
| 94 | + <input title="Note that the tooltip disappears when clicking the input element" type="text" value="Test" name="action" id="text1"/>
|
| 95 | +
|
| 96 | + <h3>Code</h3>
|
| 97 | + <pre><code class="mix">$('#set1 *').tooltip();</code></pre> |
| 98 | + </fieldset>
|
| 99 | +
|
| 100 | + <fieldset id="foottip">
|
| 101 | + <legend>Using bodyHandler to display footnotes in the tooltip</legend>
|
| 102 | + Some text referring to a <a href="#footnote">footnote</a>.
|
| 103 | + <br/>
|
| 104 | + <br/>
|
| 105 | + <br/>
|
| 106 | + <br/>
|
| 107 | + <br/>
|
| 108 | + <div id="footnote"><em>And here</em> is the actual footnote, complete with nested <strong>HTML</strong>.</div>
|
| 109 | +
|
| 110 | + <h3>Code</h3>
|
| 111 | + <pre><code class="mix">$("#foottip a").tooltip({
|
| 112 | + bodyHandler: function() {
|
| 113 | + return $($(this).attr("href")).html();
|
| 114 | + },
|
| 115 | + showURL: false
|
| 116 | +});</code></pre>
|
| 117 | + </fieldset>
|
| 118 | + |
| 119 | + <fieldset>
|
| 120 | + <legend>An image with a tooltip</legend> |
| 121 | + <img id="tonus" src="image.png" height="80" title="No delay. The src value is displayed below the title" />
|
| 122 | + <h3>Code</h3>
|
| 123 | + <pre><code class="mix">$('#tonus').tooltip({ |
| 124 | + delay: 0, |
| 125 | + showURL: false, |
| 126 | + bodyHandler: function() { |
| 127 | + return $("<img/>").attr("src", this.src); |
| 128 | + } |
| 129 | +});</code></pre>
|
| 130 | + </fieldset>
|
| 131 | +
|
| 132 | + <fieldset>
|
| 133 | + <legend>Blocking tooltips</legend>
|
| 134 | + <button id="block">Click this button to block/unblock all tooltips</button>
|
| 135 | + <pre><code class="mix">$("#block").click($.tooltip.block);</code></pre>
|
| 136 | + </fieldset> |
| 137 | +
|
| 138 | + <fieldset>
|
| 139 | + <legend>The next four links have no delay with tracking and fading, with extra content:</legend> |
| 140 | + <div id="yahoo"> |
| 141 | + <a title="Yahoo doo - more content" href="http://yahoo.com">Link to yahoo</a> |
| 142 | + <a title="Yahoo doo2 - wohooo" href="http://yahoo.com">Link to yahoo1</a> |
| 143 | + <a title="Yahoo doo3" href="http://yahoo.com">Link to yahoo2</a> |
| 144 | + <a title="Yahoo doo4 - buga!" href="http://yahoo.com">Link to yahoo3</a> |
| 145 | + </div>
|
| 146 | + <select><option>bgiframe test</option></select>
|
| 147 | + <h3>Code</h3>
|
| 148 | + <pre><code class="mix">$('#yahoo a').tooltip({ |
| 149 | + track: true, |
| 150 | + delay: 0, |
| 151 | + showURL: false, |
| 152 | + showBody: " - ", |
| 153 | + fade: 250 |
| 154 | +});</code></pre>
|
| 155 | + </fieldset>
|
| 156 | +
|
| 157 | + <fieldset>
|
| 158 | + <legend>Tooltips with extra classes. Useful for different tooltip styles on a single page.</legend>
|
| 159 | + <em>Note how the one on the right gets a different background image when at the right viewport border.</em>
|
| 160 | + <br/>
|
| 161 | + <span id="fancy" title="You are dead, this is hell. - Please note the custom positioning here!">A fancy tooltip, now with some custom positioning.</span>
|
| 162 | + <span id="fancy2" title="You are dead, this is hell. - Please note the custom positioning here!">A fancy tooltip, now with some custom positioning.</span>
|
| 163 | + <p><span id="pretty" title="I am pretty! - I am a very pretty tooltip, I need lot's of attention from buggers like you! Yes!">And now, for the fancy stuff, a tooltip with an extra class for nice shadows, and some extra content</span></p>
|
| 164 | + <br/>
|
| 165 | + <br/>
|
| 166 | + <br/>
|
| 167 | + <select><option>bgiframe test</option></select>
|
| 168 | + <h3>Code</h3>
|
| 169 | + <pre><code class="mix">$("#fancy, #fancy2").tooltip({
|
| 170 | + track: true,
|
| 171 | + delay: 0,
|
| 172 | + showURL: false,
|
| 173 | + opacity: 1,
|
| 174 | + fixPNG: true,
|
| 175 | + showBody: " - ",
|
| 176 | + extraClass: "pretty fancy",
|
| 177 | + top: -15,
|
| 178 | + left: 5
|
| 179 | +});
|
| 180 | +
|
| 181 | +$('#pretty').tooltip({
|
| 182 | + track: true,
|
| 183 | + delay: 0,
|
| 184 | + showURL: false,
|
| 185 | + showBody: " - ",
|
| 186 | + extraClass: "pretty",
|
| 187 | + fixPNG: true,
|
| 188 | + opacity: 0.95,
|
| 189 | + left: -120
|
| 190 | +});</code></pre>
|
| 191 | + </fieldset> |
| 192 | + |
| 193 | + <fieldset> |
| 194 | + <legend>Selects</legend> |
| 195 | + <select title="fancy select with a tooltip"> |
| 196 | + <option>1. option</option> |
| 197 | + <option>2. option</option> |
| 198 | + <option>3. option</option> |
| 199 | + </select> |
| 200 | + </fieldset> |
| 201 | + |
| 202 | + <fieldset> |
| 203 | + <legend>Image map with tooltips.</legend> |
| 204 | + |
| 205 | + <img id="map" src="karte.png" width="345" height="312" border="0" usemap="#Landkarte"> |
| 206 | + <map name="Landkarte"> |
| 207 | + <area shape="rect" coords="11,10,59,29" |
| 208 | + href="http://www.koblenz.de/" alt="Koblenz" title="Koblenz"> |
| 209 | + <area shape="rect" coords="42,36,96,57" |
| 210 | + href="http://www.wiesbaden.de/" alt="Wiesbaden" title="Wiesbaden"> |
| 211 | + <area shape="rect" coords="42,59,78,80" |
| 212 | + href="http://www.mainz.de/" alt="Mainz" title="Mainz"> |
| 213 | + <area shape="rect" coords="100,26,152,58" |
| 214 | + href="http://www.frankfurt.de/" alt="Frankfurt" title="Frankfurt"> |
| 215 | + <area shape="rect" coords="27,113,93,134" |
| 216 | + href="http://www.mannheim.de/" alt="Mannheim" title="Mannheim"> |
| 217 | + <area shape="rect" coords="100,138,163,159" |
| 218 | + href="http://www.heidelberg.de/" alt="Heidelberg" title="Heidelberg"> |
| 219 | + <area shape="rect" coords="207,77,266,101" |
| 220 | + href="http://www.wuerzburg.de/" alt="Würzburg" title="Würzburg"> |
| 221 | + <area shape="rect" coords="282,62,344,85" |
| 222 | + href="http://www.bamberg.de/" alt="Bamberg" title="Bamberg"> |
| 223 | + <area shape="rect" coords="255,132,316,150" |
| 224 | + href="http://www.nuernberg.de/" alt="Nürnberg" title="Nürnberg"> |
| 225 | + <area shape="rect" coords="78,182,132,200" |
| 226 | + href="http://www.karlsruhe.de/" alt="Karlsruhe" title="Karlsruhe"> |
| 227 | + <area shape="rect" coords="142,169,200,193" |
| 228 | + href="http://www.heilbronn.de/" alt="Heilbronn" title="Heilbronn"> |
| 229 | + <area shape="rect" coords="140,209,198,230" |
| 230 | + href="http://www.stuttgart.de/" alt="Stuttgart" title="Stuttgart"> |
| 231 | + <area shape="rect" coords="187,263,222,281" |
| 232 | + href="http://www.ulm.de/" alt="Ulm" title="Ulm"> |
| 233 | + <area shape="rect" coords="249,278,304,297" |
| 234 | + href="http://www.augsburg.de/" alt="Augsburg" title="Augsburg"> |
| 235 | + <area shape="poly" coords="48,311,105,248,96,210,75,205,38,234,8,310" |
| 236 | + href="http://www.baden-aktuell.de/" alt="Baden" title="Baden"> |
| 237 | + </map> |
| 238 | + <h3>Code</h3> |
| 239 | + <pre><code class="mix">$("map *").tooltip({ positionLeft: true });</code></pre> |
| 240 | + </fieldset> |
| 241 | +
|
| 242 | + <fieldset>
|
| 243 | + <legend>Testing repositioning at viewport borders</legend> |
| 244 | + <p id="right"> |
| 245 | + Tooltip with fixed width<br/> |
| 246 | + <a title="Short title" href="http://goggle">Google me!</a><br/> |
| 247 | + <a title="Rather a very very long title with no meaning but yet quite long long long" href="http://goggle">Google me!</a> |
| 248 | + </p> |
| 249 | + <p id="right2"> |
| 250 | + Tooltip width auto width<br/> |
| 251 | + <a title="Short title" href="http://goggle">Google me!</a><br/> |
| 252 | + <a title="Rather a very very long title with no meaning but yet quite long long long" href="http://goggle">Google me!</a> |
| 253 | + </p>
|
| 254 | + <h3>Code</h3>
|
| 255 | + <pre><code class="mix">$('#right a').tooltip({
|
| 256 | + track: true,
|
| 257 | + delay: 0,
|
| 258 | + showURL: false,
|
| 259 | + extraClass: "right"
|
| 260 | +});
|
| 261 | +$('#right2 a').tooltip({ showURL: false, positionLeft: true });</code></pre>
|
| 262 | + </fieldset>
|
| 263 | +</div> |
| 264 | +<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> |
| 265 | +</script> |
| 266 | +<script type="text/javascript"> |
| 267 | +_uacct = "UA-2623402-1"; |
| 268 | +urchinTracker(); |
| 269 | +</script>
|
| 270 | +</body> |
| 271 | +</html> |
\ No newline at end of file |
Index: trunk/extensions/Tooltips/jquery-tooltip/demo/shadow2.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/Tooltips/jquery-tooltip/demo/shadow2.png |
___________________________________________________________________ |
Added: svn:mime-type |
1 | 272 | + application/octet-stream |
Index: trunk/extensions/Tooltips/jquery-tooltip/demo/bg.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/Tooltips/jquery-tooltip/demo/bg.gif |
___________________________________________________________________ |
Added: svn:mime-type |
2 | 273 | + application/octet-stream |
Index: trunk/extensions/Tooltips/jquery-tooltip/changelog.txt |
— | — | @@ -0,0 +1,38 @@ |
| 2 | +1.3
|
| 3 | +---
|
| 4 | +
|
| 5 | +* Added fade option (duration in ms) for fading in/out tooltips; IE <= 6 is excluded when bgiframe plugin is included
|
| 6 | +* Fixed imagemaps in IE, added back example
|
| 7 | +* Added positionLeft-option - positions the tooltip to the left of the cursor
|
| 8 | +* Remove deprecated $.fn.Tooltip in favor of $.fn.tooltip
|
| 9 | +
|
| 10 | +1.2
|
| 11 | +---
|
| 12 | +
|
| 13 | +* Improved bodyHandler option to accept HTML strings, DOM elements and jQuery objects as the return value
|
| 14 | +* Fixed bug in Safari 3 where to tooltip is initially visible, by first appending to DOM then hiding it
|
| 15 | +* Improvement for viewport-border-positioning: Add the classes "viewport-right" and "viewport-bottom" when the element is moved at the viewport border.
|
| 16 | +* Moved and enhanced documentation to docs.jquery.com
|
| 17 | +* Added examples for bodyHandler: footnote-tooltip and thumbnail
|
| 18 | +* Added id option, defaults to "tooltip", override to use a different id in your stylesheet
|
| 19 | +* Moved demo tooltip style to screen.css
|
| 20 | +* Moved demo files to demo folder and dependencies to lib folder
|
| 21 | +* Dropped image map example - completely incompatible with IE; image maps aren't supported anymore
|
| 22 | +
|
| 23 | +1.1
|
| 24 | +---
|
| 25 | +
|
| 26 | +* Use bgiframe-plugin if available
|
| 27 | +* Use dimensions-plugin to calculate viewport
|
| 28 | +* Expose global blocked-property via $.Tooltip.blocked to programmatically disable all tooltips
|
| 29 | +* Fixed image maps in IE by setting the alt-attribute to an empty string
|
| 30 | +* Removed event-option (only hover-tooltips now)
|
| 31 | +* Simplified event-handling (using hover instead of mouseover und mouseout)
|
| 32 | +* Added another "pretty" example
|
| 33 | +* Added top and left options to specify tooltip offset
|
| 34 | +* Reworked example page: New layout, code examples
|
| 35 | +
|
| 36 | +1.0
|
| 37 | +---
|
| 38 | +
|
| 39 | +* first release considered stable |
\ No newline at end of file |
Index: trunk/extensions/Tooltips/jquery-tooltip/jquery.tooltip.min.js |
— | — | @@ -0,0 +1,19 @@ |
| 2 | +/* |
| 3 | + * jQuery Tooltip plugin 1.3 |
| 4 | + * |
| 5 | + * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ |
| 6 | + * http://docs.jquery.com/Plugins/Tooltip |
| 7 | + * |
| 8 | + * Copyright (c) 2006 - 2008 Jörn Zaefferer |
| 9 | + * |
| 10 | + * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $ |
| 11 | + * |
| 12 | + * Dual licensed under the MIT and GPL licenses: |
| 13 | + * http://www.opensource.org/licenses/mit-license.php |
| 14 | + * http://www.gnu.org/licenses/gpl.html |
| 15 | + */;(function($){var helper={},current,title,tID,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.tooltip={blocked:false,defaults:{delay:200,fade:false,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){$.tooltip.blocked=!$.tooltip.blocked;}};$.fn.extend({tooltip:function(settings){settings=$.extend({},$.tooltip.defaults,settings);createHelper(settings);return this.each(function(){$.data(this,"tooltip",settings);this.tOpacity=helper.parent.css("opacity");this.tooltipText=this.title;$(this).removeAttr("title");this.alt="";}).mouseover(save).mouseout(hide).click(hide);},fixPNG:IE?function(){return this.each(function(){var image=$(this).css('backgroundImage');if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"}).each(function(){var position=$(this).css('position');if(position!='absolute'&&position!='relative')$(this).css('position','relative');});}});}:function(){return this;},unfixPNG:IE?function(){return this.each(function(){$(this).css({'filter':'',backgroundImage:''});});}:function(){return this;},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]();});},url:function(){return this.attr('href')||this.attr('src');}});function createHelper(settings){if(helper.parent)return;helper.parent=$('<div id="'+settings.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if($.fn.bgiframe)helper.parent.bgiframe();helper.title=$('h3',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent);}function settings(element){return $.data(element,"tooltip");}function handle(event){if(settings(this).delay)tID=setTimeout(show,settings(this).delay);else |
| 16 | +show();track=!!settings(this).track;$(document.body).bind('mousemove',update);update(event);}function save(){if($.tooltip.blocked||this==current||(!this.tooltipText&&!settings(this).bodyHandler))return;current=this;title=this.tooltipText;if(settings(this).bodyHandler){helper.title.hide();var bodyContent=settings(this).bodyHandler.call(this);if(bodyContent.nodeType||bodyContent.jquery){helper.body.empty().append(bodyContent)}else{helper.body.html(bodyContent);}helper.body.show();}else if(settings(this).showBody){var parts=title.split(settings(this).showBody);helper.title.html(parts.shift()).show();helper.body.empty();for(var i=0,part;(part=parts[i]);i++){if(i>0)helper.body.append("<br/>");helper.body.append(part);}helper.body.hideWhenEmpty();}else{helper.title.html(title).show();helper.body.hide();}if(settings(this).showURL&&$(this).url())helper.url.html($(this).url().replace('http://','')).show();else |
| 17 | +helper.url.hide();helper.parent.addClass(settings(this).extraClass);if(settings(this).fixPNG)helper.parent.fixPNG();handle.apply(this,arguments);}function show(){tID=null;if((!IE||!$.fn.bgiframe)&&settings(current).fade){if(helper.parent.is(":animated"))helper.parent.stop().show().fadeTo(settings(current).fade,current.tOpacity);else |
| 18 | +helper.parent.is(':visible')?helper.parent.fadeTo(settings(current).fade,current.tOpacity):helper.parent.fadeIn(settings(current).fade);}else{helper.parent.show();}update();}function update(event){if($.tooltip.blocked)return;if(event&&event.target.tagName=="OPTION"){return;}if(!track&&helper.parent.is(":visible")){$(document.body).unbind('mousemove',update)}if(current==null){$(document.body).unbind('mousemove',update);return;}helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){left=event.pageX+settings(current).left;top=event.pageY+settings(current).top;var right='auto';if(settings(current).positionLeft){right=$(window).width()-left;left='auto';}helper.parent.css({left:left,right:right,top:top});}var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+settings(current).left;helper.parent.css({left:left+'px'}).addClass("viewport-right");}if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+settings(current).top;helper.parent.css({top:top+'px'}).addClass("viewport-bottom");}}function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()};}function hide(event){if($.tooltip.blocked)return;if(tID)clearTimeout(tID);current=null;var tsettings=settings(this);function complete(){helper.parent.removeClass(tsettings.extraClass).hide().css("opacity","");}if((!IE||!$.fn.bgiframe)&&tsettings.fade){if(helper.parent.is(':animated'))helper.parent.stop().fadeTo(tsettings.fade,0,complete);else |
| 19 | +helper.parent.stop().fadeOut(tsettings.fade,complete);}else |
| 20 | +complete();if(settings(this).fixPNG)helper.parent.unfixPNG();}})(jQuery); |
\ No newline at end of file |
Index: trunk/extensions/Tooltips/jquery-tooltip/todo |
— | — | @@ -0,0 +1,9 @@ |
| 2 | +1.3
|
| 3 | +---
|
| 4 | +
|
| 5 | +* leverage advanced background-styling, eg. see http://www.google.com/intl/en_ALL/mapfiles/iw2.png
|
| 6 | +* add ability to display remote tooltip for other elements, eg. an invalid input
|
| 7 | +* Add stop-queue stuff for fadein/out without nasty queues
|
| 8 | +* add delay on hide
|
| 9 | +* add stick on hover of tooltip (with track:false)
|
| 10 | +* offer hoverIntent support
|
Index: trunk/extensions/Tooltips/jquery-tooltip/lib/jquery.dimensions.js |
— | — | @@ -0,0 +1,504 @@ |
| 2 | +/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net) |
| 3 | + * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) |
| 4 | + * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. |
| 5 | + * |
| 6 | + * $LastChangedDate: 2007-06-22 04:38:37 +0200 (Fr, 22 Jun 2007) $ |
| 7 | + * $Rev: 2141 $ |
| 8 | + * |
| 9 | + * Version: 1.0b2 |
| 10 | + */ |
| 11 | + |
| 12 | +(function($){ |
| 13 | + |
| 14 | +// store a copy of the core height and width methods |
| 15 | +var height = $.fn.height, |
| 16 | + width = $.fn.width; |
| 17 | + |
| 18 | +$.fn.extend({ |
| 19 | + /** |
| 20 | + * If used on document, returns the document's height (innerHeight) |
| 21 | + * If used on window, returns the viewport's (window) height |
| 22 | + * See core docs on height() to see what happens when used on an element. |
| 23 | + * |
| 24 | + * @example $("#testdiv").height() |
| 25 | + * @result 200 |
| 26 | + * |
| 27 | + * @example $(document).height() |
| 28 | + * @result 800 |
| 29 | + * |
| 30 | + * @example $(window).height() |
| 31 | + * @result 400 |
| 32 | + * |
| 33 | + * @name height |
| 34 | + * @type Object |
| 35 | + * @cat Plugins/Dimensions |
| 36 | + */ |
| 37 | + height: function() { |
| 38 | + if ( this[0] == window ) |
| 39 | + return self.innerHeight || |
| 40 | + $.boxModel && document.documentElement.clientHeight || |
| 41 | + document.body.clientHeight; |
| 42 | + |
| 43 | + if ( this[0] == document ) |
| 44 | + return Math.max( document.body.scrollHeight, document.body.offsetHeight ); |
| 45 | + |
| 46 | + return height.apply(this, arguments); |
| 47 | + }, |
| 48 | + |
| 49 | + /** |
| 50 | + * If used on document, returns the document's width (innerWidth) |
| 51 | + * If used on window, returns the viewport's (window) width |
| 52 | + * See core docs on height() to see what happens when used on an element. |
| 53 | + * |
| 54 | + * @example $("#testdiv").width() |
| 55 | + * @result 200 |
| 56 | + * |
| 57 | + * @example $(document).width() |
| 58 | + * @result 800 |
| 59 | + * |
| 60 | + * @example $(window).width() |
| 61 | + * @result 400 |
| 62 | + * |
| 63 | + * @name width |
| 64 | + * @type Object |
| 65 | + * @cat Plugins/Dimensions |
| 66 | + */ |
| 67 | + width: function() { |
| 68 | + if ( this[0] == window ) |
| 69 | + return self.innerWidth || |
| 70 | + $.boxModel && document.documentElement.clientWidth || |
| 71 | + document.body.clientWidth; |
| 72 | + |
| 73 | + if ( this[0] == document ) |
| 74 | + return Math.max( document.body.scrollWidth, document.body.offsetWidth ); |
| 75 | + |
| 76 | + return width.apply(this, arguments); |
| 77 | + }, |
| 78 | + |
| 79 | + /** |
| 80 | + * Returns the inner height value (without border) for the first matched element. |
| 81 | + * If used on document, returns the document's height (innerHeight) |
| 82 | + * If used on window, returns the viewport's (window) height |
| 83 | + * |
| 84 | + * @example $("#testdiv").innerHeight() |
| 85 | + * @result 800 |
| 86 | + * |
| 87 | + * @name innerHeight |
| 88 | + * @type Number |
| 89 | + * @cat Plugins/Dimensions |
| 90 | + */ |
| 91 | + innerHeight: function() { |
| 92 | + return this[0] == window || this[0] == document ? |
| 93 | + this.height() : |
| 94 | + this.is(':visible') ? |
| 95 | + this[0].offsetHeight - num(this, 'borderTopWidth') - num(this, 'borderBottomWidth') : |
| 96 | + this.height() + num(this, 'paddingTop') + num(this, 'paddingBottom'); |
| 97 | + }, |
| 98 | + |
| 99 | + /** |
| 100 | + * Returns the inner width value (without border) for the first matched element. |
| 101 | + * If used on document, returns the document's Width (innerWidth) |
| 102 | + * If used on window, returns the viewport's (window) width |
| 103 | + * |
| 104 | + * @example $("#testdiv").innerWidth() |
| 105 | + * @result 1000 |
| 106 | + * |
| 107 | + * @name innerWidth |
| 108 | + * @type Number |
| 109 | + * @cat Plugins/Dimensions |
| 110 | + */ |
| 111 | + innerWidth: function() { |
| 112 | + return this[0] == window || this[0] == document ? |
| 113 | + this.width() : |
| 114 | + this.is(':visible') ? |
| 115 | + this[0].offsetWidth - num(this, 'borderLeftWidth') - num(this, 'borderRightWidth') : |
| 116 | + this.width() + num(this, 'paddingLeft') + num(this, 'paddingRight'); |
| 117 | + }, |
| 118 | + |
| 119 | + /** |
| 120 | + * Returns the outer height value (including border) for the first matched element. |
| 121 | + * Cannot be used on document or window. |
| 122 | + * |
| 123 | + * @example $("#testdiv").outerHeight() |
| 124 | + * @result 1000 |
| 125 | + * |
| 126 | + * @name outerHeight |
| 127 | + * @type Number |
| 128 | + * @cat Plugins/Dimensions |
| 129 | + */ |
| 130 | + outerHeight: function() { |
| 131 | + return this[0] == window || this[0] == document ? |
| 132 | + this.height() : |
| 133 | + this.is(':visible') ? |
| 134 | + this[0].offsetHeight : |
| 135 | + this.height() + num(this,'borderTopWidth') + num(this, 'borderBottomWidth') + num(this, 'paddingTop') + num(this, 'paddingBottom'); |
| 136 | + }, |
| 137 | + |
| 138 | + /** |
| 139 | + * Returns the outer width value (including border) for the first matched element. |
| 140 | + * Cannot be used on document or window. |
| 141 | + * |
| 142 | + * @example $("#testdiv").outerHeight() |
| 143 | + * @result 1000 |
| 144 | + * |
| 145 | + * @name outerHeight |
| 146 | + * @type Number |
| 147 | + * @cat Plugins/Dimensions |
| 148 | + */ |
| 149 | + outerWidth: function() { |
| 150 | + return this[0] == window || this[0] == document ? |
| 151 | + this.width() : |
| 152 | + this.is(':visible') ? |
| 153 | + this[0].offsetWidth : |
| 154 | + this.width() + num(this, 'borderLeftWidth') + num(this, 'borderRightWidth') + num(this, 'paddingLeft') + num(this, 'paddingRight'); |
| 155 | + }, |
| 156 | + |
| 157 | + /** |
| 158 | + * Returns how many pixels the user has scrolled to the right (scrollLeft). |
| 159 | + * Works on containers with overflow: auto and window/document. |
| 160 | + * |
| 161 | + * @example $("#testdiv").scrollLeft() |
| 162 | + * @result 100 |
| 163 | + * |
| 164 | + * @name scrollLeft |
| 165 | + * @type Number |
| 166 | + * @cat Plugins/Dimensions |
| 167 | + */ |
| 168 | + /** |
| 169 | + * Sets the scrollLeft property and continues the chain. |
| 170 | + * Works on containers with overflow: auto and window/document. |
| 171 | + * |
| 172 | + * @example $("#testdiv").scrollLeft(10).scrollLeft() |
| 173 | + * @result 10 |
| 174 | + * |
| 175 | + * @name scrollLeft |
| 176 | + * @param Number value A positive number representing the desired scrollLeft. |
| 177 | + * @type jQuery |
| 178 | + * @cat Plugins/Dimensions |
| 179 | + */ |
| 180 | + scrollLeft: function(val) { |
| 181 | + if ( val != undefined ) |
| 182 | + // set the scroll left |
| 183 | + return this.each(function() { |
| 184 | + if (this == window || this == document) |
| 185 | + window.scrollTo( val, $(window).scrollTop() ); |
| 186 | + else |
| 187 | + this.scrollLeft = val; |
| 188 | + }); |
| 189 | + |
| 190 | + // return the scroll left offest in pixels |
| 191 | + if ( this[0] == window || this[0] == document ) |
| 192 | + return self.pageXOffset || |
| 193 | + $.boxModel && document.documentElement.scrollLeft || |
| 194 | + document.body.scrollLeft; |
| 195 | + |
| 196 | + return this[0].scrollLeft; |
| 197 | + }, |
| 198 | + |
| 199 | + /** |
| 200 | + * Returns how many pixels the user has scrolled to the bottom (scrollTop). |
| 201 | + * Works on containers with overflow: auto and window/document. |
| 202 | + * |
| 203 | + * @example $("#testdiv").scrollTop() |
| 204 | + * @result 100 |
| 205 | + * |
| 206 | + * @name scrollTop |
| 207 | + * @type Number |
| 208 | + * @cat Plugins/Dimensions |
| 209 | + */ |
| 210 | + /** |
| 211 | + * Sets the scrollTop property and continues the chain. |
| 212 | + * Works on containers with overflow: auto and window/document. |
| 213 | + * |
| 214 | + * @example $("#testdiv").scrollTop(10).scrollTop() |
| 215 | + * @result 10 |
| 216 | + * |
| 217 | + * @name scrollTop |
| 218 | + * @param Number value A positive number representing the desired scrollTop. |
| 219 | + * @type jQuery |
| 220 | + * @cat Plugins/Dimensions |
| 221 | + */ |
| 222 | + scrollTop: function(val) { |
| 223 | + if ( val != undefined ) |
| 224 | + // set the scroll top |
| 225 | + return this.each(function() { |
| 226 | + if (this == window || this == document) |
| 227 | + window.scrollTo( $(window).scrollLeft(), val ); |
| 228 | + else |
| 229 | + this.scrollTop = val; |
| 230 | + }); |
| 231 | + |
| 232 | + // return the scroll top offset in pixels |
| 233 | + if ( this[0] == window || this[0] == document ) |
| 234 | + return self.pageYOffset || |
| 235 | + $.boxModel && document.documentElement.scrollTop || |
| 236 | + document.body.scrollTop; |
| 237 | + |
| 238 | + return this[0].scrollTop; |
| 239 | + }, |
| 240 | + |
| 241 | + /** |
| 242 | + * Returns the top and left positioned offset in pixels. |
| 243 | + * The positioned offset is the offset between a positioned |
| 244 | + * parent and the element itself. |
| 245 | + * |
| 246 | + * @example $("#testdiv").position() |
| 247 | + * @result { top: 100, left: 100 } |
| 248 | + * |
| 249 | + * @name position |
| 250 | + * @param Map options Optional settings to configure the way the offset is calculated. |
| 251 | + * @option Boolean margin Should the margin of the element be included in the calculations? False by default. |
| 252 | + * @option Boolean border Should the border of the element be included in the calculations? False by default. |
| 253 | + * @option Boolean padding Should the padding of the element be included in the calculations? False by default. |
| 254 | + * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the |
| 255 | + * chain will not be broken and the result will be assigned to this object. |
| 256 | + * @type Object |
| 257 | + * @cat Plugins/Dimensions |
| 258 | + */ |
| 259 | + position: function(options, returnObject) { |
| 260 | + var elem = this[0], parent = elem.parentNode, op = elem.offsetParent, |
| 261 | + options = $.extend({ margin: false, border: false, padding: false, scroll: false }, options || {}), |
| 262 | + x = elem.offsetLeft, |
| 263 | + y = elem.offsetTop, |
| 264 | + sl = elem.scrollLeft, |
| 265 | + st = elem.scrollTop; |
| 266 | + |
| 267 | + // Mozilla and IE do not add the border |
| 268 | + if ($.browser.mozilla || $.browser.msie) { |
| 269 | + // add borders to offset |
| 270 | + x += num(elem, 'borderLeftWidth'); |
| 271 | + y += num(elem, 'borderTopWidth'); |
| 272 | + } |
| 273 | + |
| 274 | + if ($.browser.mozilla) { |
| 275 | + do { |
| 276 | + // Mozilla does not add the border for a parent that has overflow set to anything but visible |
| 277 | + if ($.browser.mozilla && parent != elem && $.css(parent, 'overflow') != 'visible') { |
| 278 | + x += num(parent, 'borderLeftWidth'); |
| 279 | + y += num(parent, 'borderTopWidth'); |
| 280 | + } |
| 281 | + |
| 282 | + if (parent == op) break; // break if we are already at the offestParent |
| 283 | + } while ((parent = parent.parentNode) && (parent.tagName.toLowerCase() != 'body' || parent.tagName.toLowerCase() != 'html')); |
| 284 | + } |
| 285 | + |
| 286 | + var returnValue = handleOffsetReturn(elem, options, x, y, sl, st); |
| 287 | + |
| 288 | + if (returnObject) { $.extend(returnObject, returnValue); return this; } |
| 289 | + else { return returnValue; } |
| 290 | + }, |
| 291 | + |
| 292 | + /** |
| 293 | + * Returns the location of the element in pixels from the top left corner of the viewport. |
| 294 | + * |
| 295 | + * For accurate readings make sure to use pixel values for margins, borders and padding. |
| 296 | + * |
| 297 | + * Known issues: |
| 298 | + * - Issue: A div positioned relative or static without any content before it and its parent will report an offsetTop of 0 in Safari |
| 299 | + * Workaround: Place content before the relative div ... and set height and width to 0 and overflow to hidden |
| 300 | + * |
| 301 | + * @example $("#testdiv").offset() |
| 302 | + * @result { top: 100, left: 100, scrollTop: 10, scrollLeft: 10 } |
| 303 | + * |
| 304 | + * @example $("#testdiv").offset({ scroll: false }) |
| 305 | + * @result { top: 90, left: 90 } |
| 306 | + * |
| 307 | + * @example var offset = {} |
| 308 | + * $("#testdiv").offset({ scroll: false }, offset) |
| 309 | + * @result offset = { top: 90, left: 90 } |
| 310 | + * |
| 311 | + * @name offset |
| 312 | + * @param Map options Optional settings to configure the way the offset is calculated. |
| 313 | + * @option Boolean margin Should the margin of the element be included in the calculations? True by default. |
| 314 | + * @option Boolean border Should the border of the element be included in the calculations? False by default. |
| 315 | + * @option Boolean padding Should the padding of the element be included in the calculations? False by default. |
| 316 | + * @option Boolean scroll Should the scroll offsets of the parent elements be included in the calculations? True by default. |
| 317 | + * When true it adds the totla scroll offets of all parents to the total offset and also adds two properties |
| 318 | + * to the returned object, scrollTop and scrollLeft. |
| 319 | + * @options Boolean lite Will use offsetLite instead of offset when set to true. False by default. |
| 320 | + * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the |
| 321 | + * chain will not be broken and the result will be assigned to this object. |
| 322 | + * @type Object |
| 323 | + * @cat Plugins/Dimensions |
| 324 | + */ |
| 325 | + offset: function(options, returnObject) { |
| 326 | + var x = 0, y = 0, sl = 0, st = 0, |
| 327 | + elem = this[0], parent = this[0], op, parPos, elemPos = $.css(elem, 'position'), |
| 328 | + mo = $.browser.mozilla, ie = $.browser.msie, sf = $.browser.safari, oa = $.browser.opera, |
| 329 | + absparent = false, relparent = false, |
| 330 | + options = $.extend({ margin: true, border: false, padding: false, scroll: true, lite: false }, options || {}); |
| 331 | + |
| 332 | + // Use offsetLite if lite option is true |
| 333 | + if (options.lite) return this.offsetLite(options, returnObject); |
| 334 | + |
| 335 | + if (elem.tagName.toLowerCase() == 'body') { |
| 336 | + // Safari is the only one to get offsetLeft and offsetTop properties of the body "correct" |
| 337 | + // Except they all mess up when the body is positioned absolute or relative |
| 338 | + x = elem.offsetLeft; |
| 339 | + y = elem.offsetTop; |
| 340 | + // Mozilla ignores margin and subtracts border from body element |
| 341 | + if (mo) { |
| 342 | + x += num(elem, 'marginLeft') + (num(elem, 'borderLeftWidth')*2); |
| 343 | + y += num(elem, 'marginTop') + (num(elem, 'borderTopWidth') *2); |
| 344 | + } else |
| 345 | + // Opera ignores margin |
| 346 | + if (oa) { |
| 347 | + x += num(elem, 'marginLeft'); |
| 348 | + y += num(elem, 'marginTop'); |
| 349 | + } else |
| 350 | + // IE does not add the border in Standards Mode |
| 351 | + if (ie && jQuery.boxModel) { |
| 352 | + x += num(elem, 'borderLeftWidth'); |
| 353 | + y += num(elem, 'borderTopWidth'); |
| 354 | + } |
| 355 | + } else { |
| 356 | + do { |
| 357 | + parPos = $.css(parent, 'position'); |
| 358 | + |
| 359 | + x += parent.offsetLeft; |
| 360 | + y += parent.offsetTop; |
| 361 | + |
| 362 | + // Mozilla and IE do not add the border |
| 363 | + if (mo || ie) { |
| 364 | + // add borders to offset |
| 365 | + x += num(parent, 'borderLeftWidth'); |
| 366 | + y += num(parent, 'borderTopWidth'); |
| 367 | + |
| 368 | + // Mozilla does not include the border on body if an element isn't positioned absolute and is without an absolute parent |
| 369 | + if (mo && parPos == 'absolute') absparent = true; |
| 370 | + // IE does not include the border on the body if an element is position static and without an absolute or relative parent |
| 371 | + if (ie && parPos == 'relative') relparent = true; |
| 372 | + } |
| 373 | + |
| 374 | + op = parent.offsetParent; |
| 375 | + if (options.scroll || mo) { |
| 376 | + do { |
| 377 | + if (options.scroll) { |
| 378 | + // get scroll offsets |
| 379 | + sl += parent.scrollLeft; |
| 380 | + st += parent.scrollTop; |
| 381 | + } |
| 382 | + |
| 383 | + // Mozilla does not add the border for a parent that has overflow set to anything but visible |
| 384 | + if (mo && parent != elem && $.css(parent, 'overflow') != 'visible') { |
| 385 | + x += num(parent, 'borderLeftWidth'); |
| 386 | + y += num(parent, 'borderTopWidth'); |
| 387 | + } |
| 388 | + |
| 389 | + parent = parent.parentNode; |
| 390 | + } while (parent != op); |
| 391 | + } |
| 392 | + parent = op; |
| 393 | + |
| 394 | + if (parent.tagName.toLowerCase() == 'body' || parent.tagName.toLowerCase() == 'html') { |
| 395 | + // Safari and IE Standards Mode doesn't add the body margin for elments positioned with static or relative |
| 396 | + if ((sf || (ie && $.boxModel)) && elemPos != 'absolute' && elemPos != 'fixed') { |
| 397 | + x += num(parent, 'marginLeft'); |
| 398 | + y += num(parent, 'marginTop'); |
| 399 | + } |
| 400 | + // Mozilla does not include the border on body if an element isn't positioned absolute and is without an absolute parent |
| 401 | + // IE does not include the border on the body if an element is positioned static and without an absolute or relative parent |
| 402 | + if ( (mo && !absparent && elemPos != 'fixed') || |
| 403 | + (ie && elemPos == 'static' && !relparent) ) { |
| 404 | + x += num(parent, 'borderLeftWidth'); |
| 405 | + y += num(parent, 'borderTopWidth'); |
| 406 | + } |
| 407 | + break; // Exit the loop |
| 408 | + } |
| 409 | + } while (parent); |
| 410 | + } |
| 411 | + |
| 412 | + var returnValue = handleOffsetReturn(elem, options, x, y, sl, st); |
| 413 | + |
| 414 | + if (returnObject) { $.extend(returnObject, returnValue); return this; } |
| 415 | + else { return returnValue; } |
| 416 | + }, |
| 417 | + |
| 418 | + /** |
| 419 | + * Returns the location of the element in pixels from the top left corner of the viewport. |
| 420 | + * This method is much faster than offset but not as accurate. This method can be invoked |
| 421 | + * by setting the lite option to true in the offset method. |
| 422 | + * |
| 423 | + * @name offsetLite |
| 424 | + * @param Map options Optional settings to configure the way the offset is calculated. |
| 425 | + * @option Boolean margin Should the margin of the element be included in the calculations? True by default. |
| 426 | + * @option Boolean border Should the border of the element be included in the calculations? False by default. |
| 427 | + * @option Boolean padding Should the padding of the element be included in the calculations? False by default. |
| 428 | + * @option Boolean scroll Should the scroll offsets of the parent elements be included in the calculations? True by default. |
| 429 | + * When true it adds the totla scroll offets of all parents to the total offset and also adds two properties |
| 430 | + * to the returned object, scrollTop and scrollLeft. |
| 431 | + * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the |
| 432 | + * chain will not be broken and the result will be assigned to this object. |
| 433 | + * @type Object |
| 434 | + * @cat Plugins/Dimensions |
| 435 | + */ |
| 436 | + offsetLite: function(options, returnObject) { |
| 437 | + var x = 0, y = 0, sl = 0, st = 0, parent = this[0], op, |
| 438 | + options = $.extend({ margin: true, border: false, padding: false, scroll: true }, options || {}); |
| 439 | + |
| 440 | + do { |
| 441 | + x += parent.offsetLeft; |
| 442 | + y += parent.offsetTop; |
| 443 | + |
| 444 | + op = parent.offsetParent; |
| 445 | + if (options.scroll) { |
| 446 | + // get scroll offsets |
| 447 | + do { |
| 448 | + sl += parent.scrollLeft; |
| 449 | + st += parent.scrollTop; |
| 450 | + parent = parent.parentNode; |
| 451 | + } while(parent != op); |
| 452 | + } |
| 453 | + parent = op; |
| 454 | + } while (parent && parent.tagName.toLowerCase() != 'body' && parent.tagName.toLowerCase() != 'html'); |
| 455 | + |
| 456 | + var returnValue = handleOffsetReturn(this[0], options, x, y, sl, st); |
| 457 | + |
| 458 | + if (returnObject) { $.extend(returnObject, returnValue); return this; } |
| 459 | + else { return returnValue; } |
| 460 | + } |
| 461 | +}); |
| 462 | + |
| 463 | +/** |
| 464 | + * Handles converting a CSS Style into an Integer. |
| 465 | + * @private |
| 466 | + */ |
| 467 | +var num = function(el, prop) { |
| 468 | + return parseInt($.css(el.jquery?el[0]:el,prop))||0; |
| 469 | +}; |
| 470 | + |
| 471 | +/** |
| 472 | + * Handles the return value of the offset and offsetLite methods. |
| 473 | + * @private |
| 474 | + */ |
| 475 | +var handleOffsetReturn = function(elem, options, x, y, sl, st) { |
| 476 | + if ( !options.margin ) { |
| 477 | + x -= num(elem, 'marginLeft'); |
| 478 | + y -= num(elem, 'marginTop'); |
| 479 | + } |
| 480 | + |
| 481 | + // Safari and Opera do not add the border for the element |
| 482 | + if ( options.border && ($.browser.safari || $.browser.opera) ) { |
| 483 | + x += num(elem, 'borderLeftWidth'); |
| 484 | + y += num(elem, 'borderTopWidth'); |
| 485 | + } else if ( !options.border && !($.browser.safari || $.browser.opera) ) { |
| 486 | + x -= num(elem, 'borderLeftWidth'); |
| 487 | + y -= num(elem, 'borderTopWidth'); |
| 488 | + } |
| 489 | + |
| 490 | + if ( options.padding ) { |
| 491 | + x += num(elem, 'paddingLeft'); |
| 492 | + y += num(elem, 'paddingTop'); |
| 493 | + } |
| 494 | + |
| 495 | + // do not include scroll offset on the element |
| 496 | + if ( options.scroll ) { |
| 497 | + sl -= elem.scrollLeft; |
| 498 | + st -= elem.scrollTop; |
| 499 | + } |
| 500 | + |
| 501 | + return options.scroll ? { top: y - st, left: x - sl, scrollTop: st, scrollLeft: sl } |
| 502 | + : { top: y, left: x }; |
| 503 | +}; |
| 504 | + |
| 505 | +})(jQuery); |
\ No newline at end of file |
Index: trunk/extensions/Tooltips/jquery-tooltip/lib/jquery.delegate.js |
— | — | @@ -0,0 +1,56 @@ |
| 2 | +/* |
| 3 | + * jQuery delegate plug-in v1.0 |
| 4 | + * |
| 5 | + * Copyright (c) 2007 Jörn Zaefferer |
| 6 | + * |
| 7 | + * $Id: jquery.delegate.js 4786 2008-02-19 20:02:34Z joern.zaefferer $ |
| 8 | + * |
| 9 | + * Dual licensed under the MIT and GPL licenses: |
| 10 | + * http://www.opensource.org/licenses/mit-license.php |
| 11 | + * http://www.gnu.org/licenses/gpl.html |
| 12 | + */ |
| 13 | + |
| 14 | +// provides cross-browser focusin and focusout events |
| 15 | +// IE has native support, in other browsers, use event caputuring (neither bubbles) |
| 16 | + |
| 17 | +// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation |
| 18 | +// handler is only called when $(event.target).is(delegate), in the scope of the jQuery-object for event.target |
| 19 | + |
| 20 | +// provides triggerEvent(type: String, target: Element) to trigger delegated events |
| 21 | +;(function($) { |
| 22 | + $.each({ |
| 23 | + focus: 'focusin', |
| 24 | + blur: 'focusout' |
| 25 | + }, function( original, fix ){ |
| 26 | + $.event.special[fix] = { |
| 27 | + setup:function() { |
| 28 | + if ( $.browser.msie ) return false; |
| 29 | + this.addEventListener( original, $.event.special[fix].handler, true ); |
| 30 | + }, |
| 31 | + teardown:function() { |
| 32 | + if ( $.browser.msie ) return false; |
| 33 | + this.removeEventListener( original, |
| 34 | + $.event.special[fix].handler, true ); |
| 35 | + }, |
| 36 | + handler: function(e) { |
| 37 | + arguments[0] = $.event.fix(e); |
| 38 | + arguments[0].type = fix; |
| 39 | + return $.event.handle.apply(this, arguments); |
| 40 | + } |
| 41 | + }; |
| 42 | + }); |
| 43 | + |
| 44 | + $.extend($.fn, { |
| 45 | + delegate: function(type, delegate, handler) { |
| 46 | + return this.bind(type, function(event) { |
| 47 | + var target = $(event.target); |
| 48 | + if (target.is(delegate)) { |
| 49 | + return handler.apply(target, arguments); |
| 50 | + } |
| 51 | + }); |
| 52 | + }, |
| 53 | + triggerEvent: function(type, target) { |
| 54 | + return this.triggerHandler(type, [jQuery.event.fix({ type: type, target: target })]); |
| 55 | + } |
| 56 | + }) |
| 57 | +})(jQuery); |
Index: trunk/extensions/Tooltips/jquery-tooltip/lib/jquery.bgiframe.js |
— | — | @@ -0,0 +1,104 @@ |
| 2 | +/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net) |
| 3 | + * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) |
| 4 | + * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. |
| 5 | + * |
| 6 | + * $LastChangedDate: 2007-06-20 03:23:36 +0200 (Mi, 20 Jun 2007) $ |
| 7 | + * $Rev: 2110 $ |
| 8 | + * |
| 9 | + * Version 2.1 |
| 10 | + */ |
| 11 | + |
| 12 | +(function($){ |
| 13 | + |
| 14 | +/** |
| 15 | + * The bgiframe is chainable and applies the iframe hack to get |
| 16 | + * around zIndex issues in IE6. It will only apply itself in IE |
| 17 | + * and adds a class to the iframe called 'bgiframe'. The iframe |
| 18 | + * is appeneded as the first child of the matched element(s) |
| 19 | + * with a tabIndex and zIndex of -1. |
| 20 | + * |
| 21 | + * By default the plugin will take borders, sized with pixel units, |
| 22 | + * into account. If a different unit is used for the border's width, |
| 23 | + * then you will need to use the top and left settings as explained below. |
| 24 | + * |
| 25 | + * NOTICE: This plugin has been reported to cause perfromance problems |
| 26 | + * when used on elements that change properties (like width, height and |
| 27 | + * opacity) a lot in IE6. Most of these problems have been caused by |
| 28 | + * the expressions used to calculate the elements width, height and |
| 29 | + * borders. Some have reported it is due to the opacity filter. All |
| 30 | + * these settings can be changed if needed as explained below. |
| 31 | + * |
| 32 | + * @example $('div').bgiframe(); |
| 33 | + * @before <div><p>Paragraph</p></div> |
| 34 | + * @result <div><iframe class="bgiframe".../><p>Paragraph</p></div> |
| 35 | + * |
| 36 | + * @param Map settings Optional settings to configure the iframe. |
| 37 | + * @option String|Number top The iframe must be offset to the top |
| 38 | + * by the width of the top border. This should be a negative |
| 39 | + * number representing the border-top-width. If a number is |
| 40 | + * is used here, pixels will be assumed. Otherwise, be sure |
| 41 | + * to specify a unit. An expression could also be used. |
| 42 | + * By default the value is "auto" which will use an expression |
| 43 | + * to get the border-top-width if it is in pixels. |
| 44 | + * @option String|Number left The iframe must be offset to the left |
| 45 | + * by the width of the left border. This should be a negative |
| 46 | + * number representing the border-left-width. If a number is |
| 47 | + * is used here, pixels will be assumed. Otherwise, be sure |
| 48 | + * to specify a unit. An expression could also be used. |
| 49 | + * By default the value is "auto" which will use an expression |
| 50 | + * to get the border-left-width if it is in pixels. |
| 51 | + * @option String|Number width This is the width of the iframe. If |
| 52 | + * a number is used here, pixels will be assume. Otherwise, be sure |
| 53 | + * to specify a unit. An experssion could also be used. |
| 54 | + * By default the value is "auto" which will use an experssion |
| 55 | + * to get the offsetWidth. |
| 56 | + * @option String|Number height This is the height of the iframe. If |
| 57 | + * a number is used here, pixels will be assume. Otherwise, be sure |
| 58 | + * to specify a unit. An experssion could also be used. |
| 59 | + * By default the value is "auto" which will use an experssion |
| 60 | + * to get the offsetHeight. |
| 61 | + * @option Boolean opacity This is a boolean representing whether or not |
| 62 | + * to use opacity. If set to true, the opacity of 0 is applied. If |
| 63 | + * set to false, the opacity filter is not applied. Default: true. |
| 64 | + * @option String src This setting is provided so that one could change |
| 65 | + * the src of the iframe to whatever they need. |
| 66 | + * Default: "javascript:false;" |
| 67 | + * |
| 68 | + * @name bgiframe |
| 69 | + * @type jQuery |
| 70 | + * @cat Plugins/bgiframe |
| 71 | + * @author Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net) |
| 72 | + */ |
| 73 | +$.fn.bgIframe = $.fn.bgiframe = function(s) { |
| 74 | + // This is only for IE6 |
| 75 | + if ( $.browser.msie && parseInt($.browser.version) <= 6 ) { |
| 76 | + s = $.extend({ |
| 77 | + top : 'auto', // auto == .currentStyle.borderTopWidth |
| 78 | + left : 'auto', // auto == .currentStyle.borderLeftWidth |
| 79 | + width : 'auto', // auto == offsetWidth |
| 80 | + height : 'auto', // auto == offsetHeight |
| 81 | + opacity : true, |
| 82 | + src : 'javascript:false;' |
| 83 | + }, s || {}); |
| 84 | + var prop = function(n){return n&&n.constructor==Number?n+'px':n;}, |
| 85 | + html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+ |
| 86 | + 'style="display:block;position:absolute;z-index:-1;'+ |
| 87 | + (s.opacity !== false?'filter:Alpha(Opacity=\'0\');':'')+ |
| 88 | + 'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+ |
| 89 | + 'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+ |
| 90 | + 'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+ |
| 91 | + 'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+ |
| 92 | + '"/>'; |
| 93 | + return this.each(function() { |
| 94 | + if ( $('> iframe.bgiframe', this).length == 0 ) |
| 95 | + this.insertBefore( document.createElement(html), this.firstChild ); |
| 96 | + }); |
| 97 | + } |
| 98 | + return this; |
| 99 | +}; |
| 100 | + |
| 101 | +// Add browser.version if it doesn't exist |
| 102 | +if (!$.browser.version) |
| 103 | + $.browser.version = navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)[1]; |
| 104 | + |
| 105 | +})(jQuery); |
\ No newline at end of file |
Index: trunk/extensions/Tooltips/jquery-tooltip/lib/jquery.js |
— | — | @@ -0,0 +1,3383 @@ |
| 2 | +(function(){ |
| 3 | +/* |
| 4 | + * jQuery 1.2.2 - New Wave Javascript |
| 5 | + * |
| 6 | + * Copyright (c) 2007 John Resig (jquery.com) |
| 7 | + * Dual licensed under the MIT (MIT-LICENSE.txt) |
| 8 | + * and GPL (GPL-LICENSE.txt) licenses. |
| 9 | + * |
| 10 | + * $Date: 2008-01-14 17:56:07 -0500 (Mon, 14 Jan 2008) $ |
| 11 | + * $Rev: 4454 $ |
| 12 | + */ |
| 13 | + |
| 14 | +// Map over jQuery in case of overwrite |
| 15 | +if ( window.jQuery ) |
| 16 | + var _jQuery = window.jQuery; |
| 17 | + |
| 18 | +var jQuery = window.jQuery = function( selector, context ) { |
| 19 | + // The jQuery object is actually just the init constructor 'enhanced' |
| 20 | + return new jQuery.prototype.init( selector, context ); |
| 21 | +}; |
| 22 | + |
| 23 | +// Map over the $ in case of overwrite |
| 24 | +if ( window.$ ) |
| 25 | + var _$ = window.$; |
| 26 | + |
| 27 | +// Map the jQuery namespace to the '$' one |
| 28 | +window.$ = jQuery; |
| 29 | + |
| 30 | +// A simple way to check for HTML strings or ID strings |
| 31 | +// (both of which we optimize for) |
| 32 | +var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/; |
| 33 | + |
| 34 | +// Is it a simple selector |
| 35 | +var isSimple = /^.[^:#\[\.]*$/; |
| 36 | + |
| 37 | +jQuery.fn = jQuery.prototype = { |
| 38 | + init: function( selector, context ) { |
| 39 | + // Make sure that a selection was provided |
| 40 | + selector = selector || document; |
| 41 | + |
| 42 | + // Handle $(DOMElement) |
| 43 | + if ( selector.nodeType ) { |
| 44 | + this[0] = selector; |
| 45 | + this.length = 1; |
| 46 | + return this; |
| 47 | + |
| 48 | + // Handle HTML strings |
| 49 | + } else if ( typeof selector == "string" ) { |
| 50 | + // Are we dealing with HTML string or an ID? |
| 51 | + var match = quickExpr.exec( selector ); |
| 52 | + |
| 53 | + // Verify a match, and that no context was specified for #id |
| 54 | + if ( match && (match[1] || !context) ) { |
| 55 | + |
| 56 | + // HANDLE: $(html) -> $(array) |
| 57 | + if ( match[1] ) |
| 58 | + selector = jQuery.clean( [ match[1] ], context ); |
| 59 | + |
| 60 | + // HANDLE: $("#id") |
| 61 | + else { |
| 62 | + var elem = document.getElementById( match[3] ); |
| 63 | + |
| 64 | + // Make sure an element was located |
| 65 | + if ( elem ) |
| 66 | + // Handle the case where IE and Opera return items |
| 67 | + // by name instead of ID |
| 68 | + if ( elem.id != match[3] ) |
| 69 | + return jQuery().find( selector ); |
| 70 | + |
| 71 | + // Otherwise, we inject the element directly into the jQuery object |
| 72 | + else { |
| 73 | + this[0] = elem; |
| 74 | + this.length = 1; |
| 75 | + return this; |
| 76 | + } |
| 77 | + |
| 78 | + else |
| 79 | + selector = []; |
| 80 | + } |
| 81 | + |
| 82 | + // HANDLE: $(expr, [context]) |
| 83 | + // (which is just equivalent to: $(content).find(expr) |
| 84 | + } else |
| 85 | + return new jQuery( context ).find( selector ); |
| 86 | + |
| 87 | + // HANDLE: $(function) |
| 88 | + // Shortcut for document ready |
| 89 | + } else if ( jQuery.isFunction( selector ) ) |
| 90 | + return new jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector ); |
| 91 | + |
| 92 | + return this.setArray( |
| 93 | + // HANDLE: $(array) |
| 94 | + selector.constructor == Array && selector || |
| 95 | + |
| 96 | + // HANDLE: $(arraylike) |
| 97 | + // Watch for when an array-like object, contains DOM nodes, is passed in as the selector |
| 98 | + (selector.jquery || selector.length && selector != window && !selector.nodeType && selector[0] != undefined && selector[0].nodeType) && jQuery.makeArray( selector ) || |
| 99 | + |
| 100 | + // HANDLE: $(*) |
| 101 | + [ selector ] ); |
| 102 | + }, |
| 103 | + |
| 104 | + // The current version of jQuery being used |
| 105 | + jquery: "1.2.2", |
| 106 | + |
| 107 | + // The number of elements contained in the matched element set |
| 108 | + size: function() { |
| 109 | + return this.length; |
| 110 | + }, |
| 111 | + |
| 112 | + // The number of elements contained in the matched element set |
| 113 | + length: 0, |
| 114 | + |
| 115 | + // Get the Nth element in the matched element set OR |
| 116 | + // Get the whole matched element set as a clean array |
| 117 | + get: function( num ) { |
| 118 | + return num == undefined ? |
| 119 | + |
| 120 | + // Return a 'clean' array |
| 121 | + jQuery.makeArray( this ) : |
| 122 | + |
| 123 | + // Return just the object |
| 124 | + this[ num ]; |
| 125 | + }, |
| 126 | + |
| 127 | + // Take an array of elements and push it onto the stack |
| 128 | + // (returning the new matched element set) |
| 129 | + pushStack: function( elems ) { |
| 130 | + // Build a new jQuery matched element set |
| 131 | + var ret = jQuery( elems ); |
| 132 | + |
| 133 | + // Add the old object onto the stack (as a reference) |
| 134 | + ret.prevObject = this; |
| 135 | + |
| 136 | + // Return the newly-formed element set |
| 137 | + return ret; |
| 138 | + }, |
| 139 | + |
| 140 | + // Force the current matched set of elements to become |
| 141 | + // the specified array of elements (destroying the stack in the process) |
| 142 | + // You should use pushStack() in order to do this, but maintain the stack |
| 143 | + setArray: function( elems ) { |
| 144 | + // Resetting the length to 0, then using the native Array push |
| 145 | + // is a super-fast way to populate an object with array-like properties |
| 146 | + this.length = 0; |
| 147 | + Array.prototype.push.apply( this, elems ); |
| 148 | + |
| 149 | + return this; |
| 150 | + }, |
| 151 | + |
| 152 | + // Execute a callback for every element in the matched set. |
| 153 | + // (You can seed the arguments with an array of args, but this is |
| 154 | + // only used internally.) |
| 155 | + each: function( callback, args ) { |
| 156 | + return jQuery.each( this, callback, args ); |
| 157 | + }, |
| 158 | + |
| 159 | + // Determine the position of an element within |
| 160 | + // the matched set of elements |
| 161 | + index: function( elem ) { |
| 162 | + var ret = -1; |
| 163 | + |
| 164 | + // Locate the position of the desired element |
| 165 | + this.each(function(i){ |
| 166 | + if ( this == elem ) |
| 167 | + ret = i; |
| 168 | + }); |
| 169 | + |
| 170 | + return ret; |
| 171 | + }, |
| 172 | + |
| 173 | + attr: function( name, value, type ) { |
| 174 | + var options = name; |
| 175 | + |
| 176 | + // Look for the case where we're accessing a style value |
| 177 | + if ( name.constructor == String ) |
| 178 | + if ( value == undefined ) |
| 179 | + return this.length && jQuery[ type || "attr" ]( this[0], name ) || undefined; |
| 180 | + |
| 181 | + else { |
| 182 | + options = {}; |
| 183 | + options[ name ] = value; |
| 184 | + } |
| 185 | + |
| 186 | + // Check to see if we're setting style values |
| 187 | + return this.each(function(i){ |
| 188 | + // Set all the styles |
| 189 | + for ( name in options ) |
| 190 | + jQuery.attr( |
| 191 | + type ? |
| 192 | + this.style : |
| 193 | + this, |
| 194 | + name, jQuery.prop( this, options[ name ], type, i, name ) |
| 195 | + ); |
| 196 | + }); |
| 197 | + }, |
| 198 | + |
| 199 | + css: function( key, value ) { |
| 200 | + // ignore negative width and height values |
| 201 | + if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) |
| 202 | + value = undefined; |
| 203 | + return this.attr( key, value, "curCSS" ); |
| 204 | + }, |
| 205 | + |
| 206 | + text: function( text ) { |
| 207 | + if ( typeof text != "object" && text != null ) |
| 208 | + return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); |
| 209 | + |
| 210 | + var ret = ""; |
| 211 | + |
| 212 | + jQuery.each( text || this, function(){ |
| 213 | + jQuery.each( this.childNodes, function(){ |
| 214 | + if ( this.nodeType != 8 ) |
| 215 | + ret += this.nodeType != 1 ? |
| 216 | + this.nodeValue : |
| 217 | + jQuery.fn.text( [ this ] ); |
| 218 | + }); |
| 219 | + }); |
| 220 | + |
| 221 | + return ret; |
| 222 | + }, |
| 223 | + |
| 224 | + wrapAll: function( html ) { |
| 225 | + if ( this[0] ) |
| 226 | + // The elements to wrap the target around |
| 227 | + jQuery( html, this[0].ownerDocument ) |
| 228 | + .clone() |
| 229 | + .insertBefore( this[0] ) |
| 230 | + .map(function(){ |
| 231 | + var elem = this; |
| 232 | + |
| 233 | + while ( elem.firstChild ) |
| 234 | + elem = elem.firstChild; |
| 235 | + |
| 236 | + return elem; |
| 237 | + }) |
| 238 | + .append(this); |
| 239 | + |
| 240 | + return this; |
| 241 | + }, |
| 242 | + |
| 243 | + wrapInner: function( html ) { |
| 244 | + return this.each(function(){ |
| 245 | + jQuery( this ).contents().wrapAll( html ); |
| 246 | + }); |
| 247 | + }, |
| 248 | + |
| 249 | + wrap: function( html ) { |
| 250 | + return this.each(function(){ |
| 251 | + jQuery( this ).wrapAll( html ); |
| 252 | + }); |
| 253 | + }, |
| 254 | + |
| 255 | + append: function() { |
| 256 | + return this.domManip(arguments, true, false, function(elem){ |
| 257 | + if (this.nodeType == 1) |
| 258 | + this.appendChild( elem ); |
| 259 | + }); |
| 260 | + }, |
| 261 | + |
| 262 | + prepend: function() { |
| 263 | + return this.domManip(arguments, true, true, function(elem){ |
| 264 | + if (this.nodeType == 1) |
| 265 | + this.insertBefore( elem, this.firstChild ); |
| 266 | + }); |
| 267 | + }, |
| 268 | + |
| 269 | + before: function() { |
| 270 | + return this.domManip(arguments, false, false, function(elem){ |
| 271 | + this.parentNode.insertBefore( elem, this ); |
| 272 | + }); |
| 273 | + }, |
| 274 | + |
| 275 | + after: function() { |
| 276 | + return this.domManip(arguments, false, true, function(elem){ |
| 277 | + this.parentNode.insertBefore( elem, this.nextSibling ); |
| 278 | + }); |
| 279 | + }, |
| 280 | + |
| 281 | + end: function() { |
| 282 | + return this.prevObject || jQuery( [] ); |
| 283 | + }, |
| 284 | + |
| 285 | + find: function( selector ) { |
| 286 | + var elems = jQuery.map(this, function(elem){ |
| 287 | + return jQuery.find( selector, elem ); |
| 288 | + }); |
| 289 | + |
| 290 | + return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ? |
| 291 | + jQuery.unique( elems ) : |
| 292 | + elems ); |
| 293 | + }, |
| 294 | + |
| 295 | + clone: function( events ) { |
| 296 | + // Do the clone |
| 297 | + var ret = this.map(function(){ |
| 298 | + if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) { |
| 299 | + // IE copies events bound via attachEvent when |
| 300 | + // using cloneNode. Calling detachEvent on the |
| 301 | + // clone will also remove the events from the orignal |
| 302 | + // In order to get around this, we use innerHTML. |
| 303 | + // Unfortunately, this means some modifications to |
| 304 | + // attributes in IE that are actually only stored |
| 305 | + // as properties will not be copied (such as the |
| 306 | + // the name attribute on an input). |
| 307 | + var clone = this.cloneNode(true), |
| 308 | + container = document.createElement("div"), |
| 309 | + container2 = document.createElement("div"); |
| 310 | + container.appendChild(clone); |
| 311 | + container2.innerHTML = container.innerHTML; |
| 312 | + return container2.firstChild; |
| 313 | + } else |
| 314 | + return this.cloneNode(true); |
| 315 | + }); |
| 316 | + |
| 317 | + // Need to set the expando to null on the cloned set if it exists |
| 318 | + // removeData doesn't work here, IE removes it from the original as well |
| 319 | + // this is primarily for IE but the data expando shouldn't be copied over in any browser |
| 320 | + var clone = ret.find("*").andSelf().each(function(){ |
| 321 | + if ( this[ expando ] != undefined ) |
| 322 | + this[ expando ] = null; |
| 323 | + }); |
| 324 | + |
| 325 | + // Copy the events from the original to the clone |
| 326 | + if ( events === true ) |
| 327 | + this.find("*").andSelf().each(function(i){ |
| 328 | + if (this.nodeType == 3) |
| 329 | + return; |
| 330 | + var events = jQuery.data( this, "events" ); |
| 331 | + |
| 332 | + for ( var type in events ) |
| 333 | + for ( var handler in events[ type ] ) |
| 334 | + jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data ); |
| 335 | + }); |
| 336 | + |
| 337 | + // Return the cloned set |
| 338 | + return ret; |
| 339 | + }, |
| 340 | + |
| 341 | + filter: function( selector ) { |
| 342 | + return this.pushStack( |
| 343 | + jQuery.isFunction( selector ) && |
| 344 | + jQuery.grep(this, function(elem, i){ |
| 345 | + return selector.call( elem, i ); |
| 346 | + }) || |
| 347 | + |
| 348 | + jQuery.multiFilter( selector, this ) ); |
| 349 | + }, |
| 350 | + |
| 351 | + not: function( selector ) { |
| 352 | + if ( selector.constructor == String ) |
| 353 | + // test special case where just one selector is passed in |
| 354 | + if ( isSimple.test( selector ) ) |
| 355 | + return this.pushStack( jQuery.multiFilter( selector, this, true ) ); |
| 356 | + else |
| 357 | + selector = jQuery.multiFilter( selector, this ); |
| 358 | + |
| 359 | + var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; |
| 360 | + return this.filter(function() { |
| 361 | + return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; |
| 362 | + }); |
| 363 | + }, |
| 364 | + |
| 365 | + add: function( selector ) { |
| 366 | + return !selector ? this : this.pushStack( jQuery.merge( |
| 367 | + this.get(), |
| 368 | + selector.constructor == String ? |
| 369 | + jQuery( selector ).get() : |
| 370 | + selector.length != undefined && (!selector.nodeName || jQuery.nodeName(selector, "form")) ? |
| 371 | + selector : [selector] ) ); |
| 372 | + }, |
| 373 | + |
| 374 | + is: function( selector ) { |
| 375 | + return selector ? |
| 376 | + jQuery.multiFilter( selector, this ).length > 0 : |
| 377 | + false; |
| 378 | + }, |
| 379 | + |
| 380 | + hasClass: function( selector ) { |
| 381 | + return this.is( "." + selector ); |
| 382 | + }, |
| 383 | + |
| 384 | + val: function( value ) { |
| 385 | + if ( value == undefined ) { |
| 386 | + |
| 387 | + if ( this.length ) { |
| 388 | + var elem = this[0]; |
| 389 | + |
| 390 | + // We need to handle select boxes special |
| 391 | + if ( jQuery.nodeName( elem, "select" ) ) { |
| 392 | + var index = elem.selectedIndex, |
| 393 | + values = [], |
| 394 | + options = elem.options, |
| 395 | + one = elem.type == "select-one"; |
| 396 | + |
| 397 | + // Nothing was selected |
| 398 | + if ( index < 0 ) |
| 399 | + return null; |
| 400 | + |
| 401 | + // Loop through all the selected options |
| 402 | + for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { |
| 403 | + var option = options[ i ]; |
| 404 | + |
| 405 | + if ( option.selected ) { |
| 406 | + // Get the specifc value for the option |
| 407 | + value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value; |
| 408 | + |
| 409 | + // We don't need an array for one selects |
| 410 | + if ( one ) |
| 411 | + return value; |
| 412 | + |
| 413 | + // Multi-Selects return an array |
| 414 | + values.push( value ); |
| 415 | + } |
| 416 | + } |
| 417 | + |
| 418 | + return values; |
| 419 | + |
| 420 | + // Everything else, we just grab the value |
| 421 | + } else |
| 422 | + return (this[0].value || "").replace(/\r/g, ""); |
| 423 | + |
| 424 | + } |
| 425 | + |
| 426 | + return undefined; |
| 427 | + } |
| 428 | + |
| 429 | + return this.each(function(){ |
| 430 | + if ( this.nodeType != 1 ) |
| 431 | + return; |
| 432 | + |
| 433 | + if ( value.constructor == Array && /radio|checkbox/.test( this.type ) ) |
| 434 | + this.checked = (jQuery.inArray(this.value, value) >= 0 || |
| 435 | + jQuery.inArray(this.name, value) >= 0); |
| 436 | + |
| 437 | + else if ( jQuery.nodeName( this, "select" ) ) { |
| 438 | + var values = value.constructor == Array ? |
| 439 | + value : |
| 440 | + [ value ]; |
| 441 | + |
| 442 | + jQuery( "option", this ).each(function(){ |
| 443 | + this.selected = (jQuery.inArray( this.value, values ) >= 0 || |
| 444 | + jQuery.inArray( this.text, values ) >= 0); |
| 445 | + }); |
| 446 | + |
| 447 | + if ( !values.length ) |
| 448 | + this.selectedIndex = -1; |
| 449 | + |
| 450 | + } else |
| 451 | + this.value = value; |
| 452 | + }); |
| 453 | + }, |
| 454 | + |
| 455 | + html: function( value ) { |
| 456 | + return value == undefined ? |
| 457 | + (this.length ? |
| 458 | + this[0].innerHTML : |
| 459 | + null) : |
| 460 | + this.empty().append( value ); |
| 461 | + }, |
| 462 | + |
| 463 | + replaceWith: function( value ) { |
| 464 | + return this.after( value ).remove(); |
| 465 | + }, |
| 466 | + |
| 467 | + eq: function( i ) { |
| 468 | + return this.slice( i, i + 1 ); |
| 469 | + }, |
| 470 | + |
| 471 | + slice: function() { |
| 472 | + return this.pushStack( Array.prototype.slice.apply( this, arguments ) ); |
| 473 | + }, |
| 474 | + |
| 475 | + map: function( callback ) { |
| 476 | + return this.pushStack( jQuery.map(this, function(elem, i){ |
| 477 | + return callback.call( elem, i, elem ); |
| 478 | + })); |
| 479 | + }, |
| 480 | + |
| 481 | + andSelf: function() { |
| 482 | + return this.add( this.prevObject ); |
| 483 | + }, |
| 484 | + |
| 485 | + domManip: function( args, table, reverse, callback ) { |
| 486 | + var clone = this.length > 1, elems; |
| 487 | + |
| 488 | + return this.each(function(){ |
| 489 | + if ( !elems ) { |
| 490 | + elems = jQuery.clean( args, this.ownerDocument ); |
| 491 | + |
| 492 | + if ( reverse ) |
| 493 | + elems.reverse(); |
| 494 | + } |
| 495 | + |
| 496 | + var obj = this; |
| 497 | + |
| 498 | + if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) ) |
| 499 | + obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") ); |
| 500 | + |
| 501 | + var scripts = jQuery( [] ); |
| 502 | + |
| 503 | + jQuery.each(elems, function(){ |
| 504 | + var elem = clone ? |
| 505 | + jQuery( this ).clone( true )[0] : |
| 506 | + this; |
| 507 | + |
| 508 | + // execute all scripts after the elements have been injected |
| 509 | + if ( jQuery.nodeName( elem, "script" ) ) { |
| 510 | + scripts = scripts.add( elem ); |
| 511 | + } else { |
| 512 | + // Remove any inner scripts for later evaluation |
| 513 | + if ( elem.nodeType == 1 ) |
| 514 | + scripts = scripts.add( jQuery( "script", elem ).remove() ); |
| 515 | + |
| 516 | + // Inject the elements into the document |
| 517 | + callback.call( obj, elem ); |
| 518 | + } |
| 519 | + }); |
| 520 | + |
| 521 | + scripts.each( evalScript ); |
| 522 | + }); |
| 523 | + } |
| 524 | +}; |
| 525 | + |
| 526 | +// Give the init function the jQuery prototype for later instantiation |
| 527 | +jQuery.prototype.init.prototype = jQuery.prototype; |
| 528 | + |
| 529 | +function evalScript( i, elem ) { |
| 530 | + if ( elem.src ) |
| 531 | + jQuery.ajax({ |
| 532 | + url: elem.src, |
| 533 | + async: false, |
| 534 | + dataType: "script" |
| 535 | + }); |
| 536 | + |
| 537 | + else |
| 538 | + jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); |
| 539 | + |
| 540 | + if ( elem.parentNode ) |
| 541 | + elem.parentNode.removeChild( elem ); |
| 542 | +} |
| 543 | + |
| 544 | +jQuery.extend = jQuery.fn.extend = function() { |
| 545 | + // copy reference to target object |
| 546 | + var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; |
| 547 | + |
| 548 | + // Handle a deep copy situation |
| 549 | + if ( target.constructor == Boolean ) { |
| 550 | + deep = target; |
| 551 | + target = arguments[1] || {}; |
| 552 | + // skip the boolean and the target |
| 553 | + i = 2; |
| 554 | + } |
| 555 | + |
| 556 | + // Handle case when target is a string or something (possible in deep copy) |
| 557 | + if ( typeof target != "object" && typeof target != "function" ) |
| 558 | + target = {}; |
| 559 | + |
| 560 | + // extend jQuery itself if only one argument is passed |
| 561 | + if ( length == 1 ) { |
| 562 | + target = this; |
| 563 | + i = 0; |
| 564 | + } |
| 565 | + |
| 566 | + for ( ; i < length; i++ ) |
| 567 | + // Only deal with non-null/undefined values |
| 568 | + if ( (options = arguments[ i ]) != null ) |
| 569 | + // Extend the base object |
| 570 | + for ( var name in options ) { |
| 571 | + // Prevent never-ending loop |
| 572 | + if ( target === options[ name ] ) |
| 573 | + continue; |
| 574 | + |
| 575 | + // Recurse if we're merging object values |
| 576 | + if ( deep && options[ name ] && typeof options[ name ] == "object" && target[ name ] && !options[ name ].nodeType ) |
| 577 | + target[ name ] = jQuery.extend( target[ name ], options[ name ] ); |
| 578 | + |
| 579 | + // Don't bring in undefined values |
| 580 | + else if ( options[ name ] != undefined ) |
| 581 | + target[ name ] = options[ name ]; |
| 582 | + |
| 583 | + } |
| 584 | + |
| 585 | + // Return the modified object |
| 586 | + return target; |
| 587 | +}; |
| 588 | + |
| 589 | +var expando = "jQuery" + (new Date()).getTime(), uuid = 0, windowData = {}; |
| 590 | + |
| 591 | +// exclude the following css properties to add px |
| 592 | +var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i; |
| 593 | + |
| 594 | +jQuery.extend({ |
| 595 | + noConflict: function( deep ) { |
| 596 | + window.$ = _$; |
| 597 | + |
| 598 | + if ( deep ) |
| 599 | + window.jQuery = _jQuery; |
| 600 | + |
| 601 | + return jQuery; |
| 602 | + }, |
| 603 | + |
| 604 | + // See test/unit/core.js for details concerning this function. |
| 605 | + isFunction: function( fn ) { |
| 606 | + return !!fn && typeof fn != "string" && !fn.nodeName && |
| 607 | + fn.constructor != Array && /function/i.test( fn + "" ); |
| 608 | + }, |
| 609 | + |
| 610 | + // check if an element is in a (or is an) XML document |
| 611 | + isXMLDoc: function( elem ) { |
| 612 | + return elem.documentElement && !elem.body || |
| 613 | + elem.tagName && elem.ownerDocument && !elem.ownerDocument.body; |
| 614 | + }, |
| 615 | + |
| 616 | + // Evalulates a script in a global context |
| 617 | + globalEval: function( data ) { |
| 618 | + data = jQuery.trim( data ); |
| 619 | + |
| 620 | + if ( data ) { |
| 621 | + // Inspired by code by Andrea Giammarchi |
| 622 | + // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html |
| 623 | + var head = document.getElementsByTagName("head")[0] || document.documentElement, |
| 624 | + script = document.createElement("script"); |
| 625 | + |
| 626 | + script.type = "text/javascript"; |
| 627 | + if ( jQuery.browser.msie ) |
| 628 | + script.text = data; |
| 629 | + else |
| 630 | + script.appendChild( document.createTextNode( data ) ); |
| 631 | + |
| 632 | + head.appendChild( script ); |
| 633 | + head.removeChild( script ); |
| 634 | + } |
| 635 | + }, |
| 636 | + |
| 637 | + nodeName: function( elem, name ) { |
| 638 | + return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); |
| 639 | + }, |
| 640 | + |
| 641 | + cache: {}, |
| 642 | + |
| 643 | + data: function( elem, name, data ) { |
| 644 | + elem = elem == window ? |
| 645 | + windowData : |
| 646 | + elem; |
| 647 | + |
| 648 | + var id = elem[ expando ]; |
| 649 | + |
| 650 | + // Compute a unique ID for the element |
| 651 | + if ( !id ) |
| 652 | + id = elem[ expando ] = ++uuid; |
| 653 | + |
| 654 | + // Only generate the data cache if we're |
| 655 | + // trying to access or manipulate it |
| 656 | + if ( name && !jQuery.cache[ id ] ) |
| 657 | + jQuery.cache[ id ] = {}; |
| 658 | + |
| 659 | + // Prevent overriding the named cache with undefined values |
| 660 | + if ( data != undefined ) |
| 661 | + jQuery.cache[ id ][ name ] = data; |
| 662 | + |
| 663 | + // Return the named cache data, or the ID for the element |
| 664 | + return name ? |
| 665 | + jQuery.cache[ id ][ name ] : |
| 666 | + id; |
| 667 | + }, |
| 668 | + |
| 669 | + removeData: function( elem, name ) { |
| 670 | + elem = elem == window ? |
| 671 | + windowData : |
| 672 | + elem; |
| 673 | + |
| 674 | + var id = elem[ expando ]; |
| 675 | + |
| 676 | + // If we want to remove a specific section of the element's data |
| 677 | + if ( name ) { |
| 678 | + if ( jQuery.cache[ id ] ) { |
| 679 | + // Remove the section of cache data |
| 680 | + delete jQuery.cache[ id ][ name ]; |
| 681 | + |
| 682 | + // If we've removed all the data, remove the element's cache |
| 683 | + name = ""; |
| 684 | + |
| 685 | + for ( name in jQuery.cache[ id ] ) |
| 686 | + break; |
| 687 | + |
| 688 | + if ( !name ) |
| 689 | + jQuery.removeData( elem ); |
| 690 | + } |
| 691 | + |
| 692 | + // Otherwise, we want to remove all of the element's data |
| 693 | + } else { |
| 694 | + // Clean up the element expando |
| 695 | + try { |
| 696 | + delete elem[ expando ]; |
| 697 | + } catch(e){ |
| 698 | + // IE has trouble directly removing the expando |
| 699 | + // but it's ok with using removeAttribute |
| 700 | + if ( elem.removeAttribute ) |
| 701 | + elem.removeAttribute( expando ); |
| 702 | + } |
| 703 | + |
| 704 | + // Completely remove the data cache |
| 705 | + delete jQuery.cache[ id ]; |
| 706 | + } |
| 707 | + }, |
| 708 | + |
| 709 | + // args is for internal usage only |
| 710 | + each: function( object, callback, args ) { |
| 711 | + if ( args ) { |
| 712 | + if ( object.length == undefined ) { |
| 713 | + for ( var name in object ) |
| 714 | + if ( callback.apply( object[ name ], args ) === false ) |
| 715 | + break; |
| 716 | + } else |
| 717 | + for ( var i = 0, length = object.length; i < length; i++ ) |
| 718 | + if ( callback.apply( object[ i ], args ) === false ) |
| 719 | + break; |
| 720 | + |
| 721 | + // A special, fast, case for the most common use of each |
| 722 | + } else { |
| 723 | + if ( object.length == undefined ) { |
| 724 | + for ( var name in object ) |
| 725 | + if ( callback.call( object[ name ], name, object[ name ] ) === false ) |
| 726 | + break; |
| 727 | + } else |
| 728 | + for ( var i = 0, length = object.length, value = object[0]; |
| 729 | + i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} |
| 730 | + } |
| 731 | + |
| 732 | + return object; |
| 733 | + }, |
| 734 | + |
| 735 | + prop: function( elem, value, type, i, name ) { |
| 736 | + // Handle executable functions |
| 737 | + if ( jQuery.isFunction( value ) ) |
| 738 | + value = value.call( elem, i ); |
| 739 | + |
| 740 | + // Handle passing in a number to a CSS property |
| 741 | + return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ? |
| 742 | + value + "px" : |
| 743 | + value; |
| 744 | + }, |
| 745 | + |
| 746 | + className: { |
| 747 | + // internal only, use addClass("class") |
| 748 | + add: function( elem, classNames ) { |
| 749 | + jQuery.each((classNames || "").split(/\s+/), function(i, className){ |
| 750 | + if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) |
| 751 | + elem.className += (elem.className ? " " : "") + className; |
| 752 | + }); |
| 753 | + }, |
| 754 | + |
| 755 | + // internal only, use removeClass("class") |
| 756 | + remove: function( elem, classNames ) { |
| 757 | + if (elem.nodeType == 1) |
| 758 | + elem.className = classNames != undefined ? |
| 759 | + jQuery.grep(elem.className.split(/\s+/), function(className){ |
| 760 | + return !jQuery.className.has( classNames, className ); |
| 761 | + }).join(" ") : |
| 762 | + ""; |
| 763 | + }, |
| 764 | + |
| 765 | + // internal only, use is(".class") |
| 766 | + has: function( elem, className ) { |
| 767 | + return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1; |
| 768 | + } |
| 769 | + }, |
| 770 | + |
| 771 | + // A method for quickly swapping in/out CSS properties to get correct calculations |
| 772 | + swap: function( elem, options, callback ) { |
| 773 | + var old = {}; |
| 774 | + // Remember the old values, and insert the new ones |
| 775 | + for ( var name in options ) { |
| 776 | + old[ name ] = elem.style[ name ]; |
| 777 | + elem.style[ name ] = options[ name ]; |
| 778 | + } |
| 779 | + |
| 780 | + callback.call( elem ); |
| 781 | + |
| 782 | + // Revert the old values |
| 783 | + for ( var name in options ) |
| 784 | + elem.style[ name ] = old[ name ]; |
| 785 | + }, |
| 786 | + |
| 787 | + css: function( elem, name, force ) { |
| 788 | + if ( name == "width" || name == "height" ) { |
| 789 | + var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; |
| 790 | + |
| 791 | + function getWH() { |
| 792 | + val = name == "width" ? elem.offsetWidth : elem.offsetHeight; |
| 793 | + var padding = 0, border = 0; |
| 794 | + jQuery.each( which, function() { |
| 795 | + padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; |
| 796 | + border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; |
| 797 | + }); |
| 798 | + val -= Math.round(padding + border); |
| 799 | + } |
| 800 | + |
| 801 | + if ( jQuery(elem).is(":visible") ) |
| 802 | + getWH(); |
| 803 | + else |
| 804 | + jQuery.swap( elem, props, getWH ); |
| 805 | + |
| 806 | + return Math.max(0, val); |
| 807 | + } |
| 808 | + |
| 809 | + return jQuery.curCSS( elem, name, force ); |
| 810 | + }, |
| 811 | + |
| 812 | + curCSS: function( elem, name, force ) { |
| 813 | + var ret; |
| 814 | + |
| 815 | + // A helper method for determining if an element's values are broken |
| 816 | + function color( elem ) { |
| 817 | + if ( !jQuery.browser.safari ) |
| 818 | + return false; |
| 819 | + |
| 820 | + var ret = document.defaultView.getComputedStyle( elem, null ); |
| 821 | + return !ret || ret.getPropertyValue("color") == ""; |
| 822 | + } |
| 823 | + |
| 824 | + // We need to handle opacity special in IE |
| 825 | + if ( name == "opacity" && jQuery.browser.msie ) { |
| 826 | + ret = jQuery.attr( elem.style, "opacity" ); |
| 827 | + |
| 828 | + return ret == "" ? |
| 829 | + "1" : |
| 830 | + ret; |
| 831 | + } |
| 832 | + // Opera sometimes will give the wrong display answer, this fixes it, see #2037 |
| 833 | + if ( jQuery.browser.opera && name == "display" ) { |
| 834 | + var save = elem.style.display; |
| 835 | + elem.style.display = "block"; |
| 836 | + elem.style.display = save; |
| 837 | + } |
| 838 | + |
| 839 | + // Make sure we're using the right name for getting the float value |
| 840 | + if ( name.match( /float/i ) ) |
| 841 | + name = styleFloat; |
| 842 | + |
| 843 | + if ( !force && elem.style && elem.style[ name ] ) |
| 844 | + ret = elem.style[ name ]; |
| 845 | + |
| 846 | + else if ( document.defaultView && document.defaultView.getComputedStyle ) { |
| 847 | + |
| 848 | + // Only "float" is needed here |
| 849 | + if ( name.match( /float/i ) ) |
| 850 | + name = "float"; |
| 851 | + |
| 852 | + name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); |
| 853 | + |
| 854 | + var getComputedStyle = document.defaultView.getComputedStyle( elem, null ); |
| 855 | + |
| 856 | + if ( getComputedStyle && !color( elem ) ) |
| 857 | + ret = getComputedStyle.getPropertyValue( name ); |
| 858 | + |
| 859 | + // If the element isn't reporting its values properly in Safari |
| 860 | + // then some display: none elements are involved |
| 861 | + else { |
| 862 | + var swap = [], stack = []; |
| 863 | + |
| 864 | + // Locate all of the parent display: none elements |
| 865 | + for ( var a = elem; a && color(a); a = a.parentNode ) |
| 866 | + stack.unshift(a); |
| 867 | + |
| 868 | + // Go through and make them visible, but in reverse |
| 869 | + // (It would be better if we knew the exact display type that they had) |
| 870 | + for ( var i = 0; i < stack.length; i++ ) |
| 871 | + if ( color( stack[ i ] ) ) { |
| 872 | + swap[ i ] = stack[ i ].style.display; |
| 873 | + stack[ i ].style.display = "block"; |
| 874 | + } |
| 875 | + |
| 876 | + // Since we flip the display style, we have to handle that |
| 877 | + // one special, otherwise get the value |
| 878 | + ret = name == "display" && swap[ stack.length - 1 ] != null ? |
| 879 | + "none" : |
| 880 | + ( getComputedStyle && getComputedStyle.getPropertyValue( name ) ) || ""; |
| 881 | + |
| 882 | + // Finally, revert the display styles back |
| 883 | + for ( var i = 0; i < swap.length; i++ ) |
| 884 | + if ( swap[ i ] != null ) |
| 885 | + stack[ i ].style.display = swap[ i ]; |
| 886 | + } |
| 887 | + |
| 888 | + // We should always get a number back from opacity |
| 889 | + if ( name == "opacity" && ret == "" ) |
| 890 | + ret = "1"; |
| 891 | + |
| 892 | + } else if ( elem.currentStyle ) { |
| 893 | + var camelCase = name.replace(/\-(\w)/g, function(all, letter){ |
| 894 | + return letter.toUpperCase(); |
| 895 | + }); |
| 896 | + |
| 897 | + ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; |
| 898 | + |
| 899 | + // From the awesome hack by Dean Edwards |
| 900 | + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 |
| 901 | + |
| 902 | + // If we're not dealing with a regular pixel number |
| 903 | + // but a number that has a weird ending, we need to convert it to pixels |
| 904 | + if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { |
| 905 | + // Remember the original values |
| 906 | + var style = elem.style.left, runtimeStyle = elem.runtimeStyle.left; |
| 907 | + |
| 908 | + // Put in the new values to get a computed value out |
| 909 | + elem.runtimeStyle.left = elem.currentStyle.left; |
| 910 | + elem.style.left = ret || 0; |
| 911 | + ret = elem.style.pixelLeft + "px"; |
| 912 | + |
| 913 | + // Revert the changed values |
| 914 | + elem.style.left = style; |
| 915 | + elem.runtimeStyle.left = runtimeStyle; |
| 916 | + } |
| 917 | + } |
| 918 | + |
| 919 | + return ret; |
| 920 | + }, |
| 921 | + |
| 922 | + clean: function( elems, context ) { |
| 923 | + var ret = []; |
| 924 | + context = context || document; |
| 925 | + // !context.createElement fails in IE with an error but returns typeof 'object' |
| 926 | + if (typeof context.createElement == 'undefined') |
| 927 | + context = context.ownerDocument || context[0] && context[0].ownerDocument || document; |
| 928 | + |
| 929 | + jQuery.each(elems, function(i, elem){ |
| 930 | + if ( !elem ) |
| 931 | + return; |
| 932 | + |
| 933 | + if ( elem.constructor == Number ) |
| 934 | + elem = elem.toString(); |
| 935 | + |
| 936 | + // Convert html string into DOM nodes |
| 937 | + if ( typeof elem == "string" ) { |
| 938 | + // Fix "XHTML"-style tags in all browsers |
| 939 | + elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ |
| 940 | + return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? |
| 941 | + all : |
| 942 | + front + "></" + tag + ">"; |
| 943 | + }); |
| 944 | + |
| 945 | + // Trim whitespace, otherwise indexOf won't work as expected |
| 946 | + var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div"); |
| 947 | + |
| 948 | + var wrap = |
| 949 | + // option or optgroup |
| 950 | + !tags.indexOf("<opt") && |
| 951 | + [ 1, "<select multiple='multiple'>", "</select>" ] || |
| 952 | + |
| 953 | + !tags.indexOf("<leg") && |
| 954 | + [ 1, "<fieldset>", "</fieldset>" ] || |
| 955 | + |
| 956 | + tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && |
| 957 | + [ 1, "<table>", "</table>" ] || |
| 958 | + |
| 959 | + !tags.indexOf("<tr") && |
| 960 | + [ 2, "<table><tbody>", "</tbody></table>" ] || |
| 961 | + |
| 962 | + // <thead> matched above |
| 963 | + (!tags.indexOf("<td") || !tags.indexOf("<th")) && |
| 964 | + [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] || |
| 965 | + |
| 966 | + !tags.indexOf("<col") && |
| 967 | + [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] || |
| 968 | + |
| 969 | + // IE can't serialize <link> and <script> tags normally |
| 970 | + jQuery.browser.msie && |
| 971 | + [ 1, "div<div>", "</div>" ] || |
| 972 | + |
| 973 | + [ 0, "", "" ]; |
| 974 | + |
| 975 | + // Go to html and back, then peel off extra wrappers |
| 976 | + div.innerHTML = wrap[1] + elem + wrap[2]; |
| 977 | + |
| 978 | + // Move to the right depth |
| 979 | + while ( wrap[0]-- ) |
| 980 | + div = div.lastChild; |
| 981 | + |
| 982 | + // Remove IE's autoinserted <tbody> from table fragments |
| 983 | + if ( jQuery.browser.msie ) { |
| 984 | + |
| 985 | + // String was a <table>, *may* have spurious <tbody> |
| 986 | + var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ? |
| 987 | + div.firstChild && div.firstChild.childNodes : |
| 988 | + |
| 989 | + // String was a bare <thead> or <tfoot> |
| 990 | + wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ? |
| 991 | + div.childNodes : |
| 992 | + []; |
| 993 | + |
| 994 | + for ( var j = tbody.length - 1; j >= 0 ; --j ) |
| 995 | + if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) |
| 996 | + tbody[ j ].parentNode.removeChild( tbody[ j ] ); |
| 997 | + |
| 998 | + // IE completely kills leading whitespace when innerHTML is used |
| 999 | + if ( /^\s/.test( elem ) ) |
| 1000 | + div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild ); |
| 1001 | + |
| 1002 | + } |
| 1003 | + |
| 1004 | + elem = jQuery.makeArray( div.childNodes ); |
| 1005 | + } |
| 1006 | + |
| 1007 | + if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) ) |
| 1008 | + return; |
| 1009 | + |
| 1010 | + if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options ) |
| 1011 | + ret.push( elem ); |
| 1012 | + |
| 1013 | + else |
| 1014 | + ret = jQuery.merge( ret, elem ); |
| 1015 | + |
| 1016 | + }); |
| 1017 | + |
| 1018 | + return ret; |
| 1019 | + }, |
| 1020 | + |
| 1021 | + attr: function( elem, name, value ) { |
| 1022 | + // don't set attributes on text and comment nodes |
| 1023 | + if (!elem || elem.nodeType == 3 || elem.nodeType == 8) |
| 1024 | + return undefined; |
| 1025 | + |
| 1026 | + var fix = jQuery.isXMLDoc( elem ) ? |
| 1027 | + {} : |
| 1028 | + jQuery.props; |
| 1029 | + |
| 1030 | + // Safari mis-reports the default selected property of a hidden option |
| 1031 | + // Accessing the parent's selectedIndex property fixes it |
| 1032 | + if ( name == "selected" && jQuery.browser.safari ) |
| 1033 | + elem.parentNode.selectedIndex; |
| 1034 | + |
| 1035 | + // Certain attributes only work when accessed via the old DOM 0 way |
| 1036 | + if ( fix[ name ] ) { |
| 1037 | + if ( value != undefined ) |
| 1038 | + elem[ fix[ name ] ] = value; |
| 1039 | + |
| 1040 | + return elem[ fix[ name ] ]; |
| 1041 | + |
| 1042 | + } else if ( jQuery.browser.msie && name == "style" ) |
| 1043 | + return jQuery.attr( elem.style, "cssText", value ); |
| 1044 | + |
| 1045 | + else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName( elem, "form" ) && (name == "action" || name == "method") ) |
| 1046 | + return elem.getAttributeNode( name ).nodeValue; |
| 1047 | + |
| 1048 | + // IE elem.getAttribute passes even for style |
| 1049 | + else if ( elem.tagName ) { |
| 1050 | + |
| 1051 | + if ( value != undefined ) { |
| 1052 | + // We can't allow the type property to be changed (since it causes problems in IE) |
| 1053 | + if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode ) |
| 1054 | + throw "type property can't be changed"; |
| 1055 | + |
| 1056 | + // convert the value to a string (all browsers do this but IE) see #1070 |
| 1057 | + elem.setAttribute( name, "" + value ); |
| 1058 | + } |
| 1059 | + |
| 1060 | + if ( jQuery.browser.msie && /href|src/.test( name ) && !jQuery.isXMLDoc( elem ) ) |
| 1061 | + return elem.getAttribute( name, 2 ); |
| 1062 | + |
| 1063 | + return elem.getAttribute( name ); |
| 1064 | + |
| 1065 | + // elem is actually elem.style ... set the style |
| 1066 | + } else { |
| 1067 | + // IE actually uses filters for opacity |
| 1068 | + if ( name == "opacity" && jQuery.browser.msie ) { |
| 1069 | + if ( value != undefined ) { |
| 1070 | + // IE has trouble with opacity if it does not have layout |
| 1071 | + // Force it by setting the zoom level |
| 1072 | + elem.zoom = 1; |
| 1073 | + |
| 1074 | + // Set the alpha filter to set the opacity |
| 1075 | + elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) + |
| 1076 | + (parseFloat( value ).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"); |
| 1077 | + } |
| 1078 | + |
| 1079 | + return elem.filter && elem.filter.indexOf("opacity=") >= 0 ? |
| 1080 | + (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() : |
| 1081 | + ""; |
| 1082 | + } |
| 1083 | + |
| 1084 | + name = name.replace(/-([a-z])/ig, function(all, letter){ |
| 1085 | + return letter.toUpperCase(); |
| 1086 | + }); |
| 1087 | + |
| 1088 | + if ( value != undefined ) |
| 1089 | + elem[ name ] = value; |
| 1090 | + |
| 1091 | + return elem[ name ]; |
| 1092 | + } |
| 1093 | + }, |
| 1094 | + |
| 1095 | + trim: function( text ) { |
| 1096 | + return (text || "").replace( /^\s+|\s+$/g, "" ); |
| 1097 | + }, |
| 1098 | + |
| 1099 | + makeArray: function( array ) { |
| 1100 | + var ret = []; |
| 1101 | + |
| 1102 | + // Need to use typeof to fight Safari childNodes crashes |
| 1103 | + if ( typeof array != "array" ) |
| 1104 | + for ( var i = 0, length = array.length; i < length; i++ ) |
| 1105 | + ret.push( array[ i ] ); |
| 1106 | + else |
| 1107 | + ret = array.slice( 0 ); |
| 1108 | + |
| 1109 | + return ret; |
| 1110 | + }, |
| 1111 | + |
| 1112 | + inArray: function( elem, array ) { |
| 1113 | + for ( var i = 0, length = array.length; i < length; i++ ) |
| 1114 | + if ( array[ i ] == elem ) |
| 1115 | + return i; |
| 1116 | + |
| 1117 | + return -1; |
| 1118 | + }, |
| 1119 | + |
| 1120 | + merge: function( first, second ) { |
| 1121 | + // We have to loop this way because IE & Opera overwrite the length |
| 1122 | + // expando of getElementsByTagName |
| 1123 | + |
| 1124 | + // Also, we need to make sure that the correct elements are being returned |
| 1125 | + // (IE returns comment nodes in a '*' query) |
| 1126 | + if ( jQuery.browser.msie ) { |
| 1127 | + for ( var i = 0; second[ i ]; i++ ) |
| 1128 | + if ( second[ i ].nodeType != 8 ) |
| 1129 | + first.push( second[ i ] ); |
| 1130 | + |
| 1131 | + } else |
| 1132 | + for ( var i = 0; second[ i ]; i++ ) |
| 1133 | + first.push( second[ i ] ); |
| 1134 | + |
| 1135 | + return first; |
| 1136 | + }, |
| 1137 | + |
| 1138 | + unique: function( array ) { |
| 1139 | + var ret = [], done = {}; |
| 1140 | + |
| 1141 | + try { |
| 1142 | + |
| 1143 | + for ( var i = 0, length = array.length; i < length; i++ ) { |
| 1144 | + var id = jQuery.data( array[ i ] ); |
| 1145 | + |
| 1146 | + if ( !done[ id ] ) { |
| 1147 | + done[ id ] = true; |
| 1148 | + ret.push( array[ i ] ); |
| 1149 | + } |
| 1150 | + } |
| 1151 | + |
| 1152 | + } catch( e ) { |
| 1153 | + ret = array; |
| 1154 | + } |
| 1155 | + |
| 1156 | + return ret; |
| 1157 | + }, |
| 1158 | + |
| 1159 | + grep: function( elems, callback, inv ) { |
| 1160 | + // If a string is passed in for the function, make a function |
| 1161 | + // for it (a handy shortcut) |
| 1162 | + if ( typeof callback == "string" ) |
| 1163 | + callback = eval("false||function(a,i){return " + callback + "}"); |
| 1164 | + |
| 1165 | + var ret = []; |
| 1166 | + |
| 1167 | + // Go through the array, only saving the items |
| 1168 | + // that pass the validator function |
| 1169 | + for ( var i = 0, length = elems.length; i < length; i++ ) |
| 1170 | + if ( !inv && callback( elems[ i ], i ) || inv && !callback( elems[ i ], i ) ) |
| 1171 | + ret.push( elems[ i ] ); |
| 1172 | + |
| 1173 | + return ret; |
| 1174 | + }, |
| 1175 | + |
| 1176 | + map: function( elems, callback ) { |
| 1177 | + var ret = []; |
| 1178 | + |
| 1179 | + // Go through the array, translating each of the items to their |
| 1180 | + // new value (or values). |
| 1181 | + for ( var i = 0, length = elems.length; i < length; i++ ) { |
| 1182 | + var value = callback( elems[ i ], i ); |
| 1183 | + |
| 1184 | + if ( value !== null && value != undefined ) { |
| 1185 | + if ( value.constructor != Array ) |
| 1186 | + value = [ value ]; |
| 1187 | + |
| 1188 | + ret = ret.concat( value ); |
| 1189 | + } |
| 1190 | + } |
| 1191 | + |
| 1192 | + return ret; |
| 1193 | + } |
| 1194 | +}); |
| 1195 | + |
| 1196 | +var userAgent = navigator.userAgent.toLowerCase(); |
| 1197 | + |
| 1198 | +// Figure out what browser is being used |
| 1199 | +jQuery.browser = { |
| 1200 | + version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1], |
| 1201 | + safari: /webkit/.test( userAgent ), |
| 1202 | + opera: /opera/.test( userAgent ), |
| 1203 | + msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), |
| 1204 | + mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) |
| 1205 | +}; |
| 1206 | + |
| 1207 | +var styleFloat = jQuery.browser.msie ? |
| 1208 | + "styleFloat" : |
| 1209 | + "cssFloat"; |
| 1210 | + |
| 1211 | +jQuery.extend({ |
| 1212 | + // Check to see if the W3C box model is being used |
| 1213 | + boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat", |
| 1214 | + |
| 1215 | + props: { |
| 1216 | + "for": "htmlFor", |
| 1217 | + "class": "className", |
| 1218 | + "float": styleFloat, |
| 1219 | + cssFloat: styleFloat, |
| 1220 | + styleFloat: styleFloat, |
| 1221 | + innerHTML: "innerHTML", |
| 1222 | + className: "className", |
| 1223 | + value: "value", |
| 1224 | + disabled: "disabled", |
| 1225 | + checked: "checked", |
| 1226 | + readonly: "readOnly", |
| 1227 | + selected: "selected", |
| 1228 | + maxlength: "maxLength", |
| 1229 | + selectedIndex: "selectedIndex", |
| 1230 | + defaultValue: "defaultValue", |
| 1231 | + tagName: "tagName", |
| 1232 | + nodeName: "nodeName" |
| 1233 | + } |
| 1234 | +}); |
| 1235 | + |
| 1236 | +jQuery.each({ |
| 1237 | + parent: "elem.parentNode", |
| 1238 | + parents: "jQuery.dir(elem,'parentNode')", |
| 1239 | + next: "jQuery.nth(elem,2,'nextSibling')", |
| 1240 | + prev: "jQuery.nth(elem,2,'previousSibling')", |
| 1241 | + nextAll: "jQuery.dir(elem,'nextSibling')", |
| 1242 | + prevAll: "jQuery.dir(elem,'previousSibling')", |
| 1243 | + siblings: "jQuery.sibling(elem.parentNode.firstChild,elem)", |
| 1244 | + children: "jQuery.sibling(elem.firstChild)", |
| 1245 | + contents: "jQuery.nodeName(elem,'iframe')?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes)" |
| 1246 | +}, function(name, fn){ |
| 1247 | + fn = eval("false||function(elem){return " + fn + "}"); |
| 1248 | + |
| 1249 | + jQuery.fn[ name ] = function( selector ) { |
| 1250 | + var ret = jQuery.map( this, fn ); |
| 1251 | + |
| 1252 | + if ( selector && typeof selector == "string" ) |
| 1253 | + ret = jQuery.multiFilter( selector, ret ); |
| 1254 | + |
| 1255 | + return this.pushStack( jQuery.unique( ret ) ); |
| 1256 | + }; |
| 1257 | +}); |
| 1258 | + |
| 1259 | +jQuery.each({ |
| 1260 | + appendTo: "append", |
| 1261 | + prependTo: "prepend", |
| 1262 | + insertBefore: "before", |
| 1263 | + insertAfter: "after", |
| 1264 | + replaceAll: "replaceWith" |
| 1265 | +}, function(name, original){ |
| 1266 | + jQuery.fn[ name ] = function() { |
| 1267 | + var args = arguments; |
| 1268 | + |
| 1269 | + return this.each(function(){ |
| 1270 | + for ( var i = 0, length = args.length; i < length; i++ ) |
| 1271 | + jQuery( args[ i ] )[ original ]( this ); |
| 1272 | + }); |
| 1273 | + }; |
| 1274 | +}); |
| 1275 | + |
| 1276 | +jQuery.each({ |
| 1277 | + removeAttr: function( name ) { |
| 1278 | + jQuery.attr( this, name, "" ); |
| 1279 | + if (this.nodeType == 1) |
| 1280 | + this.removeAttribute( name ); |
| 1281 | + }, |
| 1282 | + |
| 1283 | + addClass: function( classNames ) { |
| 1284 | + jQuery.className.add( this, classNames ); |
| 1285 | + }, |
| 1286 | + |
| 1287 | + removeClass: function( classNames ) { |
| 1288 | + jQuery.className.remove( this, classNames ); |
| 1289 | + }, |
| 1290 | + |
| 1291 | + toggleClass: function( classNames ) { |
| 1292 | + jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames ); |
| 1293 | + }, |
| 1294 | + |
| 1295 | + remove: function( selector ) { |
| 1296 | + if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) { |
| 1297 | + // Prevent memory leaks |
| 1298 | + jQuery( "*", this ).add(this).each(function(){ |
| 1299 | + jQuery.event.remove(this); |
| 1300 | + jQuery.removeData(this); |
| 1301 | + }); |
| 1302 | + if (this.parentNode) |
| 1303 | + this.parentNode.removeChild( this ); |
| 1304 | + } |
| 1305 | + }, |
| 1306 | + |
| 1307 | + empty: function() { |
| 1308 | + // Remove element nodes and prevent memory leaks |
| 1309 | + jQuery( ">*", this ).remove(); |
| 1310 | + |
| 1311 | + // Remove any remaining nodes |
| 1312 | + while ( this.firstChild ) |
| 1313 | + this.removeChild( this.firstChild ); |
| 1314 | + } |
| 1315 | +}, function(name, fn){ |
| 1316 | + jQuery.fn[ name ] = function(){ |
| 1317 | + return this.each( fn, arguments ); |
| 1318 | + }; |
| 1319 | +}); |
| 1320 | + |
| 1321 | +jQuery.each([ "Height", "Width" ], function(i, name){ |
| 1322 | + var type = name.toLowerCase(); |
| 1323 | + |
| 1324 | + jQuery.fn[ type ] = function( size ) { |
| 1325 | + // Get window width or height |
| 1326 | + return this[0] == window ? |
| 1327 | + // Opera reports document.body.client[Width/Height] properly in both quirks and standards |
| 1328 | + jQuery.browser.opera && document.body[ "client" + name ] || |
| 1329 | + |
| 1330 | + // Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths) |
| 1331 | + jQuery.browser.safari && window[ "inner" + name ] || |
| 1332 | + |
| 1333 | + // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode |
| 1334 | + document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] : |
| 1335 | + |
| 1336 | + // Get document width or height |
| 1337 | + this[0] == document ? |
| 1338 | + // Either scroll[Width/Height] or offset[Width/Height], whichever is greater |
| 1339 | + Math.max( |
| 1340 | + Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]), |
| 1341 | + Math.max(document.body["offset" + name], document.documentElement["offset" + name]) |
| 1342 | + ) : |
| 1343 | + |
| 1344 | + // Get or set width or height on the element |
| 1345 | + size == undefined ? |
| 1346 | + // Get width or height on the element |
| 1347 | + (this.length ? jQuery.css( this[0], type ) : null) : |
| 1348 | + |
| 1349 | + // Set the width or height on the element (default to pixels if value is unitless) |
| 1350 | + this.css( type, size.constructor == String ? size : size + "px" ); |
| 1351 | + }; |
| 1352 | +}); |
| 1353 | + |
| 1354 | +var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ? |
| 1355 | + "(?:[\\w*_-]|\\\\.)" : |
| 1356 | + "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)", |
| 1357 | + quickChild = new RegExp("^>\\s*(" + chars + "+)"), |
| 1358 | + quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"), |
| 1359 | + quickClass = new RegExp("^([#.]?)(" + chars + "*)"); |
| 1360 | + |
| 1361 | +jQuery.extend({ |
| 1362 | + expr: { |
| 1363 | + "": "m[2]=='*'||jQuery.nodeName(a,m[2])", |
| 1364 | + "#": "a.getAttribute('id')==m[2]", |
| 1365 | + ":": { |
| 1366 | + // Position Checks |
| 1367 | + lt: "i<m[3]-0", |
| 1368 | + gt: "i>m[3]-0", |
| 1369 | + nth: "m[3]-0==i", |
| 1370 | + eq: "m[3]-0==i", |
| 1371 | + first: "i==0", |
| 1372 | + last: "i==r.length-1", |
| 1373 | + even: "i%2==0", |
| 1374 | + odd: "i%2", |
| 1375 | + |
| 1376 | + // Child Checks |
| 1377 | + "first-child": "a.parentNode.getElementsByTagName('*')[0]==a", |
| 1378 | + "last-child": "jQuery.nth(a.parentNode.lastChild,1,'previousSibling')==a", |
| 1379 | + "only-child": "!jQuery.nth(a.parentNode.lastChild,2,'previousSibling')", |
| 1380 | + |
| 1381 | + // Parent Checks |
| 1382 | + parent: "a.firstChild", |
| 1383 | + empty: "!a.firstChild", |
| 1384 | + |
| 1385 | + // Text Check |
| 1386 | + contains: "(a.textContent||a.innerText||jQuery(a).text()||'').indexOf(m[3])>=0", |
| 1387 | + |
| 1388 | + // Visibility |
| 1389 | + visible: '"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden"', |
| 1390 | + hidden: '"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden"', |
| 1391 | + |
| 1392 | + // Form attributes |
| 1393 | + enabled: "!a.disabled", |
| 1394 | + disabled: "a.disabled", |
| 1395 | + checked: "a.checked", |
| 1396 | + selected: "a.selected||jQuery.attr(a,'selected')", |
| 1397 | + |
| 1398 | + // Form elements |
| 1399 | + text: "'text'==a.type", |
| 1400 | + radio: "'radio'==a.type", |
| 1401 | + checkbox: "'checkbox'==a.type", |
| 1402 | + file: "'file'==a.type", |
| 1403 | + password: "'password'==a.type", |
| 1404 | + submit: "'submit'==a.type", |
| 1405 | + image: "'image'==a.type", |
| 1406 | + reset: "'reset'==a.type", |
| 1407 | + button: '"button"==a.type||jQuery.nodeName(a,"button")', |
| 1408 | + input: "/input|select|textarea|button/i.test(a.nodeName)", |
| 1409 | + |
| 1410 | + // :has() |
| 1411 | + has: "jQuery.find(m[3],a).length", |
| 1412 | + |
| 1413 | + // :header |
| 1414 | + header: "/h\\d/i.test(a.nodeName)", |
| 1415 | + |
| 1416 | + // :animated |
| 1417 | + animated: "jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length" |
| 1418 | + } |
| 1419 | + }, |
| 1420 | + |
| 1421 | + // The regular expressions that power the parsing engine |
| 1422 | + parse: [ |
| 1423 | + // Match: [@value='test'], [@foo] |
| 1424 | + /^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/, |
| 1425 | + |
| 1426 | + // Match: :contains('foo') |
| 1427 | + /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/, |
| 1428 | + |
| 1429 | + // Match: :even, :last-chlid, #id, .class |
| 1430 | + new RegExp("^([:.#]*)(" + chars + "+)") |
| 1431 | + ], |
| 1432 | + |
| 1433 | + multiFilter: function( expr, elems, not ) { |
| 1434 | + var old, cur = []; |
| 1435 | + |
| 1436 | + while ( expr && expr != old ) { |
| 1437 | + old = expr; |
| 1438 | + var f = jQuery.filter( expr, elems, not ); |
| 1439 | + expr = f.t.replace(/^\s*,\s*/, "" ); |
| 1440 | + cur = not ? elems = f.r : jQuery.merge( cur, f.r ); |
| 1441 | + } |
| 1442 | + |
| 1443 | + return cur; |
| 1444 | + }, |
| 1445 | + |
| 1446 | + find: function( t, context ) { |
| 1447 | + // Quickly handle non-string expressions |
| 1448 | + if ( typeof t != "string" ) |
| 1449 | + return [ t ]; |
| 1450 | + |
| 1451 | + // check to make sure context is a DOM element or a document |
| 1452 | + if ( context && context.nodeType != 1 && context.nodeType != 9) |
| 1453 | + return [ ]; |
| 1454 | + |
| 1455 | + // Set the correct context (if none is provided) |
| 1456 | + context = context || document; |
| 1457 | + |
| 1458 | + // Initialize the search |
| 1459 | + var ret = [context], done = [], last, nodeName; |
| 1460 | + |
| 1461 | + // Continue while a selector expression exists, and while |
| 1462 | + // we're no longer looping upon ourselves |
| 1463 | + while ( t && last != t ) { |
| 1464 | + var r = []; |
| 1465 | + last = t; |
| 1466 | + |
| 1467 | + t = jQuery.trim(t); |
| 1468 | + |
| 1469 | + var foundToken = false; |
| 1470 | + |
| 1471 | + // An attempt at speeding up child selectors that |
| 1472 | + // point to a specific element tag |
| 1473 | + var re = quickChild; |
| 1474 | + var m = re.exec(t); |
| 1475 | + |
| 1476 | + if ( m ) { |
| 1477 | + nodeName = m[1].toUpperCase(); |
| 1478 | + |
| 1479 | + // Perform our own iteration and filter |
| 1480 | + for ( var i = 0; ret[i]; i++ ) |
| 1481 | + for ( var c = ret[i].firstChild; c; c = c.nextSibling ) |
| 1482 | + if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) ) |
| 1483 | + r.push( c ); |
| 1484 | + |
| 1485 | + ret = r; |
| 1486 | + t = t.replace( re, "" ); |
| 1487 | + if ( t.indexOf(" ") == 0 ) continue; |
| 1488 | + foundToken = true; |
| 1489 | + } else { |
| 1490 | + re = /^([>+~])\s*(\w*)/i; |
| 1491 | + |
| 1492 | + if ( (m = re.exec(t)) != null ) { |
| 1493 | + r = []; |
| 1494 | + |
| 1495 | + var merge = {}; |
| 1496 | + nodeName = m[2].toUpperCase(); |
| 1497 | + m = m[1]; |
| 1498 | + |
| 1499 | + for ( var j = 0, rl = ret.length; j < rl; j++ ) { |
| 1500 | + var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild; |
| 1501 | + for ( ; n; n = n.nextSibling ) |
| 1502 | + if ( n.nodeType == 1 ) { |
| 1503 | + var id = jQuery.data(n); |
| 1504 | + |
| 1505 | + if ( m == "~" && merge[id] ) break; |
| 1506 | + |
| 1507 | + if (!nodeName || n.nodeName.toUpperCase() == nodeName ) { |
| 1508 | + if ( m == "~" ) merge[id] = true; |
| 1509 | + r.push( n ); |
| 1510 | + } |
| 1511 | + |
| 1512 | + if ( m == "+" ) break; |
| 1513 | + } |
| 1514 | + } |
| 1515 | + |
| 1516 | + ret = r; |
| 1517 | + |
| 1518 | + // And remove the token |
| 1519 | + t = jQuery.trim( t.replace( re, "" ) ); |
| 1520 | + foundToken = true; |
| 1521 | + } |
| 1522 | + } |
| 1523 | + |
| 1524 | + // See if there's still an expression, and that we haven't already |
| 1525 | + // matched a token |
| 1526 | + if ( t && !foundToken ) { |
| 1527 | + // Handle multiple expressions |
| 1528 | + if ( !t.indexOf(",") ) { |
| 1529 | + // Clean the result set |
| 1530 | + if ( context == ret[0] ) ret.shift(); |
| 1531 | + |
| 1532 | + // Merge the result sets |
| 1533 | + done = jQuery.merge( done, ret ); |
| 1534 | + |
| 1535 | + // Reset the context |
| 1536 | + r = ret = [context]; |
| 1537 | + |
| 1538 | + // Touch up the selector string |
| 1539 | + t = " " + t.substr(1,t.length); |
| 1540 | + |
| 1541 | + } else { |
| 1542 | + // Optimize for the case nodeName#idName |
| 1543 | + var re2 = quickID; |
| 1544 | + var m = re2.exec(t); |
| 1545 | + |
| 1546 | + // Re-organize the results, so that they're consistent |
| 1547 | + if ( m ) { |
| 1548 | + m = [ 0, m[2], m[3], m[1] ]; |
| 1549 | + |
| 1550 | + } else { |
| 1551 | + // Otherwise, do a traditional filter check for |
| 1552 | + // ID, class, and element selectors |
| 1553 | + re2 = quickClass; |
| 1554 | + m = re2.exec(t); |
| 1555 | + } |
| 1556 | + |
| 1557 | + m[2] = m[2].replace(/\\/g, ""); |
| 1558 | + |
| 1559 | + var elem = ret[ret.length-1]; |
| 1560 | + |
| 1561 | + // Try to do a global search by ID, where we can |
| 1562 | + if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) { |
| 1563 | + // Optimization for HTML document case |
| 1564 | + var oid = elem.getElementById(m[2]); |
| 1565 | + |
| 1566 | + // Do a quick check for the existence of the actual ID attribute |
| 1567 | + // to avoid selecting by the name attribute in IE |
| 1568 | + // also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form |
| 1569 | + if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] ) |
| 1570 | + oid = jQuery('[@id="'+m[2]+'"]', elem)[0]; |
| 1571 | + |
| 1572 | + // Do a quick check for node name (where applicable) so |
| 1573 | + // that div#foo searches will be really fast |
| 1574 | + ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : []; |
| 1575 | + } else { |
| 1576 | + // We need to find all descendant elements |
| 1577 | + for ( var i = 0; ret[i]; i++ ) { |
| 1578 | + // Grab the tag name being searched for |
| 1579 | + var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2]; |
| 1580 | + |
| 1581 | + // Handle IE7 being really dumb about <object>s |
| 1582 | + if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" ) |
| 1583 | + tag = "param"; |
| 1584 | + |
| 1585 | + r = jQuery.merge( r, ret[i].getElementsByTagName( tag )); |
| 1586 | + } |
| 1587 | + |
| 1588 | + // It's faster to filter by class and be done with it |
| 1589 | + if ( m[1] == "." ) |
| 1590 | + r = jQuery.classFilter( r, m[2] ); |
| 1591 | + |
| 1592 | + // Same with ID filtering |
| 1593 | + if ( m[1] == "#" ) { |
| 1594 | + var tmp = []; |
| 1595 | + |
| 1596 | + // Try to find the element with the ID |
| 1597 | + for ( var i = 0; r[i]; i++ ) |
| 1598 | + if ( r[i].getAttribute("id") == m[2] ) { |
| 1599 | + tmp = [ r[i] ]; |
| 1600 | + break; |
| 1601 | + } |
| 1602 | + |
| 1603 | + r = tmp; |
| 1604 | + } |
| 1605 | + |
| 1606 | + ret = r; |
| 1607 | + } |
| 1608 | + |
| 1609 | + t = t.replace( re2, "" ); |
| 1610 | + } |
| 1611 | + |
| 1612 | + } |
| 1613 | + |
| 1614 | + // If a selector string still exists |
| 1615 | + if ( t ) { |
| 1616 | + // Attempt to filter it |
| 1617 | + var val = jQuery.filter(t,r); |
| 1618 | + ret = r = val.r; |
| 1619 | + t = jQuery.trim(val.t); |
| 1620 | + } |
| 1621 | + } |
| 1622 | + |
| 1623 | + // An error occurred with the selector; |
| 1624 | + // just return an empty set instead |
| 1625 | + if ( t ) |
| 1626 | + ret = []; |
| 1627 | + |
| 1628 | + // Remove the root context |
| 1629 | + if ( ret && context == ret[0] ) |
| 1630 | + ret.shift(); |
| 1631 | + |
| 1632 | + // And combine the results |
| 1633 | + done = jQuery.merge( done, ret ); |
| 1634 | + |
| 1635 | + return done; |
| 1636 | + }, |
| 1637 | + |
| 1638 | + classFilter: function(r,m,not){ |
| 1639 | + m = " " + m + " "; |
| 1640 | + var tmp = []; |
| 1641 | + for ( var i = 0; r[i]; i++ ) { |
| 1642 | + var pass = (" " + r[i].className + " ").indexOf( m ) >= 0; |
| 1643 | + if ( !not && pass || not && !pass ) |
| 1644 | + tmp.push( r[i] ); |
| 1645 | + } |
| 1646 | + return tmp; |
| 1647 | + }, |
| 1648 | + |
| 1649 | + filter: function(t,r,not) { |
| 1650 | + var last; |
| 1651 | + |
| 1652 | + // Look for common filter expressions |
| 1653 | + while ( t && t != last ) { |
| 1654 | + last = t; |
| 1655 | + |
| 1656 | + var p = jQuery.parse, m; |
| 1657 | + |
| 1658 | + for ( var i = 0; p[i]; i++ ) { |
| 1659 | + m = p[i].exec( t ); |
| 1660 | + |
| 1661 | + if ( m ) { |
| 1662 | + // Remove what we just matched |
| 1663 | + t = t.substring( m[0].length ); |
| 1664 | + |
| 1665 | + m[2] = m[2].replace(/\\/g, ""); |
| 1666 | + break; |
| 1667 | + } |
| 1668 | + } |
| 1669 | + |
| 1670 | + if ( !m ) |
| 1671 | + break; |
| 1672 | + |
| 1673 | + // :not() is a special case that can be optimized by |
| 1674 | + // keeping it out of the expression list |
| 1675 | + if ( m[1] == ":" && m[2] == "not" ) |
| 1676 | + // optimize if only one selector found (most common case) |
| 1677 | + r = isSimple.test( m[3] ) ? |
| 1678 | + jQuery.filter(m[3], r, true).r : |
| 1679 | + jQuery( r ).not( m[3] ); |
| 1680 | + |
| 1681 | + // We can get a big speed boost by filtering by class here |
| 1682 | + else if ( m[1] == "." ) |
| 1683 | + r = jQuery.classFilter(r, m[2], not); |
| 1684 | + |
| 1685 | + else if ( m[1] == "[" ) { |
| 1686 | + var tmp = [], type = m[3]; |
| 1687 | + |
| 1688 | + for ( var i = 0, rl = r.length; i < rl; i++ ) { |
| 1689 | + var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ]; |
| 1690 | + |
| 1691 | + if ( z == null || /href|src|selected/.test(m[2]) ) |
| 1692 | + z = jQuery.attr(a,m[2]) || ''; |
| 1693 | + |
| 1694 | + if ( (type == "" && !!z || |
| 1695 | + type == "=" && z == m[5] || |
| 1696 | + type == "!=" && z != m[5] || |
| 1697 | + type == "^=" && z && !z.indexOf(m[5]) || |
| 1698 | + type == "$=" && z.substr(z.length - m[5].length) == m[5] || |
| 1699 | + (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not ) |
| 1700 | + tmp.push( a ); |
| 1701 | + } |
| 1702 | + |
| 1703 | + r = tmp; |
| 1704 | + |
| 1705 | + // We can get a speed boost by handling nth-child here |
| 1706 | + } else if ( m[1] == ":" && m[2] == "nth-child" ) { |
| 1707 | + var merge = {}, tmp = [], |
| 1708 | + // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' |
| 1709 | + test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( |
| 1710 | + m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" || |
| 1711 | + !/\D/.test(m[3]) && "0n+" + m[3] || m[3]), |
| 1712 | + // calculate the numbers (first)n+(last) including if they are negative |
| 1713 | + first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0; |
| 1714 | + |
| 1715 | + // loop through all the elements left in the jQuery object |
| 1716 | + for ( var i = 0, rl = r.length; i < rl; i++ ) { |
| 1717 | + var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode); |
| 1718 | + |
| 1719 | + if ( !merge[id] ) { |
| 1720 | + var c = 1; |
| 1721 | + |
| 1722 | + for ( var n = parentNode.firstChild; n; n = n.nextSibling ) |
| 1723 | + if ( n.nodeType == 1 ) |
| 1724 | + n.nodeIndex = c++; |
| 1725 | + |
| 1726 | + merge[id] = true; |
| 1727 | + } |
| 1728 | + |
| 1729 | + var add = false; |
| 1730 | + |
| 1731 | + if ( first == 0 ) { |
| 1732 | + if ( node.nodeIndex == last ) |
| 1733 | + add = true; |
| 1734 | + } else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 ) |
| 1735 | + add = true; |
| 1736 | + |
| 1737 | + if ( add ^ not ) |
| 1738 | + tmp.push( node ); |
| 1739 | + } |
| 1740 | + |
| 1741 | + r = tmp; |
| 1742 | + |
| 1743 | + // Otherwise, find the expression to execute |
| 1744 | + } else { |
| 1745 | + var f = jQuery.expr[m[1]]; |
| 1746 | + if ( typeof f != "string" ) |
| 1747 | + f = jQuery.expr[m[1]][m[2]]; |
| 1748 | + |
| 1749 | + // Build a custom macro to enclose it |
| 1750 | + f = eval("false||function(a,i){return " + f + "}"); |
| 1751 | + |
| 1752 | + // Execute it against the current filter |
| 1753 | + r = jQuery.grep( r, f, not ); |
| 1754 | + } |
| 1755 | + } |
| 1756 | + |
| 1757 | + // Return an array of filtered elements (r) |
| 1758 | + // and the modified expression string (t) |
| 1759 | + return { r: r, t: t }; |
| 1760 | + }, |
| 1761 | + |
| 1762 | + dir: function( elem, dir ){ |
| 1763 | + var matched = []; |
| 1764 | + var cur = elem[dir]; |
| 1765 | + while ( cur && cur != document ) { |
| 1766 | + if ( cur.nodeType == 1 ) |
| 1767 | + matched.push( cur ); |
| 1768 | + cur = cur[dir]; |
| 1769 | + } |
| 1770 | + return matched; |
| 1771 | + }, |
| 1772 | + |
| 1773 | + nth: function(cur,result,dir,elem){ |
| 1774 | + result = result || 1; |
| 1775 | + var num = 0; |
| 1776 | + |
| 1777 | + for ( ; cur; cur = cur[dir] ) |
| 1778 | + if ( cur.nodeType == 1 && ++num == result ) |
| 1779 | + break; |
| 1780 | + |
| 1781 | + return cur; |
| 1782 | + }, |
| 1783 | + |
| 1784 | + sibling: function( n, elem ) { |
| 1785 | + var r = []; |
| 1786 | + |
| 1787 | + for ( ; n; n = n.nextSibling ) { |
| 1788 | + if ( n.nodeType == 1 && (!elem || n != elem) ) |
| 1789 | + r.push( n ); |
| 1790 | + } |
| 1791 | + |
| 1792 | + return r; |
| 1793 | + } |
| 1794 | +}); |
| 1795 | + |
| 1796 | +/* |
| 1797 | + * A number of helper functions used for managing events. |
| 1798 | + * Many of the ideas behind this code orignated from |
| 1799 | + * Dean Edwards' addEvent library. |
| 1800 | + */ |
| 1801 | +jQuery.event = { |
| 1802 | + |
| 1803 | + // Bind an event to an element |
| 1804 | + // Original by Dean Edwards |
| 1805 | + add: function(elem, types, handler, data) { |
| 1806 | + if ( elem.nodeType == 3 || elem.nodeType == 8 ) |
| 1807 | + return; |
| 1808 | + |
| 1809 | + // For whatever reason, IE has trouble passing the window object |
| 1810 | + // around, causing it to be cloned in the process |
| 1811 | + if ( jQuery.browser.msie && elem.setInterval != undefined ) |
| 1812 | + elem = window; |
| 1813 | + |
| 1814 | + // Make sure that the function being executed has a unique ID |
| 1815 | + if ( !handler.guid ) |
| 1816 | + handler.guid = this.guid++; |
| 1817 | + |
| 1818 | + // if data is passed, bind to handler |
| 1819 | + if( data != undefined ) { |
| 1820 | + // Create temporary function pointer to original handler |
| 1821 | + var fn = handler; |
| 1822 | + |
| 1823 | + // Create unique handler function, wrapped around original handler |
| 1824 | + handler = function() { |
| 1825 | + // Pass arguments and context to original handler |
| 1826 | + return fn.apply(this, arguments); |
| 1827 | + }; |
| 1828 | + |
| 1829 | + // Store data in unique handler |
| 1830 | + handler.data = data; |
| 1831 | + |
| 1832 | + // Set the guid of unique handler to the same of original handler, so it can be removed |
| 1833 | + handler.guid = fn.guid; |
| 1834 | + } |
| 1835 | + |
| 1836 | + // Init the element's event structure |
| 1837 | + var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}), |
| 1838 | + handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){ |
| 1839 | + // returned undefined or false |
| 1840 | + var val; |
| 1841 | + |
| 1842 | + // Handle the second event of a trigger and when |
| 1843 | + // an event is called after a page has unloaded |
| 1844 | + if ( typeof jQuery == "undefined" || jQuery.event.triggered ) |
| 1845 | + return val; |
| 1846 | + |
| 1847 | + val = jQuery.event.handle.apply(arguments.callee.elem, arguments); |
| 1848 | + |
| 1849 | + return val; |
| 1850 | + }); |
| 1851 | + // Add elem as a property of the handle function |
| 1852 | + // This is to prevent a memory leak with non-native |
| 1853 | + // event in IE. |
| 1854 | + handle.elem = elem; |
| 1855 | + |
| 1856 | + // Handle multiple events seperated by a space |
| 1857 | + // jQuery(...).bind("mouseover mouseout", fn); |
| 1858 | + jQuery.each(types.split(/\s+/), function(index, type) { |
| 1859 | + // Namespaced event handlers |
| 1860 | + var parts = type.split("."); |
| 1861 | + type = parts[0]; |
| 1862 | + handler.type = parts[1]; |
| 1863 | + |
| 1864 | + // Get the current list of functions bound to this event |
| 1865 | + var handlers = events[type]; |
| 1866 | + |
| 1867 | + // Init the event handler queue |
| 1868 | + if (!handlers) { |
| 1869 | + handlers = events[type] = {}; |
| 1870 | + |
| 1871 | + // Check for a special event handler |
| 1872 | + // Only use addEventListener/attachEvent if the special |
| 1873 | + // events handler returns false |
| 1874 | + if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) { |
| 1875 | + // Bind the global event handler to the element |
| 1876 | + if (elem.addEventListener) |
| 1877 | + elem.addEventListener(type, handle, false); |
| 1878 | + else if (elem.attachEvent) |
| 1879 | + elem.attachEvent("on" + type, handle); |
| 1880 | + } |
| 1881 | + } |
| 1882 | + |
| 1883 | + // Add the function to the element's handler list |
| 1884 | + handlers[handler.guid] = handler; |
| 1885 | + |
| 1886 | + // Keep track of which events have been used, for global triggering |
| 1887 | + jQuery.event.global[type] = true; |
| 1888 | + }); |
| 1889 | + |
| 1890 | + // Nullify elem to prevent memory leaks in IE |
| 1891 | + elem = null; |
| 1892 | + }, |
| 1893 | + |
| 1894 | + guid: 1, |
| 1895 | + global: {}, |
| 1896 | + |
| 1897 | + // Detach an event or set of events from an element |
| 1898 | + remove: function(elem, types, handler) { |
| 1899 | + // don't do events on text and comment nodes |
| 1900 | + if ( elem.nodeType == 3 || elem.nodeType == 8 ) |
| 1901 | + return; |
| 1902 | + |
| 1903 | + var events = jQuery.data(elem, "events"), ret, index; |
| 1904 | + |
| 1905 | + if ( events ) { |
| 1906 | + // Unbind all events for the element |
| 1907 | + if ( types == undefined ) |
| 1908 | + for ( var type in events ) |
| 1909 | + this.remove( elem, type ); |
| 1910 | + else { |
| 1911 | + // types is actually an event object here |
| 1912 | + if ( types.type ) { |
| 1913 | + handler = types.handler; |
| 1914 | + types = types.type; |
| 1915 | + } |
| 1916 | + |
| 1917 | + // Handle multiple events seperated by a space |
| 1918 | + // jQuery(...).unbind("mouseover mouseout", fn); |
| 1919 | + jQuery.each(types.split(/\s+/), function(index, type){ |
| 1920 | + // Namespaced event handlers |
| 1921 | + var parts = type.split("."); |
| 1922 | + type = parts[0]; |
| 1923 | + |
| 1924 | + if ( events[type] ) { |
| 1925 | + // remove the given handler for the given type |
| 1926 | + if ( handler ) |
| 1927 | + delete events[type][handler.guid]; |
| 1928 | + |
| 1929 | + // remove all handlers for the given type |
| 1930 | + else |
| 1931 | + for ( handler in events[type] ) |
| 1932 | + // Handle the removal of namespaced events |
| 1933 | + if ( !parts[1] || events[type][handler].type == parts[1] ) |
| 1934 | + delete events[type][handler]; |
| 1935 | + |
| 1936 | + // remove generic event handler if no more handlers exist |
| 1937 | + for ( ret in events[type] ) break; |
| 1938 | + if ( !ret ) { |
| 1939 | + if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) { |
| 1940 | + if (elem.removeEventListener) |
| 1941 | + elem.removeEventListener(type, jQuery.data(elem, "handle"), false); |
| 1942 | + else if (elem.detachEvent) |
| 1943 | + elem.detachEvent("on" + type, jQuery.data(elem, "handle")); |
| 1944 | + } |
| 1945 | + ret = null; |
| 1946 | + delete events[type]; |
| 1947 | + } |
| 1948 | + } |
| 1949 | + }); |
| 1950 | + } |
| 1951 | + |
| 1952 | + // Remove the expando if it's no longer used |
| 1953 | + for ( ret in events ) break; |
| 1954 | + if ( !ret ) { |
| 1955 | + var handle = jQuery.data( elem, "handle" ); |
| 1956 | + if ( handle ) handle.elem = null; |
| 1957 | + jQuery.removeData( elem, "events" ); |
| 1958 | + jQuery.removeData( elem, "handle" ); |
| 1959 | + } |
| 1960 | + } |
| 1961 | + }, |
| 1962 | + |
| 1963 | + trigger: function(type, data, elem, donative, extra) { |
| 1964 | + // Clone the incoming data, if any |
| 1965 | + data = jQuery.makeArray(data || []); |
| 1966 | + |
| 1967 | + // Handle a global trigger |
| 1968 | + if ( !elem ) { |
| 1969 | + // Only trigger if we've ever bound an event for it |
| 1970 | + if ( this.global[type] ) |
| 1971 | + jQuery("*").add([window, document]).trigger(type, data); |
| 1972 | + |
| 1973 | + // Handle triggering a single element |
| 1974 | + } else { |
| 1975 | + // don't do events on text and comment nodes |
| 1976 | + if ( elem.nodeType == 3 || elem.nodeType == 8 ) |
| 1977 | + return undefined; |
| 1978 | + |
| 1979 | + var val, ret, fn = jQuery.isFunction( elem[ type ] || null ), |
| 1980 | + // Check to see if we need to provide a fake event, or not |
| 1981 | + event = !data[0] || !data[0].preventDefault; |
| 1982 | + |
| 1983 | + // Pass along a fake event |
| 1984 | + if ( event ) |
| 1985 | + data.unshift( this.fix({ type: type, target: elem }) ); |
| 1986 | + |
| 1987 | + // Enforce the right trigger type |
| 1988 | + data[0].type = type; |
| 1989 | + |
| 1990 | + // Trigger the event |
| 1991 | + if ( jQuery.isFunction( jQuery.data(elem, "handle") ) ) |
| 1992 | + val = jQuery.data(elem, "handle").apply( elem, data ); |
| 1993 | + |
| 1994 | + // Handle triggering native .onfoo handlers |
| 1995 | + if ( !fn && elem["on"+type] && elem["on"+type].apply( elem, data ) === false ) |
| 1996 | + val = false; |
| 1997 | + |
| 1998 | + // Extra functions don't get the custom event object |
| 1999 | + if ( event ) |
| 2000 | + data.shift(); |
| 2001 | + |
| 2002 | + // Handle triggering of extra function |
| 2003 | + if ( extra && jQuery.isFunction( extra ) ) { |
| 2004 | + // call the extra function and tack the current return value on the end for possible inspection |
| 2005 | + ret = extra.apply( elem, val == null ? data : data.concat( val ) ); |
| 2006 | + // if anything is returned, give it precedence and have it overwrite the previous value |
| 2007 | + if (ret !== undefined) |
| 2008 | + val = ret; |
| 2009 | + } |
| 2010 | + |
| 2011 | + // Trigger the native events (except for clicks on links) |
| 2012 | + if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) { |
| 2013 | + this.triggered = true; |
| 2014 | + try { |
| 2015 | + elem[ type ](); |
| 2016 | + // prevent IE from throwing an error for some hidden elements |
| 2017 | + } catch (e) {} |
| 2018 | + } |
| 2019 | + |
| 2020 | + this.triggered = false; |
| 2021 | + } |
| 2022 | + |
| 2023 | + return val; |
| 2024 | + }, |
| 2025 | + |
| 2026 | + handle: function(event) { |
| 2027 | + // returned undefined or false |
| 2028 | + var val; |
| 2029 | + |
| 2030 | + // Empty object is for triggered events with no data |
| 2031 | + event = jQuery.event.fix( event || window.event || {} ); |
| 2032 | + |
| 2033 | + // Namespaced event handlers |
| 2034 | + var parts = event.type.split("."); |
| 2035 | + event.type = parts[0]; |
| 2036 | + |
| 2037 | + var handlers = jQuery.data(this, "events") && jQuery.data(this, "events")[event.type], args = Array.prototype.slice.call( arguments, 1 ); |
| 2038 | + args.unshift( event ); |
| 2039 | + |
| 2040 | + for ( var j in handlers ) { |
| 2041 | + var handler = handlers[j]; |
| 2042 | + // Pass in a reference to the handler function itself |
| 2043 | + // So that we can later remove it |
| 2044 | + args[0].handler = handler; |
| 2045 | + args[0].data = handler.data; |
| 2046 | + |
| 2047 | + // Filter the functions by class |
| 2048 | + if ( !parts[1] || handler.type == parts[1] ) { |
| 2049 | + var ret = handler.apply( this, args ); |
| 2050 | + |
| 2051 | + if ( val !== false ) |
| 2052 | + val = ret; |
| 2053 | + |
| 2054 | + if ( ret === false ) { |
| 2055 | + event.preventDefault(); |
| 2056 | + event.stopPropagation(); |
| 2057 | + } |
| 2058 | + } |
| 2059 | + } |
| 2060 | + |
| 2061 | + // Clean up added properties in IE to prevent memory leak |
| 2062 | + if (jQuery.browser.msie) |
| 2063 | + event.target = event.preventDefault = event.stopPropagation = |
| 2064 | + event.handler = event.data = null; |
| 2065 | + |
| 2066 | + return val; |
| 2067 | + }, |
| 2068 | + |
| 2069 | + fix: function(event) { |
| 2070 | + // store a copy of the original event object |
| 2071 | + // and clone to set read-only properties |
| 2072 | + var originalEvent = event; |
| 2073 | + event = jQuery.extend({}, originalEvent); |
| 2074 | + |
| 2075 | + // add preventDefault and stopPropagation since |
| 2076 | + // they will not work on the clone |
| 2077 | + event.preventDefault = function() { |
| 2078 | + // if preventDefault exists run it on the original event |
| 2079 | + if (originalEvent.preventDefault) |
| 2080 | + originalEvent.preventDefault(); |
| 2081 | + // otherwise set the returnValue property of the original event to false (IE) |
| 2082 | + originalEvent.returnValue = false; |
| 2083 | + }; |
| 2084 | + event.stopPropagation = function() { |
| 2085 | + // if stopPropagation exists run it on the original event |
| 2086 | + if (originalEvent.stopPropagation) |
| 2087 | + originalEvent.stopPropagation(); |
| 2088 | + // otherwise set the cancelBubble property of the original event to true (IE) |
| 2089 | + originalEvent.cancelBubble = true; |
| 2090 | + }; |
| 2091 | + |
| 2092 | + // Fix target property, if necessary |
| 2093 | + if ( !event.target ) |
| 2094 | + event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either |
| 2095 | + |
| 2096 | + // check if target is a textnode (safari) |
| 2097 | + if ( event.target.nodeType == 3 ) |
| 2098 | + event.target = originalEvent.target.parentNode; |
| 2099 | + |
| 2100 | + // Add relatedTarget, if necessary |
| 2101 | + if ( !event.relatedTarget && event.fromElement ) |
| 2102 | + event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement; |
| 2103 | + |
| 2104 | + // Calculate pageX/Y if missing and clientX/Y available |
| 2105 | + if ( event.pageX == null && event.clientX != null ) { |
| 2106 | + var doc = document.documentElement, body = document.body; |
| 2107 | + event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0); |
| 2108 | + event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0); |
| 2109 | + } |
| 2110 | + |
| 2111 | + // Add which for key events |
| 2112 | + if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) |
| 2113 | + event.which = event.charCode || event.keyCode; |
| 2114 | + |
| 2115 | + // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) |
| 2116 | + if ( !event.metaKey && event.ctrlKey ) |
| 2117 | + event.metaKey = event.ctrlKey; |
| 2118 | + |
| 2119 | + // Add which for click: 1 == left; 2 == middle; 3 == right |
| 2120 | + // Note: button is not normalized, so don't use it |
| 2121 | + if ( !event.which && event.button ) |
| 2122 | + event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); |
| 2123 | + |
| 2124 | + return event; |
| 2125 | + }, |
| 2126 | + |
| 2127 | + special: { |
| 2128 | + ready: { |
| 2129 | + setup: function() { |
| 2130 | + // Make sure the ready event is setup |
| 2131 | + bindReady(); |
| 2132 | + return; |
| 2133 | + }, |
| 2134 | + |
| 2135 | + teardown: function() { return; } |
| 2136 | + }, |
| 2137 | + |
| 2138 | + mouseenter: { |
| 2139 | + setup: function() { |
| 2140 | + if ( jQuery.browser.msie ) return false; |
| 2141 | + jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler); |
| 2142 | + return true; |
| 2143 | + }, |
| 2144 | + |
| 2145 | + teardown: function() { |
| 2146 | + if ( jQuery.browser.msie ) return false; |
| 2147 | + jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler); |
| 2148 | + return true; |
| 2149 | + }, |
| 2150 | + |
| 2151 | + handler: function(event) { |
| 2152 | + // If we actually just moused on to a sub-element, ignore it |
| 2153 | + if ( withinElement(event, this) ) return true; |
| 2154 | + // Execute the right handlers by setting the event type to mouseenter |
| 2155 | + arguments[0].type = "mouseenter"; |
| 2156 | + return jQuery.event.handle.apply(this, arguments); |
| 2157 | + } |
| 2158 | + }, |
| 2159 | + |
| 2160 | + mouseleave: { |
| 2161 | + setup: function() { |
| 2162 | + if ( jQuery.browser.msie ) return false; |
| 2163 | + jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler); |
| 2164 | + return true; |
| 2165 | + }, |
| 2166 | + |
| 2167 | + teardown: function() { |
| 2168 | + if ( jQuery.browser.msie ) return false; |
| 2169 | + jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler); |
| 2170 | + return true; |
| 2171 | + }, |
| 2172 | + |
| 2173 | + handler: function(event) { |
| 2174 | + // If we actually just moused on to a sub-element, ignore it |
| 2175 | + if ( withinElement(event, this) ) return true; |
| 2176 | + // Execute the right handlers by setting the event type to mouseleave |
| 2177 | + arguments[0].type = "mouseleave"; |
| 2178 | + return jQuery.event.handle.apply(this, arguments); |
| 2179 | + } |
| 2180 | + } |
| 2181 | + } |
| 2182 | +}; |
| 2183 | + |
| 2184 | +jQuery.fn.extend({ |
| 2185 | + bind: function( type, data, fn ) { |
| 2186 | + return type == "unload" ? this.one(type, data, fn) : this.each(function(){ |
| 2187 | + jQuery.event.add( this, type, fn || data, fn && data ); |
| 2188 | + }); |
| 2189 | + }, |
| 2190 | + |
| 2191 | + one: function( type, data, fn ) { |
| 2192 | + return this.each(function(){ |
| 2193 | + jQuery.event.add( this, type, function(event) { |
| 2194 | + jQuery(this).unbind(event); |
| 2195 | + return (fn || data).apply( this, arguments); |
| 2196 | + }, fn && data); |
| 2197 | + }); |
| 2198 | + }, |
| 2199 | + |
| 2200 | + unbind: function( type, fn ) { |
| 2201 | + return this.each(function(){ |
| 2202 | + jQuery.event.remove( this, type, fn ); |
| 2203 | + }); |
| 2204 | + }, |
| 2205 | + |
| 2206 | + trigger: function( type, data, fn ) { |
| 2207 | + return this.each(function(){ |
| 2208 | + jQuery.event.trigger( type, data, this, true, fn ); |
| 2209 | + }); |
| 2210 | + }, |
| 2211 | + |
| 2212 | + triggerHandler: function( type, data, fn ) { |
| 2213 | + if ( this[0] ) |
| 2214 | + return jQuery.event.trigger( type, data, this[0], false, fn ); |
| 2215 | + return undefined; |
| 2216 | + }, |
| 2217 | + |
| 2218 | + toggle: function() { |
| 2219 | + // Save reference to arguments for access in closure |
| 2220 | + var args = arguments; |
| 2221 | + |
| 2222 | + return this.click(function(event) { |
| 2223 | + // Figure out which function to execute |
| 2224 | + this.lastToggle = 0 == this.lastToggle ? 1 : 0; |
| 2225 | + |
| 2226 | + // Make sure that clicks stop |
| 2227 | + event.preventDefault(); |
| 2228 | + |
| 2229 | + // and execute the function |
| 2230 | + return args[this.lastToggle].apply( this, arguments ) || false; |
| 2231 | + }); |
| 2232 | + }, |
| 2233 | + |
| 2234 | + hover: function(fnOver, fnOut) { |
| 2235 | + return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut); |
| 2236 | + }, |
| 2237 | + |
| 2238 | + ready: function(fn) { |
| 2239 | + // Attach the listeners |
| 2240 | + bindReady(); |
| 2241 | + |
| 2242 | + // If the DOM is already ready |
| 2243 | + if ( jQuery.isReady ) |
| 2244 | + // Execute the function immediately |
| 2245 | + fn.call( document, jQuery ); |
| 2246 | + |
| 2247 | + // Otherwise, remember the function for later |
| 2248 | + else |
| 2249 | + // Add the function to the wait list |
| 2250 | + jQuery.readyList.push( function() { return fn.call(this, jQuery); } ); |
| 2251 | + |
| 2252 | + return this; |
| 2253 | + } |
| 2254 | +}); |
| 2255 | + |
| 2256 | +jQuery.extend({ |
| 2257 | + isReady: false, |
| 2258 | + readyList: [], |
| 2259 | + // Handle when the DOM is ready |
| 2260 | + ready: function() { |
| 2261 | + // Make sure that the DOM is not already loaded |
| 2262 | + if ( !jQuery.isReady ) { |
| 2263 | + // Remember that the DOM is ready |
| 2264 | + jQuery.isReady = true; |
| 2265 | + |
| 2266 | + // If there are functions bound, to execute |
| 2267 | + if ( jQuery.readyList ) { |
| 2268 | + // Execute all of them |
| 2269 | + jQuery.each( jQuery.readyList, function(){ |
| 2270 | + this.apply( document ); |
| 2271 | + }); |
| 2272 | + |
| 2273 | + // Reset the list of functions |
| 2274 | + jQuery.readyList = null; |
| 2275 | + } |
| 2276 | + |
| 2277 | + // Trigger any bound ready events |
| 2278 | + jQuery(document).triggerHandler("ready"); |
| 2279 | + } |
| 2280 | + } |
| 2281 | +}); |
| 2282 | + |
| 2283 | +var readyBound = false; |
| 2284 | + |
| 2285 | +function bindReady(){ |
| 2286 | + if ( readyBound ) return; |
| 2287 | + readyBound = true; |
| 2288 | + |
| 2289 | + // Mozilla, Opera (see further below for it) and webkit nightlies currently support this event |
| 2290 | + if ( document.addEventListener && !jQuery.browser.opera) |
| 2291 | + // Use the handy event callback |
| 2292 | + document.addEventListener( "DOMContentLoaded", jQuery.ready, false ); |
| 2293 | + |
| 2294 | + // If IE is used and is not in a frame |
| 2295 | + // Continually check to see if the document is ready |
| 2296 | + if ( jQuery.browser.msie && window == top ) (function(){ |
| 2297 | + if (jQuery.isReady) return; |
| 2298 | + try { |
| 2299 | + // If IE is used, use the trick by Diego Perini |
| 2300 | + // http://javascript.nwbox.com/IEContentLoaded/ |
| 2301 | + document.documentElement.doScroll("left"); |
| 2302 | + } catch( error ) { |
| 2303 | + setTimeout( arguments.callee, 0 ); |
| 2304 | + return; |
| 2305 | + } |
| 2306 | + // and execute any waiting functions |
| 2307 | + jQuery.ready(); |
| 2308 | + })(); |
| 2309 | + |
| 2310 | + if ( jQuery.browser.opera ) |
| 2311 | + document.addEventListener( "DOMContentLoaded", function () { |
| 2312 | + if (jQuery.isReady) return; |
| 2313 | + for (var i = 0; i < document.styleSheets.length; i++) |
| 2314 | + if (document.styleSheets[i].disabled) { |
| 2315 | + setTimeout( arguments.callee, 0 ); |
| 2316 | + return; |
| 2317 | + } |
| 2318 | + // and execute any waiting functions |
| 2319 | + jQuery.ready(); |
| 2320 | + }, false); |
| 2321 | + |
| 2322 | + if ( jQuery.browser.safari ) { |
| 2323 | + var numStyles; |
| 2324 | + (function(){ |
| 2325 | + if (jQuery.isReady) return; |
| 2326 | + if ( document.readyState != "loaded" && document.readyState != "complete" ) { |
| 2327 | + setTimeout( arguments.callee, 0 ); |
| 2328 | + return; |
| 2329 | + } |
| 2330 | + if ( numStyles === undefined ) |
| 2331 | + numStyles = jQuery("style, link[rel=stylesheet]").length; |
| 2332 | + if ( document.styleSheets.length != numStyles ) { |
| 2333 | + setTimeout( arguments.callee, 0 ); |
| 2334 | + return; |
| 2335 | + } |
| 2336 | + // and execute any waiting functions |
| 2337 | + jQuery.ready(); |
| 2338 | + })(); |
| 2339 | + } |
| 2340 | + |
| 2341 | + // A fallback to window.onload, that will always work |
| 2342 | + jQuery.event.add( window, "load", jQuery.ready ); |
| 2343 | +} |
| 2344 | + |
| 2345 | +jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," + |
| 2346 | + "mousedown,mouseup,mousemove,mouseover,mouseout,change,select," + |
| 2347 | + "submit,keydown,keypress,keyup,error").split(","), function(i, name){ |
| 2348 | + |
| 2349 | + // Handle event binding |
| 2350 | + jQuery.fn[name] = function(fn){ |
| 2351 | + return fn ? this.bind(name, fn) : this.trigger(name); |
| 2352 | + }; |
| 2353 | +}); |
| 2354 | + |
| 2355 | +// Checks if an event happened on an element within another element |
| 2356 | +// Used in jQuery.event.special.mouseenter and mouseleave handlers |
| 2357 | +var withinElement = function(event, elem) { |
| 2358 | + // Check if mouse(over|out) are still within the same parent element |
| 2359 | + var parent = event.relatedTarget; |
| 2360 | + // Traverse up the tree |
| 2361 | + while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; } |
| 2362 | + // Return true if we actually just moused on to a sub-element |
| 2363 | + return parent == elem; |
| 2364 | +}; |
| 2365 | + |
| 2366 | +// Prevent memory leaks in IE |
| 2367 | +// And prevent errors on refresh with events like mouseover in other browsers |
| 2368 | +// Window isn't included so as not to unbind existing unload events |
| 2369 | +jQuery(window).bind("unload", function() { |
| 2370 | + jQuery("*").add(document).unbind(); |
| 2371 | +}); |
| 2372 | +jQuery.fn.extend({ |
| 2373 | + load: function( url, params, callback ) { |
| 2374 | + if ( jQuery.isFunction( url ) ) |
| 2375 | + return this.bind("load", url); |
| 2376 | + |
| 2377 | + var off = url.indexOf(" "); |
| 2378 | + if ( off >= 0 ) { |
| 2379 | + var selector = url.slice(off, url.length); |
| 2380 | + url = url.slice(0, off); |
| 2381 | + } |
| 2382 | + |
| 2383 | + callback = callback || function(){}; |
| 2384 | + |
| 2385 | + // Default to a GET request |
| 2386 | + var type = "GET"; |
| 2387 | + |
| 2388 | + // If the second parameter was provided |
| 2389 | + if ( params ) |
| 2390 | + // If it's a function |
| 2391 | + if ( jQuery.isFunction( params ) ) { |
| 2392 | + // We assume that it's the callback |
| 2393 | + callback = params; |
| 2394 | + params = null; |
| 2395 | + |
| 2396 | + // Otherwise, build a param string |
| 2397 | + } else { |
| 2398 | + params = jQuery.param( params ); |
| 2399 | + type = "POST"; |
| 2400 | + } |
| 2401 | + |
| 2402 | + var self = this; |
| 2403 | + |
| 2404 | + // Request the remote document |
| 2405 | + jQuery.ajax({ |
| 2406 | + url: url, |
| 2407 | + type: type, |
| 2408 | + dataType: "html", |
| 2409 | + data: params, |
| 2410 | + complete: function(res, status){ |
| 2411 | + // If successful, inject the HTML into all the matched elements |
| 2412 | + if ( status == "success" || status == "notmodified" ) |
| 2413 | + // See if a selector was specified |
| 2414 | + self.html( selector ? |
| 2415 | + // Create a dummy div to hold the results |
| 2416 | + jQuery("<div/>") |
| 2417 | + // inject the contents of the document in, removing the scripts |
| 2418 | + // to avoid any 'Permission Denied' errors in IE |
| 2419 | + .append(res.responseText.replace(/<script(.|\s)*?\/script>/g, "")) |
| 2420 | + |
| 2421 | + // Locate the specified elements |
| 2422 | + .find(selector) : |
| 2423 | + |
| 2424 | + // If not, just inject the full result |
| 2425 | + res.responseText ); |
| 2426 | + |
| 2427 | + self.each( callback, [res.responseText, status, res] ); |
| 2428 | + } |
| 2429 | + }); |
| 2430 | + return this; |
| 2431 | + }, |
| 2432 | + |
| 2433 | + serialize: function() { |
| 2434 | + return jQuery.param(this.serializeArray()); |
| 2435 | + }, |
| 2436 | + serializeArray: function() { |
| 2437 | + return this.map(function(){ |
| 2438 | + return jQuery.nodeName(this, "form") ? |
| 2439 | + jQuery.makeArray(this.elements) : this; |
| 2440 | + }) |
| 2441 | + .filter(function(){ |
| 2442 | + return this.name && !this.disabled && |
| 2443 | + (this.checked || /select|textarea/i.test(this.nodeName) || |
| 2444 | + /text|hidden|password/i.test(this.type)); |
| 2445 | + }) |
| 2446 | + .map(function(i, elem){ |
| 2447 | + var val = jQuery(this).val(); |
| 2448 | + return val == null ? null : |
| 2449 | + val.constructor == Array ? |
| 2450 | + jQuery.map( val, function(val, i){ |
| 2451 | + return {name: elem.name, value: val}; |
| 2452 | + }) : |
| 2453 | + {name: elem.name, value: val}; |
| 2454 | + }).get(); |
| 2455 | + } |
| 2456 | +}); |
| 2457 | + |
| 2458 | +// Attach a bunch of functions for handling common AJAX events |
| 2459 | +jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){ |
| 2460 | + jQuery.fn[o] = function(f){ |
| 2461 | + return this.bind(o, f); |
| 2462 | + }; |
| 2463 | +}); |
| 2464 | + |
| 2465 | +var jsc = (new Date).getTime(); |
| 2466 | + |
| 2467 | +jQuery.extend({ |
| 2468 | + get: function( url, data, callback, type ) { |
| 2469 | + // shift arguments if data argument was ommited |
| 2470 | + if ( jQuery.isFunction( data ) ) { |
| 2471 | + callback = data; |
| 2472 | + data = null; |
| 2473 | + } |
| 2474 | + |
| 2475 | + return jQuery.ajax({ |
| 2476 | + type: "GET", |
| 2477 | + url: url, |
| 2478 | + data: data, |
| 2479 | + success: callback, |
| 2480 | + dataType: type |
| 2481 | + }); |
| 2482 | + }, |
| 2483 | + |
| 2484 | + getScript: function( url, callback ) { |
| 2485 | + return jQuery.get(url, null, callback, "script"); |
| 2486 | + }, |
| 2487 | + |
| 2488 | + getJSON: function( url, data, callback ) { |
| 2489 | + return jQuery.get(url, data, callback, "json"); |
| 2490 | + }, |
| 2491 | + |
| 2492 | + post: function( url, data, callback, type ) { |
| 2493 | + if ( jQuery.isFunction( data ) ) { |
| 2494 | + callback = data; |
| 2495 | + data = {}; |
| 2496 | + } |
| 2497 | + |
| 2498 | + return jQuery.ajax({ |
| 2499 | + type: "POST", |
| 2500 | + url: url, |
| 2501 | + data: data, |
| 2502 | + success: callback, |
| 2503 | + dataType: type |
| 2504 | + }); |
| 2505 | + }, |
| 2506 | + |
| 2507 | + ajaxSetup: function( settings ) { |
| 2508 | + jQuery.extend( jQuery.ajaxSettings, settings ); |
| 2509 | + }, |
| 2510 | + |
| 2511 | + ajaxSettings: { |
| 2512 | + global: true, |
| 2513 | + type: "GET", |
| 2514 | + timeout: 0, |
| 2515 | + contentType: "application/x-www-form-urlencoded", |
| 2516 | + processData: true, |
| 2517 | + async: true, |
| 2518 | + data: null, |
| 2519 | + username: null, |
| 2520 | + password: null, |
| 2521 | + accepts: { |
| 2522 | + xml: "application/xml, text/xml", |
| 2523 | + html: "text/html", |
| 2524 | + script: "text/javascript, application/javascript", |
| 2525 | + json: "application/json, text/javascript", |
| 2526 | + text: "text/plain", |
| 2527 | + _default: "*/*" |
| 2528 | + } |
| 2529 | + }, |
| 2530 | + |
| 2531 | + // Last-Modified header cache for next request |
| 2532 | + lastModified: {}, |
| 2533 | + |
| 2534 | + ajax: function( s ) { |
| 2535 | + var jsonp, jsre = /=\?(&|$)/g, status, data; |
| 2536 | + |
| 2537 | + // Extend the settings, but re-extend 's' so that it can be |
| 2538 | + // checked again later (in the test suite, specifically) |
| 2539 | + s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s)); |
| 2540 | + |
| 2541 | + // convert data if not already a string |
| 2542 | + if ( s.data && s.processData && typeof s.data != "string" ) |
| 2543 | + s.data = jQuery.param(s.data); |
| 2544 | + |
| 2545 | + // Handle JSONP Parameter Callbacks |
| 2546 | + if ( s.dataType == "jsonp" ) { |
| 2547 | + if ( s.type.toLowerCase() == "get" ) { |
| 2548 | + if ( !s.url.match(jsre) ) |
| 2549 | + s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?"; |
| 2550 | + } else if ( !s.data || !s.data.match(jsre) ) |
| 2551 | + s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?"; |
| 2552 | + s.dataType = "json"; |
| 2553 | + } |
| 2554 | + |
| 2555 | + // Build temporary JSONP function |
| 2556 | + if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) { |
| 2557 | + jsonp = "jsonp" + jsc++; |
| 2558 | + |
| 2559 | + // Replace the =? sequence both in the query string and the data |
| 2560 | + if ( s.data ) |
| 2561 | + s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1"); |
| 2562 | + s.url = s.url.replace(jsre, "=" + jsonp + "$1"); |
| 2563 | + |
| 2564 | + // We need to make sure |
| 2565 | + // that a JSONP style response is executed properly |
| 2566 | + s.dataType = "script"; |
| 2567 | + |
| 2568 | + // Handle JSONP-style loading |
| 2569 | + window[ jsonp ] = function(tmp){ |
| 2570 | + data = tmp; |
| 2571 | + success(); |
| 2572 | + complete(); |
| 2573 | + // Garbage collect |
| 2574 | + window[ jsonp ] = undefined; |
| 2575 | + try{ delete window[ jsonp ]; } catch(e){} |
| 2576 | + if ( head ) |
| 2577 | + head.removeChild( script ); |
| 2578 | + }; |
| 2579 | + } |
| 2580 | + |
| 2581 | + if ( s.dataType == "script" && s.cache == null ) |
| 2582 | + s.cache = false; |
| 2583 | + |
| 2584 | + if ( s.cache === false && s.type.toLowerCase() == "get" ) { |
| 2585 | + var ts = (new Date()).getTime(); |
| 2586 | + // try replacing _= if it is there |
| 2587 | + var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2"); |
| 2588 | + // if nothing was replaced, add timestamp to the end |
| 2589 | + s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : ""); |
| 2590 | + } |
| 2591 | + |
| 2592 | + // If data is available, append data to url for get requests |
| 2593 | + if ( s.data && s.type.toLowerCase() == "get" ) { |
| 2594 | + s.url += (s.url.match(/\?/) ? "&" : "?") + s.data; |
| 2595 | + |
| 2596 | + // IE likes to send both get and post data, prevent this |
| 2597 | + s.data = null; |
| 2598 | + } |
| 2599 | + |
| 2600 | + // Watch for a new set of requests |
| 2601 | + if ( s.global && ! jQuery.active++ ) |
| 2602 | + jQuery.event.trigger( "ajaxStart" ); |
| 2603 | + |
| 2604 | + // If we're requesting a remote document |
| 2605 | + // and trying to load JSON or Script with a GET |
| 2606 | + if ( (!s.url.indexOf("http") || !s.url.indexOf("//")) && ( s.dataType == "script" || s.dataType =="json" ) && s.type.toLowerCase() == "get" ) { |
| 2607 | + var head = document.getElementsByTagName("head")[0]; |
| 2608 | + var script = document.createElement("script"); |
| 2609 | + script.src = s.url; |
| 2610 | + if (s.scriptCharset) |
| 2611 | + script.charset = s.scriptCharset; |
| 2612 | + |
| 2613 | + // Handle Script loading |
| 2614 | + if ( !jsonp ) { |
| 2615 | + var done = false; |
| 2616 | + |
| 2617 | + // Attach handlers for all browsers |
| 2618 | + script.onload = script.onreadystatechange = function(){ |
| 2619 | + if ( !done && (!this.readyState || |
| 2620 | + this.readyState == "loaded" || this.readyState == "complete") ) { |
| 2621 | + done = true; |
| 2622 | + success(); |
| 2623 | + complete(); |
| 2624 | + head.removeChild( script ); |
| 2625 | + } |
| 2626 | + }; |
| 2627 | + } |
| 2628 | + |
| 2629 | + head.appendChild(script); |
| 2630 | + |
| 2631 | + // We handle everything using the script element injection |
| 2632 | + return undefined; |
| 2633 | + } |
| 2634 | + |
| 2635 | + var requestDone = false; |
| 2636 | + |
| 2637 | + // Create the request object; Microsoft failed to properly |
| 2638 | + // implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available |
| 2639 | + var xml = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); |
| 2640 | + |
| 2641 | + // Open the socket |
| 2642 | + xml.open(s.type, s.url, s.async, s.username, s.password); |
| 2643 | + |
| 2644 | + // Need an extra try/catch for cross domain requests in Firefox 3 |
| 2645 | + try { |
| 2646 | + // Set the correct header, if data is being sent |
| 2647 | + if ( s.data ) |
| 2648 | + xml.setRequestHeader("Content-Type", s.contentType); |
| 2649 | + |
| 2650 | + // Set the If-Modified-Since header, if ifModified mode. |
| 2651 | + if ( s.ifModified ) |
| 2652 | + xml.setRequestHeader("If-Modified-Since", |
| 2653 | + jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" ); |
| 2654 | + |
| 2655 | + // Set header so the called script knows that it's an XMLHttpRequest |
| 2656 | + xml.setRequestHeader("X-Requested-With", "XMLHttpRequest"); |
| 2657 | + |
| 2658 | + // Set the Accepts header for the server, depending on the dataType |
| 2659 | + xml.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ? |
| 2660 | + s.accepts[ s.dataType ] + ", */*" : |
| 2661 | + s.accepts._default ); |
| 2662 | + } catch(e){} |
| 2663 | + |
| 2664 | + // Allow custom headers/mimetypes |
| 2665 | + if ( s.beforeSend ) |
| 2666 | + s.beforeSend(xml); |
| 2667 | + |
| 2668 | + if ( s.global ) |
| 2669 | + jQuery.event.trigger("ajaxSend", [xml, s]); |
| 2670 | + |
| 2671 | + // Wait for a response to come back |
| 2672 | + var onreadystatechange = function(isTimeout){ |
| 2673 | + // The transfer is complete and the data is available, or the request timed out |
| 2674 | + if ( !requestDone && xml && (xml.readyState == 4 || isTimeout == "timeout") ) { |
| 2675 | + requestDone = true; |
| 2676 | + |
| 2677 | + // clear poll interval |
| 2678 | + if (ival) { |
| 2679 | + clearInterval(ival); |
| 2680 | + ival = null; |
| 2681 | + } |
| 2682 | + |
| 2683 | + status = isTimeout == "timeout" && "timeout" || |
| 2684 | + !jQuery.httpSuccess( xml ) && "error" || |
| 2685 | + s.ifModified && jQuery.httpNotModified( xml, s.url ) && "notmodified" || |
| 2686 | + "success"; |
| 2687 | + |
| 2688 | + if ( status == "success" ) { |
| 2689 | + // Watch for, and catch, XML document parse errors |
| 2690 | + try { |
| 2691 | + // process the data (runs the xml through httpData regardless of callback) |
| 2692 | + data = jQuery.httpData( xml, s.dataType ); |
| 2693 | + } catch(e) { |
| 2694 | + status = "parsererror"; |
| 2695 | + } |
| 2696 | + } |
| 2697 | + |
| 2698 | + // Make sure that the request was successful or notmodified |
| 2699 | + if ( status == "success" ) { |
| 2700 | + // Cache Last-Modified header, if ifModified mode. |
| 2701 | + var modRes; |
| 2702 | + try { |
| 2703 | + modRes = xml.getResponseHeader("Last-Modified"); |
| 2704 | + } catch(e) {} // swallow exception thrown by FF if header is not available |
| 2705 | + |
| 2706 | + if ( s.ifModified && modRes ) |
| 2707 | + jQuery.lastModified[s.url] = modRes; |
| 2708 | + |
| 2709 | + // JSONP handles its own success callback |
| 2710 | + if ( !jsonp ) |
| 2711 | + success(); |
| 2712 | + } else |
| 2713 | + jQuery.handleError(s, xml, status); |
| 2714 | + |
| 2715 | + // Fire the complete handlers |
| 2716 | + complete(); |
| 2717 | + |
| 2718 | + // Stop memory leaks |
| 2719 | + if ( s.async ) |
| 2720 | + xml = null; |
| 2721 | + } |
| 2722 | + }; |
| 2723 | + |
| 2724 | + if ( s.async ) { |
| 2725 | + // don't attach the handler to the request, just poll it instead |
| 2726 | + var ival = setInterval(onreadystatechange, 13); |
| 2727 | + |
| 2728 | + // Timeout checker |
| 2729 | + if ( s.timeout > 0 ) |
| 2730 | + setTimeout(function(){ |
| 2731 | + // Check to see if the request is still happening |
| 2732 | + if ( xml ) { |
| 2733 | + // Cancel the request |
| 2734 | + xml.abort(); |
| 2735 | + |
| 2736 | + if( !requestDone ) |
| 2737 | + onreadystatechange( "timeout" ); |
| 2738 | + } |
| 2739 | + }, s.timeout); |
| 2740 | + } |
| 2741 | + |
| 2742 | + // Send the data |
| 2743 | + try { |
| 2744 | + xml.send(s.data); |
| 2745 | + } catch(e) { |
| 2746 | + jQuery.handleError(s, xml, null, e); |
| 2747 | + } |
| 2748 | + |
| 2749 | + // firefox 1.5 doesn't fire statechange for sync requests |
| 2750 | + if ( !s.async ) |
| 2751 | + onreadystatechange(); |
| 2752 | + |
| 2753 | + function success(){ |
| 2754 | + // If a local callback was specified, fire it and pass it the data |
| 2755 | + if ( s.success ) |
| 2756 | + s.success( data, status ); |
| 2757 | + |
| 2758 | + // Fire the global callback |
| 2759 | + if ( s.global ) |
| 2760 | + jQuery.event.trigger( "ajaxSuccess", [xml, s] ); |
| 2761 | + } |
| 2762 | + |
| 2763 | + function complete(){ |
| 2764 | + // Process result |
| 2765 | + if ( s.complete ) |
| 2766 | + s.complete(xml, status); |
| 2767 | + |
| 2768 | + // The request was completed |
| 2769 | + if ( s.global ) |
| 2770 | + jQuery.event.trigger( "ajaxComplete", [xml, s] ); |
| 2771 | + |
| 2772 | + // Handle the global AJAX counter |
| 2773 | + if ( s.global && ! --jQuery.active ) |
| 2774 | + jQuery.event.trigger( "ajaxStop" ); |
| 2775 | + } |
| 2776 | + |
| 2777 | + // return XMLHttpRequest to allow aborting the request etc. |
| 2778 | + return xml; |
| 2779 | + }, |
| 2780 | + |
| 2781 | + handleError: function( s, xml, status, e ) { |
| 2782 | + // If a local callback was specified, fire it |
| 2783 | + if ( s.error ) s.error( xml, status, e ); |
| 2784 | + |
| 2785 | + // Fire the global callback |
| 2786 | + if ( s.global ) |
| 2787 | + jQuery.event.trigger( "ajaxError", [xml, s, e] ); |
| 2788 | + }, |
| 2789 | + |
| 2790 | + // Counter for holding the number of active queries |
| 2791 | + active: 0, |
| 2792 | + |
| 2793 | + // Determines if an XMLHttpRequest was successful or not |
| 2794 | + httpSuccess: function( r ) { |
| 2795 | + try { |
| 2796 | + // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 |
| 2797 | + return !r.status && location.protocol == "file:" || |
| 2798 | + ( r.status >= 200 && r.status < 300 ) || r.status == 304 || r.status == 1223 || |
| 2799 | + jQuery.browser.safari && r.status == undefined; |
| 2800 | + } catch(e){} |
| 2801 | + return false; |
| 2802 | + }, |
| 2803 | + |
| 2804 | + // Determines if an XMLHttpRequest returns NotModified |
| 2805 | + httpNotModified: function( xml, url ) { |
| 2806 | + try { |
| 2807 | + var xmlRes = xml.getResponseHeader("Last-Modified"); |
| 2808 | + |
| 2809 | + // Firefox always returns 200. check Last-Modified date |
| 2810 | + return xml.status == 304 || xmlRes == jQuery.lastModified[url] || |
| 2811 | + jQuery.browser.safari && xml.status == undefined; |
| 2812 | + } catch(e){} |
| 2813 | + return false; |
| 2814 | + }, |
| 2815 | + |
| 2816 | + httpData: function( r, type ) { |
| 2817 | + var ct = r.getResponseHeader("content-type"); |
| 2818 | + var xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0; |
| 2819 | + var data = xml ? r.responseXML : r.responseText; |
| 2820 | + |
| 2821 | + if ( xml && data.documentElement.tagName == "parsererror" ) |
| 2822 | + throw "parsererror"; |
| 2823 | + |
| 2824 | + // If the type is "script", eval it in global context |
| 2825 | + if ( type == "script" ) |
| 2826 | + jQuery.globalEval( data ); |
| 2827 | + |
| 2828 | + // Get the JavaScript object, if JSON is used. |
| 2829 | + if ( type == "json" ) |
| 2830 | + data = eval("(" + data + ")"); |
| 2831 | + |
| 2832 | + return data; |
| 2833 | + }, |
| 2834 | + |
| 2835 | + // Serialize an array of form elements or a set of |
| 2836 | + // key/values into a query string |
| 2837 | + param: function( a ) { |
| 2838 | + var s = []; |
| 2839 | + |
| 2840 | + // If an array was passed in, assume that it is an array |
| 2841 | + // of form elements |
| 2842 | + if ( a.constructor == Array || a.jquery ) |
| 2843 | + // Serialize the form elements |
| 2844 | + jQuery.each( a, function(){ |
| 2845 | + s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) ); |
| 2846 | + }); |
| 2847 | + |
| 2848 | + // Otherwise, assume that it's an object of key/value pairs |
| 2849 | + else |
| 2850 | + // Serialize the key/values |
| 2851 | + for ( var j in a ) |
| 2852 | + // If the value is an array then the key names need to be repeated |
| 2853 | + if ( a[j] && a[j].constructor == Array ) |
| 2854 | + jQuery.each( a[j], function(){ |
| 2855 | + s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) ); |
| 2856 | + }); |
| 2857 | + else |
| 2858 | + s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j] ) ); |
| 2859 | + |
| 2860 | + // Return the resulting serialization |
| 2861 | + return s.join("&").replace(/%20/g, "+"); |
| 2862 | + } |
| 2863 | + |
| 2864 | +}); |
| 2865 | +jQuery.fn.extend({ |
| 2866 | + show: function(speed,callback){ |
| 2867 | + return speed ? |
| 2868 | + this.animate({ |
| 2869 | + height: "show", width: "show", opacity: "show" |
| 2870 | + }, speed, callback) : |
| 2871 | + |
| 2872 | + this.filter(":hidden").each(function(){ |
| 2873 | + this.style.display = this.oldblock || ""; |
| 2874 | + if ( jQuery.css(this,"display") == "none" ) { |
| 2875 | + var elem = jQuery("<" + this.tagName + " />").appendTo("body"); |
| 2876 | + this.style.display = elem.css("display"); |
| 2877 | + // handle an edge condition where css is - div { display:none; } or similar |
| 2878 | + if (this.style.display == "none") |
| 2879 | + this.style.display = "block"; |
| 2880 | + elem.remove(); |
| 2881 | + } |
| 2882 | + }).end(); |
| 2883 | + }, |
| 2884 | + |
| 2885 | + hide: function(speed,callback){ |
| 2886 | + return speed ? |
| 2887 | + this.animate({ |
| 2888 | + height: "hide", width: "hide", opacity: "hide" |
| 2889 | + }, speed, callback) : |
| 2890 | + |
| 2891 | + this.filter(":visible").each(function(){ |
| 2892 | + this.oldblock = this.oldblock || jQuery.css(this,"display"); |
| 2893 | + this.style.display = "none"; |
| 2894 | + }).end(); |
| 2895 | + }, |
| 2896 | + |
| 2897 | + // Save the old toggle function |
| 2898 | + _toggle: jQuery.fn.toggle, |
| 2899 | + |
| 2900 | + toggle: function( fn, fn2 ){ |
| 2901 | + return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ? |
| 2902 | + this._toggle( fn, fn2 ) : |
| 2903 | + fn ? |
| 2904 | + this.animate({ |
| 2905 | + height: "toggle", width: "toggle", opacity: "toggle" |
| 2906 | + }, fn, fn2) : |
| 2907 | + this.each(function(){ |
| 2908 | + jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ](); |
| 2909 | + }); |
| 2910 | + }, |
| 2911 | + |
| 2912 | + slideDown: function(speed,callback){ |
| 2913 | + return this.animate({height: "show"}, speed, callback); |
| 2914 | + }, |
| 2915 | + |
| 2916 | + slideUp: function(speed,callback){ |
| 2917 | + return this.animate({height: "hide"}, speed, callback); |
| 2918 | + }, |
| 2919 | + |
| 2920 | + slideToggle: function(speed, callback){ |
| 2921 | + return this.animate({height: "toggle"}, speed, callback); |
| 2922 | + }, |
| 2923 | + |
| 2924 | + fadeIn: function(speed, callback){ |
| 2925 | + return this.animate({opacity: "show"}, speed, callback); |
| 2926 | + }, |
| 2927 | + |
| 2928 | + fadeOut: function(speed, callback){ |
| 2929 | + return this.animate({opacity: "hide"}, speed, callback); |
| 2930 | + }, |
| 2931 | + |
| 2932 | + fadeTo: function(speed,to,callback){ |
| 2933 | + return this.animate({opacity: to}, speed, callback); |
| 2934 | + }, |
| 2935 | + |
| 2936 | + animate: function( prop, speed, easing, callback ) { |
| 2937 | + var optall = jQuery.speed(speed, easing, callback); |
| 2938 | + |
| 2939 | + return this[ optall.queue === false ? "each" : "queue" ](function(){ |
| 2940 | + if ( this.nodeType != 1) |
| 2941 | + return false; |
| 2942 | + |
| 2943 | + var opt = jQuery.extend({}, optall); |
| 2944 | + var hidden = jQuery(this).is(":hidden"), self = this; |
| 2945 | + |
| 2946 | + for ( var p in prop ) { |
| 2947 | + if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden ) |
| 2948 | + return jQuery.isFunction(opt.complete) && opt.complete.apply(this); |
| 2949 | + |
| 2950 | + if ( p == "height" || p == "width" ) { |
| 2951 | + // Store display property |
| 2952 | + opt.display = jQuery.css(this, "display"); |
| 2953 | + |
| 2954 | + // Make sure that nothing sneaks out |
| 2955 | + opt.overflow = this.style.overflow; |
| 2956 | + } |
| 2957 | + } |
| 2958 | + |
| 2959 | + if ( opt.overflow != null ) |
| 2960 | + this.style.overflow = "hidden"; |
| 2961 | + |
| 2962 | + opt.curAnim = jQuery.extend({}, prop); |
| 2963 | + |
| 2964 | + jQuery.each( prop, function(name, val){ |
| 2965 | + var e = new jQuery.fx( self, opt, name ); |
| 2966 | + |
| 2967 | + if ( /toggle|show|hide/.test(val) ) |
| 2968 | + e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop ); |
| 2969 | + else { |
| 2970 | + var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/), |
| 2971 | + start = e.cur(true) || 0; |
| 2972 | + |
| 2973 | + if ( parts ) { |
| 2974 | + var end = parseFloat(parts[2]), |
| 2975 | + unit = parts[3] || "px"; |
| 2976 | + |
| 2977 | + // We need to compute starting value |
| 2978 | + if ( unit != "px" ) { |
| 2979 | + self.style[ name ] = (end || 1) + unit; |
| 2980 | + start = ((end || 1) / e.cur(true)) * start; |
| 2981 | + self.style[ name ] = start + unit; |
| 2982 | + } |
| 2983 | + |
| 2984 | + // If a +=/-= token was provided, we're doing a relative animation |
| 2985 | + if ( parts[1] ) |
| 2986 | + end = ((parts[1] == "-=" ? -1 : 1) * end) + start; |
| 2987 | + |
| 2988 | + e.custom( start, end, unit ); |
| 2989 | + } else |
| 2990 | + e.custom( start, val, "" ); |
| 2991 | + } |
| 2992 | + }); |
| 2993 | + |
| 2994 | + // For JS strict compliance |
| 2995 | + return true; |
| 2996 | + }); |
| 2997 | + }, |
| 2998 | + |
| 2999 | + queue: function(type, fn){ |
| 3000 | + if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) { |
| 3001 | + fn = type; |
| 3002 | + type = "fx"; |
| 3003 | + } |
| 3004 | + |
| 3005 | + if ( !type || (typeof type == "string" && !fn) ) |
| 3006 | + return queue( this[0], type ); |
| 3007 | + |
| 3008 | + return this.each(function(){ |
| 3009 | + if ( fn.constructor == Array ) |
| 3010 | + queue(this, type, fn); |
| 3011 | + else { |
| 3012 | + queue(this, type).push( fn ); |
| 3013 | + |
| 3014 | + if ( queue(this, type).length == 1 ) |
| 3015 | + fn.apply(this); |
| 3016 | + } |
| 3017 | + }); |
| 3018 | + }, |
| 3019 | + |
| 3020 | + stop: function(clearQueue, gotoEnd){ |
| 3021 | + var timers = jQuery.timers; |
| 3022 | + |
| 3023 | + if (clearQueue) |
| 3024 | + this.queue([]); |
| 3025 | + |
| 3026 | + this.each(function(){ |
| 3027 | + // go in reverse order so anything added to the queue during the loop is ignored |
| 3028 | + for ( var i = timers.length - 1; i >= 0; i-- ) |
| 3029 | + if ( timers[i].elem == this ) { |
| 3030 | + if (gotoEnd) |
| 3031 | + // force the next step to be the last |
| 3032 | + timers[i](true); |
| 3033 | + timers.splice(i, 1); |
| 3034 | + } |
| 3035 | + }); |
| 3036 | + |
| 3037 | + // start the next in the queue if the last step wasn't forced |
| 3038 | + if (!gotoEnd) |
| 3039 | + this.dequeue(); |
| 3040 | + |
| 3041 | + return this; |
| 3042 | + } |
| 3043 | + |
| 3044 | +}); |
| 3045 | + |
| 3046 | +var queue = function( elem, type, array ) { |
| 3047 | + if ( !elem ) |
| 3048 | + return undefined; |
| 3049 | + |
| 3050 | + type = type || "fx"; |
| 3051 | + |
| 3052 | + var q = jQuery.data( elem, type + "queue" ); |
| 3053 | + |
| 3054 | + if ( !q || array ) |
| 3055 | + q = jQuery.data( elem, type + "queue", |
| 3056 | + array ? jQuery.makeArray(array) : [] ); |
| 3057 | + |
| 3058 | + return q; |
| 3059 | +}; |
| 3060 | + |
| 3061 | +jQuery.fn.dequeue = function(type){ |
| 3062 | + type = type || "fx"; |
| 3063 | + |
| 3064 | + return this.each(function(){ |
| 3065 | + var q = queue(this, type); |
| 3066 | + |
| 3067 | + q.shift(); |
| 3068 | + |
| 3069 | + if ( q.length ) |
| 3070 | + q[0].apply( this ); |
| 3071 | + }); |
| 3072 | +}; |
| 3073 | + |
| 3074 | +jQuery.extend({ |
| 3075 | + |
| 3076 | + speed: function(speed, easing, fn) { |
| 3077 | + var opt = speed && speed.constructor == Object ? speed : { |
| 3078 | + complete: fn || !fn && easing || |
| 3079 | + jQuery.isFunction( speed ) && speed, |
| 3080 | + duration: speed, |
| 3081 | + easing: fn && easing || easing && easing.constructor != Function && easing |
| 3082 | + }; |
| 3083 | + |
| 3084 | + opt.duration = (opt.duration && opt.duration.constructor == Number ? |
| 3085 | + opt.duration : |
| 3086 | + { slow: 600, fast: 200 }[opt.duration]) || 400; |
| 3087 | + |
| 3088 | + // Queueing |
| 3089 | + opt.old = opt.complete; |
| 3090 | + opt.complete = function(){ |
| 3091 | + if ( opt.queue !== false ) |
| 3092 | + jQuery(this).dequeue(); |
| 3093 | + if ( jQuery.isFunction( opt.old ) ) |
| 3094 | + opt.old.apply( this ); |
| 3095 | + }; |
| 3096 | + |
| 3097 | + return opt; |
| 3098 | + }, |
| 3099 | + |
| 3100 | + easing: { |
| 3101 | + linear: function( p, n, firstNum, diff ) { |
| 3102 | + return firstNum + diff * p; |
| 3103 | + }, |
| 3104 | + swing: function( p, n, firstNum, diff ) { |
| 3105 | + return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; |
| 3106 | + } |
| 3107 | + }, |
| 3108 | + |
| 3109 | + timers: [], |
| 3110 | + timerId: null, |
| 3111 | + |
| 3112 | + fx: function( elem, options, prop ){ |
| 3113 | + this.options = options; |
| 3114 | + this.elem = elem; |
| 3115 | + this.prop = prop; |
| 3116 | + |
| 3117 | + if ( !options.orig ) |
| 3118 | + options.orig = {}; |
| 3119 | + } |
| 3120 | + |
| 3121 | +}); |
| 3122 | + |
| 3123 | +jQuery.fx.prototype = { |
| 3124 | + |
| 3125 | + // Simple function for setting a style value |
| 3126 | + update: function(){ |
| 3127 | + if ( this.options.step ) |
| 3128 | + this.options.step.apply( this.elem, [ this.now, this ] ); |
| 3129 | + |
| 3130 | + (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this ); |
| 3131 | + |
| 3132 | + // Set display property to block for height/width animations |
| 3133 | + if ( this.prop == "height" || this.prop == "width" ) |
| 3134 | + this.elem.style.display = "block"; |
| 3135 | + }, |
| 3136 | + |
| 3137 | + // Get the current size |
| 3138 | + cur: function(force){ |
| 3139 | + if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null ) |
| 3140 | + return this.elem[ this.prop ]; |
| 3141 | + |
| 3142 | + var r = parseFloat(jQuery.css(this.elem, this.prop, force)); |
| 3143 | + return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0; |
| 3144 | + }, |
| 3145 | + |
| 3146 | + // Start an animation from one number to another |
| 3147 | + custom: function(from, to, unit){ |
| 3148 | + this.startTime = (new Date()).getTime(); |
| 3149 | + this.start = from; |
| 3150 | + this.end = to; |
| 3151 | + this.unit = unit || this.unit || "px"; |
| 3152 | + this.now = this.start; |
| 3153 | + this.pos = this.state = 0; |
| 3154 | + this.update(); |
| 3155 | + |
| 3156 | + var self = this; |
| 3157 | + function t(gotoEnd){ |
| 3158 | + return self.step(gotoEnd); |
| 3159 | + } |
| 3160 | + |
| 3161 | + t.elem = this.elem; |
| 3162 | + |
| 3163 | + jQuery.timers.push(t); |
| 3164 | + |
| 3165 | + if ( jQuery.timerId == null ) { |
| 3166 | + jQuery.timerId = setInterval(function(){ |
| 3167 | + var timers = jQuery.timers; |
| 3168 | + |
| 3169 | + for ( var i = 0; i < timers.length; i++ ) |
| 3170 | + if ( !timers[i]() ) |
| 3171 | + timers.splice(i--, 1); |
| 3172 | + |
| 3173 | + if ( !timers.length ) { |
| 3174 | + clearInterval( jQuery.timerId ); |
| 3175 | + jQuery.timerId = null; |
| 3176 | + } |
| 3177 | + }, 13); |
| 3178 | + } |
| 3179 | + }, |
| 3180 | + |
| 3181 | + // Simple 'show' function |
| 3182 | + show: function(){ |
| 3183 | + // Remember where we started, so that we can go back to it later |
| 3184 | + this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop ); |
| 3185 | + this.options.show = true; |
| 3186 | + |
| 3187 | + // Begin the animation |
| 3188 | + this.custom(0, this.cur()); |
| 3189 | + |
| 3190 | + // Make sure that we start at a small width/height to avoid any |
| 3191 | + // flash of content |
| 3192 | + if ( this.prop == "width" || this.prop == "height" ) |
| 3193 | + this.elem.style[this.prop] = "1px"; |
| 3194 | + |
| 3195 | + // Start by showing the element |
| 3196 | + jQuery(this.elem).show(); |
| 3197 | + }, |
| 3198 | + |
| 3199 | + // Simple 'hide' function |
| 3200 | + hide: function(){ |
| 3201 | + // Remember where we started, so that we can go back to it later |
| 3202 | + this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop ); |
| 3203 | + this.options.hide = true; |
| 3204 | + |
| 3205 | + // Begin the animation |
| 3206 | + this.custom(this.cur(), 0); |
| 3207 | + }, |
| 3208 | + |
| 3209 | + // Each step of an animation |
| 3210 | + step: function(gotoEnd){ |
| 3211 | + var t = (new Date()).getTime(); |
| 3212 | + |
| 3213 | + if ( gotoEnd || t > this.options.duration + this.startTime ) { |
| 3214 | + this.now = this.end; |
| 3215 | + this.pos = this.state = 1; |
| 3216 | + this.update(); |
| 3217 | + |
| 3218 | + this.options.curAnim[ this.prop ] = true; |
| 3219 | + |
| 3220 | + var done = true; |
| 3221 | + for ( var i in this.options.curAnim ) |
| 3222 | + if ( this.options.curAnim[i] !== true ) |
| 3223 | + done = false; |
| 3224 | + |
| 3225 | + if ( done ) { |
| 3226 | + if ( this.options.display != null ) { |
| 3227 | + // Reset the overflow |
| 3228 | + this.elem.style.overflow = this.options.overflow; |
| 3229 | + |
| 3230 | + // Reset the display |
| 3231 | + this.elem.style.display = this.options.display; |
| 3232 | + if ( jQuery.css(this.elem, "display") == "none" ) |
| 3233 | + this.elem.style.display = "block"; |
| 3234 | + } |
| 3235 | + |
| 3236 | + // Hide the element if the "hide" operation was done |
| 3237 | + if ( this.options.hide ) |
| 3238 | + this.elem.style.display = "none"; |
| 3239 | + |
| 3240 | + // Reset the properties, if the item has been hidden or shown |
| 3241 | + if ( this.options.hide || this.options.show ) |
| 3242 | + for ( var p in this.options.curAnim ) |
| 3243 | + jQuery.attr(this.elem.style, p, this.options.orig[p]); |
| 3244 | + } |
| 3245 | + |
| 3246 | + // If a callback was provided, execute it |
| 3247 | + if ( done && jQuery.isFunction( this.options.complete ) ) |
| 3248 | + // Execute the complete function |
| 3249 | + this.options.complete.apply( this.elem ); |
| 3250 | + |
| 3251 | + return false; |
| 3252 | + } else { |
| 3253 | + var n = t - this.startTime; |
| 3254 | + this.state = n / this.options.duration; |
| 3255 | + |
| 3256 | + // Perform the easing function, defaults to swing |
| 3257 | + this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration); |
| 3258 | + this.now = this.start + ((this.end - this.start) * this.pos); |
| 3259 | + |
| 3260 | + // Perform the next step of the animation |
| 3261 | + this.update(); |
| 3262 | + } |
| 3263 | + |
| 3264 | + return true; |
| 3265 | + } |
| 3266 | + |
| 3267 | +}; |
| 3268 | + |
| 3269 | +jQuery.fx.step = { |
| 3270 | + scrollLeft: function(fx){ |
| 3271 | + fx.elem.scrollLeft = fx.now; |
| 3272 | + }, |
| 3273 | + |
| 3274 | + scrollTop: function(fx){ |
| 3275 | + fx.elem.scrollTop = fx.now; |
| 3276 | + }, |
| 3277 | + |
| 3278 | + opacity: function(fx){ |
| 3279 | + jQuery.attr(fx.elem.style, "opacity", fx.now); |
| 3280 | + }, |
| 3281 | + |
| 3282 | + _default: function(fx){ |
| 3283 | + fx.elem.style[ fx.prop ] = fx.now + fx.unit; |
| 3284 | + } |
| 3285 | +}; |
| 3286 | +// The Offset Method |
| 3287 | +// Originally By Brandon Aaron, part of the Dimension Plugin |
| 3288 | +// http://jquery.com/plugins/project/dimensions |
| 3289 | +jQuery.fn.offset = function() { |
| 3290 | + var left = 0, top = 0, elem = this[0], results; |
| 3291 | + |
| 3292 | + if ( elem ) with ( jQuery.browser ) { |
| 3293 | + var parent = elem.parentNode, |
| 3294 | + offsetChild = elem, |
| 3295 | + offsetParent = elem.offsetParent, |
| 3296 | + doc = elem.ownerDocument, |
| 3297 | + safari2 = safari && parseInt(version) < 522, |
| 3298 | + fixed = jQuery.css(elem, "position") == "fixed"; |
| 3299 | + |
| 3300 | + // Use getBoundingClientRect if available |
| 3301 | + if ( elem.getBoundingClientRect ) { |
| 3302 | + var box = elem.getBoundingClientRect(); |
| 3303 | + |
| 3304 | + // Add the document scroll offsets |
| 3305 | + add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), |
| 3306 | + box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop)); |
| 3307 | + |
| 3308 | + // IE adds the HTML element's border, by default it is medium which is 2px |
| 3309 | + // IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; } |
| 3310 | + // IE 7 standards mode, the border is always 2px |
| 3311 | + // This border/offset is typically represented by the clientLeft and clientTop properties |
| 3312 | + // However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS |
| 3313 | + // Therefore this method will be off by 2px in IE while in quirksmode |
| 3314 | + add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop ); |
| 3315 | + |
| 3316 | + // Otherwise loop through the offsetParents and parentNodes |
| 3317 | + } else { |
| 3318 | + |
| 3319 | + // Initial element offsets |
| 3320 | + add( elem.offsetLeft, elem.offsetTop ); |
| 3321 | + |
| 3322 | + // Get parent offsets |
| 3323 | + while ( offsetParent ) { |
| 3324 | + // Add offsetParent offsets |
| 3325 | + add( offsetParent.offsetLeft, offsetParent.offsetTop ); |
| 3326 | + |
| 3327 | + // Mozilla and Safari > 2 does not include the border on offset parents |
| 3328 | + // However Mozilla adds the border for table or table cells |
| 3329 | + if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 ) |
| 3330 | + border( offsetParent ); |
| 3331 | + |
| 3332 | + // Add the document scroll offsets if position is fixed on any offsetParent |
| 3333 | + if ( !fixed && jQuery.css(offsetParent, "position") == "fixed" ) |
| 3334 | + fixed = true; |
| 3335 | + |
| 3336 | + // Set offsetChild to previous offsetParent unless it is the body element |
| 3337 | + offsetChild = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent; |
| 3338 | + // Get next offsetParent |
| 3339 | + offsetParent = offsetParent.offsetParent; |
| 3340 | + } |
| 3341 | + |
| 3342 | + // Get parent scroll offsets |
| 3343 | + while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) { |
| 3344 | + // Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug |
| 3345 | + if ( !/^inline|table.*$/i.test(jQuery.css(parent, "display")) ) |
| 3346 | + // Subtract parent scroll offsets |
| 3347 | + add( -parent.scrollLeft, -parent.scrollTop ); |
| 3348 | + |
| 3349 | + // Mozilla does not add the border for a parent that has overflow != visible |
| 3350 | + if ( mozilla && jQuery.css(parent, "overflow") != "visible" ) |
| 3351 | + border( parent ); |
| 3352 | + |
| 3353 | + // Get next parent |
| 3354 | + parent = parent.parentNode; |
| 3355 | + } |
| 3356 | + |
| 3357 | + // Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild |
| 3358 | + // Mozilla doubles body offsets with a non-absolutely positioned offsetChild |
| 3359 | + if ( (safari2 && (fixed || jQuery.css(offsetChild, "position") == "absolute")) || |
| 3360 | + (mozilla && jQuery.css(offsetChild, "position") != "absolute") ) |
| 3361 | + add( -doc.body.offsetLeft, -doc.body.offsetTop ); |
| 3362 | + |
| 3363 | + // Add the document scroll offsets if position is fixed |
| 3364 | + if ( fixed ) |
| 3365 | + add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), |
| 3366 | + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop)); |
| 3367 | + } |
| 3368 | + |
| 3369 | + // Return an object with top and left properties |
| 3370 | + results = { top: top, left: left }; |
| 3371 | + } |
| 3372 | + |
| 3373 | + function border(elem) { |
| 3374 | + add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) ); |
| 3375 | + } |
| 3376 | + |
| 3377 | + function add(l, t) { |
| 3378 | + left += parseInt(l) || 0; |
| 3379 | + top += parseInt(t) || 0; |
| 3380 | + } |
| 3381 | + |
| 3382 | + return results; |
| 3383 | +}; |
| 3384 | +})(); |
Index: trunk/extensions/Tooltips/hover.js |
— | — | @@ -0,0 +1,10 @@ |
| 2 | +// hover.js |
| 3 | +$j( function() { |
| 4 | + $j('.mw-tooltip-text').tooltip({ |
| 5 | + bodyHandler: function() { |
| 6 | + var content = $j(this).find('.mw-tooltip'); |
| 7 | + return content.html(); |
| 8 | + }, |
| 9 | + showURL : false |
| 10 | + }); |
| 11 | +} ); |