[Proto-Scripty] Re: Can I change what new [someClass] will return?

2010-12-17 Thread Luke
Hi Richard, thanks for your reply. With The return is something I've been using since May 2008 with all the releases and updates since then. Do you mean you have used the native prototype-return, or did you alter it, and it still worked? On Dec 16, 6:04 pm, Richard Quadling

[Proto-Scripty] Re: Is there a way to get the name of a class from within the class?

2010-12-17 Thread Luke
I take that as a no? On Dec 16, 6:02 pm, bernard bernard.christophe...@gmail.com wrote: I truly wish some people would take the trouble to buy a javascript book instead of off-topic-posting in this group... meh. b. Intellectual honesty consists in taking ideas seriously. To take ideas

Re: [Proto-Scripty] Re: Can I change what new [someClass] will return?

2010-12-17 Thread Richard Quadling
On 17 December 2010 08:32, Luke kickingje...@gmail.com wrote: Hi Richard, thanks for your reply. With The return is something I've been using since May 2008 with all the releases and updates since then. Do you mean you have used the native prototype-return, or did you alter it, and it

[Proto-Scripty] Re: Can I change what new [someClass] will return?

2010-12-17 Thread Luke
Sounds good. Can you post a link to your source (if you want to share it and have it on github or something)? On Dec 17, 11:08 am, Richard Quadling rquadl...@gmail.com wrote: On 17 December 2010 08:32, Luke kickingje...@gmail.com wrote: Hi Richard, thanks for your reply. With The

Re: [Proto-Scripty] Re: Can I change what new [someClass] will return?

2010-12-17 Thread Richard Quadling
On 17 December 2010 08:32, Luke kickingje...@gmail.com wrote: Hi Richard, thanks for your reply. With The return is something I've been using since May 2008 with all the releases and updates since then. Do you mean you have used the native prototype-return, or did you alter it, and it

Re: [Proto-Scripty] Re: Can I change what new [someClass] will return?

2010-12-17 Thread Richard Quadling
On 17 December 2010 10:14, Luke kickingje...@gmail.com wrote: Sounds good. Can you post a link to your source (if you want to share it and have it on github or something)? I don't use github. I simply build prototype and then add my patch. I don't have any unit tests for this either, but my

[Proto-Scripty] Re: Can I change what new [someClass] will return?

2010-12-17 Thread Luke
Ok, that works great. Thank you Richard! On Dec 17, 11:17 am, Richard Quadling rquadl...@gmail.com wrote: On 17 December 2010 10:14, Luke kickingje...@gmail.com wrote: Sounds good. Can you post a link to your source (if you want to share it and have it on github or something)? I don't use

[Proto-Scripty] problem with drag and drop in sortable create

2010-12-17 Thread Rickynet
HI to all, firts, gretings, second excuse my english, i'm spanish native talker, go to thye point i have a page with severals divs with images that are created dynamic, what i need i that when the last div is created (lets name newdiv), i can drag and drop from all the divs existing in the page

[Proto-Scripty] Class.create() and Object.clone() and methods

2010-12-17 Thread thomas.boer...@googlemail.com
HI! When I create a class with Class.create() and add some methods like this: var Database = Class.create({ initialize: function() { this.name = ; }, setName: function(name) { this.name = name; }, }); Are the methods on the class level, as if I had declared them with

[Proto-Scripty] Re: Class.create() and Object.clone() and methods

2010-12-17 Thread T.J. Crowder
Hi, Are the methods on the class level, as if I had declared them with Database.prototype.methodName? Well, at the prototype level, yes. (class level gets to be ambiguous, since class methods in many languages are meant to be ones that are on the *class*, not instances of it; e.g., like

[Proto-Scripty] Re: Is there a way to get the name of a class from within the class?

2010-12-17 Thread T.J. Crowder
Hi, Yes or no, depending on what you mean. You can access the `MyCoolClass` variable inside your code, of course, as it's defined in the scope that contains the functions you've passed into `Class.create`. But I'm thinking that's not what you mean. You can't get the string MyCoolClass, if

[Proto-Scripty] Re: Is there a way to get the name of a class from within the class?

2010-12-17 Thread T.J. Crowder
Bernard, 1. No need to be offensive. If you think a question is beneath you, by all means ignore it rather than moaning into everyone's mailbox. 2. This question is almost certainly about Prototype's `Class` feature, not JavaScript. Yes, if you know JavaScript well you automatically know the

[Proto-Scripty] Re: Is there a way to get the name of a class from within the class?

2010-12-17 Thread Luke
Ok, thanks T.J., I really wanted to get the name of the Class as a string. The reason is this: I'm working on a project that lets you create really simple webpages by adding, editing and removing objects (images, text, ..) to your page. To structure my code I do 2 things: 1.) I create classes

[Proto-Scripty] Re: Is there a way to get the name of a class from within the class?

2010-12-17 Thread T.J. Crowder
Hi, Another option is to give the classes that you're using in this way a unique ID: * * * * (function() { var uniqueClassIDAllocator = 0; Class.createSpecial = Class_createSpecial; function Class_createSpecial() { var clz = Class.create.apply(Class, arguments);

[Proto-Scripty] Re: Is there a way to get the name of a class from within the class?

2010-12-17 Thread Luke
Hmm, that actually is a really good Idea. I already use my own Class.create-method as discussed here http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/b7f516a73fb4113a , so adding a unique id to this wouldn't be much of an effort. Thanks again! :) On Dec 17, 6:43 pm,

[Proto-Scripty] Re: PeriodicalExecuter counter

2010-12-17 Thread T.J. Crowder
Hi, You *can* use PeriodicalExecutor for this. I'm not sure it buys you much: function loopThroughArray(array, interval, callback) { var index = 0; setTimeout(process, interval); function process() { var rv; if (index array.length) { try {