Minor JS bugfix.
authorRadek Czajka <rczajka@rczajka.pl>
Wed, 13 Jan 2021 13:57:37 +0000 (14:57 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Wed, 13 Jan 2021 13:57:37 +0000 (14:57 +0100)
src/annoy/static/annoy/book_text.js

index bcc46f0..b18f1ab 100644 (file)
@@ -25,7 +25,7 @@
             }
         };
 
-        if (inserts) {
+        if (inserts.length) {
             var underFold = false;
             var counter = 0;
             $(".paragraph, .stanza").each(function() {
@@ -46,7 +46,7 @@
                 return inserts.length > 0;
             });
            /* Special case for short poems. */
-           if (inserts && !counter) {
+           if (inserts.length && !counter) {
                inserts[0].insertAfter($(".paragraph, .stanza").last());
            }
         };