5 var fold = $(window).scrollTop() + $(window).height();
8 $("#annoy-stubs .dynamic-insert").each(function() {inserts.push($(this));});
10 var $intermissions = $("#annoy-stubs .annoy-banner_book-text-intermission");
11 if ($intermissions.length) {
13 $("#book-text a + h2").each(function(i, e) {
16 $($intermissions[which]).clone().insertBefore($(this)).show();
17 which = (which + 1) % $intermissions.length;
21 if ($("#footnotes").length) {
22 $($intermissions[which]).clone().insertBefore($("#footnotes")).show();
24 $($intermissions[which]).clone().appendTo($("#book-text")).show();
29 var underFold = false;
31 $(".paragraph, .stanza").each(function() {
33 if (p.prev().hasClass('anchor')) p = p.prev();
35 if (p.offset().top > fold) {
40 if (inserts[0].attr('data-paragraphs') == counter) {
41 insert = inserts.shift();
42 insert.insertBefore(p);
46 return inserts.length > 0;