[Proto-Scripty] Re: Array.without() problem
Use delete history[index]; If you're trying to remove elements from a history array (not an object), you probably want history.splice(index,1), or your indexes are going to be all out of whack. Using splice will cause your history array to have a length of n-1 (which is what you're probably after), whereas the delete will cause the array to have length n with an undefined value at your index. If history is an object, then the delete will work fine. -- Jerod Venema Frozen Mountain Software http://www.frozenmountain.com/ 919-368-5105 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Possible incompatibility with JSON library?
Not sure about the bug, but is there a reason you can't use the prototype JSON methods? On Sun, Jan 25, 2009 at 7:30 PM, nlloyds nllo...@gmail.com wrote: I'm using this code: script src=http://www.json.org/json2.js;/script script runat=server src=https://ajax.googleapis.com/ajax/libs/ prototype/1.6.0.3/prototype.jshttps://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js /script script runat=server document.write(JSON.stringify([])); /script Which will output null with the Prototype script tag. If that tag is removed, the output is [], as I had expected. I believe the JSON library checks for at toJSON property on objects, which doesn't normally exist for Array, but does after Prototype.js augments them. Any ideas? Thanks, Nathan -- Jerod Venema Frozen Mountain Software http://www.frozenmountain.com/ 919-368-5105 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Opera and $$('.wrapper .class') seems not to work correctly
Hey all, when you're replying to these threads, can you make sure you keep it on-list? I like to keep up with various solutions to all these problems, and seeing half the solution (or no solution at all) is really frustrating. (@Kangax, I know I've seen a few replies to messages you've sent off-list, and since I know you've got good replies, I'd love it if they'd stay on the list. :-D) Thanks! On Tue, Jan 13, 2009 at 12:58 PM, T.J. Crowder t...@crowdersoftware.comwrote: I usually try to eliminate as much of irrelevant prototypeism as possible when creating a testcase : ) Fair 'nuff, but I'd still use something other than inline to allow for browsers being difficult about the closing body tag and DOM rendering time. Probably me being paranoid. Perhaps (shock and horror) DOM0 window.onload stuff, image loading not being an issue: script type='text/javascript' window.onload = function() { alert('Found ' + $$('.wrapper .inner').length); }); /script at the time when body is definitely loaded and parsed. Is it, definitely? Within the tag? (Serious question, you know more about this stuff than I do.) -- T.J. ;-) On Jan 13, 2:17 pm, kangax kan...@gmail.com wrote: On Jan 13, 8:30 am, T.J. Crowder t...@crowdersoftware.com wrote: Hi Juriy, That inline script could muddy the water in terms of DOM availability, etc. Perhaps a minor mod: I usually try to eliminate as much of irrelevant prototypeism as possible when creating a testcase : ) Why use dom:loaded (which is also known to be unreliable in IE in its current implementation) when we can simply run script at the time when body is definitely loaded and parsed. [...] -- kangax -- Jerod Venema Frozen Mountain Software http://www.frozenmountain.com/ 919-368-5105 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Inheritance question
If you're trying to avoid the default behaviour for the label (which is to check/uncheck the appropriate form element), you may want to just use prototypes stop [1] function. I've never done this, but something like the following ought to work (I think): Event.observe('mylabel', 'click', function(evt){ Event.stop(evt); }); You'll probably want a $$('label') call instead of 'mylabel', but you get the idea. [1] http://www.prototypejs.org/api/event/stop On Tue, Jan 13, 2009 at 9:31 AM, Cyrus arianglan...@googlemail.com wrote: Ok, thanks. Let me describe my actual problem: I have a list with labels and checkboxes: ul id=list lilabelinput type=checkbox / My first checkbox/label/li lilabelinput type=checkbox / My second checkbox/label/li ... /ul I wanted to have that list sortable. Very easy task with Sortable: Sortable.create(list); Works fine except one issue: Safari and Firefox interpret the drag and drop as a click on the label. Clicking on the label changes the status of the checkbox. There must be a way to prevent this. Do you have any ideas how to do this. I used the Sortable callback onChange to save the checkbox status before the drop. The other callback onUpdate is fired before the click on the label takes effect. I would like to add another change listener to the checkbox that only takes effect when onUpdate was fired. On 13 Jan., 14:44, T.J. Crowder t...@crowdersoftware.com wrote: Hi Cyrus, I don't know much about script.aculo.us, but looking at it (dragdrop.js), Sortable isn't a class (in the loose way we use that word in this classless prototypical language JavaScript), it's just an object with a bunch of functions assigned as properties. So you won't be able to extend it in this way. Perhaps someone who's done more with script.aculo.us can point you to a convenient way to achieve the result you're looking for. FWIW, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Jan 13, 1:27 pm, Cyrus arianglan...@googlemail.com wrote: Hi, I want to extend the Sortable class from the scriptaculous library. Where is my mistake? It's telling me SortableLabelList.create doesn't exist - I assumed it is inherited from Sortable. // extend SortableLabelList = Class.create(Sortable, { // redefine onHover onHover: function($super, element, dropon, overlap) { $super(); console.log(element); console.log(dropon); console.log(overlap); } }); // create list SortableLabelList.create(...); -- Jerod Venema Frozen Mountain Software http://www.frozenmountain.com/ 919-368-5105 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: sound.js bug
The second argument should be an anonymous object. This should work: play('http://myurl.com/sound.wav', { replace: true }); On Fri, Dec 5, 2008 at 1:29 PM, Bill Walton [EMAIL PROTECTED] wrote: I think I've found a bug in the latest release of sound.js. This is the code in sound.js play: function(url){ if(!Sound._enabled) return; var options = Object.extend({ track: 'global', url: url, replace: false }, arguments[1] || {}); In order to get the replace to work (to eliminate double-ding), I had to change it to... play: function(url){ if(!Sound._enabled) return; var options = Object.extend({ track: 'global', url: url, replace: arguments[1] || {} }); I'm not real strong in JavaScript, but it looks to me like replace is hardcoded in the lates release. At least, I couldn't get it to change. Am I doing something wrong? Or is this a bug? TIA from Texas! Bill -- Jerod Venema Frozen Mountain Software http://www.frozenmountain.com/ 919-368-5105 --~--~-~--~~~---~--~~ 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: sound.js bug
D'you have the code up somewhere that I can take a look at? If not, I'll set one up... On Fri, Dec 5, 2008 at 7:26 PM, bill walton [EMAIL PROTECTED] wrote: Hi Jerod, Update below. I would really appreciate your, or anyone else's, feedback/help on this. I figured making three simple sounds would be simple. ;-( On Dec 5, 1:53 pm, Jerod Venema [EMAIL PROTECTED] wrote: The second argument should be an anonymous object. This should work: play('http://myurl.com/sound.wav', { replace: true }); On Fri, Dec 5, 2008 at 1:29 PM, Bill Walton [EMAIL PROTECTED] wrote: I think I've found a bug in the latest release of sound.js. This is the code in sound.js play: function(url){ if(!Sound._enabled) return; var options = Object.extend({ track: 'global', url: url, replace: false }, arguments[1] || {}); In order to get the replace to work (to eliminate double-ding), I had to change it to... play: function(url){ if(!Sound._enabled) return; var options = Object.extend({ track: 'global', url: url, replace: arguments[1] || {} }); The code that immediately follows the above is this... if(options.replace this.tracks[options.track]) { $R(0, this.tracks[options.track].id).each(function(id){ var sound = $('sound_'+options.track+'_'+id); sound.Stop sound.Stop(); sound.remove(); }); this.tracks[options.track] = null; } In FF2, walking through the script with a breakpoint set on the '$R' line, I see this in the 'watch' window (the right pane in the FireBug panel): with my code it shows ... New watch expression... + this Object tracks=Object _enabled=true template=Object - optionsObject track=global url=../sounds/item_found.wav - replace Object replace=true replace true track global url ../sounds/item_found.wav url ../sounds/item_found.wav with latest sound.js code it shows ... New watch expression... + thisObject tracks=Object _enabled=true template=Object - optionsObject track=global url=../sounds/item_found.wav replace true trackglobal url../sounds/item_found.wav url ../sounds/item_found.wav I looks like sound.js is not creating the anonymous object. Or am I misunderstanding what I'm seeing? Thanks, Bill -- Jerod Venema Frozen Mountain Software http://www.frozenmountain.com/ 919-368-5105 --~--~-~--~~~---~--~~ 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: Banner viewport
I just took a brief look, but try moving the startScroller calls into the onload rather than having them inline, see if that helps. On Fri, Nov 28, 2008 at 10:40 PM, jonathon [EMAIL PROTECTED] wrote: I was just troubleshooting something like this, and can't figure out how to get it to work in ie... If I add an alert to scrollImage(), I see it only in firefox. http://www.lotzunga.com/ works in Firefox (check out the image thingies) http://www.lotzunga.com/ doesn't work in IE (I hate IE.) Is there something I'm missing? On Nov 28, 7:01 pm, Jerod Venema [EMAIL PROTECTED] wrote: That's not really an effect, per-se, as much as a simple continuous motion. It's simple enough to do this without scriptaculous: //assumes myelement is positioned absolutely var moveIt = function(){ var pos = parseInt($('myelement').getStyle(top).gsub(/[^\d]/,)); pos = (pos + 1) + px; $('myelement').setStyle({ top: pos});} new PeriodicalExecuter(moveIt,0.1); That's it :) Voila, nice scolling element. Replace myelement with header and you can run that script on the script.aculo.us homepage. On Fri, Nov 28, 2008 at 11:43 AM, Fernando Mertins [EMAIL PROTECTED] wrote: Hi Everybody, Is it possible to create a viewport with moving an image in vertical, with Scriptaculous? Something like this: http://adamssleep.com.br/newsite/(madehttp://adamssleep.com.br/newsite/%28madewith Flash) OBS.: I don't need the curve, only normal rectangle image Another example is the GUCCI website, but in this case the movement it's at horizontal and the used Scriptaculous :-) Which effects I must use? Thank you in advance, Fernando -- Jerod Venema Frozen Mountain Softwarehttp://www.frozenmountain.com/ 919-368-5105 -- Jerod Venema Frozen Mountain Software http://www.frozenmountain.com/ 919-368-5105 --~--~-~--~~~---~--~~ 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: Is the new statement ever needed ?
Follow the documentation. Those are classes, and do need the new. To avoid JSLint errors, simply use extra parens: (new Ajax.Request({foo:'bar'})); which will make it happy. On Wed, Dec 3, 2008 at 9:03 AM, Alex Mcauley [EMAIL PROTECTED] wrote: not everything is a class and needs initiating with new ... you should check what does need new and what doesn't .. some effects need to be initiated as objects as they are classes and some dont Regards Alex - Original Message - From: fero [EMAIL PROTECTED] To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Wednesday, December 03, 2008 1:54 PM Subject: [Proto-Scripty] Is the new statement ever needed ? As I read the Prototypejs documentation, I noticed that every example in using your classes begin with the new statement. So I have written all my code like new Ajax.Request , new Effect.SlideDown etc. This works very well for FF. Now I am porting my code to IE :( and as I got some (other) errors I discovered the wonderful a href=www.jslint.comJSLint/a which tells me that 'new' should not be used as a statement Since I don't really know too much of internals of Javascript: I was wondering if it is the same to do new Ajax.Request and Ajax.Request just to make JSLint not to bother me :) If it is the same, I think you should write a couple of lines in prototypejs documentation about this. Thank you very much fero -- Jerod Venema Frozen Mountain Software http://www.frozenmountain.com/ 919-368-5105 --~--~-~--~~~---~--~~ 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: New Script.aculo.us combination effect: Fisheye (beta), I need help with callback
You probably want to do something like: mouseClick:. arguments[1].onClick || function(){} and then, in your code, you hook up the click like so: myelement.on(click, options.mouseClick); which hooks the click event to the passed in function. If you need to do other processing first, try: myelement.on(click, function(evt){ dostuff(); options.mouseClick(evt); }); Jerod Venema Frozen Mountain Software http://www.frozenmountain.com/ 919-368-5105 On Fri, Nov 28, 2008 at 4:32 PM, Diodeus [EMAIL PROTECTED] wrote: I am building a Scriptaculous-based fisheye menu, which is coming along well. The thing I can't figure out is how to fire what is in the onClick callback I created. new Effect.FishEye('demo',{onClick:function(){alert(##)}}) In the initialization I have: options = Object.extend({ mouseClick: arguments[1].onClick || '' ... }) ...which then goes to this method: mouseClick: function(event) { alert(u...I dunno) }, I've been looking at other effects code to try and figure it out, but I'm not getting anywhere. Here's the demo: jameslab.moveable.com/fisheye Thank you. - James. -- Jerod Venema --~--~-~--~~~---~--~~ 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: Unofficial wiki - layout question
Hey TJ, My vote is lump it all together. Especially since scripty has its own wiki anyways, there are going to be sections that are really not relevant for scripty. Anyway, I think it makes sense to keep it primarily a prototype wiki, with general tips for other stuff and links out to the scriptaculous wiki where appropriate, which means your re-org pattern looks good :) -Jerod On Fri, Oct 17, 2008 at 7:25 AM, T.J. Crowder [EMAIL PROTECTED]wrote: Hi folks, The initial let's get something out there layout I did for the unofficial wiki[1] has a clear distinction between Prototype and script.aculo.us. There are separate sections for them, and each section has its own list of Tips, How Tos, etc. In fact, I even had us putting pages about Prototype in a prototype category and pages about script.aculo.us in a scripty category. [1] http://proto-scripty.wikidot.com Is there any point to that? I mean, is the tip about minimizing download times (or about unobtrusive JavaScript, or about instance methods as callbacks/event handlers) related to Prototype or script.aculo.us? My answer to that second question is Yes, both, which suggests that the answer to the first question is No, not really and we should get rid of it before things go on much further. (The site already has a bunch of stuff broken into these categories, so before things grow too much further...) Like many wikis, we can use tags on pages, and we've been careful to tag Prototype pages with a prototype tag, script.aculo.us pages with a script.aculo.us tag, and pages about both with both. I tend to think that's enough. So that would leave the menu on the left looking a bit like this: Home Tips How Tos Troubleshooting API Notes Extras / Add-ons Resources Pitch In! Editing this wiki ...followed by the mini-tag cloud. It's a biggish reorganization, getting rid of the categories and such, so I thought it best to throw the idea out and see if it makes sense. BTW: If you feel like pitching in, there's a list of things needed/ wanted here: http://proto-scripty.wikidot.com/pitch-in Thanks in advance, -- T.J. Crowder tj / crowder software / com -- Jerod Venema --~--~-~--~~~---~--~~ 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 Logo?
Woohoo! Prototype shirts! On Tue, Oct 7, 2008 at 10:04 AM, T.J. Crowder [EMAIL PROTECTED]wrote: Hi, If you're thinking of using it on an unofficial site, you will definitely want to check with the Core team first. Suggest posting over in the Prototype Core group: http://groups.google.com/group/prototype-core?lnk= -- T.J. Crowder tj / crowder software / com On Oct 7, 2:39 pm, White Shadow [EMAIL PROTECTED] wrote: Does anyone have the Prototype logo in vector format? or know where I can download one? -- Jerod Venema Senior Software Engineer Nth Penguin, LLC http://www.nthpenguin.com (919) 368-5105 --- WebWidgetry.com / MashupStudio.com Future Home of the World's First Complete Web Platform --~--~-~--~~~---~--~~ 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 wiki?
On Sun, Oct 5, 2008 at 5:30 PM, Tobie Langel [EMAIL PROTECTED] wrote: There are some security issues with the github wiki which currently makes it improper to be used as a community wiki. Is there are reason we're stuck with github? We could go with mediawiki or any other of the gazillion free wikis out there... Regarding the FAQ, I remember clearly requesting a number of changes to it before publishing it and haven't heard about it since then. I'd love to have it online asap. Best, Tobie -- Jerod Venema Senior Software Engineer Nth Penguin, LLC http://www.nthpenguin.com (919) 368-5105 --- WebWidgetry.com / MashupStudio.com Future Home of the World's First Complete Web Platform --~--~-~--~~~---~--~~ 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 wiki?
OK, that makes good sense. Glad you're moving on with something else if we can't use github for security reasons. Let me know if I can help. On Mon, Oct 6, 2008 at 12:48 PM, T.J. Crowder [EMAIL PROTECTED]wrote: Hey Jerod, Yeah, I was asking about github because Prototype is already hosted there, and the official script.aculo.us wiki is hosted there, so it seemed logical to at least ask what the plan was. Anyone who reads this group regularly will know that I'm a big believer in we, the community, doing things for ourselves (such as this group), rather than expecting the core group to do everything. Over in the Does Prototype have a future? thread[1] (answer, btw: YES), I raised the question of whether we should have a community site just as we have this community group. I got a couple of positive responses there (and by private email), and so I've been looking at putting something together. It's just that I would tend to think there wasn't any need if we had a wiki for Prototype like we do for script.aculo.us. But I'm putting something _very_ basic together now, using wikidot; look for a thread on it in the next week or so. -- T.J. Crowder tj / crowder software / com [1] http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/08b3bbc96fbd5ad7 On Oct 6, 5:23 pm, Jerod Venema [EMAIL PROTECTED] wrote: On Sun, Oct 5, 2008 at 5:30 PM, Tobie Langel [EMAIL PROTECTED] wrote: There are some security issues with the github wiki which currently makes it improper to be used as a community wiki. Is there are reason we're stuck with github? We could go with mediawiki or any other of the gazillion free wikis out there... Regarding the FAQ, I remember clearly requesting a number of changes to it before publishing it and haven't heard about it since then. I'd love to have it online asap. Best, Tobie -- Jerod Venema Senior Software Engineer Nth Penguin, LLChttp://www.nthpenguin.com (919) 368-5105 --- WebWidgetry.com / MashupStudio.com Future Home of the World's First Complete Web Platform -- Jerod Venema Senior Software Engineer Nth Penguin, LLC http://www.nthpenguin.com (919) 368-5105 --- WebWidgetry.com / MashupStudio.com Future Home of the World's First Complete Web Platform --~--~-~--~~~---~--~~ 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 wiki?
Here's another vote for a prototype.js wiki... It'd be great to have a central place where we could put all the extra bits of code people have written in their libraries rather than having to search through the google archives. Also, there have been a couple times that I've wanted to update the docs with a bit more info. Explain an example a bit more, show perhaps a this is a good pattern to use for situation XYZ, etc. I've replied back to the appropriate lists with suggestions once or twice, but as TJ mentioned, I think the gatekeepers might have just had a bit too much going on, so the suggestions fell to the wayside. -Jerod On Sun, Oct 5, 2008 at 5:04 PM, T.J. Crowder [EMAIL PROTECTED] wrote: What would go in this wiki ? Whatever the community comes up with -- that's the joy of community content! ;-) The FAQ that kangax and I wrote, for a start; it's been more than three months since we turned it over in markdown format and it still hasn't appeared on prototypejs.org as discussed because people are too busy -- and even if it did, there are probably 18 edits that really need to get made that people would make if it were open and editable by the community (like, for instance, adding Andrew's book that's come out in the meantime to the where can I read more section). That's the issue with gatekeepig; gatekeepers tend to get too busy... -- T.J. Crowder tj / crowder software / com On Oct 5, 9:39 pm, Tobie Langel [EMAIL PROTECTED] wrote: What would go in this wiki ? On Oct 5, 10:34 pm, T.J. Crowder [EMAIL PROTECTED] wrote: Hey Tobie, So there's no plan to host a Prototype wiki there? -- T.J. Crowder tj / crowder software / com On Oct 5, 6:46 pm, Tobie Langel [EMAIL PROTECTED] wrote: That's the github default. Best, Tobie On Oct 5, 3:53 pm, T.J. Crowder [EMAIL PROTECTED] wrote: Hi folks, script.aculo.us is using github's wiki stuff these days: http://github.com/madrobby/scriptaculous/wikis I can't help but notice this: http://github.com/sstephenson/prototype/wikis It currently just says Welcome to the Prototype wiki! Is it meant to be / become an official wiki for Prototype? -- T.J. Crowder tj / crowder software / com -- Jerod Venema Senior Software Engineer Nth Penguin, LLC http://www.nthpenguin.com (919) 368-5105 --- WebWidgetry.com / MashupStudio.com Future Home of the World's First Complete Web Platform --~--~-~--~~~---~--~~ 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: Hash.toQueryString() nested hash
2008/9/27 darrinholst [EMAIL PROTECTED] I was going to inject my own thoughts on this, but I found this thread instead... http://groups.google.com/group/prototype-core/browse_thread/thread/140fdf88eed057d/1c466af382e9ba54?lnk=gstq=toQueryString# Some good reading, but I'm not sure what ever came out of it. I looked at Tobie's branch (which I think might be the next release?) and it totally skips objects that are not Arrays. I think nested hashes would be useful if you're using a server side language/framework that understands the format that the client put it in, but since Prototype should be server agnostic then I think you're going to have to roll your own. I primarily use Java, so when I need a complex object sent to the server I've always just converted it to a JSON string and then parsed it back out server side. I know we're getting a little OT here, but just to emphasize Darrin's point, I think there's a good reason for leaving toQueryString as-is. I do the same (or similar) thing as Darrin. If you really have nested hashes on the client side, you're probably working with data that's complex enough that you should have a corresponding object on the server side. Then you can use any of the bazillion JSON-[Insert Language Here] converters/deserializers to translate your data, and you don't need to work with just the primitive values...instead, you get to work with actual objects. Intead of (say, in PHP) $_GET[name] and $_GET[id]...etc, etc, etc, you could do $_GET[myobject] and (in addition to some parsing, or the JSON-...libraries) handle it as a REAL object from that point forward. I work with ASP.Net web services a lot, and when I write my web services, I always write a very simple overloaded version that takes a JSON string, converts to the appropriate object, and then calls the matching web service, ie: UpdateCustomer(Customer c); and UpdateCustomerJSON(string CustomerJSON); This way, you can simply convert the CustomerJSON string to a Customer object, which makes for cleaner code both on the client and server side, because you maintain your object structure. Just my $0.02 -Jerod Darrin -- Jerod Venema Senior Software Engineer Nth Penguin, LLC http://www.nthpenguin.com (919) 368-5105 --- WebWidgetry.com / MashupStudio.com Future Home of the World's First Complete Web Platform --~--~-~--~~~---~--~~ 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: Problems getting stopObserving to work
On Tue, Sep 23, 2008 at 3:05 PM, FigglesKoy [EMAIL PROTECTED] wrote: I have some code for a lightbox below: LightBox.prototype.showBox = function(){ ... //Assign event handlers this.okBtn = this.lbElm.select('INPUT.control.ok')[0]; if(this.okBtn) { this.okBtn.observe('click', this.okClick.bind(this)); this.okBtn.focus(); } ... }; LightBox.prototype.okClick = function(){ this.closeBox(); }; LightBox.prototype.closeBox = function(){ alert('hi'); var elms = this.lbElm.select('INPUT.control'); elms.invoke('stopObserving'); this.lbElm.remove(); this.backDrop.remove(); }; The issue is that the stopObserving doesn't seem to work. The OK button will still pop-up the alert('hi') no matter how many times I click it. I tried doing something like this.okBtn.stopObserving() but that didn't work either. Any ideas? Check out the docs on stopobserving. http://prototypejs.org/api/event/stopObserving. The issues you're having are described in detail. Essentially, you need to do a couple things: 1) Cache the reference to your bound function, like so: var bound = this.okClick.bind(this); this.okBtn.observe('click', bound); so you can remove the function call later. 2) Pass the correct parameters when attempting to stop observing: this.okBtn.stopObserving('click', bound); Notice, as specified in the docs, that you have to have the correct function reference so that the browser knows WHAT you want to stop observing. Assuming you want to bind the same function to all of your elements, you could also do: elms.invoke('stopObserving', 'click', bound); ...BUT you still need the reference to bound, and it has to be the SAME function that you initially hooked to your click event. -- Jerod Venema Senior Software Engineer Nth Penguin, LLC http://www.nthpenguin.com (919) 368-5105 --- WebWidgetry.com / MashupStudio.com Future Home of the World's First Complete Web Platform --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---