mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 00:13:36 +00:00
Group comment warnings in DOM so they don't break alternate colours
Change-Id: I0516a57a30a59ee6eac0ad2f23f05ad83c396391
This commit is contained in:
parent
4d0498853d
commit
2328a3cad0
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var initialOffset, indentWidth;
|
||||
var initialOffset, indentWidth, firstMarker;
|
||||
|
||||
function markTimestamp( parser, node, match ) {
|
||||
var
|
||||
|
@ -83,11 +83,17 @@ function markComment( comment ) {
|
|||
marker.style.left = ( rect.left + scrollLeft ) + 'px';
|
||||
marker.style.width = ( rect.width ) + 'px';
|
||||
|
||||
if ( !firstMarker ) {
|
||||
firstMarker = marker;
|
||||
}
|
||||
|
||||
if ( comment.warnings && comment.warnings.length ) {
|
||||
markerWarnings = marker.cloneNode( false );
|
||||
markerWarnings.className = 'detected-comment-warnings';
|
||||
markerWarnings.innerText = comment.warnings.join( '\n' );
|
||||
document.body.appendChild( markerWarnings );
|
||||
// Group warnings at the top as we use nth-child selectors
|
||||
// to alternate color of markers.
|
||||
document.body.insertBefore( markerWarnings, firstMarker );
|
||||
}
|
||||
|
||||
document.body.appendChild( marker );
|
||||
|
|
Loading…
Reference in a new issue