source: extensions/cl_conflit/js/conflit.js.bak @ 7880

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

[cl_conflit] create of cl_conflit

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