Ignore:
Timestamp:
Oct 15, 2010, 11:58:37 AM (14 years ago)
Author:
cljosse
Message:

[Autosize][beta]Improvement frame work mootools,prototype,jquery compatibility.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Autosize/js/conflit.js

    r7124 r7193  
    11//==== remplace $(... avec jQuery( ====
     2var d1 = 0;
     3var init_tb = 0;
    24 
    3 (function () {
    4    
    5 })();
    6 
    7 
    8 
    95function $(element, nc) {
    106    //============== détection framework ==================
    11     jq = jQuery(element).selector;
     7   
    128
    139    var tp1 = typeof (MooTools);
     10    var MooTools_version = "0";
     11
    1412    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 {
     13        if (MooTools.version == "1.2.4") {
     14            MooTools_version = "Luciano"; // luciano
     15            ret_Luciano = jQuery().$Luciano(element, nc);
     16        }
     17
     18    if (MooTools.version == "1.11") {
     19        MooTools_version = "pamoorama"; //pamoorama
     20        try {
     21           
     22        } catch (e) {
     23       
     24        };
     25        }
     26
     27
     28    }
     29
     30    tp1 = typeof (Prototype);
     31   var Prototype_Version = '0';
     32   if (tp1 != "undefined") {
    2733       if (Prototype.Version == '1.6.0.2') {
    28            var Prototype_Version = '1602';
     34           Prototype_Version = '1602';
     35         
    2936       } else if (Prototype.Version == '1.6.1') {
    30            var Prototype_Version = '161';
     37          Prototype_Version = '161';
     38         
    3139       } else if (Prototype.Version == '1.0.0.0') {
    32            var Prototype_Version = '1';
     40          Prototype_Version = '1';
     41       
    3342       }
    3443   }
    35     //===================================================
     44     //===================================================
     45   var  jq = jQuery(element).selector;
     46   var  new_element = jQuery(element);
     47
    3648    if ( Prototype_Version=="0" && MooTools_version == "0") {
    37       return jQuery(element);
     49        return new_element;
    3850    }
    3951//=======================================================================================
    40    if (arguments.caller) {
     52    if (arguments.caller && arguments.caller.length>0 ) {
    4153        if (arguments.caller.length > 1) {
    4254            if (element == "pamoorama") {
    43                 return jQuery().$Pamoorama(element);
     55                return jQuery().$Pamoorama(element) ;
    4456            }
    4557
     
    5062                case "dom:loaded":
    5163                    return element;
    52                     return jQuery().$Protype1602(element);
     64                    return jQuery().$Protype(element);
    5365                    break;
    5466                case "load":
    55                     return jQuery().$Protype1602(element); ;
     67                    return jQuery().$Protype(element);
    5668                    break;
    5769                case "unload":
    58                     return jQuery().$Protype1602(element); ;
     70                    return jQuery().$Protype(element);
     71                    break;
     72                case "prototype_event_registry":
     73
     74                    try {
     75                        new_element = jQuery().$Protype(element);
     76                    } catch (e) {
     77                        new_element = null;
     78                    }
     79
     80                   
     81                    return new_element;
     82                    break;
     83                case "readystatechange":
     84                    try {
     85                        new_element = jQuery().$Protype(element);
     86                    } catch (e) {
     87                        new_element = null;
     88                    }
     89
     90                    return new_element;
    5991                    break;
    6092            }
     
    6698                switch (arg) {
    6799                    case "bottom":
    68                         return jQuery().$Pamoorama(element);
     100                        return jQuery().$Pamoorama(element) ;
    69101                        break;
    70102                    case "left":
     103                        return jQuery().$Pamoorama(element) ;
     104                        break;
     105                    case "prototype_event_registry":
     106                        return jQuery().$Pamoorama(element) ;
     107                        break;
     108                    case "readystatechange":
    71109                        return jQuery().$Pamoorama(element);
    72110                        break;
     
    108146                            }
    109147                        //=======================================================
    110                         return jQuery(element);
     148                            return new_element;
    111149                        break;
    112150
     
    115153             { //=========== options luciano ===================================
    116154                 //=== theme Luciano ====
    117                  return jQuery().$Luciano(element, nc);
     155                 return ret_Luciano;
    118156             }
    119157        }
     
    122160     //==================================================
    123161     tpe = typeof (element);
    124     new_element = jQuery(element);
    125  
     162   
    126163    //========== test jQuery ? ==============
    127164
     
    143180    //=========== options pamoorama =================================== 
    144181    {
    145     tp1=typeof (element) ;
    146     if (tp1=="string")
     182     
     183    if (tpe=="string")
    147184        switch (jq) {
    148185            case "ie_ready":
     
    156193                break;
    157194
    158         }else if(tp1=="boolean")
     195        }else if(tpe=="boolean")
    159196        {
    160197            return jQuery().$Pamoorama(element);
     
    164201        if (el == "IMG") return jQuery().$Pamoorama(element);
    165202        if (el == "#document") return jQuery(element) ;
    166          jQuery().$Pamoorama(element);
    167     }
    168  
    169     if (jQuery("#Panorama").length > 0 && jq != "rateForm" && jq != "order" && jq != "themeSelect") {
     203        if (el == "BODY") {
     204            try { return jQuery().$Pamoorama(element) } catch (e) {
     205  return jQuery(element);
     206            };
     207         
     208        }
     209        if (element == window)
     210            return new_element;
     211       jQuery().$Pamoorama(element);
     212    }
     213    obj_panorama = jQuery("#Panorama");
     214    if (obj_panorama.length > 0 && jq != "rateForm" && jq != "order" && jq != "themeSelect") {
     215        if (tpe == "object")
     216            if (Prototype_Version != '0') {
     217                //=== rvmaps ===
     218                try { elem_retour=jQuery().$Protype(element);
     219                    return elem_retour;
     220                } catch (e) {
     221                     
     222                }
     223            }
     224
    170225        if (new_element.length < 2) return new_element;
    171226        if (new_element.length == 2) return jQuery(element).get(1);
     
    188243        if (new_element.context.loaded) {
    189244    //=== theme Luciano ====
    190         if (MooTools_version == "Luciano")  return jQuery().$Luciano(element, nc);
     245        if (MooTools_version == "Luciano")  return ret_Luciano;
    191246        //=== theme gally ? ====
    192247            return new_element;
     
    198253        if (MooTools_version == "Luciano") {
    199254            //=== theme Luciano ====
    200             new_element = jQuery().$Luciano(element, nc);
     255            new_element = ret_Luciano;
    201256            tp = new_element.nodeName + new_element.nodeType;
    202257            if (tp == "DIV1") return new_element;
     
    214269    if (Prototype_Version != '0') {
    215270        //=== rvmaps ===
    216 
    217         return jQuery().$Protype1602(element);
     271        try {
     272            return jQuery().$Protype(element);
     273        } catch (e) {
     274            return jQuery(element);
     275        }
    218276    }
    219277    return jQuery(element);
     
    222280
    223281//=========================================================
     282(function ($) {
     283              $.fn.panorama2 =
     284              function (height, width) {
     285               
     286           var src =jQuery(this);
     287
     288          return ;
     289
     290$("#theImage img").eq(0).removeAttr("style").attr({width:width,height:height});
     291retour= jQuery('a.panorama-control-left').click();
     292panoramaContainer=jQuery('panorama-container');
     293
     294            /*
     295                $(panoramaContainer).stop();
     296                op=options;
     297                settings.direction = 'right';
     298                panoramaContainer.panorama_animate(panoramaContainer, elemWidth, settings);
     299             */ 
     300               
     301
     302                           
     303
     304
     305              }
     306
     307
     308})(jQuery);
     309
     310
    224311jQuery.fn.extend({
    225312    //---------------- luciano -------------------------------
     
    253340    },
    254341    //===================================================
    255     $Protype1602: function (element) {
     342    $Protype: function (element) {
    256343        //======== prototype.js =====================
    257344        if (arguments.length > 1) {
Note: See TracChangeset for help on using the changeset viewer.