lib/jquery.configurator.js
function(){
			var plugin = $(this.element).data("ui-" + this.options.pluginName) || $(this.element).data(this.options.pluginName),
				opts = this.options,
				actualOpts = plugin.options,
				availOptList = opts.optionList,
				$opts = $(this.options.optionTarget).empty(),
				$ul = $("<ul>").appendTo($opts),
				$li = null;
			$.each(availOptList, function(i, o){
				if( typeof o.value === "boolean"){
					$li = $("<li>").append(
						$("<input>", {
							id: o.name,
							name: o.name,
							type: "checkbox",
							checked: !!actualOpts[o.name]  //o.value
						})
					).append(
						$("<label>", {"for": o.name, text: " " + o.hint})
					);
				}else if( typeof o.value === "number" || typeof o.value === "string"){
					$li = $("<li>").append(
							$("<label>", {"for": o.name, text: " " + o.name})
						).append(
							$("<input>", {
								id: o.name,
								name: o.name,
								type: "text",
								value: actualOpts[o.name] //o.value
							})
						);
				}else if( $.isArray(o.value) ){
					$li = $("<li>")
						.append(
							$("<label>", {"for": o.name, text: " " + o.name})
						).append(
							$("<select>", {
								id: o.name,
								name: o.name,
								size: 1
							})
						);
					var $sel = $li.find("select");
					$.each(o.value, function(){
						$sel.append($("<option>", {
							value: this.value,
							text: this.name,
							selected: (actualOpts[o.name] == this.value)  //this.selected
						}));
					});
				}
				$ul.append($li);
			});
		}
function(){
			var plugin = $(this.element).data("ui-" + this.options.pluginName) || $(this.element).data(this.options.pluginName),
				opts = this.options,
				actualOpts = plugin.options,
				availOptList = opts.optionList,
				$opts = $(this.options.optionTarget).empty(),
				$ul = $("<ul>").appendTo($opts),
				$li = null;
			$.each(availOptList, function(i, o){
				if( typeof o.value === "boolean"){
					$li = $("<li>").append(
						$("<input>", {
							id: o.name,
							name: o.name,
							type: "checkbox",
							checked: !!actualOpts[o.name]  //o.value
						})
					).append(
						$("<label>", {"for": o.name, text: " " + o.hint})
					);
				}else if( typeof o.value === "number" || typeof o.value === "string"){
					$li = $("<li>").append(
							$("<label>", {"for": o.name, text: " " + o.name})
						).append(
							$("<input>", {
								id: o.name,
								name: o.name,
								type: "text",
								value: actualOpts[o.name] //o.value
							})
						);
				}else if( $.isArray(o.value) ){
					$li = $("<li>")
						.append(
							$("<label>", {"for": o.name, text: " " + o.name})
						).append(
							$("<select>", {
								id: o.name,
								name: o.name,
								size: 1
							})
						);
					var $sel = $li.find("select");
					$.each(o.value, function(){
						$sel.append($("<option>", {
							value: this.value,
							text: this.name,
							selected: (actualOpts[o.name] == this.value)  //this.selected
						}));
					});
				}
				$ul.append($li);
			});
		}
function ( ) { var plugin = $ ( this . element ) . data ( "ui-" + this . options . pluginName ) || $ ( this . element ) . data ( this . options . pluginName ) , opts = this . options , actualOpts = plugin . options , availOptList = opts . optionList , $opts = $ ( this . options . optionTarget ) . empty ( ) , $ul = $ ( "<ul>" ) . appendTo ( $opts ) , $li = null ; $ . each ( availOptList , function ( i , o ) { if ( typeof o . value === "boolean" ) { $li = $ ( "<li>" ) . append ( $ ( "<input>" , { id : o . name , name : o . name , type : "checkbox" , checked : ! ! actualOpts [ o . name ] //o.value } ) ) . append ( $ ( "<label>" , { "for" : o . name , text : " " + o . hint } ) ) ; } else if ( typeof o . value === "number" || typeof o . value === "string" ) { $li = $ ( "<li>" ) . append ( $ ( "<label>" , { "for" : o . name , text : " " + o . name } ) ) . append ( $ ( "<input>" , { id : o . name , name : o . name , type : "text" , value : actualOpts [ o . name ] //o.value } ) ) ; } else if ( $ . isArray ( o . value ) ) { $li = $ ( "<li>" ) . append ( $ ( "<label>" , { "for" : o . name , text : " " + o . name } ) ) . append ( $ ( "<select>" , { id : o . name , name : o . name , size : 1 } ) ) ; var $sel = $li . find ( "select" ) ; $ . each ( o . value , function ( ) { $sel . append ( $ ( "<option>" , { value : this . value , text : this . name , selected : ( actualOpts [ o . name ] == this . value ) //this.selected } ) ) ; } ) ; } $ul . append ( $li ) ; } ) ; }
Render checkboxes and other controls into configurator panel.
Render checkboxes and other controls into configurator panel .