rubyfu 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +96 -0
- data/Rakefile +1 -0
- data/_book/beginners.html +1299 -0
- data/_book/contribution.html +1350 -0
- data/_book/contributors/Ruby_Loves_Us.jpg +0 -0
- data/_book/contributors/index.html +1294 -0
- data/_book/contributors/todo.html +1293 -0
- data/_book/cover.jpg +0 -0
- data/_book/faqs/index.html +1308 -0
- data/_book/files/module03/dns_spoofing_dns-query.pcap +0 -0
- data/_book/files/module03/dns_spoofing_dns-req_res.pcap.pcapng +0 -0
- data/_book/files/module06/ftp.pcap +0 -0
- data/_book/files/module06/packets.pcap +0 -0
- data/_book/gitbook/app.js +25001 -0
- data/_book/gitbook/fonts/fontawesome/FontAwesome.otf +0 -0
- data/_book/gitbook/fonts/fontawesome/fontawesome-webfont.eot +0 -0
- data/_book/gitbook/fonts/fontawesome/fontawesome-webfont.svg +504 -0
- data/_book/gitbook/fonts/fontawesome/fontawesome-webfont.ttf +0 -0
- data/_book/gitbook/fonts/fontawesome/fontawesome-webfont.woff +0 -0
- data/_book/gitbook/images/apple-touch-icon-precomposed-152.png +0 -0
- data/_book/gitbook/images/favicon.ico +0 -0
- data/_book/gitbook/plugins/gitbook-plugin-addcssjs/README.md +19 -0
- data/_book/gitbook/plugins/gitbook-plugin-addcssjs/index.js +57 -0
- data/_book/gitbook/plugins/gitbook-plugin-addcssjs/package.json +47 -0
- data/_book/gitbook/plugins/gitbook-plugin-anchors/plugin.css +26 -0
- data/_book/gitbook/plugins/gitbook-plugin-book-summary-scroll-position-saver/book-summary-scroll-position-saver.js +30 -0
- data/_book/gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.css +28 -0
- data/_book/gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.js +68 -0
- data/_book/gitbook/plugins/gitbook-plugin-fontsettings/buttons.js +151 -0
- data/_book/gitbook/plugins/gitbook-plugin-fontsettings/website.css +291 -0
- data/_book/gitbook/plugins/gitbook-plugin-highlight/ebook.css +131 -0
- data/_book/gitbook/plugins/gitbook-plugin-highlight/website.css +426 -0
- data/_book/gitbook/plugins/gitbook-plugin-search/lunr.min.js +7 -0
- data/_book/gitbook/plugins/gitbook-plugin-search/search.css +27 -0
- data/_book/gitbook/plugins/gitbook-plugin-search/search.js +135 -0
- data/_book/gitbook/plugins/gitbook-plugin-sharing/buttons.js +93 -0
- data/_book/gitbook/plugins/gitbook-plugin-splitter/splitter.css +22 -0
- data/_book/gitbook/plugins/gitbook-plugin-splitter/splitter.js +122 -0
- data/_book/gitbook/style.css +9 -0
- data/_book/googlec55db2d603c3da8b.html +1 -0
- data/_book/images/module02/Cryptography__wiringdiagram.png +0 -0
- data/_book/images/module02/packaging__ocra1.png +0 -0
- data/_book/images/module03/dns_spoofing_wireshark1.png +0 -0
- data/_book/images/module03/dns_spoofing_wireshark2.png +0 -0
- data/_book/images/module04/webfu__post_form1.png +0 -0
- data/_book/images/module04/webfu__proxy2.png +0 -0
- data/_book/images/module04/webfu__twitterAPI1.png +0 -0
- data/_book/images/module04/webfu__xmlrpc1.png +0 -0
- data/_book/images/module05/msf_template1.png +0 -0
- data/_book/images/module06/win-foren__winreg1.png +0 -0
- data/_book/images/other/Ruby_Loves_Us.jpg +0 -0
- data/_book/images/other/cover.jpg +0 -0
- data/_book/images/other/cover_small.jpg +0 -0
- data/_book/images/other/logo.png +0 -0
- data/_book/images/other/rubyfu.png +0 -0
- data/_book/images/other/rubyfu1.png +0 -0
- data/_book/images/other/rubyfu3.png +0 -0
- data/_book/images/other/rubyfu4.png +0 -0
- data/_book/images/other/rubyfu_.png +0 -0
- data/_book/index.html +1284 -0
- data/_book/module_0x1__basic_ruby_kung_fu/array.html +1297 -0
- data/_book/module_0x1__basic_ruby_kung_fu/conversion.html +1386 -0
- data/_book/module_0x1__basic_ruby_kung_fu/extraction.html +1346 -0
- data/_book/module_0x1__basic_ruby_kung_fu/index.html +1367 -0
- data/_book/module_0x1__basic_ruby_kung_fu/string.html +1451 -0
- data/_book/module_0x2__system_kung_fu/command_execution.html +1348 -0
- data/_book/module_0x2__system_kung_fu/cryptography.html +1396 -0
- data/_book/module_0x2__system_kung_fu/email.html +1352 -0
- data/_book/module_0x2__system_kung_fu/file_manipulation.html +1371 -0
- data/_book/module_0x2__system_kung_fu/index.html +1557 -0
- data/_book/module_0x2__system_kung_fu/ncatrb.html +1424 -0
- data/_book/module_0x2__system_kung_fu/packaging.md +1 -0
- data/_book/module_0x2__system_kung_fu/packaging__ocra1.png +0 -0
- data/_book/module_0x2__system_kung_fu/parsing_html,_xml,_json.html +1395 -0
- data/_book/module_0x2__system_kung_fu/rce_as_a_service.html +1336 -0
- data/_book/module_0x2__system_kung_fu/smtp_enumeration.html +1308 -0
- data/_book/module_0x2__system_kung_fu/system_shell.html +1299 -0
- data/_book/module_0x2__system_kung_fu/virustotal.html +1318 -0
- data/_book/module_0x3__network_kung_fu/Remote_shell.md +19 -0
- data/_book/module_0x3__network_kung_fu/arp_spoofing.html +1420 -0
- data/_book/module_0x3__network_kung_fu/dns.html +1315 -0
- data/_book/module_0x3__network_kung_fu/dns_bruteforce.md +49 -0
- data/_book/module_0x3__network_kung_fu/dns_enumeration.html +1371 -0
- data/_book/module_0x3__network_kung_fu/dns_spoofing.html +1694 -0
- data/_book/module_0x3__network_kung_fu/dns_spoofing_wireshark2.png +0 -0
- data/_book/module_0x3__network_kung_fu/ftp.html +1287 -0
- data/_book/module_0x3__network_kung_fu/index.html +1392 -0
- data/_book/module_0x3__network_kung_fu/network_scanning.html +1339 -0
- data/_book/module_0x3__network_kung_fu/network_traffic_analysis.html +1356 -0
- data/_book/module_0x3__network_kung_fu/nmap.html +1355 -0
- data/_book/module_0x3__network_kung_fu/oracle_tns_enum1.png +0 -0
- data/_book/module_0x3__network_kung_fu/packet_manipulation.html +1386 -0
- data/_book/module_0x3__network_kung_fu/ruby_socket.html +1553 -0
- data/_book/module_0x3__network_kung_fu/snmp_enumeration.html +1314 -0
- data/_book/module_0x3__network_kung_fu/ssh.html +1461 -0
- data/_book/module_0x3__network_kung_fu/ssid_finder.html +1324 -0
- data/_book/module_0x3__network_kung_fu/tns_enumeration.html +1505 -0
- data/_book/module_0x4__web_kung_fu/browser_manipulation.html +1630 -0
- data/_book/module_0x4__web_kung_fu/databases.html +1531 -0
- data/_book/module_0x4__web_kung_fu/extending_burpsuite.html +1303 -0
- data/_book/module_0x4__web_kung_fu/index.html +1536 -0
- data/_book/module_0x4__web_kung_fu/interacting_with_apis.html +1271 -0
- data/_book/module_0x4__web_kung_fu/ruby2javascript.html +1303 -0
- data/_book/module_0x4__web_kung_fu/sql_injection_scanner.html +1489 -0
- data/_book/module_0x4__web_kung_fu/twitter_api.html +1328 -0
- data/_book/module_0x4__web_kung_fu/web_servcies_and_apis.html +1291 -0
- data/_book/module_0x4__web_kung_fu/web_server_and_proxy.html +1370 -0
- data/_book/module_0x4__web_kung_fu/web_services.html +1394 -0
- data/_book/module_0x4__web_kung_fu/webfu__burp-ext1.png +0 -0
- data/_book/module_0x4__web_kung_fu/webfu__burp-ext2.png +0 -0
- data/_book/module_0x4__web_kung_fu/webfu__burp_setenv1.png +0 -0
- data/_book/module_0x4__web_kung_fu/webfu__proxy2.png +0 -0
- data/_book/module_0x4__web_kung_fu/webfu__twitterAPI1.png +0 -0
- data/_book/module_0x4__web_kung_fu/webfu__xmlrpc1.png +0 -0
- data/_book/module_0x4__web_kung_fu/wordpress_api.html +1543 -0
- data/_book/module_0x5__exploitation_kung_fu/MSF-struct.png +0 -0
- data/_book/module_0x5__exploitation_kung_fu/auxiliary_module.html +1870 -0
- data/_book/module_0x5__exploitation_kung_fu/exploit_module.html +1523 -0
- data/_book/module_0x5__exploitation_kung_fu/extensions.html +1466 -0
- data/_book/module_0x5__exploitation_kung_fu/fuzzer.html +1325 -0
- data/_book/module_0x5__exploitation_kung_fu/index.html +1319 -0
- data/_book/module_0x5__exploitation_kung_fu/metasm.html +1322 -0
- data/_book/module_0x5__exploitation_kung_fu/metasploit.html +1441 -0
- data/_book/module_0x5__exploitation_kung_fu/meterpreter.html +1327 -0
- data/_book/module_0x5__exploitation_kung_fu/meterpreter_scripting.html +1318 -0
- data/_book/module_0x5__exploitation_kung_fu/msf_meter_railgun1.png +0 -0
- data/_book/module_0x5__exploitation_kung_fu/msf_template1.png +0 -0
- data/_book/module_0x5__exploitation_kung_fu/railgun_api_extension.html +1300 -0
- data/_book/module_0x6__forensic/android_forensic.html +1356 -0
- data/_book/module_0x6__forensic/index.html +1332 -0
- data/_book/module_0x6__forensic/parsing_log_files.html +1375 -0
- data/_book/module_0x6__forensic/win-foren__winreg1.png +0 -0
- data/_book/module_0x6__forensic/windows_forensic.html +1289 -0
- data/_book/package.json +5 -0
- data/_book/references/index.html +1338 -0
- data/_book/required_gems.html +1342 -0
- data/_book/rubyfu_.png +0 -0
- data/_book/search_index.json +1 -0
- data/_book/styles/ebook.css +1 -0
- data/_book/styles/epub.css +1 -0
- data/_book/styles/header.js +5 -0
- data/_book/styles/mobi.css +1 -0
- data/_book/styles/pdf.css +1 -0
- data/_book/styles/website.css +41 -0
- data/bin/rubyfu +48 -0
- data/lib/rubyfu.rb +36 -0
- data/lib/rubyfu/browse.rb +35 -0
- data/lib/rubyfu/version.rb +3 -0
- data/lib/rubyfu/webserver.rb +30 -0
- metadata +210 -0
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# gitbook-plugin-addcssjs
|
2
|
+
Plugin for gitbook for adding external css and js files to the git book.
|
3
|
+
|
4
|
+
## How to use
|
5
|
+
- Add addcssjs plugin to your book.json:
|
6
|
+
|
7
|
+
|
8
|
+
"plugins": [
|
9
|
+
"addcssjs"
|
10
|
+
]
|
11
|
+
- Add plugin configuration specifying css and js files to include:
|
12
|
+
|
13
|
+
|
14
|
+
"pluginsConfig": {
|
15
|
+
"addcssjs": {
|
16
|
+
"js": ["js/custom.js"],
|
17
|
+
"css": ["css/custom.css"]
|
18
|
+
}
|
19
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module.exports = {
|
2
|
+
book: {
|
3
|
+
assets: ".",
|
4
|
+
html: {
|
5
|
+
"head:end": function(current) {
|
6
|
+
var BASE_PATH, config, jsArray, cssArray, elements, i;
|
7
|
+
|
8
|
+
BASE_PATH = current.basePath === "." ? "" : current.basePath + "/";
|
9
|
+
|
10
|
+
config = this.options.pluginsConfig.addcssjs || {js: [], css: []};
|
11
|
+
jsArray = config.js || [];
|
12
|
+
cssArray = config.css || [];
|
13
|
+
elements = "";
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Creates a full path for the given file name
|
17
|
+
*
|
18
|
+
* @param {String} fileName
|
19
|
+
* @returns {string}
|
20
|
+
*/
|
21
|
+
var createPath = function (fileName) {
|
22
|
+
return BASE_PATH + fileName.replace("../", "");
|
23
|
+
};
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Generates a script element for the given file name
|
27
|
+
*
|
28
|
+
* @param {String} fileName
|
29
|
+
* @returns {string}
|
30
|
+
*/
|
31
|
+
var generateScriptElement = function (fileName) {
|
32
|
+
return "<script type=\"text/javascript\" src=\"" + createPath(fileName) + "\"></script>"
|
33
|
+
};
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Generates a link element for the given file name
|
37
|
+
*
|
38
|
+
* @param {String} fileName
|
39
|
+
* @returns {string}
|
40
|
+
*/
|
41
|
+
var generateLinkElement = function (fileName) {
|
42
|
+
return "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + createPath(fileName) + "\">";
|
43
|
+
};
|
44
|
+
|
45
|
+
for (i = 0; i < jsArray.length; i++) {
|
46
|
+
elements += generateScriptElement(jsArray[i]);
|
47
|
+
}
|
48
|
+
|
49
|
+
for (i = 0; i < cssArray.length; i++) {
|
50
|
+
elements += generateLinkElement(cssArray[i]);
|
51
|
+
}
|
52
|
+
|
53
|
+
return elements;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
};
|
@@ -0,0 +1,47 @@
|
|
1
|
+
{
|
2
|
+
"name": "gitbook-plugin-addcssjs",
|
3
|
+
"version": "1.0.1",
|
4
|
+
"description": "Adds external CSS and JS files to the gitbook",
|
5
|
+
"keywords": [
|
6
|
+
"CSS",
|
7
|
+
"JS",
|
8
|
+
"gitbook"
|
9
|
+
],
|
10
|
+
"author": {
|
11
|
+
"name": "Olga Filipova",
|
12
|
+
"email": "chudaol@gmail.com"
|
13
|
+
},
|
14
|
+
"repository": {
|
15
|
+
"type": "git",
|
16
|
+
"url": "https://github.com/chudaol/gitbook-plugin-addcssjs"
|
17
|
+
},
|
18
|
+
"engines": {
|
19
|
+
"gitbook": ">1.x.x"
|
20
|
+
},
|
21
|
+
"license": "MIT",
|
22
|
+
"gitHead": "ca6b9326af68ed3092ecaa8c7d2f7b9597da89d4",
|
23
|
+
"bugs": {
|
24
|
+
"url": "https://github.com/chudaol/gitbook-plugin-addcssjs/issues"
|
25
|
+
},
|
26
|
+
"_id": "gitbook-plugin-addcssjs@1.0.1",
|
27
|
+
"scripts": {},
|
28
|
+
"_shasum": "a0dd4a5c969ac52e3e1663d656f172a4fa70490f",
|
29
|
+
"_from": "gitbook-plugin-addcssjs@1.0.1",
|
30
|
+
"_npmVersion": "1.4.21",
|
31
|
+
"_npmUser": {
|
32
|
+
"name": "chudaol",
|
33
|
+
"email": "chudaol@gmail.com"
|
34
|
+
},
|
35
|
+
"maintainers": [
|
36
|
+
{
|
37
|
+
"name": "chudaol",
|
38
|
+
"email": "chudaol@gmail.com"
|
39
|
+
}
|
40
|
+
],
|
41
|
+
"dist": {
|
42
|
+
"shasum": "a0dd4a5c969ac52e3e1663d656f172a4fa70490f",
|
43
|
+
"tarball": "http://registry.npmjs.org/gitbook-plugin-addcssjs/-/gitbook-plugin-addcssjs-1.0.1.tgz"
|
44
|
+
},
|
45
|
+
"directories": {},
|
46
|
+
"_resolved": "https://registry.npmjs.org/gitbook-plugin-addcssjs/-/gitbook-plugin-addcssjs-1.0.1.tgz"
|
47
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
a.plugin-anchor {
|
3
|
+
color: inherit !important;
|
4
|
+
display: none;
|
5
|
+
margin-left: -30px;
|
6
|
+
padding-left: 40px;
|
7
|
+
cursor: pointer;
|
8
|
+
position: absolute;
|
9
|
+
top: 0;
|
10
|
+
left: 0;
|
11
|
+
bottom: 0;
|
12
|
+
}
|
13
|
+
|
14
|
+
a.plugin-anchor span {
|
15
|
+
margin-left: -25px;
|
16
|
+
font-size: 15px;
|
17
|
+
}
|
18
|
+
|
19
|
+
h1, h2, h3, h4, h5, h6 {
|
20
|
+
position: relative;
|
21
|
+
}
|
22
|
+
|
23
|
+
h1:hover a.plugin-anchor, h2:hover a.plugin-anchor, h3:hover a.plugin-anchor,
|
24
|
+
h4:hover a.plugin-anchor, h5:hover a.plugin-anchor, h6:hover a.plugin-anchor {
|
25
|
+
display: inline-block;
|
26
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require(['gitbook', 'jQuery'], function (gitbook, $) {
|
2
|
+
|
3
|
+
if (!window.history.pushState || !window.sessionStorage) return;
|
4
|
+
|
5
|
+
var KEY_SCROLL_POSITION = 'book_summary_scroll_postion_saver';
|
6
|
+
var $summary;
|
7
|
+
|
8
|
+
bindChangePushState(function() {
|
9
|
+
window.sessionStorage.setItem(KEY_SCROLL_POSITION, $summary.scrollTop())
|
10
|
+
});
|
11
|
+
|
12
|
+
gitbook.events.bind('page.change', function () {
|
13
|
+
var savedScrollPosition
|
14
|
+
= Number(window.sessionStorage.getItem(KEY_SCROLL_POSITION), 10) || 0;
|
15
|
+
|
16
|
+
$summary = $('.book-summary .summary');
|
17
|
+
|
18
|
+
window.setTimeout(function() {
|
19
|
+
$summary.scrollTop(savedScrollPosition);
|
20
|
+
}, 50);
|
21
|
+
});
|
22
|
+
|
23
|
+
function bindChangePushState(cb) {
|
24
|
+
var pushState = window.history.pushState;
|
25
|
+
window.history.pushState = function (state) {
|
26
|
+
cb();
|
27
|
+
return pushState.apply(window.history, arguments);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
});
|
@@ -0,0 +1,28 @@
|
|
1
|
+
.book .book-summary .chapter > .articles {
|
2
|
+
overflow: hidden;
|
3
|
+
max-height: 0px;
|
4
|
+
}
|
5
|
+
|
6
|
+
.book .book-summary .chapter.expanded > .articles {
|
7
|
+
max-height: 9999px;
|
8
|
+
}
|
9
|
+
|
10
|
+
.book .book-summary .exc-trigger {
|
11
|
+
position: absolute;
|
12
|
+
left: 12px;
|
13
|
+
top: 12px;
|
14
|
+
}
|
15
|
+
|
16
|
+
.book .book-summary ul.summary li a,
|
17
|
+
.book .book-summary ul.summary li span {
|
18
|
+
padding-left: 30px;
|
19
|
+
}
|
20
|
+
|
21
|
+
.book .book-summary .exc-trigger:before {
|
22
|
+
content: "\f054";
|
23
|
+
}
|
24
|
+
|
25
|
+
.book .book-summary .expanded > a .exc-trigger:before,
|
26
|
+
.book .book-summary .expanded > span .exc-trigger:before {
|
27
|
+
content: "\f078";
|
28
|
+
}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require(['gitbook', 'jQuery'], function(gitbook, $) {
|
2
|
+
var TOGGLE_CLASSNAME = 'expanded',
|
3
|
+
CHAPTER = '.chapter',
|
4
|
+
ARTICLES = '.articles',
|
5
|
+
TRIGGER_TEMPLATE = '<i class="exc-trigger fa"></i>',
|
6
|
+
LS_NAMESPACE = 'expChapters';
|
7
|
+
var init = function () {
|
8
|
+
// adding the trigger element to each ARTICLES parent and binding the event
|
9
|
+
$(ARTICLES)
|
10
|
+
.parent(CHAPTER)
|
11
|
+
.children('a')
|
12
|
+
.append(
|
13
|
+
$(TRIGGER_TEMPLATE)
|
14
|
+
.on('click', function(e) {
|
15
|
+
e.preventDefault();
|
16
|
+
e.stopPropagation();
|
17
|
+
toggle($(e.target).closest(CHAPTER));
|
18
|
+
})
|
19
|
+
);
|
20
|
+
expand(lsItem());
|
21
|
+
//expand current selected chapter with it's parents
|
22
|
+
var activeChapter = $(CHAPTER + '.active');
|
23
|
+
expand(activeChapter);
|
24
|
+
expand(activeChapter.parents(CHAPTER));
|
25
|
+
|
26
|
+
|
27
|
+
}
|
28
|
+
var toggle = function ($chapter) {
|
29
|
+
if ($chapter.hasClass('expanded')) {
|
30
|
+
collapse($chapter);
|
31
|
+
} else {
|
32
|
+
expand($chapter);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
var collapse = function ($chapter) {
|
36
|
+
if ($chapter.length && $chapter.hasClass(TOGGLE_CLASSNAME)) {
|
37
|
+
$chapter.removeClass(TOGGLE_CLASSNAME);
|
38
|
+
lsItem($chapter);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
var expand = function ($chapter) {
|
42
|
+
if ($chapter.length && !$chapter.hasClass(TOGGLE_CLASSNAME)) {
|
43
|
+
$chapter.addClass(TOGGLE_CLASSNAME);
|
44
|
+
lsItem($chapter);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
var lsItem = function () {
|
48
|
+
var map = JSON.parse(localStorage.getItem(LS_NAMESPACE)) || {}
|
49
|
+
if (arguments.length) {
|
50
|
+
var $chapters = arguments[0];
|
51
|
+
$chapters.each(function (index, element) {
|
52
|
+
var level = $(this).data('level');
|
53
|
+
var value = $(this).hasClass(TOGGLE_CLASSNAME);
|
54
|
+
map[level] = value;
|
55
|
+
})
|
56
|
+
localStorage.setItem(LS_NAMESPACE, JSON.stringify(map));
|
57
|
+
} else {
|
58
|
+
return $(CHAPTER).map(function(index, element){
|
59
|
+
if (map[$(this).data('level')]) {
|
60
|
+
return this;
|
61
|
+
}
|
62
|
+
})
|
63
|
+
}
|
64
|
+
}
|
65
|
+
gitbook.events.bind('page.change', function() {
|
66
|
+
init()
|
67
|
+
});
|
68
|
+
});
|
@@ -0,0 +1,151 @@
|
|
1
|
+
require(["gitbook", "lodash", "jQuery"], function(gitbook, _, $) {
|
2
|
+
var fontState;
|
3
|
+
|
4
|
+
var THEMES = {
|
5
|
+
"white": 0,
|
6
|
+
"sepia": 1,
|
7
|
+
"night": 2
|
8
|
+
};
|
9
|
+
|
10
|
+
var FAMILY = {
|
11
|
+
"serif": 0,
|
12
|
+
"sans": 1
|
13
|
+
};
|
14
|
+
|
15
|
+
// Save current font settings
|
16
|
+
function saveFontSettings() {
|
17
|
+
gitbook.storage.set("fontState", fontState);
|
18
|
+
update();
|
19
|
+
}
|
20
|
+
|
21
|
+
// Increase font size
|
22
|
+
function enlargeFontSize(e) {
|
23
|
+
e.preventDefault();
|
24
|
+
if (fontState.size >= 4) return;
|
25
|
+
|
26
|
+
fontState.size++;
|
27
|
+
saveFontSettings();
|
28
|
+
};
|
29
|
+
|
30
|
+
// Decrease font size
|
31
|
+
function reduceFontSize(e) {
|
32
|
+
e.preventDefault();
|
33
|
+
if (fontState.size <= 0) return;
|
34
|
+
|
35
|
+
fontState.size--;
|
36
|
+
saveFontSettings();
|
37
|
+
};
|
38
|
+
|
39
|
+
// Change font family
|
40
|
+
function changeFontFamily(index, e) {
|
41
|
+
e.preventDefault();
|
42
|
+
|
43
|
+
fontState.family = index;
|
44
|
+
saveFontSettings();
|
45
|
+
};
|
46
|
+
|
47
|
+
// Change type of color
|
48
|
+
function changeColorTheme(index, e) {
|
49
|
+
e.preventDefault();
|
50
|
+
|
51
|
+
var $book = $(".book");
|
52
|
+
|
53
|
+
if (fontState.theme !== 0)
|
54
|
+
$book.removeClass("color-theme-"+fontState.theme);
|
55
|
+
|
56
|
+
fontState.theme = index;
|
57
|
+
if (fontState.theme !== 0)
|
58
|
+
$book.addClass("color-theme-"+fontState.theme);
|
59
|
+
|
60
|
+
saveFontSettings();
|
61
|
+
};
|
62
|
+
|
63
|
+
function update() {
|
64
|
+
var $book = gitbook.state.$book;
|
65
|
+
|
66
|
+
$(".font-settings .font-family-list li").removeClass("active");
|
67
|
+
$(".font-settings .font-family-list li:nth-child("+(fontState.family+1)+")").addClass("active");
|
68
|
+
|
69
|
+
$book[0].className = $book[0].className.replace(/\bfont-\S+/g, '');
|
70
|
+
$book.addClass("font-size-"+fontState.size);
|
71
|
+
$book.addClass("font-family-"+fontState.family);
|
72
|
+
|
73
|
+
if(fontState.theme !== 0) {
|
74
|
+
$book[0].className = $book[0].className.replace(/\bcolor-theme-\S+/g, '');
|
75
|
+
$book.addClass("color-theme-"+fontState.theme);
|
76
|
+
}
|
77
|
+
};
|
78
|
+
|
79
|
+
function init(config) {
|
80
|
+
var $bookBody, $book;
|
81
|
+
|
82
|
+
//Find DOM elements.
|
83
|
+
$book = gitbook.state.$book;
|
84
|
+
$bookBody = $book.find(".book-body");
|
85
|
+
|
86
|
+
// Instantiate font state object
|
87
|
+
fontState = gitbook.storage.get("fontState", {
|
88
|
+
size: config.size || 2,
|
89
|
+
family: FAMILY[config.family || "sans"],
|
90
|
+
theme: THEMES[config.theme || "white"]
|
91
|
+
});
|
92
|
+
|
93
|
+
update();
|
94
|
+
};
|
95
|
+
|
96
|
+
|
97
|
+
gitbook.events.bind("start", function(e, config) {
|
98
|
+
var opts = config.fontsettings;
|
99
|
+
|
100
|
+
// Create buttons in toolbar
|
101
|
+
gitbook.toolbar.createButton({
|
102
|
+
icon: 'fa fa-font',
|
103
|
+
label: 'Font Settings',
|
104
|
+
className: 'font-settings',
|
105
|
+
dropdown: [
|
106
|
+
[
|
107
|
+
{
|
108
|
+
text: 'A',
|
109
|
+
className: 'font-reduce',
|
110
|
+
onClick: reduceFontSize
|
111
|
+
},
|
112
|
+
{
|
113
|
+
text: 'A',
|
114
|
+
className: 'font-enlarge',
|
115
|
+
onClick: enlargeFontSize
|
116
|
+
}
|
117
|
+
],
|
118
|
+
[
|
119
|
+
{
|
120
|
+
text: 'Serif',
|
121
|
+
onClick: _.partial(changeFontFamily, 0)
|
122
|
+
},
|
123
|
+
{
|
124
|
+
text: 'Sans',
|
125
|
+
onClick: _.partial(changeFontFamily, 1)
|
126
|
+
}
|
127
|
+
],
|
128
|
+
[
|
129
|
+
{
|
130
|
+
text: 'White',
|
131
|
+
onClick: _.partial(changeColorTheme, 0)
|
132
|
+
},
|
133
|
+
{
|
134
|
+
text: 'Sepia',
|
135
|
+
onClick: _.partial(changeColorTheme, 1)
|
136
|
+
},
|
137
|
+
{
|
138
|
+
text: 'Night',
|
139
|
+
onClick: _.partial(changeColorTheme, 2)
|
140
|
+
}
|
141
|
+
]
|
142
|
+
]
|
143
|
+
});
|
144
|
+
|
145
|
+
|
146
|
+
// Init current settings
|
147
|
+
init(opts);
|
148
|
+
});
|
149
|
+
});
|
150
|
+
|
151
|
+
|
@@ -0,0 +1,291 @@
|
|
1
|
+
/*
|
2
|
+
* Theme 1
|
3
|
+
*/
|
4
|
+
.color-theme-1 .dropdown-menu {
|
5
|
+
background-color: #111111;
|
6
|
+
border-color: #7e888b;
|
7
|
+
}
|
8
|
+
.color-theme-1 .dropdown-menu .dropdown-caret .caret-inner {
|
9
|
+
border-bottom: 9px solid #111111;
|
10
|
+
}
|
11
|
+
.color-theme-1 .dropdown-menu .buttons {
|
12
|
+
border-color: #7e888b;
|
13
|
+
}
|
14
|
+
.color-theme-1 .dropdown-menu .button {
|
15
|
+
color: #afa790;
|
16
|
+
}
|
17
|
+
.color-theme-1 .dropdown-menu .button:hover {
|
18
|
+
color: #73553c;
|
19
|
+
}
|
20
|
+
/*
|
21
|
+
* Theme 2
|
22
|
+
*/
|
23
|
+
.color-theme-2 .dropdown-menu {
|
24
|
+
background-color: #2d3143;
|
25
|
+
border-color: #272a3a;
|
26
|
+
}
|
27
|
+
.color-theme-2 .dropdown-menu .dropdown-caret .caret-inner {
|
28
|
+
border-bottom: 9px solid #2d3143;
|
29
|
+
}
|
30
|
+
.color-theme-2 .dropdown-menu .buttons {
|
31
|
+
border-color: #272a3a;
|
32
|
+
}
|
33
|
+
.color-theme-2 .dropdown-menu .button {
|
34
|
+
color: #62677f;
|
35
|
+
}
|
36
|
+
.color-theme-2 .dropdown-menu .button:hover {
|
37
|
+
color: #f4f4f5;
|
38
|
+
}
|
39
|
+
.book .book-header .font-settings .font-enlarge {
|
40
|
+
line-height: 30px;
|
41
|
+
font-size: 1.4em;
|
42
|
+
}
|
43
|
+
.book .book-header .font-settings .font-reduce {
|
44
|
+
line-height: 30px;
|
45
|
+
font-size: 1em;
|
46
|
+
}
|
47
|
+
.book.color-theme-1 .book-body {
|
48
|
+
color: #704214;
|
49
|
+
background: #f3eacb;
|
50
|
+
}
|
51
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section {
|
52
|
+
background: #f3eacb;
|
53
|
+
}
|
54
|
+
.book.color-theme-2 .book-body {
|
55
|
+
color: #bdcadb;
|
56
|
+
background: #1c1f2b;
|
57
|
+
}
|
58
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section {
|
59
|
+
background: #1c1f2b;
|
60
|
+
}
|
61
|
+
.book.font-size-0 .book-body .page-inner section {
|
62
|
+
font-size: 1.2rem;
|
63
|
+
}
|
64
|
+
.book.font-size-1 .book-body .page-inner section {
|
65
|
+
font-size: 1.4rem;
|
66
|
+
}
|
67
|
+
.book.font-size-2 .book-body .page-inner section {
|
68
|
+
font-size: 1.6rem;
|
69
|
+
}
|
70
|
+
.book.font-size-3 .book-body .page-inner section {
|
71
|
+
font-size: 2.2rem;
|
72
|
+
}
|
73
|
+
.book.font-size-4 .book-body .page-inner section {
|
74
|
+
font-size: 4rem;
|
75
|
+
}
|
76
|
+
.book.font-family-0 {
|
77
|
+
font-family: Georgia, serif;
|
78
|
+
}
|
79
|
+
.book.font-family-1 {
|
80
|
+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
81
|
+
}
|
82
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal {
|
83
|
+
color: #704214;
|
84
|
+
}
|
85
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal a {
|
86
|
+
color: inherit;
|
87
|
+
}
|
88
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1,
|
89
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2,
|
90
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h3,
|
91
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h4,
|
92
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h5,
|
93
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 {
|
94
|
+
color: inherit;
|
95
|
+
}
|
96
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1,
|
97
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2 {
|
98
|
+
border-color: inherit;
|
99
|
+
}
|
100
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 {
|
101
|
+
color: inherit;
|
102
|
+
}
|
103
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal hr {
|
104
|
+
background-color: inherit;
|
105
|
+
}
|
106
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal blockquote {
|
107
|
+
border-color: inherit;
|
108
|
+
}
|
109
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre,
|
110
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code {
|
111
|
+
background: #fdf6e3;
|
112
|
+
color: #657b83;
|
113
|
+
border-color: #f8df9c;
|
114
|
+
}
|
115
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal .highlight {
|
116
|
+
background-color: inherit;
|
117
|
+
}
|
118
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table th,
|
119
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table td {
|
120
|
+
border-color: #f5d06c;
|
121
|
+
}
|
122
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr {
|
123
|
+
color: inherit;
|
124
|
+
background-color: #fdf6e3;
|
125
|
+
border-color: #444444;
|
126
|
+
}
|
127
|
+
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) {
|
128
|
+
background-color: #fbeecb;
|
129
|
+
}
|
130
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal {
|
131
|
+
color: #bdcadb;
|
132
|
+
}
|
133
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal a {
|
134
|
+
color: #3eb1d0;
|
135
|
+
}
|
136
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1,
|
137
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2,
|
138
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h3,
|
139
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h4,
|
140
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h5,
|
141
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 {
|
142
|
+
color: #fffffa;
|
143
|
+
}
|
144
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1,
|
145
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2 {
|
146
|
+
border-color: #373b4e;
|
147
|
+
}
|
148
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 {
|
149
|
+
color: #373b4e;
|
150
|
+
}
|
151
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal hr {
|
152
|
+
background-color: #373b4e;
|
153
|
+
}
|
154
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal blockquote {
|
155
|
+
border-color: #373b4e;
|
156
|
+
}
|
157
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre,
|
158
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code {
|
159
|
+
color: #9dbed8;
|
160
|
+
background: #2d3143;
|
161
|
+
border-color: #2d3143;
|
162
|
+
}
|
163
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal .highlight {
|
164
|
+
background-color: #282a39;
|
165
|
+
}
|
166
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table th,
|
167
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table td {
|
168
|
+
border-color: #3b3f54;
|
169
|
+
}
|
170
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr {
|
171
|
+
color: #b6c2d2;
|
172
|
+
background-color: #2d3143;
|
173
|
+
border-color: #3b3f54;
|
174
|
+
}
|
175
|
+
.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) {
|
176
|
+
background-color: #35394b;
|
177
|
+
}
|
178
|
+
.book.color-theme-1 .book-header {
|
179
|
+
color: #afa790;
|
180
|
+
background: transparent;
|
181
|
+
}
|
182
|
+
.book.color-theme-1 .book-header .btn {
|
183
|
+
color: #afa790;
|
184
|
+
}
|
185
|
+
.book.color-theme-1 .book-header .btn:hover {
|
186
|
+
color: #73553c;
|
187
|
+
background: none;
|
188
|
+
}
|
189
|
+
.book.color-theme-1 .book-header h1 {
|
190
|
+
color: #704214;
|
191
|
+
}
|
192
|
+
.book.color-theme-2 .book-header {
|
193
|
+
color: #7e888b;
|
194
|
+
background: transparent;
|
195
|
+
}
|
196
|
+
.book.color-theme-2 .book-header .btn {
|
197
|
+
color: #3b3f54;
|
198
|
+
}
|
199
|
+
.book.color-theme-2 .book-header .btn:hover {
|
200
|
+
color: #fffff5;
|
201
|
+
background: none;
|
202
|
+
}
|
203
|
+
.book.color-theme-2 .book-header h1 {
|
204
|
+
color: #bdcadb;
|
205
|
+
}
|
206
|
+
.book.color-theme-1 .book-body .navigation {
|
207
|
+
color: #afa790;
|
208
|
+
}
|
209
|
+
.book.color-theme-1 .book-body .navigation:hover {
|
210
|
+
color: #73553c;
|
211
|
+
}
|
212
|
+
.book.color-theme-2 .book-body .navigation {
|
213
|
+
color: #383f52;
|
214
|
+
}
|
215
|
+
.book.color-theme-2 .book-body .navigation:hover {
|
216
|
+
color: #fffff5;
|
217
|
+
}
|
218
|
+
/*
|
219
|
+
* Theme 1
|
220
|
+
*/
|
221
|
+
.book.color-theme-1 .book-summary {
|
222
|
+
color: #afa790;
|
223
|
+
background: #111111;
|
224
|
+
border-right: 1px solid rgba(0, 0, 0, 0.07);
|
225
|
+
}
|
226
|
+
.book.color-theme-1 .book-summary .book-search {
|
227
|
+
background: transparent;
|
228
|
+
}
|
229
|
+
.book.color-theme-1 .book-summary .book-search input,
|
230
|
+
.book.color-theme-1 .book-summary .book-search input:focus {
|
231
|
+
border: 1px solid transparent;
|
232
|
+
}
|
233
|
+
.book.color-theme-1 .book-summary ul.summary li.divider {
|
234
|
+
background: #7e888b;
|
235
|
+
box-shadow: none;
|
236
|
+
}
|
237
|
+
.book.color-theme-1 .book-summary ul.summary li i.fa-check {
|
238
|
+
color: #33cc33;
|
239
|
+
}
|
240
|
+
.book.color-theme-1 .book-summary ul.summary li.done > a {
|
241
|
+
color: #877f6a;
|
242
|
+
}
|
243
|
+
.book.color-theme-1 .book-summary ul.summary li a,
|
244
|
+
.book.color-theme-1 .book-summary ul.summary li span {
|
245
|
+
color: #877f6a;
|
246
|
+
background: transparent;
|
247
|
+
font-weight: normal;
|
248
|
+
}
|
249
|
+
.book.color-theme-1 .book-summary ul.summary li.active > a,
|
250
|
+
.book.color-theme-1 .book-summary ul.summary li a:hover {
|
251
|
+
color: #704214;
|
252
|
+
background: transparent;
|
253
|
+
font-weight: normal;
|
254
|
+
}
|
255
|
+
/*
|
256
|
+
* Theme 2
|
257
|
+
*/
|
258
|
+
.book.color-theme-2 .book-summary {
|
259
|
+
color: #bcc1d2;
|
260
|
+
background: #2d3143;
|
261
|
+
border-right: none;
|
262
|
+
}
|
263
|
+
.book.color-theme-2 .book-summary .book-search {
|
264
|
+
background: transparent;
|
265
|
+
}
|
266
|
+
.book.color-theme-2 .book-summary .book-search input,
|
267
|
+
.book.color-theme-2 .book-summary .book-search input:focus {
|
268
|
+
border: 1px solid transparent;
|
269
|
+
}
|
270
|
+
.book.color-theme-2 .book-summary ul.summary li.divider {
|
271
|
+
background: #272a3a;
|
272
|
+
box-shadow: none;
|
273
|
+
}
|
274
|
+
.book.color-theme-2 .book-summary ul.summary li i.fa-check {
|
275
|
+
color: #33cc33;
|
276
|
+
}
|
277
|
+
.book.color-theme-2 .book-summary ul.summary li.done > a {
|
278
|
+
color: #62687f;
|
279
|
+
}
|
280
|
+
.book.color-theme-2 .book-summary ul.summary li a,
|
281
|
+
.book.color-theme-2 .book-summary ul.summary li span {
|
282
|
+
color: #c1c6d7;
|
283
|
+
background: transparent;
|
284
|
+
font-weight: 600;
|
285
|
+
}
|
286
|
+
.book.color-theme-2 .book-summary ul.summary li.active > a,
|
287
|
+
.book.color-theme-2 .book-summary ul.summary li a:hover {
|
288
|
+
color: #f4f4f5;
|
289
|
+
background: #252737;
|
290
|
+
font-weight: 600;
|
291
|
+
}
|