diff --git a/.gitignore b/.gitignore index f87060a9..c7b69d3f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,11 @@ /__archives -/__dist/** -!/__dist/bibi-bookshelf -/__dist/bibi-bookshelf/** -!/__dist/bibi-bookshelf/.gitignore +/__dist /__src/bibi/wardrobe/DRESS-TEMPLATE-* +/archives +/bib +/dev-bib + node_modules npm-debug.log diff --git a/README.md b/README.md index b6f38eec..ee1d8a03 100644 --- a/README.md +++ b/README.md @@ -131,20 +131,25 @@ How to Arrange Development Environment 2. $ `cd ` 3. $ `npm install` +And files and folders are generated in `__dist` folder. + ### How to Develop 1. $ `npm start` - 1. webpack generates development version of Bibi, and start to watch changes of the files. + 1. webpack generates development version of Bibi to `__dist` folder, and start to watch changes of the files in `__src` folder. 2. BrowserSync webserver launches and navigate your browser to `http://localhost:61671/bibi/?book=`. 2. Edit source files. - 1. webpack watches your modification and updates development version of the file(s) with sourcemaps. + 1. If you modify source files in `__src` folder, development version of the file(s) are updated in `__dist` folder automaticaly. 2. BrowserSync reloads your browser(s) or inject changes of CSS. +Files in `__dist` folder generated with `npm start` are development version. +Please don't forget to run `npm run build` and build production version before you upload. + | Distribution | Source | | --------------------------------------- | ----------------------------------------------------------------------------------------------------- | -| `__dist/bibi/index.html` | `__src/bibi/index.html` | +| `__dist/bibi/*.html` | `__src/bibi/*.html` | | `__dist/bibi/and/jo.js` | `__src/bibi/and/jo.js` + `__src/bibi/and/jo.scss` | | `__dist/bibi/extensions/**` | `__src/bibi/extensions/**` | | `__dist/bibi/presets/*.js` | `__src/bibi/presets/*.js` | @@ -152,22 +157,22 @@ How to Arrange Development Environment | `__dist/bibi/resources/styles/bibi.css` | `__src/bibi/resources/styles/*.scss` | | `__dist/bibi/wardrobe/**/*.css` | Read documents in `__src/bibi/wardrobe/README-DRESS_ja` (Sorry..., currently README is Japanese only) | -* Files in `__dist/bibi-bookshelf/` are not processed (this directory contains `.gitkeep`) - +Files in the `Distribution` column of the table are overwritten with the files updated by `npm start` or `npm run build`. +If you want to modify them, please edit files in the `Source` column instead of editing these files in `__dist` directly. ### How to Build * $ `npm run build` - - webpack generates production version of Bibi. - + - webpack generates production version of Bibi to `__dist` folder. + - You can upload them to your online webserver. -### How to Make a Ditribution +### How to Make a Ditribution Package -* $ `npm run make:distribution` - 1. webpack generates production version of Bibi. - 2. gulp generates zipped archive. +* $ `npm run make:distribution-package` + 1. webpack generates production version of Bibi to `__dist` folder. + 2. gulp generates zipped archive to `__archives` folder. diff --git a/__src/bibi/resources/scripts/bibi.heart.js b/__src/bibi/resources/scripts/bibi.heart.js index 1b116c87..dd211e28 100644 --- a/__src/bibi/resources/scripts/bibi.heart.js +++ b/__src/bibi/resources/scripts/bibi.heart.js @@ -62,7 +62,7 @@ Bibi.initialize = () => { if(Lan == 'en') break; } return 'en'; })())); - // Device & Event; + // Device & Event if(O.TouchOS = (sML.OS.iOS || sML.OS.Android)) { O.HTML.classList.add('touch'); if(sML.OS.iOS) { @@ -77,8 +77,8 @@ Bibi.initialize = () => { H.initialize(); U.initialize(); S.initialize(); + // Say Bye-bye if(sML.UA.Trident && !(sML.UA.Trident[0] >= 7)) { - // Say Bye-bye I.note(`Your Browser Is Not Compatible`, 99999999999, 'ErrorOccured'); return O.error(I.Veil.byebye({ 'en': `Sorry.... Your Browser Is Not Compatible.`, @@ -205,7 +205,7 @@ Bibi.loadBook = (BookDataParam) => Promise.resolve().then(() => { }); }).then(() => { if(S['use-cookie']) { - const BibiCookie = O.Cookie.remember(O.RootPath); + const BibiCookie = O.Cookie.remember(O.Path); const BookCookie = O.Cookie.remember(B.ID); if(BibiCookie) { if(!U['reader-view-mode'] && BibiCookie.RVM ) S['reader-view-mode'] = BibiCookie.RVM; @@ -1315,21 +1315,14 @@ R.layOutSpread = (Spread) => new Promise(resolve => { // Paired Mixed Items if(R.Stage.Width > Spread.Items[0].Box.offsetWidth + Spread.Items[1].Box.offsetWidth) { // horizontal layout - console.log(`== R.layOutSpread ======================================= Mixed:A ==`); SpreadSize.Width = Spread.Items[0].Box.offsetWidth + Spread.Items[1].Box.offsetWidth; SpreadSize.Height = Math.max(Spread.Items[0].Box.offsetHeight, Spread.Items[1].Box.style.offsetHeight); + console.log(`» R.layOutSpread › Mixed:H › R.Spreads[${ Spread.Index }]`, Spread); } else { // vertical layout - console.log(`== R.layOutSpread ======================================= Mixed:B ==`); SpreadSize.Width = Math.max(Spread.Items[0].Box.offsetWidth, Spread.Items[1].Box.offsetWidth); SpreadSize.Height = Spread.Items[0].Box.offsetHeight + Spread.Items[1].Box.offsetHeight; - } /**/ { - console.log(`--------------------------------------------------------------------`); - console.log(`The Structure of this EPUB File is Rare.`); - console.log(`If This File is Yours and You Can Send It,`); - console.log(`Please Send It as a Sample to the Author of Bibi.`); - console.log(`It will Help Improving Bibi So Much !`); - console.log(`====================================================================`); + console.log(`» R.layOutSpread › Mixed:V › R.Spreads[${ Spread.Index }]`, Spread); } } if(O.Scrollbars.Height && S.SLA == 'vertical' && S.ARA != 'vertical') { @@ -1888,7 +1881,7 @@ R.changeView = (Par, Opt = {}) => { L.play(); } if(S['use-cookie']) { - O.Cookie.eat(O.RootPath, { + O.Cookie.eat(O.Path, { 'RVM': Par.Mode }); } @@ -2531,7 +2524,7 @@ I.Menu = { create: () => { if(IsActive) O.HTML.classList.add( 'book-full-breadth'); else O.HTML.classList.remove('book-full-breadth'); if(S.RVM == 'horizontal' || S.RVM == 'vertical') R.changeView({ Mode: S.RVM, Force: true }); - if(S['use-cookie']) O.Cookie.eat(O.RootPath, { 'FBL': S['full-breadth-layout-in-scroll'] }); + if(S['use-cookie']) O.Cookie.eat(O.Path, { 'FBL': S['full-breadth-layout-in-scroll'] }); } }] }] @@ -2701,7 +2694,7 @@ I.FontSizeChanger = { create: () => { const FontSizeChanger = I.FontSizeChanger = {}; if(typeof S['font-size-scale-per-step'] != 'number' || S['font-size-scale-per-step'] <= 1) S['font-size-scale-per-step'] = 1.25; if(S['use-font-size-changer'] && S['use-cookie']) { - const BibiCookie = O.Cookie.remember(O.RootPath); + const BibiCookie = O.Cookie.remember(O.Path); if(BibiCookie && BibiCookie.FontSize && BibiCookie.FontSize.Step != undefined) FontSizeChanger.Step = BibiCookie.FontSize.Step * 1; } if(typeof FontSizeChanger.Step != 'number' || FontSizeChanger.Step < -2 || 2 < FontSizeChanger.Step) FontSizeChanger.Step = 0; @@ -2759,7 +2752,7 @@ I.FontSizeChanger = { create: () => { if(typeof Actions.before == 'function') Actions.before(); FontSizeChanger.Step = Step; if(S['use-font-size-changer'] && S['use-cookie']) { - O.Cookie.eat(O.RootPath, { FontSize: { Step: Step } }); + O.Cookie.eat(O.Path, { FontSize: { Step: Step } }); } setTimeout(() => { R.layOut({ @@ -5095,12 +5088,7 @@ O.getOrigin = (Win = window) => { const Loc = Win.location; O.Origin = O.getOrigin(); -O.Path = (DCS => { - if(DCS) return DCS.src; - return document.getElementById('bibi-script').src; -})(document.currentScript); - -O.RootPath = O.Path.replace(/\/res\/scripts\/.+$/, ''); +O.Path = document.currentScript.src; O.Cookie = { @@ -5304,11 +5292,7 @@ X.load = (Xtn) => new Promise((resolve, reject) => { const XO = new URL(Xtn['src']).origin; if(!S['trustworthy-origins'].includes(XO)) return reject(`The Origin Is Not Allowed. ("${ Xtn['src'] }")`); Xtn.Script = document.head.appendChild(sML.create('script', { className: 'bibi-extension-script', src: Xtn['src'], Extension: Xtn, resolve: resolve, reject: function() { reject(); document.head.removeChild(this); } })); -})/*.then(DefinedExtension => - DefinedExtension['id'] + ': ' + O.getPath(O.RootPath, DefinedExtension['src']) -).catch(Msg => - Msg -)*/; +}); X.add = (XMeta) => { const XScript = document.currentScript; diff --git a/bibi.info.js b/bibi.info.js index 36731d3a..4faae265 100644 --- a/bibi.info.js +++ b/bibi.info.js @@ -83,7 +83,7 @@ Bibi.Banners = { // ----------------------------------------------------------------------------------------------------------------------------- -'/jo.js': _banner(`Jo | Partner of Bibi who embeds Bibi frame in webpage.`, 'default', null, true), +'/jo.js': _banner(`Jo | Helper for Embedding Bibi-Frames in Webpage.`, 'default', null, true), // -----------------------------------------------------------------------------------------------------------------------------