Перейти к публикации
View in the app

A better way to browse. Learn more.

Дизайн и модификация Invision Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ShoutBox - Поменять функция Sound Play на Page Title Notification

Опубликовано:

IPB 3.4.6

Shoutbox 1.4.1

 

ShoutBox - Поменять функция Sound Play on new shout на Page Title Notification

 

При новое сообщение играет shout.mp3

 

За это отвечает: /admin/applications_addon/other/shoutbox/sources/classes/library.php

 

			# Found new shouts?!?
		if ( $content != "" )
		{
			$new_ids =  count($new_ids) ? implode(",", $new_ids) : "";
			$a  = array('shouts' => $content,
						'ids'    => $new_ids,
						'sound'	 => '',
						#'force'  => 0, //TODO: this variable is needed in a future version to fix the bugs caused by editing a shout/clearing the cache
						);
			//----------------------------------
			// Shout Alerts
			//----------------------------------
			if( $new_ids != "" AND $this->settings['shoutbox_enable_sound'] AND ! $this->prefs[ 'disable_sound' ] )
			{
				$a['sound'] =  "soundManager.play('shoutbox-shouts', ipb.vars['board_url'] + '/public/sounds/shout.mp3' );\n";
			}


			$content = $this->registry->output->getTemplate('shoutbox')->shouts_ajax( $a );
		}

 

Никак не получается засунуть там за место:

$a['sound'] =  "soundManager.play('shoutbox-shouts', ipb.vars['board_url'] + '/public/sounds/shout.mp3' );\n";

код Page Title Notification:

<script type="text/javascript">
var origionalTitle = document.title;
var titleInterval;
var newTitle = "Новая сообщение в чате";
window.isActive = true;

function alertTitle( ){
if(!window.isActive){
	window.clearInterval(titleInterval);
	titleInterval = window.setInterval( changeTitle , 1500 );
}
};

function changeTitle() {
if( document.title  == origionalTitle ){
	document.title = newTitle;
} else {
	document.title  = origionalTitle;
}
};
</script>

 

P.S. О Audio Shoutbox Alerts я знаю, но не хочется ставить лишние компоненты.

Рекомендованные сообщения

No posts to show

Создайте аккаунт или войдите в него для комментирования

Сейчас на странице 0

  • Нет пользователей, просматривающих эту страницу.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.