[jQuery] Intercepting AJAX responses globally

2009-03-17 Thread [rob desbois]

Hi all,

I'm trying to write a global AJAX response handler which hooks in
*before* the client code receives requested data. The response data
from the server might be in JSON or HTML format depending on where the
request has come from.

I'm trying to build in some client-side handling in case the user's
login session ends between page load and asynchronous request. The
server-side is easy - if the request wants JSON just return
{login_required: true}, if HTML then something like span
id=login_required/span should work for the equivalent.

I have 2 issues here:
1. The global AJAX event ajaxSuccess is being generated after the
local AJAX event success. This means that I can't just prevent the
success handler from running and call the error one instead.
2. Even if I can intercept the events / response in a generic handler
before it is passed to the request-specific handler, I won't know
whether I've got HTML or JSON data.

The other option I can think of is in each response-handler function,
call e.g. 'checkResponse(data, type)' function which does the
necessary checking and returns true/false for ok/not-ok. That seems
risky though as anyone adding a feature which uses async. requests
might forget to use the check function. Obviously I can't defend
against all eventualities but this idea is a bit lacking in 'defensive
programming'.

I know this is a little vague...has anyone implemented this sort of
thing before? Cna anyone point me in the right direction for how to
implement this? I feel like I'm approaching it wrong...

TIA
--rob


[jQuery] Why does $.width return innerWidth but set outerWidth?

2009-02-13 Thread [rob desbois]

Hi all,

I was just writing a bit of JS to set the width of some buttons to the
width of the largest.
While doing this I found that the largest one would shrink!

Doing this in a debugger gives:
$(#x).width(); // 222
$(#x).width(222); // makes element shrink
$(#x).width(); // 216

The number returned from $.width() is equal to the innerWidth() (at
least it is on my button, which has a border but no padding).
When you set it though, if you set it to the value returned, it will
shrink! It won't do this if you pass the return from $.outerWidth().

This seems backwards; I would never expect that passing the return of
a getter to its corresponding setter to change the return from the
getter!

Can someone tell me if this is a bug or is by design - and if by
design, why?
TIA,
--rob


[jQuery] Re: Why does $.width return innerWidth but set outerWidth?

2009-02-13 Thread [rob desbois]

Hi Brandon,

Give this a whirl: http://pastebin.com/d20276791
Shows the described behaviour in Firefox 3.0.6

o_0

--rob


On Feb 13, 2:34 pm, Brandon Aaron brandon.aa...@gmail.com wrote:
 This isn't the normal behavior. Could you create a test case for this?

 --
 Brandon Aaron

 On Fri, Feb 13, 2009 at 5:07 AM, [rob desbois] rob.desb...@gmail.comwrote:



  Hi all,

  I was just writing a bit of JS to set the width of some buttons to the
  width of the largest.
  While doing this I found that the largest one would shrink!

  Doing this in a debugger gives:
  $(#x).width(); // 222
  $(#x).width(222); // makes element shrink
  $(#x).width(); // 216

  The number returned from $.width() is equal to the innerWidth() (at
  least it is on my button, which has a border but no padding).
  When you set it though, if you set it to the value returned, it will
  shrink! It won't do this if you pass the return from $.outerWidth().

  This seems backwards; I would never expect that passing the return of
  a getter to its corresponding setter to change the return from the
  getter!

  Can someone tell me if this is a bug or is by design - and if by
  design, why?
  TIA,
  --rob


[jQuery] Re: Why does $.width return innerWidth but set outerWidth?

2009-02-13 Thread [rob desbois]

Filed on trac too: http://dev.jquery.com/ticket/4146

--rob


On Feb 13, 5:04 pm, [rob desbois] rob.desb...@gmail.com wrote:
 Hi Brandon,

 Give this a whirl:http://pastebin.com/d20276791
 Shows the described behaviour in Firefox 3.0.6

 o_0

 --rob

 On Feb 13, 2:34 pm, Brandon Aaron brandon.aa...@gmail.com wrote:

  This isn't the normal behavior. Could you create a test case for this?

  --
  Brandon Aaron

  On Fri, Feb 13, 2009 at 5:07 AM, [rob desbois] rob.desb...@gmail.comwrote:

   Hi all,

   I was just writing a bit of JS to set the width of some buttons to the
   width of the largest.
   While doing this I found that the largest one would shrink!

   Doing this in a debugger gives:
   $(#x).width(); // 222
   $(#x).width(222); // makes element shrink
   $(#x).width(); // 216

   The number returned from $.width() is equal to the innerWidth() (at
   least it is on my button, which has a border but no padding).
   When you set it though, if you set it to the value returned, it will
   shrink! It won't do this if you pass the return from $.outerWidth().

   This seems backwards; I would never expect that passing the return of
   a getter to its corresponding setter to change the return from the
   getter!

   Can someone tell me if this is a bug or is by design - and if by
   design, why?
   TIA,
   --rob


[jQuery] UI/TABS: Can't enable multiple tabs in one call

2008-07-22 Thread [rob desbois]

Hi all,

I want to enable/disable a couple of tabs at will.
The docs say To enable more than one tab at once reset the disabled
property like: $('#example').data('disabled.ui-tabs', []);

I cannot get this to work at all - what element is the #example
supposed to select? I've been trying on the element I called .tabs()
on initially to create the tabs but that just does nothing

TIA,
--rob


[jQuery] Re: expr in $(, expr) not as expected

2008-07-02 Thread [rob desbois]

On Jul 2, 2:11 pm, Karl Swedberg [EMAIL PROTECTED] wrote:
 On Jul 2, 2008, at 7:57 AM, [rob desbois] wrote:





  Hi, have a feeling this may be a silly question but here goes..

  Test output from Firebug's console is below to explain my issue.

  I select an array of divs by their parent:
  divs = $(#sidebar  div).get()
  [div#sidebar-search-tabcont, div#sidebar-events-tabcont]

  I then want to find a particular one:
  $(div, divs)
  Object length=0 prevObject=Object jquery=1.2.6

  Given that the 'expr' parameter to $(...) contains an array of divs,
  why is using the selector div not returning anything from that?? Am
  I misunderstanding expr?

  Confused...
  --rob

 Hi Rob,

 Your selector $('div', divs) is looking for all div elements contained  
 in any of the divs stored in your variable. So, it's like doing $
 (divs).find('div') . I think you may have been expecting it to work  
 like $(divs).filter('div')? Do any of the divs selected by $(#sidebar  
   div).get() have child divs? If not, the second selector shouldn't  
 be returning anything.

 Hope that makes sense

 --Karl

 
 Karl Swedbergwww.englishrules.comwww.learningjquery.com

Aha! Yes it does.

Seems a bit odd though, the array (or jQuery/DOM object if so) *does*
contain 2 div elements, so I would naturally expect those to be found.

Thanks Karl,
--rob


[jQuery] Re: problem with jquery

2007-10-24 Thread Rob Desbois
Mark,

I think you are saving the document as rich text format (RTF).
Try pasting the code sample into notepad and save it from there.

Once that works, make sure that in whatever editor you're using you save
things as 'plain text'.

Hope that helps
--rob


On 10/24/07, mark [EMAIL PROTECTED] wrote:


 Hi All,

 I am a new person to the world of jQuery.

 I am having a problem in my first program only. Please tell me what is
 wrong over here.

 My code is :

 htmlhead
 script type=text/javascript src=jquery.js/script
 script type=text/javascript
 $(document).ready(function() {
$(a).click(function() {
  alert(Hello world!);
});
 });
 /script/head
 body
 a href=http://google.com;google/a
 /body
 /html

 Output which I am getting is :

 {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss
 \fcharset0 Arial;}} {\*\generator Msftedit
 5.41.15.1507;}\viewkind4\uc1\pard\f0\fs20 \par \par \par \par \tab
 google\par \par \par }




-- 
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] ANNOUNCE: v0.2 of jqMultiSelects released

2007-10-23 Thread Rob Desbois
Hi all,

After a lengthy delay I have released v0.2 of the jqMultiSelects plugin: *
jqMultiSelects* enables you to deal purely with the presentation of your
select elements, and then use the plugin to transfer options from one
select to another.


   - It now conforms with other plugins and accepts all element
   identifiers as jQuery selectors instead of requiring an element ID.


   - Callbacks have been added to enable cancelling the move or just
   hooking into it before and after.


   - option elements can now be automatic submitted with parent form
   submission
   - Size is 4.4KB or 0.6KB packed

Thanks to everyone who made suggestions and waited for so long.

Further information and downloads are available from
http://code.google.com/p/jqmultiselects/
--rob


-- 
Rob Desbois


[jQuery] Re: jqMultiSelects suggestion

2007-10-23 Thread Rob Desbois
Rodrigo,

This has now been implemented along with some additional features.
jqMultiSelects v0.2 is available from
http://code.google.com/p/jqmultiselects/

Cheers,
--rob


On 10/22/07, Rob Desbois [EMAIL PROTECTED] wrote:

 Hey Rodrigo,

 Apologies for the massive time in replying, I am very busy these days.

 That is a great suggestion, and one which a few people have mentioned. I
 will modify the official plugin source as soon as possible, but for now your
 fix does just great :-)

 All the best
 --rob

 On 9/22/07, Rodrigo Moraes [EMAIL PROTECTED] wrote:
 
 
  Hey Rob,
 
  Thanks for jqMultiSelects. Useful one. :)
 
  One suggestion: let the user decide the selectors that will be used
  for the elements, instead of forcing an ID. I modified it to allow
  this:
 
  jQuery.fn.multiSelect = function(to, button) {
  return this.each(function() {
  var select = this;
  jQuery(this).dblclick(function() {
  moveOptions(select, to);
  });
 
  if (typeof button != undefined) {
  jQuery(button).click(function() {
  moveOptions(select, to);
  });
  }
  });
 
  function moveOptions(from, to) {
  jQuery(from).children(option:selected).each(function() {
  jQuery(this)
  .attr(selected, false)
  .appendTo(to);
  });
  }
  };
 
  Then it can be called like this:
 
  $(#select_left).multiSelect(#select_right, #options_right);
  $(#select_right).multiSelect(#select_left, #options_left);
 
  Don't you think it is less restrictive?
  -- rodrigo
 



 --
 Rob Desbois
 Eml: [EMAIL PROTECTED]
 Tel: 07946 705987
 There's a whale there's a whale there's a whale fish he cried, and the
 whale was in full view.
 ...Then ooh welcome. Ahhh. Ooh mug welcome.




-- 
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: jqMultiSelects suggestion

2007-10-22 Thread Rob Desbois
Hey Rodrigo,

Apologies for the massive time in replying, I am very busy these days.

That is a great suggestion, and one which a few people have mentioned. I
will modify the official plugin source as soon as possible, but for now your
fix does just great :-)

All the best
--rob

On 9/22/07, Rodrigo Moraes [EMAIL PROTECTED] wrote:


 Hey Rob,

 Thanks for jqMultiSelects. Useful one. :)

 One suggestion: let the user decide the selectors that will be used
 for the elements, instead of forcing an ID. I modified it to allow
 this:

 jQuery.fn.multiSelect = function(to, button) {
 return this.each(function() {
 var select = this;
 jQuery(this).dblclick(function() {
 moveOptions(select, to);
 });

 if (typeof button != undefined) {
 jQuery(button).click(function() {
 moveOptions(select, to);
 });
 }
 });

 function moveOptions(from, to) {
 jQuery(from).children(option:selected).each(function() {
 jQuery(this)
 .attr(selected, false)
 .appendTo(to);
 });
 }
 };

 Then it can be called like this:

 $(#select_left).multiSelect(#select_right, #options_right);
 $(#select_right).multiSelect(#select_left, #options_left);

 Don't you think it is less restrictive?
 -- rodrigo




-- 
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Validate plugin and attribute selector values with [square brackets]

2007-09-21 Thread Rob Desbois
Hi all,

I thought I'd give you all (and Joern also) a heads-up on a problem I've
been having.

I use the validate() plugin on forms whose tags have names like
'user[email]'.
The 'rules' option to validate() has no problem with this, but I've now
started passing an array of server-side errors to showErrors() which then
fails.

The reason is that on line #538 of jquery.validate.js v1.1, the selector
resolves to jQuery([EMAIL PROTECTED]) - I presume that the first closing
square bracket is interpreted by jQuery to be closing the selector instead
of part of the attribute.

The fix I have discovered is to amend line #538 to put single quotes around
the value, like so:

 element: jQuery([EMAIL PROTECTED]' + name + ']:first, this.currentForm)[0]


I'm not sure how advisable that fix is - if anyone can advise on that I'd be
very grateful.

As an aside - Joern this is the first time I've used validate, all I'll say
is thank you, it's a fantastic plugin very well thought-out.
--rob

-- 
Rob Desbois


[jQuery] Re: .ready(), Rhino and HttpUnit

2007-09-13 Thread Rob Desbois
Thanks for the replies - it's not just .ready() though, it seems to be all
events. Without the ability to use one of addEventListener and attachEvent
jQuery can't bind events to anything, which makes it all a bit less useful
:-(

On 9/12/07, Brandon Aaron [EMAIL PROTECTED] wrote:

 I think you might be able to use John's modified version of Rhino that
 acts like a browser. Where it is I'm not sure but it wasn't that long ago
 that he wrote it.

 --
 Brandon Aaron

 On 9/12/07, Sean Catchpole [EMAIL PROTECTED] wrote:
 
  Hi Rob,
 
  .ready() won't work in Rhino since there is no page to wait if it's
  ready.
  Everything else should work just fine.
 
  ~Sean
 
  On 9/12/07, Rob Desbois [EMAIL PROTECTED] wrote:
  
   Ok I've enlightened myself a little: I tried it with jQuery 1.2 and
   discovered that the line number changed - it's not a line number in 
   httpUnit
   as I thought (understandably I think!) but in jQuery.
  
   In jQuery 1.2 it's line 1613 (but is reported as 1612), which is the
   else statement in this part of jQuery.event[add]:
  
   // And bind the global event handler to the element
if (element.addEventListener )
   element.addEventListener(type, handle, false);
else
   element.attachEvent(on + type, handle);
   
  
   So neither addEventListener nor attachEvent are defined (I change the
   else to an else if to check attachEvent - it's undefined).
   Seeing as there's been a fair bit of mention of jQuery in Rhino on the
   list, I find it hard to believe jQuery won't work with it - so has anyone
   who's used Rhino with jQuery seen this, and can anyone help?
  
   thanks,
   --rob
  
   On 9/12/07, Rob Desbois  [EMAIL PROTECTED] wrote:
   
Hi all,
   
I'm creating a Web app which uses jQuery, and am unit testing it
with HttpUnit which uses Rhino (the Mozilla JavaScript implementation).
   
I'm having trouble with $(document).ready(...) causing the tests to
crash with this message:
   
alert(hi);
 });' failed: TypeError: undefined is not a function. (httpunit;
 line 1456))
   
   
The whole statement is this:
   
 $(document).ready(function() {
alert(hi);
 });

   
Other basic checks are ok, e.g. $(#foo).focus() works perfectly.
Even if I only try to use .ready() after checking that is is
defined, I still get the same result:
   
 if (typeof $(document).ready === 'function')

   
I know this is likely to be a Rhino/HttpUnit problem but as I know
several people on this list are familiar with Rhino I wanted to know if
anyone's seen this or has any ideas?
I'm on:
jQuery 1.1.4
HttpUnit 1.6.2
   
TIA,
--rob
   
--
Rob Desbois
[EMAIL PROTECTED]
  
  
  
   --
   Rob Desbois
 
 
 



-- 
Rob Desbois


[jQuery] .ready(), Rhino and HttpUnit

2007-09-12 Thread Rob Desbois
Hi all,

I'm creating a Web app which uses jQuery, and am unit testing it with
HttpUnit which uses Rhino (the Mozilla JavaScript implementation).

I'm having trouble with $(document).ready(...) causing the tests to crash
with this message:

alert(hi);
 });' failed: TypeError: undefined is not a function. (httpunit; line
 1456))


The whole statement is this:

 $(document).ready(function() {
alert(hi);
 });


Other basic checks are ok, e.g. $(#foo).focus() works perfectly.
Even if I only try to use .ready() after checking that is is defined, I
still get the same result:

 if (typeof $(document).ready === 'function')


I know this is likely to be a Rhino/HttpUnit problem but as I know several
people on this list are familiar with Rhino I wanted to know if anyone's
seen this or has any ideas?
I'm on:
jQuery 1.1.4
HttpUnit 1.6.2

TIA,
--rob

-- 
Rob Desbois
Eml: [EMAIL PROTECTED]


[jQuery] Re: .ready(), Rhino and HttpUnit

2007-09-12 Thread Rob Desbois
Ok I've enlightened myself a little: I tried it with jQuery 1.2 and
discovered that the line number changed - it's not a line number in httpUnit
as I thought (understandably I think!) but in jQuery.

In jQuery 1.2 it's line 1613 (but is reported as 1612), which is the else
statement in this part of jQuery.event[add]:

// And bind the global event handler to the element
 if (element.addEventListener)
element.addEventListener(type, handle, false);
 else
element.attachEvent(on + type, handle);


So neither addEventListener nor attachEvent are defined (I change the else
to an else if to check attachEvent - it's undefined).
Seeing as there's been a fair bit of mention of jQuery in Rhino on the list,
I find it hard to believe jQuery won't work with it - so has anyone who's
used Rhino with jQuery seen this, and can anyone help?

thanks,
--rob

On 9/12/07, Rob Desbois [EMAIL PROTECTED] wrote:

 Hi all,

 I'm creating a Web app which uses jQuery, and am unit testing it with
 HttpUnit which uses Rhino (the Mozilla JavaScript implementation).

 I'm having trouble with $(document).ready(...) causing the tests to crash
 with this message:

 alert(hi);
  });' failed: TypeError: undefined is not a function. (httpunit; line
  1456))


 The whole statement is this:

  $(document).ready(function() {
 alert(hi);
  });
 

 Other basic checks are ok, e.g. $(#foo).focus() works perfectly.
 Even if I only try to use .ready() after checking that is is defined, I
 still get the same result:

  if (typeof $(document).ready === 'function')
 

 I know this is likely to be a Rhino/HttpUnit problem but as I know several
 people on this list are familiar with Rhino I wanted to know if anyone's
 seen this or has any ideas?
 I'm on:
 jQuery 1.1.4
 HttpUnit 1.6.2

 TIA,
 --rob

 --
 Rob Desbois
 [EMAIL PROTECTED]



-- 
Rob Desbois


[jQuery] Re: Need tips on how i can optimize the scripts on this page...

2007-08-23 Thread Rob Desbois
Hi Trinodia,

I'm afraid you're unlikely to get any responses from that - there're always
people on this list who will help you with debugging, but you have to help
us. Posting a link and asking people to play around and find the problems
themselves will rarely result in what you want.

I did just visit, but a minute of clicking things yielded no error for me,
so I have given up.
What are the errors you're receiving? Have you tried debugging?

--rob


On 8/22/07, Trinodia [EMAIL PROTECTED] wrote:


 Hi all!

 Just have gotten my head into the jQuery stuff and while updating the
 companys website this summer i have now run into some problems.

 The scripts on the page causes an error message to pop up from time to
 time (mostly on IE6 but also in IE7 and in Firefox). Any tips on how i
 can get these errors to, if not disapear completly atleast lower in
 amount of times...

 The website is located at http://www.restaurangguiden.com ... the
 content is in Swedish so to try it out, click on any of the graphic
 buttons to the right, Välj ort on the left or A till Ö on the
 left. The english version does not have large enough pages to cause
 the error from what i can tell.

 Thanks in advance!

 //Trinodia




-- 
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: ORing selectors

2007-08-17 Thread Rob Desbois
Does anyone know offhand how much overhead using .add() instead of the comma
incurs?
Is it just the additional function call?

I've always used comma in selectors but using .add() instead is much clearer
as it separates the selectors in an obvious manner.
--rob


On 8/15/07, Matt Stith [EMAIL PROTECTED] wrote:

 I would do something like

 $(#X).add(.Y);

 On 8/15/07, rickdog [EMAIL PROTECTED]  wrote:
 
 
  What is the cleanest way for ORing select results, e.g. returning all
  DIVs with id=X or class=Y?
 
 



-- 
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: min max in array

2007-08-10 Thread Rob Desbois
Your trusty friend 'Google' is usually the best way for this!
A quick search on javascript array max yields a useful result from none
other than John: http://ejohn.org/blog/fast-javascript-maxmin/

--rob

On 8/10/07, Simpel [EMAIL PROTECTED] wrote:


 Hi there! not really a jquery question this maybe but hopefully
 someone will answer it anyway...

 I've got an array with different productprices. I'd like to get the
 highest and lowest price out of this array. What's the best way to do
 this?

 /J




-- 
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Excluding an element part of a selection

2007-08-10 Thread Rob Desbois
I'm not sure how to do this as it stands - I've never been particularly au
fait with text nodes and how to work with them.
However, a possible solution is to put the text next to the checkbox in a
span and then attach the click event to that.

--rob


On 8/9/07, David Garcia Ortega [EMAIL PROTECTED] wrote:


 Hi JQueriers,

I have a question about selectors. First of all, I have the
 following html:

 div id=content
 a href=# input
 type=checkbox name=option1
 value=Novedad1 Novedad 1: HOla holaaa /a

 /div


As you can see, I have a div an inside it a link which has a
 checkbox an text.


   Well, what I would like to do is to associate a click event when the
 user clicks on the link, but with an exception: This event should
 raise when the user clicks anywhere on the link excepts on the
 checkbox that it is inside the link.


   To be honest I don't know how to do it. I've been googling and
 JQuering but I've not foud anything useful. I've read about not but
 I think that it is not useful in this case.


What I have in .js file is:

 $('#content a').click( function ()
 {
 //code
 }
 );


I would like this click event to raise when the user clicks
 anywhere on the link excepts on the checkbox.


   Any ideas? Thank in advance!!




-- 
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Nested Tables Question

2007-08-08 Thread Rob Desbois
Hi Mike,

If you use $(table table) that will select all tables which are inside
another table in the document.

--rob

On 8/7/07, Mike Miller [EMAIL PROTECTED] wrote:


 Hi,

 I need to find a quick way to determine whether or not table elements
 on the page have any children table elements...as I want to change the
 style class of the innermost table.

 Any ideas on how best to do this?

 M




-- 
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Looking for correct Jquery AJAX statement

2007-08-07 Thread Rob Desbois
Jack,

The correct jQuery syntax is as follows:

var chk1 = $(#city).val() + *;
 var s = 'iframe name=cwindow style=border:0px solid purple width=980
 height=1500 src=s30.php?id=' + chk1 + '\/iframe';


The $.get() function [http://docs.jquery.com/Core#get.28.29] returns the
matched elements as an array of DOM objects, so $(#feeds).get() will give
you an array with a single DOM element - that with the ID 'feeds' (unless it
doesn't exist, in which case you'll get an empty array).

HTH,
--rob


On 8/7/07, Jack [EMAIL PROTECTED] wrote:


 Hello everyone,

 I want to translate this

 var chk1 = document.getElementById('city').value + '*' ...
 var string= 'iframe name=cwindow style=border:0px solid purple
 width=980 height=1500 src=s30.php?id=' + chk1 + '\/iframe';

 into

 $(#feeds).get(chk1); or $(#feeds).get(s30.php?id=' + chk1 + ');
 or $(#feeds).get(s30.php, { id: chk1 })

 Which jquery expression is correct?

 Than you for help




-- 
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: What does === equate to?

2007-08-02 Thread Rob Desbois
I had a discussion on the use of the === and !== operators recently on this
list, my opinion was, and still is, that unless you explicitly WANT to allow
type conversion, you should be using these. Only use == and != if you really
want type conversion.

It's bitten me once, although I can't for the life of me remember how, but
it involved lots of in-depth debugging and head-scratching to find the
problem. I'm more wary now and think that these operators are the way to go.

--rob

On 8/2/07, Sam Collett [EMAIL PROTECTED] wrote:


 I don't think many actually use !== (and when you would want to use
 it) and many sites that show usage of operators don't cover !== (but
 do have ===).

 3 != '3' false
 3 !== '3'true
 3 == '3' true
 3 === '3'false


 On Aug 1, 9:33 pm, Michael Geary [EMAIL PROTECTED] wrote:
   I...cannot figure how what the heck === is.
 
  I see that Jake answered your question, but just for next time...
 
  You may have tried a Google search for javascript === and been
  disappointed to find it returned no useful results (because Google seems
 to
  ignore the === in the search).
 
  The key thing to know is that ===, like most special symbols in
 JavaScript
  such as + and -, is an operator. Now you can do a more productive Google
  search:
 
  http://www.google.com/search?q=javascript+operators
 
  This will help when you run into !== and wonder what the heck *that* one
 is.
  :-)
 
  -Mike




-- 
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: What does === equate to?

2007-08-02 Thread Rob Desbois
There's no overhead unless the types are different. From the ECMAScript
specification:

For the 'abstract equality comparison algorithm' (==) [11.9.3]
1. if Type(x) is different from Type(y), go to step 14.

For the 'strict equality comparison algorithm' (===) [11.9.3]
1. if Type(x) is different from Type(y), return false.

Steps 2-13 of both algorithms are exactly the same, so if the types match
then there's no difference in the execution of each algorithm, and no
overhead for the abstract algorithm.

--rob

On 8/2/07, Terry B [EMAIL PROTECTED] wrote:


 known about this for awhile but since we are on the topic...  there
 has to be some over head of using == and !=  does anyone know for
 sure the impact of the overhead...  and does it matter of the type


 On Aug 2, 6:21 am, Ian Struble [EMAIL PROTECTED] wrote:
  !== and === are identity operators.  It is a good idea to use them
  instead of the equality operators (!= and ==) unless you know why you
  would want to use equality (and the possible type coercion) over
  identity.  Probably the biggest gotcha with equality is with falsy
  values (false, 0, undefined, /empty string, null and NaN).   The
  truthy / falsy issue is probably what bit you Rob.
 
  It may be worth reading a bit of Douglas Crockford's ideas about
  javascript if you are trying to figure out identity and equality
  operators:
 
 http://javascript.crockford.com/code.html
 
  And here is something about truthy and falsy:
 
   http://developer.mozilla.org/en/docs/A_re-introduction_to_JavaScript#.
 ..
 
  Ian
 
  On 8/2/07, Rob Desbois [EMAIL PROTECTED] wrote:
 
   I had a discussion on the use of the === and !== operators recently on
 this
   list, my opinion was, and still is, that unless you explicitly WANT to
 allow
   type conversion, you should be using these. Only use == and != if you
 really
   want type conversion.
 
   It's bitten me once, although I can't for the life of me remember how,
 but
   it involved lots of in-depth debugging and head-scratching to find the
   problem. I'm more wary now and think that these operators are the way
 to go.
 
   --rob
 
   On 8/2/07, Sam Collett [EMAIL PROTECTED] wrote:
 
I don't think many actually use !== (and when you would want to use
it) and many sites that show usage of operators don't cover !== (but
do have ===).
 
3 != '3' false
3 !== '3'true
3 == '3' true
3 === '3'false
 
On Aug 1, 9:33 pm, Michael Geary [EMAIL PROTECTED] wrote:
  I...cannot figure how what the heck === is.
 
 I see that Jake answered your question, but just for next time...
 
 You may have tried a Google search for javascript === and been
 disappointed to find it returned no useful results (because Google
 seems
   to
 ignore the === in the search).
 
 The key thing to know is that ===, like most special symbols in
   JavaScript
 such as + and -, is an operator. Now you can do a more productive
 Google
 search:
 
http://www.google.com/search?q=javascript+operators
 
 This will help when you run into !== and wonder what the heck
 *that* one
   is.
 :-)
 
 -Mike
 
   --
   Rob Desbois
   Eml: [EMAIL PROTECTED]
   Tel: 01452 760631
   Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and
 the
   whale was in full view.
   ...Then ooh welcome. Ahhh. Ooh mug welcome.




-- 
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Two words for Jquery

2007-08-01 Thread Rob Desbois
My saviour

On 8/1/07, Tane Piper [EMAIL PROTECTED] wrote:


 Bloody Brilliant!

 (I wonder how many other 2 word ways there are to describe jQuery)

 On 8/1/07, Richard D. Worth [EMAIL PROTECTED] wrote:
  Here here.
 
  - Richard
 
 
  On 8/1/07, kiwwwi [EMAIL PROTECTED] wrote:
  
   jQuery Rocks!!
  
   oh... possibly will add two more words;
  
   Thank you :)
  
   I'm not the best scripter and jquery has simply allowed me to
   accomplish with my own personal site so much more than I would
   have otherwise attempted.  You people behind jquery are genious and
   your work is great, thanks.
  
   Kiwwwi.
  
  
 
 


 --
 Tane Piper
 http://digitalspaghetti.tooum.net

 This email is: [ ] blogable [ x ] ask first [ ] private




-- 
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: It's all in the mind - the power of belief

2007-07-27 Thread Rob Desbois
That's ok - I believe that *I* have a real spiritual impact in my life, so I
do!

On 7/27/07, Gordon [EMAIL PROTECTED] wrote:


 Sorry! I posted this into entirely the wrong group. Please ignore/
 delete.

 On Jul 27, 11:04 am, Gordon [EMAIL PROTECTED] wrote:
  Sources:
 
 
 http://www.ehponline.org/members/2007/10286/10286.pdfhttp://news.bbc.co.uk/1/hi/health/6914492.stmhttp://www.theregister.co.uk/2007/07/25/mobile_sufferers_unaffected_b.
 ..
 
  There are people who believe that signals from mobile phone masts are
  causing them ill health.  Symptons include headaches, nausia, anxiety
  and lethargy.
 
  A double-blind study was undertaken to determine the validity of the
  claim that radio emissions from mobile phone masts can cause illness.
  Two groups of volenteers, some mast sensitive and a control group of
  mast insensitive individuals were exposed to mobile phone masts
  which were sometimes transmitting and sometimes turned off.  Neither
  the mast-sensitives, the controls or the scientists observing the
  group knew when the mast was on and when it was off.
 
  The results show that the mast-sensitives consistantly reported
  significantly higher incidents of symptons than the control group when
  the mast was transmitting.  However, they also reported more symptons
  than the control group when the mast was not transmitting and could
  therefore have no effect on them.
 
  While the symptons were quite real the mobile mast had to be ruled out
  as a cause because the symptons were reported whether or not the mast
  was active.
 
  Belief is a very powerful thing, said Professor Elaine Fox, of the
  University of Essex, who led the three-year study.
 
  If you really believe something is going to do you some harm, it
  will.
 
  The Placebo effect is already well documented.  This research
  demonstrates teh reverse is also possible.  If you believe something
  is harmful you will feel ill effects regardless of how much physical
  harm it is actually capable of causing.
 
  What does this have to do with religion?  The answer is nothing
  directly, but it does demonstrate the power of belief.  If you believe
  that mobile masts will make you ill you will feel ill.  If you believe
  in God then God will have real spiritual impact in your life,
  regardless of whether or not he really exists.




-- 
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Does $('input#myId') search for inputs first or is it optimised?

2007-07-26 Thread Rob Desbois

It uses document.getElementById(myId) as usual so it's a fast search, but
it will then check that the returned element is an input, so there is a
little additional overhead.

--rob

On 7/26/07, Remy Sharp [EMAIL PROTECTED] wrote:



I should really know this, but I've come to realise I'm not 100% sure.

Does this:

$('input#myId')

...search for all inputs first then narrow down to the ID, or does
jQuery work out before hand that there can be only one Id - and
therefore is the same, with respect to processing to:

$('#myId')

Cheers.

Remy.





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: vs '

2007-07-26 Thread Rob Desbois

Sean,

Attributes in (X)HTML don't need to be double-quoted, again single-quotes
are equally valid there so 'a href=...' and a href='...' are
effectively the same and both valid.
I know you probably know, I just wanted to rephrase It is easier to type an
html string if you use single quotes: in case :-)

--rob


On 7/26/07, Sean Catchpole [EMAIL PROTECTED] wrote:


On 7/26/07, Mitchell Waite [EMAIL PROTECTED] wrote:
 This going will make me sound really dumb but what is the difference
between
 using single quote versus double quotes in jQuery, e.g.

Mitchell, the concept of single vs double quotes is more of a javascript
question.
The simple answer is that there's no difference really. It is easier to
type an html string if you use single quotes:
Single: var html = 'a href=#link/a';
Double: var html = a href\#\link/a';
But sometimes you might want to use double instead:
Single: var str = 'I\'m in love';
Double: var str = I'm in love;

So just use whichever you feel is better for the situation. Some people
are used to single quotes representing characters, whereas others think html
= double quotes, javascript = single quotes.

~Sean





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Possible to retrieve image data via AJAX for display?

2007-07-25 Thread Rob Desbois

Traunic


how does raw image data get you anything?  Seems you want the data and
the image URL via XHR and then dynamically insert your DOM bits (img
tag w/ URL from response with some sort of wrapper containing your
legend)...  I mean, what you are talking about is technically doable
(not in all browsers) http://www.kryogenix.org/days/2003/10/18/embedding
but I am not sure it gets you anything.


No, you haven't read my post carefully enough. I don't want the image's URL
because the image *doesn't have* a URL - it's generated by a server-side
script.
Because I can't retrieve raw image data and legend data in the same request,
this now necessitates 2 requests, both of which have common functionality.
This to me seems a little odd that two aspects of the same set of
information have to be retrieved separately, but then Web development can be
like that sometimes ;-)


and make sure to check out the link to

http://neil.fraser.name/software/img2html/

because that is just sick!  Taking your idea to the next demented
level


Absolutely, I've seen that before, hence I was pretty sure this couldn't be
done. What a horrific 'solution'! Although I'm not sure what you think is
demented about the idea generically (disgusting 1x1 celled tables aside I
mean) - many people have a need of embedding raw image data directly into a
Web page, exemplified by the first post mentioning people who are willing to
pay money for Web archives - MHTs - to be implemented in Mozilla. Email
clients support these archives by using the multipart MIME types. So why not
Web browsers?

Anyway, as I thought it seems there's no cross-platform mechanism for
achieving this, so it's down to making sure 2 similar requests don't
unnecessarily repeat redundant code.

Thanks for your input on this everyone :-)
--rob

On 7/24/07, Christof Donat [EMAIL PROTECTED] wrote:



Hi,

 I have a server-side script which generates a graph image given a set of
 dataset identifiers. Additional datasets are implicitly added
server-side
 too.
 Currently the image contains the legend, but I'd like to generate the
 legend in HTML as it'll be more consistent with legends used for tables.
 The legend contents cannot be determined until partway through graph
 generation - so I'd like to retrieve both raw image data and legend data
 via AJAX, build the legend's HTML representation and display the image.

I guess you are lokking for something like canvas. Firefox and Safari do
support it. I am not shure about Opera, but IE and Konqueror don't. For IE
there is at least IECanvas (http://sourceforge.net/projects/iecanvas),
which
might be of use.

You can use JavaScript to put an Image on a canvas and you also have
drawing
primitives to add Information.

Christof





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: AJAX .load() Can I set web place to my script?

2007-07-25 Thread Rob Desbois

Mario,

I don't understand - are you wishing to change the working directory for
PHP? If so the function chdir() can help you.

If that's not what you're asking I don't get it, can you rephrase the
question, perhaps let us know what you're trying to do with this?

--rob


On 7/25/07, Mario Moura [EMAIL PROTECTED] wrote:


Hi Folks

Now I am tasting Jquery AJAX

My BIG problem is

$(#myID).load(/mysite/myCustomDir/MyOtherPlace/myscript.php);

Yes I can run my php file. Excelent! but How can I set to this file to run
in http://localhost/mysite/mydir/myplace?

In other word I would like to say to my server hey! I am in 
http://localhost/mysite/mydir/myplace
load me

Every time run in http://localhost/mysite

It is impossible set the web url by php. Could I set with Jquery?

In my case is impossible set /mysite/myCustomDir/MyOtherPlace/myscript.php
equal with http://localhost/mysite/mydir/myplace

Regards

--
Mário





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Toggling an objects visiblty without show and hide

2007-07-25 Thread Rob Desbois

Ganeshji,
Correct, As Aaron states above, 'this' refers to the jQuery object, hence
this code will not work.

Mitch,
As I can see it I think you're misunderstanding how jQuery works from the
outside at quite a fundamental level. Did you run through the tutorials at
http://docs.jquery.com/Tutorials ? At the very least, John and Joern's
tutorials - the top two - are an excellent introduction.
Also IIRC from your other posts you aren't overly-familiar with JavaScript
itself. I don't know of other people's opinions and am not speaking for the
jQuery community, but I would really recommend learning JavaScript on its
own to a competent level before attempting to use jQuery, otherwise it's
hard for you to know which conventions, problems and bits of code are
JavaScript, and which are jQuery. It would be like trying to learn MFC
(Microsoft Foundation Classes - the old MS C++ class hierarchy wrapping the
Windows API) before being able to code in C++.
Granted, jQuery is massively more simple than MFC, but JavaScript is a much
more complicated language than some appreciate (I'm currently struggling
with some aspects). Walk before you can run.

--rob

On 7/25/07, Ganeshji Marwaha [EMAIL PROTECTED] wrote:


 jQuery.fn.toggleVis = function() {
if(this.style.visibility == 'hidden') {
  this.style.visibility = 'visible';
} else {
   this.style.visibility = 'hidden';
}
 };

doesn't this here refer to the jquery object... I don't think jquery
object has a style attribute, or does it?

-GTG


On 7/24/07, Stephan Beal [EMAIL PROTECTED] wrote:


 On Jul 25, 12:41 am, Mitchell Waite [EMAIL PROTECTED]  wrote:
  I know this is trivial but what it turned out I needed was something
 this
  simple
 
  jQuery.fn.toggleVis = function() {
 
  if(chesireCat.style.visibility == 'hidden') {
 
 chesireCat.style.visibility = 'visible';
 
  } else {
 
 chesireCat.style.visibility = 'hidden';
 
  }
 
  };

 Eeeek! What you're doing here is adding a toggleVis() function to ALL
 selectable jQuery elements, but then in the function you're applying
 the change to a specific element. Thus this will trigger your
 function:

 $('div').toggleVis();

 that will toggle the cheshireCat element, not the selected element(s),
 which certainly isn't desired.

 What i *think* you meant was to either make that a standalone function
 (not using jQuery.fn.) or:

 jQuery.fn.toggleVis = function() {
if(this.style.visibility == 'hidden') {
   this.style.visibility = 'visible';
} else {
   this.style.visibility = 'hidden';
}
 };








--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Possible to retrieve image data via AJAX for display?

2007-07-25 Thread Rob Desbois

Yes, sorry I didn't phrase my post very well: there is a URL for the image,
of course, but I was trying to emphasise that there isn't a URL to an image
cached on the server's filesystem to pass back, as I don't want to
*permanently* cache the image (or implement a cleverer algorithm - there's
no need).
I simply want the cached image (or intermediates) to be temporary; the
user's session seems the obvious candidate for this type of storage to me.

--rob

On 7/25/07, Klaus Hartl [EMAIL PROTECTED] wrote:



Rob Desbois wrote:
 Traunic

   how does raw image data get you anything?  Seems you want the data
and
   the image URL via XHR and then dynamically insert your DOM bits (img
   tag w/ URL from response with some sort of wrapper containing your
   legend)...  I mean, what you are talking about is technically doable
   (not in all browsers)
http://www.kryogenix.org/days/2003/10/18/embedding
   but I am not sure it gets you anything.

 No, you haven't read my post carefully enough. I don't want the image's
 URL because the image *doesn't have* a URL - it's generated by a
 server-side script.

This cannot be. If you want to load the raw image data via Ajax, there
*must* be a URL.

But this URL could as well be used as src for the image given that the
server-side script sets the proper mime type.


--Klaus





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: insert an html string

2007-07-25 Thread Rob Desbois

This works perfectly for me in Fx2.0.0.5 Stef.

You are correct though - where you use .insertAfter() it will insert the
provided content after every matching element, which is ALL .changeQty
elements.
You can use 'this' (not '$this') to only insert it after the element that
was clicked by changing the line of the inner function to:


$(form class='newQty'stuff here/form).insertAfter(this);




I'm also not sure if insertAfter is the best thing to use - should i use

childElements?
If you're wanting to insert content into the DOM then you're going about it
the right way. If .insertAfter() achieves the effect you're looking for then
it's the right one.

If you still can't get it working can you give us a URL of a test page?
--rob


On 7/25/07, stef [EMAIL PROTECTED] wrote:



im trying to insert an html string (a form) into a div (at spot XXX)
when .changeQty is clicked. I can only use classes, not id's cause the
div repeats many times on the page

div class='inline'span class='currentQty'Quantity: blahspan
class='changeQty' (Change)/span/spanXXX/div

the string is: form class=newQtystuff here/form

the code i came up with so far is below. it doesnt work but firebug
doesnt give errors either ... i dont think i can
use .insertAfter(.changeQty) because then it will insert it after
every instance of that class it finds on the page. so maybe i should
replace it with $this? I'm also not sure if insertAfter is the best
thing to use - should i use childElements?

$(document).ready(function()
{
$(.changeQty).click
(
function()
{
$(form class='newQty'stuff here/
form).insertAfter(.changeQty);
}
)



});





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: AJAX .load() Can I set web place to my script?

2007-07-25 Thread Rob Desbois

Mario,

No problem, it wasn't so much your English, more just not providing enough
info :-)


$().load() will execute my php file always in my main root or in

http://localhost/mysite or in actual physical path, no matter.
When the server runs a script in response to a request (AJAX or otherwise)
the current directory will usually be the path of the script. So for
http://example.com/dir/x.php, the current directory is /dir.

Is the reason you want this so that you don't have to put in the full paths
to included files? You can add paths to PHP's 'include_path' INI setting to
provide additional directories where included files will be searched for.
The default for this is .:/php/includes. You can change it in your
php.inifile, or if you don't have access to that you can alter it at
runtime:

$path = ini_get('include_path');

$path .= ':/var/www/html/dir';
ini_set('include_path', $path);



Bear in mind these paths are from the root of your filesystem, not the root
of your website.

Does that help?
--rob


On 7/25/07, Mario Moura [EMAIL PROTECTED] wrote:


Hi Rob

Sorry my english. Isnt native

I think php will get the php code and execute it.

I am Drupalist.

$().load() will execute my php file always in my main root or in
http://localhost/mysite or in actual physical path, no matter.

I need pass an argument to this php file or to my server (I dont know how
or which server or file) telling this php file isnt in main root it is in
http://localhost/mysite/node/add/mycontent. Like a mask or alias.

myscript.php is
- - - - - -
chdir('./../../../'); // for relative path includes to work I tried change
this value but didnt work
include includes/bootstrap.inc;
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
print $content;
- - - - - -

If I can pass the argument (path=http://localhost/mysite/node/add/mycontent
) to my server with load() the $print content; will get my content from
this path in the Drupal.

You can see if this work could be a good, fast and easy way to implement
AJAX and many CMS will love.

But could be a crazy idea. If is forgive me and sorry.

Regards

Mario

2007/7/25, Rob Desbois [EMAIL PROTECTED]:

 Mario,

 I don't understand - are you wishing to change the working directory for
 PHP? If so the function chdir() can help you.

 If that's not what you're asking I don't get it, can you rephrase the
 question, perhaps let us know what you're trying to do with this?

 --rob


 On 7/25/07, Mario Moura  [EMAIL PROTECTED] wrote:
 
  Hi Folks
 
  Now I am tasting Jquery AJAX
 
  My BIG problem is
 
  $(#myID).load(/mysite/myCustomDir/MyOtherPlace/myscript.php);
 
  Yes I can run my php file. Excelent! but How can I set to this file to
  run in http://localhost/mysite/mydir/myplace?
 
  In other word I would like to say to my server hey! I am in 
http://localhost/mysite/mydir/myplace
  load me
 
  Every time run in http://localhost/mysite
 
  It is impossible set the web url by php. Could I set with Jquery?
 
  In my case is impossible set
  /mysite/myCustomDir/MyOtherPlace/myscript.php equal with
  http://localhost/mysite/mydir/myplace
 
  Regards
 
  --
  Mário




 --
 Rob Desbois
 Eml: [EMAIL PROTECTED]
 Tel: 01452 760631
 Mob: 07946 705987
 There's a whale there's a whale there's a whale fish he cried, and the
 whale was in full view.
 ...Then ooh welcome. Ahhh. Ooh mug welcome.




--
Mário Alberto Chaves Moura
[EMAIL PROTECTED]
31-9157-6000





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Possible to retrieve image data via AJAX for display?

2007-07-25 Thread Rob Desbois

Christof,

Thanks for that, but I was really looking to see if there was a
browser-independent mechanism, essentially something like the Web archives
that IE has supported for years. I think adding components for this would be
over-complicating the matter.

Thanks anyway.
--rob

On 7/25/07, Christof Donat [EMAIL PROTECTED] wrote:



Am Mittwoch, 25. Juli 2007 schrieb Rob Desbois:
 Yes, sorry I didn't phrase my post very well: there is a URL for the
image,
 of course, but I was trying to emphasise that there isn't a URL to an
image
 cached on the server's filesystem to pass back, as I don't want to
 *permanently* cache the image (or implement a cleverer algorithm -
there's
 no need).
 I simply want the cached image (or intermediates) to be temporary; the
 user's session seems the obvious candidate for this type of storage to
me.

var ctx = $('canvas')[0].getContext(2d);
var img = new Image();
img.onload = function() {
  ctx.drawImage(img,0,0);
  ctx.beginPath();
  ctx.moveTo(30,96);
  ctx.lineTo(70,66);
  ctx.lineTo(103,76);
  ctx.lineTo(170,15);
  ctx.stroke();
  // ...
}
img.src = /basicImage.png;

I am pretty shure that this is what you are looking for. I have the code
almost exactly from the first example of
http://developer.mozilla.org/en/docs/Canvas_tutorial:Using_images

The example should work in Firefox, Safari and Opera. For IE there is
IECanvas
(http://sourceforge.net/projects/iecanvas).


If you really need to care about Konqueror, you can try to mimic the
behaviour
you need with data URLs. For a refference how this could look like, see
PNGlets: http://www.elf.org/pnglets/


There is no really usefull Drawing solution on all Browsers. Changing data
URLs lie PNGlet is slow and annoying and IECanvas is slow and can not
handle
many drawing primitives - it gets slower all the time.

There was the possibility in IE 6 to use javascript URLs for images that
return monochrome XBM images which could have been colored and combined
with
filters. Alas MS doesn't support XBM any more, so there is not evan a
pita-way left.

Christof





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Possible to retrieve image data via AJAX for display?

2007-07-25 Thread Rob Desbois

I never noticed that they ever were browser-independent.

I know, that's why I said 'that IE has supported for years' and why I can't
use them.

Despite the ways there are to do this such as these canvas projects or
something big and bulky client-side (Java, Flash possibly, any number of
similar technologies), what baffles me most is that you can inject content
client-side into many tags: script, style, div, title, all of the things
which contain HTML or text. But you can't do that with the specialised tags
like img, object and applet. Granted these do not contain HTML, but then
neither do script and style.
It just seems peculiar to me that there is this mismatch - why wouldn't HTML
have the capability to support, e.g. imgGIF89a...binary rubbish.../img?

--rob

--
Rob Desbois
Eml: [EMAIL PROTECTED]


[jQuery] Re: Toggling an objects visiblty without show and hide

2007-07-25 Thread Rob Desbois
 the cheshireCat element, not the selected element(s),
which certainly isn't desired.

What i *think* you meant was to either make that a standalone function
(not using jQuery.fn.) or:

jQuery.fn.toggleVis = function() {
if(this.style.visibility == 'hidden') {
   this.style.visibility = 'visible';
} else {
   this.style.visibility = 'hidden';
}
};









--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Toggling an objects visiblty without show and hide

2007-07-25 Thread Rob Desbois


Unfortunately my code does work J. Must be a miracle?


The one where you used 'this' instead of 'cheshireCat' didn't work - that
was the one I was referring to. My last post clears that up a bit more
understandably I hope.


I just got my copy of Learning jQuery and it's a very good book (took 10
days to get here). Some really basic concepts that got away from me are
finally becoming clear.


Excellent - good luck with it!


I know enough Javascript, my main issue is not understanding the domain of
jQuery and the domain of JS, and how the two differ, but the book is making
that clear. Also the book helps me understand that jQuery is really about
manipulating elements in the DOM using selectors and traversing the DOM. I
think that is where I went astray. I don't think you need to dive deep into
JS to grok jQ, but the syntax closeness of the two can be tricky, and not
explained well in the tutorials. Like the book spends a lot of time
explaining $() which it calls the Factory function.


Ok, I hope my post didn't offend in any way. Re-reading your posts, I think
your conclusion is correct - understanding what is jQuery and what is JS,
and the differences, can be tricky. I'm not so sure about not needing a good
understanding of JS - really getting to grips with relatively advanced
topics like closures is quite important IMO - I certainly struggled with
some bits of JS I'd never seen before coming to jQuery, especially when
extending jQuery yourself.


I see now that an object in jQuery does not have a visibility directly, it
needs a class assigned to it, so that is why example 2 doesn't work.


Not entirely sure what you mean by this..?


PS I have read all the tutorials at http://docs.jquery.com/Tutorials and
honestly they assume a lot of prior knowledge and leave out some really
major lessons for the newbie.


PSS I am not sure your metaphor is right, but I agree that the bigger

picture needs amplifying on the docs site, and maybe I will end up
contributing to that issue, which is not to be critical of the community in
any way, you guys are all fabulous and very generous.


In what sort of areas do you think too much is assumed in the tutorials?
I'm not so sure about the metaphor - jQuery is a tool, the use of which
requires knowledge and understanding of how you use that tool, as with
anything. I would strongly advise anyone wanting to use jQuery to learn
JavaScript first, but that is my opinion - you think otherwise, perhaps the
rest of the community would disagree with me too ;-)

In terms of adding to the docs I'm sure nobody will be offended. We all
approach learning a new language / tool / platform in different ways, if you
found that the existing reference and tutorials were not sufficient or
appropriate for you then there are probably others in a similar situation.
By going through the hard part and contributing yourself, you add your own
viewpoint which might be just what someone else needs, which can only be a
good thing.

--rob

*From:* jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] *On

Behalf Of *Rob Desbois
*Sent:* Wednesday, July 25, 2007 2:14 AM
*To:* jquery-en@googlegroups.com
*Subject:* [jQuery] Re: Toggling an objects visiblty without show and hide



Ganeshji,
Correct, As Aaron states above, 'this' refers to the jQuery object, hence
this code will not work.

Mitch,
As I can see it I think you're misunderstanding how jQuery works from the
outside at quite a fundamental level. Did you run through the tutorials at
http://docs.jquery.com/Tutorials ? At the very least, John and Joern's
tutorials - the top two - are an excellent introduction.
Also IIRC from your other posts you aren't overly-familiar with JavaScript
itself. I don't know of other people's opinions and am not speaking for the
jQuery community, but I would really recommend learning JavaScript on its
own to a competent level before attempting to use jQuery, otherwise it's
hard for you to know which conventions, problems and bits of code are
JavaScript, and which are jQuery. It would be like trying to learn MFC
(Microsoft Foundation Classes - the old MS C++ class hierarchy wrapping the
Windows API) before being able to code in C++.
Granted, jQuery is massively more simple than MFC, but JavaScript is a
much more complicated language than some appreciate (I'm currently
struggling with some aspects). Walk before you can run.

--rob

On 7/25/07, *Ganeshji Marwaha* [EMAIL PROTECTED] wrote:

 jQuery.fn.toggleVis = function() {
if(this.style.visibility == 'hidden') {
  this.style.visibility = 'visible';
} else {
this.style.visibility = 'hidden';
}
 };


doesn't this here refer to the jquery object... I don't think jquery
object has a style attribute, or does it?



-GTG




On 7/24/07, *Stephan Beal* [EMAIL PROTECTED]  wrote:


On Jul 25, 12:41 am, Mitchell Waite  [EMAIL PROTECTED]  wrote:
 I know this is trivial but what it turned out I needed was something
this
 simple

[jQuery] Re: Toggling an objects visiblty without show and hide

2007-07-24 Thread Rob Desbois

For information, the reason that works is that setting {visibility:hidden}
hides the element but the element's box still affects layout.
Setting {display:none} suppresses box generation altogether.
(From http://www.w3.org/TR/REC-CSS2/visufx.html#visibility)

--rob


On 7/24/07, Aaron Heimlich [EMAIL PROTECTED] wrote:


jQuery.fn.toggleVis = function() {
// Here, this is the jQuery object
// This return statement is used for two reasons
//   1. To make sure we hit every HTML element in the jQuery object
//   2. To make sure that this method doesn't break the chain
return this.each(function() {
// Iterate over all selected HTML elements and toggle their
visibility CSS property
// Here, this a HTML element
if(this.style.visibility == 'hidden') {
this.style.visibility = 'visible';
} else {
this.style.visibility = 'hidden';
}
});
};

Usage: $('mySelector').toggleVis();

On 7/23/07, Mitchell Waite  [EMAIL PROTECTED] wrote:


 I like jQuery effects show and hide but they actually remove the object
 from the screen. So an H1 under an image will move up.

 Can someone show me the best way to change (toggle) an objects
 visibility property between hidden and visible so any HTML under it
 will not move.

 Mitch





--
Aaron Heimlich
Web Developer
[EMAIL PROTECTED]
http://aheimlich.freepgs.com





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Possible to retrieve image data via AJAX for display?

2007-07-24 Thread Rob Desbois

JK,
Thanks but no - that's my alternative.

Dan,
Absolutely, please do tell me if I am!

I have a server-side script which generates a graph image given a set of
dataset identifiers. Additional datasets are implicitly added server-side
too.
Currently the image contains the legend, but I'd like to generate the legend
in HTML as it'll be more consistent with legends used for tables.
The legend contents cannot be determined until partway through graph
generation - so I'd like to retrieve both raw image data and legend data via
AJAX, build the legend's HTML representation and display the image.

Otherwise, I'll use an AJAX request to return the legend data, and cache the
intermediate step so that when I insert the img tag for the graph, the
generating script doesn't need to repeat the first part.

What do you think?

--rob


On 7/23/07, Dan G. Switzer, II [EMAIL PROTECTED] wrote:



Rob,

I have a feeling the answer is a flat 'no', but want to check: is it
possible for an AJAX request to retrieve binary image data (e.g. raw
GIF) and display that on the page?

Can you describe the *exact* effect your trying to achieve?

Why do you think you need to load binary image data via AJAX?

I'm asking just to make sure you're not barking up the wrong tree...

-Dan





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Opening external links in a new window

2007-07-24 Thread Rob Desbois

Matt,
The point of writing code that conforms with specifications isn't to satisfy
the validator.
The point of satisfying the validator is so that you know that your code
will work as expected in all conforming browsers.

--rob


On 7/24/07, Matt Stith [EMAIL PROTECTED] wrote:


Im not really worried about that.. The validator wont notice that your
setting the target with javascript, so its fine for me :P

On 7/23/07, Karl Swedberg [EMAIL PROTECTED] wrote:

 On Jul 23, 2007, at 7:53 PM, Matt Stith wrote:

 Or even easier,
 $([EMAIL PROTECTED]'http']).attr('target','_blank');


 yeah, but I avoid the target attribute out of habit because as far as I
 can tell it's not valid with strict doctypes:
 http://www.w3.org/MarkUp/2004/xhtml-faq#target


 --Karl
 _
 Karl Swedberg
 www.englishrules.com
 www.learningjquery.com








--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] [To Klaus] tabs plugin suggestion

2007-07-24 Thread Rob Desbois

Klaus,

I've got a page which has two parts, a side bar, and a main content
container.
The main container is tabbed with your excellent plugin, but the contents of
the sidebar must also vary in-line with the tabs.
What I've done is given the tab li elements IDs like 'action-tab', and the
div elements IDs like 'sidebar-action-tabcont' so that with onShow and
onHide handlers for the tabs I can show and hide the relevant tabs.

The one problem with this is that these handlers are not fired for any of
the tabs when they are initially setup with .tabs(), so I would suggest that
this be done once they are setup - call onHide for the inactive tabs and
onShow for the active one. Do you agree with this? Or can you make an
alternate suggestion if I'm going about this wrong?

Thanks,
--rob

--
Rob Desbois
Eml: [EMAIL PROTECTED]


[jQuery] Re: Loading Javascript Dynamically (in other words, as needed)

2007-07-23 Thread Rob Desbois

Guys, responses below.
--rob

On 7/23/07, Stephan Beal [EMAIL PROTECTED] wrote:



On Jul 23, 4:06 am, Dave Methvin [EMAIL PROTECTED] wrote:
 All of those results make sense.

  print( (new String('foo') === new String('foo')))
  false

 Those are two different objects, even though they have the same value;
 object1 !== object2 by definition of the === operator.

Agreed.


What is this definition of the === operator you are referring to? I'm
unaware of it having ever been defined as a reference comparison, and having
read the relevant part of the ECMA Script specification yesterday I'm
certain it isn't.


Two primitives with the same type and value are === as well as ==

i probably would expect it for string constants, but i would not
expect it to be true for computed strings:

[EMAIL PROTECTED]:~$ SpiderApe -e a=function(){return 'abc'[0];};
print(a() === 'a')
true


That proves it isn't a by-reference comparison.



  print(typeof someUndefined == 'fuzzyDuck')
  false

 typeof someUndefined is 'undefined', and 'undefined' != 'fuzzyDuck'

This makes sense, of course, but seems to contradict the standard (as
Rob described it above).


No, it was my Sunday evening brain. I was thinking of 'someUndefined' as
being the LHS of the expression, but of course it isn't, it's 'typeof
someUndefined'. It will return true as long as y is the string 'undefined'.
According to the spec, === and == only differ in the algorithm's flow when
the type of the left and right expressions differ, so it is likely that my
(not uncommon) belief that === is faster than == is incorrect.

It is however the case that === is a safer comparison for a lot of
situations. Allowing type conversions to take place means that you may get
unexpected results, I have come across a situation where this happened
before and so use the strict (in)equality operators now to avoid problems in
future. If I want type conversion I make it explicit.


[jQuery] Possible to retrieve image data via AJAX for display?

2007-07-23 Thread [rob desbois]

Hi all,

I have a feeling the answer is a flat 'no', but want to check: is it
possible for an AJAX request to retrieve binary image data (e.g. raw
GIF) and display that on the page?

Thanks,
--rob



[jQuery] Re: Loading Javascript Dynamically (in other words, as needed)

2007-07-22 Thread Rob Desbois

Stephan,
The only time that == or != should be used (IMO anyway) is when you
explicitly *want* type conversion to take place. Otherwise, it's safest (and
faster) to use === or !==

Zacky,
One cross-domain AJAX jQuery plugin:
http://trainofthoughts.org/repo/export/jquery/jquery.xsajax.html
Can't advise on its use though as have had no experience with it.

--rob

On 7/22/07, March [EMAIL PROTECTED] wrote:



but the $.getScript() has a weakness, cross domain restrict... that's
really bad...

On 7/22/07, Stephan Beal [EMAIL PROTECTED] wrote:

 On Jul 21, 2:15 pm, Rob Desbois [EMAIL PROTECTED] wrote:
  Try this:
 
  if (typeof myFunction === undefined) {

 Shouldn't that be:

 if( typeof myFunction === undefined )

 or

 if( typeof myFunction == undefined )

 ??? i don't think === is what you want when comparing different string
 instances, whereas === is preferred for null/undefined comparisons
 (according to Doug Crockford, anyway).





--
Zacky Ma
www.marchbox.com





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Should be real easy but not for me

2007-07-21 Thread Rob Desbois

Hi Mitch,

I'm afraid it is a silly one!

function advmode() (

   $(#Panel).SlideInRight(1000);


};


You've used a parenthesis ( instead of brace { for opening the function
body. Change that and it works as expected :-)

Glen, SlideInRight and similar functions are from Interface elements for
jQuery.

--rob


On 7/20/07, Glen Lipka [EMAIL PROTECTED] wrote:


Im a little confused.  SlideInRight and SlideOutRight arent jQuery
functions.
Are these from a plugin you made?

Best thing is to post a simple proof-of-concept page.  then we can help
you debug it.

Glen

On 7/19/07, Goofy [EMAIL PROTECTED] wrote:


 Why wont this work. Its so simple. I just want to call a fuction using
 the onclick event. I want it to move a div called Panel.

 I set up the function

 function advmode() (
 $(#Panel).SlideInRight(1000);
 };

 Then inside a table cell with an image for a button I have this simple
 link

 a href=#Javascript; onclick=advmode()img
 src=images/Advanced
 Search Button Wide_No.png width=250 height=25 /

 I must be missing something really basic because this does not come
 close to working. But this does\

 a href=#Javascript; id=PanelButtonOpen2img
 src=images/
 Advanced Search Button Wide.png width=250 height=25 /

 $('#PanelButtonOpen2').click(function() {
 $(#Panel).SlideOutRight(1000);
 });

 Thanks for any aid I am feeling very silly tonight.

 Mitch






--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Loading Javascript Dynamically (in other words, as needed)

2007-07-21 Thread Rob Desbois

Try this:

if (typeof myFunction === undefined) {

   $.getScript(myFunction.js, function() {
  alert('script loaded');
   });
}



--rob

On 7/20/07, Chrisss [EMAIL PROTECTED] wrote:



Hello,

I was wondering if jQuery can be used to load javascript dynamically,
on an as-needed basis. Here is the problem I have:

I want to load a page with as little javascript as possible. When
someone clicks on an item that requires some javascript functionality,
I want it to load a javascript function from an external file and then
execute it.

While there is some simple javascript I've found that can do this kind
of thing by appending the script to the DOM, it can't do things in
order. For instance, I want to load the function, and then execute it.
To do so, the javascript has to have some way to check if the funciton
exists. I don't like the idea of doing a time-out loop, so I was
wondering if jQuery has something built in for this kind of thing.

Thank you!
Chris





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: changing the value of a global variable inside an post callback function?

2007-07-20 Thread Rob Desbois

I've just spotted it after debugging it in Firebug.

Anything which requires having a response for it to execute correctly, must
be in the response-handling function.
This is behaving exactly as required - the request is asynchronous, and you
cannot guarantee that it will execute after the code that comes after it.

The checkEmailDups() function cannot tell you the value without having to
wait block execution until the response is received. Far better would be to
send the check, and handle both cases within the callback function instead.
This will also allow you to remove the (horrible) global variable.

function checkEmailDups(myemail) {
  $.post(checkemail.cfm, { email: myemail }, function(data) {
 if ($.trim(data) === available) {
// allow whatever action is being performed
 }
 else if ($.trim(data) == taken) {
alert(That email address is taken);
 }
  });
}

--rob

On 7/19/07, bdee1 [EMAIL PROTECTED] wrote:




ok i may have figured out why this is happening.
i put replaces alert(dupsfound) with setTimeout('alert(dupsfound)',3000)
so
that the script waited 3 seconds before displaying the alert and then it
displayed the correct value

so the key is that it IS settign the value properly but it just takes a
minute for the post to complete.

so the next question is, how do i prevent the rest of the function
from
running until the post is finished?



Rob Desbois-2 wrote:

 That should work if errorsFound is global - can you provide your code or
 give us a link to look at?
 --rob

 On 7/19/07, bdee1 [EMAIL PROTECTED] wrote:



 i am building a function to validate a registration form for my site.
 one
 of
 the things i need to validate is that the email address entered into
the
 form does not already exist in the database.

 in my formValidate function i perform several tests.  if a test fails i
 increment a errorsFound variable.  at the end of my function if
 errorsFound
 is greater than 0, i do not submit the form.

 the test for my email field does a $.post to a checkEmail - a page that
 checks the database for duplicate email addresses.  then my callback
 function looks st the results of the post - if duplicates were found, i
 increment my errorsFound variable.

 problem is that from within my $.post callback function i cannot seem
to
 access my errorsFound variable.

 how can i get my post callback function to increment my errorsFound
 variable?
 --
 View this message in context:

http://www.nabble.com/changing-the-value-of-a-global-variable-inside-an-post-callback-function--tf4111860s15494.html#a11691585
 Sent from the JQuery mailing list archive at Nabble.com.




 --
 Rob Desbois
 Eml: [EMAIL PROTECTED]
 Tel: 01452 760631
 Mob: 07946 705987
 There's a whale there's a whale there's a whale fish he cried, and the
 whale was in full view.
 ...Then ooh welcome. Ahhh. Ooh mug welcome.



--
View this message in context:
http://www.nabble.com/changing-the-value-of-a-global-variable-inside-an-post-callback-function--tf4111860s15494.html#a11693506
Sent from the JQuery mailing list archive at Nabble.com.





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Find missing HTML tags

2007-07-20 Thread Rob Desbois

How about stripping tags and showing 30 characters of unformatted text?
It's quite a common thing to do for displaying summaries and would solve the
problem instead of just fixing the symptoms.

--rob


On 7/19/07, Shawn Tumey [EMAIL PROTECTED] wrote:


If the the content is being fetched using AJAX and the return type is text
that you are using to plop in as the inner-html for the div, than you should
be able to parse through the text  and push elements onto a stack when
opening tags are encountered. Pop when closing tags are encountered. Any
tags on the stack at the end of the input need closed.

-Shawn

On 7/19/07, Jonathan Sharp [EMAIL PROTECTED] wrote:

 I think you're going to have to attack that server side as the html is
 interperted browserside into the dom tree which automatically closes tags as
 necessairy.

 -js


 On 7/19/07, sozzi [EMAIL PROTECTED]  wrote:
 
 
  I have a rather odd problem where I am looking for potentially missing
  html tags due to truncation and need to close them.
 
  I am displaying a short summaries for an overview of published
  articles by showing a title and the first 30 words. Unfortunately
  sometimes the article starts with an OL or UL and the closing tags get
  truncated.
 
  Is there a way to find missing closing tags within a div and close
  them automatically? I don't need a final solution, any hint where to
  start would be great, preferably client-side (jQuery) until I get it
  sorted on the server-side
 
  Thanks
 
 







--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Listing methods of an object

2007-07-19 Thread Rob Desbois

Robert,

Try this:


for (var x in j) {
   if (typeof j[x] == function)
  alert(x);
}



--rob


On 7/19/07, S. Robert James [EMAIL PROTECTED] wrote:



Yes - what JS code allows it to see the list of all methods (and their
source code!)?

Jack Killpatrick wrote:
 Something like this?

 http://www.netgrow.com.au/files/javascript_dump.cfm

 - Jack

 Robert James wrote:
 
 
  Is there a way to list all the methods that a particular JavaScript
  object has? Or is there a tool that can do this?
 
 





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Listing methods of an object

2007-07-19 Thread Rob Desbois

Sorry, and the source code for the function can be obtained with
alert(j[x]).
In this code (and that below) 'j' is the javascript object.

--rob


On 7/19/07, Rob Desbois [EMAIL PROTECTED] wrote:


Robert,

Try this:

 for (var x in j) {
if (typeof j[x] == function)
   alert(x);
 }


--rob


On 7/19/07, S. Robert James [EMAIL PROTECTED] wrote:


 Yes - what JS code allows it to see the list of all methods (and their
 source code!)?

 Jack Killpatrick wrote:
  Something like this?
 
  http://www.netgrow.com.au/files/javascript_dump.cfm
 
  - Jack
 
  Robert James wrote:
  
  
   Is there a way to list all the methods that a particular JavaScript
   object has? Or is there a tool that can do this?
  
  




--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Rows hidden by CSS then shown after page load ignore colspan attribute

2007-07-19 Thread Rob Desbois

Hi,

I have a table where some of the rows have a single cell spanning the whole
table, containing a sub-table with different data.
These rows need to be hidden on page load which is easy enough with
display:none, but doing a .show() on them after that breaks the layout in
Firefox 2.0: it seems to ignore the colspan attribute, as the whole
sub-table appears crammed into the first cell.

Works in IE as expected. Also works in Fx if I remove the CSS and do a
$.hide() on the rows after page load instead.
I'm assuming this is a Firefox rendering bug, so apologies for the slightly
OT - can anyone yield any further info on it?

Thanks,
--rob
--
Rob Desbois
Eml: [EMAIL PROTECTED]


[jQuery] Re: Rows hidden by CSS then shown after page load ignore colspan attribute

2007-07-19 Thread Rob Desbois

Marc,

Thanks, but I get the same result...
Any other ideas?

Rob

On 7/19/07, Marc Jansen [EMAIL PROTECTED] wrote:



Rob Desbois schrieb:
 Hi,

 I have a table where some of the rows have a single cell spanning the
 whole table, containing a sub-table with different data.
 These rows need to be hidden on page load which is easy enough with
 display:none, but doing a .show() on them after that breaks the
 layout in Firefox 2.0: it seems to ignore the colspan attribute, as
 the whole sub-table appears crammed into the first cell.

 Works in IE as expected. Also works in Fx if I remove the CSS and do a
 $.hide() on the rows after page load instead.
 I'm assuming this is a Firefox rendering bug, so apologies for the
 slightly OT - can anyone yield any further info on it?

 Thanks,
 --rob
 --
 Rob Desbois
 Eml: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]

Hi Rob,

mabe you should try to set the style property display to table:

$('table#mytable').css( {display : table} );


-- Marc





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Tabs plugin in floated container

2007-07-16 Thread Rob Desbois

Klaus,

Yes, apologies the code I posted was absolute rubbish.
The code you posted was what it actually looked like. Sorry for that!

If you think about it the tabs styling will always break the page if inside
a floated layout: the rule that makes the end of the ul.tabs-nav have
clear: both will always force the container (if below the ul) to
position itself below all previous floated elements on the page.


But they're not floated (float makes an element automatically block). In

IE though they're floated to fix stupid bugs.
I meant the li elements wrapping the as are floated for this, as
otherwise they'll be in a vertical layout.

It may be possible to do a decent-looking layout with non-floated li
elements, perhaps by using display: inline but I think that to get uniform
sizes JS would be required to do some post-rendering fiddling.


Olaf,
Thanks - that prevents the clear property from affecting it.
I hadn't realised floats worked like that.

Cheers both,
--rob


On 7/13/07, Olaf Bosch  [EMAIL PROTECTED] wrote:



Rob, you must set the parents element to, with float!

try:

 div#sidebar {
float: left;
width: 15%;
 }

 div#content {
float: left; /* or right */
margin-left: 16%;
display:inline; /* for duble margin in IE when left float */
 }

--
Viele Grüße, Olaf

---
[EMAIL PROTECTED]
http://olaf-bosch.de
www.akitafreund.de
---





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Tabs plugin in floated container

2007-07-16 Thread Rob Desbois

Klaus,

Try adding height: 200px; to div#sidebar and you can see the problem.
Floating div#content left or right solves that problem, but does mean the
div's don't expand to fill the client area anymore :-(

--rob

On 7/16/07, Klaus Hartl [EMAIL PROTECTED] wrote:



Rob Desbois wrote:
 Klaus,

 Yes, apologies the code I posted was absolute rubbish.
 The code you posted was what it actually looked like. Sorry for that!

 If you think about it the tabs styling will always break the page if
 inside a floated layout: the rule that makes the end of the ul.tabs-nav
 have clear: both will always force the container (if below the ul)
 to position itself below all previous floated elements on the page.

I cannot confirm that. Have a look here:
http://stilbuero.de/jquery/tabs/test.html

The float isn't cleared by the tabs (quickly tested in Firefox only).

Which browsers are you talking of?



--Klaus





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Tabs plugin in floated container

2007-07-16 Thread Rob Desbois

Aha, the solution failed in IE6 though! (Including your test page).

A quick play shows the floating #sidebar and #content right instead of left,
and putting #content before #sidebar in the source to fix the problem.
I daren't go near Opera/Safari now ;-)

--rob

On 7/16/07, Rob Desbois [EMAIL PROTECTED] wrote:


Klaus, thank you.

That's fixed it perfectly, and it's not an inelegant solution.
I still find proper column layouts in pure CSS can be such a trial to get
right: this trick is going in my snippet library!

--rob [happy]

On 7/16/07, Klaus Hartl [EMAIL PROTECTED] wrote:


 Rob Desbois wrote:
  Klaus,
 
  Try adding height: 200px; to div#sidebar and you can see the
 problem.
  Floating div#content left or right solves that problem, but does mean
  the div's don't expand to fill the client area anymore :-(


 I see. The reason why I never ran into this kind of problem is that I
 usually use a little more complex layouts to allow better source code
 ordering (content first!).

 I quickly put together a little prototype, which overcomes your problems

 while allowing flexible width (only tested in Firefox):
 http://stilbuero.de/jquery/tabs/test.html

 It uses a wrapper with 15% padding on the left, the sidebar is floated
 left and pushed onto the wrapper's left padding via negative margin. The
 content expands to 100% width...

 HTH, Klaus


 --Klaus




--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Tabs plugin in floated container

2007-07-13 Thread Rob Desbois

Happy Friday 13th all ;-)

Just mocking up a new interface and attempting to use floated divs for
layout.
The right div of two floated next two each other needs to be a tabbed
container...but the tabs plugin floats the li elements then does a
clear:both afterwards which breaks my layout.

I have a feeling I'll be playing with it all afternoon to try and change
this, but can anyone assist and point me in the right direction? I like the
positioning as it is but just need it to not use floats...

Thanks!

In case it's useful, the code I am using is below.

CSS:


div#sidebar {
   float: left;
   width: 15%;
}

div#content {
   margin-left: 16%
}



HTML:


div id='sidebar'
   div id='content'
  ul
 lia href=#tab-1Tab 1/a/li
  /ul

  div id=tab-1Tab 1/div
   /div
/div



Each tab div (i.e. #tab-1 in this instance) will appear *below* the
sidebar because of these two tabs styles:


.tabs-nav:after { /* clearing without presentational markup, IE gets extra
treatment */
clear: both;
}

.tabs-nav li {
float: left;
}



Funnily enough it 'works' in IE6 - but this is because the clear:both is
broken by the IE-specific style.


--
Rob Desbois
Eml: [EMAIL PROTECTED]


[jQuery] Re: Tabs plugin in floated container

2007-07-13 Thread Rob Desbois

Klaus,

Thanks for the reply - making the ul float as well didn't help.
Using the overflow doesn't seem to have any discernible difference from
without it (when the tabs-nav:after rules are removed).

I think the best way to go will be to remove display: block from the
.tabs-nav a rule and do the sizing of them manually.
--rob

On 7/13/07, Klaus Hartl [EMAIL PROTECTED] wrote:



Klaus Hartl wrote:

 Rob Desbois wrote:
 Happy Friday 13th all ;-)

 Just mocking up a new interface and attempting to use floated divs
 for layout.
 The right div of two floated next two each other needs to be a tabbed
 container...but the tabs plugin floats the li elements then does a
 clear:both afterwards which breaks my layout.

 I have a feeling I'll be playing with it all afternoon to try and
 change this, but can anyone assist and point me in the right
 direction? I like the positioning as it is but just need it to not use
 floats...

 Thanks!

 Rob, does it help if you declare float for the ul as well?

 .tabs-nav {
 float: left;
 }

Depending on how the tabs shall look like you could also clear by
declaring overflow for the ul, like:

.tabs-nav {
 overflow: hidden;
}

Works in all modern browsers except for IE 6.

But that breaks the relative positioning, e.g. pushing the active tab on
top of the bottom border (this is why I said it depends on how tabs
shall look like).

Alternatively you may declare a height for the ul and do not clear at
all...

Getting around the float will be hard, although doable (via display:
inline-block, or display: table-cell)


--Klaus





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Tabs plugin in floated container

2007-07-13 Thread Rob Desbois

Am I right in thinking that the a tags are given display:block and then
floated to make them all automatically the same width?
Or not?
Bah, darn CSS trickery...

On 7/13/07, Rob Desbois [EMAIL PROTECTED] wrote:


Klaus,

Thanks for the reply - making the ul float as well didn't help.
Using the overflow doesn't seem to have any discernible difference from
without it (when the tabs-nav:after rules are removed).

I think the best way to go will be to remove display: block from the
.tabs-nav a rule and do the sizing of them manually.
--rob

On 7/13/07, Klaus Hartl [EMAIL 
PROTECTED]https://mail.google.com/mail?view=cmtf=0[EMAIL PROTECTED]
wrote:


 Klaus Hartl wrote:
 
  Rob Desbois wrote:
  Happy Friday 13th all ;-)
 
  Just mocking up a new interface and attempting to use floated divs
  for layout.
  The right div of two floated next two each other needs to be a tabbed
  container...but the tabs plugin floats the li elements then does a
  clear:both afterwards which breaks my layout.
 
  I have a feeling I'll be playing with it all afternoon to try and
  change this, but can anyone assist and point me in the right
  direction? I like the positioning as it is but just need it to not
 use
  floats...
 
  Thanks!
 
  Rob, does it help if you declare float for the ul as well?
 
  .tabs-nav {
  float: left;
  }

 Depending on how the tabs shall look like you could also clear by
 declaring overflow for the ul, like:

 .tabs-nav {
  overflow: hidden;
 }

 Works in all modern browsers except for IE 6.

 But that breaks the relative positioning, e.g. pushing the active tab on

 top of the bottom border (this is why I said it depends on how tabs
 shall look like).

 Alternatively you may declare a height for the ul and do not clear at
 all...

 Getting around the float will be hard, although doable (via display:
 inline-block, or display: table-cell)


 --Klaus




--
Rob Desbois
Eml: [EMAIL PROTECTED]https://mail.google.com/mail?view=cmtf=0[EMAIL 
PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: how to fetch data by php page from jQuery

2007-07-12 Thread Rob Desbois

How so?
If I understand correctly, Xinhao wants to create a PHP script which can
provide JSON data when requested. The only method of doing this is by
outputting it.
It is possible to make the script only output if requested by the
XmlHttpRequest object, but this is very easily spoofed, and the response is
sent plaintext over the network anyway.

What he's trying to do is to provide the user with some information, but
without providing the user without that information. A paradox I'm sure
you'll understand!

What's your suggestion ricardoe?

On 7/11/07, ricardoe [EMAIL PROTECTED] wrote:



Is impossible to use the cookies? To achieve what Benjamin wants to
do.
Sorry for my english. Saludos from México.





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: how to fetch data by php page from jQuery

2007-07-11 Thread Rob Desbois

Xinhao,

The only way to return data from server to client (PHP - jQuery in this
case) is by 'displaying' it in PHP - in other words using echo, print or
something similar.

This does mean that anyone could look at what your javascript is doing and
do the same, unfortunately there's not much you can do about this. If you're
worried about confidentiality then using a login system along with the
request should mean that someone can only retrieve the data they are
entitled to view.

--rob


On 7/11/07, Xinhao Zheng [EMAIL PROTECTED] wrote:



hi  Benjamin,
  It's very nice for your reply.Thanks a lot!Your advice does help
me,but i have another problem.
  If i don't like the php file to display the data.Because if someone
who view the js source will see the url and can request the url in the
navigator and get the data.Can i just return  json but not display it.

Thanks

On 7月11日, 上午10时46分, Benjamin Sterling
[EMAIL PROTECTED] wrote:
 Xinhao,
 Welcome to the list;

 The way I usually do it is something like this:

 php (returns json):
 echo '{id:1,fname:Benjamin,lname:Sterling}';

 javascript:

 $.ajax({
 dataType:'json',
 url:'mypage.php',
 success : function(info){
 // do something with with info
 // call return by doing something like
 // info.id / info.fname / info.lname

 }
 });

 This should point you in the right direction.

 On 7/10/07, Xinhao Zheng [EMAIL PROTECTED] wrote:



  hello everyone,
I am just a fresher to jQuery.I like it very much.I need some help.

  Is there any way to request a php file to fetch data from db in jQuery
  then operate on it use  js?Ajax can do it?

  which format would be the best way to return the data,json or xml?how
to
  deal with that in js?

  I just want to implement a calendar and display data from db.

  Thanks

 --
 Benjamin Sterlinghttp://www.KenzoMedia.comhttp://www.KenzoHosting.com





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: append reformting the content i send it

2007-07-10 Thread Rob Desbois

What is the content you are trying to add...?

On 7/10/07, Terry B [EMAIL PROTECTED] wrote:



wtf?  I have specific html i want added to a div so I use append to
add it.  fine it works but it is formatting the code and making it
unusable.  how do i prevent append from doing this?





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: loop through elements and stop at first match

2007-07-09 Thread Rob Desbois

jQuery's in-built selectors with the custom selector ability should provide
you with everything you need without having to loop through the array
yourself.
What are you trying to search for?

On 7/9/07, Olivier Percebois-Garve [EMAIL PROTECTED] wrote:


Hi

I want to loop through the jquery array of objects,
stop to loop when it finds the first match,
and then continue to loop with another search.

In another language I would set a var found = false;
before the loop and then set it to true in the loop,
but with chaining I'm not sure how to do.
Any idea ?


Olivier





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: login via ajax

2007-07-06 Thread Rob Desbois

An AJAX submission is as secure as a normal form submission - both go via
the same mechanism.

For security in both you should use HTTPS. If submitting only via AJAX you
could implement client-side encryption with a public key, the server can
then decrypt this, but this wouldn't apply to normal form submissions hence
I suggest HTTPS.

On 7/6/07, Shelane [EMAIL PROTECTED] wrote:



I'm sure someone out there has done a login via ajax.  What's the
securest way to pass a username and password into the server.

Currently, I have the case where a user desires to register for an
event.  If the user is not logged in, he/she is presented with a login
form that has a Register for this Event and hidden fields with event
info, etc.  If the user authenticates properly, there will be no issue
and I'd be able to log the user in and register that user for that
event.  However, if the user mistypes his/her password, I have an
issue.  So, I'd have to take the user to another login form, retain
all the desired action information (this could be something other
than event registration) and continue this until the user
authenticates properly.  However, if I can authenticate that user
before I have to take them away from that inital form, I can just keep
them there until they authenticate properly, then move ahead once they
do.  Is an ajax submission even the way to go?

I'm looking for ideas out there from you wonderful developers.





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Translate to jquery

2007-07-06 Thread Rob Desbois

We can all help you - but you won't learn anything if I just paste a
translated version of the function ;-)

To learn jQuery the best thing you can do is to run through the tutorials on
the website to see how it all works, then have a go at translating it
yourself.

By all means though if you still struggle then ask here again :-)

--rob


On 7/5/07, Sebastián V. Würtz [EMAIL PROTECTED] wrote:



I what translate this (im still noob) to jquery can anyone helpme?

function insertAfter(newElement,targetElement) {
  var parent = targetElement.parentNode;
  if (parent.lastChild == targetElement) {
parent.appendChild(newElement);
  } else {
parent.insertBefore(newElement,targetElement.nextSibling);
  }
}
function captionizeImages() {
  if (!document.getElementsByTagName) return false;
  if (!document.createElement) return false;
  var images = document.getElementsByTagName(img);
  if (images.length  1) return false;
  for (var i=0; iimages.length; i++) {
if (images[i].className.indexOf(captioned) != -1) {
  var title = images[i].getAttribute(title);
  var divCaption = document.createElement(div);
  divCaption.className = caption;
  var divCaption_text = document.createTextNode(title);
  divCaption.appendChild(divCaption_text);
  var divContainer = document.createElement(div);
  divContainer.className=imgcontainer;
  images[i].parentNode.insertBefore(divContainer,images[i]);
  divContainer.appendChild(images[i]);
  insertAfter(divCaption,images[i]);
}
  }
}





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: jQuery 1.1.3.1

2007-07-05 Thread Rob Desbois

Should the changelog say 'jQuery 1.1.4 Closed Bugs'?

Plus: thanks for the quick fixes!

--rob

On 7/5/07, John Resig [EMAIL PROTECTED] wrote:



Hi Everyone -

This is a quick bug fix release for jQuery 1.1.3. About six major
issues popped up after the 1.1.3 release that we deemed important
enough to resolve immediately, with a follow-up release. The full list
of resolved issues can be found here:
http://dev.jquery.com/report/16

You can download the release from the jQuery Google Code page:

Uncompressed:
http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.1.3.1.js

Compressed:

http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.1.3.1.pack.js

As always, be sure to let us know if you encounter any issues by
submitting a bug report to the jQuery  bug tracker:
http://dev.jquery.com/

Thanks and enjoy!

--John





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: jQuery 1.1.3: 800%+ Faster, still 20KB

2007-07-02 Thread Rob Desbois

Wow, an incredible improvement.

I can notice the speed differences with my various jQuerified interfaces
just by using them, no need to benchmark!

John et al: thanks again, for a great improvement on what is already a great
piece of kit.

On 7/2/07, Klaus Hartl [EMAIL PROTECTED] wrote:



John Resig wrote:

 Hi Everyone -

 I'm pleased to announce the release of jQuery 1.1.3. After many months
 of testing, developing, and more testing, we have a very solid release
 available for download. It comes with roughly 80+ fixed bugs and a
 handful of enhancements for good measure. Highlights include:

   1. Improved speeds, with DOM traversal over 800% faster than in 1.1.2.
   2. A re-written event system, with more graceful handling of keyboard
 events.
   3. A re-written effects system (with an accompanying fx test
 suite), featuring faster execution and better cross-platform support.

 Full list of fixes:
 http://dev.jquery.com/report/15


Great news! Good to have that out now! I found some issues with the
Tabs, but will write a seperate mail for that...



--Klaus





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: $(elem) question

2007-07-02 Thread Rob Desbois

Hi, the syntax you need for selecting by ID is this:


$(#identifier)


so to find the element with ID 'aller' you want:


$(#aller)




Bear in mind that the $() function does not return a DOM object, it returns
a jQuery object.
If you want to access a DOM property such as selectedIndex, you will need to
retrieve the DOM object like this:


alert($(#aller)[0].selectedIndex);



Remember also that that line will generate an error if there is no element
found with ID 'aller'.

I hope that explains it for you :-)
--rob


On 7/2/07, debussy007 [EMAIL PROTECTED] wrote:




Hi,

I am trying to access my SELECT element with jQuery but I can't make it
working :

This works :
 alert(document.getElementById('aller')); //  [object]
 var sel = document.getElementById('aller');
 alert(sel.selectedIndex);   // 0
This not working :
 alert($(document.aller));   // [object Object]
 alert($(document.aller).selectedIndex);   // undefined

Could anyone help me ?

Thank u for any comment.


--
View this message in context:
http://www.nabble.com/%24%28elem%29--question-tf4011702s15494.html#a11392465
Sent from the JQuery mailing list archive at Nabble.com.





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: $(elem) question

2007-07-02 Thread Rob Desbois

The string #aller is called a selector - meaning it selects elements from
the DOM.
Whilst the ID (#) selector will only ever return at most 1 element, other
selectors can return more than 1, for example:


$(.my_class)


will return all elements with a CSS class of my_class.

The returned object is a jQuery object, which contains, amongst other things
(such as functions) the DOM elements found.
The DOM elements are accessible individually via array element access with
integer index, so $(#aller)[0] will give you the first DOM element found
with ID of aller.

--rob

On 7/2/07, debussy007 [EMAIL PROTECTED] wrote:





I have everything working now, thank u very much for your kind help.
Though I do not understand the array $(#aller)[0]
what are in the next indexes $(#aller)[1], $(#aller)[2], ... ?



Rob Desbois-2 wrote:

 Hi, the syntax you need for selecting by ID is this:

 $(#identifier)

 so to find the element with ID 'aller' you want:

 $(#aller)



 Bear in mind that the $() function does not return a DOM object, it
 returns
 a jQuery object.
 If you want to access a DOM property such as selectedIndex, you will
need
 to
 retrieve the DOM object like this:

 alert($(#aller)[0].selectedIndex);


 Remember also that that line will generate an error if there is no
element
 found with ID 'aller'.

 I hope that explains it for you :-)
 --rob


 On 7/2/07, debussy007 [EMAIL PROTECTED] wrote:



 Hi,

 I am trying to access my SELECT element with jQuery but I can't make it
 working :

 This works :
  alert(document.getElementById('aller')); //
 [object]
  var sel = document.getElementById('aller');
  alert(sel.selectedIndex);   // 0
 This not working :
  alert($(document.aller));   // [object Object]
  alert($(document.aller).selectedIndex);   // undefined

 Could anyone help me ?

 Thank u for any comment.


 --
 View this message in context:

http://www.nabble.com/%24%28elem%29--question-tf4011702s15494.html#a11392465
 Sent from the JQuery mailing list archive at Nabble.com.




 --
 Rob Desbois
 Eml: [EMAIL PROTECTED]
 Tel: 01452 760631
 Mob: 07946 705987
 There's a whale there's a whale there's a whale fish he cried, and the
 whale was in full view.
 ...Then ooh welcome. Ahhh. Ooh mug welcome.



--
View this message in context:
http://www.nabble.com/%24%28elem%29--question-tf4011702s15494.html#a11393227
Sent from the JQuery mailing list archive at Nabble.com.





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: HELP!!!!!!

2007-06-28 Thread Rob Desbois

I don't know whether the line wraps you have are hard wraps or not - beware
that you can't run a string across multiple lines in JS.

Otherwise this looks fine on the face of it, although I'm not familiar with
the validation plugin so couldn't be sure that you've configured that
correctly.

Where is it breaking? Are you getting any javascript errors? Have you tried
debugging in Firefox?

--rob


On 6/28/07, Sebastián V. Würtz [EMAIL PROTECTED] wrote:



What is bad in this? i want a simple alert() but dont work, check
the lastest lines

var loader = jQuery('div id=black_overlaydiv
id=loading_commentsimg src=assets/i.loading_big.gif alt=Espere
por favor... /pCargando, espere por favor/p/div/div')
.hide()
.appendTo(body);
jQuery().ajaxStart(function() {
loader.show();
})
.ajaxStop(function() {
loader.hide();
});


var v = jQuery(#envio_comentarios_form).validate({
errorLabelContainer: $(#mensajes_envio),
wrapper: li,
event: keyup,
rules: {
nombre: {
required: true,
minLength: 4,
maxLength: 30
},
acepto_comentario: {
required: true
},
email: {
email: true,
required: true,
minLength: 10,
maxLength: 25
},
comentario: {
required: true,
minLength: 30,
maxLength: 300
}
},
messages: {
comentario: {
required: Es necesario que deje un comentario,
minLength: Su comentario es muy corto (mínimo 30
letras).,
maxLength: Su comentario es muy largo (máximo 300
letras).
},
nombre: {
required: Es necesario que complete su nombre,
minLength: Nombre muy corto,
maxLength: Nombre muy largo.
},
email: {
email: Ingrese una dirección válida de email,
required: Es necesario que complete su email,
minLength: Dirección muy corta,
maxLength: Dirección muy larga.
},
acepto_comentario: {
required: Debe aceptar nuestras cláusulas sobre
comentarios
}
},
submitHandler: function(form) {
jQuery(form).ajaxSubmit({
resetForm: true,
dataType: json,
success:  function() {alert(test) }
});
}
});





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Validation Plugin - hows to only fire on form submit?

2007-06-28 Thread Rob Desbois

Sam,

On the API documentation page have a look at the examples for .validate() -
http://jquery.bassistance.de/api-browser/plugins.html#validateMap

There is a parameter called 'event' which seems to control when each input
is validated, its use is shown a couple of times.
This isn't documented but shouldn't be too hard to work out its semantics -
I'd love to help further but haven't used the validate() plugin myself.

HTH,
--rob


On 6/28/07, Sam Collett [EMAIL PROTECTED] wrote:



Is it possible to only run validation when the form is submitted? I am
using version 1.1 of the validation plugin (http://bassistance.de/
jquery-plugins/jquery-plugin-validation/)

I want to do something only when the form is submitted, so tried this
basic code:

$(form).validate(
{
showErrors: function(errors)
{
alert(should only fire on submit);
}
})


The alert shows when I try to submit the form, and also when I click
the page after dismissing the alert.

Test page: http://www.texotela.co.uk/validation.php





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: how to make cross browser application with javascript

2007-06-28 Thread Rob Desbois

Hi Rajesh,

We need you to provide some information on your code if you need help.
Are you receiving any errors in Firefox? If so then where?
Have you installed Firebug? I can highly recommend it for debugging scripts
in Firefox.

If that doesn't help, you need to provide us with the bits of code that are
not working and explain what doesn't work.

--rob


On 6/28/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:



hi,
I want to make code in javascript for client side
it is runninf in IE but not in FireFoxPls Help





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: jQuery

2007-06-28 Thread Rob Desbois

I feel very stupid for clicking on that :-( I was expecting some
super-excellent jQuery usage.
Oh well, back to work...

On 6/28/07, Brandon [EMAIL PROTECTED] wrote:



Check it out: www.BrandonsMansion.com




[jQuery] Re: select all unchecked checkboxes

2007-06-26 Thread Rob Desbois

I think  $(#myform input:checkbox).not(:checked)  should do what you
want, but I've not tested it.
--rob

On 6/26/07, badtant [EMAIL PROTECTED] wrote:



Hi!

I want to get all checkbox items that are not checked.

I use the following to get all checkboxes that is checked but now i
want to get the ones that are unchecked, how can I do that?

$(#myform input:checkbox:checked)

Thanks!
/Niklas





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Attn. developers. Speed of getElementById

2007-06-25 Thread Rob Desbois

Josh, that's all very true, but the reason that getElementById() is faster
than getElementsByTagName() for example, is that it doesn't traverse the DOM
to perform a string comparison of each element's ID.

I don't know what the exact mechanism is, but I would assume it is a hash
table from element IDs to the DOM nodes - that would seem the most sensible,
although could obviously vary between browsers.

As to why a longer ID would result in slower lookups, that's an odd one. If
it is a hash table then the hashing algorithm would technically take longer
for a longer string, but I can't imagine it being noticeable unless it was
really appalling!

Just my £0.02 worth
--rob


On 6/22/07, Josh Bush [EMAIL PROTECTED] wrote:



I can only imagine the longer the attribute, the longer the comparison
will take.
Puts on CompSci hat

String comparison has to compare each char at each position.
abc=abc would involve 3 iterations.

digitalbush.com=digitalbush.com would involve 15 iterations.

In the description at the top with a, another with
ids like , if every element is
preceeded by 32 a's, then looking for
 would result in 32 iterations
before it failed to match that attribute.  If the document has 100
elements all with 32 a's as a prefix, then worst case scenario is (100
x 32) + 4 [the actual remaining ] would yield 3,204 comparisons.

Please keep in mind, we are talking about tiny cpu time, but that
could add up over a large document.

-Josh

On Jun 22, 10:38 am, Su [EMAIL PROTECTED] wrote:
 Weird. It'd provide an interesting guideline if there's an id-length
 threshold where that slowdown kicks in.

 On 6/22/07, John Resig [EMAIL PROTECTED] wrote:



  Dimitii -

  Those results are really interesting - you should post them to the
jQuery
  Dev list (where we discuss issues like selector speed).

  More information about the list can be found here:
 http://docs.jquery.com/Discussion





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Table cell navigation

2007-06-22 Thread Rob Desbois

On 6/21/07, Brad Perkins [EMAIL PROTECTED] wrote:



On Jun 21, 11:29 am, Rob Desbois [EMAIL PROTECTED] wrote:
 Brad,

 Glad to help, I had to solve a similar problem a few months back.

 Regarding the use of the already-present names instead of duplicating
them
 to IDs, it may be worth the duplication for speed of selectors if that
is a
 concern.
 It wholly depends on how many elements there are in the page - what
could be
 useful is to give each tr an id of row-304.

Even with the original traverse up, then down code, selection was
quick, but I didn't like the syntax.
In the actual page the rows do have ids and I don't think the number
of elements will be an issue.


What I meant by this was that an operation like getting elements by name is
a 'slow' operation - I don't think the browser has any 'shortcuts' it can
take to find them, so must search through the entire DOM to find all
matching elements. Conversely, when getting an element by ID, the browser
knows there is only one and can retrieve it very quickly.
Thus, more elements = retrieving by name is slower


That way you can use that as
 a context for retrieving something by name, e.g. [untested]:

 var row = $(#row-+index);

  $('[EMAIL PROTECTED]'], row).val(...);


I'll give that a try. If I understand that selector correctly that
will find the input element with name 'serial-304' within the tr
referenced by 'row'?


Correct. The second paramater is 'context' - the selector provided will be
limited to elements in the context, which defaults to the current document.


I'm not certain of how beneficial either of those suggestions would be
 speed-wise though, it could be worth testing if important.

Out of curiosity, and for future reference what is the best way to
measure the selection speed?


If available, a Javascript profiler such as the one provided in the
excellent Firefox plugin firebug (http://www.getfirebug.com).
Otherwise best is to output start and end times of functions yourself. Do
whatever benchmark a few hundred times to get a good average, then compare
the methods.

Thanks Again!


 --rob

 On 6/21/07, Brad Perkins [EMAIL PROTECTED] wrote:





  Rob,

  That is an excellent suggestion. I didn't give actual source in the
  example, but it turns out that each of the selects and inputs have
  unique numbered name attributes already, e.g., name=serial-304.
  The numeric part correspond to keys in the db backend. So I can either
  add a redundant id attribute or just lookup based on $
  ('[EMAIL PROTECTED]']) or $('[EMAIL PROTECTED]']).

  re: not using .val

  For some reason I thought that had been deprecated when .id and .name
  were. Thanks for pointing out that it still exists.

  On Jun 21, 2:29 am, Rob Desbois [EMAIL PROTECTED] wrote:
   I would suggest making all of these items related via numeric IDs,
you
  then
   dispose with having to traverse up and back down the DOM to find the
  related
   elements:

   tr

 td
   select id=select_1.../select
 /td
 td
   input id=text_1a type=text ... /
 /td
 td
   input id=text_1b type=text ... /
 /td
 td
   input id=text_1c type=text ... /
 /td
 td
   ...
 /td
/tr

// Update 2nd column input with new_value.
// $(this) is the select in the first row cell.
var index = /select_(\d+)/.exec(this.id)[1];  // Get the number
from
  the
ID. There is no checking if it doesn't match.
var new_value = $(this).val();
$(text_+index+a).val(new_value);

   Incidentally, as I've used here, the .val() function is a handy
shortcut
  for
   .attr(val, ...)

   I don't know what the speed difference is here but I'm guessing
it'll be
   pretty good.

   HTH,
   --rob

   On 6/21/07, Brad Perkins [EMAIL PROTECTED] wrote:

Imagine a table row like this

tr
  td
select.../select
  /td
  td
input type=text ... /
  /td
  td
input type=text ... /
  /td
  td
input type=text ... /
  /td
  td
...
  /td
/tr

Depending on the select option I need to modify or clear values in
the
text inputs in the 2nd, 3rd, and 4th cells.

I find that this code works, but suspect there may be a better way
to
achieve the same result with less code?

// Update 2nd column input with new_value.
// $(this) is the select in the first row cell.
$

 
(this).parent('td').parent('tr').children('td').eq(1)children('input').attr(value,new_value);

Since I'll be updating various cells I suppose this helps, but
again
suspect there is a better way.
var cells = $(this).parent('td').parent('tr').children('td');
cells.eq(1).children('input').attr(value,new_value_1);
cells.eq(3).children('input').attr(value,new_value_2);
cells.eq(4).children('input').attr(value,new_value_3);

Thanks

Brad

   --
   Rob Desbois
   Eml: [EMAIL PROTECTED]
   Tel: 01452 760631
   Mob: 07946 705987
   There's a whale there's a whale

[jQuery] Re: jquery editor?

2007-06-22 Thread Rob Desbois

I develop for embedded C/C++ as well as Web, and don't use an IDE for
either.
I haven't found a One True Editor which does exactly what I want, and seem
to alternate between Notepad++ and Programmer's Notepad every few months.
UltraEdit was a particular favourite many moons ago but haven't used it in
some years now.

E-TextEditor looked good until I realised the 'fully functional' demo breaks
after 30 days...for the same reason as I don't use UE anymore, I wouldn't
use that. It looks damn good (particularly Cygwin integration), but I don't
want to try the demo in case I really like it :-(

--rob


On 6/22/07, Olivier Percebois-Garve [EMAIL PROTECTED] wrote:


 The code you shown look like the one produced by Zend Studio


Alexandre Plennevaux wrote:


This may be slightly off-topic, yet i would like to know which piece of
software you like best to write jquery code?

So far i use (windows) dreamweaver / phpedit / crimson editor /
programmer's notepad 2, depending on what's opened when i'm about to
jquerify life.
When i dive into others' plugins codes i see comments that seem
preformatted, as in:

/**
 *
 * @name flash.hasFlash.playerVersion
 * @desc Get the version of the installed Flash plugin.
 * @type String
 *
**/

i've always wondered where that comes from...


Thanks!

Alex


Alexandre Plennevaux - LAb[au] asbl.vzw / MediaRuimte
Lakensestraat/Rue de Laeken 104
B-1000 Brussel-Bruxelles-Brussels
Belgie-Belgique-Belgium

Tel:+32(0)2.219.65.55
Fax:+32(0)2.426.69.86
Mobile:+32(0)476.23.21.42
http://www.lab-au.com
http://www.mediaruimte.be

__

The information in this e-mail is intended only for the addressee named
above.  If you are not that addressee, please note that any disclosure,
distribution or copying of this e-mail is prohibited.
Because e-mail can be electronically altered, the integrity of this
communication cannot be guaranteed.

__


Ce message Envoi est certifié sans virus connu.
Analyse effectuée par AVG.
Version: 7.5.472 / Base de données virus: 269.9.1/857 - Date: 20/06/2007
14:18






--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: form onchange event

2007-06-22 Thread Rob Desbois

The form itself doesn't have an onchange, however each of the input elements
will.
Try this, it's untested but looks ok.

$(#myForm :input).change(function() {

   $(#mySubmit).attr(disabled, false);
});



The :input pseudo-selector includes all form elements (input, select,
textarea, button)

--rob


On 6/22/07, oscar esp [EMAIL PROTECTED] wrote:



Hi,

I have a form with submit button.
When I load the form I load the var values in order to fill the form.
Initiallly submit button is disabled...

I would like:

If use change any thing into the form I will like to enable the
button.

I dont' know If there is a event like  form onchage=''

I need that it works with ie and seems that onghange event doesn't
work.

Maybe adding some event to the form?





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Table cell navigation

2007-06-21 Thread Rob Desbois

I would suggest making all of these items related via numeric IDs, you then
dispose with having to traverse up and back down the DOM to find the related
elements:

tr

 td
   select id=select_1.../select
 /td
 td
   input id=text_1a type=text ... /
 /td
 td
   input id=text_1b type=text ... /
 /td
 td
   input id=text_1c type=text ... /
 /td
 td
   ...
 /td
/tr


// Update 2nd column input with new_value.
// $(this) is the select in the first row cell.
var index = /select_(\d+)/.exec(this.id)[1];  // Get the number from the
ID. There is no checking if it doesn't match.
var new_value = $(this).val();
$(text_+index+a).val(new_value);



Incidentally, as I've used here, the .val() function is a handy shortcut for
.attr(val, ...)

I don't know what the speed difference is here but I'm guessing it'll be
pretty good.

HTH,
--rob


On 6/21/07, Brad Perkins [EMAIL PROTECTED] wrote:



Imagine a table row like this

tr
  td
select.../select
  /td
  td
input type=text ... /
  /td
  td
input type=text ... /
  /td
  td
input type=text ... /
  /td
  td
...
  /td
/tr



Depending on the select option I need to modify or clear values in the
text inputs in the 2nd, 3rd, and 4th cells.

I find that this code works, but suspect there may be a better way to
achieve the same result with less code?

// Update 2nd column input with new_value.
// $(this) is the select in the first row cell.
$

(this).parent('td').parent('tr').children('td').eq(1)children('input').attr(value,new_value);

Since I'll be updating various cells I suppose this helps, but again
suspect there is a better way.
var cells = $(this).parent('td').parent('tr').children('td');
cells.eq(1).children('input').attr(value,new_value_1);
cells.eq(3).children('input').attr(value,new_value_2);
cells.eq(4).children('input').attr(value,new_value_3);

Thanks

Brad





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Easing rocks

2007-06-21 Thread Rob Desbois

Glen I disagree there too.
Stuff like this doesn't belong in the core IMO - in fact I think the only
effects that should be present are show() and hide().

What is this mythical 'turbospeed' you speak of? Surely anything that makes
the selectors faster should be the default mechanism used by the core?
Unless of course it's 100KB...

--rob


On 6/21/07, Erik Beeson [EMAIL PROTECTED] wrote:


I like backin/out. It feels like the virtual equivalent of physical toggle
switches that work like that (often used as power switches).

I disagree about having that stuff in the core though. Often I don't even
need animations or ajax, but part of what I really like about jQuery is that
it's small enough that it doesn't hurt to load all of that stuff whether you
need it or not. Not having to deal with loading various packages based on
which features you need is nice, but the tricky bit is finding the right
balance between including things and not. I'd say, leave the core features
in the core, and addon features in plugins. e.g. Basic ajax stuff in the
core, auto ajaxification of forms in a plugin. Basic animations in the core,
fancy easing effects in a plugin. Basic selectors in the core, super speed
tuned selectors in a plugin. etc.

--Erik


On 6/20/07, Glen Lipka [EMAIL PROTECTED] wrote:

 Had occasion just now to use the Easing plugin
 http://gsgd.co.uk/sandbox/jquery.easing.php

 I replaced a slideDown Toggle with bounceout.  Kickass.
 And it's 2k!  Too cool.  Improves the interaction immediately,

 I'm changing my vote on stuff I think should be in the base.  Yes, I am
 fickle.
 1. Dimensions
 2. Easing
 3. TurboSpeed (yet to be developed)

 I took moreSelectors off my list.  Sorry moreSelectors.  Only three
 spots.

 Glen






--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Simple Question about ajax request timeout

2007-06-15 Thread Rob Desbois

Does this catch a timeout condition? If so you could do the slideUp() from
there.

$.ajaxSetup({

   error: function() {
  // ...
   }
});



--rob


On 6/15/07, joomlafreak [EMAIL PROTECTED] wrote:



Many times the ajax request gets timeout and the show/hide or slideup/
down function gets stalled. Even the next succcessful ajax call does
not update the element.

I wonder how can I set up some global callback / local callback
function so that those element which should have been updated are
cleared up for next successful callback.

for example, lets say I have this code

function test(){
$(#loading).slideDown(slow);
$.get(url,function(result){
$(container).html(result);
$(#loading).slideUp(slow);
}

Now as the function test is called it shows the loading div slidedown
showing the message loading
and once the ajax request is successful, the same div slideup.

However, in case the ajax request timeout occurs, the div stays open
and even if the next call to this function results in successful ajax
request, this div stays open. Basically it likks the show. Everything
is sorted out once you refresh the page.

How can I sort this practical question/problem?





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Simple Question about ajax request timeout

2007-06-15 Thread Rob Desbois

The code I gave sets the global error handler using $.ajaxSetup() - best is
to use that and set the error handler when you set the timeout.

If you only wish to set it for a single request though then you need to pass
the 'error' parameter to $.ajax() instead.
--rob


On 6/15/07, joomlafreak [EMAIL PROTECTED] wrote:



Cool..

This is work, not tried yet but I am hopeful.

I have one concern though. I have the above described situations at
many places in my application
http://feed.joomlaprodigy.com/

and all are prone to the situation I described in my post above. Is
there a way I can do it globally.
By the above means it seems I have to provide the element's id to do
the slideUp and since it is a global function, how do I do the slideup
only for the one which had failed response. If I write all of them in
the function then even the one which had successful request will
slideUp.

Don't know if I could explain my question clearly.

BTW thank you very much for the tip. I will try to play with it and
post back if I get something working.

On Jun 15, 8:59 am, Rob Desbois [EMAIL PROTECTED] wrote:
 Does this catch a timeout condition? If so you could do the slideUp()
from
 there.

 $.ajaxSetup({

 error: function() {
// ...
 }
  });

 --rob

 On 6/15/07, joomlafreak [EMAIL PROTECTED] wrote:





  Many times the ajax request gets timeout and the show/hide or slideup/
  down function gets stalled. Even the next succcessful ajax call does
  not update the element.

  I wonder how can I set up some global callback / local callback
  function so that those element which should have been updated are
  cleared up for next successful callback.

  for example, lets say I have this code

  function test(){
  $(#loading).slideDown(slow);
  $.get(url,function(result){
  $(container).html(result);
  $(#loading).slideUp(slow);
  }

  Now as the function test is called it shows the loading div slidedown
  showing the message loading
  and once the ajax request is successful, the same div slideup.

  However, in case the ajax request timeout occurs, the div stays open
  and even if the next call to this function results in successful ajax
  request, this div stays open. Basically it likks the show. Everything
  is sorted out once you refresh the page.

  How can I sort this practical question/problem?

 --
 Rob Desbois
 Eml: [EMAIL PROTECTED]
 Tel: 01452 760631
 Mob: 07946 705987
 There's a whale there's a whale there's a whale fish he cried, and the
 whale was in full view.
 ...Then ooh welcome. Ahhh. Ooh mug welcome.





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: What's the best way to document my javascript?

2007-06-14 Thread Rob Desbois

Tom,

With all C type languages I almost obsessively use the Javadoc syntax (like
Doxygen if you've used that) for functions, classes, etc.
An example:

/** Set event note icon type

* @param id ID of event to set icon for.
* @param exists true for 'view note', false for 'add note'.
*/
function _set_icon_type(id, exists) {



To keep smaller parts of code maintainable, e.g. a few functionally linked
lines of code in a function, comments and judicious use of whitespace are
your friends. Whitespace in particular - put plenty of it in where it helps,
it'll all vanish when (if) you pack your scripts for distribution.

--rob


On 6/14/07, Mike Alsup [EMAIL PROTECTED] wrote:



I think jQuery itself is a good example of how to document.  Use
liberal comments throughout and then take advantage of the build
scripts to generate lite, minimized or packed versions as needed.

Mike


On 6/14/07, Tom Holder [EMAIL PROTECTED] wrote:

 Hi,

 Even with jQuery... a lot of my JavaScript is starting to becoming
 difficult to manage (certainly with the passing of time!) and I'd like
 a way to document it sensible so that it will all mean something in
 the future to me and anyone else that's tasked with working on it.

 What's the best way to do this?

 Thanks for your help,
 Tom







--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: What's the best way to document my javascript?

2007-06-14 Thread Rob Desbois

Try googling for javascript documentation generator - I turned up
http://jsdoc.sourceforge.net/ which looks pretty good, although requires
Perl.

--rob


On 6/14/07, Tom Holder [EMAIL PROTECTED] wrote:



Hi Guys,

Thanks for your replies. I was kinda meaning a tool that would
automatically parse my JS files and produce documentation (and link
function calls).

Cheers
Tom

On Jun 14, 1:30 pm, Rob Desbois [EMAIL PROTECTED] wrote:
 Tom,

 With all C type languages I almost obsessively use the Javadoc syntax
(like
 Doxygen if you've used that) for functions, classes, etc.
 An example:

 /** Set event note icon type

  * @param id ID of event to set icon for.
  * @param exists true for 'view note', false for 'add note'.
  */
  function _set_icon_type(id, exists) {

 To keep smaller parts of code maintainable, e.g. a few functionally
linked
 lines of code in a function, comments and judicious use of whitespace
are
 your friends. Whitespace in particular - put plenty of it in where it
helps,
 it'll all vanish when (if) you pack your scripts for distribution.

 --rob

 On 6/14/07, Mike Alsup [EMAIL PROTECTED] wrote:





  I think jQuery itself is a good example of how to document.  Use
  liberal comments throughout and then take advantage of the build
  scripts to generate lite, minimized or packed versions as needed.

  Mike

  On 6/14/07, Tom Holder [EMAIL PROTECTED] wrote:

   Hi,

   Even with jQuery... a lot of my JavaScript is starting to becoming
   difficult to manage (certainly with the passing of time!) and I'd
like
   a way to document it sensible so that it will all mean something in
   the future to me and anyone else that's tasked with working on it.

   What's the best way to do this?

   Thanks for your help,
   Tom

 --
 Rob Desbois
 Eml: [EMAIL PROTECTED]
 Tel: 01452 760631
 Mob: 07946 705987
 There's a whale there's a whale there's a whale fish he cried, and the
 whale was in full view.
 ...Then ooh welcome. Ahhh. Ooh mug welcome.





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Moving between lists while sorting.

2007-06-13 Thread Rob Desbois

Do you mean select boxes?
The jqMultiSelects plugin at
http://code.google.com/p/jqmultiselects/implements the ability to move
items between select boxes.
It's the first release and a bit crude but if unsuitable the code can be
lifted out of it or just modified...

--rob

On 6/13/07, shr1975 [EMAIL PROTECTED] wrote:



Hi,

Does anyone have any idea about this?


Thanks.

On Jun 11, 4:45 pm, shr1975 [EMAIL PROTECTED] wrote:
 Hi,

 I am using Interface 1.2. I have two sortable lists. I also want an
 additional feature of moving items between lists.

 I went through Interface's documentation. It is mentioned that
 elements can be moved from one container to the other, but no where in
 the demos is it shown.

 Does any one have an idea how can this be achieved?

 Thanks.





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: German Support Forum? intrested?

2007-06-13 Thread Rob Desbois

I agree with Alexandre on this, I think it would degrade the overall
community to split the mailing list.
I would be far more comfortable with non-native English speakers posting to
the list in a foreign language, perhaps including a rough English
translation so we can attempt to help.

All IMHO of course :-)
--rob

On 6/13/07, Alexandre Plennevaux [EMAIL PROTECTED] wrote:



I understand your concern (i'm a french speaking person) but i think you
would diminish the overall responsiveness of the jquery community if we
start to divide the community in our local languages. I don't feel like
following the activities of several groups for one technology. It seems to
me that quite a few persons in the community do not master english but
still
manage to get help.
And then, no one is obliged to write in english is it? Those that do not
wish or can't write english could post in german and so having only german
developers being able to respond. That does not bother me personally.
That's just my 2 cent of course do as you like :)

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of cfreak
Sent: mercredi 13 juin 2007 8:42
To: jQuery (English)
Subject: [jQuery] German Support Forum? intrested?


I would like to make a german Support forum for jQuery, because for many
german people it is much easier to talk in german about thier problems, or
understanding the answers.


So my Question is, who is intrested in a german support forum and who
want's
to help with the moderation of this forum?

greets cfreak

Ce message Envoi est certifié sans virus connu.
Analyse effectuée par AVG.
Version: 7.5.472 / Base de données virus: 269.8.15/847 - Date: 12/06/2007
21:42





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: INSPIRE: eyeos.org

2007-06-13 Thread Rob Desbois

Wow, thanks for sharing that Alex - what an incredible piece of kit.
Without a doubt the fastest, best remote desk application I've seen.
It even recurses onto itself with eyeNav well!

--rob


On 6/13/07, Dan G. Switzer, II [EMAIL PROTECTED] wrote:



Having said that, I think the basic goal of implementing a traditional
operating system UI in a browser is inherently flawed. While there may
be
value in a lot of the technology, I doubt the WinXP explorer shell look
in a browser will ever take off.

I agree. I've seen people trying to create web OSes for 10 years. I've
never
understood why people thank that analogy will work--at least with current
technology.

Sure, people want low cost alternatives to pricey Microsoft products, but
users can't do what they expect from real desktop software on the Web (at
least not with having to go with addons/plugins.)

For example, the biggest issue I've seen with 99% of implement WYWSIYG
web-based editors (FCK, TinyMCE, etc, etc) is that inserting images does
not
work like it does in a traditional application. You can't just paste the
image or drag-n-drop it to the canvas.

I've used XStandard (a browser plug-in) in the past to resolve this issue
(as it will upload binary objects via a web service automatically.) This
works well, but still much slower than working in a local environment.

Microsoft's been trying to push software rentals for a while and that's
probably a more affective avenue than trying to build a web OS.

I mean eyeOS looks nice (and seems to be quite a great achievement,) but I
don't see people seeing this as a viable solution to computing.

-Dan





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Moving between lists while sorting.

2007-06-13 Thread Rob Desbois

Ah ok I'm afraid I can't help with that, I've never had need to do that sort
of thing.
Might this help: http://interface.eyecon.ro/demos/drag.html

--rob


On 6/13/07, shr1975 [EMAIL PROTECTED] wrote:



Thanks Rob,

I am using unordered lists that are sorted using the Interface plugin
(ver. 1.2).

The sorting works fine, but I also additionally want the user to be
able to drag and drop between two such sortable uls.

How can I achieve that?

On Jun 13, 4:16 pm, Rob Desbois [EMAIL PROTECTED] wrote:
 Do you mean select boxes?
 The jqMultiSelects plugin
athttp://code.google.com/p/jqmultiselects/implementsthe ability to move
 items between select boxes.
 It's the first release and a bit crude but if unsuitable the code can be
 lifted out of it or just modified...

 --rob

 On 6/13/07, shr1975 [EMAIL PROTECTED] wrote:





  Hi,

  Does anyone have any idea about this?

  Thanks.

  On Jun 11, 4:45 pm, shr1975 [EMAIL PROTECTED] wrote:
   Hi,

   I am using Interface 1.2. I have two sortable lists. I also want an
   additional feature of moving items between lists.

   I went through Interface's documentation. It is mentioned that
   elements can be moved from one container to the other, but no where
in
   the demos is it shown.

   Does any one have an idea how can this be achieved?

   Thanks.

 --
 Rob Desbois
 Eml: [EMAIL PROTECTED]
 Tel: 01452 760631
 Mob: 07946 705987
 There's a whale there's a whale there's a whale fish he cried, and the
 whale was in full view.
 ...Then ooh welcome. Ahhh. Ooh mug welcome.





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Problem accessing jQuery Documentation website

2007-06-12 Thread Rob Desbois

I saw it too, although problem vanished after 5 minutes ish.

On 6/12/07, Michael Andreas [EMAIL PROTECTED] wrote:



Oh my..


http://groups.google.com/group/jquery-en/browse_thread/thread/2fb8eb9152b705ef

It's happening again today (2007-06-12 09:45Z). I got the message
jQuery JavaScript Library has a problem over at Documentation
(http://docs.jquery.com/). The main site (http://jquery.com/) isn't
affected currently. Anyone have any idea what's wrong and for how
long?

Best of luck to those who's trying to fix it.

-Michael-





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Slightly OT: javascript and AJAX response 'concurrency'

2007-06-12 Thread Rob Desbois

I have a function which generates an AJAX request to retrieve information.
The display of this information requires modification of the interface - the
structure of the function is roughly:

function getInfo() {

   do AJAX request, success callback is onAjaxResponse
   setup interface to display data
}

function onAjaxResponse() {
   add data to the interface
   show interface
}



Is it guaranteed that onAjaxResponse() will not execute until getInfo() has
returned?
The interface *must* be setup before it is shown, so if this guarantee is
not there I must set up the interface in the response callback.

A test in Firefox shows that this works but I'm not sure of what to search
for to find out if it is guaranteed.

Thanks
--rob

--
Rob Desbois
Eml: [EMAIL PROTECTED]


[jQuery] Re: Slightly OT: javascript and AJAX response 'concurrency'

2007-06-12 Thread Rob Desbois

Great, thanks.
How do you know this - is it part of the ECMAScript specification or is
there some other reference you can point me too?

--rob

On 6/12/07, Mike Alsup [EMAIL PROTECTED] wrote:



It's guaranteed as long as you don't force a synchronous call using
the async option.

Mike


On 6/12/07, Rob Desbois [EMAIL PROTECTED] wrote:
 I have a function which generates an AJAX request to retrieve
information.
 The display of this information requires modification of the interface -
the
 structure of the function is roughly:


  function getInfo() {
 do AJAX request, success callback is onAjaxResponse
 setup interface to display data
  }
 
  function onAjaxResponse() {
 add data to the interface
 show interface
  }
 

 Is it guaranteed that onAjaxResponse() will not execute until getInfo()
has
 returned?
 The interface *must* be setup before it is shown, so if this guarantee
is
 not there I must set up the interface in the response callback.

 A test in Firefox shows that this works but I'm not sure of what to
search
 for to find out if it is guaranteed.

 Thanks
 --rob

 --
 Rob Desbois
 Eml: [EMAIL PROTECTED]





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: update input text when tick radio

2007-06-11 Thread Rob Desbois

Certainly is:

input type='text' id='myInput' /

input type='radio' name='myRadio' value='first' /First
input type='radio' name='myRadio' value='second' /Second

$(document).ready(function() {
   $(input:radio).click(function() {
  $(#myInput).val($(this).val());
   });
});



--rob

On 6/10/07, sublimenal [EMAIL PROTECTED] wrote:



Hello,

is it possible to update a input type=text when you tick a input
type=radio name=1 value=10.00 ?

Basicly I will have a bunch of radios and when you tick it, it shoud
update the input with the value of that radio that the user ticked.
Thanks in advance.





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: waiting for a request to complete

2007-06-11 Thread Rob Desbois

Where you're checking the request status you're creating a new request each
time.
You need to store the XHR object from the request and use that (untested):

var xhr = $.post(/myhandler.php, params);

while (xhr.status != 200);



Alternatively you could use a globally accessibly variable which states
whether there is a pending request or not.
When a request is sent, set it true, when the response is received set it
false.

HTH
--rob


On 6/11/07, Phil Glatz [EMAIL PROTECTED] wrote:



I'm calling $.post to send some text back to a web server, where it
gets logged. The function is something like this:

function send_message(msg) {
  var params = {};
  params['my_message'] = msg;
  $.post(/myhandler.php, params);
}

It calls a php page that appends it to a log. If I view the log in
real time with tail -f log.txt, I can see the messages.

The problem is that if I set up a page to send 5 messages, they aren't
being displayed sequentially; I might see them in the order 2,1,4,3,5
-- and the order is random each time I call the page. What I would
like to do is wait until the post function completes before continuing
with the next message.

Since the post returns an XMLHttpRequest object, I thought I could try
some thing like:

  while ($.post(/myhandler.php, params).status != 200)

But I think that simply keeps calling the function, making things
worse.

How can I query the post request for success, and not exit my function
until it is done?





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] The .ready() event

2007-06-08 Thread Rob Desbois

Is $(document) the only thing that .ready(..) should be applied to?

When a page has a form on it with an item which should logically have the
focus by default, I like to bung in some JS to focus on that element ASAP.

It's not necessary for the entire DOM to be ready to do that, only the
textbox.
The following code works but I just want someone to tell me whether I'm
being dumb or not ;-)


$(#noJavascriptWarning).ready(function() {


  $(#noJavascriptWarning).hide();



});




Additionally, if that is a sensible thing to do can I get the jQuery/DOM
object in the function or do I have to select it again?
The 'this' in the function is a Document object, hence me thinking .ready()
perhaps shouldn't be applied to anything but $(document).

TIA, happy nearly weekend all :-)
--rob


--
Rob Desbois
Eml: [EMAIL PROTECTED]
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: The .ready() event

2007-06-08 Thread Rob Desbois


I might be missing something here but why not just use the noscript tag?



Damn it, didn't even think of that!
What an idiot!



I'm far from knowing all the facts but I thought .ready() was just a
jquery event for 'onload', for whatever element just loaded. Like
.bind('onload', function(){ ... } );, Is that right?


I'd be interested to know if anyone can enlighten me.

--rob

--
Rob Desbois
Eml: [EMAIL PROTECTED]
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: The .ready() event

2007-06-08 Thread Rob Desbois

Aha ok, thanks Mike.

--rob

On 6/8/07, Mike Alsup [EMAIL PROTECTED] wrote:



You can call ready on anything you want, but the fn will only run when
the document is ready.  So what you have is no different than
$(document).ready().

Mike


On 6/8/07, Rob Desbois [EMAIL PROTECTED] wrote:
 Is $(document) the only thing that .ready(..) should be applied to?

 When a page has a form on it with an item which should logically have
the
 focus by default, I like to bung in some JS to focus on that element
ASAP.

 It's not necessary for the entire DOM to be ready to do that, only the
 textbox.
 The following code works but I just want someone to tell me whether I'm
 being dumb or not ;-)
  $(#noJavascriptWarning).ready(function() {
 $(#noJavascriptWarning).hide();
 
 
  });
 

 Additionally, if that is a sensible thing to do can I get the jQuery/DOM
 object in the function or do I have to select it again?
 The 'this' in the function is a Document object, hence me thinking
.ready()
 perhaps shouldn't be applied to anything but $(document).

 TIA, happy nearly weekend all :-)
 --rob


 --
 Rob Desbois
 Eml: [EMAIL PROTECTED]
 There's a whale there's a whale there's a whale fish he cried, and the
 whale was in full view.
 ...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Jquery similar to twinhelix's supernote js

2007-06-08 Thread Rob Desbois

There are a couple of plugins like this, the ones that immediately spring
out of my bookmarks are:
* http://www.codylindley.com/blogstuff/js/jtip/
* http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/

Not used either of them though.
--rob


On 6/8/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:



Anyone familiar with:
http://www.twinhelix.com/dhtml/supernote/demo/
IS there a similar jquery functionality or plugin, I looked at what I
could find yesterday.
Something that just provides a clickable popup, almost like a tooltip
for any hyperlink.
Thanks for any suggestions.
There's nothing wrong with the twinhelix item's it's just if it's
jquery-ized it would probably save bandwidth and be compatible with my
other scripts for sure, like innerfade that will be used on this site.





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: datePicker v2 beta

2007-06-06 Thread Rob Desbois

A tricky one...or perhaps not.
My feeling is that the datePicker is there to replace not enhance the input
field.

I'm not overly pleased with the blur() method as it breaks tabbing between
fields.
I didn't know that autocomplete could be suppressed (thank you!), but I
think that would be the most elegant solution.

--rob

On 6/6/07, Kelvin Luck [EMAIL PROTECTED] wrote:



Rob Desbois wrote:
 I've had an issue in Firefox2.0 using the plugin with the 'clickInput'
 option turned on.

 When the input field has the focus, clicking on it to display the
 datePicker will work, but over the top of that will be Firefox's
 drop-down box showing previous inputs to that field.

 The solution I've used is to do this:

 $(#dateFrom)
.datePicker(dpOptions)
.click(function() {
   this.blur();
});


 Don't know if anyone else has a better suggestion?
 Not sure if it would be appropriate to make this default behaviour for
 the plugin but it's there as a suggestion anyway :-)

 --rob

Hi,

I think that it might make sense to make the plugin disable autocomplete
  (set autocomplete=off on the input element) where clickInput = true...

Do you think this would make sense? Then again, what about if a user
tabs into the field and you want them to be able to autocomplete? If
this is a consideration then maybe your suggestion is most elegant (and
I can add the blur into the plugin). Does anyone have any suggestions on
this?

Cheers,

Kelvin :)





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: datePicker v2 beta

2007-06-06 Thread Rob Desbois

I disagree; in the interest of keeping the plugin small, to do this outside
the class is equally minimal effort and I don't think the plugin should
accept every possible representation. If you always use Date where String is
required, you can overload and wrap the function to perform the conversion.

Kelvin:
That said I think that given it's a *date*Picker, Date would be a far more
appropriate choice for the interface than String. What made you choose
String?

--rob

On 6/6/07, Brian Miller [EMAIL PROTECTED] wrote:



Just my opinion: both Date and String should be supported.  It's probably
only two lines of code to check for type, and cast to the other type if
necessary.

- Brian


 There's a bug or documentation error with dpSetSelected() [revision
 #1993] : it's documented as taking a string, but the code for it
 requires a Date (due to using .getMonth(), .getFullYear() and
 .getTime()).

 To fix this problem I added the line  d = new Date(d);  to the start
 of dpSetSelected().

 It's a documentation error. I'll update the documentation to explain
 that it expects a Date object (the change you made might have other
 unforseen consequences).


 Hi,

 Just an update on this... I've decided that the documentation was
 correct and so I've changed the function to behave as it described.
 dpSetSelected now expects a String as documented. I also fixed the other
 documentation errors you noticed,

 Sorry for any confusion and thanks for the report,

 Kelvin :)






--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Get the checked status from radio button?

2007-06-05 Thread Rob Desbois

The difference between your first and second statements is that
document.getElementById() returns a DOM object, but $() returns a jQuery
object.

This will work (although untested):


console.debug( $(#type_1)[0].checked );


or this:


 console.debug( $(#type_1).attr(checked) );



--rob


On 6/5/07, howard chen [EMAIL PROTECTED] wrote:



Using the traditional method, it worka

console.debug ( document.getElementById(type_1).checked );


But this one failed...

console.debug( $(#type_1).checked );



any method to get using jquery?

thanks.





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Find set of questions

2007-06-05 Thread Rob Desbois

Ah ok I follow you now.

Ok I'm not certain this will work; I haven't tested it but give it a go and
see what you get.

From the jQuery selectors documentation:



Hide all Paragraph elements that contain a link:

 $(p[a]).hide();

So my guess at how to do what you want would be:



$(ol.ol1[li.correctchosen]);



If my understanding is correct, that will give you all ols with class
'ol1' which contain an li of class 'correctchosen'.
Give it a shot and let us know the result!

--rob


On 6/5/07, SamCKayak [EMAIL PROTECTED] wrote:



I am learning, I am learning...

I missed the subtle difference in the documentation:

$('a, b') and $('a', 'b')

   !!!

The way to filter my list is using a function..  like so:

('ol.ol1  li').filter( function() { return $('li.correctchosen ',
this).length != 0 } )

// Filters the first set down to those that contain a correct chosen
list element somewhere deep inside the dom subtree of 'this' element.

Any short technique appreciated.

Overview of the HTML:

ol class=ol1li ... html here... ulli class=correctchosen/
li/ul/li





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


[jQuery] Re: Multiple Selects

2007-06-04 Thread Rob Desbois

Hi,

Thanks for your contribution - callbacks was something I knew needed adding,
and I agree with your modification to passing in selectors rather than just
IDs.

At some point I'll release a new version with this and some other planned
enhancements.

--rob


On 6/4/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:



I edited the Multiple Selects plugin, and thought the author could use
it for any future releases.  All I did was made it so you're not
restricted to IDs for the selectors, and added a callback so you can
interact with the moved items.

All credit goes to Rob Desbois

/**
* Multiple Selects - jQuery plugin for converting a multiple select
into two, adding the ability to move items between the boxes.
* http://code.google.com/p/jqmultiselects/
*
* Copyright (c) 2007 Rob Desbois
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Version: 0.1
*/

/**
* Adds multiple select behaviour to a select element.
* This allows options to be transferred to a different select using
mouse double-clicks, or multiple options at a time via another
element.
*
* @example $('#my_select_left').multiSelect('#my_select_right');
* @desc Sets up double-clicks on #my_select_left's options to move the
option to #my_select_right
* @example $('#my_select_left').multiSelect('#my_select_right',
'#my_move_right_button');
* @desc Sets up double-clicks as above and also sets up
#my_move_right_button to transfer multiple elements on click.
* @example $('#my_select_left').multiSelect('#my_select_right',
'#my_move_right_button',function(){
* //callback here
* });
* @desc Allows for a callback to be executed once a transfer has been
made.

*
* @example
* table
*tr
*   tdselect id=select_left multiple=multiple size=6
*  optionItem 1/option
*  optionItem 2/option
*  optionItem 3/option
*  optionItem 4/option
*   /select/td
*
*   td
*  pa id=options_right href=#
* img src=arrow_right.gif alt=gt; /
*  /a/p
*
* pa id=options_left href=#
* img src=arrow_left.gif alt=lt; /
*  /a/p
*   /td
*
*   tdselect id=select_right multiple=multiple size=6
*  optionItem 5/option
*  optionItem 6/option
*  optionItem 7/option
*  optionItem 8/option
*   /select/td
*/tr
* /table
*
* script type=text/javascript!--
* $(function() {
*$(#select_left).multiSelect($(#select_right),$
(#options_right),function(){  alert(I have an ajax call here, which
sends the right select elements to the server);});
*$(#select_right).multiSelect($(#select_left),$
(#options_left));
* });
* // --/script
*/
jQuery.fn.multiSelect = function(to,button,thecallback) {
return this.each(function() {
var self = this;
jQuery(this).dblclick(function(){
moveOptions(self,to);
});
if (typeof button!=undefined)
jQuery(button).click(function(){
moveOptions(self,to);
});
});

function moveOptions(from,to) {
var dest = jQuery(to)[0];
jQuery(option:selected,from).each(function() {
jQuery(this)
.attr(selected,false)
.appendTo(dest);
if (thecallback)
thecallback();
});
}

function callback() {
}
};





--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
There's a whale there's a whale there's a whale fish he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.


  1   2   >