5.14.js 763 B

1234567891011121314151617181920212223242526272829
  1. $(document).ready(function() {
  2. // Use attr() to add an id, rel, and title.
  3. $('div.chapter a[href*="wikipedia"]').attr({
  4. rel: 'external',
  5. title: function() {
  6. return 'Learn more about ' + $(this).text() + ' at Wikipedia.';
  7. },
  8. id: function(index, oldValue) {
  9. return 'wikilink-' + index;
  10. }
  11. });
  12. // Add "back to top" links.
  13. $('<a href="#top">back to top</a>').insertAfter('div.chapter p');
  14. $('<a id="top"></a>').prependTo('body');
  15. // Create footnotes.
  16. var $notes = $('<ol id="notes"></ol>').insertBefore('#footer');
  17. $('span.footnote').each(function(index) {
  18. $(this)
  19. .before([
  20. '<sup>',
  21. index + 1,
  22. '</sup>'
  23. ].join(''))
  24. .appendTo($notes)
  25. .wrap('<li></li>');
  26. });
  27. });