Skip to content

Commit

Permalink
Fix navbar toggle on mobile/plugin page
Browse files Browse the repository at this point in the history
Previously, the scripts for the page had multiple entrypoints, which
caused bootstrap to load multiple times (and thus to register navbar
toggle listeners multiple times).
  • Loading branch information
personalizedrefrigerator committed Oct 2, 2023
1 parent 427126d commit 191e59f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion build/bundleJs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const bundleJs = (buildConfig: BuildConfig, watch: boolean): Promise<void> => {
mode: 'production',
entry: {
main: path.join(runtimeDirectory, 'index.ts'),
'plugin-page': path.join(runtimeDirectory, 'plugin', 'pluginPage.ts'),
},
output: {
path: buildConfig.distDir,
Expand Down
3 changes: 0 additions & 3 deletions src/pages/plugin/[pluginName].mustache
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,6 @@
</div>
</main>

{{! Initializes screenshots and postprocesses the README }}
<script src="{{&config.site}}/bundle-plugin-page.js"></script>

{{> plugin-documentation-link}}

</body>
Expand Down
5 changes: 5 additions & 0 deletions src/runtime/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import PluginDataManager from './PluginDataManager';
import initializeSearch from './search/initializeSearch';
import initializePluginPage from './plugin/initializePluginPage';
import initializeDownloadPage from './initializeDownloadPage';
import 'bootstrap';

Expand All @@ -11,6 +12,10 @@ const siteRoot: string = (window as any).siteRoot;
window.addEventListener('DOMContentLoaded', async () => {
const page = (window as any).pageId ?? 'default';

if (page === 'pluginDisplay') {
initializePluginPage();
}

const pluginDataManager = await PluginDataManager.fromURL(
`${siteRoot}/pluginData.json`,
siteRoot,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ const initializePluginPage = () => {
}
};

initializePluginPage();
export default initializePluginPage;

0 comments on commit 191e59f

Please sign in to comment.