Monday, July 13, 2015

Lost in the JavaScript rainforest

Okay, so maybe it’s time to ask for help. Well actually all I need pointed out to me is a manageable path through the jungle, and I’ll be off trekking on my own again. I’ve been to forums like but have been so put off by the smartaleckiness of some of the experts answering newbie questions that forums have become my last-resort sources of information. I thought I’d try the message-in-a-bottle-thrown-into-the-search-engine-ocean approach and see what results. If you’re an expert in JavaScript/jQuery with infinite patience, or know someone who is, I would greatly appreciate a bit of useful information. However, if you’ve grown tired of the same newbie questions over and over... umm, why do you answer those questions? Fame? Opportunities for bullying? It looks good on the resume? Please feel free to go do something else. All newbies deserve to be treated with respect, no matter how poorly formed their familiar question is, because it’s their first time asking the question.

The project I’m working on fits somewhere between “ebook” and “app.” It’s both, or it’s one looking like the other. When I started out it seemed like it wouldn’t be all that difficult to create a novel that presents the reader with simple games at certain plot points to unlock subsequent text. I’ve encountered a few novels in the app stores that attempt to add new ways of communicating the story to the reader, and it does seem to be how fiction will naturally evolve with the availability of the new media. The lines will naturally begin to blur between novel, graphic novel, game, movie and music video. So it does seem to me to be a worthwhile direction in which to head.

The project started out pleasantly with my writing several chapters of the book while simultaneously formatting the text with html/css in Sigil, and what I was producing was much cleaner than the hairy html one gets when going from Word through Calibre to Sigil. What a mess. As I coded I would view the results in the graphic window and then resume writing in the code window. Nice, efficient. However, when I tried to do more elaborate things I learned that Sigil wasn’t the program to use. This was before the epub3 enhancements, but even now Sigil understands only part of the new features, and it’s now no longer being updated. I migrated to Aptana Studio 3 and was able to add JavaScript and jQuery and create graphics like an iPhone-style “camera” which makes additional text appear after the reader has clicked the shutter a set number of times, things like that. One of the problems I’m having without the epub format is forming linked text boxes that allow the text to flow through pages rather than scrolling. Also I’d like to have background sound files play continuously through several pages.

I consulted forums and read about Ajax. Then I learned that Processing and Ionic are replacing antiquated jQuery. Then there was Node.js and NPM and SPA and the CLI. The underbrush was getting thicker so I thought I should get a book. I looked at Learning Single Page Web Application Development by Fernando Monteiro, and o-m-g. MongoDB, Express, AngularJS, Yeoman, Bower, Grunt, PureCSS, Hackathon, Passport, Json, Postman, Karma, Protractor, and Jasmine from the TOC and under “What you need for this book” is a list of modules that covers two pages. Forever, Glob, Helmet, Morgan, Swig? And the reason for this pile of modules is? The reason? To make JavaScript easier to work with! Ba ha ha ha ha ha ha ha ha ha! It’s all to ease the pain of working with JavaScript! Lord, if JavaScript needs this many bandaids, it’s probably time to rewrite it. I did buy Monteiro’s book, and it’s well written. But I’m now much less interested in becoming a designer who builds cross-platform apps with html5 and Cordova on a full-time basis. If this is the state of the industry, it’s not interesting. It’s a mess, like Word/Calibre/Sigil html code. It’s not that it’s too confusing; it’s that it’s totally illogical. Having to make frequent use of the CLI now is like Scotty picking up the mouse and speaking into it “Computer.” All of the functionality provided by this shrubbery of modules surrounding JavaScript should be provided by JavaScript itself. The core should be fundamentally repaired, or it should be replaced with something that integrates everything efficiently and smoothly.

Anyway, thanks for letting me vent. Now, where was I? Because my project is primarily an ebook, I can’t take the PDF fixed-layout route. Long passages of text between the games need to flow to accommodate different device resolutions. If epub3 is robust enough to allow full-screen boxes, each containing a maze or hidden-object game with sound effects, to flow along with the text without being split by page breaks, it would be great, but I haven’t run into a program that would act as a next-gen Sigil. I recently bought QuarkXpress but haven’t found that its ebook editor or AppStudio are developed enough to let me accomplish what I want to do easily. Probably with enough jerryrigging… Because the project would function as an ebook, the whole thing needs to be downloaded so it’s available offline. I’ve started looking at Macaw, thinking that I could construct the book like a portrait-oriented website that is entirely cached and that flips single pages instead of scrolling, but I’m not hopeful. If someone could recommend a logical path through the jungle, I’d be grateful. Not a path that involves climbing a lot of trees and swinging on vines and then spelunking and then walking on stilts through quicksand, but just a path. I know someone could say that I’ve (yet another metaphor) bitten off more than I can chew and I should hold off on this kind of hybrid project until I’m more seasoned, but I’ve actually bitten off what I want to learn to chew, and I consider learning how to chew it is as important as completing the writing itself. Thanks for reading!