Skip to content

Instantly share code, notes, and snippets.

View JayPanoz's full-sized avatar

Jiminy Panoz JayPanoz

View GitHub Profile
@JayPanoz
JayPanoz / a11y-meta.xml
Last active September 17, 2020 13:47
List of ePub 3 a11y metadata
<!-- To put in your .opf file in <metadata>. -->
<!-- Don't forget to add prefix="schema: http://schema.org/" in <package> -->
<!-- Accessibility Metadata -->
<!-- Please get rid of features you don't use in your book -->
<meta property="schema:accessibilityFeature">alternativeText</meta>
<meta property="schema:accessibilityFeature">audioDescription</meta>
<meta property="schema:accessibilityFeature">braille</meta>
<meta property="schema:accessibilityFeature">captions</meta>
@JayPanoz
JayPanoz / eBookColors.less
Last active March 30, 2016 10:33
Colors used in eBook’s RS (background, text, link)
/* CSS filters may be used for some modes
e.g. sepia in iBooks for instance.
Note the eyedropper has been used here,
which could explain unusual text color
for some modes.
In this case, find the filter value
for background and you’ll find the
real value for text + links.
*/
@JayPanoz
JayPanoz / iBooks-iPad-dimensions.md
Last active September 23, 2016 14:42
Dimensions for iBooks on iPad

Dimensions for iBooks on iPad

Dimensions (width + height + body’s left and right margins) have been recovered using JavaScript. One is consistent with those listed at Atavist Help, all others are not (wtf? Could someone confirm?).

As a reminder, iBooks sets columns for html, which is the reason why body’s margin-left and -right apply to each column.

  • Width is window’s width
  • Height is window’s height
  • Inner width is body’s width minus margins.
@JayPanoz
JayPanoz / portrait-caption.css
Last active September 7, 2018 15:45
Experimental CSS to get portrait-aspect-ratio image + caption on same page, on reflow
/* Current nugget */
/* This in your fallback CSS (for ePub 2) */
.portrait-caption {
height: 99%; /* must check if necessary */
margin: 1.5em 0;
page-break-before: auto;
}
.portrait-caption > img {
width: auto;
@JayPanoz
JayPanoz / broken-in-eBooks.md
Last active January 30, 2021 16:05
Here’s a list of fundamentals which are broken in eBooks’ Reading Systems

Broken in eBooks

I hate being ”that guy” but someone must do the dirty work and list all the basic stuff which eBooks’ Reading Systems break in reflow.

So, here’s the stuff you can’t rely upon… Brace yourself, nightmares are coming!

Important advice: make sure your demos/test-case files span several “pages” and don’t rely neither on the results you get on “document ready” nor on the results which are displayed in the first column, usually at the top of your xhtml file. I’ve checked a certain amount of demos for which those issues didn’t show up because of that. Problem is if you publish a tutorial/article and people don’t double-check by themselves, it may lead to catastrophes.

For your information…

@JayPanoz
JayPanoz / all_iBooks.css
Last active May 26, 2016 10:47
Setting "all : keyword" in iBooks
/* Testing initial and unset in iBooks
All those styles are applied.
Comments in .unset if different value */
/* all : initial */
.initial {
-webkit-animation-delay: 0s;
-webkit-animation-direction: normal;
-webkit-animation-duration: 0s;
@JayPanoz
JayPanoz / float-and-flood.css
Last active January 15, 2023 00:07
eBook CSS to make the image float and the text flood when the image doesn’t fit
.float-image {
width: 100%;
float: left;
padding: 0;
display: block;
text-align: center;
margin: 0.75em 0;
margin-top: 1vh; /* will collapse if float + margin-top because your entire CSS will be ignored by legacy RMSDK if you’re using margin: 1vh 0; */
margin-bottom: 1vh;
}
@JayPanoz
JayPanoz / eBookPerf.md
Last active August 30, 2016 15:47
Article meant to be published on Medium, feedbacks and inputs appreciated

Let’s talk about eBook performance

If you’re not an eBook producer, this article probably won’t interest you. As a matter of fact, even if you are, chances are you’ve already experienced painful performance but it’s not something we’re used to speak about so there’s little interest anyway.

Now, if we take a look at the web, performance is everywhere: good performance is a must since it’s part of the user experience, a 3-second delay may cause a dramatic drop in sales, developers try to hit 60 frames per second and so on and so forth.

How many of us, eBook producers, actually have a precise idea of mobile apps’ or eInk Readers’ performance? Can you list CSS or JS bottlenecks? Do you define rules or best practices based on performance? Do you know how Reading Systems work? Really?

I surely can’t answer those questions in an extensive manner. And you probably can’t either because we lack debug tools. So it’s all about testing on a shitload of devices and feeling what doesn’t work well, taking decisions

@JayPanoz
JayPanoz / renderer.min.js
Last active November 22, 2020 00:08
Come On Baby light my fire
/* As of v.5.1 (iOS)
FYI, relies on jQuery 1.5.1
Note to big company involved: 1) there’s no copyright and 2) it’s available with a right click
*/
var KindleRendererAnnotationRenderer = function() {
function g() {
var b = {};
return function(f, a) {
if (b[f] !== void 0) return b[f];
@JayPanoz
JayPanoz / tts.js
Last active October 23, 2016 12:42
Quick and dirty exploration of Speech Synthesis API (just don’t use it AS-IS, thanks!)
/* Quick and dirty exploration of Speech Synthesis API
https://developer.mozilla.org/en/docs/Web/API/SpeechSynthesis
This is some R&D for eBookDys.js
https://github.com/JayPanoz/eBookDys/tree/js
⚠️ DON'T USE IN PRODUCTION ⚠️
*/
// Start script when document is definitely ready (not interactive)