source: extensions/GrumPluginClasses/js/ui.inputStatusBar.min.js @ 9683

Last change on this file since 9683 was 8961, checked in by grum, 14 years ago

release 3.4.0
fix bug:1984, bug:2109
js file are minified, remove packed files

  • Property svn:executable set to *
File size: 3.1 KB
Line 
1/* file: ui.inputStatusBar.js - v1.0.0 | minified on 2011/01/27 with http://jscompress.com/ */
2(function($)
3{var publicMethods={init:function(opt)
4{return this.each(function()
5{var $this=$(this),data=$this.data('options'),objects=$this.data('objects'),properties=$this.data('properties'),options={items:[]};$this.data('options',options);if(!properties)
6{$this.data('properties',{initialized:false,id:$this.get(0).id});properties=$this.data('properties');}
7if(!objects)
8{objects={table:$('<table/>',{'class':'ui-inputStatusBar',css:{width:'100%'}}),tr:$('<tr/>'),td:[]};$this.html('').append(objects.table.append(objects.tr));$this.data('objects',objects);}
9privateMethods.setOptions($this,opt);});},destroy:function()
10{return this.each(function()
11{var $this=$(this),objects=$this.data('objects');objects.tr.remove();objects.table.remove();$this.unbind('.inputStatusBar').css({width:'',height:''});});},options:function(value)
12{return(this.each(function()
13{privateMethods.setOptions($(this),value);}));},items:function(fct,value)
14{if((fct=='add'||fct=='remove'||fct=='set')&&value!=null)
15{return(this.each(function()
16{privateMethods.setItems($(this),fct,value);}));}
17else if(fct=='get'&&value!=null)
18{var options=this.data('options');return(options.items[value]);}
19else
20{var options=this.data('options');return(options.items);}}};var privateMethods={setOptions:function(object,value)
21{var properties=object.data('properties'),options=object.data('options');if(!$.isPlainObject(value))return(false);properties.initialized=false;privateMethods.setItems(object,'init',(value.items!=null)?value.items:options.items);properties.initialized=true;},setItems:function(object,fct,value)
22{var options=object.data('options'),properties=object.data('properties'),objects=object.data('objects'),index=-1;if(value.id==null&&!$.isArray(value))return(false);if(value.id!=null)index=privateMethods.findItemById(object,value.id);if(fct=='add'&&value.id!=null&&index==-1)
23{if(value.content==null)value.content=' ';if(value.width==null)value.width='';if(value.title==null)value.title='';var td=$('<td/>',{id:properties.id+value.id,html:value.content,title:value.title,css:{width:value.width}});objects.td.push({id:value.id,td:td});objects.tr.append(td);options.items.push(value);}
24else if(fct=='remove'&&value.id!=null&&index>-1)
25{if(index>-1)
26{objects.td[index].td.remove();objects.td.splice(index,1);options.items.splice(index,1);delete options.items[value.id];}}
27else if(fct=='set'&&value.id!=null&&index>-1&&value.content!=null)
28{if(value.title==null)value.title='';objects.td[index].td.html(value.content).attr('title',value.title);}
29else if(fct=='init')
30{for(var i in value)
31{privateMethods.setItems(object,'add',value[i]);}}
32return(true);},findItemById:function(object,id)
33{var objects=object.data('objects');for(var i=0;i<objects.td.length;i++)
34{if(objects.td[i].id==id)return(i);}
35return(-1);}};$.fn.inputStatusBar=function(method)
36{if(publicMethods[method])
37{return publicMethods[method].apply(this,Array.prototype.slice.call(arguments,1));}
38else if(typeof method==='object'||!method)
39{return publicMethods.init.apply(this,arguments);}
40else
41{$.error('Method '+method+' does not exist on jQuery.inputStatusBar');}}})(jQuery);
Note: See TracBrowser for help on using the repository browser.