Changeset 7669 for extensions/Autosize/js/conflit.js
- Timestamp:
- Nov 6, 2010, 4:43:08 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Autosize/js/conflit.js
r7642 r7669 2 2 var d1 = 0; 3 3 var init_tb = 0; 4 4 //=================================================== 5 5 function $(element, nc) { 6 nc = this; 7 // element, key, defaultValue 8 return conflit(element, nc); 6 return conflit(element, nc) 7 } 8 //=================================================== 9 function conflit(element, nc) { 10 try { 11 var retour = alert(nonExistentVariable); 12 13 } catch (e) { 14 15 var retour=(getStackTrace()); 16 17 } 18 19 if (retour == "") 20 return jQuery(element); 21 22 23 if (retour.match(RegExp("pamoorama", "gi"))) { 24 return jQuery().$Pamoorama(element); 25 } 26 27 if (retour.match(RegExp("luciano", "gi"))) { 28 return jQuery().$Luciano(element); 29 } 30 31 if (retour.match(RegExp("prototype.js", "gi"))) { 32 return jQuery().$Prototype(element); 33 } 34 35 //alert(retour); 36 if (retour.match(RegExp("jquery|switchmenu|gmaps", "gi"))) { 37 return jQuery(element); 38 } 39 40 41 if (retour.match(RegExp("ie_ready", "gi"))) { 42 return jQuery().$Pamoorama(element); 43 } 44 if (retour.match(RegExp("skipInit", "gi"))) { 45 return jQuery().$Pamoorama(element); 46 } 47 //============================================================== 48 49 if (retour.match(RegExp("(splat|buildFrameWork|photoNext)", "gi"))) { 50 ret = jQuery().$Luciano(element); 51 return ret; 52 } 53 54 // var form = $('rateForm'); 55 Expression = new RegExp("\$", "gi") 56 if (retour.match(Expression)) { 57 if (retour.match(RegExp("rateForm", "gi"))) { 58 ret = jQuery().$Luciano(element); 59 return ret; 60 } 61 } 62 if (typeof(Browser)!="undefined") 63 if (Browser.loaded) 64 b="mootools1.2.4" 65 66 67 68 if (retour.match(RegExp("gmaps", "gi"))) { 69 return jQuery(element); 70 } 71 if (retour.match(RegExp("responder", "gi"))) { 72 return jQuery().$Prototype(element); 73 } 74 if (retour.match(RegExp("fire", "gi"))) { 75 return jQuery().$Prototype(element); 76 } 77 if (retour.match(RegExp("createResponder", "gi"))) { 78 return jQuery().$Prototype(element); 79 } 80 if (retour.match(RegExp("element =", "gi"))) { 81 // return jQuery().$Prototype(element); 82 } 83 if (retour.match(RegExp("stopO", "g"))) { 84 return jQuery().$Prototype(element); 85 } 86 87 alert(retour); 88 89 retour= jQuery(element); 90 return retour; 91 return jQuery().$Pamoorama(element); 92 9 93 } 10 94 //============================================================ 95 11 96 jQuery(document).ready( 12 13 97 function (jQuery) { 14 15 98 tpj = jQuery("#pamoorama"); 16 99 if (tpj.length > 0) { } 17 100 jQuery(window).load(function () { 18 19 20 101 if (jQuery("#theImage").css("position") == "relative") { 21 102 //==== compatibilité Gally/LLGBO === … … 23 104 jQuery("#theImage").css("position", "static"); 24 105 } 25 26 106 function $(element, nc) { 107 return conflit(element, nc); 108 } 109 27 110 }); 28 111 29 112 }) 30 113 ; 31 function conflit(element, nc) { 32 //============== détection framework ================== 33 var tp1 = typeof (MooTools); 34 var MooTools_version = "0"; 35 ret_mootool=jQuery(element) ; 36 ret_Luciano =ret_mootool ; 37 ret_pamoorama = ret_mootool; 38 39 if (tp1 != "undefined") { 40 MooTools_version = "1"; 41 if (MooTools.version == "1.2.4") { 42 MooTools_version = "Luciano"; // luciano 43 ret_Luciano = jQuery().$Luciano(element, nc) ; 44 } 45 46 if (MooTools.version == "1.11") { 47 MooTools_version = "pamoorama"; //pamoorama 48 ret_pamoorama = jQuery().$Pamoorama(element) 49 } 50 51 52 } 53 54 tp1 = typeof (Prototype); 55 var Prototype_Version = '0'; 56 ret_proto=jQuery(); 57 if (tp1 != "undefined") { 58 if (Prototype.Version == '1.6.0.2') { 59 Prototype_Version = '1602'; 60 ret_proto=jQuery().$Prototype(element) ; 61 } else if (Prototype.Version == '1.6.1') { 62 Prototype_Version = '161'; 63 ret_proto=jQuery().$Prototype(element) ; 64 } else if (Prototype.Version == '1.0.0.0') { 65 Prototype_Version = '1'; 66 ret_proto=jQuery().$Prototype(element) ; 67 } 68 } 69 //=================================================== 70 71 72 var jq = jQuery(element).selector; 73 var ret_el ={ Prototype : ret_proto, 74 Pamoorama : ret_pamoorama, 75 jquery : jQuery(element), 76 Luciano: ret_Luciano 77 }; 78 79 if (element == window) { 80 if (typeof (Gmaps_status) != "undefined") { 81 if (Gmaps_status ) 82 return ret_el.jquery; 83 } 84 85 if (Prototype_Version != "0") return ret_el.Prototype; //rv_gmaps 86 //if (MooTools_version == "pamoorama") return ret_el.Pamoorama; 87 return ret_el.jquery; 88 j = nc; 89 90 } 91 92 //=================================================== 93 //div.gmapsPopup div.ui-dialog-titlebar 94 if (jq.match(/GMaps/) || jq.match(/gmaps/)) { 95 Gmaps_status = true; 96 if (jq == "#iGMapsIconContent") { 97 setTimeout('jQuery().recentrage_widget()', 0); 98 } 99 if (ret_el.jquery.length > 0) return ret_el.jquery; 100 return ret_el.jquery; 101 } 102 if (Prototype_Version == "0" && MooTools_version == "0") { 103 return ret_el.jquery; 104 } 105 //======================================================================================= 106 if (arguments.caller && arguments.caller.length > 0) { 107 if (arguments.caller.length > 1) { 108 if (element == "pamoorama") { 109 return ret_el.Pamoorama 110 } 111 arg = arguments.caller[1]; 112 if (typeof (arg) != "undefined" && typeof (arg) != undefined) { 113 //=========== options rv_maps prototype.js =================================== 114 115 if (Prototype_Version != '0') 116 switch (arg) { 117 case "dom:loaded": 118 return element; 119 return ret_el.Prototype 120 break; 121 case "load": 122 return ret_el.Prototype 123 break; 124 case "unload": 125 return ret_el.Prototype 126 break; 127 case "prototype_event_registry": 128 129 try { 130 retour = ret_el.Prototype; 131 } catch (e) { 132 retour = null; 133 } 134 return retour; 135 break; 136 case "readystatechange": 137 try { 138 retour = ret_el.Luciano; 139 } catch (e) { 140 retour = null; 141 try { 142 retour = ret_el.Luciano; 143 retour = jQuery(element).get(0); 144 } catch (e) { 145 retour = null; 146 } 147 148 } 149 150 return ret_el.jquery; 151 break; 152 } 153 154 if (MooTools_version == 'pamoorama' && typeof (arg) != undefined) 155 //=========== options pamoorama =================================== 156 { 157 var reg1 = new RegExp("pamoorama", "g"); 158 switch (arg) { 159 case "bottom": 160 return ret_el.Pamoorama 161 break; 162 case "left": 163 return ret_el.Pamoorama 164 break; 165 case "prototype_event_registry": 166 return ret_el.Pamoorama 167 break; 168 case "readystatechange": 169 return ret_el.Pamoorama 170 break; 171 172 default: 173 if (arg.area) { 174 return ret_el.Pamoorama 175 } else 176 if (arg.velocity) { 177 return ret_el.Pamoorama 178 } else if (arg.src) { 179 return ret_el.Pamoorama 180 } else if (arg.modifiers) { 181 return ret_el.Pamoorama 182 } else if (arg.limit) { 183 return ret_el.Pamoorama 184 } else if (arg.duration) { 185 return ret_el.Pamoorama 186 } else if (arg.id) { 187 switch (arg.id) { 188 case "pamoorama_footer": 189 return ret_el.Pamoorama 190 break; 191 case "pamoorama_outter": 192 return ret_el.Pamoorama 193 break; 194 case "pamoorama_inner": 195 return ret_el.Pamoorama 196 break; 197 198 default: 199 return ret_el.Pamoorama 200 break; 201 202 } 203 } else if (arg.src) { 204 return ret_el.Pamoorama 205 206 } 207 //======================================================= 208 return ret_el.jquery; 209 break; 210 211 } 212 } else if (MooTools_version == 'Luciano') { //=========== options luciano =================================== 213 //=== theme Luciano ==== 214 return ret_Luciano; 215 } 216 217 } 218 } 219 } 220 221 //================================================== 222 tpe = typeof (element); 223 if (Prototype_Version != '0') { 224 if (tpe == "string") { 225 //=== rvmaps === // 226 if (element.match(/[a-z]_[a-z]/)) { 227 228 return ret_el.Prototype 229 } 230 id = "window_" + new Date().getTime(); 231 reg1 = new RegExp("^window_", "g"); 232 if (element.match(reg1, "g")) { 233 234 if (element.match(/_[a-z]/)) { 235 return ret_el.Prototype 236 } 237 return null; 238 } 239 } 240 } 241 //========== test jQuery ? ============== 242 if (tpe == "string") 243 if (element.match(RegExp("^#", "g")) ) { 244 return ret_el.jquery; 245 } 246 if (jq.match(RegExp("^#", "g")) || jq == "html") { 247 return ret_el.jquery; 248 } 249 if (tpe == "undefined") { 250 return jQuery(); 251 } 252 //==== mootools ==== 253 if (MooTools_version == "Luciano" && tpe == "string") { 254 //=== theme Luciano ==== 255 256 if (element == "order") return ret_el.Luciano; 257 if (element == "themeSelect") return ret_el.Luciano; 258 if (element == "languageSelect") return ret_el.Luciano; 259 if (element == 'linkPrev') return ret_el.Luciano; 260 if (element == 'linkNext') return ret_el.Luciano; 261 if (element == 'rateForm') return ret_el.Luciano; 262 } 263 264 if (MooTools_version == 'pamoorama') 265 //=========== options pamoorama =================================== 266 { 267 268 if (tpe == "string") 269 switch (jq) { 270 case "ie_ready": 271 return ret_el.Pamoorama 272 break; 273 case "pamoorama": 274 return ret_el.Pamoorama 275 break; 276 case ".tab a": 277 return ret_el.jquery; 278 break; 279 280 } else if (tpe == "boolean") { 281 return ret_el.Pamoorama 282 } 283 if(element) 284 if (typeof (element.nodeName) != "undefined") { 285 el = element.nodeName; 286 if (el == "DIV") return ret_el.Pamoorama 287 if (el == "IMG") return ret_el.Pamoorama 288 if (el == "#document") { 289 if (Prototype_Version != "0") return ret_el.Prototype; //rv_gmaps 290 if (MooTools_version == "pamoorama") return ret_el.jquery; 291 if (MooTools_version == "pamoorama") return ret_el.Pamoorama; 292 return ret_el.jquery; 293 } 294 if (el == "BODY") { 295 try { 296 if (Prototype_Version != "0") return ret_el.Prototype; //rv_gmaps 297 if (MooTools_version == "pamoorama") return ret_el.Pamoorama; 298 return ret_el.jquery; 299 return jQuery().$Pamoorama(element) 300 } catch (e) { 301 return jQuery(element); 302 }; 303 } 304 } 305 306 307 308 if (element == window) { 309 if (Prototype_Version != "0") return ret_el.Prototype; //rv_gmaps 310 if (MooTools_version == "pamoorama") return ret_el.Pamoorama; 311 return ret_el.jquery; 312 313 } 314 315 } 316 obj_panorama = jQuery("#Panorama"); 317 if (obj_panorama.length > 0 && jq != "rateForm" && jq != "order" && jq != "themeSelect") { 318 if (tpe == "object") 319 if (Prototype_Version != '0') { 320 //=== rvmaps === 321 try { 322 elem_retour = jQuery().$Prototype(element); 323 return elem_retour; 324 } catch (e) { 325 326 } 327 } 328 329 if (ret_el.jquery.length < 2) return ret_el.jquery; 330 if (ret_el.jquery.length == 2) return jQuery(element).get(1); 331 if (ret_el.jquery.length == 3) return jQuery(element).get(2); 332 333 } 334 afq = jQuery(document).data("initialized"); //2 335 if (element == window && afq != 1) 336 if (init_tb == 1) { 337 init_tb = 2; 338 return ret_el.jquery; 339 } 340 341 342 //========= ???? =================== 343 if (ret_el.jquery != null) { 344 if (typeof (ret_el.jquery.context) != "undefined") { 345 if (afq != 1 && afq != undefined) { 346 if (init_tb != 2) init_tb = 1; 347 return ret_el.jquery; 348 } 349 if (ret_el.jquery.context.loaded) { 350 //=== theme Luciano ==== 351 if (MooTools_version == "Luciano") { 352 try { 353 ret_el = jQuery().$Prototype(element); 354 return ret_el; 355 } catch (e) { 356 jQuery("#Debug").text(e.message); 357 return ret_Luciano; 358 } 359 } 360 //=== theme gally ? ==== 361 if (Prototype_Version != '0') { 362 //=== rvmaps === 363 try { 364 return ret_el.Prototype 365 366 } catch (e) { 367 return jQuery(element); 368 369 } 370 } 371 } 372 } 373 } 374 init_tb = 0; 375 //================================================================ 376 377 //==== mootools ==== 378 if (MooTools_version == "Luciano") { 379 //=== theme Luciano ==== 380 tp = this; 381 ret_el.jquery = ret_Luciano; 382 //$(this.options.container) 383 if (ret_el.jquery != null) { 384 if (ret_el.jquery.nodeName) { 385 tp = ret_el.jquery.nodeName + ret_el.jquery.nodeType; 386 if (tp == "DIV1") return ret_el.jquery; 387 if (tp == "SELECT1") return ret_el.jquery; 388 tp = element.nodeName + element.nodeType; 389 return ret_el.jquery; 390 } 391 392 } 393 } else if (MooTools_version == "pamoorama") { 394 //=== paMOOramics === 395 // ie_ready,undefined 396 return ret_el.Pamoorama 397 } 398 399 //================================================================= 400 401 402 if (Prototype_Version != '0') { 403 //=== rvmaps === 404 try { 405 return ret_el.Prototype 406 } catch (e) { 407 return jQuery(element); 408 } 409 } 410 return jQuery(element); 411 412 } 114 413 115 414 116 //========================================================= 415 117 (function ($2) { 416 118 $2.fn.panorama2 = 417 function (height, width) { 418 419 var src =jQuery(this); 420 421 return ; 422 423 $("#theImage img").eq(0).removeAttr("style").attr({width:width,height:height}); 424 retour= jQuery('a.panorama-control-left').click(); 425 panoramaContainer=jQuery('panorama-container'); 426 427 /* 428 $(panoramaContainer).stop(); 429 op=options; 430 settings.direction = 'right'; 431 panoramaContainer.panorama_animate(panoramaContainer, elemWidth, settings); 432 */ 433 434 435 436 437 438 } 119 function (height, width) { 120 var src =jQuery(this); 121 return ; 122 } 439 123 440 124 … … 445 129 //---------------- luciano ------------------------------- 446 130 $Luciano: function (el, nc) { 447 try { 448 return document.id(el, nc, this.document) 449 } catch (e) { 450 return; 451 }; 131 return document.id(el, nc, this.document); 452 132 }, 453 133 //=============== PaMOOramics =========================== 134 454 135 $Pamoorama: function (B) { 455 456 if (!B) { 457 return null; 458 } 459 if (B.htmlElement) { 460 return Garbage.collect(B); 461 } 462 if ([window, document].contains(B)) { 463 return B; 464 } 465 var A = $type(B); 466 if (A == "string") { 467 B = document.getElementById(B); 468 A = (B) ? "element" : false; 469 } 470 if (A != "element") { 471 return null; 472 } 473 if (B.htmlElement) { 474 return Garbage.collect(B); 475 } 476 if (["object", "embed"].contains(B.tagName.toLowerCase())) { 477 return B; 478 } 479 $extend(B, Element.prototype); 480 B.htmlElement = function () { }; 136 if (!B) { 137 if (typeof (B) == "boolean") return null; 138 return jQuery(); 139 } 140 if (B.htmlElement) { 481 141 return Garbage.collect(B); 482 142 143 } 144 if ([window, document].contains(B)) { return B; } 145 var A = $type(B); 146 if (A == "string") { B = document.getElementById(B); A = (B) ? "element" : false; } 147 if (A != "element") { 148 return null; 149 } 150 if (B.htmlElement) { return Garbage.collect(B); } 151 if (["object", "embed"].contains(B.tagName.toLowerCase())) { return B; } 152 $extend(B, Element.prototype); 153 B.htmlElement = function () { }; 154 try{ return Garbage.collect(B);}catch(e){ 155 return ; 156 } 483 157 484 158 }, … … 494 168 element = document.getElementById(element); 495 169 496 return Element.extend(element);170 return Element.extend(element); 497 171 498 172 try { 499 ret_el.jquery= Element.extend(element);173 new_element = Element.extend(element); 500 174 } catch (e) { 501 return ret_el.jquery;502 } 503 return ret_el.jquery;175 return new_element; 176 } 177 return new_element; 504 178 } 505 179 //========================================================= 506 }); // fin extend 180 }); // fin extend 181 182 183 184 185 function getStackTrace() { 186 var callstack = []; 187 var isCallstackPopulated = false; 188 try { 189 i.dont.exist += 0; //doesn't exist- that's the point 190 } catch (e) { 191 192 var retcallstack = []; 193 if (e.stack) { //Firefox 194 var lines = e.stack.split("\n"); 195 for (var i = 2, len = lines.length; i < len; i++) { 196 if (lines[i].match(/conflit.js/)) { 197 // 198 } else if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) { 199 callstack.push(lines[i]); //php? 200 } else { 201 callstack.push(lines[i]); 202 203 } 204 if (lines[i].match("prototype")) { 205 break; 206 } 207 } 208 //Remove call to printStackTrace() 209 //callstack.shift(); 210 isCallstackPopulated = true; 211 isCallstackPopulated = false; 212 213 } 214 else if (window.opera && e.message) { 215 //Opera ================================= 216 var lines = e.message.split("\n"); 217 for (var i = 0, len = lines.length; i < len; i++) { 218 if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) { 219 var entry = lines[i]; 220 //Append next line also since it has the file info 221 if (lines[i + 1]) { 222 entry += " at " + lines[i + 1]; 223 i++; 224 } 225 callstack.push(entry); 226 } 227 } 228 //Remove call to printStackTrace() 229 // callstack.shift(); 230 isCallstackPopulated = true; 231 } 232 //===== fin Opera====================================== 233 } 234 if (!isCallstackPopulated) { //IE and Safari 235 var currentFunction = arguments.callee.caller; 236 //next 237 if (currentFunction == null) { 238 return ("The function was called from the top!"); 239 } 240 241 currentFunction = currentFunction.caller; 242 //$family 243 while (currentFunction) { 244 var fn = currentFunction.toString(); 245 var fname = fn.substring(fn.indexOf("function") + 8, fn.indexOf("(")) || " "; 246 callstack.push(fn); 247 // if (fname != " $") callstack.push(fn); 248 if (fn.match(RegExp("buildFrameWork", "gi"))) { //luciano 249 break; 250 } 251 if (fn.match(RegExp("_footer", "gi"))) { 252 break; 253 } 254 if (fn.match(RegExp("observe|responder|stopobserving", "gi"))) { 255 callstack.push('prototype.js'); 256 break; 257 } 258 if (fn.match(RegExp("stopobserving", "gi"))) { 259 break; 260 } 261 if (fn .match(RegExp("jquery", "gi"))) { 262 break ; 263 } 264 currentFunction = currentFunction.caller; 265 } 266 267 } 268 269 return callstack.join('\n'); 270 } 271 /* 272 //1.2.4 273 Element1.Events.domready = { 274 onAdd: function (fn) { 275 if (Browser.loaded) fn.call(this); 276 } 277 } ; 278 279 Element2.Events.domready = { 280 add: function (B) { 281 if (window.loaded) { B.call(this); return; } 282 var A = function () { 283 if (window.loaded) { return; } 284 window.loaded = true; 285 window.timer = $clear(window.timer); 286 this.fireEvent("domready"); 287 } .bind(this); 288 } 289 } 290 */
Note: See TracChangeset
for help on using the changeset viewer.