Re: [Rails-spinoffs] Determining the type of an object

2006-06-09 Thread Martin Bialasinski
On 6/9/06, Ryan Gahl <[EMAIL PROTECTED]> wrote: was just pointing out that proto does all that stuff No. Prototype.js actually does far less than the methods described in Douglas' article, you must have misread it. The current prototype implementation is at the bottom end of what is possible. A

Re: [Rails-spinoffs] camelize bug?

2006-06-04 Thread Martin Bialasinski
On 6/3/06, Eric Anderson <[EMAIL PROTECTED]> wrote: Seems that you could just do: var camelizedString = oStringList[0]; and achieve the same thing. Am I missing something? No. http://dev.rubyonrails.org/ticket/4170 Bye, Martin ___ Rails-spinoffs m

Re: [Rails-spinoffs] gsub vs. replace

2006-06-04 Thread Martin Bialasinski
On 6/3/06, Eric Anderson <[EMAIL PROTECTED]> wrote: Also both functions allow the second parameter to be a function (although with different arguments). Not in Internet Explorer 5. This is the sole reason why this function exists. Bye, Martin ___ R

Re: [Rails-spinoffs] Hide content before page load

2006-05-25 Thread Martin Bialasinski
On 5/25/06, Gregory Hill <[EMAIL PROTECTED]> wrote: JS cannot access the attributes if they were set using a

Re: [Rails-spinoffs] Javascript Profiler

2006-05-15 Thread Martin Bialasinski
On 5/15/06, Maninder, Singh <[EMAIL PROTECTED]> wrote: Yep, it can. But, it's too clutterred and too much info. Try this as a start. var Benchmark = new function(){ this.starttime = []; this.start = function(text) { this.starttime.push([new Date(), text || ""]); } this.stop = function

Re: [Rails-spinoffs] 2 clone methods?

2006-05-15 Thread Martin Bialasinski
On 5/15/06, Eric Anderson <[EMAIL PROTECTED]> wrote: I was reviewing the prototype library (current SVN version) to try to understand the library better. I noticed there are two implementations of the "clone" method on the Position object. The first one is just some leftover code. It is overwri

Re: [Rails-spinoffs] Event.observe mystery

2006-04-30 Thread Martin Bialasinski
On 30 Apr 2006 00:48:52 -, Thomas Anderson <[EMAIL PROTECTED]> wrote: I've solved it by using Insertion.Before instead of direct innerHTML but I still don't understand what was wrong with my code... A.innerHTML += B; does C = A.innerHTML; A.innerHTML = "" // HERE A.innerHTML = C + B The

Re: [Rails-spinoffs] .times not behaving as I'd expect

2006-04-29 Thread Martin Bialasinski
On 4/29/06, Jeremy Kitchen <[EMAIL PROTECTED]> wrote: > bug in prototype. Give me a few minutes and I'll get you a patch :) and here it is. The problem was because a do { } while() always runs at least once. So I changed it to a while() {} and it solved the problem. A patch for this bug wa

Re: [Rails-spinoffs] Serialize / deserialize an associative array

2006-04-28 Thread Martin Bialasinski
On 4/28/06, SPENDLOVE, Matt, GBM <[EMAIL PROTECTED]> wrote: That's pretty much what I did in the end anyway. Didn't have any joy with flatten().. There is also Hash.toQueryString() and String.prototype.toQueryParams(). Mind the fix from for the later, laying around in the bug tracker. As you

Re: [Rails-spinoffs] cleanWhitespace and parentNode

2006-04-28 Thread Martin Bialasinski
On 4/28/06, Thomas Fuchs <[EMAIL PROTECTED]> wrote: > Why not write a patch? I froze my Prototype version just prior to the change to $(). Currently, I need stability and this is too much a change in the fundamental workings of the library. The last thing I need are nasty surprises, which there w

Re: [Rails-spinoffs] how to use Effect.BlindUp for resizing a div

2006-04-28 Thread Martin Bialasinski
On 4/26/06, Jeremy Kitchen <[EMAIL PROTECTED]> wrote: > Element.setStyle(element, {height: 123}); Length in CSS always needs a unit, except for 0. There is no "default unit" of px. Whether using the setStyle wrapper or direct assignment, this has to be "123px". ___

Re: [Rails-spinoffs] cleanWhitespace and parentNode

2006-04-28 Thread Martin Bialasinski
On 4/27/06, Siegfried Puchbauer <[EMAIL PROTECTED]> wrote: > The problem is Element.cleanWhiteSpace() calls Element.remove() on empty > textnodes. Element.remove tries to extend the element (Element.Methods) and > IE doesn't support this So prototype now burns cycles to extend an element that

Re: [Rails-spinoffs] issue with $() and child nodes on ie

2006-04-25 Thread Martin Bialasinski
On 4/25/06, Joseph Annino <[EMAIL PROTECTED]> wrote: > - Repeat a set of html code and inserts it as the innerHTML of an > element > Maybe because > after the repeating of the HTML, elements temporarily have the same id. Never insert something into the DOM that results in IDs not being unique. T

Re: [Rails-spinoffs] Limited Autocompleter

2006-04-24 Thread Martin Bialasinski
On 4/24/06, Athman,Joseph J <[EMAIL PROTECTED]> wrote: > I hacked this together on my own using scriptaculous, but I was hoping > someone had already done this better than me? How would we know, you did not show your solution. Bye, Martin ___ Rails-s

Re: [Rails-spinoffs] merging one array into another

2006-04-24 Thread Martin Bialasinski
On 4/24/06, Jeremy Kitchen <[EMAIL PROTECTED]> wrote: > Is there no better way to merge one array into another than iterating over the > array you wish to append with each() and push()ing the elements on to the > other array? Anything wrong with the standard Javascript arr1.concat(arr2) ? :-) Bye

Re: [Rails-spinoffs] problem with drag and drop

2006-04-21 Thread Martin Bialasinski
On 4/21/06, Lindsey Simon <[EMAIL PROTECTED]> wrote: > That just fixed the same problem for me - makes me wonder why this isn't > the default behaviour. Anyone know, out of curiousity? Use the source, Luke. var Position = { // set to true if needed, warning: firefox performance problems // N

Re: [Rails-spinoffs] Form.Serialize - Method's for limiting form data?

2006-04-19 Thread Martin Bialasinski
On 4/17/06, Erin Brewer <[EMAIL PROTECTED]> wrote: > My initial approach is to have a 2nd empty form tag on the page, and > whenever the user changes a form field it will call a function that will > dynamically create a new hidden form element in the 2nd form and write > the attribute name and val

Re: [Rails-spinoffs] evalScripts in IE

2006-04-16 Thread Martin Bialasinski
On 4/16/06, Maninder, Singh <[EMAIL PROTECTED]> wrote: > See the following extract from www.sergiopereira.com - > In case you've tried it before, you know it doesn't work. The reason is that > the script block will be evaluated, and evaluating a script like the above > will not create a function

Re: [Rails-spinoffs] innerHTML and scripts not running

2006-04-14 Thread Martin Bialasinski
Too fast on the trigger finger. > evalScriptsGlobal: function() { > return this.extractScripts().map(function(s){eval(s)}.bind(window)); > }, should rather be evalScriptsGlobal: function() { return this.extractScripts().map(function(s){eval.call(window, s)}); }, _

Re: [Rails-spinoffs] innerHTML and scripts not running

2006-04-14 Thread Martin Bialasinski
To followup to myself: > They are defined in the context the eval is executed in. That is: as > inner functions of the evalScripts method. The way evalScripts is implemented in prototype: as inner functions of the enumerator iteration. A third solution (untested) would be evalScriptsGlobal: f

Re: [Rails-spinoffs] Problems using Sortable with an onUpdate callback

2006-04-14 Thread Martin Bialasinski
On 4/14/06, Matt Adams <[EMAIL PROTECTED]> wrote: > onUpdate: updateOrder('page_33') This calls updateOrder at once and assigns the result to onUpdate. () means "execute the function". Use onUpdate: updateOrder.bind(this, 'page_33') For more details search the mailing list archive for the

Re: [Rails-spinoffs] innerHTML and scripts not running

2006-04-14 Thread Martin Bialasinski
On 4/14/06, Will Merrell <[EMAIL PROTECTED]> wrote: > The one problem with > this is that any code that defines functions works only while being > evaluated. The functions are not defined if you try to call them later. They are defined in the context the eval is executed in. That is: as inner fun

Re: [Rails-spinoffs] Re: Prototype Ajax - How to pass my own params to onComplete

2006-04-10 Thread Martin Bialasinski
On 4/10/06, Todd Ross <[EMAIL PROTECTED]> wrote: > swap theElement and theResponse in your function > NamedActionResponseHandler definition. Your optionally bind()'ed > parameters are passed first. You are right, got that mixed up. Although > 'theResponse' as the returned xml still puzzles me.

Re: [Rails-spinoffs] Prototype Ajax - How to pass my own params to onComplete ?

2006-04-10 Thread Martin Bialasinski
On 4/10/06, Michael Peters <[EMAIL PROTECTED]> wrote: > change this function to return another function. Something like this: Yes, this is also what .bind() does to form a closure without having to change NamedActionResponseHandler > And then call it like this: > onComplete: NamedActionResponse

Re: [Rails-spinoffs] document.write() in ajax response

2006-03-23 Thread Martin Bialasinski
On 3/22/06, Maninder, Singh <[EMAIL PROTECTED]> wrote: > I am not able to follow what you suggested. > > Could you take this example and explain? There is nothing special with document.write. It can be redeclared like any normal property. Just try this in normal page: document.write("written");

Re: [Rails-spinoffs] document.write() in ajax response

2006-03-22 Thread Martin Bialasinski
On 3/22/06, Maninder, Singh <[EMAIL PROTECTED]> wrote: > response is received it will be rendered till the point document.write is > encountered and after that it will write to a new document instead of writing > to the same one. I know this is how document.write is supposed to work. > > But, do

Re: [Rails-spinoffs] Exception in Javascript console in Firefox 1.0.7

2006-03-17 Thread Martin Bialasinski
On 3/17/06, Ryan Gahl <[EMAIL PROTECTED]> wrote: > Why are you not using FF > 1.0.7? sheesh, how many versions have been > released since then? I have both 1.0 and 1.5 installed. When I use FF, I use the 1.0 branch, as there are some to me critical extensions not ported to 1.5 yet. Just for a di

Re: [Rails-spinoffs] [Fwd: [PATCH] Allow generic autocompleter (Ajax.Watcher)]

2006-03-02 Thread Martin Bialasinski
On 3/1/06, Robin Haswell <[EMAIL PROTECTED]> wrote: > Patch to allow generic Ajax.Autocompleter-style textbox watchers. Looks good. But check this: this.hasFocus is never used. In onObserverEvent, check if the value has really changed since the last remote call (user might have just moved the car

Re: [Rails-spinoffs] rant on browser makers (was something about updating TD's)

2006-03-02 Thread Martin Bialasinski
[ On the W3C box model ] Therefore css3 allows to switch the box-model. http://www.w3.org/TR/css3-ui/#box-sizing I expect it to be usable in general web-design around 2017. ___ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists

Re: [Rails-spinoffs] manipulate 's and their contentbygrabbingtheir classNames

2006-03-02 Thread Martin Bialasinski
On 3/2/06, Maninder, Singh <[EMAIL PROTECTED]> wrote: > Like I mentioned earlier, what do you think about using the $$ function? Troels' code would be faster in any case. It also has constant speed, whereas > $$('table#main td.active').each(updateClassName(elm, newClass)) grows linear with the

Re: [Rails-spinoffs] EventPublisher (contribution)

2006-03-01 Thread Martin Bialasinski
> This one is called EventPublisher. Cool, very useful. Although I won't remodel my current project to use it :-) ___ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Re: [Rails-spinoffs] prototype.js ajax w/ post - how to send '+' character

2006-03-01 Thread Martin Bialasinski
On 3/1/06, chuck clark <[EMAIL PROTECTED]> wrote: >postBody: element.name + '=' + escape(element.value), Use encodeURIComponent(), not escape(). ___ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman

Re: [Rails-spinoffs] bindAsEventListener with parameters

2006-02-28 Thread Martin Bialasinski
Or even scratch the args[0] = null; as this "initialization" is not neccessary. ___ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Re: [Rails-spinoffs] bindAsEventListener with parameters

2006-02-28 Thread Martin Bialasinski
On 2/28/06, Todd Ross <[EMAIL PROTECTED]> wrote: > The plain old Function.prototype.bind() provides this exact > functionality. If you want to put that into bindAsEventListener, I'd > recommend using the same variable names/techniques rather than > reinventing them. Well, it is basically the same

Re: [Rails-spinoffs] Disabling anchor clicking in a draggable

2006-02-27 Thread Martin Bialasinski
On 2/28/06, Gregory Hill <[EMAIL PROTECTED]> wrote: > Hmm... that's an interesting approach. Does that work on all browsers? Now that you say it: preventDefault() is broken in Safari. It has been fixed in the nightly builds. But Safari crashes on the app I am building anyway (to heavy on DOM mani

Re: [Rails-spinoffs] Disabling anchor clicking in a draggable

2006-02-27 Thread Martin Bialasinski
> The main problem is that Event.stop stops the onclick event, but it does > not stop the link from firing It sure does. Must be something else in your code. I disable Links on form edit like (excerpt) Event.observe(document.body, "click", noAction.bindAsEventListener(this)); noAction:

[Rails-spinoffs] bindAsEventListener with parameters

2006-02-27 Thread Martin Bialasinski
I would like to share a modification to bindAsEventListener() that might be useful to some of you. It makes it possible to do function show(event, number) { alert(Event.element(event).id + " = " + number); } Event.observe("el1", "click", show.bindAsEventListener(this, 5); Event.observe("el2", "

Re: [Rails-spinoffs] Disabling anchor clicking in a draggable

2006-02-27 Thread Martin Bialasinski
On 2/27/06, Robin Haswell <[EMAIL PROTECTED]> wrote: > I think this would work, I can set the onclick to evaluate a false > function, this is my stanrd method of doing things like this. Strangely I > don't think the event.observe(el, "click") method works for this. When binding an event handler v

Re: [Rails-spinoffs] Sorting Multiple Arrays

2006-02-18 Thread Martin Bialasinski
On 2/17/06, Jason Hummel <[EMAIL PROTECTED]> wrote: > So for instance if I wanted to sort on > myObject.data.line[2] the object would rearrange itself to look like: Thant would be myObject.data = myObject.data.sortBy( function(v){ return v.line[2] }); Bye, Martin __

[Rails-spinoffs] Move element into view

2006-02-18 Thread Martin Bialasinski
Hello, I am in fly-by mode as I am still more than busy, so I just dumb this one out for anyone interested. Adapt it for your needs if you like it. This effect is similar to ScrollTo, but scrolls the viewport vertically the minimal amount necessary to bring the element into view. Usage: new Eff

Re: [Rails-spinoffs] Prototype & Cookies

2006-01-11 Thread Martin Bialasinski
Actually, scratch the previous post, use this one: /* ** ++ Methods to use with Cookiejar: ** ** var kekse = new Cookiejar(cookieJarName, CookiePath) ** This is the constructor.cookieJarName is the name of the collection of ** cookies you would like to associate with this

Re: [Rails-spinoffs] Prototype & Cookies

2006-01-11 Thread Martin Bialasinski
On 11/01/06, Maninder, Singh <[EMAIL PROTECTED]> wrote: > Basically, what I am looking for is if there is an easy way to store mutiple > cookies in a single cookie using hash or something - easy writing and > retrieval (updating the cookie value). How about this for a start: /* ** ++ Metho

Re: [Rails-spinoffs] Wiki Gripe

2006-01-11 Thread Martin Bialasinski
On 11/01/06, Ryan Gahl <[EMAIL PROTECTED]> wrote: > I know this isn't productive, but I must say that I absolutely hate the > wiki. I've never been able to use it for more than a couple minutes before > it completely farts out. Yes, not a too nice situation. The other thing about it is that the w

Re: [Rails-spinoffs] extending the Element.prototype to provide a setAttributes function

2006-01-11 Thread Martin Bialasinski
On 11/01/06, Jeremy Kitchen <[EMAIL PROTECTED]> wrote: > On a side note, it appears that firefox is the most liberal about allowing the > extension of DOM prototypes, since I had a similar issue previously with > trying to add an instance method to the HTMLSelectElement prototype :( In Internet E

Re: [Rails-spinoffs] can I load javascript inside a 'try' block?

2005-12-27 Thread Martin Bialasinski
On 27/12/05, Gregory Hill <[EMAIL PROTECTED]> wrote: > document.write(' src="/javascript/prototype.js">'); > Unfortunately that makes Mozilla display this in the document: > ') } catch (e) {}; You may not include a ETAGO (end tag) in the script. document.write('<\/script>'); If it is ab

Re: [Rails-spinoffs] Performance issues with Prototype

2005-12-21 Thread Martin Bialasinski
On 20/12/05, Nicolas Terray <[EMAIL PROTECTED]> wrote: > 837c840,841 > < if (child.className.match(new RegExp("(^|\\s)" + className + > "(\\s|$)"))) > --- > > var re = new RegExp("(^|\\s)" + className + "(\\s|$)"); > > if (child.className.match(re)) One can even put the var re=... one

Re: [Rails-spinoffs] Performance issues with Prototype

2005-12-21 Thread Martin Bialasinski
On 20/12/05, Gregory Hill <[EMAIL PROTECTED]> wrote: > He's just > copying a value to a local variable and using that instead and there's a > big speed difference? "foo.bar" or even "foo.bar.baz.qwertz" are more expensive to lookup than "temp". So if you have to use the former multiple times (e.g.