mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 15:45:13 +00:00
22 lines
524 B
JavaScript
22 lines
524 B
JavaScript
var $ = require('jquery');
|
|
var url = require('url');
|
|
var path = require('path');
|
|
|
|
var state = {};
|
|
|
|
state.update = function(dom) {
|
|
var $book = $(dom.find('.book'));
|
|
|
|
state.$book = $book;
|
|
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;
|