source: extensions/cl_conflit/js/conflit.js @ 7895

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

[cl_conflit] save

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