mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 07:43:12 +09:00
Small change allowing plugins to add sidebar entries
This commit is contained in:
1 parent
6962324a45
commit
02c545c650
1 file changed
+17
-4
+17
-4
@@ -13,10 +13,23 @@
|
|||||||
<p>Slaves</p>
|
<p>Slaves</p>
|
||||||
</div></a>
|
</div></a>
|
||||||
<%# Very ugly ejs code to hide the Players button if the playerManager plugin isn`t installed %>
|
<%# Very ugly ejs code to hide the Players button if the playerManager plugin isn`t installed %>
|
||||||
<% adsdf = "none"; masterPlugins.forEach(plug => {if(plug.pluginConfig.name == "playerManager"){ adsdf = "block" }}); %>
|
<%
|
||||||
<a href="/playerManager" style="display:<%= adsdf %>"><div id="playerManager-menu" class="button-black menuItem">
|
sidebarPluginButtonsHtml = "";
|
||||||
<p>Players</p>
|
masterPlugins.forEach(plug => {
|
||||||
</div></a>
|
if(plug.main
|
||||||
|
&& plug.main.ui
|
||||||
|
&& typeof plug.main.ui.sidebar == "object"
|
||||||
|
&& Array.isArray(plug.main.ui.sidebar)){
|
||||||
|
let sidebarEntries = plug.main.ui.sidebar;
|
||||||
|
sidebarEntries.forEach(button => {
|
||||||
|
if(button.getHtml && typeof button.getHtml == "function"){
|
||||||
|
sidebarPluginButtonsHtml += button.getHtml();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
%>
|
||||||
|
<%- sidebarPluginButtonsHtml %>
|
||||||
<a href="/settings"><div id="settings-menu" class="button-black menuItem">
|
<a href="/settings"><div id="settings-menu" class="button-black menuItem">
|
||||||
<p>Settings</p>
|
<p>Settings</p>
|
||||||
</div></a>
|
</div></a>
|
||||||
|
|||||||
Reference in new issue
Block a user