summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-10-22 13:50:05 +0200
committerSamy Pessé <samypesse@gmail.com>2015-10-22 13:50:05 +0200
commitad39dc8c0cb605ec4f155dabd2043e08543fd00d (patch)
tree6f31669dcf61240fef7910f6611c16060ab24978
parent481a76319fadef4e8f117dd55fda270c14aa0a25 (diff)
downloadgitbook-ad39dc8c0cb605ec4f155dabd2043e08543fd00d.zip
gitbook-ad39dc8c0cb605ec4f155dabd2043e08543fd00d.tar.gz
gitbook-ad39dc8c0cb605ec4f155dabd2043e08543fd00d.tar.bz2
Update app.js
-rw-r--r--theme/assets/website/app.js372
1 files changed, 349 insertions, 23 deletions
diff --git a/theme/assets/website/app.js b/theme/assets/website/app.js
index a5a28b9..1230ac8 100644
--- a/theme/assets/website/app.js
+++ b/theme/assets/website/app.js
@@ -1,4 +1,325 @@
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
+(function (process){
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// resolves . and .. elements in a path array with directory names there
+// must be no slashes, empty elements, or device names (c:\) in the array
+// (so also no leading and trailing slashes - it does not distinguish
+// relative and absolute paths)
+function normalizeArray(parts, allowAboveRoot) {
+ // if the path tries to go above the root, `up` ends up > 0
+ var up = 0;
+ for (var i = parts.length - 1; i >= 0; i--) {
+ var last = parts[i];
+ if (last === '.') {
+ parts.splice(i, 1);
+ } else if (last === '..') {
+ parts.splice(i, 1);
+ up++;
+ } else if (up) {
+ parts.splice(i, 1);
+ up--;
+ }
+ }
+
+ // if the path is allowed to go above the root, restore leading ..s
+ if (allowAboveRoot) {
+ for (; up--; up) {
+ parts.unshift('..');
+ }
+ }
+
+ return parts;
+}
+
+// Split a filename into [root, dir, basename, ext], unix version
+// 'root' is just a slash, or nothing.
+var splitPathRe =
+ /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
+var splitPath = function(filename) {
+ return splitPathRe.exec(filename).slice(1);
+};
+
+// path.resolve([from ...], to)
+// posix version
+exports.resolve = function() {
+ var resolvedPath = '',
+ resolvedAbsolute = false;
+
+ for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
+ var path = (i >= 0) ? arguments[i] : process.cwd();
+
+ // Skip empty and invalid entries
+ if (typeof path !== 'string') {
+ throw new TypeError('Arguments to path.resolve must be strings');
+ } else if (!path) {
+ continue;
+ }
+
+ resolvedPath = path + '/' + resolvedPath;
+ resolvedAbsolute = path.charAt(0) === '/';
+ }
+
+ // At this point the path should be resolved to a full absolute path, but
+ // handle relative paths to be safe (might happen when process.cwd() fails)
+
+ // Normalize the path
+ resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
+ return !!p;
+ }), !resolvedAbsolute).join('/');
+
+ return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
+};
+
+// path.normalize(path)
+// posix version
+exports.normalize = function(path) {
+ var isAbsolute = exports.isAbsolute(path),
+ trailingSlash = substr(path, -1) === '/';
+
+ // Normalize the path
+ path = normalizeArray(filter(path.split('/'), function(p) {
+ return !!p;
+ }), !isAbsolute).join('/');
+
+ if (!path && !isAbsolute) {
+ path = '.';
+ }
+ if (path && trailingSlash) {
+ path += '/';
+ }
+
+ return (isAbsolute ? '/' : '') + path;
+};
+
+// posix version
+exports.isAbsolute = function(path) {
+ return path.charAt(0) === '/';
+};
+
+// posix version
+exports.join = function() {
+ var paths = Array.prototype.slice.call(arguments, 0);
+ return exports.normalize(filter(paths, function(p, index) {
+ if (typeof p !== 'string') {
+ throw new TypeError('Arguments to path.join must be strings');
+ }
+ return p;
+ }).join('/'));
+};
+
+
+// path.relative(from, to)
+// posix version
+exports.relative = function(from, to) {
+ from = exports.resolve(from).substr(1);
+ to = exports.resolve(to).substr(1);
+
+ function trim(arr) {
+ var start = 0;
+ for (; start < arr.length; start++) {
+ if (arr[start] !== '') break;
+ }
+
+ var end = arr.length - 1;
+ for (; end >= 0; end--) {
+ if (arr[end] !== '') break;
+ }
+
+ if (start > end) return [];
+ return arr.slice(start, end - start + 1);
+ }
+
+ var fromParts = trim(from.split('/'));
+ var toParts = trim(to.split('/'));
+
+ var length = Math.min(fromParts.length, toParts.length);
+ var samePartsLength = length;
+ for (var i = 0; i < length; i++) {
+ if (fromParts[i] !== toParts[i]) {
+ samePartsLength = i;
+ break;
+ }
+ }
+
+ var outputParts = [];
+ for (var i = samePartsLength; i < fromParts.length; i++) {
+ outputParts.push('..');
+ }
+
+ outputParts = outputParts.concat(toParts.slice(samePartsLength));
+
+ return outputParts.join('/');
+};
+
+exports.sep = '/';
+exports.delimiter = ':';
+
+exports.dirname = function(path) {
+ var result = splitPath(path),
+ root = result[0],
+ dir = result[1];
+
+ if (!root && !dir) {
+ // No dirname whatsoever
+ return '.';
+ }
+
+ if (dir) {
+ // It has a dirname, strip trailing slash
+ dir = dir.substr(0, dir.length - 1);
+ }
+
+ return root + dir;
+};
+
+
+exports.basename = function(path, ext) {
+ var f = splitPath(path)[2];
+ // TODO: make this comparison case-insensitive on windows?
+ if (ext && f.substr(-1 * ext.length) === ext) {
+ f = f.substr(0, f.length - ext.length);
+ }
+ return f;
+};
+
+
+exports.extname = function(path) {
+ return splitPath(path)[3];
+};
+
+function filter (xs, f) {
+ if (xs.filter) return xs.filter(f);
+ var res = [];
+ for (var i = 0; i < xs.length; i++) {
+ if (f(xs[i], i, xs)) res.push(xs[i]);
+ }
+ return res;
+}
+
+// String.prototype.substr - negative index don't work in IE8
+var substr = 'ab'.substr(-1) === 'b'
+ ? function (str, start, len) { return str.substr(start, len) }
+ : function (str, start, len) {
+ if (start < 0) start = str.length + start;
+ return str.substr(start, len);
+ }
+;
+
+}).call(this,require('_process'))
+},{"_process":2}],2:[function(require,module,exports){
+// shim for using process in browser
+
+var process = module.exports = {};
+var queue = [];
+var draining = false;
+var currentQueue;
+var queueIndex = -1;
+
+function cleanUpNextTick() {
+ draining = false;
+ if (currentQueue.length) {
+ queue = currentQueue.concat(queue);
+ } else {
+ queueIndex = -1;
+ }
+ if (queue.length) {
+ drainQueue();
+ }
+}
+
+function drainQueue() {
+ if (draining) {
+ return;
+ }
+ var timeout = setTimeout(cleanUpNextTick);
+ draining = true;
+
+ var len = queue.length;
+ while(len) {
+ currentQueue = queue;
+ queue = [];
+ while (++queueIndex < len) {
+ if (currentQueue) {
+ currentQueue[queueIndex].run();
+ }
+ }
+ queueIndex = -1;
+ len = queue.length;
+ }
+ currentQueue = null;
+ draining = false;
+ clearTimeout(timeout);
+}
+
+process.nextTick = function (fun) {
+ var args = new Array(arguments.length - 1);
+ if (arguments.length > 1) {
+ for (var i = 1; i < arguments.length; i++) {
+ args[i - 1] = arguments[i];
+ }
+ }
+ queue.push(new Item(fun, args));
+ if (queue.length === 1 && !draining) {
+ setTimeout(drainQueue, 0);
+ }
+};
+
+// v8 likes predictible objects
+function Item(fun, array) {
+ this.fun = fun;
+ this.array = array;
+}
+Item.prototype.run = function () {
+ this.fun.apply(null, this.array);
+};
+process.title = 'browser';
+process.browser = true;
+process.env = {};
+process.argv = [];
+process.version = ''; // empty string to avoid regexp issues
+process.versions = {};
+
+function noop() {}
+
+process.on = noop;
+process.addListener = noop;
+process.once = noop;
+process.off = noop;
+process.removeListener = noop;
+process.removeAllListeners = noop;
+process.emit = noop;
+
+process.binding = function (name) {
+ throw new Error('process.binding is not supported');
+};
+
+process.cwd = function () { return '/' };
+process.chdir = function (dir) {
+ throw new Error('process.chdir is not supported');
+};
+process.umask = function() { return 0; };
+
+},{}],3:[function(require,module,exports){
(function (global){
/*! https://mths.be/punycode v1.3.2 by @mathias */
;(function(root) {
@@ -532,7 +853,7 @@
}(this));
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{}],2:[function(require,module,exports){
+},{}],4:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -618,7 +939,7 @@ var isArray = Array.isArray || function (xs) {
return Object.prototype.toString.call(xs) === '[object Array]';
};
-},{}],3:[function(require,module,exports){
+},{}],5:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -705,13 +1026,13 @@ var objectKeys = Object.keys || function (obj) {
return res;
};
-},{}],4:[function(require,module,exports){
+},{}],6:[function(require,module,exports){
'use strict';
exports.decode = exports.parse = require('./decode');
exports.encode = exports.stringify = require('./encode');
-},{"./decode":2,"./encode":3}],5:[function(require,module,exports){
+},{"./decode":4,"./encode":5}],7:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -1420,7 +1741,7 @@ function isNullOrUndefined(arg) {
return arg == null;
}
-},{"punycode":1,"querystring":4}],6:[function(require,module,exports){
+},{"punycode":3,"querystring":6}],8:[function(require,module,exports){
/*!
* jQuery JavaScript Library v2.1.4
* http://jquery.com/
@@ -10632,7 +10953,7 @@ return jQuery;
}));
-},{}],7:[function(require,module,exports){
+},{}],9:[function(require,module,exports){
(function (global){
/**
* @license
@@ -22987,7 +23308,7 @@ return jQuery;
}.call(this));
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{}],8:[function(require,module,exports){
+},{}],10:[function(require,module,exports){
/*global define:false */
/**
* Copyright 2015 Craig Campbell
@@ -24010,7 +24331,7 @@ return jQuery;
}
}) (window, document);
-},{}],9:[function(require,module,exports){
+},{}],11:[function(require,module,exports){
var $ = require('jquery');
function toggleDropdown(e) {
@@ -24037,13 +24358,13 @@ module.exports = {
};
-},{"jquery":6}],10:[function(require,module,exports){
+},{"jquery":8}],12:[function(require,module,exports){
var $ = require('jquery');
module.exports = $({});
-},{"jquery":6}],11:[function(require,module,exports){
+},{"jquery":8}],13:[function(require,module,exports){
var $ = require('jquery');
var _ = require('lodash');
@@ -24127,7 +24448,7 @@ window.require = function(mods, fn) {
module.exports = {};
-},{"./dropdown":9,"./events":10,"./keyboard":12,"./navigation":14,"./sidebar":16,"./state":17,"./storage":18,"./toolbar":19,"jquery":6,"lodash":7}],12:[function(require,module,exports){
+},{"./dropdown":11,"./events":12,"./keyboard":14,"./navigation":16,"./sidebar":18,"./state":19,"./storage":20,"./toolbar":21,"jquery":8,"lodash":9}],14:[function(require,module,exports){
var Mousetrap = require('mousetrap');
var navigation = require('./navigation');
@@ -24165,7 +24486,7 @@ module.exports = {
bind: bindShortcut
};
-},{"./navigation":14,"./sidebar":16,"mousetrap":8}],13:[function(require,module,exports){
+},{"./navigation":16,"./sidebar":18,"mousetrap":10}],15:[function(require,module,exports){
var state = require('./state');
function showLoading(p) {
@@ -24181,7 +24502,7 @@ module.exports = {
show: showLoading
};
-},{"./state":17}],14:[function(require,module,exports){
+},{"./state":19}],16:[function(require,module,exports){
var $ = require('jquery');
var url = require('url');
@@ -24343,12 +24664,12 @@ module.exports = {
goPrev: goPrev
};
-},{"./events":10,"./loading":13,"./state":17,"jquery":6,"url":5}],15:[function(require,module,exports){
+},{"./events":12,"./loading":15,"./state":19,"jquery":8,"url":7}],17:[function(require,module,exports){
module.exports = {
isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
};
-},{}],16:[function(require,module,exports){
+},{}],18:[function(require,module,exports){
var $ = require('jquery');
var _ = require('lodash');
@@ -24401,25 +24722,30 @@ module.exports = {
filter: filterSummary
};
-},{"./platform":15,"./state":17,"./storage":18,"jquery":6,"lodash":7}],17:[function(require,module,exports){
+},{"./platform":17,"./state":19,"./storage":20,"jquery":8,"lodash":9}],19:[function(require,module,exports){
var $ = require('jquery');
+var url = require('url');
+var path = require('path');
var state = {};
state.update = function(dom) {
- var $book = $(dom.find(".book"));
+ var $book = $(dom.find('.book'));
state.$book = $book;
- state.level = $book.data("level");
- state.basePath = $book.data("basepath");
- state.revision = $book.data("revision");
+ state.level = $book.data('level');
+ state.basePath = $book.data('basepath');
+ state.revision = $book.data('revision');
+
+ // Absolute url to the root of the book
+ state.root = url.resolve(location.origin, path.dirname(path.resolve(location.pathname, state.basePath)));
};
state.update($);
module.exports = state;
-},{"jquery":6}],18:[function(require,module,exports){
+},{"jquery":8,"path":1,"url":7}],20:[function(require,module,exports){
var baseKey = '';
/*
@@ -24458,7 +24784,7 @@ module.exports = {
}
};
-},{}],19:[function(require,module,exports){
+},{}],21:[function(require,module,exports){
var $ = require('jquery');
var _ = require('lodash');
@@ -24638,4 +24964,4 @@ module.exports = {
createButton: createButton
};
-},{"./events":10,"jquery":6,"lodash":7}]},{},[11]);
+},{"./events":12,"jquery":8,"lodash":9}]},{},[13]);