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

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

[Autosize][beta] fix bug with pamooramic...

File size: 16.9 KB
Line 
1//==== autosize  remplace $(... avec jQuery( ====
2var d1 = 0;
3var init_tb = 0;             
4
5
6 function $(element, nc) {
7                  return conflit(element, nc);
8              }
9
10jQuery(document).ready(
11
12      function (jQuery) {
13
14
15
16           tpj = jQuery("#pamoorama");
17          if (tpj.length > 0) {             }
18          jQuery(window).load(function () {
19              if (jQuery("#theImage").css("position") == "relative") {
20                  //==== compatibilité Gally/LLGBO ===
21                  //--- passage relative ==> static ===/
22                  jQuery("#theImage").css("position", "static");
23              }
24
25
26              tp = typeof (Browser);
27              if (tp != "undefined")
28                  if (Browser.loaded == true) {
29                      n = Browser;
30                  }
31                  function $(element, nc) {
32                      return conflit(element, nc);
33                  }
34             
35          });
36
37      })
38;
39    function conflit(element, nc) {
40        //============== détection framework ==================
41        var tp1 = typeof (MooTools);
42        var MooTools_version = "0";
43
44        if (tp1 != "undefined") {
45            MooTools_version = "1";
46            if (MooTools.version == "1.2.4") {
47                MooTools_version = "Luciano"; // luciano
48                ret_Luciano = jQuery().$Luciano(element, nc);
49            }
50
51            if (MooTools.version == "1.11") {
52                MooTools_version = "pamoorama"; //pamoorama
53            }
54
55
56        }
57
58        tp1 = typeof (Prototype);
59        var Prototype_Version = '0';
60        if (tp1 != "undefined") {
61            if (Prototype.Version == '1.6.0.2') {
62                Prototype_Version = '1602';
63
64            } else if (Prototype.Version == '1.6.1') {
65                Prototype_Version = '161';
66
67            } else if (Prototype.Version == '1.0.0.0') {
68                Prototype_Version = '1';
69
70            }
71        }
72        //===================================================
73        var jq = jQuery(element).selector;
74        var new_element = jQuery(element);
75        //div.gmapsPopup div.ui-dialog-titlebar
76        if (jq.match(/GMaps/) || jq.match(/gmaps/)) {
77            if (jq == "#iGMapsIconContent") {
78                setTimeout('jQuery().recentrage_widget()', 0);
79            }
80            if (new_element.length > 0) return new_element;
81            return new_element;
82        }
83        if (Prototype_Version == "0" && MooTools_version == "0") {
84            return new_element;
85        }
86        //=======================================================================================
87        if (arguments.caller && arguments.caller.length > 0) {
88            if (arguments.caller.length > 1) {
89                if (element == "pamoorama") {
90                    return jQuery().$Pamoorama(element);
91                }
92                arg = arguments.caller[1];
93                if (typeof (arg) != "undefined" && typeof (arg) != undefined) {
94                    //=========== options rv_maps prototype.js ===================================   
95
96                    if (Prototype_Version != '0')
97                        switch (arg) {
98                        case "dom:loaded":
99                            return element;
100                            return jQuery().$Prototype(element);
101                            break;
102                        case "load":
103                            return jQuery().$Prototype(element);
104                            break;
105                        case "unload":
106                            return jQuery().$Prototype(element);
107                            break;
108                        case "prototype_event_registry":
109
110                            try {
111                                new_element = jQuery().$Prototype(element);
112                            } catch (e) {
113                                new_element = null;
114                            }
115
116
117                            return new_element;
118                            break;
119                        case "readystatechange":
120                            try {
121                                new_element = jQuery().$Prototype(element);
122                            } catch (e) {
123                                new_element = null;
124                                try {
125                                    new_element = jQuery().$Luciano(element, nc);
126                                    new_element = jQuery(element).get(0);
127                                } catch (e) {
128                                    new_element = null;
129                                }
130
131                            }
132
133                            return new_element;
134                            break;
135                    }
136
137                    if (MooTools_version == 'pamoorama' && typeof (arg) != undefined)
138                    //=========== options pamoorama =================================== 
139                    {
140                        var reg1 = new RegExp("pamoorama", "g");
141                        switch (arg) {
142                            case "bottom":
143                                return jQuery().$Pamoorama(element);
144                                break;
145                            case "left":
146                                return jQuery().$Pamoorama(element);
147                                break;
148                            case "prototype_event_registry":
149                                return jQuery().$Pamoorama(element);
150                                break;
151                            case "readystatechange":
152                                return jQuery().$Pamoorama(element);
153                                break;
154
155                            default:
156                                if (arg.area) {
157                                    return jQuery().$Pamoorama(element);
158                                } else
159                                    if (arg.velocity) {
160                                        return jQuery().$Pamoorama(element);
161                                    } else if (arg.src) {
162                                        return jQuery().$Pamoorama(element);
163                                    } else if (arg.modifiers) {
164                                        return jQuery().$Pamoorama(element);
165                                    } else if (arg.limit) {
166                                        return jQuery().$Pamoorama(element);
167                                    } else if (arg.duration) {
168                                        return jQuery().$Pamoorama(element);
169                                    } else if (arg.id) {
170                                        switch (arg.id) {
171                                            case "pamoorama_footer":
172                                                return jQuery().$Pamoorama(element);
173                                                break;
174                                            case "pamoorama_outter":
175                                                return jQuery().$Pamoorama(element);
176                                                break;
177                                            case "pamoorama_inner":
178                                                return jQuery().$Pamoorama(element);
179                                                break;
180
181                                            default:
182                                                return jQuery().$Pamoorama(element);
183                                                break;
184
185                                        }
186                                    } else if (arg.src) {
187                                        return jQuery().$Pamoorama(element);
188
189                                    }
190                                //=======================================================
191                                return new_element;
192                                break;
193
194                        }
195                    } else if (MooTools_version == 'Luciano') { //=========== options luciano ===================================
196                        //=== theme Luciano ====
197                        return ret_Luciano;
198                    }
199
200                }
201            }
202        }
203
204        //==================================================
205        tpe = typeof (element);
206        if (Prototype_Version != '0') {
207            if (tpe == "string") {
208                //=== rvmaps === //
209                if (element.match(/[a-z]_[a-z]/)) {
210
211                    return jQuery().$Prototype(element);
212                }
213                id = "window_" + new Date().getTime();
214                reg1 = new RegExp("^window_", "g");
215                if (element.match(reg1, "g")) {
216
217                    if (element.match(/_[a-z]/)) {
218                        return jQuery().$Prototype(element);
219                    }
220                    return null;
221                }
222            }
223        }
224        //========== test jQuery ? ==============
225        if (tpe == "string")
226            if (element.match(RegExp("^#", "g")) ) {
227                return new_element;
228            }
229        if (jq.match(RegExp("^#", "g")) || jq == "html") {
230            return new_element;
231        }
232        if (tpe == "undefined") {
233            return jQuery();
234        }
235        //==== mootools ====
236        if (MooTools_version == "Luciano" && tpe == "string") {
237            //=== theme Luciano ====
238            new_element = jQuery().$Luciano(element, nc);
239            if (element == "order") return new_element;
240            if (element == "themeSelect") return new_element;
241            if (element == "languageSelect") return new_element;
242            if (element == 'linkPrev') return new_element;
243            if (element == 'linkNext') return new_element;
244            if (element == 'rateForm') return new_element;
245        }
246
247        if (MooTools_version == 'pamoorama')
248        //=========== options pamoorama =================================== 
249        {
250
251            if (tpe == "string")
252                switch (jq) {
253                case "ie_ready":
254                    return jQuery().$Pamoorama(element);
255                    break;
256                case "pamoorama":
257                    return jQuery().$Pamoorama(element);
258                    break;
259                case ".tab a":
260                    return jQuery(element);
261                    break;
262
263            } else if (tpe == "boolean") {
264                return jQuery().$Pamoorama(element);
265            }
266            el = element.nodeName;
267            if (el == "DIV") return jQuery().$Pamoorama(element);
268            if (el == "IMG") return jQuery().$Pamoorama(element);
269            if (el == "#document") return jQuery(element);
270            if (el == "BODY") {
271                try { return jQuery().$Pamoorama(element) } catch (e) {
272                    return jQuery(element);
273                };
274
275            }
276            if (element == window)
277                return new_element;
278            jQuery().$Pamoorama(element);
279        }
280        obj_panorama = jQuery("#Panorama");
281        if (obj_panorama.length > 0 && jq != "rateForm" && jq != "order" && jq != "themeSelect") {
282            if (tpe == "object")
283                if (Prototype_Version != '0') {
284                    //=== rvmaps ===
285                    try {
286                        elem_retour = jQuery().$Prototype(element);
287                        return elem_retour;
288                    } catch (e) {
289
290                    }
291                }
292
293            if (new_element.length < 2) return new_element;
294            if (new_element.length == 2) return jQuery(element).get(1);
295            if (new_element.length == 3) return jQuery(element).get(2);
296
297        }
298        afq = jQuery(document).data("initialized"); //2
299        if (element == window && afq != 1)
300            if (init_tb == 1) {
301                init_tb = 2;
302                return new_element;
303            }
304
305
306        //========= ????  ===================
307        if (new_element != null) {
308            if (typeof (new_element.context) != "undefined") {
309                if (afq != 1 && afq != undefined) {
310                    if (init_tb != 2) init_tb = 1;
311                    return new_element;
312                }
313                if (new_element.context.loaded) {
314                    //=== theme Luciano ====
315                    if (MooTools_version == "Luciano") {
316                        try {
317                            ret_el = jQuery().$Prototype(element);
318                            return ret_el;
319                        } catch (e) {
320                            jQuery("#Debug").text(e.message);
321                            return ret_Luciano;
322                        }
323                    }
324                    //=== theme gally ? ====
325                    if (Prototype_Version != '0') {
326                        //=== rvmaps ===
327                        try {
328                            return jQuery(element);
329                        } catch (e) {
330                            return jQuery().$Prototype(element);
331                        }
332                    }
333                }
334            }
335        }
336        init_tb = 0;
337        //================================================================
338
339        //==== mootools ====
340        if (MooTools_version == "Luciano") {
341            //=== theme Luciano ====
342            tp = this;
343            new_element = ret_Luciano;
344            //$(this.options.container)
345            if (new_element != null) {
346                if (new_element.nodeName) {
347                    tp = new_element.nodeName + new_element.nodeType;
348                    if (tp == "DIV1") return new_element;
349                    if (tp == "SELECT1") return new_element;
350                    tp = element.nodeName + element.nodeType;
351                    return new_element;
352                }
353
354            }
355        } else if (MooTools_version == "pamoorama") {
356            //=== paMOOramics ===
357            // ie_ready,undefined
358            return jQuery().$Pamoorama(element);
359        }
360
361        //=================================================================
362
363        if (Prototype_Version != '0') {
364            //=== rvmaps ===
365            try {
366                return jQuery().$Prototype(element);
367            } catch (e) {
368                return jQuery(element);
369            }
370        }
371        return jQuery(element);
372
373    }
374
375//=========================================================
376(function ($) {
377              $.fn.panorama2 =
378              function (height, width) {
379               
380           var src =jQuery(this);
381
382          return ;
383
384$("#theImage img").eq(0).removeAttr("style").attr({width:width,height:height});
385retour= jQuery('a.panorama-control-left').click();
386panoramaContainer=jQuery('panorama-container');
387
388            /*
389                $(panoramaContainer).stop();
390                op=options;
391                settings.direction = 'right';
392                panoramaContainer.panorama_animate(panoramaContainer, elemWidth, settings);
393             */ 
394               
395
396                           
397
398
399              } 
400
401
402})(jQuery);
403
404
405jQuery.fn.extend({
406    //---------------- luciano -------------------------------
407    $Luciano: function (el, nc) {
408        return document.id(el, nc, this.document);
409    },
410    //=============== PaMOOramics ===========================
411    $Pamoorama: function (B) {
412        if (!B) {
413            if (typeof (B) == "boolean") return null;
414            return jQuery();
415        }
416        if (B.htmlElement) {
417            return Garbage.collect(B);
418
419        }
420        if ([window, document].contains(B)) { return B; }
421        var A = $type(B);
422        if (A == "string") { B = document.getElementById(B); A = (B) ? "element" : false; }
423        if (A != "element") {
424            return null;
425        }
426        if (B.htmlElement) { return Garbage.collect(B); }
427        if (["object", "embed"].contains(B.tagName.toLowerCase())) { return B; }
428        $extend(B, Element.prototype);
429        B.htmlElement = function () { };
430       try{ return Garbage.collect(B);}catch(e){
431       return ;
432       }
433
434    },
435    //===================================================
436    $Prototype: function (element) {
437        //======== prototype.js =====================
438        if (arguments.length > 1) {
439            for (var i = 0, elements = [], length = arguments.length; i < length; i++)
440                elements.push($(arguments[i]));
441            return elements;
442        }
443        if (typeof element == "string")
444            element = document.getElementById(element);
445
446          return Element.extend(element);
447
448        try {
449            new_element = Element.extend(element);
450        } catch (e) {
451            return new_element;
452        }
453        return new_element;
454    }
455    //=========================================================
456});   // fin extend
Note: See TracBrowser for help on using the repository browser.