Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1426003
unwatchedPages.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
unwatchedPages.js
View Options
/*!
* JavaScript for Special:UnwatchedPages
*/
(
function
()
{
$
(
()
=>
{
$
(
'a.mw-watch-link'
).
on
(
'click'
,
function
(
e
)
{
const
api
=
new
mw
.
Api
(),
$link
=
$
(
this
),
$subjectLink
=
$link
.
closest
(
'li'
).
children
(
'a'
).
eq
(
0
),
titleParam
=
mw
.
util
.
getParamValue
(
'title'
,
$link
.
attr
(
'href'
)
),
// nice format
title
=
mw
.
Title
.
newFromText
(
titleParam
).
toText
();
$link
.
addClass
(
'mw-watch-link-disabled'
);
// Preload the notification module for mw.notify
mw
.
loader
.
load
(
'mediawiki.notification'
);
let
promise
;
// Use the class to determine whether to watch or unwatch
// eslint-disable-next-line no-jquery/no-class-state
if
(
!
$subjectLink
.
hasClass
(
'mw-watched-item'
)
)
{
$link
.
text
(
mw
.
msg
(
'watching'
)
);
promise
=
api
.
watch
(
title
).
done
(
()
=>
{
$subjectLink
.
addClass
(
'mw-watched-item'
);
$link
.
text
(
mw
.
msg
(
'unwatch'
)
);
mw
.
notify
(
mw
.
msg
(
'addedwatchtext-short'
,
title
)
);
}
).
fail
(
(
code
,
data
)
=>
{
$link
.
text
(
mw
.
msg
(
'watch'
)
);
mw
.
notify
(
api
.
getErrorMessage
(
data
),
{
type
:
'error'
}
);
}
);
}
else
{
$link
.
text
(
mw
.
msg
(
'unwatching'
)
);
promise
=
api
.
unwatch
(
title
).
done
(
()
=>
{
$subjectLink
.
removeClass
(
'mw-watched-item'
);
$link
.
text
(
mw
.
msg
(
'watch'
)
);
mw
.
notify
(
mw
.
msg
(
'removedwatchtext-short'
,
title
)
);
}
).
fail
(
(
code
,
data
)
=>
{
$link
.
text
(
mw
.
msg
(
'unwatch'
)
);
mw
.
notify
(
api
.
getErrorMessage
(
data
),
{
type
:
'error'
}
);
}
);
}
promise
.
always
(
()
=>
{
$link
.
removeClass
(
'mw-watch-link-disabled'
);
}
);
e
.
preventDefault
();
}
);
}
);
}()
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, May 16, 12:24 (23 h, 40 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
df/16/688d679d4c01be30cd67809682bc
Default Alt Text
unwatchedPages.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment