[Proto-Scripty] script.aculo.us Effect.Scale issue
Hi, i am trying to scale up an HTML element, after scaling it down with Effect.Scale. The problem is that this is animated ONLY on scale down. when scaling up, the resize is produced instantly, without any animation, while scaling down occurs at it should. So roughly the steps would be: // shrinking myElement to 0 height new Effect.Scale(myElement, 0, {duration:0.2, scaleX:false, scaleContent:false} ); //restoring myElement to original size new Effect.Scale(myElement, 100, {duration:0.2, scaleX:false, scaleContent:false, scaleMode:{originalHeight:200} } ); Does anyone have any idea why the scaling up animation does not occur? Thanks! -- 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] err fred.loginfo is not function.
HI, I am new programmer. I looking to work with OOP in javascript. I heard about prototypejs, and I try to run my first CODE in firefox7.0.1 And Prototype JavaScript framework, version 1.7 . The err that I got is fred.loginfo is not function below the code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head script type=text/javascript src=/prototype_js/prototype.js/ script title/title /head body script language=javascript type=text/javascript function player(n,s,r){ this.name=n; this.score=s; this.rank=r; } player.prototype.promte=function(){ this.rank++; console.log(my new rank is: ,this.rank); } var fred=new player(fred,1,5); fred.loginfo(); fred.promote(); var bob=new player(bob,50,1); fred.loginfo(); fred.promote(); var alise=new player(alise,233,33); fred.loginfo(); fred.promote(); /script /body /html -- 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: err fred.loginfo is not function.
Hi, You haven't given your `player` object a method called `loginfo` at all, which is why you're getting that error (the property `fred.loginfo` will come back `undefined`, which naturally fails when you try to execute it via `()`). Also, you have a typo where you're creating your `promote` function, it's a `promte` instead, so if you got past the `loginfo` call you'd run into the same problem with `promote`. And note that in your test code at the end, you create `bob` and `alice` instances but you continue to call the methods on the `fred` instance. You said you're a new programmer. One thing to take away from this is that computers are incredibly picky about small details. :-) FYI, if a function is a constructor function (intended to be used with `new`, like your `player` function), the convention is to use initial caps on the name, e.g. `Player` with a capital `P`. Other functions are written in camelCase. This helps differentiate functions that aren't constructor functions from ones that are. It's only a convention, but it's very widely-used. If you're new to JavaScript, I did a series of blog posts/articles on the language you may find helpful (or not, of course). If you start here[1] and then work your way forward through the posts chronologically, it may be helpful. [1] http://blog.niftysnippets.org/2008/02/javascripts-curiously-powerful-or.html HTH, -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Oct 16, 6:55 pm, Yossi rness...@gmail.com wrote: HI, I am new programmer. I looking to work with OOP in javascript. I heard about prototypejs, and I try to run my first CODE in firefox7.0.1 And Prototype JavaScript framework, version 1.7 . The err that I got is fred.loginfo is not function below the code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head script type=text/javascript src=/prototype_js/prototype.js/ script title/title /head body script language=javascript type=text/javascript function player(n,s,r){ this.name=n; this.score=s; this.rank=r; } player.prototype.promte=function(){ this.rank++; console.log(my new rank is: ,this.rank); } var fred=new player(fred,1,5); fred.loginfo(); fred.promote(); var bob=new player(bob,50,1); fred.loginfo(); fred.promote(); var alise=new player(alise,233,33); fred.loginfo(); fred.promote(); /script /body /html -- 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: method ON vs OBSERVE
On Oct 16, 2:45 pm, clockworkgeek nonproffessio...@clockworkgeek.com wrote: I find IE doesn't bubble it's field-related events properly so you still need to use `observe` for those cases. As a fix I suppose 'on' could search it's children for fields and manually apply `observe` on those but it wouldn't be ideal, dynamically added fields would be exempt. IE doesn't bubble `focus` or `blur`, but it does bubble the IE- specific `focusin` and `focusout` events. jQuery maps `focus` to `focusin` (and similarly for `blur`/`focusout`) in its event delegation stuff. I think that would be a better way to go. -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com -- 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: strange problem with detect method and cloning data
Hi, The code you've quoted has a variety of syntax errors and typos, such as using `function initialize()` within an object literal (which results in an Unexpected identifier error) and using `Class.Create` rather than `Class.create`. It's very hard to help when the code presented is fundamentally broken and yet reported as working. I recommend going back to first principles, building a minimal failing test case, and if you don't solve the problem in the course of doing that (which frequently happens), putting it on jsbin.com or jsfiddle.net or similar and then linking to it so people can help you. -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Oct 17, 3:37 am, buda www...@pochta.ru wrote: I have a class var a = Class.Create({ function initialize() { var _items = []; Object.defineProperties(this, { 'items': { get: function () { return Object.clone(_items); }, enumerable: true } }); ...} function indexOf(item) { return -1; } }); then I create an instance of the class var b = new a(); then I fill the _items with the data [ { name: 'Joe', last: 'Celko' }, { name: 'Ivan', last: 'Susanin' } ] and ovewrite the indexOf method with thw new one b.indexOf = function(item) { var index = -1; var items = this.items; items.detect(function(el, idx) { var b = (el.name === item.name) (el.last === item.last); b (index = idx); return b; }); return index; }; then i try to seach b.indexOf({ name: 'Joe', last: 'Celko' }); and always get -1 !!! I try to debug and detect the this._each in Enumerable.each never goes into, but if I chnge return Object.clone(_items); --- return _items; everything goes ok and returns 0! Why? Help me please. I cannot expose original items because changes on it maybe damaged -- 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: strange problem with detect method and cloning data
On Oct 17, 10:17 am, T.J. Crowder t...@crowdersoftware.com wrote: It's very hard to help when the code presented is fundamentally broken and yet reported as working. Sorry, in print that comes across much more harshly than it was intended to. I only mean that it's easier to help debug code that's a bit more cleaned up, wasn't meant as a dig. -- T.J. -- 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: What performs better? 30 observers on specific elements or 1 Observer observing every click?
You can use some dispatching mechanism, e.g.: 1. HTML: all your clickable elements have special class or attribute like a class=widget chooserchooser/a or a data-widget-type=chooserchooser/a 2. JS: your single observer finds somehow your desired element and dispatches event accordingly to the special class of element (chooser in this sample) var widgetType = element.readAttribute(data-widget-type) || ; if (widgetType Widgets[widgetType]) { Widgets[widgetType].handleEvent(element); } -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/tekiC8jpxlMJ. 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: What performs better? 30 observers on specific elements or 1 Observer observing every click?
Do I understand this right that you suggest adding one special class or attribute to all clickable elements, so that in my observer I can check for that class/attribute in the very first line minimizing the amount of if statements PLUS you suggest to delegate the triggered event to the [clicked] element so that I don't have one big eventhandler and can keep a good software structure? If I understand this right this would be THE answer. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/HR4SX-ts9ZoJ. 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] Adding CSS-Rules to a styletag in Prototype
Hi there, I wanna add CSS-Definitions to a style-tag using Prototype. In all good browsers (ALL^IE) this works by simplay appending a CSS-String to the desired style-tag. IE doesn't like this though. I found [1] that in IE you can update the entire contents of the style-tag using an attribute named * cssText* but that doesn't append but replace the all definitions. So I was wondering, does Prototype JS already have a method to append style-definitions to a styletags for all browsers? Thanks, Lukas [1] http://acidmartin.wordpress.com/2009/05/06/creating-style-tag-with-javascript-and-adding-rules-to-it/ -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/4fQMnC0XkpIJ. 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.
Re: [Proto-Scripty] Re: err fred.loginfo is not function.
*Thanks allot. You help me * On Mon, Oct 17, 2011 at 9:33 AM, T.J. Crowder t...@crowdersoftware.comwrote: Hi, You haven't given your `player` object a method called `loginfo` at all, which is why you're getting that error (the property `fred.loginfo` will come back `undefined`, which naturally fails when you try to execute it via `()`). Also, you have a typo where you're creating your `promote` function, it's a `promte` instead, so if you got past the `loginfo` call you'd run into the same problem with `promote`. And note that in your test code at the end, you create `bob` and `alice` instances but you continue to call the methods on the `fred` instance. You said you're a new programmer. One thing to take away from this is that computers are incredibly picky about small details. :-) FYI, if a function is a constructor function (intended to be used with `new`, like your `player` function), the convention is to use initial caps on the name, e.g. `Player` with a capital `P`. Other functions are written in camelCase. This helps differentiate functions that aren't constructor functions from ones that are. It's only a convention, but it's very widely-used. If you're new to JavaScript, I did a series of blog posts/articles on the language you may find helpful (or not, of course). If you start here[1] and then work your way forward through the posts chronologically, it may be helpful. [1] http://blog.niftysnippets.org/2008/02/javascripts-curiously-powerful-or.html HTH, -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Oct 16, 6:55 pm, Yossi rness...@gmail.com wrote: HI, I am new programmer. I looking to work with OOP in javascript. I heard about prototypejs, and I try to run my first CODE in firefox7.0.1 And Prototype JavaScript framework, version 1.7 . The err that I got is fred.loginfo is not function below the code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head script type=text/javascript src=/prototype_js/prototype.js/ script title/title /head body script language=javascript type=text/javascript function player(n,s,r){ this.name=n; this.score=s; this.rank=r; } player.prototype.promte=function(){ this.rank++; console.log(my new rank is: ,this.rank); } var fred=new player(fred,1,5); fred.loginfo(); fred.promote(); var bob=new player(bob,50,1); fred.loginfo(); fred.promote(); var alise=new player(alise,233,33); fred.loginfo(); fred.promote(); /script /body /html -- 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. -- 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: script.aculo.us Effect.Scale issue
If you're running the two effects next to each other like that in the code, the behavior describing makes sense, and the effects are triggered asynchronously. There are two ways to accomplish a synchronous chain: * Effect queues (my preference) ** http://madrobby.github.com/scriptaculous/effect-queues/ ** http://www.google.com/search?q=scriptaculous+queue+effectsie=UTF-8oe=UTF-8 * Using the afterFinish callback, which fires, not surprisingly, after the effect in question finishes. ** http://madrobby.github.com/scriptaculous/core-effects/ TAG On Oct 16, 9:56 am, Annatar stefan.o...@gmail.com wrote: Hi, i am trying to scale up an HTML element, after scaling it down with Effect.Scale. The problem is that this is animated ONLY on scale down. when scaling up, the resize is produced instantly, without any animation, while scaling down occurs at it should. So roughly the steps would be: // shrinking myElement to 0 height new Effect.Scale(myElement, 0, {duration:0.2, scaleX:false, scaleContent:false} ); //restoring myElement to original size new Effect.Scale(myElement, 100, {duration:0.2, scaleX:false, scaleContent:false, scaleMode:{originalHeight:200} } ); Does anyone have any idea why the scaling up animation does not occur? Thanks! -- 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: Adding CSS-Rules to a styletag in Prototype
i don't think Prototype has a method for directly editing a STYLE tag (only for modifying styles on element[s]. But http://stackoverflow.com/questions/524696/how-to-create-a-style-tag-with-javascript seems to offer a couple cross-browser approaches by examining feature support to determine which way to append style rules to the interior of a STYLE tag. i haven't tested, but as they say, seems legit. -joe t. On Oct 17, 11:55 am, Luke lukas.bomb...@googlemail.com wrote: Hi there, I wanna add CSS-Definitions to a style-tag using Prototype. In all good browsers (ALL^IE) this works by simplay appending a CSS-String to the desired style-tag. IE doesn't like this though. I found [1] that in IE you can update the entire contents of the style-tag using an attribute named * cssText* but that doesn't append but replace the all definitions. So I was wondering, does Prototype JS already have a method to append style-definitions to a styletags for all browsers? Thanks, Lukas [1]http://acidmartin.wordpress.com/2009/05/06/creating-style-tag-with-ja... -- 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: strange problem with detect method and cloning data
it's ok T.J. - I'll try to write a test on JS Bin and write link here to reproduce the bug On 17 окт, 12:33, T.J. Crowder t...@crowdersoftware.com wrote: On Oct 17, 10:17 am, T.J. Crowder t...@crowdersoftware.com wrote: It's very hard to help when the code presented is fundamentally broken and yet reported as working. Sorry, in print that comes across much more harshly than it was intended to. I only mean that it's easier to help debug code that's a bit more cleaned up, wasn't meant as a dig. -- T.J. -- 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: strange problem with detect method and cloning data
Here is a sample from my code http://jsfiddle.net/QW8vM/9/ On 17 окт, 12:33, T.J. Crowder t...@crowdersoftware.com wrote: On Oct 17, 10:17 am, T.J. Crowder t...@crowdersoftware.com wrote: It's very hard to help when the code presented is fundamentally broken and yet reported as working. Sorry, in print that comes across much more harshly than it was intended to. I only mean that it's easier to help debug code that's a bit more cleaned up, wasn't meant as a dig. -- T.J. -- 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: strange problem with detect method and cloning data
sorry - this is a write link http://jsfiddle.net/QW8vM/10/ -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/3QhVzBt2bpUJ. 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: strange problem with detect method and cloning data
here the code http://jsfiddle.net/QW8vM/10/ -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/NzCfXch19G8J. 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.