Debian Codegraph @

extensions/Echo/modules/ui/mw.echo.ui.PlaceholderItemWidget.js

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