http://git-wip-us.apache.org/repos/asf/incubator-hivemall-site/blob/30afb6e4/userguide/gitbook/gitbook-plugin-splitter/splitter.css ---------------------------------------------------------------------- diff --git a/userguide/gitbook/gitbook-plugin-splitter/splitter.css b/userguide/gitbook/gitbook-plugin-splitter/splitter.css new file mode 100644 index 0000000..4e84720 --- /dev/null +++ b/userguide/gitbook/gitbook-plugin-splitter/splitter.css @@ -0,0 +1,22 @@ +.divider-content-summary { + position: absolute; + top: 0; + right: 0; + height: 100%; + width: 5px; + display: table; + cursor: col-resize; + color: #ccc; + -webkit-transition: color 350ms ease; + -moz-transition: color 350ms ease; + -o-transition: color 350ms ease; + transition: color 350ms ease +} +.divider-content-summary:hover { + color: #444; +} + .divider-content-summary__icon { + display: table-cell; + vertical-align: middle; + text-align: center; + }
http://git-wip-us.apache.org/repos/asf/incubator-hivemall-site/blob/30afb6e4/userguide/gitbook/gitbook-plugin-splitter/splitter.js ---------------------------------------------------------------------- diff --git a/userguide/gitbook/gitbook-plugin-splitter/splitter.js b/userguide/gitbook/gitbook-plugin-splitter/splitter.js new file mode 100644 index 0000000..df95e6d --- /dev/null +++ b/userguide/gitbook/gitbook-plugin-splitter/splitter.js @@ -0,0 +1,122 @@ +/// <reference path="../typings/tsd.d.ts" /> + +require(['gitbook', 'jQuery'], function (gitbook, $) { + + gitbook.events.bind('start', function () { + }); + + gitbook.events.bind('page.change', function () { + + var KEY_SPLIT_STATE = 'plugin_gitbook_split'; + + var dividerWidth = null; + var isDraggable = false; + var dividerCenterOffsetLeft = null; + var splitState = null; + var grabPointWidth = null; + + var $body = $('body'); + var $book = $('.book'); + var $summary = $('.book-summary'); + var $bookBody = $('.book-body'); + var $divider = $('<div class="divider-content-summary">' + + '<div class="divider-content-summary__icon">' + + '<i class="fa fa-ellipsis-v"></i>' + + '</div>' + + '</div>'); + + $summary.append($divider); + + dividerWidth = $divider.outerWidth(); + dividerCenterOffsetLeft = $divider.outerWidth() / 2; + + // restore split state from localStrage + splitState = getSplitState(); + setSplitState( + splitState.summaryWidth, + splitState.summaryOffset, + splitState.bookBodyOffset + ); + + setTimeout(function() { + var isGreaterThanEqualGitbookV2_5 = !Boolean($('.toggle-summary').length); + + var $toggleSummary = isGreaterThanEqualGitbookV2_5 + ? $('.fa.fa-align-justify').parent() : $('.toggle-summary'); + + $toggleSummary.on('click', function () { + + var summaryOffset = null; + var bookBodyOffset = null; + + var isOpen = isGreaterThanEqualGitbookV2_5 + ? !gitbook.sidebar.isOpen() : $book.hasClass('with-summary'); + + if (isOpen) { + summaryOffset = -($summary.outerWidth()); + bookBodyOffset = 0; + } else { + summaryOffset = 0; + bookBodyOffset = $summary.outerWidth(); + } + + setSplitState($summary.outerWidth(), summaryOffset, bookBodyOffset); + saveSplitState($summary.outerWidth(), summaryOffset, bookBodyOffset); + }); + }, 1); + + $divider.on('mousedown', function (event) { + event.stopPropagation(); + isDraggable = true; + grabPointWidth = $summary.outerWidth() - event.pageX; + }); + + $body.on('mouseup', function (event) { + event.stopPropagation(); + isDraggable = false; + saveSplitState( + $summary.outerWidth(), + $summary.position().left, + $bookBody.position().left + ); + }); + + $body.on('mousemove', function (event) { + if (!isDraggable) { + return; + } + event.stopPropagation(); + event.preventDefault(); + $summary.outerWidth(event.pageX + grabPointWidth); + $bookBody.offset({ left: event.pageX + grabPointWidth }); + }); + + function getSplitState() { + var splitState = JSON.parse(localStorage.getItem(KEY_SPLIT_STATE)); + splitState || (splitState = {}); + splitState.summaryWidth || (splitState.summaryWidth = $summary.outerWidth()); + splitState.summaryOffset || (splitState.summaryOffset = $summary.position().left); + splitState.bookBodyOffset || (splitState.bookBodyOffset = $bookBody.position().left); + return splitState; + } + + function saveSplitState(summaryWidth, summaryWidthOffset, bookBodyOffset) { + localStorage.setItem(KEY_SPLIT_STATE, JSON.stringify({ + summaryWidth: summaryWidth, + summaryOffset: summaryWidthOffset, + bookBodyOffset: bookBodyOffset, + })); + } + + function setSplitState(summaryWidth, summaryOffset, bookBodyOffset) { + $summary.outerWidth(summaryWidth); + $summary.offset({ left: summaryOffset }); + $bookBody.offset({ left: bookBodyOffset }); + // improved broken layout in windows chrome. + // "$(x).offset" automatically add to "position:relative". + // but it cause layout broken.. + $summary.css({ position: 'absolute' }); + $bookBody.css({ position: 'absolute' }); + } + }); +}); http://git-wip-us.apache.org/repos/asf/incubator-hivemall-site/blob/30afb6e4/userguide/gitbook/gitbook-plugin-theme-api/theme-api.css ---------------------------------------------------------------------- diff --git a/userguide/gitbook/gitbook-plugin-theme-api/theme-api.css b/userguide/gitbook/gitbook-plugin-theme-api/theme-api.css new file mode 100644 index 0000000..51f8b35 --- /dev/null +++ b/userguide/gitbook/gitbook-plugin-theme-api/theme-api.css @@ -0,0 +1,6 @@ +/*! + * Preboot v2 + * + * Open sourced under MIT license by @mdo. + * Some variables and mixins from Bootstrap (Apache 2 license). + */.api-method{margin:30px -30px}.api-method:last-of-type{margin-bottom:0}.api-method .api-method-definition{padding:0 30px}.api-method .api-method-code{padding:30px 30px 15px;background-color:#FEFEFE;border-top:1px solid #F1EFEF;border-bottom:1px solid #F1EFEF}.api-method .api-method-code pre>code{white-space:pre-wrap;white-space:-moz- pre-wrap;white-space:- pre-wrap;white-space:-o- pre-wrap;word-wrap:break-word}.api-method:after{clear:both}.book.two-columns .api-method{position:relative;width:calc(100% + 60px)}.book.two-columns .api-method:after{content:" ";display:block;visibility:hidden;clear:both}.book.two-columns .api-method .api-method-title{margin-top:0}.book.two-columns .api-method .api-method-definition{float:left;width:50%}.book.two-columns .api-method .api-method-code{position:relative;float:left;width:50%;padding:30px 30px 15px;border-left:1px solid #F1EFEF;border-top:none;border-bottom:none;transition:opacity .3s ease}.book.two-columns .page-wrapper.comments-open-from- definition .api-method-code{opacity:.1}.book-header{padding:0;position:fixed;top:0;left:0;right:0;background-color:#FFF;border-bottom:1px solid rgba(0,0,0,.07);-webkit-transition:left 250ms ease;-moz-transition:left 250ms ease;-o-transition:left 250ms ease;transition:left 250ms ease}.book.with-summary .book-header{left:300px}@media (max-width:600px){.book.with-summary .book-header{left:0}}.book-header .btn.lang-switcher{text-transform:none;font-weight:500;border-radius:0}.book-header .btn.lang-switcher.active{background-color:#03677D;color:#FFF}#book-search-results .search-results{padding:20px 30px 0}#book-search-input{padding:5px;margin-top:0}.book .book-body .page-wrapper .page-inner .comments-section{max-width:calc(100% - 40px)}.book .book-body .page-wrapper .page-inner .comments-section .comments-area{z-index:1}.book .book-body .page-wrapper.comments-open-from-definition .page-inner{left:0!important}.color-theme-3 .dropdown-menu{background-color:#2D3134;border-color:#373B3E}.col or-theme-3 .dropdown-menu .dropdown-caret .caret-inner{border-bottom:9px solid #2D3134}.color-theme-3 .dropdown-menu .buttons{border-color:#373B3E}.color-theme-3 .dropdown-menu .button{color:#D0D4D7}.color-theme-3 .dropdown-menu .button:hover{color:#EEE}.book.color-theme-3 .book-header{color:#D0D4D7;background:#272B2D}.book.color-theme-3 .book-header .btn{color:#D0D4D7}.book.color-theme-3 .book-header .btn:hover{color:#EEE;background:0 0}.book.color-theme-3 .book-header .btn.lang-switcher.active{background-color:#186469}.book.color-theme-3 .book-header .btn.lang-switcher.active:hover{background-color:#186469}.book.color-theme-3 .book-header h1{color:#EEE}.book.color-theme-3 .book-body section a{color:#3EAAB1}.book.color-theme-3 .book-body section .api-method-code{color:#EEE;background-color:#272B2D}.book.color-theme-3 .book-body section .api-method-code h1,.book.color-theme-3 .book-body section .api-method-code h2,.book.color-theme-3 .book-body section .api-method-code h3,.book.colo r-theme-3 .book-body section .api-method-code h4,.book.color-theme-3 .book-body section .api-method-code h5,.book.color-theme-3 .book-body section .api-method-code h6{color:#fff}.book.color-theme-3 .book-body section .api-method-code h6{color:#D0D4D7}.book.color-theme-3 .book-body section .api-method-code hr{background-color:#373B3E}.book.color-theme-3 .book-body section .api-method-code blockquote{border-color:#373B3E}.book.color-theme-3 .book-body section .api-method-code code,.book.color-theme-3 .book-body section .api-method-code pre{color:#EEE;background-color:#2D3134;border-radius:3px}.book.color-theme-3 .book-body section .api-method-code table{border-collapse:separate;border:1px solid #373B3E;border-radius:3px}.book.color-theme-3 .book-body section .api-method-code table td,.book.color-theme-3 .book-body section .api-method-code table th{border:none}.book.color-theme-3 .book-body section .api-method-code table th{border-bottom:1px solid #373B3E}.book.color-theme-3 .book-body section .api-method-code table tr{color:#EEE;background-color:transparent}.book.color-theme-3 .book-body section .api-method-code table tr:nth-child(2n){background-color:#2D3134}.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs{display:block;overflow-x:auto;padding:.5em;background:#474949;color:#d1d9e1}.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-comment,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-quote,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-comment,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-quote{color:#969896;font-style:italic}.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-c ode code .hljs-addition,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-keyword,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-literal,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-selector-tag,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-type,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-addition,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-keyword,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-literal,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-selector-tag,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-type{c olor:#c9c}.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-number,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-selector-attr,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-selector-pseudo,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-number,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-selector-attr,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-selector-pseudo{color:#f99157}.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-doctag,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-regexp,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-string,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-doctag,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-regexp,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-string{color:#8abeb7}.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-built_in,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-name,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-section,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-title,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-built_in,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-name,.book. color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-section,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-title{color:#b5bd68}.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-class .hljs-title,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-selector-id,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-template-variable,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-variable,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-class .hljs-title,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-selector-id,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-template-variable,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-variable{color:#fc6}.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-name,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-section,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-strong,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-name,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-section,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-strong{font-weight:700}.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-bullet,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-link,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-meta,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-subst,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-symbol,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-bullet,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-link,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-meta,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-subst,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-symbol{color:#f99157}.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-deletion,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-deletion{color:#dc322f}.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-formula,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-formula{background:#eee8d5}.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-attr,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-attribute,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-attr,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-attribute{color:#81a2be}.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code code .hljs-emphasis,.book.color-theme-3 .book-body .page-wrapper .page-inner section.normal .api-method-code pre .hljs-emphasis{f ont-style:italic}.page-inner{max-width:100%;padding:0;margin-top:50px}.markdown-section{padding:20px 30px 0} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-hivemall-site/blob/30afb6e4/userguide/gitbook/gitbook-plugin-theme-api/theme-api.js ---------------------------------------------------------------------- diff --git a/userguide/gitbook/gitbook-plugin-theme-api/theme-api.js b/userguide/gitbook/gitbook-plugin-theme-api/theme-api.js new file mode 100644 index 0000000..07e6c21 --- /dev/null +++ b/userguide/gitbook/gitbook-plugin-theme-api/theme-api.js @@ -0,0 +1 @@ +require(["gitbook","jquery"],function(t,e){function n(e){r=t.storage.get("themeApi",{split:e.split,currentLang:null})}function a(){t.storage.set("themeApi",r),i()}function i(){e(".book").toggleClass("two-columns",r.split),s=e(".api-method-sample"),s.each(function(){var t=!(e(this).data("lang")==r.currentLang);e(this).toggleClass("hidden",t)})}function o(){t.toolbar.removeButtons(c),c=[],s=e(".api-method-sample");var n=[],i=!1;s.each(function(){var t,a,o=!1,s=e(this).data("lang"),c=e(this).data("name");s==r.currentLang&&(i=!0,o=!0),t=e.grep(n,function(t){return t.name==c}),a=!!t.length,a||n.push({name:c,lang:s,"default":o})}),n.reverse(),e.each(n,function(o,s){var l,g=s["default"]||!i&&o==n.length-1;l=t.toolbar.createButton({text:s.name,position:"right",className:"lang-switcher"+(g?" active":""),onClick:function(t){r.currentLang=s.lang,a(),e(".btn.lang-switcher.active").removeClass("active"),e(t.currentTarget).addClass("active")}}),c.push(l),g&&(r.currentLang=s.lang)})}var s,r,c=[],l =[{config:"light",text:"Light",id:0},{config:"dark",text:"Dark",id:3}];t.events.bind("start",function(e,i){var o=i["theme-api"];t.toolbar.createButton({icon:"fa fa-columns",label:"Change Layout",onClick:function(){r.split=!r.split,a()}}),t.fontsettings.setThemes(l),t.fontsettings.setTheme(o.theme),n(o)}),t.events.on("page.change",function(){o(),i()}),t.events.on("comment.toggled",function(e,n,a){if(n.parents(".api-method-definition").length){var i=t.state.$book.find(".page-wrapper");i.toggleClass("comments-open-from-definition",a&&r.split)}})}); http://git-wip-us.apache.org/repos/asf/incubator-hivemall-site/blob/30afb6e4/userguide/gitbook/gitbook-plugin-toggle-chapters/toggle.css ---------------------------------------------------------------------- diff --git a/userguide/gitbook/gitbook-plugin-toggle-chapters/toggle.css b/userguide/gitbook/gitbook-plugin-toggle-chapters/toggle.css new file mode 100644 index 0000000..e69de29 http://git-wip-us.apache.org/repos/asf/incubator-hivemall-site/blob/30afb6e4/userguide/gitbook/gitbook-plugin-toggle-chapters/toggle.js ---------------------------------------------------------------------- diff --git a/userguide/gitbook/gitbook-plugin-toggle-chapters/toggle.js b/userguide/gitbook/gitbook-plugin-toggle-chapters/toggle.js new file mode 100644 index 0000000..12f619a --- /dev/null +++ b/userguide/gitbook/gitbook-plugin-toggle-chapters/toggle.js @@ -0,0 +1,27 @@ +require(["gitbook", "jQuery"], function(gitbook, $) { + + function expand(chapter) { + chapter.show(); + if (chapter.parent().attr('class') != 'summary' + && chapter.parent().attr('class') != 'book-summary' + && chapter.length != 0 + ) { + expand(chapter.parent()); + } + } + + gitbook.events.bind("page.change", function() { + $('li.chapter').children('ul.articles').hide(); + $chapter = $('li.chapter.active'); + $children = $chapter.children('ul.articles'); + $parent = $chapter.parent(); + $siblings = $chapter.siblings().children('ul.articles'); + + expand($chapter); + + if ($children.length > 0) { + $children.show(); + } + }); + +});