[Proto-Scripty] Re: get all values?

2008-10-28 Thread Justin Perkins

given this:
div class=foo/div
div class=foo/div
div class=foo/div
div class=foo/div

do this:

$$('div.foo').each(function(div){
  alert(div);
});

The each method is an *iterator*.
http://prototypejs.org/api/enumerable/each

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: I use Updater with a webpage in different folder. I can't see images

2008-10-21 Thread Justin Perkins

Why don't you use paths to your images that are relative to the
webroot instead of the directory they are in so that they work no
matter where they are?

The convention is to have a directory in your webroot called images
and all your imagery goes in there.

/images/c1/foo.jpg
/images/c2/bar.jpg

img src=/images/c1/foo.jpg /

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: PeriodicalExecuter vs. Ajax.PeriodicalUpdater: use cases and advice?

2008-10-21 Thread Justin Perkins

Why aren't you just using the Ajax.PeriodicalUpdater, which supports
the decay option?

var poller = new Ajax.PeriodicalUpdater('some-element-id', '/foo/bar',
{decay:10});

Also, if you pass an empty string as the first parameter, then you can
pass pure JavaScript to be executed as opposed to just replacing the
contents of a page element.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: PeriodicalExecuter vs. Ajax.PeriodicalUpdater: use cases and advice?

2008-10-21 Thread Justin Perkins

Well since the Ajax requests in Prototype will auto-eval the response,
you can modify the page without updating just one div. It's the route
I take most of the time.

Say you set it up like this:

new Ajax.PeriodicalUpdater('', '/some/url');

Then the response from /some/url could be:

$('some-element').blindUp({duration:0.5);
// wait for the blind up to complete before replacing the content
Element.update.delay(0.5, 'some-element', 'pmy new content/p');
// wait for the blind up to complete, then wait a 10th of a second longer
Element.blindDown.delay(0.6, 'some-element', {duration:0.5});

You get the idea. I find it more flexible and convenient than updating
just a single element. You could alternatively call into some
predefined object/method to do this work.

Some people might be opposed to this approach, but it works.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Demos?

2008-10-19 Thread Justin Perkins

All that stuff has been moved to the github wiki for Scriptaculous:

http://github.com/madrobby/scriptaculous/wikis

All the scriptaculous links at script.aculo.us point over to the wiki
but I did notice that the animation framework link points to an
invalid page at github, which probably made you think the demos were
down.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Demos?

2008-10-19 Thread Justin Perkins

I agree github is a little tough to use if you're just looking for
demos. There has been a lot of talk about setting up an easier to use
wiki, but the details are still being worked out iirc. In the meantime
the wiki on github is the best option.

Which effect are you wanting to loop?

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Prototype.js (1.6.0.3) breaks Firebug (1.2.1) Options allegedly.

2008-10-14 Thread Justin Perkins

Ever since Firefox3, there have been many issues with Firebug and I
find it pretty hard to believe that Prototype is the cause of these
issues. There didn't seem to be anything wrong with running Firebug
and Prototype side-by-side on Firefox2.

Guess it's easier to blame than to fix.

What specific issues are you having?

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: One AJAX Script, Three Browser Bugs?

2008-10-13 Thread Justin Perkins

There is no inherit flaws in Prototype that would cause erratic
behavior like you are describing. That's just plain ludicrous for
somebody to suggest that, typical jQuery crowd trying to pimp their
framework at any chance they can ;)

Right away I think your initializer code is buggy. Not sure why you're
iterating over the entire forms collection and then using a regex to
match an ID. Your form has an ID so why not use it? Or if you will
have multiple forms to observe why not just give them all a class name
then you can match just those forms by doing:

form method=... action=... class=poll
...
/form

$$(form.poll).each(...)

Also, you should use a true event observer rather than the onsubmit
attribute, such as:

someFormElement.observe('submit', function(event){ event.stop(); /*
stop the form from being submitted */ });

Also, you are assigning a function to onsubmit, but that function is
lacking the proper scope. I don't see how the code you have would work
in any browser but I guess I'm missing something since you say it
works in IE.

Why don't you try something more like this:

var PollForm = {
  initialize: function(){
// for each element that matches this selector, invoke the
// observe method with these arguments
$$('form.poll').invoke('observe', 'submit',
this.formSubmit.bindAsEventListener(this));
  },
  formSubmit: function(event){
// stop the form from being submitted
event.stop();
// process the form passing in the form relating to the event
this.processForm(event.element());
  },
  processForm: function(form){
// do whatever you need to do here
var formData = form.serialize();
  }
}

document.observe('dom:loaded', PollForm.initialize.bind(PollForm));

See these pages for more info on the various methods used in this example:
http://www.prototypejs.org/api/document/observe
http://www.prototypejs.org/api/utility/dollar-dollar
http://www.prototypejs.org/api/enumerable/invoke
http://www.prototypejs.org/api/event/observe
http://www.prototypejs.org/api/form/serialize

Hope this helps.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Getting Text Nodes of Elements

2008-10-11 Thread Justin Perkins

On Sat, Oct 11, 2008 at 10:31 AM, RobG [EMAIL PROTECTED] wrote:
 Performance is not the issue - fewer lines of code doesn't necessarily
 mean faster performance.

Do you differentiate between browser sniffing and object/method sniffing?

Do you like that Prototype's Selector#findElements method uses XPATH
(Firefox) and querySelector/querySelectorAll (WebKit) when available?
Or do you think this muddles up the codebase with unnecessary
branching?

(not trying to get into a huge discussion, just curious where you draw the line)

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Form works in Opera Firefox but not in IE and partially in Chrome Safa

2008-10-09 Thread Justin Perkins

On Thu, Oct 9, 2008 at 3:02 AM, Mondane [EMAIL PROTECTED] wrote:
 The bug in Safari is, when choosing an option
 in the third drop-down (Choose your category), the form resets to only
 showing Choose your game. After this, it stops working.

I didn't have that problem, was able to get through all the way so
that it showed the quick solution below the form. Is it maybe
dependent on the options you choose? Since you are using a GET
request, you should escape your parameters to ensure the value chosen
is what is received by the server.

Wrt to IE, it sounds like you've got a JavaScript error that is
causing the Ajax request to not submit. Do you have Script Debugger
installed in IE? If not, you should install it and then go into the
advanced options for IE and enable script debugging.

-justin

p.s. I loved that game lemmings, forgot all about it :)

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: location.hash and event handler/window event

2008-10-09 Thread Justin Perkins

I know of no native way to do this. The first thing that comes to mind
is using window.setInterval() to invoke a function every couple of
seconds to see if the address bar has been changed.

Are you updating the address bar when an Ajax request changes the
page, but then when you click the back button you are noticing that
the URL changes (after the hash symbol) but nothing else does?

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: location.hash and event handler/window event

2008-10-09 Thread Justin Perkins

On Thu, Oct 9, 2008 at 12:03 PM, Mauro Marchiori Neto
[EMAIL PROTECTED] wrote:
 setInterval right? wouldnt it overload the browser?

Not necessarily, as long as your URL checking function is simple and
you don't check very frequently. Say, something like this:

var AnchorChecker = {
  initialize: function(){
this.location = location.href;
this.interval = setInterval(function(){
  if (this.location != location.href) this.anchorAltered();
}.bind(this), 500); // check every half second
  },
  anchorAltered: function(){
// the url has been altered
  }
};

AnchorChecker.initialize();


^ 100% untested, beware

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Getting Text Nodes of Elements

2008-10-09 Thread Justin Perkins

On Thu, Oct 9, 2008 at 10:42 PM, RobG [EMAIL PROTECTED] wrote:
 Interesting, but it relies on browser sniffing and proprietary
 properties.

What's wrong with that? If it is in the name of performance, I say go for it.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Form works in Opera Firefox but not in IE and partially in Chrome Safari

2008-10-08 Thread Justin Perkins

Can you create a simple page that displays this problem? It is very
hard to debug/view your code on the live site.

Also, at this point I consider Chrome a novelty but obviously you want
things to work in IE and Safari might be a priority too.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Form works in Opera Firefox but not in IE and partially in Chrome Safar

2008-10-08 Thread Justin Perkins

In Safari, when I change the first drop-down, the second and third
drop-downs are updated but the second one remains disabled. Is that
your intention or is that the bug you are describing?

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Ajax.Responders

2008-10-07 Thread Justin Perkins

Are you getting any errors? What browser are you using?

I think that code can be cleaned up a bit, $() is expensive, it should
be used sparingly. Also there is no need to call appear on an already
visible element.

Ajax.Responders.register({
  onCreate: function(request){
var loading = $('loading');
if (loading){
  loading.update('Loading (' + Ajax.activeRequestCount + ')')
  // only appear the element if it is not already visible
  if (!loading.visible()) loading.appear({duration:0.5});
}
  },
  onComplete: function(request){
var loading = $('loading');
if (loading){
  loading.update('Loading (' + Ajax.activeRequestCount + ')');
  if (loading.visible()  Ajax.activeRequestCount  1)
loading.fade({duration:0.5});
}
  }
});

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Getting Text Nodes of Elements

2008-10-07 Thread Justin Perkins

I think you will need to use the native methods to get the text nodes
as Prototype filters them out. This will work though:

$A( $('some-element-id').childNodes ).select( function(element){
return element.nodeType == 3; } )

Or better yet:

Element.addMethods({
  textNodes: function(element){
return $A(element.childNodes).select( function(child){ return
child.nodeType == 3; } );
  }
});

Then you can just do: $('some-element-id').textNodes();

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Ajax.Responders

2008-10-07 Thread Justin Perkins

On Tue, Oct 7, 2008 at 2:50 PM, Namotco [EMAIL PROTECTED] wrote:

 WebKit has a JS debugger much like Firebug, no errors.

I know, but I still find Firebug to be much better about error reporting.

 Here's the
 function I call that seems to no decrement the counter:

If there is an error in that code that causes the Ajax request to
fail, it will not invoke the onComplete global callback.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Observing the removal of elements

2008-10-06 Thread Justin Perkins

You can use Function#wrap to help you with this by wrapping the
Element#remove method, but you will also have to watch out for other
destructive methods on elements such as Element#update and
Element#replace.

http://prototypejs.org/api/function/wrap

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How can I get input elements of a div in order of their position?

2008-10-06 Thread Justin Perkins

2008/10/6 buda [EMAIL PROTECTED]:

 it is - but on a form it may be several divs filled with input
 elements and I have to work with them separetely from other divs and I
 need to have their right ordered array of input elements

You're right, sorry I did not think of that. Rob's idea is a good one.
You could also still use the Form#getElements method then filter out
those that are not in the div your interested in. What route your
choose should dependent on your markup mostly (lots of form controls
vs. lots of div child elements).

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How can I get input elements of a div in order of their position?

2008-10-06 Thread Justin Perkins

2008/10/6 buda [EMAIL PROTECTED]:
 it gets all elements for a form? but I need for a div!

Usually wherever *form* elements (input, select, textarea) exist, a
form tag will be around them.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Autocompleter doesn't cancel pending requests

2008-10-03 Thread Justin Perkins

That's a good idea. I prefer to leave the prototype and scriptaculous
source files in pristine condition whenever possible so that when I
update to a newer version I don't have to keep track of what I changed
and having to reapply those changes.

So here is the same idea, but extending Ajax.Autocompleter instead of
altering the code directly. This code would go in a separate file that
is included after controls.js is included.

http://pastie.org/284326

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: event.observer oncontextmenu

2008-10-02 Thread Justin Perkins

You need to attach it to the window object, not the document.body object.

Event.observe(window, 'contextmenu', someMethod);

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: event.observer oncontextmenu

2008-10-02 Thread Justin Perkins

On Thu, Oct 2, 2008 at 12:47 PM, kangax [EMAIL PROTECTED] wrote:
 It could, if you are using an older version. Latest one doesn't check
 against a list of event names, so observing an event on document.body
 should work.

Yes it does. I thought it was only a window event but sure enough it
works fine on the body as well.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Does Prototype have a future?

2008-09-26 Thread Justin Perkins

I like Prototype better than any other framework :p

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Ajax.Autocomplete Questions

2008-09-25 Thread Justin Perkins

On Thu, Sep 25, 2008 at 2:36 PM, ericindc [EMAIL PROTECTED] wrote:
 First, in the online Ajax.Autocompleter document's Server Return
 section, it states that the server must return an unordered list.
 So, in my server side PHP code I literally return a string containing
 the unordered list.

Autocompleter expects the following:

ul
  lisome item/li
  lisome other item/li
  ...
/ul

It also expects a div to exist on the page with the ID that you pass
as the second argument when you are instantiating the autocompleter.


 Second, I'm having trouble getting my autocomplete code to work
 properly in Netscape 7, even though the exact same code works just
 fine in IE 6.  Are there any known bugs in Scriptaculous that could be
 causing this to fail.

Not sure about that. I know it works fine in IE6/7, Firefox 2/3,
Safari, Opera, Camino, but have never tested nor used NN7.

 Third, I've noticed in that typing in my input fast causes the
 autocomplete to attempt running but fail.  I see my indicator image
 flash on and then off, but no results are returned.

I've never seen behavior like that. I just tried and it had no
problems returning results that matched what I typed, regardless of
how fast I typed those two characters.

Can you link to a demo page exhibiting these bugs and also let us know
what browser/version you are experiencing the problems in?

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Effect.Highlight and :hover stops working?

2008-09-25 Thread Justin Perkins

That is happening because the background color of the row is set with
inline CSS to be the original background color when the highlight
effect is complete. Inline CSS always has priority over CSS in the
stylesheet. Maybe you can try using the !important declaration to
override it?

Note that the :hover pseudo class is not supported in IE6 on any
element except an anchor.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: yet another show/hide example

2008-09-24 Thread Justin Perkins

I prefer not to nest my code like that, I feel like it is difficult to
read and hard to extend/modify (read: fragile), but if that's how you
like to read your code and you find it easier to read/write, then
that's all that matters.

I think if that code works for you now, then you should just be happy
with it. Keep writing JavaScript and then revisit this code in a few
months and you'll probably have an idea or two for improving it.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: binding to preserve 'this' keyword scope

2008-09-19 Thread Justin Perkins

If you just bind your observer to the current instance of this when
you are setting up your observer, everything will work fine. Here is a
contrived example to illustrate usage.

// this code is untested
var Foo = {
  initialize: function(){
this.message = 'I am who I say I am';
this.body = document.body;
// attach to a normal method
this.body.observe('click', this.bodyClicked.bindAsEventListener(this));

// attach to an anonymous method
this.body.observe('keypress', function(event){
  alert('you pressed a key, here is my message: ' + this.message);
}.bindAsEventListener(this));
  },
  bodyClicked: function(event){
alert('you clicked on my body, here is my message: ' + this.message);
  }
};

Foo.initialize();

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: issues with getElementBySelector

2008-09-18 Thread Justin Perkins

On Thu, Sep 18, 2008 at 10:09 AM, Matt Foster [EMAIL PROTECTED] wrote:

 bluezehn, the $$ method just executes getElementsBySelector on the
 document. http://prototypejs.org/api/element/getelementsbyselector

Doesn't $$ use Element#select?

Nobody should be using getElementsBySelector if you're running
Prototype 1.6 or higher.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: AJAX autocompleter

2008-09-18 Thread Justin Perkins

On Thu, Sep 18, 2008 at 2:30 PM, Jack D [EMAIL PROTECTED] wrote:
 Hello,

 any clue regarding memory leak?

What version of IE? IE is well known for it's memory leaks with
JavaScript. I recommend using a memory leak tool for IE rather than
just looking at the task manager. sIEve is one good tool I have had
success with in the past. This is probably one of the best named
memory leak tools ever to exist. :)

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: AJAX autocompleter

2008-09-18 Thread Justin Perkins

On Thu, Sep 18, 2008 at 3:02 PM, Jack D [EMAIL PROTECTED] wrote:
 Hi Justin,
 I'm using IE 6. In the memory leak tool which you've specified, if the
 #leak is showing some number, then does it mean that its a memory leak?

I guess, but with IE there will be all sorts of stuff marked as #leak.
You'll have to do a bit more digging than that. I have only used this
tool once when I had a bad memory leak (over a year ago) so I'm not
going to be able to help.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: submiting form created by Ajax.inPlaceEditor

2008-09-17 Thread Justin Perkins

On Tue, Sep 16, 2008 at 2:21 PM, Tokeiito [EMAIL PROTECTED] wrote:

 Is there a way to triger submit by using object i get after: var
 editor = new Ajax.InPlaceEditor(...); ?

You might try calling editor.handleFormSubmission(), although that
method expects an event argument it appears to be safe to call it
without arguments.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Disable form submission

2008-09-17 Thread Justin Perkins

To add to the list of ideas, I would recommend you override the
Ajax.InPlaceEditor#checkForEscapeOrReturn method to do what you want
since that's where this submit event is getting fired from.

Ajax.InPlaceEditor.addMethods({
  checkForEscapeOrReturn: function(e) {
if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return;
if (Event.KEY_ESC == e.keyCode)
  this.handleFormCancellation(e);
else if (Event.KEY_RETURN == e.keyCode)
  return; //this.handleFormSubmission(e);
  }
});

Ideally you would pass in an extra option when instantiating the IPE
and then in the above code snippet you could check for the existence
of an option before blocking the form submit event.

-justin

P.S. Your users might see this as a bug since submitting a form on
return key press is expected behavior.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: toHTML() doesn't work

2008-09-17 Thread Justin Perkins

On Wed, Sep 17, 2008 at 8:00 PM, yawnmoth [EMAIL PROTECTED] wrote:
 It's Object#toHTML:

 http://www.prototypejs.org/api/object/tohtml

Yes, like Object.toHTML(someObject), not someObject.toHTML().

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: recommended css forms

2008-09-16 Thread Justin Perkins

Have you looked into Prototip2?
http://www.nickstakenburg.com/projects/prototip2/

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: recommended css forms

2008-09-16 Thread Justin Perkins

On Tue, Sep 16, 2008 at 11:33 AM, Jimmy Brake [EMAIL PROTECTED] wrote:
 nor anything for locking out the rest of a
 page while using the form(I could have missed it).

If you want to do lockout style forms, then the lightbox approach is
the best way.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Need Help with Ajax.Request Parameters

2008-09-16 Thread Justin Perkins

On Tue, Sep 16, 2008 at 10:57 AM, TheZ [EMAIL PROTECTED] wrote:
 parameters : {
  user : {
first:'first_name',
last:'last_name'
  }
 }

The Ajax.Request object does not handle nested parameters. You should
use a string instead.

'user[first]=first_nameuser[last]=last_name'

This is happening because the AjaxRequest parses the parameters with
Object#toQueryString which does not parse nested objects.

http://prototypejs.org/api/object/toquerystring

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: $$( ) returns hidden/removed tr tags

2008-09-16 Thread Justin Perkins

If all your HTML and JavaScript is in one file, you can put it in
pastie and then provide a link. See here: http://pastie.org/

Since you're using Prototype, you should take advantage of it's helper
methods to traverse the DOM, such as Element#up and Element#down
instead of messing with parentNode ... especially since the element
returned from parentNode won't be a Prototype-extended element when in
IE.

Element#up: http://prototypejs.org/api/element/up

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: $$( ) returns hidden/removed tr tags

2008-09-16 Thread Justin Perkins

Just as I thought, you are calling your function setRowFeatures
immediately instead of waiting until the row is removed. Due to
implementation problems in browsers like IE, I really recommend
against using effects on table elements.

Take these 2 lines of code:

row.fade(); //{afterFinish: function(fx){ fx.element.remove()}});
setRowFeatures();

And change them to:

row.remove();
setRowFeatures();

If you insist on using an effect to remove the row, you need to wait
until the effect has completed before you process the rows.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: $$( ) returns hidden/removed tr tags

2008-09-16 Thread Justin Perkins

Like I said in my first post, delay invoking your function for the
same amount of time as the effect. There's a few different ways to
achieve this, but the goal is don't do any row counting/alteration/etc
until after the effect is complete.

row.fade({duration:0.5});
setTimeout(function(){
  row.remove();
  setRowFeatures();
}, 500);

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: User types freely on webpage and it jumps to a link...

2008-09-12 Thread Justin Perkins

Yes you could just setup a keyup observer on the entire document, the
two problems that I see right away is that any keyboard shortcuts the
user already uses may or may not work any longer depending on how you
write your code. Secondly, depending on the size of the list of links,
the script may take a while to process each keypress.

There's a few other issues I'd be concerned with, but the above is
probably enough to think about for now. Having a textbox to type into
would solve the first problem. Keeping a copy of the list of links in
a local variable would help to solve the second problem.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: autocompleter does not work with contents pasted by using mouse

2008-09-12 Thread Justin Perkins

On Fri, Sep 12, 2008 at 11:57 AM, Jack [EMAIL PROTECTED] wrote:
   Question 1:
   I've observed that when copy paste the search string using keyboard
 in the text box, it displays hints. However, if I copy paste the same
 stuff using mouse, then the hints are not displayed at all. I think
 the even is placed on keydown or something.

The Autocompleter listens for the keydown event to trigger Ajax
request. To accommodate the event you are describing, you could wrap
the Autocompleter#baseInitialize method and add an additional
mousedown or mouseup listener bound to the same method that the
keydown listener invokes.

   Question 2:
   I kept minChars to 2  I entered ab in text box, it shows hints
 for all matching abs. If I enter a  (a followed by a space), it
 does not even invoke anything  does not display hint. Is this a bug?
 Why space is excluded? Any workaround?

The reason for this is because the input is stripped (leading and
trailing spaces removed) which means that a single character followed
by any number of spaces is still considered a single character. The
default minChars value is 1, if you're going to be typing a character
then a space you might want to just leave the default value instead of
using minChars:2.

Alternatively, you can override the getToken method to return an
unstripped string.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Form.Element#setValue

2008-09-08 Thread Justin Perkins

On Mon, Sep 8, 2008 at 3:35 PM, Alexey Bass [EMAIL PROTECTED] wrote:
 What I'm asking is that why this is not documented on Prototype site.

Maybe it should be mentioned, but really Element#update is just using
innerHTML to update the contents of a node, and since innerHTML cannot
be used to update form elements, I've always thought it goes without
saying that you use Element#update for most stuff except form
controls.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Assigning OnClick Events To Options On A Select Menu?

2008-09-08 Thread Justin Perkins

Why don't you just observe the 'change' event on the select? Works in
all browsers, and is the standard method for observing select boxes.

One tip, where you do:

var someNodeList = 
 $('game_types').getElementsByTagName('option');
var nodes = $A(someNodeList);
nodes.each(

Can really be:

$('game_types').select('option').each(function(options){
});

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Bug in scriptaculous-js-1.6.4

2008-09-08 Thread Justin Perkins

On Mon, Sep 8, 2008 at 6:06 PM, Jack D [EMAIL PROTECTED] wrote:
  This problem exist only with IE. It always shows 1 space.

I didn't realize it was just an IE thing. I'm sorry I can't help right
now because I don't have IE.

I might be able to look into it a bit more tomorrow.

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---