Skip to content

Commit c09dd15

Browse files
committed
add Safari 6.1/7.0 support
1 parent 178e723 commit c09dd15

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

book.js

+15-5
Original file line numberDiff line numberDiff line change
@@ -1241,11 +1241,13 @@
12411241
setTimeout(redoToc, 0);
12421242

12431243
});
1244-
document.fontloader.addEventListener('loadingdone', function() {
1245-
// When fonts have been loaded, update the body layout.
1246-
// TODO: This does not seem to work at all times.
1247-
document.body.dispatchEvent(pagination.events.bodyLayoutUpdated);
1248-
});
1244+
if (document.hasOwnProperty('fontloader')) {
1245+
document.fontloader.addEventListener('loadingdone', function() {
1246+
// When fonts have been loaded, update the body layout.
1247+
// TODO: This does not seem to work at all times.
1248+
document.body.dispatchEvent(pagination.events.bodyLayoutUpdated);
1249+
});
1250+
}
12491251
}
12501252
if (pagination.config('enableCrossReferences')) {
12511253
pagination.findAllCrossReferences();
@@ -2145,6 +2147,14 @@
21452147

21462148
flowObject.namedFlow.addEventListener("webkitregionoversetchange", checkOverset);
21472149

2150+
if (navigator.userAgent.indexOf('6.1 Safari/') > -1
2151+
|| navigator.userAgent.indexOf('7.0 Safari/') > -1) {
2152+
/* Safari 6.1/7 does not include the regionoversetchange event.
2153+
* Newer versions should drop the regionlayoutupdate event.
2154+
*/
2155+
flowObject.namedFlow.addEventListener("webkitregionlayoutupdate", checkOverset);
2156+
}
2157+
21482158
flowObject.currentlyChecking = false;
21492159

21502160
if (this.rawdiv) {

index.html

+9-5
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ <h4>Page headers, footnotes, pagenumbers, multi columns, TOC, using CSS Regions<
66

77
<h2>Steps:</h2>
88
<ol>
9-
<li>Download a recent version of Chromium/Chrome (29+)</li>
10-
<li>In Chrome/Chromium open a new tab and go to "<code>chrome://flags/</code>"</li>
11-
<li>Search for "Webkit Experimental Features" and enable them</li>
12-
<li>Restart your browser</li>
9+
<li>Download a recent version of Chromium/Chrome (29+) or Safari 6.1/7.0</li>
10+
<li>If you use Chrome/Chromium:
11+
<ul>
12+
<li>Open a new tab and go to "<code>chrome://flags/</code>"</li>
13+
<li>Search for "Webkit Experimental Features" and enable them</li>
14+
<li>Restart your browser</li>
15+
</ul>
16+
</li>
1317
<li>Read the "Notice" below so you know what to look for and then</li>
1418
<li>Check out the <a href="test.html">simple test book</a>, a book with <a href="test2.html">many chapters</a>, or a book with a <a href="test3.html">very long chapter</a>, <a href="test4.html">top floats</a>.</li>
1519
</ol>
@@ -30,7 +34,7 @@ <h2>Footnotes:</h2>
3034
<p>In order to insert a footnote into the source text, simply insert it as a span with a class 'pagination-footnote', such as <i>&lt;span class='pagination-footnote'&gt;&lt;span&gt;&lt;span&gt;This a footnote&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;</i>. See also the source code of the <a href="test.html">Test Page</a>.</p>
3135

3236
<h2>License:</h2>
33-
BookJS is licensed under the APL license. For further information, check <a href="LICENSE.txt">LICENSE.txt</a>.
37+
BookJS is licensed under the AGPL license. For further information, check <a href="LICENSE.txt">LICENSE.txt</a>.
3438

3539

3640
</body>

0 commit comments

Comments
 (0)