drabble judgment

is that thing tagged drabble actually a drabble

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         drabble judgment
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  is that thing tagged drabble actually a drabble
// @author       scriptfairy
// @match        http*://archiveofourown.org/*works*
// @grant        none
// ==/UserScript==

(function($) {
    var works = $('li.blurb');
    for (i=0;i<works.length;i++) {
        var freeforms = $('li.freeforms',works[i]), wordCount = $('dd.words',works[i]).text(), chapterCount = $('dd.chapters',works[i]).text();
        wordCount = parseInt(wordCount.replace(',',''));
        chapterCount = parseInt(chapterCount.substring(0,chapterCount.indexOf('/')));
        freeforms = freeforms.filter(function(index){
            return $(this).text().search(/[Dd]rabbles?$/) != -1;
        });
        if (freeforms.length >= 1 && (wordCount/chapterCount <= 90 || (wordCount/chapterCount >= 110) && wordCount/chapterCount <= 300)) {
            $('a',freeforms[0]).text('Probably not a Drabble');
        }
        else if (freeforms.length >=1 && wordCount/chapterCount > 300 && wordCount/chapterCount <= 1000) {
            $('a',freeforms[0]).text('Not actually a Drabble');
        }
        else if (freeforms.length >=1 && wordCount/chapterCount > 1000) {
            $('a',freeforms[0]).text('NOTHING LIKE A DRABBLE');
        }
    }
})(window.jQuery);