| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
(function( $, undefined ) { |
| 12 |
|
| 13 |
var uuid = 0, |
| 14 |
runiqueId = /^ui-id-\d+$/; |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
$.ui = $.ui || {}; |
| 20 |
if ( $.ui.version ) { |
| 21 |
return; |
| 22 |
} |
| 23 |
|
| 24 |
$.extend( $.ui, { |
| 25 |
version: "1.9.2", |
| 26 |
|
| 27 |
keyCode: { |
| 28 |
BACKSPACE: 8, |
| 29 |
COMMA: 188, |
| 30 |
DELETE: 46, |
| 31 |
DOWN: 40, |
| 32 |
END: 35, |
| 33 |
ENTER: 13, |
| 34 |
ESCAPE: 27, |
| 35 |
HOME: 36, |
| 36 |
LEFT: 37, |
| 37 |
NUMPAD_ADD: 107, |
| 38 |
NUMPAD_DECIMAL: 110, |
| 39 |
NUMPAD_DIVIDE: 111, |
| 40 |
NUMPAD_ENTER: 108, |
| 41 |
NUMPAD_MULTIPLY: 106, |
| 42 |
NUMPAD_SUBTRACT: 109, |
| 43 |
PAGE_DOWN: 34, |
| 44 |
PAGE_UP: 33, |
| 45 |
PERIOD: 190, |
| 46 |
RIGHT: 39, |
| 47 |
SPACE: 32, |
| 48 |
TAB: 9, |
| 49 |
UP: 38 |
| 50 |
} |
| 51 |
}); |
| 52 |
|
| 53 |
|
| 54 |
$.fn.extend({ |
| 55 |
_focus: $.fn.focus, |
| 56 |
focus: function( delay, fn ) { |
| 57 |
return typeof delay === "number" ? |
| 58 |
this.each(function() { |
| 59 |
var elem = this; |
| 60 |
setTimeout(function() { |
| 61 |
$( elem ).focus(); |
| 62 |
if ( fn ) { |
| 63 |
fn.call( elem ); |
| 64 |
} |
| 65 |
}, delay ); |
| 66 |
}) : |
| 67 |
this._focus.apply( this, arguments ); |
| 68 |
}, |
| 69 |
|
| 70 |
scrollParent: function() { |
| 71 |
var scrollParent; |
| 72 |
if (($.ui.ie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { |
| 73 |
scrollParent = this.parents().filter(function() { |
| 74 |
return (/(relative|absolute|fixed)/).test($.css(this,'position')) && (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x')); |
| 75 |
}).eq(0); |
| 76 |
} else { |
| 77 |
scrollParent = this.parents().filter(function() { |
| 78 |
return (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x')); |
| 79 |
}).eq(0); |
| 80 |
} |
| 81 |
|
| 82 |
return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent; |
| 83 |
}, |
| 84 |
|
| 85 |
zIndex: function( zIndex ) { |
| 86 |
if ( zIndex !== undefined ) { |
| 87 |
return this.css( "zIndex", zIndex ); |
| 88 |
} |
| 89 |
|
| 90 |
if ( this.length ) { |
| 91 |
var elem = $( this[ 0 ] ), position, value; |
| 92 |
while ( elem.length && elem[ 0 ] !== document ) { |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
position = elem.css( "position" ); |
| 97 |
if ( position === "absolute" || position === "relative" || position === "fixed" ) { |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
value = parseInt( elem.css( "zIndex" ), 10 ); |
| 103 |
if ( !isNaN( value ) && value !== 0 ) { |
| 104 |
return value; |
| 105 |
} |
| 106 |
} |
| 107 |
elem = elem.parent(); |
| 108 |
} |
| 109 |
} |
| 110 |
|
| 111 |
return 0; |
| 112 |
}, |
| 113 |
|
| 114 |
uniqueId: function() { |
| 115 |
return this.each(function() { |
| 116 |
if ( !this.id ) { |
| 117 |
this.id = "ui-id-" + (++uuid); |
| 118 |
} |
| 119 |
}); |
| 120 |
}, |
| 121 |
|
| 122 |
removeUniqueId: function() { |
| 123 |
return this.each(function() { |
| 124 |
if ( runiqueId.test( this.id ) ) { |
| 125 |
$( this ).removeAttr( "id" ); |
| 126 |
} |
| 127 |
}); |
| 128 |
} |
| 129 |
}); |
| 130 |
|
| 131 |
|
| 132 |
function focusable( element, isTabIndexNotNaN ) { |
| 133 |
var map, mapName, img, |
| 134 |
nodeName = element.nodeName.toLowerCase(); |
| 135 |
if ( "area" === nodeName ) { |
| 136 |
map = element.parentNode; |
| 137 |
mapName = map.name; |
| 138 |
if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { |
| 139 |
return false; |
| 140 |
} |
| 141 |
img = $( "img[usemap=#" + mapName + "]" )[0]; |
| 142 |
return !!img && visible( img ); |
| 143 |
} |
| 144 |
return ( /input|select|textarea|button|object/.test( nodeName ) ? |
| 145 |
!element.disabled : |
| 146 |
"a" === nodeName ? |
| 147 |
element.href || isTabIndexNotNaN : |
| 148 |
isTabIndexNotNaN) && |
| 149 |
|
| 150 |
visible( element ); |
| 151 |
} |
| 152 |
|
| 153 |
function visible( element ) { |
| 154 |
return $.expr.pseudos.visible( element ) && |
| 155 |
!$( element ).parents().addBack().filter(function() { |
| 156 |
return $.css( this, "visibility" ) === "hidden"; |
| 157 |
}).length; |
| 158 |
} |
| 159 |
|
| 160 |
$.extend( $.expr.pseudos, { |
| 161 |
data: $.expr.createPseudo ? |
| 162 |
$.expr.createPseudo(function( dataName ) { |
| 163 |
return function( elem ) { |
| 164 |
return !!$.data( elem, dataName ); |
| 165 |
}; |
| 166 |
}) : |
| 167 |
|
| 168 |
function( elem, i, match ) { |
| 169 |
return !!$.data( elem, match[ 3 ] ); |
| 170 |
}, |
| 171 |
|
| 172 |
focusable: function( element ) { |
| 173 |
return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); |
| 174 |
}, |
| 175 |
|
| 176 |
tabbable: function( element ) { |
| 177 |
var tabIndex = $.attr( element, "tabindex" ), |
| 178 |
isTabIndexNaN = isNaN( tabIndex ); |
| 179 |
return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); |
| 180 |
} |
| 181 |
}); |
| 182 |
|
| 183 |
|
| 184 |
$(function() { |
| 185 |
var body = document.body, |
| 186 |
div = body.appendChild( div = document.createElement( "div" ) ); |
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
div.offsetHeight; |
| 192 |
|
| 193 |
$.extend( div.style, { |
| 194 |
minHeight: "100px", |
| 195 |
height: "auto", |
| 196 |
padding: 0, |
| 197 |
borderWidth: 0 |
| 198 |
}); |
| 199 |
|
| 200 |
$.support.minHeight = div.offsetHeight === 100; |
| 201 |
$.support.selectstart = "onselectstart" in div; |
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
body.removeChild( div ).style.display = "none"; |
| 206 |
}); |
| 207 |
|
| 208 |
|
| 209 |
if ( !$( "<a>" ).outerWidth( 1 ).jquery ) { |
| 210 |
$.each( [ "Width", "Height" ], function( i, name ) { |
| 211 |
var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], |
| 212 |
type = name.toLowerCase(), |
| 213 |
orig = { |
| 214 |
innerWidth: $.fn.innerWidth, |
| 215 |
innerHeight: $.fn.innerHeight, |
| 216 |
outerWidth: $.fn.outerWidth, |
| 217 |
outerHeight: $.fn.outerHeight |
| 218 |
}; |
| 219 |
|
| 220 |
function reduce( elem, size, border, margin ) { |
| 221 |
$.each( side, function() { |
| 222 |
size -= parseFloat( $.css( elem, "padding" + this ) ) || 0; |
| 223 |
if ( border ) { |
| 224 |
size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0; |
| 225 |
} |
| 226 |
if ( margin ) { |
| 227 |
size -= parseFloat( $.css( elem, "margin" + this ) ) || 0; |
| 228 |
} |
| 229 |
}); |
| 230 |
return size; |
| 231 |
} |
| 232 |
|
| 233 |
$.fn[ "inner" + name ] = function( size ) { |
| 234 |
if ( size === undefined ) { |
| 235 |
return orig[ "inner" + name ].call( this ); |
| 236 |
} |
| 237 |
|
| 238 |
return this.each(function() { |
| 239 |
$( this ).css( type, reduce( this, size ) + "px" ); |
| 240 |
}); |
| 241 |
}; |
| 242 |
|
| 243 |
$.fn[ "outer" + name] = function( size, margin ) { |
| 244 |
if ( typeof size !== "number" ) { |
| 245 |
return orig[ "outer" + name ].call( this, size ); |
| 246 |
} |
| 247 |
|
| 248 |
return this.each(function() { |
| 249 |
$( this).css( type, reduce( this, size, true, margin ) + "px" ); |
| 250 |
}); |
| 251 |
}; |
| 252 |
}); |
| 253 |
} |
| 254 |
|
| 255 |
|
| 256 |
if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) { |
| 257 |
$.fn.removeData = (function( removeData ) { |
| 258 |
return function( key ) { |
| 259 |
if ( arguments.length ) { |
| 260 |
return removeData.call( this, $.camelCase( key ) ); |
| 261 |
} else { |
| 262 |
return removeData.call( this ); |
| 263 |
} |
| 264 |
}; |
| 265 |
})( $.fn.removeData ); |
| 266 |
} |
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
(function() { |
| 275 |
var uaMatch = /msie ([\w.]+)/.exec( navigator.userAgent.toLowerCase() ) || []; |
| 276 |
$.ui.ie = uaMatch.length ? true : false; |
| 277 |
$.ui.ie6 = parseFloat( uaMatch[ 1 ], 10 ) === 6; |
| 278 |
})(); |
| 279 |
|
| 280 |
$.fn.extend({ |
| 281 |
disableSelection: function() { |
| 282 |
return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) + |
| 283 |
".ui-disableSelection", function( event ) { |
| 284 |
event.preventDefault(); |
| 285 |
}); |
| 286 |
}, |
| 287 |
|
| 288 |
enableSelection: function() { |
| 289 |
return this.unbind( ".ui-disableSelection" ); |
| 290 |
} |
| 291 |
}); |
| 292 |
|
| 293 |
$.extend( $.ui, { |
| 294 |
|
| 295 |
plugin: { |
| 296 |
add: function( module, option, set ) { |
| 297 |
var i, |
| 298 |
proto = $.ui[ module ].prototype; |
| 299 |
for ( i in set ) { |
| 300 |
proto.plugins[ i ] = proto.plugins[ i ] || []; |
| 301 |
proto.plugins[ i ].push( [ option, set[ i ] ] ); |
| 302 |
} |
| 303 |
}, |
| 304 |
call: function( instance, name, args ) { |
| 305 |
var i, |
| 306 |
set = instance.plugins[ name ]; |
| 307 |
if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) { |
| 308 |
return; |
| 309 |
} |
| 310 |
|
| 311 |
for ( i = 0; i < set.length; i++ ) { |
| 312 |
if ( instance.options[ set[ i ][ 0 ] ] ) { |
| 313 |
set[ i ][ 1 ].apply( instance.element, args ); |
| 314 |
} |
| 315 |
} |
| 316 |
} |
| 317 |
}, |
| 318 |
|
| 319 |
contains: $.contains, |
| 320 |
|
| 321 |
|
| 322 |
hasScroll: function( el, a ) { |
| 323 |
|
| 324 |
|
| 325 |
if ( $( el ).css( "overflow" ) === "hidden") { |
| 326 |
return false; |
| 327 |
} |
| 328 |
|
| 329 |
var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", |
| 330 |
has = false; |
| 331 |
|
| 332 |
if ( el[ scroll ] > 0 ) { |
| 333 |
return true; |
| 334 |
} |
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
el[ scroll ] = 1; |
| 340 |
has = ( el[ scroll ] > 0 ); |
| 341 |
el[ scroll ] = 0; |
| 342 |
return has; |
| 343 |
}, |
| 344 |
|
| 345 |
|
| 346 |
isOverAxis: function( x, reference, size ) { |
| 347 |
|
| 348 |
return ( x > reference ) && ( x < ( reference + size ) ); |
| 349 |
}, |
| 350 |
isOver: function( y, x, top, left, height, width ) { |
| 351 |
|
| 352 |
return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width ); |
| 353 |
} |
| 354 |
}); |
| 355 |
|
| 356 |
})( jQuery ); |