バブル通知

This page is a translated version of the page Bubble notifications and the translation is 70% complete.
バブル通知の例

Bubble notifications is a JavaScript system developed as part of MediaWiki for displaying notifications on a web page.

機能

  • 複数の通知: 同時に多数の通知を表示できます。 それぞれ個別に閉じることが可能です。
  • 自動的に閉じる: 通知は、しばらくすると自動で閉じる様設定ができます。 This is enabled by default, but individual features using this system may choose to disable it for specific notifications where needed.
  • タグ付け: A notification can optionally be given a name (or "tag"). When a new notification is created with the same name as an older one that is still active, the older one is replaced with the new one. This enables an improved user experience where one would otherwise cause old, incomplete, or duplicate notifications to be visible (example use cases)

API

バブル通知におけるエントリーポイントは、mw.notify()メソッドです。 例:

mw.notify( 'This is a notification.' ); // Send a plaintext notification
mw.notify( mw.message( 'some-message' ) ); // Use an i18n message to send a notification
mw.notify( $( '<span>This is an <u>HTML</u> notification.</span>' ) ); // Send an HTML notification with a jQuery instance (a DOM node also works)

mw.notify( 'Test', { title: 'Title!' } ); // Give the notification a title
mw.notify( 'Test', { autoHide: false } ); // Don't automatically hide the notification
mw.notify( 'Test', { tag: 'foobar' } ); // Send a notification tagged with a tag
mw.notify( 'Test 2', { tag: 'foobar' } ); // This one will replace the previous 'foobar' notification.

The format is: mw.notify(message, options), available options are:

  • autoHideA boolean indicating whether the notification should automatically be hidden after shown or if it should persist.
  • autoHideSecondsNumber of seconds for timeout of auto-hide notifications.
  • tag – 任意の文字列です。 通知にタグを付けるとそのタグの付いたメッセージが1つだけ表示されます。 Trying to display a new notification with the same tag as one already being displayed will cause the other notification to be closed and this new notification to open up inside the same place as the previous notification.
  • title – 通知の任意のタイトル。 コンテンツの上に表示され、普通は太字の表示です。
  • type – スタイリング用のメッセージタイプを示す任意の文字列。例: 'info', 'warn', 'error', 'success'.
  • visibleTimeout – autoHideタイムアウトを、ページの表示時間に基づくのか、それとも時計の時間に基づくのかを示す真偽値。


関連項目


コードのスチュワード権限