MediaWiki:Gadget-Prosesize.js: Difference between revisions
Content deleted Content added
ce |
fix |
||
(5 intermediate revisions by the same user not shown) | |||
Line 137:
// Use prosesize API to get a more accurate prose size account
// The calculations below are left in for the highlighting
prosePromise = $.getJSON( 'https://prosesize.toolforge.org/api
// Calculate prose size and size of reference markers ([1] etc)
Line 155 ⟶ 156:
} );
// Add the relevant outputs once we have fetched the prose size.▼
prosePromise.then( function( data ) {▼
function show_output() {
▲ if ( mw.config.get( 'wgIsArticle' ) && mw.config.get( 'wgCurRevisionId' ) === mw.config.get( 'wgRevisionId' ) ) {
proseValue = sizeElement( 'prose-size', 'Prose size (text only):', proseSize
▲ proseSize = data.prose_size;
wordCount = data.word_count;▼
}▼
▲ proseValue = sizeElement( 'prose-size', 'Prose size (text only):', proseSize - refmarksize, ' (' + wordCount + ' words) "readable prose size"' );
refValue = sizeElement( 'ref-size', 'References (text only):', refSize + refmarksize );
refHtmlValue = sizeElement( 'ref-size-html', 'References (including all HTML code):', refSizeHtml + refmarkSizeHtml );
Line 170 ⟶ 167:
getFileSize( proseHtmlValue );
getRevisionSize( proseValue );
}
▲ // Add the relevant outputs once we have fetched the prose size.
function( data ) {
if ( mw.config.get( 'wgIsArticle' ) ) {
// Tool doesn't work on previews
proseSize = data.prose_size;
▲ wordCount = data.word_count;
▲ }
show_output();
},
// If tool is down fallback to our prose count
show_output
);
}
}
|