Changeset 511

add proto 1.6.0.2, debug carousel

Feb 06 2008 * 18:07 (11 months ago)
Committed by seb

Affected files:

trunk/Rakefile (Unified diff)

r510r511
1212 :dock => :core,
1313 :shadow => [:core, :util],
1414 :util => :core,
15 :context_menu => [ :shadow, :"util/iframe_shim.js" ]
15 :context_menu => [ :shadow, :"util/iframe_shim.js"],
1616 }
1717
1818 PUI_COMPONENTS = PUI_DEPENDENCIES.keys

trunk/doc/config/Menu.txt (Unified diff)

r509r511
22
33
44 Title: Prototype-UI
5 SubTitle: 508M
5 SubTitle: 509M
66
77 # You can add a footer to your documentation like this:
88 # Footer: [text]

trunk/lib/distrib.rb (Unified diff)

r388r511
2525 Dir.chdir(component_path) do
2626 Protodoc::Preprocessor.new(TemplateName).to_s
2727 end
28 elsif File.exist?(component_path)
29 File.read(component_path)
2830 else
29 File.read(component_path)
31 ""
3032 end
3133 end
3234 end

trunk/lib/prototype.js (Unified diff)

r491r511
1 /* Prototype JavaScript framework, version 1.6.0.1
2 * (c) 2005-2007 Sam Stephenson
1 /* Prototype JavaScript framework, version 1.6.0.2
2 * (c) 2005-2008 Sam Stephenson
33 *
44 * Prototype is freely distributable under the terms of an MIT-style license.
55 * For details, see the Prototype web site: http://www.prototypejs.org/
------
77 *--------------------------------------------------------------------------*/
88
99 var Prototype = {
10 Version: '1.6.0.1',
10 Version: '1.6.0.2',
1111
1212 Browser: {
1313 IE: !!(window.attachEvent && !window.opera),
------
110110 try {
111111 if (Object.isUndefined(object)) return 'undefined';
112112 if (object === null) return 'null';
113 return object.inspect ? object.inspect() : object.toString();
113 return object.inspect ? object.inspect() : String(object);
114114 } catch (e) {
115115 if (e instanceof RangeError) return '...';
116116 throw e;
------
171171 },
172172
173173 isArray: function(object) {
174 return object && object.constructor === Array;
174 return object != null && typeof object == "object" &&
175 'splice' in object && 'join' in object;
175176 },
176177
177178 isHash: function(object) {
------
578579 }
579580
580581 return before + String.interpret(ctx);
581 }.bind(this));
582 });
582583 }
583584 });
584585 Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
------
812813 }
813814
814815 if (Prototype.Browser.WebKit) {
815 function $A(iterable) {
816 $A = function(iterable) {
816817 if (!iterable) return [];
817818 if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') &&
818819 iterable.toArray) return iterable.toArray();
819820 var length = iterable.length || 0, results = new Array(length);
820821 while (length--) results[length] = iterable[length];
821822 return results;
822 }
823 };
823824 }
824825
825826 Array.from = $A;
------
12981299
12991300 var contentType = response.getHeader('Content-type');
13001301 if (this.options.evalJS == 'force'
1301 || (this.options.evalJS && contentType
1302 || (this.options.evalJS && this.isSameOrigin() && contentType
13021303 && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
13031304 this.evalResponse();
13041305 }
------
13161317 }
13171318 },
13181319
1320 isSameOrigin: function() {
1321 var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
1322 return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
1323 protocol: location.protocol,
1324 domain: document.domain,
1325 port: location.port ? ':' + location.port : ''
1326 }));
1327 },
1328
13191329 getHeader: function(name) {
13201330 try {
13211331 return this.transport.getResponseHeader(name) || null;
------
13911401 if (!json) return null;
13921402 json = decodeURIComponent(escape(json));
13931403 try {
1394 return json.evalJSON(this.request.options.sanitizeJSON);
1404 return json.evalJSON(this.request.options.sanitizeJSON ||
1405 !this.request.isSameOrigin());
13951406 } catch (e) {
13961407 this.request.dispatchException(e);
13971408 }
------
14041415 this.responseText.blank())
14051416 return null;
14061417 try {
1407 return this.responseText.evalJSON(options.sanitizeJSON);
1418 return this.responseText.evalJSON(options.sanitizeJSON ||
1419 !this.request.isSameOrigin());
14081420 } catch (e) {
14091421 this.request.dispatchException(e);
14101422 }
------
16101622
16111623 var content, insert, tagName, childNodes;
16121624
1613 for (position in insertions) {
1625 for (var position in insertions) {
16141626 content = insertions[position];
16151627 position = position.toLowerCase();
16161628 insert = Element._insertionTranslations[position];
------
18631875 do { ancestor = ancestor.parentNode; }
18641876 while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode);
18651877 }
1866 if (nextAncestor) return (e > a && e < nextAncestor.sourceIndex);
1878 if (nextAncestor && nextAncestor.sourceIndex)
1879 return (e > a && e < nextAncestor.sourceIndex);
18671880 }
18681881
18691882 while (element = element.parentNode)
------
20072020 if (element) {
20082021 if (element.tagName == 'BODY') break;
20092022 var p = Element.getStyle(element, 'position');
2010 if (p == 'relative' || p == 'absolute') break;
2023 if (p !== 'static') break;
20112024 }
20122025 } while (element);
20132026 return Element._returnOffset(valueL, valueT);
------
22002213 }
22012214
22022215 else if (Prototype.Browser.IE) {
2203 $w('positionedOffset getOffsetParent viewportOffset').each(function(method) {
2216 // IE doesn't report offsets correctly for static elements, so we change them
2217 // to "relative" to get the values, then change them back.
2218 Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap(
2219 function(proceed, element) {
2220 element = $(element);
2221 var position = element.getStyle('position');
2222 if (position !== 'static') return proceed(element);
2223 element.setStyle({ position: 'relative' });
2224 var value = proceed(element);
2225 element.setStyle({ position: position });
2226 return value;
2227 }
2228 );
2229
2230 $w('positionedOffset viewportOffset').each(function(method) {
22042231 Element.Methods[method] = Element.Methods[method].wrap(
22052232 function(proceed, element) {
22062233 element = $(element);
22072234 var position = element.getStyle('position');
2208 if (position != 'static') return proceed(element);
2235 if (position !== 'static') return proceed(element);
2236 // Trigger hasLayout on the offset parent so that IE6 reports
2237 // accurate offsetTop and offsetLeft values for position: fixed.
2238 var offsetParent = element.getOffsetParent();
2239 if (offsetParent && offsetParent.getStyle('position') === 'fixed')
2240 offsetParent.setStyle({ zoom: 1 });
22092241 element.setStyle({ position: 'relative' });
22102242 var value = proceed(element);
22112243 element.setStyle({ position: position });
------
22872319 };
22882320
22892321 Element._attributeTranslations.write = {
2290 names: Object.clone(Element._attributeTranslations.read.names),
2322 names: Object.extend({
2323 cellpadding: 'cellPadding',
2324 cellspacing: 'cellSpacing'
2325 }, Element._attributeTranslations.read.names),
22912326 values: {
22922327 checked: function(element, value) {
22932328 element.checked = !!value;
------
26382673 var B = Prototype.Browser;
26392674 $w('width height').each(function(d) {
26402675 var D = d.capitalize();
2641
26422676 dimensions[d] = (B.WebKit && !document.evaluate) ? self['inner' + D] :
26432677 (B.Opera) ? document.body['client' + D] : document.documentElement['client' + D];
26442678 });
------
29022936 },
29032937
29042938 criteria: {
2905 tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;',
2906 className: 'n = h.className(n, r, "#{1}", c); c = false;',
2907 id: 'n = h.id(n, r, "#{1}", c); c = false;',
2908 attrPresence: 'n = h.attrPresence(n, r, "#{1}"); c = false;',
2939 tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;',
2940 className: 'n = h.className(n, r, "#{1}", c); c = false;',
2941 id: 'n = h.id(n, r, "#{1}", c); c = false;',
2942 attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;',
29092943 attr: function(m) {
29102944 m[3] = (m[5] || m[6]);
2911 return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(m);
2945 return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);
29122946 },
29132947 pseudo: function(m) {
29142948 if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
------
29582992
29592993 attr: function(element, matches) {
29602994 var nodeValue = Element.readAttribute(element, matches[1]);
2961 return Selector.operators[matches[2]](nodeValue, matches[3]);
2995 return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]);
29622996 }
29632997 },
29642998
------
29733007
29743008 // marks an array of nodes for counting
29753009 mark: function(nodes) {
3010 var _true = Prototype.emptyFunction;
29763011 for (var i = 0, node; node = nodes[i]; i++)
2977 node._counted = true;
3012 node._countedByPrototype = _true;
29783013 return nodes;
29793014 },
29803015
29813016 unmark: function(nodes) {
29823017 for (var i = 0, node; node = nodes[i]; i++)
2983 node._counted = undefined;
3018 node._countedByPrototype = undefined;
29843019 return nodes;
29853020 },
29863021
------
29883023 // "ofType" flag indicates whether we're indexing for nth-of-type
29893024 // rather than nth-child
29903025 index: function(parentNode, reverse, ofType) {
2991 parentNode._counted = true;
3026 parentNode._countedByPrototype = Prototype.emptyFunction;
29923027 if (reverse) {
29933028 for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
29943029 var node = nodes[i];
2995 if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
3030 if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
29963031 }
29973032 } else {
29983033 for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
2999 if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
3034 if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
30003035 }
30013036 },
30023037
------
30053040 if (nodes.length == 0) return nodes;
30063041 var results = [], n;
30073042 for (var i = 0, l = nodes.length; i < l; i++)
3008 if (!(n = nodes[i])._counted) {
3009 n._counted = true;
3043 if (!(n = nodes[i])._countedByPrototype) {
3044 n._countedByPrototype = Prototype.emptyFunction;
30103045 results.push(Element.extend(n));
30113046 }
30123047 return Selector.handlers.unmark(results);
------
31183153 return results;
31193154 },
31203155
3121 attrPresence: function(nodes, root, attr) {
3156 attrPresence: function(nodes, root, attr, combinator) {
31223157 if (!nodes) nodes = root.getElementsByTagName("*");
3158 if (nodes && combinator) nodes = this[combinator](nodes);
31233159 var results = [];
31243160 for (var i = 0, node; node = nodes[i]; i++)
31253161 if (Element.hasAttribute(node, attr)) results.push(node);
31263162 return results;
31273163 },
31283164
3129 attr: function(nodes, root, attr, value, operator) {
3165 attr: function(nodes, root, attr, value, operator, combinator) {
31303166 if (!nodes) nodes = root.getElementsByTagName("*");
3167 if (nodes && combinator) nodes = this[combinator](nodes);
31313168 var handler = Selector.operators[operator], results = [];
31323169 for (var i = 0, node; node = nodes[i]; i++) {
31333170 var nodeValue = Element.readAttribute(node, attr);
------
32063243 var h = Selector.handlers, results = [], indexed = [], m;
32073244 h.mark(nodes);
32083245 for (var i = 0, node; node = nodes[i]; i++) {
3209 if (!node.parentNode._counted) {
3246 if (!node.parentNode._countedByPrototype) {
32103247 h.index(node.parentNode, reverse, ofType);
32113248 indexed.push(node.parentNode);
32123249 }
------
32443281 var exclusions = new Selector(selector).findElements(root);
32453282 h.mark(exclusions);
32463283 for (var i = 0, results = [], node; node = nodes[i]; i++)
3247 if (!node._counted) results.push(node);
3284 if (!node._countedByPrototype) results.push(node);
32483285 h.unmark(exclusions);
32493286 return results;
32503287 },
------
32783315 '|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); }
32793316 },
32803317
3318 split: function(expression) {
3319 var expressions = [];
3320 expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
3321 expressions.push(m[1].strip());
3322 });
3323 return expressions;
3324 },
3325
32813326 matchElements: function(elements, expression) {
32823327 var matches = $$(expression), h = Selector.handlers;
32833328 h.mark(matches);
32843329 for (var i = 0, results = [], element; element = elements[i]; i++)
3285 if (element._counted) results.push(element);
3330 if (element._countedByPrototype) results.push(element);
32863331 h.unmark(matches);
32873332 return results;
32883333 },
------
32953340 },
32963341
32973342 findChildElements: function(element, expressions) {
3298 var exprs = expressions.join(',');
3299 expressions = [];
3300 exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
3301 expressions.push(m[1].strip());
3302 });
3343 expressions = Selector.split(expressions.join(','));
33033344 var results = [], h = Selector.handlers;
33043345 for (var i = 0, l = expressions.length, selector; i < l; i++) {
33053346 selector = new Selector(expressions[i].strip());
------
33103351 });
33113352
33123353 if (Prototype.Browser.IE) {
3313 // IE returns comment nodes on getElementsByTagName("*").
3314 // Filter them out.
3315 Selector.handlers.concat = function(a, b) {
3316 for (var i = 0, node; node = b[i]; i++)
3317 if (node.tagName !== "!") a.push(node);
3318 return a;
3319 };
3354 Object.extend(Selector.handlers, {
3355 // IE returns comment nodes on getElementsByTagName("*").
3356 // Filter them out.
3357 concat: function(a, b) {
3358 for (var i = 0, node; node = b[i]; i++)
3359 if (node.tagName !== "!") a.push(node);
3360 return a;
3361 },
3362
3363 // IE improperly serializes _countedByPrototype in (inner|outer)HTML.
3364 unmark: function(nodes) {
3365 for (var i = 0, node; node = nodes[i]; i++)
3366 node.removeAttribute('_countedByPrototype');
3367 return nodes;
3368 }
3369 });
33203370 }
33213371
33223372 function $$() {
------
37943844 var cache = Event.cache;
37953845
37963846 function getEventID(element) {
3797 if (element._eventID) return element._eventID;
3847 if (element._prototypeEventID) return element._prototypeEventID[0];
37983848 arguments.callee.id = arguments.callee.id || 1;
3799 return element._eventID = ++arguments.callee.id;
3849 return element._prototypeEventID = [++arguments.callee.id];
38003850 }
38013851
38023852 function getDOMEventName(eventName) {

trunk/src/carousel/ajax_carousel.js (Unified diff)

r506r511
153153 update: function(transport, json) {
154154 this.requestRunning = false;
155155 this.fire("request:ended");
156 if (!json)
157 json = transport.responseJSON;
156158 this.hasMore = json.more;
157159
158160 this.endIndex = Math.max(this.endIndex, json.to);
------
191193 }
192194 }
193195 return this;
196 },
197
198 updateNextButton: function($super) {
199 var lastPosition = this.currentLastPosition();
200 var size = this.currentSize();
201 var nextClassName = "next_button" + this.options.disabledButtonSuffix;
202
203 if (this.nextButton.hasClassName(nextClassName) && lastPosition != size) {
204 this.nextButton.removeClassName(nextClassName);
205 this.fire('nextButton:enabled');
206 }
207 if (!this.nextButton.hasClassName(nextClassName) && lastPosition == size && !this.hasMore) {
208 this.nextButton.addClassName(nextClassName);
209 this.fire('nextButton:disabled');
210 }
194211 }
195212 });

trunk/src/carousel/carousel.js (Unified diff)

r506r511
359359 this
360360 */
361361 updateButtons: function() {
362 this.updatePreviousButton();
363 this.updateNextButton();
364 return this;
365 },
366
367 updatePreviousButton: function() {
362368 var position = this.currentPosition();
363369 var previousClassName = "previous_button" + this.options.disabledButtonSuffix;
364370
------
369375 if (!this.previousButton.hasClassName(previousClassName) && position == 0) {
370376 this.previousButton.addClassName(previousClassName);
371377 this.fire('previousButton:disabled');
372 }
373
378 }
379 },
380
381 updateNextButton: function() {
374382 var lastPosition = this.currentLastPosition();
375383 var size = this.currentSize();
376384 var nextClassName = "next_button" + this.options.disabledButtonSuffix;
385
377386 if (this.nextButton.hasClassName(nextClassName) && lastPosition != size) {
378387 this.nextButton.removeClassName(nextClassName);
379388 this.fire('nextButton:enabled');
------
382391 this.nextButton.addClassName(nextClassName);
383392 this.fire('nextButton:disabled');
384393 }
385
386 return this;
387394 },
388
395
389396 // Group: Size and Position
390397
391398 /*
------
447454 Carousel's size in pixel
448455 */
449456 currentSize: function() {
450 return this.element.getDimensions()[this.dimAttribute];
457 return this.container.parentNode.getDimensions()[this.dimAttribute];
451458 },
452459
453460 /*