Re: [Rails-spinoffs] Creating Custom Events using prototype

2006-08-18 Thread Ryan Gahl
You can also use my EventPublisher class I posted here several months ago (attached .txt file)...Here's the link to my initial post with example code... http://lists.rubyonrails.org/pipermail/rails-spinoffs/2006-March/002885.htmlEnjoy.On 8/18/06, Andreas Wahlin < [EMAIL PROTECTED]> wrote:This seems

Re: [Rails-spinoffs] Sortable callback, when dragging starts/stops

2006-08-16 Thread Ryan Gahl
past thread... but now I see that at the bottom gmail is telling me I have X deleted message in this conversation and gives me the option to recover them from the trash... So my apologies :-)On 8/16/06, Michael Peters <[EMAIL PROTECTED]> wrote: Todd Ross wrote:> Ryan Gahl wrote:>>

Re: RE: RE: [Rails-spinoffs] OK. I'm confused again.

2006-08-15 Thread Ryan Gahl
I couldn't agree more. And as Thomas himself has expressed here... optimization is the very last thing you need to worry about.On 8/15/06, Brandon Aaron <[EMAIL PROTECTED]> wrote: > 1 - Is every object that is extended by Enumerable going to have iterable> class names?Yes but it will probably be n

Re: [Rails-spinoffs] Sortable callback, when dragging starts/stops

2006-08-15 Thread Ryan Gahl
ways shows me quoted text correctly, is your mail program not? You're making me feel like an insane person, lol... On 8/15/06, Todd Ross <[EMAIL PROTECTED]> wrote: Ryan Gahl wrote:> When I joined the list I had my own etiquette issues which others politely> corrected for me (right

Re: [Rails-spinoffs] Prototype $$ Question

2006-08-14 Thread Ryan Gahl
BUT, wait just a second Thomas :-)Remember a lot of us aren't Ruby-jockies... keep the function names _descriptive_ please :-) "unique" is better than uniq IMHOOn 8/14/06, Thomas Fuchs <[EMAIL PROTECTED]> wrote: That method should be named "uniq" (to match the ruby enumerables, whichPrototype heav

Re: [Rails-spinoffs] Sortable callback, when dragging starts/stops

2006-08-14 Thread Ryan Gahl
Hi Tim... I'm sorry that I'm not replying to the actual topic, but could you please use "reply-to" in your email program so you don't break the threading... When I joined the list I had my own etiquette issues which others politely corrected for me (right Jeremy?)... so don't feel like I'm singling

Re: [Rails-spinoffs] Inspecting an object

2006-08-14 Thread Ryan Gahl
Short of finding a full debugging tool for IE (VS.NET or VWD supply this but may not work well for your project) or creating your own robust object inspector, I'd say simply serializing your object like that in JSON is about the quickest way to get the debug info you really need. On 8/14/06, Sam <[

Re: [Rails-spinoffs] requestHeaders: ['cache-control', 'no-cache', 'pragma', 'no-cache'],

2006-08-12 Thread Ryan Gahl
One sure fire way to prevent caching is to include a cache buster in your request URL...var cacheBuster = "?" + new Date() * 1;var url = "" + cacheBuster;...do Request... On 8/9/06, Sam <[EMAIL PROTECTED]> wrote: Ajax.Request    ... does   requestHeaders: ['cache-control','no-cache','pragma',

Re: [Rails-spinoffs] requestHeaders: ['cache-control', 'no-cache', 'pragma', 'no-cache'],

2006-08-09 Thread Ryan Gahl
...oops, this should be obvious, but replace the ? with a "&c=" (or something) if your url already contains other parameters... you'll figure that part out I'm sure...On 8/9/06, Ryan Gahl <[EMAIL PROTECTED]> wrote: One sure fire way to prevent caching is to include

Re: [Rails-spinoffs] Dropables problem on scroll bars

2006-08-08 Thread Ryan Gahl
Mandy, I am so sorry I haven't done anything like that yet. I'll get there. I've just been so busy. One of my big projects is getting close to coming to fruition (well relatively close anyway), at which time a lot of my (and my team's) works will be released (some open source and patch-type stuff l

Re: [Rails-spinoffs] Dropables problem on scroll bars

2006-08-07 Thread Ryan Gahl
A 3rd option, which is what I use, is on drag start create a clone of the draggable item (just like if you use the ghosting option), and attach the cloned element at the _document_ level. This doesn't require you to break your design by showing overflow for items you want to keep the overflow hidde

Re: [Rails-spinoffs] some math - need help

2006-08-04 Thread Ryan Gahl
Not sure if this was a typo in your post, or if it's the root of your problem...In that first line you have a closing paren ")" at the end, and it's not needed. And, in the alert right after that you are missing the closing paren ")"... On 8/4/06, Marco M. Jaeger <[EMAIL PROTECTED]> wrote:

Re: [Rails-spinoffs] Extending Class.create() for casting objects

2006-07-31 Thread Ryan Gahl
However, when creating consumable components or APIs, it's always good to embed defensive techniques into your code because you may not know which anonymous application space is trying to do what with your stuff, and yes you can tell those 3rd parties to unit test unit test, but in the end you can'

Re: [Rails-spinoffs] select objetcs inside an object

2006-07-27 Thread Ryan Gahl
var selects = $('yourTable').getElementsByTagName("tr")[1].getElementsByTagName("td")[1].getElementsByTagName("select");...getElementsByTagName returns a zero-indexed collection, therefore, get the 2nd row's 2nd cell's selects with the above line... On 7/27/06, Javier Martinez <[EMAIL PROTECTED]> w

Re: [Rails-spinoffs] New Microsoft IDE

2006-07-27 Thread Ryan Gahl
Looks like nothing more than an updated FrontPage with some Dreamweaver-esque candy. MS tools are extremely good when it comes to backend development (in terms of ease of use, extensibility, and developer productivity)... but I doubt they will be able to make any headway as a design tool provider.

Re: [Rails-spinoffs] XML Question

2006-07-24 Thread Ryan Gahl
Here's a nice library supporting xpath...http://sarissa.sourceforge.net/doc/On 7/24/06, Sam <[EMAIL PROTECTED]> wrote:   I've got an XML file which is pretty well structured.  I need to retrieve specific elements from that file to fill out empty HTML elements on a page.   I think what I n

Re: [Rails-spinoffs] Draggable slow if page contains more than 4 Droppables [testcase]

2006-07-24 Thread Ryan Gahl
And for general drag/drop performance tuning, review my lazy loading article from February on this list...http://lists.rubyonrails.org/pipermail/rails-spinoffs/2006-February/002459.html On 7/24/06, Sam Rowe <[EMAIL PROTECTED]> wrote: On Sun, Jul 23, 2006 at 10:58:54PM -0700, Peter Michaux wrote:# O

Re: [Rails-spinoffs] Custom attributes?

2006-07-23 Thread Ryan Gahl
Just off the top of my head, I'm gonna go on a limb here and say you can use other means to pass this data to the js environment without mucking up your markup. That is assuming this is not really semantically relevant data, but rather some meta-information or application state stuff you're trying

Re: [Rails-spinoffs] [slightly OT] ajax calls, interpolating inbetween, moving ships and a map

2006-07-23 Thread Ryan Gahl
Hmm, sounds interesting, any way we can log in to that link you provided in your signature or see some example of the problem?On 7/23/06, Michael Siebert <[EMAIL PROTECTED]> wrote:Hello there, since this is the greatest gathering of JS gurus all over the world, i have a question not directly relat

Re: [Rails-spinoffs] Prototype.js strips scripts before innerHTML

2006-07-21 Thread Ryan Gahl
There we go, that sounds scientific :-)btw, Thomas, have you anything to say (maybe in a new thread), regarding what we've been so hotly debating here these last few days? ie. future of proto? On 7/21/06, Thomas Fuchs <[EMAIL PROTECTED]> wrote: AFAIK the setTimeout makes sure that the eval() is exe

Re: [Rails-spinoffs] Prototype.js strips scripts before innerHTML

2006-07-21 Thread Ryan Gahl
scripts inserted via innerHTML are not executed, so this ensures any scripts actually get executed... does anyone else have the scientific answer for the timeOut? prevent UI blocking as much as possible? There are potential benefits, but it's probably not 100% necessary. On 7/21/06, Peter Michaux <

Re: [Rails-spinoffs] custom javascript events

2006-07-21 Thread Ryan Gahl
Good stuff, a couple months back I posted my very lightweight EventPublisher class, along with a quick example. http://threebit.net/mail-archive/rails-spinoffs/msg00548.html ...and here is the code.../ EventPublisher Class / The EventP

Re: [Rails-spinoffs] Re: Javascript Namespacing Question

2006-07-20 Thread Ryan Gahl
>> The trick is encapsulating the class definition as a whole inside the>> contructor method (using bind() to preserve the lexical scope of the>> containing class), > Both of these actions seem very unfriendly to me. Having to define my> entire object inside the constructor? Appending a bind(this)

Re: [Rails-spinoffs] Re: Javascript Namespacing Question

2006-07-20 Thread Ryan Gahl
well to other tasks like overridding, overloading, interface implementations, (as well as refactoring) etc... the point was that proto makes it _easy_ to apply sound classical OO. On 7/20/06, Ryan Gahl <[EMAIL PROTECTED]> wrote: The beauty though, Eric, is that you can use prototype to achieve

Re: [Rails-spinoffs] Re: Javascript Namespacing Question

2006-07-20 Thread Ryan Gahl
The beauty though, Eric, is that you can use prototype to achieve this as well. People have a habit of putting boxes around things and imposing imaginary constraints.  Look outside the box you've (not you specifically, Eric, that's the general "you") put the powerful prototype.js into and you'll

Re: [Rails-spinoffs] Javascript Namespacing Question

2006-07-20 Thread Ryan Gahl
formance and efficiency. (as you may have already noticed, im a bit paranoid about performance/speed) On 7/21/06, Ryan Gahl <[EMAIL PROTECTED]> wrote:Nope, that should work out just fine, but I would just call that "namespacing" (YUI didn't invent that concept)... :-)

Re: [Rails-spinoffs] Re: Documenting Prototype...

2006-07-20 Thread Ryan Gahl
Base _is_ completely unnecessary since I've demonstrated that proto already provides the means to achieve that functionality in a very clean manner.But more importantly, can you stop perpetuating this thread in a completely non-productive manner? Seriously, you are bringing no value to anyone in th

Re: [Rails-spinoffs] Javascript Namespacing Question

2006-07-20 Thread Ryan Gahl
Nope, that should work out just fine, but I would just call that "namespacing" (YUI didn't invent that concept)... :-)On 7/20/06, Brian Feliciano <[EMAIL PROTECTED]> wrote:Anyway, my base is still going to be prototype. But is there any difference/problem if i use the yui namespacing and proceed w

Re: [Rails-spinoffs] Javascript Namespacing Question

2006-07-20 Thread Ryan Gahl
The only stumbling block I have yet to fall down on in proto/scriptaculous as far as performance goes is when I have a ton of Draggables/Droppables instances on a page at a time. I have engineered my own solution to that problem though and others here have done similar, so if you get there just ask

Re: [Rails-spinoffs] Re: Documenting Prototype...

2006-07-20 Thread Ryan Gahl
Can I just say what, here? What? That's just a general what to this premise that a new release every X days/months/years is a necessary thing to the success of (what?).Ok, so you used prototype version X.X (doesn't matter, I'm still using 1.4)... and you've built a clean toolkit or componenet set

Re: [Rails-spinoffs] AOP in Prototype / JS

2006-07-20 Thread Ryan Gahl
Lol, and I apologize in kind for asking this obvious question, what do you mean "Aspects" (and I'm not Googling as we speak, heh).On 7/20/06, Matt Spendlove <[EMAIL PROTECTED]> wrote: Hey folks I am just investigating using Aspects for logging my main _javascript_ "interfaces". I don't be

Re: [Rails-spinoffs] Re: Documenting Prototype...

2006-07-19 Thread Ryan Gahl
in this list. Don't make me come over there! I'll jump into the YUI list or forum and start picking it apart.:-)On 7/19/06, Peter Michaux < [EMAIL PROTECTED]> wrote:On 7/19/06, Ryan Gahl < [EMAIL PROTECTED]> wrote:> Protoype is important if only for the ease with which it e

Re: [Rails-spinoffs] Re: Documenting Prototype...

2006-07-19 Thread Ryan Gahl
And just to edit: I don't mean "whining" as an insult to anyone... just that there's a general gathering of complaints all pointing toward this singular problem..my brash American comments get me in trouble here so often I'm just turning into a big apologist. On 7

Re: [Rails-spinoffs] Re: Documenting Prototype...

2006-07-19 Thread Ryan Gahl
Protoype is important if only for the ease with which it enables class based OO programming in js. Yes, we all know... js is a prototyped based OO language, but using a traditional class approach makes code re-use, readability, and refactoring (read maintenance) so much easier. I'm guessing the OP

Re: [Rails-spinoffs] Re: Documenting Prototype...

2006-07-19 Thread Ryan Gahl
My vote is against removing it, if any votes are being counted here, which I don't think they are.On 7/19/06, Tom Gregory < [EMAIL PROTECTED]> wrote:Sounds like a vote to remove the prototype dependency from scriptaculous.  I'm in favor for all sorts of reasons.A clean separation obviates any the-o

Re: [Rails-spinoffs] Ajax Timeouts

2006-07-19 Thread Ryan Gahl
Going back to the Parenizor debate we had here a few weeks ago (I tried to do a search for that thread on http://www.ruby-forum.com/forum/10 but the search function is currently broken, meh)... One could cache the old (core) proto class in question into a "base" property of the new class before ex

Re: [Rails-spinoffs] Simple Problem, but I can't find it

2006-07-19 Thread Ryan Gahl
You are passing in a string value as the 1st parameter, and then trying to compare it to the bool value true. If you are checking for the existance of the element, either pass in the actual element reference (not the string of the id), or try to get the element reference in the function before or w

Re: [Rails-spinoffs] Ajax Timeouts

2006-07-19 Thread Ryan Gahl
Mandy...Can the changed lines/classes you're talking about be factored out into a separate "prototype-overrides.js" file which you can load into the docuement after prototype.js is loaded, thus overwriting (or Object.extending) the existing classes with your added functionality, but still allowing

Re: [Rails-spinoffs] Re: Documenting Prototype...

2006-07-19 Thread Ryan Gahl
supported at the moment, but I can see you've made it very easy to add any library) On 7/19/06, Ryan Gahl <[EMAIL PROTECTED]> wrote: Sorry for the reply-all, anyone not interested in this thread (aside from the rails-spinoffs list people), please let us know and we will exclude you from furthe

Re: [Rails-spinoffs] Re: Documenting Prototype...

2006-07-19 Thread Ryan Gahl
Sorry for the reply-all, anyone not interested in this thread (aside from the rails-spinoffs list people), please let us know and we will exclude you from further responses (at least I will, heh)As for the IDE, just downloaded the Windows version, all I have to say is... (nothing to say, speechless

Re: [Rails-spinoffs] Grow/Shrink Effect

2006-07-18 Thread Ryan Gahl
...exbealadociousOn 7/18/06, Ryan Gahl <[EMAIL PROTECTED]> wrote: lol, Jerod.script.acu.proto.dojo.lo.us On 7/18/06, Jerod Venema < [EMAIL PROTECTED]> wrote:Heh, yeah...an abstraction layer for abstraction layerswhee! On 7/18/06, Ryan Gahl < [EMAIL PROTECTED]> wrote: Wha

Re: [Rails-spinoffs] Grow/Shrink Effect

2006-07-18 Thread Ryan Gahl
lol, Jerod.script.acu.proto.dojo.lo.usOn 7/18/06, Jerod Venema < [EMAIL PROTECTED]> wrote:Heh, yeah...an abstraction layer for abstraction layerswhee! On 7/18/06, Ryan Gahl < [EMAIL PROTECTED]> wrote: What the world really needs now is a proto-dojo-scriptaculous abstraction laye

Re: [Rails-spinoffs] script.aculo.us effect to update elements

2006-07-18 Thread Ryan Gahl
Nice effect... although I'm more inclined to call it a control or widget than effect. Perhaps you can also make it support passing in an array of values to allow for non-ajax updates. For instance, "new Effect.Updater (el, {newContentArray: ['foo', 'bar', 'blah'], queue: 'end'});"On 7/18/06, Fabian

Re: [Spam] Re: [Rails-spinoffs] What I need to do?

2006-07-18 Thread Ryan Gahl
Imagine if gmail employed this... lol.On 7/18/06, Hill, Greg <[EMAIL PROTECTED]> wrote: >now, one thing js won't let you do is set the value of the file inputActually, there's a proof-of-concept 'security' issue about that.  Whatyou do is have a text input and add an onkeydown event that focuses th

Re: [Rails-spinoffs] Grow/Shrink Effect

2006-07-18 Thread Ryan Gahl
What the world really needs now is a proto-dojo-scriptaculous abstraction layer. Much like proto and dojo abstract browser differences we need an interop lib on top of these... for a given command or widget where code is available in both libs, the coder can specify the provider like "new Draggable

Re: [Rails-spinoffs] $F

2006-07-13 Thread Ryan Gahl
Yep, you're definitely doing something wrong somewhere, or using a wrong version of something... sounds like in your example $('checkbox') is not finding the element, meaning you are either not using the correct id for the element in question, or perhaps you are trying to do this before the element

Re: [Rails-spinoffs] $F

2006-07-13 Thread Ryan Gahl
Andrew... $('some_element') _does_ return the DOM element reference and does allow you to set values and properties... I believe either you are misunderstanding that method (which simply maps directly to document.getElementById ), or you made a typo, or I'm somehow not reading correctly what you ty

Re: [Rails-spinoffs] how to write lazy loading droppable?

2006-07-11 Thread Ryan Gahl
I wrote an article on this forum back February on that exact topic...http://www.ruby-forum.com/topic/54193#33080On 7/11/06, Grzesiek Slusarek <[EMAIL PROTECTED]> wrote: hi All. Does anyone wanted to write droppables with lazyloading? I mean on my site I'm doing iteration over the arrayand making d

Re: [Rails-spinoffs] how to write lazy loading droppable?

2006-07-11 Thread Ryan Gahl
hopefully it can get your mind working outside the box to the point you can creatively engineer your own optimizations. I'm just too buried in life atm :-) On 7/11/06, Ryan Gahl <[EMAIL PROTECTED]> wrote: I wrote an article on this forum back February on that exact topic...http://www.rub

Re: [Rails-spinoffs] Hiding an event to launch a debug window

2006-07-11 Thread Ryan Gahl
Lol... "Ajax Joe"... hey if you don't have a blog yet that's a great name for a blog.On 7/11/06, Bauser, Joseph (Joe) < [EMAIL PROTECTED]> wrote:Not only did someone beat me to it, but my name is apparently ajax now... way to go me... :\ CheersJoe... not Ajax-Original Message-From: [EMAIL P

Re: [Rails-spinoffs] Hiding an event to launch a debug window

2006-07-11 Thread Ryan Gahl
Just to drive a point home... that site also has a search function. :-)On 7/11/06, Bauser, Joseph (Joe) < [EMAIL PROTECTED]> wrote:The okClick event handler will pass an Event into your function which means the reference page you're looking for is here: http://www.w3schools.com/htmldom/dom_obj_even

Re: [Rails-spinoffs] Hiding an event to launch a debug window

2006-07-11 Thread Ryan Gahl
Google search for "_javascript_ detecting keys pressed during click" reveals this as the first result...http://www.webreference.com/js/column11/modifierkeys.html On 7/11/06, Sam <[EMAIL PROTECTED]> wrote: I appreciate your help.  I'm still at a loss.  Let me ask again with specifics.   I h

Re: [Rails-spinoffs] Hiding an event to launch a debug window

2006-07-10 Thread Ryan Gahl
Sure can... inspect the event object... i forget the exact names of the properties you want, but http://www.w3schools.com is great for looking this stuff up...and instead of Ctrl Alt, might i suggest something harder to guess, like: up, up, down, down, left, right, left, right, b, a, select, start?

Re: [Rails-spinoffs] Event.observe(element, 'click', fn); vs. element.onclick = fn;

2006-07-07 Thread Ryan Gahl
Correct, and it also allows you to attach multiple event handlers to a single element/event pair, as well as detach them at will. It's just a more robust model.On 7/7/06, Tobie Langel <[EMAIL PROTECTED]> wrote: Hi all,I'm generating a new element through _javascript_ upon initializing aclass. This

Re: [Rails-spinoffs] Ajax Bookmarks & Browser Navigation (Back ButtonIssue)

2006-07-07 Thread Ryan Gahl
ad a lot of problems in IE when inserting iframes as DOM elements. Most history-supporting frameworks use this approach btw.I totally agree with you to not use smth like that to get an undo/redo behavior, but for content navigation this might be useful. On 7/7/06, Ryan Gahl < [EMAIL PROTECTED]&g

Re: [Rails-spinoffs] Ajax Bookmarks & Browser Navigation (Back ButtonIssue)

2006-07-07 Thread Ryan Gahl
Exactly the kind of thing I don't think is necessary or even good. You should port that idea over to a user control that acts as an undo/redo control, and does not mess around with the history hash. Not knocking your work, it's good code (except maybe for the document.write stuff -- use Builder in

Re: [Rails-spinoffs] Ajax Bookmarks & Browser Navigation (Back ButtonIssue)

2006-07-07 Thread Ryan Gahl
This really depends on the context of your usage of Ajax. Where each page is potentially it's own mini application (RIA), I personally would not expect the back button to act as an undo for the operations done within that application (for that it would probably be best to create your own "undo/redo

Re: [Rails-spinoffs] Re: Text sizing

2006-07-07 Thread Ryan Gahl
resort to black magic, general hackery, and other types of mysterious foo. -Ryan Gahl, 2006:-)On 7/6/06, Andrew Tetlaw <[EMAIL PROTECTED]> wrote: On 07/07/06, Eric Anderson <[EMAIL PROTECTED]> wrote:> Seems to me the 76% and em sizing solution is a hack. The person who> developed

Re: [Rails-spinoffs] How to add ordinary draggables to sortables??

2006-07-05 Thread Ryan Gahl
At first thought, I think you're best bet is to add a list item (onDrop) to the list making up the sortable, then destroy and re-create the sortable with that list. On 7/4/06, Kjell Bublitz <[EMAIL PROTECTED]> wrote: Hi all..I have some sortable lists and i have items that can be added to it .. so

Re: [Rails-spinoffs] Implementing a boolean "switch" in a Class

2006-06-22 Thread Ryan Gahl
it should keep it's state across all instances of that class.  Or maybe I haven't woken up yet J   Greg   From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Ryan Gahl Sent: Thursday, June 22, 2006 7:27 AM To: rails-spinoffs@lists.rubyonrails.org Subject: Re:

Re: [Rails-spinoffs] Implementing a boolean "switch" in a Class

2006-06-22 Thread Ryan Gahl
damnit... can't type.. "possesive"On 6/22/06, Ryan Gahl <[EMAIL PROTECTED]> wrote: lol, no ides why i decided "original" should be a possisive contraction.On 6/22/06, Ryan Gahl <[EMAIL PROTECTED] > wrote:Right, but the original's poster was looking for p

Re: [Rails-spinoffs] Implementing a boolean "switch" in a Class

2006-06-22 Thread Ryan Gahl
lol, no ides why i decided "original" should be a possisive contraction.On 6/22/06, Ryan Gahl <[EMAIL PROTECTED] > wrote:Right, but the original's poster was looking for precisely a way to chance a property in the main function ("class") and have that change insta

Re: [Rails-spinoffs] Implementing a boolean "switch" in a Class

2006-06-22 Thread Ryan Gahl
Right, but the original's poster was looking for precisely a way to chance a property in the main function ("class") and have that change instantly propagate to all instances. On 6/21/06, Andrew Tetlaw <[EMAIL PROTECTED]> wrote: On 21/06/06, Ryan Gahl <

Re: [Rails-spinoffs] Implementing a boolean "switch" in a Class

2006-06-21 Thread Ryan Gahl
Very interesting. It would seem the constructor points to a floating instance, not the actual prototype.I wonder what these 3 variations do...oTest1.constructor.color = 'purple';oTest1.constructor.constructor.color = 'purple';oTest1.constructor.constructor.prototype.color = 'purple';On 6/21/06,

Re: [Rails-spinoffs] Implementing a boolean "switch" in a Class

2006-06-21 Thread Ryan Gahl
oops, caught another typo...alert(p + " = " + oMyInstance.constructor[p]);On 6/21/06, Ryan Gahl < [EMAIL PROTECTED]> wrote:typo...alert("p = " + oMyInstance.constructor [p]);On 6/21/06, Ryan Gahl < [EMAIL PROTECTED] > wrote:Not sure... but i'd start by i

Re: [Rails-spinoffs] Implementing a boolean "switch" in a Class

2006-06-21 Thread Ryan Gahl
typo...alert("p = " + oMyInstance.constructor[p]);On 6/21/06, Ryan Gahl <[EMAIL PROTECTED] > wrote:Not sure... but i'd start by inspecting it, using various different "classes"... for (var p in oMyInstance.constructor){alert("p = " + oMyInstance[p]); }O

Re: [Rails-spinoffs] Implementing a boolean "switch" in a Class

2006-06-21 Thread Ryan Gahl
Not sure... but i'd start by inspecting it, using various different "classes"...for (var p in oMyInstance.constructor){alert("p = " + oMyInstance[p]); }On 6/21/06, Sam <[EMAIL PROTECTED]> wrote: Hmm, interesting. Frankly, i have no idea about the constructor thing -- half expected it to thr

Re: [Rails-spinoffs] Implementing a boolean "switch" in a Class

2006-06-21 Thread Ryan Gahl
Hmm, interesting. Frankly, i have no idea about the constructor thing -- half expected it to throw an error. But I'm still not sure why you're so reluctanct to use the main prototype; this is what it's for. Ultimately, you're looking for a way to use an instance to _get_at_ the main prototype... so

Re: [Rails-spinoffs] Implementing a boolean "switch" in a Class

2006-06-21 Thread Ryan Gahl
yea.. the constructor thing I posted probably doesn't exist... I just thought I remembered seeing that somewhere... On 6/21/06, Ryan Gahl < [EMAIL PROTECTED]> wrote:But, how can you create an instance of a class without knowing the constructor's name? It's much mor

Re: [Rails-spinoffs] Implementing a boolean "switch" in a Class

2006-06-21 Thread Ryan Gahl
Also... you said:** After declaring the Class, I've never had to mess with a class before.:-) you're still thinking of _javascript_ as a classical OO language, when it's not. Embrace the power of the prototype.On 6/21/06, Sam <[EMAIL PROTECTED]> wrote: Nope... in fact this is one of the "dy

Re: [Rails-spinoffs] Implementing a boolean "switch" in a Class

2006-06-21 Thread Ryan Gahl
But, how can you create an instance of a class without knowing the constructor's name? It's much more likely you know the constructor's name than the name of any given instance.But, try this... (not sure if its works but worth a shot if you need it)... oMyObj5.constructor.prototype.bSwitch = true;O

Re: [Rails-spinoffs] vertical menus

2006-06-21 Thread Ryan Gahl
WJ, have you ported the below to a proto class yet? I'd be interested in throwing a menu into my toolbox, but I'm making a concerted effort to make everything into a clean proto class, thus avoiding nasty namesapce collisions down the road, and also enabling widgetization (new word i just made up,

Re: [Rails-spinoffs] Implementing a boolean "switch" in a Class

2006-06-21 Thread Ryan Gahl
Nope... in fact this is one of the "dynamic" benefits of a prototype based object system.  Changing the prototype of the "class" function (the function from which the other references are constructed), changes the state of all instances automatically. MyObject.prototype.bSwitch = true; is the corre

Re: [Rails-spinoffs] Prototype Array bug??

2006-06-20 Thread Ryan Gahl
For your example.. use the numeric index to access the ACTUAL items in the Array... not the properties of the instance (Object) of the array...for (var i = 0; i < $aTOC.length; i++){ $temp += 't=' + $t + ', ' + $aTOC[i].name + '';}On 6/20/06, Ryan Gahl < [E

Re: [Rails-spinoffs] Prototype Array bug??

2006-06-20 Thread Ryan Gahl
You are using Array where you should just be using an Object... don't use Array as an associative array, there is really no point whatsoever in doing this. If you aren't using .push, .pop, .splice, and the numeric based indexing of the Array object... then use just a plain old Object. On 6/20/06, K

Re: [Rails-spinoffs] Detecting Body Onload

2006-06-16 Thread Ryan Gahl
No idea, and to be honest not even sure if window load will work :-)... but if not, body will, or document... my point was just that Event.observe is what you want.On 6/16/06, Sam <[EMAIL PROTECTED]> wrote:  >  Or, in script (assuming you're using prototype) >  Event.observe(window, "load

Re: [Rails-spinoffs] Detecting Body Onload

2006-06-16 Thread Ryan Gahl
Or, in script (assuming you're using prototype)Event.observe(window, "load", myHandler);Using the behavior lib raises other issues as far as keeping handles on your event handlers for when you need to clear them (if you ever start dealing with full blown componentized UI based applications and have

Re: [Rails-spinoffs] Menu using Scriptaculous Effects = OnMouseOver bug

2006-06-16 Thread Ryan Gahl
With what browser(s) are you seeing the problems? Based on your description I'm guessing Safari? Safari fires mouseover events for text elements within an element (buggy, and why people use this shoddy browser is beyond me)... The fix in general will most likely involve you setting a flag on the fi

Re: [Rails-spinoffs] Why such bad performance with IE ?

2006-06-16 Thread Ryan Gahl
hen other browser since the close OS implementation .. now it actually seems to be the slowest one when it comes down to a bit more complex actions. strangly enough.. I am still not sure where the leak is. Either the rapid functions calls, the dragging/positioniong OR the collision detection. :(Re

Re: [Rails-spinoffs] Why such bad performance with IE ?

2006-06-16 Thread Ryan Gahl
Right, I'm not personally destroying the Draggable on mouseout, although there may some use cases out there to argue for that and it may aid in the area of improving overall drag preformance.But... Tom's idea is good because it moves the point of instantiation even later in the process. I just hadn

Re: [Rails-spinoffs] Yahoo!-like Eventobjectemulation/abstractioninPrototype?

2006-06-15 Thread Ryan Gahl
Greg, that's a good start... but yea, I personally don't really see the overall utility of such a thing compared to just using the proto abstract statics.On 6/15/06, Gregory Hill <[EMAIL PROTECTED]> wrote: This is obviously rough draft and not thoroughly tested, but it seems towork.  If you'd like

Re: [Rails-spinoffs] Set global var in onComplete and keep persistant? Is this possible?

2006-06-15 Thread Ryan Gahl
sure, just set a property on some object that's visible at the global level (window, for example, or some object you've created just for this purpose).On 6/15/06, Kevin Old <[EMAIL PROTECTED]> wrote: Hello everyone,I posted yesterday about setting a global variable.  I've doneeverything I can thin

Re: [Rails-spinoffs] Yahoo!-like Event object emulation/abstractioninPrototype?

2006-06-15 Thread Ryan Gahl
age-> # > From: [EMAIL PROTECTED]> # [mailto: rails-spinoffs-> # > [EMAIL PROTECTED]] On Behalf Of Sam Rowe> # > Sent: Thursday, June 15, 2006 11:24 AM> # > To: rails-spinoffs@lists.rubyonrails.org> # > Subject: Re: [Rails-spinoffs] Yahoo!-like Event ob

Re: [Rails-spinoffs] Yahoo!-like Event object emulation/abstractioninPrototype?

2006-06-15 Thread Ryan Gahl
static methods (like Event.element() and Event.positionY and positionX), which you can use in a cross-browser manner... and then you still have access the original (browser native) Event object if you need it. On 6/15/06, Sam Rowe <[EMAIL PROTECTED]> wrote: On Thu, Jun 15, 2006 at 02:26:0

Re: [Rails-spinoffs] Yahoo!-like Event object emulation/abstractioninPrototype?

2006-06-15 Thread Ryan Gahl
ject... lol sorry I was so blind... so using Event.element(e).id was really all you were looking for... my bad!! I'm just going to leave the above code like that though so you can see a working example of bindAsEventListener()... On 6/15/06, Sam Rowe <[EMAIL PROTECTED]> wrote: On Thu,

Re: [Rails-spinoffs] Yahoo!-like Event object emulation/abstractioninPrototype?

2006-06-15 Thread Ryan Gahl
15/06, Ryan Gahl <[EMAIL PROTECTED]> wrote: jojo is a member method of taco (in your previous posts I think both me and Greg assumed your function was at the global scope level)... change your Event.observe line to the following...Event.observe(x,'click', this.jojo.bindAsEventListener(t

Re: [Rails-spinoffs] Yahoo!-like Event object emulation/abstractioninPrototype?

2006-06-15 Thread Ryan Gahl
jojo is a member method of taco (in your previous posts I think both me and Greg assumed your function was at the global scope level)...change your Event.observe line to the following...Event.observe(x,'click', this.jojo.bindAsEventListener(this));On 6/15/06, Sam Rowe <[EMAIL PROTECTED]> wrote: On

Re: [Rails-spinoffs] Yahoo!-like Event object emulation/abstractionin Prototype?

2006-06-15 Thread Ryan Gahl
ls-spinoffs] Yahoo!-like Event object# > emulation/abstractionin Prototype? # ># > On Thu, Jun 15, 2006 at 08:44:13AM -0500, Ryan Gahl wrote:# > #Um... Event.observe() -- it's been there all along and does that# > #abstraction.# ># > Weird, I wonder why none of my

Re: [Rails-spinoffs] Why such bad performance with IE ?

2006-06-15 Thread Ryan Gahl
ease a file that overloads the drag-drop stuff with all that, so we can share in the greatness J   Would it be non-trivial to implement that lazy-loading in a generic enough way that you could do that?   Greg   From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Ryan Gah

Re: [Rails-spinoffs] Yahoo!-like Event object emulation/abstraction in Prototype?

2006-06-15 Thread Ryan Gahl
i had a typo in there, and Greg beat me to it... yep Greg's example should work perfectly tooOn 6/15/06, Ryan Gahl < [EMAIL PROTECTED]> wrote:Ahh... the event object itself... what you need is proto's bindAsEventListener method. myClass = Class.create();myClass.prototype ={init

Re: [Rails-spinoffs] Yahoo!-like Event object emulation/abstraction in Prototype?

2006-06-15 Thread Ryan Gahl
nction(e){//use e },};The above will work cross-browser. Otherwise, in the example you gave, you can do the following in myFunc...function myFunc(e){if (!e) e = window.event ;//use e}On 6/15/06, Sam Rowe <[EMAIL PROTECTED]> wrote: On Thu, Jun 15, 2006 at 08:44:13AM -0500, Ryan Gahl wrote:#  

Re: [Rails-spinoffs] Why such bad performance with IE ?

2006-06-15 Thread Ryan Gahl
Do you have a ton of draggables on the page at a time (or droppables)?If so, one work around is to "lazy load" the instantiation of the draggable object. That is, only actually make an element draggable at the very point at which dragging functionality is needed (in this case the mouseover event mi

Re: [Rails-spinoffs] generic onDragStart onDrag and onDragFinish events extracted from scriptaculous?

2006-06-15 Thread Ryan Gahl
I think he mentioned SortableObserver just as an example. There is also the more generic DraggableObserver construct available...this.draggable = new Draggable($("someElement"), dragOptions);this.draggableObserver = {            onStart: function(eventName, draggable, event) {                if (d

Re: [Rails-spinoffs] Yahoo!-like Event object emulation/abstraction in Prototype?

2006-06-15 Thread Ryan Gahl
Um... Event.observe() -- it's been there all along and does that abstraction.On 6/15/06, Sam Rowe <[EMAIL PROTECTED] > wrote:Hi,I was reading about the Yahoo! library recently and was really excited by the idea that I wouldn't have to branch for IE in myevent handlers. Is there any chance that such

Re: [Rails-spinoffs] Re: why some features uses new and some just static function call

2006-06-14 Thread Ryan Gahl
Well then I guess I was wrong :-)Just do what works and call it magic :-)On 6/14/06, Reynard Hilman < [EMAIL PROTECTED]> wrote:Thanks for the explanation. The functions that require instantiation won't work if you just call the function though. Hmm, I'm pretty sure they can all be used either wa

Re: [Rails-spinoffs] why some features uses new and some just static function call

2006-06-13 Thread Ryan Gahl
Hmm, I'm pretty sure they can all be used either way, since functions are first class objects (you can either invoke or instanstiate, and instantiation also causes invocation of the constructor, which in this case is also the meat and potatoes)... I think instantiation of the Effects, et. al., depe

Re: [Rails-spinoffs] scriptaculous & sortables/draggables scrolling?

2006-06-13 Thread Ryan Gahl
Ahh, yes, good thinking. I'll bet the document.documentElement wasn't working how you wanted because your content wasn't pushing that element down far enough on the page (it must only make itself tall enough to envelope the bottom-most element). On 6/13/06, ML <[EMAIL PROTECTED]> wrote: Leon,"scrol

Re: [Rails-spinoffs] scriptaculous & sortables/draggables scrolling?

2006-06-12 Thread Ryan Gahl
If you are using the latest build, the following should work... (maybe just use document instead of documentElement)var myDraggable = new Draggable($('someElement'), {scroll: document.documentElement}); On 6/12/06, ML <[EMAIL PROTECTED]> wrote: Re,Would anyone happen to know how to make sortable/dr

Re: [Rails-spinoffs] Re: Cross Broswer Fire Event

2006-06-12 Thread Ryan Gahl
That would only execute the function that is attached to the onclick event (if there is one), not actually cause the onclick event to fire. Also, if there was not function attached to the onclick event, that would cause an error. To actually fire the event and cause all event handlers to execute (w

Re: [Rails-spinoffs] Ajax - preloading images

2006-06-12 Thread Ryan Gahl
For both methods, my untested assumption is that you have to attach some element(s) to the DOM which actually triggers the browser to load the images from the server, or use the _javascript_ Image() object to do the same. The XHR object is only getting XML/text... not the binary data. On 6/12/06,

  1   2   3   4   >