Fügt dem Tag den Initialisierer für ein JQueryUI-Widget hinzu

z. B. so:
<span id="element"></span>
<script type="text/javascript">$('#element').droppable({..})</script>
5397
public static function widget(Tag $tag, $name, $options = array()) {
    //$tag->addClass('\Psc\jquery-widget');
    
    $js = sprintf("%s(%s)",
                  $name, JSHelper::convertHashMap((object) $options)
                  );
    
    $tag->chain(new Code($js));
    
    return $tag;
  }
1307383
public function init()
    {

        //nazwa
        $this->addElement((new Element\Text('name'))
            ->setLabel('form.contact.option.name.label'));

        //wyślij wiadomość
        $this->addElement((new Element\Text('sendTo'))
            ->setLabel('form.contact.option.sendTo.label')
            ->setDescription('form.contact.option.sendTo.description')
            ->addValidator(new \Mmi\Validator\EmailAddressList([])));

        //submit
        $this->addElement((new Element\Submit('submit'))
            ->setLabel('form.contact.option.submit.label'));
    }
1324230
protected void init() {
        
        if(isZero()) {
            this.integerPart = "";
            this.decimalPart = "";
            return;
        }
        
        final StringBuilder sb = new StringBuilder();
        sb.append("#");
        if(scale > 0) {
            sb.append(".");
        }
        
        // 小数の精度分、書式を追加する。
        for(int i=0; i < scale; i++) {
            sb.append("#");
        }
        
        final DecimalFormat format = new DecimalFormat(sb.toString());
        format.setRoundingMode(RoundingMode.HALF_UP);
        
        double num = Math.abs(getValue());
        if(getPermilles() > 0) {
            num /= Math.pow(1000, getPermilles());
        }
        
        String str = format.format(num);
        
        // 数値を小数部と整数部に分割する。
        setupIntegerAndDecimalPart(str);
        
    }
932259
function init ($container, elementSelector, eventSelectors, handler) {
      $container = $container || $(document.body)

      // Handle control clicks
      function deferred () {
        var $control = $(this)
        handler($control, getToggledContent($control))
      }

      // Prepare ARIA attributes
      var $controls = $(elementSelector)
      $controls.each(initToggledContent)

      // Handle events
      $.each(eventSelectors, function (idx, eventSelector) {
        $container.on('click.' + selectors.namespace, eventSelector, deferred)
      })

      // Any already :checked on init?
      if ($controls.is(':checked')) {
        $controls.filter(':checked').each(deferred)
      }
    }
602866
function _abstract_annotation_widget(widget_type, placeholder,
					 placeholder_secondary){

	var anchor = this;

	// Create add button.
	var add_btn_args = {
    	    'generate_id': true,
    	    'type': 'button',
    	    'class': 'btn btn-success'
	};
	anchor.add_button = new tag('button', add_btn_args, 'Add');

	// The form control for the input area.
	var text_args = {
    	    'generate_id': true,
    	    //'type': 'text',
    	    'class': 'form-control',
    	    'placeholder': placeholder
	};
	if( widget_type == 'textarea' ){
	    text_args['type'] = 'text';
	    text_args['rows'] = '2';
	    anchor.text_input = new tag('textarea', text_args);
	}else if( widget_type == 'text' ){
	    text_args['type'] = 'text';
	    anchor.text_input = new tag('input', text_args);
	}else{ // 'source_ref'
	    text_args['type'] = 'text';
	    anchor.text_input = new tag('input', text_args);
	    // Gets a second input.
	    text_args['placeholder'] = placeholder_secondary;
	    anchor.text_input_secondary = new tag('input', text_args);	    
	}

	// Both placed into the larger form string.
	var form = [];
	if( widget_type == 'textarea' ){
	    form = [
		'<div>',
		'<div class="form-group">',
		anchor.text_input.to_string(),
		'</div>',
    		anchor.add_button.to_string(),
		'</div>'
	    ];
	}else if( widget_type == 'text' ){
	    form = [
    		'<div class="form-inline">',
    		'<div class="form-group">',
		anchor.text_input.to_string(),
    		'</div>',
    		anchor.add_button.to_string(),
    		'</div>'
	    ];
	}else{ // 'source_ref'
	    form = [
    		'<div class="form-inline">',
    		'<div class="form-group">',
		anchor.text_input.to_string(),
		'&nbsp;',
		anchor.text_input_secondary.to_string(),
    		'</div>',
    		anchor.add_button.to_string(),
    		'</div>'
	    ];
	}
	anchor.form_string = form.join('');
    }
773058
protected void initDropzone(Element e, Element template, String previews, Element uploadPreview, Element uploadedFiles) {
        JQueryElement previewNode = $(template);
        previewNode.asElement().setId("");
        String previewTemplate = previewNode.parent().html();
        options.previewTemplate = previewTemplate;
        options.previewsContainer = "#" + previews;
        uploader = new Dropzone(e, options);

        uploader.on(FileUploaderEvents.DROP, event -> {
            fireDropEvent();
            if (preview) {
                $(e).removeClass(CssName.ACTIVE);
            }
            return true;
        });

        uploader.on(FileUploaderEvents.DRAG_START, event -> {
            DragStartEvent.fire(this);
            return true;
        });

        uploader.on(FileUploaderEvents.DRAG_END, event -> {
            DragEndEvent.fire(this);
            return true;
        });

        uploader.on(FileUploaderEvents.DRAG_ENTER, event -> {
            DragEnterEvent.fire(this, null);
            if (preview) {
                $(e).addClass(CssName.ACTIVE);
            }
            return true;
        });

        uploader.on(FileUploaderEvents.DRAG_OVER, event -> {
            DragOverEvent.fire(this);
            return true;
        });

        uploader.on(FileUploaderEvents.DRAG_LEAVE, event -> {
            DragLeaveEvent.fire(this, null);
            if (preview) {
                $(e).removeClass(CssName.ACTIVE);
            }
            return true;
        });

        uploader.on(FileUploaderEvents.ADDED_FILE, file -> {
            AddedFileEvent.fire(this, convertUploadFile(file));
            totalFiles++;

            if (isPreview()) {
                $(uploadedFiles).html("Uploaded files " + totalFiles);
                getUploadPreview().getUploadHeader().getProgress().setPercent(0);
                getUploadPreview().setVisibility(Style.Visibility.VISIBLE);
            }
        });

        uploader.on(FileUploaderEvents.REMOVED_FILE, file -> {
            RemovedFileEvent.fire(this, convertUploadFile(file));
            totalFiles -= 1;
            $(uploadedFiles).html("Uploaded files " + totalFiles);

            if (totalFiles == 0 && isPreview()) {
                getUploadPreview().setVisibility(Style.Visibility.HIDDEN);
            }
        });

        uploader.on("error", (file, response) -> {
            int code = 200;
            String statusText = "";

            if (file.xhr != null) {
                code = file.xhr.status;
                statusText = file.xhr.statusText;
            }

            String body = "";

            if (response instanceof String) {
                body = (String)response;
            } else {
                statusText = getResponseMessage(response);
            }

            if (code == 401) {
                statusText = statusText.isEmpty() ? "Unauthorized. Your session may have expired. Log in and try again." : statusText;
                globalResponse = response;
                UnauthorizedEvent.fire(this, convertUploadFile(file), new UploadResponse(code, statusText, body));
            }

            if (code == 404) {
                statusText = statusText.isEmpty() ? "There is a problem uploading your file." : statusText;
                globalResponse = response;
            }

            if (code == 500) {
                statusText = statusText.isEmpty() ? "There is a problem uploading your file." : statusText;
                globalResponse = response;
            }


            ErrorEvent.fire(this, convertUploadFile(file), new UploadResponse(code, statusText, body));
        });

        uploader.on(FileUploaderEvents.TOTAL_UPLOAD_PROGRESS, (progress, file, response) -> {
            TotalUploadProgressEvent.fire(this, progress);
            if (isPreview()) {
                getUploadPreview().getUploadHeader().getProgress().setPercent(progress);
            }
        });

        uploader.on(FileUploaderEvents.UPLOAD_PROGRESS, (progress, file, response) -> {
            CurrentUploadProgressEvent.fire(this, progress);
            if ($this != null) {
                $this.find(".progress .determinate").css("width", progress + "%");
            }
        });

        uploader.on(FileUploaderEvents.SENDING, file -> {
            SendingEvent.fire(this, convertUploadFile(file),
                    new UploadResponse(file.xhr.status, file.xhr.statusText));
        });

        uploader.on(FileUploaderEvents.SUCCESS, (file, response) -> {
            globalResponse = response;
            String message = getResponseMessage(response);
            SuccessEvent.fire(this, convertUploadFile(file),
                    new UploadResponse(file.xhr.status, file.xhr.statusText, message));
        });

        uploader.on(FileUploaderEvents.COMPLETE, file -> {
            String message = getResponseMessage(globalResponse);
            CompleteEvent.fire(this, convertUploadFile(file),
                    new UploadResponse(file.xhr.status, file.xhr.statusText, message));
        });

        uploader.on(FileUploaderEvents.CANCELED, file -> {
            CanceledEvent.fire(this, convertUploadFile(file));
        });

        uploader.on(FileUploaderEvents.MAX_FILES_REACHED, file -> {
            MaxFilesReachedEvent.fire(this, convertUploadFile(file));
        });

        uploader.on(FileUploaderEvents.MAX_FILES_EXCEEDED, file -> {
            MaterialToast.fireToast("You have reached the maximum files to be uploaded.");
            MaxFilesExceededEvent.fire(this, convertUploadFile(file));
        });
    }
201779
function(e, ui) {
					var dst    = $(this),
						helper = ui.helper,
						cl     = hover+' '+dropover,
						hash, status;
					e.stopPropagation();
					helper.data('dropover', helper.data('dropover') + 1);
					dst.data('dropover', true);
					if (ui.helper.data('namespace') !== fm.namespace || ! insideNavbar(e.clientX) || ! fm.insideWorkzone(e.pageX, e.pageY)) {
						dst.removeClass(cl);
						helper.removeClass('elfinder-drag-helper-move elfinder-drag-helper-plus');
						return;
					}
					dst.addClass(hover);
					if (dst.is('.'+collapsed+':not(.'+expanded+')')) {
						dst.data('expandTimer', setTimeout(function() {
							dst.is('.'+collapsed+'.'+hover) && dst.children('.'+arrow).trigger('click');
						}, 500));
					}
					if (dst.is('.elfinder-ro,.elfinder-na')) {
						dst.removeClass(dropover);
						helper.removeClass('elfinder-drag-helper-move elfinder-drag-helper-plus');
						return;
					}
					hash = fm.navId2Hash(dst.attr('id'));
					dst.data('dropover', hash);
					$.each(ui.helper.data('files'), function(i, h) {
						if (h === hash || (fm.file(h).phash === hash && !ui.helper.hasClass('elfinder-drag-helper-plus'))) {
							dst.removeClass(cl);
							return false; // break $.each
						}
					});
					if (helper.data('locked')) {
						status = 'elfinder-drag-helper-plus';
					} else {
						status = 'elfinder-drag-helper-move';
						if (e.shiftKey || e.ctrlKey || e.metaKey) {
							status += ' elfinder-drag-helper-plus';
						}
					}
					dst.hasClass(dropover) && helper.addClass(status);
					requestAnimationFrame(function(){ dst.hasClass(dropover) && helper.addClass(status); });
				}
173249
function init () {

    $mdUtil.initOptionalProperties($scope, $attrs, {
      searchText: '',
      selectedItem: null,
      clearButton: false,
      disableVirtualRepeat: false,
    });

    $mdTheming($element);
    configureWatchers();
    $mdUtil.nextTick(function () {

      gatherElements();
      moveDropdown();

      // Forward all focus events to the input element when autofocus is enabled
      if ($scope.autofocus) {
        $element.on('focus', focusInputElement);
      }
      if ($scope.inputAriaDescribedBy) {
        elements.input.setAttribute('aria-describedby', $scope.inputAriaDescribedBy);
      }
      if (!$scope.floatingLabel) {
        if ($scope.inputAriaLabel) {
          elements.input.setAttribute('aria-label', $scope.inputAriaLabel);
        } else if ($scope.inputAriaLabelledBy) {
          elements.input.setAttribute('aria-labelledby', $scope.inputAriaLabelledBy);
        } else if ($scope.placeholder) {
          // If no aria-label or aria-labelledby references are defined, then just label using the
          // placeholder.
          elements.input.setAttribute('aria-label', $scope.placeholder);
        }
      }
    });
  }
175310
public function init()
    {
        $this->addElement((new Element\Text('url'))
            ->addValidator(new \Mmi\Validator\Regex(['/^https?:\/\/[a-z0-9\.\/]+$/', 'link nie jest poprawnym adresem HTTPS']))
            ->setDescription('form.connectorImportContentForm.url.description')
            ->setRequired()
            ->setLabel('form.connectorImportContentForm.url.label'));

        $this->addElement((new Element\Text('identity'))
            ->setLabel('form.connectorImportContentForm.identity.label')
            ->setRequired());

        $this->addElement((new Element\Password('credential'))
            ->setLabel('form.connectorImportContentForm.credential.label')
            ->setRequired());

        $this->addElement((new Element\Checkbox('acl'))
            ->setLabel('form.connectorImportContentForm.acl.label'));

        $this->addElement((new Element\Checkbox('content'))
            ->setLabel('form.connectorImportContentForm.content.label'));

        $this->addElement((new Element\Checkbox('file'))
            ->setLabel('form.connectorImportContentForm.file.label'));

        $this->addElement((new Element\Submit('submit'))
            ->setLabel('form.connectorImportContentForm.submit.label'));
    }
75885
function (ui, opts) {
    
		log("xxmlmirror.init");

		var $el = $(ui);
		var state = ($("div.xmlmirrorstate:first", $el).html() || "").trim();
		opts = $.extend({ defaultScript: state }, opts);

		$el.html(template.trim());

		var editor = null;
		(function iframeImplementation() {
			var iframe = $("iframe", ui);

			editor = ns.widgets.xmleditorInitIframe(iframe);

		})();

		if (opts.defaultScript) {
			editor.set(ns.modules.string.htmlDecode(opts.defaultScript));
		}

		var me = {};
		me.refresh = function () { editor.refresh(); };
		me.getXml = function () {
			var code = editor.get();
			return code;
		};
		me.setXml = function (xml) {
			editor.set(xml);
		};

		return me;
	}
861336
function init( element, value, bindings ) {
    var $el = $( element );
    var model = value();
    var allBindings = unwrap( bindings() );
    var options = ko.toJS( allBindings.froalaOptions );

    // initialize the editor
    $el.froalaEditor( options || {} );

    // provide froala editor instance for flexibility
    if( allBindings.froalaInstance && ko.isWriteableObservable( allBindings.froalaInstance ) ) {
      allBindings.froalaInstance( $el.data( 'froala.editor' ) );
    }

    // update underlying model whenever editor content changed
    var processUpdateEvent = function (e, editor) {
        if (ko.isWriteableObservable(model)) {
            var editorValue = editor.html.get();
            var current = model();
            if (current !== editorValue) {
                model(editorValue);
            }
        }
    }

    $el.on('froalaEditor.contentChanged', processUpdateEvent);
    $el.on('froalaEditor.paste.after', processUpdateEvent);

    // cleanup editor, when dom node is removed
    ko.utils.domNodeDisposal.addDisposeCallback( element, destroy( element ) );

    // do not handle child nodes
    return { controlsDescendantBindings: true };
  }
1086288
function(element, options) {
    this.widget = '';
    this.$element = $(element);
    this.defaultTime = options.defaultTime;
    this.disableFocus = options.disableFocus;
    this.disableMousewheel = options.disableMousewheel;
    this.isOpen = options.isOpen;
    this.minuteStep = options.minuteStep;
    this.modalBackdrop = options.modalBackdrop;
    this.orientation = options.orientation;
    this.secondStep = options.secondStep;
    this.snapToStep = options.snapToStep;
    this.showInputs = options.showInputs;
    this.showMeridian = options.showMeridian;
    this.showSeconds = options.showSeconds;
    this.template = options.template;
    this.appendWidgetTo = options.appendWidgetTo;
    this.showWidgetOnAddonClick = options.showWidgetOnAddonClick;
    this.icons = options.icons;
    this.maxHours = options.maxHours;
    this.explicitMode = options.explicitMode; // If true 123 = 1:23, 12345 = 1:23:45, else invalid.

    this.handleDocumentClick = function (e) {
      var self = e.data.scope;
      // This condition was inspired by bootstrap-datepicker.
      // The element the timepicker is invoked on is the input but it has a sibling for addon/button.
      if (!(self.$element.parent().find(e.target).length ||
          self.$widget.is(e.target) ||
          self.$widget.find(e.target).length)) {
        self.hideWidget();
      }
    };

    this._init();
  }
153873
function(element, options) {
        this.name = name;
        this.$ = $(element);
        this.id = $.zui.uuid();
        this.selectOrder = 1;
        this.selections = {};

        this.getOptions(options);
        this._init();
    }
794960
function(element, options) {
    this.widget = '';
    this.$element = $(element);
    this.defaultTime = options.defaultTime;
    this.disableFocus = options.disableFocus;
    this.isOpen = options.isOpen;
    this.minuteStep = options.minuteStep;
    this.modalBackdrop = options.modalBackdrop;
    this.secondStep = options.secondStep;
    this.showInputs = options.showInputs;
    this.showMeridian = options.showMeridian;
    this.showSeconds = options.showSeconds;
    this.template = options.template;
    this.appendWidgetTo = options.appendWidgetTo;

    this._init();
  }
508953
public function init()
    {
        parent::init();		
		echo Html::beginTag('div', ['class'=>'modal fade','id'=>$this->modalId,'role'=>"dialog"]);
		echo Html::beginTag('div', ['class'=>'modal-dialog '.$this->modalSize]);
		echo Html::beginTag('div', ['class'=>'modal-content']);
			echo Html::beginTag('div', ['class'=>'modal-header']);
				echo Html::beginTag('button', ['type'=>"button",'class'=>"close", 'data-dismiss'=>"modal"]);
					echo Html::beginTag('span', ['aria-hidden'=>"true"]);
					echo "&times;";
					echo Html::endTag('span');
					echo Html::beginTag('span', ['class'=>"sr-only"]);
					echo "Close";
					echo Html::endTag('span');
				echo Html::endTag('button');
				echo Html::beginTag('h4', ['class'=>"modal-title"]);		
				echo Html::endTag('h4');
			echo Html::endTag('div');
			echo Html::beginTag('div', ['class'=>'modal-body']);
				echo Html::beginTag('div', ['class'=>'content','style'=>'overflow:auto;']);		
				echo Html::endTag('div');
			echo Html::endTag('div');
			/* modal-footer tak hapus. Kayaknya ga pernah kepake. Biar tampilan modalnya bagus, ga ada garis bawah pengganggu
			echo Html::beginTag('div', ['class'=>'modal-footer']);
		
			echo Html::endTag('div');*/
		echo Html::endTag('div');
		echo Html::endTag('div');
		echo Html::endTag('div');
		if($this->registerAsset) ModalAsset::register($this->getView());
    }
302650
function(view, config, widget) {

		this.Element$init(view, config, widget);

		var self = this;

		this._IE_click_callback = function() {
			if (self._events['compatible_changed']) {
				Lava.view_manager.dispatchEvent(self._view, 'compatible_changed', null, self._events['compatible_changed']);
			}
		};

	}
713358
private void init() {

        getElement().setAttribute("contentEditable", "true");
        addStyleName(I_CmsLayoutBundle.INSTANCE.form().input());
        m_active = true;
    }