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

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

[Autosize][beta] compatibility with simple


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