Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Brett Ludwig committed Jul 8, 2016
2 parents 76115cf + 34cfd38 commit a9a1d2d
Show file tree
Hide file tree
Showing 60 changed files with 25,042 additions and 12,201 deletions.
4 changes: 4 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# How to contribute to Readium

Please visit this link for more information:
http://readium.github.io/contributing.html
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
*General Instructions*

- *Please use a short, but meaningful title.*
- *Delete everything in italics before submitting issue*
- *Make sure to fill in as much information as possible*

#### This issue is a Bug|Feature Request|Enhancement|Question|Task|Other
*(choose ONE from the above list and delete the others)*

#### Related issue(s) and/or pull request(s)
*Example: See also #NUMBER*

#### Expected Behaviour
*What you expected Readium to do...*

#### Observed behaviour
*Instead, Readium does...*

#### Steps to reproduce
1. First, do this
2. Then do this
3. etc.

#### Test file(s)
*If relevant, please indicate public EPUB URL(s), or whether you can share ebook(s) privately. It is often next to impossible to reproduce bugs without the original file.*

### Product
*Choose one of the following (and delete the others)*

* Readium Chrome extension
* latest official version available from the Chrome Web Store
* Version of the Chrome browser
* OS and version
* Readium cloud reader app
* latest development build uploaded at https://readium.firebaseapp.com OR a custom integration (list public deployment URL, if any)
* Browser and version
* OS and version
* Native application (Readium SDK C++)
* official "launcher" sample OR propietary app
* OS and version
* Hybrid app (ReadiumJS)
* Electron OR Apache Cordova OR ?
* OS and version
* Other?

#### Additional information
*Please list any additional information that might help us*
19 changes: 19 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
*General Instructions*

- *Please use a short, but meaningful title.*
- *Delete everything in italics before submitting the pull request*
- *Make sure to fill in as much information as possible*

#### This pull request is a Work In Progress|Finalized|Other
*(choose ONE from the above list and delete the others)*

#### Related issue(s) and/or pull request(s)
*Example: See also #NUMBER*

#### Test cases, sample files

*(if relevant, please indicate public EPUB URL(s), or whether you can share ebook(s) privately)*


### Additional information
*Please provide any and all information that might help us*
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
.DS_Store
node_modules
build.txt
plugins-override.cson
RequireJS_config_plugins.js
RequireJS_config_plugins_multiple-bundles.js
RequireJS_config_plugins_single-bundle.js
http.log
http.log
api-docs
.idea
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Windows ( https://github.com/readium/SDKLauncher-Windows ), etc.

You can try Readium here:

* Online "cloud reader" demo: http://development.readium.divshot.io
* Online "cloud reader" demo: https://readium.firebaseapp.com
* Chrome extension (can be used offline): https://chrome.google.com/webstore/detail/readium/fepbnnnkkadjhjahcafoaglimekefifl


Expand All @@ -24,7 +24,7 @@ See [license.txt](./license.txt).
## Prerequisites

* A decent terminal. On Windows, GitShell works great ( http://git-scm.com ), GitBash works too ( https://msysgit.github.io ), and Cygwin adds useful commands ( https://www.cygwin.com ).
* NodeJS ( https://nodejs.org ) **v0.12** or higher
* NodeJS ( https://nodejs.org ) **v4** (but not v5, because the installer ships with NPM v3 which seems to [have bugs](https://github.com/readium/readium-js-viewer/issues/453) related to the new flat module dependencies)


## Development
Expand Down
3 changes: 3 additions & 0 deletions build-config/RequireJS_config_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ require.config({
eventEmitter:
process._RJS_rootDir(1) + '/node_modules/eventemitter3/_rjs/index',
//see prepare:patch npm build task (converts CommonJS to AMD => define(function(require, exports, module) { .... });)

"es6-collections":
process._RJS_rootDir(1) + '/node_modules/es6-collections/index',

'FontLoader':
process._RJS_rootDir(1) + '/node_modules/FontLoader/FontLoader',
Expand Down
101 changes: 57 additions & 44 deletions build-output/_multiple-bundles/RequireJS.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/** vim: et:ts=4:sw=4:sts=4
* @license RequireJS 2.1.22 Copyright (c) 2010-2015, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details
* @license RequireJS 2.2.0 Copyright jQuery Foundation and other contributors.
* Released under MIT license, http://github.com/requirejs/requirejs/LICENSE
*/
//Not using strict: uneven strict support in browsers, #392, and causes
//problems with requirejs.exec()/transpiler plugins that may not be strict.
Expand All @@ -12,15 +11,14 @@ var requirejs, require, define;
(function (global) {
var req, s, head, baseElement, dataMain, src,
interactiveScript, currentlyAddingScript, mainScript, subPath,
version = '2.1.22',
version = '2.2.0',
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
jsSuffixRegExp = /\.js$/,
currDirRegExp = /^\.\//,
op = Object.prototype,
ostring = op.toString,
hasOwn = op.hasOwnProperty,
ap = Array.prototype,
isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document),
isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
//PS3 indicates loaded and complete, but need to wait for complete
Expand All @@ -37,6 +35,11 @@ var requirejs, require, define;
globalDefQueue = [],
useInteractive = false;

//Could match something like ')//comment', do not lose the prefix to comment.
function commentReplace(match, multi, multiText, singlePrefix) {
return singlePrefix || '';
}

function isFunction(it) {
return ostring.call(it) === '[object Function]';
}
Expand Down Expand Up @@ -861,10 +864,21 @@ var requirejs, require, define;

if (this.depCount < 1 && !this.defined) {
if (isFunction(factory)) {
try {
//If there is an error listener, favor passing
//to that instead of throwing an error. However,
//only do it for define()'d modules. require
//errbacks should not be called for failures in
//their callbacks (#699). However if a global
//onError is set, use that.
if ((this.events.error && this.map.isDefine) ||
req.onError !== defaultOnError) {
try {
exports = context.execCb(id, factory, depExports, exports);
} catch (e) {
err = e;
}
} else {
exports = context.execCb(id, factory, depExports, exports);
} catch (e) {
err = e;
}

// Favor return value over exports. If node/cjs in play,
Expand All @@ -881,30 +895,12 @@ var requirejs, require, define;
}

if (err) {
// If there is an error listener, favor passing
// to that instead of throwing an error. However,
// only do it for define()'d modules. require
// errbacks should not be called for failures in
// their callbacks (#699). However if a global
// onError is set, use that.
if ((this.events.error && this.map.isDefine) ||
req.onError !== defaultOnError) {
err.requireMap = this.map;
err.requireModules = this.map.isDefine ? [this.map.id] : null;
err.requireType = this.map.isDefine ? 'define' : 'require';
return onError((this.error = err));
} else if (typeof console !== 'undefined' &&
console.error) {
// Log the error for debugging. If promises could be
// used, this would be different, but making do.
console.error(err);
} else {
// Do not want to completely lose the error. While this
// will mess up processing and lead to similar results
// as bug 1440, it at least surfaces the error.
req.onError(err);
}
err.requireMap = this.map;
err.requireModules = this.map.isDefine ? [this.map.id] : null;
err.requireType = this.map.isDefine ? 'define' : 'require';
return onError((this.error = err));
}

} else {
//Just a literal value
exports = factory;
Expand Down Expand Up @@ -1288,6 +1284,14 @@ var requirejs, require, define;
}
}

// Convert old style urlArgs string to a function.
if (typeof cfg.urlArgs === 'string') {
var urlArgs = cfg.urlArgs;
cfg.urlArgs = function(id, url) {
return (url.indexOf('?') === -1 ? '?' : '&') + urlArgs;
};
}

//Save off the paths since they require special processing,
//they are additive.
var shim = config.shim,
Expand Down Expand Up @@ -1664,13 +1668,12 @@ var requirejs, require, define;

//Join the path parts together, then figure out if baseUrl is needed.
url = syms.join('/');
url += (ext || (/^data\:|\?/.test(url) || skipExt ? '' : '.js'));
url += (ext || (/^data\:|^blob\:|\?/.test(url) || skipExt ? '' : '.js'));
url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
}

return config.urlArgs ? url +
((url.indexOf('?') === -1 ? '?' : '&') +
config.urlArgs) : url;
return config.urlArgs && !/^blob\:/.test(url) ?
url + config.urlArgs(moduleName, url) : url;
},

//Delegates to req.load. Broken out as a separate function to
Expand Down Expand Up @@ -1724,8 +1727,8 @@ var requirejs, require, define;
each(value.depMaps, function(depMap) {
if (depMap.id === data.id) {
parents.push(key);
return true;
}
return true;
});
}
});
Expand Down Expand Up @@ -1891,9 +1894,6 @@ var requirejs, require, define;
if (isBrowser) {
//In the browser so use a script tag
node = req.createNode(config, moduleName, url);
if (config.onNodeCreated) {
config.onNodeCreated(node, config, moduleName, url);
}

node.setAttribute('data-requirecontext', context.contextName);
node.setAttribute('data-requiremodule', moduleName);
Expand All @@ -1909,11 +1909,11 @@ var requirejs, require, define;
if (node.attachEvent &&
//Check if node.attachEvent is artificially added by custom script or
//natively supported by browser
//read https://github.com/jrburke/requirejs/issues/187
//read https://github.com/requirejs/requirejs/issues/187
//if we can NOT find [native code] then it must NOT natively supported.
//in IE8, node.attachEvent does not have toString()
//Note the test for "[native code" with no closing brace, see:
//https://github.com/jrburke/requirejs/issues/273
//https://github.com/requirejs/requirejs/issues/273
!(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
!isOpera) {
//Probably IE. IE (at least 6-8) do not fire
Expand Down Expand Up @@ -1941,6 +1941,12 @@ var requirejs, require, define;
}
node.src = url;

//Calling onNodeCreated after all properties on the node have been
//set, but before it is placed in the DOM.
if (config.onNodeCreated) {
config.onNodeCreated(node, config, moduleName, url);
}

//For some cache cases in IE 6-8, the script executes before the end
//of the appendChild execution, so to tie an anonymous define
//call to the module name (which is stored on the node), hold on
Expand All @@ -1962,6 +1968,11 @@ var requirejs, require, define;
//are in play, the expectation is that a build has been done so
//that only one script needs to be loaded anyway. This may need
//to be reevaluated if other use cases become common.

// Post a task to the event loop to work around a bug in WebKit
// where the worker gets garbage-collected after calling
// importScripts(): https://webkit.org/b/153317
setTimeout(function() {}, 0);
importScripts(url);

//Account for anonymous modules
Expand Down Expand Up @@ -2007,8 +2018,10 @@ var requirejs, require, define;
//Preserve dataMain in case it is a path (i.e. contains '?')
mainScript = dataMain;

//Set final baseUrl if there is not already an explicit one.
if (!cfg.baseUrl) {
//Set final baseUrl if there is not already an explicit one,
//but only do so if the data-main value is not a loader plugin
//module ID.
if (!cfg.baseUrl && mainScript.indexOf('!') === -1) {
//Pull off the directory of data-main for use as the
//baseUrl.
src = mainScript.split('/');
Expand Down Expand Up @@ -2069,7 +2082,7 @@ var requirejs, require, define;
if (callback.length) {
callback
.toString()
.replace(commentRegExp, '')
.replace(commentRegExp, commentReplace)
.replace(cjsRequireRegExp, function (match, dep) {
deps.push(dep);
});
Expand Down
Loading

0 comments on commit a9a1d2d

Please sign in to comment.