This commit is contained in:
147
public/assets/scaffolding-min.js
vendored
147
public/assets/scaffolding-min.js
vendored
@@ -3014,13 +3014,8 @@ Prism.languages.webmanifest = Prism.languages.json;
|
||||
|
||||
/***/ }),
|
||||
/* 8 */
|
||||
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
||||
/***/ (function(module) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ init: function() { return /* binding */ init; }
|
||||
/* harmony export */ });
|
||||
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
||||
@@ -3122,35 +3117,37 @@ var calculateStickyPosition = function calculateStickyPosition(s) {
|
||||
});
|
||||
}
|
||||
};
|
||||
function init() {
|
||||
var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
||||
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px", ""));
|
||||
p.querySelectorAll("sticky-note").forEach(function (s) {
|
||||
if (s.querySelectorAll("svg").length == 0) {
|
||||
var wrapper = document.createElement("sticky-note-wrapper");
|
||||
s.parentNode.insertBefore(wrapper, s);
|
||||
wrapper.appendChild(s);
|
||||
s.setAttribute("content", s.innerHTML.replace(/"/g, "\""));
|
||||
s.innerHTML = "<div><svg width='0' height='0'><defs><clipPath id='stickyClip' clipPathUnits='objectBoundingBox'><path d='M 0 0 Q 0 0.69, 0.03 0.96 0.03 0.96, 1 0.96 Q 0.96 0.69, 0.96 0 0.96 0, 0 0' stroke-linejoin='round' stroke-linecap='square' /></clipPath></defs></svg></div><div><div>".concat(s.innerHTML, "</div></div>");
|
||||
}
|
||||
calculateStickyPosition(s);
|
||||
drag(s);
|
||||
s.ondblclick = function (e) {
|
||||
if (e.ctrlKey) {
|
||||
calculateStickyPosition(s);
|
||||
} else {
|
||||
// add one click select
|
||||
}
|
||||
};
|
||||
});
|
||||
window.onresize = function () {
|
||||
module.exports = {
|
||||
init: function init() {
|
||||
var p = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
||||
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px", ""));
|
||||
var stickies = p.querySelectorAll("sticky-note");
|
||||
stickies.forEach(function (s) {
|
||||
p.querySelectorAll("sticky-note").forEach(function (s) {
|
||||
if (s.querySelectorAll("svg").length == 0) {
|
||||
var wrapper = document.createElement("sticky-note-wrapper");
|
||||
s.parentNode.insertBefore(wrapper, s);
|
||||
wrapper.appendChild(s);
|
||||
s.setAttribute("content", s.innerHTML.replace(/"/g, "\""));
|
||||
s.innerHTML = "<div><svg width='0' height='0'><defs><clipPath id='stickyClip' clipPathUnits='objectBoundingBox'><path d='M 0 0 Q 0 0.69, 0.03 0.96 0.03 0.96, 1 0.96 Q 0.96 0.69, 0.96 0 0.96 0, 0 0' stroke-linejoin='round' stroke-linecap='square' /></clipPath></defs></svg></div><div><div>".concat(s.innerHTML, "</div></div>");
|
||||
}
|
||||
calculateStickyPosition(s);
|
||||
drag(s);
|
||||
s.ondblclick = function (e) {
|
||||
if (e.ctrlKey) {
|
||||
calculateStickyPosition(s);
|
||||
} else {
|
||||
// add one click select
|
||||
}
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
window.onresize = function () {
|
||||
font.size = parseFloat(getComputedStyle(document.documentElement).fontSize.replace("px", ""));
|
||||
var stickies = p.querySelectorAll("sticky-note");
|
||||
stickies.forEach(function (s) {
|
||||
calculateStickyPosition(s);
|
||||
});
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 9 */
|
||||
@@ -3226,27 +3223,47 @@ var waitForElement = function waitForElement(selector) {
|
||||
});
|
||||
});
|
||||
};
|
||||
var tabsetCount = 0;
|
||||
function init() {
|
||||
var container = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
|
||||
var spacer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
||||
var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
container.querySelectorAll(".tab-group, tabset").forEach(function (tabGroup) {
|
||||
if (tabGroup.querySelector("[role=tablist]") === null) {
|
||||
if (tabGroup.getAttribute("id") == null) {
|
||||
tabGroup.setAttribute("id", "tab-group-" + tabsetCount);
|
||||
tabsetCount++;
|
||||
}
|
||||
var tabgroup = tabGroup.getAttribute("id");
|
||||
var tablist = "";
|
||||
Array.from(tabGroup.children).forEach(function (child) {
|
||||
var tab = child.getAttribute("tab") || child.getAttribute("data-tab");
|
||||
// is details?
|
||||
var dtls = child.nodeName == "DETAILS" ? true : false;
|
||||
|
||||
// get the tab text
|
||||
var tab = dtls ? child.querySelector("summary").innerHTML : child.getAttribute("tab") || child.getAttribute("data-tab");
|
||||
|
||||
// if the tab text is not blank
|
||||
if (tab !== null) {
|
||||
var tabID = tab.replace(/\W+/g, "-").toLowerCase();
|
||||
var tabPanel = document.createElement('div');
|
||||
|
||||
// define the tab panel content
|
||||
var tabPanel = null;
|
||||
if (dtls) {
|
||||
tabPanel = child;
|
||||
tabPanel.setAttribute("open", "");
|
||||
} else {
|
||||
tabPanel = document.createElement('div');
|
||||
tabPanel.appendChild(child.cloneNode(true));
|
||||
}
|
||||
tabPanel.id = "tab-panel-".concat(tabgroup, "-").concat(tabID);
|
||||
tabPanel.className = tablist === "" ? "open" : "";
|
||||
tabPanel.setAttribute("role", "tabpanel");
|
||||
tabPanel.setAttribute("tabindex", "0");
|
||||
tabPanel.setAttribute("aria-labelledby", "tab-".concat(tabgroup, "-").concat(tabID));
|
||||
tabPanel.appendChild(child.cloneNode(true));
|
||||
child.parentNode.replaceChild(tabPanel, child);
|
||||
tablist += "<li tabindex=\"0\" role=\"tab\" ".concat(tablist === "" ? "class='selected'" : "", " id=\"tab-").concat(tabgroup, "-").concat(tabID, "\"><span>").concat(tab, "</span></li>");
|
||||
var cls = tablist === "" ? "class='selected'" : "";
|
||||
tablist += "<li tabindex=\"0\" role=\"tab\" ".concat(cls, " id=\"tab-").concat(tabgroup, "-").concat(tabID, "\"><span>").concat(tab, "</span></li>");
|
||||
} else {
|
||||
child.classList.add("tab-hidden");
|
||||
}
|
||||
@@ -3256,28 +3273,35 @@ function init() {
|
||||
ul.innerHTML = spacer != true ? "".concat(tablist) : "".concat(tablist, "<li role=\"separator\" class=\"separator\"></li>");
|
||||
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
||||
tabGroup.querySelectorAll('[role="tab"]').forEach(function (tab) {
|
||||
tab.addEventListener("click", function (e) {
|
||||
if (e.altKey && typeof args.altModifier == "function") {
|
||||
args.altModifier(tab);
|
||||
} else if (e.shiftKey && typeof args.shiftModifier == "function") {
|
||||
args.shiftModifier(tab);
|
||||
} else if (e.metaKey && typeof args.metaModifier == "function") {
|
||||
args.metaModifier(tab);
|
||||
} else {
|
||||
var siblings = Array.from(tab.parentNode.children);
|
||||
siblings.forEach(function (sibling) {
|
||||
return sibling.classList.remove("selected");
|
||||
});
|
||||
tab.classList.add("selected");
|
||||
var tabPanels = Array.from(tab.parentNode.parentNode.children).filter(function (child) {
|
||||
return child.getAttribute("role") === "tabpanel";
|
||||
});
|
||||
tabPanels.forEach(function (panel) {
|
||||
return panel.classList.remove("open");
|
||||
});
|
||||
var tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
||||
document.getElementById(tabPanelId).classList.add("open");
|
||||
}
|
||||
tab.addEventListener("click", function (evt) {
|
||||
// if (evt.altKey && typeof args.altModifier == "function") {
|
||||
// args.altModifier(tab, evt);
|
||||
// } else if (evt.shiftKey && typeof args.shiftModifier == "function") {
|
||||
// args.shiftModifier(tab, evt);
|
||||
// } else if (evt.metaKey && typeof args.metaModifier == "function") {
|
||||
// args.metaModifier(tab, evt);
|
||||
// } else {
|
||||
var siblings = Array.from(tab.parentNode.children);
|
||||
siblings.forEach(function (sibling) {
|
||||
return sibling.classList.remove("selected");
|
||||
});
|
||||
tab.classList.add("selected");
|
||||
var urlPath = window.location;
|
||||
urlPath.hash = evt.currentTarget.getAttribute("id");
|
||||
window.history.pushState({
|
||||
"pageTitle": window.title + " : " + evt.currentTarget.innerHTML
|
||||
}, "", urlPath.toString());
|
||||
// window.history.pushState({"html":response.html,"pageTitle":response.pageTitle},"", urlPath);
|
||||
|
||||
var tabPanels = Array.from(tab.parentNode.parentNode.children).filter(function (child) {
|
||||
return child.getAttribute("role") === "tabpanel";
|
||||
});
|
||||
tabPanels.forEach(function (panel) {
|
||||
return panel.classList.remove("open");
|
||||
});
|
||||
var tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
||||
document.getElementById(tabPanelId).classList.add("open");
|
||||
//}
|
||||
});
|
||||
tab.addEventListener("keypress", function (e) {
|
||||
e.preventDefault();
|
||||
@@ -3295,6 +3319,12 @@ function init() {
|
||||
});
|
||||
}
|
||||
});
|
||||
addEventListener("hashchange", function (evt) {
|
||||
document.querySelector(window.location.hash).dispatchEvent(click);
|
||||
|
||||
// window.location.hash
|
||||
// console.log(window.location.hash)
|
||||
});
|
||||
}
|
||||
|
||||
/***/ })
|
||||
@@ -3398,6 +3428,7 @@ __webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var _node_modules_prismjs_components_prism_sass__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7);
|
||||
/* harmony import */ var _node_modules_prismjs_components_prism_sass__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_node_modules_prismjs_components_prism_sass__WEBPACK_IMPORTED_MODULE_6__);
|
||||
/* harmony import */ var _pg_patterns_core_sticky_note_sticky_note_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(8);
|
||||
/* harmony import */ var _pg_patterns_core_sticky_note_sticky_note_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_pg_patterns_core_sticky_note_sticky_note_js__WEBPACK_IMPORTED_MODULE_7__);
|
||||
/* harmony import */ var _pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(9);
|
||||
/* harmony import */ var _pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_pg_patterns_core_switch_switch_js__WEBPACK_IMPORTED_MODULE_8__);
|
||||
/* harmony import */ var _pg_patterns_core_tabs_tabs_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(10);
|
||||
|
File diff suppressed because one or more lines are too long
@@ -42,7 +42,7 @@
|
||||
div(tab="[tab title]")
|
||||
div(tab="[tab title]")
|
||||
</pre>
|
||||
<pre class="language-css" tab="css">.tab-group,tabset{margin:2rem 0 1rem 0}.tab-group>ul,tabset>ul{display:-webkit-box;display:-ms-flexbox;display:flex;margin:0;padding:0}.tab-group>ul li.separator,tabset>ul li.separator{border-bottom:1px solid #7f7f7f;border-left:1px solid #7f7f7f;display:inline-block;margin:0.45rem 0 0 0;width:100%}.tab-group .tab-hidden,tabset .tab-hidden{display:none}.tab-group [role=tab],tabset [role=tab]{background-color:#FFF;border-left:1px solid #7f7f7f;border-radius:0.5rem 0.5rem 0 0;border-top:1px solid #7f7f7f;color:#000;cursor:pointer;display:inline;margin:0;padding:1rem 1.5rem 0.14rem 1.5rem;z-index:2}.tab-group [role=tab]:last-of-type,tabset [role=tab]:last-of-type{border-right:1px solid #7f7f7f}.tab-group [role=tab]:not(.selected),tabset [role=tab]:not(.selected){background-color:#f0f0f0;border-bottom:1px solid #7f7f7f;color:#000}.tab-group [role=tab] span,tabset [role=tab] span{display:block;margin:0 0 0.5rem 0}.tab-group [role=tabpanel],tabset [role=tabpanel]{background-color:#FFF;border:1px solid #7f7f7f;border-top:#7f7f7f solid 1px;padding:1rem;z-index:1}.tab-group [role=tabpanel]:not(.open),tabset [role=tabpanel]:not(.open){display:none}</pre>
|
||||
<pre class="language-css" tab="css">@media (min-width:450px){.tab-group,tabset{margin:2rem 0 1rem 0}}.tab-group>ul,tabset>ul{display:-webkit-box;display:-ms-flexbox;display:flex;margin:0;padding:0}.tab-group>ul li.separator,tabset>ul li.separator{border-bottom:1px solid #7f7f7f;border-left:1px solid #7f7f7f;display:inline-block;margin:0.45rem 0 0 0;width:100%}.tab-group .tab-hidden,tabset .tab-hidden{display:none}.tab-group [role=tab],tabset [role=tab]{background-color:#FFF;border-left:1px solid #7f7f7f;border-top:1px solid #7f7f7f;border-radius:0.5rem 0.5rem 0 0;cursor:pointer;margin:0;display:inline;padding:1rem 1.5rem 0.14rem 1.5rem;z-index:2}.tab-group [role=tab]:last-of-type,tabset [role=tab]:last-of-type{border-right:1px solid #7f7f7f}.tab-group [role=tab]:not(.selected),tabset [role=tab]:not(.selected){background-color:#f0f0f0;border-bottom:1px solid #7f7f7f}.tab-group [role=tab] span,tabset [role=tab] span{display:block;margin:0 0 0.5rem 0}.tab-group [role=tabpanel],tabset [role=tabpanel]{background-color:#FFF;border:1px solid #7f7f7f;border-top:none;padding:1rem;z-index:1}@media (min-width:450px){.tab-group [role=tabpanel][open] summary,tabset [role=tabpanel][open] summary{display:none}}@media (min-width:450px){.tab-group [role=tabpanel]:not(.open),tabset [role=tabpanel]:not(.open){display:none}}@media (max-width:450px){.tab-group:has(details) [role=tablist],tabset:has(details) [role=tablist]{display:none}.tab-group:has(details) [role=tabpanel],tabset:has(details) [role=tabpanel]{border:none}}</pre>
|
||||
<div tab="scss">
|
||||
<pre class="language-sass">@import "scss/core/tabs/_tabs";
|
||||
@include tabs{
|
||||
@@ -52,23 +52,23 @@
|
||||
<pre class="language-sass">// DS2 core (c) 2024 Alexander McIlwraith
|
||||
// Licensed under CC BY-SA 4.0
|
||||
|
||||
|
||||
$tab-border: #7f7f7f !default;
|
||||
$tab-panel-background-color: #FFF !default;
|
||||
$tab-panel-top-border: #7f7f7f !default;
|
||||
$tab-panel-top-border-width: 1px !default;
|
||||
$tab-selected: #FFF !default;
|
||||
$tab-selected-text: #000 !default;
|
||||
$tab-notselected: #f0f0f0 !default;
|
||||
$tab-notselected-text: #000 !default;
|
||||
$tab-break: 450px !default;
|
||||
|
||||
@mixin tabs {
|
||||
tabset, .tab-group {
|
||||
margin: 2rem 0 1rem 0;
|
||||
@media (min-width: $tab-break) {
|
||||
margin: 2rem 0 1rem 0;
|
||||
}
|
||||
> ul {
|
||||
display: flex;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
|
||||
li.separator {
|
||||
border-bottom: 1px solid $tab-border;
|
||||
border-left: 1px solid $tab-border;
|
||||
@@ -78,6 +78,8 @@ $tab-notselected-text: #000 !default;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.tab-hidden {
|
||||
display: none;
|
||||
}
|
||||
@@ -85,12 +87,11 @@ $tab-notselected-text: #000 !default;
|
||||
[role="tab"] {
|
||||
background-color: $tab-selected;
|
||||
border-left: 1px solid $tab-border;
|
||||
border-radius: .5rem .5rem 0 0;
|
||||
border-top: 1px solid $tab-border;
|
||||
color: $tab-selected-text;
|
||||
border-radius: .5rem .5rem 0 0;
|
||||
cursor:pointer;
|
||||
display: inline;
|
||||
margin: 0;
|
||||
display: inline;
|
||||
padding: 1rem 1.5rem .14rem 1.5rem;
|
||||
z-index: 2;
|
||||
|
||||
@@ -101,7 +102,6 @@ $tab-notselected-text: #000 !default;
|
||||
&:not(.selected) {
|
||||
background-color: $tab-notselected;
|
||||
border-bottom: 1px solid $tab-border;
|
||||
color: $tab-notselected-text;
|
||||
}
|
||||
|
||||
span {
|
||||
@@ -111,17 +111,41 @@ $tab-notselected-text: #000 !default;
|
||||
|
||||
}
|
||||
[role="tabpanel"] {
|
||||
background-color: $tab-panel-background-color;
|
||||
background-color: $tab-selected;
|
||||
border: 1px solid $tab-border;
|
||||
border-top: $tab-panel-top-border solid $tab-panel-top-border-width;
|
||||
border-top: none;
|
||||
padding: 1rem;
|
||||
z-index: 1;
|
||||
|
||||
&:not(.open) {
|
||||
display: none;
|
||||
@media (min-width: $tab-break) {
|
||||
&[open] summary {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: $tab-break) {
|
||||
&:not(.open) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@content;
|
||||
|
||||
}
|
||||
|
||||
@media (max-width: $tab-break) {
|
||||
&:has(details) {
|
||||
[role="tablist"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
[role="tabpanel"] {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}</pre>
|
||||
</div>
|
||||
@@ -160,28 +184,53 @@ const waitForElement = (selector) => {
|
||||
});
|
||||
}
|
||||
|
||||
let tabsetCount = 0;
|
||||
|
||||
export function init(container = document, spacer = true, args = {}) {
|
||||
|
||||
container.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
|
||||
|
||||
if (tabGroup.querySelector("[role=tablist]") === null) {
|
||||
if (tabGroup.getAttribute("id") == null) {
|
||||
tabGroup.setAttribute("id", "tab-group-" + tabsetCount);
|
||||
tabsetCount++;
|
||||
}
|
||||
|
||||
|
||||
const tabgroup = tabGroup.getAttribute("id");
|
||||
let tablist = "";
|
||||
|
||||
Array.from(tabGroup.children).forEach(child => {
|
||||
const tab = child.getAttribute("tab") || child.getAttribute("data-tab");
|
||||
|
||||
// is details?
|
||||
let dtls = child.nodeName == "DETAILS" ? true : false;
|
||||
|
||||
// get the tab text
|
||||
let tab = dtls ? child.querySelector("summary").innerHTML : child.getAttribute("tab") || child.getAttribute("data-tab");
|
||||
|
||||
// if the tab text is not blank
|
||||
if (tab !== null) {
|
||||
const tabID = tab.replace(/\W+/g, "-").toLowerCase();
|
||||
const tabPanel = document.createElement('div');
|
||||
|
||||
|
||||
// define the tab panel content
|
||||
let tabPanel = null;
|
||||
if (dtls) {
|
||||
tabPanel = child;
|
||||
tabPanel.setAttribute("open", "");
|
||||
} else {
|
||||
tabPanel = document.createElement('div');
|
||||
tabPanel.appendChild(child.cloneNode(true));
|
||||
}
|
||||
|
||||
tabPanel.id = `tab-panel-${tabgroup}-${tabID}`;
|
||||
tabPanel.className = tablist === "" ? "open" : "";
|
||||
tabPanel.setAttribute("role", "tabpanel");
|
||||
tabPanel.setAttribute("tabindex", "0");
|
||||
tabPanel.setAttribute("aria-labelledby", `tab-${tabgroup}-${tabID}`);
|
||||
tabPanel.appendChild(child.cloneNode(true));
|
||||
child.parentNode.replaceChild(tabPanel, child);
|
||||
tablist += `<li tabindex="0" role="tab" ${tablist === "" ? "class='selected'" : ""} id="tab-${tabgroup}-${tabID}"><span>${tab}</span></li>`;
|
||||
let cls = tablist === "" ? "class='selected'" : "";
|
||||
tablist += `<li tabindex="0" role="tab" ${cls} id="tab-${tabgroup}-${tabID}"><span>${tab}</span></li>`;
|
||||
} else {
|
||||
child.classList.add("tab-hidden");
|
||||
}
|
||||
@@ -193,25 +242,32 @@ export function init(container = document, spacer = true, args = {}) {
|
||||
tabGroup.insertBefore(ul, tabGroup.firstChild);
|
||||
|
||||
tabGroup.querySelectorAll('[role="tab"]').forEach(tab => {
|
||||
tab.addEventListener("click", (e) => {
|
||||
if (e.altKey && typeof args.altModifier == "function") {
|
||||
args.altModifier(tab);
|
||||
} else if (e.shiftKey && typeof args.shiftModifier == "function") {
|
||||
args.shiftModifier(tab);
|
||||
} else if (e.metaKey && typeof args.metaModifier == "function") {
|
||||
args.metaModifier(tab);
|
||||
} else {
|
||||
const siblings = Array.from(tab.parentNode.children);
|
||||
siblings.forEach(sibling => sibling.classList.remove("selected"));
|
||||
tab.classList.add("selected");
|
||||
tab.addEventListener("click", (evt) => {
|
||||
// if (evt.altKey && typeof args.altModifier == "function") {
|
||||
// args.altModifier(tab, evt);
|
||||
// } else if (evt.shiftKey && typeof args.shiftModifier == "function") {
|
||||
// args.shiftModifier(tab, evt);
|
||||
// } else if (evt.metaKey && typeof args.metaModifier == "function") {
|
||||
// args.metaModifier(tab, evt);
|
||||
// } else {
|
||||
const siblings = Array.from(tab.parentNode.children);
|
||||
siblings.forEach(sibling => sibling.classList.remove("selected"));
|
||||
tab.classList.add("selected");
|
||||
|
||||
const tabPanels = Array.from(tab.parentNode.parentNode.children)
|
||||
.filter(child => child.getAttribute("role") === "tabpanel");
|
||||
tabPanels.forEach(panel => panel.classList.remove("open"));
|
||||
|
||||
const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
||||
document.getElementById(tabPanelId).classList.add("open");
|
||||
}
|
||||
let urlPath = window.location;
|
||||
urlPath.hash = evt.currentTarget.getAttribute("id");
|
||||
window.history.pushState({"pageTitle": window.title + " : " + evt.currentTarget.innerHTML},"", urlPath.toString());
|
||||
// window.history.pushState({"html":response.html,"pageTitle":response.pageTitle},"", urlPath);
|
||||
|
||||
|
||||
const tabPanels = Array.from(tab.parentNode.parentNode.children)
|
||||
.filter(child => child.getAttribute("role") === "tabpanel");
|
||||
tabPanels.forEach(panel => panel.classList.remove("open"));
|
||||
|
||||
const tabPanelId = tab.getAttribute("id").replace("tab", "tab-panel");
|
||||
document.getElementById(tabPanelId).classList.add("open");
|
||||
//}
|
||||
});
|
||||
|
||||
|
||||
@@ -230,11 +286,18 @@ export function init(container = document, spacer = true, args = {}) {
|
||||
el.focus();
|
||||
el.dispatchEvent(click);
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
</pre>
|
||||
|
||||
addEventListener("hashchange", (evt) => {
|
||||
document.querySelector(window.location.hash).dispatchEvent(click);
|
||||
|
||||
// window.location.hash
|
||||
// console.log(window.location.hash)
|
||||
})
|
||||
|
||||
|
||||
}</pre>
|
||||
</div>
|
||||
</tabset>
|
||||
</body>
|
||||
|
Reference in New Issue
Block a user