1// LICENSE : MIT 2"use strict"; 3require(['gitbook'], function (gitbook) { 4 function addBeforeHeader(element) { 5 jQuery('.book-header > h1').before(element); 6 } 7 8 function createButton(_ref) { 9 var user = _ref.user; 10 var repo = _ref.repo; 11 var type = _ref.type; 12 var size = _ref.size; 13 var width = _ref.width; 14 var height = _ref.height; 15 var count = _ref.count; 16 17 var extraParam = type === "watch" ? "&v=2" : ""; 18 return '<a class="btn pull-right hidden-mobile" aria-label="github">\n <iframe\n style="display:inline-block;vertical-align:middle;"\n src="https://ghbtns.com/github-btn.html?user=' + user + '&repo=' + repo + '&type=' + type + '&count=' + count + '&size=' + size + extraParam + '"\n frameborder="0"\n scrolling="0"\n width="' + width + 'px"\n height="' + height + 'px"\n ></iframe>\n </a>'; 19 } 20 21 function createUserButton(_ref2) { 22 var user = _ref2.user; 23 var size = _ref2.size; 24 var width = _ref2.width; 25 var height = _ref2.height; 26 var count = _ref2.count; 27 28 return '<a class="btn pull-right hidden-mobile" aria-label="github">\n <iframe\n style="display:inline-block;vertical-align:middle;"\n src="https://ghbtns.com/github-btn.html?user=' + user + '&type=follow&count=' + count + '&size=' + size + '"\n frameborder="0"\n scrolling="0"\n width="' + width + 'px"\n height="' + height + 'px"\n ></iframe>\n </a>'; 29 } 30 31 function insertGitHubLink(button) { 32 var user = button.user; 33 var repo = button.repo; 34 var type = button.type; 35 var size = button.size; 36 var width = button.width; 37 var height = button.height; 38 var count = button.count; 39 40 var size = size || "large"; 41 var width = width || (size === "large" ? "150" : "100"); 42 var height = height || (size === "large" ? "30" : "20"); 43 var count = typeof count === "boolean" ? count : false; 44 45 if (type === 'follow') { 46 var elementString = createUserButton({ 47 user: user, 48 size: size, 49 width: width, 50 height: height, 51 count: count 52 }); 53 } else { 54 var elementString = createButton({ 55 user: user, 56 repo: repo, 57 type: type, 58 size: size, 59 width: width, 60 height: height, 61 count: count 62 }); 63 } 64 addBeforeHeader(elementString); 65 } 66 67 function init(config) { 68 config.buttons.forEach(insertGitHubLink); 69 } 70 71 // injected by html hook 72 function getPluginConfig() { 73 return window["gitbook-plugin-github-buttons"]; 74 } 75 76 // make sure configuration gets injected 77 gitbook.events.bind('start', function (e, config) { 78 window["gitbook-plugin-github-buttons"] = config["github-buttons"]; 79 }); 80 81 gitbook.events.bind('page.change', function () { 82 init(getPluginConfig()); 83 }); 84}); 85//# sourceMappingURL=plugin.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.