add footer and sidebar star
parent
ce5ca1e26c
commit
66983db872
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
|
@ -0,0 +1,91 @@
|
||||||
|
// LICENSE : MIT
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
|
||||||
|
|
||||||
|
require(['gitbook'], function (gitbook) {
|
||||||
|
function addBeforeHeader(element) {
|
||||||
|
jQuery('.book-header > h1').before(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
function createButton(_ref) {
|
||||||
|
var user = _ref.user;
|
||||||
|
var repo = _ref.repo;
|
||||||
|
var type = _ref.type;
|
||||||
|
var size = _ref.size;
|
||||||
|
var width = _ref.width;
|
||||||
|
var height = _ref.height;
|
||||||
|
var count = _ref.count;
|
||||||
|
|
||||||
|
var extraParam = type === "watch" ? "&v=2" : "";
|
||||||
|
return '<a class="btn pull-right hidden-mobile" aria-label="github">\n <iframe style="display:inline-block;vertical-align:middle;" src="https://ghbtns.com/github-btn.html?user=' + user + '&repo=' + repo + '&type=' + type + '&count=' + count + '&size=' + size + extraParam + '" frameborder="0" scrolling="0" width="' + width + 'px" height="' + height + 'px"></iframe>\n </a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function insertGitHubLink(_ref2) {
|
||||||
|
var user = _ref2.user;
|
||||||
|
var repo = _ref2.repo;
|
||||||
|
var types = _ref2.types;
|
||||||
|
var size = _ref2.size;
|
||||||
|
var width = _ref2.width;
|
||||||
|
var height = _ref2.height;
|
||||||
|
var count = _ref2.count;
|
||||||
|
|
||||||
|
types.reverse().forEach(function (type) {
|
||||||
|
var elementString = createButton({
|
||||||
|
user: user,
|
||||||
|
repo: repo,
|
||||||
|
type: type,
|
||||||
|
size: size,
|
||||||
|
width: width,
|
||||||
|
height: height,
|
||||||
|
count: count
|
||||||
|
});
|
||||||
|
addBeforeHeader(elementString);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function init(config) {
|
||||||
|
var repoPath = config.repo;
|
||||||
|
|
||||||
|
var _repoPath$split = repoPath.split("/");
|
||||||
|
|
||||||
|
var _repoPath$split2 = _slicedToArray(_repoPath$split, 2);
|
||||||
|
|
||||||
|
var user = _repoPath$split2[0];
|
||||||
|
var repo = _repoPath$split2[1];
|
||||||
|
|
||||||
|
if (repoPath == null) {
|
||||||
|
console.log("Should set github.repo");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var types = config.types || ["star", "watch"];
|
||||||
|
var size = config.size || "large";
|
||||||
|
var width = config.width || (size === "large" ? "150" : "100");
|
||||||
|
var height = config.height || (size === "large" ? "30" : "20");
|
||||||
|
var count = typeof config.count === "undefined" ? "true" : "false";
|
||||||
|
insertGitHubLink({
|
||||||
|
user: user,
|
||||||
|
repo: repo,
|
||||||
|
types: types,
|
||||||
|
size: size,
|
||||||
|
width: width,
|
||||||
|
height: height,
|
||||||
|
count: count
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// injected by html hook
|
||||||
|
function getPluginConfig() {
|
||||||
|
return window["gitbook-plugin-github-buttons"];
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure configuration gets injected
|
||||||
|
gitbook.events.bind('start', function (e, config) {
|
||||||
|
window["gitbook-plugin-github-buttons"] = config["github-buttons"];
|
||||||
|
});
|
||||||
|
|
||||||
|
gitbook.events.bind('page.change', function () {
|
||||||
|
init(getPluginConfig());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=plugin.js.map
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"sources":["../src/plugin.js"],"names":[],"mappings":";AACA,YAAY,CAAC;;;;AACb,OAAO,CAAC,CAAC,SAAS,CAAC,EAAE,UAAU,OAAO,EAAE;AACpC,aAAS,eAAe,CAAC,OAAO,EAAE;AAC9B,cAAM,CAAC,mBAAmB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;KAC9C;;AAED,aAAS,YAAY,CAAC,IAQjB,EAAE;YAPH,IAAI,GADc,IAQjB,CAPD,IAAI;YACJ,IAAI,GAFc,IAQjB,CAND,IAAI;YACJ,IAAI,GAHc,IAQjB,CALD,IAAI;YACJ,IAAI,GAJc,IAQjB,CAJD,IAAI;YACJ,KAAK,GALa,IAQjB,CAHD,KAAK;YACL,MAAM,GANY,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M,EAAE,OAAO,CAAC,CAAC;AAC9C,YAAI,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,OAAO,CAAC;AAClC,YAAI,KAAK,GAAG,MAAM,CAAC,KAAK,KAAK,IAAI,KAAK,OAAO,GAAG,KAAK,GAAG,KAAK,CAAA,AAAC,CAAC;AAC/D,YAAI,MAAM,GAAG,MAAM,CAAC,MAAM,KAAK,IAAI,KAAK,OAAO,GAAG,IAAI,GAAG,IAAI,CAAA,AAAC,CAAC;AAC/D,YAAI,KAAK,GAAG,OAAO,MAAM,CAAC,KAAK,KAAK,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC;AACnE,wBAAgB,CAAC;AACb,gBAAI,EAAJ,IAAI;AACJ,gBAAI,EAAJ,IAAI;AACJ,iBAAK,EAAL,KAAK;AACL,gBAAI,EAAJ,IAAI;AACJ,iBAAK,EAAL,KAAK;AACL,kBAAM,EAAN,MAAM;AACN,iBAAK,EAAL,KAAK;SACR,CAAC,CAAC;KACN;;;AAGD,aAAS,eAAe,GAAG;AACvB,eAAO,MAAM,CAAC,+BAA+B,CAAC,CAAC;KAClD;;;AAGD,WAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE;AAC9C,cAAM,CAAC,+BAA+B,CAAC,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;KACtE,CAAC,CAAC;;AAEH,WAAO,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,YAAY;AAC3C,YAAI,CAAC,eAAe,EAAE,CAAC,CAAC;KAC3B,CAAC,CAAC;CACN,CAAC,CAAC","file":"plugin.js","sourcesContent":["// LICENSE : MIT\n\"use strict\";\nrequire(['gitbook'], function (gitbook) {\n function addBeforeHeader(element) {\n jQuery('.book-header > h1').before(element)\n }\n\n function createButton({\n user,\n repo,\n type,\n size,\n width,\n height,\n count\n }) {\n var extraParam = type === \"watch\" ? \"&v=2\" : \"\";\n return `<a class=\"btn pull-right hidden-mobile\" aria-label=\"github\">\n <iframe style=\"display:inline-block;vertical-align:middle;\" src=\"https://ghbtns.com/github-btn.html?user=${user}&repo=${repo}&type=${type}&count=${count}&size=${size}${extraParam}\" frameborder=\"0\" scrolling=\"0\" width=\"${width}px\" height=\"${height}px\"></iframe>\n </a>`;\n }\n\n\n function insertGitHubLink({\n user,\n repo,\n types,\n size,\n width,\n height,\n count\n }) {\n types.reverse().forEach(type => {\n var elementString = createButton({\n user,\n repo,\n type,\n size,\n width,\n height,\n count\n });\n addBeforeHeader(elementString);\n });\n }\n\n function init(config) {\n var repoPath = config.repo;\n var [user, repo] = repoPath.split(\"/\");\n if (repoPath == null) {\n console.log(\"Should set github.repo\");\n return;\n }\n var types = config.types || [\"star\", \"watch\"];\n var size = config.size || \"large\";\n var width = config.width || (size === \"large\" ? \"150\" : \"100\");\n var height = config.height || (size === \"large\" ? \"30\" : \"20\");\n var count = typeof config.count === \"undefined\" ? \"true\" : \"false\";\n insertGitHubLink({\n user,\n repo,\n types,\n size,\n width,\n height,\n count\n });\n }\n\n // injected by html hook\n function getPluginConfig() {\n return window[\"gitbook-plugin-github-buttons\"];\n }\n\n // make sure configuration gets injected\n gitbook.events.bind('start', function (e, config) {\n window[\"gitbook-plugin-github-buttons\"] = config[\"github-buttons\"];\n });\n\n gitbook.events.bind('page.change', function () {\n init(getPluginConfig());\n });\n});\n"]}
|
|
@ -0,0 +1,15 @@
|
||||||
|
.page-footer {
|
||||||
|
margin-top: 50px;
|
||||||
|
border-top: 1px solid #ccc;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 10px 0;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #808080;
|
||||||
|
}
|
||||||
|
.page-footer a {
|
||||||
|
color: #808080!important;
|
||||||
|
text-decoration: underline!important;
|
||||||
|
}
|
||||||
|
.footer-modification {
|
||||||
|
float: right;
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
49
index.html
49
index.html
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue