[Proto-Scripty] Re: Observing events on dynamic content.
2009/2/24 david david.brill...@gmail.com: Hi, Why not relying on event delegation to a parent contener that will not be delete or modify ?? btw, I thing the only problem is an excessive memory consuption. I did not say/mean memory leak !! There should not have more impact even. -- david On 24 fév, 16:52, Richard Quadling rquadl...@googlemail.com wrote: Hi. I know that I need to stop observing on elements before I destroy them (say they are coming in via an AJAX connection). I know one way of handling this is to not actually attach events to dynamic content, but to the container and then use the bubbling effect. With that, the event handler for such a container may have several different paths through the code, depending upon the event and the element that triggered it. I suppose if the generic event handler was nothing more than a switch board, then the functions which is attached directly could remain as they are. Anyone know of anything else I should be aware of with this issue? Regards, Richard Quadling. -- - Richard Quadling Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! I've put a container around the dynamic elements. This will have all the event handlers attached. Most obvious really. Thank you. -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! --~--~-~--~~~---~--~~ 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: does prototype abstract canvas usage to both IE mozilla?
HI all, how could I miss it !! thanks kangax. -- david On 25 fév, 06:38, kangax kan...@gmail.com wrote: On Feb 24, 7:32 pm, greghauptmann greg.hauptm...@gmail.com wrote: yes, it's quite confusing - I'm just trying to determine whether I really need to go Java Applet/JavaFX or not (versus javascript)... :( Canvas element is supported by quite a lot of modern browsers. You don't need to normalize anything. To simulate it in IE, you would use `excanvas.js` by Google. It works quite well. -- kangax --~--~-~--~~~---~--~~ 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: How do I sort a set of divs slowly.
2009/2/24 david david.brill...@gmail.com: Hi richard, I've done something like that, but very different :)) Here is my SIMPLE solution: - first clone the desired tab (let's call him cloneTab) and attach cloned element to parent, and clonePosition of the cloned tab from the creator tab - next detach the creator tab, and replace it with an empty element with the same dimension (let's call it emptyTab) You should also append an empty element as first child of the contener (let's call him emptyFirstTab) - Next, motion, Effect.Parallel ( - emptyTab to width=0 - emptyFirstTab from width=0 to the desired width - cloneTab should move to its final position ) - Next, detach the emptyTab and the emptyFirstTab, and reattach as the first child of the contener the cloneTab. You don't see any flickering if all attach/detach are grouped in the code. -- david On 24 fév, 17:47, Richard Quadling rquadl...@googlemail.com wrote: Hi. I've got a set of spans ... div class=tabHs span id=tabH_UserAdmin class=tabHEUser Administration/span span id=tabH_ReportAdmin class=tabHEReport Administration/span span id=tabH_ReportGenerator class=tabHE tabHAGenerate Report/span /div They are styled to look like tabs. There is CSS dealing with hovering, active/inactive, enabled/disabled. I've got an onClick handler on the class of tabHs (so I can have multiple tab controls). function tabHeadClick(ev){ console.group('tabHeadClick(', arguments, ')'); var el = ('click' === ev.type) ? ev.element() : ev; // Don't process disabled tabs. if (false == el.hasClassName('tabHD')){ // Update the tab header. el .addClassName('tabHA') .siblings() .without(el) .invoke('removeClassName', 'tabHA'); // Update the tab sheets. var a_IdParts = el.id.split('_'); var o_TabSheet = $('tabS_' + a_IdParts[1]); // Upda the required tab sheet if it exists and it is not currently active. if (o_TabSheet !o_TabSheet.hasClassName('tabSA')){ // Make all other tabSheets inactive el .up('.tabC') .down('.tabSs') .childElements() .without(o_TabSheet) .invoke('addClassName', 'tabSI') .invoke('removeClassName', 'tabSA'); // Make this tabSheet active. sizeElements( o_TabSheet .addClassName('tabSA') .removeClassName('tabSI') ); } } console.groupEnd(); } What I want to do is, when they click a span is to slide that o_TabSheet to the top of the list. The user isn't dragging the tab, I just want the active tab to be the first in the list. A nice sliding effect would be what I would like to see, but I have no idea at all how to do such a thing. Regards, Richard. -- - Richard Quadling Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! That's a bit beyond me at the moment. I think the sortable functionality is what I am looking for. The Effect.Morph demo also looks promising. I think I need to determine the current width's and left's of my tabs and then morph them all to new positions, taking into account the widths. I'd like to have the active tab slide in front, so I assume some z-index stuff is also required. I think. -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! --~--~-~--~~~---~--~~ 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: When?
2009/2/25 Lox gecka.comp...@gmail.com: Is there some particular development you are waiting for? What does more modern means? Well Peppy or Sizzle means that to me Also I'll be happy to have it optimized in size and speed. (Scriptaculous is much more concerned by the size matter: the number of Ko to load to have a sliding effect is impressing! ) Some other things missed me in my last javascript project but sorry I can't remember exactly what (shame on me) but I promise to post them here next time I notice them. Opensource communities need something to eat quite often! And I, as others, are getting more and more hungry! See how Ubuntu is successful with their 6 months release cycle! Jquery has more updates and so a growing community... Concerning the well know smashingmagazine I consider a shame no being listed in the 50 Useful JavaScript Tools whereas Jquery UI is... Anyway I love how prototype is, and how it works. Using it is so logical to me that I don't have to look a the doc very often. Great works devs! Regards (excuse my poor english) As I see things, prototype.js is a background toolkit. Unless there are more inconsistencies found amongst the browsers or there are some radically new ways of processing CSS, getting hold of elements, processing arrays/hashes, etc., then prototype is becoming the mature and stable platform for standardised/cross platform javascript development. Scripty (for example), which uses prototype is always going to expand as new effects or user orientated functionality becomes available. I think of prototype as a runtime library. You need it to be small, efficient and stable. This is so I, as a developer, can take it, use it in knowledge that if it works today, it will work tomorrow. Upgrading the lowest level libraries in a project nearly always breaks SOMETHING (not always major, but ...) Maybe one reason for JQuery and others like it having such a frequent release schedule is simply because they are not mature and stable enough. Yet. Keeping backend and frontend functionality separate is a great way to go. If prototype started handling user interaction (rather than just DOM/AJAX interaction), then it would bloat VERY quickly. Richard. -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! --~--~-~--~~~---~--~~ 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: Detecting an empty [] as a parameter to a function.
On Feb 25, 3:27 am, SWilk wilkola...@gmail.com wrote: [...] It's not that Richard does want to use it. It's that the PHP json_encode() function produces inconsistent output for empty arrays. If you do json_encode(array('key' = 'value'); you will get: { key: value }; And I assume that `json_encode(array('a', 'b', 'c'))` returns `[a, b, c]`? [...] I think in most cases: var _a=[]; _a = (Object.isArray(_a) !_a.length) ? {} : _a; var hash = $H(_a); That should work, but wouldn't you want to differentiate between these broken arrays (which should really be empty objects) and the actual empty arrays (returned from json)? -- kangax --~--~-~--~~~---~--~~ 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: How to use TAB key with inplaceEditor ? :(
no ? :( On 21 fév, 13:05, kreatik krea...@gmail.com wrote: Hi ;-) I think we have a DIV element containing another element (eg SPAN) to be editable element : div class=parentForFocus tabindex=n span class=editablemy data editable/span /div When parentForFocus receive focus, I' have a listenner for RETURNkey, if pressed call setEnterEditMode(); (for this span.editable child) It's good solution work, but IE randomly loses focus :( I'm sory for my anglish... On Feb 20, 12:47 pm, KreatiK' krea...@gmail.com wrote: Hi all J It's possible to use the TAB and Escape keys with InplaceEditor ? (like extJS) Have a good day ! --~--~-~--~~~---~--~~ 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] newbie scriptaculous query
I am newbie to AJAX and scriptaculous (I know and use php js) with what I hope is easy question. I am building a new homepage for my company with the idea that a basic shell of links and other widgets is always in browser, but center section changes to provide other commonly used company widgets. I have not yet started to play with center section - the main use of AJAX - but, and here is problem: Company desires automatically updating time widget at bottom of page - this feature was already in use implemented in scriptaculous at our London office; this is why I am starting with scriptaculous rather than some other AJAX implementation. I stole the following code: Head section: script src=required/scriptaculous/lib/prototype.js type=text/ javascript/script script type=text/javascript new Ajax.PeriodicalUpdater('clock', 'required/clock/gettime.php', {asynchronous:true, frequency:60}); /script And of course, brought all the scriptacous code over to required/lib. At bottom of page London original was: div id=clock align=center?php include (required/clock/ gettime.php); ?/div I used that and also tried: span id=clock ?php //include clock footer include (required/clock/gettime.php); ? /span (since I had the whole in table, thought I might need to go to span instead of div) That's it - works in London, does not work in NY for me and London guy who did original long gone. The only other difference is London site runs on Windows; mine runs on Linux - is that a prob? --~--~-~--~~~---~--~~ 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] How to resize window without screen flickering
I have a JSP page whereby I am displaying a table that contains rows of each data record. Each record has an icon at the beginning of each row that when the user clicks that icon a function that I created using the Ajax.Updater gets the data and populates another JSP page that displays the details of that row item that I am inserting via a DIV ... tag in the initial JSP and that is working great. However, the user can click another row's icon in the initial JSP page and the window keeps growing even though it is only displaying the details of the next item. I need a way to resize the window back to where it was prior to displaying the details of that next row. I attempted to resize the window before running the Ajax.Updater for the next record but when I did that the window flickers. I would like to be able to click another icon on that same page and just display the next record's details without having the entire window flicker. Any help or direction would be greatly appreciated. Here is my function: function getVendorInfo(vNum) { window.resizeBy(0, -$('vendorInfoResults').offsetHeight); var url = '/common/Lookup.action'; new Ajax.Updater('vendorInfoResults', url, {method: 'get', parameters: {vendorInfo: '', vendorNum: vNum}, onComplete: function() { window.resizeBy(0, $('vendorInfoResults').offsetHeight); } }); } --~--~-~--~~~---~--~~ 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: Strategies for replacing Elements in realtime
I would reccomend using the dom to be *safe*. For instance, in a select box if you just try to add option tags into the select container IE will not detect the new elements. you should use the javascript add option methods. In general both methods work, but i find using JS is sometimes safer. I guess in general if its really small nothing is easier and faster than assigning what you want to an elements.innerHTML. and in more complex or sensitive cases it can depend. On Feb 24, 1:48 pm, Lee Jenkins l...@datatrakpos.com wrote: Hi all, Pretty new to javascript and prototype. Been developing windows software for years though. At any rate, I have a question and if it's too javascript related and considered OT, please let me know and/or direct me to an appropriate group for discussion. Assume that I have DIV with several elements such as TextBox, Combo Box, etc and I want to update one specific widget within the DIV, would you recommend updating the widget through the DOM or replacing it's markup? Either way, the data would be coming in the response of an AJAX request. Seems to me that if I wanted to juse replace it's markup, I would have to site the elements within DIV's themselves. If the DIV has several controls on it, I'd prefer not to have to re-display the entire contents with an innerHTML call, but I am unsure of the best way to update a single widget contained within another element like a DIV. Thanks for advise, -- Warm Regards, Lee --~--~-~--~~~---~--~~ 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: newbie scriptaculous query
use firebug, and check the response from the server. (make sure error reporting is on) if the return from the ajax query is an error... then its server side. I suspect its a php related time error, you should check those scripts. NOW if its a local javascript error, (not a bad return from the server) it may be that you have not initalized the control correctly does this help? On Feb 25, 10:10 am, Bhudda Ben benjamin.rud...@gmail.com wrote: I am newbie to AJAX and scriptaculous (I know and use php js) with what I hope is easy question. I am building a new homepage for my company with the idea that a basic shell of links and other widgets is always in browser, but center section changes to provide other commonly used company widgets. I have not yet started to play with center section - the main use of AJAX - but, and here is problem: Company desires automatically updating time widget at bottom of page - this feature was already in use implemented in scriptaculous at our London office; this is why I am starting with scriptaculous rather than some other AJAX implementation. I stole the following code: Head section: script src=required/scriptaculous/lib/prototype.js type=text/ javascript/script script type=text/javascript new Ajax.PeriodicalUpdater('clock', 'required/clock/gettime.php', {asynchronous:true, frequency:60}); /script And of course, brought all the scriptacous code over to required/lib. At bottom of page London original was: div id=clock align=center?php include (required/clock/ gettime.php); ?/div I used that and also tried: span id=clock ?php //include clock footer include (required/clock/gettime.php); ? /span (since I had the whole in table, thought I might need to go to span instead of div) That's it - works in London, does not work in NY for me and London guy who did original long gone. The only other difference is London site runs on Windows; mine runs on Linux - is that a prob? --~--~-~--~~~---~--~~ 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] Drag and Drop with conditional revert
I've been struggling to achieve something with drag and drop. I've found a solution, but I don't think it's very elegant, and I was wondering if anybody has a better solution. I'm dragging an object from one box to another. If it is a suitable dropsite, it fires off an Ajax request to update the database and several parts of the display (including the dropsite). But it is possible that the operation will not be permitted, in which case the Ajax returns a failure code and a message, and the object hasn't been moved in the database. So far so good. But I want the drag to revert not only if the user doesn't find a suitable dropsite, but also if the Ajax operation returns failure. On the other hand, if the Ajax operation succeeds, I don't want it to revert. (It will only be for a moment before the box is redrawn, but it doesn't look good). The workround I've implemented is to hide the element before issuing the Ajax call, and show it again in the failure callback, but not in the success one; so the user won't see it reverting in the latter case. But it means the object you've moved disappears for a moment, which is not very good. Is there a better solution? I wondered if there was a way to use a function in the 'revert' option of the Draggable, or to use the onEnd of the Draggable or onDrop of the Droppable. But none of these have access to the Draggable, only to the dragged element, so I would have to write my own revert. In any case, there doesn't seem to be a callable default 'revert' function in Draggable: I would expect there to be one, so that you can provide a callback which does some other processing and then calls the default. I see that there was a discussion on similar lines last September, but the recommendation there seemed to be to do the checking client-side. That is possible, but would mean that much more data would need to be downloaded, so I prefer to do it on the server. Any suggestions? --~--~-~--~~~---~--~~ 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: When?
[...] then prototype is becoming the mature and stable platform for standardised/cross platform javascript development. I understand that, and quite second that, but Peppy or Sizzle are much more faster at selecting elements by css selector witch, these days where javascript apps a getting bigger, is a must have. Someone talked about a lot of patches floating around. What are they? Where are they? To me prototype can be optimized without changing its functionalities. I recently had a case where, in a well formed dom, it didn't find something like '#mydiv span.class' witch was anoying. I remember I had to find a workaround and also that Peppy found 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 prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Replace $$ function
Please, does anyone can guide me to integrate sizzle or peppy to prototype? On 13 jan, 13:13, Lox laurent.dincl...@gmail.com wrote: Hello, I want to integrate peppy (orsizzle) in prototype to replace $$() function. Can I safely replace the whole Selector class? Regards --~--~-~--~~~---~--~~ 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: When?
Scripty (for example), which uses prototype is always going to expand as new effects or user orientated functionality becomes available. Is Scripty Scriptaculous ? --~--~-~--~~~---~--~~ 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: When?
On Feb 25, 4:28 pm, Lox gecka.comp...@gmail.com wrote: [...] then prototype is becoming the mature and stable platform for standardised/cross platform javascript development. I understand that, and quite second that, but Peppy or Sizzle are much more faster at selecting elements by css selector witch, these days where javascript apps a getting bigger, is a must have. Someone talked about a lot of patches floating around. What are they? Where are they? Which patches? To me prototype can be optimized without changing its functionalities. Optimized how? The bug tracker is public and anyone is free to suggest optimizations, patches, tests, etc. I recently had a case where, in a well formed dom, it didn't find something like '#mydiv span.class' witch was anoying. I remember I had to find a workaround and also that Peppy found it Submitting bug is a good way to let developers know about it. Otherwise, the chances of it being found and fixed are much lower, as you can probably guess. In which browser did that query not work? -- kangax --~--~-~--~~~---~--~~ 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: When?
2009/2/25 Lox gecka.comp...@gmail.com: Scripty (for example), which uses prototype is always going to expand as new effects or user orientated functionality becomes available. Is Scripty Scriptaculous ? Yes. Sorry for the abbrev. -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! --~--~-~--~~~---~--~~ 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: Replace $$ function
I tried too . On 26 fév, 12:31, Tobie Langel tobie.lan...@gmail.com wrote: Hi, I'll be working on Sizzle implementation over the next weeks. And no, it isn't as simple as replacing the whole Selector class. :( Best, Tobie On Feb 25, 10:30 pm, Lox gecka.comp...@gmail.com wrote: Please, does anyone can guide me to integrate sizzle or peppy to prototype? On 13 jan, 13:13, Lox laurent.dincl...@gmail.com wrote: Hello, I want to integrate peppy (orsizzle) in prototype to replace $$() function. Can I safely replace the whole Selector class? Regards --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---