[Proto-Scripty] Re: Text selections

2011-05-09 Thread T.J. Crowder
On May 10, 5:16 am, kstubs wrote: > Ok, yep cool, nice demo!   > So the select() is easy enough, but what about:  selecting the word "gently" > in a textarea?  So you might have: > > row row row your boat gently down the stream It's not specific to Prototype, but you might find Rangy useful: http

Re: [Proto-Scripty] Text selections

2011-05-09 Thread kstubs
Ok, yep cool, nice demo! So the select() is easy enough, but what about: selecting the word "gently" in a textarea? So you might have: row row row your boat gently down the stream -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" gro

Re: [Proto-Scripty] Text selections

2011-05-09 Thread Walter Davis
Selecting all text in a textarea is as simple as $ ('theIdOfTheBox').select(); I have written an example that works with any text on the page, inspired by the New York Times' definition widget. http://scripty.walterdavisstudio.com/lookup Walter On May 9, 2011, at 10:33 PM, kstubs wrote: C

[Proto-Scripty] Text selections

2011-05-09 Thread kstubs
Can anyone recommend code or library that helps with making text selections? For example, selecting all text in a texarea? Does Prototype help with this at all? Karl.. -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post t

[Proto-Scripty] Re: Element not extended automatically?

2011-05-09 Thread blackfrancis
Ahhh, I found the issue. My page was including mootools automatically (it's a Joomla template). That was preventing my elements from being extended properly. Thanks On May 9, 11:16 am, "T.J. Crowder" wrote: > Hi, > > That's strange, if you're getting the element from $(), it should > already b

[Proto-Scripty] Re: Element not extended automatically?

2011-05-09 Thread blackfrancis
To boil it down to the essentials, the following statement is failing with 'Object doesn't support this property or method'. 'root' is a UL element: $('root').hasClassName("level"); On May 9, 11:16 am, "T.J. Crowder" wrote: > Hi, > > That's strange, if you're getting the element from $(), it s

Re: [Proto-Scripty] IE Sortable issue

2011-05-09 Thread Walter Davis
This page is still really invalid. For example, there is a close body tag, but no open body tag. It works fine in Safari, but that's just Safari being kind, I think. Also, each of your form elements that you're sorting has a mis-match between name and id attributes, and that's another thing

[Proto-Scripty] Re: Element not extended automatically?

2011-05-09 Thread blackfrancis
Thanks for your reply. Yeah, I'm using IE8's crappy debugger; I can see the this.element exists and the methods on it - they're the standard methods. It is really strange. Well, if anything else occurs please let me know. -- You received this message because you are subscribed to the Google Grou

Re: [Proto-Scripty] IE Sortable issue

2011-05-09 Thread Audrey Bowman
Okay. So the Self-contained test you provided works just fine in IE7. here's mine: http://test.tpionline.com/Audrey/TPI_new_platform/dynamic_invoicing/test.php It still fails in IE7 to allow the first element to be reordered. Still not sure what's going on with it. I appreciate all the help! Tha

[Proto-Scripty] Re: Element not extended automatically?

2011-05-09 Thread T.J. Crowder
Hi, That's strange, if you're getting the element from $(), it should already be extended (and if not, explicitly extending it should work). My only thought is that for some reason, the element lookup isn't working at all and so it's not that it's not extended, but that the element isn't there. T

[Proto-Scripty] Element not extended automatically?

2011-05-09 Thread blackfrancis
My script is throwing an error on 'this.element.hasClassName()' in IE (only, Chrome works fine). Debugging, I see that the method is not present on the element. I gather that this is because the element is not automatically Extended. I put the line 'Element.extend(this.element)' before it in the s

[Proto-Scripty] Element.cleanWhitespace not recursive?

2011-05-09 Thread sclaflin
I ran into this recently - I thought that in the past it had been recursive. But, the code I see looks like: cleanWhitespace: function(element) { element = $(element); var node = element.firstChild; while (node) { var nextNode = node.nextSibling; if (node.nodeType == 3 &

[Proto-Scripty] Re: Enumerable sort descending

2011-05-09 Thread kstubs
Fruit of my labors: http://beta.meetscoresonline.com/results/11827 Now the results grid should populate on initial load of the page, so that is a bug (works locally, of course). To get it to populate, you just need to drop down a navigation selection. Currently working well on FF. TJ., the li

[Proto-Scripty] Re: Enumerable sort descending

2011-05-09 Thread T.J. Crowder
Hi, > Hey, what stops me from this: Nothing at all (since `Array#sort` operates on the array in place, but does return the array reference as a return value as well). Well, nothing other than the missing "e" on `reverse`. ;-) Note that if you do that, `list` will be an `Array`, regardless of wha

[Proto-Scripty] Re: Enumerable sort descending

2011-05-09 Thread kstubs
Hey, what stops me from this: list = list.sortBy(function(s) { if(field.field.startsWith('EventScore') || field.field == 'AAScore') return Number(Object.values(s)[index]); else return Object.values(s)[index];

[Proto-Scripty] Re: Enumerable sort descending

2011-05-09 Thread kstubs
It does! OK, so I had this: var copylist = list; list = new Array(); for(i = copylist.size(); i>0; i--) { list.push(copylist[i - 1]); } No I have this: list = list.reverse(); Works! Thanks, Karl.

[Proto-Scripty] Re: Enumerable sort descending

2011-05-09 Thread T.J. Crowder
Hi, On May 9, 9:27 am, kstubs wrote: > OK TJ, I understand what to do, but is there a way to iterate backwards > through the enumeration?  I guess I can get the size, and iterate over it > with a decremental index value. I'd use `Enumerable#toArray` and then either reverse it or loop through it

[Proto-Scripty] Re: Enumerable sort descending

2011-05-09 Thread kstubs
OK TJ, I understand what to do, but is there a way to iterate backwards through the enumeration? I guess I can get the size, and iterate over it with a decremental index value. -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To

[Proto-Scripty] Re: Enumerable sort descending

2011-05-09 Thread Julien Lenne
Hi, So to answer your questions that were asked at first : - To sort descending an Array : - You sort it with the JS native function sort() - You use sortBy and return "-your_array.indexOf(current_element)" - To sort alphanumeric fields : - It's already done by the sort function, but if you

[Proto-Scripty] Re: Enumerable sort descending

2011-05-09 Thread T.J. Crowder
Hi, Sorry, I gave you a bum steer there. `sortBy` works completely differently from `sort`. Apparently, you only get given one element (and its index, as a second parameter the documentation doesn't mention, perhaps it's not explicitly supported) and you're meant to return some piece of informatio

Re: [Proto-Scripty] Re: Can't load google maps

2011-05-09 Thread venu gupta
Thanks Crowder. The latest version has solved my problem [?] On Mon, May 9, 2011 at 12:31 PM, T.J. Crowder wrote: > Hi, > > OMG. Out of curiousity, I looked at the prototype.js file you > referenced in that file; wow was I in for a shock: You're using > Prototype 1.3.1?!?!?!! > > That version was

[Proto-Scripty] Re: Enumerable sort descending

2011-05-09 Thread Julien Lenne
Hello, Have you tried to return with a minus operand to reverse the order ? Regards, Julien. On May 9, 9:46 am, kstubs wrote: > Thanks for the tips.  Since my posting I discovered sortBy().  So I'm close, > but don't see how/where to pass in the 2nd argument to compare.  I have: > > list = list

[Proto-Scripty] Re: Enumerable sort descending

2011-05-09 Thread kstubs
Thanks for the tips. Since my posting I discovered sortBy(). So I'm close, but don't see how/where to pass in the 2nd argument to compare. I have: list = list.sortBy(function(s) { if(field.field.startsWith('EventScore') || field.field == 'AAScore') return N

[Proto-Scripty] Re: Enumerable sort descending

2011-05-09 Thread T.J. Crowder
On May 9, 3:40 am, kstubs wrote: > How do you sort descending?  Also, how do you distinguish between Alpha, > Alpha-numeric, and Numeric sorts? > > Thanks, loving the methods like sort() and uniq() off enumerable? > > Karl.. `Enumerable` doesn't have a `sort` function. `Array` does, it's part of

[Proto-Scripty] Re: Can't load google maps

2011-05-09 Thread T.J. Crowder
Hi, OMG. Out of curiousity, I looked at the prototype.js file you referenced in that file; wow was I in for a shock: You're using Prototype 1.3.1?!?!?!! That version was superceded more than SIX YEARS AGO. I don't actually know when, because the Prototype changelog doesn't go back that far, but w