mirror of
https://github.com/duguosheng/6.S081-All-in-one.git
synced 2026-11-28 15:01:33 +08:00
修改结构
This commit is contained in:
4
node_modules/gitbook-plugin-chapter-fold/.npmignore
generated
vendored
Normal file
4
node_modules/gitbook-plugin-chapter-fold/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
package.json
|
||||
README
|
||||
CHANGELOG
|
||||
LICENSE / LICENCE
|
||||
39
node_modules/gitbook-plugin-chapter-fold/README.md
generated
vendored
Normal file
39
node_modules/gitbook-plugin-chapter-fold/README.md
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
#Chapter fold for GitBook
|
||||
==============
|
||||
|
||||
Extended from the **expandable-chapters** plugin, and make a little modify. Thx for the original author.
|
||||
Tiny change to the expandable-chapters plugin from https://github.com/DomainDrivenArchitecture/ to use smaller arrows.
|
||||
|
||||
### Anything Change?
|
||||
|
||||
Modify the feature of the chapter links, make the links could be clicked to fold or expand their content.
|
||||
And add a new feature in order to keep the last chapter which the user browses at last time.
|
||||
|
||||
### How to use it?
|
||||
|
||||
Add it to your `book.json` configuration:
|
||||
|
||||
```
|
||||
{
|
||||
plugins: ["chapter-fold"]
|
||||
}
|
||||
```
|
||||
|
||||
Install your plugins using:
|
||||
|
||||
```
|
||||
$ gitbook install
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
There is _no_ configuration needed at the moment, can be left empty.
|
||||
|
||||
```
|
||||
{
|
||||
"pluginsConfig": {
|
||||
"chapter-fold":{}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
29
node_modules/gitbook-plugin-chapter-fold/book/chapter-fold.css
generated
vendored
Normal file
29
node_modules/gitbook-plugin-chapter-fold/book/chapter-fold.css
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
.book .book-summary .chapter > .articles {
|
||||
overflow: hidden;
|
||||
max-height: 0px;
|
||||
}
|
||||
|
||||
.book .book-summary .chapter.expanded > .articles {
|
||||
max-height: 9999px;
|
||||
}
|
||||
|
||||
.book .book-summary .exc-trigger {
|
||||
position: absolute;
|
||||
left: 12px;
|
||||
top: 12px;
|
||||
}
|
||||
|
||||
.book .book-summary ul.summary li a,
|
||||
.book .book-summary ul.summary li span {
|
||||
padding-left: 30px;
|
||||
}
|
||||
|
||||
.book .book-summary .exc-trigger:before {
|
||||
content: "\f105";
|
||||
}
|
||||
|
||||
.book .book-summary .expanded > a .exc-trigger:before,
|
||||
.book .book-summary .expanded > span .exc-trigger:before {
|
||||
content: "\f107";
|
||||
}
|
||||
|
||||
67
node_modules/gitbook-plugin-chapter-fold/book/chapter-fold.js
generated
vendored
Normal file
67
node_modules/gitbook-plugin-chapter-fold/book/chapter-fold.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
require(['gitbook', 'jQuery'], function(gitbook, $) {
|
||||
var TOGGLE_CLASSNAME = 'expanded',
|
||||
CHAPTER = '.chapter',
|
||||
ARTICLES = '.articles',
|
||||
TRIGGER_TEMPLATE = '<i class="exc-trigger fa"></i>',
|
||||
LS_NAMESPACE = 'expChapters';
|
||||
var init = function () {
|
||||
// adding the trigger element to each ARTICLES parent and binding the event
|
||||
var chapterLink = $(ARTICLES).parent(CHAPTER).children('a');
|
||||
chapterLink.append($(TRIGGER_TEMPLATE));
|
||||
chapterLink.on('click', function (e) {
|
||||
e.preventDefault();
|
||||
//e.stopPropagation();
|
||||
toggle($(e.target).closest(CHAPTER));
|
||||
});
|
||||
|
||||
expand(lsItem());
|
||||
//expand current selected chapter with it's parents
|
||||
collapse($(CHAPTER));
|
||||
var activeChapter = $(CHAPTER + '.active');
|
||||
expand(activeChapter);
|
||||
expand(activeChapter.parents(CHAPTER));
|
||||
}
|
||||
//on page.change will happend the function.
|
||||
|
||||
var toggle = function ($chapter) {
|
||||
if ($chapter.hasClass('expanded')) {
|
||||
collapse($chapter);
|
||||
} else {
|
||||
expand($chapter);
|
||||
//$chapter.addClass('active').siblings().removeClass('active');
|
||||
}
|
||||
}
|
||||
var collapse = function ($chapter) {
|
||||
if ($chapter.length && $chapter.hasClass(TOGGLE_CLASSNAME)) {
|
||||
$chapter.removeClass(TOGGLE_CLASSNAME);
|
||||
lsItem($chapter);
|
||||
}
|
||||
}
|
||||
var expand = function ($chapter) {
|
||||
if ($chapter.length && !$chapter.hasClass(TOGGLE_CLASSNAME)) {
|
||||
$chapter.addClass(TOGGLE_CLASSNAME);
|
||||
lsItem($chapter);
|
||||
}
|
||||
}
|
||||
var lsItem = function () {
|
||||
var map = JSON.parse(localStorage.getItem(LS_NAMESPACE)) || {}
|
||||
if (arguments.length) {
|
||||
var $chapters = arguments[0];
|
||||
$chapters.each(function (index, element) {
|
||||
var level = $(this).data('level');
|
||||
var value = $(this).hasClass(TOGGLE_CLASSNAME);
|
||||
map[level] = value;
|
||||
})
|
||||
localStorage.setItem(LS_NAMESPACE, JSON.stringify(map));
|
||||
} else {
|
||||
return $(CHAPTER).map(function(index, element){
|
||||
if (map[$(this).data('level')]) {
|
||||
return this;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
gitbook.events.bind('page.change', function() {
|
||||
init()
|
||||
});
|
||||
});
|
||||
12
node_modules/gitbook-plugin-chapter-fold/index.js
generated
vendored
Normal file
12
node_modules/gitbook-plugin-chapter-fold/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
module.exports = {
|
||||
// Extend website resources and html
|
||||
website: {
|
||||
assets: "./book",
|
||||
js: [
|
||||
"chapter-fold.js"
|
||||
],
|
||||
css: [
|
||||
"chapter-fold.css"
|
||||
]
|
||||
}
|
||||
};
|
||||
87
node_modules/gitbook-plugin-chapter-fold/package.json
generated
vendored
Normal file
87
node_modules/gitbook-plugin-chapter-fold/package.json
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"name": "gitbook-plugin-chapter-fold",
|
||||
"raw": "gitbook-plugin-chapter-fold@0.0.4",
|
||||
"rawSpec": "0.0.4",
|
||||
"scope": null,
|
||||
"spec": "0.0.4",
|
||||
"type": "version"
|
||||
},
|
||||
"D:\\WorkSpace\\Gitbook\\test"
|
||||
]
|
||||
],
|
||||
"_cnpm_publish_time": 1529402331929,
|
||||
"_from": "gitbook-plugin-chapter-fold@0.0.4",
|
||||
"_hasShrinkwrap": false,
|
||||
"_id": "gitbook-plugin-chapter-fold@0.0.4",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/gitbook-plugin-chapter-fold",
|
||||
"_nodeVersion": "8.9.4",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "s3://npm-registry-packages",
|
||||
"tmp": "tmp/gitbook-plugin-chapter-fold_0.0.4_1529402331863_0.19505579298587006"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "crazypad@qq.com",
|
||||
"name": "coco9420"
|
||||
},
|
||||
"_npmVersion": "4.6.1",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "gitbook-plugin-chapter-fold",
|
||||
"raw": "gitbook-plugin-chapter-fold@0.0.4",
|
||||
"rawSpec": "0.0.4",
|
||||
"scope": null,
|
||||
"spec": "0.0.4",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER"
|
||||
],
|
||||
"_resolved": "https://registry.nlark.com/gitbook-plugin-chapter-fold/download/gitbook-plugin-chapter-fold-0.0.4.tgz",
|
||||
"_shasum": "dcd5a21f80bcbc98c088419774c397ae6d4463ef",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "gitbook-plugin-chapter-fold@0.0.4",
|
||||
"_where": "D:\\WorkSpace\\Gitbook\\test",
|
||||
"author": {
|
||||
"name": "Colin"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/ColinCollins/gitbook-plugin-chapter-fold/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"noattachment": false,
|
||||
"shasum": "dcd5a21f80bcbc98c088419774c397ae6d4463ef",
|
||||
"size": 2051,
|
||||
"tarball": "https://registry.nlark.com/gitbook-plugin-chapter-fold/download/gitbook-plugin-chapter-fold-0.0.4.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"gitbook": ">=1.0.0"
|
||||
},
|
||||
"gitHead": "523aa84802ccbeabfae13d66c3dda66b4961b72f",
|
||||
"homepage": "https://github.com/ColinCollins/gitbook-plugin-chapter-fold",
|
||||
"license": "Apache 2",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"email": "crazypad@qq.com",
|
||||
"name": "coco9420"
|
||||
}
|
||||
],
|
||||
"name": "gitbook-plugin-chapter-fold",
|
||||
"optionalDependencies": {},
|
||||
"publish_time": 1529402331929,
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ColinCollins/gitbook-plugin-chapter-fold.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"version": "0.0.4"
|
||||
}
|
||||
Reference in New Issue
Block a user