User:Pyrospirit/metadata/lowestfirst.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:Pyrospirit/metadata/lowestfirst. |
/* Optional component for metadata script ([[User:Pyrospirit/metadata]]). This script modifies the
* behavior of the metadata script so that the lowest rating found is displayed, rather than the
* highest.
*
* As an optional addition to the script, the code here may be less thoroughly tested or less up-to-
* date than the main script. Also, note that since this significantly changes the order in which
* assessments are detected, the results displayed may not be an accurate reflection of the article's
* quality.
*/
assessment.getRating = function (text) {
if ( text.match(/\bclass *= *stub/i) ) rating = 'stub';
else if ( text.match(/\bclass *= *start/i) ) rating = 'start';
else if ( text.match(/\bclass *= *c\b/i) ) rating = 'c';
else if ( text.match(/\bclass *= *bplus\b/i) ) rating = 'bplus';
else if ( text.match(/\bclass *= *b\b/i) ) rating = 'b';
else if ( text.match(/\bclass *= *ga\b|\bcurrentstatus *= *(ffa\/)?ga\b|\{\{ *ga *\|/i)
&& !text.match(/\bcurrentstatus *= *dga\b/i) ) rating = 'ga';
else if ( text.match(/\bclass *= *a\b/i) ) {
if ( text.match(/\bclass *= *ga\b|\bcurrentstatus *= *(ffa\/)?ga\b/i) )
rating = 'a/ga';
else rating = 'a';
} else if ( text.match(/\b(class|currentstatus) *= *fl\b/i) ) rating = 'fl';
else if ( text.match(/\b(class|currentstatus) *= *fa\b/i) ) rating = 'fa';
else if ( text.match(/\bclass *= *list/i) ) rating = 'list';
else if ( text.match(/\bclass *= *(dab|disambig)/i) ) rating = 'dab';
else if ( text.match(/\bclass *= *cur(rent)?/i) ) rating = 'cur';
else if ( text.match(/\bclass *= *future/i) ) rating = 'future';
else rating = 'none';
return rating;
}