blob: 31ab206d80d53679f907fa65d48a38b3be952ad3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
( function ( mw, $ ) {
/**
* Placeholder notification option widget for echo popup.
*
* @class
* @extends OO.ui.Widget
* @mixins OO.ui.mixin.LabelElement
*
* @constructor
* @param {Object} [config] Configuration object
* @cfg {string} [link] A link that this widget leads to.
*/
mw.echo.ui.PlaceholderItemWidget = function MwEchoUiPlaceholderItemWidget( config ) {
config = config || {};
// Parent constructor
mw.echo.ui.PlaceholderItemWidget.super.call( this, $.extend( { data: null }, config ) );
// Mixin constructor
OO.ui.mixin.LabelElement.call( this, config );
this.$element.addClass( 'mw-echo-ui-placeholderItemWidget' );
this.setLink( config.link );
};
OO.inheritClass( mw.echo.ui.PlaceholderItemWidget, OO.ui.Widget );
OO.mixinClass( mw.echo.ui.PlaceholderItemWidget, OO.ui.mixin.LabelElement );
/**
* Set (or unset) the main link url for this widget
*
* @param {string} [url] The widget url
*/
mw.echo.ui.PlaceholderItemWidget.prototype.setLink = function ( url ) {
var $link;
if ( url ) {
$link = $( '<a>' )
.addClass( 'mw-echo-ui-placeholderItemWidget-link' )
.attr( 'href', url );
this.$element.html( $link.append( this.$label ) );
} else {
this.$element.html( this.$label );
}
};
/**
* Return false on 'isRead' call for the notification list
* sorting.
*
* @return {boolean} false
*/
mw.echo.ui.PlaceholderItemWidget.prototype.isRead = function () {
return false;
};
/**
* Return false on 'isForeign' call for the notification list
* sorting.
*
* @return {boolean} false
*/
mw.echo.ui.PlaceholderItemWidget.prototype.isForeign = function () {
return false;
};
/**
* Return 0 on getTimestamp call for the notification list
* sorting.
*
* @return {number} 0
*/
mw.echo.ui.PlaceholderItemWidget.prototype.getTimestamp = function () {
return 0;
};
/**
* Return 0 on getId call for the notification list
* sorting.
*
* @return {number} 0
*/
mw.echo.ui.PlaceholderItemWidget.prototype.getId = function () {
return 0;
};
/**
* Do nothing for resetInitiallyUnseen since it is requested by the list widget
*/
mw.echo.ui.PlaceholderItemWidget.prototype.resetInitiallyUnseen = function () {};
}( mediaWiki, jQuery ) );
|