Commit ffafeb89632bc46eb1efe0782534f060d7d2be2a
1 parent
d07e3bd1
Exists in
master
and in
29 other branches
ActionItem507: that is beault but no done
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2138 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
8 changed files
with
352 additions
and
175 deletions
Show diff stats
app/views/blocks/profile_info.rhtml
| @@ -23,15 +23,29 @@ | @@ -23,15 +23,29 @@ | ||
| 23 | <% end %> | 23 | <% end %> |
| 24 | </ul> | 24 | </ul> |
| 25 | 25 | ||
| 26 | -<% if block.owner.person? %> | ||
| 27 | - <div class="adr"> | ||
| 28 | - <%= | ||
| 29 | - [ [ profile.city, 'locality' ], | ||
| 30 | - [ profile.state, 'region' ], | ||
| 31 | - [ profile.country, 'country-name' ] | ||
| 32 | - ].map{ |s,c| s =~ /^\s*$/ ? nil : content_tag( 'span', s, :class => c ) }.compact.join ' - ' | ||
| 33 | - %> | ||
| 34 | - </div> | 26 | +<% if profile.respond_to? :city %> |
| 27 | +<div class="adr"> | ||
| 28 | +<%= | ||
| 29 | + [ [ profile.city, 'locality' ], | ||
| 30 | + [ profile.state, 'region' ], | ||
| 31 | + [ profile.country, 'country-name' ] | ||
| 32 | + ].map{ |s,c| s =~ /^\s*$/ ? nil : content_tag( 'span', s, :class => c ) }.compact.join ' - ' | ||
| 33 | +%> | ||
| 34 | +</div> | ||
| 35 | +<% end %> | ||
| 36 | + | ||
| 37 | +<% if profile.class == Enterprise %> | ||
| 38 | +<div class="product-categories"> | ||
| 39 | +<%= | ||
| 40 | + profile.product_categories.map{ |c| c.size > 1 ? [c[0],c[1]] : nil }. | ||
| 41 | + compact.uniq.map{ |c| | ||
| 42 | + content_tag 'span', | ||
| 43 | + content_tag( 'span', c.join(' → ') ), | ||
| 44 | + :title => c[0] +' → '+ c[1], | ||
| 45 | + :class => 'product_cat_' + (c[0]+'_'+c[1]).gsub( /\s/, '_' ) | ||
| 46 | + }.join "\n" | ||
| 47 | +%> | ||
| 48 | +</div> | ||
| 35 | <% end %> | 49 | <% end %> |
| 36 | 50 | ||
| 37 | <div class="profile-info-options"> | 51 | <div class="profile-info-options"> |
app/views/search/_display_results.rhtml
| @@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
| 17 | <%= @names[name] %> | 17 | <%= @names[name] %> |
| 18 | </h3> | 18 | </h3> |
| 19 | <% end %> | 19 | <% end %> |
| 20 | - <%= link_to _('see more...'), params.merge(:action => 'index', :find_in => [ name ]), :class => 'see-more' %> | 20 | + <%= link_to _('see all...'), params.merge(:action => 'index', :find_in => [ name ]), :class => 'see-more' %> |
| 21 | <% end %> | 21 | <% end %> |
| 22 | <% partial = partial_for_class results.first.class %> | 22 | <% partial = partial_for_class results.first.class %> |
| 23 | <div class="search-results-innerbox search-results-type-<%= partial %> <%= 'common-profile-list-block' if partial == 'profile' %>"> | 23 | <div class="search-results-innerbox search-results-type-<%= partial %> <%= 'common-profile-list-block' if partial == 'profile' %>"> |
app/views/search/_product_categories_menu.rhtml
| 1 | <% if product_categories_menu %> | 1 | <% if product_categories_menu %> |
| 2 | -<div id="product-categories-menu" class="product-search-filter"> | ||
| 3 | -<ul> | ||
| 4 | - <% product_categories_menu.each do |cat, hits, childs| %> | ||
| 5 | - <li> | ||
| 6 | - <%= link_to (cat.name + "(#{hits})"), params.merge({:product_category => cat.id}) %> | ||
| 7 | - <% if !childs.blank? %> | ||
| 8 | - <ul> | ||
| 9 | - <% childs.each do |child, child_hits| %> | ||
| 10 | - <li> <%= link_to (child.name + "(#{child_hits})"), params.merge({:product_category => child.id}) %> </li> | ||
| 11 | - <% end %> | ||
| 12 | - </ul> | 2 | + |
| 3 | +<div id="product-categories-menu"> | ||
| 4 | + <ul> | ||
| 5 | + <% if product_categories_menu.empty? %> | ||
| 6 | + <li class="cat-empty"> <%= _('There is no sub-categories for %s.') % @product_category.name %> </li> | ||
| 7 | + <% end %> | ||
| 8 | + <% product_categories_menu.each do |cat, hits, childs| %> | ||
| 9 | + <li class="cat-parent" onmouseover="prodCatMenuOver(this)" onmouseout="prodCatMenuOut(this)"> | ||
| 10 | + <%= link_to( | ||
| 11 | + cat.name + " " + content_tag('small', "(#{hits})"), | ||
| 12 | + params.merge({:product_category => cat.id}) | ||
| 13 | + ) %> | ||
| 14 | + <% if !childs.blank? %> | ||
| 15 | + <div> | ||
| 16 | + <ul> | ||
| 17 | + <% childs.each do |child, child_hits| %> | ||
| 18 | + <li class="cat-child"> <%= link_to( | ||
| 19 | + child.name + " " + content_tag('small', "(#{child_hits})"), | ||
| 20 | + params.merge({:product_category => child.id}) | ||
| 21 | + ) %> </li> | ||
| 22 | + <% end %> | ||
| 23 | + </ul> | ||
| 24 | + </div> | ||
| 25 | + <% end %> | ||
| 26 | + </li> | ||
| 13 | <% end %> | 27 | <% end %> |
| 14 | - </li> | ||
| 15 | - <% end %> | ||
| 16 | -</ul> | 28 | + </ul> |
| 17 | </div> | 29 | </div> |
| 30 | + | ||
| 31 | +<script type="text/javascript"> | ||
| 32 | + | ||
| 33 | +function prodCatMenuOver( li ) { | ||
| 34 | + clearTimeout( li.timeout ); | ||
| 35 | + //if ( ! ( li.opened || li.opening ) ) { | ||
| 36 | + if ( | ||
| 37 | + ( ! li.opened ) && ( ! li.opening ) && | ||
| 38 | + ( ( ! li.e ) || li.e.state == "finished" ) | ||
| 39 | + ) { | ||
| 40 | + li.opening = true; | ||
| 41 | + li.className = "cat-parent sub-opening"; | ||
| 42 | + li.subMenu.className = "opening"; | ||
| 43 | + li.e = Effect.BlindDown(li.subMenu); | ||
| 44 | + li.e._finish = li.e.finish; | ||
| 45 | + li.e.finish = function(){ | ||
| 46 | + this._finish(); | ||
| 47 | + this.element.li.closed = false; | ||
| 48 | + this.element.li.opened = true; | ||
| 49 | + this.element.li.opening = false; | ||
| 50 | + this.element.className = "opened"; | ||
| 51 | + this.element.li.className = "cat-parent sub-opened"; | ||
| 52 | + } | ||
| 53 | + li.closed = false; | ||
| 54 | + } | ||
| 55 | +} | ||
| 56 | + | ||
| 57 | +function prodCatMenuOut( li ) { | ||
| 58 | + //if ( li.e.state == "finished" ) { | ||
| 59 | + if ( | ||
| 60 | + ( ! li.closed ) && ( ! li.closeing ) && | ||
| 61 | + ( li.e.state == "finished" ) | ||
| 62 | + ) { | ||
| 63 | + li.timeout = setTimeout( function () { | ||
| 64 | + this.closeing = true; | ||
| 65 | + this.className = "cat-parent sub-closeing"; | ||
| 66 | + this.subMenu.className = "closeing"; | ||
| 67 | + this.e = Effect.BlindUp(this.subMenu); | ||
| 68 | + this.e._finish = this.e.finish; | ||
| 69 | + this.e.finish = function(){ | ||
| 70 | + this._finish(); | ||
| 71 | + this.element.li.opened = false; | ||
| 72 | + this.element.li.closed = true; | ||
| 73 | + this.element.li.closeing = false; | ||
| 74 | + this.element.className = "closed"; | ||
| 75 | + this.element.li.className = "cat-parent sub-closed"; | ||
| 76 | + } | ||
| 77 | + }.bind(li), 200 ); | ||
| 78 | + } else { | ||
| 79 | + li.timeout = setTimeout( li.onmouseout.bind(li), 200 ); | ||
| 80 | + } | ||
| 81 | +} | ||
| 82 | + | ||
| 83 | +$$("#product-categories-menu ul div").each( function(subMenu){ | ||
| 84 | + var li = subMenu.parentNode; | ||
| 85 | + subMenu.li = li; | ||
| 86 | + li.subMenu = subMenu; | ||
| 87 | + li.subMenu.style.display = "none"; | ||
| 88 | + li.closed = true; | ||
| 89 | +}) | ||
| 90 | + | ||
| 91 | +</script> | ||
| 92 | + | ||
| 18 | <% end %> | 93 | <% end %> |
| 19 | 94 |
app/views/search/products.rhtml
| @@ -18,6 +18,10 @@ | @@ -18,6 +18,10 @@ | ||
| 18 | 18 | ||
| 19 | <%= render :partial => 'search_form', :locals => { :form_title => _("Refine your search"), :simple_search => true } %> | 19 | <%= render :partial => 'search_form', :locals => { :form_title => _("Refine your search"), :simple_search => true } %> |
| 20 | 20 | ||
| 21 | +<% if @categories_menu %> | ||
| 22 | +<div class="has_cat_list"> | ||
| 23 | +<% end %> | ||
| 24 | + | ||
| 21 | <%= render :partial => 'product_categories_menu', :object => @categories_menu %> | 25 | <%= render :partial => 'product_categories_menu', :object => @categories_menu %> |
| 22 | 26 | ||
| 23 | <div id="search-results" class="only-one-result-box"> | 27 | <div id="search-results" class="only-one-result-box"> |
| @@ -29,6 +33,10 @@ | @@ -29,6 +33,10 @@ | ||
| 29 | </div> | 33 | </div> |
| 30 | </div> | 34 | </div> |
| 31 | 35 | ||
| 36 | +<% if @categories_menu %> | ||
| 37 | +</div><!-- class="has_cat_list" --> | ||
| 38 | +<% end %> | ||
| 39 | + | ||
| 32 | <%= will_paginate @results[:products], :id => 'products-pagination' %> | 40 | <%= will_paginate @results[:products], :id => 'products-pagination' %> |
| 33 | 41 | ||
| 34 | <br style="clear:both" /> | 42 | <br style="clear:both" /> |
public/designs/themes/ecosol/stylesheets/controller_search.css
| @@ -132,6 +132,32 @@ body.category4 .search-results-type-profile.common-profile-list-block li a { | @@ -132,6 +132,32 @@ body.category4 .search-results-type-profile.common-profile-list-block li a { | ||
| 132 | background: #F79494; | 132 | background: #F79494; |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | + | ||
| 136 | +#product-categories-menu a { | ||
| 137 | + text-decoration: none; | ||
| 138 | +} | ||
| 139 | +#product-categories-menu a:hover { | ||
| 140 | + text-decoration: underline; | ||
| 141 | +} | ||
| 142 | + | ||
| 143 | +#product-categories-menu .cat-parent { | ||
| 144 | + background-color: #E0E8F0; | ||
| 145 | + Xborder: 1px solid #729FCF; | ||
| 146 | + -moz-border-radius: 10px; | ||
| 147 | + padding: 3px 0px 3px 10px; | ||
| 148 | +} | ||
| 149 | + | ||
| 150 | +#product-categories-menu .sub-opening, | ||
| 151 | +#product-categories-menu .sub-closeing { | ||
| 152 | +} | ||
| 153 | +#product-categories-menu .sub-opened { | ||
| 154 | + background-color: #CDE; | ||
| 155 | + Xborder: 1px solid #3465A4; | ||
| 156 | + X-moz-border-radius: 10px; | ||
| 157 | +} | ||
| 158 | + | ||
| 159 | + | ||
| 160 | + | ||
| 135 | /* * * Category Page * * * * * * * * * * * * */ | 161 | /* * * Category Page * * * * * * * * * * * * */ |
| 136 | 162 | ||
| 137 | #view-category h3 { | 163 | #view-category h3 { |
public/javascripts/prototype.js
| 1 | -/* Prototype JavaScript framework, version 1.6.0.2 | ||
| 2 | - * (c) 2005-2008 Sam Stephenson | 1 | +/* Prototype JavaScript framework, version 1.6.0.1 |
| 2 | + * (c) 2005-2007 Sam Stephenson | ||
| 3 | * | 3 | * |
| 4 | * Prototype is freely distributable under the terms of an MIT-style license. | 4 | * Prototype is freely distributable under the terms of an MIT-style license. |
| 5 | * For details, see the Prototype web site: http://www.prototypejs.org/ | 5 | * For details, see the Prototype web site: http://www.prototypejs.org/ |
| @@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
| 7 | *--------------------------------------------------------------------------*/ | 7 | *--------------------------------------------------------------------------*/ |
| 8 | 8 | ||
| 9 | var Prototype = { | 9 | var Prototype = { |
| 10 | - Version: '1.6.0.2', | 10 | + Version: '1.6.0.1', |
| 11 | 11 | ||
| 12 | Browser: { | 12 | Browser: { |
| 13 | IE: !!(window.attachEvent && !window.opera), | 13 | IE: !!(window.attachEvent && !window.opera), |
| @@ -110,7 +110,7 @@ Object.extend(Object, { | @@ -110,7 +110,7 @@ Object.extend(Object, { | ||
| 110 | try { | 110 | try { |
| 111 | if (Object.isUndefined(object)) return 'undefined'; | 111 | if (Object.isUndefined(object)) return 'undefined'; |
| 112 | if (object === null) return 'null'; | 112 | if (object === null) return 'null'; |
| 113 | - return object.inspect ? object.inspect() : String(object); | 113 | + return object.inspect ? object.inspect() : object.toString(); |
| 114 | } catch (e) { | 114 | } catch (e) { |
| 115 | if (e instanceof RangeError) return '...'; | 115 | if (e instanceof RangeError) return '...'; |
| 116 | throw e; | 116 | throw e; |
| @@ -171,8 +171,7 @@ Object.extend(Object, { | @@ -171,8 +171,7 @@ Object.extend(Object, { | ||
| 171 | }, | 171 | }, |
| 172 | 172 | ||
| 173 | isArray: function(object) { | 173 | isArray: function(object) { |
| 174 | - return object != null && typeof object == "object" && | ||
| 175 | - 'splice' in object && 'join' in object; | 174 | + return object && object.constructor === Array; |
| 176 | }, | 175 | }, |
| 177 | 176 | ||
| 178 | isHash: function(object) { | 177 | isHash: function(object) { |
| @@ -579,7 +578,7 @@ var Template = Class.create({ | @@ -579,7 +578,7 @@ var Template = Class.create({ | ||
| 579 | } | 578 | } |
| 580 | 579 | ||
| 581 | return before + String.interpret(ctx); | 580 | return before + String.interpret(ctx); |
| 582 | - }); | 581 | + }.bind(this)); |
| 583 | } | 582 | } |
| 584 | }); | 583 | }); |
| 585 | Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; | 584 | Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; |
| @@ -807,20 +806,20 @@ Object.extend(Enumerable, { | @@ -807,20 +806,20 @@ Object.extend(Enumerable, { | ||
| 807 | function $A(iterable) { | 806 | function $A(iterable) { |
| 808 | if (!iterable) return []; | 807 | if (!iterable) return []; |
| 809 | if (iterable.toArray) return iterable.toArray(); | 808 | if (iterable.toArray) return iterable.toArray(); |
| 810 | - var length = iterable.length || 0, results = new Array(length); | 809 | + var length = iterable.length, results = new Array(length); |
| 811 | while (length--) results[length] = iterable[length]; | 810 | while (length--) results[length] = iterable[length]; |
| 812 | return results; | 811 | return results; |
| 813 | } | 812 | } |
| 814 | 813 | ||
| 815 | if (Prototype.Browser.WebKit) { | 814 | if (Prototype.Browser.WebKit) { |
| 816 | - $A = function(iterable) { | 815 | + function $A(iterable) { |
| 817 | if (!iterable) return []; | 816 | if (!iterable) return []; |
| 818 | if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') && | 817 | if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') && |
| 819 | iterable.toArray) return iterable.toArray(); | 818 | iterable.toArray) return iterable.toArray(); |
| 820 | - var length = iterable.length || 0, results = new Array(length); | 819 | + var length = iterable.length, results = new Array(length); |
| 821 | while (length--) results[length] = iterable[length]; | 820 | while (length--) results[length] = iterable[length]; |
| 822 | return results; | 821 | return results; |
| 823 | - }; | 822 | + } |
| 824 | } | 823 | } |
| 825 | 824 | ||
| 826 | Array.from = $A; | 825 | Array.from = $A; |
| @@ -1299,7 +1298,7 @@ Ajax.Request = Class.create(Ajax.Base, { | @@ -1299,7 +1298,7 @@ Ajax.Request = Class.create(Ajax.Base, { | ||
| 1299 | 1298 | ||
| 1300 | var contentType = response.getHeader('Content-type'); | 1299 | var contentType = response.getHeader('Content-type'); |
| 1301 | if (this.options.evalJS == 'force' | 1300 | if (this.options.evalJS == 'force' |
| 1302 | - || (this.options.evalJS && this.isSameOrigin() && contentType | 1301 | + || (this.options.evalJS && contentType |
| 1303 | && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) | 1302 | && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) |
| 1304 | this.evalResponse(); | 1303 | this.evalResponse(); |
| 1305 | } | 1304 | } |
| @@ -1317,18 +1316,9 @@ Ajax.Request = Class.create(Ajax.Base, { | @@ -1317,18 +1316,9 @@ Ajax.Request = Class.create(Ajax.Base, { | ||
| 1317 | } | 1316 | } |
| 1318 | }, | 1317 | }, |
| 1319 | 1318 | ||
| 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 | - | ||
| 1329 | getHeader: function(name) { | 1319 | getHeader: function(name) { |
| 1330 | try { | 1320 | try { |
| 1331 | - return this.transport.getResponseHeader(name) || null; | 1321 | + return this.transport.getResponseHeader(name); |
| 1332 | } catch (e) { return null } | 1322 | } catch (e) { return null } |
| 1333 | }, | 1323 | }, |
| 1334 | 1324 | ||
| @@ -1401,8 +1391,7 @@ Ajax.Response = Class.create({ | @@ -1401,8 +1391,7 @@ Ajax.Response = Class.create({ | ||
| 1401 | if (!json) return null; | 1391 | if (!json) return null; |
| 1402 | json = decodeURIComponent(escape(json)); | 1392 | json = decodeURIComponent(escape(json)); |
| 1403 | try { | 1393 | try { |
| 1404 | - return json.evalJSON(this.request.options.sanitizeJSON || | ||
| 1405 | - !this.request.isSameOrigin()); | 1394 | + return json.evalJSON(this.request.options.sanitizeJSON); |
| 1406 | } catch (e) { | 1395 | } catch (e) { |
| 1407 | this.request.dispatchException(e); | 1396 | this.request.dispatchException(e); |
| 1408 | } | 1397 | } |
| @@ -1415,8 +1404,7 @@ Ajax.Response = Class.create({ | @@ -1415,8 +1404,7 @@ Ajax.Response = Class.create({ | ||
| 1415 | this.responseText.blank()) | 1404 | this.responseText.blank()) |
| 1416 | return null; | 1405 | return null; |
| 1417 | try { | 1406 | try { |
| 1418 | - return this.responseText.evalJSON(options.sanitizeJSON || | ||
| 1419 | - !this.request.isSameOrigin()); | 1407 | + return this.responseText.evalJSON(options.sanitizeJSON); |
| 1420 | } catch (e) { | 1408 | } catch (e) { |
| 1421 | this.request.dispatchException(e); | 1409 | this.request.dispatchException(e); |
| 1422 | } | 1410 | } |
| @@ -1620,28 +1608,24 @@ Element.Methods = { | @@ -1620,28 +1608,24 @@ Element.Methods = { | ||
| 1620 | Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML))) | 1608 | Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML))) |
| 1621 | insertions = {bottom:insertions}; | 1609 | insertions = {bottom:insertions}; |
| 1622 | 1610 | ||
| 1623 | - var content, insert, tagName, childNodes; | 1611 | + var content, t, range; |
| 1624 | 1612 | ||
| 1625 | - for (var position in insertions) { | 1613 | + for (position in insertions) { |
| 1626 | content = insertions[position]; | 1614 | content = insertions[position]; |
| 1627 | position = position.toLowerCase(); | 1615 | position = position.toLowerCase(); |
| 1628 | - insert = Element._insertionTranslations[position]; | 1616 | + t = Element._insertionTranslations[position]; |
| 1629 | 1617 | ||
| 1630 | if (content && content.toElement) content = content.toElement(); | 1618 | if (content && content.toElement) content = content.toElement(); |
| 1631 | if (Object.isElement(content)) { | 1619 | if (Object.isElement(content)) { |
| 1632 | - insert(element, content); | 1620 | + t.insert(element, content); |
| 1633 | continue; | 1621 | continue; |
| 1634 | } | 1622 | } |
| 1635 | 1623 | ||
| 1636 | content = Object.toHTML(content); | 1624 | content = Object.toHTML(content); |
| 1637 | 1625 | ||
| 1638 | - tagName = ((position == 'before' || position == 'after') | ||
| 1639 | - ? element.parentNode : element).tagName.toUpperCase(); | ||
| 1640 | - | ||
| 1641 | - childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); | ||
| 1642 | - | ||
| 1643 | - if (position == 'top' || position == 'after') childNodes.reverse(); | ||
| 1644 | - childNodes.each(insert.curry(element)); | 1626 | + range = element.ownerDocument.createRange(); |
| 1627 | + t.initializeRange(element, range); | ||
| 1628 | + t.insert(element, range.createContextualFragment(content.stripScripts())); | ||
| 1645 | 1629 | ||
| 1646 | content.evalScripts.bind(content).defer(); | 1630 | content.evalScripts.bind(content).defer(); |
| 1647 | } | 1631 | } |
| @@ -1686,7 +1670,7 @@ Element.Methods = { | @@ -1686,7 +1670,7 @@ Element.Methods = { | ||
| 1686 | }, | 1670 | }, |
| 1687 | 1671 | ||
| 1688 | descendants: function(element) { | 1672 | descendants: function(element) { |
| 1689 | - return $(element).select("*"); | 1673 | + return $(element).getElementsBySelector("*"); |
| 1690 | }, | 1674 | }, |
| 1691 | 1675 | ||
| 1692 | firstDescendant: function(element) { | 1676 | firstDescendant: function(element) { |
| @@ -1725,31 +1709,32 @@ Element.Methods = { | @@ -1725,31 +1709,32 @@ Element.Methods = { | ||
| 1725 | element = $(element); | 1709 | element = $(element); |
| 1726 | if (arguments.length == 1) return $(element.parentNode); | 1710 | if (arguments.length == 1) return $(element.parentNode); |
| 1727 | var ancestors = element.ancestors(); | 1711 | var ancestors = element.ancestors(); |
| 1728 | - return Object.isNumber(expression) ? ancestors[expression] : | ||
| 1729 | - Selector.findElement(ancestors, expression, index); | 1712 | + return expression ? Selector.findElement(ancestors, expression, index) : |
| 1713 | + ancestors[index || 0]; | ||
| 1730 | }, | 1714 | }, |
| 1731 | 1715 | ||
| 1732 | down: function(element, expression, index) { | 1716 | down: function(element, expression, index) { |
| 1733 | element = $(element); | 1717 | element = $(element); |
| 1734 | if (arguments.length == 1) return element.firstDescendant(); | 1718 | if (arguments.length == 1) return element.firstDescendant(); |
| 1735 | - return Object.isNumber(expression) ? element.descendants()[expression] : | ||
| 1736 | - element.select(expression)[index || 0]; | 1719 | + var descendants = element.descendants(); |
| 1720 | + return expression ? Selector.findElement(descendants, expression, index) : | ||
| 1721 | + descendants[index || 0]; | ||
| 1737 | }, | 1722 | }, |
| 1738 | 1723 | ||
| 1739 | previous: function(element, expression, index) { | 1724 | previous: function(element, expression, index) { |
| 1740 | element = $(element); | 1725 | element = $(element); |
| 1741 | if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element)); | 1726 | if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element)); |
| 1742 | var previousSiblings = element.previousSiblings(); | 1727 | var previousSiblings = element.previousSiblings(); |
| 1743 | - return Object.isNumber(expression) ? previousSiblings[expression] : | ||
| 1744 | - Selector.findElement(previousSiblings, expression, index); | 1728 | + return expression ? Selector.findElement(previousSiblings, expression, index) : |
| 1729 | + previousSiblings[index || 0]; | ||
| 1745 | }, | 1730 | }, |
| 1746 | 1731 | ||
| 1747 | next: function(element, expression, index) { | 1732 | next: function(element, expression, index) { |
| 1748 | element = $(element); | 1733 | element = $(element); |
| 1749 | if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element)); | 1734 | if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element)); |
| 1750 | var nextSiblings = element.nextSiblings(); | 1735 | var nextSiblings = element.nextSiblings(); |
| 1751 | - return Object.isNumber(expression) ? nextSiblings[expression] : | ||
| 1752 | - Selector.findElement(nextSiblings, expression, index); | 1736 | + return expression ? Selector.findElement(nextSiblings, expression, index) : |
| 1737 | + nextSiblings[index || 0]; | ||
| 1753 | }, | 1738 | }, |
| 1754 | 1739 | ||
| 1755 | select: function() { | 1740 | select: function() { |
| @@ -1875,8 +1860,7 @@ Element.Methods = { | @@ -1875,8 +1860,7 @@ Element.Methods = { | ||
| 1875 | do { ancestor = ancestor.parentNode; } | 1860 | do { ancestor = ancestor.parentNode; } |
| 1876 | while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode); | 1861 | while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode); |
| 1877 | } | 1862 | } |
| 1878 | - if (nextAncestor && nextAncestor.sourceIndex) | ||
| 1879 | - return (e > a && e < nextAncestor.sourceIndex); | 1863 | + if (nextAncestor) return (e > a && e < nextAncestor.sourceIndex); |
| 1880 | } | 1864 | } |
| 1881 | 1865 | ||
| 1882 | while (element = element.parentNode) | 1866 | while (element = element.parentNode) |
| @@ -2020,7 +2004,7 @@ Element.Methods = { | @@ -2020,7 +2004,7 @@ Element.Methods = { | ||
| 2020 | if (element) { | 2004 | if (element) { |
| 2021 | if (element.tagName == 'BODY') break; | 2005 | if (element.tagName == 'BODY') break; |
| 2022 | var p = Element.getStyle(element, 'position'); | 2006 | var p = Element.getStyle(element, 'position'); |
| 2023 | - if (p !== 'static') break; | 2007 | + if (p == 'relative' || p == 'absolute') break; |
| 2024 | } | 2008 | } |
| 2025 | } while (element); | 2009 | } while (element); |
| 2026 | return Element._returnOffset(valueL, valueT); | 2010 | return Element._returnOffset(valueL, valueT); |
| @@ -2169,6 +2153,46 @@ Element._attributeTranslations = { | @@ -2169,6 +2153,46 @@ Element._attributeTranslations = { | ||
| 2169 | } | 2153 | } |
| 2170 | }; | 2154 | }; |
| 2171 | 2155 | ||
| 2156 | + | ||
| 2157 | +if (!document.createRange || Prototype.Browser.Opera) { | ||
| 2158 | + Element.Methods.insert = function(element, insertions) { | ||
| 2159 | + element = $(element); | ||
| 2160 | + | ||
| 2161 | + if (Object.isString(insertions) || Object.isNumber(insertions) || | ||
| 2162 | + Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML))) | ||
| 2163 | + insertions = { bottom: insertions }; | ||
| 2164 | + | ||
| 2165 | + var t = Element._insertionTranslations, content, position, pos, tagName; | ||
| 2166 | + | ||
| 2167 | + for (position in insertions) { | ||
| 2168 | + content = insertions[position]; | ||
| 2169 | + position = position.toLowerCase(); | ||
| 2170 | + pos = t[position]; | ||
| 2171 | + | ||
| 2172 | + if (content && content.toElement) content = content.toElement(); | ||
| 2173 | + if (Object.isElement(content)) { | ||
| 2174 | + pos.insert(element, content); | ||
| 2175 | + continue; | ||
| 2176 | + } | ||
| 2177 | + | ||
| 2178 | + content = Object.toHTML(content); | ||
| 2179 | + tagName = ((position == 'before' || position == 'after') | ||
| 2180 | + ? element.parentNode : element).tagName.toUpperCase(); | ||
| 2181 | + | ||
| 2182 | + if (t.tags[tagName]) { | ||
| 2183 | + var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); | ||
| 2184 | + if (position == 'top' || position == 'after') fragments.reverse(); | ||
| 2185 | + fragments.each(pos.insert.curry(element)); | ||
| 2186 | + } | ||
| 2187 | + else element.insertAdjacentHTML(pos.adjacency, content.stripScripts()); | ||
| 2188 | + | ||
| 2189 | + content.evalScripts.bind(content).defer(); | ||
| 2190 | + } | ||
| 2191 | + | ||
| 2192 | + return element; | ||
| 2193 | + }; | ||
| 2194 | +} | ||
| 2195 | + | ||
| 2172 | if (Prototype.Browser.Opera) { | 2196 | if (Prototype.Browser.Opera) { |
| 2173 | Element.Methods.getStyle = Element.Methods.getStyle.wrap( | 2197 | Element.Methods.getStyle = Element.Methods.getStyle.wrap( |
| 2174 | function(proceed, element, style) { | 2198 | function(proceed, element, style) { |
| @@ -2213,31 +2237,12 @@ if (Prototype.Browser.Opera) { | @@ -2213,31 +2237,12 @@ if (Prototype.Browser.Opera) { | ||
| 2213 | } | 2237 | } |
| 2214 | 2238 | ||
| 2215 | else if (Prototype.Browser.IE) { | 2239 | else if (Prototype.Browser.IE) { |
| 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) { | 2240 | + $w('positionedOffset getOffsetParent viewportOffset').each(function(method) { |
| 2231 | Element.Methods[method] = Element.Methods[method].wrap( | 2241 | Element.Methods[method] = Element.Methods[method].wrap( |
| 2232 | function(proceed, element) { | 2242 | function(proceed, element) { |
| 2233 | element = $(element); | 2243 | element = $(element); |
| 2234 | var position = element.getStyle('position'); | 2244 | var position = element.getStyle('position'); |
| 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 }); | 2245 | + if (position != 'static') return proceed(element); |
| 2241 | element.setStyle({ position: 'relative' }); | 2246 | element.setStyle({ position: 'relative' }); |
| 2242 | var value = proceed(element); | 2247 | var value = proceed(element); |
| 2243 | element.setStyle({ position: position }); | 2248 | element.setStyle({ position: position }); |
| @@ -2319,10 +2324,7 @@ else if (Prototype.Browser.IE) { | @@ -2319,10 +2324,7 @@ else if (Prototype.Browser.IE) { | ||
| 2319 | }; | 2324 | }; |
| 2320 | 2325 | ||
| 2321 | Element._attributeTranslations.write = { | 2326 | Element._attributeTranslations.write = { |
| 2322 | - names: Object.extend({ | ||
| 2323 | - cellpadding: 'cellPadding', | ||
| 2324 | - cellspacing: 'cellSpacing' | ||
| 2325 | - }, Element._attributeTranslations.read.names), | 2327 | + names: Object.clone(Element._attributeTranslations.read.names), |
| 2326 | values: { | 2328 | values: { |
| 2327 | checked: function(element, value) { | 2329 | checked: function(element, value) { |
| 2328 | element.checked = !!value; | 2330 | element.checked = !!value; |
| @@ -2442,7 +2444,7 @@ if (Prototype.Browser.IE || Prototype.Browser.Opera) { | @@ -2442,7 +2444,7 @@ if (Prototype.Browser.IE || Prototype.Browser.Opera) { | ||
| 2442 | }; | 2444 | }; |
| 2443 | } | 2445 | } |
| 2444 | 2446 | ||
| 2445 | -if ('outerHTML' in document.createElement('div')) { | 2447 | +if (document.createElement('div').outerHTML) { |
| 2446 | Element.Methods.replace = function(element, content) { | 2448 | Element.Methods.replace = function(element, content) { |
| 2447 | element = $(element); | 2449 | element = $(element); |
| 2448 | 2450 | ||
| @@ -2480,25 +2482,45 @@ Element._returnOffset = function(l, t) { | @@ -2480,25 +2482,45 @@ Element._returnOffset = function(l, t) { | ||
| 2480 | 2482 | ||
| 2481 | Element._getContentFromAnonymousElement = function(tagName, html) { | 2483 | Element._getContentFromAnonymousElement = function(tagName, html) { |
| 2482 | var div = new Element('div'), t = Element._insertionTranslations.tags[tagName]; | 2484 | var div = new Element('div'), t = Element._insertionTranslations.tags[tagName]; |
| 2483 | - if (t) { | ||
| 2484 | - div.innerHTML = t[0] + html + t[1]; | ||
| 2485 | - t[2].times(function() { div = div.firstChild }); | ||
| 2486 | - } else div.innerHTML = html; | 2485 | + div.innerHTML = t[0] + html + t[1]; |
| 2486 | + t[2].times(function() { div = div.firstChild }); | ||
| 2487 | return $A(div.childNodes); | 2487 | return $A(div.childNodes); |
| 2488 | }; | 2488 | }; |
| 2489 | 2489 | ||
| 2490 | Element._insertionTranslations = { | 2490 | Element._insertionTranslations = { |
| 2491 | - before: function(element, node) { | ||
| 2492 | - element.parentNode.insertBefore(node, element); | 2491 | + before: { |
| 2492 | + adjacency: 'beforeBegin', | ||
| 2493 | + insert: function(element, node) { | ||
| 2494 | + element.parentNode.insertBefore(node, element); | ||
| 2495 | + }, | ||
| 2496 | + initializeRange: function(element, range) { | ||
| 2497 | + range.setStartBefore(element); | ||
| 2498 | + } | ||
| 2493 | }, | 2499 | }, |
| 2494 | - top: function(element, node) { | ||
| 2495 | - element.insertBefore(node, element.firstChild); | 2500 | + top: { |
| 2501 | + adjacency: 'afterBegin', | ||
| 2502 | + insert: function(element, node) { | ||
| 2503 | + element.insertBefore(node, element.firstChild); | ||
| 2504 | + }, | ||
| 2505 | + initializeRange: function(element, range) { | ||
| 2506 | + range.selectNodeContents(element); | ||
| 2507 | + range.collapse(true); | ||
| 2508 | + } | ||
| 2496 | }, | 2509 | }, |
| 2497 | - bottom: function(element, node) { | ||
| 2498 | - element.appendChild(node); | 2510 | + bottom: { |
| 2511 | + adjacency: 'beforeEnd', | ||
| 2512 | + insert: function(element, node) { | ||
| 2513 | + element.appendChild(node); | ||
| 2514 | + } | ||
| 2499 | }, | 2515 | }, |
| 2500 | - after: function(element, node) { | ||
| 2501 | - element.parentNode.insertBefore(node, element.nextSibling); | 2516 | + after: { |
| 2517 | + adjacency: 'afterEnd', | ||
| 2518 | + insert: function(element, node) { | ||
| 2519 | + element.parentNode.insertBefore(node, element.nextSibling); | ||
| 2520 | + }, | ||
| 2521 | + initializeRange: function(element, range) { | ||
| 2522 | + range.setStartAfter(element); | ||
| 2523 | + } | ||
| 2502 | }, | 2524 | }, |
| 2503 | tags: { | 2525 | tags: { |
| 2504 | TABLE: ['<table>', '</table>', 1], | 2526 | TABLE: ['<table>', '</table>', 1], |
| @@ -2510,6 +2532,7 @@ Element._insertionTranslations = { | @@ -2510,6 +2532,7 @@ Element._insertionTranslations = { | ||
| 2510 | }; | 2532 | }; |
| 2511 | 2533 | ||
| 2512 | (function() { | 2534 | (function() { |
| 2535 | + this.bottom.initializeRange = this.top.initializeRange; | ||
| 2513 | Object.extend(this.tags, { | 2536 | Object.extend(this.tags, { |
| 2514 | THEAD: this.tags.TBODY, | 2537 | THEAD: this.tags.TBODY, |
| 2515 | TFOOT: this.tags.TBODY, | 2538 | TFOOT: this.tags.TBODY, |
| @@ -2936,13 +2959,13 @@ Object.extend(Selector, { | @@ -2936,13 +2959,13 @@ Object.extend(Selector, { | ||
| 2936 | }, | 2959 | }, |
| 2937 | 2960 | ||
| 2938 | criteria: { | 2961 | criteria: { |
| 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;', | 2962 | + tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;', |
| 2963 | + className: 'n = h.className(n, r, "#{1}", c); c = false;', | ||
| 2964 | + id: 'n = h.id(n, r, "#{1}", c); c = false;', | ||
| 2965 | + attrPresence: 'n = h.attrPresence(n, r, "#{1}"); c = false;', | ||
| 2943 | attr: function(m) { | 2966 | attr: function(m) { |
| 2944 | m[3] = (m[5] || m[6]); | 2967 | m[3] = (m[5] || m[6]); |
| 2945 | - return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m); | 2968 | + return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(m); |
| 2946 | }, | 2969 | }, |
| 2947 | pseudo: function(m) { | 2970 | pseudo: function(m) { |
| 2948 | if (m[6]) m[6] = m[6].replace(/"/g, '\\"'); | 2971 | if (m[6]) m[6] = m[6].replace(/"/g, '\\"'); |
| @@ -2966,8 +2989,7 @@ Object.extend(Selector, { | @@ -2966,8 +2989,7 @@ Object.extend(Selector, { | ||
| 2966 | tagName: /^\s*(\*|[\w\-]+)(\b|$)?/, | 2989 | tagName: /^\s*(\*|[\w\-]+)(\b|$)?/, |
| 2967 | id: /^#([\w\-\*]+)(\b|$)/, | 2990 | id: /^#([\w\-\*]+)(\b|$)/, |
| 2968 | className: /^\.([\w\-\*]+)(\b|$)/, | 2991 | className: /^\.([\w\-\*]+)(\b|$)/, |
| 2969 | - pseudo: | ||
| 2970 | -/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/, | 2992 | + pseudo: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s)|(?=:))/, |
| 2971 | attrPresence: /^\[([\w]+)\]/, | 2993 | attrPresence: /^\[([\w]+)\]/, |
| 2972 | attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/ | 2994 | attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/ |
| 2973 | }, | 2995 | }, |
| @@ -2992,7 +3014,7 @@ Object.extend(Selector, { | @@ -2992,7 +3014,7 @@ Object.extend(Selector, { | ||
| 2992 | 3014 | ||
| 2993 | attr: function(element, matches) { | 3015 | attr: function(element, matches) { |
| 2994 | var nodeValue = Element.readAttribute(element, matches[1]); | 3016 | var nodeValue = Element.readAttribute(element, matches[1]); |
| 2995 | - return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]); | 3017 | + return Selector.operators[matches[2]](nodeValue, matches[3]); |
| 2996 | } | 3018 | } |
| 2997 | }, | 3019 | }, |
| 2998 | 3020 | ||
| @@ -3007,15 +3029,14 @@ Object.extend(Selector, { | @@ -3007,15 +3029,14 @@ Object.extend(Selector, { | ||
| 3007 | 3029 | ||
| 3008 | // marks an array of nodes for counting | 3030 | // marks an array of nodes for counting |
| 3009 | mark: function(nodes) { | 3031 | mark: function(nodes) { |
| 3010 | - var _true = Prototype.emptyFunction; | ||
| 3011 | for (var i = 0, node; node = nodes[i]; i++) | 3032 | for (var i = 0, node; node = nodes[i]; i++) |
| 3012 | - node._countedByPrototype = _true; | 3033 | + node._counted = true; |
| 3013 | return nodes; | 3034 | return nodes; |
| 3014 | }, | 3035 | }, |
| 3015 | 3036 | ||
| 3016 | unmark: function(nodes) { | 3037 | unmark: function(nodes) { |
| 3017 | for (var i = 0, node; node = nodes[i]; i++) | 3038 | for (var i = 0, node; node = nodes[i]; i++) |
| 3018 | - node._countedByPrototype = undefined; | 3039 | + node._counted = undefined; |
| 3019 | return nodes; | 3040 | return nodes; |
| 3020 | }, | 3041 | }, |
| 3021 | 3042 | ||
| @@ -3023,15 +3044,15 @@ Object.extend(Selector, { | @@ -3023,15 +3044,15 @@ Object.extend(Selector, { | ||
| 3023 | // "ofType" flag indicates whether we're indexing for nth-of-type | 3044 | // "ofType" flag indicates whether we're indexing for nth-of-type |
| 3024 | // rather than nth-child | 3045 | // rather than nth-child |
| 3025 | index: function(parentNode, reverse, ofType) { | 3046 | index: function(parentNode, reverse, ofType) { |
| 3026 | - parentNode._countedByPrototype = Prototype.emptyFunction; | 3047 | + parentNode._counted = true; |
| 3027 | if (reverse) { | 3048 | if (reverse) { |
| 3028 | for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) { | 3049 | for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) { |
| 3029 | var node = nodes[i]; | 3050 | var node = nodes[i]; |
| 3030 | - if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++; | 3051 | + if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++; |
| 3031 | } | 3052 | } |
| 3032 | } else { | 3053 | } else { |
| 3033 | for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++) | 3054 | for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++) |
| 3034 | - if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++; | 3055 | + if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++; |
| 3035 | } | 3056 | } |
| 3036 | }, | 3057 | }, |
| 3037 | 3058 | ||
| @@ -3040,8 +3061,8 @@ Object.extend(Selector, { | @@ -3040,8 +3061,8 @@ Object.extend(Selector, { | ||
| 3040 | if (nodes.length == 0) return nodes; | 3061 | if (nodes.length == 0) return nodes; |
| 3041 | var results = [], n; | 3062 | var results = [], n; |
| 3042 | for (var i = 0, l = nodes.length; i < l; i++) | 3063 | for (var i = 0, l = nodes.length; i < l; i++) |
| 3043 | - if (!(n = nodes[i])._countedByPrototype) { | ||
| 3044 | - n._countedByPrototype = Prototype.emptyFunction; | 3064 | + if (!(n = nodes[i])._counted) { |
| 3065 | + n._counted = true; | ||
| 3045 | results.push(Element.extend(n)); | 3066 | results.push(Element.extend(n)); |
| 3046 | } | 3067 | } |
| 3047 | return Selector.handlers.unmark(results); | 3068 | return Selector.handlers.unmark(results); |
| @@ -3093,7 +3114,7 @@ Object.extend(Selector, { | @@ -3093,7 +3114,7 @@ Object.extend(Selector, { | ||
| 3093 | 3114 | ||
| 3094 | // TOKEN FUNCTIONS | 3115 | // TOKEN FUNCTIONS |
| 3095 | tagName: function(nodes, root, tagName, combinator) { | 3116 | tagName: function(nodes, root, tagName, combinator) { |
| 3096 | - var uTagName = tagName.toUpperCase(); | 3117 | + tagName = tagName.toUpperCase(); |
| 3097 | var results = [], h = Selector.handlers; | 3118 | var results = [], h = Selector.handlers; |
| 3098 | if (nodes) { | 3119 | if (nodes) { |
| 3099 | if (combinator) { | 3120 | if (combinator) { |
| @@ -3106,7 +3127,7 @@ Object.extend(Selector, { | @@ -3106,7 +3127,7 @@ Object.extend(Selector, { | ||
| 3106 | if (tagName == "*") return nodes; | 3127 | if (tagName == "*") return nodes; |
| 3107 | } | 3128 | } |
| 3108 | for (var i = 0, node; node = nodes[i]; i++) | 3129 | for (var i = 0, node; node = nodes[i]; i++) |
| 3109 | - if (node.tagName.toUpperCase() === uTagName) results.push(node); | 3130 | + if (node.tagName.toUpperCase() == tagName) results.push(node); |
| 3110 | return results; | 3131 | return results; |
| 3111 | } else return root.getElementsByTagName(tagName); | 3132 | } else return root.getElementsByTagName(tagName); |
| 3112 | }, | 3133 | }, |
| @@ -3153,18 +3174,16 @@ Object.extend(Selector, { | @@ -3153,18 +3174,16 @@ Object.extend(Selector, { | ||
| 3153 | return results; | 3174 | return results; |
| 3154 | }, | 3175 | }, |
| 3155 | 3176 | ||
| 3156 | - attrPresence: function(nodes, root, attr, combinator) { | 3177 | + attrPresence: function(nodes, root, attr) { |
| 3157 | if (!nodes) nodes = root.getElementsByTagName("*"); | 3178 | if (!nodes) nodes = root.getElementsByTagName("*"); |
| 3158 | - if (nodes && combinator) nodes = this[combinator](nodes); | ||
| 3159 | var results = []; | 3179 | var results = []; |
| 3160 | for (var i = 0, node; node = nodes[i]; i++) | 3180 | for (var i = 0, node; node = nodes[i]; i++) |
| 3161 | if (Element.hasAttribute(node, attr)) results.push(node); | 3181 | if (Element.hasAttribute(node, attr)) results.push(node); |
| 3162 | return results; | 3182 | return results; |
| 3163 | }, | 3183 | }, |
| 3164 | 3184 | ||
| 3165 | - attr: function(nodes, root, attr, value, operator, combinator) { | 3185 | + attr: function(nodes, root, attr, value, operator) { |
| 3166 | if (!nodes) nodes = root.getElementsByTagName("*"); | 3186 | if (!nodes) nodes = root.getElementsByTagName("*"); |
| 3167 | - if (nodes && combinator) nodes = this[combinator](nodes); | ||
| 3168 | var handler = Selector.operators[operator], results = []; | 3187 | var handler = Selector.operators[operator], results = []; |
| 3169 | for (var i = 0, node; node = nodes[i]; i++) { | 3188 | for (var i = 0, node; node = nodes[i]; i++) { |
| 3170 | var nodeValue = Element.readAttribute(node, attr); | 3189 | var nodeValue = Element.readAttribute(node, attr); |
| @@ -3243,7 +3262,7 @@ Object.extend(Selector, { | @@ -3243,7 +3262,7 @@ Object.extend(Selector, { | ||
| 3243 | var h = Selector.handlers, results = [], indexed = [], m; | 3262 | var h = Selector.handlers, results = [], indexed = [], m; |
| 3244 | h.mark(nodes); | 3263 | h.mark(nodes); |
| 3245 | for (var i = 0, node; node = nodes[i]; i++) { | 3264 | for (var i = 0, node; node = nodes[i]; i++) { |
| 3246 | - if (!node.parentNode._countedByPrototype) { | 3265 | + if (!node.parentNode._counted) { |
| 3247 | h.index(node.parentNode, reverse, ofType); | 3266 | h.index(node.parentNode, reverse, ofType); |
| 3248 | indexed.push(node.parentNode); | 3267 | indexed.push(node.parentNode); |
| 3249 | } | 3268 | } |
| @@ -3281,7 +3300,7 @@ Object.extend(Selector, { | @@ -3281,7 +3300,7 @@ Object.extend(Selector, { | ||
| 3281 | var exclusions = new Selector(selector).findElements(root); | 3300 | var exclusions = new Selector(selector).findElements(root); |
| 3282 | h.mark(exclusions); | 3301 | h.mark(exclusions); |
| 3283 | for (var i = 0, results = [], node; node = nodes[i]; i++) | 3302 | for (var i = 0, results = [], node; node = nodes[i]; i++) |
| 3284 | - if (!node._countedByPrototype) results.push(node); | 3303 | + if (!node._counted) results.push(node); |
| 3285 | h.unmark(exclusions); | 3304 | h.unmark(exclusions); |
| 3286 | return results; | 3305 | return results; |
| 3287 | }, | 3306 | }, |
| @@ -3315,19 +3334,11 @@ Object.extend(Selector, { | @@ -3315,19 +3334,11 @@ Object.extend(Selector, { | ||
| 3315 | '|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); } | 3334 | '|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); } |
| 3316 | }, | 3335 | }, |
| 3317 | 3336 | ||
| 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 | - | ||
| 3326 | matchElements: function(elements, expression) { | 3337 | matchElements: function(elements, expression) { |
| 3327 | - var matches = $$(expression), h = Selector.handlers; | 3338 | + var matches = new Selector(expression).findElements(), h = Selector.handlers; |
| 3328 | h.mark(matches); | 3339 | h.mark(matches); |
| 3329 | for (var i = 0, results = [], element; element = elements[i]; i++) | 3340 | for (var i = 0, results = [], element; element = elements[i]; i++) |
| 3330 | - if (element._countedByPrototype) results.push(element); | 3341 | + if (element._counted) results.push(element); |
| 3331 | h.unmark(matches); | 3342 | h.unmark(matches); |
| 3332 | return results; | 3343 | return results; |
| 3333 | }, | 3344 | }, |
| @@ -3340,7 +3351,11 @@ Object.extend(Selector, { | @@ -3340,7 +3351,11 @@ Object.extend(Selector, { | ||
| 3340 | }, | 3351 | }, |
| 3341 | 3352 | ||
| 3342 | findChildElements: function(element, expressions) { | 3353 | findChildElements: function(element, expressions) { |
| 3343 | - expressions = Selector.split(expressions.join(',')); | 3354 | + var exprs = expressions.join(','); |
| 3355 | + expressions = []; | ||
| 3356 | + exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) { | ||
| 3357 | + expressions.push(m[1].strip()); | ||
| 3358 | + }); | ||
| 3344 | var results = [], h = Selector.handlers; | 3359 | var results = [], h = Selector.handlers; |
| 3345 | for (var i = 0, l = expressions.length, selector; i < l; i++) { | 3360 | for (var i = 0, l = expressions.length, selector; i < l; i++) { |
| 3346 | selector = new Selector(expressions[i].strip()); | 3361 | selector = new Selector(expressions[i].strip()); |
| @@ -3351,22 +3366,13 @@ Object.extend(Selector, { | @@ -3351,22 +3366,13 @@ Object.extend(Selector, { | ||
| 3351 | }); | 3366 | }); |
| 3352 | 3367 | ||
| 3353 | if (Prototype.Browser.IE) { | 3368 | if (Prototype.Browser.IE) { |
| 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 | - }); | 3369 | + // IE returns comment nodes on getElementsByTagName("*"). |
| 3370 | + // Filter them out. | ||
| 3371 | + Selector.handlers.concat = function(a, b) { | ||
| 3372 | + for (var i = 0, node; node = b[i]; i++) | ||
| 3373 | + if (node.tagName !== "!") a.push(node); | ||
| 3374 | + return a; | ||
| 3375 | + }; | ||
| 3370 | } | 3376 | } |
| 3371 | 3377 | ||
| 3372 | function $$() { | 3378 | function $$() { |
| @@ -3844,9 +3850,9 @@ Object.extend(Event, (function() { | @@ -3844,9 +3850,9 @@ Object.extend(Event, (function() { | ||
| 3844 | var cache = Event.cache; | 3850 | var cache = Event.cache; |
| 3845 | 3851 | ||
| 3846 | function getEventID(element) { | 3852 | function getEventID(element) { |
| 3847 | - if (element._prototypeEventID) return element._prototypeEventID[0]; | 3853 | + if (element._eventID) return element._eventID; |
| 3848 | arguments.callee.id = arguments.callee.id || 1; | 3854 | arguments.callee.id = arguments.callee.id || 1; |
| 3849 | - return element._prototypeEventID = [++arguments.callee.id]; | 3855 | + return element._eventID = ++arguments.callee.id; |
| 3850 | } | 3856 | } |
| 3851 | 3857 | ||
| 3852 | function getDOMEventName(eventName) { | 3858 | function getDOMEventName(eventName) { |
| @@ -3864,7 +3870,6 @@ Object.extend(Event, (function() { | @@ -3864,7 +3870,6 @@ Object.extend(Event, (function() { | ||
| 3864 | } | 3870 | } |
| 3865 | 3871 | ||
| 3866 | function createWrapper(element, eventName, handler) { | 3872 | function createWrapper(element, eventName, handler) { |
| 3867 | - if ( typeof( handler ) != "function" ) return false; | ||
| 3868 | var id = getEventID(element); | 3873 | var id = getEventID(element); |
| 3869 | var c = getWrappersForEventName(id, eventName); | 3874 | var c = getWrappersForEventName(id, eventName); |
| 3870 | if (c.pluck("handler").include(handler)) return false; | 3875 | if (c.pluck("handler").include(handler)) return false; |
| @@ -3875,7 +3880,7 @@ Object.extend(Event, (function() { | @@ -3875,7 +3880,7 @@ Object.extend(Event, (function() { | ||
| 3875 | return false; | 3880 | return false; |
| 3876 | 3881 | ||
| 3877 | Event.extend(event); | 3882 | Event.extend(event); |
| 3878 | - handler.call(element, event); | 3883 | + handler.call(element, event) |
| 3879 | }; | 3884 | }; |
| 3880 | 3885 | ||
| 3881 | wrapper.handler = handler; | 3886 | wrapper.handler = handler; |
| @@ -3957,12 +3962,11 @@ Object.extend(Event, (function() { | @@ -3957,12 +3962,11 @@ Object.extend(Event, (function() { | ||
| 3957 | if (element == document && document.createEvent && !element.dispatchEvent) | 3962 | if (element == document && document.createEvent && !element.dispatchEvent) |
| 3958 | element = document.documentElement; | 3963 | element = document.documentElement; |
| 3959 | 3964 | ||
| 3960 | - var event; | ||
| 3961 | if (document.createEvent) { | 3965 | if (document.createEvent) { |
| 3962 | - event = document.createEvent("HTMLEvents"); | 3966 | + var event = document.createEvent("HTMLEvents"); |
| 3963 | event.initEvent("dataavailable", true, true); | 3967 | event.initEvent("dataavailable", true, true); |
| 3964 | } else { | 3968 | } else { |
| 3965 | - event = document.createEventObject(); | 3969 | + var event = document.createEventObject(); |
| 3966 | event.eventType = "ondataavailable"; | 3970 | event.eventType = "ondataavailable"; |
| 3967 | } | 3971 | } |
| 3968 | 3972 | ||
| @@ -3991,21 +3995,20 @@ Element.addMethods({ | @@ -3991,21 +3995,20 @@ Element.addMethods({ | ||
| 3991 | Object.extend(document, { | 3995 | Object.extend(document, { |
| 3992 | fire: Element.Methods.fire.methodize(), | 3996 | fire: Element.Methods.fire.methodize(), |
| 3993 | observe: Element.Methods.observe.methodize(), | 3997 | observe: Element.Methods.observe.methodize(), |
| 3994 | - stopObserving: Element.Methods.stopObserving.methodize(), | ||
| 3995 | - loaded: false | 3998 | + stopObserving: Element.Methods.stopObserving.methodize() |
| 3996 | }); | 3999 | }); |
| 3997 | 4000 | ||
| 3998 | (function() { | 4001 | (function() { |
| 3999 | /* Support for the DOMContentLoaded event is based on work by Dan Webb, | 4002 | /* Support for the DOMContentLoaded event is based on work by Dan Webb, |
| 4000 | Matthias Miller, Dean Edwards and John Resig. */ | 4003 | Matthias Miller, Dean Edwards and John Resig. */ |
| 4001 | 4004 | ||
| 4002 | - var timer; | 4005 | + var timer, fired = false; |
| 4003 | 4006 | ||
| 4004 | function fireContentLoadedEvent() { | 4007 | function fireContentLoadedEvent() { |
| 4005 | - if (document.loaded) return; | 4008 | + if (fired) return; |
| 4006 | if (timer) window.clearInterval(timer); | 4009 | if (timer) window.clearInterval(timer); |
| 4007 | document.fire("dom:loaded"); | 4010 | document.fire("dom:loaded"); |
| 4008 | - document.loaded = true; | 4011 | + fired = true; |
| 4009 | } | 4012 | } |
| 4010 | 4013 | ||
| 4011 | if (document.addEventListener) { | 4014 | if (document.addEventListener) { |
| @@ -4219,4 +4222,4 @@ Object.extend(Element.ClassNames.prototype, Enumerable); | @@ -4219,4 +4222,4 @@ Object.extend(Element.ClassNames.prototype, Enumerable); | ||
| 4219 | 4222 | ||
| 4220 | /*--------------------------------------------------------------------------*/ | 4223 | /*--------------------------------------------------------------------------*/ |
| 4221 | 4224 | ||
| 4222 | -Element.addMethods(); | 4225 | -Element.addMethods(); |
| 4226 | +Element.addMethods(); | ||
| 4223 | \ No newline at end of file | 4227 | \ No newline at end of file |
public/stylesheets/blocks/profile-info-block.css
public/stylesheets/controller_search.css
| @@ -39,6 +39,54 @@ | @@ -39,6 +39,54 @@ | ||
| 39 | width: 100%; | 39 | width: 100%; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | +.has_cat_list .only-one-result-box .search-results-box { | ||
| 43 | + width: 79%; | ||
| 44 | + float: right; | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | +.has_cat_list #product-categories-menu { | ||
| 48 | + width: 20%; | ||
| 49 | + float: left; | ||
| 50 | +} | ||
| 51 | + | ||
| 52 | +#product-categories-menu a { | ||
| 53 | + display: block; | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +#product-categories-menu ul { | ||
| 57 | + margin: 0px 0px 0px 20px; | ||
| 58 | + padding: 0px; | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +#product-categories-menu .cat-parent { | ||
| 62 | + font-weight: bold; | ||
| 63 | + margin: 2px 0px; | ||
| 64 | + padding: 5px 0px 0px 10px; | ||
| 65 | + list-style: none; | ||
| 66 | +} | ||
| 67 | +#product-categories-menu .cat-empty { | ||
| 68 | + list-style: none; | ||
| 69 | + color: #999; | ||
| 70 | +} | ||
| 71 | + | ||
| 72 | +#product-categories-menu .cat-parent ul { | ||
| 73 | + padding-bottom: 5px; | ||
| 74 | +} | ||
| 75 | + | ||
| 76 | +#product-categories-menu .cat-parent li { | ||
| 77 | + font-weight: normal; | ||
| 78 | + margin: 0px; | ||
| 79 | + padding: 0px; | ||
| 80 | +} | ||
| 81 | + | ||
| 82 | +#product-categories-menu .sub-opening, | ||
| 83 | +#product-categories-menu .sub-closeing { | ||
| 84 | + background-color: #FF8; | ||
| 85 | +} | ||
| 86 | +#product-categories-menu .sub-opened { | ||
| 87 | + background-color: #FF0; | ||
| 88 | +} | ||
| 89 | + | ||
| 42 | .search-results-box.odd { | 90 | .search-results-box.odd { |
| 43 | margin-left: 1%; | 91 | margin-left: 1%; |
| 44 | } | 92 | } |