remove dead code

This commit is contained in:
rolux 2012-04-02 23:10:41 +02:00
parent b2dfa428b9
commit 1576ba4c48

View file

@ -320,192 +320,3 @@ Ox.SplitPanel = function(options, self) {
return that;
};
// fixme: remove!
/*
Ox.SplitPanel_ = function(options, self) {
self = self || {};
var that = Ox.Element({}, self)
.defaults({
elements: [],
orientation: 'horizontal'
})
.options(options)
.addClass(
'OxSplitPanel_ Ox' + Ox.toTitleCase(self.options.orientation)
);
Ox.extend(self, {
$separators: [],
clientXY: self.options.orientation == 'horizontal' ? 'clientX' : 'clientY',
dimensions: Ox.UI.DIMENSIONS[self.options.orientation],
edges: Ox.UI.EDGES[self.options.orientation]
});
self.options.elements.forEach(function(element, i) {
self.options.elements[i] = Ox.extend({
collapsible: false,
collapsed: false,
resizable: false,
resize: [],
size: 'auto'
}, element);
});
self.autoPercent = (100 - self.options.elements.reduce(function(val, element) {
return val + (Ox.endsWith(element.size, '%') ? parseFloat(element.size) : 0);
}, 0)) / self.options.elements.filter(function(element) {
return element.size == 'auto';
}).length + '%';
self.options.elements.forEach(function(element, i) {
var flex, index = i == 0 ? 0 : 1;
if (Ox.isNumber(element.size)) {
element.element.css(self.dimensions[0], element.size + 'px');
} else {
flex = (
element.size == 'auto' ? self.autoPercent : element.size
).replace('%', '');
element.element.css({
boxFlex: flex,
MozBoxFlex: flex,
WebkitBoxFlex: flex
});
}
element.element.appendTo(that);
if (element.collapsible || element.resizable) {
self.$separators.push(
Ox.Element()
.addClass('OxSeparator')
.bindEvent({
anyclick: function() {
that.toggle(i);
},
dragstart: function(data) {
dragstart(i, data);
},
drag: function(data) {
drag(i, data);
},
dragend: function(data) {
dragend(i, data);
},
})
.append($('<div>').addClass('OxSpace'))
.append($('<div>').addClass('OxLine'))
.append($('<div>').addClass('OxSpace'))
['insert' + (index ? 'Before' : 'After')](element.element)
);
}
});
function dragstart(pos, e) {
var element = self.options.elements[pos],
size = element.element[self.dimensions[0]]();
if (element.resizable && !element.collapsed) {
self.drag = {
size: size,
startPos: e[self.clientXY],
startSize: size
};
}
}
function drag(pos, e) {
var data = {},
element = self.options.elements[pos],
index = pos == 0 ? 0 : 1;
if (element.resizable && !element.collapsed) {
var d = e[self.clientXY] - self.drag.startPos,
size = Ox.limit(
self.drag.startSize + d * (index ? -1 : 1),
element.resize[0],
element.resize[element.resize.length - 1]
);
Ox.forEach(element.resize, function(v) {
if (size >= v - 8 && size <= v + 8) {
size = v;
return false;
}
});
if (size != self.drag.size) {
self.drag.size = size;
data[self.dimensions[0]] = size;
element.element
.css(self.dimensions[0], size + 'px')
.triggerEvent('resize', data);
triggerEvents('resize', pos);
}
}
}
function dragend(pos, e) {
var data = {},
element = self.options.elements[pos];
if (element.resizable && !element.collapsed) {
data[self.dimensions[0]] = self.drag.size
element.element.triggerEvent('resizeend', data);
triggerEvents('resizeend', pos);
}
}
function triggerEvents(event, pos) {
var data = {};
self.options.elements.forEach(function(element, i) {
if (i != pos && element.size == 'auto') {
data[self.dimensions[0]] = element.element[self.dimensions[0]]();
element.element.triggerEvent(event, data);
}
});
}
that.replaceElement = function(pos, element) {
var $element = self.options.elements[pos].element,
size = self.options.elements[pos].size;
$element.replaceWith(self.options.elements[pos].element = element);
if (size == 'auto') {
$element.css(self.boxFlexCSS);
} else {
$element.css(self.dimensions[0], size + 'px')
}
return that;
};
that.size = function(pos, size) {
var element = self.options.elements[pos],
ret;
if (Ox.isUndefined(size)) {
ret = element.element[self.dimensions[0]]();
} else {
element.size = size;
element.element.css(self.dimensions[0], size + 'px')
ret = that;
}
return that;
}
that.toggle = function(pos) {
var css = {},
element = self.options.elements[pos],
flex,
index = pos == 0 ? 0 : 1,
size = element.element[self.dimensions[0]]();
if (element.collapsible) {
element.collapsed = !element.collapsed;
css['margin' + Ox.toTitleCase(self.edges[0][index])] =
element.collapsed ? -size : 0;
that.animate(css, 250, function() {
element.element.triggerEvent('toggle', {collapsed: element.collapsed});
triggerEvents('resize', pos);
});
self.$resizebars[pos == 0 ? 0 : 1].options({collapsed: element.collapsed});
}
}
return that;
};
*/