Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

what did I just say? window != Window git show

  • Loading branch information...
commit b391ed36de43bbbd0bd3586c330f811236407d41 1 parent 1736dd8
authored July 08, 2010
2  Core/Core.js
@@ -44,5 +44,5 @@ MooTools.upgradeLog = function() {
44 44
 
45 45
 window.onDomReady = Window.onDomReady = function(fn){
46 46
 	MooTools.upgradeLog('1.1 > 1.2: window.onDomReady is no longer supported. Use window.addEvent("domready") instead');
47  
-	return this.addEvent('domready', fn);
  47
+	return window.addEvent('domready', fn);
48 48
 };
682  mootools-1.1-to-1.2-upgrade-helper.js
... ...
@@ -0,0 +1,682 @@
  1
+if(!window.console) var console = {};
  2
+if(!console.log) console.log = function(){};
  3
+if(!console.warn) console.warn = console.log;
  4
+if(!console.error) console.error = console.warn;
  5
+
  6
+MooTools.upgradeLog = function() {
  7
+	if (console[this.upgradeLogLevel]) console[this.upgradeLogLevel].apply(console, arguments);
  8
+};
  9
+
  10
+(function(){
  11
+	oldA = $A;
  12
+	window.$A = function(iterable, start, length){
  13
+		if (start != undefined && length != undefined) {
  14
+			MooTools.upgradeLog('1.1 > 1.2: $A no longer takes start and length arguments.');
  15
+			if (Browser.Engine.trident && $type(iterable) == 'collection'){
  16
+				start = start || 0;
  17
+				if (start < 0) start = iterable.length + start;
  18
+				length = length || (iterable.length - start);
  19
+				var array = [];
  20
+				for (var i = 0; i < length; i++) array[i] = iterable[start++];
  21
+				return array;
  22
+			}
  23
+			start = (start || 0) + ((start < 0) ? iterable.length : 0);
  24
+			var end = ((!$chk(length)) ? iterable.length : length) + start;
  25
+			return Array.prototype.slice.call(iterable, start, end);
  26
+		}
  27
+		return oldA(iterable);
  28
+	};
  29
+
  30
+
  31
+	var strs = ['Array', 'Function', 'String', 'RegExp', 'Number', 'Window', 'Document', 'Element', 'Elements'];
  32
+	for (var i = 0, l = strs.length; i < l; i++) {
  33
+		var type = strs[i];
  34
+		var natv = window[type];
  35
+		if (natv) {
  36
+			var extend = natv.extend;
  37
+			natv.extend = function(props){
  38
+				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.');
  39
+				return extend.apply(this, arguments);
  40
+			};
  41
+		}
  42
+	}
  43
+})();
  44
+
  45
+window.onDomReady = Window.onDomReady = function(fn){
  46
+	MooTools.upgradeLog('1.1 > 1.2: window.onDomReady is no longer supported. Use window.addEvent("domready") instead');
  47
+	return window.addEvent('domready', fn);
  48
+};if (Browser.__defineGetter__) {
  49
+	Browser.__defineGetter__('hasGetter',function(){
  50
+		return true;
  51
+	});
  52
+}
  53
+
  54
+if(Browser.hasGetter){ // webkit, gecko, opera support
  55
+	
  56
+	window.__defineGetter__('ie',function(){
  57
+		MooTools.upgradeLog('1.1 > 1.2: window.ie is deprecated. Use Browser.Engine.trident');
  58
+		return (Browser.Engine.name == 'trident') ? true : false;
  59
+	});
  60
+	window.__defineGetter__('ie6',function(){
  61
+		MooTools.upgradeLog('1.1 > 1.2: window.ie6 is deprecated. Use Browser.Engine.trident and Browser.Engine.version');
  62
+		return (Browser.Engine.name == 'trident' && Browser.Engine.version == 4) ? true : false;
  63
+	});
  64
+	window.__defineGetter__('ie7',function(){
  65
+		MooTools.upgradeLog('1.1 > 1.2: window.ie7 is deprecated. Use Browser.Engine.trident and Browser.Engine.version');
  66
+		return (Browser.Engine.name == 'trident' && Browser.Engine.version == 5) ? true : false;
  67
+	});
  68
+	window.__defineGetter__('gecko',function(){
  69
+		MooTools.upgradeLog('1.1 > 1.2: window.gecko is deprecated. Use Browser.Engine.gecko');
  70
+		return (Browser.Engine.name == 'gecko') ? true : false;
  71
+	});
  72
+	window.__defineGetter__('webkit',function(){
  73
+		MooTools.upgradeLog('1.1 > 1.2: window.webkit is deprecated. Use Browser.Engine.webkit');
  74
+		return (Browser.Engine.name == 'webkit') ? true : false;
  75
+	});
  76
+	window.__defineGetter__('webkit419',function(){
  77
+		MooTools.upgradeLog('1.1 > 1.2: window.webkit is deprecated. Use Browser.Engine.webkit and Browser.Engine.version');
  78
+		return (Browser.Engine.name == 'webkit' && Browser.Engine.version == 419) ? true : false;
  79
+	});
  80
+	window.__defineGetter__('webkit420',function(){
  81
+		MooTools.upgradeLog('1.1 > 1.2: window.webkit is deprecated. Use Browser.Engine.webkit and Browser.Engine.version');
  82
+		return (Browser.Engine.name == 'webkit' && Browser.Engine.version == 420) ? true : false;
  83
+	});
  84
+	window.__defineGetter__('opera',function(){
  85
+		MooTools.upgradeLog('1.1 > 1.2: window.opera is deprecated. Use Browser.Engine.presto');
  86
+		return (Browser.Engine.name == 'presto') ? true : false;
  87
+	});
  88
+} else {
  89
+	window[Browser.Engine.name] = window[Browser.Engine.name + Browser.Engine.version] = true;
  90
+	window.ie = window.trident;
  91
+	window.ie6 = window.trident4;
  92
+	window.ie7 = window.trident5;	
  93
+}
  94
+Array.implement({
  95
+
  96
+	copy: function(start, length){
  97
+		MooTools.upgradeLog('1.1 > 1.2: Array.copy is deprecated. Use Array.splice');
  98
+		return $A(this, start, length);
  99
+	},
  100
+
  101
+	remove : function(item){
  102
+		MooTools.upgradeLog('1.1 > 1.2: Array.remove is deprecated. Use Array.erase');
  103
+		return this.erase(item);
  104
+	},
  105
+
  106
+	merge : function(array){
  107
+		MooTools.upgradeLog('1.1 > 1.2: Array.merge is deprecated. Use Array.combine');
  108
+		return this.combine(array);
  109
+	}
  110
+
  111
+});
  112
+Function.implement({
  113
+
  114
+	bindAsEventListener: function(bind, args){
  115
+		MooTools.upgradeLog('1.1 > 1.2: Function.bindAsEventListener is deprecated. Use bindWithEvent.');
  116
+		return this.bindWithEvent.call(this, bind, args);
  117
+	}
  118
+
  119
+});
  120
+
  121
+Function.empty = function(){
  122
+	MooTools.upgradeLog('1.1 > 1.2: Function.empty is now just $empty.');
  123
+};Hash.implement({
  124
+
  125
+	keys : function(){
  126
+		MooTools.upgradeLog('1.1 > 1.2: Hash.keys is deprecated. Use Hash.getKeys');
  127
+		return this.getKeys();
  128
+	},
  129
+
  130
+	values : function(){
  131
+		MooTools.upgradeLog('1.1 > 1.2: Hash.values is deprecated. Use Hash.getValues');
  132
+		return this.getValues();
  133
+	},
  134
+
  135
+	hasKey : function(item){
  136
+		MooTools.upgradeLog('1.1 > 1.2: Hash.hasKey is deprecated. Use Hash.has');
  137
+		return this.has(item);
  138
+	},
  139
+
  140
+	merge : function(properties){
  141
+		MooTools.upgradeLog('1.1 > 1.2: Hash.merge is deprecated. Use Hash.combine');
  142
+		return this.extend(properties);
  143
+	},
  144
+
  145
+	remove: function(key){
  146
+		MooTools.upgradeLog('1.1 > 1.2: Hash.remove is deprecated. use Hash.erase');
  147
+		return this.erase(key);
  148
+	}
  149
+
  150
+});
  151
+
  152
+Object.toQueryString = function(obj){
  153
+	MooTools.upgradeLog('1.1 > 1.2: Object.toQueryString() is deprecated. use Hash.toQueryString() instead');
  154
+	$H(obj).each(function(item, key){
  155
+		if ($type(item) == 'object' || $type(item) == 'array'){
  156
+			obj[key] = item.toString();
  157
+		}
  158
+	});
  159
+	return Hash.toQueryString(obj);
  160
+};
  161
+
  162
+var Abstract = function(obj){
  163
+	MooTools.upgradeLog('1.1 > 1.2: Abstract is deprecated. Use Hash');
  164
+	return new Hash(obj);
  165
+};Class.empty = function(){ 
  166
+	MooTools.upgradeLog('1.1 > 1.2: replace Class.empty with $empty');
  167
+	return $empty;
  168
+};
  169
+
  170
+//legacy .extend support
  171
+
  172
+(function(){
  173
+	var proto = function(obj) {
  174
+		var f = function(){
  175
+			return this;
  176
+		};
  177
+		f.prototype = obj;
  178
+		return f;
  179
+	};
  180
+
  181
+	Class.prototype.extend = function(properties){
  182
+		MooTools.upgradeLog('1.1 > 1.2: Class.extend is deprecated. See the class Extend mutator.');
  183
+		var maker = proto(properties);
  184
+		var made = new maker();
  185
+		made.Extends = this;
  186
+		return new Class(made);
  187
+	};
  188
+
  189
+	var __implement = Class.prototype.implement;
  190
+	Class.prototype.implement = function(){
  191
+		if (arguments.length > 1 && Array.every(arguments, Object.type)){
  192
+			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.');
  193
+			Array.each(arguments, function(argument){
  194
+				__implement.call(this, argument);
  195
+			}, this);
  196
+			return this;
  197
+		}
  198
+		return __implement.apply(this, arguments);
  199
+	};
  200
+})();(function(){
  201
+
  202
+	var getPosition = Element.prototype.getPosition;
  203
+	var getCoordinates = Element.prototype.getCoordinates;
  204
+
  205
+	function isBody(element){
  206
+		return (/^(?:body|html)$/i).test(element.tagName);
  207
+	};
  208
+
  209
+	var getSize = Element.prototype.getSize;
  210
+
  211
+	Element.implement({
  212
+	
  213
+		getSize: function(){
  214
+			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.');
  215
+			var size = getSize.apply(this, arguments);
  216
+			return $merge(size, {
  217
+				size: size,
  218
+				scroll: this.getScroll(),
  219
+				scrollSize: this.getScrollSize()
  220
+			});
  221
+		},
  222
+
  223
+		getPosition: function(relative){
  224
+			if (relative && $type(relative) == "array") {
  225
+				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.');
  226
+				relative = null;
  227
+			}
  228
+			return getPosition.apply(this, [relative]);
  229
+		},
  230
+
  231
+		getCoordinates: function(relative){
  232
+			if (relative && $type(relative) == "array") {
  233
+				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.');
  234
+				relative = null;
  235
+			}
  236
+			return getCoordinates.apply(this, [relative]);
  237
+		}
  238
+	
  239
+	});
  240
+
  241
+	Native.implement([Document, Window], {
  242
+
  243
+		getSize: function(){
  244
+			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.');
  245
+			var size;
  246
+			var win = this.getWindow();
  247
+			var doc = this.getDocument();
  248
+			doc = (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body;
  249
+			if (Browser.Engine.presto || Browser.Engine.webkit){
  250
+				size =  {x: win.innerWidth, y: win.innerHeight};
  251
+			} else {
  252
+				size = {x: doc.clientWidth, y: doc.clientHeight};
  253
+			}
  254
+			return $extend(size, {
  255
+				size: size,
  256
+				scroll: {x: win.pageXOffset || doc.scrollLeft, y: win.pageYOffset || doc.scrollTop},
  257
+				scrollSize: {x: Math.max(doc.scrollWidth, size.x), y: Math.max(doc.scrollHeight, size.y)}
  258
+			});
  259
+		}
  260
+
  261
+	});
  262
+
  263
+})();Event.keys = Event.Keys; // TODO
  264
+(function(){
  265
+
  266
+	var toQueryString = Element.prototype.toQueryString;
  267
+
  268
+	Element.implement({
  269
+
  270
+		getFormElements: function(){
  271
+			MooTools.upgradeLog('1.1 > 1.2: Element.getFormElements is deprecated, use Element.getElements("input, textarea, select");'); 
  272
+			return this.getElements('input, textarea, select');
  273
+		},
  274
+
  275
+		replaceWith: function(el){
  276
+			MooTools.upgradeLog('1.1 > 1.2: Element.replaceWith is deprecated, use Element.replaces instead.'); 
  277
+			el = $(el);
  278
+			this.parentNode.replaceChild(el, this);
  279
+			return el;
  280
+		},
  281
+
  282
+		remove: function() {
  283
+			MooTools.upgradeLog('1.1 > 1.2: Element.remove is deprecated - use Element.dispose.');
  284
+			return this.dispose.apply(this, arguments);
  285
+		},
  286
+
  287
+		getText: function(){
  288
+			MooTools.upgradeLog('1.1 > 1.2: Element.getText is deprecated - use Element.get("text").'); 
  289
+			return this.get('text');
  290
+		},
  291
+
  292
+		setText: function(text){
  293
+			MooTools.upgradeLog('1.1 > 1.2: Element.setText is deprecated - use Element.set("text", text).'); 
  294
+			return this.set('text', text);
  295
+		},
  296
+
  297
+		setHTML: function(){
  298
+			MooTools.upgradeLog('1.1 > 1.2: Element.setHTML is deprecated - use Element.set("html", HTML).'); 
  299
+			return this.set('html', arguments);
  300
+		},
  301
+
  302
+		getHTML: function(){
  303
+			MooTools.upgradeLog('1.1 > 1.2: Element.getHTML is deprecated - use Element.get("html").'); 
  304
+			return this.get('html');
  305
+		},
  306
+
  307
+		getTag: function(){
  308
+			MooTools.upgradeLog('1.1 > 1.2: Element.getTag is deprecated - use Element.get("tag").'); 
  309
+			return this.get('tag');
  310
+		},
  311
+	
  312
+		getValue: function(){
  313
+			MooTools.upgradeLog('1.1 > 1.2: Element.getValue is deprecated - use Element.get("value").');
  314
+			switch(this.getTag()){
  315
+				case 'select':
  316
+					var values = [];
  317
+					$each(this.options, function(option){
  318
+						if (option.selected) values.push($pick(option.value, option.text));
  319
+					});
  320
+					return (this.multiple) ? values : values[0];
  321
+				case 'input': if (!(this.checked && ['checkbox', 'radio'].contains(this.type)) && !['hidden', 'text', 'password'].contains(this.type)) break;
  322
+				case 'textarea': return this.value;
  323
+			}
  324
+			return false;
  325
+		},
  326
+
  327
+		toQueryString: function(){
  328
+			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.');
  329
+			return toQueryString.apply(this, arguments);
  330
+		}
  331
+	});
  332
+})();
  333
+
  334
+Element.Properties.properties = {
  335
+	
  336
+	set: function(props){
  337
+		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})).');
  338
+		$H(props).each(function(value, property){
  339
+			this.set(property, value);
  340
+		}, this);
  341
+	}
  342
+	
  343
+};
  344
+Element.implement({
  345
+
  346
+	setOpacity: function(op){
  347
+		MooTools.upgradeLog('1.1 > 1.2: Element.setOpacity is deprecated; use Element.setStyle("opacity", value).');
  348
+		return this.setStyle('opacity', op);
  349
+	}
  350
+
  351
+});
  352
+
  353
+Element.Properties.styles = {
  354
+	
  355
+	set: function(styles){
  356
+		MooTools.upgradeLog('1.1 > 1.2: Element.set("styles") no longer accepts a string as an argument. Pass an object instead.');
  357
+		if ($type(styles) == 'string'){
  358
+			styles.split(";").each(function(style){
  359
+				this.setStyle(style.split(":")[0], style.split(":")[1]);
  360
+			}, this);
  361
+		} else {
  362
+			this.setStyles(styles);
  363
+		}
  364
+	}
  365
+	
  366
+};Fx.implement({
  367
+
  368
+	custom: function(from, to){
  369
+		MooTools.upgradeLog('1.1 > 1.2: Fx.custom is deprecated. use Fx.start.');
  370
+		return this.start(from, to);
  371
+	},
  372
+
  373
+	clearTimer: function(){
  374
+		MooTools.upgradeLog('1.1 > 1.2: Fx.clearTimer is deprecated. use Fx.cancel.');
  375
+		return this.cancel();
  376
+	},
  377
+
  378
+	stop: function(){
  379
+		MooTools.upgradeLog('1.1 > 1.2: Fx.stop is deprecated. use Fx.cancel.');
  380
+		return this.cancel();
  381
+	}
  382
+
  383
+});
  384
+
  385
+Fx.Base = new Class({
  386
+	Extends: Fx,
  387
+	initialize: function(){
  388
+		MooTools.upgradeLog('1.1 > 1.2: Fx.Base is deprecated. use Fx.');
  389
+		this.parent.apply(this, arguments);
  390
+	}
  391
+});
  392
+Fx.Style = new Class({
  393
+	Extends: Fx.Tween,
  394
+	initialize: function(element, property, options){
  395
+		MooTools.upgradeLog('1.1 > 1.2: Fx.Style is deprecated. use Fx.Tween.');
  396
+		this.property = property;
  397
+		this.parent(element, options);
  398
+	},
  399
+	
  400
+	start: function(from, to) {
  401
+		return this.parent(this.property, from, to);
  402
+	},
  403
+	
  404
+	set: function(to) {
  405
+		return this.parent(this.property, to);
  406
+	},
  407
+	
  408
+	hide: function(){
  409
+		MooTools.upgradeLog('1.1 > 1.2: Fx.Style .hide() is deprecated; use Fx.Tween .set(0) instead');
  410
+		return this.set(0);
  411
+	}
  412
+
  413
+});
  414
+
  415
+Element.implement({
  416
+
  417
+	effect: function(property, options){
  418
+		MooTools.upgradeLog('1.1 > 1.2: Element.effect is deprecated; use Fx.Tween or Element.tween.');
  419
+		return new Fx.Style(this, property, options);
  420
+	}
  421
+
  422
+});
  423
+Fx.Styles = new Class({
  424
+	Extends: Fx.Morph,
  425
+	initialize: function(){
  426
+		MooTools.upgradeLog('1.1 > 1.2: Fx.Styles is deprecated. use Fx.Morph.');
  427
+		this.parent.apply(this, arguments);
  428
+	}
  429
+});
  430
+
  431
+Element.implement({
  432
+
  433
+	effects: function(options){
  434
+		MooTools.upgradeLog('1.1 > 1.2: Element.effects is deprecated; use Fx.Morph or Element.morph.');
  435
+		return new Fx.Morph(this, options);
  436
+	}
  437
+
  438
+});Fx.Scroll.implement({
  439
+
  440
+	scrollTo: function(y, x){
  441
+		MooTools.upgradeLog('1.1 > 1.2: Fx.Scroll\'s .scrollTo is deprecated; use .start.');
  442
+		return this.start(y, x);
  443
+	}
  444
+
  445
+});Request.implement({
  446
+	//1.11 passed along the response text and xml to onComplete
  447
+	onStateChange: function(){
  448
+		if (this.xhr.readyState != 4 || !this.running) return;
  449
+		this.running = false;
  450
+		this.status = 0;
  451
+		$try(function(){
  452
+			this.status = this.xhr.status;
  453
+		}.bind(this));
  454
+		this.xhr.onreadystatechange = $empty;
  455
+		this.response = {text: this.xhr.responseText, xml: this.xhr.responseXML};
  456
+		if (this.options.isSuccess.call(this, this.status)) this.success(this.response.text, this.response.xml);
  457
+		else this.failure(this.response.text, this.response.xml);
  458
+	},
  459
+	
  460
+	failure: function(){
  461
+		this.onFailure.apply(this, arguments);
  462
+	},
  463
+
  464
+	onFailure: function(){
  465
+		MooTools.upgradeLog('1.1 > 1.2: Note that onComplete does not receive arguments in 1.2. Also note that onComplete is invoked on BOTH success and failure (while in 1.1 it was only invoked on success). Use the onSuccess event instead if you wish to limit this invocation to success.');
  466
+		this.fireEvent('complete', arguments).fireEvent('failure', this.xhr);
  467
+	}
  468
+
  469
+});
  470
+
  471
+var XHR = new Class({
  472
+
  473
+	Extends: Request,
  474
+
  475
+	options: {
  476
+		update: false
  477
+	},
  478
+
  479
+	initialize: function(options){
  480
+		MooTools.upgradeLog('1.1 > 1.2: XHR is deprecated. Use Request.');
  481
+		this.parent(options);
  482
+		this.transport = this.xhr;
  483
+	},
  484
+
  485
+	request: function(data){
  486
+		MooTools.upgradeLog('1.1 > 1.2: XHR.request() is deprecated. Use Request.send() instead.');
  487
+		return this.send(this.url, data || this.options.data);
  488
+	},
  489
+
  490
+	send: function(url, data){
  491
+		if (!this.check(arguments.callee, url, data)) return this;
  492
+		return this.parent({url: url, data: data});
  493
+	},
  494
+
  495
+	success: function(text, xml){
  496
+		text = this.processScripts(text);
  497
+		if (this.options.update) $(this.options.update).empty().set('html', text);
  498
+		this.onSuccess(text, xml);
  499
+	},
  500
+
  501
+	failure: function(){
  502
+		this.fireEvent('failure', this.xhr);
  503
+	}
  504
+
  505
+});
  506
+
  507
+
  508
+var Ajax = new Class({
  509
+
  510
+	Extends: XHR,
  511
+
  512
+	initialize: function(url, options){
  513
+		MooTools.upgradeLog('1.1 > 1.2: Ajax is deprecated. Use Request.');
  514
+		this.url = url;
  515
+		this.parent(options);
  516
+	},
  517
+
  518
+	success: function(text, xml){
  519
+		// This version processes scripts *after* the update element is updated, like Mootools 1.1's Ajax class
  520
+		// Partially from Remote.Ajax.success
  521
+		this.processScripts(text);
  522
+		response = this.response;
  523
+		response.html = text.stripScripts(function(script){
  524
+				response.javascript = script;
  525
+		});
  526
+		if (this.options.update) $(this.options.update).empty().set('html', response.html);
  527
+		if (this.options.evalScripts) $exec(response.javascript);
  528
+		this.onSuccess(text, xml);
  529
+	}
  530
+
  531
+});
  532
+
  533
+(function(){
  534
+	var send = Element.prototype.send;
  535
+	Element.implement({
  536
+		send: function(url) {
  537
+			if ($type(url) == "string") return send.apply(this, arguments);
  538
+			if ($type(url) == "object") {
  539
+				MooTools.upgradeLog('1.1 > 1.2: Element.send no longer takes an options argument as its object but rather a url. See docs.');
  540
+				this.set('send', url);
  541
+				send.call(this);
  542
+			}
  543
+			return this;
  544
+		}
  545
+	});
  546
+})();JSON.Remote = new Class({
  547
+
  548
+	options: {
  549
+		key: 'json'
  550
+	},
  551
+
  552
+	Extends: Request.JSON,
  553
+
  554
+	initialize: function(url, options){
  555
+		MooTools.upgradeLog('JSON.Remote is deprecated. Use Request.JSON');
  556
+		this.parent(options);
  557
+		this.onComplete = $empty;
  558
+		this.url = url;
  559
+	},
  560
+
  561
+	send: function(data){
  562
+		if (!this.check(arguments.callee, data)) return this;
  563
+		return this.parent({url: this.url, data: {json: Json.encode(data)}});
  564
+	},
  565
+
  566
+	failure: function(){
  567
+		this.fireEvent('failure', this.xhr);
  568
+	}
  569
+
  570
+});
  571
+
  572
+Cookie.set = function(key, value, options){
  573
+	MooTools.upgradeLog('1.1 > 1.2: Cookie.set is deprecated. Use Cookie.write');
  574
+	return new Cookie(key, options).write(value);
  575
+};
  576
+
  577
+Cookie.get = function(key){
  578
+	MooTools.upgradeLog('1.1 > 1.2: Cookie.get is deprecated. Use Cookie.read');
  579
+	return new Cookie(key).read();
  580
+};
  581
+
  582
+Cookie.remove = function(key, options){
  583
+	MooTools.upgradeLog('1.1 > 1.2: Cookie.remove is deprecated. Use Cookie.dispose');
  584
+	return new Cookie(key, options).dispose();
  585
+};
  586
+JSON.toString = function(obj){ 
  587
+	MooTools.upgradeLog('1.1 > 1.2: JSON.toString is deprecated. Use JSON.encode');
  588
+	return JSON.encode(obj); 
  589
+};
  590
+JSON.evaluate = function(str){
  591
+	MooTools.upgradeLog('1.1 > 1.2: JSON.evaluate is deprecated. Use JSON.decode');
  592
+	return JSON.decode(str); 
  593
+};
  594
+var Json = JSON;
  595
+
  596
+Native.implement([Element, Document], {
  597
+
  598
+	getElementsByClassName: function(className){
  599
+		MooTools.upgradeLog('1.1 > 1.2: Element.filterByTag is deprecated.');
  600
+		
  601
+		return this.getElements('.' + className);
  602
+	},
  603
+
  604
+	getElementsBySelector: function(selector){
  605
+		MooTools.upgradeLog('1.1 > 1.2: Element.getElementsBySelector is deprecated. Use getElements()');
  606
+		return this.getElements(selector);
  607
+	}
  608
+
  609
+});
  610
+
  611
+Elements.implement({
  612
+
  613
+	filterByTag: function(tag){
  614
+		MooTools.upgradeLog('1.1 > 1.2: Elements.filterByTag is deprecated. Use Elements.filter.');
  615
+		return this.filter(tag);
  616
+	},
  617
+
  618
+	filterByClass: function(className){
  619
+		MooTools.upgradeLog('1.1 > 1.2: Elements.filterByClass is deprecated. Use Elements.filter.');
  620
+		return this.filter('.' + className);
  621
+	},
  622
+
  623
+	filterById: function(id){
  624
+		MooTools.upgradeLog('1.1 > 1.2: Elements.filterById is deprecated. Use Elements.filter.');
  625
+		return this.filter('#' + id);
  626
+	},
  627
+
  628
+	filterByAttribute: function(name, operator, value){
  629
+		MooTools.upgradeLog('1.1 > 1.2: Elements.filterByAttribute is deprecated. Use Elements.filter.');
  630
+		var filtered = this.filter('[' + name + (operator || '') + (value || '') + ']');
  631
+		if (value) filtered = filtered.filter('[' + name + ']');
  632
+		return filtered;
  633
+	}
  634
+
  635
+});
  636
+
  637
+var $E = function(selector, filter){
  638
+	MooTools.upgradeLog('1.1 > 1.2: $E is deprecated, use document.getElement.');
  639
+	return ($(filter) || document).getElement(selector);
  640
+};
  641
+
  642
+var $ES = function(selector, filter){
  643
+	MooTools.upgradeLog('1.1 > 1.2: $ES is deprecated. Use $$.');
  644
+	return ($(filter) || document).getElements(selector);
  645
+};(function(){
  646
+	if (!window.Tips) return;
  647
+
  648
+	Tips.implement({
  649
+
  650
+		initialize: function(){
  651
+			MooTools.upgradeLog('1.1 > 1.2: Tips DOM element layout has changed and your CSS classes may need to change.');
  652
+			var params = Array.link(arguments, {options: Object.type, elements: $defined});
  653
+			this.setOptions(params.options);
  654
+			if (this.options.offsets) {
  655
+				MooTools.upgradeLog('1.1 > 1.2: Tips no longer have an "offsets" option; use "offset".');
  656
+				this.options.offset = this.options.offsets;
  657
+			}
  658
+			document.id(this);
  659
+			this.addEvent('show', function(){
  660
+				this.tip.addClass('tool-tip');
  661
+				this.tip.getElement('.tip-title').addClass('tool-title');
  662
+				this.tip.getElement('.tip-text').addClass('tool-text');
  663
+			});
  664
+			this.parseTitle(params.elements);
  665
+			if (params.elements) this.attach(params.elements);
  666
+		},
  667
+
  668
+		parseTitle: function(elements){
  669
+			elements.each(function(element){
  670
+			var title = element.get('title');
  671
+				if (title.test('::')) {
  672
+					MooTools.upgradeLog('1.1 > 1.2: Tips no longer parse the title attribute for "::" for title/caption; use title and rel attributes instead.');
  673
+					element.store('tip:title', title.split('::')[0]);
  674
+					element.store('tip:text', title.split('::')[1]);
  675
+					element.set('title', '');
  676
+				}
  677
+			});
  678
+		}
  679
+
  680
+	});
  681
+
  682
+})();

0 notes on commit b391ed3

Please sign in to comment.
Something went wrong with that request. Please try again.