Commit 6c4046da by Carsten Brandt

defer loading of search index in api doc

fixes #3289
parent cb8100d7
...@@ -80,7 +80,16 @@ $this->beginPage(); ...@@ -80,7 +80,16 @@ $this->beginPage();
</div> </div>
</div> </div>
<?php <?php
$this->registerJsFile('./jssearch.index.js', 'yii\apidoc\templates\bootstrap\assets\JsSearchAsset'); \yii\apidoc\templates\bootstrap\assets\JsSearchAsset::register($this);
// defer loading of the search index: https://developers.google.com/speed/docs/best-practices/payload?csw=1#DeferLoadingJS
$this->registerJs(<<<JS
var element = document.createElement("script");
element.src = "./jssearch.index.js";
document.body.appendChild(element);
JS
);
$this->registerJs(<<<JS $this->registerJs(<<<JS
var searchBox = $('#searchbox'); var searchBox = $('#searchbox');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment