Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F6091978
tables.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
tables.js
View Options
const
config
=
require
(
'./config.json'
);
const
init
=
()
=>
{
if
(
!
config
.
VectorWrapTablesTemporary
)
{
return
;
}
const
tables
=
document
.
querySelectorAll
(
'.mw-parser-output > table.wikitable'
);
let
numberBigTables
=
0
;
Array
.
from
(
tables
).
forEach
(
(
table
)
=>
{
const
styles
=
window
.
getComputedStyle
(
table
);
const
isFloat
=
styles
.
getPropertyValue
(
'float'
)
===
'right'
||
styles
.
getPropertyValue
(
'float'
)
===
'left'
;
// Don't wrap tables within tables
const
parent
=
table
.
parentElement
;
if
(
parent
&&
!
parent
.
matches
(
'.noresize'
)
&&
!
parent
.
closest
(
'table'
)
&&
!
isFloat
)
{
const
tableRect
=
table
.
getBoundingClientRect
();
const
tableWidth
=
tableRect
&&
tableRect
.
width
;
const
wrapper
=
document
.
createElement
(
'div'
);
wrapper
.
classList
.
add
(
'noresize'
);
parent
.
insertBefore
(
wrapper
,
table
);
wrapper
.
appendChild
(
table
);
if
(
tableWidth
>
948
)
{
numberBigTables
++
;
}
}
}
);
if
(
numberBigTables
>
0
)
{
// @ts-ignore
mw
.
errorLogger
.
logError
(
new
Error
(
`T374493:
${
numberBigTables
}
tables wrapped`
),
'error.web-team'
);
}
};
module
.
exports
=
{
init
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 5 2026, 22:47 (6 w, 1 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
0e/6b/0c9a7c8d683ef5248ac996f7ef28
Default Alt Text
tables.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment