Synchronize with kiwix-js

Former-commit-id: 02cd3ce8226c572e8a5ca2e2878b216f9c30673f [formerly 84ce9efc674825e14635c3d6d263e1219df0346c]
Former-commit-id: 954ed180d739d1b91c2e7e45ebd44bc4d9083a01
This commit is contained in:
Jaifroid 2017-06-21 20:28:45 +01:00
parent d29a68ed35
commit d4a0af4142

View File

@ -32,7 +32,6 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies','abstractFiles
// Disable any eval() call in jQuery : it's disabled by CSP in any packaged application
// It happens on some wiktionary archives, because there is some javascript inside the html article
// Cf http://forum.jquery.com/topic/jquery-ajax-disable-script-eval
/** This is not needed for UWP and seems to cause problems - GK
jQuery.globalEval = function (code) {
// jQuery believes the javascript has been executed, but we did nothing
// In any case, that would have been blocked by CSP for package applications
@ -576,12 +575,14 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies','abstractFiles
var request = new XMLHttpRequest();
request.open("GET", url, true);
request.responseType = "blob";
request.onload = function (e) {
if (request.response) {
request.onreadystatechange = function () {
if (request.readyState === XMLHttpRequest.DONE) {
if ((request.status >= 200 && request.status < 300) || request.status === 0) {
// Hack to make this look similar to a file
request.response.name = url;
setLocalArchiveFromFileList([request.response]);
}
}
};
request.send(null);
};