/** * ----------------------------------------------------------------------------- * file: ui.inputRadio.js * file version: 1.0.1 * date: 2012-06-18 * * A jQuery plugin provided by the piwigo's plugin "GrumPluginClasses" * * ----------------------------------------------------------------------------- * Author : Grum * email : grum@piwigo.com * website : http://photos.grum.fr * * << May the Little SpaceFrog be with you ! >> * ----------------------------------------------------------------------------- * * * * * :: HISTORY :: * * | release | date | * | 1.0.0 | 2010/11/04 | first release * | | | * | 1.0.1 | 2012/06/18 | * improve memory managment * | | | * | | | * | | | * | | | * | | | * */ ( function($) { /* * plugin 'public' functions */ var publicMethods = { init : function (opt) { return this.each( function() { // default values for the plugin var $this=$(this), data = $this.data('options'), objects = $this.data('objects'), properties = $this.data('properties'), options = { disabled:[], hidden:[], value:'', change:null }; // if options given, merge it // if(opt) $.extend(options, opt); ==> options are set by setters $this.data('options', options); if(!properties) { $this.data('properties', { initialized:false, value:'', isValid:true } ); properties=$this.data('properties'); } if(!objects) { objects = { radio:[] }; $this.data('objects', objects); } $this.find('input[type=radio]').each( function (index, item) { objects.radio.push($(item)); $(item).attr('name', 'ir_'+$this.get(0).id).bind('click', function (event) { privateMethods.setValue($this, $(this).attr('value'), false); } ); } ); privateMethods.setOptions($this, opt); } ); }, // init destroy : function () { return this.each( function() { // default values for the plugin var $this=$(this), objects = $this.data('objects'); for(var i=0;i-1)); } return(privateMethods.getDisabled(object)); }, getDisabled : function (object) { var objects=object.data('objects'), returned=[]; for(var i=0;i-1) { if(objects.radio[i].parent().attr('nodeName')=='LABEL') { objects.radio[i].parent().hide(); } else { objects.radio[i].hide(); } } else { if(objects.radio[i].parent().attr('nodeName')=='LABEL') { objects.radio[i].parent().show(); } else { objects.radio[i].show(); } } } return(privateMethods.getHidden(object)); }, getHidden : function (object) { var objects=object.data('objects'), returned=[]; for(var i=0;i