|
|
@ -21,56 +21,54 @@ function CategoryBase (options, data) { |
|
|
|
var name |
|
|
|
var a |
|
|
|
|
|
|
|
if (this.id !== 'index') { |
|
|
|
this.domHeader = document.createElement('header') |
|
|
|
this.dom.appendChild(this.domHeader) |
|
|
|
|
|
|
|
if ('name' in this.data) { |
|
|
|
if (typeof this.data.name === 'object') { |
|
|
|
name = lang(this.data.name) |
|
|
|
} else { |
|
|
|
name = this.data.name |
|
|
|
} |
|
|
|
} else if (('name:' + ui_lang) in this.data) { |
|
|
|
name = this.data['name:' + ui_lang] |
|
|
|
this.domHeader = document.createElement('header') |
|
|
|
this.dom.appendChild(this.domHeader) |
|
|
|
|
|
|
|
if ('name' in this.data) { |
|
|
|
if (typeof this.data.name === 'object') { |
|
|
|
name = lang(this.data.name) |
|
|
|
} else { |
|
|
|
name = lang('category:' + this.id) |
|
|
|
name = this.data.name |
|
|
|
} |
|
|
|
} else if (('name:' + ui_lang) in this.data) { |
|
|
|
name = this.data['name:' + ui_lang] |
|
|
|
} else { |
|
|
|
name = lang('category:' + this.id) |
|
|
|
} |
|
|
|
|
|
|
|
a = document.createElement('a') |
|
|
|
a.appendChild(document.createTextNode(name)) |
|
|
|
a.href = '#' |
|
|
|
a.onclick = this.toggle.bind(this) |
|
|
|
this.domHeader.appendChild(a) |
|
|
|
a = document.createElement('a') |
|
|
|
a.appendChild(document.createTextNode(name)) |
|
|
|
a.href = '#' |
|
|
|
a.onclick = this.toggle.bind(this) |
|
|
|
this.domHeader.appendChild(a) |
|
|
|
|
|
|
|
if (this.options.repositoryId && this.options.repositoryId !== 'default') { |
|
|
|
a = document.createElement('span') |
|
|
|
a.className = 'repoId' |
|
|
|
a.appendChild(document.createTextNode(this.options.repositoryId)) |
|
|
|
this.domHeader.appendChild(a) |
|
|
|
} |
|
|
|
if (this.options.repositoryId && this.options.repositoryId !== 'default') { |
|
|
|
a = document.createElement('span') |
|
|
|
a.className = 'repoId' |
|
|
|
a.appendChild(document.createTextNode(this.options.repositoryId)) |
|
|
|
this.domHeader.appendChild(a) |
|
|
|
} |
|
|
|
|
|
|
|
if (this.shallShowReload()) { |
|
|
|
a = document.createElement('a') |
|
|
|
a.appendChild(document.createTextNode('⟳')) |
|
|
|
a.title = lang('reload') |
|
|
|
a.className = 'reload' |
|
|
|
a.onclick = function () { |
|
|
|
var id = this.id |
|
|
|
var isOpen = this.isOpen |
|
|
|
|
|
|
|
this.reload(function (err, category) { |
|
|
|
if (err) { |
|
|
|
alert('Error reloading category ' + id + ': ' + err) |
|
|
|
} |
|
|
|
|
|
|
|
if (isOpen) { |
|
|
|
category.open() |
|
|
|
} |
|
|
|
}) |
|
|
|
}.bind(this) |
|
|
|
this.domHeader.appendChild(a) |
|
|
|
} |
|
|
|
if (this.shallShowReload()) { |
|
|
|
a = document.createElement('a') |
|
|
|
a.appendChild(document.createTextNode('⟳')) |
|
|
|
a.title = lang('reload') |
|
|
|
a.className = 'reload' |
|
|
|
a.onclick = function () { |
|
|
|
var id = this.id |
|
|
|
var isOpen = this.isOpen |
|
|
|
|
|
|
|
this.reload(function (err, category) { |
|
|
|
if (err) { |
|
|
|
alert('Error reloading category ' + id + ': ' + err) |
|
|
|
} |
|
|
|
|
|
|
|
if (isOpen) { |
|
|
|
category.open() |
|
|
|
} |
|
|
|
}) |
|
|
|
}.bind(this) |
|
|
|
this.domHeader.appendChild(a) |
|
|
|
} |
|
|
|
|
|
|
|
this.tools = new tabs.Tabs(this.dom) |
|
|
|