Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4101628
LiveUpdateButtonWidget.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
LiveUpdateButtonWidget.js
View Options
/**
* Widget for toggling live updates.
*
* @class mw.rcfilters.ui.LiveUpdateButtonWidget
* @ignore
* @extends OO.ui.ToggleButtonWidget
*
* @param {mw.rcfilters.Controller} controller
* @param {mw.rcfilters.dm.ChangesListViewModel} changesListModel
* @param {Object} [config] Configuration object
*/
const
LiveUpdateButtonWidget
=
function
MwRcfiltersUiLiveUpdateButtonWidget
(
controller
,
changesListModel
,
config
)
{
config
=
config
||
{};
// Parent
LiveUpdateButtonWidget
.
super
.
call
(
this
,
Object
.
assign
(
{
label
:
mw
.
msg
(
'rcfilters-liveupdates-button'
)
},
config
)
);
this
.
controller
=
controller
;
this
.
model
=
changesListModel
;
// Events
this
.
connect
(
this
,
{
click
:
'onClick'
}
);
this
.
model
.
connect
(
this
,
{
liveUpdateChange
:
'onLiveUpdateChange'
}
);
this
.
$element
.
addClass
(
'mw-rcfilters-ui-liveUpdateButtonWidget'
);
this
.
setState
(
false
);
};
/* Initialization */
OO
.
inheritClass
(
LiveUpdateButtonWidget
,
OO
.
ui
.
ToggleButtonWidget
);
/* Methods */
/**
* Respond to the button being clicked
*/
LiveUpdateButtonWidget
.
prototype
.
onClick
=
function
()
{
this
.
controller
.
toggleLiveUpdate
();
};
/**
* Set the button's state and change its appearance
*
* @param {boolean} enable Whether the 'live update' feature is now on/off
*/
LiveUpdateButtonWidget
.
prototype
.
setState
=
function
(
enable
)
{
this
.
setValue
(
enable
);
this
.
setIcon
(
enable
?
'stop'
:
'play'
);
this
.
setTitle
(
mw
.
msg
(
enable
?
'rcfilters-liveupdates-button-title-on'
:
'rcfilters-liveupdates-button-title-off'
)
);
};
/**
* Respond to the 'live update' feature being turned on/off
*
* @param {boolean} enable Whether the 'live update' feature is now on/off
*/
LiveUpdateButtonWidget
.
prototype
.
onLiveUpdateChange
=
function
(
enable
)
{
this
.
setState
(
enable
);
};
module
.
exports
=
LiveUpdateButtonWidget
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Aug 18, 17:02 (3 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
a9/5a/f562f5ff80a0c7dd40969045d379
Default Alt Text
LiveUpdateButtonWidget.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment