Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yuya-takeyama/1170348 to your computer and use it in GitHub Desktop.
Save yuya-takeyama/1170348 to your computer and use it in GitHub Desktop.
Real World Haskell の HTML 中に節番号振るグリモン
// ==UserScript==
// @name section_numbers_for_real_world_haskell.user.js
// @namespace http://yuyat.jp/
// @description Gives section numbers for Real World Haskell book online.
// @include http://book.realworldhaskell.org/read/*
// ==/UserScript==
(function (elements) {
var n = 1;
for (var i in elements) {
var element = elements[i];
if (i > 0 && element.tagName === 'H2') {
element.innerHTML = n + ". " + element.innerHTML;
n += 1;
}
}
})(document.getElementsByClassName('title'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment