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,
				lines = [],
				header = opts.header || '$("#selector").' + opts.pluginName + "({",
				footer = "});",
				i;
			// Make a filtered copy of the option list (so we get the last ',' right)
			if(this.options.hideDefaults){
				availOptList = [];
				for(i=0; i<this.options.optionList.length; i++){
					var o = this.options.optionList[i],
						n = o.name,
						defVal = o.value;
					if($.isArray(defVal)){
						defVal = $.map(defVal, function(e){ return e.selected ? e.value : null;})[0];
					}
					if( actualOpts[n] !== defVal /*&& actualOpts[n] !== undefined*/){
						availOptList.push(o);
					}
				}
			}
			//
			lines.push(header);
			for(i=0; i<availOptList.length; i++){
				var o = availOptList[i],
					actualVal = actualOpts[o.name],
					line = "    " + o.name + ": ";
				if(typeof actualVal === "string"){
					line += '"' + actualVal + '"';
				}else if($.isPlainObject(actualVal)){
					line += JSON.stringify(actualVal);
				}else{
					line += "" + actualVal;
				}
				if( i < (availOptList.length - 1) ){
					line += ",";
				}
				if( opts.showComments ){
					line += " // " + o.hint;
				}
				lines.push(line);
			}
			lines.push(footer);
			$(opts.sourceTarget).addClass("ui-configurator-source").text(lines.join("\n"));
			this._trigger("render");
		}
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,
				lines = [],
				header = opts.header || '$("#selector").' + opts.pluginName + "({",
				footer = "});",
				i;
			// Make a filtered copy of the option list (so we get the last ',' right)
			if(this.options.hideDefaults){
				availOptList = [];
				for(i=0; i<this.options.optionList.length; i++){
					var o = this.options.optionList[i],
						n = o.name,
						defVal = o.value;
					if($.isArray(defVal)){
						defVal = $.map(defVal, function(e){ return e.selected ? e.value : null;})[0];
					}
					if( actualOpts[n] !== defVal /*&& actualOpts[n] !== undefined*/){
						availOptList.push(o);
					}
				}
			}
			//
			lines.push(header);
			for(i=0; i<availOptList.length; i++){
				var o = availOptList[i],
					actualVal = actualOpts[o.name],
					line = "    " + o.name + ": ";
				if(typeof actualVal === "string"){
					line += '"' + actualVal + '"';
				}else if($.isPlainObject(actualVal)){
					line += JSON.stringify(actualVal);
				}else{
					line += "" + actualVal;
				}
				if( i < (availOptList.length - 1) ){
					line += ",";
				}
				if( opts.showComments ){
					line += " // " + o.hint;
				}
				lines.push(line);
			}
			lines.push(footer);
			$(opts.sourceTarget).addClass("ui-configurator-source").text(lines.join("\n"));
			this._trigger("render");
		}
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 , lines = [ ] , header = opts . header || '$("#selector").' + opts . pluginName + "({" , footer = "});" , i ; // Make a filtered copy of the option list (so we get the last ',' right) if ( this . options . hideDefaults ) { availOptList = [ ] ; for ( i = 0 ; i < this . options . optionList . length ; i ++ ) { var o = this . options . optionList [ i ] , n = o . name , defVal = o . value ; if ( $ . isArray ( defVal ) ) { defVal = $ . map ( defVal , function ( e ) { return e . selected ? e . value : null ; } ) [ 0 ] ; } if ( actualOpts [ n ] !== defVal /*&& actualOpts[n] !== undefined*/ ) { availOptList . push ( o ) ; } } } // lines . push ( header ) ; for ( i = 0 ; i < availOptList . length ; i ++ ) { var o = availOptList [ i ] , actualVal = actualOpts [ o . name ] , line = "    " + o . name + ": " ; if ( typeof actualVal === "string" ) { line += '"' + actualVal + '"' ; } else if ( $ . isPlainObject ( actualVal ) ) { line += JSON . stringify ( actualVal ) ; } else { line += "" + actualVal ; } if ( i < ( availOptList . length - 1 ) ) { line += "," ; } if ( opts . showComments ) { line += " // " + o . hint ; } lines . push ( line ) ; } lines . push ( footer ) ; $ ( opts . sourceTarget ) . addClass ( "ui-configurator-source" ) . text ( lines . join ( "\n" ) ) ; this . _trigger ( "render" ) ; }
Render source code into source panel.
Render source code into source panel .