shared readium js code extracted