Ignore:
Timestamp:
Oct 13, 2010, 5:22:04 PM (14 years ago)
Author:
grum
Message:

Packing js files + add categorySelector functionnalities

Location:
extensions/GrumPluginClasses/js
Files:
7 added
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/GrumPluginClasses/js/criteriaBuilder.js

    r7142 r7175  
    6969{
    7070  var itemsId = {
    71     group:'iCbGroup',
    72     item:'iCbItem',
    73     container:container,
    74   }
    75 
    76   var counters = {
    77     group:0,
    78     item:0,
    79   }
    80 
    81   var options = {
    82       textAND:'AND',
    83       textOR:'OR',
    84       textHint:'',
    85       classGroup:'',
    86       classItem:'',
    87       classOperator:'',
    88       classHelper:'helper',
    89       opacity:0.8,
    90       onEdit:null,
    91       onDelete:null,
    92       onRequestSuccess:null,
    93       onRequestError:null,
    94       onGetPageSuccess:null,
    95       onGetPageError:null,
    96       imgEditUrl:'',
    97       imgDeleteUrl:'',
    98       ajaxUrl:'',
    99     };
    100 
    101   var extraData = new Array();
     71          group:'iCbGroup',
     72          item:'iCbItem',
     73          container:container,
     74        },
     75      counters = {
     76          group:0,
     77          item:0,
     78        },
     79      options = {
     80          textAND:'AND',
     81          textOR:'OR',
     82          textHint:'',
     83          classGroup:'',
     84          classItem:'',
     85          classOperator:'',
     86          classHelper:'helper',
     87          opacity:0.8,
     88          onEdit:null,
     89          onDelete:null,
     90          onRequestSuccess:null,
     91          onRequestError:null,
     92          onGetPageSuccess:null,
     93          onGetPageError:null,
     94          imgEditUrl:'',
     95          imgDeleteUrl:'',
     96          ajaxUrl:'',
     97        },
     98      extraData = new Array();
    10299
    103100  if(arguments.length==2)
     
    213210        break;
    214211    }
    215   }
     212  };
    216213
    217214  /**
     
    243240
    244241    applyNested();
    245   }
     242  };
    246243
    247244  /**
     
    253250  {
    254251    $('#'+groupId).remove();
    255   }
     252  };
    256253
    257254  /**
     
    292289
    293290    extraData[counters.item]=data;
    294   }
     291  };
    295292
    296293  /**
     
    309306      manage();
    310307    }
    311   }
     308  };
    312309
    313310  /**
     
    327324      extraData[eval(re.exec(itemId)[0])]=data;
    328325    }
    329   }
     326  };
    330327
    331328  /**
     
    339336    counters.group=0;
    340337    extraData=new Array();
    341   }
     338  };
    342339
    343340  /**
     
    370367    }
    371368    return(returned);
    372   }
     369  };
    373370
    374371
     
    410407
    411408    return(serialized);
    412   }
     409  };
    413410
    414411
     
    423420
    424421    return(extraData[extraDataNumber]);
    425   }
     422  };
    426423
    427424
     
    433430  {
    434431    options = jQuery.extend(options, optionsToSet);
    435   }
     432  };
    436433
    437434  /**
     
    465462      }
    466463    }
    467   }
     464  };
    468465
    469466  /**
     
    505502      }
    506503    );
    507   }
     504  };
    508505
    509506  /**
     
    531528      }
    532529    );
    533   }
     530  };
    534531
    535532  /**
     
    554551      $('#'+groupId+'OpOR').css('display', 'none');
    555552    }
    556   }
     553  };
    557554
    558555  /**
     
    580577     );
    581578
    582   }
     579  };
    583580
    584581  /**
     
    606603     );
    607604
    608   }
     605  };
    609606
    610607  applyNested();
  • extensions/GrumPluginClasses/js/pagesNavigator.js

    r7142 r7175  
    5656{
    5757  var itemsId = {
    58     first:'iNavFirst',
    59     last:'iNavLast',
    60     previous:'iNavPrevious',
    61     next:'iNavNext',
    62     pageNumber:'iNavPage',
    63     morePrevious:'iNavPrevMore',
    64     moreNext:'iNavNextMore',
    65     container:container,
    66   };
    67 
    68   var pages = {
    69     num:0,
    70     current:1,
    71   }
    72 
    73   var options = {
    74     numberItem:0,
    75     itemPerPage:25,
    76     defaultPage:0,
    77     displayNumPage:7,
    78     displayFirst:true,
    79     displayLast:true,
    80     displayPrevious:true,
    81     displayNext:true,
    82     hideMode:'1,<', // "1": hide nav if only 1 page to display, "<": hide nav First, Previous, Next & Last if num of page < displayNumPage
    83     textFirst:'&lt;&lt;',
    84     textLast:'&gt;&gt;',
    85     textPrevious:'&lt;',
    86     textNext:'&gt;',
    87     textMore:'...',
    88     onPageChange:null,
    89     classActive:'',
    90     classInactive:'',
    91     classDisabled:'',
    92   };
     58          first:'iNavFirst',
     59          last:'iNavLast',
     60          previous:'iNavPrevious',
     61          next:'iNavNext',
     62          pageNumber:'iNavPage',
     63          morePrevious:'iNavPrevMore',
     64          moreNext:'iNavNextMore',
     65          container:container,
     66        },
     67      pages = {
     68          num:0,
     69          current:1,
     70        },
     71      options = {
     72        numberItem:0,
     73        itemPerPage:25,
     74        defaultPage:0,
     75        displayNumPage:7,
     76        displayFirst:true,
     77        displayLast:true,
     78        displayPrevious:true,
     79        displayNext:true,
     80        hideMode:'1,<', // "1": hide nav if only 1 page to display, "<": hide nav First, Previous, Next & Last if num of page < displayNumPage
     81        textFirst:'&lt;&lt;',
     82        textLast:'&gt;&gt;',
     83        textPrevious:'&lt;',
     84        textNext:'&gt;',
     85        textMore:'...',
     86        onPageChange:null,
     87        classActive:'',
     88        classInactive:'',
     89        classDisabled:'',
     90      };
    9391
    9492
     
    110108        break;
    111109    }
    112   }
     110  };
    113111
    114112  /**
     
    122120  {
    123121    return(Math.ceil(numItems/numPerPage));
    124   }
     122  };
    125123
    126124  /**
     
    143141      build();
    144142    }
    145   }
     143  };
    146144
    147145  /**
     
    195193
    196194    $('#'+itemsId.container).css('visibility', 'visible');
    197   }
     195  };
    198196
    199197
     
    206204      prev=pages.current-1;
    207205    }
    208     next=options.displayNumPage-1-prev
     206    next=options.displayNumPage-1-prev;
     207
    209208    if(pages.current+next>=pages.num)
    210209    {
     
    283282    );
    284283
    285   }
     284  };
    286285
    287286
     
    325324    displayNav();
    326325    if(options.onPageChange!=null && jQuery.isFunction(options.onPageChange)) options.onPageChange(pages.current);
    327   }
     326  };
    328327
    329328  if(arguments.length==2)
  • extensions/GrumPluginClasses/js/simpleTip.js

    r6732 r7175  
    8181function simpleTip()
    8282{
    83   var items = new Array();
    84   var itemIndexInc = 0;
    85   var options={
    86     name:'',
    87   }
     83  var items = new Array(),
     84      itemIndexInc = 0,
     85      options={
     86          name:'',
     87        };
    8888
    8989  if(arguments.length>=1)
     
    134134        break;
    135135    }
    136   }
     136  };
    137137
    138138  var add = function (item, options)
     
    169169    }
    170170
    171   }
     171  };
    172172
    173173
     
    191191      items.splice(index,1);
    192192    }
    193   }
     193  };
    194194
    195195
     
    216216    }
    217217    itemIndexInc=0;
    218   }
     218  };
    219219
    220220
     
    228228    }
    229229    return(-1);
    230   }
     230  };
    231231
    232232  /**
     
    255255          display: 'block',
    256256        }
    257       )
     257      );
    258258
    259259    switch(items[itemIndex].options.targetPos)
     
    415415      .addClass(items[itemIndex].options.classes);
    416416
    417   }
     417  };
    418418
    419419  var show = function ()
    420420  {
    421421    $('#iSimpleTip'+options.name).css('display', 'block');
    422   }
     422  };
    423423
    424424  var hide = function ()
    425425  {
    426426    $('#iSimpleTip'+options.name).css('display', 'none');
    427   }
     427  };
    428428
    429429
     
    435435      $('body').append(text);
    436436    }
    437   }
     437  };
    438438
    439439
  • extensions/GrumPluginClasses/js/ui.iconSelector.js

    r7146 r7175  
    128128              if(opt) $.extend(options, opt);
    129129
    130               if(!data)
    131               {
    132                 $this.data('options', options);
    133                 options.initialized=false;
    134               }
     130              $this.data('options', options);
    135131
    136132              if(!properties)
     
    239235          {
    240236            // set images list values
    241             this.each(function()
    242               {
    243                 var $this=$(this);
    244                 privateMethods.setImages($this, list);
    245                 return($this);
     237            return this.each(function()
     238              {
     239                privateMethods.setImages($(this), list);
    246240              }
    247241            );
     
    250244          {
    251245            // return images list values
    252             var data = this.data('options');
    253 
    254             if(data)
    255             {
    256               return(data.images);
     246            var options = this.data('options');
     247
     248            if(options)
     249            {
     250              return(options.images);
    257251            }
    258252            else
     
    267261          {
    268262            // set numCols values
    269             this.each(function()
    270               {
    271                 var $this=$(this);
    272                 privateMethods.setCols($this, value);
    273                 return($this);
     263            return this.each(function()
     264              {
     265                privateMethods.setCols($(this), value);
    274266              }
    275267            );
     
    278270          {
    279271            // return images list values
    280             var data = this.data('options');
    281 
    282             if(data)
    283             {
    284               return(data.numCols);
     272            var options = this.data('options');
     273
     274            if(options)
     275            {
     276              return(options.numCols);
    285277            }
    286278            else
     
    295287          {
    296288            // set numRows values
    297             this.each(function()
    298               {
    299                 var $this=$(this);
    300                 privateMethods.setRows($this, value);
    301                 return($this);
     289            return this.each(function()
     290              {
     291                privateMethods.setRows($(this), value);
    302292              }
    303293            );
     
    306296          {
    307297            // return images list values
    308             var data = this.data('options');
    309 
    310             if(data)
    311             {
    312               return(data.numRows);
     298            var options = this.data('options');
     299
     300            if(options)
     301            {
     302              return(options.numRows);
    313303            }
    314304            else
     
    323313          {
    324314            // set cell width values
    325             this.each(function()
    326               {
    327                 var $this=$(this);
    328                 privateMethods.setCellWidth($this, value);
    329                 return($this);
     315            return this.each(function()
     316              {
     317                privateMethods.setCellWidth($(this), value);
    330318              }
    331319            );
     
    334322          {
    335323            // return images list values
    336             var data = this.data('options');
    337 
    338             if(data)
    339             {
    340               return(data.cellWidth);
     324            var options = this.data('options');
     325
     326            if(options)
     327            {
     328              return(options.cellWidth);
    341329            }
    342330            else
     
    351339          {
    352340            // set cell width values
    353             this.each(function()
    354               {
    355                 var $this=$(this);
    356                 privateMethods.setCellHeight($this, value);
    357                 return($this);
     341            return this.each(function()
     342              {
     343                privateMethods.setCellHeight($(this), value);
    358344              }
    359345            );
     
    362348          {
    363349            // return images list values
    364             var data = this.data('options');
    365 
    366             if(data)
    367             {
    368               return(data.cellHeight);
     350            var options = this.data('options');
     351
     352            if(options)
     353            {
     354              return(options.cellHeight);
    369355            }
    370356            else
     
    379365          {
    380366            // set selected value
    381             this.each(function()
    382               {
    383                 var $this=$(this);
    384                 privateMethods.setValue($this, value);
    385                 return($this);
     367            return this.each(function()
     368              {
     369                privateMethods.setValue($(this), value);
    386370              }
    387371            );
     
    390374          {
    391375            // return the selected value
    392             var data=this.data('options'),
     376            var options=this.data('options'),
    393377                properties=this.data('properties');
    394378
    395             if(data && properties && properties.index>-1)
    396             {
    397               return(data.images[properties.index]);
     379            if(options && properties && properties.index>-1 && properties.index<options.images.length)
     380            {
     381              return(options.images[properties.index]);
    398382            }
    399383            else
     
    408392          {
    409393            // set selected value
    410             this.each(function()
    411               {
    412                 var $this=$(this);
    413                 privateMethods.setEventPopup($this, value);
    414                 return($this);
     394            return this.each(function()
     395              {
     396                privateMethods.setEventPopup($(this), value);
    415397              }
    416398            );
     
    419401          {
    420402            // return the selected value
    421             var data=this.data('options');
    422 
    423             if(data)
    424             {
    425               return(data.popup);
     403            var options=this.data('options');
     404
     405            if(options)
     406            {
     407              return(options.popup);
    426408            }
    427409            else
     
    436418          {
    437419            // set selected value
    438             this.each(function()
    439               {
    440                 var $this=$(this);
    441                 privateMethods.setEventChange($this, value);
    442                 return($this);
     420            return this.each(function()
     421              {
     422                privateMethods.setEventChange($(this), value);
    443423              }
    444424            );
     
    447427          {
    448428            // return the selected value
    449             var data=this.data('options');
    450 
    451             if(data)
    452             {
    453               return(data.change);
     429            var options=this.data('options');
     430
     431            if(options)
     432            {
     433              return(options.change);
    454434            }
    455435            else
     
    458438            }
    459439          }
    460         }, // popup
    461 
    462     } // methods
     440        } // popup
     441
     442    }; // methods
    463443
    464444
     
    470450      updateListArea : function (object)
    471451        {
    472           var data=object.data('options'),
     452          var options=object.data('options'),
    473453              objects=object.data('objects'),
    474454              icon=objects.list.children().first(),
    475               width=icon.outerWidth()*data.numCols,
    476               height=icon.outerHeight()*data.numRows;
     455              width=icon.outerWidth()*options.numCols,
     456              height=icon.outerHeight()*options.numRows;
    477457
    478458          objects.listContainer.css(
     
    492472      setImages : function (object, value)
    493473        {
    494           var data=object.data('options'),
     474          var options=object.data('options'),
    495475              objects=object.data('objects'),
    496476              properties=object.data('properties');
    497           data.images=value;
     477          options.images=value;
    498478
    499479          objects.list.children().unbind();
    500480          objects.list.html('');
    501           for(var i=0;i<data.images.length;i++)
     481          for(var i=0;i<options.images.length;i++)
    502482          {
    503483            liClass=' ui-icon-selector-icon ';
     
    507487            }
    508488            objects.list.append(
    509               $('<li indexValue="'+i+'" class="'+liClass+'" style="display:inline-block;width:'+data.cellWidth+'px;height:'+data.cellHeight+'px;background-image:url('+data.images[i]+');"></li>')
     489              $('<li indexValue="'+i+'" class="'+liClass+'" style="display:inline-block;width:'+options.cellWidth+'px;height:'+options.cellHeight+'px;background-image:url('+options.images[i]+');"></li>')
    510490                .bind('click',
    511491                  {object:object},
     
    519499          }
    520500
    521           return(data.images);
     501          return(options.images);
    522502        },
    523503      setNumCols : function (object, value)
    524504        {
    525           var data=object.data('options'),
     505          var options=object.data('options'),
    526506              properties=object.data('properties');
    527           if((!properties.initialized || data.numCols!=value) && value>0)
    528           {
    529             data.numCols=value;
    530           }
    531           return(data.numCols);
     507          if((!properties.initialized || options.numCols!=value) && value>0)
     508          {
     509            options.numCols=value;
     510          }
     511          return(options.numCols);
    532512        },
    533513      setNumRows : function (object, value)
    534514        {
    535           var data=object.data('options'),
     515          var options=object.data('options'),
    536516              properties=object.data('properties');
    537           if((!properties.initialized || data.numRows!=value) && value>0)
    538           {
    539             data.numRows=value;
    540           }
    541           return(data.numRows);
     517          if((!properties.initialized || options.numRows!=value) && value>0)
     518          {
     519            options.numRows=value;
     520          }
     521          return(options.numRows);
    542522        },
    543523      setCellWidth : function (object, value)
    544524        {
    545           var data=object.data('options'),
     525          var options=object.data('options'),
    546526              properties=object.data('properties'),
    547527              objects=object.data('objects');
    548           if((!properties.initialized || data.cellWidth!=value) && value>=0)
    549           {
    550             data.cellWidth=value;
     528          if((!properties.initialized || options.cellWidth!=value) && value>=0)
     529          {
     530            options.cellWidth=value;
    551531            objects.container.css('width', value+'px');
    552532          }
    553           return(data.cellWidth);
     533          return(options.cellWidth);
    554534        },
    555535      setCellHeight : function (object, value)
    556536        {
    557           var data=object.data('options'),
     537          var options=object.data('options'),
    558538              properties=object.data('properties'),
    559539              objects=object.data('objects');
    560           if((!properties.initialized || data.cellHeight!=value) && value>=0)
    561           {
    562             data.cellHeight=value;
     540          if((!properties.initialized || options.cellHeight!=value) && value>=0)
     541          {
     542            options.cellHeight=value;
    563543            objects.container.css('height', value+'px');
    564544          }
    565           return(data.cellHeight);
     545          return(options.cellHeight);
    566546        },
    567547      setValue : function (object, value)
    568548        {
    569           var data=object.data('options'),
     549          var options=object.data('options'),
    570550              properties=object.data('properties'),
    571551              index=-1;
     
    574554          {
    575555            case ':first':
    576               if(data.images.length>0) index=0;
     556              if(options.images.length>0) index=0;
    577557              break;
    578558            case ':last':
    579               index=data.images.length-1;
     559              index=options.images.length-1;
    580560              break;
    581561            default:
    582               index=$.inArray(value, data.images);
     562              index=$.inArray(value, options.images);
    583563              break;
    584564          }
     
    588568            privateMethods.setValueByIndex(object, index, false);
    589569          }
    590           return(data.images[properties.index]);
     570          return(options.images[properties.index]);
    591571        },
    592572      setValueByIndex : function (object, value, trigger)
    593573        {
    594           var data=object.data('options'),
     574          var options=object.data('options'),
    595575              properties=object.data('properties'),
    596576              objects=object.data('objects');
    597           if((!properties.initialized || properties.index!=value) && value>-1 && value<data.images.length)
     577          if((!properties.initialized || properties.index!=value) && value>-1 && value<options.images.length)
    598578          {
    599579            objects.list.children('.ui-icon-selector-selected-icon').removeClass('ui-icon-selector-selected-icon');
    600580            objects.list.children('[indexValue="'+value+'"]').addClass('ui-icon-selector-selected-icon');
    601581            properties.index=value;
    602             objects.container.css('background-image', 'url('+data.images[properties.index]+')');
    603             if(trigger && data.change) object.trigger('iconSelectorChange', [properties.index]);
    604           }
    605           return(data.images[properties.index]);
     582            objects.container.css('background-image', 'url('+options.images[properties.index]+')');
     583            if(trigger && options.change) object.trigger('iconSelectorChange', [properties.index]);
     584          }
     585          return(options.images[properties.index]);
    606586        },
    607587      displaySelector : function (object, value)
    608588        {
    609           var data=object.data('options'),
     589          var options=object.data('options'),
    610590              properties=object.data('properties'),
    611591              objects=object.data('objects');
     
    625605              objects.listContainer.css('display', 'none');
    626606            }
    627             if(data.popup) object.trigger('iconSelectorPopup', [properties.selectorVisible]);
     607            if(options.popup) object.trigger('iconSelectorPopup', [properties.selectorVisible]);
    628608          }
    629609          return(properties.selectorVisible);
     
    631611      setEventPopup : function (object, value)
    632612        {
    633           var data=object.data('options');
    634           data.popup=value;
     613          var options=object.data('options');
     614          options.popup=value;
    635615          object.unbind('iconSelectorPopup');
    636           if(value) object.bind('iconSelectorPopup', data.popup);
    637           return(data.popup);
     616          if(value) object.bind('iconSelectorPopup', options.popup);
     617          return(options.popup);
    638618        },
    639619      setEventChange : function (object, value)
    640620        {
    641           var data=object.data('options');
    642           data.change=value;
     621          var options=object.data('options');
     622          options.change=value;
    643623          object.unbind('iconSelectorChange');
    644           if(value) object.bind('iconSelectorChange', data.change);
    645           return(data.change);
     624          if(value) object.bind('iconSelectorChange', options.change);
     625          return(options.change);
    646626        }
    647     }
     627    };
    648628
    649629
Note: See TracChangeset for help on using the changeset viewer.