123456789101112131415161718192021222324252627 |
- $(document).ready(function () {
- 'use strict';
- // Use attr() to add an id, rel, and title.
- $('div.chapter a[href*="wikipedia"]').attr({
- rel: 'external',
- title: function () {
- return 'Learn more about ' + $(this).text() + ' at Wikipedia.';
- },
- id: function (index, oldValue) {
- return 'wikilink-' + index;
- }
- });
- // Add "back to top" links.
- $('<a href="#top">back to top</a>').insertAfter('div.chapter p');
- $('<a id="top"></a>').prependTo('body');
- // insertBefore <elem> prependTo <children /> appendTo </elem> insertAfter
- // Create footnotes.
- // This works just as well, in spite of what the book says.
- // $('span.footnote').insertAfter('div.chapter');
- $('span.footnote')
- .insertBefore('#footer')
- .wrapAll('<ol id="notes"></ol>')
- .wrap('<li></li>');
- });
|