[7912] | 1 | /* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net) |
---|
| 2 | * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) |
---|
| 3 | * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. |
---|
| 4 | * |
---|
| 5 | * $LastChangedDate: 2007-12-20 08:43:48 -0600 (Thu, 20 Dec 2007) $ |
---|
| 6 | * $Rev: 4257 $ |
---|
| 7 | * |
---|
| 8 | * $LastChangedDate: 2010-10-23 08:43:48 -0600 (Thu, 20 Dec 2007) $ |
---|
| 9 | * By cljosse |
---|
[16638] | 10 | * Version: 1.3 |
---|
[7912] | 11 | * |
---|
| 12 | * Requires: jQuery 1.2+ |
---|
| 13 | * |
---|
[7867] | 14 | */ |
---|
[7353] | 15 | (function (jQuery) { |
---|
[10845] | 16 | jQuery.dimensions = { version: '1.3' }; |
---|
| 17 | /* |
---|
| 18 | * Interception Height, Width |
---|
| 19 | */ |
---|
| 20 | jQuery.each(['Height', 'Width'], |
---|
[8627] | 21 | function (i, name) { |
---|
[10845] | 22 | jQuery.fn['inner' + name] = function () { |
---|
| 23 | if (!this[0]) return; |
---|
| 24 | var torl = name == 'Height' ? 'Top' : 'Left', |
---|
[8627] | 25 | borr = name == 'Height' ? 'Bottom' : 'Right'; |
---|
[10845] | 26 | return this.is(':visible') ? this[0]['client' + name] : num(this, name.toLowerCase()) + num(this, 'padding' + torl) + num(this, 'padding' + borr); |
---|
| 27 | }; |
---|
[7353] | 28 | |
---|
[10845] | 29 | jQuery.fn['outer' + name] = function (options) { |
---|
| 30 | if (!this[0]) return; |
---|
| 31 | var torl = name == 'Height' ? 'Top' : 'Left', |
---|
[8627] | 32 | borr = name == 'Height' ? 'Bottom' : 'Right'; |
---|
[10845] | 33 | options = options || false; |
---|
| 34 | options = jQuery.extend({ margin: options }); |
---|
[16931] | 35 | Maxi_val = this.parent().width(); |
---|
[10845] | 36 | var val = this.is(':visible') ? this[0]['offset' + name] : |
---|
[8627] | 37 | num(this, |
---|
| 38 | name.toLowerCase()) + |
---|
| 39 | num(this, 'border' + torl + 'Width') + |
---|
| 40 | num(this, 'border' + borr + 'Width') + |
---|
| 41 | num(this, 'padding' + torl) + |
---|
| 42 | num(this, 'padding' + borr) |
---|
[7912] | 43 | |
---|
[8627] | 44 | ; |
---|
[10845] | 45 | return val + (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0); |
---|
| 46 | }; |
---|
[8627] | 47 | }); |
---|
[10845] | 48 | /* |
---|
| 49 | * |
---|
| 50 | */ |
---|
[17192] | 51 | jQuery.each(['Left', 'Top', 'Right', 'Bottom', 'All'], |
---|
[8627] | 52 | function (i, name) { |
---|
[17192] | 53 | //========== scroll ================= |
---|
[10845] | 54 | jQuery.fn['scroll' + name] = function (val) { |
---|
| 55 | if (!this[0]) return; |
---|
| 56 | return val != undefined ? this.each(function () { |
---|
| 57 | this == window || this == document ? window.scrollTo(name == 'Left' ? val : $(window)['scrollLeft'](), |
---|
[8627] | 58 | name == 'Top' ? val : $(window)['scrollTop']()) : this['scroll' + name] = val; |
---|
[10845] | 59 | }) : this[0] == window || this[0] == document ? self[(name == 'Left' ? 'pageXOffset' : 'pageYOffset')] || jQuery.boxModel && document.documentElement['scroll' + name] || document.body['scroll' + name] : this[0]['scroll' + name]; |
---|
| 60 | }; |
---|
[17192] | 61 | //========= Absolute ===================== |
---|
| 62 | jQuery.fn['absolute' + name] = function (Args) { |
---|
| 63 | if (!this[0]) return 0; |
---|
[10845] | 64 | a = jQuery(this[0]); |
---|
[17192] | 65 | m = { Left: 0, Top: 0, Right: 0, Bottom: 0, |
---|
| 66 | All: { |
---|
| 67 | Left: 0, Top: 0, Right: 0, Bottom: 0 |
---|
| 68 | } |
---|
| 69 | }; |
---|
| 70 | pos = jQuery(this).offset(); |
---|
| 71 | pos.top = Math.ceil(pos.top); |
---|
| 72 | pos.left = Math.ceil(pos.left); |
---|
[7353] | 73 | |
---|
[17192] | 74 | size = { width: jQuery(this).outerWidth(), height: jQuery(this).outerHeight() }; |
---|
| 75 | |
---|
| 76 | if (name == "All") { |
---|
| 77 | m[name]['Left'] = pos.left; |
---|
| 78 | m[name]['Top'] = pos.top; |
---|
| 79 | m[name]['Right'] = pos.left + size.width; |
---|
| 80 | m[name]['Bottom'] = pos.top + size.height; |
---|
| 81 | } else { |
---|
| 82 | |
---|
| 83 | if (name == 'Left' || name == 'Top') { |
---|
| 84 | m[name] = name == 'Left' ? pos.left : (pos.top); |
---|
| 85 | } else { |
---|
| 86 | m[name] = name == 'Right' ? pos.left + size.width : pos.top + size.height; |
---|
| 87 | } |
---|
| 88 | |
---|
| 89 | |
---|
[10845] | 90 | } |
---|
[8807] | 91 | |
---|
| 92 | |
---|
[17192] | 93 | return m[name]; |
---|
[8807] | 94 | |
---|
| 95 | |
---|
[10845] | 96 | }; |
---|
[8807] | 97 | |
---|
| 98 | |
---|
[8627] | 99 | }); |
---|
[10845] | 100 | //===================================================== |
---|
| 101 | jQuery.fn.extend({ |
---|
[7353] | 102 | |
---|
[17192] | 103 | infos: function (Arguments) { |
---|
| 104 | if (!Arguments) { |
---|
| 105 | Arguments = { pos_absolute: false, pos_externe: false }; |
---|
| 106 | |
---|
| 107 | } |
---|
| 108 | Args = { pos_absolute: Arguments.pos_absolute || false, pos_externe: Arguments.pos_externe || false }; |
---|
| 109 | |
---|
[10845] | 110 | var width = 0, height = 0; |
---|
| 111 | var elem = jQuery(this).get(0); |
---|
[7353] | 112 | |
---|
| 113 | |
---|
[10845] | 114 | var Left = 0, Top = 0, offset, parentOffset, offsetParent, results; |
---|
| 115 | var borderwidth = { width: "0 0 0 0", |
---|
| 116 | top: 0, |
---|
| 117 | left: 0, |
---|
| 118 | right: 0, |
---|
| 119 | bottom: 0 |
---|
| 120 | } |
---|
| 121 | var padding = { padding: "0 0 0 0", |
---|
| 122 | top: 0, |
---|
| 123 | left: 0, |
---|
| 124 | right: 0, |
---|
| 125 | bottom: 0 |
---|
| 126 | }; |
---|
| 127 | var margin = { margin: "0 0 0 0", |
---|
| 128 | top: 0, |
---|
| 129 | left: 0, |
---|
| 130 | right: 0, |
---|
| 131 | bottom: 0 |
---|
| 132 | }; |
---|
| 133 | //===================================================================== |
---|
| 134 | myposition = ""; |
---|
| 135 | results = { |
---|
[17192] | 136 | visible: false, |
---|
[10845] | 137 | position: "", |
---|
| 138 | top: 0, |
---|
| 139 | left: 0, |
---|
| 140 | width: 0, |
---|
| 141 | height: 0, |
---|
| 142 | right: 0, |
---|
| 143 | bottom: 0, |
---|
| 144 | borderwidth: borderwidth, |
---|
| 145 | padding: padding, |
---|
[16931] | 146 | margin: margin, |
---|
| 147 | |
---|
| 148 | out: { |
---|
| 149 | width: 0, |
---|
| 150 | height: 0, |
---|
| 151 | right: 0, |
---|
| 152 | bottom: 0 |
---|
| 153 | }, |
---|
[17192] | 154 | |
---|
[16931] | 155 | exterieur: { |
---|
| 156 | width: 0, |
---|
| 157 | height: 0, |
---|
| 158 | right: 0, |
---|
| 159 | bottom: 0 |
---|
| 160 | }, |
---|
[17192] | 161 | |
---|
[16931] | 162 | general: { |
---|
| 163 | width: 0, |
---|
| 164 | height: 0, |
---|
| 165 | right: 0, |
---|
| 166 | bottom: 0, |
---|
[17192] | 167 | marges: { height: 0, |
---|
| 168 | top: 0, |
---|
| 169 | bottom: 0, |
---|
| 170 | width: 0, |
---|
| 171 | left: 0, |
---|
| 172 | right: 0 |
---|
| 173 | } |
---|
| 174 | }, |
---|
| 175 | src: "", |
---|
| 176 | useMap: "", |
---|
[16931] | 177 | id: "", |
---|
| 178 | nodeName: "" |
---|
[10845] | 179 | }; |
---|
| 180 | ; |
---|
| 181 | if (elem) { |
---|
| 182 | id = ""; nodeName = ""; |
---|
| 183 | if (elem.id) id = elem.id; |
---|
| 184 | if (elem.nodeName) nodeName = elem.nodeName; |
---|
[7805] | 185 | |
---|
[16638] | 186 | width = jQuery(elem).width(); |
---|
| 187 | height = jQuery(elem).height(); |
---|
[10845] | 188 | if (elem == window) { |
---|
[7867] | 189 | |
---|
[10845] | 190 | myposition = ""; |
---|
| 191 | width = jQuery(elem).width(); |
---|
| 192 | height = jQuery(elem).height(); |
---|
[16638] | 193 | out_width = width; |
---|
| 194 | out_height = height; |
---|
[17192] | 195 | in_width = width; ; |
---|
| 196 | in_height = height; |
---|
| 197 | |
---|
[10845] | 198 | } else { |
---|
[8729] | 199 | |
---|
[10845] | 200 | Css = jQuery(elem).getStyles(elem); |
---|
| 201 | myposition = Css.position.toString() || ""; |
---|
[16638] | 202 | out_width = jQuery(elem).outerWidth(); |
---|
| 203 | out_height = jQuery(elem).outerHeight(); |
---|
[17192] | 204 | in_width = jQuery(elem).innerWidth(); |
---|
| 205 | in_height = jQuery(elem).innerHeight(); |
---|
[16931] | 206 | elem_parent = elem.parentElement; |
---|
[11961] | 207 | if (typeof elem_parent == "undefined") { |
---|
| 208 | elem_parent = window; |
---|
| 209 | } |
---|
[17192] | 210 | |
---|
[11961] | 211 | if (typeof Css.width != "undefined") |
---|
[16638] | 212 | width = Get_Val_int(Css.width, jQuery(elem_parent).width(), 0); |
---|
[7353] | 213 | |
---|
[11961] | 214 | if (typeof Css.height != "undefined") |
---|
[16638] | 215 | height = Get_Val_int(Css.height, jQuery(elem_parent).height(), 0); |
---|
[7353] | 216 | |
---|
[11961] | 217 | |
---|
[16638] | 218 | borderwidth.left = Get_Val_int(Css.borderLeftWidth, "", "", { elem: elem, prop: 'borderLeftWidth' }); |
---|
| 219 | borderwidth.right = Get_Val_int(Css.borderRightWidth, "", "", { elem: elem, prop: 'borderRightWidth' }); |
---|
| 220 | borderwidth.top = Get_Val_int(Css.borderTopWidth, "", "", { elem: elem, prop: 'borderTopWidth' }); |
---|
| 221 | borderwidth.bottom = Get_Val_int(Css.borderBottomWidth, "", "", { elem: elem, prop: 'borderBottomWidth' }); |
---|
[10845] | 222 | try { |
---|
| 223 | borderwidth.width = Css.borderWidth; |
---|
| 224 | } catch (e) { |
---|
| 225 | borderwidth.width = '"' + borderwidth.left + ' ' + borderwidth.top + ' ' + borderwidth.right + ' ' + borderwidth.bottom + '"'; |
---|
| 226 | } |
---|
[7805] | 227 | |
---|
[16638] | 228 | margin.left = Get_Val_int(Css.marginLeft, "", "", { elem: elem, prop: 'marginLeft' }); |
---|
| 229 | margin.right = Get_Val_int(Css.marginRight, "", "", { elem: elem, prop: 'marginRight' }); |
---|
| 230 | margin.top = Get_Val_int(Css.marginTop, "", "", { elem: elem, prop: 'marginTop' }); |
---|
| 231 | margin.bottom = Get_Val_int(Css.marginBottom, "", "", { elem: elem, prop: 'marginBottom' }); |
---|
[8536] | 232 | |
---|
[8729] | 233 | |
---|
[10845] | 234 | try { |
---|
| 235 | margin.margin = Css.margin; |
---|
| 236 | } catch (e) { |
---|
| 237 | margin.margin = '"' + margin.left + ' ' + margin.top + ' ' + margin.right + ' ' + margin.bottom + '"'; |
---|
| 238 | } |
---|
[8729] | 239 | |
---|
| 240 | |
---|
[16638] | 241 | padding.left = Get_Val_int(Css.paddingLeft, "", "", { elem: elem, prop: 'paddingLeft' }); |
---|
| 242 | padding.right = Get_Val_int(Css.paddingRight, "", "", { elem: elem, prop: 'paddingRight' }); |
---|
| 243 | padding.top = Get_Val_int(Css.paddingTop, "", "", { elem: elem, prop: 'paddingTop' }); |
---|
| 244 | padding.bottom = Get_Val_int(Css.paddingBottom, "", "", { elem: elem, prop: 'paddingBottom' }); |
---|
[7816] | 245 | |
---|
[10845] | 246 | try { |
---|
| 247 | padding.padding = Css.padding; |
---|
| 248 | } catch (e) { |
---|
| 249 | padding.padding = '"' + padding.left + ' ' + padding.top + ' ' + padding.right + ' ' + padding.bottom + '"'; |
---|
| 250 | } |
---|
| 251 | } |
---|
| 252 | if (elem == window) { |
---|
[11277] | 253 | Cl_Position = { top: 0, left: 0 }; |
---|
[10845] | 254 | } else { |
---|
| 255 | Cl_Position = jQuery(elem).d_position(); |
---|
[17192] | 256 | |
---|
| 257 | /* |
---|
| 258 | margin: 5px; |
---|
| 259 | border: 10px ; |
---|
| 260 | padding: 20px; |
---|
| 261 | |
---|
| 262 | */ |
---|
| 263 | s_elem = elem; |
---|
| 264 | Left = Cl_Position.left; // 291 |
---|
| 265 | Top = Cl_Position.top; // 812 |
---|
| 266 | if (Args.pos_absolute == true) { |
---|
| 267 | |
---|
| 268 | all = jQuery(elem).absoluteAll(); |
---|
| 269 | |
---|
| 270 | Top = all.Top; |
---|
| 271 | Left = all.Left; |
---|
| 272 | Args.pos_externe = false; |
---|
| 273 | } |
---|
| 274 | |
---|
| 275 | if (Args.pos_externe == true) { |
---|
| 276 | if (elem.tagName != "BODY") { |
---|
| 277 | nodeName = nodeName || ""; |
---|
| 278 | L1 = jQuery(elem).position(); // sans les marges ; |
---|
| 279 | L2 = jQuery(elem).position(true); // 296 x 817 |
---|
| 280 | Left = L1.left; |
---|
| 281 | Top = L1.top; |
---|
| 282 | } |
---|
| 283 | |
---|
| 284 | } |
---|
| 285 | |
---|
| 286 | elem = s_elem; |
---|
[10845] | 287 | } |
---|
[16931] | 288 | visible = jQuery(elem).is(':visible'); |
---|
[17192] | 289 | results = { |
---|
| 290 | useMap: elem.useMap || "none", |
---|
[16931] | 291 | src: elem.src || "none", |
---|
[16638] | 292 | visible: visible || false, |
---|
[10845] | 293 | position: myposition, |
---|
| 294 | top: Top, |
---|
| 295 | left: Left, |
---|
[16638] | 296 | width: width, // valeur interieur |
---|
[10845] | 297 | height: height, |
---|
| 298 | right: Left + width, |
---|
| 299 | bottom: Top + height, |
---|
[16638] | 300 | |
---|
| 301 | padding: padding, |
---|
| 302 | |
---|
| 303 | out: { |
---|
| 304 | width: in_width, |
---|
| 305 | height: in_height, |
---|
| 306 | right: Left + in_width, |
---|
| 307 | bottom: Top + in_height |
---|
| 308 | }, |
---|
[10845] | 309 | borderwidth: borderwidth, |
---|
[16638] | 310 | exterieur: { |
---|
| 311 | width: out_width, |
---|
| 312 | height: out_height, |
---|
| 313 | right: Left + out_width, |
---|
| 314 | bottom: Top + out_height |
---|
| 315 | }, |
---|
[10845] | 316 | margin: margin, |
---|
[16638] | 317 | general: { |
---|
| 318 | width: out_width + margin.left + margin.right, |
---|
| 319 | height: out_height + margin.top + margin.bottom, |
---|
| 320 | right: Left + out_width + margin.left + margin.right, |
---|
| 321 | bottom: Top + out_height + margin.top + margin.bottom, |
---|
[16931] | 322 | marges: { height: margin.top + |
---|
| 323 | borderwidth.top + |
---|
| 324 | padding.top + |
---|
| 325 | margin.bottom + borderwidth.bottom + |
---|
| 326 | padding.bottom, |
---|
[17192] | 327 | top: margin.top + |
---|
[16931] | 328 | borderwidth.top + |
---|
| 329 | padding.top, |
---|
[17192] | 330 | bottom: margin.bottom + |
---|
[16931] | 331 | borderwidth.bottom + |
---|
| 332 | padding.bottom, |
---|
[17192] | 333 | width: margin.left + |
---|
[16931] | 334 | borderwidth.left + |
---|
| 335 | padding.left + |
---|
| 336 | margin.right + |
---|
| 337 | borderwidth.right + |
---|
| 338 | padding.right, |
---|
[17192] | 339 | left: margin.left + |
---|
[16931] | 340 | borderwidth.left + |
---|
| 341 | padding.left, |
---|
[17192] | 342 | right: margin.right + |
---|
[16931] | 343 | borderwidth.right + |
---|
| 344 | padding.right |
---|
[17192] | 345 | } |
---|
[16638] | 346 | }, |
---|
[10845] | 347 | id: id, |
---|
[17192] | 348 | nodeName: nodeName || "" |
---|
[10845] | 349 | }; |
---|
[7702] | 350 | |
---|
[10845] | 351 | return results |
---|
| 352 | } return results; |
---|
| 353 | }, |
---|
| 354 | /* |
---|
| 355 | * Cl_Position de l'object elem |
---|
| 356 | */ |
---|
| 357 | d_position: function () { |
---|
| 358 | var left = 0, top = 0, elem = this[0], offset, parentOffset, offsetParent, results; |
---|
[11277] | 359 | l1 = jQuery(elem).css("left"); |
---|
[10845] | 360 | if (elem) { |
---|
| 361 | offsetParent = this.offsetParent(); |
---|
| 362 | offset = this.offset(); |
---|
[7353] | 363 | |
---|
[10845] | 364 | if (offsetParent) { |
---|
| 365 | if (elem == window) { |
---|
| 366 | parentOffset = { top: 0, left: 0 }; |
---|
| 367 | } else if (typeof (offsetParent.offset) != "undefined") |
---|
| 368 | parentOffset = offsetParent.offset(); |
---|
| 369 | else |
---|
| 370 | parentOffset = { top: 0, left: 0 }; |
---|
[7702] | 371 | |
---|
[10845] | 372 | if (!offset) |
---|
| 373 | offset = { top: 0, left: 0 }; |
---|
[7353] | 374 | |
---|
[10845] | 375 | offset.top -= num(elem, 'marginTop'); |
---|
| 376 | offset.left -= num(elem, 'marginLeft'); |
---|
[7353] | 377 | |
---|
[10845] | 378 | if (offsetParent.length > 0) { |
---|
| 379 | parentOffset.top += num(offsetParent, 'borderTopWidth'); |
---|
| 380 | parentOffset.left += num(offsetParent, 'borderLeftWidth'); |
---|
| 381 | } else { |
---|
| 382 | parentOffset = { top: 0, left: 0 }; |
---|
[7816] | 383 | |
---|
[10845] | 384 | } |
---|
| 385 | } else { |
---|
| 386 | parentOffset = { top: 0, left: 0 }; |
---|
| 387 | } |
---|
[8536] | 388 | |
---|
[10845] | 389 | results = { |
---|
| 390 | top: Math.ceil(offset.top - parentOffset.top), left: Math.ceil(offset.left - parentOffset.left) |
---|
| 391 | }; |
---|
| 392 | } return results; |
---|
| 393 | }, |
---|
| 394 | /* |
---|
| 395 | * offsetParent |
---|
| 396 | */ |
---|
| 397 | offsetParent: function () { |
---|
[17192] | 398 | if (this[0] == window) return; |
---|
| 399 | try { |
---|
| 400 | |
---|
| 401 | n1 = this[0].nodeName; |
---|
| 402 | var offsetParent = this[0].offsetParent; |
---|
| 403 | |
---|
| 404 | while (offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static')) |
---|
| 405 | offsetParent = offsetParent.offsetParent; |
---|
| 406 | return jQuery(offsetParent); |
---|
| 407 | } catch (e) { |
---|
| 408 | jQuery(offsetParent); |
---|
| 409 | } |
---|
[10845] | 410 | }, |
---|
| 411 | // getStyles(Obj) Récupérer la valeur CSS |
---|
| 412 | getStyles: function (elt) { |
---|
[12683] | 413 | var element = jQuery(elt).get(0); |
---|
| 414 | propriete = []; |
---|
[16931] | 415 | try { |
---|
| 416 | if (jQuery(element).length > 0) |
---|
| 417 | if (window.getComputedStyle) // Mozilla Firefox & cie |
---|
| 418 | { |
---|
| 419 | var propriete = window.getComputedStyle(element, null); |
---|
| 420 | } |
---|
| 421 | else if (element.currentStyle) // Microsoft Internet Explorer |
---|
| 422 | { |
---|
[7394] | 423 | |
---|
[16931] | 424 | var propriete = element.currentStyle; |
---|
| 425 | } |
---|
| 426 | } catch (e) { |
---|
| 427 | |
---|
[10845] | 428 | } |
---|
| 429 | return propriete; |
---|
| 430 | }, |
---|
[16638] | 431 | Get_Val_int: function (myObj, Maxi_val, Mini_val, prop) { |
---|
| 432 | |
---|
| 433 | return Get_Val_int(myObj, Maxi_val, Mini_val, prop); |
---|
| 434 | } |
---|
| 435 | }); |
---|
| 436 | |
---|
| 437 | /************************** |
---|
[16931] | 438 | * Get_val_int |
---|
| 439 | * params: element,valeur maxi |
---|
| 440 | * return: valeur entiere |
---|
[16638] | 441 | ******************************/ |
---|
| 442 | Get_Val_int = function (myObj, Maxi_val, Mini_val, prop) { |
---|
[7394] | 443 | |
---|
[16931] | 444 | var val = 0; |
---|
| 445 | Maxi_val = parseInt(Maxi_val || "0"); |
---|
[7394] | 446 | |
---|
[16931] | 447 | /* |
---|
| 448 | - numérique suivie de px ou % ou pt ou em, |
---|
| 449 | - thin, bordure mince, |
---|
| 450 | - medium, bordure moyenne (valeur par défaut), |
---|
| 451 | - thick, bordure épaisse, |
---|
| 452 | - inherit, hérite de son parent (css2). |
---|
| 453 | */ |
---|
[7816] | 454 | |
---|
[16931] | 455 | if (!myObj) { |
---|
| 456 | return Maxi_val; |
---|
| 457 | } |
---|
| 458 | |
---|
| 459 | if (typeof (myObj) == "string") { |
---|
| 460 | switch (myObj) { |
---|
| 461 | case 'thin': |
---|
| 462 | return 1; |
---|
| 463 | break; |
---|
| 464 | case 'medium': |
---|
| 465 | return 2; |
---|
| 466 | break; |
---|
| 467 | case 'thick': |
---|
| 468 | return 4; |
---|
| 469 | break; |
---|
| 470 | case 'inherit': |
---|
| 471 | break; |
---|
| 472 | case 'none': |
---|
| 473 | return Maxi_val; |
---|
| 474 | break; |
---|
| 475 | default: |
---|
| 476 | break; |
---|
| 477 | } |
---|
| 478 | |
---|
| 479 | var reg1 = new RegExp("auto", "g"); |
---|
| 480 | if (myObj.match(reg1)) { |
---|
[10845] | 481 | return Maxi_val; |
---|
| 482 | } |
---|
[7394] | 483 | |
---|
[16638] | 484 | if (prop) { |
---|
| 485 | |
---|
| 486 | myObj = num(prop.elem, prop.prop); |
---|
| 487 | } else { |
---|
[16931] | 488 | reg1 = new RegExp("px", "g"); |
---|
| 489 | if (myObj.match(reg1)) { |
---|
[7394] | 490 | |
---|
[16638] | 491 | myObj = Parse_Int(myObj); |
---|
[7394] | 492 | |
---|
[16931] | 493 | } else { |
---|
| 494 | reg1 = new RegExp("%", "g"); |
---|
| 495 | if (myObj.match(reg1)) { |
---|
| 496 | myObj = myObj.replace(reg1, ""); |
---|
| 497 | val = Math.ceil(myObj * Maxi_val / 100); |
---|
| 498 | return val; |
---|
[10845] | 499 | } |
---|
| 500 | } |
---|
[16931] | 501 | } |
---|
| 502 | if (Mini_val) |
---|
| 503 | if (myObj < Mini_val) return Maxi_val; |
---|
[16638] | 504 | val = Parse_Int(myObj); |
---|
[8729] | 505 | |
---|
[16931] | 506 | } else { |
---|
[16638] | 507 | val = Parse_Int(myObj); |
---|
[16931] | 508 | } |
---|
[16638] | 509 | if (typeof (val) == "NaN") |
---|
| 510 | return Maxi_val; |
---|
[16931] | 511 | return val; |
---|
[16638] | 512 | |
---|
[16931] | 513 | } |
---|
[16638] | 514 | |
---|
[10845] | 515 | /* |
---|
| 516 | * |
---|
| 517 | */ |
---|
[16638] | 518 | function Parse_Int(valeur_num) { |
---|
[16931] | 519 | if (!jQuery.isNumeric(valeur_num)) { |
---|
| 520 | valeur_num = valeur_num.toString(); |
---|
| 521 | reg1 = new RegExp("px", "gi"); |
---|
| 522 | if (valeur_num.match(reg1)) { |
---|
[16638] | 523 | valeur_num = valeur_num.replace(reg1, ""); |
---|
[16931] | 524 | } if (valeur_num.match(RegExp("%", "gi"))) { |
---|
[16638] | 525 | valeur_num = valeur_num.replace(reg1, ""); |
---|
[16931] | 526 | valeur_num = Math.ceil(valeur_num * Maxi_val / 100); |
---|
| 527 | } else { |
---|
| 528 | valeur_num = valeur_num.replace(reg1, ""); |
---|
| 529 | } |
---|
[16638] | 530 | } |
---|
| 531 | valeur_num = Math.ceil(valeur_num); |
---|
| 532 | return valeur_num || 0; |
---|
| 533 | } |
---|
| 534 | |
---|
[10845] | 535 | function num(el, prop) { |
---|
[16638] | 536 | valeur_num = jQuery.curCSS(el.jquery ? el[0] : el, prop, true); |
---|
| 537 | |
---|
| 538 | return Parse_Int(valeur_num); |
---|
[10845] | 539 | }; |
---|
[7394] | 540 | |
---|
[17192] | 541 | // myjQuery = jQuery; |
---|
| 542 | // my$ = $; |
---|
[10845] | 543 | |
---|
[7353] | 544 | })(jQuery); |
---|