Changeset 3081
- Timestamp:
- 12/19/06 07:01:59 (2 years ago)
- Files:
-
- trunk/CHANGELOG (modified) (1 diff)
- trunk/data/web/sf/prototype/js/builder.js (modified) (1 diff)
- trunk/data/web/sf/prototype/js/controls.js (modified) (1 diff)
- trunk/data/web/sf/prototype/js/dragdrop.js (modified) (1 diff)
- trunk/data/web/sf/prototype/js/effects.js (modified) (7 diffs)
- trunk/data/web/sf/prototype/js/prototype.js (modified) (18 diffs)
- trunk/data/web/sf/prototype/js/scriptaculous.js (modified) (2 diffs)
- trunk/data/web/sf/prototype/js/slider.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/CHANGELOG
r3078 r3081 28 28 * r2879: fixed glob() problem with PHP < 5.1 29 29 * r2875: added simple autoloader to ease unit tests (for model classes for example) 30 * updated script.aculo.us (1.7.0_beta 1) and prototype (1.5.0_rc2)30 * updated script.aculo.us (1.7.0_beta2) and prototype (1.5.0_rc2) 31 31 32 32 * fixed some bugs (see trac) 33 * added more unit tests (> 3 000 now)33 * added more unit tests (> 3400 now) 34 34 35 35 Version 1.0.0-beta1 trunk/data/web/sf/prototype/js/builder.js
r2877 r3081 1 // script.aculo.us builder.js v1.7.0_beta 1, Tue Nov 21 10:25:25CET 20061 // script.aculo.us builder.js v1.7.0_beta2, Mon Dec 18 23:38:56 CET 2006 2 2 3 3 // Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) trunk/data/web/sf/prototype/js/controls.js
r2877 r3081 1 // script.aculo.us controls.js v1.7.0_beta 1, Tue Nov 21 10:25:25CET 20061 // script.aculo.us controls.js v1.7.0_beta2, Mon Dec 18 23:38:56 CET 2006 2 2 3 3 // Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) trunk/data/web/sf/prototype/js/dragdrop.js
r2877 r3081 1 // script.aculo.us dragdrop.js v1.7.0_beta 1, Tue Nov 21 10:25:25CET 20061 // script.aculo.us dragdrop.js v1.7.0_beta2, Mon Dec 18 23:38:56 CET 2006 2 2 3 3 // Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) trunk/data/web/sf/prototype/js/effects.js
r2877 r3081 1 // script.aculo.us effects.js v1.7.0_beta 1, Tue Nov 21 10:25:25CET 20061 // script.aculo.us effects.js v1.7.0_beta2, Mon Dec 18 23:38:56 CET 2006 2 2 3 3 // Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) … … 51 51 52 52 Element.getOpacity = function(element){ 53 element = $(element); 54 var opacity; 55 if (opacity = element.getStyle('opacity')) 56 return parseFloat(opacity); 57 if (opacity = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) 58 if(opacity[1]) return parseFloat(opacity[1]) / 100; 59 return 1.0; 60 } 61 62 Element.setOpacity = function(element, value){ 63 element= $(element); 64 if (value == 1){ 65 element.setStyle({ opacity: 66 (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 67 0.999999 : 1.0 }); 68 if(/MSIE/.test(navigator.userAgent) && !window.opera) 69 element.setStyle({filter: Element.getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')}); 70 } else { 71 if(value < 0.00001) value = 0; 72 element.setStyle({opacity: value}); 73 if(/MSIE/.test(navigator.userAgent) && !window.opera) 74 element.setStyle( 75 { filter: element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'') + 76 'alpha(opacity='+value*100+')' }); 77 } 78 return element; 53 return $(element).getStyle('opacity'); 54 } 55 56 Element.setOpacity = function(element, value){ 57 return $(element).setStyle({opacity:value}); 79 58 } 80 59 … … 236 215 237 216 if(!this.interval) 238 this.interval = setInterval(this.loop.bind(this), 40);217 this.interval = setInterval(this.loop.bind(this), 15); 239 218 }, 240 219 remove: function(effect) { … … 267 246 transition: Effect.Transitions.sinoidal, 268 247 duration: 1.0, // seconds 269 fps: 25.0, // max. 25fps due to Effect.Queue implementation248 fps: 60.0, // max. 60fps due to Effect.Queue implementation 270 249 sync: false, // true for combining 271 250 from: 0.0, … … 948 927 if(!this.element) throw(Effect._elementDoesNotExistError); 949 928 var options = Object.extend({ 950 style: ''929 style: {} 951 930 }, arguments[1] || {}); 931 if (typeof options.style == 'string') { 932 if(options.style.indexOf(':') == -1) { 933 var cssText = '', selector = '.' + options.style; 934 $A(document.styleSheets).reverse().each(function(styleSheet) { 935 if (styleSheet.cssRules) cssRules = styleSheet.cssRules; 936 else if (styleSheet.rules) cssRules = styleSheet.rules; 937 $A(cssRules).reverse().each(function(rule) { 938 if (selector == rule.selectorText) { 939 cssText = rule.style.cssText; 940 throw $break; 941 } 942 }); 943 if (cssText) throw $break; 944 }); 945 this.style = cssText.parseStyle(); 946 options.afterFinishInternal = function(effect){ 947 effect.element.addClassName(effect.options.style); 948 effect.transforms.each(function(transform) { 949 if(transform.style != 'opacity') 950 effect.element.style[transform.style.camelize()] = ''; 951 }); 952 } 953 } else this.style = options.style.parseStyle(); 954 } else this.style = $H(options.style) 952 955 this.start(options); 953 956 }, … … 960 963 }); 961 964 } 962 this.transforms = this.options.style.parseStyle().map(function(property){ 963 var originalValue = this.element.getStyle(property[0]); 965 this.transforms = this.style.map(function(pair){ 966 var property = pair[0].underscore().dasherize(), value = pair[1], unit = null; 967 968 if(value.parseColor('#zzzzzz') != '#zzzzzz') { 969 value = value.parseColor(); 970 unit = 'color'; 971 } else if(property == 'opacity') { 972 value = parseFloat(value); 973 if(/MSIE/.test(navigator.userAgent) && !window.opera && (!this.element.currentStyle.hasLayout)) 974 this.element.setStyle({zoom: 1}); 975 } else if(Element.CSS_LENGTH.test(value)) 976 var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/), 977 value = parseFloat(components[1]), unit = (components.length == 3) ? components[2] : null; 978 979 var originalValue = this.element.getStyle(property); 964 980 return $H({ 965 style: property[0], 966 originalValue: property[1].unit=='color' ? 967 parseColor(originalValue) : parseFloat(originalValue || 0), 968 targetValue: property[1].unit=='color' ? 969 parseColor(property[1].value) : property[1].value, 970 unit: property[1].unit 981 style: property, 982 originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), 983 targetValue: unit=='color' ? parseColor(value) : value, 984 unit: unit 971 985 }); 972 986 }.bind(this)).reject(function(transform){ … … 1050 1064 1051 1065 Element.CSS_PROPERTIES.each(function(property){ 1052 if(style[property]) styleRules[property] = style[property];1066 if(style[property]) styleRules[property] = style[property]; 1053 1067 }); 1054 1055 var result = $H(); 1056 1057 styleRules.each(function(pair){ 1058 var property = pair[0], value = pair[1], unit = null; 1059 1060 if(value.parseColor('#zzzzzz') != '#zzzzzz') { 1061 value = value.parseColor(); 1062 unit = 'color'; 1063 } else if(Element.CSS_LENGTH.test(value)) 1064 var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/), 1065 value = parseFloat(components[1]), unit = (components.length == 3) ? components[2] : null; 1066 1067 result[property.underscore().dasherize()] = $H({ value:value, unit:unit }); 1068 }.bind(this)); 1069 1070 return result; 1068 if(/MSIE/.test(navigator.userAgent) && !window.opera && this.indexOf('opacity') > -1) { 1069 styleRules.opacity = this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]; 1070 } 1071 return styleRules; 1071 1072 }; 1072 1073 trunk/data/web/sf/prototype/js/prototype.js
r2907 r3081 250 250 toArray: function() { 251 251 return this.split(''); 252 }, 253 254 succ: function() { 255 return this.slice(0, this.length - 1) + 256 String.fromCharCode(this.charCodeAt(this.length - 1) + 1); 252 257 }, 253 258 … … 336 341 while ((index += number) < array.length) 337 342 slices.push(array.slice(index, index+number)); 338 return slices. collect(iterator || Prototype.K);343 return slices.map(iterator); 339 344 }, 340 345 … … 360 365 var results = []; 361 366 this.each(function(value, index) { 362 results.push( iterator(value, index));367 results.push((iterator || Prototype.K)(value, index)); 363 368 }); 364 369 return results; … … 407 412 408 413 inGroupsOf: function(number, fillWith) { 409 fillWith = fillWith || null; 410 var results = this.eachSlice(number); 411 if (results.length > 0) (number - results.last().length).times(function() { 412 results.last().push(fillWith) 413 }); 414 return results; 414 fillWith = fillWith === undefined ? null : fillWith; 415 return this.eachSlice(number, function(slice) { 416 while(slice.length < number) slice.push(fillWith); 417 return slice; 418 }); 415 419 }, 416 420 … … 424 428 invoke: function(method) { 425 429 var args = $A(arguments).slice(1); 426 return this. collect(function(value) {430 return this.map(function(value) { 427 431 return value[method].apply(value, args); 428 432 }); … … 476 480 477 481 sortBy: function(iterator) { 478 return this. collect(function(value, index) {482 return this.map(function(value, index) { 479 483 return {value: value, criteria: iterator(value, index)}; 480 484 }).sort(function(left, right) { … … 485 489 486 490 toArray: function() { 487 return this. collect(Prototype.K);491 return this.map(); 488 492 }, 489 493 … … 497 501 return iterator(collections.pluck(index)); 498 502 }); 503 }, 504 505 size: function() { 506 return this.toArray().length; 499 507 }, 500 508 … … 591 599 }, 592 600 601 size: function() { 602 return this.length; 603 }, 604 593 605 inspect: function() { 594 606 return '[' + this.map(Object.inspect).join(', ') + ']'; … … 597 609 598 610 Array.prototype.toArray = Array.prototype.clone; 611 612 function $w(string){ 613 string = string.strip(); 614 return string ? string.split(/\s+/) : []; 615 } 599 616 600 617 if(window.opera){ … … 808 825 809 826 this.transport.open(this.options.method.toUpperCase(), this.url, 810 this.options.asynchronous, this.options.username, 811 this.options.password); 827 this.options.asynchronous); 812 828 813 829 if (this.options.asynchronous) … … 1168 1184 1169 1185 descendants: function(element) { 1170 element = $(element); 1171 return $A(element.getElementsByTagName('*')); 1186 return $A($(element).getElementsByTagName('*')); 1172 1187 }, 1173 1188 … … 1193 1208 1194 1209 match: function(element, selector) { 1195 element = $(element);1196 1210 if (typeof selector == 'string') 1197 1211 selector = new Selector(selector); 1198 return selector.match( element);1212 return selector.match($(element)); 1199 1213 }, 1200 1214 … … 1221 1235 1222 1236 getElementsByClassName: function(element, className) { 1223 element = $(element);1224 1237 return document.getElementsByClassName(className, element); 1225 1238 }, … … 1230 1243 1231 1244 getHeight: function(element) { 1232 element = $(element); 1233 return element.offsetHeight; 1245 return $(element).offsetHeight; 1234 1246 }, 1235 1247 … … 1257 1269 if (!(element = $(element))) return; 1258 1270 Element.classNames(element).remove(className); 1271 return element; 1272 }, 1273 1274 toggleClassName: function(element, className) { 1275 if (!(element = $(element))) return; 1276 Element.classNames(element)[element.hasClassName(className) ? 'remove' : 'add'](className); 1259 1277 return element; 1260 1278 }, … … 1296 1314 scrollTo: function(element) { 1297 1315 element = $(element); 1298 var x = element.x ? element.x : element.offsetLeft, 1299 y = element.y ? element.y : element.offsetTop; 1300 window.scrollTo(x, y); 1316 var pos = Position.cumulativeOffset(element); 1317 window.scrollTo(pos[0], pos[1]); 1301 1318 return element; 1302 1319 }, … … 1736 1753 matchElements: function(elements, expression) { 1737 1754 var selector = new Selector(expression); 1738 return elements.select(selector.match.bind(selector)). collect(Element.extend);1755 return elements.select(selector.match.bind(selector)).map(Element.extend); 1739 1756 }, 1740 1757 trunk/data/web/sf/prototype/js/scriptaculous.js
r2877 r3081 1 // script.aculo.us scriptaculous.js v1.7.0_beta 1, Tue Nov 21 10:25:25CET 20061 // script.aculo.us scriptaculous.js v1.7.0_beta2, Mon Dec 18 23:38:56 CET 2006 2 2 3 3 // Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) … … 25 25 26 26 var Scriptaculous = { 27 Version: '1.7.0_beta 1',27 Version: '1.7.0_beta2', 28 28 require: function(libraryName) { 29 29 // inserting via DOM fails in Safari 2.0, so brute force approach trunk/data/web/sf/prototype/js/slider.js
r2877 r3081 1 // script.aculo.us slider.js v1.7.0_beta 1, Tue Nov 21 10:25:25CET 20061 // script.aculo.us slider.js v1.7.0_beta2, Mon Dec 18 23:38:56 CET 2006 2 2 3 3 // Copyright (c) 2005, 2006 Marty Haught, Thomas Fuchs