@leapdev/gui 0.2.243 → 0.2.244
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/scss/xsf-crx/sf-leap.js +32 -31
- package/package.json +1 -1
|
@@ -104,17 +104,17 @@
|
|
|
104
104
|
|
|
105
105
|
// #@desktop:accordion-2;sub-accordion-1@parent-accordion-1
|
|
106
106
|
// Set default tab via URL hash parameters or device type if present on tabs
|
|
107
|
-
|
|
107
|
+
window['urlHash'] = {
|
|
108
108
|
topicsTabAccordion: {},
|
|
109
109
|
articleTabsInit: false,
|
|
110
110
|
articleAccordionInit: false,
|
|
111
111
|
deviceType: getDeviceType(),
|
|
112
112
|
list: window.location.hash,
|
|
113
113
|
init: function () {
|
|
114
|
-
urlHash.openedTopics = window.location.hash.substring(1).split('@').splice(1);
|
|
114
|
+
// window.urlHash.openedTopics = window.location.hash.substring(1).split('@').splice(1);
|
|
115
115
|
|
|
116
116
|
ready('.sf-tabs', function () {
|
|
117
|
-
if (!urlHash.articleTabsInit) {
|
|
117
|
+
if (!window.urlHash.articleTabsInit) {
|
|
118
118
|
|
|
119
119
|
const toggleTabs = (params) => {
|
|
120
120
|
// Remove existing active CSS classes
|
|
@@ -131,9 +131,9 @@
|
|
|
131
131
|
tab.querySelectorAll('.sf-tab-item-link').forEach(tabitem => {
|
|
132
132
|
const tabItemText = tabitem.textContent.toLowerCase().replace(/\s/g, '');
|
|
133
133
|
|
|
134
|
-
const _closestParent = urlHash.closestParent(tabitem);
|
|
134
|
+
const _closestParent = window.urlHash.closestParent(tabitem);
|
|
135
135
|
|
|
136
|
-
urlHash.topicsTabAccordion[tabitem.id] = {
|
|
136
|
+
window.urlHash.topicsTabAccordion[tabitem.id] = {
|
|
137
137
|
text: tabItemText,
|
|
138
138
|
isMainParent: _closestParent.flag,
|
|
139
139
|
parentLabel: _closestParent.parentLabel,
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
|
|
143
143
|
// If URL hash is not present, we locate the name of the device tab
|
|
144
144
|
const sfTabNav = tabitem.parentNode.parentNode;
|
|
145
|
-
if (tabItemText === urlHash.deviceType && urlHash.list === '') {
|
|
145
|
+
if (tabItemText === window.urlHash.deviceType && urlHash.list === '') {
|
|
146
146
|
if (sfTabNav.querySelector('.sf-tab-item.active').classList.contains('active')) {
|
|
147
147
|
toggleTabs({
|
|
148
148
|
targetTabLink: tabitem,
|
|
@@ -151,9 +151,9 @@
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
if (urlHash.list !== '' && urlHash.list.search(tabItemText) > -1) {
|
|
155
|
-
Object.keys(urlHash.topicsTabAccordion).forEach(key => {
|
|
156
|
-
if (tabItemText == urlHash.topicsTabAccordion[key].text) {
|
|
154
|
+
if (window.urlHash.list !== '' && window.urlHash.list.search(tabItemText) > -1) {
|
|
155
|
+
Object.keys(window.urlHash.topicsTabAccordion).forEach(key => {
|
|
156
|
+
if (tabItemText == window.urlHash.topicsTabAccordion[key].text) {
|
|
157
157
|
toggleTabs({
|
|
158
158
|
targetTabLink: tabitem,
|
|
159
159
|
tabNav: sfTabNav
|
|
@@ -164,30 +164,34 @@
|
|
|
164
164
|
});
|
|
165
165
|
});
|
|
166
166
|
|
|
167
|
-
urlHash.articleTabsInit = true;
|
|
168
|
-
|
|
167
|
+
window.urlHash.articleTabsInit = true;
|
|
168
|
+
|
|
169
|
+
if (window.location.pathname.includes('/article')) {
|
|
170
|
+
window.urlHash.observe();
|
|
171
|
+
}
|
|
172
|
+
console.log(window.urlHash.topicsTabAccordion);
|
|
169
173
|
}
|
|
170
174
|
});
|
|
171
175
|
|
|
172
176
|
ready('.sf-accordion', function () {
|
|
173
|
-
if (!urlHash.articleAccordionInit) {
|
|
177
|
+
if (!window.urlHash.articleAccordionInit) {
|
|
174
178
|
const urlHashList = window.location.hash;
|
|
175
179
|
document.querySelectorAll('.sf-accordion-toggle').forEach(accordionToggle => {
|
|
176
180
|
const accordionText = accordionToggle
|
|
177
181
|
.querySelector('.sf-accordion-text')
|
|
178
182
|
.textContent.split(' ').join('-').toLowerCase();
|
|
179
183
|
|
|
180
|
-
const _closestParent = urlHash.closestParent(accordionToggle);
|
|
184
|
+
const _closestParent = window.urlHash.closestParent(accordionToggle);
|
|
181
185
|
|
|
182
|
-
urlHash.topicsTabAccordion[accordionToggle.id] = {
|
|
186
|
+
window.urlHash.topicsTabAccordion[accordionToggle.id] = {
|
|
183
187
|
text: accordionText,
|
|
184
188
|
isMainParent: _closestParent.flag,
|
|
185
189
|
parentLabel: _closestParent.parentLabel
|
|
186
190
|
};
|
|
187
191
|
|
|
188
|
-
if (urlHashList !== '' && urlHash.list.split(':')[1] === accordionText) {
|
|
189
|
-
Object.keys(urlHash.topicsTabAccordion).forEach(key => {
|
|
190
|
-
if (accordionText == urlHash.topicsTabAccordion[key].text) {
|
|
192
|
+
if (urlHashList !== '' && window.urlHash.list.split(':')[1] === accordionText) {
|
|
193
|
+
Object.keys(window.urlHash.topicsTabAccordion).forEach(key => {
|
|
194
|
+
if (accordionText == window.urlHash.topicsTabAccordion[key].text) {
|
|
191
195
|
document.getElementById(key).classList.add('in');
|
|
192
196
|
|
|
193
197
|
const hasAccordionParent = getClosestParent(accordionToggle, '.sf-accordion-content');
|
|
@@ -203,10 +207,6 @@
|
|
|
203
207
|
urlHash.articleAccordionInit = true;
|
|
204
208
|
}
|
|
205
209
|
});
|
|
206
|
-
|
|
207
|
-
if (window.location.pathname.includes('/article')) {
|
|
208
|
-
urlHash.observe();
|
|
209
|
-
}
|
|
210
210
|
},
|
|
211
211
|
observe: function () {
|
|
212
212
|
let previousState = window.history.state;
|
|
@@ -214,7 +214,7 @@
|
|
|
214
214
|
if (previousState !== window.history.state) {
|
|
215
215
|
previousState = window.history.state;
|
|
216
216
|
clearInterval(t);
|
|
217
|
-
urlHash.reset();
|
|
217
|
+
window.urlHash.reset();
|
|
218
218
|
}
|
|
219
219
|
}, 100);
|
|
220
220
|
},
|
|
@@ -240,19 +240,20 @@
|
|
|
240
240
|
};
|
|
241
241
|
},
|
|
242
242
|
setItem: function (id) {
|
|
243
|
-
|
|
244
|
-
const
|
|
243
|
+
// console.log(window.urlHash.topicsTabAccordion);
|
|
244
|
+
const childText = window.urlHash.topicsTabAccordion[id].isMainParent ? '' : (':' + window.urlHash.topicsTabAccordion[id].text);
|
|
245
|
+
const parentText = window.urlHash.topicsTabAccordion[id].isMainParent ? window.urlHash.topicsTabAccordion[id].text : window.urlHash.topicsTabAccordion[id].parentLabel;
|
|
245
246
|
return `@${parentText}${childText}`;
|
|
246
247
|
},
|
|
247
248
|
reset: function () {
|
|
248
|
-
urlHash.topicsTabAccordion = {};
|
|
249
|
-
urlHash.articleTabsInit = false;
|
|
250
|
-
urlHash.articleAccordionInit = false;
|
|
251
|
-
urlHash.init();
|
|
249
|
+
window.urlHash.topicsTabAccordion = {};
|
|
250
|
+
window.urlHash.articleTabsInit = false;
|
|
251
|
+
window.urlHash.articleAccordionInit = false;
|
|
252
|
+
window.urlHash.init();
|
|
252
253
|
}
|
|
253
254
|
};
|
|
254
255
|
|
|
255
|
-
urlHash.init();
|
|
256
|
+
window.urlHash.init();
|
|
256
257
|
// Tab and Accordion Toggling
|
|
257
258
|
document.addEventListener('click', function (event) {
|
|
258
259
|
const
|
|
@@ -293,8 +294,8 @@
|
|
|
293
294
|
className.value.indexOf('sf-tab-item-link') !== -1 ||
|
|
294
295
|
className.value.indexOf('sf-accordion-toggle') !== -1
|
|
295
296
|
) {
|
|
296
|
-
// console.log(urlHash.topicsTabAccordion);
|
|
297
|
-
window.location.hash = urlHash.setItem(targetElem.id);
|
|
297
|
+
// console.log(window.urlHash.topicsTabAccordion);
|
|
298
|
+
window.location.hash = window.urlHash.setItem(targetElem.id);
|
|
298
299
|
}
|
|
299
300
|
|
|
300
301
|
return false;
|