Ladsgroup has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/358311 )
Change subject: Rework highlighting frontend to make it work everywhere
......................................................................
Rework highlighting frontend to make it work everywhere
Bug: T155930
Bug: T155903
Change-Id: I58556e114e56fb868239097912a37ca79090ca10
---
M modules/ext.ores.highlighter.css
M modules/ext.ores.highlighter.js
M modules/ext.ores.styles.css
3 files changed, 28 insertions(+), 36 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ORES
refs/changes/11/358311/1
diff --git a/modules/ext.ores.highlighter.css b/modules/ext.ores.highlighter.css
index 8f84666..68ab22d 100644
--- a/modules/ext.ores.highlighter.css
+++ b/modules/ext.ores.highlighter.css
@@ -1,12 +1,12 @@
/* Make the whole rows various shades of yellow */
-.damaging.ores-highlight[data-ores-damaging='verylikelybad'] {
+.damaging.mw-changeslist-damaging-verylikelybad {
background-color: #fc3;
}
-.damaging.ores-highlight[data-ores-damaging='likelybad'] {
+.damaging.mw-changeslist-damaging-likelybad {
background-color: #ffe79e;
}
-.damaging.ores-highlight[data-ores-damaging='maybebad'] {
+.damaging.mw-changeslist-damaging-maybebad {
background-color: #fef6e7;
}
diff --git a/modules/ext.ores.highlighter.js b/modules/ext.ores.highlighter.js
index c5bb9ac..b61b2cd 100644
--- a/modules/ext.ores.highlighter.js
+++ b/modules/ext.ores.highlighter.js
@@ -1,35 +1,28 @@
( function ( mw, $ ) {
- 'use strict';
- $( function () {
- var $changesList = $( '.mw-changeslist, .mw-contributions-list'
),
- thresholds = mw.config.get( 'oresThresholds' ).damaging,
- levels = [ 'verylikelybad', 'likelybad', 'maybebad' ],
- scores = mw.config.get( 'oresData' );
- if ( !$changesList.length ) {
- return;
- }
+ 'use strict';
+ $( function () {
+ var $changesList = $( '.mw-changeslist,
.mw-contributions-list' ),
+ thresholds = mw.config.get( 'oresThresholds'
).damaging,
+ levels = [ 'verylikelybad', 'likelybad', 'maybebad' ],
+ scores = mw.config.get( 'oresData' );
+ if ( !$changesList.length ) {
+ return;
+ }
- $( 'li.damaging' ).each( function () {
- var i, revid, score,
- $link = $( this ).find( 'a.mw-changeslist-diff'
),
- href = $link.prop( 'href' ),
- uri = new mw.Uri( href );
- if ( !href ) {
- return;
- }
- // URI looks like either diff=prev&oldid=R, or
diff=R&oldid=P, and we want R
- revid = uri.query.diff === 'prev' ? uri.query.oldid :
uri.query.diff;
- if ( !scores[ revid ] ) {
- return;
- }
- score = scores[ revid ].damaging;
- for ( i = 0; i < levels.length; i++ ) {
- if ( score > thresholds[ levels[ i ] ] ) {
- $( this ).attr( 'data-ores-damaging',
levels[ i ] );
- break;
- }
- }
- } );
- } );
+ $( 'li[data-mw-revid]' ).each( function () {
+ var i, revid, score;
+ revid = $( this ).attr('data-mw-revid');
+ if ( !scores[ revid ] ) {
+ return;
+ }
+ score = scores[ revid ].damaging;
+ for ( i = 0; i < levels.length; i++ ) {
+ if ( score > thresholds[ levels[ i ] ] ) {
+ $( this ).addClass(
'mw-changeslist-damaging-' + levels[ i ] );
+ break;
+ }
+ }
+ } );
+ } );
}( mediaWiki, jQuery ) );
diff --git a/modules/ext.ores.styles.css b/modules/ext.ores.styles.css
index 579d357..900ae27 100644
--- a/modules/ext.ores.styles.css
+++ b/modules/ext.ores.styles.css
@@ -4,8 +4,7 @@
}
/* Make the whole row orange if highlighted */
-li.damaging.ores-highlight,
-tr.damaging.ores-highlight {
+.damaging.ores-highlight {
background: #fef6e7;
line-height: 1.8;
}
--
To view, visit https://gerrit.wikimedia.org/r/358311
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I58556e114e56fb868239097912a37ca79090ca10
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits