Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4002247
ext.cite.tracking.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
ext.cite.tracking.js
View Options
'use strict'
;
/**
* Temporary tracking to evaluate the impact of Reference Previews on
* users' interaction with references.
*
* @memberof module:ext.cite.ux-enhancements
* @see https://phabricator.wikimedia.org/T214493
* @see https://phabricator.wikimedia.org/T231529
* @see https://phabricator.wikimedia.org/T353798
* @see https://meta.wikimedia.org/wiki/Schema:ReferencePreviewsBaseline
* @see https://meta.wikimedia.org/wiki/Schema:ReferencePreviewsCite
*/
const
CITE_BASELINE_LOGGING_SCHEMA
=
'ext.cite.baseline'
;
// Same as in the Popups extension
// FIXME: Could be an extension wide constant when Reference Previews is merged into this code base
const
REFERENCE_PREVIEWS_LOGGING_SCHEMA
=
'event.ReferencePreviewsPopups'
;
// EventLogging may not be installed
mw
.
loader
.
using
(
'ext.eventLogging'
).
then
(
()
=>
{
$
(
()
=>
{
if
(
!
navigator
.
sendBeacon
||
!
mw
.
config
.
get
(
'wgIsArticle'
)
)
{
return
;
}
// FIXME: This might be obsolete when the code moves to the this extension
mw
.
trackSubscribe
(
REFERENCE_PREVIEWS_LOGGING_SCHEMA
,
(
type
,
data
)
=>
{
if
(
data
.
action
.
indexOf
(
'anonymous'
)
!==
-
1
)
{
mw
.
config
.
set
(
'wgCiteReferencePreviewsVisible'
,
data
.
action
===
'anonymousEnabled'
);
}
}
);
// eslint-disable-next-line no-jquery/no-global-selector
$
(
'#mw-content-text'
).
on
(
'click'
,
// Footnote links, references block in VisualEditor, and reference content links.
'.reference a[ href*="#" ], .mw-reference-text a, .reference-text a'
,
function
()
{
const
isInReferenceBlock
=
$
(
this
).
parents
(
'.references'
).
length
>
0
;
mw
.
eventLog
.
dispatch
(
CITE_BASELINE_LOGGING_SCHEMA
,
{
action
:
(
isInReferenceBlock
?
'clickedReferenceContentLink'
:
'clickedFootnote'
),
// FIXME: This might be obsolete when the code moves to the this extension and
// we get state directly.
// eslint-disable-next-line camelcase
with_ref_previews
:
mw
.
config
.
get
(
'wgCiteReferencePreviewsVisible'
)
}
);
}
);
}
);
}
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Aug 14 2026, 07:14 (14 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
23/b6/c667da62b95a2d6c923a3036ccd7
Default Alt Text
ext.cite.tracking.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment