use Ox.$, not $; use .on, not .click

This commit is contained in:
rolux 2013-12-06 21:12:59 +01:00
parent b834bb2b4d
commit 60fe713e65

View file

@ -87,7 +87,7 @@ Ox.DocPage = function(options, self) {
function getItem(item, level, name) { function getItem(item, level, name) {
Ox.Log('Core', 'getItem', item, level, name); Ox.Log('Core', 'getItem', item, level, name);
var $elements = [ var $elements = [
$('<div>') Ox.$('<div>')
.css({paddingLeft: (level ? level * 32 - 16 : 0) + 'px'}) .css({paddingLeft: (level ? level * 32 - 16 : 0) + 'px'})
.html( .html(
'<code><b>' + (name || item.name) + '</b> ' '<code><b>' + (name || item.name) + '</b> '
@ -124,7 +124,7 @@ Ox.DocPage = function(options, self) {
isExpanded = !Ox.contains(section, 'inherited'); isExpanded = !Ox.contains(section, 'inherited');
if (item[section]) { if (item[section]) {
if (section == 'description') { if (section == 'description') {
$elements.push($('<div>') $elements.push(Ox.$('<div>')
.css({ .css({
paddingTop: (level ? 0 : 8) + 'px', paddingTop: (level ? 0 : 8) + 'px',
borderTopWidth: level ? 0 : '1px', borderTopWidth: level ? 0 : '1px',
@ -134,7 +134,7 @@ Ox.DocPage = function(options, self) {
.html(Ox.sanitizeHTML(item.description)) .html(Ox.sanitizeHTML(item.description))
); );
} else { } else {
$elements.push($('<div>') $elements.push(Ox.$('<div>')
.css({ .css({
paddingTop: (level ? 0 : 8) + 'px', paddingTop: (level ? 0 : 8) + 'px',
borderTopWidth: level ? 0 : '1px', borderTopWidth: level ? 0 : '1px',
@ -142,7 +142,7 @@ Ox.DocPage = function(options, self) {
marginLeft: (level * 32) + 'px' marginLeft: (level * 32) + 'px'
}) })
.append( .append(
$('<img>') Ox.$('<img>')
.attr({ .attr({
src: isExpanded src: isExpanded
? Ox.UI.getImageURL('symbolDown') ? Ox.UI.getImageURL('symbolDown')
@ -153,7 +153,8 @@ Ox.DocPage = function(options, self) {
height: '12px', height: '12px',
margin: '0 4px -1px 0' margin: '0 4px -1px 0'
}) })
.click(function() { .on({
click: function() {
var $this = $(this), var $this = $(this),
isExpanded = $this.attr('src') == Ox.UI.getImageURL('symbolRight'); isExpanded = $this.attr('src') == Ox.UI.getImageURL('symbolRight');
$this.attr({ $this.attr({
@ -176,6 +177,7 @@ Ox.DocPage = function(options, self) {
$this.hide(); $this.hide();
} }
}); });
}
}) })
) )
.append('<span class="OxSection">' + ( .append('<span class="OxSection">' + (
@ -190,7 +192,7 @@ Ox.DocPage = function(options, self) {
item.tests.forEach(function(test) { item.tests.forEach(function(test) {
var isAsync = test.expected && /(.+Ox\.test\()/.test(test.statement); var isAsync = test.expected && /(.+Ox\.test\()/.test(test.statement);
$elements.push( $elements.push(
$('<div>') Ox.$('<div>')
.addClass(className) .addClass(className)
.css({marginLeft: (level * 32 + 16) + 'px'}) .css({marginLeft: (level * 32 + 16) + 'px'})
.html( .html(
@ -211,7 +213,7 @@ Ox.DocPage = function(options, self) {
); );
if (test.expected) { if (test.expected) {
$elements.push( $elements.push(
$('<div>') Ox.$('<div>')
.addClass(className) .addClass(className)
.css({marginLeft: (level * 32 + 16) + 'px'}) .css({marginLeft: (level * 32 + 16) + 'px'})
.html( .html(
@ -234,7 +236,7 @@ Ox.DocPage = function(options, self) {
}); });
} else if (section == 'source') { } else if (section == 'source') {
// fixme: not the right place to fix path // fixme: not the right place to fix path
$elements.push($('<div>') $elements.push(Ox.$('<div>')
.addClass(className) .addClass(className)
.css({marginLeft: 16 + 'px'}) .css({marginLeft: 16 + 'px'})
.html( .html(