Includes the javascript file and initializes the Socket javascript object.

@return string
437406
public function javascript($url = null)
    {
         if (!$url) {
            $parts = parse_url(url('/'));
            if (!isset($parts['port'])) {
                $parts['port'] = Config::get('socket.default_port');
            }
            $url = 'ws://' . $parts['host'] . ':' . $parts['port'];
        }

        return implode('', [
            '<script src="' . url('vendor/socket/socket.js') .'"></script>',
            '<script>window.appSocket = new Socket("' . $url . '");</script>'
        ]);
    }
391654
private function _script() {
        // we need to compress?
        if($this->compress && $this->_config['compress']['js']) {
            // get cache
            $cache = $this->filename('js');
            if(!$cache)
                return false;

            // get paths
            $web_path = $this->_config['paths']['js'] . '/' . $cache;
            $system_path = $this->js['full'] . DS . $cache;

            // no cache file? write it
            if(!file_exists($system_path)) {
                // process compression
                $output = $this->process('js');

                // write to file
                file_put_contents($system_path, $output);
            }

            // output the cached file with the HTML helper
            return $this->Html->script($web_path);

        // no need to compress? output separately with the HTML helper
        } else return $this->Html->script($this->js['extern']);
    }
1121529
public function initHeadScript()
    {
        $javascripts = $this->orderByPriority($this->options->getJs()->getHead());
        foreach ($javascripts as $js) {
            $this->setJavascript($this->headScript, $js);
        }

        return $this;
    }
261062
protected function getInlineJavaScript()
    {
        $resizeable = $this->resizeable ? 'true' : 'false';
        return sprintf(
            "var %s_obj = new SwatTextarea('%s', %s);",
            $this->id,
            $this->id,
            $resizeable
        );
    }
1162907
protected function getInlineJavaScript()
    {
        $javascript = parent::getInlineJavaScript();

        $colors = "'" . implode("', '", $this->colors) . "'";

        if ($this->none_option) {
            $none_option =
                $this->none_option_title === null
                    ? 'null'
                    : SwatString::quoteJavaScriptString(
                        $this->none_option_title
                    );
        } else {
            $none_option = 'null';
        }

        $js_class_name = $this->getJavaScriptClassName();

        $javascript .=
            "\nvar {$this->id}_obj = new {$js_class_name}(" .
            "'{$this->id}', [{$colors}], {$none_option});\n";

        return $javascript;
    }
885247
public function getJs()
    {
        $html = '<script type="text/javascript">';
        $js = file_get_contents(__DIR__.'/Js/formidable.js');
        $html .= str_replace("\n", '', str_replace('{remove}', $this->factory->getLanguage()->translate('remove'), $js));
        $html .= '</script>';

        return $html;
    }
46367
public function getScript()
    {
        $sPrefix = $this->getOption('core.prefix.function');
        $sJsFunction = $this->getName();

        return $this->render('jaxon::support/function.js', array(
            'sPrefix' => $sPrefix,
            'sAlias' => $sJsFunction,
            'sFunction' => $sJsFunction, // sAlias is the same as sFunction
            'aConfig' => $this->aConfiguration,
        ));
    }
422428
public function getInlineJavaScript()
    {
        $view = $this->getFirstAncestor('SwatView');
        if ($view !== null) {
            $javascript = sprintf(
                "var %s = new SwatRadioButtonCellRenderer('%s', %s);",
                $this->id,
                $this->id,
                $view->id
            );
        } else {
            $javascript = '';
        }

        return $javascript;
    }
861174
public function getCreateScript() {
        static::$includeScripts = true;

        $text = '<script>';
        $text .= 'editors = ( typeof editors != "undefined" && editors instanceof Array ) ? editors : [];';
        $text .= 'editors.push({';
        $text .= 'name: "' . $this->name . '",';
        $text .= 'stylesheets: ' . json_encode($this->stylesheets) . ',';

        foreach($this->options as $key => $value) {
            $text .= $key . ': "' . $value . '",';
        }

        $text .= '});</script>';

        return $text;
    }
1158175
public function renderJs()
    {
        $jsFileList = $this->getJsFileList();

        if ($jsFileList->count() == 0) {
            return '';
        }

        $generate   = true;
        $bundlePath = $this->getJsBundlePath();

        if (!$this->getForce() && file_exists($bundlePath)) {
            $cacheTime = filemtime($bundlePath);

            if (false !== $cacheTime && $cacheTime >= $jsFileList->getMaxMTime()) {
                $generate = false;
            }
        }

        $bundleUrl = $this->getJsBundleUrl();

        if ($generate) {
            $data   = '';
            $filter = $this->getJsFilter();

            foreach ($jsFileList as $file => $fileInfo) {
                $data .= '/* --------- ' . $file . ' --------- */' . PHP_EOL;
                $contents = @file_get_contents($fileInfo->getPathname());
                if (!$contents) {
                    $data .= '/* FILE READ ERROR! */' . PHP_EOL;
                } else {
                    if (null !== $filter) {
                        $contents = $filter->filterFile($contents, $file, $fileInfo, $bundleUrl, $bundlePath);
                    }

                    $data .= $contents . PHP_EOL;
                }
            }

            if (null !== $filter) {
                $data = $filter->filter($data);
            }

            $cacheTime = $this->writeBundleFile($bundlePath, $data);
        }

        $template = $this->getJsTemplate();

        if (is_callable($template)) {
            return call_user_func($template, $bundleUrl, $cacheTime);
        }

        return sprintf(
            $template,
            $bundleUrl,
            $cacheTime
        );
    }
161349
public function getJs()
    {
        if(!$this->includeAssets())
        {
            return '';
        }
        $libraries = $this->getLibrariesInUse();
        $code = '';
        foreach($libraries as $library)
        {
            $code .= "\n" . $library->getJs() . "\n";
        }
        return $code;
    }
1315628
public function getClientScript()
    {
        $options = $this->clientOptions !== false && !empty($this->clientOptions) ? Json::encode($this->clientOptions) : '{}';
        return "var {$this->name} = new Bloodhound($options);{$this->name}.initialize();";
    }
549368
public function getInlineJavaScript()
    {
        if (count($this->view->model) < 2) {
            return '';
        }

        // set the controller of the check-all widget
        return sprintf(
            "%s_obj.setController(%s);",
            $this->check_all->id,
            $this->list_id
        );
    }
897289
public function includeJavaScriptValidationAndConditionFiles()
    {
        $javaScriptValidationFiles = $this->getJavaScriptFiles();
        $assetHandlerConnectorStates = $this->assetHandlerConnectorManager
            ->getAssetHandlerConnectorStates();

        foreach ($javaScriptValidationFiles as $file) {
            if (false === in_array($file, $assetHandlerConnectorStates->getAlreadyIncludedValidationJavaScriptFiles())) {
                $assetHandlerConnectorStates->registerIncludedValidationJavaScriptFiles($file);
                $this->includeJsFile(StringService::get()->getResourceRelativePath($file));
            }
        }

        return $this;
    }
303081
public function generateAndIncludeFormzConfigurationJavaScript()
    {
        $formzConfigurationJavaScriptAssetHandler = $this->getFormzConfigurationJavaScriptAssetHandler();
        $fileName = $formzConfigurationJavaScriptAssetHandler->getJavaScriptFileName();

        $this->assetHandlerConnectorManager->createFileInTemporaryDirectory(
            $fileName,
            function () use ($formzConfigurationJavaScriptAssetHandler) {
                return $formzConfigurationJavaScriptAssetHandler->getJavaScriptCode();
            }
        );

        $this->includeJsFile(StringService::get()->getResourceRelativePath($fileName));

        return $this;
    }
668544
protected function getInlineJavaScript()
    {
        $open = $this->open ? 'true' : 'false';
        return sprintf(
            "var %s_obj = new %s('%s', %s);",
            $this->id,
            $this->getJavaScriptClass(),
            $this->id,
            $open
        );
    }
1317754
protected function getInlineJavaScript()
    {
        switch ($this->tab_position) {
            case self::POSITION_RIGHT:
                $position = 'right';
                break;
            case self::POSITION_LEFT:
                $position = 'left';
                break;
            case self::POSITION_BOTTOM:
                $position = 'bottom';
                break;
            case self::POSITION_TOP:
            default:
                $position = 'top';
                break;
        }

        return sprintf(
            "var %s_obj = new YAHOO.widget.TabView(" .
                "'%s', {orientation: '%s'});",
            $this->id,
            $this->id,
            $position
        );
    }