1function FieldWidget() 2{ 3 this.type = "fieldrule" 4 5 this.init = function( $el, field, value ) { 6 $el.addClass( 'field-widget' ) 7 $el.data( 'widget', this ) 8 9 this.$el = $el; 10 this.field = field; 11 12 this.initEl( $el, field, value ) 13 } 14 15 this.initFieldEl = function( $el, $controlEl, field ) { 16 17 this.controlEl = $controlEl; 18 19 $controlWrapperEl = $("<div class='control-wrapper'></div>'") 20 $controlEl.appendTo( $controlWrapperEl ) 21 22 $controlWrapperEl.appendTo( $el ) 23 } 24 25 this.initLabeledFieldEl = function( $el, $controlEl, field ) { 26 27 $labelEl = $("<label></label>") 28 $labelEl.html( field.label ) 29 30 $labelEl.appendTo( $el ) 31 32 this.initFieldEl( $el, $controlEl, field ) 33 } 34 35 this.getValue = function() { 36 return null; 37 } 38 39 this.changed = function() {} 40 41} 42window.logicFieldWidgets = []; 43 44jQuery.widget( 'gc.fieldWidget', { 45 options: { 46 type: "string", 47 value: null, 48 field: null 49 }, 50 _create: function() { 51 var type = this.options.type; 52 var self = this; 53 if ( ! window.logicFieldWidgets[type] ) { 54 alert( "Unknown logic field widget type: " + type ) 55 } 56 var widget = new window.logicFieldWidgets[type] 57 widget.initEl( this.element, this.options.field, this.options.value ) 58 59 widget.changed = function() { 60 if ( self.options.changed ) { 61 self.options.changed( widget.getValue() ); 62 } 63 } 64 65 } 66});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.