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)
reduced
 
(33 intermediate revisions by the same user not shown)
Line 1: Line 1:
$( function () {
$(document).ready(function(){
  /* original source: https://www.mediawiki.org/wiki/Gadget_kitchen */
  const isEditing = $("div.editButtons").length !== 0;
  let numWords = $("#mw-content-text > div").text().split(" ").length;
  if (isEditing) {
  let headerWords = $("h1").text().split(" ").length;
    $("#firstHeading").append(" \u{1F642} \u{1F609} | \u{1F641}");
  let totalWords = numWords + headerWords;
    $("#toolbar").append("\u{1F642}");
  let timeInMinutes = totalWords / 200;
  }
  let header = $("h1").text();
});
  $("h1").text(header + " (it will take you " + timeInMinutes + " minutes to read this page)");
});

Latest revision as of 17:03, 12 June 2020

$(document).ready(function(){
  const isEditing = $("div.editButtons").length !== 0;
  if (isEditing) {
    $("#firstHeading").append(" \u{1F642} \u{1F609} | \u{1F641}");
    $("#toolbar").append("\u{1F642}");
  }
});