Revert to jQuery API for archive scanning (it was not working properly with Q)

+ change version number
+ minor cleanup
This commit is contained in:
mossroy 2015-04-26 11:28:50 +02:00
parent 9359290f50
commit e0411408d9
6 changed files with 17 additions and 13 deletions

View File

@ -1,5 +1,5 @@
{
"version": "1.1.4",
"version": "2.0-kiwix-SNAPSHOT",
"name": "Evopedia",
"description": "Offline Wikipedia Viewer",
"launch_path": "/www/index.html",

View File

@ -51,7 +51,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand">Evopedia 1.1.4</a>
<a class="navbar-brand">Evopedia 2.0-kiwix-SNAPSHOT</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->

View File

@ -20,8 +20,8 @@
* along with Evopedia (file LICENSE-GPLv3.txt). If not, see <http://www.gnu.org/licenses/>
*/
'use strict';
define(['title', 'archive', 'zimArchive', 'util', 'jquery'],
function(evopediaTitle, evopediaArchive, zimArchive, util, jQuery) {
define(['archive', 'zimArchive', 'util', 'jquery'],
function(evopediaArchive, zimArchive, util, jQuery) {
function loadArchiveFromDeviceStorage(storage, path) {
if (util.endsWith(path, ".zim")) {
@ -35,7 +35,7 @@ define(['title', 'archive', 'zimArchive', 'util', 'jquery'],
function loadArchiveFromFiles(files) {
var archive = new evopediaArchive.LocalArchive();
archive.initializeFromArchiveFiles(files);
return achive;
return archive;
};
/**
* Scans the DeviceStorage for archives
@ -58,7 +58,7 @@ define(['title', 'archive', 'zimArchive', 'util', 'jquery'],
alert("Error scanning your SD card : " + error
+ ". If you're using the Firefox OS Simulator, please put the archives in "
+ "a 'fake-sdcard' directory inside your Firefox profile "
+ "(ex : ~/.mozilla/firefox/xxxx.default/extensions/fxos_1_x_simulator@mozilla.org/"
+ "(ex : ~/.mozilla/firefox/xxxx.default/extensions/fxos_2_x_simulator@mozilla.org/"
+ "profile/fake-sdcard/wikipedia_small_2010-08-14)");
callbackFunction(null);
});

View File

@ -20,7 +20,7 @@
* along with Evopedia (file LICENSE-GPLv3.txt). If not, see <http://www.gnu.org/licenses/>
*/
'use strict';
define(['util', 'q'], function(util, q) {
define(['util', 'q', 'jquery'], function(util, q, jQuery) {
/**
* Creates an abstraction layer around the FirefoxOS storage.
* @see StoragePhoneGap
@ -49,7 +49,7 @@ define(['util', 'q'], function(util, q) {
* paths and rejected with an error message.
*/
StorageFirefoxOS.prototype.scanForArchives = function() {
var deferred = q.defer();
var deferred = jQuery.Deferred();
var directories = [];
var cursor = this._storage.enumerate();
cursor.onerror = function() {
@ -80,7 +80,7 @@ define(['util', 'q'], function(util, q) {
cursor.continue();
};
return deferred.promise;
return deferred.promise();
};
/**

View File

@ -123,10 +123,10 @@ define(['utf8', 'util'], function(utf8, util) {
Title.prototype.name = function() {
return this._name;
}
};
Title.prototype.isRedirect = function() {
return this._fileNr === 0xff;
}
};
/**
* Serialize the title with its values

View File

@ -116,10 +116,10 @@ define(['q'], function(q) {
/**
* Reads a Uint8Array from the given file starting at byte offset begin and
* not including byte offset end.
* for given size.
* @param file
* @param begin
* @param end
* @param size
* @returns jQuery promise
*/
function readFileSlice(file, begin, size) {
@ -140,6 +140,10 @@ define(['q'], function(q) {
* continue the search.
* If lowerBound is not set, returns only indices where query returns 0 and null otherwise.
* If lowerBound is set, returns the smallest index where query does not return > 0.
* @param begin
* @param end
* @param query
* @param lowerBound
*/
function binarySearch(begin, end, query, lowerBound) {
if (end <= begin)