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

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

[Autosize][beta] fix compatiblity with luciano()

File size: 14.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}
17
18//===================================================
19
20/*
21 
22*/
23msie = jQuery.browser.msie || false;
24opera= jQuery.browser.opera || false;
25//========================================
26/*function $defined(A) {
27    $ = _$2; //   ;
28    return A != undefined;
29}
30*/
31
32var time_out = 0;
33//===================================================
34
35nbpa = 0;
36var Fn;
37function conflit(element, nc) {
38    //--- cl_conflit   
39    var retour = (getStackTrace());
40    Fn = retour.fn;
41    retour = retour.state;
42
43    n = document;
44    v = window;
45    var ret_element = "";
46    if (retour.match(RegExp("jQuery", "gi"))) {
47        ret_element = jQuery(element);
48    }
49    else if (retour.match(RegExp("rv_gmaps", "gi"))) {
50        ret_element = jQuery().$Prototype(element);
51    } else if (retour.match(RegExp("GMaps", "gi"))) {
52        ret_element = jQuery(element);
53    } else if (retour.match(RegExp("pamooramics", "gi"))) {
54
55    ret_element =   jQuery().$Pamoorama(element);
56
57        if (retour.match(RegExp("init_", "gi"))) {
58
59        }
60        nbpa += 1;
61
62    } else if (retour.match(RegExp("luciano", "gi"))) {
63        $1 = $_;
64       
65        ret_element = jQuery().$Luciano(element,nc);
66
67    } else if (retour.match(RegExp("jQuery", "gi"))) {
68        ret_element = jQuery(element);
69    }
70
71    if (ret_element != "")
72        return ret_element;
73
74    if (typeof (element) == "string") {
75        if (element.match("^#|.ui", "gi")) {
76            ret_element = jQuery(element);
77            return ret_element;
78        }
79    } else if (typeof (element) == "function") {
80        fn = element.toString();
81        if (fn.match("#pwg|open", "gi")) {
82            ret_element = jQuery(element);
83            return ret_element;
84        }
85    } else if (element == document) {
86
87        ret_element = jQuery(element);
88        return ret_element;
89
90
91    }
92    tp0 = typeof (element);
93
94    ret_element = jQuery(element);
95    if (DEBUG == "true") {
96        retour = (getStackTrace());
97        alert("element : " + element + " retour : " + retour);
98
99    }
100    return ret_element;
101} // conflit(element,nc)
102
103
104
105
106
107jQuery(document).ready(
108    function (jQuery) {
109        jQuery(window).load(function () {
110            //============================================================
111            jQuery("#icon_gmaps").bind('click', function () {
112
113                jQuery('html,body').stop().scrollTop(0);
114                jQuery('html,body').stop().scrollLeft(0);
115                jQuery(".ui-widget-overlay").css("opacity", "0.75");
116
117                l1 = (jQuery(window).width() - (jQuery(".gmapsPopup").width())) / 2;
118                h1 = (jQuery(window).height() - (jQuery(".gmapsPopup").height())) / 2;
119
120                jQuery(".gmapsPopup").css("left", l1 + "px");
121                jQuery(".gmapsPopup").css("top", h1 + "px");
122            })
123            //=============================================================               
124            p0 = jQuery("#theImage");
125            if (p0.length) {
126
127                //======================================================
128                if (theme.match("gally", "gi"))
129                    if (jQuery.isFunction(inittoolbar)) {
130                        if (typeof (currentTab) == "undefined") inittoolbar();
131                        else initializeImageMode("resize");
132                    };
133
134                p1 = jQuery("#theImage").css("position");
135                if (p1 != "static") {
136                    //==== compatibilité Gally/LLGBO ===
137                    //--- passage relative ==> static ===/
138                    jQuery("#theImage").css({ position: "static"
139                    }
140
141                    );
142                    jQuery("#imageToolBar").css({ position: "relative", top: "0px" });
143                }
144            }
145            //   jQuery(window).resize();
146
147        });
148        //=============================================================       
149
150        //  $ = _$2; ;
151
152
153    })
154;
155
156
157
158//=========================================================
159
160jQuery.fn.extend({
161
162    //---------------- luciano -------------------------------
163    $Luciano: function (el, nc) {
164        return document.id(el, nc, this.document);
165    },
166    //=============== PaMOOramics ===========================
167
168    $Pamoorama: function (B) {
169
170
171        if (!B) {
172            if (typeof (B) == "boolean") return null;
173
174        }
175
176        try {
177            if (B.htmlElement) {
178                return Garbage.collect(B);
179            }
180        } catch (e) {
181
182        }
183
184        if ([window, document].contains(B)) { return B; }
185        var A = $type(B);
186        if (A == "string") { B = document.getElementById(B); A = (B) ? "element" : false; }
187        if (A != "element") {
188            return null;
189        }
190        if (B.htmlElement) { return Garbage.collect(B); }
191        if (["object", "embed"].contains(B.tagName.toLowerCase())) { return B; }
192        $extend(B, Element.prototype);
193        B.htmlElement = function () { };
194        try { return Garbage.collect(B); } catch (e) {
195            return;
196        }
197
198    },
199    //===================================================
200    $Prototype: function (element) {
201        //======== prototype.js =====================
202        if (arguments.length > 1) {
203            for (var i = 0, elements = [], length = arguments.length; i < length; i++)
204                elements.push($(arguments[i]));
205            return elements;
206        }
207        if (typeof element == "string")
208            element = document.getElementById(element);
209
210        return Element.extend(element);
211
212        try {
213            new_element = Element.extend(element);
214        } catch (e) {
215            return new_element;
216        }
217        return new_element;
218    }
219    //=========================================================
220});    // fin extend
221
222
223
224/*
225* mootools.js  version: "1.11"
226* pamoorama0.3.js
227*
228* main.js (google maps)
229* prototype.js(mootool version: "1.62")
230* windows.js
231*
232*/
233function getStackTrace() {
234    var callstack = [];
235    var isCallstackPopulated = false;
236    try {
237        i.dont.exist += 0; //doesn't exist- that's the point
238    } catch (e) {
239        var retcallstack = [];
240        var e_message = e.message;
241        var e_stack = e.stack;
242        if (e_stack) { //Firefox Opera 3.6
243            //=== test fichier source =============
244            var lines = e.stack.split("\n");
245            for (var i = 0, len = lines.length; i < len; i++) {
246                var Src_Match = lines[i];
247                if (Src_Match.match(/conflit.js/)) {
248                    //
249                } else {
250                    if (Src_Match.match(/^\s*[A-Za-z0-9\-_\$]+\(/)) {
251                        callstack.push(Src_Match); //php?
252                    } else {
253                        callstack.push(Src_Match);
254                    }
255                    if (Src_Match.match("GMaps|applyMap|markupMaps|applyMarkers")) {
256                        callstack.push("GMaps");
257                        isCallstackPopulated = true;
258                        break;
259                    }
260                    if (Src_Match.match("rv_gmaps", "gi")) {
261                        callstack.push("rv_gmaps");
262                        isCallstackPopulated = true;
263                        break;
264                    }
265                    if (Src_Match.match("paMOOramics")) {
266                        isCallstackPopulated = true;
267                        callstack.push("paMOOramics");
268                        break;
269                    }
270                    if (Src_Match.match("Luciano", "gi")) {
271                        callstack.push("Luciano");
272                        isCallstackPopulated = true;
273                        break;
274                    }
275                    if (Src_Match.match("main")) {
276                     
277                        callstack.push("main");
278                        isCallstackPopulated = true;
279                        break;
280                    }
281                    if (Src_Match.match("jQuery")) {
282                        callstack.push("jQuery");
283                        isCallstackPopulated = true;
284                        break;
285                    }
286                }
287            }
288            //callstack.shift();
289            isCallstackPopulated = false;
290        }
291        if (window.opera && e.message && isCallstackPopulated == false) {
292            callstack = [];
293            //Opera =================================
294            var lines = e.message.split("\n");
295            for (var i = 0, len = lines.length; i < len; i++) {
296                if (lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)) {
297                    var entry = lines[i];
298                    //Append next line also since it has the file info
299                    if (lines[i + 1]) {
300                        entry += " at " + lines[i + 1];
301                        i++;
302                    }
303                    callstack.push(entry);
304                    //isCallstackPopulated = true;
305                }
306            }
307
308        }
309        //===== fin Opera======================================
310    }
311    if (!isCallstackPopulated) { //IE and Safari
312        var currentFunction = arguments.callee.caller;
313        //next
314        callstack = [];
315        all_functions = [];
316        state = "";
317        if (currentFunction == null) {
318            return ("");
319        }
320        states = [];
321        var fn1 = currentFunction.toString(); // fonction d'appel local (conflit)
322
323        currentFunction = currentFunction.caller;
324        currentFunction = currentFunction.caller;
325        //$family
326
327        while (currentFunction) {
328            var fn = currentFunction.toString();
329            all_functions.push(fn);
330            var fname = fn.substring(fn.indexOf("function") + 8, fn.indexOf("(")) || " ";
331            if (fname != " ") {
332
333                jQuery.noop;
334                if (states.length > 0) break;
335
336                // if (fname != " $") callstack.push(fn);
337            } if (fname != "") {
338                jQuery.noop;
339                // if (fname != " $") callstack.push(fn);
340            }
341            callstack.push(fn);
342
343            if (fn.match(RegExp("jquery|switchmenu|switchTabs|switchInterface|gally|initializeImageMode", "gi"))) {
344                states.push('jQuery');
345
346            }
347            if (fn.match(RegExp("dialog..open", "gi"))) {
348                states.push('GMaps');
349
350            }
351            if (fn.match(RegExp("GMaps|applyMap|markupMaps|applyMarkers", "gi"))) {
352                states.push('GMaps');
353
354            }
355            //======================
356            if (fn.match(RegExp("_footer|ie_ready|makeDraggable|droppables", "gi"))) {
357
358                states.push('paMOOramics');
359
360            }
361            if (fn.match(RegExp("observe|responder|stopobserving|fireContentLoadedEvent", "gi"))) {
362                states.push('rv_gmaps');
363
364            }
365            //? bubble 
366            Expression = new RegExp("\\$", "gi")
367            if (fn.match(Expression)) {
368                if (fn.match(RegExp("rateForm", "gi"))) {
369
370                    states.push('Luciano');
371
372                }
373            }
374            if (fn.match(RegExp("(splat|buildFrameWork|photoNext)", "gi"))) {  //luciano
375
376                states.push('Luciano');
377
378            }
379
380            if (all_functions.length > 50) break;
381
382
383            currentFunction = currentFunction.caller;
384        }
385
386    }
387    state = states.join('\n');
388    Fn = all_functions;
389    return { state: state, fn: callstack.join('\n') };
390}
391//====================================
392
393
394(function($) {
395    $(document).ready(function(){
396         jQuery(window).load(function () {
397               a = jQuery(':Description');
398        });
399    });
400    //==============================================
401    jQuery.extend(jQuery.expr[':'], {
402    // Nom du sélecteur personnalisé
403        Description: function (a) {
404        n = jQuery(a).infos();
405        if (n.id != "") {
406            //alert("<" + n.nodeName  +" id= " + n.id    + " >") ;
407        }
408        if (n.nodeName == "SCRIPT")
409            if (a.src == "") {
410                Match = jQuery(a).html();
411                /*
412                if ( Match.match(new RegExp("jQuery", "gi") )) {
413                alert(n.id + n.nodeName + a.outerHTML ) ;
414                }
415                if ( Match.match(new RegExp("ajax", "gi") )) {
416                alert(n.id + n.nodeName + a.outerHTML ) ;
417                }
418                */
419                if (Match.match(new RegExp("\\$", "gi"))) {
420
421                    if (Match.match(new RegExp("ajax", "gi"))) {
422                        //     alert(n.id + n.nodeName + a.outerHTML);
423
424                    }
425                }
426                if (Match.match(new RegExp("pamoorama", "ig"))) {
427
428                    //     alert(n.id + n.nodeName + a.innerHTML);
429
430                }
431            }else{ 
432         
433            if (a.src.match(RegExp("mootools|pamooramic|luciano", "gi"))) {   
434              jQuery.noop;           
435
436                     }
437 
438                }
439
440        return a;
441
442    }
443  }); //fin extend
444  /*
445  *
446  */
447
448
449
450
451
452
453})(jQuery); 
454
455
456 function $(element, nc0) {
457        a = conflit(element, nc0);
458        return a;
459    }
460if (typeof ($.ajax)!="function") 
461    {   
462    $.ajax=        function  (origSettings) {
463             jQuery.ajax(origSettings) ;
464        } 
465     
466
467     $.parseJSON=  function (msg){
468            return jQuery.parseJSON(msg) ;
469        }
470
471
472    }
473if (typeof ($.get)!="function") 
474    {
475        $.get = function (options) {
476            return jQuery.get(options);
477        }
478
479
480    }
481    $_ = $;
482    function save_framework(page) {
483        $_ = $;
484      return 
485 
486}
487
Note: See TracBrowser for help on using the repository browser.