User:R0o0di/common.js: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
mw. | const numWords = $( '#mw-content-text > div' ).text().split( ' ' ).length; | ||
const headerWords = $( 'h1' ).text().split( ' ' ).length; | |||
const totalWords = numWords + headerWords; | |||
const timeInMinutes = totalWords / 200; | |||
const header = $( 'h1' ).text(); | |||
$( 'h1' ).text( header + ' (it will take you ' + timeInMinutes + ' minutes to read this page)' ); | |||
Revision as of 21:15, 11 April 2025
const numWords = $( '#mw-content-text > div' ).text().split( ' ' ).length; const headerWords = $( 'h1' ).text().split( ' ' ).length; const totalWords = numWords + headerWords; const timeInMinutes = totalWords / 200; const header = $( 'h1' ).text(); $( 'h1' ).text( header + ' (it will take you ' + timeInMinutes + ' minutes to read this page)' );