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

Last change on this file since 7124 was 7124, checked in by cljosse, 14 years ago

[Autosize][beta]Improvement theme compatibility.


File size: 9.7 KB
Line 
1//==== remplace $(... avec jQuery( ====
2 
3(function () {
4   
5})();
6
7
8
9function $(element, nc) {
10    //============== détection framework ==================
11    jq = jQuery(element).selector;
12
13    var tp1 = typeof (MooTools);
14    if (tp1 != "undefined") {
15        if (MooTools.version == "1.2.4") var  MooTools_version = "Luciano"; // luciano
16        if (MooTools.version == "1.11") var MooTools_version  = "pamoorama"; //pamoorama
17
18    } else {
19        var MooTools_version  = "0";
20    }
21
22   tp1 = typeof (Prototype);
23   if (tp1 == "undefined") {
24       var Prototype_Version = '0';
25
26   } else {
27       if (Prototype.Version == '1.6.0.2') {
28           var Prototype_Version = '1602';
29       } else if (Prototype.Version == '1.6.1') {
30           var Prototype_Version = '161';
31       } else if (Prototype.Version == '1.0.0.0') {
32           var Prototype_Version = '1';
33       }
34   }
35    //===================================================
36    if ( Prototype_Version=="0" && MooTools_version == "0") {
37      return jQuery(element);
38    }
39//=======================================================================================
40   if (arguments.caller) {
41        if (arguments.caller.length > 1) {
42            if (element == "pamoorama") {
43                return jQuery().$Pamoorama(element);
44            }
45
46            //=========== options rv_maps prototype.js ===================================   
47            arg = arguments.caller[1];
48            if (Prototype_Version != '0')
49            switch (arg) {
50                case "dom:loaded":
51                    return element;
52                    return jQuery().$Protype1602(element);
53                    break;
54                case "load":
55                    return jQuery().$Protype1602(element); ;
56                    break;
57                case "unload":
58                    return jQuery().$Protype1602(element); ;
59                    break;
60            }
61
62            if (MooTools_version == 'pamoorama')
63            //=========== options pamoorama =================================== 
64            {
65                var reg1 = new RegExp("pamoorama", "g");
66                switch (arg) {
67                    case "bottom":
68                        return jQuery().$Pamoorama(element);
69                        break;
70                    case "left":
71                        return jQuery().$Pamoorama(element);
72                        break;
73
74                    default:
75                        if (arg.area) {
76                            return jQuery().$Pamoorama(element);
77                        } else
78                            if (arg.velocity) {
79                                return jQuery().$Pamoorama(element);
80                            } else if (arg.src) {
81                                return jQuery().$Pamoorama(element);
82                            } else if (arg.modifiers) {
83                                return jQuery().$Pamoorama(element);
84                            } else if (arg.limit) {
85                                return jQuery().$Pamoorama(element);
86                            } else if (arg.duration) {
87                                return jQuery().$Pamoorama(element);
88                            } else if (arg.id) {
89                                switch (arg.id) {
90                                    case "pamoorama_footer":
91                                        return jQuery().$Pamoorama(element);
92                                        break;
93                                    case "pamoorama_outter":
94                                        return jQuery().$Pamoorama(element);
95                                        break;
96                                    case "pamoorama_inner":
97                                        return jQuery().$Pamoorama(element);
98                                        break;
99
100                                    default:
101                                        return jQuery().$Pamoorama(element);
102                                        break;
103
104                                }
105                            } else if (arg.src) {
106                                return jQuery().$Pamoorama(element);
107
108                            }
109                        //=======================================================
110                        return jQuery(element);
111                        break;
112
113                }
114            }else if (MooTools_version=='Luciano')
115             { //=========== options luciano ===================================
116                 //=== theme Luciano ====
117                 return jQuery().$Luciano(element, nc);
118             }
119        }
120    }
121
122     //==================================================
123     tpe = typeof (element);
124    new_element = jQuery(element);
125 
126    //========== test jQuery ? ==============
127
128    if (jq.match(RegExp("^#", "g")) || jq == "html") {
129        return new_element;
130    }
131     if (tpe == "undefined") {
132        return jQuery();
133    }
134    //==== mootools ====
135    if (MooTools_version == "Luciano" && tpe=="string") {
136        //=== theme Luciano ====
137        new_element = jQuery().$Luciano(element, nc);
138        return new_element;
139
140    }
141
142    if (MooTools_version == 'pamoorama')
143    //=========== options pamoorama =================================== 
144    {
145    tp1=typeof (element) ;
146    if (tp1=="string")
147        switch (jq) {
148            case "ie_ready":
149                return jQuery().$Pamoorama(element);
150                break;
151            case "pamoorama":
152                return jQuery().$Pamoorama(element);
153                break;
154            case ".tab a":
155                return jQuery(element);
156                break;
157
158        }else if(tp1=="boolean")
159        {
160            return jQuery().$Pamoorama(element);
161        }
162        el = element.nodeName;
163        if (el == "DIV") return jQuery().$Pamoorama(element);
164        if (el == "IMG") return jQuery().$Pamoorama(element);
165        if (el == "#document") return jQuery(element) ;
166         jQuery().$Pamoorama(element);
167    }
168 
169    if (jQuery("#Panorama").length > 0 && jq != "rateForm" && jq != "order" && jq != "themeSelect") {
170        if (new_element.length < 2) return new_element;
171        if (new_element.length == 2) return jQuery(element).get(1);
172        if (new_element.length == 3) return jQuery(element).get(2);
173
174    }
175    afq = jQuery(document).data("initialized"); //2
176    if (element == window && afq != 1)
177        if (init_tb == 1) {
178            init_tb = 2;
179            return new_element;
180        }
181
182    if (new_element.context && afq != 1 && afq != undefined) {
183        if (init_tb != 2) init_tb = 1;
184        return new_element;
185    }
186    //==========================================================
187    if (new_element.context)
188        if (new_element.context.loaded) {
189    //=== theme Luciano ====
190        if (MooTools_version == "Luciano")  return jQuery().$Luciano(element, nc);
191        //=== theme gally ? ====
192            return new_element;
193        }
194    init_tb = 0;
195    //================================================================
196
197        //==== mootools ====
198        if (MooTools_version == "Luciano") {
199            //=== theme Luciano ====
200            new_element = jQuery().$Luciano(element, nc);
201            tp = new_element.nodeName + new_element.nodeType;
202            if (tp == "DIV1") return new_element;
203            tp = element.nodeName + element.nodeType;
204            return new_element;
205
206        } else if (MooTools_version == "pamoorama") {
207            //=== paMOOramics ===
208            // ie_ready,undefined
209            return jQuery().$Pamoorama(element);
210        }
211
212    //=================================================================
213
214    if (Prototype_Version != '0') {
215        //=== rvmaps ===
216
217        return jQuery().$Protype1602(element);
218    }
219    return jQuery(element);
220
221}
222
223//=========================================================
224jQuery.fn.extend({
225    //---------------- luciano -------------------------------
226    $Luciano: function (el, nc) {
227        return document.id(el, nc, this.document);
228    },
229    //=============== PaMOOramics ===========================
230    $Pamoorama: function (B) {
231        if (!B) {
232            if (typeof (B) == "boolean") return null;
233            return jQuery();
234        }
235        if (B.htmlElement) {
236            return Garbage.collect(B);
237
238        }
239        if ([window, document].contains(B)) { return B; }
240        var A = $type(B);
241        if (A == "string") { B = document.getElementById(B); A = (B) ? "element" : false; }
242        if (A != "element") {
243            return null;
244        }
245        if (B.htmlElement) { return Garbage.collect(B); }
246        if (["object", "embed"].contains(B.tagName.toLowerCase())) { return B; }
247        $extend(B, Element.prototype);
248        B.htmlElement = function () { };
249       try{ return Garbage.collect(B);}catch(e){
250       return ;
251       }
252
253    },
254    //===================================================
255    $Protype1602: function (element) {
256        //======== prototype.js =====================
257        if (arguments.length > 1) {
258            for (var i = 0, elements = [], length = arguments.length; i < length; i++)
259                elements.push($(arguments[i]));
260            return elements;
261        }
262        if (typeof element == "string")
263            element = document.getElementById(element);
264
265          return Element.extend(element);
266
267        try {
268            new_element = Element.extend(element);
269        } catch (e) {
270            return new_element;
271        }
272        return new_element;
273    }
274    //=========================================================
275});   // fin extend
Note: See TracBrowser for help on using the repository browser.