Register client assets

return @void
324483
protected function registerAssets()
    {
        $view = $this->getView();
        $clientOptions = Json::encode($this->clientOptions);
        $js = 'jQuery("div#' . $this->options['id'] . '").raty(' . $clientOptions . ');';
        $view->registerJs($js);
    }
375899
public function registerClientScript()
    {

        /* publish assets dir */
        $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
        $assetsUrl = $this->getAssetsUrl($path);

        /* @var $cs CClientScript */
        $cs = Yii::app()->getClientScript();

        $cs->registerCssFile($assetsUrl . '/css/jquery.fileupload-ui.css');

        // Upgrade widget factory
        // @todo remove when jquery.ui 1.9+ is fully integrated into stable Yii versions
        $cs->registerScriptFile($assetsUrl . '/js/vendor/jquery.ui.widget.js', CClientScript::POS_END);

        //The Templates plugin is included to render the upload/download listings
        $cs->registerScriptFile($assetsUrl . '/js/tmpl.min.js', CClientScript::POS_END);

        if ($this->previewImages || $this->imageProcessing) {
            $cs->registerScriptFile($assetsUrl . '/js/load-image.min.js', CClientScript::POS_END);
            $cs->registerScriptFile($assetsUrl . '/js/canvas-to-blob.min.js', CClientScript::POS_END);
            // gallery :)
            $this->getYiiWheels()->registerAssetCss("bootstrap-image-gallery.min.css");
            $this->getYiiWheels()->registerAssetJs("bootstrap-image-gallery.min.js", CClientScript::POS_END);
        }
        //The Iframe Transport is required for browsers without support for XHR file uploads
        $cs->registerScriptFile($assetsUrl . '/js/jquery.iframe-transport.js', CClientScript::POS_END);
        $cs->registerScriptFile($assetsUrl . '/js/jquery.fileupload.js', CClientScript::POS_END);

        // The File Upload image processing plugin
        if ($this->imageProcessing) {
            $cs->registerScriptFile($assetsUrl . '/js/jquery.fileupload-ip.js', CClientScript::POS_END);
        }
        // The File Upload file processing plugin
        if ($this->previewImages) {
            $cs->registerScriptFile($assetsUrl . '/js/jquery.fileupload-fp.js', CClientScript::POS_END);
        }
        // locale
        $cs->registerScriptFile($assetsUrl . '/js/jquery.fileupload-locale.js', CClientScript::POS_END);

        //The File Upload user interface plugin
        $cs->registerScriptFile($assetsUrl . '/js/jquery.fileupload-ui.js', CClientScript::POS_END);

        /* initialize plugin */
        $selector = '#' . TbArray::getValue('id', $this->htmlOptions, $this->getId());

        $this->getApi()->registerPlugin('fileupload', $selector, $this->options);
    }
946950
public function registerAssets()
    {
        $view = $this->getView();
        RemoteModalAsset::register($view);
 	$uuid = uniqid();

    	$js = "rm_$uuid = new RemoteModal('#$this->id');\n";
    	$js .= "$(document).on('click', '[role=\"$this->id\"]', function (event){ \n ";
        $js .= "event.preventDefault(); \n";
        $js.= "rm_$uuid.open(this, null);\n";
    	$js .="});\n";
	$view->registerJs($js,\yii\web\View::POS_READY);
    }
883625
public function registerClientScript()
    {
        $options = $this->getClientOptions();
        $options = empty($options) ? '' : Json::encode($options);
        $id = $this->imageOptions['id'];
        $view = $this->getView();
        CaptchaAsset::register($view);
        $view->registerJs("jQuery('#$id').yiiMbCaptcha($options);");
    }
133409
protected function registerRegional()
    {
        $this->clientOptions['lang'] = ArrayHelper::getValue($this->clientOptions, 'lang', Yii::$app->language);
        $langAsset = 'lang/' . $this->clientOptions['lang'] . '.js';
        if (file_exists($this->sourcePath . DIRECTORY_SEPARATOR . $langAsset)) {
            $this->assetBundle->js[] = $langAsset;
        } else {
            ArrayHelper::remove($this->clientOptions, 'lang');
        }

    }
366510
public function registerCustomClientScript()
    {
        /* publish assets dir */
        $path = __DIR__ . DIRECTORY_SEPARATOR . 'assets';
        $assetsUrl = $this->getAssetsUrl($path);

        /** @var $cs CClientScript */
        $cs = Yii::app()->getClientScript();

        $fixedHeaderJs = '';
        if ($this->fixedHeader) {
            $cs->registerScriptFile(
                $assetsUrl . '/js/jquery.stickytableheaders' . (!YII_DEBUG ? '.min' : '') . '.js',
                CClientScript::POS_END
            );
            $fixedHeaderJs = "$('#{$this->id} table.items').stickyTableHeaders({fixedOffset:{$this->headerOffset}});";
            $this->componentsAfterAjaxUpdate[] = $fixedHeaderJs;
        }

        $cs->registerScript(
            __CLASS__ . '#Wh' . $this->id,
            '$grid = $("#' . $this->id . '");' .
            $fixedHeaderJs . '
			if ($(".' . $this->extendedSummaryCssClass . '", $grid).length)
			{
				$(".' . $this->extendedSummaryCssClass . '", $grid).html($("#' . $this->id . '-extended-summary", $grid).html());
			}
			' . (count($this->componentsReadyScripts) ? implode("\n", $this->componentsReadyScripts) : '') . '
			$.ajaxPrefilter(function (options, originalOptions, jqXHR) {
				var qs = $.deparam.querystring(options.url);
				if (qs.hasOwnProperty("ajax") && qs.ajax == "' . $this->id . '")
				{
					options.realsuccess = options.success;
					options.success = function(data)
					{
						if (options.realsuccess) {
							options.realsuccess(data);
							var $data = $("<div>" + data + "</div>");
							// we need to get the grid again... as it has been updated
							if ($(".' . $this->extendedSummaryCssClass . '", $("#' . $this->id . '")))
							{
								$(".' .
            $this->extendedSummaryCssClass .
            '", $("#' . $this->id .
            '")).html($("#' . $this->id .
            '-extended-summary", $data).html());
        }
        ' .
            (count($this->componentsAfterAjaxUpdate)
                ? implode("\n", $this->componentsAfterAjaxUpdate)
                : '') .
            '
        }
    }
}
});'
        );
    }
206967
public function registerClientScript()
    {
        /* publish assets dir */
        $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
        $assetsUrl = $this->getAssetsUrl($path);

        /* @var $cs CClientScript */
        $cs = Yii::app()->getClientScript();

        $cs->registerScriptFile($assetsUrl . '/js/jquery.mask.js');

        /* initialize plugin */
        $selector = '#' . TbArray::getValue('id', $this->htmlOptions, $this->getId());

        $options = !empty($this->pluginOptions) ? CJavaScript::encode($this->pluginOptions) : '{}';
        $script = "jQuery('{$selector}').mask('{$this->mask}',{$options});";
        Yii::app()->clientScript->registerScript((uniqid(__CLASS__ . '#', true)), $script, CClientScript::POS_END);
    }
1124708
protected function registerAssets()
    {
        $view = $this->getView();
        PieAsset::register($view);

        $js = 'var pie' . ucfirst($this->getId()) . ' = new d3pie(' . $this->getId() . ', ' . Json::encode($this->pieOptions) . ');';
        $view->registerJs($js);

    }
5853
public function registerClientScript()
    {
        /* publish assets dir */
        $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
        $assetsUrl = $this->getAssetsUrl($path);

        /* @var $cs CClientScript */
        $cs = Yii::app()->getClientScript();

        $cs->registerCssFile($assetsUrl . '/css/bootstrap-formhelpers.css');
        $cs->registerScriptFile($assetsUrl . '/js/bootstrap-formhelpers-timepicker.js');

        /* initialize plugin */
        // $selector = '#' . TbArray::getValue('id', $this->htmlOptions, $this->getId());
        // $this->getApi()->registerPlugin('bfhdatepicker', $selector, $this->pluginOptions);

    }
805212
protected function registerAssetPublisher(): void
    {
        $this->app->singleton('asset.publisher', function (Application $app) {
            $publicPath = $app->publicPath();

            // The asset "publisher" is responsible for moving package's assets into the
            // web accessible public directory of an application so they can actually
            // be served to the browser. Otherwise, they would be locked in vendor.
            $publisher = new Asset($app->make('files'), $publicPath);

            $publisher->setPackagePath($app->basePath().'/vendor');

            return $publisher;
        });
    }
1187926
public function register()
    {
        $this->app->singleton('asset', function ($app, $parameters = []) {
            if (count($parameters) < 2) {
                $parameters = array_merge($parameters, [null]);
            }
            list($dir, $path) = $parameters;

            return new Asset($dir, $path);
        });

        $this->app->bind('manifest', function ($app, $parameters = []) {
            if (count($parameters) < 2) {
                $parameters = array_merge($parameters, [null]);
            }
            list($dir, $path) = $parameters;

            return new Manifest($dir, $path);
        });

        // TODO: Allow to register or not Larasset commands in production env with a config option
        if ($this->app->environment() !== 'production' && $this->app['config']->get('app.debug')) {
            // For security reasons Larasset commands aren't available in production environment
            $this->registerCommands();
        }

        // TODO: Allow to publish default package.json in the config path of the package
    }
664408
protected function registerClientScript()
    {
        $view = $this->getView();
        $options = Json::encode($this->jsOptions);
        Asset::register($view);
        $view->registerJs('jQuery.communication(' . $options . ');');
    }
308515
public function registerAssetFactory()
    {
        $this->app->singleton('asset.factory', function ($app) {
            return new AssetFactory($app['assets.collection'], $app);
        });

        $this->app->alias('asset.factory', AssetFactory::class);
    }
224224
public function registerAssets()
    {
        $view = $this->getView();
        NotifyAsset::register($view);

        $config = [
            'type' => $this->type,
            'closable' => $this->closable,
            'transition' => $this->transition,
            'fadeOut' => $this->fadeOut,
            'message' => $this->message,
            'onClose' => new JsExpression($this->onClose),
            'onClosed' => new JsExpression($this->onClosed)
        ];
        $defaults = Json::encode($config);

        $js = <<<SCRIPT
;(function($, window, document, undefined) {
    $('.alert').toNotify({$defaults}, $('#talmaNotify')).show();
})(window.jQuery, window, document);
SCRIPT;
        $view->registerJs($js);
    }
1155830
public function registerClientScript()
    {
        /* publish assets dir */
        $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
        $assetsUrl = $this->getAssetsUrl($path);

        /* @var $cs CClientScript */
        $cs = Yii::app()->getClientScript();

        $cs->registerScriptFile($assetsUrl . '/js/ace.js', CClientScript::POS_END);

        $id = TbArray::getValue('id', $this->htmlOptions, $this->getId());

        /* Global value that will hold the editor */
        $cs->registerScript(uniqid(__CLASS__ . '#' . $id, true), 'var ' . $id . ';', CClientScript::POS_HEAD);

        ob_start();
        /* initialize plugin */
        $selector = TbArray::getValue('id', $this->htmlOptions, $this->getId());

        echo $selector . '= ace.edit("' . $id . '");' . PHP_EOL;
        echo $selector . '.setTheme("ace/theme/' . $this->theme . '");' . PHP_EOL;
        echo $selector . '.getSession().setMode(' . (is_array($this->mode) ? CJavaScript::encode(
                $this->mode
            ) : '"ace/mode/' . $this->mode . '"') . ');' . PHP_EOL;
        echo $selector . '.setValue($("#' . $this->htmlOptions['textareaId'] . '").val());' . PHP_EOL;
        echo $selector . '.getSession().on("change", function(){
                var theVal = ' . $selector . '.getSession().getValue();
                $("#' . $this->htmlOptions['textareaId'] . '").val(theVal);
            });';

        if (!empty($this->events) && is_array($this->events)) {
            foreach ($this->events as $name => $handler) {
                $handler = ($handler instanceof CJavaScriptExpression)
                    ? $handler
                    : new CJavaScriptExpression($handler);

                echo $id . ".getSession().on('{$name}', {$handler});" . PHP_EOL;
            }
        }

        if (!empty($this->pluginOptions))
            echo $selector . '.setOptions(' . CJavaScript::encode($this->pluginOptions) . ')';

        $cs->registerScript(uniqid(__CLASS__ . '#ReadyJS' . $id, true), ob_get_clean());
    }
600391
public function registerAssets()
    {
        $data = $this->getData();

        // Read the assets manifest file if it exists
        $manifest = $this->loadManifest();

        if (isset($data['styles']))
        {
            foreach ($data['styles'] as $handle => $props)
            {
                $this->handleStyleAction('register', $handle, $props, $manifest);
            }
        }

        if (isset($data['scripts']))
        {
            foreach ($data['scripts'] as $handle => $props)
            {
                $this->handleScriptAction('register', $handle, $props, $manifest);
            }
        }
    }
1279885
protected function registerClientScript()
    {
        /* publish assets dir */
        $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
        $assetsUrl = $this->getAssetsUrl($path);

        /* @var $cs CClientScript */
        $cs = Yii::app()->getClientScript();

        $cs->registerScriptFile($assetsUrl . '/js/highcharts.js');

        /* register required files */
        $defaultOptions = array('exporting' => array('enabled' => true));

        $this->pluginOptions = CMap::mergeArray($defaultOptions, $this->pluginOptions);

        if (isset($this->pluginOptions['exporting']) && @$this->pluginOptions['exporting']['enabled']) {
            $cs->registerScriptFile($assetsUrl . '/js/modules/exporting.js');
        }

        if ($theme = TbArray::getValue('theme', $this->pluginOptions)) {
            $cs->registerScriptFile($assetsUrl . '/js/themes/' . $theme . '.js');
        }

        $options = CJavaScript::encode($this->pluginOptions);

        $cs->registerScript(
            __CLASS__ . '#' . $this->getId(),
            "var highchart{$this->getId()} = new Highcharts.Chart({$options});"
        );
    }