Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme on old features and rewording of title vs direntry #241

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ Technically, after reading an article from a ZIM file, there is a need to "injec

This application is released under the GPL v3 license. See http://www.gnu.org/licenses/ or the included LICENSE-GPLv3.txt file
The source code can be found at https://github.com/kiwix/kiwix-html5
Unit tests can be run by opening tests.html file on Firefox.
Unit tests can be run by opening tests.html file on Firefox (or Chromium/Chrome with some tweaks).

The first versions of this application were originally part of the Evopedia project: http://www.evopedia.info (now discontinued)
These first versions were targeting Firefox OS (now discontinued too : we're not lucky ;-) ).
The first versions of this application were originally part of the Evopedia project: http://www.evopedia.info (now discontinued). There was a "articles nearby" feature, that was able to find articles around your location. It has been deleted from the source code with everything related to Evopedia (but still in git history in versions<=2.0.0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be I think more readable and stick in memory of devs as a simple list rather than a para.

Useful Features Unavailable in Current Build:

  1. Evopedia archive support
  2. Find Articles Nearby (Geo based search)
  3. Firefox OS port
  4. Phonegap/Cordova port (incomplete)
    Please consult Git History for reference.

These first versions were targeting Firefox OS (now discontinued too : we're not lucky ;-) ).
Some Phonegap/Cordova port had been started but never finished (see in git history in versions<=2.0.0).
12 changes: 6 additions & 6 deletions browser-tests/nightwatch_runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ module.exports = {
.execute(function() {
window.setRemoteArchive('https://kiwix.github.io/kiwix-html5/tests/wikipedia_en_ray_charles_2015-06.zim');
})
.waitForElementVisible('#formTitleSearch', 20000)
.waitForElementVisible('#searchTitles', 20000)
.waitForElementVisible('#formArticleSearch', 20000)
.waitForElementVisible('#searchArticles', 20000)
.setValue('#prefix', "Ray")
.click('#searchTitles')
.waitForElementVisible('#titleList', 20000)
.click('#searchArticles')
.waitForElementVisible('#articleList', 20000)
.useXpath()
.waitForElementVisible("//div[@id='titleList']/a[text()='Ray Charles']", 20000)
.click("//div[@id='titleList']/a[text()='Ray Charles']")
.waitForElementVisible("//div[@id='articleList']/a[text()='Ray Charles']", 20000)
.click("//div[@id='articleList']/a[text()='Ray Charles']")
.useCss()
.frame('articleContent')
.waitForElementPresent('#mweQ', 2000000)
Expand Down
36 changes: 18 additions & 18 deletions service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,39 +99,39 @@ function fetchEventListener(event) {
console.log('Asking app.js for a content', event.request.url);
event.respondWith(new Promise(function(resolve, reject) {
var nameSpace;
var titleName;
var titleNameWithNameSpace;
var title;
var titleWithNameSpace;
var contentType;
if (regexpContentUrlWithoutNamespace.test(event.request.url)) {
// When the request URL is in the same folder,
// it means it's a link to an article (namespace A)
var regexpResult = regexpContentUrlWithoutNamespace.exec(event.request.url);
nameSpace = 'A';
titleName = regexpResult[1];
title = regexpResult[1];
} else {
var regexpResult = regexpContentUrlWithNamespace.exec(event.request.url);
nameSpace = regexpResult[1];
titleName = regexpResult[2];
title = regexpResult[2];
}

// The namespace defines the type of content. See http://www.openzim.org/wiki/ZIM_file_format#Namespaces
// TODO : read the contentType from the ZIM file instead of hard-coding it here
if (nameSpace === 'A') {
console.log("It's an article : " + titleName);
console.log("It's an article : " + title);
contentType = 'text/html';
}
else if (nameSpace === 'I' || nameSpace === 'J') {
console.log("It's an image : " + titleName);
if (regexpJPEG.test(titleName)) {
console.log("It's an image : " + title);
if (regexpJPEG.test(title)) {
contentType = 'image/jpeg';
}
else if (regexpPNG.test(titleName)) {
else if (regexpPNG.test(title)) {
contentType = 'image/png';
}
}
else if (nameSpace === '-') {
console.log("It's a layout dependency : " + titleName);
if (regexpJS.test(titleName)) {
console.log("It's a layout dependency : " + title);
if (regexpJS.test(title)) {
contentType = 'text/javascript';
var responseInit = {
status: 200,
Expand All @@ -147,21 +147,21 @@ function fetchEventListener(event) {
resolve(httpResponse);
return;
}
else if (regexpCSS.test(titleName)) {
else if (regexpCSS.test(title)) {
contentType = 'text/css';
}
}

// We need to remove the potential parameters in the URL
titleName = removeUrlParameters(decodeURIComponent(titleName));
title = removeUrlParameters(decodeURIComponent(title));

titleNameWithNameSpace = nameSpace + '/' + titleName;
titleWithNameSpace = nameSpace + '/' + title;

// Let's instanciate a new messageChannel, to allow app.s to give us the content
var messageChannel = new MessageChannel();
messageChannel.port1.onmessage = function(event) {
if (event.data.action === 'giveContent') {
console.log('content message received for ' + titleNameWithNameSpace, event.data);
console.log('content message received for ' + titleWithNameSpace, event.data);
var responseInit = {
status: 200,
statusText: 'OK',
Expand All @@ -172,16 +172,16 @@ function fetchEventListener(event) {

var httpResponse = new Response(event.data.content, responseInit);

console.log('ServiceWorker responding to the HTTP request for ' + titleNameWithNameSpace + ' (size=' + event.data.content.length + ' octets)' , httpResponse);
console.log('ServiceWorker responding to the HTTP request for ' + titleWithNameSpace + ' (size=' + event.data.content.length + ' octets)' , httpResponse);
resolve(httpResponse);
}
else {
console.log('Invalid message received from app.js for ' + titleNameWithNameSpace, event.data);
console.log('Invalid message received from app.js for ' + titleWithNameSpace, event.data);
reject(event.data);
}
};
console.log('Eventlistener added to listen for an answer to ' + titleNameWithNameSpace);
outgoingMessagePort.postMessage({'action': 'askForContent', 'titleName': titleNameWithNameSpace}, [messageChannel.port2]);
console.log('Eventlistener added to listen for an answer to ' + titleWithNameSpace);
outgoingMessagePort.postMessage({'action': 'askForContent', 'title': titleWithNameSpace}, [messageChannel.port2]);
console.log('Message sent to app.js through outgoingMessagePort');
}));
}
Expand Down
Loading