joseph / monocle Goto Github PK
View Code? Open in Web Editor NEWA silky, tactile browser-based ebook JavaScript library.
Home Page: http://monocle.inventivelabs.com.au
License: MIT License
A silky, tactile browser-based ebook JavaScript library.
Home Page: http://monocle.inventivelabs.com.au
License: MIT License
Hi,
we would like to display two pages in landscape mode. Do you think this might be possible with Monocle? I am currently in the process of getting to know the source code to find out whether CSS columns might be used to this end.
Do you see any conceptual obstacles?
Regards,
Tim
I dont know if it is my styling that messes something up, but when you resize the reader in firefox, the transparent black overlay doesn't disappear rendering the book unflipable and you need to reload the page to continue.
We should have explicit support for cover images, so that they can be displayed outside the normal page objects (which have margins and controls and so on).
This might use the getMetaData function of the book object.
Alternatively, maybe a cover is itself a control? Perhaps, but it would probably want to make use of the flipper's animation, and that implies a page object. This is a bit tricky, actually.
https://github.com/joseph/Monocle/blob/master/src/compat.js#L233 it applied to Safari 5.1.
Can this workaround be removed entirely, since it's long fixed in Chrome?
Hi,
I have been doing some Monocle tests in a Android 3.1 tablet (http://www.pcworld.com/article/227373/asus_eee_pad_transformer_tf101_review_innovative_design_makes_this_tablet_stand_out.html) and I found many issues in monocle page transitions. All the flippers seems not working. The slider seems to be the flipper more stable (event thought stop work suddenly).
Any idea for work around ?
I haven't tested in 3.7 alphas, but at the moment, the animation for the Slider flipper is painfully slow in Gecko-based browsers. I doubt we'll see the 3D acceleration that is available to Safari and MobileSafari, but there might be something we can do.
I have been using an AJAX call to load components following the Dubliners online example. It's been working fine for me. However, I have noticed there is duplicity in the content returned via AJAX in the "src=" in iframe as well as in between the <iframe> and </iframe> tags. When I load Arabic UTF8 characters, iOS and Safari hangs. I'm suspecting this is the problem. I looked through the examples and I can't see an AJAX loading example.
Also, I have noticed that Dubliners is not using iframes at all.
Here's my bookData code:
var bookData = {
getComponents: function () {
return [ <% @book.spine.each do |item|%>
'/books/<%[email protected]%>/section?section=<%=item%>',
<%end%>];
},
getComponent: function (componentId) {
return this.getViaAjax(componentId);
},
getViaAjax: function (path) {
var ajReq = new XMLHttpRequest();
ajReq.open("GET", path, false);
ajReq.send(null);
return ajReq.responseText;
}
}
Hi,
I have a few questions regarding Monocle. I am new to Javascript so please forgive my newbie questions. Please let me know if these questions should be posted elsewhere.
1 – How can I get the value of lastPageNumber for the current chapter ? A code snippet would be appreciated. It seems it is not exposed through the API, but I could be wrong.
2 – My chapters have images alongside the text. When clicking on an image, a lightbox is displayed so that you can view the image in higher resolution using prettyphoto.
Basically, my img has a onclick function which calls the code to display the lightbox. The problem is of course that this also triggers a page change in Monocle.
I tried using the event from the onclick method and call stopPropagation and preventDefault, but this did not work. I believe the Monocle reader receives the event before my onclick.
Any suggestions?
3 – Similarly, I have an option to select a text quote from the book and email it to a friend. The Select Quote has a Boolean which is true when this mode is on, and false otherwise.
The problem again is that on the mouseup event, The Monocle change page occurs. Is there a way to temporarily turn off the listening of mouse events in the reader (while quotation mode is true) and re-enabling them after?
I have been scratching my head and I have no idea on how to accomplish this. A code snippet if possible would again be appreciated.
Thank you very much,
I'm using slider flipper, and want to highlight a paragraph when it is double clicked. It looks ok if paragraph is in one page. But if a paragraph covers two pages, highlight is only applied to the active page.
How can I apply highlight effect to another page(iframe)? Can one page fire event, and another page listen it?
In the test folder, under the "controls" test, it appears to me that the internal styles that apply to the class "reader" are ignored. For instance, there's an attempt to center the h3 tag, but it clearly isn't applied to the displayed text in the reader.
I toyed a bit and figured that to get it to work, I'd have to set the styleSheet attribute while initializing the reader. In this case, that's done via a variable that's already used to set the panels:
function () {
var readerOptions = {
panels: Monocle.Panels.Marginal,
stylesheet: "h3 {text-align: center; }"
};
(I added the "stylesheet" variable)
Perhaps not a bug in the Monocle reader itself, but a misleading test case.
Hi,
I would like to know if Monocle has support to Epub3 format (http://idpf.org/epub/30/spec/epub30-changes.html) or if this library is agnostic regarding the version of Epub.
Thanks
Including a Monocle book on an existing, styled page (such as at monocle.inventivelabs.com.au) is problematic, because the CSS rules of the page get applied to the internals of the book. We can't exactly rely on page designers to avoid breaking the display of the book.
There's no simple way to take the element out of the cascading style hierarchy, except by using an iframe. This iframe should by dynamically created by Monocle during reader initialization. Arguably it could be optional — since in many cases the book element is the only element on the page (such as the 'full screen' examples at that site), and an iframe is therefore superfluous.
Additionally, this would introduce a different problem: what if the designer should have some control over the styling of content within the book? How do we attach designer-provided styles to the iframe?
Hey,
So, here's an example of how I've implemented monocle into my website with a simple user interface. I think it's a bit different than what was intended for monocle and the use of the epub standard, and I've been debating to myself if I should start now to make the switch. Perhaps some people using Monocle could help me make that decision or help to modify the method I'm using.
Basically, instead of using epubs or an array of html files, I'm using simple xml files with the chapters and such divided by xml tags. Then, I'm using PHP and XSLT to transform the XML to XHTML and feed it to the Monocle reader. I'm doing this not for ease of reading or control over formatting, but simply for ease of writing, ease of updating the content of the site, and keeping the content more organized (one story or book as one file). Plus, the XSLT is simple and provides plenty of formatting options of basic text.
Here's the address to the "Fiction" page of my site:
http://www.sciencefictionjournal.com/Worlds/Fiction.html
And the interface works as such:
The Fiction.html has three main divisions. A "rdr" division for monocle, a navigation div, and a division with a php script that creates a list of links to the XML "book" files.
Upon clicking a link in the XML list, it calls a php page, FictionReader.php. This page includes the monocle-min.js, calls for an instance of the monocle reader, and uses PHP to parse and format the XML file with XSLT. All of this is then directed to the "rdr" div in the Fiction.html page. This all functions great.
The structure of the XML files is as such:
<document>
<book>
<info>
<type>Fiction</type>
<genre>Science Fiction</genre>
<title>Heavy Dosage</title>
<issue>Chapter 1</issue>
<date>02-26-2010</date>
<author>Mr. Mutant</author>
</info>
<body>Blablablablabla
</body>
</book
<book>
<info>
<type>Fiction</type>
<genre>Science Fiction</genre>
<title>Heavy Dosage</title>
<issue>Chapter 2</issue>
<date>02-26-2010</date>
<author>Mr. Mutant</author>
</info>
<body>Blablablablabla
</body>
</book>
</document>
Based on this structure, I was wandering if there is a method to load each "book" as a separate component in Monocle. Then create a simple table of contents based on the "issue" tags. I don't know if it is is even possible after the XSL transformation - which is what I'd like to keep as my formatting tool. Perhaps this is to complicated or not following the general development of Monocle as a whole? Any feedback would be helpful.
I'm hoping that in the near future I will have a better understanding of JQuery and Javascript so that I can help with the development and feedback of Monocle. In the meantime I may just be experimenting with different ways to use what's already been coded.
Thanks for your time,
Mr. Mutant
Hi,
I am using Monocle to test read some epubs files. On Monocle initialization, in getComponent function, I am doing an Ajax response to get the contents of each section of my epubs.
Everything is working fine but when books XHTML code include the tag "image" with xlink:href attribute (to specify the image source), it does not work in Safari (image is not presented). It affects all Safari versions (PC, IPhone, IPad, etc). In other browsers (Firefox, Chrome), it works fine.
Just to 2 more notes:
getComponent: function(cmptId)
{
return { url: cmptId};
}
Does anyone know a work around for this issue?
Thanks
J Santos
I tried integrating hyphenator.js in the test book totc, but I cannot get it to work with Monocle (no problem using it in standalone simpler webpages).
I tried loading the script in the <head>
:
<script type="text/javascript" src="hyphenate.js"></script>
And adding class="hyphenate"
(which is what I set hyphenator.js to look for in its mergeAndPack-Tool) to either <body>
or each <div id="part…">
.
Any experience/hint on integrating it into Monocle?
Most everywhere, the html#RS\\:monocle img
default style rule applies, constraining the height of images to the height of the page. But because iOS is just a little bit crazy, the percentage value in that rule is not being calculated against height of the frame. So if an image is very tall and not wide enough to trigger the max-width rule, it will be cut up over multiple pages.
This could be bludgeoned by manually setting the max-height of each image to the pixel height of the component frame every time the component frame height changes, but that's slow and prone to measurement problems.
function pageAtPercentageThrough(pc) {
return Math.round(p.component.lastPageNumber() * pc);
}
When the percentage location is small enough, method returns (page) 0 - which causes the reader to display the last page of the previous chapter.
Totach
Hi,
For various reasons, I implemented my own save last-page-read code. I am using a cookie to save the page.
Once I initialize the reader (see code below), I use the window.reader.moveTo({ direction: lastPage }); function to go to the appropriate page. This works fine. The problem is that I see page 1 displayed for about 500msec before the new page is displayed. Is there anyway to tell the reader to initialize with a start page to avoid this flicker? As you can tell below, I am not using bookData. The book html is loaded directly in the div called "mycenter".
Thanks for any insight you can provide.
function initializeReader()
{
window.reader = Monocle.Reader('mycenter');
// MAGNIFIER
var magnifier = new Monocle.Controls.Magnifier(reader);
reader.addControl(magnifier, 'page');
var pgN = displayPageNumber(reader);
/* Because the 'reader' element changes size on window resize,
* we should notify it of this event. */
Monocle.addListener(
window,
'resize',
function () { window.reader.resized() }
);
}
First, thanks for the great tool. I have started customizing it recently and encountered an IE problem (not a surprise, huh?).
I understand that the html content of the book is loaded in an iframe (Ex: <iframe src="/books/the-velveteen-rabbit" class="embeddedBook"></iframe> in the ebook at home page http://monocle.inventivelabs.com.au/) and that monocle reader components are not used.
We are building few functionalities (like: notes, bookmarks, search) using the reader component. Because of this, we are not able to bring in the new reader functionalities in IE browsers.
If you look at the showcase folder of the source code & try to open the same velveteen-rabbit book in IE, it will not open. The "view source" shows that the Monocle components are used in it. The moment I use monocle components, the book doesn't load in IE.
Please share your thoughts.
There's three different kinds of styles:
The first category is already well supported in Monocle, using the Monocle.Styles hash and any additional rules provided in the page CSS. However, note that the intended move to a dynamic iframe will make CSS rules outside Monocle.Styles impractical. Perhaps the initialization of the reader should allow the user to provide the HTML for the content of the iframe? But that's getting a bit convoluted.
The second category is thorny. Firstly, the EPUB spec lists all the CSS1/2 properties that must be supported, and absurdly makes up a few of its own. By implication, anything not listed there should be dropped — but does that make sense, or just hold EPUB creators back? Secondly, rules defined in EPUB files may well make the book look worse in Monocle, not better — especially where they are intended for specific reader targets (like iBooks or Stanza or ADE), or particular device capabilities (like a monochrome screen). Rules like width and margin seem like a bad idea, and should probably be dropped even though the spec allows them.
The third category is an interesting idea, not included in the EPUB spec. Here, particular generic rules that are defined in the component could be overridden with specific rules for Monocle, if the EPUB creator chooses. This way they could add margins to ADE with a generic rule, and have auto margins for Monocle. It's as simple as scoping the rule to a Monocle-defined classname.
There's also a hybrid category — where rules defined in the 1) category override the book's styles. So the developer integrating Monocle on their own site could provide styles to override any book's styles, across the board.
Tasks:
How do I create a forward or back button that would flip a page?
As stated in the README, Monocle currently only supports synchronous AJAX requests, because the book data object's getComponent call must return the text itself.
By providing an optional callback mechanism, we could support the existing API and still offer more conventional AJAX/dynamic-script-tags support. The basic rule of thumb is not to make the book data object API more complex in the process. This might mean that if getComponent returns null, we wait for the callback to complete before permitting the page change.
Hello,
I'm experimenting to extract epub files and put it in an automatic way in monocle with bookData object
Some parsing of epub files, according to your doc give me for example this:
Sheridan Le Fanu was born at No. 45 Lower Dominick Steet, Dublin, into a literary family of Huguenot origins. Both his grandmother Alicia Sheridan Le Fanu and his great-uncle Richard Brinsley Sheridan were playwrights. His niece Rhoda Broughton would become a very successful novelist. Within a year of his birth his family moved to the Royal Hibernian Military School in Phoenix Park, where his father, an Anglican clergyman, was the chaplain of the establishment. Phoenix Park and the adjacent village and parish church of Chapelizod were to feature in Le Fanu\'s later stories. Le Fanu studied law at Trinity College in Dublin, where he was elected Auditor of the College Historical Society. He was called to the bar in 1839, but he never practised and soon abandoned law for journalism. In 1838 he began contributing stories to the Dublin University Magazine, including his first ghost story, entitled "A Strange Event in the Life of Schalken the Painter" (1839). He became owner of several newspapers from 1840, including the Dublin Evening Mail and the Warder. In 1844 Le Fanu married Susanna Bennett, the daughter of a leading Dublin barrister. In 1847 he supported John Mitchell and Thomas Meagher in their campaign against the indifference of the Government to the Irish Famine. His support cost him the nomination as Tory MP for County Carlow in 1852. His personal life also became difficult at this time, as his wife Susanna suffered from increasing neurotic symptoms. She died in 1858 in unclear circumstances, and anguished excerpts from Le Fanu\'s diaries suggest that he felt guilt as well as loss. However, it was only after her death that, becoming something of a recluse, he devoted himself full time to writing. In 1861 he became the editor and proprietor of the Dublin University Magazine and he began exploiting double exposure: serializing in the Dublin University Magazine and then revising for the English market. The House by the Churchyard and Wylder\'s Hand were both published in this way. After the lukewarm reviews of the former novel, set in the Phoenix Park area of Dublin, Le Fanu signed a contract with Richard Bentley, his London publisher, which specified that future novels be stories "of an English subject and of modern times", a step Bentley thought necessary in order for Le Fanu to satisfy the English audience. Le Fanu succeeded in this aim in 1864, with the publication of Uncle Silas, which he set in Derbyshire. In his very last short stories, however, Le Fanu returned to Irish folklore as an inspiration and encouraged his friend Patrick Kennedy to contribute folklore to the D.U.M. Le Fanu died in his native Dublin on February 7, 1873. Today there is a road in Ballyfermot, near his childhood home in south-west Dublin, named after him. Source: Wikipedia
At the edge of melancholy Catstean Moor, in the north of England, with half-a-dozen ancient poplar-trees with rugged and hoary stems around, one smashed across the middle by a flash of lightning thirty summers before, and all by their great height dwarfing the abode near which they stand, there squats a rude stone house, with a thick chimney, a kitchen and bedroom on the ground-floor, and a loft, accessible by a ladder, under the shingle roof, divided into two rooms.
Its owner was a man of ill repute. Tom Chuff was his name. A shock-headed, broad-shouldered, powerful man, though somewhat short, with lowering brows and a sullen eye. He was a poacher, and hardly made an ostensible pretence of earning his bread by any honest industry. He was a drunkard. He beat his wife, and led his children a life of terror and lamentation, when he was at home. It was a blessing to his frightened little family when he absented himself, as he sometimes did, for a week or more together.
On the night I speak of he knocked at the door with his cudgel at about eight o\'clock. It was winter, and the night was very dark. Had the summons been that of a bogie from the moor, the inmates of this small house could hardly have heard it with greater terror.
His wife unbarred the door in fear and haste. Her hunchbacked sister stood by the hearth, staring toward the threshold. The children cowered behind.
Tom Chuff entered with his cudgel in his hand, without speaking, and threw himself into a chair opposite the fire. He had been away two or three days. He looked haggard, and his eyes were bloodshot. They knew he had been drinking.
Tom raked and knocked the peat fire with his stick, and thrust his feet close to it. He signed towards the little dresser, and nodded to his wife, and she knew he wanted a cup, which in silence she gave him. He pulled a bottle of gin from his coat-pocket, and nearly filling the teacup, drank off the dram at a few gulps.
He usually refreshed himself with two or three drams of this kind before beating the inmates of his house. His three little children, cowering in a corner, eyed him from under a table, as Jack did the ogre in the nursery tale. His wife, Nell, standing behind a chair, which she was ready to snatch up to meet the blow of the cudgel, which might be levelled at her at any moment, never took her eyes off him; and hunchbacked Mary showed the whites of a large pair of eyes, similarly employed, as she stood against the oaken press, her dark face hardly distinguishable in the distance from the brown panel behind it.
Tom Chuff was at his third dram, and had not yet spoken a word since his entrance, and the suspense was growing dreadful, when, on a sudden, he leaned back in his rude seat, the cudgel slipped from his hand, a change and a death-like pallor came over his face.
For a while they all stared on; such was their fear of him, they dared not speak or move, lest it should prove to have been but a doze, and Tom should wake up and proceed forthwith to gratify his temper and exercise his cudgel.
In a very little time, however, things began to look so odd, that they ventured, his wife and Mary, to exchange glances full of doubt and wonder. He hung so much over the side of the chair, that if it had not been one of cyclopean clumsiness and weight, he would have borne it to the floor. A leaden tint was darkening the pallor of his face. They were becoming alarmed, and finally braving everything his wife timidly said, "Tom!" and then more sharply repeated it, and finally cried the appellative loudly, and again and again, with the terrified accompaniment, "He\'s dying—he\'s dying!" her voice rising to a scream, as she found that neither it nor her plucks and shakings of him by the shoulder had the slightest effect in recalling him from his torpor.
And now from sheer terror of a new kind the children added their shrilly piping to the talk and cries of their seniors; and if anything could have called Tom up from his lethargy, it might have been the piercing chorus that made the rude chamber of the poacher\'s habitation ring again. But Tom continued unmoved, deaf, and stirless.
His wife sent Mary down to the village, hardly a quarter of a mile away, to implore of the doctor, for whose family she did duty as laundress, to come down and look at her husband, who seemed to be dying.
The doctor, who was a good-natured fellow, arrived. With his hat still on, he looked at Tom, examined him, and when he found that the emetic he had brought with him, on conjecture from Mary\'s description, did not act, and that his lancet brought no blood, and that he felt a pulseless wrist, he shook his head, and inwardly thought:
"What the plague is the woman crying for? Could she have desired a greater blessing for her children and herself than the very thing that has happened?"
Tom, in fact, seemed quite gone. At his lips no breath was perceptible. The doctor could discover no pulse. His hands and feet were cold, and the chill was stealing up into his body.
The doctor, after a stay of twenty minutes, had buttoned up his great-coat again and pulled down his hat, and told Mrs. Chuff that there was no use in his remaining any longer, when, all of a sudden, a little rill of blood began to trickle from the lancet-cut in Tom Chuffs temple.
"That\'s very odd," said the doctor. "Let us wait a little."
I must describe now the sensations which Tom Chuff had experienced.
With his elbows on his knees, and his chin upon his hands, he was staring into the embers, with his gin beside him, when suddenly a swimming came in his head, he lost sight of the fire, and a sound like one stroke of a loud church bell smote his brain.
Then he heard a confused humming, and the leaden weight of his head held him backward as he sank in his chair, and consciousness quite forsook him.
When he came to himself he felt chilled, and was leaning against a huge leafless tree. The night was moonless, and when he looked up he thought he had never seen stars so large and bright, or sky so black. The stars, too, seemed to blink down with longer intervals of darkness, and fiercer and more dazzling emergence, and something, he vaguely thought, of the character of silent menace and fury.
He had a confused recollection of having come there, or rather of having been carried along, as if on men\'s shoulders, with a sort of rushing motion. But it was utterly indistinct; the imperfect recollection simply of a sensation. He had seen or heard nothing on his way.
He looked round. There was not a sign of a living creature near. And he began with a sense of awe to recognise the place.
The tree against which he had been leaning was one of the noble old beeches that surround at irregular intervals the churchyard of Shackleton, which spreads its green and wavy lap on the edge of the Moor of Catstean, at the opposite side of which stands the rude cottage in which he had just lost consciousness. It was six miles or more across the moor to his habitation, and the black expanse lay before him, disappearing dismally in the darkness. So that, looking straight before him, sky and land blended together in an undistinguishable and awful blank.
There was a silence quite unnatural over the place. The distant murmur of the brook, which he knew so well, was dead; not a whisper in the leaves about him; the air, earth, everything about and above was indescribably still; and he experienced that quaking of the heart that seems to portend the approach of something awful. He would have set out upon his return across the moor, had he not an undefined presentiment that he was waylaid by something he dared not pass.
The old grey church and tower of Shackleton stood like a shadow in the rear. His eye had grown accustomed to the obscurity, and he could just trace its outline. There were no comforting associations in his mind connected with it; nothing but menace and misgiving. His early training in his lawless calling was connected with this very spot. Here his father used to meet two other poachers, and bring his son, then but a boy, with him.
Under the church porch, towards morning, they used to divide the game they had taken, and take account of the sales they had made on the previous day, and make partition of the money, and drink their gin. It was here he had taken his early lessons in drinking, cursing, and lawlessness. His father\'s grave was hardly eight steps from the spot where he stood. In his present state of awful dejection, no scene on earth could have so helped to heighten his fear.
There was one object close by which added to his gloom. About a yard away, in rear of the tree, behind himself, and extending to his left, was an open grave, the mould and rubbish piled on the other side. At the head of this grave stood the beech-tree; its columnar stem rose like a huge monumental pillar. He knew every line and crease on its smooth surface. The initial letters of his own name, cut in its bark long ago, had spread out and wrinkled like the grotesque capitals of a fanciful engraver, and now with a sinister significance overlooked the open grave, as if answering his mental question, "Who for is t\' grave cut?"
He felt still a little stunned, and there was a faint tremor in his joints that disinclined him to exert himself; and, further, he had a vague apprehension that take what direction he might, there was danger around him worse than that of staying where he was.
On a sudden the stars began to blink more fiercely, a faint wild light overspread for a minute the bleak landscape, and he saw approaching from the moor a figure at a kind of swinging trot, with now and then a zig-zag hop or two, such as men accustomed to cross such places make, to avoid the patches of slob or quag that meet them here and there. This figure resembled his father\'s, and like him, whistled through his finger by way of signal as he approached; but the whistle sounded not now shrilly and sharp, as in old times, but immensely far away, and seemed to sing strangely through Tom\'s head. From habit or from fear, in answer to the signal, Tom whistled as he used to do five-and-twenty years ago and more, although he was already chilled with an unearthly fear.
Like his father, too, the figure held up the bag that was in his left hand as he drew near, when it was his custom to call out to him what was in it. It did not reassure the watcher, you may be certain, when a shout unnaturally faint reached him, as the phantom dangled the bag in the air, and he heard with a faint distinctness the words, "Tom Chuff\'s soul!"
Scarcely fifty yards away from the low churchyard fence at which Tom was standing, there was a wider chasm in the peat, which there threw up a growth of reeds and bulrushes, among which, as the old poacher used to do on a sudden alarm, the approaching figure suddenly cast itself down.
From the same patch of tall reeds and rushes emerged instantaneously what he at first mistook for the same figure creeping on all-fours, but what he soon perceived to be an enormous black dog with a rough coat like a bear\'s, which at first sniffed about, and then started towards him in what seemed to be a sportive amble, bouncing this way and that, but as it drew near it displayed a pair of fearful eyes that glowed like live coals, and emitted from the monstrous expanse of its jaws a terrifying growl.
This beast seemed on the point of seizing him, and Tom recoiled in panic and fell into the open grave behind him. The edge which he caught as he tumbled gave way, and down he went, expecting almost at the same instant to reach the bottom. But never was such a fall! Bottomless seemed the abyss! Down, down, down, with immeasurable and still increasing speed, through utter darkness, with hair streaming straight upward, breathless, he shot with a rush of air against him, the force of which whirled up his very arms, second after second, minute after minute, through the chasm downward he flew, the icy perspiration of horror covering his body, and suddenly, as he expected to be dashed into annihilation, his descent was in an instant arrested with a tremendous shock, which, however, did not deprive him of consciousness even for a moment.
He looked about him. The place resembled a smoke-stained cavern or catacomb, the roof of which, except for a ribbed arch here and there faintly visible, was lost in darkness. From several rude passages, like the galleries of a gigantic mine, which opened from this centre chamber, was very dimly emitted a dull glow as of charcoal, which was the only light by which he could imperfectly discern the objects immediately about him.
What seemed like a projecting piece of the rock, at the corner of one of these murky entrances, moved on a sudden, and proved to be a human figure, that beckoned to him. He approached, and saw his father. He could barely recognise him, he was so monstrously altered.
"I\'ve been looking for you, Tom. Welcome home, lad; come along to your place."
Tom\'s heart sank as he heard these words, which were spoken in a hollow and, he thought, derisive voice that made him tremble. But he could not help accompanying the wicked spirit, who led him into a place, in passing which he heard, as it were from within the rock, deadful cries and appeals for mercy.
"What is this?" said he.
"Never mind."
"Who are they?"
"New-comers, like yourself, lad," answered his father apathetically. "They give over that work in time, finding it is no use."
"What shall I do?" said Tom, in an agony.
"It\'s all one."
"But what shall I do?" reiterated Tom, quivering in every joint and nerve.
"Grin and bear it, I suppose."
"For God\'s sake, if ever you cared for me, as I am your own child, let me out of this!"
"There\'s no way out."
"If there\'s a way in there\'s a way out, and for Heaven\'s sake let me out of this."
But the dreadful figure made no further answer, and glided backwards by his shoulder to the rear; and others appeared in view, each with a faint red halo round it, staring on him with frightful eyes, images, all in hideous variety, of eternal fury or derision. He was growing mad, it seemed, under the stare of so many eyes, increasing in number and drawing closer every moment, and at the same time myriads and myriads of voices were calling him by his name, some far away, some near, some from one point, some from another, some from behind, close to his ears. These cries were increased in rapidity and multitude, and mingled with laughter, with flitting blasphemies, with broken insults and mockeries, succeeded and obliterated by others, before he could half catch their meaning.
All this time, in proportion to the rapidity and urgency of these dreadful sights and sounds, the epilepsy of terror was creeping up to his brain, and with a long and dreadful scream he lost consciousness.
When he recovered his senses, he found himself in a small stone chamber, vaulted above, and with a ponderous door. A single point of light in the wall, with a strange brilliancy illuminated this cell.
Seated opposite to him was a venerable man with a snowy beard of immense length; an image of awful purity and severity. He was dressed in a coarse robe, with three large keys suspensed from his girdle. He might have filled one\'s idea of an ancient porter of a city gate; such spiritual cities, I should say, as John Bunyan loved to describe.
This old man\'s eyes were brilliant and awful, and fixed on him as they were, Tom Chuff felt himself helplessly in his power. At length he spoke:
"The command is given to let you forth for one trial more. But if you are found again drinking with the drunken, and beating your fellow-servants, you shall return through the door by which you came, and go out no more."
With these words the old man took him by the wrist and led him through the first door, and then unlocking one that stood in the cavern outside, he struck Tom Chuff sharply on the shoulder, and the door shut behind him with a sound that boomed peal after peal of thunder near and far away, and all round and above, till it rolled off gradually into silence. It was totally dark, but there was a fanning of fresh cool air that overpowered him. He felt that he was in the upper world again.
In a few minutes he began to hear voices which he knew, and first a faint point of light appeared before his eyes, and gradually he saw the flame of the candle, and, after that, the familiar faces of his wife and children, and he heard them faintly when they spoke to him, although he was as yet unable to answer.
He also saw the doctor, like an isolated figure in the dark, and heard him say:
"There, now, you have him back. He\'ll do, I think."
His first words, when he could speak and saw clearly all about him, and felt the blood on his neck and shirt, were:
"Wife, forgie me. I\'m a changed man. Send for\'t sir."
Which last phrase means, "Send for the clergyman."
When the vicar came and entered the little bedroom where the scared poacher, whose soul had died within him, was lying, still sick and weak, in his bed, and with a spirit that was prostrate with terror, Tom Chuff feebly beckoned the rest from the room, and, the door being closed, the good parson heard the strange confession, and with equal amazement the man\'s earnest and agitated vows of amendment, and his helpless appeals to him for support and counsel.
These, of course, were kindly met; and the visits of the rector, for some time, were frequent.
One day, when he took Tom Chuff\'s hand on bidding him good-bye, the sick man held it still, and said:
"Ye\'r vicar o\' Shackleton, sir, and if I sud dee, ye\'ll promise me a\'e thing, as I a promised ye a many. I a said I\'ll never gie wife, nor barn, nor folk o\' no sort, skelp nor sizzup more, and ye\'ll know o\' me no more among the sipers. Nor never will Tom draw trigger, nor set a snare again, but in an honest way, and after that ye\'ll no make it a bootless bene for me, but bein\', as I say, vicar o\' Shackleton, and able to do as ye list, ye\'ll no let them bury me within twenty good yerd-wands measure o\' the a\'d beech trees that\'s round the churchyard of Shackleton."
"I see; you would have your grave, when your time really comes, a good way from the place where lay the grave you dreamed of."
"That\'s jest it. I\'d lie at the bottom o\' a marl-pit liefer! And I\'d be laid in anither churchyard just to be shut o\' my fear o\' that, but that a\' my kinsfolk is buried beyond in Shackleton, and ye\'ll gie me yer promise, and no break yer word."
"I do promise, certainly. I\'m not likely to outlive you; but, if I should, and still be vicar of Shackleton, you shall be buried somewhere as near the middle of the churchyard as we can find space."
"That\'ll do."
And so content they parted.
The effect of the vision upon Tom Chuff was powerful, and promised to be lasting. With a sore effort he exchanged his life of desultory adventure and comparative idleness for one of regular industry. He gave up drinking; he was as kind as an originally surly nature would allow to his wife and family; he went to church; in fine weather they crossed the moor to Shackleton Church; the vicar said he came there to look at the scenery of his vision, and to fortify his good resolutions by the reminder.
Impressions upon the imagination, however, are but transitory, and a bad man acting under fear is not a free agent; his real character does not appear. But as the images of the imagination fade, and the action of fear abates, the essential qualities of the man reassert themselves.
So, after a time, Tom Chuff began to grow weary of his new life; he grew lazy, and people began to say that he was catching hares, and pursuing his old contraband way of life, under the rose.
He came home one hard night, with signs of the bottle in his thick speech and violent temper. Next day he was sorry, or frightened, at all events repentant, and for a week or more something of the old horror returned, and he was once more on his good behaviour. But in a little time came a relapse, and another repentance, and then a relapse again, and gradually the return of old habits and the flooding in of all his old way of life, with more violence and gloom, in proportion as the man was alarmed and exasperated by the remembrance of his despised, but terrible, warning.
With the old life returned the misery of the cottage. The smiles, which had begun to appear with the unwonted sunshine, were seen no more. Instead, returned to his poor wife\'s face the old pale and heartbroken look. The cottage lost its neat and cheerful air, and the melancholy of neglect was visible. Sometimes at night were overheard, by a chance passer-by, cries and sobs from that ill-omened dwelling. Tom Chuff was now often drunk, and not very often at home, except when he came in to sweep away his poor wife\'s earnings.
Tom had long lost sight of the honest old parson. There was shame mixed with his degradation. He had grace enough left when he saw the thin figure of "t\' sir" walking along the road to turn out of his way and avoid meeting him. The clergyman shook his head, and sometimes groaned, when his name was mentioned. His horror and regret were more for the poor wife than for the relapsed sinner, for her case was pitiable indeed.
Her brother, Jack Everton, coming over from Hexley, having heard stories of all this, determined to beat Tom, for his ill-treatment of his sister, within an inch of his life. Luckily, perhaps, for all concerned, Tom happened to be away upon one of his long excursions, and poor Nell besought her brother, in extremity of terror, not to interpose between them. So he took his leave and went home muttering and sulky.
Now it happened a few months later that Nelly Chuff fell sick. She had been ailing, as heartbroken people do, for a good while. But now the end had come.
There was a coroner\'s inquest when she died, for the doctor had doubts as to whether a blow had not, at least, hastened her death. Nothing certain, however, came of the inquiry. Tom Chuff had left his home more than two days before his wife\'s death. He was absent upon his lawless business still when the coroner had held his quest.
Jack Everton came over from Hexley to attend the dismal obsequies of his sister. He was more incensed than ever with the wicked husband, who, one way or other, had hastened Nelly\'s death. The inquest had closed early in the day. The husband had not appeared.
An occasional companion—perhaps I ought to say accomplice—of Chuff\'s happened to turn up. He had left him on the borders of Westmoreland, and said he would probably be home next day. But Everton affected not to believe it. Perhaps it was to Tom Chuff, he suggested, a secret satisfaction to crown the history of his bad married life with the scandal of his absence from the funeral of his neglected and abused wife.
Everton had taken on himself the direction of the melancholy preparations. He had ordered a grave to be opened for his sister beside her mother\'s, in Shackleton churchyard, at the other side of the moor. For the purpose, as I have said, of marking the callous neglect of her husband, he determined that the funeral should take place that night. His brother Dick had accompanied him, and they and his sister, with Mary and the children, and a couple of the neighbours, formed the humble cortège.
Jack Everton said he would wait behind, on the chance of Tom Chuff coming in time, that he might tell him what had happened, and make him cross the moor with him to meet the funeral. His real object, I think, was to inflict upon the villain the drubbing he had so long wished to give him. Anyhow, he was resolved, by crossing the moor, to reach the churchyard in time to anticipate the arrival of the funeral, and to have a few words with the vicar, clerk, and sexton, all old friends of his, for the parish of Shackleton was the place of his birth and early recollections.
But Tom Chuff did not appear at his house that night. In surly mood, and without a shilling in his pocket, he was making his way homeward. His bottle of gin, his last investment, half emptied, with its neck protruding, as usual on such returns, was in his coat-pocket.
His way home lay across the moor of Catstean, and the point at which he best knew the passage was from the churchyard of Shackleton. He vaulted the low wall that forms its boundary, and strode across the graves, and over many a flat, half-buried tombstone, toward the side of the churchyard next Catstean Moor.
The old church of Shackleton and its tower rose, close at his right, like a black shadow against the sky. It was a moonless night, but clear. By this time he had reached the low boundary wall, at the other side, that overlooks the wide expanse of Catstean Moor. He stood by one of the huge old beech-trees, and leaned his back to its smooth trunk. Had he ever seen the sky look so black, and the stars shine out and blink so vividly? There was a deathlike silence over the scene, like the hush that precedes thunder in sultry weather. The expanse before him was lost in utter blackness. A strange quaking unnerved his heart. It was the sky and scenery of his vision! The same horror and misgiving. The same invincible fear of venturing from the spot where he stood. He would have prayed if he dared. His sinking heart demanded a restorative of some sort, and he grasped the bottle in his coat-pocket. Turning to his left, as he did so, he saw the piled-up mould of an open grave that gaped with its head close to the base of the great tree against which he was leaning.
He stood aghast. His dream was returning and slowly enveloping him. Everything he saw was weaving itself into the texture of his vision. The chill of horror stole over him.
A faint whistle came shrill and clear over the moor, and he saw a figure approaching at a swinging trot, with a zig-zag course, hopping now here and now there, as men do over a surface where one has need to choose their steps. Through the jungle of reeds and bulrushes in the foreground this figure advanced; and with the same unaccountable impulse that had coerced him in his dream, he answered the whistle of the advancing figure.
On that signal it directed its course straight toward him. It mounted the low wall, and, standing there, looked into the graveyard.
"Who med answer?" challenged the new-comer from his post of observation.
"Me," answered Tom.
"Who are you?" repeated the man upon the wall.
"Tom Chuff; and who\'s this grave cut for?" He answered in a savage tone, to cover the secret shudder of his panic.
"I\'ll tell you that, ye villain!" answered the stranger, descending from the wall, "I a\' looked for you far and near, and waited long, and now you\'re found at last."
Not knowing what to make of the figure that advanced upon him, Tom Chuff recoiled, stumbled, and fell backward into the open grave. He caught at the sides as he fell, but without retarding his fall.
An hour later, when lights came with the coffin, the corpse of Tom Chuff was found at the bottom of the grave. He had fallen direct upon his head, and his neck was broken. His death must have been simultaneous with his fall. Thus far his dream was accomplished.
It was his brother-in-law who had crossed the moor and approached the churchyard of Shackleton, exactly in the line which the image of his father had seemed to take in his strange vision. Fortunately for Jack Everton, the sexton and clerk of Shackleton church were, unseen by him, crossing the churchyard toward the grave of Nelly Chuff, just as Tom the poacher stumbled and fell. Suspicion of direct violence would otherwise have inevitably attached to the exasperated brother. As it was, the catastrophe was followed by no legal consequences.
The good vicar kept his word, and the grave of Tom Chuff is still pointed out by the old inhabitants of Shackleton pretty nearly in the centre of the churchyard. This conscientious compliance with the entreaty of the panic-stricken man as to the place of his sepulture gave a horrible and mocking emphasis to the strange combination by which fate had defeated his precaution, and fixed the place of his death.
The story was for many a year, and we believe still is, told round many a cottage hearth, and though it appeals to what many would term superstition, it yet sounded, in the ears of a rude and simple audience, a thrilling, and let us hope, not altogether fruitless homily.
Hi.. I found the closed issue on this, but wanted to make shure i understood correctly. You said there is no plans to make monocle compatible with older versions of IE, but how about IE8 ? After i switched to the componentry branch it's not working in IE8 anymore.. Not even with the legacy flipper. Is this intended ? My current solution requires me to support IE7 and IE8 but does not have to be full featured, so that ie7 and ie8 should be able to load, but can live with just a scrollbar or something that enables you to see the contents of the book.
So.. If there is no support i guess i'll have to make it myself.
@joseph
Do you have some advise on how i go about this. Im a fairly advanced js-dev, but any pointers to where i have to start would be great
So, I resolved the issue of loading components from an XML file that denotes certain chapters based on XML tags. Pretty simple, really; I've modified the XSL stylesheet to create division tags in the HTML based on chapters and then Monocle loads them based on the getElementById('components") function in the getComponents method. This is great for content that is updated frequently. The XSL keeps the formatting simple and separate and allows for content to be updated without having to add HTML tags innitially (such as paragraph tags and such).
The only problem I'm running into at this point is trying to load a table of contents dynamically based on what file is selected for the viewer to display. So far I've tried creating a hidden division within the HTML (using, again, XSL) that displays a table of contents as it would show in the Javascript, then call that with getElementById,("chaps").innerHTML. But this causes a freezeup in Monocle. I'm damned near certain that I have the structural hierarchy correct, and I think this is something to do with how the getContents method reads the title: and src: objects. Is there a way to load a TOC based on a certain file that is selected?
Thanks,
Mr. Mutant
Ok.. So i've been playing around with a new buildscript made with 'make' but i can't figure out the correct order to build in. It's almost there but strange errors ocur. Could you make an ordered list of the files in the order they should be added ? I will ofcourse share my makefile when its working.
As a general principle, it would make sense for Monocle to have an offline mode, where previously requested components are available to the Book object loaded from the browser's database or key/value store.
From this functionality, a "Sync" control could be trivially created that iterates over all the component ids and requests them, so that they sit in local storage. Then a book could be read offline.
However, because it's browser-based, this still isn't sufficient for someone to, say, launch MobileSafari while on a plane to read a book, when the book isn't currently open in their browser. That feels somewhat outside the scope of Monocle — but it'd be great if we could at least propose a technique for it. Worth noting that Ibis Reader appears to support this.
[Note: I deleted another comment in this thread and edited the original one. Sorry for the back and forth]
I understand that the "monocle:componentchange" event is fired, when the iFrame of a component is changed but without the style being applied / measuring done.
Since I need to hook up directly to the actual content (html or xml, i.e. iFrame.contentDocument) it would be cool to have an event like "monocle:componentready" that let's me know, when a component is in the actual visible status.
I know that the framework (in it's current form) is not intent to work with the content directly. However, I think that this would be a handy addition for the future.
Also I'm not sure if "componentchange" is a good name for the event, since future developers might think, that the component is displayed now (same applies for "monocle:loaded", where the components are also not necessarily ready).
Using Chrome 10.0.648.205 on Windows 7 and Chromium 10.0.648.133 (77742) Ubuntu 10.10 only a two pages of content show for each chapter on the demo here http://monocle.inventivelabs.com.au/books/dubliners. That is there are two pages of text for each chapter then blank pages show as you click through until you get to the beginning of another chapter.
Works on Firefox.
Hi,
I have been doing some tests to moveTo function from reader.js and the behavior seems to be weird. For the same locus passed (I am creating locus instances passing the component Id and the percentage), sometimes the function move the book to the expected place but other times it just show the spinner and nothing happens (no error is written to console).
I realized also that, in some cases of error, if I resize the browser window (forcing monocle to render the current page again), it shows the expected page (not sure if it "fix" the issue in all cases).
My questions are:
Thanks
JSantos
If a book data object is made up of several HTML files, such as the example book Dubliners, the page count is for a particular file instead of the whole book, which is then very little reference of how far in the book one is. It would be great to be able to display page no. X of book's total Y.
Since Monocle supports standard HTML content, it would be great to have an easy way to allow for standard HTML controls and events within a book. That way, if the book references a website a standard link within the book pointed at a new window (so it loads in a separate tab / window) would be great for those moments when the book references URL's (rather than the user having to type them in by hand like the print versions of my books ;-) or you want to offer a "Like" link for the book within the book. (For full bore websites it's not quite as important as it might be for stand alone apps on platforms like the iPhone. Current using Monocle + PhoneGap to distribute eBook copies of my print books - works nice, by the way.)
I'm having a lot of problems trying to change de actual monocle book with another one with ajax.
Is there any way to destroy the monocle object and create a new one?
Thanks!
not work in ie7.0 and ie6.0?
or have the solution?
thanks.
magnifier.js has two fixed font sizes:
// Constants.
var k = {
LARGE_FONT_SIZE: "115%",
NORMAL_FONT_SIZE: Monocle.Styles.content['font-size'] || "100%"
}
I cannot find a parent to Monocle.Styles.content that I can assign a base CSS font-size
to, which those percentages would inherit (besides just editing magnifier.js per book style, which does not seem very tidy).
I'm trying to modify the Table of Contents in the 'totc' example to be able hide/unhide child nodes when I click on the parent. So in the TOC, if i have:
-Title1
---Subtitle_1a
---Subtitle_1b
-Title2
Clicking on Title1 would hide the subtitles and clicking again would unhide it. I tried modifying parts of the contents.js, but was unable to achieve this thus far.
I'm new to Javascript so any tips/instructions would be much appreciated.
If this isn't the right place to ask the question, please let me know where I could get help.
Thanks!
Hi,
During some tests to the new version of Monocle (1.0.299 available at http://github.com/joseph/monocle/tree/componentry), I realized that the reader cannot render books which page files extension is not html or xhtml (it show a blank page instead).
However, there are a lot of ePubs which content files have 'xml' extension (for instance, see http://www.epubbooks.com/book/377/importance-of-being-earnest)
There's any work around for this issue ?
I'm developing a web-based epub viewer using phonegap for iOS 4+. I have got monocle to appear correctly but only by using version 1.0.0 of the monocle library - the 'min' js file and the css code used by the 'velveteen' rabbit viewer on the monocle homepage. It will not render correctly with the version 2.
What has changed?
We have problems customizing monocle to suit for ePub files with TABLE, TR, TD tags.. Then we found that none of monocle ePub sample files has those tags, could someone explain why? Thanks!
Hi Joseph, monocle is great!! thank you very much for share it. I have doubt when I display the dickens example in chrome (last version of monocle) only see a blank book, when i used firefox works ok!
Thank you
I tried Monocle on the recommendation of Liza Daly as part of a project I'm working on: http://jiscpub.blogs.edina.ac.uk/2011/04/14/introducing-epub2html-adding-a-plain-html-view-to-an-epub/
I wanted to be able to add an index.html to an epub file that could be used as a pure HTML reader but I have had trouble understanding how to get Monocle working. I looked at the examples in the componentry branch but it seems like an awful lot of code is need to get something working.
Some suggestions:
Would it be possible to provide some kind of basic useful default reader that can be invoked using a very small number of lines of code rather than the several in the test example? Bonus points if it only needs one div element in the HTML to anchor it.
Could this use a JSON table of contents specified declaratively rather than every implementation having to re-write the http loading code?
I am happy to help but at the moment I'm finding the README file quite challenging - I have no idea what spinners or flippers are or what a control might actually look like or why I might need Rake and I was not able to get the reader to work in my application in the limited amount of time I spent on it. (Worked OK when I pulled in the application from here: http://monocle.inventivelabs.com.au/books/dubliners but that had bugs and I wanted to have the files served locally)
Is There any way to reset the Monocle reader after resizing the fonts of the Content from out side ?
I can verify that this does not happen on the latest release version of Chrome 9, but the problem persists in Chrome 11 dev. While 11 is a dev version, it's very possible these changes will roll down to the release version soon. Tested with booki.sh today.
because this line should be src = src.replace(/\n/g, '\\n').replace(/\r/, '\\r');
However, we'll also use loadFrameFromJavaScript from now on.
Hi there.. First of all GREAT piece of code.. I really like how clean and nicely you coded this framework.
I'm creating a reader that i would like to be full-page. My idea was to have a control-bar in the top of the page, but this creates problems considering the current method for adding controls. Wouldn't it be better if the controls where decoupled from the the content ? Then you could update the controlls when flipping a page ? Maybe i havn't looked enough at the code and this is totally possible within the current realm.. What are your thoughts ?
Hi,
Doing some tests to Monocle, I noticed that contents control (that generates the table of contents) has some issues when accessed by an IPhone or Ipad. In fact, the sections list is well presented but if the list is long, I cannot scroll to see the last results.
I’ve made an example at http://www.rswebportal.com/assets/joseph-Monocle-ae73c74/test/controls/index2.html to repro this issue.
Is this an issue of Monocle css?
If the src of a component contains a Regular Expression character (such as a ? in a php url), the Regular Expression in chaptersForComponent breaks. Simple fix would be to create a quick RegEx escape function such as:
RegExp.escape = function(text) {
return text.replace(/[-[]{}()*+?.,^$|#\s]/g, "$&");
}
and then escape the cmptId:
var matcher = new RegExp('^'+RegExp.escape(cmptId)+"(#(.+)|$)");
Hi,
I am using Monocle to do some tests and I found some problems with relative paths in Xhtml files of ePubs. In particular, I realized that, despite a XHTML inside a ePub include a correct path to a resource (e.g. image or CSS), the Monocle reader is requesting the resource from root.
Example:
XHTML file (available in http://localhost/dest/123/maugham.magician/OPS/title.xml)
HTTP request performed by Moncole reader:
http://localhost/css/book.css instead of http://localhost/dest/123/css/book.css (NOTE THAT THE BASE URL IS ROOT INSTEAD OF CURRENT XHTML URL).
Does someone know any work around for this issue ?
Thanks
J. Santos
I currently use rdr.addPageStyles() to apply a custom style to the pages. That works perfectly well.
However, the text "jumps" since the default style is applied right before the custom style comes into the game.
Maybe it would be useful to pass a custom style in the initialize options, so the reader can use the custom style right for the initial rendering.
I have added a popover controller to my monocle reader and it hides when I click away from it. However, I would like to catch this hide event in order to add my own logic. Is it possible? How?
I have been analyzing the monocle code and found the line that hides the control (it is a listener from overlay in reader.js). But, it seems that when it occurs, it is not dispacted any event that allows me listen from my code. Any idea ?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.