Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F8076
ajax_rollback_links.js
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 11:50 PM
2014-11-21 23:50:04 (UTC+0)
Size
903 B
Referenced Files
None
Subscribers
None
ajax_rollback_links.js
View Options
/* Makes [rollback] links for edits excecute without an additional page load. Including self-closing bookmarklet option.
* Based on [[meta:User:Krinkle/Scripts/AjaxPatrolLinks.js]]
* See https://bugzilla.wikimedia.org/show_bug.cgi?id=31270
*/
function
ajaxRollback
()
{
var
$rollbackLinks
=
$
(
'.mw-rollback-link a'
);
if
(
$rollbackLinks
.
length
>
0
)
{
$rollbackLinks
.
click
(
function
(
e
)
{
e
.
preventDefault
();
var
$this
=
$
(
this
);
var
href
=
$this
.
attr
(
'href'
);
$this
.
text
(
'Rolling back...'
);
$rollbackLinks
=
$this
.
parent
();
// FIXME: Use MediaWiki API
$
.
get
(
href
,
null
,
function
(
data
,
status
,
request
)
{
if
(
status
==
'success'
)
{
$this
.
html
(
'<span style="color:green">Rolled back</span>'
);
}
else
{
$this
.
html
(
'<span style="color:red">Rollback failed</span>'
);
// MediaWiki:Rollbackfailed
}
}
);
});
}
}
$
(
ajaxRollback
);
File Metadata
Details
Attached
Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
7603
Default Alt Text
ajax_rollback_links.js (903 B)
Attached To
Mode
T33270: Proper AJAX rollback functionality in core
Attached
Detach File
Event Timeline
Log In to Comment