Подключение внешнего скрипта, реально лежащего в корне сайта
@param string $js
508784
function add($js, $condition = null, $no_build = false) {
        //если начинается с / значит надо в урл добавить хост
        if (mb_strpos($js, '/') === 0) {
            $js = $this->host() . $js;
        }
        $this->js_external[$js] = array(
            'condition' => $condition,
            'no_build' => $no_build,
        );
        return $this;
    }
659425
protected function unlock($js)
	{
		if (empty($this->locks))
		{
			return $js;
		}

		foreach ($this->locks as $lock => $replacement)
		{
			$js = str_replace($lock, $replacement, $js);
		}

		return $js;
	}
608719
final public static function js(array $params)
    {
        return ("<script type='text/javascript' src='".
            FEnv::get("host.web.components.apps").strtolower(FEnv::get("framework.env"))."/".
            strtolower(FEnv::get("app.call"))."/".
            ((isset($params['path']))? $params['path']."." : "")."js'></script>");
    }
300003
public function compile(JsUtils $js=NULL, &$view=NULL) {
		$this->setProperty("class", "nav nav-".$this->_tabsType." ".$this->stacked);
		return parent::compile($js, $view);
	}
1242053
protected function initialize($js, $options)
	{
		$this->options = array_merge(static::$defaultOptions, $options);
		$js            = str_replace("\r\n", "\n", $js);
		$js            = str_replace('/**/', '', $js);
		$this->input   = str_replace("\r", "\n", $js);

		// We add a newline to the end of the script to make it easier to deal
		// with comments at the bottom of the script- this prevents the unclosed
		// comment error that can otherwise occur.
		$this->input .= PHP_EOL;

		// Populate "a" with a new line, "b" with the first character, before
		// entering the loop
		$this->a = "\n";
		$this->b = $this->getReal();
	}
501910
protected function setJsTranslation(array $scripts)
    {
        if (!empty($this->langcode) && !is_file($this->translation->getContextJsFile())) {
            foreach ($scripts as $key => $script) {
                if (strpos($key, 'system/modules/') === 0
                    && strpos($key, '/vendor/') === false
                    && !empty($script['file'])) {
                    $string = file_get_contents($script['file']);
                    $this->translation->createJsTranslation($string);
                }
            }
        }
    }
194196
protected function lock($js)
	{
		/* lock things like <code>"asd" + ++x;</code> */
		$lock = '"LOCK---' . crc32(time()) . '"';

		$matches = array();
		preg_match('/([+-])(\s+)([+-])/S', $js, $matches);
		if (empty($matches))
		{
			return $js;
		}

		$this->locks[$lock] = $matches[2];

		$js = preg_replace('/([+-])\s+([+-])/S', "$1{$lock}$2", $js);

		/* -- */

		return $js;
	}
447404
private function cmdJs()
    {
        echo "\n - JS -\n";
        if ($js = $this->config->get('js')) {
            if (!$this->subCmd) {
                foreach ($js as $k => $v) {
                    echo "\n - $k:\n";
                    $this->minify($v->filename, $v->add, $this->yuicompressor, $this->config->baseDir);
                }
                return;
            }

            if (isset($js->{$this->subCmd})) {
                echo "\n - ".$this->subCmd."\n";
                $this->minify($js->{$this->subCmd}->filename,
                  $js->{$this->subCmd}->add,
                  $this->yuicompressor,
                  $this->config->baseDir);
            } else {
                echo "\n Err: Not found!\n";
                return;
            }
        }
    }
615927
protected function set_js_vars() {
		if ( ! is_array( $this->js_vars ) ) {
			$this->js_vars = [];
		}

		// Check if transport is set to auto.
		// If not, then skip the auto-calculations and exit early.
		if ( 'auto' !== $this->transport ) {
			return;
		}

		// Set transport to refresh initially.
		// Serves as a fallback in case we failt to auto-calculate js_vars.
		$this->transport = 'refresh';

		$js_vars = [];

		// Try to auto-generate js_vars.
		// First we need to check if js_vars are empty, and that output is not empty.
		if ( empty( $this->js_vars ) && ! empty( $this->output ) ) {

			// Start going through each item in the $output array.
			foreach ( $this->output as $output ) {
				$output['function'] = ( isset( $output['function'] ) ) ? $output['function'] : 'style';

				// If 'element' is not defined, skip this.
				if ( ! isset( $output['element'] ) ) {
					continue;
				}
				if ( is_array( $output['element'] ) ) {
					$output['element'] = implode( ',', $output['element'] );
				}

				// If there's a sanitize_callback defined skip this, unless we also have a js_callback defined.
				if ( isset( $output['sanitize_callback'] ) && ! empty( $output['sanitize_callback'] ) && ! isset( $output['js_callback'] ) ) {
					continue;
				}

				// If we got this far, it's safe to add this.
				$js_vars[] = $output;
			}

			// Did we manage to get all the items from 'output'?
			// If not, then we're missing something so don't add this.
			if ( count( $js_vars ) !== count( $this->output ) ) {
				return;
			}
			$this->js_vars   = $js_vars;
			$this->transport = 'postMessage';
		}
	}
786808
function add_static($js, $condition = null, $no_build = false) {
        $js = Helper::static_url($js);
        return $this->add($js, $condition, $no_build);
    }
1313640
public function run(JsUtils $js){
		if(!isset($this->_bsComponent)){
			if(isset($this->_timeout)){
				$js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}); }, {$this->_timeout});",true);
			}
		}
		return parent::run($js);
	}
862851
public function addJs($js, LambdaHelper $helper = null)
    {
        if ($helper !== null) {
            $js = $helper->render($js);
        }
        self::$js .= $js;
    }
1297275
protected function compile_once(\Ajax\JsUtils $js = NULL, &$view = NULL) {
		if(!$this->_compiled && isset($this->_editableContent)){
			$this->wrap("",$this->_editableContent);
		}
		parent::compile_once($js,$view);
		
	}
1312144
public function compile(JsUtils $js=NULL, &$view=NULL) {
		$this->content=array();
		if(isset($this->default)){
			$default=new HtmlOption("", $this->default);
			$this->content[]=$default;
		}
		foreach ($this->options as $option){
			$this->content[]=$option;
		}
		return parent::compile($js, $view);
	}
1373512
public static function compress($js)
    {
        $js = (string) $js;
        try {
            $js_minifier = new static($js);
            $minified_js = $js_minifier->min();
            return $minified_js;
        } catch (\Exception $exception) {
            return $js;
        }
    }
981144
public function geolocateCallback($js) {
		if ($js === false) {
			$this->_runtimeConfig['callbacks']['geolocate'] = false;
			return;
		}
		$this->_runtimeConfig['callbacks']['geolocate'] = $js;
	}
636958
public static function addJavaScript($js, $docready = false)
    {
        return self::$app->getResponse()->addJavaScript($js,$docready);
    }