[Proto-Scripty] Re: Improving FPS Speeds

2008-12-16 Thread RobG



On Dec 17, 3:13 am, Craig  wrote:
> I have a very graphics intense website with 4 sliders on each coded in
> a serperate JS file.
>
> Recently i have developed a full screen image viewer that behaves much
> like lightbox. I am using the effects library to BlindDown the image
> and alternates in their containers as well as Appear/Fading a
> background that covers the whole page.
>
> Problem is that this makes the browser lag and the animation does not
> look smooth at all.
>
> Does anyone have any tips that could be helpful for me to improve the
> FPS as i am not the most experienced js programmer?

Optimisation for speed usually starts by finding the code that is most
sluggish.  You can spend a very long time optimising by doint things
like replacing for loops with do loops or whatever for marginal
improvement when some other simple change, like replacing extensive
use of += to concatenate strings with Array.join or just plain +
(specific to IE), can have a dramatic effect.

Post a link.

You might also consider whehter your effects add to the functionality
of the page or are just a nusance.


--
Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Coupon Code validation

2008-12-16 Thread RobG



On Dec 17, 2:12 am, kangax  wrote:
> Michael wrote:
> > This is awesome - I am totally almost getting this!
>
> > What if my Coupon Code started at some number mid sequence - like
> > everything
> > greater then
>
> > C32456 would be valid...
>
> It's almost always a pain to work with numeric ranges in regex. I
> think the best option in this case is to parse sequence as a number
> and just use comparison operators. Something like:
>
> var passed = false;
> var match = 'C32456'.match(/\d+/);
> if (match && match[0]) {
>   match = parseInt(match);}

Will that result differ from:

  var match = parseInt('C32456');


>
> if (!isNaN(match)) {
>  passed = (match > 1234);

There is no need to use parseInt.  During evaluation of the '<'
operator, if one expression is a Number, the other will be converted
too.  A simpler algorithm finds the number part by simply removing
leading non-digits, so:

  var s = 'C32456';
  passed = s.replace(/^\D+/,'') > 1234;


A RegExp test should probably be done first to ensure the correct
format before testing that the number part is in range, so something
like the following may do:

  if (/^C\d+$/.test(s) && s.replace(/^\D+/,'') > 1234) {
// coupon OK
  }

adjusted for whatever formats need testing.  If there are many
formats, a function could be written to test the format (passed as a
RegExp) and that the number part is within a certain range, something
like:

  function testCoupon( s, formatRE, min, max) {
var n = s.replace(/^\D+/,'');
return re.test(s) && n >= min && n <= max;
  }

 and

  testCoupon('C123', /^C\d+$/, 0, 1000)


--
Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] absolutely positioned content on top of scrolled content

2008-12-16 Thread mr_justin

Hey guys, long time no talk. I've got what I hope will be a simple
question, been trying to wrap my brain around this for a while and
only coming up with blanks.

Here's the deal: I have some fixed-height content with overflow set to
scroll. In the scroll box there are links which when clicked, a menu
is shown just under the link. The menu is positioned absolutely and
WRT to dom order, it is the first thing in the markup, so in other
words the absolutely positioned menu is NOT inside the scrollable
content. The reason the menu is not inside the scroll content is so
that it will appear above all other content, including the right
scroll bar.

Everything works fine as long as the scroll content is not scrolled,
once I start scrolling, the cumulative offset used to calculate the
position of the menu is unreliable.

I've tried messing with the other offset methods, but none seem to
return what I want. I've also tried combining the
cumulativeScrollOffset of the link with the scrollTop of the
scrollable div, along with the cumulativeOffset of the scrollable div,
but could not get it to work.

It's better if I just show an example:
http://sandbox.enjoybeing.net/absolute-above-scrolled.html

If you click a link when the container is not scrolled, the menu is
displayed in the right spot, but as soon as you scroll the div,
everything is wrong.

What's do I need to do here to position this sucker correctly?

-justin

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Problem (propably logical one) with dynamic fadein / fadeout for a navigation menu

2008-12-16 Thread Diodeus

Abort any actions if one is already running:

var running = 0
function createSpecialEffects() {
if(running==1) {
return
}
// Cache needed elements
elms = $$('div#products_new ul li a img');


elms.each(function(slink) {

slink.observe('mouseover', function(e) {
running=1
this.elm = Event.element(e);
this.elm_array = new Array();
this.elm_array = elms.without(this.elm);

this.elm_array.each(function(elms) {
elms.fade({
duration: 0.5,
to: 0.3,
scope: 'specials',
limit: '1',
afterFinish:function()
{running=0}

});
});
});

slink.observe('mouseout', function(e) {
running=1
this.elm_array.each(function(elms) {
elms.appear({
duration: 0.5,
to: 1.0,
scope: 'specials',
limit: '1'
afterFinish:function()
{running=0}
});
});

});

});


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Improving FPS Speeds

2008-12-16 Thread Diodeus

Post your URL.  There may be ways to optimize things, but it's hard to
say without seeing what you've done.

On Dec 16, 12:13 pm, Craig  wrote:
> I have a very graphics intense website with 4 sliders on each coded in
> a serperate JS file.
>
> Recently i have developed a full screen image viewer that behaves much
> like lightbox. I am using the effects library to BlindDown the image
> and alternates in their containers as well as Appear/Fading a
> background that covers the whole page.
>
> Problem is that this makes the browser lag and the animation does not
> look smooth at all.
>
> Does anyone have any tips that could be helpful for me to improve the
> FPS as i am not the most experienced js programmer?
>
> Any help or links that can help me would be much appreciated
>
> Thanks
> Craig
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How can drag a dragable object to another droppable more than one time ?

2008-12-16 Thread Diodeus

You need to reinsert the dragged DIV into the document where it
started from and reinitialize it as a draggable.

$("dragContainer").insert(new Element("div", { id: 'something',
'class':'whatever' }))
new Draggable('something',{revert:true})

On Dec 15, 4:05 pm, PATMAP  wrote:
> Hello to script.aculo.us developer team.
>
> thank you for your best scripts.
>
> I want to drop the draggable onto the droppable and have it stay there
> but not remove from source,
>
> i want only a copy of dragable droped on droppable and i can drag and
> drop this dragable next time and more.
>
> by means i want drag a object to another droppable more than one time
> and source object dont remove.
>
> best regards
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Position.includeScrollOffsets=true and Draggable inside a scrolling div ?

2008-12-16 Thread astilla

Hi,

I'm having a problem with using "Position.includeScrollOffsets = true"
with a Draggable inside a scrolling layer - the draggable is
positioned away from the mouse pointer when the layer things are in is
scrolled down.  I've used the includeScrollOffsets before successfully
on a Sortable but am not having much luck with a Draggable in the same
situation - does anyone know if there is anything that needs to be
done differently?

Basic, very cut-down outline is:-



something

 ... (etc) 




(script)
Position.includeScrollOffsets = true;

$$('li.item').each(function(item) {
new Draggable(item, {ghosting:true, scroll:'main'});
});

(css)
div#main {
position: relative;
float: left;
width: 75%;
overflow: scroll;
height: 100%;
background-color: white;
}

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Reg:how to populate Select Box using prototype & script.aculo.us

2008-12-16 Thread vishnu

Hi all ,
 i have an requirement .. HTML page ..contains two text fields and one
select box .Text Fields are fulling up by using script.aculo.us Auto
completer . i want populate select box depends on the text fields
values .how can i do it ..am using java as server side technology

thanks in advance

thanks,
Vishnu

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Problem (propably logical one) with dynamic fadein / fadeout for a navigation menu

2008-12-16 Thread Chris

Hi,

I got a little problem with prototype/scriptacolous effects. I have an
unordered list (Navigation element) that I want to apply an effect on.
If you hover over one of the images, all other images should fade out.
The effect itself works fine, but the problem is, that after I hover
on another img while the effect of the first image is still active,
some of the images flicker. I tried to solve this by using scopes and
limits, but it doesnt seem to work right.

Does anyone have an answer to this problem?


  





  



JS:
function createSpecialEffects() {

// Cache needed elements
elms = $$('div#products_new ul li a img');

elms.each(function(slink) {

slink.observe('mouseover', function(e) {

this.elm = Event.element(e);
this.elm_array = new Array();
this.elm_array = elms.without(this.elm);

this.elm_array.each(function(elms) {
elms.fade({
duration: 0.5,
to: 0.3,
scope: 'specials',
limit: '1'
});
});
});

slink.observe('mouseout', function(e) {

this.elm_array.each(function(elms) {
elms.appear({
duration: 0.5,
to: 1.0,
scope: 'specials',
limit: '1'
});
});

});


});

}

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Ajax.Autocompleter used in a frame doesn't work

2008-12-16 Thread Greenosity

We have a web application that uses multiple frames. In one frame, we
have a page on which we are trying the use the Scriptaculous
Ajax.Autocompleter. As soon as the minimum number of characters are
entered in the text field, the entire page goes blank and nothing ever
happens after that. No error messages, nothing but a white page. If we
try this in a standalone HTML page (no frames involved), it works
fine. We have confirmed that our server page is returning what we
expect because it appears in the non-frame version page.

Is there something about using frames/framesets that interferes with
Ajax.Autocompleter?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] How can drag a dragable object to another droppable more than one time ?

2008-12-16 Thread PATMAP


Hello to script.aculo.us developer team.

thank you for your best scripts.

I want to drop the draggable onto the droppable and have it stay there
but not remove from source,

i want only a copy of dragable droped on droppable and i can drag and
drop this dragable next time and more.

by means i want drag a object to another droppable more than one time
and source object dont remove.

best regards

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Improving FPS Speeds

2008-12-16 Thread Craig

I have a very graphics intense website with 4 sliders on each coded in
a serperate JS file.

Recently i have developed a full screen image viewer that behaves much
like lightbox. I am using the effects library to BlindDown the image
and alternates in their containers as well as Appear/Fading a
background that covers the whole page.

Problem is that this makes the browser lag and the animation does not
look smooth at all.

Does anyone have any tips that could be helpful for me to improve the
FPS as i am not the most experienced js programmer?

Any help or links that can help me would be much appreciated

Thanks
Craig

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Coupon Code validation

2008-12-16 Thread Diodeus

> This is awesome - I am totally almost getting this!

"Totally almost" - snicker

Regex hurts my brain.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Coupon Code validation

2008-12-16 Thread kangax



Michael wrote:
> This is awesome - I am totally almost getting this!
>
> What if my Coupon Code started at some number mid sequence - like
> everything
> greater then
>
> C32456 would be valid...

It's almost always a pain to work with numeric ranges in regex. I
think the best option in this case is to parse sequence as a number
and just use comparison operators. Something like:

var passed = false;
var match = 'C32456'.match(/\d+/);
if (match && match[0]) {
  match = parseInt(match);
}
if (!isNaN(match)) {
 passed = (match > 1234);
}

// etc.

[...]

--
kangax
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Coupon Code validation

2008-12-16 Thread Michael

This is awesome - I am totally almost getting this!

What if my Coupon Code started at some number mid sequence - like
everything
greater then

C32456 would be valid...



On Dec 16, 8:45 am, kangax  wrote:
> On Dec 16, 5:17 am, SWilk  wrote:
>
> > Michael wrote:
> > > This script is right up my alley - thanks a lot -
>
> > > I am trying to validate a field that has a letter/number combo - it
> > > must be between C400 and C700 OR D300 and D999
> > > [...]
>
> > try this regexp:
> > ^((C[4-6]\d{2})|(D[3-9]\d{2})|(C700))$
>
> Or a bit shorter:
> ^(C([4-6]\d\d|700)|D[3-9]\d\d)$
>
> [...]
>
> > Regards,
> > SWilk
>
> --
> kangax

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Prototype Cross Site Ajax Request

2008-12-16 Thread Jeztah

Does anyone know if this is supported yet in prototypejs ... i have
found a plugin for it but it seems not to work as it is intended for
proto 1.5 and i am on the latest one  Are the developers thinking
of maybe adding the "crossSite" option into ajax requests ?


Thanks in advance

Alex
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Coupon Code validation

2008-12-16 Thread kangax

On Dec 16, 5:17 am, SWilk  wrote:
> Michael wrote:
> > This script is right up my alley - thanks a lot -
>
> > I am trying to validate a field that has a letter/number combo - it
> > must be between C400 and C700 OR D300 and D999
> > [...]
>
> try this regexp:
> ^((C[4-6]\d{2})|(D[3-9]\d{2})|(C700))$

Or a bit shorter:
^(C([4-6]\d\d|700)|D[3-9]\d\d)$

[...]
> Regards,
> SWilk

--
kangax
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Ajax onComplete, but from another function

2008-12-16 Thread George

Hi TJ

Many thanks for your response.

Actualy I'm not having any problem with execution scope and have
managed to grasp a fairly good understanding over the past few weeks.
In my constant attempts to re-use code, I'm trying to revisit a method
that refreshes a dataset with an ajax call.

The problem that I'm running into though is that I'm not able to
determine when the data has been refreshed successfully from outside
the method.  This results in my calling function charging on and
refreshing my page with out of date data.

So my question is - is there some kind of global status I can access
to tell whether or not the Ajax call has successfully completed.
All the best

George

On Dec 15, 5:56 pm, "T.J. Crowder"  wrote:
> Hi George,
>
> If I'm reading that right on a fairly quick skim, it looks like you've
> already taken a stab at this and gotten very close:
>
> > onSuccess  : function(transport){
> >     this.RS = transport.responseText.evalJSON();
> >     if (a==1) this._drawPage;
> >   });},
>
> The thing is that "this", within the onSuccess handler, won't be what
> it is in the _getData call.  "this" is set by how a function is
> called, rather than where and how it's defined.  The anonymous
> function being used for the onSuccess handler will be called with
> "this" being something else (I don't immediately recall what), rather
> than it being a reference to an instance of your class.
>
> This is easily fixed, though, using Function#bind[1]:
>
> > onSuccess  : (function(transport){
> >     this.RS = transport.responseText.evalJSON();
> >     if (a==1) this._drawPage();
> >   }).bind(this));},
>
> [1]http://prototypejs.org/api/function/bind
>
> I put parens around the function definition, and then put .bind(this)
> after it.  I also put parens after the this._getData call to make it a
> call to the function rather than a reference to the function object.
>
> Details on the Function#bind page, an also here are some useful
> articles:
>
> http://proto-scripty.wikidot.com/prototype:how-to-hooking-events#Boun...http://blog.niftysnippets.org/2008/04/you-must-remember-this.htmlhttp://www.alistapart.com/articles/getoutbindingsituations
>
> (I'm rushing a bit this morning, apologies if I misread the question
> or code and the above is off-base.)
>
> HTH,
> --
> T.J. Crowder
> tj / crowder software / com
>
> On Dec 15, 5:07 am, George  wrote:
>
> > Hi Folks,
>
> > I'm wondering if there is a way to get a function to wait until an
> > external Ajax.Request has completed.  As always, I find an example is
> > the best way to describe my issue:
>
> > var buildPage = {};
> > buildPage = Class.create();
> > buildPage.prototype =
> > {
> > initialize: function() {
> > this.RS = [];//hold json data for later use
> >  ...
> > this._getData(1);},
>
> > _getData : function(a) {
> > var url = (a==1) ? 'url1' : 'url2';
> > new Ajax.Request (url), {method:'get',
> > onSuccess  : function(transport){
> >     this.RS = transport.responseText.evalJSON();
> >     if (a==1) this._drawPage;
> >   });},
>
> > _drawPage : function () {
> > //parse this.RS data with template
> > ...},
>
> > _refreshData : function () {
> >  this.getData(2);
> > //wait until _getData reports success then continue
> >  this._drawPage();
>
> > }
> > };
>
> > So this buildPage class reuses the _getData method calling a different
> > URL depending on what is passed to it.  What I want the _refreshData
> > method to do is call the _getData method, and only when it has
> > successfully refreshed the RS array, call the _drawPage method.
>
> > Is this possible? should I be doing it a different way?
>
> > Many thanks
>
> > George
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Sorting on a JSON array

2008-12-16 Thread George

Hi Folks,
I wondered if there was a way to sort a JSON array.  Here's an
example:

var RS =  [
{id: 1, dateFrom: 20090101, dateTo: 20090309, tariff: [
  {guest: 1, mon: 105, tue: 79, wed: 79, thu: 79, fri: 99, sat: 109,
sun: 79},
  {guest: 2, mon: 89, tue: 89, wed: 89, thu: 89, fri: 109, sat: 119,
sun: 89}
]},
{id: 2, dateFrom: 20090302, dateTo: 20090304, tariffhigh: 180,
tarifflow: 150, tariff: [
  {guest: 1, mon: 240, tue: 0, wed: 0, thu: 0, fri: 0, sat: 0, sun:
0},
  {guest: 2, mon: 220, tue: 0, wed: 0, thu: 0, fri: 0, sat: 0, sun: 0}
]},
{id: 0, dateFrom: 20081216, dateTo: 20081216, tariff: [
  {guest: 1, mon: 0, tue: 0, wed: 0, thu: 0, fri: 0, sat: 0, sun: 0}
]}
]

RS.sortBy(function(i){return i.dateFrom},this)

I've simplified this code slightly but you should get the general
idea.

I'm trying to reorder by dateFrom but I can't get sortBy to sort in
this case.  Anyone know what I'm doing wrong, or is there an
altogether better way?

Many thanks

George
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Coupon Code validation

2008-12-16 Thread SWilk

Michael wrote:
> This script is right up my alley - thanks a lot -
> 
> I am trying to validate a field that has a letter/number combo - it
> must be between C400 and C700 OR D300 and D999
> [...]

try this regexp:
^((C[4-6]\d{2})|(D[3-9]\d{2})|(C700))$

> 
> This is just beyond my reach - I appreciate any help

This is top of my head, probably could be optimized, but should work.

Regards,
SWilk

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: DOM Exception with findElements()

2008-12-16 Thread RobG



On Dec 14, 5:34 am, Matthew  wrote:
> In an application I wrote I have a call to up(), as in:
>
> test = elt.up('li');
>
> elt is anything that will be contained within a li element, if this is
> true, I create a rollover item for that li element.
>
> At any rate, accoring to Firebug this call propagates through
> Prototype via:
> _methodized()
> up()
> findElement()
> matchElements()
> $$
> findChildElements()
> findElements()

That is an enormous amount of cruft for something that can be done as
simply as:

function up(el, tName) {
  tName = tName.toLowerCase();
  while ((el = el.parentNode) && el.tagName)
if (el.tagName && el.tagName.toLowerCase() == tName)
  return el;
}


Prototype-ized of course.


--
Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---