chore(): add generated files to index
This commit is contained in:
parent
06e02bcc45
commit
b531322840
|
@ -1,9 +1,5 @@
|
|||
.idea
|
||||
npm-debug.log
|
||||
static/css/theme.css
|
||||
static/css/theme.min.css
|
||||
static/js/theme.js
|
||||
static/js/theme.min.js
|
||||
node_modules
|
||||
static/fonts
|
||||
!static/fonts/.gitkeep
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,35 @@
|
|||
(function() {
|
||||
var elements = document.querySelectorAll('[data-open]');
|
||||
for (var i=0; i<elements.length; i++) {
|
||||
initOpen(elements[i]);
|
||||
}
|
||||
|
||||
function initOpen(element) {
|
||||
var className = 'open';
|
||||
var target = document.getElementById(element.getAttribute('data-open'));
|
||||
var ulChildrenMap = function(fn) {
|
||||
var lists = target.getElementsByTagName('ul');
|
||||
for (var i=0; i<lists.length; i++) {
|
||||
fn(lists[i]);
|
||||
}
|
||||
};
|
||||
if (!target) return;
|
||||
|
||||
// dirty hack for small screen ...
|
||||
var firstChildUl = target.getElementsByTagName('ul')[0];
|
||||
if (firstChildUl && window.getComputedStyle(firstChildUl).display === 'none') {
|
||||
target.classList.remove(className);
|
||||
}
|
||||
|
||||
element.addEventListener('click', function() {
|
||||
var list = target.getElementsByTagName('ul')[0];
|
||||
if (target.classList.contains(className)) {
|
||||
target.classList.remove(className);
|
||||
ulChildrenMap(function(ul) { ul.style.display = 'none'; });
|
||||
} else {
|
||||
target.classList.add(className);
|
||||
ulChildrenMap(function(ul) { ul.style.display = 'block'; });
|
||||
}
|
||||
});
|
||||
}
|
||||
})();
|
|
@ -0,0 +1 @@
|
|||
!function(){function e(e){var t="open",n=document.getElementById(e.getAttribute("data-open")),a=function(e){for(var t=n.getElementsByTagName("ul"),a=0;a<t.length;a++)e(t[a])};if(n){var l=n.getElementsByTagName("ul")[0];l&&"none"===window.getComputedStyle(l).display&&n.classList.remove(t),e.addEventListener("click",function(){n.getElementsByTagName("ul")[0];n.classList.contains(t)?(n.classList.remove(t),a(function(e){e.style.display="none"})):(n.classList.add(t),a(function(e){e.style.display="block"}))})}}for(var t=document.querySelectorAll("[data-open]"),n=0;n<t.length;n++)e(t[n])}();
|
Loading…
Reference in New Issue