Sha256: 061a1f109f18891ddde5bb082efff94d48f48553120beff069f148e5fbb5f71a

Contents?: true

Size: 1.83 KB

Versions: 10

Compression:

Stored size: 1.83 KB

Contents

// CytoField v0.1
// By MacKinley Smith
(function($){
	var defaults = {
		widget:{
			field:{
				
			}
		},
		events:{
			create:function(cy){},
			change:function(cy,event){},
			destroy:function(cy){}
		}
	};
	
	var methods = {
		init:function(options){
			return this.each(function(){
				var $this = $(this).addClass('cytoField');
				var settings = $.extend(true,{},defaults,options);
				
				// Setup widget
				
				
				$this.data('cytoField',settings);
				methods.resize.apply($this);
			});
		},
		resize:function(){
			return this.each(function(){
				var $this = $(this);
				var settings = $this.data('cytoField');
				if (settings==null) return console.warn("You must instantiate $.cytoField before you call the resize method!");
				$this.width("100%");
				setTimeout(function(){
					$this.width($this.width()-16);
				},1);
			});
		},
		destroy:function(){
			return this.each(function(){
				
			});
		}
	};
	
	$.fn.cytoField=function(method){
		if (methods[method]) return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
		else if (typeof method == 'object' || !method) return methods.init.apply(this,arguments);
		else $.error('Method ' + method + ' does not exist on $.cytoField!');
	};
	
	$(window).resize(function(){$('.cytoField').cytoField('resize');});
	$.Cytoplasm("ready",function(){
		$.Cytoplasm("addStyles","cytofield_styles",{
			".cytoField":{
				width:"100%",
				border:"1px solid #aaa",
				"border-radius":"5px",
				"font":$.Cytoplasm("vars","fonts.sizes.normal")+" "+$.Cytoplasm("vars","fonts.faces.regular"),
				"box-shadow":"inset 0px 0px 5px rgba(0,0,0,0.25)",
				"&[type=text],&[type=password],&[type=email]":{
					height:"28px",
					padding:"0px 7px"
				}
			},
			"textarea.cytoField":{
				resize:"none",
				height:"200px",
				padding:"7px"
			}
		});
		$('.cytoField').cytoField();
	});
})(jQuery);

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cytoplasm-0.4.5 app/assets/javascripts/cytoplasm/cytoField.js.erb
cytoplasm-0.4.4 app/assets/javascripts/cytoplasm/cytoField.js.erb
cytoplasm-0.4.3 app/assets/javascripts/cytoplasm/cytoField.js.erb
cytoplasm-0.4.2 app/assets/javascripts/cytoplasm/cytoField.js.erb
cytoplasm-0.4.1 app/assets/javascripts/cytoplasm/cytoField.js.erb
cytoplasm-0.4.0 app/assets/javascripts/cytoplasm/cytoField.js.erb
cytoplasm-0.3.9 app/assets/javascripts/cytoplasm/cytoField.js.erb
cytoplasm-0.3.8 app/assets/javascripts/cytoplasm/cytoField.js.erb
cytoplasm-0.3.7 app/assets/javascripts/cytoplasm/cytoField.js.erb
cytoplasm-0.3.6 app/assets/javascripts/cytoplasm/cytoField.js.erb