MediaWiki:Gadget-Prosesize.js: Difference between revisions

Content deleted Content added
make this work for other wikis if they import/use this code
fallback to regular prose count is tool is down
Line 156:
} );
proseSize -= refmarksize;
// Add the relevant outputs once we have fetched the prose size.
prosePromise.then( function( data ) {
function show_output() {
if ( mw.config.get( 'wgIsArticle' ) ) {
// Tool doesn't work on previews
proseSize = data.prose_size;
wordCount = data.word_count;
} else {
proseSize -= refmarksize;
}
proseValue = sizeElement( 'prose-size', 'Prose size (text only):', proseSize, ' (' + wordCount + ' words) "readable prose size"' );
refValue = sizeElement( 'ref-size', 'References (text only):', refSize + refmarksize );
Line 173 ⟶ 167:
getFileSize( proseHtmlValue );
getRevisionSize( proseValue );
})
// Add the relevant outputs once we have fetched the prose size.
prosePromise.then( function( data ) {
function( data ) {
if ( mw.config.get( 'wgIsArticle' ) ) {
// Tool doesn't work on previews
proseSize = data.prose_size;
wordCount = data.word_count;
} else {
show_output();
},
// If tool is down fallback to our prose count
show_output()
);
}
}