Greasy Fork is available in English.

AO3: Kudos/average hits per chapter ratio

Replace hitcount with kudos/average hits per chapter percentage. Sort works on the page by this ratio.

< Commentaires sur AO3: Kudos/average hits per chapter ratio

Avis: OK - le script fonctionne, mais souffre de quelques problèmes

Hi! I noticed that this has trouble with calculating kudos/hits per chapter (or kudos/average hits per chapter ratio) when the hits value is > 3 digits (aka >999). I checked the parsed values to see where the code was having trouble, and I realized that it's incorrectly parsing the hits value of a 4 digit number as just the first digit (e.g. 5,400 --> 5) because of the comma. I modified the code and it solved the problem for me, so I would recommend making this modification to the countRatio function.

$('dl.stats').each(function() {
var hits_value = $(this).find('dd.hits');

//...add this section of the code below...

// When hits_value.text() is greater than 999 and contains commas or other characters
var hits_count_text = hits_value.text().replace(/,/g, ''); // Remove commas
var hits_count = parseInt(hits_count_text);

Poster une réponse

Connectez-vous pour poster une réponse.