Page MenuHomePhabricator
Paste P4289

(An Untitled Masterwork)
ActivePublic

Authored by Ladsgroup on Oct 23 2016, 8:53 AM.
Referenced Files
F4645635:
Oct 23 2016, 8:53 AM
Subscribers
None
/**
* Created by amir on 10/23/16.
*/
( function ( mw, $ ) {
'use strict';
var colors = {
0.40: '#750787',
0.50: '#004DFF',
0.60: '#008026',
0.70: '#FFED00',
0.80: '#FF8C00',
0.90: '#E40303'
}
$('li').each( function (){
if ( $( this ).children('a').attr('href') ) {
var reg = /diff=(\d+)/ig
var res = reg.exec( $(this).children('a').attr('href') );
if (res && res[1] in mw.config.get('oresData')) {
var score = mw.config.get('oresData')[res[1]]['damaging'];
var threshold = 0;
for ( threshold in colors ) {
if ( score > threshold ) {
$( this ).css( 'background-color', colors[threshold]);
}
}
}
}
} )
}( mediaWiki, jQuery ) );