diff options
-rw-r--r-- | conf/dokuwiki.php | 3 | ||||
-rw-r--r-- | inc/template.php | 10 | ||||
-rw-r--r-- | lib/plugins/config/lang/en/lang.php | 3 | ||||
-rw-r--r-- | lib/plugins/config/settings/config.metadata.php | 3 |
4 files changed, 15 insertions, 4 deletions
diff --git a/conf/dokuwiki.php b/conf/dokuwiki.php index f138908a0..9b576f4cf 100644 --- a/conf/dokuwiki.php +++ b/conf/dokuwiki.php @@ -162,6 +162,9 @@ $conf['trustedproxy'] = '^(::1|[fF][eE]80:|127\.|10\.|192\.168\.|172\.((1[6-9])| //Regexp of trusted proxy address when reading IP using HTTP header // if blank, do not trust any proxy (including local IP) +/* Feature Flags */ +$conf['defer_js'] = 1; // Defer javascript to be executed after the page's HTML has been parsed. Setting will be removed in the next release. + /* Network Settings */ $conf['dnslookups'] = 1; //disable to disallow IP to hostname lookups $conf['jquerycdn'] = 0; //use a CDN for delivering jQuery? diff --git a/inc/template.php b/inc/template.php index 1f003d56e..011df63fe 100644 --- a/inc/template.php +++ b/inc/template.php @@ -348,16 +348,18 @@ function tpl_metaheaders($alt = true) { $jquery = getCdnUrls(); foreach($jquery as $src) { $head['script'][] = array( - 'type' => 'text/javascript', 'charset' => 'utf-8', '_data' => '', 'src' => $src, 'defer' => 'defer' - ); + 'type' => 'text/javascript', + 'charset' => 'utf-8', + '_data' => '', + 'src' => $src, + ) + ($conf['defer_js'] ? [ 'defer' => 'defer'] : []); } // load our javascript dispatcher $head['script'][] = array( 'type'=> 'text/javascript', 'charset'=> 'utf-8', '_data'=> '', 'src' => DOKU_BASE.'lib/exe/js.php'.'?t='.rawurlencode($conf['template']).'&tseed='.$tseed, - 'defer'=> 'defer' - ); + ) + ($conf['defer_js'] ? [ 'defer' => 'defer'] : []); // trigger event here Event::createAndTrigger('TPL_METAHEADER_OUTPUT', $head, '_tpl_metaheaders_action', true); diff --git a/lib/plugins/config/lang/en/lang.php b/lib/plugins/config/lang/en/lang.php index 2ee8df707..3a408e0e3 100644 --- a/lib/plugins/config/lang/en/lang.php +++ b/lib/plugins/config/lang/en/lang.php @@ -187,6 +187,9 @@ $lang['search_fragment_o_ends_with'] = 'ends with'; $lang['search_fragment_o_contains'] = 'contains'; $lang['trustedproxy'] = 'Trust forwarding proxies matching this regular expression about the true client IP they report. The default matches local networks. Leave empty to trust no proxy.'; +$lang['_feature_flags'] = 'Feature Flags'; +$lang['defer_js'] = 'Defer javascript to be execute after the page\'s HTML has been parsed. Improves perceived page speed but could break a small number of plugins.'; + /* Network Options */ $lang['dnslookups'] = 'DokuWiki will lookup hostnames for remote IP addresses of users editing pages. If you have a slow or non working DNS server or don\'t want this feature, disable this option'; $lang['jquerycdn'] = 'Should the jQuery and jQuery UI script files be loaded from a CDN? This adds additional HTTP requests, but files may load faster and users may have them cached already.'; diff --git a/lib/plugins/config/settings/config.metadata.php b/lib/plugins/config/settings/config.metadata.php index 6cb9267f7..cd818cb88 100644 --- a/lib/plugins/config/settings/config.metadata.php +++ b/lib/plugins/config/settings/config.metadata.php @@ -230,6 +230,9 @@ $meta['search_nslimit'] = array('numeric', '_min' => 0); $meta['search_fragment'] = array('multichoice','_choices' => array('exact', 'starts_with', 'ends_with', 'contains'),); $meta['trustedproxy'] = array('regex'); +$meta['_feature_flags'] = ['fieldset']; +$meta['defer_js'] = ['onoff']; + $meta['_network'] = array('fieldset'); $meta['dnslookups'] = array('onoff'); $meta['jquerycdn'] = array('multichoice', '_choices' => array(0,'jquery', 'cdnjs')); |