Deploy acpi.dortania.ml to github.com/dortania/Getting-Started-With-ACPI.git:gh-pages

This commit is contained in:
Travis Build Bot (from Travis CI)
2020-04-14 01:21:59 +00:00
parent 727bbdc432
commit c034ef5cd8
27 changed files with 1641 additions and 68 deletions

View File

@@ -0,0 +1,30 @@
a.plugin-anchor {
color: inherit !important;
display: none;
margin-left: -30px;
padding-left: 40px;
cursor: pointer;
position: absolute;
top: 0;
left: 0;
bottom: 0;
}
a.plugin-anchor i {
margin-left: -30px;
font-size: 15px !important;
}
h1, h2, h3, h4, h5, h6 {
position: relative;
}
h1:hover a.plugin-anchor, h2:hover a.plugin-anchor, h3:hover a.plugin-anchor,
h4:hover a.plugin-anchor, h5:hover a.plugin-anchor, h6:hover a.plugin-anchor {
display: inline-block;
}
.book .book-body .page-wrapper .page-inner section.normal {
overflow: visible;
}

View File

@@ -0,0 +1,50 @@
require([ 'gitbook' ], function (gitbook) {
handleEditButton = function (e, config) {
/**
* [defaultOption: default option]
* @type {Object}
*/
const defaultOption = {
'url': 'https://github.com',
'repo': 'aleen42/PersonalWiki',
'branch': 'master'
};
/** if users have its option, and then combine it with default options */
if (config['github-edit']) {
// @deprecated
// if (this.options.pluginsConfig['page-treeview']) {
for (var item in defaultOption) {
/** special for copyright */
// @deprecated
const configOption = config['github-edit'];
// defaultOption[item] = this.options.pluginsConfig['page-treeview'][item] || defaultOption[item];
if (item in configOption) {
defaultOption[item] = configOption[item];
}
}
}
const configRoot = config['root'];
gitbook.toolbar.createButton({
icon: 'fa fa-pencil-square-o ',
label: 'Edit on GitHub',
position: 'right',
onClick: function () {
window.open(defaultOption.url
+ '/'
+ defaultOption.repo
+ '/edit/'
+ defaultOption.branch
+ (configRoot ? '/' + configRoot : '')
+ '/'
+ gitbook.state.filepath
);
}
});
};
gitbook.events.bind('start', handleEditButton);
});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
.medium-zoom--opened .medium-zoom-overlay {
z-index: 998;
}
.medium-zoom-image--opened {
z-index: 999;
}

View File

@@ -0,0 +1,28 @@
require([
'gitbook'
], function(gitbook) {
const options = {
margin: 0,
background: '#fff',
scrollOffset: 40
};
const init = function() {
mediumZoom("img", options);
}
gitbook.events.bind('start', function(e, config){
const configOption = config['medium-zoom'];
if (configOption) {
for (const item in options) {
if (options.hasOwnProperty(item) && (item in configOption)) {
options[item] = configOption[item];
}
}
}
});
gitbook.events.bind('page.change', function(e, config) {
init();
});
});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,44 @@
/*
This CSS only styled the search results section, not the search input
It defines the basic interraction to hide content when displaying results, etc
*/
#book-search-input {
background: inherit;
}
#book-search-results .search-results {
display: none;
}
#book-search-results .search-results ul.search-results-list {
list-style-type: none;
padding-left: 0;
}
#book-search-results .search-results ul.search-results-list li {
margin-bottom: 1.5rem;
padding-bottom: 0.5rem;
/* Highlight results */
}
#book-search-results .search-results ul.search-results-list li p em {
background-color: rgba(255, 220, 0, 0.4);
font-style: normal;
}
#book-search-results .search-results .no-results {
display: none;
}
#book-search-results.open .search-results {
display: block;
}
#book-search-results.open .search-noresults {
display: none;
}
#book-search-results.no-results .search-results .has-results {
display: none;
}
#book-search-results.no-results .search-results .no-results {
display: block;
}
#book-search-results span.search-highlight-keyword {
background: #ff0;
}
#book-search-results.search-plus .search-results .has-results .search-results-item {
color: inherit;
}

View File

@@ -0,0 +1,252 @@
require([
'gitbook',
'jquery'
], function (gitbook, $) {
var MAX_DESCRIPTION_SIZE = 500
var state = gitbook.state
var INDEX_DATA = {}
var usePushState = (typeof window.history.pushState !== 'undefined')
// DOM Elements
var $body = $('body')
var $bookSearchResults
var $searchList
var $searchTitle
var $searchResultsCount
var $searchQuery
// Throttle search
function throttle (fn, wait) {
var timeout
return function () {
var ctx = this
var args = arguments
if (!timeout) {
timeout = setTimeout(function () {
timeout = null
fn.apply(ctx, args)
}, wait)
}
}
}
function displayResults (res) {
$bookSearchResults = $('#book-search-results')
$searchList = $bookSearchResults.find('.search-results-list')
$searchTitle = $bookSearchResults.find('.search-results-title')
$searchResultsCount = $searchTitle.find('.search-results-count')
$searchQuery = $searchTitle.find('.search-query')
$bookSearchResults.addClass('open')
var noResults = res.count == 0
$bookSearchResults.toggleClass('no-results', noResults)
// Clear old results
$searchList.empty()
// Display title for research
$searchResultsCount.text(res.count)
$searchQuery.text(res.query)
// Create an <li> element for each result
res.results.forEach(function (item) {
var $li = $('<li>', {
'class': 'search-results-item'
})
var $title = $('<h3>')
var $link = $('<a>', {
'href': gitbook.state.basePath + '/' + item.url + '?h=' + encodeURIComponent(res.query),
'text': item.title,
'data-is-search': 1
})
if ($link[0].href.split('?')[0] === window.location.href.split('?')[0]) {
$link[0].setAttribute('data-need-reload', 1)
}
var content = item.body.trim()
if (content.length > MAX_DESCRIPTION_SIZE) {
content = content + '...'
}
var $content = $('<p>').html(content)
$link.appendTo($title)
$title.appendTo($li)
$content.appendTo($li)
$li.appendTo($searchList)
})
$('.body-inner').scrollTop(0)
}
function escapeRegExp (keyword) {
// escape regexp prevserve word
return String(keyword).replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1')
}
function query (keyword) {
if (keyword == null || keyword.trim() === '') return
keyword = keyword.toLowerCase()
var results = []
var index = -1
for (var page in INDEX_DATA) {
var store = INDEX_DATA[page]
if (
~store.keywords.toLowerCase().indexOf(keyword) ||
~(index = store.body.toLowerCase().indexOf(keyword))
) {
results.push({
url: page,
title: store.title,
body: store.body.substr(Math.max(0, index - 50), MAX_DESCRIPTION_SIZE)
.replace(/^[^\s,.]+./, '').replace(/(..*)[\s,.].*/, '$1') // prevent break word
.replace(new RegExp('(' + escapeRegExp(keyword) + ')', 'gi'), '<span class="search-highlight-keyword">$1</span>')
})
}
}
displayResults({
count: results.length,
query: keyword,
results: results
})
}
function launchSearch (keyword) {
// Add class for loading
$body.addClass('with-search')
$body.addClass('search-loading')
function doSearch () {
query(keyword)
$body.removeClass('search-loading')
}
throttle(doSearch)()
}
function closeSearch () {
$body.removeClass('with-search')
$('#book-search-results').removeClass('open')
}
function bindSearch () {
// Bind DOM
var $body = $('body')
// Launch query based on input content
function handleUpdate () {
var $searchInput = $('#book-search-input input')
var keyword = $searchInput.val()
if (keyword.length === 0) {
closeSearch()
} else {
launchSearch(keyword)
}
}
$body.on('keyup', '#book-search-input input', function (e) {
if (e.keyCode === 13) {
if (usePushState) {
var uri = updateQueryString('q', $(this).val())
window.history.pushState({
path: uri
}, null, uri)
}
}
handleUpdate()
})
// Push to history on blur
$body.on('blur', '#book-search-input input', function (e) {
// Update history state
if (usePushState) {
var uri = updateQueryString('q', $(this).val())
window.history.pushState({
path: uri
}, null, uri)
}
})
}
gitbook.events.on('start', function () {
bindSearch()
$.getJSON(state.basePath + '/search_plus_index.json').then(function (data) {
INDEX_DATA = data
showResult()
closeSearch()
})
})
// highlight
var highLightPageInner = function (keyword) {
$('.page-inner').mark(keyword, {
'ignoreJoiners': true,
'acrossElements': true,
'separateWordSearch': false
})
setTimeout(function () {
var mark = $('mark[data-markjs="true"]')
if (mark.length) {
mark[0].scrollIntoView()
}
}, 100)
}
function showResult () {
var keyword, type
if (/\b(q|h)=([^&]+)/.test(window.location.search)) {
type = RegExp.$1
keyword = decodeURIComponent(RegExp.$2)
if (type === 'q') {
launchSearch(keyword)
} else {
highLightPageInner(keyword)
}
$('#book-search-input input').val(keyword)
}
}
gitbook.events.on('page.change', showResult)
function updateQueryString (key, value) {
value = encodeURIComponent(value)
var url = window.location.href.replace(/([?&])(?:q|h)=([^&]+)(&|$)/, function (all, pre, value, end) {
if (end === '&') {
return pre
}
return ''
})
var re = new RegExp('([?&])' + key + '=.*?(&|#|$)(.*)', 'gi')
var hash
if (re.test(url)) {
if (typeof value !== 'undefined' && value !== null) { return url.replace(re, '$1' + key + '=' + value + '$2$3') } else {
hash = url.split('#')
url = hash[0].replace(re, '$1$3').replace(/(&|\?)$/, '')
if (typeof hash[1] !== 'undefined' && hash[1] !== null) { url += '#' + hash[1] }
return url
}
} else {
if (typeof value !== 'undefined' && value !== null) {
var separator = url.indexOf('?') !== -1 ? '&' : '?'
hash = url.split('#')
url = hash[0] + separator + key + '=' + value
if (typeof hash[1] !== 'undefined' && hash[1] !== null) { url += '#' + hash[1] }
return url
} else { return url }
}
}
window.addEventListener('click', function (e) {
if (e.target.tagName === 'A' && e.target.getAttribute('data-need-reload')) {
setTimeout(function () {
window.location.reload()
}, 100)
}
}, true)
})