User:PrelevatedInsider22581/common.js: Difference between revisions
From BetaArchive Wiki
(Created page with " mw.loader.load( '//en.wikipedia.org/w/index.php?title=MediaWiki:VisualEditor.js&action=raw&ctype=text/javascript' ); window.onload = function() { var target = document...") |
No edit summary |
||
Line 2: | Line 2: | ||
window.onload = function() { | window.onload = function() { | ||
var target = document.getElementById( 'visualeditor' ); | var target = document.getElementById( 'visualeditor' ); | ||
var numWords = $("#mw-content-text > div").text().split(" ").length; | |||
var headerWords = $("h1").text().split(" ").length; | |||
var totalWords = numWords + headerWords; | |||
var timeInMinutes = totalWords / 200; | |||
var header = $("h1").text(); | |||
$("h1").text(header + " (it will take you " + timeInMinutes + " minutes to read this page)"); | |||
} |
Revision as of 17:51, 17 July 2023
mw.loader.load( '//en.wikipedia.org/w/index.php?title=MediaWiki:VisualEditor.js&action=raw&ctype=text/javascript' ); window.onload = function() { var target = document.getElementById( 'visualeditor' ); var numWords = $("#mw-content-text > div").text().split(" ").length; var headerWords = $("h1").text().split(" ").length; var totalWords = numWords + headerWords; var timeInMinutes = totalWords / 200; var header = $("h1").text(); $("h1").text(header + " (it will take you " + timeInMinutes + " minutes to read this page)"); }