source: extensions/Autosize/js/conflit.js @ 7912

Last change on this file since 7912 was 7912, checked in by cljosse, 13 years ago

[Autosize][beta] setup cl_conflit

File size: 17.9 KB
Line 
1//==== autosize  remplace $(... avec jQuery( ====
2/*
3*[gmaps=id:1;width:800;height:640;]
4*       Luciano rv_gmaps
5* pb : Gmaps llgbo pamooramics rv_map
6*/
7var d1 = 0;
8var init_tb = 0;
9var dom = {};
10if (typeof jQuery == 'undefined') {
11    alert(" jQuery n'est pas chargé");
12} else {
13    // jQuery est chargé
14}
15
16//===================================================
17var detect = navigator.userAgent.toLowerCase();
18var OS, version;
19//==============================================================================
20browser = detect_browser();
21
22function detect_browser() {
23    mybrowser = {
24        browser: "",
25        konqueror: false,
26        chrome: false,
27        safari: false,
28        omniWeb: false,
29        opera: false,
30        firefox: false,
31        msie: false,
32        netscape: false
33    }
34    if (checkIt('konqueror')) { mybrowser.Konqueror = true; lbrowser = "konqueror"; OS = "Linux"; }
35    else if (checkIt('chrome')) { mybrowser.chrome = true; lbrowser = "chrome"; }
36    else if (checkIt('safari')) { mybrowser.safari = true; lbrowser = "safari"; }
37    else if (checkIt('omniweb')) { mybrowser.omniweb = true; lbrowser = "omniWeb"; }
38    else if (checkIt('opera')) { mybrowser.opera = true; lbrowser = "opera"; }
39    else if (checkIt('firefox')) { mybrowser.firefox = true; lbrowser = "firefox"; }
40
41    else if (checkIt('msie')) { mybrowser.msie = true; lbrowser = "msie"; }
42    else if (checkIt('compatible')) { mybrowser.NetscapeNavigator = true; lmybrowser.browser = "NetscapeNavigator"; version = detect.charAt(8); }
43    else lbrowser = "An unknown browser";
44    if (!version) version = detect.charAt(place + thestring.length);
45    if (!OS) {
46        if (checkIt('linux')) OS = "Linux";
47        else if (checkIt('x11')) OS = "Unix";
48        else if (checkIt('mac')) OS = "Mac";
49        else if (checkIt('win')) OS = "Windows";
50        else OS = "an unknown operating system";
51    }
52
53    mybrowser.browser = lbrowser;
54    return mybrowser
55
56
57};
58
59
60
61function checkIt(string) {
62    place = detect.indexOf(string) + 1;
63    thestring = string;
64    return place;
65}
66/*
67 
68*/
69
70
71konqueror = mybrowser.konqueror || false;
72chrome = mybrowser.chrome || false;
73safari = mybrowser.safari || false;
74omniWeb = mybrowser.omniWeb || false;
75opera = mybrowser.opera || false;
76firefox = mybrowser.firefox || false;
77msie = mybrowser.msie || false;
78netscape = mybrowser.netscape || false;
79
80
81//========================================
82/*function $defined(A) {
83$ = _$2; //   ;
84return A != undefined;
85}
86*/
87
88var time_out = 0;
89//===================================================
90
91nbpa = 0;
92var Fn;
93function conflit(element, nc) {
94    //--- cl_conflit   
95    var retour = (getStackTrace());
96    Fn = retour.fn;
97    retour = retour.state;
98
99    n = document;
100    v = window;
101    var ret_element = "";
102    if (retour.match(RegExp("jQuery", "gi"))) {
103        ret_element = jQuery(element);
104    }
105    else if (retour.match(RegExp("rv_gmaps", "gi"))) {
106        ret_element = jQuery().$Prototype(element);
107    } else if (retour.match(RegExp("GMaps", "gi"))) {
108       
109
110        ret_element = jQuery(element);
111    } else if (retour.match(RegExp("pamooramics", "gi"))) {
112
113        ret_element = jQuery().$Pamoorama(element);
114
115        if (retour.match(RegExp("init_", "gi"))) {
116
117        }
118        nbpa += 1;
119
120    } else if (retour.match(RegExp("luciano", "gi"))) {
121        $1 = $_;
122
123        ret_element = jQuery().$Luciano(element, nc);
124
125    } else if (retour.match(RegExp("jQuery", "gi"))) {
126        ret_element = jQuery(element);
127    }
128
129    if (ret_element != "")
130        return ret_element;
131
132    if (typeof (element) == "string") {
133        if (element.match("^#|.ui", "gi")) {
134            ret_element = jQuery(element);
135            return ret_element;
136        }
137    } else if (typeof (element) == "function") {
138        fn = element.toString();
139        if (fn.match("#pwg|open", "gi")) {
140            ret_element = jQuery(element);
141            return ret_element;
142        }
143    } else if (element == document) {
144
145        ret_element = jQuery(element);
146        return ret_element;
147
148
149    }
150    tp0 = typeof (element);
151
152    ret_element = jQuery(element);
153    if (DEBUG == "true") {
154        retour = (getStackTrace());
155        alert("element : " + element + " retour : " + retour + "Fonctions:" + Fn);
156
157    }
158    return ret_element;
159} // conflit(element,nc)
160
161
162
163
164
165jQuery(document).ready(
166    function (jQuery) {
167        jQuery(window).load(function () {
168            //============================================================
169            jQuery("#icon_gmaps").bind('click', function () {
170
171                jQuery('html,body').stop().scrollTop(0);
172                jQuery('html,body').stop().scrollLeft(0);
173                jQuery(".ui-widget-overlay").css("opacity", "0.75");
174
175                l1 = (jQuery(window).width() - (jQuery(".gmapsPopup").width())) / 2;
176                h1 = (jQuery(window).height() - (jQuery(".gmapsPopup").height())) / 2;
177
178                jQuery(".gmapsPopup").css("left", l1 + "px");
179                jQuery(".gmapsPopup").css("top", h1 + "px");
180            })
181            //============================================================= 
182            if (typeof(Parent)=="undefined")
183                Parent = "#theImage";
184
185            info_image = jQuery(Parent).infos();
186            p0 = jQuery(Parent);
187            if (p0.length > 0) {   
188
189                //======================================================
190                if (theme.match("gally", "gi"))
191                    if (jQuery.isFunction(inittoolbar)) {
192                        if (typeof (currentTab) == "undefined") inittoolbar();
193                        else initializeImageMode("resize");
194                   
195
196                    if (info_image.position != "static") {
197                    //==== compatibilité Gally/LLGBO ===
198                    //--- passage relative ==> static ===/
199                    jQuery(Parent).css({ position: "static" } );
200                    jQuery("#imageToolBar").css({ position: "relative", top: "0px" });
201                    };
202                }
203            }
204            //   jQuery(window).resize();
205
206        });
207        //=============================================================       
208
209        //  $ = _$2; ;
210
211
212    })
213;
214
215
216
217//=========================================================
218
219jQuery.fn.extend({
220
221    //---------------- luciano -------------------------------
222    $Luciano: function (el, nc) {
223        return document.id(el, nc, this.document);
224    },
225    //=============== PaMOOramics ===========================
226
227    $Pamoorama: function (B) {
228
229
230        if (!B) {
231            if (typeof (B) == "boolean") return null;
232
233        }
234
235        try {
236            if (B.htmlElement) {
237                return Garbage.collect(B);
238            }
239        } catch (e) {
240
241        }
242
243        if ([window, document].contains(B)) { return B; }
244        var A = $type(B);
245        if (A == "string") { B = document.getElementById(B); A = (B) ? "element" : false; }
246        if (A != "element") {
247            return null;
248        }
249        if (B.htmlElement) { return Garbage.collect(B); }
250        if (["object", "embed"].contains(B.tagName.toLowerCase())) { return B; }
251        $extend(B, Element.prototype);
252        B.htmlElement = function () { };
253        try { return Garbage.collect(B); } catch (e) {
254            return;
255        }
256
257    },
258    //===================================================
259    $Prototype: function (element) {
260        //======== prototype.js =====================
261        if (arguments.length > 1) {
262            for (var i = 0, elements = [], length = arguments.length; i < length; i++)
263                elements.push($(arguments[i]));
264            return elements;
265        }
266        if (typeof element == "string")
267            element = document.getElementById(element);
268
269        return Element.extend(element);
270
271        try {
272            new_element = Element.extend(element);
273        } catch (e) {
274            return new_element;
275        }
276        return new_element;
277    }
278    //=========================================================
279});    // fin extend
280
281
282
283/*
284* mootools.js  version: "1.11"
285* pamoorama0.3.js
286*
287* main.js (google maps)
288* prototype.js(mootool version: "1.62")
289* windows.js
290*
291*/
292function getStackTrace() {
293    var callstack = [];
294    var isCallstackPopulated = false;
295    try {
296        i.dont.exist += 0; //doesn't exist- that's the point
297    } catch (e) {
298        var retcallstack = [];
299        var e_message = e.message;
300        var e_stack = e.stack;
301        var state_ff = "";
302        if (e_stack) { //Firefox Opera 3.6
303            //=== test fichier source =============
304            var lines = e.stack.split("\n");
305            for (var i = 0, len = lines.length; i < len; i++) {
306                var Src_Match = lines[i];
307                if (Src_Match.match(/conflit.js/)) {
308                    //
309                } else {
310                    if (Src_Match.match(/^\s*[A-Za-z0-9\-_\$]+\(/)) {
311                        callstack.push(Src_Match); //php?
312                    } else {
313                        callstack.push(Src_Match);
314                    }
315                    if (Src_Match.match("GMaps|applyMap|markupMaps|applyMarkers")) {
316                        callstack.push("GMaps");
317                        isCallstackPopulated = true;
318                        break;
319                    }
320                    if (Src_Match.match("rv_gmaps", "gi")) {
321                        callstack.push("rv_gmaps");
322                        isCallstackPopulated = true;
323                        break;
324                    }
325                    if (Src_Match.match("paMOOramics")) {
326                        isCallstackPopulated = true;
327                        callstack.push("paMOOramics");
328                        break;
329                    }
330                    if (Src_Match.match("Luciano", "gi")) {
331                        callstack.push("Luciano");
332                        isCallstackPopulated = true;
333                        break;
334                    }
335                    if (Src_Match.match("main")) {
336
337                        callstack.push("main");
338                        isCallstackPopulated = true;
339                        break;
340                    }
341                    if (Src_Match.match("jQuery", "gi")) {
342                        callstack.push("jQuery");
343                        isCallstackPopulated = true;
344                     
345                        break;
346                    }
347                }
348            }
349            //callstack.shift();
350            state_ff = callstack.join('\n');
351            isCallstackPopulated = false;
352        }
353        if (window.opera && e.message && isCallstackPopulated == false) {
354            callstack = [];
355            //Opera =================================
356            var lines = e.message.split("\n");
357            for (var i = 0, len = lines.length; i < len; i++) {
358                if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) {
359                    var entry = lines[i];
360                    //Append next line also since it has the file info
361                    if (lines[i + 1]) {
362                        entry += " at " + lines[i + 1];
363                        i++;
364                    }
365                    callstack.push(entry);
366                    //isCallstackPopulated = true;
367                }
368            }
369
370        }
371        //===== fin Opera======================================
372    }
373    if (!isCallstackPopulated) { //IE and Safari
374        var currentFunction = arguments.callee.caller;
375        //next
376        callstack = [];
377        all_functions = [];
378        state = "";
379        if (currentFunction == null) {
380            return ("");
381        }
382        states = [];
383        var fn1 = currentFunction.toString(); // fonction d'appel local (conflit)
384
385        currentFunction = currentFunction.caller;
386        var fn2 = currentFunction.toString(); // fonction d'appel local (conflit)
387        currentFunction = currentFunction.caller;
388        //$family
389
390        while (currentFunction) {
391            var fn = currentFunction.toString();
392            all_functions.push(fn);
393            var fname = fn.substring(fn.indexOf("function") + 8, fn.indexOf("(")) || " ";
394            if (fname != " ") {
395
396                jQuery.noop;
397                if (states.length > 0) break;
398
399                // if (fname != " $") callstack.push(fn);
400            } if (fname != "") {
401                jQuery.noop;
402                // if (fname != " $") callstack.push(fn);
403            }
404            callstack.push(fn);
405
406            if (fn.match(RegExp("jquery|switchmenu|switchTabs|switchInterface|gally|initializeImageMode", "gi"))) {
407                states.push('jQuery');
408                break;
409            }
410            if (fn.match(RegExp("dialog..open", "gi"))) {
411                states.push('GMaps');
412                break;
413            }
414            if (fn.match(RegExp("GMaps|applyMap|markupMaps|applyMarkers", "gi"))) {
415                states.push('GMaps');
416                break;
417            }
418            //======================
419            if (fn.match(RegExp("_footer|ie_ready|makeDraggable|droppables", "gi"))) {
420
421                states.push('paMOOramics');
422              break;
423          }
424          //window_1290934905697_top
425          if (fn.match(RegExp("window_..|WindowUtilities", "gi"))) {
426              states.push('rv_gmaps');
427              break;
428          }
429          if (fn.match(RegExp("that.overlayOpacity", "gi"))) {
430              states.push('rv_gmaps');
431              break;
432          }
433          if (fn.match(RegExp("For backward compatibility like win", "gi"))) {
434              states.push('rv_gmaps');
435              break;
436          }
437          if (fn.match(RegExp("overlay_modal|HTMLDivElement|constraintPad", "gi"))) {
438              states.push('rv_gmaps');
439              break;
440          }
441
442            if (fn.match(RegExp("__content|__method|observe|responder|stopobserving|fireContentLoadedEvent", "gi"))) {
443                states.push('rv_gmaps');
444                break;
445            }
446            //? bubble 
447            Expression = new RegExp("\\$", "gi")
448            if (fn.match(Expression)) {
449                if (fn.match(RegExp("rateForm", "gi"))) {
450
451                    states.push('Luciano');
452                    break;
453                }
454            }
455            // "window.fireEvent('domready')"
456            Expression = new RegExp("window.fireEvent", "gi")
457            if (fn.match(Expression)) {  //luciano
458                // "window.fireEvent('domready')"
459                Expression = new RegExp("window.fireEvent..domready..", "gi")
460                if (fn.match(Expression)) {
461                    states.push('Luciano');
462                    break;
463                }
464            }
465            if (fn.match(RegExp("(splat|buildFrameWork|photoNext)", "gi"))) {  //luciano
466
467                states.push('Luciano');
468                break;
469            }
470
471            if (all_functions.length > 50) 
472            break;
473
474
475            currentFunction = currentFunction.caller;
476        }
477
478    }
479  // state_ff + "|" +
480    state = states.join('\n');
481    if (state == "") {
482        if (DEBUG == "true") {
483            Fn = all_functions.join('\n');
484            alert("non trouvé:" + Fn + "\n"  + fn2 + "\n Firefox:" + state_ff);
485        }
486        state = state_ff;
487    }
488
489    Fn = all_functions;
490    return { state: state, fn: callstack.join('\n'),fn1:fn2 };
491}
492//====================================
493
494
495(function ($) {
496    $(document).ready(function () {
497        jQuery(window).load(function () {
498            a = jQuery(':Description');
499        });
500    });
501    //==============================================
502    librairies=[];
503    jQuery.extend(jQuery.expr[':'], {
504        // Nom du sélecteur personnalisé
505        Description: function (a) {
506            n = jQuery(a).infos();
507            if (n.id != "") {
508                //alert("<" + n.nodeName  +" id= " + n.id    + " >") ;
509            }
510            if (n.nodeName == "SCRIPT")
511                if (a.src == "") {
512                    Match = jQuery(a).html();
513                    /*
514                    if ( Match.match(new RegExp("jQuery", "gi") )) {
515                    alert(n.id + n.nodeName + a.outerHTML ) ;
516                    }
517                    if ( Match.match(new RegExp("ajax", "gi") )) {
518                    alert(n.id + n.nodeName + a.outerHTML ) ;
519                    }
520                    */
521                    if (Match.match(new RegExp("\\$", "gi"))) {
522
523                        if (Match.match(new RegExp("ajax", "gi"))) {
524                            //     alert(n.id + n.nodeName + a.outerHTML);
525
526                        }
527                    }
528                    if (Match.match(new RegExp("pamoorama", "ig"))) {
529
530                        //     alert(n.id + n.nodeName + a.innerHTML);
531
532                    }
533                } else {
534
535                    if (a.src.match(RegExp("mootools|pamooramic|luciano", "gi"))) {
536                        jQuery.noop;
537                        librairies.push(a.src);
538                    }
539
540                }
541
542            return a;
543
544        }
545    }); //fin extend
546    /*
547    *
548    */
549})(jQuery);
550
551
552function $(element, nc0) {
553    a = conflit(element, nc0);
554    return a;
555}
556if (typeof ($.ajax) != "function") {
557    $.ajax = function (origSettings) {
558        jQuery.ajax(origSettings);
559    }
560
561
562    $.parseJSON = function (msg) {
563        return jQuery.parseJSON(msg);
564    }
565
566
567}
568
569if (typeof ($.get) != "function") {
570    $.get = function (options) {
571        return jQuery.get(options);
572    }
573
574
575}
576$_ = $;
577function save_framework(page) {
578    try {
579        Conflit = { version: cl_version, name: cl_plugin };
580    } catch (e) {
581
582    }
583   
584    $_ = $;
585    return
586
587}
588
Note: See TracBrowser for help on using the repository browser.