Code: Select all
public function addScript($script) {
$this->scripts[md5($script)] = $script;
}
Has anyone run into this situation and come up with a solution or modification to the document.php file?
Any help is greatly appreciated!
Code: Select all
public function addScript($script) {
$this->scripts[md5($script)] = $script;
}
Code: Select all
</footer></div>
<script type="text/javascript" async src="catalog/view/theme/default/js/compressed.js"></script>
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com
Code: Select all
// JavaScript
if ($popup_box['use_default_javascript']) {
// Include core JavaScript files
$this->document->addScript('catalog/view/javascript/popup_box/magnific_popup/0.9.9/dist/jquery.magnific-popup.min.js');
if ($this->development_mode) {
$this->document->addScript('catalog/view/javascript/popup_box/popup_box.js');
} else {
$this->document->addScript('catalog/view/javascript/popup_box/popup_box.min.js');
}
}
Code: Select all
$this->document->addScript('catalog/view/javascript/popup_box/magnific_popup/0.9.9/dist/jquery.magnific-popup.min.js', defer);
Code: Select all
<script type="text/javascript" src="catalog/view/javascript/popup_box/magnific_popup/0.9.9/dist/jquery.magnific_popup.min.js"></script>
Code: Select all
<script defer type="text/javascript" src="catalog/view/javascript/popup_box/magnific_popup/0.9.9/dist/jquery.magnific_popup.min.js"></script>
Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com
Thanks but I guess that you still don't understand, none of the above posted code is "my code". I am simply asking if there's some way to add a modification to addScript function of the /system/library/document.php file to include defer or attribute tags to scripts that are added using the addScript function.
Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com
Thanks, I'll try to find a way to accomplish this in the header. I guess I just figured writing additional functionality into the library functions would allow me to modify the offending render-blocking scripts easier.thekrotek wrote: ↑Fri Jun 07, 2019 10:22 pmAnd again, I repeat, that you can add these changes directly into the header. To all the scripts, which were added via library functions or directly. No need to expand the library functions themselves.
Anyway, the task is custom, implement it anyway you like.
Read, what I posted above, to find out, what he meant ...When you say that you can add these changes directly into the header,
would you mind explaining how you would accomplish this?
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Users browsing this forum: No registered users and 119 guests