update.patch 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. --- mif.tree-v1.2.6.4.js 2011-07-29 09:55:04.000000000 +0200
  2. +++ mif.tree_for-mt-1.3.2.js 2011-08-01 14:41:36.000000000 +0200
  3. @@ -7,8 +7,9 @@
  4. copyright: Anton Samoylov (http://mifjs.net)
  5. authors: Anton Samoylov (http://mifjs.net)
  6. requires:
  7. - - Core:1.2.4/*
  8. + - Core:1.3/*
  9. - More/Fx.Scroll
  10. + - More/Fx.Drag
  11. provides: Mif.Tree
  12. ...
  13. @@ -24,7 +25,7 @@
  14. version: '1.2.6.4',
  15. - Implements: [new Events, new Options],
  16. + Implements: [Events, Options],
  17. options:{
  18. types: {},
  19. @@ -36,7 +37,7 @@
  20. initialize: function(options){
  21. this.setOptions(options);
  22. - $extend(this, {
  23. + Object.append(this, {
  24. types: this.options.types,
  25. forest: this.options.forest,
  26. animateScroll: this.options.animateScroll,
  27. @@ -62,7 +63,7 @@
  28. this.updateOpenState();
  29. if(this.options.expandTo) this.initExpandTo();
  30. this.DOMidPrefix='mif-tree-';
  31. - this.wrapper = new Element('div').addClass('mif-tree-wrapper').injectInside(this.container);
  32. + this.wrapper = new Element('div').addClass('mif-tree-wrapper').inject(this.container,'bottom');
  33. this.events();
  34. this.initScroll();
  35. this.initSelection();
  36. @@ -343,12 +344,12 @@
  37. Implements: [Events],
  38. initialize: function(structure, options) {
  39. - $extend(this, structure);
  40. + Object.append(this, structure);
  41. this.children = [];
  42. this.type = options.type || this.tree.dfltType;
  43. this.property = options.property || {};
  44. this.data = options.data;
  45. - this.state = $extend($unlink(this.tree.dfltState), options.state);
  46. + this.state = Object.append(Object.clone(this.tree.dfltState), options.state);
  47. this.$calculate();
  48. this.UID = Mif.Tree.Node.UID++;
  49. Mif.Tree.Nodes[this.UID] = this;
  50. @@ -359,13 +360,13 @@
  51. },
  52. $calculate: function(){
  53. - $extend(this, $unlink(this.tree.defaults));
  54. - this.type = $splat(this.type);
  55. + Object.append(this, Object.clone(this.tree.defaults));
  56. + this.type = Array.from(this.type);
  57. this.type.each(function(type){
  58. var props = this.tree.types[type];
  59. - if(props) $extend(this, props);
  60. + if(props) Object.append(this, props);
  61. }, this);
  62. - $extend(this, this.property);
  63. + Object.append(this, this.property);
  64. return this;
  65. },
  66. @@ -418,7 +419,7 @@
  67. },
  68. recursive: function(fn, args){
  69. - args=$splat(args);
  70. + args=Array.from(args);
  71. if(fn.apply(this, args) !== false){
  72. this.children.each(function(node){
  73. if(node.recursive(fn, args) === false){
  74. @@ -671,7 +672,7 @@
  75. getHTML: function(node,html){
  76. var prefix = node.tree.DOMidPrefix;
  77. var checkbox;
  78. - if($defined(node.state.checked)){
  79. + if(node.state.checked != undefined){
  80. if(!node.hasCheckbox) node.state.checked='nochecked';
  81. checkbox = '<span class="mif-tree-checkbox mif-tree-node-'+node.state.checked+'" uid="'+node.UID+'">'+Mif.Tree.Draw.zeroSpace+'</span>';
  82. }else{
  83. @@ -713,7 +714,7 @@
  84. },
  85. forestRoot: function(tree){
  86. - var container = new Element('div').addClass('mif-tree-children-root').injectInside(tree.wrapper);
  87. + var container = new Element('div').addClass('mif-tree-children-root').inject(tree.wrapper,'bottom');
  88. Mif.Tree.Draw.children(tree.root, container);
  89. },
  90. @@ -757,7 +758,7 @@
  91. element = element || node.getDOM('node') || this.node(node);
  92. var previous = node.getPrevious();
  93. if(previous){
  94. - element.injectAfter(previous.getDOM('node'));
  95. + element.inject(previous.getDOM('node'),'after');
  96. return;
  97. }
  98. var container;
  99. @@ -773,7 +774,7 @@
  100. };
  101. -Mif.Tree.Draw.zeroSpace = Browser.Engine.trident ? '&shy;' : (Browser.Engine.webkit ? '&#8203' : '');
  102. +Mif.Tree.Draw.zeroSpace = Browser.ie ? '&shy;' : (Browser.chrome ? '&#8203' : '');
  103. @@ -795,7 +796,11 @@
  104. initSelection: function(){
  105. this.defaults.selectClass = '';
  106. - this.wrapper.addEvent('mousedown', this.attachSelect.bindWithEvent(this));
  107. + this.wrapper.addEvent('mousedown', function(e) {
  108. + //this.attachSelect.bindWithEvent(this)
  109. + this.attachSelect(e)
  110. + }.bind(this)
  111. + );
  112. },
  113. attachSelect: function(event){
  114. @@ -881,13 +886,13 @@
  115. name: false,
  116. node: false
  117. };
  118. - this.hoverState = $unlink(this.defaultHoverState);
  119. + this.hoverState = Object.clone(this.defaultHoverState);
  120. },
  121. hover: function(){
  122. var cnode = this.mouse.node;
  123. var ctarget = this.mouse.target;
  124. - $each(this.hoverState, function(node, target, state){
  125. + Object.each(this.hoverState, function(node, target, state){
  126. if(node == cnode && (target == 'node'||target==ctarget)) return;
  127. if(node) {
  128. Mif.Tree.Hover.out(node, target);
  129. @@ -905,7 +910,7 @@
  130. },
  131. updateHover: function(){
  132. - this.hoverState = $unlink(this.defaultHoverState);
  133. + this.hoverState = Object.clone(this.defaultHoverState);
  134. this.hover();
  135. }
  136. @@ -976,7 +981,7 @@
  137. load: function(options){
  138. var tree = this;
  139. - this.loadOptions = this.loadOptions||$lambda({});
  140. + this.loadOptions = this.loadOptions||Function.from({});
  141. function success(json){
  142. var parent = null;
  143. if(tree.forest){
  144. @@ -992,8 +997,8 @@
  145. tree.fireEvent('load');
  146. return tree;
  147. }
  148. - options = $extend($extend({
  149. - isSuccess: $lambda(true),
  150. + options = Object.append(Object.append({
  151. + isSuccess: Function.from(true),
  152. secure: true,
  153. onSuccess: success,
  154. method: 'get'
  155. @@ -1022,8 +1027,8 @@
  156. self.tree.fireEvent('loadNode', self);
  157. return self;
  158. }
  159. - options=$extend($extend($extend({
  160. - isSuccess: $lambda(true),
  161. + options=Object.append(Object.append(Object.append({
  162. + isSuccess: Function.from(true),
  163. secure: true,
  164. onSuccess: success,
  165. method: 'get'
  166. @@ -1066,12 +1071,12 @@
  167. },
  168. attach: function(){
  169. - var event = Browser.Engine.trident || Browser.Engine.webkit ? 'keydown' : 'keypress';
  170. + var event = Browser.ie || Browser.chrome ? 'keydown' : 'keypress';
  171. document.addEvent(event, this.bound.action);
  172. },
  173. detach: function(){
  174. - var event = Browser.Engine.trident || Browser.Engine.webkit ? 'keydown' : 'keypress';
  175. + var event = Browser.ie || Browser.chrome ? 'keydown' : 'keypress';
  176. document.removeEvent(event, this.bound.action);
  177. },
  178. @@ -1158,12 +1163,14 @@
  179. });
  180. +/*
  181. Event.Keys.extend({
  182. 'pgdown': 34,
  183. 'pgup': 33,
  184. 'home': 36,
  185. 'end': 35
  186. });
  187. +*/
  188. /*
  189. @@ -1299,7 +1306,7 @@
  190. function copy(structure){
  191. var node = structure.node;
  192. var tree = structure.tree;
  193. - var options = $unlink({
  194. + var options = Object.clone({
  195. property: node.property,
  196. type: node.type,
  197. state: node.state,
  198. @@ -1407,7 +1414,7 @@
  199. Mif.Tree.Drag = new Class({
  200. - Implements: [new Events, new Options],
  201. + Implements: [Events, Options],
  202. Extends: Drag,
  203. @@ -1427,7 +1434,7 @@
  204. initialize: function(tree, options){
  205. tree.drag = this;
  206. this.setOptions(options);
  207. - $extend(this, {
  208. + Object.append(this, {
  209. tree: tree,
  210. snap: this.options.snap,
  211. groups: [],
  212. @@ -1439,7 +1446,7 @@
  213. this.setDroppables(this.options.droppables);
  214. - $extend(tree.defaults, {
  215. + Object.append(tree.defaults, {
  216. dropDenied: [],
  217. dragDisabled: false
  218. });
  219. @@ -1447,7 +1454,7 @@
  220. tree.root.dropDenied.combine(['before', 'after']);
  221. });
  222. - this.pointer = new Element('div').addClass('mif-tree-pointer').injectInside(tree.wrapper);
  223. + this.pointer = new Element('div').addClass('mif-tree-pointer').inject(tree.wrapper,'bottom');
  224. this.current = Mif.Tree.Drag.current;
  225. this.target = Mif.Tree.Drag.target;
  226. @@ -1456,7 +1463,7 @@
  227. this.element = [this.current, this.target, this.where];
  228. this.document = tree.wrapper.getDocument();
  229. - this.selection = (Browser.Engine.trident) ? 'selectstart' : 'mousedown';
  230. + this.selection = (Browser.ie) ? 'selectstart' : 'mousedown';
  231. this.bound = {
  232. start: this.start.bind(this),
  233. @@ -1464,7 +1471,7 @@
  234. drag: this.drag.bind(this),
  235. stop: this.stop.bind(this),
  236. cancel: this.cancel.bind(this),
  237. - eventStop: $lambda(false),
  238. + eventStop: Function.from(false),
  239. leave: this.leave.bind(this),
  240. enter: this.enter.bind(this),
  241. keydown: this.keydown.bind(this)
  242. @@ -1504,7 +1511,7 @@
  243. },
  244. addToGroups: function(groups){
  245. - groups = $splat(groups);
  246. + groups = Array.from(groups);
  247. this.groups.combine(groups);
  248. groups.each(function(group){
  249. Mif.Tree.Drag.groups[group]=(Mif.Tree.Drag.groups[group]||[]).include(this);
  250. @@ -1512,7 +1519,7 @@
  251. },
  252. setDroppables: function(droppables){
  253. - this.droppables.combine($splat(droppables));
  254. + this.droppables.combine(Array.from(droppables));
  255. this.groups.each(function(group){
  256. this.droppables.combine(Mif.Tree.Drag.groups[group]);
  257. }, this);
  258. @@ -1555,7 +1562,7 @@
  259. onleave: function(){
  260. this.tree.unselect();
  261. this.clean();
  262. - $clear(this.scrolling);
  263. + clearInterval(this.scrolling);
  264. this.scrolling = null;
  265. this.target = false;
  266. },
  267. @@ -1621,7 +1628,7 @@
  268. }.periodical(this.options.scrollDelay, this, [sign]);
  269. }
  270. if(!sign){
  271. - $clear(this.scrolling);
  272. + clearInterval(this.scrolling);
  273. this.scrolling = null;
  274. }
  275. },
  276. @@ -1633,7 +1640,7 @@
  277. var target = this.tree.mouse.target;
  278. if(!target) return;
  279. - this.current = $splat(this.options.startPlace).contains(target) ? this.tree.mouse.node : false;
  280. + this.current = Array.from(this.options.startPlace).contains(target) ? this.tree.mouse.node : false;
  281. if(!this.current || this.current.dragDisabled) {
  282. return;
  283. }
  284. @@ -1691,7 +1698,7 @@
  285. clean: function(){
  286. this.pointer.style.width = 0;
  287. if(this.openTimer){
  288. - $clear(this.openTimer);
  289. + clearInterval(this.openTimer);
  290. this.openTimer = false;
  291. this.wrapper.style.cursor = 'inherit';
  292. this.wrapper = false;
  293. @@ -1702,8 +1709,8 @@
  294. var wrapper = this.current.getDOM('wrapper');
  295. var ghost = new Element('span').addClass('mif-tree-ghost');
  296. ghost.adopt(Mif.Tree.Draw.node(this.current).getFirst())
  297. - .injectInside(document.body).addClass('mif-tree-ghost-notAllowed').setStyle('position', 'absolute');
  298. - new Element('span').set('html',Mif.Tree.Draw.zeroSpace).injectTop(ghost);
  299. + .inject(document.body,'bottom').addClass('mif-tree-ghost-notAllowed').setStyle('position', 'absolute');
  300. + new Element('span').set('html',Mif.Tree.Draw.zeroSpace).inject(ghost,'top');
  301. ghost.getLast().getFirst().className = '';
  302. Mif.Tree.Drag.ghost = ghost;
  303. },
  304. @@ -1835,7 +1842,7 @@
  305. onstop: function(){
  306. this.clean();
  307. - $clear(this.scrolling);
  308. + clearInterval(this.scrolling);
  309. }
  310. });
  311. @@ -2021,7 +2028,7 @@
  312. left: -2000,
  313. top:0,
  314. padding: 0
  315. - }).injectInside(document.body);
  316. + }).inject(document.body,'bottom');
  317. input.addEvent('keydown',function(event){
  318. (function(){
  319. input.setStyle('width',Math.max(20, span.set('html', input.value.replace(/\s/g,'&nbsp;')).offsetWidth+15));