init
This commit is contained in:
@@ -0,0 +1,329 @@
|
||||
.esun-wiki-download-center {
|
||||
margin-top: 48px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__filters {
|
||||
display: grid;
|
||||
gap: 24px;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
||||
margin: 0 0 46px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__field {
|
||||
color: #6c9b73;
|
||||
display: grid;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
gap: 8px;
|
||||
letter-spacing: 2px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__field select {
|
||||
background: #fbfffc;
|
||||
border: 1px solid #dcefe4;
|
||||
border-radius: 10px;
|
||||
box-shadow: none;
|
||||
color: #333;
|
||||
font-size: 15px;
|
||||
font-weight: 400;
|
||||
height: 48px;
|
||||
letter-spacing: 0;
|
||||
padding: 0 18px;
|
||||
text-transform: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__count {
|
||||
align-items: center;
|
||||
color: #6c9b73;
|
||||
display: flex;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
gap: 8px;
|
||||
letter-spacing: 2px;
|
||||
margin: 0 0 22px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__count strong {
|
||||
align-items: center;
|
||||
background: #eef6f0;
|
||||
border-radius: 8px;
|
||||
color: #91a8bc;
|
||||
display: inline-flex;
|
||||
font-size: 12px;
|
||||
height: 22px;
|
||||
justify-content: center;
|
||||
min-width: 22px;
|
||||
padding: 0 7px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__empty {
|
||||
align-items: center;
|
||||
border: 2px dashed #e4edf7;
|
||||
border-radius: 16px;
|
||||
color: #64748b;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
min-height: 220px;
|
||||
padding: 44px 24px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__empty-icon {
|
||||
border: 4px solid #e6eef7;
|
||||
border-radius: 50%;
|
||||
display: block;
|
||||
height: 34px;
|
||||
margin-bottom: 22px;
|
||||
position: relative;
|
||||
width: 34px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__empty-icon::after {
|
||||
background: #e6eef7;
|
||||
content: "";
|
||||
height: 14px;
|
||||
position: absolute;
|
||||
right: -8px;
|
||||
top: 23px;
|
||||
transform: rotate(-45deg);
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__empty strong {
|
||||
color: #1f2937;
|
||||
font-size: 20px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__empty p {
|
||||
line-height: 1.55;
|
||||
margin: 0;
|
||||
max-width: 420px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__list {
|
||||
display: grid;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__item {
|
||||
align-items: center;
|
||||
border: 1px solid #dcefe4;
|
||||
border-radius: 12px;
|
||||
color: #1f2937;
|
||||
display: grid;
|
||||
gap: 22px;
|
||||
grid-template-columns: 48px minmax(0, 1fr) auto;
|
||||
min-height: 110px;
|
||||
padding: 22px 26px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__item:hover,
|
||||
.esun-wiki-download-center .esun-download-specifications__item:focus {
|
||||
border-color: #18a957;
|
||||
color: #1f2937;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__logo {
|
||||
align-items: center;
|
||||
background: #effaf3;
|
||||
border-radius: 8px;
|
||||
display: inline-flex;
|
||||
height: 48px;
|
||||
justify-content: center;
|
||||
width: 48px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__logo img {
|
||||
max-height: 34px;
|
||||
max-width: 34px;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__body {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__meta {
|
||||
align-items: center;
|
||||
color: #75a67a;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
font-size: 12px;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__brand {
|
||||
border: 1px solid #9fe4b8;
|
||||
border-radius: 5px;
|
||||
color: #18a957;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
padding: 2px 8px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__model::before {
|
||||
content: "\2022";
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__body strong {
|
||||
color: #111827;
|
||||
font-size: 22px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__info {
|
||||
color: #8db694;
|
||||
display: flex;
|
||||
font-size: 12px;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__action {
|
||||
align-items: center;
|
||||
display: inline-flex;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__download-text {
|
||||
color: #333;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__download-icon {
|
||||
align-items: center;
|
||||
background: #18a957;
|
||||
border-radius: 50%;
|
||||
display: inline-flex;
|
||||
height: 48px;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
width: 48px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__download-icon::before {
|
||||
border-bottom: 2px solid #fff;
|
||||
border-left: 2px solid #fff;
|
||||
content: "";
|
||||
height: 10px;
|
||||
margin-top: -4px;
|
||||
transform: rotate(-45deg);
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__download-icon::after {
|
||||
background: #fff;
|
||||
content: "";
|
||||
height: 16px;
|
||||
left: 50%;
|
||||
position: absolute;
|
||||
top: 14px;
|
||||
transform: translateX(-50%);
|
||||
width: 2px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__pagination {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
justify-content: center;
|
||||
margin-top: 32px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__pagination:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__page {
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
border: 1px solid #dcefe4;
|
||||
border-radius: 8px;
|
||||
color: #334155;
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
font-size: 14px;
|
||||
height: 38px;
|
||||
justify-content: center;
|
||||
min-width: 38px;
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__page:hover,
|
||||
.esun-wiki-download-center .esun-download-specifications__page:focus-visible {
|
||||
border-color: #18a957;
|
||||
color: #18a957;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__page.is-active {
|
||||
background: #18a957;
|
||||
border-color: #18a957;
|
||||
color: #fff;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__page:disabled {
|
||||
background: #f8fafc;
|
||||
border-color: #e5e7eb;
|
||||
color: #94a3b8;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__ellipsis {
|
||||
color: #94a3b8;
|
||||
min-width: 24px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.esun-wiki-download-center {
|
||||
margin-top: 32px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__filters {
|
||||
grid-template-columns: 1fr;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__item {
|
||||
gap: 16px;
|
||||
grid-template-columns: 42px minmax(0, 1fr);
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__logo {
|
||||
height: 42px;
|
||||
width: 42px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__body strong {
|
||||
font-size: 18px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__action {
|
||||
grid-column: 2;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__pagination {
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.esun-wiki-download-center .esun-download-specifications__page {
|
||||
height: 36px;
|
||||
min-width: 36px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,438 @@
|
||||
.esun-parameter-comparison {
|
||||
--pc-green: #17a957;
|
||||
--pc-dark: #303631;
|
||||
--pc-muted: #8a928d;
|
||||
--pc-line: #d9eadf;
|
||||
margin: 45px 0 55px;
|
||||
color: var(--pc-dark);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__app {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__selector {
|
||||
border: 1px solid var(--pc-line);
|
||||
border-radius: 18px;
|
||||
background: #fff;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__selector-row {
|
||||
display: block;
|
||||
padding: 28px 30px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__selector-row + .esun-parameter-comparison__selector-row {
|
||||
border-top: 1px solid var(--pc-line);
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__row-title strong {
|
||||
display: block;
|
||||
color: #4d735e;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
letter-spacing: .12em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__row-title span {
|
||||
display: block;
|
||||
margin-top: 7px;
|
||||
color: var(--pc-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__row-title {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__base-options {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__base-options label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-height: 42px;
|
||||
box-sizing: border-box;
|
||||
padding: 0 15px;
|
||||
border: 2px solid #cfe4d7;
|
||||
border-radius: 999px;
|
||||
color: #657069;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
transition: .2s ease;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__base-options input {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__dot {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
background: #afbeb5;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__base-options small {
|
||||
color: #8d9891;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__base-options label:has(input:checked) {
|
||||
border-color: var(--pc-green);
|
||||
background: #f2fbf6;
|
||||
color: var(--pc-green);
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__base-options label:has(input:checked) .esun-parameter-comparison__dot {
|
||||
background: var(--pc-green);
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__series-area {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__series-summary {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
margin-bottom: 14px;
|
||||
color: #747d77;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__series-summary strong {
|
||||
color: var(--pc-green);
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__series-list {
|
||||
column-count: 3;
|
||||
column-gap: 12px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__series-row {
|
||||
display: inline-block;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
margin: 0 0 12px;
|
||||
padding: 15px;
|
||||
border: 1px solid #dcebe1;
|
||||
border-radius: 12px;
|
||||
background: #fbfdfc;
|
||||
break-inside: avoid;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__series-name {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
gap: 8px;
|
||||
padding: 0 0 11px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__series-name strong {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__series-name span {
|
||||
min-width: 27px;
|
||||
padding: 2px 7px;
|
||||
border: 1px solid #cce6d6;
|
||||
border-radius: 999px;
|
||||
background: #f2faf5;
|
||||
color: #55976f;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__series-products {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 7px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__product {
|
||||
min-height: 36px;
|
||||
max-width: 100%;
|
||||
padding: 0 12px;
|
||||
border: 1px solid #cfe1d5;
|
||||
border-radius: 999px;
|
||||
background: #fff;
|
||||
color: #68726c;
|
||||
font-size: 13px;
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__product:hover,
|
||||
.esun-parameter-comparison__product.is-selected {
|
||||
border-color: var(--pc-green);
|
||||
background: var(--pc-green);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__product:disabled {
|
||||
opacity: .45;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__notice {
|
||||
min-height: 20px;
|
||||
margin: 7px 0 0;
|
||||
color: #b43e32;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__selected {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 9px;
|
||||
min-height: 40px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__selected-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 7px 9px 7px 14px;
|
||||
border: 1px solid #b9dfc8;
|
||||
border-radius: 999px;
|
||||
background: #f0faf4;
|
||||
color: #315e43;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__selected-pill button,
|
||||
.esun-parameter-comparison thead button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 50%;
|
||||
background: #dcefe3;
|
||||
color: #4c7a5e;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__comparison {
|
||||
margin-top: 36px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__comparison-head {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
gap: 24px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__comparison-head h2 {
|
||||
margin: 0 0 4px;
|
||||
font-size: 23px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__comparison-head p {
|
||||
margin: 0;
|
||||
color: var(--pc-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__modes {
|
||||
display: inline-flex;
|
||||
padding: 4px;
|
||||
border: 1px solid var(--pc-line);
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__modes button {
|
||||
padding: 9px 16px;
|
||||
border: 0;
|
||||
border-radius: 7px;
|
||||
background: transparent;
|
||||
color: #929a95;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__modes button.is-active {
|
||||
background: var(--pc-green);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__placeholder {
|
||||
padding: 52px 25px;
|
||||
border: 1px solid var(--pc-line);
|
||||
border-radius: 14px;
|
||||
color: var(--pc-muted);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__table-wrap {
|
||||
display: none;
|
||||
max-height: 720px;
|
||||
border: 1px solid var(--pc-line);
|
||||
border-radius: 14px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison table {
|
||||
width: 100%;
|
||||
min-width: 780px;
|
||||
margin: 0;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__table-wrap.is-single table {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__table-wrap.is-single th:first-child {
|
||||
width: 46%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison th,
|
||||
.esun-parameter-comparison td {
|
||||
padding: 15px 18px;
|
||||
border-right: 1px solid #e3eee7;
|
||||
border-bottom: 1px solid #e3eee7;
|
||||
background: #fff;
|
||||
color: var(--pc-dark);
|
||||
vertical-align: top;
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison thead th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 3;
|
||||
background: #f4faf6;
|
||||
color: var(--pc-dark) !important;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison thead th span {
|
||||
margin-right: 9px;
|
||||
color: var(--pc-dark) !important;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison th:first-child {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
z-index: 2;
|
||||
width: 29%;
|
||||
min-width: 245px;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison thead th:first-child {
|
||||
z-index: 4;
|
||||
}
|
||||
|
||||
.esun-parameter-comparison__group-row th {
|
||||
left: 0;
|
||||
z-index: 2;
|
||||
background: #eff9f3;
|
||||
color: var(--pc-green);
|
||||
font-size: 13px;
|
||||
letter-spacing: .09em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.esun-parameter-comparison__selector-row {
|
||||
padding: 24px 22px;
|
||||
}
|
||||
.esun-parameter-comparison__series-list {
|
||||
column-count: 2;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.esun-parameter-comparison {
|
||||
margin: 28px 0 40px;
|
||||
}
|
||||
.esun-parameter-comparison__selector-row {
|
||||
padding: 18px 14px;
|
||||
}
|
||||
.esun-parameter-comparison__row-title {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.esun-parameter-comparison__base-options {
|
||||
flex-wrap: nowrap;
|
||||
padding-bottom: 5px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
.esun-parameter-comparison__base-options label {
|
||||
flex: 0 0 auto;
|
||||
min-height: 36px;
|
||||
padding: 0 11px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.esun-parameter-comparison__base-options label:has(input:checked) {
|
||||
padding: 0 11px;
|
||||
}
|
||||
.esun-parameter-comparison__series-row {
|
||||
padding: 13px;
|
||||
}
|
||||
.esun-parameter-comparison__series-name {
|
||||
justify-content: flex-start;
|
||||
padding-top: 2px;
|
||||
}
|
||||
.esun-parameter-comparison__series-products {
|
||||
gap: 7px;
|
||||
}
|
||||
.esun-parameter-comparison__series-list {
|
||||
column-count: 1;
|
||||
}
|
||||
.esun-parameter-comparison__product {
|
||||
min-height: 33px;
|
||||
padding: 0 11px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.esun-parameter-comparison__comparison-head {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
.esun-parameter-comparison__comparison-head h2 {
|
||||
font-size: 20px;
|
||||
}
|
||||
.esun-parameter-comparison__modes {
|
||||
overflow-x: auto;
|
||||
}
|
||||
.esun-parameter-comparison__modes button {
|
||||
flex: 0 0 auto;
|
||||
padding: 8px 11px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.esun-parameter-comparison th,
|
||||
.esun-parameter-comparison td {
|
||||
padding: 11px 12px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.esun-parameter-comparison__table-wrap:not(.is-single) table {
|
||||
min-width: 680px;
|
||||
}
|
||||
.esun-parameter-comparison__table-wrap.is-single table {
|
||||
width: 100%;
|
||||
table-layout: fixed;
|
||||
}
|
||||
.esun-parameter-comparison__table-wrap.is-single th,
|
||||
.esun-parameter-comparison__table-wrap.is-single td {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,211 @@
|
||||
define(['jquery', 'mage/translate'], function ($, $t) {
|
||||
'use strict';
|
||||
|
||||
return function (config, element) {
|
||||
var $root = $(element),
|
||||
items = config.items || [],
|
||||
archives = config.archives || [],
|
||||
brands = config.brands || [],
|
||||
modelsByBrand = config.modelsByBrand || {},
|
||||
pageSize = 20,
|
||||
currentPage = 1,
|
||||
$brand = $root.find('[data-role="spec-brand"]'),
|
||||
$model = $root.find('[data-role="spec-model"]'),
|
||||
$count = $root.find('[data-role="spec-count"]'),
|
||||
$empty = $root.find('[data-role="spec-empty"]'),
|
||||
$list = $root.find('[data-role="spec-list"]'),
|
||||
$pagination = $root.find('[data-role="spec-pagination"]');
|
||||
|
||||
function renderBrands() {
|
||||
$.each(brands, function (_, brandItem) {
|
||||
$('<option/>', {
|
||||
value: brandItem.id,
|
||||
text: brandItem.name
|
||||
}).appendTo($brand);
|
||||
});
|
||||
}
|
||||
|
||||
function renderModels() {
|
||||
var brandId = $brand.val(),
|
||||
models = brandId ? (modelsByBrand[brandId] || []).slice() : [];
|
||||
|
||||
if (!brandId) {
|
||||
$.each(modelsByBrand, function (_, brandModels) {
|
||||
$.each(brandModels, function (_, modelName) {
|
||||
if ($.inArray(modelName, models) === -1) {
|
||||
models.push(modelName);
|
||||
}
|
||||
});
|
||||
});
|
||||
models.sort();
|
||||
}
|
||||
|
||||
$model.empty().append($('<option/>', {
|
||||
value: '',
|
||||
text: $t('All Models')
|
||||
}));
|
||||
$.each(models, function (_, modelName) {
|
||||
$('<option/>', {
|
||||
value: modelName,
|
||||
text: modelName
|
||||
}).appendTo($model);
|
||||
});
|
||||
}
|
||||
|
||||
function filterItems() {
|
||||
var brandId = $brand.val(),
|
||||
modelName = $model.val(),
|
||||
results;
|
||||
|
||||
if (!brandId && !modelName) {
|
||||
return archives.slice();
|
||||
}
|
||||
|
||||
results = $.grep(items, function (item) {
|
||||
return (!brandId || String(item.brand_id) === String(brandId)) &&
|
||||
(!modelName || item.model_name === modelName);
|
||||
});
|
||||
|
||||
if (brandId) {
|
||||
results = $.grep(archives, function (archive) {
|
||||
return String(archive.brand_id) === String(brandId);
|
||||
}).concat(results);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
function createPageButton(label, page, options) {
|
||||
var settings = options || {},
|
||||
$button = $('<button/>', {
|
||||
'class': 'esun-download-specifications__page' + (settings.active ? ' is-active' : ''),
|
||||
type: 'button',
|
||||
text: label,
|
||||
disabled: settings.disabled || false,
|
||||
'aria-label': settings.ariaLabel || null,
|
||||
'aria-current': settings.active ? 'page' : null
|
||||
});
|
||||
|
||||
if (!settings.disabled && !settings.active) {
|
||||
$button.on('click', function () {
|
||||
currentPage = page;
|
||||
renderList();
|
||||
$root.get(0).scrollIntoView({behavior: 'smooth', block: 'start'});
|
||||
});
|
||||
}
|
||||
|
||||
return $button;
|
||||
}
|
||||
|
||||
function renderPagination(totalPages) {
|
||||
var pages = [],
|
||||
previousPage = 0;
|
||||
|
||||
$pagination.empty();
|
||||
if (totalPages <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
$pagination.append(createPageButton($t('Previous'), currentPage - 1, {
|
||||
disabled: currentPage === 1,
|
||||
ariaLabel: $t('Previous page')
|
||||
}));
|
||||
|
||||
for (var page = 1; page <= totalPages; page++) {
|
||||
if (page === 1 || page === totalPages || Math.abs(page - currentPage) <= 2) {
|
||||
pages.push(page);
|
||||
}
|
||||
}
|
||||
|
||||
$.each(pages, function (_, page) {
|
||||
if (previousPage && page - previousPage > 1) {
|
||||
$('<span/>', {
|
||||
'class': 'esun-download-specifications__ellipsis',
|
||||
text: '…',
|
||||
'aria-hidden': 'true'
|
||||
}).appendTo($pagination);
|
||||
}
|
||||
$pagination.append(createPageButton(String(page), page, {
|
||||
active: page === currentPage,
|
||||
ariaLabel: $t('Page %1').replace('%1', page)
|
||||
}));
|
||||
previousPage = page;
|
||||
});
|
||||
|
||||
$pagination.append(createPageButton($t('Next'), currentPage + 1, {
|
||||
disabled: currentPage === totalPages,
|
||||
ariaLabel: $t('Next page')
|
||||
}));
|
||||
}
|
||||
|
||||
function renderItem(item) {
|
||||
var $item = $('<a/>', {
|
||||
'class': 'esun-download-specifications__item',
|
||||
href: item.file_url,
|
||||
download: item.file_name
|
||||
}),
|
||||
$logo = $('<span/>', {'class': 'esun-download-specifications__logo'}),
|
||||
$body = $('<span/>', {'class': 'esun-download-specifications__body'}),
|
||||
$meta = $('<span/>', {'class': 'esun-download-specifications__meta'}),
|
||||
$info = $('<span/>', {'class': 'esun-download-specifications__info'}),
|
||||
$action = $('<span/>', {'class': 'esun-download-specifications__action'});
|
||||
|
||||
if (item.brand_logo_url) {
|
||||
$('<img/>', {src: item.brand_logo_url, alt: ''}).appendTo($logo);
|
||||
}
|
||||
|
||||
$('<span/>', {'class': 'esun-download-specifications__brand', text: item.brand_name}).appendTo($meta);
|
||||
if (item.model_name) {
|
||||
$('<span/>', {'class': 'esun-download-specifications__model', text: item.model_name}).appendTo($meta);
|
||||
}
|
||||
$('<strong/>', {text: item.file_name}).appendTo($body);
|
||||
$('<span/>', {text: item.file_size_label}).appendTo($info);
|
||||
if (item.file_date) {
|
||||
$('<span/>', {text: item.file_date}).appendTo($info);
|
||||
}
|
||||
$('<span/>', {
|
||||
'class': 'esun-download-specifications__download-text',
|
||||
text: $t('Download')
|
||||
}).appendTo($action);
|
||||
$('<span/>', {'class': 'esun-download-specifications__download-icon'}).appendTo($action);
|
||||
|
||||
$body.prepend($meta).append($info);
|
||||
$item.append($logo, $body, $action).appendTo($list);
|
||||
}
|
||||
|
||||
function renderList() {
|
||||
var results = filterItems(),
|
||||
totalPages = Math.ceil(results.length / pageSize),
|
||||
start;
|
||||
|
||||
if (totalPages > 0 && currentPage > totalPages) {
|
||||
currentPage = totalPages;
|
||||
}
|
||||
|
||||
$count.text(results.length);
|
||||
$list.empty();
|
||||
$empty.toggle(results.length === 0);
|
||||
$list.toggle(results.length > 0);
|
||||
|
||||
start = (currentPage - 1) * pageSize;
|
||||
$.each(results.slice(start, start + pageSize), function (_, item) {
|
||||
renderItem(item);
|
||||
});
|
||||
renderPagination(totalPages);
|
||||
}
|
||||
|
||||
renderBrands();
|
||||
renderModels();
|
||||
renderList();
|
||||
|
||||
$brand.on('change', function () {
|
||||
currentPage = 1;
|
||||
renderModels();
|
||||
renderList();
|
||||
});
|
||||
$model.on('change', function () {
|
||||
currentPage = 1;
|
||||
renderList();
|
||||
});
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,236 @@
|
||||
define(['jquery', 'mage/translate'], function ($, $t) {
|
||||
'use strict';
|
||||
|
||||
return function (config, element) {
|
||||
var $root = $(element),
|
||||
rawConfig = $root.find('[data-role="parameter-config"]').text(),
|
||||
data = rawConfig ? JSON.parse(rawConfig) : {},
|
||||
products = data.products || [],
|
||||
applicationOptions = data.applicationOptions || [],
|
||||
messages = data.messages || {},
|
||||
maximum = 6,
|
||||
selected = [],
|
||||
mode = 'key',
|
||||
keyParameters = [
|
||||
'Density(g/cm3) (unit to be confirmed)',
|
||||
'Heat Distortion Temperature(°C)',
|
||||
'Tensile Strength (XY) (MPa)',
|
||||
'Elongation at Break (XY) (%)',
|
||||
'Flexural Strength (XY) (MPa)',
|
||||
'Flexural Modulus (XY) (MPa)',
|
||||
'IZOD Impact Strength (XY) (kJ/m²)',
|
||||
'Extruder Temperature(°C)',
|
||||
'Bed Temperature(°C)',
|
||||
'Fan Speed(%)',
|
||||
'Printing Speed(mm/s) (high-speed printing parameter)',
|
||||
'Printing Recommendation',
|
||||
'Drying'
|
||||
],
|
||||
$seriesList = $root.find('[data-role="series-list"]'),
|
||||
$selectedMaterials = $root.find('[data-role="selected-materials"]'),
|
||||
$notice = $root.find('[data-role="material-notice"]'),
|
||||
$selectionCount = $root.find('[data-role="selection-count"]'),
|
||||
$comparisonCount = $root.find('[data-role="comparison-count"]'),
|
||||
$resultCount = $root.find('[data-role="result-count"]'),
|
||||
$placeholder = $root.find('[data-role="comparison-placeholder"]'),
|
||||
$tableWrap = $root.find('[data-role="comparison-table-wrap"]'),
|
||||
$head = $root.find('[data-role="comparison-head"]'),
|
||||
$body = $root.find('[data-role="comparison-body"]');
|
||||
|
||||
function selectedBase() {
|
||||
return $root.find('[data-role="base-filter"]:checked').val() || '';
|
||||
}
|
||||
|
||||
function productsForBase() {
|
||||
var base = selectedBase();
|
||||
return $.grep(products, function (product) { return product.base === base; });
|
||||
}
|
||||
|
||||
function primaryApplication(product) {
|
||||
return product.applications && product.applications.length ? product.applications[0] : 'other';
|
||||
}
|
||||
|
||||
function applicationLabel(value) {
|
||||
var option = applicationOptions.find(function (item) { return item.value === value; });
|
||||
return option ? option.label : $t('Other Series');
|
||||
}
|
||||
|
||||
function isSelected(id) {
|
||||
return $.inArray(id, selected) !== -1;
|
||||
}
|
||||
|
||||
function findProduct(id) {
|
||||
return products.find(function (product) { return product.id === id; });
|
||||
}
|
||||
|
||||
function renderSeries() {
|
||||
var baseProducts = productsForBase(), groups = {};
|
||||
$.each(baseProducts, function (_, product) {
|
||||
var application = primaryApplication(product);
|
||||
groups[application] = groups[application] || [];
|
||||
groups[application].push(product);
|
||||
});
|
||||
|
||||
$seriesList.empty();
|
||||
$.each(applicationOptions, function (_, option) {
|
||||
var groupProducts = groups[option.value] || [];
|
||||
if (!groupProducts.length) {
|
||||
return;
|
||||
}
|
||||
renderSeriesRow(option.label, groupProducts);
|
||||
delete groups[option.value];
|
||||
});
|
||||
$.each(groups, function (application, groupProducts) {
|
||||
renderSeriesRow(applicationLabel(application), groupProducts);
|
||||
});
|
||||
|
||||
$resultCount.text(baseProducts.length);
|
||||
updateSelection();
|
||||
}
|
||||
|
||||
function renderSeriesRow(label, groupProducts) {
|
||||
var $row = $('<div/>', {'class': 'esun-parameter-comparison__series-row'}),
|
||||
$label = $('<div/>', {'class': 'esun-parameter-comparison__series-name'}),
|
||||
$products = $('<div/>', {'class': 'esun-parameter-comparison__series-products'});
|
||||
|
||||
$label.append($('<strong/>', {text: label}), $('<span/>', {text: groupProducts.length}));
|
||||
$.each(groupProducts, function (_, product) {
|
||||
$('<button/>', {
|
||||
type: 'button',
|
||||
'class': 'esun-parameter-comparison__product' + (isSelected(product.id) ? ' is-selected' : ''),
|
||||
text: product.name,
|
||||
title: product.name,
|
||||
disabled: !isSelected(product.id) && selected.length >= maximum,
|
||||
'data-role': 'material-option',
|
||||
'data-id': product.id
|
||||
}).appendTo($products);
|
||||
});
|
||||
$row.append($label, $products).appendTo($seriesList);
|
||||
}
|
||||
|
||||
function updateSelection() {
|
||||
$selectionCount.text(selected.length);
|
||||
$comparisonCount.text(selected.length);
|
||||
$selectedMaterials.empty();
|
||||
$.each(selected, function (_, id) {
|
||||
var product = findProduct(id), $pill;
|
||||
if (!product) {
|
||||
return;
|
||||
}
|
||||
$pill = $('<span/>', {'class': 'esun-parameter-comparison__selected-pill'});
|
||||
$pill.append(
|
||||
$('<span/>', {text: product.name}),
|
||||
$('<button/>', {
|
||||
type: 'button',
|
||||
text: '×',
|
||||
'aria-label': $t('Remove %1').replace('%1', product.name),
|
||||
'data-role': 'remove-material',
|
||||
'data-id': id
|
||||
})
|
||||
).appendTo($selectedMaterials);
|
||||
});
|
||||
renderComparison();
|
||||
}
|
||||
|
||||
function removeMaterial(id) {
|
||||
selected = $.grep(selected, function (selectedId) { return selectedId !== id; });
|
||||
$notice.text('');
|
||||
renderSeries();
|
||||
}
|
||||
|
||||
function parameterIsVisible(name, values) {
|
||||
if (mode === 'key' && $.inArray(name, keyParameters) === -1) {
|
||||
return false;
|
||||
}
|
||||
if (mode === 'differences') {
|
||||
return values.filter(function (value, index, array) {
|
||||
return array.indexOf(value) === index;
|
||||
}).length > 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function renderComparison() {
|
||||
var selectedProducts = $.map(selected, findProduct),
|
||||
groups = data.parameterGroups || {};
|
||||
$head.empty();
|
||||
$body.empty();
|
||||
|
||||
if (selectedProducts.length < 1) {
|
||||
$placeholder.show();
|
||||
$tableWrap.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
$tableWrap.toggleClass('is-single', selectedProducts.length === 1);
|
||||
|
||||
var $headerRow = $('<tr/>').append($('<th/>', {text: $t('Parameter')}));
|
||||
$.each(selectedProducts, function (_, product) {
|
||||
var $name = $('<span/>', {text: product.name}),
|
||||
$remove = $('<button/>', {
|
||||
type: 'button', text: '×',
|
||||
'aria-label': $t('Remove %1').replace('%1', product.name),
|
||||
'data-role': 'remove-material', 'data-id': product.id
|
||||
});
|
||||
$headerRow.append($('<th/>').append($name, $remove));
|
||||
});
|
||||
$head.append($headerRow);
|
||||
|
||||
$.each(groups, function (groupName, parameters) {
|
||||
var rows = [];
|
||||
$.each(parameters, function (_, parameterName) {
|
||||
var values = $.map(selectedProducts, function (product) {
|
||||
var value = product.groups[groupName] && product.groups[groupName][parameterName];
|
||||
return value === undefined || value === null || value === ''
|
||||
? (messages.missingValue || '—') : String(value);
|
||||
});
|
||||
if (!parameterIsVisible(parameterName, values)) {
|
||||
return;
|
||||
}
|
||||
var $row = $('<tr/>').append($('<th/>', {scope: 'row', text: parameterName}));
|
||||
$.each(values, function (_, value) { $row.append($('<td/>').text(value)); });
|
||||
rows.push($row);
|
||||
});
|
||||
if (rows.length) {
|
||||
$body.append($('<tr/>', {'class': 'esun-parameter-comparison__group-row'})
|
||||
.append($('<th/>', {colspan: selectedProducts.length + 1, text: groupName})));
|
||||
$.each(rows, function (_, row) { $body.append(row); });
|
||||
}
|
||||
});
|
||||
|
||||
$placeholder.hide();
|
||||
$tableWrap.show();
|
||||
}
|
||||
|
||||
$root.on('change', '[data-role="base-filter"]', function () {
|
||||
selected = [];
|
||||
$notice.text('');
|
||||
renderSeries();
|
||||
});
|
||||
$root.on('click', '[data-role="material-option"]', function () {
|
||||
var id = $(this).data('id');
|
||||
if (isSelected(id)) {
|
||||
removeMaterial(id);
|
||||
return;
|
||||
}
|
||||
if (selected.length >= maximum) {
|
||||
$notice.text($t('You can compare up to 6 materials.'));
|
||||
return;
|
||||
}
|
||||
selected.push(id);
|
||||
$notice.text('');
|
||||
renderSeries();
|
||||
});
|
||||
$root.on('click', '[data-role="remove-material"]', function () {
|
||||
removeMaterial($(this).data('id'));
|
||||
});
|
||||
$root.on('click', '[data-role="comparison-mode"]', function () {
|
||||
mode = $(this).data('mode');
|
||||
$root.find('[data-role="comparison-mode"]').removeClass('is-active');
|
||||
$(this).addClass('is-active');
|
||||
renderComparison();
|
||||
});
|
||||
|
||||
renderSeries();
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,296 @@
|
||||
define([
|
||||
'jquery'
|
||||
], function ($) {
|
||||
'use strict';
|
||||
|
||||
return function (config, element) {
|
||||
var $root = $(element),
|
||||
$activeTrigger = $(),
|
||||
$activeTooltip = $(),
|
||||
$drawers = $root.find('[data-wiki-drawer]'),
|
||||
$drawerBackdrop = $root.find('.esun-wiki-drawer-backdrop'),
|
||||
$activeDrawer = $(),
|
||||
$activeDrawerTrigger = $(),
|
||||
drawerMedia = window.matchMedia('(max-width: 860px)'),
|
||||
hideTimer = null;
|
||||
|
||||
function syncSearchClear($input) {
|
||||
var hasValue = $.trim($input.val()).length > 0;
|
||||
|
||||
$input.closest('form').find('.esun-wiki-search-clear').toggleClass('is-visible', hasValue);
|
||||
}
|
||||
|
||||
function cancelTooltipHide() {
|
||||
if (hideTimer) {
|
||||
window.clearTimeout(hideTimer);
|
||||
hideTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
function positionTooltip($trigger, $tooltip) {
|
||||
var triggerRect = $trigger[0].getBoundingClientRect(),
|
||||
viewportWidth = window.innerWidth || document.documentElement.clientWidth,
|
||||
viewportHeight = window.innerHeight || document.documentElement.clientHeight,
|
||||
gutter = 14,
|
||||
gap = 18,
|
||||
tooltipWidth,
|
||||
tooltipHeight,
|
||||
left,
|
||||
top,
|
||||
arrowLeft,
|
||||
showBelow;
|
||||
|
||||
$tooltip
|
||||
.addClass('is-active')
|
||||
.css({left: 0, top: 0, visibility: 'hidden'});
|
||||
|
||||
tooltipWidth = $tooltip.outerWidth();
|
||||
tooltipHeight = $tooltip.outerHeight();
|
||||
left = triggerRect.left + (triggerRect.width / 2) - (tooltipWidth / 2);
|
||||
left = Math.max(gutter, Math.min(left, viewportWidth - tooltipWidth - gutter));
|
||||
top = triggerRect.top - tooltipHeight - gap;
|
||||
showBelow = top < gutter;
|
||||
|
||||
if (showBelow) {
|
||||
top = triggerRect.bottom + gap;
|
||||
}
|
||||
|
||||
top = Math.max(gutter, Math.min(top, viewportHeight - tooltipHeight - gutter));
|
||||
arrowLeft = triggerRect.left + (triggerRect.width / 2) - left;
|
||||
arrowLeft = Math.max(26, Math.min(arrowLeft, tooltipWidth - 26));
|
||||
|
||||
$tooltip
|
||||
.toggleClass('is-below', showBelow)
|
||||
.css({
|
||||
left: Math.round(left),
|
||||
top: Math.round(top),
|
||||
visibility: 'visible',
|
||||
'--esun-wiki-tip-arrow-left': Math.round(arrowLeft) + 'px'
|
||||
});
|
||||
}
|
||||
|
||||
function closeTooltip(restoreFocus) {
|
||||
cancelTooltipHide();
|
||||
|
||||
if ($activeTooltip.length) {
|
||||
$activeTooltip
|
||||
.removeClass('is-active is-below')
|
||||
.attr('aria-hidden', 'true')
|
||||
.removeAttr('style');
|
||||
}
|
||||
|
||||
if ($activeTrigger.length) {
|
||||
$activeTrigger.attr('aria-expanded', 'false');
|
||||
if (restoreFocus) {
|
||||
$activeTrigger.trigger('focus');
|
||||
}
|
||||
}
|
||||
|
||||
$activeTrigger = $();
|
||||
$activeTooltip = $();
|
||||
}
|
||||
|
||||
function showTooltip($trigger) {
|
||||
var tooltipId = $trigger.attr('data-wiki-tip'),
|
||||
$tooltip = $root.find('[data-wiki-tooltip-id="' + tooltipId + '"]');
|
||||
|
||||
if (!$tooltip.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
cancelTooltipHide();
|
||||
if ($activeTooltip.length && $activeTooltip[0] !== $tooltip[0]) {
|
||||
closeTooltip(false);
|
||||
}
|
||||
|
||||
$activeTrigger = $trigger;
|
||||
$activeTooltip = $tooltip;
|
||||
$trigger.attr('aria-expanded', 'true');
|
||||
$tooltip.attr('aria-hidden', 'false');
|
||||
positionTooltip($trigger, $tooltip);
|
||||
}
|
||||
|
||||
function scheduleTooltipHide() {
|
||||
cancelTooltipHide();
|
||||
hideTimer = window.setTimeout(function () {
|
||||
closeTooltip(false);
|
||||
}, 140);
|
||||
}
|
||||
|
||||
function closeDrawer(restoreFocus) {
|
||||
var $trigger = $activeDrawerTrigger;
|
||||
|
||||
$drawers.removeClass('is-open');
|
||||
$root.find('[data-wiki-drawer-open]').attr('aria-expanded', 'false');
|
||||
$drawerBackdrop.removeClass('is-visible').attr('aria-hidden', 'true');
|
||||
$('html, body').removeClass('esun-wiki-drawer-lock');
|
||||
|
||||
if (restoreFocus && $trigger.length) {
|
||||
$trigger.trigger('focus');
|
||||
}
|
||||
|
||||
if (drawerMedia.matches) {
|
||||
$drawers.attr('aria-hidden', 'true');
|
||||
} else {
|
||||
$drawers.removeAttr('aria-hidden');
|
||||
}
|
||||
|
||||
$activeDrawer = $();
|
||||
$activeDrawerTrigger = $();
|
||||
}
|
||||
|
||||
function openDrawer(name, $trigger) {
|
||||
var $drawer;
|
||||
|
||||
if (!drawerMedia.matches) {
|
||||
return;
|
||||
}
|
||||
|
||||
$drawer = $drawers.filter('[data-wiki-drawer="' + name + '"]');
|
||||
if (!$drawer.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
closeTooltip(false);
|
||||
closeDrawer(false);
|
||||
$activeDrawer = $drawer;
|
||||
$activeDrawerTrigger = $trigger;
|
||||
$drawer.addClass('is-open').attr('aria-hidden', 'false');
|
||||
$trigger.attr('aria-expanded', 'true');
|
||||
$drawerBackdrop.addClass('is-visible').attr('aria-hidden', 'false');
|
||||
$('html, body').addClass('esun-wiki-drawer-lock');
|
||||
|
||||
window.setTimeout(function () {
|
||||
if ($drawer.hasClass('is-open')) {
|
||||
$drawer.find('.esun-wiki-drawer-close').first().trigger('focus');
|
||||
}
|
||||
}, 220);
|
||||
}
|
||||
|
||||
function syncDrawerMode() {
|
||||
closeDrawer(false);
|
||||
}
|
||||
|
||||
function trapDrawerFocus(event) {
|
||||
var $focusable,
|
||||
first,
|
||||
last;
|
||||
|
||||
if (event.key !== 'Tab' || !$activeDrawer.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
$focusable = $activeDrawer
|
||||
.find('a[href], button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])')
|
||||
.filter(':visible');
|
||||
|
||||
if (!$focusable.length) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
first = $focusable[0];
|
||||
last = $focusable[$focusable.length - 1];
|
||||
|
||||
if (event.shiftKey && document.activeElement === first) {
|
||||
event.preventDefault();
|
||||
$(last).trigger('focus');
|
||||
} else if (!event.shiftKey && document.activeElement === last) {
|
||||
event.preventDefault();
|
||||
$(first).trigger('focus');
|
||||
}
|
||||
}
|
||||
|
||||
$root.find('.esun-wiki-search input[type="search"]').each(function () {
|
||||
syncSearchClear($(this));
|
||||
});
|
||||
|
||||
$root.on('click', '.esun-wiki-tree-toggle', function () {
|
||||
var $button = $(this),
|
||||
$item = $button.closest('.esun-wiki-tree-item'),
|
||||
isOpen = !$item.hasClass('is-open');
|
||||
|
||||
$item.toggleClass('is-open', isOpen);
|
||||
$button.attr('aria-expanded', isOpen ? 'true' : 'false');
|
||||
});
|
||||
|
||||
$root.on('input change', '.esun-wiki-search input[type="search"]', function () {
|
||||
syncSearchClear($(this));
|
||||
});
|
||||
|
||||
$root.on('click', '.esun-wiki-search-clear', function () {
|
||||
var $form = $(this).closest('form'),
|
||||
$input = $form.find('input[type="search"]');
|
||||
|
||||
$input.val('').trigger('focus');
|
||||
syncSearchClear($input);
|
||||
if (window.location.search.indexOf('q=') !== -1) {
|
||||
window.location.href = $form.attr('action');
|
||||
}
|
||||
});
|
||||
|
||||
$root.on('click', '[data-wiki-drawer-open]', function () {
|
||||
openDrawer($(this).attr('data-wiki-drawer-open'), $(this));
|
||||
});
|
||||
|
||||
$root.on('click', '[data-wiki-drawer-close]', function () {
|
||||
closeDrawer(true);
|
||||
});
|
||||
|
||||
$root.on('click', '.esun-wiki-toc a, .esun-wiki-sidebar a.esun-wiki-tree-link', function () {
|
||||
if (drawerMedia.matches) {
|
||||
closeDrawer(false);
|
||||
}
|
||||
});
|
||||
|
||||
$root.on('mouseenter focusin', '.esun-wiki-tip-trigger', function () {
|
||||
showTooltip($(this));
|
||||
});
|
||||
|
||||
$root.on('mouseleave focusout', '.esun-wiki-tip-trigger', scheduleTooltipHide);
|
||||
|
||||
$root.on('click', '.esun-wiki-tip-trigger', function (event) {
|
||||
event.preventDefault();
|
||||
showTooltip($(this));
|
||||
});
|
||||
|
||||
$root.on('mouseenter focusin', '.esun-wiki-tooltip', cancelTooltipHide);
|
||||
$root.on('mouseleave focusout', '.esun-wiki-tooltip', scheduleTooltipHide);
|
||||
|
||||
$(window).on('resize.esunWikiTooltip', function () {
|
||||
if ($activeTrigger.length && $activeTooltip.length) {
|
||||
positionTooltip($activeTrigger, $activeTooltip);
|
||||
}
|
||||
});
|
||||
|
||||
$(window).on('scroll.esunWikiTooltip', function () {
|
||||
if ($activeTrigger.length && $activeTooltip.length) {
|
||||
positionTooltip($activeTrigger, $activeTooltip);
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('mousedown.esunWikiTooltip touchstart.esunWikiTooltip', function (event) {
|
||||
if (!$(event.target).closest('.esun-wiki-tip-trigger, .esun-wiki-tooltip').length) {
|
||||
closeTooltip(false);
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('keydown.esunWikiTooltip', function (event) {
|
||||
if (event.key === 'Escape' && $activeDrawer.length) {
|
||||
closeDrawer(true);
|
||||
} else if (event.key === 'Escape' && $activeTooltip.length) {
|
||||
closeTooltip(true);
|
||||
}
|
||||
|
||||
trapDrawerFocus(event);
|
||||
});
|
||||
|
||||
if (drawerMedia.addEventListener) {
|
||||
drawerMedia.addEventListener('change', syncDrawerMode);
|
||||
} else {
|
||||
drawerMedia.addListener(syncDrawerMode);
|
||||
}
|
||||
|
||||
syncDrawerMode();
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user