Merge pull request #1905 from xiaoyifang/opt/custom-js-defer

opt: make custom javascript delay execution
This commit is contained in:
xiaoyifang 2024-11-06 09:57:43 +08:00 committed by GitHub
commit 9315dda365
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -209,7 +209,7 @@ body { background: #242525; }
// load the `article-style.js` in user's config folder // load the `article-style.js` in user's config folder
if ( auto userJsFile = Config::getUserJsFileName(); userJsFile.has_value() ) { if ( auto userJsFile = Config::getUserJsFileName(); userJsFile.has_value() ) {
result += fmt::format( FMT_COMPILE( R"(<script src="file://{}"></script>)" ), userJsFile.value() ); result += fmt::format( FMT_COMPILE( R"(<script src="file://{}" defer></script>)" ), userJsFile.value() );
} }
result += "</head><body>"; result += "</head><body>";