Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4108923
mobile-echo.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
mobile-echo.js
View Options
/* eslint-disable no-jquery/no-global-selector */
module
.
exports
=
function
()
{
var
mobileMediaQuery
=
window
.
matchMedia
(
'screen and (max-width: 550px)'
),
echoHacked
=
false
,
echoHackActive
=
false
,
notifications
=
$
(
'#pt-notifications-alert a'
).
data
(
'counter-num'
)
+
$
(
'#pt-notifications-notice a'
).
data
(
'counter-num'
),
notificationsString
;
// When the icons are clicked for the first time, they are replaced with a JS interface,
// so don't cache this in a long-lived variable
function
getNotificationIcons
()
{
return
$
(
'#pt-notifications-alert, #pt-notifications-notice'
);
}
// Move echo badges in/out of p-personal
function
monoBookMobileMoveEchoIcons
()
{
var
$notificationIcons
=
getNotificationIcons
();
if
(
$notificationIcons
.
length
)
{
if
(
!
echoHackActive
&&
mobileMediaQuery
.
matches
)
{
$
(
'#echo-hack-badges'
).
append
(
$notificationIcons
);
echoHackActive
=
true
;
}
else
if
(
echoHackActive
&&
!
mobileMediaQuery
.
matches
)
{
$
(
$notificationIcons
).
insertBefore
(
'#pt-mytalk'
);
echoHackActive
=
false
;
}
}
}
function
monoBookMobileEchoHack
()
{
var
$notificationIcons
=
getNotificationIcons
();
if
(
$notificationIcons
.
length
)
{
if
(
!
echoHacked
&&
mobileMediaQuery
.
matches
)
{
if
(
notifications
)
{
notificationsString
=
mw
.
msg
(
'monobook-notifications-link'
,
notifications
);
}
else
{
notificationsString
=
mw
.
msg
(
'monobook-notifications-link-none'
);
}
// add inline p-personal echo link
mw
.
util
.
addPortletLink
(
'p-personal'
,
mw
.
util
.
getUrl
(
'Special:Notifications'
),
notificationsString
,
'pt-notifications'
,
$
(
'#pt-notifications-notice'
).
attr
(
'tooltip'
),
null
,
'#pt-preferences'
);
$
(
'#p-personal-toggle'
).
append
(
$
(
'<ul>'
).
attr
(
'id'
,
'echo-hack-badges'
)
);
echoHacked
=
true
;
}
monoBookMobileMoveEchoIcons
();
}
}
$
(
window
).
on
(
'resize'
,
monoBookMobileEchoHack
);
monoBookMobileEchoHack
();
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Aug 18, 20:48 (2 w, 1 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
cd/90/4afc94456f5100971f86e7c2677d
Default Alt Text
mobile-echo.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment