User:Xenwolf/vector.js: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
Xenwolf (talk | contribs)
test https://www.mediawiki.org/wiki/Gadget_kitchen
 
Xenwolf (talk | contribs)
testing
Line 1: Line 1:
$( function () {
var numWords = $("#mw-content-text > div").text().split(" ").length;
  /* original source: https://www.mediawiki.org/wiki/Gadget_kitchen */
 
  let numWords = $("#mw-content-text > div").text().split(" ").length;
var headerWords = $("h1").text().split(" ").length;
  let headerWords = $("h1").text().split(" ").length;
 
  let totalWords = numWords + headerWords;
var totalWords = numWords + headerWords;
  let timeInMinutes = totalWords / 200;
 
  let header = $("h1").text();
var timeInMinutes = totalWords / 200;
  $("h1").text(header + " (it will take you " + timeInMinutes + " minutes to read this page)");
 
});
var header = $("h1").text();
 
$("h1").text(header + " (it will take you " + timeInMinutes + " minutes to read this page)");

Revision as of 20:57, 27 May 2020

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)");