提交 9e1719b6 编写于 作者: Lab机器人's avatar Lab机器人

init

上级 e0649fe7
因为 它太大了无法显示 source diff 。你可以改为 查看blob
.back-to-top {
position: fixed;
bottom: 25px;
right: 25px;
background: rgba(0, 0, 0, 0.5);
width: 50px;
height: 50px;
display: block;
text-decoration: none;
-webkit-border-radius: 35px;
-moz-border-radius: 35px;
border-radius: 35px;
display: none;
}
.back-to-top i {
color: #fff;
margin: 0;
position: relative;
left: 15px;
top: 14px;
font-size: 22px;
}
.back-to-top:hover {
background: rgba(0, 0, 0, 0.9);
cursor: pointer;
}
.book.color-theme-1 .back-to-top {
background: rgba(112, 66, 20, 0.5);
}
.book.color-theme-1 .back-to-top i {
color: #f3eacb;
}
.book.color-theme-1 .back-to-top:hover {
background: rgba(112, 66, 20, 0.9);
}
.book.color-theme-2 .back-to-top {
background: rgba(189, 202, 219, 0.5);
}
.book.color-theme-2 .back-to-top i {
color: #1C1F2B;
}
.book.color-theme-2 .back-to-top:hover {
background: rgba(189, 202, 219, 0.9);
}
@media only screen
and (min-device-width: 320px)
and (max-device-width: 480px)
and (-webkit-min-device-pixel-ratio: 2)
and (orientation: portrait) {
.back-to-top {
bottom: 10px;
right: 10px;
}
}
\ No newline at end of file
var gitbook = window.gitbook;
gitbook.events.on('page.change', function() {
var back_to_top_button = ['<div class="back-to-top"><i class="fa fa-arrow-up"></i></div>'].join("");
$(".book").append(back_to_top_button)
$(".back-to-top").hide();
$('.book-body,.body-inner').on('scroll', function () {
if ($(this).scrollTop() > 100) {
$('.back-to-top').fadeIn();
} else {
$('.back-to-top').fadeOut();
}
});
$('.back-to-top').click(function () {
$('.book-body,.body-inner').animate({
scrollTop: 0
}, 800);
return false;
});
});
require(['gitbook', 'jquery'], function(gitbook, $) {
// Configuration
var MAX_SIZE = 4,
MIN_SIZE = 0,
BUTTON_ID;
// Current fontsettings state
var fontState;
// Default themes
var THEMES = [
{
config: 'white',
text: 'White',
id: 0
},
{
config: 'sepia',
text: 'Sepia',
id: 1
},
{
config: 'night',
text: 'Night',
id: 2
}
];
// Default font families
var FAMILIES = [
{
config: 'serif',
text: 'Serif',
id: 0
},
{
config: 'sans',
text: 'Sans',
id: 1
}
];
// Return configured themes
function getThemes() {
return THEMES;
}
// Modify configured themes
function setThemes(themes) {
THEMES = themes;
updateButtons();
}
// Return configured font families
function getFamilies() {
return FAMILIES;
}
// Modify configured font families
function setFamilies(families) {
FAMILIES = families;
updateButtons();
}
// Save current font settings
function saveFontSettings() {
gitbook.storage.set('fontState', fontState);
update();
}
// Increase font size
function enlargeFontSize(e) {
e.preventDefault();
if (fontState.size >= MAX_SIZE) return;
fontState.size++;
saveFontSettings();
}
// Decrease font size
function reduceFontSize(e) {
e.preventDefault();
if (fontState.size <= MIN_SIZE) return;
fontState.size--;
saveFontSettings();
}
// Change font family
function changeFontFamily(configName, e) {
if (e && e instanceof Event) {
e.preventDefault();
}
var familyId = getFontFamilyId(configName);
fontState.family = familyId;
saveFontSettings();
}
// Change type of color theme
function changeColorTheme(configName, e) {
if (e && e instanceof Event) {
e.preventDefault();
}
var $book = gitbook.state.$book;
// Remove currently applied color theme
if (fontState.theme !== 0)
$book.removeClass('color-theme-'+fontState.theme);
// Set new color theme
var themeId = getThemeId(configName);
fontState.theme = themeId;
if (fontState.theme !== 0)
$book.addClass('color-theme-'+fontState.theme);
saveFontSettings();
}
// Return the correct id for a font-family config key
// Default to first font-family
function getFontFamilyId(configName) {
// Search for plugin configured font family
var configFamily = $.grep(FAMILIES, function(family) {
return family.config == configName;
})[0];
// Fallback to default font family
return (!!configFamily)? configFamily.id : 0;
}
// Return the correct id for a theme config key
// Default to first theme
function getThemeId(configName) {
// Search for plugin configured theme
var configTheme = $.grep(THEMES, function(theme) {
return theme.config == configName;
})[0];
// Fallback to default theme
return (!!configTheme)? configTheme.id : 0;
}
function update() {
var $book = gitbook.state.$book;
$('.font-settings .font-family-list li').removeClass('active');
$('.font-settings .font-family-list li:nth-child('+(fontState.family+1)+')').addClass('active');
$book[0].className = $book[0].className.replace(/\bfont-\S+/g, '');
$book.addClass('font-size-'+fontState.size);
$book.addClass('font-family-'+fontState.family);
if(fontState.theme !== 0) {
$book[0].className = $book[0].className.replace(/\bcolor-theme-\S+/g, '');
$book.addClass('color-theme-'+fontState.theme);
}
}
function init(config) {
// Search for plugin configured font family
var configFamily = getFontFamilyId(config.family),
configTheme = getThemeId(config.theme);
// Instantiate font state object
fontState = gitbook.storage.get('fontState', {
size: config.size || 2,
family: configFamily,
theme: configTheme
});
update();
}
function updateButtons() {
// Remove existing fontsettings buttons
if (!!BUTTON_ID) {
gitbook.toolbar.removeButton(BUTTON_ID);
}
// Create buttons in toolbar
BUTTON_ID = gitbook.toolbar.createButton({
icon: 'fa fa-font',
label: 'Font Settings',
className: 'font-settings',
dropdown: [
[
{
text: 'A',
className: 'font-reduce',
onClick: reduceFontSize
},
{
text: 'A',
className: 'font-enlarge',
onClick: enlargeFontSize
}
],
$.map(FAMILIES, function(family) {
family.onClick = function(e) {
return changeFontFamily(family.config, e);
};
return family;
}),
$.map(THEMES, function(theme) {
theme.onClick = function(e) {
return changeColorTheme(theme.config, e);
};
return theme;
})
]
});
}
// Init configuration at start
gitbook.events.bind('start', function(e, config) {
var opts = config.fontsettings;
// Generate buttons at start
updateButtons();
// Init current settings
init(opts);
});
// Expose API
gitbook.fontsettings = {
enlargeFontSize: enlargeFontSize,
reduceFontSize: reduceFontSize,
setTheme: changeColorTheme,
setFamily: changeFontFamily,
getThemes: getThemes,
setThemes: setThemes,
getFamilies: getFamilies,
setFamilies: setFamilies
};
});
/*
* Theme 1
*/
.color-theme-1 .dropdown-menu {
background-color: #111111;
border-color: #7e888b;
}
.color-theme-1 .dropdown-menu .dropdown-caret .caret-inner {
border-bottom: 9px solid #111111;
}
.color-theme-1 .dropdown-menu .buttons {
border-color: #7e888b;
}
.color-theme-1 .dropdown-menu .button {
color: #afa790;
}
.color-theme-1 .dropdown-menu .button:hover {
color: #73553c;
}
/*
* Theme 2
*/
.color-theme-2 .dropdown-menu {
background-color: #2d3143;
border-color: #272a3a;
}
.color-theme-2 .dropdown-menu .dropdown-caret .caret-inner {
border-bottom: 9px solid #2d3143;
}
.color-theme-2 .dropdown-menu .buttons {
border-color: #272a3a;
}
.color-theme-2 .dropdown-menu .button {
color: #62677f;
}
.color-theme-2 .dropdown-menu .button:hover {
color: #f4f4f5;
}
.book .book-header .font-settings .font-enlarge {
line-height: 30px;
font-size: 1.4em;
}
.book .book-header .font-settings .font-reduce {
line-height: 30px;
font-size: 1em;
}
.book.color-theme-1 .book-body {
color: #704214;
background: #f3eacb;
}
.book.color-theme-1 .book-body .page-wrapper .page-inner section {
background: #f3eacb;
}
.book.color-theme-2 .book-body {
color: #bdcadb;
background: #1c1f2b;
}
.book.color-theme-2 .book-body .page-wrapper .page-inner section {
background: #1c1f2b;
}
.book.font-size-0 .book-body .page-inner section {
font-size: 1.2rem;
}
.book.font-size-1 .book-body .page-inner section {
font-size: 1.4rem;
}
.book.font-size-2 .book-body .page-inner section {
font-size: 1.6rem;
}
.book.font-size-3 .book-body .page-inner section {
font-size: 2.2rem;
}
.book.font-size-4 .book-body .page-inner section {
font-size: 4rem;
}
.book.font-family-0 {
font-family: Georgia, serif;
}
.book.font-family-1 {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal {
color: #704214;
}
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal a {
color: inherit;
}
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1,
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2,
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h3,
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h4,
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h5,
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 {
color: inherit;
}
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1,
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2 {
border-color: inherit;
}
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 {
color: inherit;
}
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal hr {
background-color: inherit;
}
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal blockquote {
border-color: inherit;
}
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre,
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code {
background: #fdf6e3;
color: #657b83;
border-color: #f8df9c;
}
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal .highlight {
background-color: inherit;
}
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table th,
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table td {
border-color: #f5d06c;
}
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr {
color: inherit;
background-color: #fdf6e3;
border-color: #444444;
}
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) {
background-color: #fbeecb;
}
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal {
color: #bdcadb;
}
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal a {
color: #3eb1d0;
}
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1,
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2,
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h3,
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h4,
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h5,
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 {
color: #fffffa;
}
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1,
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2 {
border-color: #373b4e;
}
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 {
color: #373b4e;
}
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal hr {
background-color: #373b4e;
}
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal blockquote {
border-color: #373b4e;
}
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre,
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code {
color: #9dbed8;
background: #2d3143;
border-color: #2d3143;
}
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal .highlight {
background-color: #282a39;
}
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table th,
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table td {
border-color: #3b3f54;
}
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr {
color: #b6c2d2;
background-color: #2d3143;
border-color: #3b3f54;
}
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) {
background-color: #35394b;
}
.book.color-theme-1 .book-header {
color: #afa790;
background: transparent;
}
.book.color-theme-1 .book-header .btn {
color: #afa790;
}
.book.color-theme-1 .book-header .btn:hover {
color: #73553c;
background: none;
}
.book.color-theme-1 .book-header h1 {
color: #704214;
}
.book.color-theme-2 .book-header {
color: #7e888b;
background: transparent;
}
.book.color-theme-2 .book-header .btn {
color: #3b3f54;
}
.book.color-theme-2 .book-header .btn:hover {
color: #fffff5;
background: none;
}
.book.color-theme-2 .book-header h1 {
color: #bdcadb;
}
.book.color-theme-1 .book-body .navigation {
color: #afa790;
}
.book.color-theme-1 .book-body .navigation:hover {
color: #73553c;
}
.book.color-theme-2 .book-body .navigation {
color: #383f52;
}
.book.color-theme-2 .book-body .navigation:hover {
color: #fffff5;
}
/*
* Theme 1
*/
.book.color-theme-1 .book-summary {
color: #afa790;
background: #111111;
border-right: 1px solid rgba(0, 0, 0, 0.07);
}
.book.color-theme-1 .book-summary .book-search {
background: transparent;
}
.book.color-theme-1 .book-summary .book-search input,
.book.color-theme-1 .book-summary .book-search input:focus {
border: 1px solid transparent;
}
.book.color-theme-1 .book-summary ul.summary li.divider {
background: #7e888b;
box-shadow: none;
}
.book.color-theme-1 .book-summary ul.summary li i.fa-check {
color: #33cc33;
}
.book.color-theme-1 .book-summary ul.summary li.done > a {
color: #877f6a;
}
.book.color-theme-1 .book-summary ul.summary li a,
.book.color-theme-1 .book-summary ul.summary li span {
color: #877f6a;
background: transparent;
font-weight: normal;
}
.book.color-theme-1 .book-summary ul.summary li.active > a,
.book.color-theme-1 .book-summary ul.summary li a:hover {
color: #704214;
background: transparent;
font-weight: normal;
}
/*
* Theme 2
*/
.book.color-theme-2 .book-summary {
color: #bcc1d2;
background: #2d3143;
border-right: none;
}
.book.color-theme-2 .book-summary .book-search {
background: transparent;
}
.book.color-theme-2 .book-summary .book-search input,
.book.color-theme-2 .book-summary .book-search input:focus {
border: 1px solid transparent;
}
.book.color-theme-2 .book-summary ul.summary li.divider {
background: #272a3a;
box-shadow: none;
}
.book.color-theme-2 .book-summary ul.summary li i.fa-check {
color: #33cc33;
}
.book.color-theme-2 .book-summary ul.summary li.done > a {
color: #62687f;
}
.book.color-theme-2 .book-summary ul.summary li a,
.book.color-theme-2 .book-summary ul.summary li span {
color: #c1c6d7;
background: transparent;
font-weight: 600;
}
.book.color-theme-2 .book-summary ul.summary li.active > a,
.book.color-theme-2 .book-summary ul.summary li a:hover {
color: #f4f4f5;
background: #252737;
font-weight: 600;
}
pre,
code {
/* http://jmblog.github.io/color-themes-for-highlightjs */
/* Tomorrow Comment */
/* Tomorrow Red */
/* Tomorrow Orange */
/* Tomorrow Yellow */
/* Tomorrow Green */
/* Tomorrow Aqua */
/* Tomorrow Blue */
/* Tomorrow Purple */
}
pre .hljs-comment,
code .hljs-comment,
pre .hljs-title,
code .hljs-title {
color: #8e908c;
}
pre .hljs-variable,
code .hljs-variable,
pre .hljs-attribute,
code .hljs-attribute,
pre .hljs-tag,
code .hljs-tag,
pre .hljs-regexp,
code .hljs-regexp,
pre .hljs-deletion,
code .hljs-deletion,
pre .ruby .hljs-constant,
code .ruby .hljs-constant,
pre .xml .hljs-tag .hljs-title,
code .xml .hljs-tag .hljs-title,
pre .xml .hljs-pi,
code .xml .hljs-pi,
pre .xml .hljs-doctype,
code .xml .hljs-doctype,
pre .html .hljs-doctype,
code .html .hljs-doctype,
pre .css .hljs-id,
code .css .hljs-id,
pre .css .hljs-class,
code .css .hljs-class,
pre .css .hljs-pseudo,
code .css .hljs-pseudo {
color: #c82829;
}
pre .hljs-number,
code .hljs-number,
pre .hljs-preprocessor,
code .hljs-preprocessor,
pre .hljs-pragma,
code .hljs-pragma,
pre .hljs-built_in,
code .hljs-built_in,
pre .hljs-literal,
code .hljs-literal,
pre .hljs-params,
code .hljs-params,
pre .hljs-constant,
code .hljs-constant {
color: #f5871f;
}
pre .ruby .hljs-class .hljs-title,
code .ruby .hljs-class .hljs-title,
pre .css .hljs-rules .hljs-attribute,
code .css .hljs-rules .hljs-attribute {
color: #eab700;
}
pre .hljs-string,
code .hljs-string,
pre .hljs-value,
code .hljs-value,
pre .hljs-inheritance,
code .hljs-inheritance,
pre .hljs-header,
code .hljs-header,
pre .hljs-addition,
code .hljs-addition,
pre .ruby .hljs-symbol,
code .ruby .hljs-symbol,
pre .xml .hljs-cdata,
code .xml .hljs-cdata {
color: #718c00;
}
pre .css .hljs-hexcolor,
code .css .hljs-hexcolor {
color: #3e999f;
}
pre .hljs-function,
code .hljs-function,
pre .python .hljs-decorator,
code .python .hljs-decorator,
pre .python .hljs-title,
code .python .hljs-title,
pre .ruby .hljs-function .hljs-title,
code .ruby .hljs-function .hljs-title,
pre .ruby .hljs-title .hljs-keyword,
code .ruby .hljs-title .hljs-keyword,
pre .perl .hljs-sub,
code .perl .hljs-sub,
pre .javascript .hljs-title,
code .javascript .hljs-title,
pre .coffeescript .hljs-title,
code .coffeescript .hljs-title {
color: #4271ae;
}
pre .hljs-keyword,
code .hljs-keyword,
pre .javascript .hljs-function,
code .javascript .hljs-function {
color: #8959a8;
}
pre .hljs,
code .hljs {
display: block;
background: white;
color: #4d4d4c;
padding: 0.5em;
}
pre .coffeescript .javascript,
code .coffeescript .javascript,
pre .javascript .xml,
code .javascript .xml,
pre .tex .hljs-formula,
code .tex .hljs-formula,
pre .xml .javascript,
code .xml .javascript,
pre .xml .vbscript,
code .xml .vbscript,
pre .xml .css,
code .xml .css,
pre .xml .hljs-cdata,
code .xml .hljs-cdata {
opacity: 0.5;
}
(function() {
var newEl = document.createElement('script'),
firstScriptTag = document.getElementsByTagName('script')[0];
if (firstScriptTag) {
newEl.async = 1;
newEl.src = '//' + window.location.hostname + ':35729/livereload.js';
firstScriptTag.parentNode.insertBefore(newEl, firstScriptTag);
}
})();
body {
font-family: "Helvetica Neue", "Hiragino Sans GB", "Microsoft YaHei", "\9ED1\4F53", Arial, sans-serif;
letter-spacing: .2px;
text-rendering: optimizeLegibility;
}
.markdown-section h1,
.markdown-section h2,
.markdown-section h3,
.markdown-section h4,
.markdown-section h5,
.markdown-section h6 {
margin-bottom: .5em;
font-weight: 400;
}
.markdown-section p {
line-height: 2;
}
.markdown-section img {
padding: 8px;
background: #e4e4e478;
transition: all 1s;
box-sizing: border-box;
box-shadow: 0 0 4px #dcdcdc;
margin-left: 10px;
margin-right: 10px;
max-width: 95%;
}
.markdown-section img:hover {
box-shadow: 0 0 10px #bbb
}
.exc-trigger {
color: #333333;
}
.navigation {
display: none;
}
/*Book inner page*/
.book-summary-title {
height: 50px;
line-height: 50px;
padding-left: 30px;
font-size: 16px;
color: #adadad;
}
.book-summary,
.book-body {
top: 80px;
}
.book-summary ul.summary li.active {
border-right: 3px solid #f34d4d;
background: #f3f1f1;
}
.book-summary ul.summary li.active>a {
color: #f34d4d;
text-decoration: none;
}
.book-summary ul.summary li a:hover {
text-decoration: none;
}
.page-inner {
max-width: none;
padding: 20px 270px 40px 40px;
}
.header-inner #book-search-input {
float: right;
width: 300px;
margin: 10px 0;
padding: 0;
border: none;
background: #f34d4d;
user-select: none;
}
.header-inner #book-search-input input[type="text"] {
width: 80%;
background: #e4e4e4;
}
.header-inner #book-search-input #searchBtn {
color: #ffffff;
margin-left: 10px;
cursor: pointer;
}
.header-inner #book-search-input #searchBtn:hover {
color: #eae8e8;
}
.header-inner {
width: 100%;
padding: 10px 30px;
border-bottom: 1px solid #dededede;
margin: auto;
*zoom: 1;
height: 80px;
}
.header-inner:before,
.header-inner:after {
content: " ";
display: table;
line-height: 0;
}
.header-inner:after {
clear: both;
}
.header-inner .logo {
float: left;
height: 50px;
width: 120px;
background: url('./logo.png');
background-size: 120px 50px;
background-repeat: no-repeat;
}
.header-inner .logo img {
display: block;
height: inherit;
padding: 5px 0;
}
.header-inner .title {
float: left;
font-size: 20px;
line-height: 60px;
margin-left: 10px;
color: #575656;
}
/* 导航 */
.header-inner .header-nav {
list-style: none;
margin: 10px 20px 0 0;
padding: 0;
float: right;
display: table;
}
.header-inner .header-nav li {
display: table-cell;
vertical-align: middle;
min-width: 50px;
margin-right: 20px;
padding: 8px 10px 8px 10px;
}
.header-inner .header-nav li a {
color: #333333;
}
.header-inner .header-nav li a:hover,
.header-inner .header-nav li a.active {
color: #f34d4d;
}
.header-inner .header-nav li a.active:hover {
cursor: #f34d4d;
}
@media (max-width: 768px) {
.book-summary,
.book-body {
top: 101px;
}
.header-inner #book-search-input {
clear: both;
width: 100%;
}
}
/*Book inner page end*/
/* Book anchor*/
.book-anchor {
width: 180px;
position: absolute;
top: 130px;
right: 30px;
padding: 0 10px 10px 10px;
z-index: 999;
user-select: none;
border-left: 2px solid #ececec;
}
.book-anchor-title {
line-height: 38px;
font-weight: 400;
cursor: pointer;
}
.book-anchor a {
display: block;
line-height: 25px;
color: #656565;
font-size: 13px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.book-anchor a:hover {
color: #f34d4d;
text-decoration: none;
}
.book-anchor .selected {
color: #f34d4d;
text-decoration: none;
font-weight: bold;
}
.book-anchor .anchor-h1 {}
.book-anchor .anchor-h2 {
padding-left: 20px;
}
.book-anchor .anchor-h3{
padding-left: 30px;
}
\ No newline at end of file
require(['gitbook', 'jquery'], function(gitbook, $) {
function getRootPath() {
var pathName = window.location.pathname.substring(1);
var webName = pathName == '' ? '' : pathName.substring(0, pathName.indexOf('/'));
if (webName == "") {
return window.location.protocol + '//' + window.location.host;
}
else {
return window.location.protocol + '//' + window.location.host + '/' + webName;
}
}
//生成内容导航
function generateSectionNavigator(){
$(".page-inner .markdown-section").find("h1,h2,h3").each(function(){
var cls="anchor-h1";
if($(this).is("h2")){
cls="anchor-h2";
}
if($(this).is("h3")){
cls="anchor-h3";
}
var text = $(this).text();
var href = $(this).attr("id");
$(".book-anchor-body").append("<a id='an_"+text+"' class='anchor-text "+cls+"' title='"+text+"' href='#"+href+"'>"+text+"</a>")
});
$(".book-anchor-title").click(function () {
// $(".book-anchor-body").toggle();
});
$(".book-anchor-body>a").click(function(){
$(".book-anchor-body>a").removeClass("selected");
$(this).addClass("selected");
});
//获取hash值定向到指定位置
var hash = decodeURIComponent(location.hash);
if(hash){
hash = hash.substring(1);
$("#an_"+hash).addClass("selected");
}
}
//基础设置
function setBase(){
//标题
var $title = $(".header-inner .title");
$title.text(gitbook.state.config.title);
//搜索框
var $search = $('#book-search-input');
var placeholder = gitbook.state.config.pluginsConfig["theme-fexa"]["search-placeholder"] || "输入关键字搜索"
$search.find("input").attr("placeholder",placeholder);
$search.append("<span id='searchBtn'>搜索</span>");
$search.focus();
$("#searchBtn").click(function(e){});
//去掉gitbook-link
$(".summary .gitbook-link").hide();
$(".summary .divider").hide();
}
gitbook.events.on('start', function() {
});
gitbook.events.on('page.change', function() {
setBase();
generateSectionNavigator();
});
});
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册