[Proto-Scripty] Re: Should be simple - using up() with css class

2010-08-17 Thread Fabien Ménager
up() looks for a matching ancester in the DOM, not a sibling (brother)
that was before it in the DOM.
I think this will work :

$('part-47').up().down('tr.sd_type').id

On 17 août, 22:47, Rhiq ndba...@gmail.com wrote:
 I obviously don't get the way up() works.  Using the generated HTML
 below:

 tr class=sd_type ChildOfClass10 ChildOfCat8 open id=type-18
    td class=sd_typeType: Test Type/td
    td
       a href=# onclick=renameType(18)Rename/a |
       a href=# onclick=addPart(18)Add Part/a |
       In Use (3)
    /td
 /tr
 tr id=part-43 class=sd_part ChildOfType18 ChildOfClass10
 ChildOfCat8
    td class=sd_partPart: dfgdfg (0)/td
    td
       a href=# onclick=renamePart(43)Rename/a |
       a href=# onclick=removePart(43)Remove/a
    /td
 /tr
 tr id=part-46 class=sd_part ChildOfType18 ChildOfClass10
 ChildOfCat8
    td class=sd_partPart: sdfgs (0)/td
    td
       a href=# onclick=renamePart(46)Rename/a |
       a href=# onclick=removePart(46)Remove/a
    /td
 /tr
 tr id=part-47 class=sd_part ChildOfType18 ChildOfClass10
 ChildOfCat8
    td class=sd_partPart: fdsgre (0)/td
    td
       a href=# onclick=renamePart(47)Rename/a |
       a href=# onclick=removePart(47)Remove/a
    /td
 /tr

 If I try the following:
 alert($('part-47').up('tr.sd_type').id) I get an error saying that it
 is undefined.

 Does it make sense to anyone what I am trying to do?  Is there a way
 for me to do what I would like?

 I am trying to make changes to the first tr with the class sd_type
 above the current tr (in this case tr#part-47).

 Any help would be awesome.
 Nathan

-- 
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: Ajax request on anchor onclick is buggy in Safari

2010-08-10 Thread Fabien Ménager
Your method seems really random. You should proceed differently.
Imagine the user has JS disabled, it's click won't be logged, you
should use a server side script that will log the click and redirect
the user to the desired file : href=dispatcher.php?file=program.exe
If you don't have access to the server of can't modify the links, so
you should do like this, but keep in mind that's not the best way to
do this:

add a className to the link you want to log, say log and then make a
little DOM processing to change the link's behavior to log the click,
wait for the log action and then follow the link:

a class=log href=program.exedownload/a
 script type=text/javascript
document.observe(dom:loaded, function(){
  $$(a.log).each(function(e){
e.observe(click, function(event){
new Ajax.Request('/logger.php?action=1', {
   onSuccess: function(transport) {
  location.href=e.href;
   }
};
Event.stop(event);
  );
});
  });
});
/script
On 11 août, 00:34, JoJo tokyot...@gmail.com wrote:
 I'm collecting stats on user clicking behavior. In this example, I
 write an entry into the database whenever someone clicks a link that
 starts a download:

 a href=program.exe onclick=logClick()download program/a

 function logClick() {
    new Ajax.Request(
       '/logger.php?action=1'
    );

 }

 This works great in Internet Explorer and Firefox. In Firefox, my
 Firebug highlights the request in red as if it's an error. Anyway, I
 see my database being updated, so I'm not too worried. What I'm
 worried about is this fails to work in Safari 4. The only way I can
 get it to work is:

 function logClick() {
    new Ajax.Request(
       '/logger.php?action=1', {
          onSuccess: function(transport) {
             alert(transport.responseText);
          }
       }
    );

 }

 For some reason, this causes the database to be written to.
 Transport.responseText is blank for unknown reasons. How do I get this
 to work without the alert? The alert degrades the user experience.

-- 
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: is 1.6.1 backwards compatible?

2010-07-19 Thread Fabien Ménager
We switched recently from 1.6.0.3 to 1.6.1 in a quite big web
application (350,000 lines) which uses Prototype and Scriptaculous
intensively and we didn't have any problem except a few ones related
to extensions we did in the Element object.
However, I still recommend you to have a quick look at the changelog,
this is what I did when I did this, and this is not as long as it
seems.

On Jul 19, 4:52 am, Daniel Wong allyourc...@gmail.com wrote:
 Hi,

 I want to upgrade  1.6.0.3 - 1.6.1 (another library I want to use
 requires the newer version), but I don't want the rest of my site to
 break. Is there anything I should be concerned about in terms of
 making the switch? Or is 1.6.1 backwards compatible with 1.6.0.3?

 Daniel

 PS: I know there is a change log, but

   1. the list of changes is pretty long
   2. most of them seem to be bug fixes, which
     a. aren't really relevant to my question, unless you were
 depending on the old buggy behavior
     b. don't make sense to me, probably because I'm not familiar with
 the bugs they address

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