Revert "tabs: do not open tabs by default"

This reverts commit 0b56e0f407829d3f85f3a73a8ec982511c40889b.
This commit is contained in:
Nils Schneider 2015-07-12 00:46:15 +02:00
parent eb8f1dd2a4
commit 8423ef7277

View file

@ -8,17 +8,12 @@ define([], function () {
var container = document.createElement("div") var container = document.createElement("div")
function gotoTab(li) { function gotoTab(li) {
var visible = li.classList.contains("visible")
for (var i = 0; i < tabs.children.length; i++) for (var i = 0; i < tabs.children.length; i++)
tabs.children[i].classList.remove("visible") tabs.children[i].classList.remove("visible")
while (container.firstChild) while (container.firstChild)
container.removeChild(container.firstChild) container.removeChild(container.firstChild)
if (visible)
return
li.classList.add("visible") li.classList.add("visible")
var tab = document.createElement("div") var tab = document.createElement("div")
@ -39,6 +34,17 @@ define([], function () {
li.onclick = switchTab li.onclick = switchTab
li.child = d li.child = d
tabs.appendChild(li) tabs.appendChild(li)
var anyVisible = false
for (var i = 0; i < tabs.children.length; i++)
if (tabs.children[i].classList.contains("visible")) {
anyVisible = true
break
}
if (!anyVisible)
gotoTab(li)
} }
self.render = function (el) { self.render = function (el) {