Skip to content

Commit

Permalink
Stop load of osd script when deactive
Browse files Browse the repository at this point in the history
  • Loading branch information
iszmais committed Jul 4, 2024
1 parent 5316a66 commit 3bf030b
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions Services/Notifications/classes/ilNotificationOSDGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,24 @@ public function populatePage(): void

$notificationSettings = new ilSetting('notifications');

$osdTemplate = new ilTemplate('tpl.osd_notifications.js', true, true, 'Services/Notifications');
if ($notificationSettings->get('enable_osd', '0') === '1') {
$osdTemplate = new ilTemplate('tpl.osd_notifications.js', true, true, 'Services/Notifications');

$osdTemplate->setVariable(
'OSD_INTERVAL',
$notificationSettings->get('osd_interval', (string) self::DEFAULT_POLLING_INTERVAL)
);
$osdTemplate->setVariable(
'OSD_PLAY_SOUND',
$notificationSettings->get('osd_play_sound') && $this->user->getPref('osd_play_sound') ? 'true' : 'false'
);
$osdTemplate->setVariable(
'OSD_INTERVAL',
$notificationSettings->get('osd_interval', (string) self::DEFAULT_POLLING_INTERVAL)
);
$osdTemplate->setVariable(
'OSD_PLAY_SOUND',
$notificationSettings->get('osd_play_sound') && $this->user->getPref('osd_play_sound') ? 'true' : 'false'
);

iljQueryUtil::initjQuery($this->page);
ilPlayerUtil::initMediaElementJs($this->page);
iljQueryUtil::initjQuery($this->page);
ilPlayerUtil::initMediaElementJs($this->page);

$this->page->addJavaScript('Services/Notifications/templates/default/notifications.js');
$this->page->addCSS('Services/Notifications/templates/default/osd.css');
$this->page->addOnLoadCode($osdTemplate->get());
$this->page->addJavaScript('Services/Notifications/templates/default/notifications.js');
$this->page->addCSS('Services/Notifications/templates/default/osd.css');
$this->page->addOnLoadCode($osdTemplate->get());
}
}
}

0 comments on commit 3bf030b

Please sign in to comment.