Remove chk, all must be $defined.

This commit is contained in:
Paulo Veiga 2011-07-28 13:06:15 -03:00
parent d4fefed545
commit 899bf85545
10 changed files with 49 additions and 49 deletions

View File

@ -29,7 +29,7 @@ mindplot.BubbleTip = new Class({
height:null,
form:null
};
if ($chk(this.options.form))
if ($defined(this.options.form))
this.scanElements(this.options.form);
this.buildBubble();
this._isMouseOver = false;
@ -46,14 +46,14 @@ mindplot.BubbleTip = new Class({
var opts = this.options;
var panel = new Element('div').addClass('bubbleContainer');
if ($chk(opts.height))
if ($defined(opts.height))
panel.setStyle('height', opts.height);
if ($chk(opts.width))
if ($defined(opts.width))
panel.setStyle('width', opts.width);
this.center = new Element('div').addClass('bubblePart').addClass('bubbleCenterBlue');
this.center.inject(panel);
if (!$chk(opts.divContainer)) {
if (!$defined(opts.divContainer)) {
opts.divContainer = document.body;
}
panel.injectTop(opts.divContainer);
@ -76,7 +76,7 @@ mindplot.BubbleTip = new Class({
this.doOpen.delay(500, this, [content,source]);
},
doOpen : function(content, source) {
if ($chk(this._isMouseOver) && !$chk(this._open) && !$chk(this._opening)) {
if ($defined(this._isMouseOver) && !$defined(this._open) && !$defined(this._opening)) {
this._opening = true;
var container = new Element('div');
$(content).inject(container);
@ -99,10 +99,10 @@ mindplot.BubbleTip = new Class({
},
doClose : function(event) {
if (!$chk(this._isMouseOver) && $chk(this._opening))
if (!$defined(this._isMouseOver) && $defined(this._opening))
this.doClose.delay(500, this, this._evt);
if (!$chk(this._isMouseOver) && $chk(this._open)) {
if (!$defined(this._isMouseOver) && $defined(this._open)) {
this.forceClose();
}
},
@ -139,9 +139,9 @@ mindplot.BubbleTip = new Class({
},
moveTopic : function(offset, panelHeight, panelWidth, invert, invertX) {
var f = 1, fX = 1;
if ($chk(invert))
if ($defined(invert))
f = 0;
if ($chk(invertX))
if ($defined(invertX))
fX = 0;
var opts = this.options;
$(opts.panel).setStyles({left:offset.x - (panelWidth * fX), top:offset.y - (panelHeight * f)});

View File

@ -104,7 +104,7 @@ mindplot.IconGroup = new Class({
getImageIcon : function(icon) {
var result = null;
this.options.icons.each(function(el, index) {
if (result == null && $chk(el.getModel().isIconModel) && el.getId() == icon.getId() && el.getUiId() == icon.getUiId()) {
if (result == null && $defined(el.getModel().isIconModel) && el.getId() == icon.getId() && el.getUiId() == icon.getUiId()) {
result = el;
}
}, this);
@ -115,7 +115,7 @@ mindplot.IconGroup = new Class({
var result = null;
this.options.icons.each(function(el, index) {
var elModel = el.getModel();
if (result == null && $chk(elModel.isIconModel) && elModel.getId() == iconModel.getId()) {
if (result == null && $defined(elModel.isIconModel) && elModel.getId() == iconModel.getId()) {
result = el;
}
}, this);

View File

@ -779,7 +779,7 @@ mindplot.MindmapDesigner = new Class({
var topic = null;
if (selectedTopics.length > 0) {
topic = selectedTopics[0];
if (!$chk(topic._hasLink)) {
if (!$defined(topic._hasLink)) {
var msg = new Element('div');
var urlText = new Element('div').inject(msg);
urlText.innerHTML = "URL:"
@ -832,7 +832,7 @@ mindplot.MindmapDesigner = new Class({
var topic = null;
if (selectedTopics.length > 0) {
topic = selectedTopics[0];
if (!$chk(topic._hasNote)) {
if (!$defined(topic._hasNote)) {
var msg = new Element('div');
var text = new Element('div').inject(msg);
var formElem = new Element('form', {'action': 'none', 'id':'noteFormId'});
@ -944,7 +944,7 @@ mindplot.MindmapDesigner = new Class({
var key = evt.key;
if (!this._editor.isVisible()) {
if (((evt.code >= 65 && evt.code <= 90) || (evt.code >= 48 && evt.code <= 57)) && !(evt.control || evt.meta)) {
if ($chk(evt.shift)) {
if ($defined(evt.shift)) {
key = key.toUpperCase();
}
this._showEditor(key);

View File

@ -201,7 +201,7 @@ mindplot.TextEditor = new Class({
var textHeight = editor._currentNode.getTextShape().getHeight();
var iconGroup = editor._currentNode.getIconGroup();
var iconGroupSize;
if ($chk(iconGroup)) {
if ($defined(iconGroup)) {
iconGroupSize = editor._currentNode.getIconGroup().getSize();
}
else {

View File

@ -37,11 +37,11 @@ mindplot.Tip = new Class({
buildTip : function() {
var opts = this.options;
var panel = new Element('div').addClass('bubbleContainer');
if ($chk(opts.height))
if ($defined(opts.height))
panel.setStyle('height', opts.height);
if ($chk(opts.width))
if ($defined(opts.width))
panel.setStyle('width', opts.width);
if (!$chk(opts.divContainer)) {
if (!$defined(opts.divContainer)) {
opts.divContainer = document.body;
}
panel.injectTop(opts.divContainer);
@ -67,7 +67,7 @@ mindplot.Tip = new Class({
},
doOpen : function(content, source) {
if ($chk(this._isMouseOver) && !$chk(this._open) && !$chk(this._opening)) {
if ($defined(this._isMouseOver) && !$defined(this._open) && !$defined(this._opening)) {
this._opening = true;
var container = new Element('div');
$(content).inject(container);
@ -93,10 +93,10 @@ mindplot.Tip = new Class({
doClose : function(event) {
if (!$chk(this._isMouseOver) && $chk(this._opening))
if (!$defined(this._isMouseOver) && $defined(this._opening))
this.doClose.delay(500, this, this._evt);
if (!$chk(this._isMouseOver) && $chk(this._open)) {
if (!$defined(this._isMouseOver) && $defined(this._open)) {
this.forceClose();
}
},

View File

@ -100,12 +100,12 @@ mindplot.Topic.prototype._setShapeType = function(type, updateModel)
//Move iconGroup to front ...
var iconGroup = this.getIconGroup();
if($chk(iconGroup)){
if($defined(iconGroup)){
iconGroup.moveToFront();
}
//Move connector to front
var connector = this.getShrinkConnector();
if($chk(connector)){
if($defined(connector)){
connector.moveToFront();
}
@ -368,7 +368,7 @@ mindplot.Topic.prototype.removeIcon = function(iconModel){
//Removing the icon from UI
var iconGroup = this.getIconGroup();
if($chk(iconGroup))
if($defined(iconGroup))
{
var imgIcon = iconGroup.findIconFromModel(iconModel);
iconGroup.removeImageIcon(imgIcon);
@ -385,7 +385,7 @@ mindplot.Topic.prototype.removeLink = function(){
var links = model.getLinks();
model._removeLink(links[0]);
var iconGroup = this.getIconGroup();
if($chk(iconGroup))
if($defined(iconGroup))
{
iconGroup.removeIcon(mindplot.LinkIcon.IMAGE_URL);
if(iconGroup.getIcons().length==0){
@ -403,7 +403,7 @@ mindplot.Topic.prototype.removeNote = function(){
var notes = model.getNotes();
model._removeNote(notes[0]);
var iconGroup = this.getIconGroup();
if($chk(iconGroup))
if($defined(iconGroup))
{
iconGroup.removeIcon(mindplot.Note.IMAGE_URL);
if(iconGroup.getIcons().length==0){
@ -484,7 +484,7 @@ mindplot.Topic.prototype._buildTextShape = function(disableEventsListeners)
mindplot.Topic.prototype.getIconOffset = function(){
var iconGroup = this.getIconGroup();
var size = 0;
if($chk(iconGroup))
if($defined(iconGroup))
{
size = iconGroup.getSize().width;
}

View File

@ -38,7 +38,7 @@ var Panel = new Class({
buildBody:function(){
var opts = this.options;
opts.frame = new Element('div');
if($chk(opts.content))
if($defined(opts.content))
{
this.setContent(opts.content);
}

View File

@ -169,7 +169,7 @@ var MooRainbow = new Class({
hex: hex
};
if (!$chk(this.pickerPos.x))
if (!$defined(this.pickerPos.x))
this.autoSet(hsb);
this.RedInput.value = rgb[0];
@ -382,7 +382,7 @@ var MooRainbow = new Class({
eventKeyup: function(e, el) {
var n = e.code, k = e.key, pass, prefix, chr = el.value.charAt(0);
if (!$chk(el.value)) return;
if (!$defined(el.value)) return;
if (el.className.test(/hexInput/)) {
if (chr != "#" && el.value.length != 6) return;
if (chr == '#' && el.value.length != 7) return;
@ -419,7 +419,7 @@ var MooRainbow = new Class({
pass = el.value.hexToRgb(true);
if (isNaN(pass[0]) || isNaN(pass[1]) || isNaN(pass[2])) return;
if ($chk(pass)) {
if ($defined(pass)) {
this.manualSet(pass);
this.fireEvent('onChange', [this.sets, this]);
}

View File

@ -204,7 +204,7 @@ Arguments:
obj - object to inspect
*/
function $chk(obj) {
function $defined(obj) {
return !!(obj || obj === 0);
}
;
@ -1445,7 +1445,7 @@ Function.extend({
'periodical': false,
'attempt': false
}, options);
if ($chk(options.arguments) && $type(options.arguments) != 'array') options.arguments = [options.arguments];
if ($defined(options.arguments) && $type(options.arguments) != 'array') options.arguments = [options.arguments];
return function(event) {
var args;
if (options.event) {
@ -2261,7 +2261,7 @@ Element.extend({
getStyle: function(property) {
property = property.camelCase();
var result = this.style[property];
if (!$chk(result)) {
if (!$defined(result)) {
if (property == 'opacity') return this.$tmp.opacity;
result = [];
for (var style in Element.Styles) {
@ -2575,7 +2575,7 @@ Element.extend({
});
Element.fixStyle = function(property, result, element) {
if ($chk(parseInt(result))) return result;
if ($defined(parseInt(result))) return result;
if (['height', 'width'].contains(property)) {
var values = (property == 'width') ? ['left', 'right'] : ['top', 'bottom'];
var size = 0;
@ -3955,7 +3955,7 @@ Fx.CSS = {
parse: function(el, property, fromTo) {
if (!fromTo.push) fromTo = [fromTo];
var from = fromTo[0], to = fromTo[1];
if (!$chk(to)) {
if (!$defined(to)) {
to = from;
from = el.getStyle(property);
}
@ -4409,7 +4409,7 @@ Fx.Scroll = Fx.Base.extend({
var values = {'x': x, 'y': y};
for (var z in el.size) {
var max = el.scrollSize[z] - el.size[z];
if ($chk(values[z])) values[z] = ($type(values[z]) == 'number') ? values[z].limit(0, max) : max;
if ($defined(values[z])) values[z] = ($type(values[z]) == 'number') ? values[z].limit(0, max) : max;
else values[z] = el.scroll[z];
values[z] += this.options.offset[z];
}
@ -4932,7 +4932,7 @@ Drag.Base = new Class({
this.mouse.pos[z] = event.page[z] - this.value.now[z];
if (limit && limit[z]) {
for (var i = 0; i < 2; i++) {
if ($chk(limit[z][i])) this.limit[z][i] = ($type(limit[z][i]) == 'function') ? limit[z][i]() : limit[z][i];
if ($defined(limit[z][i])) this.limit[z][i] = ($type(limit[z][i]) == 'function') ? limit[z][i]() : limit[z][i];
}
}
}
@ -4961,10 +4961,10 @@ Drag.Base = new Class({
if (!this.options.modifiers[z]) continue;
this.value.now[z] = this.mouse.now[z] - this.mouse.pos[z];
if (this.limit[z]) {
if ($chk(this.limit[z][1]) && (this.value.now[z] > this.limit[z][1])) {
if ($defined(this.limit[z][1]) && (this.value.now[z] > this.limit[z][1])) {
this.value.now[z] = this.limit[z][1];
this.out = true;
} else if ($chk(this.limit[z][0]) && (this.value.now[z] < this.limit[z][0])) {
} else if ($defined(this.limit[z][0]) && (this.value.now[z] < this.limit[z][0])) {
this.value.now[z] = this.limit[z][0];
this.out = true;
}
@ -5055,11 +5055,11 @@ Drag.Move = Drag.Base.extend({
var top = this.element.getStyle('top').toInt();
var left = this.element.getStyle('left').toInt();
if (this.position.element == 'absolute' && !['relative', 'absolute', 'fixed'].contains(this.position.container)) {
top = $chk(top) ? top : this.element.getTop(this.options.overflown);
left = $chk(left) ? left : this.element.getLeft(this.options.overflown);
top = $defined(top) ? top : this.element.getTop(this.options.overflown);
left = $defined(left) ? left : this.element.getLeft(this.options.overflown);
} else {
top = $chk(top) ? top : 0;
left = $chk(left) ? left : 0;
top = $defined(top) ? top : 0;
left = $defined(left) ? left : 0;
}
this.element.setStyles({'top': top, 'left': left, 'position': this.position.element});
this.parent(this.element);
@ -7079,7 +7079,7 @@ var Accordion = Fx.Elements.extend({
this.setOptions(options);
this.previous = -1;
if (this.options.alwaysHide) this.options.wait = true;
if ($chk(this.options.show)) {
if ($defined(this.options.show)) {
this.options.display = false;
this.previous = this.options.show;
}
@ -7100,7 +7100,7 @@ var Accordion = Fx.Elements.extend({
}
}, this);
this.parent(this.elements);
if ($chk(this.options.display)) this.display(this.options.display);
if ($defined(this.options.display)) this.display(this.options.display);
},
/*

View File

@ -469,7 +469,7 @@ Drag.Multi = Drag.extend({
mod.$limit = [];
var limit = mod.limit;
if (limit) for (var i = 0; i < 2; i++) {
if ($chk(limit[i])) mod.$limit[i] = ($type(limit[i]) == 'function') ? limit[i](mod) : limit[i];
if ($defined(limit[i])) mod.$limit[i] = ($type(limit[i]) == 'function') ? limit[i](mod) : limit[i];
}
}, this);
}
@ -483,10 +483,10 @@ Drag.Multi = Drag.extend({
var z = mod.modifier, mouse = this.mouse.now[z];
mod.out = false;
mod.now = mod.fn.step(mod.start, mod.bind ? mod.bind.inverse : mouse, mod.direction);
if (mod.$limit && $chk(mod.$limit[1]) && (mod.now > mod.$limit[1])) {
if (mod.$limit && $defined(mod.$limit[1]) && (mod.now > mod.$limit[1])) {
mod.now = mod.$limit[1];
mod.out = true;
} else if (mod.$limit && $chk(mod.$limit[0]) && (mod.now < mod.$limit[0])) {
} else if (mod.$limit && $defined(mod.$limit[0]) && (mod.now < mod.$limit[0])) {
mod.now = mod.$limit[0];
mod.out = true;
}