Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P2475
(An Untitled Masterwork)
Active
Public
Actions
Authored by
lfaraone
on Jan 14 2016, 7:51 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F3228530:
Feb 24 2016, 5:27 AM
2016-02-24 05:27:50 (UTC+0)
Subscribers
None
/*!
* Toggler for a list of checkboxes.
*
* @licence GNU GPL v2 or later
* @author Luke Faraone <luke at faraone dot cc>
* Based on `ext.nuke.js from https://www.mediawiki.org/wiki/Extension:Nuke by Jeroen De Dauw <jeroendedauw at gmail dot com>
*/
(
function
(
mw
,
$
)
{
'use strict'
;
var
$checkboxes
=
$
(
'li input[type=checkbox]'
);
var
$toggleOptions
=
mw
.
message
(
'log-checkbox-select'
,
[
$
(
'<a>'
)
.
text
(
mw
.
msg
(
'log-checkbox-all'
)
)
.
click
(
function
(
e
)
{
selectAll
(
true
);
e
.
preventDefault
();
}
),
mw
.
msg
(
"comma-separator"
),
$
(
'<a>'
)
.
text
(
mw
.
msg
(
'log-checkbox-none'
)
)
.
click
(
function
(
e
)
{
selectAll
(
false
);
e
.
preventDefault
();
}
),
mw
.
msg
(
"comma-separator"
),
$
(
'<a>'
)
.
text
(
mw
.
msg
(
'log-checkbox-invert'
)
)
.
click
(
function
(
e
)
{
$checkboxes
.
each
(
function
()
{
$
(
this
).
prop
(
'checked'
,
!
$
(
this
).
is
(
':checked'
)
);
}
);
e
.
preventDefault
();
}
)
]).
parseDom
()
$
(
'.toggle-option-placeholder'
).
append
(
$
(
'<p>'
).
append
(
$toggleOptions
)
);
function
selectAll
(
check
)
{
$checkboxes
.
prop
(
'checked'
,
check
);
}
}(
mediaWiki
,
jQuery
)
);
Event Timeline
lfaraone
updated the paste's language from
autodetect
to
js
.
Jan 14 2016, 7:51 PM
2016-01-14 19:51:39 (UTC+0)
lfaraone
edited the content of this paste.
(Show Details)
Log In to Comment