Clean up remaining state.search refs

Former-commit-id: 9604cd5ca37aa00f495486286f5d0533b588e2c1 [formerly 704d1b191706f94599825f304bc6670ba2547073]
Former-commit-id: 6d54e2b7af59d6f0d2ad42d0c9d4c979885b6996
This commit is contained in:
Jaifroid 2020-07-03 13:03:58 +01:00
parent bec34096f0
commit fc3d7ef5fa
3 changed files with 6 additions and 8 deletions

View File

@ -223,8 +223,6 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'images', 'cooki
document.getElementById('prefix').addEventListener('blur', function () { document.getElementById('prefix').addEventListener('blur', function () {
if (!searchArticlesFocused) { if (!searchArticlesFocused) {
global.search.state = 'cancelled'; global.search.state = 'cancelled';
$("#searchingArticles").hide();
$('#articleListWithHeader').hide();
} }
// We need to wait one tick for the activeElement to receive focus // We need to wait one tick for the activeElement to receive focus
setTimeout(function () { setTimeout(function () {
@ -2220,7 +2218,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'images', 'cooki
if (global.selectedArchive !== null && global.selectedArchive.isReady()) { if (global.selectedArchive !== null && global.selectedArchive.isReady()) {
// Cancel any previous search that may still be running before creating new search // Cancel any previous search that may still be running before creating new search
global.search.state = 'cancelled'; global.search.state = 'cancelled';
// Store the new search term in the state.search global object and initialize // Store the new search term in the global.search object and initialize
global.search = {'prefix': prefix, 'state': 'init', 'type': ''}; global.search = {'prefix': prefix, 'state': 'init', 'type': ''};
$('#activeContent').hide(); $('#activeContent').hide();
if (!prefix || /^\s/.test(prefix)) { if (!prefix || /^\s/.test(prefix)) {
@ -2570,7 +2568,7 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'images', 'cooki
cookies.removeItem('lastPageLoad'); cookies.removeItem('lastPageLoad');
// if (!~decodeURIComponent(params.lastPageVisit).indexOf(dirEntry.url)) { // if (!~decodeURIComponent(params.lastPageVisit).indexOf(dirEntry.url)) {
// params.lastPageVisit = encodeURIComponent(dirEntry.namespace + "/" + dirEntry.url) + // params.lastPageVisit = encodeURIComponent(dirEntry.namespace + "/" + dirEntry.url) +
// "@kiwixKey@" + state.selectedArchive._file._files[0].name; // "@kiwixKey@" + global.selectedArchive._file._files[0].name;
// if (params.rememberLastPage) { // if (params.rememberLastPage) {
// cookies.setItem('lastPageVisit', params.lastPageVisit, Infinity); // cookies.setItem('lastPageVisit', params.lastPageVisit, Infinity);
// } // }

View File

@ -84,8 +84,8 @@ define(['uiUtil'], function (uiUtil) {
}); });
return; return;
} }
state.selectedArchive.getDirEntryByTitle(title).then(function (dirEntry) { global.selectedArchive.getDirEntryByTitle(title).then(function (dirEntry) {
return state.selectedArchive.readBinaryFile(dirEntry, function (fileDirEntry, content) { return global.selectedArchive.readBinaryFile(dirEntry, function (fileDirEntry, content) {
image.style.background = ''; image.style.background = '';
var mimetype = dirEntry.getMimetype(); var mimetype = dirEntry.getMimetype();
uiUtil.feedNodeWithBlob(image, 'src', content, mimetype, params.allowHTMLExtraction, function () { uiUtil.feedNodeWithBlob(image, 'src', content, mimetype, params.allowHTMLExtraction, function () {

View File

@ -148,7 +148,7 @@ define(['zimfile', 'zimDirEntry', 'util', 'utf8'],
* This should be enhanced when the ZIM format will be modified to store normalized titles * This should be enhanced when the ZIM format will be modified to store normalized titles
* See https://phabricator.wikimedia.org/T108536 * See https://phabricator.wikimedia.org/T108536
* *
* @param {Object} search The current state.search object * @param {Object} search The current global.search object
* @param {Integer} resultSize The number of dirEntries to find * @param {Integer} resultSize The number of dirEntries to find
* @param {callbackDirEntryList} callback The function to call with the result * @param {callbackDirEntryList} callback The function to call with the result
* @param {Boolean} noInterim A flag to prevent callback until all results are ready (used in testing) * @param {Boolean} noInterim A flag to prevent callback until all results are ready (used in testing)
@ -216,7 +216,7 @@ define(['zimfile', 'zimDirEntry', 'util', 'utf8'],
* *
* @param {String} prefix The case-sensitive value against which dirEntry titles (or url) will be compared * @param {String} prefix The case-sensitive value against which dirEntry titles (or url) will be compared
* @param {Integer} resultSize The maximum number of results to return * @param {Integer} resultSize The maximum number of results to return
* @param {Object} search The original state.search object (so that we can cancel long binary searches) * @param {Object} search The original global.search object (so that we can cancel long binary searches)
* @param {Function} callback The function to call with the array of dirEntries with titles that begin with prefix * @param {Function} callback The function to call with the array of dirEntries with titles that begin with prefix
* @param {Integer} startIndex The index number with which to commence the search, or null * @param {Integer} startIndex The index number with which to commence the search, or null
*/ */