diff --git a/Makefile b/Makefile index 5029f2af96..3557372217 100644 --- a/Makefile +++ b/Makefile @@ -60,10 +60,6 @@ doc/stdlib/index.html: bin/nitdoc bin/nitls --custom-brand "Nitlanguage.org" \ --custom-overview-text "

Documentation for the standard library of Nit
Version $$(git describe)
Date: $$(git show --format="%cd" | head -1)

" \ --custom-footer-text "Nit standard library. Version $$(git describe)." \ - --github-upstream "nitlang:nit:master" \ - --github-base-sha1 "$$(git rev-parse HEAD)" \ - --github-gitdir "." \ - --source "https://github.com/nitlang/nit/blob/$$(git rev-parse HEAD)/%f#L%l-%L" \ --piwik-tracker "pratchett.info.uqam.ca/piwik/" \ --piwik-site-id "2" \ @@ -74,10 +70,6 @@ doc/nitc/index.html: bin/nitdoc bin/nitls --custom-brand "Nitlanguage.org" \ --custom-overview-text "

Documentation for the Nit tools
Version $$(git describe)
Date: $$(git show --format="%cd" | head -1)

" \ --custom-footer-text "Nit tools. Version $$(git describe)." \ - --github-upstream "nitlang:nit:master" \ - --github-base-sha1 "$$(git rev-parse HEAD)" \ - --github-gitdir "." \ - --source "https://github.com/nitlang/nit/blob/$$(git rev-parse HEAD)/%f#L%l-%L" \ --piwik-tracker "pratchett.info.uqam.ca/piwik/" \ --piwik-site-id "3" diff --git a/lib/github/README.md b/lib/github/README.md index 041e753988..18814ee4da 100644 --- a/lib/github/README.md +++ b/lib/github/README.md @@ -18,17 +18,17 @@ Token can also be recovered from user config with `get_github_oauth`. [[doc: load_user]] [[doc: User]] -[[list: User]] +[[defs: User]] ### Retrieving repo data [[doc: load_repo]] [[doc: Repo]] -[[list: Repo]] +[[defs: Repo]] ### Other data -[[list: github::api]] +[[defs: github::api]] ### Advanced uses @@ -68,4 +68,4 @@ GithubAPI can trigger different events depending on the hook configuration. [[doc: GithubEvent]] -[[list: github::events]] +[[defs: github::events]] diff --git a/share/nitdoc/css/Nitdoc.GitHub.css b/share/nitdoc/css/Nitdoc.GitHub.css deleted file mode 100644 index a2d675f9d9..0000000000 --- a/share/nitdoc/css/Nitdoc.GitHub.css +++ /dev/null @@ -1,231 +0,0 @@ -/* This file is part of NIT ( http://www.nitlanguage.org ). - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - Documentation generator for the nit language. - Generate API documentation in HTML format from nit source code. -*/ - -/* - * Nitdoc Github Login Box - */ - -#nitdoc-github-li.current { - color: #999; -} - -#nitdoc-github-li .glyphicon { - cursor: pointer; -} - -#nitdoc-github-loginbox { - cursor: default; - position: absolute; - width : 220px; - margin-top: 2px; - margin-left: -10px; - display: block; - padding: 10px; - text-align: left; - white-space: normal; - background-color: #ffffff; - border: 1px solid #ccc; - border: 1px solid rgba(0, 0, 0, 0.2); - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - border-radius: 2px; - -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); - -moz-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); - box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); - -webkit-background-clip: padding-box; - -moz-background-clip: padding; - background-clip: padding-box; -} - -#nitdoc-github-loginbox .nitdoc-github-loginbox-arrow { - position: absolute; - display: block; - width: 0; - height: 0; - border-color: transparent; - border-style: solid; - border-width: 7px; - top: -7px; - margin-left: 2px; - border-bottom-color: #999; - border-bottom-color: rgba(0, 0, 0, 0.25); - border-top-width: 0; -} - -#nitdoc-github-loginbox .nitdoc-github-loginbox-arrow:after { - position: absolute; - display: block; - width: 0; - height: 0; - border-color: transparent; - border-style: solid; - border-width: 10px; - content: ""; - top: 1px; - margin-left: -10px; - border-bottom-color: #ffffff; - border-top-width: 0; -} - -#nitdoc-github-loginbox h3 { - text-align:center; -} - -#nitdoc-github-loginbox h4 { - display: block; - width: 100%; - color: #6C6C6C; - font-style: normal; - text-align: center; - margin-bottom: 20px; -} - - -#nitdoc-github-loginbox a.nitdoc-github-loginbox-githublink { - display: block; - margin: 10px; - color: #0D8921; -} - -/* Comment editing */ - -.nitdoc-github-commentbox { - margin: 1em 5px; - border: 1px solid #eee; - padding: 1em; - background: #fff; - -moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); - -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); - box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); -} - -.nitdoc-github-commentbox h3 { - margin: 0; -} - -.nitdoc-github-commentbox-buttons { - text-align: right; -} - -.nitdoc-github-commentbox dl { - margin-bottom: 0; -} - -.nitdoc-github-commentbox dt { - margin-bottom: 0.5em; -} - -.nitdoc-github-commentbox dd { - margin: 0 0 1em 0; -} - -.nitdoc-github-commentbox textarea { - display: block; - font-family: monospace; - font-size: 1em; - width: 100%; - padding: 4px; - padding-left: 11px; - overflow-y: hidden; - border: 1px solid #CCC; -} - -.nitdoc-github-preview { - margin: 0 15px; - cursor: pointer; -} - -.nitdoc-github-button.nitdoc-github-cancel { - background-color: #b33630; - background-image: -webkit-gradient(linear, left top, left bottom, from(#E97A74), to(#9f312c)); /* Saf4+, Chrome */ - background-image: -webkit-linear-gradient(top, #E97A74, #9f312c); /* Chrome 10+, Saf5.1+ */ - background-image: -moz-linear-gradient(top, #E97A74, #9f312c); /* FF3.6 */ - background-image: -ms-linear-gradient(top, #E97A74, #9f312c); /* IE10 */ - background-image: -o-linear-gradient(top, #E97A74, #9f312c); /* Opera 11.10+ */ - background-image: linear-gradient(top, #E97A74, #9f312c); - filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#E97A74', EndColorStr='#9f312c'); /* IE6–IE9 */ - border: 1px solid #9f312c; -} - -div.comment.locked { - color: gray; -} -p.locked { - color: black; -} - -a.nitdoc-github-cancel { - color: #b33630; - cursor: pointer; -} - -a.nitdoc-github-update { - color: orange; - cursor: pointer; -} - -.nitdoc-dialog h4 { - font-weight: bold; -} - -/* hljs */ - -.hljs.nitcode { - padding-left: 10px; -} - -.hljs-comment, .hljs-comment-block { - color: #777; -} - -.hljs-keyword { - color: #000; - font-weight: bold; -} - -.hljs-title { - font-weight: bold; -} - -.hljs-module { - color: #3762E4; -} - -.hljs-class .hljs-title { - color: #3762E4; -} - -.hljs-type { - color: #3762E4; -} - -.hljs-string { - color: #8F1546; -} - -.hljs-subst { - color: #9E6BEB; -} - -.hljs-fun .hljs-title { - color: #3762E4; -} - -.hljs-char, .hljs-number { - color: #009999; -} diff --git a/share/nitdoc/css/Nitdoc.ModalBox.css b/share/nitdoc/css/Nitdoc.ModalBox.css deleted file mode 100644 index bf9f9aad9b..0000000000 --- a/share/nitdoc/css/Nitdoc.ModalBox.css +++ /dev/null @@ -1,110 +0,0 @@ -/* This file is part of NIT ( http://www.nitlanguage.org ). - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - Documentation generator for the nit language. - Generate API documentation in HTML format from nit source code. -*/ - -/* - * Nitdoc ModalBox style - */ - -.nitdoc-dialog-fade { - background: #000; - position: fixed; left: 0; top: 0; - width: 100%; height: 100%; - opacity: .80; - filter: alpha(opacity=80); - z-index: 9999; -} - -.nitdoc-dialog { - background: #fff; - border: 1px solid #ddd; - float: left; - position: fixed; - z-index: 99999; - -webkit-box-shadow: 0px 0px 20px #000; - -moz-box-shadow: 0px 0px 20px #000; - box-shadow: 0px 0px 20px #000; - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - border-radius: 2px; - text-align: left; - min-width: 300px; -} - -.nitdoc-dialog-header { - padding: 10px 10px 10px 20px; - background: #f1f1f1; - border-bottom: 1px solid #ddd; -} - -.nitdoc-dialog-error .nitdoc-dialog-header { - background: #C92020; -} -.nitdoc-dialog-error .nitdoc-dialog-header h3 { - color: white; -} - -.nitdoc-dialog h3 { - display: inline; - margin: 0; -} - -.nitdoc-dialog-content { - max-height: 450px; - overflow-y: scroll; - padding: 10px; -} - -.nitdoc-dialog-buttons { - text-align: right; - padding: 5px; - border-top: 1px solid #ddd; -} - -.nitdoc-dialog textarea { - min-width: 300px; - width: 100%; -} - -.nitdoc-dialog button { - cursor: pointer; - border-radius: 2px; - -moz-border-radius: 2px; - -webkit-border-radius: 2px; - font-size: 14px; - padding: 5px 7px 5px 7px; - text-align: center; - background: #eee; - color: #333; - border: 1px solid #ddd; - font-weight: bold; -} - -.nitdoc-dialog button:hover { - background: #0D8921; - color: #fff; - border: 1px solid #1d7900; -} - -.nitdoc-dialog-close { - float: right; - padding: 5px; - margin: 0px; - line-height: 10px; - text-transform: lowercase; -} - diff --git a/share/nitdoc/css/Nitdoc.QuickSearch.css b/share/nitdoc/css/Nitdoc.QuickSearch.css deleted file mode 100644 index 81bba5dffa..0000000000 --- a/share/nitdoc/css/Nitdoc.QuickSearch.css +++ /dev/null @@ -1,87 +0,0 @@ -/* This file is part of NIT ( http://www.nitlanguage.org ). - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - Documentation generator for the nit language. - Generate API documentation in HTML format from nit source code. -*/ - -/* - * Nitdoc Quick Search JS module - */ - -#nitdoc-qs-field { - width: 300px; - margin-top: 3px; -} - -#nitdoc-qs-table { - background-color: #FFFFFF; - border: 1px solid #E0E0E0; - border-spacing: 0px; - z-index: 1000; - -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); - -moz-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); - box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); -} - -#nitdoc-qs-table .nitdoc-qs-active { - cursor: pointer; - background: #EEE; -} - -#nitdoc-qs-table td, th { - white-space: nowrap; - overflow: hidden; - line-height: 22px; - padding: 2px; -} - -#nitdoc-qs-table td.nitdoc-qs-sub { - color: #6C6C6C; - padding-left: 12px; -} - -#nitdoc-qs-table td.nitdoc-qs-info { - color: #0D8921; - font-size: smaller; - text-align: right; -} - -#nitdoc-qs-table tr.nitdoc-qs-noresult td { - color: #6C6C6C; - font-size: small; - line-height: 15px; -} - -#nitdoc-qs-table tr.nitdoc-qs-overflow td { - text-align: center; - font-size: x-small; - line-height: 10px; - color: #FFF; - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -#nitdoc-qs-table tr.nitdoc-qs-overflow-active td { - color: #0D8921; - cursor: pointer; -} - -#nitdoc-qs-table tr.nitdoc-qs-overflow-active td:hover { - background-color: #E0E0E0; -} diff --git a/share/nitdoc/css/Nitdoc.UI.css b/share/nitdoc/css/Nitdoc.UI.css deleted file mode 100644 index 17b248d358..0000000000 --- a/share/nitdoc/css/Nitdoc.UI.css +++ /dev/null @@ -1,75 +0,0 @@ -/* This file is part of NIT ( http://www.nitlanguage.org ). - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - Documentation generator for the nit language. - Generate API documentation in HTML format from nit source code. -*/ - -/* - * Nitdoc UI JS module - */ - - -/* Folding */ - -a.nitdoc-ui-fold { - margin: 0 5px; - color: #999; - font-family: monospace; - font-weight: bold; - font-size: 120%; -} - -/* Search page field */ - -.nitdoc-ui-searchpage-field { - width: 750px; -} - -/* Side bar boxes text filtering */ - -.nitdoc-ui-filter { - text-align: center; - padding: 5px; -} - -.nitdoc-ui-filter-field { - width: 150px; - margin-right: 5px; -} - -.nitdoc-ui-filter-field-notused { - color: #999; - font-style: italic; -} - -/* Side bar boxes type filtering */ - -a.nitdoc-ui-filter-link { - color: #0D8921; - cursor: pointer; - font-family: monospace; - margin-right: 5px; - font-weight: bold; -} - -a.nitdoc-ui-filter-link:hover { - text-decoration: underline; -} - -a.nitdoc-ui-filter-hidden { - color: #999; - font-weight: normal; -} - diff --git a/share/nitdoc/css/nitdoc.bootstrap.css b/share/nitdoc/css/nitdoc.bootstrap.css index 0351b6fdb8..fd80998b19 100644 --- a/share/nitdoc/css/nitdoc.bootstrap.css +++ b/share/nitdoc/css/nitdoc.bootstrap.css @@ -1,13 +1,3 @@ -/*! - * Bootstrap v3.1.1 - * - * Copyright 2014 Twitter, Inc - * Licensed under the Apache License v2.0 - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Designed and built with all the love in the world by @mdo and @fat. - * BootSwatchr built and provided by @DrewStrickland - */ /*! normalize.css v3.0.0 | MIT License | git.io/normalize */ html { font-family: sans-serif; @@ -275,11 +265,11 @@ html { -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } body { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-family: sans-serif; font-size: 14px; line-height: 1.428571429; color: #333333; - background-color: #ffffff; + background-color: #f2f2f2; } input, button, @@ -290,12 +280,12 @@ textarea { line-height: inherit; } a { - color: #222222; + color: #0d8921; text-decoration: none; } a:hover, a:focus { - color: #0d8921; + color: #064310; text-decoration: underline; } a:focus { @@ -319,14 +309,14 @@ img { height: auto; } .img-rounded { - border-radius: 4px; + border-radius: 0px; } .img-thumbnail { padding: 4px; line-height: 1.428571429; - background-color: #ffffff; + background-color: #f2f2f2; border: 1px solid #dddddd; - border-radius: 3px; + border-radius: 0px; -webkit-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; display: inline-block; @@ -340,7 +330,7 @@ hr { margin-top: 20px; margin-bottom: 20px; border: 0; - border-top: 1px solid #eeeeee; + border-top: 1px solid #ddd; } .sr-only { position: absolute; @@ -364,7 +354,7 @@ h6, .h4, .h5, .h6 { - font-family: inherit; + font-family: sans-serif; font-weight: 500; line-height: 1.1; color: inherit; @@ -453,11 +443,11 @@ h2, } h3, .h3 { - font-size: 24px; + font-size: 23px; } h4, .h4 { - font-size: 18px; + font-size: 17px; } h5, .h5 { @@ -465,7 +455,7 @@ h5, } h6, .h6 { - font-size: 12px; + font-size: 11px; } p { margin: 0 0 10px; @@ -516,10 +506,10 @@ a.text-success:hover { color: #449d44; } .text-info { - color: #6c6c6c; + color: #5bc0de; } a.text-info:hover { - color: #525252; + color: #31b0d5; } .text-warning { color: #f0ad4e; @@ -541,28 +531,28 @@ a.bg-primary:hover { background-color: #095a16; } .bg-success { - background-color: #eaf6ea; + background-color: #dff0d8; } a.bg-success:hover { - background-color: #c7e6c7; + background-color: #c1e2b3; } .bg-info { - background-color: #ececec; + background-color: #d9edf7; } a.bg-info:hover { - background-color: #d2d2d2; + background-color: #afd9ee; } .bg-warning { - background-color: #fef9f3; + background-color: #fcf8e3; } a.bg-warning:hover { - background-color: #fae3c4; + background-color: #f7ecb5; } .bg-danger { - background-color: #f9e2e2; + background-color: #f2dede; } a.bg-danger:hover { - background-color: #f0b9b8; + background-color: #e4b9b9; } .page-header { padding-bottom: 9px; @@ -587,13 +577,15 @@ ol ol { .list-inline { padding-left: 0; list-style: none; - margin-left: -5px; } .list-inline > li { display: inline-block; padding-left: 5px; padding-right: 5px; } +.list-inline > li:first-child { + padding-left: 0; +} dl { margin-top: 0; margin-bottom: 20px; @@ -692,7 +684,7 @@ code, kbd, pre, samp { - font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + font-family: monospace; } code { padding: 2px 4px; @@ -700,14 +692,14 @@ code { color: #c7254e; background-color: #f9f2f4; white-space: nowrap; - border-radius: 3px; + border-radius: 0px; } kbd { padding: 2px 4px; font-size: 90%; color: #ffffff; background-color: #333333; - border-radius: 2px; + border-radius: 0px; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25); } pre { @@ -721,7 +713,7 @@ pre { color: #333333; background-color: #f5f5f5; border: 1px solid #cccccc; - border-radius: 3px; + border-radius: 0px; } pre code { padding: 0; @@ -1440,7 +1432,7 @@ th { border-top: 2px solid #dddddd; } .table .table { - background-color: #ffffff; + background-color: #f2f2f2; } .table-condensed > thead > tr > th, .table-condensed > tbody > tr > th, @@ -1471,7 +1463,7 @@ th { } .table-hover > tbody > tr:hover > td, .table-hover > tbody > tr:hover > th { - background-color: #f5f5f5; + background-color: #dbdbdb; } table col[class*="col-"] { position: static; @@ -1496,13 +1488,13 @@ table th[class*="col-"] { .table > thead > tr.active > th, .table > tbody > tr.active > th, .table > tfoot > tr.active > th { - background-color: #f5f5f5; + background-color: #dbdbdb; } .table-hover > tbody > tr > td.active:hover, .table-hover > tbody > tr > th.active:hover, .table-hover > tbody > tr.active:hover > td, .table-hover > tbody > tr.active:hover > th { - background-color: #e8e8e8; + background-color: #cecece; } .table > thead > tr > td.success, .table > tbody > tr > td.success, @@ -1516,13 +1508,13 @@ table th[class*="col-"] { .table > thead > tr.success > th, .table > tbody > tr.success > th, .table > tfoot > tr.success > th { - background-color: #eaf6ea; + background-color: #dff0d8; } .table-hover > tbody > tr > td.success:hover, .table-hover > tbody > tr > th.success:hover, .table-hover > tbody > tr.success:hover > td, .table-hover > tbody > tr.success:hover > th { - background-color: #d8eed8; + background-color: #d0e9c6; } .table > thead > tr > td.info, .table > tbody > tr > td.info, @@ -1536,13 +1528,13 @@ table th[class*="col-"] { .table > thead > tr.info > th, .table > tbody > tr.info > th, .table > tfoot > tr.info > th { - background-color: #ececec; + background-color: #d9edf7; } .table-hover > tbody > tr > td.info:hover, .table-hover > tbody > tr > th.info:hover, .table-hover > tbody > tr.info:hover > td, .table-hover > tbody > tr.info:hover > th { - background-color: #dfdfdf; + background-color: #c4e3f3; } .table > thead > tr > td.warning, .table > tbody > tr > td.warning, @@ -1556,13 +1548,13 @@ table th[class*="col-"] { .table > thead > tr.warning > th, .table > tbody > tr.warning > th, .table > tfoot > tr.warning > th { - background-color: #fef9f3; + background-color: #fcf8e3; } .table-hover > tbody > tr > td.warning:hover, .table-hover > tbody > tr > th.warning:hover, .table-hover > tbody > tr.warning:hover > td, .table-hover > tbody > tr.warning:hover > th { - background-color: #fceedb; + background-color: #faf2cc; } .table > thead > tr > td.danger, .table > tbody > tr > td.danger, @@ -1576,13 +1568,13 @@ table th[class*="col-"] { .table > thead > tr.danger > th, .table > tbody > tr.danger > th, .table > tfoot > tr.danger > th { - background-color: #f9e2e2; + background-color: #f2dede; } .table-hover > tbody > tr > td.danger:hover, .table-hover > tbody > tr > th.danger:hover, .table-hover > tbody > tr.danger:hover > td, .table-hover > tbody > tr.danger:hover > th { - background-color: #f4cecd; + background-color: #ebcccc; } @media (max-width: 767px) { .table-responsive { @@ -1663,6 +1655,7 @@ input[type="checkbox"] { margin: 4px 0 0; margin-top: 1px \9; /* IE8-9 */ + line-height: normal; } input[type="file"] { @@ -1685,7 +1678,7 @@ input[type="checkbox"]:focus { } output { display: block; - padding-top: 3px; + padding-top: 7px; font-size: 14px; line-height: 1.428571429; color: #555555; @@ -1693,25 +1686,25 @@ output { .form-control { display: block; width: 100%; - height: 26px; - padding: 2px 5px; + height: 34px; + padding: 6px 12px; font-size: 14px; line-height: 1.428571429; color: #555555; background-color: #ffffff; background-image: none; border: 1px solid #cccccc; - border-radius: 3px; + border-radius: 0px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; } .form-control:focus { - border-color: #6c6c6c; + border-color: #66afe9; outline: 0; - -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(108, 108, 108, 0.6); - box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(108, 108, 108, 0.6); + -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6); + box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, 0.6); } .form-control::-moz-placeholder { color: #999999; @@ -1737,7 +1730,7 @@ input[type="search"] { -webkit-appearance: none; } input[type="date"] { - line-height: 26px; + line-height: 34px; } .form-group { margin-bottom: 15px; @@ -1796,30 +1789,30 @@ fieldset[disabled] .checkbox-inline { cursor: not-allowed; } .input-sm { - height: 22px; - padding: 1px 5px; + height: 30px; + padding: 5px 10px; font-size: 12px; line-height: 1.5; - border-radius: 2px; + border-radius: 0px; } select.input-sm { - height: 22px; - line-height: 22px; + height: 30px; + line-height: 30px; } textarea.input-sm, select[multiple].input-sm { height: auto; } .input-lg { - height: 36px; - padding: 5px 10px; + height: 45px; + padding: 10px 16px; font-size: 18px; line-height: 1.33; - border-radius: 4px; + border-radius: 0px; } select.input-lg { - height: 36px; - line-height: 36px; + height: 45px; + line-height: 45px; } textarea.input-lg, select[multiple].input-lg { @@ -1829,16 +1822,16 @@ select[multiple].input-lg { position: relative; } .has-feedback .form-control { - padding-right: 32.5px; + padding-right: 42.5px; } .has-feedback .form-control-feedback { position: absolute; top: 25px; right: 0; display: block; - width: 26px; - height: 26px; - line-height: 26px; + width: 34px; + height: 34px; + line-height: 34px; text-align: center; } .has-success .help-block, @@ -1862,7 +1855,7 @@ select[multiple].input-lg { .has-success .input-group-addon { color: #5cb85c; border-color: #5cb85c; - background-color: #eaf6ea; + background-color: #dff0d8; } .has-success .form-control-feedback { color: #5cb85c; @@ -1888,7 +1881,7 @@ select[multiple].input-lg { .has-warning .input-group-addon { color: #f0ad4e; border-color: #f0ad4e; - background-color: #fef9f3; + background-color: #fcf8e3; } .has-warning .form-control-feedback { color: #f0ad4e; @@ -1914,7 +1907,7 @@ select[multiple].input-lg { .has-error .input-group-addon { color: #d9534f; border-color: #d9534f; - background-color: #f9e2e2; + background-color: #f2dede; } .has-error .form-control-feedback { color: #d9534f; @@ -1970,18 +1963,18 @@ select[multiple].input-lg { .form-horizontal .checkbox-inline { margin-top: 0; margin-bottom: 0; - padding-top: 3px; + padding-top: 7px; } .form-horizontal .radio, .form-horizontal .checkbox { - min-height: 23px; + min-height: 27px; } .form-horizontal .form-group { margin-left: -15px; margin-right: -15px; } .form-horizontal .form-control-static { - padding-top: 3px; + padding-top: 7px; } @media (min-width: 768px) { .form-horizontal .control-label { @@ -2002,18 +1995,17 @@ select[multiple].input-lg { background-image: none; border: 1px solid transparent; white-space: nowrap; - padding: 2px 5px; + padding: 6px 12px; font-size: 14px; line-height: 1.428571429; - border-radius: 3px; + border-radius: 0px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; + -o-user-select: none; user-select: none; } -.btn:focus, -.btn:active:focus, -.btn.active:focus { +.btn:focus { outline: thin dotted; outline: 5px auto -webkit-focus-ring-color; outline-offset: -2px; @@ -2165,8 +2157,8 @@ fieldset[disabled] .btn-success.active { } .btn-info { color: #ffffff; - background-color: #6c6c6c; - border-color: #5f5f5f; + background-color: #5bc0de; + border-color: #46b8da; } .btn-info:hover, .btn-info:focus, @@ -2174,8 +2166,8 @@ fieldset[disabled] .btn-success.active { .btn-info.active, .open .dropdown-toggle.btn-info { color: #ffffff; - background-color: #585858; - border-color: #414141; + background-color: #39b3d7; + border-color: #269abc; } .btn-info:active, .btn-info.active, @@ -2197,11 +2189,11 @@ fieldset[disabled] .btn-info:active, .btn-info.disabled.active, .btn-info[disabled].active, fieldset[disabled] .btn-info.active { - background-color: #6c6c6c; - border-color: #5f5f5f; + background-color: #5bc0de; + border-color: #46b8da; } .btn-info .badge { - color: #6c6c6c; + color: #5bc0de; background-color: #ffffff; } .btn-warning { @@ -2287,7 +2279,7 @@ fieldset[disabled] .btn-danger.active { background-color: #ffffff; } .btn-link { - color: #222222; + color: #0d8921; font-weight: normal; cursor: pointer; border-radius: 0; @@ -2308,7 +2300,7 @@ fieldset[disabled] .btn-link { } .btn-link:hover, .btn-link:focus { - color: #0d8921; + color: #064310; text-decoration: underline; background-color: transparent; } @@ -2321,24 +2313,24 @@ fieldset[disabled] .btn-link:focus { } .btn-lg, .btn-group-lg > .btn { - padding: 5px 10px; + padding: 10px 16px; font-size: 18px; line-height: 1.33; - border-radius: 4px; + border-radius: 0px; } .btn-sm, .btn-group-sm > .btn { - padding: 1px 5px; + padding: 5px 10px; font-size: 12px; line-height: 1.5; - border-radius: 2px; + border-radius: 0px; } .btn-xs, .btn-group-xs > .btn { - padding: 0px 3px; + padding: 1px 5px; font-size: 12px; line-height: 1.5; - border-radius: 2px; + border-radius: 0px; } .btn-block { display: block; @@ -2377,8 +2369,8 @@ input[type="button"].btn-block { } @font-face { font-family: 'Glyphicons Halflings'; - src: url('../fonts/glyphicons-halflings-regular.eot'); - src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); + src: url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/fonts/glyphicons-halflings-regular.eot'); + src: url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/fonts/glyphicons-halflings-regular.woff') format('woff'), url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); } .glyphicon { position: relative; @@ -3022,7 +3014,7 @@ input[type="button"].btn-block { background-color: #ffffff; border: 1px solid #cccccc; border: 1px solid rgba(0, 0, 0, 0.15); - border-radius: 3px; + border-radius: 0px; -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); background-clip: padding-box; @@ -3049,8 +3041,8 @@ input[type="button"].btn-block { .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus { text-decoration: none; - color: #262626; - background-color: #f5f5f5; + color: #ffffff; + background-color: #0d8921; } .dropdown-menu > .active > a, .dropdown-menu > .active > a:hover, @@ -3253,12 +3245,12 @@ input[type="button"].btn-block { border-radius: 0; } .btn-group-vertical > .btn:first-child:not(:last-child) { - border-top-right-radius: 3px; + border-top-right-radius: 0px; border-bottom-right-radius: 0; border-bottom-left-radius: 0; } .btn-group-vertical > .btn:last-child:not(:first-child) { - border-bottom-left-radius: 3px; + border-bottom-left-radius: 0px; border-top-right-radius: 0; border-top-left-radius: 0; } @@ -3304,8 +3296,6 @@ input[type="button"].btn-block { padding-right: 0; } .input-group .form-control { - position: relative; - z-index: 2; float: left; width: 100%; margin-bottom: 0; @@ -3313,17 +3303,17 @@ input[type="button"].btn-block { .input-group-lg > .form-control, .input-group-lg > .input-group-addon, .input-group-lg > .input-group-btn > .btn { - height: 36px; - padding: 5px 10px; + height: 45px; + padding: 10px 16px; font-size: 18px; line-height: 1.33; - border-radius: 4px; + border-radius: 0px; } select.input-group-lg > .form-control, select.input-group-lg > .input-group-addon, select.input-group-lg > .input-group-btn > .btn { - height: 36px; - line-height: 36px; + height: 45px; + line-height: 45px; } textarea.input-group-lg > .form-control, textarea.input-group-lg > .input-group-addon, @@ -3336,17 +3326,17 @@ select[multiple].input-group-lg > .input-group-btn > .btn { .input-group-sm > .form-control, .input-group-sm > .input-group-addon, .input-group-sm > .input-group-btn > .btn { - height: 22px; - padding: 1px 5px; + height: 30px; + padding: 5px 10px; font-size: 12px; line-height: 1.5; - border-radius: 2px; + border-radius: 0px; } select.input-group-sm > .form-control, select.input-group-sm > .input-group-addon, select.input-group-sm > .input-group-btn > .btn { - height: 22px; - line-height: 22px; + height: 30px; + line-height: 30px; } textarea.input-group-sm > .form-control, textarea.input-group-sm > .input-group-addon, @@ -3373,7 +3363,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn { vertical-align: middle; } .input-group-addon { - padding: 2px 5px; + padding: 6px 12px; font-size: 14px; font-weight: normal; line-height: 1; @@ -3381,17 +3371,17 @@ select[multiple].input-group-sm > .input-group-btn > .btn { text-align: center; background-color: #eeeeee; border: 1px solid #cccccc; - border-radius: 3px; + border-radius: 0px; } .input-group-addon.input-sm { - padding: 1px 5px; + padding: 5px 10px; font-size: 12px; - border-radius: 2px; + border-radius: 0px; } .input-group-addon.input-lg { - padding: 5px 10px; + padding: 10px 16px; font-size: 18px; - border-radius: 4px; + border-radius: 0px; } .input-group-addon input[type="radio"], .input-group-addon input[type="checkbox"] { @@ -3459,12 +3449,12 @@ select[multiple].input-group-sm > .input-group-btn > .btn { .nav > li > a { position: relative; display: block; - padding: 5px 10px; + padding: 10px 15px; } .nav > li > a:hover, .nav > li > a:focus { text-decoration: none; - background-color: #eeeeee; + background-color: #dddddd; } .nav > li.disabled > a { color: #999999; @@ -3479,8 +3469,8 @@ select[multiple].input-group-sm > .input-group-btn > .btn { .nav .open > a, .nav .open > a:hover, .nav .open > a:focus { - background-color: #eeeeee; - border-color: #222222; + background-color: #dddddd; + border-color: #0d8921; } .nav .nav-divider { height: 1px; @@ -3502,7 +3492,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn { margin-right: 2px; line-height: 1.428571429; border: 1px solid transparent; - border-radius: 3px 3px 0 0; + border-radius: 0px 0px 0 0; } .nav-tabs > li > a:hover { border-color: #eeeeee #eeeeee #dddddd; @@ -3511,7 +3501,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn { .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus { color: #555555; - background-color: #ffffff; + background-color: #f2f2f2; border: 1px solid #dddddd; border-bottom-color: transparent; cursor: default; @@ -3542,7 +3532,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn { } .nav-tabs.nav-justified > li > a { margin-right: 0; - border-radius: 3px; + border-radius: 0px; } .nav-tabs.nav-justified > .active > a, .nav-tabs.nav-justified > .active > a:hover, @@ -3552,19 +3542,19 @@ select[multiple].input-group-sm > .input-group-btn > .btn { @media (min-width: 768px) { .nav-tabs.nav-justified > li > a { border-bottom: 1px solid #dddddd; - border-radius: 3px 3px 0 0; + border-radius: 0px 0px 0 0; } .nav-tabs.nav-justified > .active > a, .nav-tabs.nav-justified > .active > a:hover, .nav-tabs.nav-justified > .active > a:focus { - border-bottom-color: #ffffff; + border-bottom-color: #f2f2f2; } } .nav-pills > li { float: left; } .nav-pills > li > a { - border-radius: 3px; + border-radius: 0px; } .nav-pills > li + li { margin-left: 2px; @@ -3610,7 +3600,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn { } .nav-tabs-justified > li > a { margin-right: 0; - border-radius: 3px; + border-radius: 0px; } .nav-tabs-justified > .active > a, .nav-tabs-justified > .active > a:hover, @@ -3620,12 +3610,12 @@ select[multiple].input-group-sm > .input-group-btn > .btn { @media (min-width: 768px) { .nav-tabs-justified > li > a { border-bottom: 1px solid #dddddd; - border-radius: 3px 3px 0 0; + border-radius: 0px 0px 0 0; } .nav-tabs-justified > .active > a, .nav-tabs-justified > .active > a:hover, .nav-tabs-justified > .active > a:focus { - border-bottom-color: #ffffff; + border-bottom-color: #f2f2f2; } } .tab-content > .tab-pane { @@ -3641,13 +3631,13 @@ select[multiple].input-group-sm > .input-group-btn > .btn { } .navbar { position: relative; - min-height: 30px; + min-height: 50px; margin-bottom: 20px; border: 1px solid transparent; } @media (min-width: 768px) { .navbar { - border-radius: 3px; + border-radius: 0px; } } @media (min-width: 768px) { @@ -3738,10 +3728,10 @@ select[multiple].input-group-sm > .input-group-btn > .btn { } .navbar-brand { float: left; - padding: 5px 15px; + padding: 15px 15px; font-size: 18px; line-height: 20px; - height: 30px; + height: 50px; } .navbar-brand:hover, .navbar-brand:focus { @@ -3758,12 +3748,12 @@ select[multiple].input-group-sm > .input-group-btn > .btn { float: right; margin-right: 15px; padding: 9px 10px; - margin-top: -2px; - margin-bottom: -2px; + margin-top: 8px; + margin-bottom: 8px; background-color: transparent; background-image: none; border: 1px solid transparent; - border-radius: 3px; + border-radius: 0px; } .navbar-toggle:focus { outline: none; @@ -3783,7 +3773,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn { } } .navbar-nav { - margin: 2.5px -15px; + margin: 7.5px -15px; } .navbar-nav > li > a { padding-top: 10px; @@ -3821,8 +3811,8 @@ select[multiple].input-group-sm > .input-group-btn > .btn { float: left; } .navbar-nav > li > a { - padding-top: 5px; - padding-bottom: 5px; + padding-top: 15px; + padding-bottom: 15px; } .navbar-nav.navbar-right:last-child { margin-right: -15px; @@ -3844,8 +3834,8 @@ select[multiple].input-group-sm > .input-group-btn > .btn { border-bottom: 1px solid transparent; -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1); - margin-top: 2px; - margin-bottom: 2px; + margin-top: 8px; + margin-bottom: 8px; } @media (min-width: 768px) { .navbar-form .form-group { @@ -3912,20 +3902,20 @@ select[multiple].input-group-sm > .input-group-btn > .btn { border-bottom-left-radius: 0; } .navbar-btn { - margin-top: 2px; - margin-bottom: 2px; + margin-top: 8px; + margin-bottom: 8px; } .navbar-btn.btn-sm { - margin-top: 4px; - margin-bottom: 4px; + margin-top: 10px; + margin-bottom: 10px; } .navbar-btn.btn-xs { - margin-top: 4px; - margin-bottom: 4px; + margin-top: 14px; + margin-bottom: 14px; } .navbar-text { - margin-top: 5px; - margin-bottom: 5px; + margin-top: 15px; + margin-bottom: 15px; } @media (min-width: 768px) { .navbar-text { @@ -3938,33 +3928,33 @@ select[multiple].input-group-sm > .input-group-btn > .btn { } } .navbar-default { - background-color: #f1f1f1; - border-color: #e0e0e0; + background-color: #0d8921; + border-color: none; } .navbar-default .navbar-brand { - color: #333333; + color: #ffffff; } .navbar-default .navbar-brand:hover, .navbar-default .navbar-brand:focus { - color: #1a1a1a; + color: #e6e6e6; background-color: transparent; } .navbar-default .navbar-text { - color: #333333; + color: #ffffff; } .navbar-default .navbar-nav > li > a { - color: #333333; + color: #ffffff; } .navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus { - color: #0d8921; + color: #dddddd; background-color: transparent; } .navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .navbar-default .navbar-nav > .active > a:focus { color: #ffffff; - background-color: #0d8921; + background-color: #0a6b1a; } .navbar-default .navbar-nav > .disabled > a, .navbar-default .navbar-nav > .disabled > a:hover, @@ -3980,32 +3970,32 @@ select[multiple].input-group-sm > .input-group-btn > .btn { background-color: #dddddd; } .navbar-default .navbar-toggle .icon-bar { - background-color: #888888; + background-color: #ffffff; } .navbar-default .navbar-collapse, .navbar-default .navbar-form { - border-color: #e0e0e0; + border-color: none; } .navbar-default .navbar-nav > .open > a, .navbar-default .navbar-nav > .open > a:hover, .navbar-default .navbar-nav > .open > a:focus { - background-color: #0d8921; + background-color: #0a6b1a; color: #ffffff; } @media (max-width: 767px) { .navbar-default .navbar-nav .open .dropdown-menu > li > a { - color: #333333; + color: #ffffff; } .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus { - color: #0d8921; + color: #dddddd; background-color: transparent; } .navbar-default .navbar-nav .open .dropdown-menu > .active > a, .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus { color: #ffffff; - background-color: #0d8921; + background-color: #0a6b1a; } .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a, .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover, @@ -4015,10 +4005,10 @@ select[multiple].input-group-sm > .input-group-btn > .btn { } } .navbar-default .navbar-link { - color: #333333; + color: #ffffff; } .navbar-default .navbar-link:hover { - color: #0d8921; + color: #dddddd; } .navbar-inverse { background-color: #222222; @@ -4114,13 +4104,13 @@ select[multiple].input-group-sm > .input-group-btn > .btn { margin-bottom: 20px; list-style: none; background-color: #f5f5f5; - border-radius: 3px; + border-radius: 0px; } .breadcrumb > li { display: inline-block; } .breadcrumb > li + li:before { - content: "/\00a0"; + content: "\00a0"; padding: 0 5px; color: #cccccc; } @@ -4131,7 +4121,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn { display: inline-block; padding-left: 0; margin: 20px 0; - border-radius: 3px; + border-radius: 0px; } .pagination > li { display: inline; @@ -4140,10 +4130,10 @@ select[multiple].input-group-sm > .input-group-btn > .btn { .pagination > li > span { position: relative; float: left; - padding: 2px 5px; + padding: 6px 12px; line-height: 1.428571429; text-decoration: none; - color: #222222; + color: #0d8921; background-color: #ffffff; border: 1px solid #dddddd; margin-left: -1px; @@ -4151,19 +4141,19 @@ select[multiple].input-group-sm > .input-group-btn > .btn { .pagination > li:first-child > a, .pagination > li:first-child > span { margin-left: 0; - border-bottom-left-radius: 3px; - border-top-left-radius: 3px; + border-bottom-left-radius: 0px; + border-top-left-radius: 0px; } .pagination > li:last-child > a, .pagination > li:last-child > span { - border-bottom-right-radius: 3px; - border-top-right-radius: 3px; + border-bottom-right-radius: 0px; + border-top-right-radius: 0px; } .pagination > li > a:hover, .pagination > li > span:hover, .pagination > li > a:focus, .pagination > li > span:focus { - color: #0d8921; + color: #064310; background-color: #eeeeee; border-color: #dddddd; } @@ -4192,33 +4182,33 @@ select[multiple].input-group-sm > .input-group-btn > .btn { } .pagination-lg > li > a, .pagination-lg > li > span { - padding: 5px 10px; + padding: 10px 16px; font-size: 18px; } .pagination-lg > li:first-child > a, .pagination-lg > li:first-child > span { - border-bottom-left-radius: 4px; - border-top-left-radius: 4px; + border-bottom-left-radius: 0px; + border-top-left-radius: 0px; } .pagination-lg > li:last-child > a, .pagination-lg > li:last-child > span { - border-bottom-right-radius: 4px; - border-top-right-radius: 4px; + border-bottom-right-radius: 0px; + border-top-right-radius: 0px; } .pagination-sm > li > a, .pagination-sm > li > span { - padding: 1px 5px; + padding: 5px 10px; font-size: 12px; } .pagination-sm > li:first-child > a, .pagination-sm > li:first-child > span { - border-bottom-left-radius: 2px; - border-top-left-radius: 2px; + border-bottom-left-radius: 0px; + border-top-left-radius: 0px; } .pagination-sm > li:last-child > a, .pagination-sm > li:last-child > span { - border-bottom-right-radius: 2px; - border-top-right-radius: 2px; + border-bottom-right-radius: 0px; + border-top-right-radius: 0px; } .pager { padding-left: 0; @@ -4305,11 +4295,11 @@ select[multiple].input-group-sm > .input-group-btn > .btn { background-color: #449d44; } .label-info { - background-color: #6c6c6c; + background-color: #5bc0de; } .label-info[href]:hover, .label-info[href]:focus { - background-color: #525252; + background-color: #31b0d5; } .label-warning { background-color: #f0ad4e; @@ -4331,7 +4321,7 @@ select[multiple].input-group-sm > .input-group-btn > .btn { padding: 3px 7px; font-size: 12px; font-weight: bold; - color: #ffffff; + color: : #fff; line-height: 1; vertical-align: baseline; white-space: nowrap; @@ -4358,41 +4348,41 @@ a.badge:focus { } a.list-group-item.active > .badge, .nav-pills > .active > a > .badge { - color: #222222; + color: #0d8921; background-color: #ffffff; } .nav-pills > li > a > .badge { margin-left: 3px; } .jumbotron { - padding: 20px; - margin-bottom: 20px; + padding: 30px; + margin-bottom: 30px; color: inherit; - background-color: #eeeeee; + background-color: #ffffff; } .jumbotron h1, .jumbotron .h1 { color: inherit; } .jumbotron p { - margin-bottom: 10px; - font-size: 17px; + margin-bottom: 15px; + font-size: 21px; font-weight: 200; } .container .jumbotron { - border-radius: 4px; + border-radius: 0px; } .jumbotron .container { max-width: 100%; } @media screen and (min-width: 768px) { .jumbotron { - padding-top: 32px; - padding-bottom: 32px; + padding-top: 48px; + padding-bottom: 48px; } .container .jumbotron { - padding-left: 40px; - padding-right: 40px; + padding-left: 60px; + padding-right: 60px; } .jumbotron h1, .jumbotron .h1 { @@ -4404,9 +4394,9 @@ a.list-group-item.active > .badge, padding: 4px; margin-bottom: 20px; line-height: 1.428571429; - background-color: #ffffff; + background-color: #f2f2f2; border: 1px solid #dddddd; - border-radius: 3px; + border-radius: 0px; -webkit-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; } @@ -4418,7 +4408,7 @@ a.list-group-item.active > .badge, a.thumbnail:hover, a.thumbnail:focus, a.thumbnail.active { - border-color: #222222; + border-color: #0d8921; } .thumbnail .caption { padding: 9px; @@ -4428,7 +4418,7 @@ a.thumbnail.active { padding: 15px; margin-bottom: 20px; border: 1px solid transparent; - border-radius: 3px; + border-radius: 0px; } .alert h4 { margin-top: 0; @@ -4454,45 +4444,45 @@ a.thumbnail.active { color: inherit; } .alert-success { - background-color: #eaf6ea; - border-color: #bcdfb5; + background-color: #dff0d8; + border-color: #d6e9c6; color: #5cb85c; } .alert-success hr { - border-top-color: #acd7a3; + border-top-color: #c9e2b3; } .alert-success .alert-link { color: #449d44; } .alert-info { - background-color: #ececec; - border-color: #d2d2d2; - color: #6c6c6c; + background-color: #d9edf7; + border-color: #bce8f1; + color: #5bc0de; } .alert-info hr { - border-top-color: #c5c5c5; + border-top-color: #a6e1ec; } .alert-info .alert-link { - color: #525252; + color: #31b0d5; } .alert-warning { - background-color: #fef9f3; - border-color: #fadac4; + background-color: #fcf8e3; + border-color: #fbeed5; color: #f0ad4e; } .alert-warning hr { - border-top-color: #f8ccac; + border-top-color: #f8e5be; } .alert-warning .alert-link { color: #ec971f; } .alert-danger { - background-color: #f9e2e2; - border-color: #f0b8c0; + background-color: #f2dede; + border-color: #eed3d7; color: #d9534f; } .alert-danger hr { - border-top-color: #eba3ad; + border-top-color: #e6c1c7; } .alert-danger .alert-link { color: #c9302c; @@ -4518,7 +4508,7 @@ a.thumbnail.active { height: 20px; margin-bottom: 20px; background-color: #f5f5f5; - border-radius: 3px; + border-radius: 0px; -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); } @@ -4553,7 +4543,7 @@ a.thumbnail.active { background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } .progress-bar-info { - background-color: #6c6c6c; + background-color: #5bc0de; } .progress-striped .progress-bar-info { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); @@ -4614,13 +4604,13 @@ a.thumbnail.active { border: 1px solid #dddddd; } .list-group-item:first-child { - border-top-right-radius: 3px; - border-top-left-radius: 3px; + border-top-right-radius: 0px; + border-top-left-radius: 0px; } .list-group-item:last-child { margin-bottom: 0; - border-bottom-right-radius: 3px; - border-bottom-left-radius: 3px; + border-bottom-right-radius: 0px; + border-bottom-left-radius: 0px; } .list-group-item > .badge { float: right; @@ -4655,11 +4645,11 @@ a.list-group-item.active:focus .list-group-item-heading { a.list-group-item.active .list-group-item-text, a.list-group-item.active:hover .list-group-item-text, a.list-group-item.active:focus .list-group-item-text { - color: #71f185; + color: #cccccc; } .list-group-item-success { color: #5cb85c; - background-color: #eaf6ea; + background-color: #dff0d8; } a.list-group-item-success { color: #5cb85c; @@ -4670,7 +4660,7 @@ a.list-group-item-success .list-group-item-heading { a.list-group-item-success:hover, a.list-group-item-success:focus { color: #5cb85c; - background-color: #d8eed8; + background-color: #d0e9c6; } a.list-group-item-success.active, a.list-group-item-success.active:hover, @@ -4680,30 +4670,30 @@ a.list-group-item-success.active:focus { border-color: #5cb85c; } .list-group-item-info { - color: #6c6c6c; - background-color: #ececec; + color: #5bc0de; + background-color: #d9edf7; } a.list-group-item-info { - color: #6c6c6c; + color: #5bc0de; } a.list-group-item-info .list-group-item-heading { color: inherit; } a.list-group-item-info:hover, a.list-group-item-info:focus { - color: #6c6c6c; - background-color: #dfdfdf; + color: #5bc0de; + background-color: #c4e3f3; } a.list-group-item-info.active, a.list-group-item-info.active:hover, a.list-group-item-info.active:focus { color: #fff; - background-color: #6c6c6c; - border-color: #6c6c6c; + background-color: #5bc0de; + border-color: #5bc0de; } .list-group-item-warning { color: #f0ad4e; - background-color: #fef9f3; + background-color: #fcf8e3; } a.list-group-item-warning { color: #f0ad4e; @@ -4714,7 +4704,7 @@ a.list-group-item-warning .list-group-item-heading { a.list-group-item-warning:hover, a.list-group-item-warning:focus { color: #f0ad4e; - background-color: #fceedb; + background-color: #faf2cc; } a.list-group-item-warning.active, a.list-group-item-warning.active:hover, @@ -4725,7 +4715,7 @@ a.list-group-item-warning.active:focus { } .list-group-item-danger { color: #d9534f; - background-color: #f9e2e2; + background-color: #f2dede; } a.list-group-item-danger { color: #d9534f; @@ -4736,7 +4726,7 @@ a.list-group-item-danger .list-group-item-heading { a.list-group-item-danger:hover, a.list-group-item-danger:focus { color: #d9534f; - background-color: #f4cecd; + background-color: #ebcccc; } a.list-group-item-danger.active, a.list-group-item-danger.active:hover, @@ -4757,7 +4747,7 @@ a.list-group-item-danger.active:focus { margin-bottom: 20px; background-color: #ffffff; border: 1px solid transparent; - border-radius: 3px; + border-radius: 0px; -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05); } @@ -4767,8 +4757,8 @@ a.list-group-item-danger.active:focus { .panel-heading { padding: 10px 15px; border-bottom: 1px solid transparent; - border-top-right-radius: 2px; - border-top-left-radius: 2px; + border-top-right-radius: -1px; + border-top-left-radius: -1px; } .panel-heading > .dropdown .dropdown-toggle { color: inherit; @@ -4786,8 +4776,8 @@ a.list-group-item-danger.active:focus { padding: 10px 15px; background-color: #f5f5f5; border-top: 1px solid #dddddd; - border-bottom-right-radius: 2px; - border-bottom-left-radius: 2px; + border-bottom-right-radius: -1px; + border-bottom-left-radius: -1px; } .panel > .list-group { margin-bottom: 0; @@ -4796,15 +4786,19 @@ a.list-group-item-danger.active:focus { border-width: 1px 0; border-radius: 0; } -.panel > .list-group:first-child .list-group-item:first-child { +.panel > .list-group .list-group-item:first-child { border-top: 0; - border-top-right-radius: 2px; - border-top-left-radius: 2px; } -.panel > .list-group:last-child .list-group-item:last-child { +.panel > .list-group .list-group-item:last-child { border-bottom: 0; - border-bottom-right-radius: 2px; - border-bottom-left-radius: 2px; +} +.panel > .list-group:first-child .list-group-item:first-child { + border-top-right-radius: -1px; + border-top-left-radius: -1px; +} +.panel > .list-group:last-child .list-group-item:last-child { + border-bottom-right-radius: -1px; + border-bottom-left-radius: -1px; } .panel-heading + .list-group .list-group-item:first-child { border-top-width: 0; @@ -4813,11 +4807,6 @@ a.list-group-item-danger.active:focus { .panel > .table-responsive > .table { margin-bottom: 0; } -.panel > .table:first-child, -.panel > .table-responsive:first-child > .table:first-child { - border-top-right-radius: 2px; - border-top-left-radius: 2px; -} .panel > .table:first-child > thead:first-child > tr:first-child td:first-child, .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child, .panel > .table:first-child > tbody:first-child > tr:first-child td:first-child, @@ -4826,7 +4815,7 @@ a.list-group-item-danger.active:focus { .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child, .panel > .table:first-child > tbody:first-child > tr:first-child th:first-child, .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child { - border-top-left-radius: 2px; + border-top-left-radius: -1px; } .panel > .table:first-child > thead:first-child > tr:first-child td:last-child, .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child, @@ -4836,12 +4825,7 @@ a.list-group-item-danger.active:focus { .panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child, .panel > .table:first-child > tbody:first-child > tr:first-child th:last-child, .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child { - border-top-right-radius: 2px; -} -.panel > .table:last-child, -.panel > .table-responsive:last-child > .table:last-child { - border-bottom-right-radius: 2px; - border-bottom-left-radius: 2px; + border-top-right-radius: -1px; } .panel > .table:last-child > tbody:last-child > tr:last-child td:first-child, .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child, @@ -4851,7 +4835,7 @@ a.list-group-item-danger.active:focus { .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child, .panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child, .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child { - border-bottom-left-radius: 2px; + border-bottom-left-radius: -1px; } .panel > .table:last-child > tbody:last-child > tr:last-child td:last-child, .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child, @@ -4861,7 +4845,7 @@ a.list-group-item-danger.active:focus { .panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child, .panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child, .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child { - border-bottom-right-radius: 2px; + border-bottom-right-radius: -1px; } .panel > .panel-body + .table, .panel > .panel-body + .table-responsive { @@ -4932,7 +4916,7 @@ a.list-group-item-danger.active:focus { } .panel-group .panel { margin-bottom: 0; - border-radius: 3px; + border-radius: 0px; overflow: hidden; } .panel-group .panel + .panel { @@ -4979,60 +4963,60 @@ a.list-group-item-danger.active:focus { border-bottom-color: #0d8921; } .panel-success { - border-color: #bcdfb5; + border-color: #d6e9c6; } .panel-success > .panel-heading { color: #5cb85c; - background-color: #eaf6ea; - border-color: #bcdfb5; + background-color: #dff0d8; + border-color: #d6e9c6; } .panel-success > .panel-heading + .panel-collapse .panel-body { - border-top-color: #bcdfb5; + border-top-color: #d6e9c6; } .panel-success > .panel-footer + .panel-collapse .panel-body { - border-bottom-color: #bcdfb5; + border-bottom-color: #d6e9c6; } .panel-info { - border-color: #d2d2d2; + border-color: #bce8f1; } .panel-info > .panel-heading { - color: #6c6c6c; - background-color: #ececec; - border-color: #d2d2d2; + color: #5bc0de; + background-color: #d9edf7; + border-color: #bce8f1; } .panel-info > .panel-heading + .panel-collapse .panel-body { - border-top-color: #d2d2d2; + border-top-color: #bce8f1; } .panel-info > .panel-footer + .panel-collapse .panel-body { - border-bottom-color: #d2d2d2; + border-bottom-color: #bce8f1; } .panel-warning { - border-color: #fadac4; + border-color: #fbeed5; } .panel-warning > .panel-heading { color: #f0ad4e; - background-color: #fef9f3; - border-color: #fadac4; + background-color: #fcf8e3; + border-color: #fbeed5; } .panel-warning > .panel-heading + .panel-collapse .panel-body { - border-top-color: #fadac4; + border-top-color: #fbeed5; } .panel-warning > .panel-footer + .panel-collapse .panel-body { - border-bottom-color: #fadac4; + border-bottom-color: #fbeed5; } .panel-danger { - border-color: #f0b8c0; + border-color: #eed3d7; } .panel-danger > .panel-heading { color: #d9534f; - background-color: #f9e2e2; - border-color: #f0b8c0; + background-color: #f2dede; + border-color: #eed3d7; } .panel-danger > .panel-heading + .panel-collapse .panel-body { - border-top-color: #f0b8c0; + border-top-color: #eed3d7; } .panel-danger > .panel-footer + .panel-collapse .panel-body { - border-bottom-color: #f0b8c0; + border-bottom-color: #eed3d7; } .well { min-height: 20px; @@ -5040,7 +5024,7 @@ a.list-group-item-danger.active:focus { margin-bottom: 20px; background-color: #f5f5f5; border: 1px solid #e3e3e3; - border-radius: 3px; + border-radius: 0px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); } @@ -5050,11 +5034,11 @@ a.list-group-item-danger.active:focus { } .well-lg { padding: 24px; - border-radius: 4px; + border-radius: 0px; } .well-sm { padding: 9px; - border-radius: 2px; + border-radius: 0px; } .close { float: right; @@ -5121,7 +5105,7 @@ button.close { background-color: #ffffff; border: 1px solid #999999; border: 1px solid rgba(0, 0, 0, 0.2); - border-radius: 4px; + border-radius: 0px; -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5); box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5); background-clip: padding-box; @@ -5231,7 +5215,7 @@ button.close { text-align: center; text-decoration: none; background-color: #000000; - border-radius: 3px; + border-radius: 0px; } .tooltip-arrow { position: absolute; @@ -5305,7 +5289,7 @@ button.close { background-clip: padding-box; border: 1px solid #cccccc; border: 1px solid rgba(0, 0, 0, 0.2); - border-radius: 4px; + border-radius: 0px; -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); white-space: normal; @@ -5570,8 +5554,8 @@ button.close { text-shadow: none; } @media screen and (min-width: 768px) { - .carousel-control .glyphicon-chevron-left, - .carousel-control .glyphicon-chevron-right, + .carousel-control .glyphicons-chevron-left, + .carousel-control .glyphicons-chevron-right, .carousel-control .icon-prev, .carousel-control .icon-next { width: 30px; diff --git a/share/nitdoc/css/nitdoc.cards.css b/share/nitdoc/css/nitdoc.cards.css new file mode 100644 index 0000000000..fc3e5ef289 --- /dev/null +++ b/share/nitdoc/css/nitdoc.cards.css @@ -0,0 +1,68 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* cards */ + +.card.active { + border: 1px solid #1E9431; +} + +.card-heading { + margin-top: 0; + margin-bottom: 5px; +} + +.card { + display: table; + width: 100%; + background: #fff; + border: 1px solid #eee; + margin-top: 10px; + box-shadow: -1px -1px 3px rgba(0,0,0,.06), 1px 1px 3px rgba(0,0,0,.12); +} + +.card-body, .card-left, .card-right { + display: table-cell; + padding: 15px; +} + +.card-body { + padding: 15px 0; + width: 100% +} + +.card-body:first-child { + padding-left: 15px; +} + +.card-body:last-child { + padding-right: 15px; +} + +.card-list { + margin-top: 10px; +} + +.card-list > .card:first-child { + border-top: 1px solid #ddd; +} + +.card-list > .card { + margin-top: 0; + border-top: none; +} + +.card-title { + margin-top: 0; +} diff --git a/share/nitdoc/css/nitdoc.code.css b/share/nitdoc/css/nitdoc.code.css new file mode 100644 index 0000000000..2a944aa93f --- /dev/null +++ b/share/nitdoc/css/nitdoc.code.css @@ -0,0 +1,47 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* Code Highlighting */ + +.nitcode a { color: inherit; text-decoration: inherit; } /* hide links */ +.nitcode a:hover { text-decoration: underline; } /* underline links */ + +/* lexical raw tokens. independent of usage or semantic: */ +.nitcode .nc_c { color: gray; font-style: italic; } /* comment */ +.nitcode .nc_d { color: #3D8127; font-style: italic; } /* documentation comments */ +.nitcode .nc_k { font-weight: bold; } /* keyword */ +.nitcode .nc_o {} /* operator */ +.nitcode .nc_i {} /* standard identifier */ +.nitcode .nc_t { color: #445588; font-weight: bold; } /* type/class identifier */ +.nitcode .nc_a { color: #445588; font-style: italic; } /* old style attribute identifier */ +.nitcode .nc_l { color: #009999; } /* char and number literal */ +.nitcode .nc_s { color: #8F1546; } /* string literal */ + +/* syntactic token usage. added because of their position in the AST */ +.nitcode .nc_ast { color: blue; } /* assert label */ +.nitcode .nc_la { color: blue; } /* break/continue label */ +.nitcode .nc_m { color: #445588; } /* module name */ + +/* syntactic groups */ +.nitcode .nc_def { font-weight: bold; color: blue; } /* name used in a definition */ +.nitcode .nc_def.nc_a { color: blue; } /* name used in a attribute definition */ +.nitcode .nc_def.nc_t { color: blue; } /* name used in a class or vt definition */ +.nitcode .nc_ss { color: #9E6BEB; } /* superstrings */ +.nitcode .nc_cdef {} /* A whole class definition */ +.nitcode .nc_pdef {} /* A whole property definition */ + +/* semantic token usage */ +.nitcode .nc_v { font-style: italic; } /* local variable or parameter */ +.nitcode .nc_vt { font-style: italic; } /* virtual type or formal type */ +.nitcode .nc_error { border: 1px red solid;} /* not used */ diff --git a/share/nitdoc/css/nitdoc.css b/share/nitdoc/css/nitdoc.css index 01da4719b5..81153c7aae 100644 --- a/share/nitdoc/css/nitdoc.css +++ b/share/nitdoc/css/nitdoc.css @@ -1,271 +1,116 @@ /* - * Global + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ -body { - text-align: justify; -} - -a:hover { - text-decoration: none; -} - -ul li .label { - padding: 1px 4px; - font-size: 70%; - vertical-align: middle; - border-radius: .25em; - margin: 3px; - font-family: monospace; -} - -code { - color: #333; - border: 1px solid #ddd; -} +/* Top menu */ -pre code { - border: none; +.navbar-fixed-top { + background-color: #1E9431; + box-shadow: 0 0 4px rgba(0,0,0,.14),0 4px 8px rgba(0,0,0,.28); } -.navbar-default .navbar-toggle { - margin-top: 2px; - padding: 5px 10px; +.navbar-brand > a { + color: #fff; } -h3 { - margin: 10px 0; +.container > .navbar-header, .container-fluid > .navbar-header, .container > .navbar-collapse, .container-fluid > .navbar-collapse { + margin-right: auto; + margin-left: auto; } -article { - padding: 10px 0px; +.navbar-default .navbar-collapse, .navbar-default .navbar-form { + border-color: transparent; } -article.nospace { - padding: 0; - margin: 0; +.navbar-toggle { + float: left; } -/* - * Sidebar - */ +/* Body */ -#sidebar .panel { - margin-top: 15px; - box-shadow: none; -} - -#sidebar .panel-heading { - padding: 3px 0 0 0; - font-size: 16px; -} - -#sidebar .panel-body { - padding: 0; -} - -#sidebar .panel-body ul>li>a { - padding: 0; -} - -#sidebar .panel-body ul>li { - padding: 0 0 0 15px; - font-size: 15px; - color: #333; +body { + background: #f2f2f2; + margin-top: 70px; + margin-bottom: 70px; } -#sidebar .panel-body ul ul>li, -#sidebar .panel-body ul ul>li a { - padding: 0 0 0 0; - font-size: 14px; +h1, h2, h3, h4, h5, h6 { color: #666; } -#sidebar .panel-body ul ul ul>li { - font-size: 13px; - color: #999; +.page-header { + margin-top: 0; + border: none; } -#sidebar .panel-heading a:hover, #sidebar .panel ul a:hover { - color: #0d8921; - background-color: transparent; -} - -#sidebar .summary .nav>li>a { - padding: 3px 0 0 10px; - font-size: 15px; - border-left: 2px solid transparent; - color: #333; -} +#sidebar { margin-top: 15px; } -#sidebar .summary .nav .nav>li>a { - padding-top: 2px; - padding-left: 15px; - font-size: 14px; - color: #666; +pre { + white-space: pre-wrap; } -#sidebar .summary .nav .nav .nav>li>a { - padding-left: 20px; - font-size: 13px; +.footer { color: #999; + text-align: center; + padding: 10px; + margin: 20px 0; } -#sidebar .summary .nav .nav .nav .nav>li>a { - font-size: 12px; - color: #CCC; -} - -#sidebar .summary .nav>.active>a, -#sidebar .summary .nav>.active>a:hover, -#sidebar .summary .nav>li>a:hover { - color: #0d8921; - background-color: transparent; -} - -#sidebar .summary .nav>.active>a, -#sidebar .summary .nav>.active>a:hover, -#sidebar .summary .nav .nav>.active>a, -#sidebar .summary .nav .nav>.active>a:hover, -#sidebar .summary .nav .nav .nav>.active>a, -#sidebar .summary .nav .nav .nav>.active>a:hover { - color: #0d8921; - border-left: 2px solid #0d8921; - margin-left: 0px; -} - -#sidebar .summary .nav>li>a:hover, -#sidebar .summary .nav .nav>li>a:hover, -#sidebar .summary .nav .nav .nav>li>a:hover { - color: #0d8921; - border-left: 1px solid #0d8921; - margin-left: 1px; - background-color: transparent; -} - -/* - * Content - */ - -#content { - position: fixed; - top: 30px; - bottom: 0; - left: 10px; - right: 15px; -} - -#content>.col { - height: 100%; - overflow-y: scroll; -} - -#content>.col::-webkit-scrollbar-thumb { - background: transparent; -} +/* ui */ -#content>.col:hover::-webkit-scrollbar-thumb { - background: #CCC; - -webkit-box-shadow: inset 1px 1px 0 rgba(0,0,0,0.10),inset 0 -1px 0 rgba(0,0,0,0.07); -} +.btn-bar { margin-top: -5px; float: right } +.btn-bar .btn { padding: 5px 10px; } -#content>.col::-webkit-scrollbar { - width: 7px; - height: 7px; -} +/* Doc */ -#content>.col::-webkit-scrollbar-thumb:hover { - background: #999; +.nitdoc > *:first-child { + margin-top: 0; } -#content>.col::-webkit-scrollbar-corner { - background: transparent; +.signature { + color: #777; + font-family: monospace; } -#content>.col::-webkit-scrollbar-button { - width: 0; - height: 0; - display: none; +.signature .name { + font-weight: bold; } -#content article:target { - padding-left: 10px; - margin-left: -10px; - border-left: 2px solid #0d8921; +.page-header .signature .name, .signature .signature .name { + font-weight: normal; } +/* Summary */ -.pull-right .dropdown-toggle { - padding: 0 5px; -} - -/* Hide the "..." link */ +.summary h1 { font-size: 14px; margin: 10px 0 5px 0; font-weight: bold; } +.summary h2 { font-size: 13px; margin: 9px 0 5px 5px; font-weight: bold; } +.summary h3 { font-size: 12px; margin: 8px 0 5px 10px; } +.summary h4 { font-size: 11px; margin: 7px 0 5px 15px; } +.summary h5 { font-size: 10px; margin: 6px 0 5px 20px; } +.summary h6 { font-size: 9px; margin: 5px 0 5px 25px; } -article .dropdown, article .dropdown { - visibility: hidden; -} -article:hover .dropdown, article:target .dropdown { - visibility: visible; -} +.summary a, .summary a:hover { color: #666; } /* - * Page parts + * Nit */ -.footer { - padding: 10px; - margin: 20px 0; -} - -.subtitle { - margin-bottom: 10px; -} - -.label:empty { - display:inline; -} - -.label.intro:before { - content: "I"; -} -.label.redef:before { - content: "R"; -} -.label.inherit:before { - content: "H"; -} - -.signature span.glyphicon { - margin: 0 10px 5px 0; - font-size: 55%; - vertical-align: middle; -} - -.signature a, .list-definition a, .info.signature a { - color: #0d8921; -} - -.info { - color: #888; -} - -.info a { - color: #666; -} - -.info a:hover { +.nitdoc h1, .nitdoc h2, .nitdoc h3, .nitdoc h4, .nitdoc h5, .nitdoc h6 { color: #333; } -.graph { - text-align: center; -} - .nitdoc .synopsys { - margin: 5px 0; - font-size: 16px; - font-weight: bold; - line-height: 1.4; + margin-top: 0; } .public { @@ -279,41 +124,3 @@ article:hover .dropdown, article:target .dropdown { .private { color: #a94442; } - -.list-definition .list-definition { - margin-left: 30px; -} - -/* - * Code Highlighting - */ - -.nitcode a { color: inherit; text-decoration: inherit; } /* hide links */ -.nitcode a:hover { text-decoration: underline; } /* underline links */ -.nitcode span[title]:hover { text-decoration: underline; } /* underline titles */ -/* lexical raw tokens. independent of usage or semantic: */ -.nitcode .nc_c { color: gray; font-style: italic; } /* comment */ -.nitcode .nc_d { color: #3D8127; font-style: italic; } /* documentation comments */ -.nitcode .nc_k { font-weight: bold; } /* keyword */ -.nitcode .nc_o {} /* operator */ -.nitcode .nc_i {} /* standard identifier */ -.nitcode .nc_t { color: #445588; font-weight: bold; } /* type/class identifier */ -.nitcode .nc_a { color: #445588; font-style: italic; } /* old style attribute identifier */ -.nitcode .nc_l { color: #009999; } /* char and number literal */ -.nitcode .nc_s { color: #8F1546; } /* string literal */ -/* syntactic token usage. added because of their position in the AST */ -.nitcode .nc_ast { color: blue; } /* assert label */ -.nitcode .nc_la { color: blue; } /* break/continue label */ -.nitcode .nc_m { color: #445588; } /* module name */ -/* syntactic groups */ -.nitcode .nc_def { font-weight: bold; color: blue; } /* name used in a definition */ -.nitcode .nc_def.nc_a { color: blue; } /* name used in a attribute definition */ -.nitcode .nc_def.nc_t { color: blue; } /* name used in a class or vt definition */ -.nitcode .nc_ss { color: #9E6BEB; } /* superstrings */ -.nitcode .nc_cdef {} /* A whole class definition */ -.nitcode .nc_pdef {} /* A whole property definition */ -/* semantic token usage */ -.nitcode .nc_v { font-style: italic; } /* local variable or parameter */ -.nitcode .nc_vt { font-style: italic; } /* virtual type or formal type */ -.nitcode .nc_error { border: 1px red solid;} /* not used */ - diff --git a/share/nitdoc/css/nitdoc.quicksearch.css b/share/nitdoc/css/nitdoc.quicksearch.css new file mode 100644 index 0000000000..3e306c3eb6 --- /dev/null +++ b/share/nitdoc/css/nitdoc.quicksearch.css @@ -0,0 +1,123 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* Nitdoc Quick Search JS module */ + +.has-icon { + position: relative; +} + +.has-icon .form-control { + padding-left: 35px; +} + +.form-control-icon { + position: absolute; + top: 0; + left: 0; + z-index: 2; + display: block; + width: 34px; + height: 34px; + line-height: 34px; + text-align: center; + pointer-events: none; +} + +.navbar-fixed-top .form-control:hover, .navbar-fixed-top .form-control:focus { + background: rgba(255, 255, 255, 0.2); +} + +.navbar-fixed-top .form-control { + background: rgba(255, 255, 255, 0.1); + border: none; + color: #fff; + box-shadow: none; +} + +.navbar-fixed-top .form-control-icon { + color: #fff; +} + +.navbar-fixed-top .form-group { + margin-top: 8px; + margin-bottom: 0px; +} + +.navbar-fixed-top *::-webkit-input-placeholder { color: #fff; } +.navbar-fixed-top *:-moz-placeholder { color: #fff; } +.navbar-fixed-top *::-moz-placeholder { color: #fff; } +.navbar-fixed-top *:-ms-input-placeholder { color: #fff; } + +.search-input { + width: 100%; +} + +#nitdoc-qs-popup { + background-color: #FFFFFF; + border: 1px solid #E0E0E0; + z-index: 1000; + -webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2); + box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2); +} + +.qs-card { + cursor: pointer; + padding: 5px; + border-bottom: 1px solid #F0F0F0; + overflow: hidden; +} + +.qs-card h1 { + color: #0D8921; + font-size: 1.2em; + margin-top: 5px; + margin-bottom: 0; +} + +.qs-info { + color: #6C6C6C; + font-size: smaller; +} + +.qs-noresult { + color: #6C6C6C; + font-size: small; +} + +.qs-overflow { + text-align: center; + font-size: x-small; + color: #6C6C6C; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.qs-overflow-active { + color: #0D8921; + cursor: pointer; +} + +.qs-overflow-active:hover { + background-color: #E0E0E0; +} + +.qs-active { + background: #EEE; +} diff --git a/share/nitdoc/js/lib/github-api.js b/share/nitdoc/js/lib/github-api.js deleted file mode 100644 index f03188a730..0000000000 --- a/share/nitdoc/js/lib/github-api.js +++ /dev/null @@ -1,295 +0,0 @@ -/* This file is part of NIT ( http://www.nitlanguage.org ). - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - Documentation generator for the nit language. - Generate API documentation in HTML format from nit source code. -*/ - -/* - * GitHub API wrapper for github plugin - */ -define([ - "jquery", - "utils" -], function($, Utils) { - return { - - // try to login the user to github API - login: function(user) { - var res = false; - $.ajax({ - beforeSend: function (xhr) { - xhr.setRequestHeader ("Authorization", user.auth); - }, - type: "GET", - url: "https://api.github.com/repos/" + user.login + "/" + user.repo, - async: false, - dataType: 'json', - success: function() { - res = true; - } - }); - user.infos = this.getUserInfos(user); - user.signedOff = this.getSignedOff(user) - return res; - }, - - // request for user github account infos - getUserInfos: function(user) { - var res = false; - $.ajax({ - beforeSend: function (xhr) { - xhr.setRequestHeader ("Authorization", user.auth); - }, - type: "GET", - url: "https://api.github.com/users/" + user.login, - async: false, - dataType: 'json', - success: function(response) { - res = response; - }, - error: function(response) { - res = response; - } - }); - return res; - }, - - // build signedoff user default signature - getSignedOff: function(user) { - return user.infos.name + " <" + user.infos.email + ">"; - }, - - // get the branches list from a repo - getBranches: function(user) { - var res = false; - $.ajax({ - beforeSend: function (xhr) { - xhr.setRequestHeader ("Authorization", user.auth); - }, - type: "GET", - url: "https://api.github.com/repos/" + user.login + "/" + user.repo + "/branches", - async: false, - dataType: 'json', - success: function(response) { - res = response; - }, - error: function(response) { - res = response; - } - }); - return res; - }, - - /* GitHub commits */ - - // get the latest commit on `branchName` - getCommit: function(user, sha) { - var res = false; - $.ajax({ - beforeSend: function (xhr) { - xhr.setRequestHeader ("Authorization", user.auth); - }, - type: "GET", - url: "https://api.github.com/repos/" + user.login + "/" + user.repo + "/git/commits/" + sha, - async: false, - dataType: 'json', - success: function(response) { - res = response; - }, - error: function(response) { - res = response; - } - }); - return res; - }, - - // get the base tree for a commit sha - getTree: function(user, sha) { - var res = false; - $.ajax({ - beforeSend: function (xhr) { - xhr.setRequestHeader ("Authorization", user.auth); - }, - type: "GET", - url: "https://api.github.com/repos/" + user.login + "/" + user.repo + "/git/trees/" + sha + "?recursive=1", - async: false, - dataType: 'json', - success: function(response) { - res = response; - }, - error: function(response) { - res = response; - } - }); - return res; - }, - - // create a new blob - createBlob: function(user, content) { - var res = false; - $.ajax({ - beforeSend: function (xhr) { - xhr.setRequestHeader ("Authorization", user.auth); - }, - type: "POST", - url: "https://api.github.com/repos/" + user.login + "/" + user.repo + "/git/blobs", - async: false, - dataType: 'json', - data: JSON.stringify({ - content: content.base64Encode(), - encoding: "base64" - }), - success: function(response) { - res = response; - }, - error: function(response) { - res = response; - } - }); - return res; - }, - - // create a new tree from a base tree - createTree: function(user, baseTree, path, blob) { - var res = false; - $.ajax({ - beforeSend: function (xhr) { - xhr.setRequestHeader ("Authorization", user.auth); - }, - type: "POST", - url: "https://api.github.com/repos/" + user.login + "/" + user.repo + "/git/trees", - data: JSON.stringify({ - base_tree: baseTree.sha, - tree: [{ - path: path, - mode: "100644", // file (blob) - type: "blob", - sha: blob.sha - }] - }), - async: false, - dataType: 'json', - success: function(response) { - res = response; - }, - error: function(response) { - res = response; - } - }); - return res; - }, - - // create a new commit - createCommit: function(user, message, parentCommit, tree) { - var res = false; - $.ajax({ - beforeSend: function (xhr) { - xhr.setRequestHeader ("Authorization", user.auth); - }, - type: "POST", - url: "https://api.github.com/repos/" + user.login + "/" + user.repo + "/git/commits", - data: JSON.stringify({ - message: message, - parents: parentCommit, - tree: tree.sha, - }), - async: false, - dataType: 'json', - success: function(response) { - res = response; - }, - error: function(response) { - res = response; - } - }); - return res; - }, - - // create a pull request - createPullRequest: function(user, title, body, origin, head) { - var res = false; - $.ajax({ - beforeSend: function (xhr) { - xhr.setRequestHeader ("Authorization", user.auth); - }, - type: "POST", - url: "https://api.github.com/repos/" + origin.user + "/" + origin.repo + "/pulls", - data: JSON.stringify({ - title: title, - body: body, - base: origin.branch, - head: user.login + ":" + head - }), - async: false, - dataType: 'json', - success: function(response) { - res = response; - }, - error: function(response) { - res = response; - } - }); - return res; - }, - - // update a pull request - updatePullRequest: function(user, title, body, state, request) { - var res = false; - $.ajax({ - beforeSend: function (xhr) { - xhr.setRequestHeader ("Authorization", user.auth); - }, - type: "PATCH", - url: request.url, - data: JSON.stringify({ - title: title, - body: body, - state: state - }), - async: false, - dataType: 'json', - success: function(response) { - res = response; - }, - error: function(response) { - res = response; - } - }); - return res; - }, - - /* Files */ - - getFile: function(user, path, branch) { - var res = false; - $.ajax({ - type: "GET", - url: "https://api.github.com/repos/" + user.login + "/" + user.repo + "/contents/" + path, - data: { - ref: branch - }, - async: false, - dataType: 'json', - success: function(response) { - res = response; - }, - error: function(response) { - res = response; - } - }); - return res; - } - } -}); diff --git a/share/nitdoc/js/lib/highlight.js b/share/nitdoc/js/lib/highlight.js deleted file mode 100644 index bd277eef1a..0000000000 --- a/share/nitdoc/js/lib/highlight.js +++ /dev/null @@ -1,715 +0,0 @@ -/* Copyright (c) 2006, Ivan Sagalaev - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of highlight.js nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -var hljs = new function() { - - /* Utility functions */ - - function escape(value) { - return value.replace(/&/gm, '&').replace(//gm, '>'); - } - - function tag(node) { - return node.nodeName.toLowerCase(); - } - - function testRe(re, lexeme) { - var match = re && re.exec(lexeme); - return match && match.index == 0; - } - - function blockLanguage(block) { - var classes = (block.className + ' ' + (block.parentNode ? block.parentNode.className : '')).split(/\s+/); - classes = classes.map(function(c) {return c.replace(/^lang(uage)?-/, '');}); - return classes.filter(function(c) {return getLanguage(c) || c == 'no-highlight';})[0]; - } - - function inherit(parent, obj) { - var result = {}; - for (var key in parent) - result[key] = parent[key]; - if (obj) - for (var key in obj) - result[key] = obj[key]; - return result; - }; - - /* Stream merging */ - - function nodeStream(node) { - var result = []; - (function _nodeStream(node, offset) { - for (var child = node.firstChild; child; child = child.nextSibling) { - if (child.nodeType == 3) - offset += child.nodeValue.length; - else if (tag(child) == 'br') - offset += 1; - else if (child.nodeType == 1) { - result.push({ - event: 'start', - offset: offset, - node: child - }); - offset = _nodeStream(child, offset); - result.push({ - event: 'stop', - offset: offset, - node: child - }); - } - } - return offset; - })(node, 0); - return result; - } - - function mergeStreams(original, highlighted, value) { - var processed = 0; - var result = ''; - var nodeStack = []; - - function selectStream() { - if (!original.length || !highlighted.length) { - return original.length ? original : highlighted; - } - if (original[0].offset != highlighted[0].offset) { - return (original[0].offset < highlighted[0].offset) ? original : highlighted; - } - - /* - To avoid starting the stream just before it should stop the order is - ensured that original always starts first and closes last: - - if (event1 == 'start' && event2 == 'start') - return original; - if (event1 == 'start' && event2 == 'stop') - return highlighted; - if (event1 == 'stop' && event2 == 'start') - return original; - if (event1 == 'stop' && event2 == 'stop') - return highlighted; - - ... which is collapsed to: - */ - return highlighted[0].event == 'start' ? original : highlighted; - } - - function open(node) { - function attr_str(a) {return ' ' + a.nodeName + '="' + escape(a.value) + '"';} - result += '<' + tag(node) + Array.prototype.map.call(node.attributes, attr_str).join('') + '>'; - } - - function close(node) { - result += ''; - } - - function render(event) { - (event.event == 'start' ? open : close)(event.node); - } - - while (original.length || highlighted.length) { - var stream = selectStream(); - result += escape(value.substr(processed, stream[0].offset - processed)); - processed = stream[0].offset; - if (stream == original) { - /* - On any opening or closing tag of the original markup we first close - the entire highlighted node stack, then render the original tag along - with all the following original tags at the same offset and then - reopen all the tags on the highlighted stack. - */ - nodeStack.reverse().forEach(close); - do { - render(stream.splice(0, 1)[0]); - stream = selectStream(); - } while (stream == original && stream.length && stream[0].offset == processed); - nodeStack.reverse().forEach(open); - } else { - if (stream[0].event == 'start') { - nodeStack.push(stream[0].node); - } else { - nodeStack.pop(); - } - render(stream.splice(0, 1)[0]); - } - } - return result + escape(value.substr(processed)); - } - - /* Initialization */ - - function compileLanguage(language) { - - function reStr(re) { - return (re && re.source) || re; - } - - function langRe(value, global) { - return RegExp( - reStr(value), - 'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '') - ); - } - - function compileMode(mode, parent) { - if (mode.compiled) - return; - mode.compiled = true; - - mode.keywords = mode.keywords || mode.beginKeywords; - if (mode.keywords) { - var compiled_keywords = {}; - - function flatten(className, str) { - if (language.case_insensitive) { - str = str.toLowerCase(); - } - str.split(' ').forEach(function(kw) { - var pair = kw.split('|'); - compiled_keywords[pair[0]] = [className, pair[1] ? Number(pair[1]) : 1]; - }); - } - - if (typeof mode.keywords == 'string') { // string - flatten('keyword', mode.keywords); - } else { - Object.keys(mode.keywords).forEach(function (className) { - flatten(className, mode.keywords[className]); - }); - } - mode.keywords = compiled_keywords; - } - mode.lexemesRe = langRe(mode.lexemes || /\b[A-Za-z0-9_]+\b/, true); - - if (parent) { - if (mode.beginKeywords) { - mode.begin = '\\b(' + mode.beginKeywords.split(' ').join('|') + ')\\b'; - } - if (!mode.begin) - mode.begin = /\B|\b/; - mode.beginRe = langRe(mode.begin); - if (!mode.end && !mode.endsWithParent) - mode.end = /\B|\b/; - if (mode.end) - mode.endRe = langRe(mode.end); - mode.terminator_end = reStr(mode.end) || ''; - if (mode.endsWithParent && parent.terminator_end) - mode.terminator_end += (mode.end ? '|' : '') + parent.terminator_end; - } - if (mode.illegal) - mode.illegalRe = langRe(mode.illegal); - if (mode.relevance === undefined) - mode.relevance = 1; - if (!mode.contains) { - mode.contains = []; - } - var expanded_contains = []; - mode.contains.forEach(function(c) { - if (c.variants) { - c.variants.forEach(function(v) {expanded_contains.push(inherit(c, v));}); - } else { - expanded_contains.push(c == 'self' ? mode : c); - } - }); - mode.contains = expanded_contains; - mode.contains.forEach(function(c) {compileMode(c, mode);}); - - if (mode.starts) { - compileMode(mode.starts, parent); - } - - var terminators = - mode.contains.map(function(c) { - return c.beginKeywords ? '\\.?(' + c.begin + ')\\.?' : c.begin; - }) - .concat([mode.terminator_end, mode.illegal]) - .map(reStr) - .filter(Boolean); - mode.terminators = terminators.length ? langRe(terminators.join('|'), true) : {exec: function(s) {return null;}}; - - mode.continuation = {}; - } - - compileMode(language); - } - - /* - Core highlighting function. Accepts a language name, or an alias, and a - string with the code to highlight. Returns an object with the following - properties: - - - relevance (int) - - value (an HTML string with highlighting markup) - - */ - function highlight(name, value, ignore_illegals, continuation) { - - function subMode(lexeme, mode) { - for (var i = 0; i < mode.contains.length; i++) { - if (testRe(mode.contains[i].beginRe, lexeme)) { - return mode.contains[i]; - } - } - } - - function endOfMode(mode, lexeme) { - if (testRe(mode.endRe, lexeme)) { - return mode; - } - if (mode.endsWithParent) { - return endOfMode(mode.parent, lexeme); - } - } - - function isIllegal(lexeme, mode) { - return !ignore_illegals && testRe(mode.illegalRe, lexeme); - } - - function keywordMatch(mode, match) { - var match_str = language.case_insensitive ? match[0].toLowerCase() : match[0]; - return mode.keywords.hasOwnProperty(match_str) && mode.keywords[match_str]; - } - - function buildSpan(classname, insideSpan, leaveOpen, noPrefix) { - var classPrefix = noPrefix ? '' : options.classPrefix, - openSpan = ''; - - return openSpan + insideSpan + closeSpan; - } - - function processKeywords() { - if (!top.keywords) - return escape(mode_buffer); - var result = ''; - var last_index = 0; - top.lexemesRe.lastIndex = 0; - var match = top.lexemesRe.exec(mode_buffer); - while (match) { - result += escape(mode_buffer.substr(last_index, match.index - last_index)); - var keyword_match = keywordMatch(top, match); - if (keyword_match) { - relevance += keyword_match[1]; - result += buildSpan(keyword_match[0], escape(match[0])); - } else { - result += escape(match[0]); - } - last_index = top.lexemesRe.lastIndex; - match = top.lexemesRe.exec(mode_buffer); - } - return result + escape(mode_buffer.substr(last_index)); - } - - function processSubLanguage() { - if (top.subLanguage && !languages[top.subLanguage]) { - return escape(mode_buffer); - } - var result = top.subLanguage ? highlight(top.subLanguage, mode_buffer, true, top.continuation.top) : highlightAuto(mode_buffer); - // Counting embedded language score towards the host language may be disabled - // with zeroing the containing mode relevance. Usecase in point is Markdown that - // allows XML everywhere and makes every XML snippet to have a much larger Markdown - // score. - if (top.relevance > 0) { - relevance += result.relevance; - } - if (top.subLanguageMode == 'continuous') { - top.continuation.top = result.top; - } - return buildSpan(result.language, result.value, false, true); - } - - function processBuffer() { - return top.subLanguage !== undefined ? processSubLanguage() : processKeywords(); - } - - function startNewMode(mode, lexeme) { - var markup = mode.className? buildSpan(mode.className, '', true): ''; - if (mode.returnBegin) { - result += markup; - mode_buffer = ''; - } else if (mode.excludeBegin) { - result += escape(lexeme) + markup; - mode_buffer = ''; - } else { - result += markup; - mode_buffer = lexeme; - } - top = Object.create(mode, {parent: {value: top}}); - } - - function processLexeme(buffer, lexeme) { - - mode_buffer += buffer; - if (lexeme === undefined) { - result += processBuffer(); - return 0; - } - - var new_mode = subMode(lexeme, top); - if (new_mode) { - result += processBuffer(); - startNewMode(new_mode, lexeme); - return new_mode.returnBegin ? 0 : lexeme.length; - } - - var end_mode = endOfMode(top, lexeme); - if (end_mode) { - var origin = top; - if (!(origin.returnEnd || origin.excludeEnd)) { - mode_buffer += lexeme; - } - result += processBuffer(); - do { - if (top.className) { - result += ''; - } - relevance += top.relevance; - top = top.parent; - } while (top != end_mode.parent); - if (origin.excludeEnd) { - result += escape(lexeme); - } - mode_buffer = ''; - if (end_mode.starts) { - startNewMode(end_mode.starts, ''); - } - return origin.returnEnd ? 0 : lexeme.length; - } - - if (isIllegal(lexeme, top)) - throw new Error('Illegal lexeme "' + lexeme + '" for mode "' + (top.className || '') + '"'); - - /* - Parser should not reach this point as all types of lexemes should be caught - earlier, but if it does due to some bug make sure it advances at least one - character forward to prevent infinite looping. - */ - mode_buffer += lexeme; - return lexeme.length || 1; - } - - var language = getLanguage(name); - if (!language) { - throw new Error('Unknown language: "' + name + '"'); - } - - compileLanguage(language); - var top = continuation || language; - var result = ''; - for(var current = top; current != language; current = current.parent) { - if (current.className) { - result += buildSpan(current.className, result, true); - } - } - var mode_buffer = ''; - var relevance = 0; - try { - var match, count, index = 0; - while (true) { - top.terminators.lastIndex = index; - match = top.terminators.exec(value); - if (!match) - break; - count = processLexeme(value.substr(index, match.index - index), match[0]); - index = match.index + count; - } - processLexeme(value.substr(index)); - for(var current = top; current.parent; current = current.parent) { // close dangling modes - if (current.className) { - result += ''; - } - }; - return { - relevance: relevance, - value: result, - language: name, - top: top - }; - } catch (e) { - if (e.message.indexOf('Illegal') != -1) { - return { - relevance: 0, - value: escape(value) - }; - } else { - throw e; - } - } - } - - /* - Highlighting with language detection. Accepts a string with the code to - highlight. Returns an object with the following properties: - - - language (detected language) - - relevance (int) - - value (an HTML string with highlighting markup) - - second_best (object with the same structure for second-best heuristically - detected language, may be absent) - - */ - function highlightAuto(text, languageSubset) { - languageSubset = languageSubset || options.languages || Object.keys(languages); - var result = { - relevance: 0, - value: escape(text) - }; - var second_best = result; - languageSubset.forEach(function(name) { - if (!getLanguage(name)) { - return; - } - var current = highlight(name, text, false); - current.language = name; - if (current.relevance > second_best.relevance) { - second_best = current; - } - if (current.relevance > result.relevance) { - second_best = result; - result = current; - } - }); - if (second_best.language) { - result.second_best = second_best; - } - return result; - } - - /* - Post-processing of the highlighted markup: - - - replace TABs with something more useful - - replace real line-breaks with '
' for non-pre containers - - */ - function fixMarkup(value) { - if (options.tabReplace) { - value = value.replace(/^((<[^>]+>|\t)+)/gm, function(match, p1, offset, s) { - return p1.replace(/\t/g, options.tabReplace); - }); - } - if (options.useBR) { - value = value.replace(/\n/g, '
'); - } - return value; - } - - /* - Applies highlighting to a DOM node containing code. Accepts a DOM node and - two optional parameters for fixMarkup. - */ - function highlightBlock(block) { - var text = options.useBR ? block.innerHTML - .replace(/\n/g,'').replace(/
|
]*>/g, '\n').replace(/<[^>]*>/g,'') - : block.textContent; - var language = blockLanguage(block); - if (language == 'no-highlight') - return; - var result = language ? highlight(language, text, true) : highlightAuto(text); - var original = nodeStream(block); - if (original.length) { - var pre = document.createElementNS('http://www.w3.org/1999/xhtml', 'pre'); - pre.innerHTML = result.value; - result.value = mergeStreams(original, nodeStream(pre), text); - } - result.value = fixMarkup(result.value); - - block.innerHTML = result.value; - block.className += ' hljs ' + (!language && result.language || ''); - block.result = { - language: result.language, - re: result.relevance - }; - if (result.second_best) { - block.second_best = { - language: result.second_best.language, - re: result.second_best.relevance - }; - } - } - - var options = { - classPrefix: 'hljs-', - tabReplace: null, - useBR: false, - languages: undefined - }; - - /* - Updates highlight.js global options with values passed in the form of an object - */ - function configure(user_options) { - options = inherit(options, user_options); - } - - /* - Applies highlighting to all
..
blocks on a page. - */ - function initHighlighting() { - if (initHighlighting.called) - return; - initHighlighting.called = true; - - var blocks = document.querySelectorAll('pre code'); - Array.prototype.forEach.call(blocks, highlightBlock); - } - - /* - Attaches highlighting to the page load event. - */ - function initHighlightingOnLoad() { - addEventListener('DOMContentLoaded', initHighlighting, false); - addEventListener('load', initHighlighting, false); - } - - var languages = {}; - var aliases = {}; - - function registerLanguage(name, language) { - var lang = languages[name] = language(this); - if (lang.aliases) { - lang.aliases.forEach(function(alias) {aliases[alias] = name;}); - } - } - - function listLanguages() { - return Object.keys(languages); - } - - function getLanguage(name) { - return languages[name] || languages[aliases[name]]; - } - - /* Interface definition */ - - this.highlight = highlight; - this.highlightAuto = highlightAuto; - this.fixMarkup = fixMarkup; - this.highlightBlock = highlightBlock; - this.configure = configure; - this.initHighlighting = initHighlighting; - this.initHighlightingOnLoad = initHighlightingOnLoad; - this.registerLanguage = registerLanguage; - this.listLanguages = listLanguages; - this.getLanguage = getLanguage; - this.inherit = inherit; - - // Common regexps - this.IDENT_RE = '[a-zA-Z][a-zA-Z0-9_]*'; - this.UNDERSCORE_IDENT_RE = '[a-zA-Z_][a-zA-Z0-9_]*'; - this.NUMBER_RE = '\\b\\d+(\\.\\d+)?'; - this.C_NUMBER_RE = '(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)'; // 0x..., 0..., decimal, float - this.BINARY_NUMBER_RE = '\\b(0b[01]+)'; // 0b... - this.RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~'; - - // Common modes - this.BACKSLASH_ESCAPE = { - begin: '\\\\[\\s\\S]', relevance: 0 - }; - this.APOS_STRING_MODE = { - className: 'string', - begin: '\'', end: '\'', - illegal: '\\n', - contains: [this.BACKSLASH_ESCAPE] - }; - this.QUOTE_STRING_MODE = { - className: 'string', - begin: '"', end: '"', - illegal: '\\n', - contains: [this.BACKSLASH_ESCAPE] - }; - this.PHRASAL_WORDS_MODE = { - begin: /\b(a|an|the|are|I|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such)\b/ - }; - this.C_LINE_COMMENT_MODE = { - className: 'comment', - begin: '//', end: '$', - contains: [this.PHRASAL_WORDS_MODE] - }; - this.C_BLOCK_COMMENT_MODE = { - className: 'comment', - begin: '/\\*', end: '\\*/', - contains: [this.PHRASAL_WORDS_MODE] - }; - this.HASH_COMMENT_MODE = { - className: 'comment', - begin: '#', end: '$', - contains: [this.PHRASAL_WORDS_MODE] - }; - this.NUMBER_MODE = { - className: 'number', - begin: this.NUMBER_RE, - relevance: 0 - }; - this.C_NUMBER_MODE = { - className: 'number', - begin: this.C_NUMBER_RE, - relevance: 0 - }; - this.BINARY_NUMBER_MODE = { - className: 'number', - begin: this.BINARY_NUMBER_RE, - relevance: 0 - }; - this.CSS_NUMBER_MODE = { - className: 'number', - begin: this.NUMBER_RE + '(' + - '%|em|ex|ch|rem' + - '|vw|vh|vmin|vmax' + - '|cm|mm|in|pt|pc|px' + - '|deg|grad|rad|turn' + - '|s|ms' + - '|Hz|kHz' + - '|dpi|dpcm|dppx' + - ')?', - relevance: 0 - }; - this.REGEXP_MODE = { - className: 'regexp', - begin: /\//, end: /\/[gim]*/, - illegal: /\n/, - contains: [ - this.BACKSLASH_ESCAPE, - { - begin: /\[/, end: /\]/, - relevance: 0, - contains: [this.BACKSLASH_ESCAPE] - } - ] - }; - this.TITLE_MODE = { - className: 'title', - begin: this.IDENT_RE, - relevance: 0 - }; - this.UNDERSCORE_TITLE_MODE = { - className: 'title', - begin: this.UNDERSCORE_IDENT_RE, - relevance: 0 - }; -}; diff --git a/share/nitdoc/js/lib/nit.js b/share/nitdoc/js/lib/nit.js deleted file mode 100644 index 1b4aff3592..0000000000 --- a/share/nitdoc/js/lib/nit.js +++ /dev/null @@ -1,144 +0,0 @@ -/* This file is part of NIT ( http://www.nitlanguage.org ). - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - Documentation generator for the nit language. - Generate API documentation in HTML format from nit source code. -*/ - -hljs.registerLanguage('nit', function(hljs) { - var METHOD_RE = '[a-z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?'; - var KEYWORDS = { - keyword: 'abort abstract and as assert break class continue do else end enum extern for fun ' + - 'if import in init interface intern intrude is isa isset label loop module new nullable not ' + - 'once or protected private redef return self super then type universal var ' + - 'when while writable', - literal: "true false null" - }; - var COMMENT = { - className: 'comment', - begin: '#', end: '$', - }; - var SUBST = { - className: 'subst', - begin: '{', end: '}', - keywords: KEYWORDS - }; - var STRING = { - className: 'string', - contains: [hljs.BACKSLASH_ESCAPE, SUBST], - variants: [ - {begin: /"/, end: /"/}, - ] - }; - var CHAR = { - className: 'char', - contains: [hljs.BACKSLASH_ESCAPE, SUBST], - begin: /'/, end: /'/, - }; - var TYPE = { - className: 'type', - begin: '[A-Z]\\w*' - } - var PARAMS = { - className: 'params', - begin: '\\(', end: '\\)', - keywords: KEYWORDS, - contains: [TYPE] - }; - var RET_TYPE = { - className: 'rettype', - begin: ':', end: '$|do|is|=', - keywords: 'nullable', - returnEnd: true, - contains: [TYPE] - } - var DO_BLOCK = { - className: 'block', - begin: 'do', end: '$|end', - keywords: KEYWORDS - } - var IS_BLOCK = { - className: 'modifiers', - begin: 'is', end: '$', - keywords: KEYWORDS - } - var CONTAINS = [ - STRING, - CHAR, - COMMENT, - TYPE, - { - className: 'module', - beginKeywords: 'module', end: '$', - contains: [ - hljs.inherit(hljs.TITLE_MODE, {begin: '[a-z_]\\w*'}), - COMMENT - ] - }, - { - className: 'import', - begin: '(intrude )?import', end: '$', - keywords: 'intrude import', - contains: [ - { - className: 'module', - begin: '[a-z_]\\w*' - }, - COMMENT - ] - }, - { - className: 'class', - begin: '(redef |private |protected )?(abstract )?(class|interface)', end: '$', - keywords: 'redef private protected abstract class interface', - contains: [ - hljs.inherit(hljs.TITLE_MODE, {begin: '[A-Z]\\w*'}), - { - className: 'super', - begin: '\\bsuper', end: '$', - keywords: 'super', - contains: [TYPE] - }, - COMMENT - ] - }, - { - className: 'fun', - begin: '(redef |private |protected )?(fun|init|type)\\b', end: '$', - keywords: KEYWORDS, - contains: [ - PARAMS, - RET_TYPE, - DO_BLOCK, - IS_BLOCK, - { - className: 'title', - begin: '\\b[a-zA-Z_][a-zA-Z_]*\\b' - }, - COMMENT - ] - }, - { - className: 'number', - begin: '(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b', - relevance: 0 - } - ]; - SUBST.contains = CONTAINS; - - return { - keywords: KEYWORDS, - contains: CONTAINS - }; -}); diff --git a/share/nitdoc/js/lib/utils.js b/share/nitdoc/js/lib/utils.js deleted file mode 100644 index 26304d884d..0000000000 --- a/share/nitdoc/js/lib/utils.js +++ /dev/null @@ -1,204 +0,0 @@ -/* This file is part of NIT ( http://www.nitlanguage.org ). - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - Documentation generator for the nit language. - Generate API documentation in HTML format from nit source code. -*/ - -/* - * Utils module - */ -String.prototype.startsWith = function(prefix, caseSensitive) { - if(caseSensitive) { - return this.toUpperCase().indexOf(prefix.toUpperCase()) === 0; - } - return this.indexOf(prefix) === 0; -} - -// Compare two strings using Sorensen-Dice Coefficient -// see: http://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient -String.prototype.dice = function(other) { - var length1 = this.length - 1; - var length2 = other.length - 1; - if(length1 < 1 || length2 < 1) return 0; - - var bigrams2 = []; - for(var i = 0; i < length2; i++) { - bigrams2.push(other.substr(i, 2)); - } - - var intersection = 0; - for(var i = 0; i < length1; i++) { - var bigram1 = this.substr(i, 2); - for(var j = 0; j < length2; j++) { - if(bigram1 == bigrams2[j]) { - intersection++; - bigrams2[j] = null; - break; - } - } - } - return (2.0 * intersection) / (length1 + length2); -} - -/* base64 */ - -String.prototype._keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - -// public method for encoding -String.prototype.base64Encode = function () { - var output = ""; - var chr1, chr2, chr3, enc1, enc2, enc3, enc4; - var i = 0; - - input = this._utf8_encode(); - - while (i < input.length) { - - chr1 = input.charCodeAt(i++); - chr2 = input.charCodeAt(i++); - chr3 = input.charCodeAt(i++); - - enc1 = chr1 >> 2; - enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); - enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); - enc4 = chr3 & 63; - - if (isNaN(chr2)) { - enc3 = enc4 = 64; - } else if (isNaN(chr3)) { - enc4 = 64; - } - - output = output + - this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + - this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); - - } - return output; -}; - -// public method for decoding -String.prototype.base64Decode = function () { - var output = ""; - var chr1, chr2, chr3; - var enc1, enc2, enc3, enc4; - var i = 0; - - input = this.replace(/[^A-Za-z0-9\+\/\=]/g, ""); - - while (i < input.length) { - - enc1 = this._keyStr.indexOf(input.charAt(i++)); - enc2 = this._keyStr.indexOf(input.charAt(i++)); - enc3 = this._keyStr.indexOf(input.charAt(i++)); - enc4 = this._keyStr.indexOf(input.charAt(i++)); - - chr1 = (enc1 << 2) | (enc2 >> 4); - chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); - chr3 = ((enc3 & 3) << 6) | enc4; - - output = output + String.fromCharCode(chr1); - - if (enc3 != 64) { - output = output + String.fromCharCode(chr2); - } - if (enc4 != 64) { - output = output + String.fromCharCode(chr3); - } - - } - return output._utf8_decode();; -}; - -// private method for UTF-8 encoding -String.prototype._utf8_encode = function () { - string = this.replace(/\r\n/g,"\n"); - var utftext = ""; - - for (var n = 0; n < string.length; n++) { - - var c = string.charCodeAt(n); - - if (c < 128) { - utftext += String.fromCharCode(c); - } - else if((c > 127) && (c < 2048)) { - utftext += String.fromCharCode((c >> 6) | 192); - utftext += String.fromCharCode((c & 63) | 128); - } - else { - utftext += String.fromCharCode((c >> 12) | 224); - utftext += String.fromCharCode(((c >> 6) & 63) | 128); - utftext += String.fromCharCode((c & 63) | 128); - } - - } - return utftext; -}; - -// private method for UTF-8 decoding -String.prototype._utf8_decode = function () { - var string = ""; - var i = 0; - var c = c1 = c2 = 0; - - while ( i < this.length ) { - - c = this.charCodeAt(i); - - if (c < 128) { - string += String.fromCharCode(c); - i++; - } - else if((c > 191) && (c < 224)) { - c2 = this.charCodeAt(i+1); - string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); - i += 2; - } - else { - c2 = this.charCodeAt(i+1); - c3 = this.charCodeAt(i+2); - string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); - i += 3; - } - - } - return string; -}; - -// JQuery Case Insensitive :icontains selector -$.expr[':'].icontains = function(obj, index, meta, stack){ - return (obj.textContent.replace(/\[[0-9]+\]/g, "") || obj.innerText.replace(/\[[0-9]+\]/g, "") || jQuery(obj).text().replace(/\[[0-9]+\]/g, "") || '').toLowerCase().indexOf(meta[3].toLowerCase()) >= 0; -}; - -var Utils = { - // Extract anchor part (after #) from URL string - extractAnchor: function(url) { - var index = url.indexOf("#"); - if (index >= 0) { - return url.substring(index + 1); - } - return null; - }, - - delayEvent: function(handler, event) { - if(this.delayEvent.timeout) { - clearTimeout(this.delayEvent.timeout); - } - this.delayEvent.timeout = setTimeout(function() { - handler.call(event); - }, 50); - } -}; diff --git a/share/nitdoc/js/nitdoc.quicksearch.js b/share/nitdoc/js/nitdoc.quicksearch.js new file mode 100644 index 0000000000..746d2e6d1f --- /dev/null +++ b/share/nitdoc/js/nitdoc.quicksearch.js @@ -0,0 +1,384 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* Nitdoc QuickSearch widget */ + +$.widget("nitdoc.quicksearch", { + + options: { + list: {}, // List of raw results generated by nitdoc tool + fieldAttrs: { + autocomplete: "off", + }, + maxSize: 10 + }, + + _create: function() { + // set widget options + this.element.attr(this.options.fieldAttrs); + // event dispatch + this._on(this.element, { + "keydown": this._doKeyDown, + "keyup": this._doKeyUp, + "input": this._doInput + }); + // add result table element once + this._popup = $("
") + .attr("id", "nitdoc-qs-popup") + .css("position", "absolute") + .css("z-index", 10000) + .hide(); + $("body").append(this._popup); + // make table disappear when a click occurs outside + $(document).click($.proxy(this.close, this)); + this._autosizeTable(); + }, + + /* events */ + + _doKeyDown: function(event) { + switch(event.keyCode) { + case 38: // Up + this._selectPrev(); + return false; + case 40: // Down + this._selectNext(); + return false; + default: + return true; + } + }, + + _doKeyUp: function(event) { + switch(event.keyCode) { + case 38: // Up + case 40: // Down + break; + case 13: // Enter + this._loadResult(); + return false; + case 27: // Escape + this.element.blur(); + this.close(); + return true; + default: // Other keys + return true; + } + }, + + _doInput: function(event) { + Utils.delayEvent($.proxy(this.search, this)); + }, + + /* Result lookup */ + + _getResults: function(query) { + var results = []; + + // Prefix matches + var prefix_matches = []; + for(var entry in this.options.list) { + if(!entry.startsWith(query, true)) { + continue; + } + var cat = { + name: entry, + entries: this.options.list[entry] + }; + prefix_matches.push(cat); + + if(entry == query) { + cat.rank = 10; + } else if(entry.toUpperCase() == query.toUpperCase()) { + cat.rank = 5; + } else if(entry[0] == query[0]) { + cat.rank = 1.1 + query.dice(entry); + } else { + cat.rank = 1 + query.dice(entry); + } + } + if(prefix_matches.length > 0) { + prefix_matches.sort(this._rankSorter); + for(var i in prefix_matches) { + var cat = prefix_matches[i]; + for(var j in cat.entries) { + var entry = cat.entries[j]; + entry.name = cat.name; + results.push(entry); + } + } + return results; + } + + // Partial matches + var partial_matches = []; + for(var entry in this.options.list) { + var cat = { + name: entry, + entries: this.options.list[entry] + } + cat.rank = query.dice(entry); + if(cat.rank > 0) { + partial_matches.push(cat); + } + } + if(partial_matches.length > 0) { + partial_matches.sort(this._rankSorter); + for(var i in partial_matches) { + var cat = partial_matches[i]; + for(var j in cat.entries) { + var entry = cat.entries[j]; + entry.name = cat.name; + results.push(entry); + } + } + } + + return results; + }, + + _rankSorter: function(a, b){ + if(a.rank < b.rank) { + return 1; + } else if(a.rank > b.rank) { + return -1; + } + return 0; + }, + + /* Results table */ + + search: function() { + var query = this.element.val(); + if(query) { + var results = this._getResults(query); + this.open(query, results); + } + }, + + open: function(query, results) { + this._popup.empty(); + this._cards = []; + this._index = -1; + + if(results.length == 0) { + this.addNoResultCard(); + } + + if(results.length >= this.options.maxSize) { + this.addOverflowUp(false); + } + + for(var i in results) { + var result = results[i]; + this.addCard(result.name, result.txt, result.url, this.options.rowCatClass) + } + + if(results.length >= this.options.maxSize) { + this.addOverflowDown(true); + } + + if(results.length > 0) { + this._setIndex(0); + } + + this._popup.show(); + this._autosizeTable(); + }, + + close: function(target) { + if(target != this.element && target != this._popup) { + this._popup.hide(); + } + }, + + addCard: function(name, txt, url, cls) { + var card = $("
") + .addClass("qs-card") + .addClass("qs-result") + .data("searchDetails", {name: name, url: url}) + .data("index", this._cards.length) + .append( + $("

") + .html(name) + .addClass(cls) + ) + .append( + $("") + .html(txt) + .addClass("qs-info") + ) + .mouseover($.proxy(this._mouseOverRow, this)) + .click($.proxy(this._clickRow, this)) + this._cards.push(card); + if(this._cards.length >= this.options.maxSize) { + card.hide(); + } + this._popup.append(card); + }, + + addOverflowUp: function(active) { + this._popup.append( + $("
") + .addClass("qs-overflow") + .addClass("qs-overflow-up") + .addClass(active ? "qs-overflow-active": "") + .html("▲") + .click($.proxy(this._clickPrev, this)) + ); + }, + + addOverflowDown: function(active) { + this._popup.append( + $("
") + .addClass("qs-overflow") + .addClass("qs-overflow-down") + .addClass(active ? "qs-overflow-active": "") + .html("▼") + .click($.proxy(this._clickNext, this)) + ); + }, + + addNoResultCard: function() { + var card = $("
") + .addClass("qs-card qs-noresult") + .html("Sorry, there is no match..."); + this._popup.append(card); + }, + + _autosizeTable: function() { + this._popup.position({ + my: "left top", + at: "left bottom", + of: this.element + }); + this._popup + .css("min-width", this.element.outerWidth()) + .css("max-width", this.element.outerWidth()); + }, + + _hasIndex: function(index) { + return index >= 0 && index < this._cards.length; + }, + + _hasPrev: function(index) { + return index - 1 >= 0; + }, + + _hasNext: function(index) { + return index + 1 < this._cards.length; + }, + + _setIndex: function(index) { + if(this._hasIndex(this._index)) { + this._cards[this._index].removeClass("qs-active"); + } + this._index = index; + if(this._hasIndex(this._index)) { + this._cards[this._index].addClass("qs-active"); + } + }, + + _selectPrev: function() { + if(this._hasPrev(this._index)) { + this._setIndex(this._index - 1); + if(!this._cards[this._index].is(":visible")) { + this._popup.find(".qs-result:visible").last().hide(); + this._popup.find(".qs-overflow-down").addClass("qs-overflow-active"); + this._cards[this._index].show(); + if(!this._hasPrev(this._index)) { + this._popup.find(".qs-overflow-up").removeClass("qs-overflow-active"); + } + } + } else { + } + }, + + _selectNext: function() { + if(this._hasNext(this._index)) { + this._setIndex(this._index + 1); + if(!this._cards[this._index].is(":visible")) { + this._popup.find(".qs-result:visible").first().hide(); + this._popup.find(".qs-overflow-up").addClass("qs-overflow-active"); + this._cards[this._index].show(); + if(!this._hasNext(this._index)) { + this._popup.find(".qs-overflow-down").removeClass("qs-overflow-active"); + } + } + } + }, + + // Load selected search result page + _loadResult: function() { + if(this._index > -1) { + window.location = this._cards[this._index].data("searchDetails").url; + return; + } + if(this.element.val().length == 0) { return; } + + window.location = this.options.gotoPage + "#q=" + this.element.val(); + if(window.location.href.indexOf(this.options.gotoPage) > -1) { + location.reload(); + } + }, + + /* table events */ + + _clickNext: function(event) { + event.stopPropagation(); + this._selectNext(); + }, + + _clickPrev: function(event) { + event.stopPropagation(); + this._selectPrev(); + }, + + _clickRow: function(event) { + window.location = $(event.currentTarget).data("searchDetails")["url"]; + }, + + _mouseOverRow: function(event) { + this._setIndex($(event.currentTarget).data("index")); + } +}); + +var searchField = $("") +.addClass("form-control search-input") +.attr({ + id: "nitdoc-qs-field", + type: "text", + placeholder: "Search..." +}) + +$("#search-placeholder").append( + $("
") + .addClass("navbar-form navbar-right") + .on("submit", function() { return false; }) + .css("margin-bottom", 0) + .css("margin-top", 0) + .append( + $("
") + .addClass("form-group has-icon") + .append(searchField) + .append( + $("") + .addClass("glyphicon glyphicon-search form-control-icon text-muted") + ) + ) +); + +searchField.quicksearch({ + list: this.nitdocQuickSearchRawList +}); diff --git a/share/nitdoc/js/nitdoc.utils.js b/share/nitdoc/js/nitdoc.utils.js new file mode 100644 index 0000000000..ac19c29cf0 --- /dev/null +++ b/share/nitdoc/js/nitdoc.utils.js @@ -0,0 +1,109 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* Utils module */ + +String.prototype.startsWith = function(prefix, caseSensitive) { + if(caseSensitive) { + return this.toUpperCase().indexOf(prefix.toUpperCase()) === 0; + } + return this.indexOf(prefix) === 0; +} + +// Compare two strings using Sorensen-Dice Coefficient +// see: http://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient +String.prototype.dice = function(other) { + var length1 = this.length - 1; + var length2 = other.length - 1; + if(length1 < 1 || length2 < 1) return 0; + + var bigrams2 = []; + for(var i = 0; i < length2; i++) { + bigrams2.push(other.substr(i, 2)); + } + + var intersection = 0; + for(var i = 0; i < length1; i++) { + var bigram1 = this.substr(i, 2); + for(var j = 0; j < length2; j++) { + if(bigram1 == bigrams2[j]) { + intersection++; + bigrams2[j] = null; + break; + } + } + } + return (2.0 * intersection) / (length1 + length2); +} + +var Utils = { + delayEvent: function(handler, event) { + if(this.delayEvent.timeout) { + clearTimeout(this.delayEvent.timeout); + } + this.delayEvent.timeout = setTimeout(function() { + handler.call(event); + }, 100); + }, + + scrollTo: function(target) { + var element = $(target); + if(element[0]) { + $("body, html").animate({ + scrollTop: element.offset().top - 60 + }); + } + }, + + openTab: function(e) { + // Open tab + var url = document.location.toString(); + if (url.match('#')) { + var hash = url.split('#')[1]; + var element = $('.nav-tabs a[href="#' + hash + '"]'); + if(element[0]) { + element.tab('show'); + } else { + Utils.scrollTo('#' + hash); + } + } + + // Jump to id + var obj = new URL(url); + var arg = obj.searchParams.get("def"); + if(arg) { + var def = '#' + arg; + $('.card.active').removeClass('active'); + $(def).addClass('active'); + $(def).find('.collapse').collapse(); + Utils.scrollTo(def); + } + } +}; + +Utils.openTab(); + +window.addEventListener("hashchange", Utils.openTab, false); + +// Scroll on hash click +$('.summary a[href*=#]').on('click', function(e) { + e.preventDefault(); + Utils.scrollTo(e.currentTarget.hash); + history.pushState({}, '', e.currentTarget.hash); +}); + +// Change hash for page-reload +$('.nav-tabs a[href]').on('shown.bs.tab', function (e) { + history.pushState({}, '', e.target.hash) +}); diff --git a/share/nitdoc/js/plugins/filtering.js b/share/nitdoc/js/plugins/filtering.js deleted file mode 100644 index fa0f12ec01..0000000000 --- a/share/nitdoc/js/plugins/filtering.js +++ /dev/null @@ -1,158 +0,0 @@ -/* This file is part of NIT ( http://www.nitlanguage.org ). - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - Documentation generator for the nit language. - Generate API documentation in HTML format from nit source code. -*/ - -/* - * Nitdoc Filtering - * - * Allow user to filter sidebar entries and search page - */ -var Filtering = { - - // Allow user to filter sidebar box entries by name - enableSidebarTextFilters: function(filterSelector) { - var div = $(document.createElement("div")) - .addClass("nitdoc-ui-filter") - .append( - $(document.createElement("input")) - .addClass("nitdoc-ui-filter-field") - .addClass("nitdoc-ui-filter-field-notused") - .attr("type", "text") - .attr("value", "filter...") - .keyup(function() { - var box = $(this).parents("nav.filterable"); - var value = $(this).val(); - box.find("ul li:not(:icontains('" + value + "'))").hide(); - box.find("ul li:icontains('" + value + "')").show(); - }) - .focusout(function() { - if($(this).val() == "") { - $(this).addClass("nitdoc-ui-filter-field-notused"); - $(this).val("filter..."); - } - }) - .focusin(function() { - if($(this).val() == "filter...") { - $(this).removeClass("nitdoc-ui-filter-field-notused"); - $(this).val(""); - } - }) - ); - $(filterSelector).after(div); - this.preloadSidebarTextFilters(); - }, - - // Prealod filters using search query - preloadSidebarTextFilters: function() { - var anchor = Utils.extractAnchor(document.location.hash); - if(!anchor || anchor.indexOf("q=") == -1) return; - - var query = anchor.substring(2); - if(!query) return; - - $(".nitdoc-ui-filter input:text") - .val(query) - .removeClass("nitdoc-ui-notused") - .trigger("keyup"); - }, - - // Allow user to filter side bar box entries by Introduced/Refined/inHerited type - enableSidebarTypeFilters: function(filterSelector) { - var box = $(filterSelector); - var types = {}; - - box.find("li").each(function() { - var span = $(this).find("span:first"); - if(!types[span.html()]) types[span.html()] = { - title: span.attr("title"), - class: $(this).attr("class") - } - }); - - for(var type in types) { - var a = $(document.createElement("a")) - .addClass("nitdoc-ui-filter-link") - .html(type) - .attr("title", "Hide " + types[type].title) - .attr("data-filter-class", types[type].class) - .toggle( - function() { - var hclass = $(this).attr("data-filter-class"); - $(this).parents(filterSelector).find("li." + hclass).hide(); - $(this).addClass("nitdoc-ui-filter-hidden") - }, - function() { - var hclass = $(this).attr("data-filter-class"); - $(this).parents(filterSelector).find("li." + hclass).show(); - $(this).removeClass("nitdoc-ui-filter-hidden") - } - ) - $(filterSelector).find(".nitdoc-ui-filter").append(a); - } - }, - - // Allow user to filter sidebar box entries by name - enableSearchPageField: function(filterSelector) { - var div = $(document.createElement("div")) - .addClass("nitdoc-ui-searchpage-filter") - .append( - $(document.createElement("input")) - .addClass("nitdoc-ui-searchpage-field") - .addClass("nitdoc-ui-filter-field-notused") - .attr("type", "text") - .attr("value", "filter...") - .keyup(function() { - var box = $(this).parents(".content.fullpage").find("article.filterable"); - var value = $(this).val(); - box.find("ul li:not(:icontains('" + value + "'))").hide(); - box.find("ul li:icontains('" + value + "')").show(); - }) - .focusout(function() { - if($(this).val() == "") { - $(this).addClass("nitdoc-ui-filter-field-notused"); - $(this).val("filter..."); - } - }) - .focusin(function() { - if($(this).val() == "filter...") { - $(this).removeClass("nitdoc-ui-filter-field-notused"); - $(this).val(""); - } - }) - ); - $(filterSelector).after(div); - this.preloadSearchPageField(); - }, - - // Prealod filter using search query - preloadSearchPageField: function() { - var anchor = Utils.extractAnchor(document.location.hash); - if(!anchor || anchor.indexOf("q=") == -1) return; - - var query = anchor.substring(2); - if(!query) return; - - $(".nitdoc-ui-searchpage-field") - .val(query) - .removeClass("nitdoc-ui-notused") - .trigger("keyup"); - } -}; - -Filtering.enableSidebarTextFilters("nav.filterable h3"); -Filtering.enableSidebarTypeFilters("nav.filterable"); -Filtering.enableSearchPageField(".content.fullpage h1:contains('Search')"); diff --git a/share/nitdoc/js/plugins/github.js b/share/nitdoc/js/plugins/github.js deleted file mode 100644 index c77c0d0eae..0000000000 --- a/share/nitdoc/js/plugins/github.js +++ /dev/null @@ -1,593 +0,0 @@ -/* This file is part of NIT ( http://www.nitlanguage.org ). - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - Documentation generator for the nit language. - Generate API documentation in HTML format from nit source code. -*/ - -/* - * Nitdoc.Github comment edition module - * - * Allows user to modify source code comments directly from the Nitdoc - */ -define([ - "jquery", - "github-api", - "highlight", - "marked", - "nit", - "plugins/modalbox", - "plugins/github/loginbox", - "plugins/github/commentbox", - "utils" -], function($, GithubAPI, hljs, marked) { - var GithubUser = function(login, password, repo, branch) { - this.login = login; - this.password = password; - this.repo = repo; - this.auth = "Basic " + (login + ':' + password).base64Encode(); - this.branch = branch; - } - - var GithubUI = { - init: function(upstream, basesha1) { - console.info("Github plugin: init GitHub module (upstream: "+ upstream +", base: " + basesha1 + ")"); - this.origin = this._parseUpstream(upstream); - this._initMarked(); - // Add github menu - $("#topmenu>.container-fluid").append( - $("") - .attr({ - "id": "nitdoc-github-li", - "type": "button", - "class": "navbar-btn navbar-right btn-link", - "href": "#", - "data-container": "body", - "data-toggle": "popover", - "data-placement": "bottom", - "data-content": "bottom", - "data-html": "true", - }) - .loginbox() - //.loginbox("displayLogin") - .bind("loginbox_logoff", function() { - GithubUI.disactivate(); - }) - .bind("loginbox_login", function(event, infos) { - GithubUI._tryLoginFromCredentials(infos); - }) - ); - // check local session - this._tryLoginFromLocalSession(); - }, - - activate: function(user, origin) { - this.openedComments = 0; - this._saveSession(user); - $("#nitdoc-github-li").loginbox("displayLogout", origin, user); - this._attachCommentBoxes(); - this._reloadComments(); - - // Prevent page unload if there is comments in editing mode - $(window).on('beforeunload', function() { - if(GithubUI.openedComments > 0){ - return "There is uncommited modified comments. Are you sure you want to leave this page?"; - } - }); - }, - - disactivate: function() { - if(this.openedComments > 0){ - if(!confirm('There is uncommited modified comments. Are you sure you want to leave this page?')) { - return false; - } - } - - localStorage.clear(); - $("#nitdoc-github-li").loginbox("toggle"); - $("#nitdoc-github-li").loginbox("displayLogin"); - $(window).unbind('beforeunload'); - //window.location.reload(); - }, - - /* login */ - - _checkLoginInfos: function(infos) { - if(!infos.login || !infos.password || !infos.repo || !infos.branch) { - $("

") - .text("Please enter your GitHub username, password, repository and branch.") - .modalbox({ - title: "Sign in error", - isError: true - }) - .modalbox("open"); - return false; - } else { - return true; - } - }, - - _tryLoginFromCredentials: function(infos) { - if(this._checkLoginInfos(infos)) { - var isok = this._tryLogin(infos.login, infos.password, infos.repo, infos.branch); - if(isok === true) { - this.activate(this.user, this.origin); - } else { - if(isok == "error:login") { - $("

") - .text("The username, password, repo or branch you entered is incorrect.") - .modalbox({ - title: "Github sign in error", - isError: true - }) - .modalbox("open"); - } else if(isok == "error:sha") { - $("

") - .text("The provided Github repository must contain the base commit '" + this.origin.sha + "'.") - .modalbox({ - title: "Github base commit error", - isError: true - }) - .modalbox("open"); - } else if(isok == "error:profile") { - $("

") - .text("Please set your public name and email in your " + - "GitHub profile." + - "

Your public profile informations are used to sign-off your commits.") - .modalbox({ - title: "Github profile error", - isError: true - }) - .modalbox("open"); - } - } - } - }, - - _tryLoginFromLocalSession: function() { - if(localStorage.user) { - var session = JSON.parse(localStorage.user); - var isok = this._tryLogin( - session.login, - session.password.base64Decode(), - session.repo, - session.branch - ); - if(isok === true) { - this.activate(this.user, this.origin); - } else { - console.debug("Github plugin: Session found but authentification failed"); - localStorage.clear(); - } - } else { - console.debug("Github plugin: No session found"); - } - }, - - _tryLogin: function(login, password, repo, branch) { - var tmpUser = new GithubUser(login, password, repo, branch); - if(!GithubAPI.login(tmpUser)) { - return "error:login"; - } - if(!tmpUser.infos.name || !tmpUser.infos.email) { - return "error:profile"; - } - var commit = GithubAPI.getCommit(tmpUser, this.origin.sha); - if(!commit || !commit.sha) { - return "error:sha"; - } - this.user = tmpUser; - return true; - }, - - _saveSession: function(user) { - localStorage.user = JSON.stringify({ - login: user.login, - password: user.password.base64Encode(), - repo: user.repo, - branch: user.branch, - }); - // check local storage synchro with branch - if(localStorage.base != this.origin.sha) { - console.log("Base changed: cleaned cache"); - localStorage.requests = "[]"; - localStorage.base = this.origin.sha; - } - }, - - /* html decoration */ - - // Attach edit button on each comment - _attachCommentBoxes: function() { - $("textarea.baseComment").each(function() { - $(this).commentbox(); - - var isNew = false; - if(!$(this).val()) { - isNew = true; - $(this).nextAll(".info:first").find(".noComment").hide() - $(this).nextAll(".info:first").before( - $("

") - .hide() - .addClass("comment") - .append( - $("
").addClass("nitdoc") - ) - ) - } - - $(this).nextAll(".info:first").prepend( - $("") - .addClass("nitdoc-github-editComment") - .css("cursor", "pointer") - .text((isNew ? "add" : "edit") + " comment") - .click($.proxy(GithubUI._openCommentBox, GithubUI, null, $(this))) - .after(" for ") - ) - - $(this).bind("commentbox_commit", function(event, data) { - GithubUI._saveChanges(data); - $(this).commentbox("close"); - GithubUI._reloadComments(); - }) - .bind("commentbox_preview", function(event, data) { - $("
") - .append($("

").text("Comment:")) - .append( - $("
") - .addClass("description") - .append( - $("
") - .addClass("comment") - .append( - $("
") - .addClass("nitdoc") - .html(marked(data.value)) - ) - ) - ) - .append($("

").text("Message:")) - .append( - $("
") - .addClass("description") - .append( - $("
") - .addClass("comment") - .append( - $("
").html(marked(data.message)) - ) - ) - ) - .modalbox({ - title: "Preview comment", - css: {"min-width": "500px"} - }) - .modalbox("open"); - }) - .bind("commentbox_open", function(event, data) { - GithubUI.openedComments++; - $(this).nextAll(".comment").hide(); - }) - .bind("commentbox_close", function(event, data) { - GithubUI.openedComments--; - $(this).nextAll(".comment").show(); - }); - }); - }, - - // reload comments from saved pull request - _reloadComments: function() { - if(!localStorage.requests){ return; } - $("p.pullRequest").remove(); - var requests = JSON.parse(localStorage.requests); - // Look for modified comments in page - for(i in requests) { - if(!requests[i]) { continue; } - var request = requests[i]; - $("textarea[data-comment-location=\"" + request.location + "\"]").each(function () { - if(request.isClosed) { - var oldComment = request.oldComment.base64Decode(); - var htmlComment = marked(oldComment); - $(this).val(oldComment); - if(!$(this).val()) { - $(this).nextAll("div.comment:first").hide(); - } else { - $(this).nextAll("div.comment:first").show(); - } - $(this).nextAll("div.comment").find("div.nitdoc").empty().html(htmlComment); - $(this).nextAll("p.info").find("a.nitdoc-github-editComment").show(); - } else { - var newComment = request.comment.base64Decode(); - var htmlComment = marked(newComment); - $(this).val(newComment); - if(!$(this).val()) { - $(this).nextAll("div.comment:first").hide(); - } else { - $(this).nextAll("div.comment:first").show(); - } - $(this).nextAll("div.comment").find("div.nitdoc").empty().html(htmlComment); - GithubUI._addPullRequestLink($(this), request); - $(this).nextAll("p.info").find("a.nitdoc-github-editComment").hide(); - } - }); - } - }, - - _addPullRequestLink: function(baseArea, request) { - baseArea.nextAll("p.info").before( - $("

") - .addClass("pullRequest inheritance") - .text("comment modified in ") - .append( - $("") - .attr({ - href: request.request.html_url, - title: "Review on GitHub" - }) - .text("pull request #" + request.request.number) - ) - .append(" ") - .append( - $("") - .data("pullrequest-number", request.request.number) - .addClass("nitdoc-github-update") - .text("update") - .click($.proxy(GithubUI._doUpdateRequest, GithubUI, null, baseArea, request)) - ) - .append(" ") - .append( - $("") - .data("pullrequest-number", request.request.number) - .addClass("nitdoc-github-cancel") - .text("cancel") - .click($.proxy(GithubUI._doCancelRequest, GithubUI, null, baseArea, request)) - ) - ); - }, - - /* github calls */ - - _saveChanges: function(edit) { - // if pull request update close existing pull request for the comment - if(edit.requestID) { - this._closePullRequest(edit.requestID); - } - edit.oldContent = this._getFileContent(edit.location.path); - edit.newContent = this._mergeComment(edit.oldContent, edit.newComment, edit.location); - edit.request = this._pushChanges(edit) - if(!edit.request) { - $("

") - .text("Unable to commit changes.
" + response) - .modalbox({ - title: "Github commit error", - isError: true - }) - .modalbox("open"); - return; - } - this._saveRequest(edit); - }, - - // save pull request in local storage - _saveRequest: function(edit) { - var requests = {}; - if(localStorage.requests) {requests = JSON.parse(localStorage.requests)} - requests[edit.request.number] = { - request: edit.request, - location: edit.location.origin, - comment: edit.newComment.base64Encode(), - oldComment: edit.oldComment.base64Encode() - }; - localStorage.requests = JSON.stringify(requests); - }, - - /* - Creating a new pull request with the new comment take 5 steps: - 1. get the base tree from latest commit - - 2. create a new blob with updated file content - 3. post a new tree from base tree and blob - 4. post the new commit with new tree - 5. create the pull request - */ - _pushChanges: function(edit) { - var baseTree = GithubAPI.getTree(this.user, this.origin.sha); - if(!baseTree.sha) { - $("

") - .text("Unable to locate base tree.
" + baseTree.status + ": " + baseTree.statusText) - .modalbox({ - title: "Github commit error", - isError: true - }) - .modalbox("open"); - return false; - } - console.log("Base tree: " + baseTree.url); - var newBlob = GithubAPI.createBlob(this.user, edit.newContent); - if(!newBlob.sha) { - $("

") - .text("Unable to create new blob.
" + newBlob.status + ": " + newBlob.statusText) - .modalbox({ - title: "Github commit error", - isError: true - }) - .modalbox("open"); - return false; - } - console.log("New blob: " + newBlob.url); - var newTree = GithubAPI.createTree(this.user, baseTree, edit.location.path, newBlob); - if(!newTree.sha) { - $("

") - .text("Unable to create new tree.
" + newTree.status + ": " + newTree.statusText) - .modalbox({ - title: "Github commit error", - isError: true - }) - .modalbox("open"); - return false; - } - console.log("New tree: " + newTree.url); - var newCommit = GithubAPI.createCommit(this.user, edit.message, baseTree.sha, newTree); - if(!newCommit.sha) { - $("

") - .text("Unable to create new commit.
" + newCommit.status + ": " + newCommit.statusText) - .modalbox({ - title: "Github commit error", - isError: true - }) - .modalbox("open"); - return false; - } - console.log("New commit: " + newCommit.url); - var pullRequest = GithubAPI.createPullRequest(this.user, edit.title, "Pull request from Nitdoc", this.origin, newCommit.sha); - if(!pullRequest.number) { - $("

") - .text("Unable to create pull request.
" + pullRequest.status + ": " + pullRequest.statusText) - .modalbox({ - title: "Github commit error", - isError: true - }) - .modalbox("open"); - return false; - } - console.log("New pull request: " + pullRequest.url); - return pullRequest; - }, - - // close previously opened pull request - _closePullRequest: function(number) { - var requests = JSON.parse(localStorage.requests); - if(!requests[number]) { - $("

") - .text("Unable to close pull request.
" + "Pull request " + number + "not found") - .modalbox({ - title: "Github commit error", - isError: true - }) - .modalbox("open"); - return false; - } - // close pull request - var res = GithubAPI.updatePullRequest(this.user, "Closed from Nitdoc", "", "closed", requests[number].request); - if(!res.id) { - $("

") - .text("Unable to close pull request.
" + res.status + ": " + res.statusText) - .modalbox({ - title: "Github commit error", - isError: true - }) - .modalbox("open"); - return false; - } - // update in localstorage - requests[number].isClosed = true; - localStorage.requests = JSON.stringify(requests); - }, - - /* internals */ - - _initMarked: function() { - var renderer = new marked.Renderer(); - renderer.code = function(code) { - return '

' + hljs.highlight('nit', code).value + '
'; - } - renderer.codespan = function(code) { - return '' + hljs.highlight('nit', code).value + ''; - } - marked.setOptions({ - renderer: renderer, - gfm: true, - tables: true, - breaks: true, - pedantic: false, - sanitize: true, - smartLists: true, - smartypants: false - }); - }, - - _parseUpstream: function(upstream) { - var parts = upstream.split(":"); - return { - user: parts[0], - repo: parts[1], - branch: parts[2], - sha: basesha1 - }; - }, - - _getFileContent: function(githubUrl) { - var origFile = GithubAPI.getFile(this.user, githubUrl); - if(!origFile.content) { - $("

") - .text("Unable to locate source file.
" + origFile.status + ": " + origFile.statusText) - .modalbox({ - title: "Github commit error", - isError: true - }) - .modalbox("open"); - return; - } - var base64Content = origFile.content.substring(0, origFile.content.length - 1) - return base64Content.base64Decode(); - }, - - _mergeComment: function(fileContent, comment, location) { - // replace comment in file content - var res = new String(); - var lines = fileContent.split("\n"); - // copy lines fron 0 to lstart - for(var i = 0; i < location.lstart - 1; i++) { - res += lines[i] + "\n"; - } - // set comment - if(comment && comment != "") { - var commentLines = comment.split("\n"); - for(var i = 0; i < commentLines.length; i++) { - var line = commentLines[i]; - var tab = location.tabpos > 1 ? "\t" : ""; - res += tab + (line.length > 0 ? "# " : "#") + line + "\n"; - } - } - // copy lines fron lend to end - for(var i = location.lend - 1; i < lines.length; i++) { - res += lines[i]; - if(i < lines.length - 1) { res += "\n"; } - } - return res; - }, - - /* events */ - - _openCommentBox: function(event, baseArea) { - baseArea.commentbox("open", this.user); - }, - - _doCancelRequest: function(event, baseArea, request) { - this._closePullRequest(request.request.number); - this._reloadComments(); - }, - - _doUpdateRequest: function(event, baseArea, request) { - baseArea.commentbox("open", this.user, request.request.number); - }, - } - - // Get github plugin data - var upstream = $("body").attr("data-github-upstream"); - var basesha1 = $("body").attr("data-github-base-sha1"); - if(upstream && basesha1) { - GithubUI.init(upstream, basesha1); - } -}); diff --git a/share/nitdoc/js/plugins/github/commentbox.js b/share/nitdoc/js/plugins/github/commentbox.js deleted file mode 100644 index 2bb6a182fe..0000000000 --- a/share/nitdoc/js/plugins/github/commentbox.js +++ /dev/null @@ -1,231 +0,0 @@ -/* This file is part of NIT ( http://www.nitlanguage.org ). - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -/* - * CommentBox allows user to edit comments then preview, commit or cancel the changes - */ -define([ - "jquery", - "jQueryUI" -], function($) { - var Location = function(location) { - var parts = location.split(":"); - this.origin = location; - this.path = parts[0]; - this.lstart = parseInt(parts[1].split("--")[0].split(",")[0]); - this.tabpos = parseInt(parts[1].split("--")[0].split(",")[1]); - this.lend = parseInt(parts[1].split("--")[1].split(",")[0]); - this.toString = function() { - return this.path + ":" + this.lstart + "," + this.tabpos + "--" + this.lend + ",0"; - } - } - - $.widget("nitdoc.commentbox", { - - options: { - previewTxt: "preview", - commitTxt: "Commit", - cancelTxt: "Cancel", - commentboxTitle: "Edit comment", - messageTxt: "Commit message" - }, - - _create: function() { - this._id = $(".nitdoc-github-commentbox").length - this._oldComment = this.element.val(); - this._namespace = this.element.data("comment-namespace"); - this._location = new Location(this.element.data("comment-location")); - this.commentBox = $("

") - .hide() - .addClass("nitdoc-github-commentbox") - .append( - $("

") - .text(this.options.commentboxTitle) - ) - .append( - $("
") - .addClass("nitdoc-github-commentbox-fields") - .append( - $("
") - .append( - $("