mirror of
https://github.com/kiwix/kiwix-js.git
synced 2025-09-22 12:01:15 -04:00
Small fixes for random article feature + cosmetic changes
Anyway, the article feature does not work all the time currently.
This commit is contained in:
parent
87a85d8e11
commit
8dd14095e6
@ -76,6 +76,7 @@ define(function(require) {
|
||||
$("#btnRandomArticle").on("click", function(e) {
|
||||
goToRandomArticle();
|
||||
$("#welcomeText").hide();
|
||||
$('#titleList').hide();
|
||||
$("#readingArticle").hide();
|
||||
if ($('#navbarToggle').is(":visible") && $('#liHomeNav').is(':visible')) {
|
||||
$('#navbarToggle').click();
|
||||
|
@ -24,8 +24,6 @@ define(function(require) {
|
||||
|
||||
// Module dependencies
|
||||
var normalize_string = require('normalize_string');
|
||||
var utf8 = require('utf8');
|
||||
var evopediaTitle = require('title');
|
||||
var util = require('util');
|
||||
var geometry = require('geometry');
|
||||
var jQuery = require('jquery');
|
||||
@ -110,7 +108,7 @@ define(function(require) {
|
||||
currentLocalArchiveInstance.readDataFilesFromStorage(storage, directory,
|
||||
index + 1);
|
||||
}, function(error) {
|
||||
// TODO there must be a better to way to detect a FileNotFound
|
||||
// TODO there must be a better way to detect a FileNotFound
|
||||
if (error != "NotFoundError") {
|
||||
alert("Error reading data file " + index + " in directory "
|
||||
+ directory + " : " + error);
|
||||
@ -141,7 +139,7 @@ define(function(require) {
|
||||
currentLocalArchiveInstance.readCoordinateFilesFromStorage(storage, directory,
|
||||
index + 1);
|
||||
}, function(error) {
|
||||
// TODO there must be a better to way to detect a FileNotFound
|
||||
// TODO there must be a better way to detect a FileNotFound
|
||||
if (error != "NotFoundError") {
|
||||
alert("Error reading coordinates file " + index + " in directory "
|
||||
+ directory + " : " + error);
|
||||
@ -372,6 +370,8 @@ define(function(require) {
|
||||
var iterator = new titleIterators.SequentialTitleIterator(that, offset);
|
||||
// call advance twice because we are probably not at the beginning
|
||||
// of a title
|
||||
// TODO : we need to find a better way to reach the beginning of the title
|
||||
// As it is now, the first advance() can fail on utf8 decoding
|
||||
return iterator.advance().then(function() {
|
||||
return iterator.advance();
|
||||
});
|
||||
@ -842,7 +842,7 @@ define(function(require) {
|
||||
return storage.scanForDirectoriesContainingFile('titles.idx')
|
||||
.then(function(dirs) {
|
||||
jQuery.merge(directories, dirs);
|
||||
return true
|
||||
return true;
|
||||
});
|
||||
});
|
||||
jQuery.when.apply(null, promises).then(function() {
|
||||
@ -880,7 +880,7 @@ define(function(require) {
|
||||
if (this.normalizedTitles === true) {
|
||||
return normalize_string.normalizeString;
|
||||
} else {
|
||||
return function(string) { return string; }
|
||||
return function(string) { return string; };
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -53,7 +53,7 @@ define(['utf8', 'title', 'util', 'jquery'], function(utf8, evopediaTitle, util,
|
||||
return util.readFileSlice(this._titleFile, this._offset,
|
||||
this._offset + MAX_TITLE_LENGTH).then(function(byteArray) {
|
||||
var newLineIndex = 15;
|
||||
while (newLineIndex < byteArray.length && byteArray[newLineIndex] != 10) {
|
||||
while (newLineIndex < byteArray.length && byteArray[newLineIndex] !== 10) {
|
||||
newLineIndex++;
|
||||
}
|
||||
var encodedTitle = byteArray.subarray(0, newLineIndex);
|
||||
|
Loading…
x
Reference in New Issue
Block a user