[Proto-Scripty] Re: finding absolute position of an element / IE7 browser detect?

2010-12-16 Thread doug


On Dec 16, 7:37 am, RobG  wrote:
> On Dec 16, 12:36 am, doug  wrote:
> [...]
>
> > Any ideas on how I can do this without an IE7 browser detect?
>
> Let me know if this works in IE 7:
>
> http://www.cinsoft.net/position.html>
>
> --
> Rob

I can't get that one to work for me.  Oh well...


Wish prototype had a version of getOffsetParent();  that worked w
objects inside overflow:auto divs...  Right now I am stuck.

-- 
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-scriptacul...@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] Can I change what new [someClass] will return?

2010-12-16 Thread Richard Quadling
On 16 December 2010 16:36, Luke  wrote:
> Hi,
>
> if you define a Class like
>
> --
> var TestClass = Class.create({
>        initialize: function(element) {
>                element = $(element);
>                this.doFunkyStuffWithElement(element)
>                return element;
>        },
>        doFunkyStuffWithElement: function(element) { log("funky stuff
> here") }
> });
> --
>
> and you instantiate that Class
>
> var myObject = new TestClass();
>
> is there a way I can change it so (while namespacing my Class-Code so
> Prototype's Class will remain untouched) that instantiation of that
> class will return something different than what Prototype returns (in
> my case a DOM-Object that has been extended with custom Methods)?
>
>
> ---
> Why I want to do this: I'm working on a site where you can create
> really simple webpages by adding, editing, and removing elements on
> your page. To structure my code I make use of prototype's dom-
> extending nature and its way of class-inheritance:
> There is a base class for elements on the page which has methods for
> editing and removing that object and so on. I subclass this base-class
> for specific elements where I implement the specific editing/removing/
> whatever-code. Now to map my functionality to the elements on the
> page, I extend the DOM-Elements which you can edit/etc with the
> methods and properties of the class, leaving out unnecessary
> constructors etc.
>
> But it is always a little annoying to extend an object with a class,
> and then fetch that object again to work with it:
>
> --
> new EditablePicture($('the_element_I_extend'));
> var my_element = $('the_element_I_extend');
> my_element.do_something();
> --
>
> it would be nice to be able to do something like this:
>
> --
> var my_element = new EditablePicture($('the_element_I_extend'));
> my_element.do_something();
> --
>
> Is that kind of stuff even possible?
>
> Thank you
> Lukas
>
> --
> 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-scriptacul...@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.
>
>

Yep - I think so. Look at around line 80 of prototype.js

function klass() {
  return this.initialize.apply(this, arguments);
}

The return is something I've been using since May 2008 with all the
releases and updates since then.

I've not had any issues with my code or with scripty with it.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
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-scriptacul...@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] Is there a way to get the name of a class from within the class?

2010-12-16 Thread bernard
I truly wish some people would take the trouble to buy a javascript book 
instead of off-topic-posting in this group... meh.

b.

Intellectual honesty consists in taking ideas seriously. To take ideas 
seriously means that you intend to live by, to practice, any idea you accept as 
true.
[Ayn Rand]

--
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-scriptacul...@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] Is there a way to get the name of a class from within the class?

2010-12-16 Thread Luke
Hi,

If you define a class like

var MyCoolClass = Class.create({

  initialize: function() {
// find out classname here
  }

});

can you get the name of the class from within itself? After all it's
just a variable-name, but is it somehow accessible?

Thank you
Lukas

-- 
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-scriptacul...@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] Can I change what new [someClass] will return?

2010-12-16 Thread Luke
Hi,

if you define a Class like

--
var TestClass = Class.create({
initialize: function(element) {
element = $(element);
this.doFunkyStuffWithElement(element)
return element;
},
doFunkyStuffWithElement: function(element) { log("funky stuff
here") }
});
--

and you instantiate that Class

var myObject = new TestClass();

is there a way I can change it so (while namespacing my Class-Code so
Prototype's Class will remain untouched) that instantiation of that
class will return something different than what Prototype returns (in
my case a DOM-Object that has been extended with custom Methods)?


---
Why I want to do this: I'm working on a site where you can create
really simple webpages by adding, editing, and removing elements on
your page. To structure my code I make use of prototype's dom-
extending nature and its way of class-inheritance:
There is a base class for elements on the page which has methods for
editing and removing that object and so on. I subclass this base-class
for specific elements where I implement the specific editing/removing/
whatever-code. Now to map my functionality to the elements on the
page, I extend the DOM-Elements which you can edit/etc with the
methods and properties of the class, leaving out unnecessary
constructors etc.

But it is always a little annoying to extend an object with a class,
and then fetch that object again to work with it:

--
new EditablePicture($('the_element_I_extend'));
var my_element = $('the_element_I_extend');
my_element.do_something();
--

it would be nice to be able to do something like this:

--
var my_element = new EditablePicture($('the_element_I_extend'));
my_element.do_something();
--

Is that kind of stuff even possible?

Thank you
Lukas

-- 
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-scriptacul...@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: finding absolute position of an element / IE7 browser detect?

2010-12-16 Thread RobG


On Dec 16, 12:36 am, doug  wrote:
[...]
> Any ideas on how I can do this without an IE7 browser detect?

Let me know if this works in IE 7:

http://www.cinsoft.net/position.html >

--
Rob

-- 
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-scriptacul...@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.