diff --git a/resources/mediawiki.page/mediawiki.page.patrol.ajax.js b/resources/mediawiki.page/mediawiki.page.patrol.ajax.js index 75908ee..7a89f3e 100644 --- a/resources/mediawiki.page/mediawiki.page.patrol.ajax.js +++ b/resources/mediawiki.page/mediawiki.page.patrol.ajax.js @@ -41,7 +41,9 @@ mw.notify( mw.msg( 'markedaspatrollednotify', title.toText() ) ); } else { // This should never happen as errors should trigger fail - mw.notify( mw.msg( 'markedaspatrollederrornotify' ) ); + mw.notify( mw.msg( 'markedaspatrollederrornotify' ), { + type: 'error' + } ); } } ) .fail( function ( error ) { @@ -51,9 +53,13 @@ $patrolLinks.show(); if ( error === 'noautopatrol' ) { // Can't patrol own - mw.notify( mw.msg( 'markedaspatrollederror-noautopatrol' ) ); + mw.notify( mw.msg( 'markedaspatrollederror-noautopatrol' ), { + type: 'error' + } ); } else { - mw.notify( mw.msg( 'markedaspatrollederrornotify' ) ); + mw.notify( mw.msg( 'markedaspatrollederrornotify' ), { + type: 'error' + } ); } } ); diff --git a/resources/mediawiki.page/mediawiki.page.watch.ajax.js b/resources/mediawiki.page/mediawiki.page.watch.ajax.js index ef287c4..f8fecd9 100644 --- a/resources/mediawiki.page/mediawiki.page.watch.ajax.js +++ b/resources/mediawiki.page/mediawiki.page.watch.ajax.js @@ -164,7 +164,10 @@ msg = mw.message( 'watcherrortext', link ); // Report to user about the error - mw.notify( msg, { tag: 'watch-self' } ); + mw.notify( msg, { + tag: 'watch-self', + type: 'error' + } ); } ); } ); } ); diff --git a/resources/mediawiki/mediawiki.notification.css b/resources/mediawiki/mediawiki.notification.css index 3aa358a..9a4c5ad 100644 --- a/resources/mediawiki/mediawiki.notification.css +++ b/resources/mediawiki/mediawiki.notification.css @@ -34,3 +34,11 @@ .mw-notification-title { font-weight: bold; } + +.mw-notification-type-error { + background-color: #fee; +} + +.mw-notification-type-warn { + background-color: #ffe; +} diff --git a/resources/mediawiki/mediawiki.notification.js b/resources/mediawiki/mediawiki.notification.js index 4ede809..1502b59 100644 --- a/resources/mediawiki/mediawiki.notification.js +++ b/resources/mediawiki/mediawiki.notification.js @@ -37,6 +37,12 @@ } } + if ( options.type ) { + // Sanitize options.type + options.type = options.type.replace( /[ _\-]+/g, '-' ).replace( /[^\-a-z0-9]+/ig, '' ); + $notification.addClass( 'mw-notification-type-' + options.type ); + } + if ( options.title ) { $notificationTitle = $( '
' ) .text( options.title ) @@ -460,11 +466,15 @@ * - title: * An optional title for the notification. Will be displayed above the * content. Usually in bold. + * + * - type: + * An optional type of message: "notify", "warn", "error". */ defaults: { autoHide: true, tag: false, - title: undefined + title: undefined, + type: "notify" }, /** diff --git a/skins/vector/screen.less b/skins/vector/screen.less index 4651b48..bcf15c4 100644 --- a/skins/vector/screen.less +++ b/skins/vector/screen.less @@ -612,6 +612,14 @@ pre, .mw-code { box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.125); } +.skin-vector .mw-notification-type-error { + background-color: #fee; +} + +.skin-vector .mw-notification-type-warn { + background-color: #ffe; +} + /* Watch/Unwatch Icon Styling */ #ca-unwatch.icon a, #ca-watch.icon a {