Permalink
Browse files

changing log method

  • Loading branch information...
1 parent fa38675 commit 8f342d1de17da8e66850b5e617a3bc6d3a9c2590 @anutron anutron committed Dec 31, 2009
View
@@ -1,5 +1,5 @@
Class.empty = function(){
- MooCompat.log('1.1 > 1.2: replace Class.empty with $empty');
+ MooTools.upgradeLog('1.1 > 1.2: replace Class.empty with $empty');
return $empty;
};
@@ -15,7 +15,7 @@ Class.empty = function(){
};
Class.prototype.extend = function(properties){
- MooCompat.log('1.1 > 1.2: Class.extend is deprecated. See the class Extend mutator.');
+ MooTools.upgradeLog('1.1 > 1.2: Class.extend is deprecated. See the class Extend mutator.');
var maker = proto(properties);
var made = new maker();
made.Extends = this;
@@ -25,7 +25,7 @@ Class.empty = function(){
var __implement = Class.prototype.implement;
Class.prototype.implement = function(){
if (arguments.length > 1 && Array.every(arguments, Object.type)){
- MooCompat.log('1.1 > 1.2: Class.implement no longer takes more than one thing at a time, either MyClass.implement(key, value) or MyClass.implement(object) but NOT MyClass.implement(new Foo, new Bar, new Baz). See also: the class Implements mutator.');
+ MooTools.upgradeLog('1.1 > 1.2: Class.implement no longer takes more than one thing at a time, either MyClass.implement(key, value) or MyClass.implement(object) but NOT MyClass.implement(new Foo, new Bar, new Baz). See also: the class Implements mutator.');
Array.each(arguments, function(argument){
__implement.call(this, argument);
}, this);
View
@@ -7,35 +7,35 @@ if (Browser.__defineGetter__) {
if(Browser.hasGetter){ // webkit, gecko, opera support
window.__defineGetter__('ie',function(){
- MooCompat.log('1.1 > 1.2: window.ie is deprecated. Use Browser.Engine.trident');
+ MooTools.upgradeLog('1.1 > 1.2: window.ie is deprecated. Use Browser.Engine.trident');
return (Browser.Engine.name == 'trident') ? true : false;
});
window.__defineGetter__('ie6',function(){
- MooCompat.log('1.1 > 1.2: window.ie6 is deprecated. Use Browser.Engine.trident and Browser.Engine.version');
+ MooTools.upgradeLog('1.1 > 1.2: window.ie6 is deprecated. Use Browser.Engine.trident and Browser.Engine.version');
return (Browser.Engine.name == 'trident' && Browser.Engine.version == 4) ? true : false;
});
window.__defineGetter__('ie7',function(){
- MooCompat.log('1.1 > 1.2: window.ie7 is deprecated. Use Browser.Engine.trident and Browser.Engine.version');
+ MooTools.upgradeLog('1.1 > 1.2: window.ie7 is deprecated. Use Browser.Engine.trident and Browser.Engine.version');
return (Browser.Engine.name == 'trident' && Browser.Engine.version == 5) ? true : false;
});
window.__defineGetter__('gecko',function(){
- MooCompat.log('1.1 > 1.2: window.gecko is deprecated. Use Browser.Engine.gecko');
+ MooTools.upgradeLog('1.1 > 1.2: window.gecko is deprecated. Use Browser.Engine.gecko');
return (Browser.Engine.name == 'gecko') ? true : false;
});
window.__defineGetter__('webkit',function(){
- MooCompat.log('1.1 > 1.2: window.webkit is deprecated. Use Browser.Engine.webkit');
+ MooTools.upgradeLog('1.1 > 1.2: window.webkit is deprecated. Use Browser.Engine.webkit');
return (Browser.Engine.name == 'webkit') ? true : false;
});
window.__defineGetter__('webkit419',function(){
- MooCompat.log('1.1 > 1.2: window.webkit is deprecated. Use Browser.Engine.webkit and Browser.Engine.version');
+ MooTools.upgradeLog('1.1 > 1.2: window.webkit is deprecated. Use Browser.Engine.webkit and Browser.Engine.version');
return (Browser.Engine.name == 'webkit' && Browser.Engine.version == 419) ? true : false;
});
window.__defineGetter__('webkit420',function(){
- MooCompat.log('1.1 > 1.2: window.webkit is deprecated. Use Browser.Engine.webkit and Browser.Engine.version');
+ MooTools.upgradeLog('1.1 > 1.2: window.webkit is deprecated. Use Browser.Engine.webkit and Browser.Engine.version');
return (Browser.Engine.name == 'webkit' && Browser.Engine.version == 420) ? true : false;
});
window.__defineGetter__('opera',function(){
- MooCompat.log('1.1 > 1.2: window.opera is deprecated. Use Browser.Engine.presto');
+ MooTools.upgradeLog('1.1 > 1.2: window.opera is deprecated. Use Browser.Engine.presto');
return (Browser.Engine.name == 'presto') ? true : false;
});
} else {
View
@@ -3,18 +3,15 @@ if(!console.log) console.log = function(){};
if(!console.warn) console.warn = console.log;
if(!console.error) console.error = console.warn;
-var MooCompat = {
- log: function() {
- if (console[this.logging]) console[this.logging].apply(console, arguments);
- },
- logging: 'warn'
+MooTools.upgradeLog = function() {
+ if (console[this.upgradeLogLevel]) console[this.upgradeLogLevel].apply(console, arguments);
};
(function(){
oldA = $A;
window.$A = function(iterable, start, length){
if (start != undefined && length != undefined) {
- MooCompat.log('1.1 > 1.2: $A no longer takes start and length arguments.');
+ MooTools.upgradeLog('1.1 > 1.2: $A no longer takes start and length arguments.');
if (Browser.Engine.trident && $type(iterable) == 'collection'){
start = start || 0;
if (start < 0) start = iterable.length + start;
@@ -38,7 +35,7 @@ var MooCompat = {
if (natv) {
var extend = natv.extend;
natv.extend = function(props){
- MooCompat.log('1.1 > 1.2: native types no longer use .extend to add methods to prototypes but instead use .implement. NOTE: YOUR METHODS WERE NOT IMPLEMENTED ON THE NATIVE ' + type.toUpperCase() + ' PROTOTYPE.');
+ MooTools.upgradeLog('1.1 > 1.2: native types no longer use .extend to add methods to prototypes but instead use .implement. NOTE: YOUR METHODS WERE NOT IMPLEMENTED ON THE NATIVE ' + type.toUpperCase() + ' PROTOTYPE.');
return extend.apply(this, arguments);
};
}
@@ -12,7 +12,7 @@
Element.implement({
getSize: function(){
- MooCompat.log('1.1 > 1.2: NOTE: getSize is different in 1.2; it no longer returns values for size, scroll, and scrollSize, but instead just returns x/y values for the dimensions of the element.');
+ MooTools.upgradeLog('1.1 > 1.2: NOTE: getSize is different in 1.2; it no longer returns values for size, scroll, and scrollSize, but instead just returns x/y values for the dimensions of the element.');
var size = getSize.apply(this, arguments);
return $merge(size, {
size: size,
@@ -23,15 +23,15 @@
getPosition: function(relative){
if (relative && $type(relative) == "array") {
- MooCompat.log('1.1 > 1.2: Element.getPosition no longer accepts an array of overflown elements but rather, optionally, a single element to get relative coordinates.');
+ MooTools.upgradeLog('1.1 > 1.2: Element.getPosition no longer accepts an array of overflown elements but rather, optionally, a single element to get relative coordinates.');
relative = null;
}
return getPosition.apply(this, [relative]);
},
getCoordinates: function(relative){
if (relative && $type(relative) == "array") {
- MooCompat.log('1.1 > 1.2: Element.getCoordinates no longer accepts an array of overflown elements but rather, optionally, a single element to get relative coordinates.');
+ MooTools.upgradeLog('1.1 > 1.2: Element.getCoordinates no longer accepts an array of overflown elements but rather, optionally, a single element to get relative coordinates.');
relative = null;
}
return getCoordinates.apply(this, [relative]);
@@ -42,7 +42,7 @@
Native.implement([Document, Window], {
getSize: function(){
- MooCompat.log('1.1 > 1.2: NOTE: getSize is different in 1.2; it no longer returns values for size, scroll, and scrollSize, but instead just returns x/y values for the dimensions of the element.');
+ MooTools.upgradeLog('1.1 > 1.2: NOTE: getSize is different in 1.2; it no longer returns values for size, scroll, and scrollSize, but instead just returns x/y values for the dimensions of the element.');
var size;
var win = this.getWindow();
var doc = this.getDocument();
View
@@ -1,7 +1,7 @@
Element.implement({
setOpacity: function(op){
- MooCompat.log('1.1 > 1.2: Element.setOpacity is deprecated; use Element.setStyle("opacity", value).');
+ MooTools.upgradeLog('1.1 > 1.2: Element.setOpacity is deprecated; use Element.setStyle("opacity", value).');
return this.setStyle('opacity', op);
}
@@ -10,7 +10,7 @@ Element.implement({
Element.Properties.styles = {
set: function(styles){
- MooCompat.log('1.1 > 1.2: Element.set("styles") no longer accepts a string as an argument. Pass an object instead.');
+ MooTools.upgradeLog('1.1 > 1.2: Element.set("styles") no longer accepts a string as an argument. Pass an object instead.');
if ($type(styles) == 'string'){
styles.split(";").each(function(style){
this.setStyle(style.split(":")[0], style.split(":")[1]);
View
@@ -5,49 +5,49 @@
Element.implement({
getFormElements: function(){
- MooCompat.log('1.1 > 1.2: Element.getFormElements is deprecated, use Element.getElements("input, textarea, select");');
+ MooTools.upgradeLog('1.1 > 1.2: Element.getFormElements is deprecated, use Element.getElements("input, textarea, select");');
return this.getElements('input, textarea, select');
},
replaceWith: function(el){
- MooCompat.log('1.1 > 1.2: Element.replaceWith is deprecated, use Element.replaces instead.');
+ MooTools.upgradeLog('1.1 > 1.2: Element.replaceWith is deprecated, use Element.replaces instead.');
el = $(el);
this.parentNode.replaceChild(el, this);
return el;
},
remove: function() {
- MooCompat.log('1.1 > 1.2: Element.remove is deprecated - use Element.dispose.');
+ MooTools.upgradeLog('1.1 > 1.2: Element.remove is deprecated - use Element.dispose.');
return this.dispose.apply(this, arguments);
},
getText: function(){
- MooCompat.log('1.1 > 1.2: Element.getText is deprecated - use Element.get("text").');
+ MooTools.upgradeLog('1.1 > 1.2: Element.getText is deprecated - use Element.get("text").');
return this.get('text');
},
setText: function(text){
- MooCompat.log('1.1 > 1.2: Element.setText is deprecated - use Element.set("text", text).');
+ MooTools.upgradeLog('1.1 > 1.2: Element.setText is deprecated - use Element.set("text", text).');
return this.set('text', text);
},
setHTML: function(){
- MooCompat.log('1.1 > 1.2: Element.setHTML is deprecated - use Element.set("html", HTML).');
+ MooTools.upgradeLog('1.1 > 1.2: Element.setHTML is deprecated - use Element.set("html", HTML).');
return this.set('html', arguments);
},
getHTML: function(){
- MooCompat.log('1.1 > 1.2: Element.getHTML is deprecated - use Element.get("html").');
+ MooTools.upgradeLog('1.1 > 1.2: Element.getHTML is deprecated - use Element.get("html").');
return this.get('html');
},
getTag: function(){
- MooCompat.log('1.1 > 1.2: Element.getTag is deprecated - use Element.get("tag").');
+ MooTools.upgradeLog('1.1 > 1.2: Element.getTag is deprecated - use Element.get("tag").');
return this.get('tag');
},
getValue: function(){
- MooCompat.log('1.1 > 1.2: Element.getValue is deprecated - use Element.get("value").');
+ MooTools.upgradeLog('1.1 > 1.2: Element.getValue is deprecated - use Element.get("value").');
switch(this.getTag()){
case 'select':
var values = [];
@@ -62,7 +62,7 @@
},
toQueryString: function(){
- MooCompat.log('1.1 > 1.2: warning Element.toQueryString is slightly different; inputs without names are excluded, inputs with type == submit, reset, and file are excluded, and inputs with undefined values are excluded.');
+ MooTools.upgradeLog('1.1 > 1.2: warning Element.toQueryString is slightly different; inputs without names are excluded, inputs with type == submit, reset, and file are excluded, and inputs with undefined values are excluded.');
return toQueryString.apply(this, arguments);
}
});
@@ -71,7 +71,7 @@
Element.Properties.properties = {
set: function(props){
- MooCompat.log('1.1 > 1.2: Element.set({properties: {}}) is deprecated; instead of properties, just name the values at the root of the object (Element.set({src: url})).');
+ MooTools.upgradeLog('1.1 > 1.2: Element.set({properties: {}}) is deprecated; instead of properties, just name the values at the root of the object (Element.set({src: url})).');
$H(props).each(function(value, property){
this.set(property, value);
}, this);
View
@@ -1,15 +1,15 @@
Fx.Styles = new Class({
Extends: Fx.Morph,
initialize: function(){
- MooCompat.log('1.1 > 1.2: Fx.Styles is deprecated. use Fx.Morph.');
+ MooTools.upgradeLog('1.1 > 1.2: Fx.Styles is deprecated. use Fx.Morph.');
this.parent.apply(this, arguments);
}
});
Element.implement({
effects: function(options){
- MooCompat.log('1.1 > 1.2: Element.effects is deprecated; use Fx.Morph or Element.morph.');
+ MooTools.upgradeLog('1.1 > 1.2: Element.effects is deprecated; use Fx.Morph or Element.morph.');
return new Fx.Morph(this, options);
}
View
@@ -1,7 +1,7 @@
Fx.Scroll.implement({
scrollTo: function(y, x){
- MooCompat.log('1.1 > 1.2: Fx.Scroll\'s .scrollTo is deprecated; use .start.');
+ MooTools.upgradeLog('1.1 > 1.2: Fx.Scroll\'s .scrollTo is deprecated; use .start.');
return this.start(y, x);
}
View
@@ -1,7 +1,7 @@
Fx.Style = new Class({
Extends: Fx.Tween,
initialize: function(element, property, options){
- MooCompat.log('1.1 > 1.2: Fx.Style is deprecated. use Fx.Tween.');
+ MooTools.upgradeLog('1.1 > 1.2: Fx.Style is deprecated. use Fx.Tween.');
this.property = property;
this.parent(element, options);
},
@@ -15,7 +15,7 @@ Fx.Style = new Class({
},
hide: function(){
- MooCompat.log('1.1 > 1.2: Fx.Style .hide() is deprecated; use Fx.Tween .set(0) instead');
+ MooTools.upgradeLog('1.1 > 1.2: Fx.Style .hide() is deprecated; use Fx.Tween .set(0) instead');
return this.set(0);
}
@@ -24,7 +24,7 @@ Fx.Style = new Class({
Element.implement({
effect: function(property, options){
- MooCompat.log('1.1 > 1.2: Element.effect is deprecated; use Fx.Tween or Element.tween.');
+ MooTools.upgradeLog('1.1 > 1.2: Element.effect is deprecated; use Fx.Tween or Element.tween.');
return new Fx.Style(this, property, options);
}
View
@@ -1,17 +1,17 @@
Fx.implement({
custom: function(from, to){
- MooCompat.log('1.1 > 1.2: Fx.custom is deprecated. use Fx.start.');
+ MooTools.upgradeLog('1.1 > 1.2: Fx.custom is deprecated. use Fx.start.');
return this.start(from, to);
},
clearTimer: function(){
- MooCompat.log('1.1 > 1.2: Fx.clearTimer is deprecated. use Fx.cancel.');
+ MooTools.upgradeLog('1.1 > 1.2: Fx.clearTimer is deprecated. use Fx.cancel.');
return this.cancel();
},
stop: function(){
- MooCompat.log('1.1 > 1.2: Fx.stop is deprecated. use Fx.cancel.');
+ MooTools.upgradeLog('1.1 > 1.2: Fx.stop is deprecated. use Fx.cancel.');
return this.cancel();
}
@@ -20,7 +20,7 @@ Fx.implement({
Fx.Base = new Class({
Extends: Fx,
initialize: function(){
- MooCompat.log('1.1 > 1.2: Fx.Base is deprecated. use Fx.');
+ MooTools.upgradeLog('1.1 > 1.2: Fx.Base is deprecated. use Fx.');
this.parent.apply(this, arguments);
}
});
View
@@ -1,17 +1,17 @@
Array.implement({
copy: function(start, length){
- MooCompat.log('1.1 > 1.2: Array.copy is deprecated. Use Array.splice');
+ MooTools.upgradeLog('1.1 > 1.2: Array.copy is deprecated. Use Array.splice');
return $A(this, start, length);
},
remove : function(item){
- MooCompat.log('1.1 > 1.2: Array.remove is deprecated. Use Array.erase');
+ MooTools.upgradeLog('1.1 > 1.2: Array.remove is deprecated. Use Array.erase');
return this.erase(item);
},
merge : function(array){
- MooCompat.log('1.1 > 1.2: Array.merge is deprecated. Use Array.combine');
+ MooTools.upgradeLog('1.1 > 1.2: Array.merge is deprecated. Use Array.combine');
return this.combine(array);
}
View
@@ -1,12 +1,12 @@
Function.implement({
bindAsEventListener: function(bind, args){
- MooCompat.log('1.1 > 1.2: Function.bindAsEventListener is deprecated. Use bindWithEvent.');
+ MooTools.upgradeLog('1.1 > 1.2: Function.bindAsEventListener is deprecated. Use bindWithEvent.');
return this.bindWithEvent.call(this, bind, args);
}
});
Function.empty = function(){
- MooCompat.log('1.1 > 1.2: Function.empty is now just $empty.');
+ MooTools.upgradeLog('1.1 > 1.2: Function.empty is now just $empty.');
};
Oops, something went wrong.

0 comments on commit 8f342d1

Please sign in to comment.