mirror of
https://github.com/kiwix/kiwix-js.git
synced 2025-09-23 04:28:30 -04:00
Remove unused debug zone
Slightly improve the case when a redirected article is not found (which seems to happen in some dumps)
This commit is contained in:
parent
fb8408e878
commit
9463eb41a1
@ -60,8 +60,8 @@ License:
|
|||||||
It's only a proof of concept so far : there are many many ways this could be enhanced (suggestions and patches are welcome : the source code is on <a href="https://github.com/mossroy/evopedia-html5">github</a>). In particular :
|
It's only a proof of concept so far : there are many many ways this could be enhanced (suggestions and patches are welcome : the source code is on <a href="https://github.com/mossroy/evopedia-html5">github</a>). In particular :
|
||||||
<ul>
|
<ul>
|
||||||
<li>The performance should be optimized when reading an article</li>
|
<li>The performance should be optimized when reading an article</li>
|
||||||
<li>Searches are not always very accurate</li>
|
<li>Some searches (starting with prefix "a" for example) do not give any result where they should</li>
|
||||||
<li>The links inside an article do not work well</li>
|
<li>The links inside an article do not work very well</li>
|
||||||
<li>On a real device (with small memory) and a normal dump, reading an article crashes because it loads too many things in memory</li>
|
<li>On a real device (with small memory) and a normal dump, reading an article crashes because it loads too many things in memory</li>
|
||||||
<li>It is hardly usable on a device because the buttons and inputs are too small</li>
|
<li>It is hardly usable on a device because the buttons and inputs are too small</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -77,11 +77,7 @@ License:
|
|||||||
<br /> Choose a title from the filtered list :
|
<br /> Choose a title from the filtered list :
|
||||||
<select id="titleList"></select>
|
<select id="titleList"></select>
|
||||||
<br />
|
<br />
|
||||||
<input type="button" id="toggleDebug" value="Switch debug on/off" />
|
|
||||||
<input type="button" id="readData" value="Read article from dump" />
|
<input type="button" id="readData" value="Read article from dump" />
|
||||||
<div id="debugZone" style="display: none;">
|
|
||||||
<textarea id="debugTextarea" cols="80" rows="10"> </textarea>
|
|
||||||
</div>
|
|
||||||
<div id="articleContent"> </div>
|
<div id="articleContent"> </div>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
|
@ -27,9 +27,6 @@ define(function(require) {
|
|||||||
$('#searchTitles').on('click', function(e) {
|
$('#searchTitles').on('click', function(e) {
|
||||||
searchTitlesFromPrefix($('#prefix').val());
|
searchTitlesFromPrefix($('#prefix').val());
|
||||||
});
|
});
|
||||||
$('#toggleDebug').on('click', function(e) {
|
|
||||||
switchDebugOnOff();
|
|
||||||
});
|
|
||||||
$('#readData').on('click', function(e) {
|
$('#readData').on('click', function(e) {
|
||||||
findTitleFromTitleIdAndLaunchArticleRead($('#titleList').val());
|
findTitleFromTitleIdAndLaunchArticleRead($('#titleList').val());
|
||||||
});
|
});
|
||||||
@ -65,32 +62,6 @@ define(function(require) {
|
|||||||
$('#titleFile').on('change', setLocalArchiveFromFileSelect);
|
$('#titleFile').on('change', setLocalArchiveFromFileSelect);
|
||||||
}
|
}
|
||||||
|
|
||||||
var debugOn = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Print the given string inside the debug zone
|
|
||||||
*
|
|
||||||
* @param string
|
|
||||||
*/
|
|
||||||
function debug(string) {
|
|
||||||
if (debugOn) {
|
|
||||||
document.getElementById("debugTextarea").value += string + "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Switch debug mode On/Off
|
|
||||||
*/
|
|
||||||
function switchDebugOnOff() {
|
|
||||||
if (debugOn == true) {
|
|
||||||
debugOn = false;
|
|
||||||
$('#debugZone').hide();
|
|
||||||
} else {
|
|
||||||
debugOn = true;
|
|
||||||
$('#debugZone').show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setLocalArchiveFromFileSelect() {
|
function setLocalArchiveFromFileSelect() {
|
||||||
dataFiles=document.getElementById('dataFiles').files;
|
dataFiles=document.getElementById('dataFiles').files;
|
||||||
titleFile=document.getElementById('titleFile').files[0];
|
titleFile=document.getElementById('titleFile').files[0];
|
||||||
|
@ -347,6 +347,10 @@ define(function(require) {
|
|||||||
var binaryTitleFile = e.target.result;
|
var binaryTitleFile = e.target.result;
|
||||||
var byteArray = new Uint8Array(binaryTitleFile);
|
var byteArray = new Uint8Array(binaryTitleFile);
|
||||||
|
|
||||||
|
if (byteArray.length==0) {
|
||||||
|
throw "Unable to find redirected article : offset "+title.blockStart+" not found in title file";
|
||||||
|
}
|
||||||
|
|
||||||
var redirectedTitle = title;
|
var redirectedTitle = title;
|
||||||
redirectedTitle.fileNr = byteArray[2];
|
redirectedTitle.fileNr = byteArray[2];
|
||||||
redirectedTitle.blockStart = readIntegerFrom4Bytes(byteArray,3);
|
redirectedTitle.blockStart = readIntegerFrom4Bytes(byteArray,3);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user