[Prototype-core] Re: Browser-Class
Just a few thoughts on this: We could have properties that are updated on scrolling or resizing the window. One possible way is extending document (not really fitting, but this avoids the window issue). Not sure about having default events, though (note that there's already a default event for cleaning up in IE), plus this could slow things down if you don't need this information. I don't like Browser.width/height/scroll too much as it isn't really fitting, as we're interested in the viewport, not the browser window. An other thought, it would be great to have a unified syntax for positioned rectangles, which should be based on CSS, so you can feed output from a "what's the viewport" function directly to a setStyle: // possible syntax $('overlay').setStyle(document.getViewPort()); Sets top, left, width, height -- maybe setStyle autoconverts numbers to 'px' strings. Best, Thomas Am 07.06.2007 um 19:25 schrieb timcharper: > > by the way, here is some code to tell the browsers window height and > scroll position. > > window.f_height = function() { return([window.innerHeight ? > window.innerHeight : null, document.documentElement ? > document.documentElement.clientHeight : null, document.body ? > document.body.clientHeight : null].compact().first()); } > > window.f_scrollTop = function() { return ([window.pageYOffset ? > window.pageYOffset : null, document.documentElement ? > document.documentElement.scrollTop : null, document.body ? > document.body.scrollTop : null].compact().first() ); } > > > > On Jun 7, 1:01 am, Frederic Gaus <[EMAIL PROTECTED]> wrote: >> Hi Tobie, >> >> well, I would prefer something like a new Browser Class. So We >> could use >> >> Browser.type.IE >> Browser.type.Safari >> >> instead of >> >> Prototype.Browser.IE. >> >> These do not really belong to "Prototype". Further we could move >> BrowserFeatures to Browser.feature. >> >> Then we could implement >> >> Browser.getWidth >> Browser.getHeight >> >> What do you think? >> >> Tobie Langel schrieb: >> >> >> >>> Hi Freddy, >> >>> There's a ticket in tract for that already. >> >>> the main thing that has been delaying it's implementation is finding >>> the right names for these mrthods, so any suggestion is welcomed. >> >>> Best, >> >>> Tobie >> >>> On Jun 6, 6:14 pm, Freddy <[EMAIL PROTECTED]> wrote: Hi Guys, >> as far as i know there is no possibility to calculate the size of browserwindow with prototype yet. But this could be very useful to place e.g. a div-popup in the middle of the window. >> I always use my own functions. If you also see a common need I would create a sample patch to include it in prototype. What do you think, is this useful or to specialized? >> >> -- >> Frederic Gaus pgp-key: 93E6903C >> fingerprint: 0C55 4517 CC1E 5F7F 9059 3535 AB54 D8E8 93E6 903C > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: SV: [Prototype-core] Re: Browser-Class
Hi Tobias! Tobias Haagen Michaelsen schrieb: > They are located under Prototype to incurage you to NOT use/depend/rely on > them. You should generally not write code that tests for which browser it > runs in - it's a job for Prototype et al. to add an abstraction layer. Yes, I totally agree. But sometimes you have to, for example if you need a function not implemented in prototype yet Greetings Frederic -- Frederic Gaus pgp-key: 93E6903C fingerprint: 0C55 4517 CC1E 5F7F 9059 3535 AB54 D8E8 93E6 903C --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Browser-Class
by the way, here is some code to tell the browsers window height and scroll position. window.f_height = function() { return([window.innerHeight ? window.innerHeight : null, document.documentElement ? document.documentElement.clientHeight : null, document.body ? document.body.clientHeight : null].compact().first()); } window.f_scrollTop = function() { return ([window.pageYOffset ? window.pageYOffset : null, document.documentElement ? document.documentElement.scrollTop : null, document.body ? document.body.scrollTop : null].compact().first() ); } On Jun 7, 1:01 am, Frederic Gaus <[EMAIL PROTECTED]> wrote: > Hi Tobie, > > well, I would prefer something like a new Browser Class. So We could use > > Browser.type.IE > Browser.type.Safari > > instead of > > Prototype.Browser.IE. > > These do not really belong to "Prototype". Further we could move > BrowserFeatures to Browser.feature. > > Then we could implement > > Browser.getWidth > Browser.getHeight > > What do you think? > > Tobie Langel schrieb: > > > > > Hi Freddy, > > > There's a ticket in tract for that already. > > > the main thing that has been delaying it's implementation is finding > > the right names for these mrthods, so any suggestion is welcomed. > > > Best, > > > Tobie > > > On Jun 6, 6:14 pm, Freddy <[EMAIL PROTECTED]> wrote: > >> Hi Guys, > > >> as far as i know there is no possibility to calculate the size of > >> browserwindow with prototype yet. But this could be very useful to > >> place e.g. a div-popup in the middle of the window. > > >> I always use my own functions. If you also see a common need I would > >> create a sample patch to include it in prototype. What do you think, > >> is this useful or to specialized? > > -- > Frederic Gaus pgp-key: 93E6903C > fingerprint: 0C55 4517 CC1E 5F7F 9059 3535 AB54 D8E8 93E6 903C --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] SV: [Prototype-core] Re: Browser-Class
They are located under Prototype to incurage you to NOT use/depend/rely on them. You should generally not write code that tests for which browser it runs in - it's a job for Prototype et al. to add an abstraction layer. -Tobias -Oprindelig meddelelse- Fra: prototype-core@googlegroups.com [mailto:[EMAIL PROTECTED] På vegne af Frederic Gaus Sendt: 7. juni 2007 09:01 Til: prototype-core@googlegroups.com Emne: [Prototype-core] Re: Browser-Class Hi Tobie, well, I would prefer something like a new Browser Class. So We could use Browser.type.IE Browser.type.Safari instead of Prototype.Browser.IE. These do not really belong to "Prototype". Further we could move BrowserFeatures to Browser.feature. Then we could implement Browser.getWidth Browser.getHeight What do you think? Tobie Langel schrieb: > Hi Freddy, > > There's a ticket in tract for that already. > > the main thing that has been delaying it's implementation is finding > the right names for these mrthods, so any suggestion is welcomed. > > Best, > > Tobie > > On Jun 6, 6:14 pm, Freddy <[EMAIL PROTECTED]> wrote: >> Hi Guys, >> >> as far as i know there is no possibility to calculate the size of >> browserwindow with prototype yet. But this could be very useful to >> place e.g. a div-popup in the middle of the window. >> >> I always use my own functions. If you also see a common need I would >> create a sample patch to include it in prototype. What do you think, >> is this useful or to specialized? > > > > > -- Frederic Gaus pgp-key: 93E6903C fingerprint: 0C55 4517 CC1E 5F7F 9059 3535 AB54 D8E8 93E6 903C --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Browser-Class
On 6/7/07, Christophe Porteneuve <[EMAIL PROTECTED]> wrote: > > > Tobie Langel a écrit : > > and what about making them properties of navigator ? > > ...of window would be more appropriate, don't you think? But, as Andrew complains, it pollutes the global namespace. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Browser-Class
Tobie Langel a écrit : > and what about making them properties of navigator ? ...of window would be more appropriate, don't you think? -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Browser-Class
Hi Tobie, well, I would prefer something like a new Browser Class. So We could use Browser.type.IE Browser.type.Safari instead of Prototype.Browser.IE. These do not really belong to "Prototype". Further we could move BrowserFeatures to Browser.feature. Then we could implement Browser.getWidth Browser.getHeight What do you think? Tobie Langel schrieb: > Hi Freddy, > > There's a ticket in tract for that already. > > the main thing that has been delaying it's implementation is finding > the right names for these mrthods, so any suggestion is welcomed. > > Best, > > Tobie > > On Jun 6, 6:14 pm, Freddy <[EMAIL PROTECTED]> wrote: >> Hi Guys, >> >> as far as i know there is no possibility to calculate the size of >> browserwindow with prototype yet. But this could be very useful to >> place e.g. a div-popup in the middle of the window. >> >> I always use my own functions. If you also see a common need I would >> create a sample patch to include it in prototype. What do you think, >> is this useful or to specialized? > > > > > -- Frederic Gaus pgp-key: 93E6903C fingerprint: 0C55 4517 CC1E 5F7F 9059 3535 AB54 D8E8 93E6 903C --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Browser-Class
On Jun 6, 10:56 pm, Tobie Langel <[EMAIL PROTECTED]> wrote: > and what about making them properties of navigator ? Perhaps, but "navigator" contains metadata about the browser itself. I though about attaching them to "document," but I think that's counterintuitive (viewport dimensions, not document dimensions). On Jun 6, 10:48 pm, Tom Gregory <[EMAIL PROTECTED]> wrote: > How 'bout Viewport.width, Viewport.offset, ... Except that viewportOffset is an element-specific method (it's the renamed-in-trunk version of Position.page), so it wouldn't belong in a Viewport object. So we'd be creating that object for only two methods. Cheers, Andrew --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Browser-Class
and what about making them properties of navigator ? On Jun 6, 11:48 pm, Tom Gregory <[EMAIL PROTECTED]> wrote: > How 'bout Viewport.width, Viewport.offset, ... > > TAG > > On Jun 6, 2007, at 9:27 PM, Andrew Dupont wrote: > > > > > We'd almost have to call them "viewportHeight" and > > "viewportWidth" (perhaps prepended with "get"), since we already have > > "viewportOffset." But I don't know where we'd put them -- they don't > > work as Element methods. > > > I'd suggest "window" if it weren't the global namespace. Thoughts? > > > Cheers, > > Andrew > > > On Jun 6, 5:42 pm, Tobie Langel <[EMAIL PROTECTED]> wrote: > >> Hi Freddy, > > >> There's a ticket in tract for that already. > > >> the main thing that has been delaying it's implementation is finding > >> the right names for these mrthods, so any suggestion is welcomed. > > >> Best, > > >> Tobie > > >> On Jun 6, 6:14 pm, Freddy <[EMAIL PROTECTED]> wrote: > > >>> Hi Guys, > > >>> as far as i know there is no possibility to calculate the size of > >>> browserwindow with prototype yet. But this could be very useful to > >>> place e.g. a div-popup in the middle of the window. > > >>> I always use my own functions. If you also see a common need I would > >>> create a sample patch to include it in prototype. What do you think, > >>> is this useful or to specialized? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Browser-Class
How 'bout Viewport.width, Viewport.offset, ... TAG On Jun 6, 2007, at 9:27 PM, Andrew Dupont wrote: > > We'd almost have to call them "viewportHeight" and > "viewportWidth" (perhaps prepended with "get"), since we already have > "viewportOffset." But I don't know where we'd put them -- they don't > work as Element methods. > > I'd suggest "window" if it weren't the global namespace. Thoughts? > > Cheers, > Andrew > > On Jun 6, 5:42 pm, Tobie Langel <[EMAIL PROTECTED]> wrote: >> Hi Freddy, >> >> There's a ticket in tract for that already. >> >> the main thing that has been delaying it's implementation is finding >> the right names for these mrthods, so any suggestion is welcomed. >> >> Best, >> >> Tobie >> >> On Jun 6, 6:14 pm, Freddy <[EMAIL PROTECTED]> wrote: >> >>> Hi Guys, >> >>> as far as i know there is no possibility to calculate the size of >>> browserwindow with prototype yet. But this could be very useful to >>> place e.g. a div-popup in the middle of the window. >> >>> I always use my own functions. If you also see a common need I would >>> create a sample patch to include it in prototype. What do you think, >>> is this useful or to specialized? > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Browser-Class
We'd almost have to call them "viewportHeight" and "viewportWidth" (perhaps prepended with "get"), since we already have "viewportOffset." But I don't know where we'd put them -- they don't work as Element methods. I'd suggest "window" if it weren't the global namespace. Thoughts? Cheers, Andrew On Jun 6, 5:42 pm, Tobie Langel <[EMAIL PROTECTED]> wrote: > Hi Freddy, > > There's a ticket in tract for that already. > > the main thing that has been delaying it's implementation is finding > the right names for these mrthods, so any suggestion is welcomed. > > Best, > > Tobie > > On Jun 6, 6:14 pm, Freddy <[EMAIL PROTECTED]> wrote: > > > Hi Guys, > > > as far as i know there is no possibility to calculate the size of > > browserwindow with prototype yet. But this could be very useful to > > place e.g. a div-popup in the middle of the window. > > > I always use my own functions. If you also see a common need I would > > create a sample patch to include it in prototype. What do you think, > > is this useful or to specialized? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Browser-Class
Hi Freddy, There's a ticket in tract for that already. the main thing that has been delaying it's implementation is finding the right names for these mrthods, so any suggestion is welcomed. Best, Tobie On Jun 6, 6:14 pm, Freddy <[EMAIL PROTECTED]> wrote: > Hi Guys, > > as far as i know there is no possibility to calculate the size of > browserwindow with prototype yet. But this could be very useful to > place e.g. a div-popup in the middle of the window. > > I always use my own functions. If you also see a common need I would > create a sample patch to include it in prototype. What do you think, > is this useful or to specialized? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Browser-Class
On 6/7/07, Freddy <[EMAIL PROTECTED]> wrote: > > > as far as i know there is no possibility to calculate the size of > browserwindow with prototype yet. But this could be very useful to > place e.g. a div-popup in the middle of the window. First check Trac for existing tickets. I think I already saw some code ready to be included in Prototype. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---