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:
mossroy 2013-05-10 17:05:44 +02:00
parent fb8408e878
commit 9463eb41a1
3 changed files with 6 additions and 35 deletions

View File

@ -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 :
<ul>
<li>The performance should be optimized when reading an article</li>
<li>Searches are not always very accurate</li>
<li>The links inside an article do not work well</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 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>It is hardly usable on a device because the buttons and inputs are too small</li>
</ul>
@ -77,11 +77,7 @@ License:
<br /> Choose a title from the filtered list :
<select id="titleList"></select>
<br />
<input type="button" id="toggleDebug" value="Switch debug on/off" />
<input type="button" id="readData" value="Read article from dump" />
<div id="debugZone" style="display: none;">
<textarea id="debugTextarea" cols="80" rows="10">&nbsp;</textarea>
</div>
<div id="articleContent">&nbsp;</div>
<hr />

View File

@ -27,9 +27,6 @@ define(function(require) {
$('#searchTitles').on('click', function(e) {
searchTitlesFromPrefix($('#prefix').val());
});
$('#toggleDebug').on('click', function(e) {
switchDebugOnOff();
});
$('#readData').on('click', function(e) {
findTitleFromTitleIdAndLaunchArticleRead($('#titleList').val());
});
@ -65,32 +62,6 @@ define(function(require) {
$('#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() {
dataFiles=document.getElementById('dataFiles').files;
titleFile=document.getElementById('titleFile').files[0];

View File

@ -347,6 +347,10 @@ define(function(require) {
var binaryTitleFile = e.target.result;
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;
redirectedTitle.fileNr = byteArray[2];
redirectedTitle.blockStart = readIntegerFrom4Bytes(byteArray,3);