Skip to content

Commit

Permalink
Merge branch 'release/v1.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
satorumurmur committed Jul 4, 2020
2 parents 5adcb4b + fcee19e commit d6317b5
Show file tree
Hide file tree
Showing 22 changed files with 2,085 additions and 2,230 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ Supported by

### [Media Do Co.,Ltd](https://www.mediado.jp)

* Bibi v1.1.1 was developed with the huge support and many feedbacks from Media Do Co.,Ltd.
* Bibi v1.2.0 was developed with the huge support and many feedbacks from Media Do Co.,Ltd.



Expand Down
8 changes: 5 additions & 3 deletions __src/bibi/and/jo.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ Jo.callBibi = (Love) => {
});
Anchor.style.display = 'none';
if(!Jo.TrustworthyOrigins.includes(Anchor.origin)) Jo.TrustworthyOrigins.push(Anchor.origin); // It is NOT reflected to S['trustworthy-origins'].
Anchor.href += (/#/.test(Anchor.href) ? ',' : '#') + (() => {
Anchor.href += (/#/.test(Anchor.href) ? '&' : '#') + (() => {
const Fragments = new Jo.Fragments();
Fragments.add('parent-bibi-index', Bibi.Index);
[
'autostart-embedded', 'autostart',
'p',
'fix-reader-view-mode', 'fix-view', 'view-unchangeable',
'full-breadth-layout-in-scroll',
'iipp',
Expand All @@ -79,6 +80,7 @@ Jo.callBibi = (Love) => {
'start-embedded-in-new-window', 'start-in-new-window'
].forEach(K => { let V = '' + (Love.ownerDocument ? Love.getAttribute('data-bibi-' + K) || '' : Love['bibi-' + K]);
if(V && (() => { switch(K) {
case 'p': return /^(\d*\.)?\d+$/;
case 'iipp': return /^(\d*\.)?\d+$/;
case 'nav': return /^[1-9][0-9]*$/;
case 'rvm': case 'view': K = 'reader-view-mode';
Expand Down Expand Up @@ -157,8 +159,8 @@ Jo.Fragments = function() { // constructor
this.make = function() {
if(!this.FragmentKeys.length) return '';
const Fragments = [];
for(let l = this.FragmentKeys.length, i = 0; i < l; i++) Fragments.push(`${ this.FragmentKeys[i] }:${ Jo.encode(this.FragmentKeysAndValues[this.FragmentKeys[i]]) }`);
return `jo(${ Fragments.join(',') })`;
for(let l = this.FragmentKeys.length, i = 0; i < l; i++) Fragments.push(`${ this.FragmentKeys[i] }=${ Jo.encode(this.FragmentKeysAndValues[this.FragmentKeys[i]]) }`);
return `jo(${ Fragments.join('&') })`;
};
return this;
};
Expand Down
4 changes: 2 additions & 2 deletions __src/bibi/extensions/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Bibi.x({

id: 'Analytics',
description: 'Utilities for Tracking and Logging with Google Analytics.',
author: 'Satoru MATSUSHIMA (@satorumurmur)',
version: '2.0.1'
author: 'Satoru Matsushima (@satorumurmur)',
version: '1.2.0-demo'

})(function() {

Expand Down
4 changes: 2 additions & 2 deletions __src/bibi/extensions/epubcfi.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Bibi.x({

id: 'EPUBCFI',
description: 'Utilities for EPUBCFI', // An Example Is at the Bottom of This Document.
author: 'Satoru MATSUSHIMA (@satorumurmur)',
version: '0.2.1'
author: 'Satoru Matsushima (@satorumurmur)',
version: '1.2.0-demo'

})(function() {

Expand Down
35 changes: 17 additions & 18 deletions __src/bibi/extensions/extractor/at-once.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Bibi.x({

id: 'Extractor_at-once',
description: 'Utilities for Zipped Books. (Method: at-once)',
author: 'Satoru MATSUSHIMA (@satorumurmur)',
version: '2.1.1'
author: 'Satoru Matsushima (@satorumurmur)',
version: '1.2.0'

})(function() {

Expand All @@ -22,17 +22,16 @@ Bibi.x({
I.Veil.Cover.appendChild(I.getBookIcon());
L.wait().then(() => resolve(BookData));
})
.then(makeArrayBuffer)
.then(JSZip.loadAsync)
.then(extractArchive);
.then(load)
.then(extract);

const makeArrayBuffer = (BookData) => new Promise((resolve, reject) => // resolve(ArrayBuffer)
typeof BookData == 'string' ? JSZipUtils.getBinaryContent(BookData, (Err, ABuf) => Err ? reject(`Book File Is Not Found or Invalid.`) : resolve(ABuf)) :
BookData instanceof Blob ? (() => { const FR = new FileReader(); FR.onerror = () => reject(`Book Data Is Invalid.`); FR.onload = () => resolve(FR.result); FR.readAsArrayBuffer(BookData); })() :
reject(`Book Data Is Invalid.`)
);
const load = (BookData) => new Promise((resolve, reject) => // resolve(ArrayBuffer)
typeof BookData == 'string' ? JSZipUtils.getBinaryContent(BookData, (Err, ABuf) => Err ? reject(Bibi.ErrorMessages.NotFound) : resolve(ABuf)) :
BookData.size && BookData.type ? (() => { const FR = new FileReader(); FR.onerror = () => reject(Bibi.ErrorMessages.DataInvalid); FR.onload = () => resolve(FR.result); FR.readAsArrayBuffer(BookData); })() :
reject(Bibi.ErrorMessages.DataInvalid)
).then(ArrayBuffer => JSZip.loadAsync(ArrayBuffer).catch(Err => Promise.reject(Bibi.ErrorMessages.DataInvalid)));

const extractArchive = (BookDataArchive) => new Promise((resolve, reject) => {
const extract = (BookDataArchive) => new Promise((resolve, reject) => {
if(I.Catcher.Input) I.Catcher.style.opacity = 0;
const FilesToBeExtract = [];
for(let FileName in BookDataArchive.files) {
Expand All @@ -48,11 +47,11 @@ Bibi.x({
}
FilesToBeExtract.push(FileName);
}
if(!FilesToBeExtract.length) return reject(`Does Not Contain Any Resources`);
if(!FilesToBeExtract.length) return reject(Bibi.ErrorMessages.DataInvalid);
let FolderName = '', FolderNameRE = undefined;
const PathsToBeChecked = [];
if(B.Type != 'Zine') PathsToBeChecked.push(B.Container.Path); // EPUB or unknown.
if(B.Type != 'EPUB') PathsToBeChecked.push(B.ZineData.Path ); // Zine or unknown.
if(B.Type != 'Zine') PathsToBeChecked.push(B.Container.Source.Path); // EPUB or unknown.
if(B.Type != 'EPUB') PathsToBeChecked.push( B.ZineData.Source.Path); // Zine or unknown.
if(!PathsToBeChecked.filter(PathToBeChecked => FilesToBeExtract.includes(PathToBeChecked)).length) {
PathsToBeChecked.forEach(PathToBeChecked => {
if(!PathToBeChecked) return;
Expand All @@ -70,9 +69,9 @@ Bibi.x({
}
let RootFileFound = false;
if(B.Type) RootFileFound = FilesToBeExtract.includes(FolderName + PathsToBeChecked[0]);
else if(FilesToBeExtract.includes(FolderName + B.Container.Path)) B.Type = 'EPUB', RootFileFound = true;
else if(FilesToBeExtract.includes(FolderName + B.ZineData.Path )) B.Type = 'Zine', RootFileFound = true;
if(!RootFileFound) return reject(`Required Metafile${ B.Type ? ' (' + (B.Type != 'EPUB' ? B.ZineData.Path : B.Container.Path).split('/').slice(-1)[0] + ')' : '' } Is Not Contained.`);
else if(FilesToBeExtract.includes(FolderName + B.Container.Source.Path)) B.Type = 'EPUB', RootFileFound = true;
else if(FilesToBeExtract.includes(FolderName + B.ZineData.Source.Path)) B.Type = 'Zine', RootFileFound = true;
if(!RootFileFound) return reject(`${ B.Type ? (B.Type == 'EPUB' ? B.Container.Source.Path : B.ZineData.Source.Path).split('/').slice(-1)[0] : '' } Not Contained`);
const FileCount = { Particular: 0 };
const FileTypesToBeCounted = {
'Meta XML': 'xml|opf|ncx',
Expand All @@ -99,7 +98,7 @@ Bibi.x({
const IsBin = O.isBin({ Path: FileName });
Promises.push(
BookDataArchive.file(FolderName + FileName).async(IsBin ? 'blob' : 'string').then(FileContent => {
const Item = B.Package.Manifest.Items[FileName] = IsBin ?
B.Package.Manifest[FileName] = IsBin ?
{ Path: FileName, DataType: 'Blob', Content: FileContent } :
{ Path: FileName, DataType: 'Text', Content: FileContent.trim() };
for(const FileType in FileTypesToBeCounted) {
Expand Down
Loading

0 comments on commit d6317b5

Please sign in to comment.