Re: [Proto-Scripty] Re: document.observe and Sorter in scrolling li sts

2009-12-08 Thread Niko Schwarz
I don't think so. head and body are both optional:

http://dev.w3.org/html5/spec/Overview.html#optional-tags

On Tue, Dec 8, 2009 at 1:24 AM, Rick Waldron waldron.r...@gmail.com wrote:
 Missing:

 head
 body

 If found, please return.

 -- Sent from my Palm Prē
 
 Niko Schwarz wrote:

 I don't know why, but somehow this snippet executes document.observe
 fine. I just open another script tag and suddenly the world is good.

 But the issue with the scrolling drag and drop remains. This code
 snippet should be executable in a browser as is, from a file (I can
 attach it as a file if that's easier, or host it on a website):

 !DOCTYPE html
 html lang=en
 script src=http://www.google.com/jsapi;/script
 script
 google.load(prototype, 1.6.1.0);
 google.load(scriptaculous, 1.8.3);
 /script
 script
 document.observe('dom:loaded',function() {
 Sortable.create('fruit', {
 scroll: container
 });
 });

 /script

 titleTest/title
 div id=container style=overflow: scroll; width: 200px; height: 100px;
 ul id=fruit
 liApple
 liBanana
 liPeach
 liStrawberry
 liCherry
 liPear
 liOrange
 liMango
 /ul

 Cheers,

 Niko

 On Mon, Dec 7, 2009 at 7:15 PM, Niko Schwarz
 niko.schw...@googlemail.com wrote:
 Hi, I have this tiny script, and it fails in two ways. First, the
 document observe thing fails really strangely, saying:

 TypeError: Result of expression 'document.observe' [undefined] is not
 a function.

 The second error, after I create the sorter on the command line: You
 cannot drag and drop the lower elements of the list.

 Here's the script:

 !DOCTYPE html
 html lang=en
 script src=http://www.google.com/jsapi;/script
 script
   google.load(prototype, 1.6.1.0);
   google.load(scriptaculous, 1.8.3);

   document.observe(dom:loaded, function() {
     Sortable.create('fruit', {
    scroll: container
    });});

 /script

 titleTest/title
 div id=container style=overflow: scroll; width: 200px; height:
 100px;
 ul id=fruit
    liApple
    liBanana
    liPeach
    liStrawberry
    liCherry
    liPear
    liOrange
    liMango
 /ul


 So, what is your take?


 Cheers,

 Niko


 --
 http://scg.unibe.ch/staff/Schwarz
 twitter.com/nes1983
 Tel: +41 076 235 8683




 --
 http://scg.unibe.ch/staff/Schwarz
 twitter.com/nes1983
 Tel: +41 076 235 8683

 --

 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-scriptacul...@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.


 --

 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-scriptacul...@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.




-- 
http://scg.unibe.ch/staff/Schwarz
twitter.com/nes1983
Tel: +41 076 235 8683

--

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-scriptacul...@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.




Re: [Proto-Scripty] Re: document.observe and Sorter in scrolling li sts

2009-12-08 Thread Niko Schwarz
That is, the tags are, the elements are not. A title can only appear
in a head, that's why my document clearly has a head element – I don't
need to spell out the tag for that. And the head ends, and body
begins, with the first element that can only be found in body.

For example, validate this: http://snipt.net/nes1983/minimal-valid-html5/

In a HTML5 validator: http://html5.validator.nu/

It's valid. It saves space, no amount of confusion is caused by
dropping these tags, so I would argue that it's good practice, when
handcoding html, to drop the irrelevant things.

I just validated the snipped I'd sent, and I learned that I forgot
closing a div at the end of the snippet, otherwise it is valid. Here's
the snippet with the closing div, passes through an html5 validator:

!DOCTYPE html
html lang=en
script src=http://www.google.com/jsapi;/script
script
  google.load(prototype, 1.6.1.0);
  google.load(scriptaculous, 1.8.3);

  document.observe(dom:loaded, function() {
Sortable.create('fruit', {
   scroll: container
   });});

/script

titleTest/title
div id=container style=overflow: scroll; width: 200px; height: 100px;
ul id=fruit
   liApple
   liBanana
   liPeach
   liStrawberry
   liCherry
   liPear
   liOrange
   liMango
/ul
/div



Cheers,

Niko

On Tue, Dec 8, 2009 at 9:27 AM, Niko Schwarz
niko.schw...@googlemail.com wrote:
 I don't think so. head and body are both optional:

 http://dev.w3.org/html5/spec/Overview.html#optional-tags

 On Tue, Dec 8, 2009 at 1:24 AM, Rick Waldron waldron.r...@gmail.com wrote:
 Missing:

 head
 body

 If found, please return.

 -- Sent from my Palm Prē
 
 Niko Schwarz wrote:

 I don't know why, but somehow this snippet executes document.observe
 fine. I just open another script tag and suddenly the world is good.

 But the issue with the scrolling drag and drop remains. This code
 snippet should be executable in a browser as is, from a file (I can
 attach it as a file if that's easier, or host it on a website):

 !DOCTYPE html
 html lang=en
 script src=http://www.google.com/jsapi;/script
 script
 google.load(prototype, 1.6.1.0);
 google.load(scriptaculous, 1.8.3);
 /script
 script
 document.observe('dom:loaded',function() {
 Sortable.create('fruit', {
 scroll: container
 });
 });

 /script

 titleTest/title
 div id=container style=overflow: scroll; width: 200px; height: 100px;
 ul id=fruit
 liApple
 liBanana
 liPeach
 liStrawberry
 liCherry
 liPear
 liOrange
 liMango
 /ul

 Cheers,

 Niko

 On Mon, Dec 7, 2009 at 7:15 PM, Niko Schwarz
 niko.schw...@googlemail.com wrote:
 Hi, I have this tiny script, and it fails in two ways. First, the
 document observe thing fails really strangely, saying:

 TypeError: Result of expression 'document.observe' [undefined] is not
 a function.

 The second error, after I create the sorter on the command line: You
 cannot drag and drop the lower elements of the list.

 Here's the script:

 !DOCTYPE html
 html lang=en
 script src=http://www.google.com/jsapi;/script
 script
   google.load(prototype, 1.6.1.0);
   google.load(scriptaculous, 1.8.3);

   document.observe(dom:loaded, function() {
     Sortable.create('fruit', {
    scroll: container
    });});

 /script

 titleTest/title
 div id=container style=overflow: scroll; width: 200px; height:
 100px;
 ul id=fruit
    liApple
    liBanana
    liPeach
    liStrawberry
    liCherry
    liPear
    liOrange
    liMango
 /ul


 So, what is your take?


 Cheers,

 Niko


 --
 http://scg.unibe.ch/staff/Schwarz
 twitter.com/nes1983
 Tel: +41 076 235 8683




 --
 http://scg.unibe.ch/staff/Schwarz
 twitter.com/nes1983
 Tel: +41 076 235 8683

 --

 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-scriptacul...@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.


 --

 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-scriptacul...@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.




 --
 http://scg.unibe.ch/staff/Schwarz
 twitter.com/nes1983
 Tel: +41 076 235 8683




-- 
http://scg.unibe.ch/staff/Schwarz
twitter.com/nes1983
Tel: +41 076 235 8683

--

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-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 

[Proto-Scripty] Re: Delay or defer ajax requests

2009-12-08 Thread T.J. Crowder
Hi,

 Yes they do. I'm using Script.aculo.us but i have to start multiple
 animations (i.e. fadeouts) on multiple elements, so its a bit tricky
 to use the afterFinish functions because it would get called after
 every finish of every element.

Ah. I'm not a scripty-head, but I wonder if the Parallel effect would
help:
http://wiki.github.com/madrobby/scriptaculous/effect-parallel

 Rick Waldron waldron.r...@gmail.com wrote on 07.12.2009 15:10:19:

  I'm not at a computer to try this out, and well, it might be a
  little hair-brained but perhaps...

  ( new Ajax.Updater() ).defer();

 Nice idea. But it does not work :-/

Indeed not, all that does is create the Ajax.Updater object (which
starts the update) and then try to call a #defer function on the
returned Ajax.Updater instance -- which isn't a function and doesn't
have a #defer function.

I'm still not seeing why wrapping up the call in a function is a
problem. It seems like a simple and straightforward solution, if you
can't use an `afterFinish` callback (which is, of course, also a
function).

FWIW,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com

On Dec 7, 8:56 pm, David S. evil.zweitaus...@googlemail.com wrote:
 T.J. Crowder t...@crowdersoftware.com wrote on 12.07.2009 09:38:54
 AM:

  Hi,

  Your animations don't provide an `afterFinish` callback or similar?

 Yes they do. I'm using Script.aculo.us but i have to start multiple
 animations (i.e. fadeouts) on multiple elements, so its a bit tricky
 to use the afterFinish functions because it would get called after
 every finish of every element.

 Here's the piece of code:

 var teaser_select = function (t) {

  var t_id = t.identify();

  t.absolutize(); // Use before offset calculation!

  var moveby_y  = t.cumulativeOffset().top;

  moveby_y -= ($('mv_logo').cumulativeOffset().top + $
 ('mv_logo').getHeight());

  moveby_y *= -1;

  new Effect.Move(t,{ duration: 0.5, x: 0, y: moveby_y, mode:
 'relative' });

  // Fade out all teasers from bottom to top

  $$('.teaser').reverse().each(function (teaser) {

   if (teaser.identify() == t_id) return;

   teaser.fade({ duration: 0.5, from: 1, to: 0 });

  });

  // TODO:

  // Call ajax after all teasers have been hidden

 }

 Maybe there's a simpler way to fade out more than one element at once
 and the each(...)-iteration becomes needless. Or its possible to call
 one function after many effects have been finished.

 But how?

 Rick Waldron waldron.r...@gmail.com wrote on 07.12.2009 15:10:19:

  I'm not at a computer to try this out, and well, it might be a
  little hair-brained but perhaps...

  ( new Ajax.Updater() ).defer();

 Nice idea. But it does not work :-/

 David.

--

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-scriptacul...@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: Custom signal

2009-12-08 Thread T.J. Crowder
Hi,

 You suggested to use:

 a = []

 instead of:

 a = new Array()

 What is the difference?

It's shorter and does exactly the same thing. Similarly, `{}` is the
same as `new Object()`.

-- T.J. :-)

On Dec 7, 9:43 pm, Frédéric f...@gbiloba.org wrote:
 On lundi 07 décembre 2009, Tobie Langel wrote:

  A couple suggestions:

 https://gist.github.com/bb3d40f6915118da4dec

 Thanks!

 You suggested to use:

     a = []

 instead of:

     a = new Array()

 What is the difference?

 PS: about the try/catch, in my real code, I log the error on Firebug
 console...

 --
     Frédéric

--

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-scriptacul...@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 using invoke()

2009-12-08 Thread T.J. Crowder
Hi,

 this._navButtons = [this._view.prevButton,
 this._view.nextButton,
 this._view.hideButton);

I assume in your real code, that ends with `]`, not with `)` as above?
As above, it's a syntax error.

 this._navButtons.invoke(_opacity, {'from': 0,
  'to': 1,
  'duration':1});

Do your button instances have a function called `_opacity` (with the
underscore)? I'm not a scripty-head and maybe I shouldn't be posting,
but the effect is called Effect.Opacity, and usually when scripty
mixes effects in as element methods, it's the name of the effect with
an initial lower case letter, so wouldn't that just be `opacity`?

FWIW,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com


On Dec 7, 9:44 pm, Frédéric f...@gbiloba.org wrote:
 Hi,

 I build an array with some DOM elements, and try to apply effects on them
 using invoke(). But it does not work.

 Ie may be a problem with function defined as pesudo-methods, but I don't
 get any usefull error neither in Firebug, nor in IE debugger.

 As I want to use Effect.Opacity(), I wrote a pure function as:

 function _opacity(el, args) {
     new Effect.Opacity(el, args);

 }

 then in my class:

 this._navButtons = [this._view.prevButton,
                     this._view.nextButton,
                     this._view.hideButton);
 this._navButtons.invoke(_opacity, {'from': 0,
                                      'to': 1,
                                      'duration':1});

 In Firebug, I get:

 reference to undefined property this[arguments[0]]
 [Break on this error]

 without any traceback or code line. In IE, I get:

 'undefined' a la valeur null ou n'est pas un objet
 ('undefined' as null value or is not an object)

 at line 713 of prototype.js; it is the call to my method:

     return value[method].apply(value, args);

 What I did wrong? Is it a problem with this context?

 --
     Frédéric

--

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-scriptacul...@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: Element.update() without evaluating the script.

2009-12-08 Thread T.J. Crowder
JoJo,

 $('foo').update('script . ' + this.someVariable + '/);

You're inserting a script tag, which means the code should be
evaluated. Don't you want to use a code or pre tag instead? Or do
you want the text script... to actually show up?

Just think in terms of how you would do this if you were just writing
a boring old HTML page. For instance, if you actually want the
characters script . to show up in the rendered page, how would
you do that? That's right, lt;script .

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com


On Dec 7, 10:52 pm, JoJo tokyot...@gmail.com wrote:
 I have a textarea id=foo which contains JS code that people can
 copy and paste. It's dynamically generated, so I do something like
 this:

 $('foo').update('script . ' + this.someVariable + '/);

 The documentation on Element.update states that the script will be
 evaluated rather than inserted literally. It does not tell me how to
 stop the evaluation. How may I do this?

--

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-scriptacul...@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.




Re: [Proto-Scripty] Re: Problem using invoke()

2009-12-08 Thread Frédéric
Le mardi 8 décembre 2009 10:07, T.J. Crowder a écrit :

 I assume in your real code, that ends with `]`, not with `)` as above?
 As above, it's a syntax error.

  this._navButtons.invoke(_opacity, {'from': 0,
   'to': 1,
   'duration':1});

Oh, yes, my real code is correct...

 Do your button instances have a function called `_opacity` (with the
 underscore)? I'm not a scripty-head and maybe I shouldn't be posting,
 but the effect is called Effect.Opacity, and usually when scripty
 mixes effects in as element methods, it's the name of the effect with
 an initial lower case letter, so wouldn't that just be `opacity`?

Ok, I see the problem: here, _opacity() is a global function, not a 
this._navButtons element method...

I want to use the Effect.Opacity effect; what is the best way to implement 
this? Should I bind my _opacity() function to the buttons, using methodize?

-- 
   Frédéric

--

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-scriptacul...@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.




Re: [Proto-Scripty] Re: Problem using invoke()

2009-12-08 Thread Frédéric
Le mardi 8 décembre 2009 10:36, T.J. Crowder a écrit :

 First check that scripty hasn't already done that (without the
 underscore). Scripty methodizes effects (at least sometimes, I don't
 know the details), so that (for instance) Effect.Fade can be used as a
 #fade method on element instances.

It does not seem to be the case with the Opacity effect..

 If you want to call a global function on each entry in an array,
 that's easy:

     this._navButtons.each(function(item) {
         _opacity(item, ...);
     });

The problem is to give additionnal params (for Effect.Oppacity); it does not 
seem to be possible with each(). That's why I tried invoke()...

 You might consider the Effect.Parallel effect, though, if you're
 looking to do effects in parallel:
 http://wiki.github.com/madrobby/scriptaculous/effect-parallel

I only need 1 effect on several elements. I also tried Effect.multiple, but 
the effect is not synchronized on all objects. Neither with a simple loop, 
but the delay is very small in this last case (I can't see it)...

-- 
   Frédéric

--

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-scriptacul...@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] Check a mouse button

2009-12-08 Thread Frédéric
Hi,

Is there a way to check if a mouse button is pressed in an 
Event.observe('mousemove') callback ?

Thanks,

-- 
   Frédéric

--

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-scriptacul...@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.




Re: [Proto-Scripty] Check a mouse button

2009-12-08 Thread Alex McAuley
...observe('mousemove',function(e) {

$('SomeElement').observe('click',function() {
doSomethingWIthyourClick();

});
});
Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: Frédéric f...@gbiloba.org
To: prototype-scriptaculous@googlegroups.com
Sent: Tuesday, December 08, 2009 1:15 PM
Subject: [Proto-Scripty] Check a mouse button


Hi,

Is there a way to check if a mouse button is pressed in an
Event.observe('mousemove') callback ?

Thanks,

-- 
   Frédéric

--

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-scriptacul...@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.



--

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-scriptacul...@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.




Re: [Proto-Scripty] Check a mouse button

2009-12-08 Thread Frédéric
Le mardi 8 décembre 2009 13:54, Alex McAuley a écrit :

 ...observe('mousemove',function(e) {

 $('SomeElement').observe('click',function() {
     doSomethingWIthyourClick();

Ok, so I have to register both events...

Thanks :o)

-- 
   Frédéric

--

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-scriptacul...@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.




Re: [Proto-Scripty] Re: document.observe and Sorter in scrolling li sts

2009-12-08 Thread Niko Schwarz
Alright, if it makes you any happier:

!DOCTYPE html
html lang=en
head
script src=http://www.google.com/jsapi;/script
script
 google.load(prototype, 1.6.1.0);
 google.load(scriptaculous, 1.8.3);

 document.observe(dom:loaded, function() {
   Sortable.create('fruit', {
  scroll: container
  });});

/script

titleTest/title
/headbody
div id=container style=overflow: scroll; width: 200px; height: 100px;
ul id=fruit
  liApple
  liBanana
  liPeach
  liStrawberry
  liCherry
  liPear
  liOrange
  liMango
/ul
/div
/body


So, what should I do?
On Tue, Dec 8, 2009 at 9:36 AM, Niko Schwarz
niko.schw...@googlemail.com wrote:
 That is, the tags are, the elements are not. A title can only appear
 in a head, that's why my document clearly has a head element – I don't
 need to spell out the tag for that. And the head ends, and body
 begins, with the first element that can only be found in body.

 For example, validate this: http://snipt.net/nes1983/minimal-valid-html5/

 In a HTML5 validator: http://html5.validator.nu/

 It's valid. It saves space, no amount of confusion is caused by
 dropping these tags, so I would argue that it's good practice, when
 handcoding html, to drop the irrelevant things.

 I just validated the snipped I'd sent, and I learned that I forgot
 closing a div at the end of the snippet, otherwise it is valid. Here's
 the snippet with the closing div, passes through an html5 validator:

 !DOCTYPE html
 html lang=en
 script src=http://www.google.com/jsapi;/script
 script
  google.load(prototype, 1.6.1.0);
  google.load(scriptaculous, 1.8.3);

  document.observe(dom:loaded, function() {
    Sortable.create('fruit', {
   scroll: container
   });});

 /script

 titleTest/title
 div id=container style=overflow: scroll; width: 200px; height: 100px;
 ul id=fruit
   liApple
   liBanana
   liPeach
   liStrawberry
   liCherry
   liPear
   liOrange
   liMango
 /ul
 /div



 Cheers,

 Niko

 On Tue, Dec 8, 2009 at 9:27 AM, Niko Schwarz
 niko.schw...@googlemail.com wrote:
 I don't think so. head and body are both optional:

 http://dev.w3.org/html5/spec/Overview.html#optional-tags

 On Tue, Dec 8, 2009 at 1:24 AM, Rick Waldron waldron.r...@gmail.com wrote:
 Missing:

 head
 body

 If found, please return.

 -- Sent from my Palm Prē
 
 Niko Schwarz wrote:

 I don't know why, but somehow this snippet executes document.observe
 fine. I just open another script tag and suddenly the world is good.

 But the issue with the scrolling drag and drop remains. This code
 snippet should be executable in a browser as is, from a file (I can
 attach it as a file if that's easier, or host it on a website):

 !DOCTYPE html
 html lang=en
 script src=http://www.google.com/jsapi;/script
 script
 google.load(prototype, 1.6.1.0);
 google.load(scriptaculous, 1.8.3);
 /script
 script
 document.observe('dom:loaded',function() {
 Sortable.create('fruit', {
 scroll: container
 });
 });

 /script

 titleTest/title
 div id=container style=overflow: scroll; width: 200px; height: 100px;
 ul id=fruit
 liApple
 liBanana
 liPeach
 liStrawberry
 liCherry
 liPear
 liOrange
 liMango
 /ul

 Cheers,

 Niko

 On Mon, Dec 7, 2009 at 7:15 PM, Niko Schwarz
 niko.schw...@googlemail.com wrote:
 Hi, I have this tiny script, and it fails in two ways. First, the
 document observe thing fails really strangely, saying:

 TypeError: Result of expression 'document.observe' [undefined] is not
 a function.

 The second error, after I create the sorter on the command line: You
 cannot drag and drop the lower elements of the list.

 Here's the script:

 !DOCTYPE html
 html lang=en
 script src=http://www.google.com/jsapi;/script
 script
   google.load(prototype, 1.6.1.0);
   google.load(scriptaculous, 1.8.3);

   document.observe(dom:loaded, function() {
     Sortable.create('fruit', {
    scroll: container
    });});

 /script

 titleTest/title
 div id=container style=overflow: scroll; width: 200px; height:
 100px;
 ul id=fruit
    liApple
    liBanana
    liPeach
    liStrawberry
    liCherry
    liPear
    liOrange
    liMango
 /ul


 So, what is your take?


 Cheers,

 Niko


 --
 http://scg.unibe.ch/staff/Schwarz
 twitter.com/nes1983
 Tel: +41 076 235 8683




 --
 http://scg.unibe.ch/staff/Schwarz
 twitter.com/nes1983
 Tel: +41 076 235 8683

 --

 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-scriptacul...@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.


 --

 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-scriptacul...@googlegroups.com.
 To unsubscribe from this group, send email to
 prototype-scriptaculous+unsubscr...@googlegroups.com.
 

[Proto-Scripty] Re: Problem using invoke()

2009-12-08 Thread T.J. Crowder
Hi,

  this._navButtons.each(function(item) {
  _opacity(item, ...);
  });

 The problem is to give additionnal params (for Effect.Oppacity); it does not
 seem to be possible with each(). That's why I tried invoke()...

Look again at my example. You'd fill in the ... with the parameters.

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com


On Dec 8, 11:23 am, Frédéric f...@gbiloba.org wrote:
 Le mardi 8 décembre 2009 10:36, T.J. Crowder a écrit :

  First check that scripty hasn't already done that (without the
  underscore). Scripty methodizes effects (at least sometimes, I don't
  know the details), so that (for instance) Effect.Fade can be used as a
  #fade method on element instances.

 It does not seem to be the case with the Opacity effect..

  If you want to call a global function on each entry in an array,
  that's easy:

      this._navButtons.each(function(item) {
          _opacity(item, ...);
      });

 The problem is to give additionnal params (for Effect.Oppacity); it does not
 seem to be possible with each(). That's why I tried invoke()...

  You might consider the Effect.Parallel effect, though, if you're
  looking to do effects in parallel:
 http://wiki.github.com/madrobby/scriptaculous/effect-parallel

 I only need 1 effect on several elements. I also tried Effect.multiple, but
 the effect is not synchronized on all objects. Neither with a simple loop,
 but the delay is very small in this last case (I can't see it)...

 --
    Frédéric

--

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-scriptacul...@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] Custom events with iframes

2009-12-08 Thread Sumit
Hi,

I've certain iframes loaded on my page (same domain) and i want to
fire custom events from one of them to the other for which those
iframes are already listening. Somehow the following implementation
doesn't work (sadly the firebug console doesn't show anything):

In the iframe A, i'm doing-
document.observe(message, function(e){
console.log(11+e);
});

In the iframe B (same as domain A), i'm doing-
Event.fire(parent.frames[frame11],message,frame12, true);

Any idea what i might be doing wrong?
Thanks in advance.
-Sumit

--

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-scriptacul...@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: Element initialisation

2009-12-08 Thread david
Hi speedpacket,

 First of all thanks for taking the time to trying to understand me ;)
 Basically what I'm trying to do is the following.

I think this forum is done for that :))

 Whenever I want to add special behaviour to elements on the form, I
 add classes to the element, or add (I know this isn't compliant, but I
 have yet to find a better way) custom attributes, for instance:

 input type=text name=nameID id=nameID value=blablabla
 validation={required}/

I see at least two better way:
first use the new prototype Element.storage, so you should keep
outside the DOM the private information.
But as you'll have to walk through the DOM after to reach each element
and find if some attribute is set,
I definitelly think to the second solution: Use an object where you'll
store each private property for each element.
Depending on how you'll walk the DOM, it could be something like:

var myProperty={
  'formName_1':{
'elementId_1':'set your parameter here in an object, array, ...
depending on what kind of property you'll need',
'elementId_2':'..'
  }
}

So that you'll have no more to walk through the DOM, but just have tio
iterate on myProperety object.



 I attached an elementInitialisation() function to the onload of the
 document.
 Once the document loaded, I have one function that does the
 initialisation on the element.

 I would loop over all elements that require initialisation in some
 way, and call the initialiseElemen(el) method.
 In that element, I do all checks (does the element need validation
 added, does it require extra behaviour, ...) and I modify the element
 adding the desired behaviour.  This works fantastically...

so this part is OK :))
my contribution is just a way to do this !


 Unfortunately however, I also update the contents of my page using
 ajax on several occasions which might also add elements to the
 document that would require initialisation.  These elements would need
 to be going through the initialiseElement(el) function as well...

In this condition, it could be hard to maintain to use the same object
to store original element and the one added with AJAX.
But if you modify a little bit your initialiseElement(el) function to
initialiseElement(OBJECT), than your first call will pass the original
object that could create some other DOM element and each onComplete
callback of the AJAX request will call the initialiseElement()
function with a newly created object only containing element that were
created inside each AJAX request.

this could be a way to do what you'll need. What do you think ?

--
david

 On Dec 7, 1:06 pm, david david.brill...@gmail.com wrote:

  Hi speedpacket,

   Is there a way to observe the dom and automatically run newly created
   elements through the initialise function?

  could you please explain a little more what is expected !
  Or perhaps if you have some available code ?

  --
  david

  On 4 déc, 13:19, speedpac...@gmail.com speedpac...@gmail.com
  wrote:

   Hello there,

   I have another question that I hope someone can give me some insight
   too...
   As I want all javascript code to be in a seperate file, I wrote a
   function initialiseElements which literally takes an element and
   initialises its behaviour based upon some attributes (classname for
   instance).

   Basically it takes the elemen, checks whether el.readAttribute
   (isInitialised) == false, and in that case processes the element
   (adding tooltips for action images, adding onclick behaviour,
   onmouseover behaviour, add validators to inputs and so on...)
   When processed we set el.writeAttribute(isInitialised) = true so
   that it will only process one element a single time...

   I found this way of working to be going great, and I basically call
   the initialiseElement method for each element upon loading the form,
   making it a very generic process...

   However (yes, there is a but!!!), I do have an issue of course when I
   cal some ajax to update the content; in that case I need to initialise
   the elements that have been added...

   Is there a way to observe the dom and automatically run newly created
   elements through the initialise function?

   Would this be a good approach?
   How do you guys deal with stuff like this?

   thanks so much in advance again for your much appreciated feedback.

--

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-scriptacul...@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: document.write() vs Element/appendChild()

2009-12-08 Thread david
Hi all,

 I was under the impression that it would not actually be added to the DOM
 when using innerhtml. And it therefore cannot be manipulated as a DOM
 element.


In fact, it's faster than any JS implementation, prototype or other.
Browser are optimize to parse HTML string in an unbeatable way !

And of course it could be manipulate as a DOM element, but you'll have
first to retrieve it from DOM using $() or $$().

--
david

--

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-scriptacul...@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: Custom events with iframes

2009-12-08 Thread david
Hi sumit,

Just a though, I didn't test it.
you don't use custom event it has the form namespace:eventName.

What you could do ?? is to define in frame A:
document.observe(FrameB:message, function(e){
console.log(11+e);
});

And send from Frame B:
Event.fire(document,'FrameB:message','message to send',true);

It could work, but my question is about frame and crossdomain ??

--
david

On 8 déc, 20:31, Sumit skbrnwl-...@yahoo.com wrote:
 Hi,

 I've certain iframes loaded on my page (same domain) and i want to
 fire custom events from one of them to the other for which those
 iframes are already listening. Somehow the following implementation
 doesn't work (sadly the firebug console doesn't show anything):

 In the iframe A, i'm doing-
 document.observe(message, function(e){
         console.log(11+e);

 });

 In the iframe B (same as domain A), i'm doing-
 Event.fire(parent.frames[frame11],message,frame12, true);

 Any idea what i might be doing wrong?
 Thanks in advance.
 -Sumit

--

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-scriptacul...@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: Solving IE and onResize

2009-12-08 Thread david
Hi Rob,

in fact there is two different trouble:
first you'll set the onresize event to many element == think using
event delegation !
next, the onresize event in FF for exemple is send one the mouse have
stop mouving (even if the event is not finished yet, means you did not
release the mouse button) BUT in IE, the onresize event is submit
every time the mouse is mouving, like the mousemove event :((

So use event delegation and in IE set a sorte of timeout to wait a
certain time before recalculate this event !

--
david

On 8 déc, 19:03, Rob Cluett rob.clu...@gmail.com wrote:
 I'm posting this here because with all of the element resizing I am
 doing with prototype I am running into the IE bug where onResize is
 fired on all elements when the IE browser window is resized.  It
 basically brings my application to a halt.  Is there anything within
 prototype that corrects this behavior in IE or is there an adequate
 workaround that anyone came up with?

 My apologies if this is deemed off-topic.

--

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-scriptacul...@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: Solving IE and onResize

2009-12-08 Thread Rob Cluett
Thank you.  Based on your response I'm doing the below.  Simply
setting and then clearing a timer if the onResize event is fired
before the timer expires.  For those following this method be aware
that client.isIE is particular to my code and merely test if the
users browser is in fact IE.

If for more than a 1/2 second the onResize event does not occur it
will run the setSize method which adjusts all the elements in the
viewport.  If the browser is resized before the timeout then the
timeout resets.  It does work well. Not perfect but does adjust
without blocking the browser.  I think it could benefit from a mask of
sorts so the user does not have to watch the elements obscure for that
1/2 second.  The completion of the setSize method does take some time
to complete.  1-2 seconds but my thinking is that this is due to IE's
slow DOM :)

setSizeWrapper : function()
{
   if (client.isIE)
   {
  clearTimeout(dashboard.ieresizeTimer);
  dashboard.ieresizeTimer = setTimeout(dashboard.setSize(),
500);
   }
}

On Dec 8, 4:41 pm, david david.brill...@gmail.com wrote:
 Hi Rob,

 in fact there is two different trouble:
 first you'll set the onresize event to many element == think using
 event delegation !
 next, the onresize event in FF for exemple is send one the mouse have
 stop mouving (even if the event is not finished yet, means you did not
 release the mouse button) BUT in IE, the onresize event is submit
 every time the mouse is mouving, like the mousemove event :((

 So use event delegation and in IE set a sorte of timeout to wait a
 certain time before recalculate this event !

 --
 david

 On 8 déc, 19:03, Rob Cluett rob.clu...@gmail.com wrote:



  I'm posting this here because with all of the element resizing I am
  doing with prototype I am running into the IE bug where onResize is
  fired on all elements when the IE browser window is resized.  It
  basically brings my application to a halt.  Is there anything within
  prototype that corrects this behavior in IE or is there an adequate
  workaround that anyone came up with?

  My apologies if this is deemed off-topic.- Hide quoted text -

 - Show quoted text -

--

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-scriptacul...@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: Custom events with iframes

2009-12-08 Thread Sumit
I think i'm having issues with the loading sequence of the javascripts
and these iframes. Will report more details once i'm done fixing the
issue.

Thanks for your response, David!
-Sumit

On Dec 9, 2:36 am, david david.brill...@gmail.com wrote:
 Hi sumit,

 Just a though, I didn't test it.
 you don't use custom event it has the form namespace:eventName.

 What you could do ?? is to define in frame A:
 document.observe(FrameB:message, function(e){
         console.log(11+e);

 });

 And send from Frame B:
 Event.fire(document,'FrameB:message','message to send',true);

 It could work, but my question is about frame and crossdomain ??

 --
 david

 On 8 déc, 20:31, Sumit skbrnwl-...@yahoo.com wrote:

  Hi,

  I've certain iframes loaded on my page (same domain) and i want to
  fire custom events from one of them to the other for which those
  iframes are already listening. Somehow the following implementation
  doesn't work (sadly the firebug console doesn't show anything):

  In the iframe A, i'm doing-
  document.observe(message, function(e){
          console.log(11+e);

  });

  In the iframe B (same as domain A), i'm doing-
  Event.fire(parent.frames[frame11],message,frame12, true);

  Any idea what i might be doing wrong?
  Thanks in advance.
  -Sumit

--

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-scriptacul...@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.