Only include janus.js if needed

This commit is contained in:
Isaac Connor 2022-02-08 13:33:02 -05:00
parent cc9306afe3
commit d7a8947e05
2 changed files with 14 additions and 2 deletions

View File

@ -193,5 +193,11 @@ xhtmlHeaders(__FILE__, translate('CycleWatch'));
</div>
</div>
<script src="<?php echo cache_bust('js/adapter.min.js') ?>"></script>
<script src="/javascript/janus/janus.js"></script>
<?php
if ( $monitor->JanusEnabled() ) {
?>
<script src="/javascript/janus/janus.js"></script>
<?php
}
?>
<?php xhtmlFooter() ?>

View File

@ -117,6 +117,7 @@ include('_monitor_filters.php');
$filterbar = ob_get_contents();
ob_end_clean();
$need_janus = false;
$monitors = array();
foreach ( $displayMonitors as &$row ) {
if ( $row['Function'] == 'None' )
@ -133,7 +134,10 @@ foreach ( $displayMonitors as &$row ) {
if ( ! isset($heights[$row['Height']]) ) {
$heights[$row['Height']] = $row['Height'].'px';
}
$monitors[] = new ZM\Monitor($row);
$monitor = $monitors[] = new ZM\Monitor($row);
if ($monitor->JanusEnabled()) {
$need_janus = true;
}
} # end foreach Monitor
xhtmlHeaders(__FILE__, translate('Montage'));
@ -319,6 +323,8 @@ foreach (array_reverse($zones) as $zone) {
</div>
</div>
<script src="<?php echo cache_bust('js/adapter.min.js') ?>"></script>
<?php if ($need_janus) { ?>
<script src="/javascript/janus/janus.js"></script>
<?php } ?>
<script src="<?php echo cache_bust('js/MonitorStream.js') ?>"></script>
<?php xhtmlFooter() ?>