Compatibility for require of plugins

This commit is contained in:
Samy Pessé
2015-10-24 21:36:17 +02:00
parent 4bc56564b4
commit ea4d96610f
2 changed files with 8 additions and 2 deletions
+6 -1
View File
@@ -24426,7 +24426,7 @@ var gitbook = {
// Modules mapping for plugins
var MODULES = {
'gitbook': gitbook,
'jQuery': $,
'jquery': $,
'lodash': _
};
@@ -24435,6 +24435,7 @@ window.$ = $;
window.jQuery = $;
window.require = function(mods, fn) {
mods = _.map(mods, function(mod) {
mod = mod.toLowerCase();
if (!MODULES[mod]) {
throw new Error('GitBook module '+mod+' doesn\'t exist');
}
@@ -24735,7 +24736,11 @@ state.update = function(dom) {
state.$book = $book;
state.level = $book.data('level');
state.basePath = $book.data('basepath');
// Date of build
state.revision = $book.data('revision');
// Original path of the file
state.filepath = $book.data('filepath');
// Absolute url to the root of the book
+2 -1
View File
@@ -59,7 +59,7 @@ var gitbook = {
// Modules mapping for plugins
var MODULES = {
'gitbook': gitbook,
'jQuery': $,
'jquery': $,
'lodash': _
};
@@ -68,6 +68,7 @@ window.$ = $;
window.jQuery = $;
window.require = function(mods, fn) {
mods = _.map(mods, function(mod) {
mod = mod.toLowerCase();
if (!MODULES[mod]) {
throw new Error('GitBook module '+mod+' doesn\'t exist');
}