Skip to content

Instantly share code, notes, and snippets.

View JayPanoz's full-sized avatar

Jiminy Panoz JayPanoz

View GitHub Profile
@JayPanoz
JayPanoz / eprdctn-merit-badges.md
Last active September 18, 2019 07:21
List of eprdctn merit badges
View eprdctn-merit-badges.md
@JayPanoz
JayPanoz / nm-bookmarklet.txt
Last active October 15, 2018 16:30
Poor man’s night mode
View nm-bookmarklet.txt
javascript:(function()%7Bvar%20nightEnabled%20%3D%20document.head.querySelector(%22%23my-night-style%22)%3Bif%20(nightEnabled)%20%7Bdocument.head.removeChild(nightEnabled)%3B%7D%20else%20%7Bvar%20nightStyle%20%3D%20document.createElement(%22style%22)%3BnightStyle.id%20%3D%20%22my-night-style%22%3BnightStyle.textContent%20%3D%20%22html%20%7Bfilter%3A%20invert(100%25)%20hue-rotate(180deg)%3B%7D%20img%2C%20svg%20%7Bfilter%3A%20invert(100%25)%20hue-rotate(180deg)%20!important%3B%7D%20video%20%7Bfilter%3A%20invert(100%25)%20hue-rotate(180deg)%20!important%3B%7D%22%3Bdocument.head.appendChild(nightStyle)%3B%7D%7D)()
Converted using Mr Coles’ Bookmarklet Creator: https://mrcoles.com/bookmarklet/
@JayPanoz
JayPanoz / book.css
Created April 5, 2018 14:26
JS and CSS files Pages iOS outputs when exporting to EPUB3
View book.css
/* unvisited link */
a:link {
color: initial;
}
/* visited link */
a:visited {
color: initial;
}
@JayPanoz
JayPanoz / index.js
Last active June 5, 2019 16:23
A proof of concept script to append aria doc roles based on epub:type
View index.js
// This is now its own package @ https://github.com/rodebert/epubtype-to-aria
// Please check Rodebert’s repo for a better and more up-to-date version
"use strict";
// Get all the elements with epub:type
// Since querySelectorAll can’t be used with XHTML attributes,
// we create an array in which we’ll push elements with an epub:type attribute
var epubTypes = [];
@JayPanoz
JayPanoz / Dynamic-leading.html
Last active September 3, 2017 14:48
A quick and dirty web app to get the optimal value for leading
View Dynamic-leading.html
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<style type="text/css" id="styles">
html, body {margin: 0; padding: 0;}
.main {
box-sizing: border-box;
display: flex;
@JayPanoz
JayPanoz / ReadiumCSS-UserProps.md
Last active September 6, 2017 08:48
Readium CSS User Agent Properties
View ReadiumCSS-UserProps.md

There is a proposal for user agent properties. To sum things up, browsers would expose user settings so that you can use them in your CSS.

For instance:

body {
  font-size: const(user-font-size);
  font-family: const(user-font-family);
  /* And so on and so forth… */
}
@JayPanoz
JayPanoz / equationEnvironment.xml
Created August 16, 2017 12:34
XML file for MathML you can find in iBooks Author’s EPUB 3
View equationEnvironment.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fonts</key>
<dict>
<key>STIX</key>
<dict>
<key>charMap</key>
<dict>
@JayPanoz
JayPanoz / defaultUserStylesheet.js
Last active June 21, 2017 15:20
Dauwhe’s magical mystery Reading System
View defaultUserStylesheet.js
/* Dauwhe’s magical mystery Reading System
A quick and dirty proto to implement https://twitter.com/dauwhe/status/877533923567390721
This is the future of ebooks’ default stylesheet
#TrollingIsMyFuel
*/
r(function() {
var style = document.createElement("style");
style.id = "ImSorryDaveImAfraidICanDoThat";
@JayPanoz
JayPanoz / LineHeightFromTheTypefaceOut-GoldenRatioEdition.md
Last active June 15, 2017 18:18
Which line-height do you get when sizing based on font-size, x-height and character width
View LineHeightFromTheTypefaceOut-GoldenRatioEdition.md

Line Height based on the typeface x-height and character width | Golden Ratio edition

CSS snippet

p {
  font-size: 1em;
  line-height: calc(1.618em + (1ex - 1ch));
}