i'm confused as to how i could implement epub.js.
(https://github.com/futurepress/epub.js/blob/master/documentation/README.md) i'm having a hard time understanding the documentation since i'm new. I tried following the demo files and folders and the "basic" example file but i noticed the paths direct to a folder named "OPS" which has a file for every chapter and others.
so i'm stuck on what to do with the .epub files and how to get a folder like that given my epub files.
simply change file extension of .epub to .zip and unpack yours books. When you done that, edit this part:
var Book = ePub("url/to/book/"); // With default options
where and give it path to your book.
Related
Like in the image below, while most .js files turn out to be javascript files, some in the same project choose to be text files although they still have .js on the file name. The content is also in correct javascript syntax and I can't tell what went wrong.
Does anyone have an idea how to fix this?
The most common explanation is they are .txt files. In other words, it means that the file's full name is something like index.js.txt.
Can you check the file type? You can quickly do that by:
Right-click on the file name;
Select the option "copy path";
Past it in some .txt file. Check if you obtain something like this: C:\{some-path}\index.js.txt
If you still see index.js check the file type. Sometimes when new files are created, the operating system does not create that file with the extension type that we define in the file name.
The solution is just to create another file, ensure that the operating system detects the file type, copy the content to this new file, and delete the old one.
I want to create a Chrome extension that contains a text file with static data (a dictionary of English words) and I want the extension to be able to parse that file. I've only managed to find FileReader class, but it looks like it's made for reading user-selected files, while in my case I always want to read the same exact file included in extension's package. As a workaround, I can convert the file to a Javascript array of strings declared in some .js file included in the manifest, but in that case the whole contents would be loaded into memory at once, while what I need is to read the data line by line. Is there any way to do this?
You can go the FileReader route, since you can obtain the Entry of your package directory with chrome.runtime.getPackageDirectoryEntry().
However, an easier way is to just make a XHR to your file using chrome.runtime.getURL() with a relative path. The first way is useful when you want to list files, though.
is there a library to unRAR files? The rar files I have to work with contain multiple files.
I'm looking for a way to navigate rar content, and get a blob with the uncompressed content of a selected file within the .rar one.
I'm already using zip.js to unzip files, and need the same for RAR. Thanks a lot for your time reading it.
I know this is an old question. But bitjs is no longer maintained, and very hard to use.
Try https://github.com/workhorsy/uncompress.js . It even works with RAR 5.
Here is the most trivial example I could make: http://workhorsy.github.io/uncompress.js/examples/trivial/index.html .
For learning purposes I created a toy project using grails.
In this project I would like to play an mp3 file in one of my views.
I found an html5/flash mp3 player. But when the music is supposed to play, I have a question.
The HTML 5 player is in the project/web-app/js folder. Everything else is in its normal place.
When I try to access a file, let's say "test.mp3" using just the name and extension of the file, where this file is supposed to be?
The file should be relative to whatever your current path is.
That is, if you're at
localhost:8080/myapp/test/test1, and you reference test.mp3, test.mp3 would have to be in the test1 directory. You can use absolute paths, such as /sounds/test.mp3 to reference from the root, but a better solution would be to use ${resource(...)} probably.
Here's the resource documentation.
Short version: can you help me fill in this code?
var conkeror_settings_dir = ".conkeror.mozdev.org/settings";
function load_all_js_files_in_dir (dir) {
var full_path = get_home_directory().appendRelativePath(dir);
// YOUR CODE HERE
}
load_all_js_files_in_dir(conkeror_settings_dir);
Background
I'm trying out Conkeror for web browsing. It's an emacs-like browser running on Mozilla's rendering engine, using javascript as configuration language (filling the role that elisp plays for emacs). In my emacs config, I have split my customizations into a series of files, where each file is a single unit of related options (for example, all my perl-related settings might be in perl-settings.el. All these settings files are loaded automatically by a function in my .emacs that simply loads every elisp file under my "settings" directory.
I am looking to structure my Conkeror config in the same way, with my main conkeror-rc file basically being a stub that loads all the js files under a certain directory relative to my home directory. Unfortunately, I am much less literate in javascript than I am in elisp, so I don't even know how to "source" a file.
I found a suitable answer, though it isn't really what I was looking for. If you set your conkerorrc file to a directory, then all the js files in that dir will be loaded.