From ce5a5defd6b276d034049e578014ebce6f46f094 Mon Sep 17 00:00:00 2001 From: Bigi Lui Date: Sat, 15 Apr 2017 15:38:53 -0700 Subject: [PATCH] Moving JS to be embedded at the end of instead of end of --- PicoUICard.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/PicoUICard.php b/PicoUICard.php index d702902..cc77af5 100644 --- a/PicoUICard.php +++ b/PicoUICard.php @@ -146,7 +146,10 @@ final class PicoUICard extends AbstractPicoPlugin public function onPageRendered(&$output) { // regular pages + // add css to end of $output = str_replace('', ($this->buildExtraHeaders() . ''), $output); + // add js to end of + $output = str_replace('', ($this->buildExtraFooters() . ''), $output); } /** @@ -157,7 +160,6 @@ final class PicoUICard extends AbstractPicoPlugin // if set to true, load from bootstrap cdn if ($this->config['loadBootstrap'] === true) { $headers .= PHP_EOL.''; - $headers .= PHP_EOL.''; } // now set up card css classes $headers .= ' @@ -178,4 +180,16 @@ a.pico-ui-card-container_internal { display: block; padding: 10px; } '; return $headers; } + + /** + * Add some extra footer tags we need. + */ + private function buildExtraFooters() { + $footers = ''; + // if set to true, load from bootstrap cdn + if ($this->config['loadBootstrap'] === true) { + $footers .= PHP_EOL.''.PHP_EOL; + } + return $footers; + } }