diff --git a/src/css/base.css b/src/css/base.css index e18589b..2f605ff 100644 --- a/src/css/base.css +++ b/src/css/base.css @@ -16,7 +16,7 @@ body { body { color: var(--color-text); - font-family: "Gotham", sans-serif; + font-family: "Source Sans Pro", sans-serif; line-height: 1.5; margin: 0; } @@ -67,7 +67,7 @@ html code { b, strong { - font-weight: var(--weight-medium); + font-weight: var(--weight-bold); } small { diff --git a/src/css/doc.css b/src/css/doc.css index 3b5cac5..58765a6 100644 --- a/src/css/doc.css +++ b/src/css/doc.css @@ -29,7 +29,8 @@ .doc h2 { font-size: 1.875rem; margin: 2.25rem 0 2.5rem; - max-width: fit-content; /* NOTE used to restrict width of key line */ + max-width: fit-content; + /* NOTE used to restrict width of key line */ } .doc h2::after { @@ -134,12 +135,12 @@ .doc .literalblock .title, .doc .openblock .title, .doc caption { - /* font-size: 1.125rem; */ - font-size: 1.0625rem; - font-weight: var(--weight-bold); + font-size: 1rem; + font-weight: var(--weight-semibold); letter-spacing: -0.025em; line-height: 1.2; margin-bottom: 0.25rem; + color: var(--color-brand-gray3); } .doc hr { @@ -148,7 +149,7 @@ border-top-width: 1px; } -.doc table.tableblock, +/* .doc table.tableblock, .doc th.tableblock, .doc td.tableblock { border: 0 solid var(--color-border-table); @@ -158,9 +159,10 @@ border-width: 1px; border-collapse: collapse; margin: 1.5rem 0 2rem; -} +} */ /* TODO drop .spread after upgrading to Asciidoctor 1.5.7 */ + .doc table.spread, .doc table.stretch { width: 100%; @@ -170,59 +172,22 @@ text-align: left; } -.doc table.tableblock > tbody { +/* .doc table.tableblock > tbody { font-weight: var(--weight-light); -} +} */ /* NOTE prevent wide tables from exceeding bounds */ + /* TODO could also target table.tableblock[style^="width:"] */ + /* TODO drop .spread after upgrading to Asciidoctor 1.5.7 */ + .doc table.spread > tbody > tr > *, .doc table.stretch > tbody > tr > * { /* NOTE setting max-width reactivates overflow-wrap behavior on the table cell */ max-width: 0; } -/* NOTE alternate way to prevent wide tables from exceeding bounds, but can overly compress header cells */ -/* table-layout: fixed strictly enforces table and column widths */ -/* another alternative is to wrap table in div and set overflow-x: auto on wrapper */ -/* -.doc table.spread, -.doc table.stretch { - table-layout: fixed; -} -*/ - -.doc table.tableblock > tbody > tr:nth-of-type(even) { - background-color: var(--color-shade); -} - -.doc th.tableblock { - font-weight: var(--weight-medium); - letter-spacing: -0.025em; -} - -.doc th.tableblock, -.doc td.tableblock { - border-width: 0 1px; - padding: 0.75rem 1rem; -} - -.doc thead th.tableblock { - border-width: 1px; - font-size: 1.0625rem; - line-height: 1.2; -} - -.doc p.tableblock + p.tableblock { - margin-top: 1rem; -} - -/* NOTE in Asciidoctor 1.5.7, this div will have a class */ -.doc td.tableblock > div > :first-child { - margin-top: 0; -} - .doc .halign-left { text-align: left; } @@ -262,7 +227,7 @@ } .doc .admonitionblock td.icon i::before { - background: no-repeat 0/cover; + background: no-repeat 0 / cover; content: ""; display: block; height: 1.875rem; @@ -506,7 +471,8 @@ .doc pre.highlight code { background-color: #151514; color: #f8f8f2; - font-weight: var(--weight-normal); /* needed to override third-party styles */ + font-weight: var(--weight-normal); + /* needed to override third-party styles */ padding: 0.625rem; white-space: pre-wrap; /* NOTE enable these styles if side-to-side scrolling is preferred */ @@ -518,6 +484,7 @@ } /* NOTE assume pre.highlight contains code[data-lang] */ + .doc pre.highlight { position: relative; } @@ -751,7 +718,8 @@ background-color: var(--color-brand-white); content: ""; display: block; - height: 3px; /* Chrome doesn't always paint the line accurately, so add a little extra */ + height: 3px; + /* Chrome doesn't always paint the line accurately, so add a little extra */ position: absolute; bottom: -1.5px; left: 0; @@ -771,3 +739,122 @@ .doc .tab-pane > :first-child { margin-top: 0; } +/* Media css */ + +@media screen and (min-width: 840px) { + .active-tab-item-row, + .tabset .dropddown-btn { + display: none; + } + + .doc .tabs ul.hide { + display: none; + } +} + +@media screen and (max-width: 840px) { + .tabset { + position: relative; + margin-top: 2rem; + display: flex; + justify-content: flex-start; + flex-wrap: wrap; + width: 100%; + } + + .active-tab-item-row { + display: inline-block; + max-width: 60%; + } + + .active-tab-item-row a { + align-items: center; + color: var(--color-brand-gray1); + border: 1px solid var(--color-border); + border-bottom: 0; + cursor: pointer; + display: flex; + font-weight: var(--weight-bold); + min-height: 2.5rem; + line-height: 1; + margin-right: 0.25rem; + padding: 0 1.5rem 5px; + position: relative; + text-decoration: none; + } + + .active-tab-item-row a::after { + background-color: var(--color-brand-white); + content: ""; + display: block; + height: 3px; + /* Chrome doesn't always paint the line accurately, so add a little extra */ + position: absolute; + bottom: -1.5px; + left: 0; + right: 0; + } + + .ulist.tabs { + margin: 0; + position: relative; + } + + .doc .tabs .dropddown-btn { + width: 100%; + height: 100%; + display: flex; + align-items: center; + color: #333; + } + + .doc .tabs .dropddown-btn .fas { + font-size: 18px; + margin-left: 10px; + } + + .doc .tabs .dropddown-btn:focus, + .doc .tabs .dropddown-btn:hover { + outline: none; + text-decoration: none; + } + + .doc .tabs ul { + box-shadow: 0 3px 10px -3px #ccc; + margin: 0; + position: absolute; + left: 0; + top: 100%; + width: 120px; + display: none; + overflow-y: auto; + background-color: var(--color-brand-white); + } + + .doc .tabs ul p { color: var(--color-brand-gray1); } + + .doc .tabset:not(.is-loading) .tabs li:not(.is-active) { + background: var(--color-brand-white); + min-height: 2.5rem; + height: auto; + padding: 0.75rem; + } + + .doc .tabs li.is-active { display: none; } + + .doc .tabs li { + width: 100%; + flex-wrap: wrap; + margin-right: 0; + border-top: 0; + border-bottom: 1px solid var(--color-border); + } + + .doc .tabset > .content { + width: 100%; + } + + .doc .tabs ul.show { + display: block; + } +} diff --git a/src/css/is-this-helpful.css b/src/css/is-this-helpful.css new file mode 100644 index 0000000..2d826b8 --- /dev/null +++ b/src/css/is-this-helpful.css @@ -0,0 +1,158 @@ + +@import url("https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700&display=swap"); + +.is-this-helpful-box * { + font-family: "Source Sans Pro", sans-serif; +} + +.is-this-helpful-box { + display: inline-block; + width: 100%; + margin-bottom: 25px; + border-top: 1px solid #ccc; + padding-top: 25px; + font-family: "Source Sans Pro", sans-serif; +} + +.is-this-helpful-box .btn-row { + display: flex; + width: 100%; + justify-content: flex-start; + margin: 15px 0; +} + +.is-this-helpful-box .btn-row .helpfull-btn { + font-size: 0.875rem; + line-height: 1.125rem; + color: var(--color-brand-gray4); +} + +.is-this-helpful-box .btn-row .helpfull-btn:hover, +.is-this-helpful-box .btn-row .helpfull-btn.active { + color: var(--color-brand-blue); + text-decoration: none; +} + +.is-this-helpful-box .btn-row .like-btn { + margin-right: 15px; +} + +.is-this-helpful-box .input-control { + width: 100%; + display: inline-block; + padding: 8px 12px; + border-radius: 5px; + border: 1px solid var(--color-brand-gray5); + resize: vertical; + font-size: 1rem; + color: var(--color-brand-gray4); + font-family: "Source Sans Pro", sans-serif; +} + +.dialog-box { + display: none; +} + +.dialog-box .blue-btn { + background-color: var(--color-brand-blue); + color: var(--color-brand-white); + font-size: 0.875rem; + line-height: 1.375rem; + border: 2px solid var(--color-brand-blue); + display: inline-block; + border-radius: 5px; + font-weight: 500; + height: 30px; + width: 65px; + margin: 0 10px; +} + +.dialog-box .disabled { + pointer-events: none; + opacity: 0.5; +} + +.dialog-box .blue-btn.like-btn { + opacity: 1; +} + +.is-this-helpful-box h4 { + font-weight: var(--weight-semibold); + margin: 0 0 10px; + font-size: 0.875rem; + line-height: 1.125rem; + color: var(--color-brand-gray4); +} + +.is-this-helpful-box .action-btn-row { + text-align: right; + margin-top: 10px; + padding: 0 10px; +} + +.is-this-helpful-box .action-btn-row .skip-btn { + display: inline-block; + font-weight: var(--weight-semibold); + font-size: 0.875rem; + line-height: 1.125rem; + color: var(--color-brand-blue); +} + +.is-this-helpful-box .action-btn-row .info-btn { + font-size: 0.75rem; + line-height: 0.75rem; + color: var(--color-brand-gray4); + display: inline-block; +} + +.is-this-helpful-box .text-msg p { + font-size: 0.875rem; + line-height: 1.125rem; + color: var(--color-brand-gray3); +} + +.is-this-helpful-box .leave-addtional-box { + display: none; +} + +/* Page Rating css */ +.modal-popup { + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: auto; + width: 100%; + height: 100%; + display: none; + background-color: rgba(0, 0, 0, 0.5); + z-index: 1001; +} + +.modal-popup .modal-popup-dialogue { + padding: 10px 15px; + /* height: auto; */ + width: 50%; + max-width: 400px; + background: #fff; + position: relative; + z-index: 9; + margin: auto; + box-shadow: 0 0 10px #333; + transform: translate(0%, -100%); + transition: all 0.3s; +} + +.modal-popup.show { display: block; } + +.modal-popup.show .modal-popup-dialogue { transform: translate(0%, 200px); } + +.modal-popup .popup-header { + display: flex; + justify-content: flex-end; +} + +.modal-popup .popup-content { + padding: 0 15px; +} diff --git a/src/css/site.css b/src/css/site.css index 1df4b82..5b61b74 100644 --- a/src/css/site.css +++ b/src/css/site.css @@ -1,3 +1,4 @@ + @import "typeface-gotham.css"; @import "typeface-roboto-mono.css"; @import "vars.css"; @@ -17,3 +18,5 @@ @import "optanon.css"; @import "highlight.css"; @import "feedback.css"; +@import "is-this-helpful.css"; +@import "table.css"; diff --git a/src/css/table.css b/src/css/table.css new file mode 100644 index 0000000..27ad9d8 --- /dev/null +++ b/src/css/table.css @@ -0,0 +1,162 @@ +/* ============================================================================= + Responsive Table CSS + ========================================================================== */ + +table.tableblock * { + font-family: "Source Sans Pro", sans-serif; +} + +table.tableblock { + display: block; + width: 100%; + margin: 1em 0; + border-spacing: 0; +} + +table.tableblock thead, +table.tableblock tbody, +table.tableblock thead tr, +table.tableblock th { + display: block; +} + +table.tableblock thead { + float: left; +} + +table.tableblock tbody { + width: auto; + position: relative; + overflow-x: auto; +} + +table.tableblock td, +table.tableblock th { + line-height: 1.5em; + box-sizing: border-box; + overflow-x: hidden; + overflow-y: auto; + color: var(--color-brand-gray1); +} + +table.tableblock th { + padding: 15px 12px 8px; + text-align: left; + border-bottom: 2px solid var(--color-brand-blue); + font-size: 1rem; + line-height: 1.25rem; + font-weight: var(--weight-bold); +} + +table.tableblock tbody tr { + display: table-cell; +} + +/* .tableblock tbody tr :hover{ + background: var(--color-brand-gray7); + } */ + +table.tableblock > tbody td { + display: block; + border-bottom: 1px solid var(--color-brand-gray6); + padding: 15px 12px 15px; +} + +table.tableblock tbody td p { + font-size: 0.875rem; + line-height: 1.125rem; + color: var(--color-brand-gray1); + font-weight: var(--weight-medium); +} + +table.tableblock .content .paragraph, +table.tableblock .content .ulist { + margin-top: 0; +} + +/* table.tableblock tr:nth-child(odd) { + background: rgba(0, 0, 0, 0.07);g29 + + } + */ + +/* table.tableblock tbody tr:hover { + background: var(--color-brand-gray7); +} */ + +table.tableblock .title { + display: inline-block; + width: 100%; + padding: 10px 0 0; + margin-bottom: 10px; +} + +/* Responsive css */ + +.doc .admonitionblock td.icon { + border-bottom: none; +} + +@media screen and (min-width: 768px) { + table.tableblock { + display: table; + position: relative; + margin-top: 2.5rem; + } + + table.tableblock .title { + position: absolute; + left: 0; + top: -35px; + } + + div.paragraph + table.tableblock { + margin-top: 40px; + } + + table.tableblock thead { + display: table-header-group; + float: none; + } + + table.tableblock tbody { + display: table-row-group; + } + + table.tableblock thead tr, + table.tableblock tbody tr { + display: table-row; + } + + table.tableblock th, + table.tableblock tbody td { + display: table-cell; + } + + table.tableblock td, + table.tableblock th { + width: auto; + } +} + +@media screen and (max-width: 767px) { + table.tableblock td { + min-width: 14.5rem; + word-break: break-word; + border-right: 1px solid var(--color-brand-gray6); + } + + .admonitionblock table tbody { + overflow-x: visible; + } + + .doc .admonitionblock > table > tbody > tr { + display: inline-block; + width: 100%; + } + + table.tableblock thead { + box-shadow: 2px 2px 4px 1px var(--color-brand-gray7); + max-width: 120px; + } +} diff --git a/src/css/toc.css b/src/css/toc.css index 8bb3e55..a1cd0ba 100644 --- a/src/css/toc.css +++ b/src/css/toc.css @@ -3,13 +3,13 @@ } .toc-menu { - border: 0 solid var(--color-brand-red); + /* border: 0 solid var(--color-brand-red); border-width: 0 0 0 0.25rem; - border-image: linear-gradient(var(--color-brand-purple), var(--color-brand-pink)) 0 0 0 100%; + border-image: linear-gradient(var(--color-brand-purple), var(--color-brand-pink)) 0 0 0 100%; */ margin-bottom: 1.5rem; } - -.toc.sidebar .toc-menu { +/* .toc.sidebar .toc-menu {position: fixed;width: inherit; position: sticky;top: var(--height-to-body)max-height: var(--height-nav);overflow-y: auto; -ms-overflow-style: none;} */ +.sidebar-box { position: fixed; /* for IE */ width: inherit; /* for position: fixed */ position: sticky; /* stylelint-disable-line declaration-block-no-duplicate-properties */ @@ -23,15 +23,31 @@ margin-top: 1rem; } -.toc-menu::-webkit-scrollbar { +.sidebar-box::-webkit-scrollbar { width: 0; } .toc .toc-menu h3 { - font-size: inherit; - font-weight: var(--weight-medium); + font-size: 0.875rem; + font-weight: var(--weight-bold); margin: 0; line-height: 1; + color: var(--color-brand-gray5); + display: inline-block; + position: relative; +} + +.toc .toc-menu h3::after { + content: ""; + position: absolute; + right: -20px; + top: 0; + display: inline-block; + height: 16px; + width: 16px; + background: url(../img/heading-icon.svg) no-repeat center center; + -webkit-transition: all 0.3s; + transition: all 0.3s; } .toc .toc-menu ul { @@ -47,29 +63,53 @@ } .toc .toc-menu li { - margin: 0.5rem 0 0; + margin: 0; } -.toc a { - color: inherit; +.toc .toc-menu li a::before { + content: ""; + position: absolute; + left: -8px; + top: 0; + display: inline-block; + height: 0; + width: 2px; + background: var(--color-active-tabset); + transition: all 0.3s; +} + +.toc .toc-menu li a.is-active::before, +.toc .toc-menu li a:hover::before { + height: 100%; +} + +.toc ul li a { display: block; text-decoration: none; + position: relative; + color: var(--color-brand-gray4); + font-weight: var(--weight-normal); + font-size: 0.875rem; + line-height: 1; + padding: 8px 0; } -.toc a:hover { - color: var(--color-link); +.toc ul li a:hover { + color: var(--color-active-tabset); + text-decoration: none; } -.toc a.is-active { - font-weight: var(--weight-medium); +.toc ul li a.is-active { + font-weight: var(--weight-semibold); letter-spacing: -0.008em; } -.toc a.is-active:focus, -.toc a.is-active:hover { - color: inherit; +.toc ul li a.is-active:focus, +.toc ul li a.is-active:hover { + color: var(--color-active-tabset); } -.toc code { +.toc ul li a code { line-height: 1.125; + color: inherit; } diff --git a/src/css/vars.css b/src/css/vars.css index 9582a44..70ad8a6 100644 --- a/src/css/vars.css +++ b/src/css/vars.css @@ -6,17 +6,30 @@ --color-brand-red-tint: #fcdedf; --color-brand-white: #fff; /* secondary */ + --color-brand-blue: #57a0ff; + --color-blue-rgb: 87, 160, 255; --color-brand-light-blue: #00ace0; --color-brand-light-blue-tint: #d9f3fb; --color-brand-pink: #eb4971; --color-brand-green: #00b9be; --color-brand-purple: #b36cdb; --color-brand-purple-tint: #f4e9fa; + --color-brand-tip: #00d770; + --color-brand-note: #4e90e6; + --color-brand-important: #9e70b1; + --color-brand-warning: #ed2226; + --color-brand-caution: #f57f17; /* tertiary */ - --color-brand-gray: #666; + --color-brand-gray1: #292b36; + --color-brand-gray2: #3d4151; + --color-brand-gray3: #52566c; + --color-brand-gray4: #73768a; + --color-brand-gray5: #c8cbdf; + --color-brand-gray6: #eaebf1; + --color-brand-gray7: #f9f9f9; /* --color-brand-silver: #ccc; */ --color-brand-silver: #c1c1c1; - --color-brand-blue: #0074e0; + /* --color-brand-blue: #0074e0; */ --color-brand-blue-tint: #d9eafb; --color-brand-orange: #fc9c0c; --color-brand-orange-tint: #fff0da; @@ -32,9 +45,9 @@ --color-navbar-text: var(--color-brand-white); --color-footer-bg: var(--color-brand-black); --color-footer-text: var(--color-brand-white); - --height-spacer: 1.5rem; + --height-spacer: 1.3rem; /* --height-navbar: 4rem; */ - --height-navbar: 4.875rem; + --height-navbar: 6.09rem; --height-to-body: calc(var(--height-navbar) + var(--height-spacer)); --height-min-body: calc(100vh - var(--height-to-body)); --height-nav: calc(var(--height-min-body) - var(--height-spacer)); @@ -43,12 +56,14 @@ /* --width-main-gutter: 1.5rem; */ --width-main-gutter: 2.5rem; --width-container: 90rem; + --width-container-fluid: 100%; --width-container-gutter: 1.25rem; - --width-nav: 16rem; + --width-nav: 20rem; --width-toc: 12rem; --weight-light: 300; --weight-normal: 400; --weight-medium: 500; + --weight-semibold: 600; --weight-bold: 700; --z-index-feedback: 7; --z-index-nav-mobile: 6; @@ -57,4 +72,7 @@ --z-index-navbar: 3; --z-index-footer: 2; --z-index-nav: 1; + + /* Color brand tabsets */ + --color-active-tabset: #57a1ff; } diff --git a/src/img/heading-icon.png b/src/img/heading-icon.png new file mode 100644 index 0000000..b44cad3 Binary files /dev/null and b/src/img/heading-icon.png differ diff --git a/src/img/heading-icon.svg b/src/img/heading-icon.svg new file mode 100644 index 0000000..6281619 --- /dev/null +++ b/src/img/heading-icon.svg @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/src/js/05-tabset.js b/src/js/05-tabset.js index 4f27c2f..ec1f91f 100644 --- a/src/js/05-tabset.js +++ b/src/js/05-tabset.js @@ -1,50 +1,90 @@ -;(function () { - 'use strict' - - var hash = window.location.hash - find('.doc .tabset').forEach(function (tabset) { - var active - var tabs = tabset.querySelector('.tabs') - if (tabs) { - var first - find('li', tabs).forEach(function (tab, idx) { - var id = (tab.querySelector('a[id]') || tab).id - if (!id) return - var pane = getPane(id, tabset) - if (!idx) first = { tab: tab, pane: pane } - if (!active && hash === '#' + id && (active = true)) { - tab.classList.add('is-active') - if (pane) pane.classList.add('is-active') - } else if (!idx) { - tab.classList.remove('is-active') - if (pane) pane.classList.remove('is-active') +var hash = window.location.hash +// var smallBreak = 768 // Your small screen breakpoint in pixels +find('.doc .tabset').forEach(function (tabset) { + var active + var checkActiveClass + var tabs = tabset.querySelector('.tabs') + if (tabs) { + var first + var dropdownMenu = document.querySelector('.tabs ul') + find('li', tabs).forEach(function (tab, idx) { + var id = (tab.querySelector('a[id]') || tab).id + checkActiveClass = setTimeout(function () { + var activeTabList = tab.classList.contains('is-active') + if (activeTabList) { + document.querySelector('.tabs').insertAdjacentHTML('beforebegin', '
') + document.querySelector('.tabs').insertAdjacentHTML('beforeend', ' More ') + document.getElementById('activeTabItem').innerText = tab.innerText + var dropdownBtn = document.querySelector('.dropdown-btn-down') + // var dropdownBtnIcon = document.querySelector('.dropdown-btn .fas') + dropdownBtn.addEventListener('click', function (e) { + e.preventDefault() + if (dropdownMenu.style.display === 'block' || dropdownMenu.classList.contains('show')) { + dropdownMenu.classList.remove('show') + dropdownMenu.classList.add('hide') + this.querySelector('.fas').classList.add('fa-chevron-circle-down') + this.querySelector('.fas').classList.remove('fa-chevron-circle-up') + } else { + dropdownMenu.classList.add('show') + dropdownMenu.classList.remove('hide') + this.querySelector('.fas').classList.add('fa-chevron-circle-up') + this.querySelector('.fas').classList.remove('fa-chevron-circle-down') + } + }) } - tab.addEventListener('click', activateTab.bind({ tabset: tabset, tab: tab, pane: pane })) - }) - if (!active && first) { - first.tab.classList.add('is-active') - if (first.pane) first.pane.classList.add('is-active') + }, 100) + + if (!id) return + var pane = getPane(id, tabset) + if (!idx) first = { tab: tab, pane: pane } + if (!active && hash === '#' + id && (active = true)) { + tab.classList.add('is-active') + if (pane) pane.classList.add('is-active') + } else if (!idx) { + tab.classList.remove('is-active') + if (pane) pane.classList.remove('is-active') } + tab.addEventListener('click', activateTab.bind({ tabset: tabset, tab: tab, pane: pane })) + }) + if (!active && first) { + first.tab.classList.add('is-active') + if (first.pane) first.pane.classList.add('is-active') + } + } + tabset.classList.remove('is-loading') + clearTimeout(checkActiveClass, 20000) +}) + +function activateTab (e) { + e.preventDefault() + var tab = this.tab + var pane = this.pane + var dropdownMenu = document.querySelector('.tabs ul') + var dropdownBtnIcon = document.querySelector('.dropdown-btn-down .fas') + + find('.tabs li, .tab-pane', this.tabset).forEach(function (it) { + it === tab || it === pane ? it.classList.add('is-active') : it.classList.remove('is-active') + var activeTabList = tab.classList.contains('is-active') + if (activeTabList) { + document.getElementById('activeTabItem').innerText = tab.innerText + dropdownMenu.classList.remove('show') + dropdownBtnIcon.classList.add('fa-chevron-circle-down') + dropdownBtnIcon.classList.remove('fa-chevron-circle-up') } - tabset.classList.remove('is-loading') }) +} - function activateTab (e) { - var tab = this.tab - var pane = this.pane - find('.tabs li, .tab-pane', this.tabset).forEach(function (it) { - it === tab || it === pane ? it.classList.add('is-active') : it.classList.remove('is-active') - }) +function find (selector, from) { + return Array.prototype.slice.call((from || document).querySelectorAll(selector)) +} +setTimeout(function () { + document.querySelector(' #activeTabItem').addEventListener('click', function (e) { e.preventDefault() - } - - function find (selector, from) { - return Array.prototype.slice.call((from || document).querySelectorAll(selector)) - } + }) +}, 3000) - function getPane (id, tabset) { - return find('.tab-pane', tabset).find(function (it) { - return it.getAttribute('aria-labelledby') === id - }) - } -})() +function getPane (id, tabset) { + return find('.tab-pane', tabset).find(function (it) { + return it.getAttribute('aria-labelledby') === id + }) +} diff --git a/src/js/06-page-rating.js b/src/js/06-page-rating.js new file mode 100644 index 0000000..76d4d10 --- /dev/null +++ b/src/js/06-page-rating.js @@ -0,0 +1,62 @@ +;(function () { + 'use strict' + + var dialogBox = document.getElementById('dialogBox') + var helpYesBtn = document.getElementById('yesBtn') + var helpNoBtn = document.getElementById('noBtn') + var skipBtnMsg = document.getElementById('skipBtnMsg') + var feedBackFormBox = document.getElementById('additionalFeedbackBox') + var leaveAddtinalBox = document.getElementById('leaveAddtinalBox') + var skipLeaveBtn = document.getElementById('skipLeaveBtn') + var feedBackMsg = document.querySelector('.feed-back-msg') + var submitBtn = document.querySelector('.submit-btn') + var leaveYesBtn = document.querySelector('.yes-btn') + var feedbackInfoBtn = document.querySelector('.info-btn') + var feedbackModal = document.querySelector('.feedback-modal') + var closeModalPopup = document.querySelector('.close-popup') + // for config + var yesBtnData = helpYesBtn.dataset + var noBtnData = helpNoBtn.dataset + + helpYesBtn.addEventListener('click', function (e) { + dialogBox.style.display = 'block' + this.classList.add('active') + helpNoBtn.classList.remove('active') + console.log(yesBtnData, 16) + }) + helpNoBtn.addEventListener('click', function (e) { + dialogBox.style.display = 'block' + this.classList.add('active') + helpYesBtn.classList.remove('active') + console.log(noBtnData, 27) + }) + + skipBtnMsg.addEventListener('click', function (e) { + feedBackFormBox.style.display = 'none' + leaveAddtinalBox.style.display = 'block' + }) + skipLeaveBtn.addEventListener('click', function (e) { + leaveAddtinalBox.style.display = 'none' + feedBackFormBox.style.display = 'block' + }) + + feedBackMsg.addEventListener('keyup', function (e) { + var textareaValue = this.value + + if (textareaValue !== '') { + submitBtn.classList.remove('disabled') + } else { + submitBtn.classList.add('disabled') + } + }) + leaveYesBtn.addEventListener('click', function (e) { + leaveAddtinalBox.style.display = 'none' + }) + feedbackInfoBtn.addEventListener('click', function (e) { + feedbackModal.classList.add('show') + }) + + closeModalPopup.addEventListener('click', function (e) { + feedbackModal.classList.remove('show') + }) +})() diff --git a/src/js/08-table-responsive.js b/src/js/08-table-responsive.js new file mode 100644 index 0000000..369737e --- /dev/null +++ b/src/js/08-table-responsive.js @@ -0,0 +1,57 @@ +;(function () { + 'use strict' + /* table js */ + + var smallBreak = 768 // Your small screen breakpoint in pixels + var tables = document.querySelectorAll('table.tableblock') + + window.onload = function () { + shapeTable() + } + window.addEventListener('resize', function () { + shapeTable() + }) + + function shapeTable () { + if (window.innerWidth < smallBreak) { + tables.forEach(function (elem, index) { + // console.log(elem.querySelector('tr')) + + var columns = elem.querySelectorAll('tbody tr').length + var rows = elem.querySelectorAll('thead tr th').length + for (var i = 1; i <= rows; i++) { + var ele = elem.querySelectorAll('th') + if (ele[i] !== undefined) { + var maxHeight = ele[i].offsetHeight + } + + for (var j = 1; j <= columns; j++) { + // console.log(i, j, 23) + if (elem.querySelector('tr:nth-child(' + j + ') td:nth-child(' + i + ')') != null && + elem.querySelector(' tr:nth-child(' + j + ') td:nth-child(' + i + ')') !== undefined) { + // console.log(elem.querySelector('tr:nth-child(' + j + ') td:nth-child(' + i + ')'), 25) + if (elem.querySelector('tr:nth-child(' + j + ') td:nth-child(' + i + ')').offsetHeight > maxHeight) { + maxHeight = elem.querySelector('tr:nth-child(' + j + ') td:nth-child(' + i + ')').offsetHeight + } + if (elem.querySelectorAll('tr:nth-child(' + j + ') td:nth-child(' + i + ')').scrollHeight > + elem.querySelector('tr:nth-child(' + j + ') td:nth-child(' + i + ')').offsetHeight) { + maxHeight = elem.querySelectorAll('tr:nth-child(' + j + ') td:nth-child(' + i + ')').scrollHeight + } + } + } + for (var k = 1; k <= columns; k++) { + if (elem.querySelector('tr:nth-child(' + k + ') td:nth-child(' + i + ')') != null && elem.querySelector( + 'tr:nth-child(' + k + ') td:nth-child(' + i + ')') !== undefined) { + elem.querySelector('tr:nth-child(' + k + ') td:nth-child(' + i + ')').style.height = maxHeight + 'px' + elem.querySelector('th:nth-child(' + i + ')').style.height = maxHeight + 'px' + } + } + } + }) + } else { + // document.querySelectorAll('table.tableblock td, table.tableblock th')[0].removeAttribute('style') + document.querySelectorAll('table.tableblock tbody tr td, table.tableblock thead tr th').forEach( + function (elem, ind) { elem.style.height = 'auto' }) + } + } +})() diff --git a/src/js/vendor/feedback.js b/src/js/vendor/feedback.js index 62e03df..d0c7d79 100644 --- a/src/js/vendor/feedback.js +++ b/src/js/vendor/feedback.js @@ -1,10 +1,11 @@ ;(function () { 'use strict' - if (Math.max(window.screen.availHeight, window.screen.availWidth) < 769) return + if (Math.max(window.screen.availHeight, window.screen.availWidth) > 769) return window.addEventListener('load', function () { var config = document.getElementById('feedback-script').dataset + console.log(config, config.collectorId, 8) var script = document.createElement('script') // eslint-disable-next-line max-len script.src = 'https://issues.couchbase.com/s/66cd330397e6b28e6a44bd3d603733a8-T/j9sjl8/802003/be0e2f3d0946caa44cd62a35c9de2f18/3.0.7/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector-embededjs/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector-embededjs.js?locale=en-US&collectorId=' + config.collectorId // prettier-ignore diff --git a/src/partials/head-last.hbs b/src/partials/head-last.hbs index dc7fb0d..764bf46 100644 --- a/src/partials/head-last.hbs +++ b/src/partials/head-last.hbs @@ -1,4 +1,10 @@ + {{!-- include fontAwesome CDN --}} + + {{!-- --}} {{#if env.OPTANON_SCRIPT_URL}} diff --git a/src/partials/toc.hbs b/src/partials/toc.hbs index 142e791..0794073 100644 --- a/src/partials/toc.hbs +++ b/src/partials/toc.hbs @@ -1,3 +1,59 @@ + + + +{{!-- --}} \ No newline at end of file