mirror of
https://github.com/kiwix/kiwix-js.git
synced 2025-09-22 12:01:15 -04:00
Add some testing fields, so that the latitude/longitude can be typed instead of found by geolocation
This commit is contained in:
parent
ccf3f80117
commit
fa580e671f
@ -74,6 +74,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
or <a href="#" id="btnArticlesNearby">Find articles around me (work in progress)</a><br/>
|
or <a href="#" id="btnArticlesNearby">Find articles around me (work in progress)</a><br/>
|
||||||
|
longitude : <input type="text" id="longitude" /> latitude : <input type="text" id="latitude" /><br/>
|
||||||
<img id="searchingForTitles" src="img/spinner.gif" alt="Please wait..." style="display: none;"/>
|
<img id="searchingForTitles" src="img/spinner.gif" alt="Please wait..." style="display: none;"/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
12
js/app.js
12
js/app.js
@ -543,7 +543,17 @@ define(function(require) {
|
|||||||
alert("Unable to geolocate your device : " + err.code + " : " + err.message);
|
alert("Unable to geolocate your device : " + err.code + " : " + err.message);
|
||||||
};
|
};
|
||||||
|
|
||||||
navigator.geolocation.getCurrentPosition(geo_success, geo_error, geo_options);
|
// TODO : for testing purpose
|
||||||
|
//navigator.geolocation.getCurrentPosition(geo_success, geo_error, geo_options);
|
||||||
|
var longitude = $('#longitude').val();
|
||||||
|
var latitude = $('#latitude').val();
|
||||||
|
var rectangle = new geometry.rect(
|
||||||
|
longitude - MAX_DISTANCE_ARTICLES_NEARBY,
|
||||||
|
latitude - MAX_DISTANCE_ARTICLES_NEARBY,
|
||||||
|
MAX_DISTANCE_ARTICLES_NEARBY * 2,
|
||||||
|
MAX_DISTANCE_ARTICLES_NEARBY * 2);
|
||||||
|
|
||||||
|
localArchive.getTitlesInCoords(rectangle, MAX_SEARCH_RESULT_SIZE, populateListOfTitles);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
alert("Geolocation is not supported (or disabled) on your device, or by your browser");
|
alert("Geolocation is not supported (or disabled) on your device, or by your browser");
|
||||||
|
@ -839,7 +839,7 @@ define(function(require) {
|
|||||||
|
|
||||||
// 0xFFFF = 65535 in decimal
|
// 0xFFFF = 65535 in decimal
|
||||||
if (selector === 65535) {
|
if (selector === 65535) {
|
||||||
// This is an innernode : let's browse it subdivisions
|
// This is an innernode : let's browse its subdivisions
|
||||||
var center = readCoordinates(byteArray, 2);
|
var center = readCoordinates(byteArray, 2);
|
||||||
var lensw = util.readIntegerFrom4Bytes(byteArray, 10);
|
var lensw = util.readIntegerFrom4Bytes(byteArray, 10);
|
||||||
var lense = util.readIntegerFrom4Bytes(byteArray, 14);
|
var lense = util.readIntegerFrom4Bytes(byteArray, 14);
|
||||||
@ -867,6 +867,8 @@ define(function(require) {
|
|||||||
if (targetRect.intersect(rectNE)) {
|
if (targetRect.intersect(rectNE)) {
|
||||||
LocalArchive.getTitlesInCoordsInt(localArchive, coordinateFileIndex, pos3, targetRect, rectNE, maxTitles, titlePositionsFound, callbackFunction, callbackGetTitlesInCoordsInt);
|
LocalArchive.getTitlesInCoordsInt(localArchive, coordinateFileIndex, pos3, targetRect, rectNE, maxTitles, titlePositionsFound, callbackFunction, callbackGetTitlesInCoordsInt);
|
||||||
}
|
}
|
||||||
|
// TODO : it seems possible that targetRect does not intersect any of the 4 rectangles
|
||||||
|
// Iis it normal? In this case, the callback is never called
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// This is a leaf node : let's see if its articles are in the
|
// This is a leaf node : let's see if its articles are in the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user