Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4056958
ve.dm.MWDefaultSortMetaItem.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ve.dm.MWDefaultSortMetaItem.js
View Options
/*!
* VisualEditor DataModel MWDefaultSortMetaItem class.
*
* @copyright See AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* DataModel category default sort meta item.
*
* @class
* @extends ve.dm.MetaItem
* @constructor
* @param {Object} element Reference to element in meta-linmod
*/
ve
.
dm
.
MWDefaultSortMetaItem
=
function
VeDmMWDefaultSortMetaItem
()
{
// Parent constructor
ve
.
dm
.
MWDefaultSortMetaItem
.
super
.
apply
(
this
,
arguments
);
};
/* Inheritance */
OO
.
inheritClass
(
ve
.
dm
.
MWDefaultSortMetaItem
,
ve
.
dm
.
MetaItem
);
/* Static Properties */
ve
.
dm
.
MWDefaultSortMetaItem
.
static
.
name
=
'mwDefaultSort'
;
ve
.
dm
.
MWDefaultSortMetaItem
.
static
.
group
=
'mwDefaultSort'
;
ve
.
dm
.
MWDefaultSortMetaItem
.
static
.
matchTagNames
=
[
'span'
];
ve
.
dm
.
MWDefaultSortMetaItem
.
static
.
matchRdfaTypes
=
[
'mw:Transclusion'
];
ve
.
dm
.
MWDefaultSortMetaItem
.
static
.
matchFunction
=
function
(
domElement
)
{
const
mwDataJSON
=
domElement
.
getAttribute
(
'data-mw'
),
mwData
=
mwDataJSON
?
JSON
.
parse
(
mwDataJSON
)
:
{};
return
ve
.
getProp
(
mwData
,
'parts'
,
'0'
,
'template'
,
'target'
,
'function'
)
===
'defaultsort'
;
};
ve
.
dm
.
MWDefaultSortMetaItem
.
static
.
toDataElement
=
function
(
domElements
)
{
const
mwDataJSON
=
domElements
[
0
].
getAttribute
(
'data-mw'
),
mwData
=
mwDataJSON
?
JSON
.
parse
(
mwDataJSON
)
:
{},
input
=
ve
.
getProp
(
mwData
,
'parts'
,
'0'
,
'template'
,
'target'
,
'wt'
);
let
prefix
,
sortKey
;
if
(
input
)
{
prefix
=
input
.
split
(
':'
)[
0
];
sortKey
=
input
.
slice
(
prefix
.
length
+
1
);
}
return
{
type
:
this
.
name
,
attributes
:
{
prefix
:
prefix
,
sortkey
:
sortKey
}
};
};
ve
.
dm
.
MWDefaultSortMetaItem
.
static
.
toDomElements
=
function
(
dataElement
,
doc
)
{
const
prefix
=
dataElement
.
attributes
.
prefix
||
mw
.
config
.
get
(
'wgVisualEditorConfig'
).
defaultSortPrefix
,
sortKey
=
dataElement
.
attributes
.
sortkey
||
''
,
mwData
=
{
parts
:
[
{
template
:
{
target
:
{
wt
:
prefix
+
':'
+
sortKey
,
function
:
'defaultsort'
}
}
}
]
};
const
span
=
doc
.
createElement
(
'span'
);
span
.
setAttribute
(
'typeof'
,
'mw:Transclusion'
);
span
.
setAttribute
(
'data-mw'
,
JSON
.
stringify
(
mwData
)
);
return
[
span
];
};
/* Registration */
ve
.
dm
.
modelRegistry
.
register
(
ve
.
dm
.
MWDefaultSortMetaItem
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Aug 16 2026, 03:44 (13 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
17/4d/e8532aafccf65e8176240bcd9b8a
Default Alt Text
ve.dm.MWDefaultSortMetaItem.js (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment