Generates the JavaScript code that will initialize the Dygraphs object.
@return string
@since 1.0.0
552492
protected function getGraphScript() {
        $id = $this->htmlOptions['id'];
        $options = Json::encode($this->options);
        $data = $this->processDates();
        return "
            var $this->jsVarName = new Dygraph(
                document.getElementById('$id'),
                $data,
                $options
            );
        ";
    }
1188256
private function init()
    {
        static $initComplete;
        $out = '';

        if (!empty($initComplete)) {
            return '';
        }

        if ($this->initialized) {
            $initComplete = true;

            return '';
        }

        $args = '';
        $ckeditorPath = $this->ckeditorPath();

        if (!empty($this->timestamp) && $this->timestamp != '%'.'TIMESTAMP%') {
            $args = '?t='.$this->timestamp;
        }

        // Skip relative paths...
        if (strpos($ckeditorPath, '..') !== 0) {
            $out .= $this->script("window.CKEDITOR_BASEPATH='".$ckeditorPath."';");
        }

        $out .= '<script type="text/javascript" src="'.$ckeditorPath.'ckeditor.js'.$args."\"></script>\n";

        $extraCode = '';
        if ($this->timestamp != self::timestamp) {
            $extraCode .= ($extraCode ? "\n" : '')."CKEDITOR.timestamp = '".$this->timestamp."';";
        }
        if ($extraCode) {
            $out .= $this->script($extraCode);
        }

        $initComplete = $this->initialized = true;

        return $out;
    }
912114
private function prepareJs()
    {
        switch ($this->treeType) {
            case self::TREE_TYPE_ADJACENCY :
                return $this->adjacencyJs();
            case self::TREE_TYPE_NESTED_SET :
                return $this->nestedSetJs();
        }
    }
192251
public function toJavascript()
  {
    ob_start();
    ?>
    <script type="text/javascript">
      jQuery( function( $ )
      {
        "use strict";

        Morris.<?php echo $this->__chart_type ?>(
          <?php echo $this->toJSON() ?>
        );
      } );
    </script>
    <?php
    $buffer = ob_get_contents();
    ob_end_clean();

    return $buffer;
  }
671006
public function getFormInitializationJavaScriptCode()
    {
        $formName = GeneralUtility::quoteJSvalue($this->getFormObject()->getName());
        $formConfigurationJson = $this->handleFormConfiguration($this->getFormConfiguration());

        $javaScriptCode = <<<JS
(function() {
    Fz.Form.register($formName, $formConfigurationJson);
})();
JS;

        return $javaScriptCode;
    }
1072404
protected function getInlineJavaScript()
    {
        $quoted_string = SwatString::quoteJavaScriptString($this->id);
        return sprintf(
            'var %s_obj = new SwatRating(%s, %s);',
            $this->id,
            $quoted_string,
            intval($this->maximum_value)
        );
    }
917267
public function getJsCode()
    {
        $html = '';
        foreach ($this->js as $js) {
            $html .= sprintf('<script src="%s"></script>', $js);
        }
        foreach ($this->entry as $entry) {
            $html .= sprintf('<script>System.import(\'%s\')</script>', $entry);
        }
        return $html;
    }
282811
public function getFieldsActivationJavaScriptCode()
    {
        $javaScriptBlocks = [];
        $formConfiguration = $this->getFormObject()->getConfiguration();

        foreach ($formConfiguration->getFields() as $field) {
            $fieldConditionExpression = [];
            $javaScriptTree = $this->getConditionTreeForField($field)->getJavaScriptConditions();

            if (false === empty($javaScriptTree)) {
                foreach ($javaScriptTree as $node) {
                    $fieldConditionExpression[] = 'flag = flag || (' . $node . ');';
                }

                $javaScriptBlocks[] = $this->getSingleFieldActivationConditionFunction($field, $fieldConditionExpression);
            }
        }

        $javaScriptBlocks = implode(CRLF, $javaScriptBlocks);
        $formName = GeneralUtility::quoteJSvalue($this->getFormObject()->getName());

        return <<<JS
(function() {
    Fz.Form.get(
        $formName,
        function(form) {
            var field = null;

$javaScriptBlocks
        }
    );
})();
JS;
    }
234927
public function generate(): string
    {
        $fieldId = $this->controllData['field-id'];
        $label = $this->controllData['label'];
        $label = $label != Tags::NBSP ? $label.':' : $label;
        $icons = '';
        $class = ['controll'];
        $ret = [];

        if ($this->controllData['required'] == 1) {
            $class[] = 'is-required';
        }
        if ($this->controllData['help'] != '') {
            $icons .= Tags::i($this->controllData['help'], ['class' => 'icon-help']);
            $class[] = 'has-help';
        }
        if ($this->controllData['error'] != '') {
            $icons .= Tags::i($this->controllData['error'], ['class' => 'icon-error']);
            $class[] = 'has-error';
        }

        $ctrl = Tags::div($label, ['class' => 'label']);
        $ctrl .= Tags::div($this->controllData['controll'], ['class' => 'html-controll']);
        $ctrl .= Tags::div($icons, ['class' => 'icons']);
        $ret[] = Tags::div($ctrl, ['class' => \implode(' ', $class), 'data-field-id' => $fieldId]);

        if ($this->controllData['script'] != '') {
            $ret[] = Tags::script(\str_replace(Tags::CRLF, ' ', $this->controllData['script']));
        }

        return \implode(Tags::CRLF, $ret);
    }
736322
public function generateScripts()
    {
        $result = '';

        $rawScript     = [];
        $this->scripts = array_unique($this->scripts, SORT_REGULAR);
        foreach ($this->scripts as $scriptInfo) {
            if (!$scriptInfo[2]) {
                $result.= '<script src="'.$scriptInfo[0].'" type="'.$scriptInfo[1].'"></script>';
            } else {
                $rawScript[$scriptInfo[1]] = isset($rawScript[$scriptInfo[1]]) ? $rawScript[$scriptInfo[1]] .= $scriptInfo[0]
                        : $scriptInfo[0];
            }
        }
        foreach ($rawScript as $type => $script) {
            $result.= '<script type="'.$type.'">'.$script.'</script>';
        }

        return $result;
    }
46158
public function getJS()
	{
		if (!isset($this->jsRegexp))
		{
			$this->jsRegexp = RegexpConvertor::toJS($this->regexp, $this->isGlobal);
		}

		return $this->jsRegexp;
	}
1129336
public function getJavaScriptCode()
    {
        $fieldsJavaScriptCode = [];
        $formConfiguration = $this->getFormObject()->getConfiguration();

        foreach ($formConfiguration->getFields() as $field) {
            $fieldsJavaScriptCode[] = $this->processField($field);
        }

        $formName = GeneralUtility::quoteJSvalue($this->getFormObject()->getName());
        $fieldsJavaScriptCode = implode(CRLF, $fieldsJavaScriptCode);

        return <<<JS
(function() {
    Fz.Form.get(
        $formName,
        function(form) {
            var field = null;

$fieldsJavaScriptCode
        }
    );
})();
JS;
    }
805086
public function getContent()
    {

        $this->addPackage(new EchartsPackage());

        $chartId = (new UniqueId())->getUniqueId();

        $div = new Div($this);
        $div->id = $chartId;
        $div->addAttribute('style', 'width:' . $this->widthPercent . '%; height:400px;');

        $script = new JavaScript($this);
        $script->addCodeLine('var myChart = echarts.init(document.getElementById("' . $chartId . '"));');
        $script->addCodeLine('var option = {');
        $script->addCodeLine('animation: ' . (new YesNo($this->animation))->getText() . ',');
        $script->addCodeLine('title: {');
        $script->addCodeLine('text: "' . $this->title . '"');
        $script->addCodeLine('},');

        //$script->addScript('tooltip: { show: true},');

        if ($this->showLegend) {
            $script->addCodeLine('legend: 
            { show: true, y: "bottom"},
            
            ');
        }

        $script->addCodeLine($this->script);

        $script->addCodeLine('};');
        $script->addCodeLine('myChart.setOption(option);');
        $script->addCodeLine('');

        return parent::getContent();
    }
659736
public function getScript()
    {
        $di = jaxon()->di();
        $code = '';
        foreach(array_keys($this->aFunctions) as $sName)
        {
            $xFunction = $di->get($sName);
            $code .= $xFunction->getScript();
        }
        return $code;
    }
120803
protected function generateTraitUsesLines()
    {
        $code = array();
        foreach ($this->traitUses as $use) {
            $use->setIndentationString($this->getIndentationString());
            $use->setIndentationLevel($this->getIndentationLevel() + 1);
            $code[] = $use->generate();
            $code[] = null;
        }

        return $code;
    }
982362
protected function getInlineJavaScript()
    {
        static $shown = false;

        if (!$shown) {
            $javascript = $this->getInlineJavaScriptTranslations();
            $shown = true;
        } else {
            $javascript = '';
        }

        $javascript .= sprintf(
            "var %s = new %s(\n" . "%s, %s, %s, %s, %s, %s);\n",
            $this->id,
            $this->getJavaScriptClass(),
            SwatString::quoteJavaScriptString($this->id),
            SwatString::quoteJavaScriptString($this->preview_image),
            intval($this->preview_width),
            intval($this->preview_height),
            $this->show_title ? 'true' : 'false',
            SwatString::quoteJavaScriptString($this->preview_title)
        );

        if ($this->container_width !== null) {
            $javascript .= sprintf(
                "%s.width = %s;",
                $this->id,
                (int) $this->container_width
            );
        }

        if ($this->container_height !== null) {
            $javascript .= sprintf(
                "%s.height = %s;",
                $this->id,
                (int) $this->container_height
            );
        }

        return $javascript;
    }
1055779
protected function buildInitScriptText()
    {
        $quadId  = Builder::getId($this->getQuad());
        $entryId = Builder::EMPTY_STRING;
        if ($this->entry) {
            $entryId = Builder::getId($this->getEntry());
        }

        $default              = Builder::getBoolean($this->default);
        $enabledDesignString  = $this->enabledDesign->getDesignString();
        $disabledDesignString = $this->disabledDesign->getDesignString();

        return "
declare Quad_CheckBox <=> (Page.GetFirstChild(\"{$quadId}\") as CMlQuad);
declare Text[Boolean] " . self::VAR_CHECKBOX_DESIGNS . " as Designs for Quad_CheckBox;
Designs[True] = \"{$enabledDesignString}\";
Designs[False] = \"{$disabledDesignString}\";
declare Boolean " . self::VAR_CHECKBOX_ENABLED . " as Enabled for Quad_CheckBox;
Enabled = !{$default};
declare Text " . self::VAR_CHECKBOX_ENTRY_ID . " as EntryId for Quad_CheckBox;
EntryId = \"{$entryId}\";
" . self::FUNCTION_UPDATE_QUAD_DESIGN . "(Quad_CheckBox);
";
    }