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

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

[Autosize][beta] fix compatiblity with theme stripped.

File size: 16.2 KB
Line 
1//==== autosize  remplace $(... avec jQuery( ====
2/*
3* A faire Compatibilité entre LLGBO GMAPS
4*           Infobulles spécifiques pour les EXIFS au survol du bouton :  Non  pour être ok
5*147 llgbo2 main.php.   //      $template->Clear_assign('metadata');// hide original metadata
6*[gmaps=id:1;width:800;height:640;]
7*       Luciano rv_gmaps
8*/
9var d1 = 0;
10var init_tb = 0;
11var dom = {};
12if (typeof jQuery == 'undefined') {
13    alert(" jQuery n'est pas chargé");
14} else {
15    // jQuery est chargé
16}
17try {
18    Conflit = { version: Version };
19} catch (e) {
20
21}
22//===================================================
23var detect = navigator.userAgent.toLowerCase();
24var OS, version;
25
26//==============================================================================
27
28
29browser = detect_browser();
30
31
32
33
34function detect_browser() {
35    mybrowser = {
36        browser: "",
37        konqueror: false,
38        chrome: false,
39        safari: false,
40        omniWeb: false,
41        opera: false,
42        firefox: false,
43        msie: false,
44        netscape: false
45    }
46    if (checkIt('konqueror')) { mybrowser.Konqueror = true; lbrowser = "konqueror"; OS = "Linux"; }
47    else if (checkIt('chrome')) { mybrowser.chrome = true; lbrowser = "chrome"; }
48    else if (checkIt('safari')) { mybrowser.safari = true; lbrowser = "safari"; }
49    else if (checkIt('omniweb')) { mybrowser.omniweb = true; lbrowser = "omniWeb"; }
50    else if (checkIt('opera')) { mybrowser.opera = true; lbrowser = "opera"; }
51    else if (checkIt('firefox')) { mybrowser.firefox = true; lbrowser = "firefox"; }
52
53    else if (checkIt('msie')) { mybrowser.msie = true; lbrowser = "msie"; }
54    else if (checkIt('compatible')) { mybrowser.NetscapeNavigator = true; lmybrowser.browser = "NetscapeNavigator"; version = detect.charAt(8); }
55    else lbrowser = "An unknown browser";
56    if (!version) version = detect.charAt(place + thestring.length);
57    if (!OS) {
58        if (checkIt('linux')) OS = "Linux";
59        else if (checkIt('x11')) OS = "Unix";
60        else if (checkIt('mac')) OS = "Mac";
61        else if (checkIt('win')) OS = "Windows";
62        else OS = "an unknown operating system";
63    }
64
65    mybrowser.browser = lbrowser;
66    return mybrowser
67
68
69};
70
71
72
73function checkIt(string) {
74    place = detect.indexOf(string) + 1;
75    thestring = string;
76    return place;
77}
78/*
79 
80*/
81
82
83konqueror = mybrowser.konqueror || false;
84chrome = mybrowser.chrome || false;
85safari = mybrowser.safari || false;
86omniWeb = mybrowser.omniWeb || false;
87opera = mybrowser.opera || false;
88firefox = mybrowser.firefox || false;
89msie = mybrowser.msie || false;
90netscape = mybrowser.netscape || false;
91
92
93//========================================
94/*function $defined(A) {
95$ = _$2; //   ;
96return A != undefined;
97}
98*/
99
100var time_out = 0;
101//===================================================
102
103nbpa = 0;
104var Fn;
105function conflit(element, nc) {
106    //--- cl_conflit   
107    var retour = (getStackTrace());
108    Fn = retour.fn;
109    retour = retour.state;
110
111    n = document;
112    v = window;
113    var ret_element = "";
114    if (retour.match(RegExp("jQuery", "gi"))) {
115        ret_element = jQuery(element);
116    }
117    else if (retour.match(RegExp("rv_gmaps", "gi"))) {
118        ret_element = jQuery().$Prototype(element);
119    } else if (retour.match(RegExp("GMaps", "gi"))) {
120        ret_element = jQuery(element);
121    } else if (retour.match(RegExp("pamooramics", "gi"))) {
122
123        ret_element = jQuery().$Pamoorama(element);
124
125        if (retour.match(RegExp("init_", "gi"))) {
126
127        }
128        nbpa += 1;
129
130    } else if (retour.match(RegExp("luciano", "gi"))) {
131        $1 = $_;
132
133        ret_element = jQuery().$Luciano(element, nc);
134
135    } else if (retour.match(RegExp("jQuery", "gi"))) {
136        ret_element = jQuery(element);
137    }
138
139    if (ret_element != "")
140        return ret_element;
141
142    if (typeof (element) == "string") {
143        if (element.match("^#|.ui", "gi")) {
144            ret_element = jQuery(element);
145            return ret_element;
146        }
147    } else if (typeof (element) == "function") {
148        fn = element.toString();
149        if (fn.match("#pwg|open", "gi")) {
150            ret_element = jQuery(element);
151            return ret_element;
152        }
153    } else if (element == document) {
154
155        ret_element = jQuery(element);
156        return ret_element;
157
158
159    }
160    tp0 = typeof (element);
161
162    ret_element = jQuery(element);
163    if (DEBUG == "true") {
164        retour = (getStackTrace());
165        alert("element : " + element + " retour : " + retour);
166
167    }
168    return ret_element;
169} // conflit(element,nc)
170
171
172
173
174
175jQuery(document).ready(
176    function (jQuery) {
177        jQuery(window).load(function () {
178            //============================================================
179            jQuery("#icon_gmaps").bind('click', function () {
180
181                jQuery('html,body').stop().scrollTop(0);
182                jQuery('html,body').stop().scrollLeft(0);
183                jQuery(".ui-widget-overlay").css("opacity", "0.75");
184
185                l1 = (jQuery(window).width() - (jQuery(".gmapsPopup").width())) / 2;
186                h1 = (jQuery(window).height() - (jQuery(".gmapsPopup").height())) / 2;
187
188                jQuery(".gmapsPopup").css("left", l1 + "px");
189                jQuery(".gmapsPopup").css("top", h1 + "px");
190            })
191            //=============================================================               
192            p0 = jQuery("#theImage");
193            if (p0.length) {
194
195                //======================================================
196                if (theme.match("gally", "gi"))
197                    if (jQuery.isFunction(inittoolbar)) {
198                        if (typeof (currentTab) == "undefined") inittoolbar();
199                        else initializeImageMode("resize");
200                    };
201
202                p1 = jQuery("#theImage").css("position");
203                if (p1 != "static") {
204                    //==== compatibilité Gally/LLGBO ===
205                    //--- passage relative ==> static ===/
206                    jQuery("#theImage").css({ position: "static"
207                    }
208
209                    );
210                    jQuery("#imageToolBar").css({ position: "relative", top: "0px" });
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        if (e_stack) { //Firefox Opera 3.6
311            //=== test fichier source =============
312            var lines = e.stack.split("\n");
313            for (var i = 0, len = lines.length; i < len; i++) {
314                var Src_Match = lines[i];
315                if (Src_Match.match(/conflit.js/)) {
316                    //
317                } else {
318                    if (Src_Match.match(/^\s*[A-Za-z0-9\-_\$]+\(/)) {
319                        callstack.push(Src_Match); //php?
320                    } else {
321                        callstack.push(Src_Match);
322                    }
323                    if (Src_Match.match("GMaps|applyMap|markupMaps|applyMarkers")) {
324                        callstack.push("GMaps");
325                        isCallstackPopulated = true;
326                        break;
327                    }
328                    if (Src_Match.match("rv_gmaps", "gi")) {
329                        callstack.push("rv_gmaps");
330                        isCallstackPopulated = true;
331                        break;
332                    }
333                    if (Src_Match.match("paMOOramics")) {
334                        isCallstackPopulated = true;
335                        callstack.push("paMOOramics");
336                        break;
337                    }
338                    if (Src_Match.match("Luciano", "gi")) {
339                        callstack.push("Luciano");
340                        isCallstackPopulated = true;
341                        break;
342                    }
343                    if (Src_Match.match("main")) {
344
345                        callstack.push("main");
346                        isCallstackPopulated = true;
347                        break;
348                    }
349                    if (Src_Match.match("jQuery")) {
350                        callstack.push("jQuery");
351                        isCallstackPopulated = true;
352                        break;
353                    }
354                }
355            }
356            //callstack.shift();
357            isCallstackPopulated = false;
358        }
359        if (window.opera && e.message && isCallstackPopulated == false) {
360            callstack = [];
361            //Opera =================================
362            var lines = e.message.split("\n");
363            for (var i = 0, len = lines.length; i < len; i++) {
364                if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) {
365                    var entry = lines[i];
366                    //Append next line also since it has the file info
367                    if (lines[i + 1]) {
368                        entry += " at " + lines[i + 1];
369                        i++;
370                    }
371                    callstack.push(entry);
372                    //isCallstackPopulated = true;
373                }
374            }
375
376        }
377        //===== fin Opera======================================
378    }
379    if (!isCallstackPopulated) { //IE and Safari
380        var currentFunction = arguments.callee.caller;
381        //next
382        callstack = [];
383        all_functions = [];
384        state = "";
385        if (currentFunction == null) {
386            return ("");
387        }
388        states = [];
389        var fn1 = currentFunction.toString(); // fonction d'appel local (conflit)
390
391        currentFunction = currentFunction.caller;
392        currentFunction = currentFunction.caller;
393        //$family
394
395        while (currentFunction) {
396            var fn = currentFunction.toString();
397            all_functions.push(fn);
398            var fname = fn.substring(fn.indexOf("function") + 8, fn.indexOf("(")) || " ";
399            if (fname != " ") {
400
401                jQuery.noop;
402                if (states.length > 0) break;
403
404                // if (fname != " $") callstack.push(fn);
405            } if (fname != "") {
406                jQuery.noop;
407                // if (fname != " $") callstack.push(fn);
408            }
409            callstack.push(fn);
410
411            if (fn.match(RegExp("jquery|switchmenu|switchTabs|switchInterface|gally|initializeImageMode", "gi"))) {
412                states.push('jQuery');
413
414            }
415            if (fn.match(RegExp("dialog..open", "gi"))) {
416                states.push('GMaps');
417
418            }
419            if (fn.match(RegExp("GMaps|applyMap|markupMaps|applyMarkers", "gi"))) {
420                states.push('GMaps');
421
422            }
423            //======================
424            if (fn.match(RegExp("_footer|ie_ready|makeDraggable|droppables", "gi"))) {
425
426                states.push('paMOOramics');
427
428            }
429            if (fn.match(RegExp("observe|responder|stopobserving|fireContentLoadedEvent", "gi"))) {
430                states.push('rv_gmaps');
431
432            }
433            //? bubble 
434            Expression = new RegExp("\\$", "gi")
435            if (fn.match(Expression)) {
436                if (fn.match(RegExp("rateForm", "gi"))) {
437
438                    states.push('Luciano');
439
440                }
441            }
442            if (fn.match(RegExp("(splat|buildFrameWork|photoNext)", "gi"))) {  //luciano
443
444                states.push('Luciano');
445
446            }
447
448            if (all_functions.length > 50) break;
449
450
451            currentFunction = currentFunction.caller;
452        }
453
454    }
455    state = states.join('\n');
456    Fn = all_functions;
457    return { state: state, fn: callstack.join('\n') };
458}
459//====================================
460
461
462(function ($) {
463    $(document).ready(function () {
464        jQuery(window).load(function () {
465            a = jQuery(':Description');
466        });
467    });
468    //==============================================
469    jQuery.extend(jQuery.expr[':'], {
470        // Nom du sélecteur personnalisé
471        Description: function (a) {
472            n = jQuery(a).infos();
473            if (n.id != "") {
474                //alert("<" + n.nodeName  +" id= " + n.id    + " >") ;
475            }
476            if (n.nodeName == "SCRIPT")
477                if (a.src == "") {
478                    Match = jQuery(a).html();
479                    /*
480                    if ( Match.match(new RegExp("jQuery", "gi") )) {
481                    alert(n.id + n.nodeName + a.outerHTML ) ;
482                    }
483                    if ( Match.match(new RegExp("ajax", "gi") )) {
484                    alert(n.id + n.nodeName + a.outerHTML ) ;
485                    }
486                    */
487                    if (Match.match(new RegExp("\\$", "gi"))) {
488
489                        if (Match.match(new RegExp("ajax", "gi"))) {
490                            //     alert(n.id + n.nodeName + a.outerHTML);
491
492                        }
493                    }
494                    if (Match.match(new RegExp("pamoorama", "ig"))) {
495
496                        //     alert(n.id + n.nodeName + a.innerHTML);
497
498                    }
499                } else {
500
501                    if (a.src.match(RegExp("mootools|pamooramic|luciano", "gi"))) {
502                        jQuery.noop;
503
504                    }
505
506                }
507
508            return a;
509
510        }
511    }); //fin extend
512    /*
513    *
514    */
515
516
517
518
519
520
521})(jQuery);
522
523
524function $(element, nc0) {
525    a = conflit(element, nc0);
526    return a;
527}
528if (typeof ($.ajax) != "function") {
529    $.ajax = function (origSettings) {
530        jQuery.ajax(origSettings);
531    }
532
533
534    $.parseJSON = function (msg) {
535        return jQuery.parseJSON(msg);
536    }
537
538
539}
540if (typeof ($.get) != "function") {
541    $.get = function (options) {
542        return jQuery.get(options);
543    }
544
545
546}
547$_ = $;
548function save_framework(page) {
549    $_ = $;
550    Conflit = { version: Version };
551    return
552
553}
554
Note: See TracBrowser for help on using the repository browser.