Jump to content

User:Edokter/FontSizer.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Edokter (talk | contribs) at 15:13, 20 June 2011. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
var fontsizerbuttons =
  '<li id="fontsizer">' +
    '<input type="submit" id="fontsizer-minus" name="minus" value="−" onclick="clickMinus()">' +
    '<input type="submit" id="fontsizer-reset" name="reset" value="100%" onclick="clickReset()">' +
    '<input type="submit" id="fontsizer-plus" name="plus" value="+" onclick="clickPlus()">' +
  '</li>';

var bodytag = document.getElementsByTagName('body')[0];

function clickMinus() {
  bodytag.style.fontSize = '90%';
}

function clickReset() {
  alert(bodytag.style.fontSize);
  bodytag.style.fontSize = '100%';
}

function clickPlus() {
  bodytag.style.fontSize = '110%';
}

$(function() {
  $('div#p-personal ul').append(fontsizerbuttons);
});