public function init()
{
parent::init();
$this->app->jquery = $this;
if (!$this->app->template) {
return;
}
if (!$this->app->template->is_set('js_include')) {
throw $this->exception('Tag js_include must be defined in shared.html');
}
if (!$this->app->template->is_set('document_ready')) {
throw $this->exception('Tag document_ready must be defined in shared.html');
}
$this->app->template->del('js_include');
/* $config['js']['jquery']='https://code.jquery.com/jquery-2.1.4.min.js'; // to use CDN */
if ($v = $this->app->getConfig('js/versions/jquery', null)) {
$v = 'jquery-' . $v;
} else {
$v = $this->app->getConfig('js/jquery', 'jquery-2.2.1.min');
// bundled jQuery version
}
$this->addInclude($v);
// Controllers are not rendered, but we need to do some stuff manually
$this->app->addHook('pre-render-output', array($this, 'postRender'));
$this->app->addHook('cut-output', array($this, 'cutRender'));
}