mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-08 19:57:46 -04:00
Restructured some of the scanning logic on initial startup
Former-commit-id: 8b0b472cbcc3805844dc750afb16a2c7c5714dac [formerly d1fe338ae00e424475e1c59606c1173788f331c5] Former-commit-id: a38089a760db595fc0ec28faf65565ddbeae638e
This commit is contained in:
parent
4b9ededf16
commit
ebadc9b091
@ -32,7 +32,7 @@
|
||||
<AppXManifest Include="C:\Users\geoff\Source\Repos\kiwix-js-windows\bin\Release\AppxManifest.xml">
|
||||
<PackagePath>AppxManifest.xml</PackagePath>
|
||||
<ReRegisterAppIfChanged>true</ReRegisterAppIfChanged>
|
||||
<Modified>2017-08-23T13:15:45.669</Modified>
|
||||
<Modified>2017-08-23T21:52:36.698</Modified>
|
||||
</AppXManifest>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -603,11 +603,11 @@
|
||||
</AppxPackagedFile>
|
||||
<AppxPackagedFile Include="C:\Users\geoff\Source\Repos\kiwix-js-windows\www\js\app.js">
|
||||
<PackagePath>www\js\app.js</PackagePath>
|
||||
<Modified>2017-08-23T13:14:12.160</Modified>
|
||||
<Modified>2017-08-23T21:52:28.917</Modified>
|
||||
</AppxPackagedFile>
|
||||
<AppxPackagedFile Include="C:\Users\geoff\Source\Repos\kiwix-js-windows\www\js\init.js">
|
||||
<PackagePath>www\js\init.js</PackagePath>
|
||||
<Modified>2017-08-23T13:15:28.105</Modified>
|
||||
<Modified>2017-08-23T21:44:15.407</Modified>
|
||||
</AppxPackagedFile>
|
||||
<AppxPackagedFile Include="C:\Users\geoff\Source\Repos\kiwix-js-windows\www\js\lib\abstractFilesystemAccess.js">
|
||||
<PackagePath>www\js\lib\abstractFilesystemAccess.js</PackagePath>
|
||||
@ -1528,7 +1528,7 @@
|
||||
<AppxPackagedFile Include="C:\Users\geoff\Source\Repos\kiwix-js-windows\bin\Release\ReverseMap\resources.pri">
|
||||
<PackagePath>resources.pri</PackagePath>
|
||||
<ReRegisterAppIfChanged>true</ReRegisterAppIfChanged>
|
||||
<Modified>2017-08-23T10:02:58.575</Modified>
|
||||
<Modified>2017-08-23T20:53:00.126</Modified>
|
||||
</AppxPackagedFile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -190,15 +190,20 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
});
|
||||
|
||||
$('#btnRescanDeviceStorage').on("click", function (e) {
|
||||
document.getElementById('returntoArticle_top').innerHTML = "";
|
||||
document.getElementById('returntoArticle_bottom').innerHTML = "";
|
||||
//Stop app from jumping straight into to first archive if user initiated the scan (to give user a chance to select the archive manually)
|
||||
params['rescan'] = true;
|
||||
//Reload any ZIM files in local storage (whcih the usar can't otherwise select with the filepicker)
|
||||
if (params['localStorage']) {
|
||||
scanUWPFolderforArchives(params['localStorage']);
|
||||
return;
|
||||
}
|
||||
if (storages.length) {
|
||||
searchForArchivesInStorage();
|
||||
} else {
|
||||
displayFileSelect();
|
||||
$('archiveFiles').click();
|
||||
//$('archiveFiles').click();
|
||||
$('btnConfigure').click();
|
||||
}
|
||||
});
|
||||
// Bottom bar :
|
||||
@ -308,6 +313,20 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
$('#searchingForArticles').hide();
|
||||
return false;
|
||||
});
|
||||
// TODO: I've set up two event listeners below because the archive list doesn't "change" if there is only one element in it
|
||||
// See if this can be simplified.... (but note that keyboard users might not click)
|
||||
$('#archiveList').on('change', function () {
|
||||
console.log("***Archive List change event fired")
|
||||
setLocalArchiveFromArchiveList()
|
||||
});
|
||||
$('#archiveList').on('click', function () {
|
||||
console.log("***Archive List click event fired: checking length of options list")
|
||||
var comboArchiveList = document.getElementById('archiveList');
|
||||
if (comboArchiveList.options.length == 1) {
|
||||
console.log("***Only one item, so, fire away...");
|
||||
setLocalArchiveFromArchiveList();
|
||||
}
|
||||
});
|
||||
$('input:radio[name=contentInjectionMode]').on('change', function (e) {
|
||||
if (checkWarnServiceWorkerMode(this.value)) {
|
||||
document.getElementById('returntoArticle_top').innerHTML = "";
|
||||
@ -381,7 +400,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
document.getElementById('cssUIDarkThemeCheck').checked = params['cssUITheme'] == 'dark' ? true : false;
|
||||
cssUIThemeSet(params['cssUITheme']);
|
||||
$('input:radio[name=cssInjectionMode]').filter('[value="' + params['cssSource'] + '"]').prop('checked', true);
|
||||
//First run of new version code
|
||||
//Code below triggers display of modal info box if app is run for the first time, or it has been upgraded to new version
|
||||
if (cookies.getItem('version') != params['version']) {
|
||||
document.getElementById('myModal').style.display = "block";
|
||||
document.getElementsByClassName("close")[0].onclick = function () {
|
||||
@ -583,7 +602,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
populateDropDownListOfArchives(directories);
|
||||
}
|
||||
else {
|
||||
if (storages.length) {
|
||||
if (storages.length || params['localStorage']) {
|
||||
searchForArchivesInStorage();
|
||||
} else {
|
||||
displayFileSelect();
|
||||
@ -602,7 +621,11 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
// If DeviceStorage is available, we look for archives in it
|
||||
$("#btnConfigure").click();
|
||||
$('#scanningForArchives').show();
|
||||
zimArchiveLoader.scanForArchives(storages, populateDropDownListOfArchives);
|
||||
if (params['localStorage'] && typeof Windows !== 'undefined' && typeof Windows.Storage !== 'undefined') {
|
||||
scanUWPFolderforArchives(params['localStorage']);
|
||||
} else {
|
||||
zimArchiveLoader.scanForArchives(storages, populateDropDownListOfArchives);
|
||||
}
|
||||
}
|
||||
|
||||
if ($.isFunction(navigator.getDeviceStorages)) {
|
||||
@ -612,7 +635,8 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
});
|
||||
}
|
||||
|
||||
if (Windows && Windows.Storage || (storages !== null && storages.length > 0)) {
|
||||
if ((storages !== null && storages.length > 0) ||
|
||||
(typeof Windows !== 'undefined' && typeof Windows.Storage !== 'undefined')) {
|
||||
// Make a fake first access to device storage, in order to ask the user for confirmation if necessary.
|
||||
// This way, it is only done once at this moment, instead of being done several times in callbacks
|
||||
// After that, we can start looking for archives
|
||||
@ -682,10 +706,10 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
// Store the list of archives in a cookie, to avoid rescanning at each start
|
||||
cookies.setItem("listOfArchives", archiveDirectories.join('|'), Infinity);
|
||||
comboArchiveList.size = comboArchiveList.length;
|
||||
|
||||
$('#archiveList').on('change', setLocalArchiveFromArchiveList);
|
||||
//$('#archiveList').on('mouseup', setLocalArchiveFromArchiveList());
|
||||
//$(comboArchiveList).on('click', setLocalArchiveFromArchiveList());
|
||||
if (comboArchiveList.options.length > 0) {
|
||||
var lastSelectedArchive = cookies.getItem("lastSelectedArchive");
|
||||
var lastSelectedArchive = cookies.getItem("lastSelectedArchive") || params['storedFile'];
|
||||
if (lastSelectedArchive !== null && lastSelectedArchive !== undefined && lastSelectedArchive !== "") {
|
||||
// Attempt to select the corresponding item in the list, if it exists
|
||||
if ($("#archiveList option[value='" + lastSelectedArchive + "']").length > 0) {
|
||||
@ -780,7 +804,12 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
//archiveDirectory = MSApp.createFileFromStorageFile(file);
|
||||
selectedArchive = zimArchiveLoader.loadArchiveFromDeviceStorage(selectedStorage, archiveDirectory, function (archive) {
|
||||
// The archive is set : go back to home page to start searching
|
||||
$('#btnHome').click();
|
||||
if (params['rescan']) {
|
||||
$('#btnConfigure').click()
|
||||
params['rescan'] = false;
|
||||
} else {
|
||||
$('#btnHome').click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error("The picked file could not be found in the selected folder!");
|
||||
@ -816,11 +845,16 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
*/
|
||||
function displayFileSelect() {
|
||||
$('#openLocalFiles').show();
|
||||
var comboArchiveList = document.getElementById('archiveList');
|
||||
if (comboArchiveList.length > 0) { comboArchiveList.size = comboArchiveList.length; }
|
||||
//$('#archiveFile').on('change', setLocalArchiveFromFileSelect);
|
||||
$('#archiveFile').on('click', pickFileUWP); //UWP FilePicker [kiwix-js-windows #3]
|
||||
$('#archiveFiles').on('click', pickFolderUWP); //UWP FolderPicker
|
||||
//TODO - check if this is necessary or if it causes the archiveList change event to fire
|
||||
//Make archive list combo box fit the number of files
|
||||
//var comboArchiveList = document.getElementById('archiveList');
|
||||
//if (comboArchiveList.length > 0) { comboArchiveList.size = comboArchiveList.length; }
|
||||
if (typeof Windows !== 'undefined' && typeof Windows.Storage !== 'undefined') {
|
||||
$('#archiveFile').on('click', pickFileUWP); //UWP FilePicker [kiwix-js-windows #3]
|
||||
$('#archiveFiles').on('click', pickFolderUWP); //UWP FolderPicker
|
||||
} else {
|
||||
$('#archiveFile').on('change', setLocalArchiveFromFileSelect);
|
||||
}
|
||||
}
|
||||
|
||||
function pickFileUWP() { //Support UWP FilePicker [kiwix-js-windows #3]
|
||||
@ -850,11 +884,15 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
folderPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.downloads;
|
||||
folderPicker.fileTypeFilter.replaceAll([".zim", ".dat", ".idx", ".txt", ".zimaa"]);
|
||||
|
||||
folderPicker.pickSingleFolderAsync().then(scanUWPFolderForArchives(folder));
|
||||
folderPicker.pickSingleFolderAsync().done(function (folder) {
|
||||
if (folder) {
|
||||
scanUWPFolderforArchives(folder);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function scanUWPFolderforArchives (folder) {
|
||||
if (folder) {
|
||||
if (folder) {
|
||||
// Application now has read/write access to all contents in the picked folder (including sub-folder contents)
|
||||
// Cache folder so the contents can be accessed at a later time
|
||||
Windows.Storage.AccessCache.StorageApplicationPermissions.futureAccessList.addOrReplace(params['falFolderToken'], folder);
|
||||
@ -862,7 +900,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
// Query the folder.
|
||||
var query = folder.createFileQuery();
|
||||
query.getFilesAsync().done(function (files) {
|
||||
// Display file list with storage provider and availability.
|
||||
// Display file list
|
||||
var archiveDisplay = document.getElementById('chooseArchiveFromLocalStorage');
|
||||
if (!files) {
|
||||
archiveDisplay.style.display = "inline";
|
||||
|
@ -32,11 +32,15 @@ params['cssTheme'] = getCookie('cssTheme') || 'light'; //Set default to 'light'
|
||||
params['cssUITheme'] = getCookie('cssUITheme') || 'light'; //Set default to 'light' or 'dark' to use respective themes for UI
|
||||
params['imageDisplay'] = getCookie('imageDisplay') || true; //Set default to display images from Zim
|
||||
params['imageDisplay'] = params['imageDisplay'] == "false" ? false : (params['imageDisplay'] == "true" ? true : params['imageDisplay']);
|
||||
params['useMathJax'] = params['useMathJax'] || true; //Set default to true to display math formulae with MathJax, false to use fallback SVG images
|
||||
params['storedFile'] = getCookie('lastSelectedArchive') || ""; //For packaged Kiwix JS (e.g. with Wikivoyage file), set this to the filename and place file in default storage
|
||||
params['useMathJax'] = params['useMathJax'] || true; //Set default to true to display math formulae with MathJax, false to use fallback SVG images only
|
||||
params['storedFile'] = getCookie('lastSelectedArchive') || "wikipedia_en_ray_charles_2015-06.zimaa"; //For packaged Kiwix JS (e.g. with Wikivoyage file), set this to the filename (for split files, give the first chunk *.zimaa) and place file(s) in default storage
|
||||
params['falFileToken'] = params['falFileToken'] || "zimfile";
|
||||
params['falFolderToken'] = params['falFolderToken'] || "zimfilestore";
|
||||
if (params['storedFile'] && Windows && Windows.Storage) { //UWP
|
||||
params['localStorage'] = params['localStorage'] || ""; //These will be set programmatically below
|
||||
params['pickedFile'] = params['pickeFile'] || "";
|
||||
params['pickedFolder'] = params['pickedFolder'] || "";
|
||||
|
||||
if (params['storedFile'] && typeof Windows !== 'undefined' && typeof Windows.Storage !== 'undefined') { //UWP
|
||||
//DEV change "archives" below if you wish to store local archives in a different location in the installation package
|
||||
Windows.ApplicationModel.Package.current.installedLocation.getFolderAsync("archives").done(function (folder) {
|
||||
if (folder) params['localStorage'] = folder;
|
||||
|
@ -190,15 +190,20 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
});
|
||||
|
||||
$('#btnRescanDeviceStorage').on("click", function (e) {
|
||||
document.getElementById('returntoArticle_top').innerHTML = "";
|
||||
document.getElementById('returntoArticle_bottom').innerHTML = "";
|
||||
//Stop app from jumping straight into to first archive if user initiated the scan (to give user a chance to select the archive manually)
|
||||
params['rescan'] = true;
|
||||
//Reload any ZIM files in local storage (whcih the usar can't otherwise select with the filepicker)
|
||||
if (params['localStorage']) {
|
||||
scanUWPFolderforArchives(params['localStorage']);
|
||||
return;
|
||||
}
|
||||
if (storages.length) {
|
||||
searchForArchivesInStorage();
|
||||
} else {
|
||||
displayFileSelect();
|
||||
$('archiveFiles').click();
|
||||
//$('archiveFiles').click();
|
||||
$('btnConfigure').click();
|
||||
}
|
||||
});
|
||||
// Bottom bar :
|
||||
@ -308,6 +313,20 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
$('#searchingForArticles').hide();
|
||||
return false;
|
||||
});
|
||||
// TODO: I've set up two event listeners below because the archive list doesn't "change" if there is only one element in it
|
||||
// See if this can be simplified.... (but note that keyboard users might not click)
|
||||
$('#archiveList').on('change', function () {
|
||||
console.log("***Archive List change event fired")
|
||||
setLocalArchiveFromArchiveList()
|
||||
});
|
||||
$('#archiveList').on('click', function () {
|
||||
console.log("***Archive List click event fired: checking length of options list")
|
||||
var comboArchiveList = document.getElementById('archiveList');
|
||||
if (comboArchiveList.options.length == 1) {
|
||||
console.log("***Only one item, so, fire away...");
|
||||
setLocalArchiveFromArchiveList();
|
||||
}
|
||||
});
|
||||
$('input:radio[name=contentInjectionMode]').on('change', function (e) {
|
||||
if (checkWarnServiceWorkerMode(this.value)) {
|
||||
document.getElementById('returntoArticle_top').innerHTML = "";
|
||||
@ -381,7 +400,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
document.getElementById('cssUIDarkThemeCheck').checked = params['cssUITheme'] == 'dark' ? true : false;
|
||||
cssUIThemeSet(params['cssUITheme']);
|
||||
$('input:radio[name=cssInjectionMode]').filter('[value="' + params['cssSource'] + '"]').prop('checked', true);
|
||||
//First run of new version code
|
||||
//Code below triggers display of modal info box if app is run for the first time, or it has been upgraded to new version
|
||||
if (cookies.getItem('version') != params['version']) {
|
||||
document.getElementById('myModal').style.display = "block";
|
||||
document.getElementsByClassName("close")[0].onclick = function () {
|
||||
@ -583,7 +602,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
populateDropDownListOfArchives(directories);
|
||||
}
|
||||
else {
|
||||
if (storages.length) {
|
||||
if (storages.length || params['localStorage']) {
|
||||
searchForArchivesInStorage();
|
||||
} else {
|
||||
displayFileSelect();
|
||||
@ -602,7 +621,11 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
// If DeviceStorage is available, we look for archives in it
|
||||
$("#btnConfigure").click();
|
||||
$('#scanningForArchives').show();
|
||||
zimArchiveLoader.scanForArchives(storages, populateDropDownListOfArchives);
|
||||
if (params['localStorage'] && typeof Windows !== 'undefined' && typeof Windows.Storage !== 'undefined') {
|
||||
scanUWPFolderforArchives(params['localStorage']);
|
||||
} else {
|
||||
zimArchiveLoader.scanForArchives(storages, populateDropDownListOfArchives);
|
||||
}
|
||||
}
|
||||
|
||||
if ($.isFunction(navigator.getDeviceStorages)) {
|
||||
@ -612,7 +635,8 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
});
|
||||
}
|
||||
|
||||
if (Windows && Windows.Storage || (storages !== null && storages.length > 0)) {
|
||||
if ((storages !== null && storages.length > 0) ||
|
||||
(typeof Windows !== 'undefined' && typeof Windows.Storage !== 'undefined')) {
|
||||
// Make a fake first access to device storage, in order to ask the user for confirmation if necessary.
|
||||
// This way, it is only done once at this moment, instead of being done several times in callbacks
|
||||
// After that, we can start looking for archives
|
||||
@ -682,10 +706,10 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
// Store the list of archives in a cookie, to avoid rescanning at each start
|
||||
cookies.setItem("listOfArchives", archiveDirectories.join('|'), Infinity);
|
||||
comboArchiveList.size = comboArchiveList.length;
|
||||
|
||||
$('#archiveList').on('change', setLocalArchiveFromArchiveList);
|
||||
//$('#archiveList').on('mouseup', setLocalArchiveFromArchiveList());
|
||||
//$(comboArchiveList).on('click', setLocalArchiveFromArchiveList());
|
||||
if (comboArchiveList.options.length > 0) {
|
||||
var lastSelectedArchive = cookies.getItem("lastSelectedArchive");
|
||||
var lastSelectedArchive = cookies.getItem("lastSelectedArchive") || params['storedFile'];
|
||||
if (lastSelectedArchive !== null && lastSelectedArchive !== undefined && lastSelectedArchive !== "") {
|
||||
// Attempt to select the corresponding item in the list, if it exists
|
||||
if ($("#archiveList option[value='" + lastSelectedArchive + "']").length > 0) {
|
||||
@ -780,7 +804,12 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
//archiveDirectory = MSApp.createFileFromStorageFile(file);
|
||||
selectedArchive = zimArchiveLoader.loadArchiveFromDeviceStorage(selectedStorage, archiveDirectory, function (archive) {
|
||||
// The archive is set : go back to home page to start searching
|
||||
$('#btnHome').click();
|
||||
if (params['rescan']) {
|
||||
$('#btnConfigure').click()
|
||||
params['rescan'] = false;
|
||||
} else {
|
||||
$('#btnHome').click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.error("The picked file could not be found in the selected folder!");
|
||||
@ -816,11 +845,16 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
*/
|
||||
function displayFileSelect() {
|
||||
$('#openLocalFiles').show();
|
||||
var comboArchiveList = document.getElementById('archiveList');
|
||||
if (comboArchiveList.length > 0) { comboArchiveList.size = comboArchiveList.length; }
|
||||
//$('#archiveFile').on('change', setLocalArchiveFromFileSelect);
|
||||
$('#archiveFile').on('click', pickFileUWP); //UWP FilePicker [kiwix-js-windows #3]
|
||||
$('#archiveFiles').on('click', pickFolderUWP); //UWP FolderPicker
|
||||
//TODO - check if this is necessary or if it causes the archiveList change event to fire
|
||||
//Make archive list combo box fit the number of files
|
||||
//var comboArchiveList = document.getElementById('archiveList');
|
||||
//if (comboArchiveList.length > 0) { comboArchiveList.size = comboArchiveList.length; }
|
||||
if (typeof Windows !== 'undefined' && typeof Windows.Storage !== 'undefined') {
|
||||
$('#archiveFile').on('click', pickFileUWP); //UWP FilePicker [kiwix-js-windows #3]
|
||||
$('#archiveFiles').on('click', pickFolderUWP); //UWP FolderPicker
|
||||
} else {
|
||||
$('#archiveFile').on('change', setLocalArchiveFromFileSelect);
|
||||
}
|
||||
}
|
||||
|
||||
function pickFileUWP() { //Support UWP FilePicker [kiwix-js-windows #3]
|
||||
@ -850,11 +884,15 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
folderPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.downloads;
|
||||
folderPicker.fileTypeFilter.replaceAll([".zim", ".dat", ".idx", ".txt", ".zimaa"]);
|
||||
|
||||
folderPicker.pickSingleFolderAsync().then(scanUWPFolderForArchives(folder));
|
||||
folderPicker.pickSingleFolderAsync().done(function (folder) {
|
||||
if (folder) {
|
||||
scanUWPFolderforArchives(folder);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function scanUWPFolderforArchives (folder) {
|
||||
if (folder) {
|
||||
if (folder) {
|
||||
// Application now has read/write access to all contents in the picked folder (including sub-folder contents)
|
||||
// Cache folder so the contents can be accessed at a later time
|
||||
Windows.Storage.AccessCache.StorageApplicationPermissions.futureAccessList.addOrReplace(params['falFolderToken'], folder);
|
||||
@ -862,7 +900,7 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'abstractFile
|
||||
// Query the folder.
|
||||
var query = folder.createFileQuery();
|
||||
query.getFilesAsync().done(function (files) {
|
||||
// Display file list with storage provider and availability.
|
||||
// Display file list
|
||||
var archiveDisplay = document.getElementById('chooseArchiveFromLocalStorage');
|
||||
if (!files) {
|
||||
archiveDisplay.style.display = "inline";
|
||||
|
@ -32,11 +32,15 @@ params['cssTheme'] = getCookie('cssTheme') || 'light'; //Set default to 'light'
|
||||
params['cssUITheme'] = getCookie('cssUITheme') || 'light'; //Set default to 'light' or 'dark' to use respective themes for UI
|
||||
params['imageDisplay'] = getCookie('imageDisplay') || true; //Set default to display images from Zim
|
||||
params['imageDisplay'] = params['imageDisplay'] == "false" ? false : (params['imageDisplay'] == "true" ? true : params['imageDisplay']);
|
||||
params['useMathJax'] = params['useMathJax'] || true; //Set default to true to display math formulae with MathJax, false to use fallback SVG images
|
||||
params['storedFile'] = getCookie('lastSelectedArchive') || ""; //For packaged Kiwix JS (e.g. with Wikivoyage file), set this to the filename and place file in default storage
|
||||
params['useMathJax'] = params['useMathJax'] || true; //Set default to true to display math formulae with MathJax, false to use fallback SVG images only
|
||||
params['storedFile'] = getCookie('lastSelectedArchive') || "wikipedia_en_ray_charles_2015-06.zimaa"; //For packaged Kiwix JS (e.g. with Wikivoyage file), set this to the filename (for split files, give the first chunk *.zimaa) and place file(s) in default storage
|
||||
params['falFileToken'] = params['falFileToken'] || "zimfile";
|
||||
params['falFolderToken'] = params['falFolderToken'] || "zimfilestore";
|
||||
if (params['storedFile'] && Windows && Windows.Storage) { //UWP
|
||||
params['localStorage'] = params['localStorage'] || ""; //These will be set programmatically below
|
||||
params['pickedFile'] = params['pickeFile'] || "";
|
||||
params['pickedFolder'] = params['pickedFolder'] || "";
|
||||
|
||||
if (params['storedFile'] && typeof Windows !== 'undefined' && typeof Windows.Storage !== 'undefined') { //UWP
|
||||
//DEV change "archives" below if you wish to store local archives in a different location in the installation package
|
||||
Windows.ApplicationModel.Package.current.installedLocation.getFolderAsync("archives").done(function (folder) {
|
||||
if (folder) params['localStorage'] = folder;
|
||||
|
Loading…
x
Reference in New Issue
Block a user