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

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

[Autosize][beta] save

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