Re: [jQuery] Popup window reference problem

2006-10-19 Thread Jacky
So, I should:
1. includes jQuery library in popup.
2. call ref.$()
where ref is the window reference created in window.open?

On 10/19/06, Blair McKenzie [EMAIL PROTECTED] wrote:
 The only way I know of to use jQuery in another window/frame is to include
 jquery in that page's html, and then access it using window.$().

 Blair


 On 10/19/06, Jacky [EMAIL PROTECTED] wrote:
 
  I have tried to directly use the window reference.
  i.e.
  var abc = ref.document.getElementById(abc1);
  abc.parentNode.removeChild(abc);
 
  The result is correct that the input box in popup windows being removed.
  Seems that jQuery cannot use popup window reference?
 
  On 10/17/06, Jacky [EMAIL PROTECTED] wrote:
   Dear all,
  
   I would like to make a simple popup which would copy current page
   content and do some conversion ( e.g. text box to text). But I have met
   a problem of getting a wrong reference. Here is the code to
   demonstrate the problem:
  
   html
   head
   titleTest Popup/title
   script type=text/javascript src=jquery.js/script
   script type=text/javascript
   $(document).ready(function(){
  
 $(#popup).click(specificPop);
  
   function specificPop(){
   var ref =
 genericPopup();
  
 $(ref.document).find(#popup_body #abc1).remove();
   }
  
   function
 genericPopup(){
   var ref =
 window.open('','','resizable=1,width=400,height=400');
   var diva =
 $(#diva).clone();
  
 ref.document.open();
  
 ref.document.write('htmlheadtitlePopup/title/head');
  
 ref.document.write ('body id=popup_body');
  
 ref.document.write($(diva).html());
  
 ref.document.write('/body/html');
  
 ref.document.close();
   return ref;
   }
   });
   /script
   /head
   body
   div id=diva
   input type=text id=abc1 value=111/
   input type=text id=abc2 value=222/
   /div
   a href=# id=popuppopup/a
   /body
   /html
  
   In this example, I would expect the text box #abc1 in the popup is
   removed. But it removes current window's one instead. For the removal
   code, I have tried the following approaches:
  
   $(ref.document).find(#abc1).remove();
   $(ref.document).find(#popup_body #abc1).remove();
   $(#popup_body #abc1,ref.document).remove();
   $(ref.document ).find(#popup_body #abc1,ref.document).remove();
  
   but all failed. Any idea how can I can the correct reference??
  
   P.S. using jQ ver 1.0.2
   --
   Best Regards,
   Jacky
   http://jacky.seezone.net
  
 
 
 
  --
  Best Regards,
  Jacky
  網絡暴民 http://jacky.seezone.net
 
  ___
  jQuery mailing list
  discuss@jquery.com
  http://jquery.com/discuss/
 


 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/





-- 
Best Regards,
Jacky
網絡暴民 http://jacky.seezone.net

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to safely get the clickTarget of an event?

2006-10-19 Thread Klaus Hartl


Kurt Mackey schrieb:
 Is there a “jQuery” way of getting an event’s click target?  I tend to 
 use those elements quite a bit, but getting them is a pain. J

Hi Kurt,

jQuery provides no functionality to retrieve the target. Here's my way 
to do that:


$( ... ).click(function(e) {
 var ev = e || event;
 var target = ev.target || ev.srcElement;
 $(target).css('border', '1px solid red');
});

Maybe that should be abstracted by jQuery...


-- Klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery history plugin - from making the back button work to a more elaborate Hijax solution

2006-10-19 Thread Paul Bakaus
Hi Klaus,your idea is definitely worth trying out, sounds great to me!By the way, I've found some (maybe?) bug in your current history implementation. If you initalize the page for the first time, then click a link, and then click the back button again, it will show you chapter 3 instead of no chapters. Have you noticed the same?
2006/10/19, Klaus Hartl [EMAIL PROTECTED]:
Hi jQuerians,people demanded, so I started to extract the history functionality fromthe tabs plugin to make a standalone plugin out of it.Worked out so far:
http://stilbuero.de/jquery/history/http://stilbuero.de/jquery/tabs/It's still alpha, support for Firefox, Safari and Opera is there, IE notyet but will be added. Also todo is to automatically show the
appropriate part, if the hash in the url refers to some point in thehistory but I can borrow that from the tabs plugin as well.At the moment it works by hooking into links and adding an eventhandler, like (prototypical code, setHash is required by Safari):
$('a').click(function(e) { $.history.setHash('#' + this.href.split('#')[1], e);});That's ok for me, I think its important to be able to control whichlinks should be observed anyway. So the snippet above might become
$('a.hijax').history();withjQuery.fn.history = function() { return this.each(function() { $(this).click(function(e) { jQuery.history.setHash('#' + this.href.split
('#')[1]); }); });};Or maybe it is reasonable to use a custom event? I'd like that:$('a.hijax').bind('history', function() {...}).click(function() { $(this).trigger('history');
});Does that work?But:You all know, I'm all for unobtrusive JS and the concept of progressiveenhancement. I don't like having a link in my HTML like ahref="" which actually points nowhere with JS disabled.
Why not implement a better solution for being able to implement Hijaxthe easy way (like what the form module is already offering)?So the links stay as they are and point to an existing ressource:a href=""
chapter-1.phpThen I intercept all these links, change the href value to hashes andload on click the content from the URL of the initial href value viaXHR. Links that already have a hash in their URL won't load via XHR but
add to history (that is needed to stay compatible with tabs).That would 1. result in history support (in most browsers) and 2. in anice gracefully degrading application with JS disabled or for browsers
not supported by jQuery. Totally unobtrusive.That concept would of course involve the back-end as well. There it mustbe decided upon the X-Requested-With request header what to send back(whole page or only the part of the page that needs to be updated.
What do you guys think? Feedback and ideas welcome...-- Klaus___jQuery mailing list
discuss@jquery.comhttp://jquery.com/discuss/-- Paul BakausWeb DeveloperHildastr. 35
79102 Freiburg
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Please help (again, sorry)..NextUntil not working

2006-10-19 Thread Klaus Hartl
Greg Bird schrieb:
 You must live and breath this stuff.

Hey Greg, indeed!

Klaus


PS: John is the creator of the wonderful jQuery library... ;)





___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to make input readonly with jQuery in IE

2006-10-19 Thread Klaus Hartl

 But I really wanted readonly. This didn't work:
 $(span.readonly input).attr(readonly, true);
  
 But these did. Note the camelCase:
 $(span.readonly input).attr(readOnly, true);
 
  
 $(span.readonly input).each(function() {
 this.readOnly = true;
 });

I think that is one for the attributes fix list?


-- Klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery history plugin - from making the back button work to a more elaborate Hijax solution

2006-10-19 Thread Klaus Hartl

Paul Bakaus schrieb:
 Hi Klaus,
 
 your idea is definitely worth trying out, sounds great to me!
 By the way, I've found some (maybe?) bug in your current history 
 implementation. If you initalize the page for the first time, then click 
 a link, and then click the back button again, it will show you chapter 3 
 instead of no chapters. Have you noticed the same?

Hi Paul,

yes, this is also related to my statement:

Also todo is to automatically show the
appropriate part, if the hash in the url refers to some point in the
history but I can borrow that from the tabs plugin as well.

That wasn't expressed to clearly. But its actually the same bug, the 
initial page state has to be remembered, as well as the approbiate link 
has to be loaded if there's an hash in the url.


Thanks for the feedback.


-- Klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] jQuery Kinda Plugin: every

2006-10-19 Thread Blair Mitchelmore
I don't know if this exists already but I needed this and assumed it 
didn't and wrote it myself. Essentially it lets you do something to an 
element every given time interval.

jQuery.fn.every = function(interval,fn) {
return this.each(function() {
var self = this;
window.setInterval(function() { fn.call(self) },interval);
});
};

I used it to get a millisecond amount display every so often to produce 
a live updated element. It's mostly for live clock updating (and I 
suppose it could be useful to implement polling) but I'm sure the 
creative among you could find some other purpose for it.

Example:
// Display the current time updated every 500 ms
$(p.display).every(500,function() {
$(this).html(new Date());
});

-blair

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to make input readonly with jQuery in IE

2006-10-19 Thread Jörn Zaefferer
Klaus Hartl schrieb:
 But I really wanted readonly. This didn't work:
 $(span.readonly input).attr(readonly, true);
  
 But these did. Note the camelCase:
 $(span.readonly input).attr(readOnly, true);

  
 $(span.readonly input).each(function() {
 this.readOnly = true;
 });
 

 I think that is one for the attributes fix list?
   
ie: readonly: readOnly?

-- Jörn

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Popup window reference problem

2006-10-19 Thread Blair McKenzie
That's what I've done. It may be possible to do it another way, but I haven't had the time to experiment.BlairOn 10/19/06, Jacky 
[EMAIL PROTECTED] wrote:So, I should:1. includes jQuery library in popup.
2. call ref.$()where ref is the window reference created in window.open?On 10/19/06, Blair McKenzie [EMAIL PROTECTED] wrote: The only way I know of to use jQuery in another window/frame is to include
 jquery in that page's html, and then access it using window.$(). Blair On 10/19/06, Jacky [EMAIL PROTECTED] wrote: 
  I have tried to directly use the window reference.  i.e.  var abc = ref.document.getElementById(abc1);  abc.parentNode.removeChild(abc);   The result is correct that the input box in popup windows being removed.
  Seems that jQuery cannot use popup window reference?   On 10/17/06, Jacky [EMAIL PROTECTED] wrote:   Dear all,  
   I would like to make a simple popup which would copy current page   content and do some conversion ( e.g. text box to text). But I have met   a problem of getting a wrong reference. Here is the code to
   demonstrate the problem: html   head   titleTest Popup/title   script type=text/_javascript_ src=""
jquery.js/script   script type=text/_javascript_   $(document).ready(function(){   $(#popup).click(specificPop);
 function specificPop(){   var ref = genericPopup();   $(ref.document
).find(#popup_body #abc1).remove();   } function genericPopup(){   var ref =
 window.open('','','resizable=1,width=400,height=400');   var diva = $(#diva).clone();   ref.document.open();
   ref.document.write('htmlheadtitlePopup/title/head');   ref.document.write ('body id=popup_body');  
 ref.document.write($(diva).html());   ref.document.write('/body/html');   ref.document.close();   return ref;
   }   });   /script   /head   body
   div id=diva   input type=text id=abc1 value=111/   input type=text id=abc2 value=222/
   /div   a href="" id=popuppopup/a   /body   /html
 In this example, I would expect the text box #abc1 in the popup is   removed. But it removes current window's one instead. For the removal   code, I have tried the following approaches:
 $(ref.document).find(#abc1).remove();   $(ref.document).find(#popup_body #abc1).remove();   $(#popup_body #abc1,ref.document
).remove();   $(ref.document ).find(#popup_body #abc1,ref.document).remove(); but all failed. Any idea how can I can the correct reference??  
   P.S. using jQ ver 1.0.2   --   Best Regards,   Jacky   http://jacky.seezone.net  
 --  Best Regards,  Jacky  網絡暴民 http://jacky.seezone.net   ___
  jQuery mailing list  discuss@jquery.com  http://jquery.com/discuss/  ___
 jQuery mailing list discuss@jquery.com http://jquery.com/discuss/--Best Regards,
Jacky網絡暴民 http://jacky.seezone.net___jQuery mailing listdiscuss@jquery.com
http://jquery.com/discuss/
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to make input readonly with jQuery in IE

2006-10-19 Thread Klaus Hartl


Jörn Zaefferer schrieb:
 Klaus Hartl schrieb:
 But I really wanted readonly. This didn't work:
 $(span.readonly input).attr(readonly, true);
  
 But these did. Note the camelCase:
 $(span.readonly input).attr(readOnly, true);

  
 $(span.readonly input).each(function() {
 this.readOnly = true;
 });
 
 I think that is one for the attributes fix list?
   
 ie: readonly: readOnly?

yes!


-- Klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to safely get the clickTarget of an event?

2006-10-19 Thread Jörn Zaefferer
Klaus Hartl schrieb:
 Kurt Mackey schrieb:
   
 Is there a “jQuery” way of getting an event’s click target?  I tend to 
 use those elements quite a bit, but getting them is a pain. J
 

 Hi Kurt,

 jQuery provides no functionality to retrieve the target. Here's my way 
 to do that:


 $( ... ).click(function(e) {
  var ev = e || event;
  var target = ev.target || ev.srcElement;
  $(target).css('border', '1px solid red');
 });

 Maybe that should be abstracted by jQuery...
   
The first line is not necessary, afaik that is already normalized by 
jQuery. I'm not sure about the second one...

-- Jörn

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery Kinda Plugin: every

2006-10-19 Thread Blair Mitchelmore
And I just realized I should make it possible to stop the repeating 
function later on.

Code:
jQuery.fn.every = function(interval,fn) {
return this.each(function() {
var self = this;
this.$every = window.setInterval(function() { fn.call(self) 
},interval);
});
};

Example:
// Display the current time updated every 500 ms
$(p.display).every(500,function() {
$(this).html(new Date());
});

//... some point later in the code execution
$(p.display).each(function() {
window.clearInterval(this.$every);
this.$every = null;
});

-blair

Blair Mitchelmore wrote:
 I don't know if this exists already but I needed this and assumed it 
 didn't and wrote it myself. Essentially it lets you do something to an 
 element every given time interval.


 -blair



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to safely get the clickTarget of an event?

2006-10-19 Thread Klaus Hartl


Jörn Zaefferer schrieb:
 Klaus Hartl schrieb:
 Kurt Mackey schrieb:
   
 Is there a “jQuery” way of getting an event’s click target?  I tend to 
 use those elements quite a bit, but getting them is a pain. J
 
 Hi Kurt,

 jQuery provides no functionality to retrieve the target. Here's my way 
 to do that:


 $( ... ).click(function(e) {
  var ev = e || event;
  var target = ev.target || ev.srcElement;
  $(target).css('border', '1px solid red');
 });

 Maybe that should be abstracted by jQuery...
   
 The first line is not necessary, afaik that is already normalized by 
 jQuery. I'm not sure about the second one...

Yes you are right:

handle: function(event) {
 ...
 event = event || jQuery.event.fix( window.event );
 ...
}

The target can easily be added to jQuery.event.fix:

fix: function(event) {
 if ( event ) {
 event.preventDefault = function() {
 this.returnValue = false;
 };

 event.stopPropagation = function() {
 this.cancelBubble = true;
 };

 event.target = event.srcElement;
 }

 return event;
}

Shall I add that?


-- Klaus


-- Klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery history plugin - from making the back button work to a more elaborate Hijax solution

2006-10-19 Thread Klaus Hartl

 Then I intercept all these links, change the href value to hashes and 
 load on click the content from the URL of the initial href value via 
 XHR. Links that already have a hash in their URL won't load via XHR but 
 add to history (that is needed to stay compatible with tabs).

That means you could still abuse the history plugin for links with 
meaningless hashes and have the history still working...


-- Klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Selectors [EMAIL PROTECTED]|=val] and [EMAIL PROTECTED] Have they been removed?

2006-10-19 Thread Choan C. Gálvez
On 10/18/06, John Resig [EMAIL PROTECTED] wrote:
 Well, I don't doubt that people use the lang attribute as intended
 (considering that I've never made a non-english site) - however,
 there's certainly never been a need for the ~=  selector - which is
 only remotely useful with lang-related attributes.

But the class name isn't the only attribute which accepts
space-separated values. There's the `%linkTypes;` [1] value type, used
in `rel` and `rev` attributes.

I can see a use for the `~=` selector in matching XFN [2] marked up links.

It could be useful too when using custom XML.

[1]: http://www.w3.org/TR/html4/sgml/dtd.html#LinkTypes
[2]: http://gmpg.org/xfn/
-- 
Choan
http://choangalvez.nom.es/

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Tablesorter

2006-10-19 Thread Christian Bach
Hi!

1. I could provied a kind of trigger for you, how about something like this.

Ex.

$(myTableWithTableSorter).trigger(resort);

2. Well it depends how your table is structured and how big it is. Please 
post a example.

/christian


Yehuda Katz wrote:
 I have a need to have the tablesorter do the following:
 
 1) Refresh when I need it to (I'm going to be doing DOM insertions, and 
 will
 need to refresh the table after an insertion). The best thing I could think
 of thus far is $(.sortUp, .sortDown).click().click(). Obviously not the
 best idea.
 2) Use custom sorters. I see that the table sorter SUPPORTS custom sorters
 and parsers, but I wasn't sure about the best way to do this.
 
 Christian? Anyone?
 
 
 
 
 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Tablesorter

2006-10-19 Thread Adrian Sweeney
-- errors
There are problems with your table sorter. 
Create a sortable table with  colspans and it will through lots of errors if
you fix those then it will work fine.

-- feature request
What I would really like is sorting tables grouped by tbody 

Ie each tbody would stay in the same place but the rows would sort inside
each tbody  except for tr's with class='tablesort-ignore'
If the r used the class='tablesort-up-down' then you could move the tbodys
up and down the table with (drag/drop) or (arrows pointing up and down).

Which would hold your tbody header information  

Example:
thead
tr
th ...
th ...
th ...
/tr
/thead
tbody
tr class=ignore
td colspan ='3' my first category/td
/tr
tr
td ...
td ...
td ...
/tr
/tbody
tbody
tr class=ignore
td colspan ='3' my second category/td
/tr
tr
td ...
td ...
td ...
/tr
/tbody
tbody
tr class=ignore
td colspan ='3' my ... category/td
/tr
tr
td ...
td ...
td ...
/tr
/tbody
Adrian Sweeney
Web Developer
Mills  Reeve
Tel: +44(0)121 456 8236
mailto:[EMAIL PROTECTED]
http://www.mills-reeve.com


-Original Message-
From: Christian Bach [mailto:[EMAIL PROTECTED] 
Sent: 19 October 2006 09:46
To: jQuery Discussion.
Subject: Re: [jQuery] Tablesorter


Hi!

1. I could provied a kind of trigger for you, how about something like this.

Ex.

$(myTableWithTableSorter).trigger(resort);

2. Well it depends how your table is structured and how big it is. Please 
post a example.

/christian


Yehuda Katz wrote:
 I have a need to have the tablesorter do the following:
 
 1) Refresh when I need it to (I'm going to be doing DOM insertions, 
 and
 will
 need to refresh the table after an insertion). The best thing I could
think
 of thus far is $(.sortUp, .sortDown).click().click(). Obviously not the
 best idea.
 2) Use custom sorters. I see that the table sorter SUPPORTS custom sorters
 and parsers, but I wasn't sure about the best way to do this.
 
 Christian? Anyone?
 
 
 --
 --
 
 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


bBirmingham Law Society 'Law Firm of the Year' 2006/b


bMills  Reeve - one of The Sunday Times 100 Best Companies To Work For in 
2004, 2005 and 2006/b

This email is confidential and may be privileged.  If you are not the intended 
recipient please accept our apologies; please do not disclose, copy, or 
distribute information in this email nor take any action in reliance on its 
contents: to do so is strictly prohibited and may be unlawful. Please inform us 
that this message has gone astray before deleting it. Thank you for your 
co-operation.

Mills  Reeve Solicitors, offices at:

Birmingham: 78-84 Colmore Row, Birmingham, B3 2AB.
Cambridge:  Francis House, 112 Hills Road, Cambridge CB2 1PH. 
Norwich: 1 St James Court, Whitefriars, Norwich NR3 1RU.
London:  Fountain House, 130 Fenchurch Street, London, EC3M 5DJ.

Mills  Reeve is regulated by the Law Society.

A list of Partners may be inspected at any of the above addresses.

Visit our web site at: http://www.mills-reeve.com

This message has been checked for viruses by the Mills  Reeve screening system.

Service cannot be effected on us by e mail.



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to safely get the clickTarget of an event?

2006-10-19 Thread Blair McKenzie
The target of a click is already available through 'this'.BlairOn 10/19/06, Klaus Hartl [EMAIL PROTECTED]
 wrote:Jörn Zaefferer schrieb: Klaus Hartl schrieb: Kurt Mackey schrieb:
 Is there a "jQuery" way of getting an event's click target?I tend to use those elements quite a bit, but getting them is a pain. J Hi Kurt,
 jQuery provides no functionality to retrieve the target. Here's my way to do that: $( ... ).click(function(e) {var ev = e || event;var target = 
ev.target || ev.srcElement;$(target).css('border', '1px solid red'); }); Maybe that should be abstracted by jQuery... The first line is not necessary, afaik that is already normalized by
 jQuery. I'm not sure about the second one...Yes you are right:handle: function(event) { ... event = event || jQuery.event.fix( window.event ); ...}The target can easily be added to 
jQuery.event.fix:fix: function(event) { if ( event ) { event.preventDefault = function() { this.returnValue = false; }; event.stopPropagation = function() {
 this.cancelBubble = true; }; event.target = event.srcElement; } return event;}Shall I add that?-- Klaus-- Klaus___
jQuery mailing listdiscuss@jquery.comhttp://jquery.com/discuss/
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Bug in Firefox with e.target?

2006-10-19 Thread Klaus Hartl
Hi all,

I wanted to add the normalization for e.target as discussed earlier. But 
I came across a strange bug in Firefox. Have a look at the following page:

http://stilbuero.de/demo/jquery/etarget.html

If you click on the link the target of the click event (attached to p) 
is alerted. In that case it is an strong element, but Firefox reports 
an HTMLSpanElement. Safari is ok.

Does anyone know what is going on?

-- Klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to safely get the clickTarget of an event?

2006-10-19 Thread Klaus Hartl
Blair McKenzie schrieb:
 The target of a click is already available through 'this'.
 
 Blair

No, not always. Consider the following structure:

pa href=emClick/em/a/p

If you attach a click event to the p element, this refers to that 
element, but the e.target is the em element.

May not be a common case but the distinction still exists and is useful 
sometimes.


-- Klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Checking select option has class?

2006-10-19 Thread Luc Pestille
Hi all,
:disabled doesn't want to work as I expect - when I submit with a
disabled option selected, the whole select drop down becomes disabled
(or rather the class is added to ALL the options). I've added my real
code in below, rather than working with hypotheticals - any more ideas?


// if option is disabled, don't submit it
if( $('#idol_date_day1').is(:checked)  $('#idol_datetime_day1
option:disabled') ){
// add class to change colour
$('#idol_datetime_day1
option:disabled').addClass(required).get(0).focus();
return false;
}else{
$('#idol_datetime_day1
option:disabled').removeClass(required);
}

Thanks,

Luc


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Dave Methvin
Sent: 18 October 2006 17:54
To: 'jQuery Discussion.'
Subject: Re: [jQuery] Checking select option has class?

 
 $('#myselect option').is(:disabled).addClass('disabled');

.is() isn't chainable, but you can just add :disabled to the selector:

$('#myselect option:disabled').addClass('disabled');


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/ 

In2
Thames House
Mere Park
Dedmere Road
Marlow
Bucks
SL7 1PB

Tel 01628 899700
Fax 01628 899701
e: [EMAIL PROTECTED]
i: www.in2.co.uk

This message (and any associated files) is intended only for the use of 
discuss@jquery.com and may contain information that is confidential, subject to 
copyright or constitutes a trade secret. If you are not discuss@jquery.com you 
are hereby notified that any dissemination, copying or distribution of this 
message, or files associated with this message, is strictly prohibited. If you 
have received this message in error, please notify us immediately by replying 
to the message and deleting it from your computer. Messages sent to and from us 
may be monitored. Any views or opinions presented are solely those of the 
author [EMAIL PROTECTED] and do not necessarily represent those of the company.

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Checking select option has class?

2006-10-19 Thread David Duymelinck
Luc Pestille schreef:
   // add class to change colour
   $('#idol_datetime_day1
 option:disabled').addClass(required).get(0).focus();
   
change to 

$('#idol_datetime_day1
option:disabled').addClass(required).eq(0).focus();

This seems to be a common mistake. Maybe on one of the learning sites or on the 
documentation page of jquery.com there should be a list of common mistakes 
found in the mailing list to guide newcomers and even 'veterans' :). 

-- 
David Duymelinck

[EMAIL PROTECTED]


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Selectors [EMAIL PROTECTED]|=val] and [EMAIL PROTECTED] Have they been removed?

2006-10-19 Thread David Duymelinck
Choan C. Gálvez schreef:
 On 10/18/06, John Resig [EMAIL PROTECTED] wrote:
   
 Well, I don't doubt that people use the lang attribute as intended
 (considering that I've never made a non-english site) - however,
 there's certainly never been a need for the ~=  selector - which is
 only remotely useful with lang-related attributes.
 

 But the class name isn't the only attribute which accepts
 space-separated values. There's the `%linkTypes;` [1] value type, used
 in `rel` and `rev` attributes.

 I can see a use for the `~=` selector in matching XFN [2] marked up links.

 It could be useful too when using custom XML.

 [1]: http://www.w3.org/TR/html4/sgml/dtd.html#LinkTypes
 [2]: http://gmpg.org/xfn/
   
John is right about the lang attribute. There is no point of having 
multiple languages in the the same lang attribute. I dove in middle 
disscusion without reading the whole thread, that was my mistake.

-- 
David Duymelinck

[EMAIL PROTECTED]


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Bug in Firefox with e.target?

2006-10-19 Thread Mike Alsup
Hi Klaus,

Intertesting.  If I change your alert to

alert(e.target.tagName);

then I see STRONG.

Mike

On 10/19/06, Klaus Hartl [EMAIL PROTECTED] wrote:
 Hi all,

 I wanted to add the normalization for e.target as discussed earlier. But
 I came across a strange bug in Firefox. Have a look at the following page:

 http://stilbuero.de/demo/jquery/etarget.html

 If you click on the link the target of the click event (attached to p)
 is alerted. In that case it is an strong element, but Firefox reports
 an HTMLSpanElement. Safari is ok.

 Does anyone know what is going on?

 -- Klaus

 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Bug in Firefox with e.target?

2006-10-19 Thread Dave Methvin

 I wanted to add the normalization for e.target as discussed earlier. 
 But I came across a strange bug in Firefox. Have a look at the following
page:

 http://stilbuero.de/demo/jquery/etarget.html

 If you click on the link the target of the click event (attached to 
 p) is alerted. In that case it is an strong element, but Firefox 
 reports an HTMLSpanElement. Safari is ok.

 Intertesting.  If I change your alert to
 alert(e.target.tagName);
 then I see STRONG.

I am guessing that FF must treat a strong tag like a styled span, which
makes sense. Also notice that if you click to the right of the link, the
alert shows HTMLParagraphElement.



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery history plugin - from making the back button work to a more elaborate Hijax solution

2006-10-19 Thread Mike Alsup
Klaus,

 $('a.hijax').history();

 jQuery.fn.history = function() {
  return this.each(function() {
  $(this).click(function(e) {
  jQuery.history.setHash('#' + this.href.split('#')[1]);
  });
  });
 };

This is looking very nice.  I like this usage pattern.


 Why not implement a better solution for being able to implement Hijax
 the easy way
 ... snip ...
 That concept would of course involve the back-end as well. There it must
 be decided upon the X-Requested-With request header what to send back
 (whole page or only the part of the page that needs to be updated.

I think this is the way to go.  The original markup must have the
correct urls so that the page degrades.  I would consider that a
requirement.

I think it is also a requirement to make sure it is easy to change the
href that gets loaded (which you've done).  That way I could achieve
the desired results without X-Requested-With logic on the server.
Using templates or SSI I could structure my docs so that a call to
mydoc.html returns the full page and a call to mydoc-p1.html
returns paragraph one only.  Using the plugin on your demo page I
could then rewire the anchor click events like:

...
$('#chapter').load('mydoc-p' + i '.html');
...

Mike

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Bug in Firefox with e.target?

2006-10-19 Thread Jan Sorgalla

Hi

http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-58190037
Seems that FF treats elements from here as HTMLSpanElement.

Jan


dave.methvin wrote:
 
 
 I wanted to add the normalization for e.target as discussed earlier. 
 But I came across a strange bug in Firefox. Have a look at the following
 page:

 http://stilbuero.de/demo/jquery/etarget.html

 If you click on the link the target of the click event (attached to 
 p) is alerted. In that case it is an strong element, but Firefox 
 reports an HTMLSpanElement. Safari is ok.
 
 Intertesting.  If I change your alert to
 alert(e.target.tagName);
 then I see STRONG.
 
 I am guessing that FF must treat a strong tag like a styled span, which
 makes sense. Also notice that if you click to the right of the link, the
 alert shows HTMLParagraphElement.
 
 
 
 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/
 
 

-- 
View this message in context: 
http://www.nabble.com/Bug-in-Firefox-with-e.target--tf2472498.html#a6896275
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Animated Menu

2006-10-19 Thread Steve Urmston
Hi folksI've been trying to build a menu where an image follows to match the hovered linkExample: http://clearbar.co.uk/navtest.htmlProblem is the animate effects queue up, thus moving mouse fast can stack up pretty high.
Anyone know how I could get around this, or think of a better way to achieve this effect?Cheers,Steven
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Animated Menu

2006-10-19 Thread Armand Datema
mm

why not attach the imag to the mousemovement ?

Armand

On 10/19/06, Steve Urmston [EMAIL PROTECTED] wrote:
 Hi folks

 I've been trying to build a menu where an image follows to match the hovered
 link

 Example: http://clearbar.co.uk/navtest.html

 Problem is the animate effects queue up, thus moving mouse fast can stack up
 pretty high.

 Anyone know how I could get around this, or think of a better way to achieve
 this effect?

 Cheers,
 Steven

 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/





-- 
Armand Datema
CTO SchwingSoft

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Bug in Firefox with e.target?

2006-10-19 Thread Klaus Hartl
Dave Methvin schrieb:
 I wanted to add the normalization for e.target as discussed earlier. 
 But I came across a strange bug in Firefox. Have a look at the following
 page:
 http://stilbuero.de/demo/jquery/etarget.html

 If you click on the link the target of the click event (attached to 
 p) is alerted. In that case it is an strong element, but Firefox 
 reports an HTMLSpanElement. Safari is ok.
 
 Intertesting.  If I change your alert to
 alert(e.target.tagName);
 then I see STRONG.

Thats good to know. I'm thinking about if it is a good idea to normalize 
e.target for EOMB* and IE at all?

I could imagine that a few scripts (for example Interface) already rely 
on that not being normalized...

If not, I think that should be done.


 I am guessing that FF must treat a strong tag like a styled span, which
 makes sense. Also notice that if you click to the right of the link, the
 alert shows HTMLParagraphElement.

I'll have a look at that. Uh, I'm tired of reading Specs :)

* Every Other Modern Browser


-- Klaus

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Animated Menu

2006-10-19 Thread Adrian Sweeney
Title: Message



with 
out looking into your code and just looking at the effect I 
suggest.

Start 
by clearing the animation path on every mouse over, then build a new animation 
to move from the current to the new position should 

so if 
you had 5 steps in your anim and 4 links 1-4

then 
if you were over 1 the icon would be at position 1 then as you moved down the 
path would be 1-2 then 1-3 and 1-4 of course if you have 5 
increments in your movement between 1  two there would be 5 between 1 and 4 
too also if you are on increment part 3 (60% of the way there then the increment 
steps should start from that x,y position to the x,y position of the 
mouse.


Adrian Sweeney Web Developer Mills  Reeve 
Tel: +44(0)121 456 8236 [EMAIL PROTECTED] 
http://www.mills-reeve.com 

  
  -Original Message-From: Steve Urmston 
  [mailto:[EMAIL PROTECTED] Sent: 19 October 2006 
  14:31To: discuss@jquery.comSubject: [jQuery] Animated 
  MenuHi folksI've been trying to build a menu 
  where an image follows to match the hovered linkExample: http://clearbar.co.uk/navtest.htmlProblem 
  is the animate effects queue up, thus moving mouse fast can stack up pretty 
  high. Anyone know how I could get around this, or think of a better 
  way to achieve this 
effect?Cheers,Steven

Birmingham Law Society 'Law Firm of the Year' 2006


Mills & Reeve - one of The Sunday Times 100 Best Companies To Work For in 2004, 2005 and 2006

This email is confidential and may be privileged.  If you are not the intended recipient please accept our apologies; please do not disclose, copy, or distribute information in this email nor take any action in reliance on its contents: to do so is strictly prohibited and may be unlawful. Please inform us that this message has gone astray before deleting it. Thank you for your co-operation.

Mills & Reeve Solicitors, offices at:

Birmingham: 78-84 Colmore Row, Birmingham, B3 2AB.
Cambridge:  Francis House, 112 Hills Road, Cambridge CB2 1PH. 
Norwich: 1 St James Court, Whitefriars, Norwich NR3 1RU.
London:  Fountain House, 130 Fenchurch Street, London, EC3M 5DJ.

Mills & Reeve is regulated by the Law Society.

A list of Partners may be inspected at any of the above addresses.

Visit our web site at: http://www.mills-reeve.com

This message has been checked for viruses by the Mills & Reeve screening system.

Service cannot be effected on us by e mail.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] [ANN] JReflection

2006-10-19 Thread Tom Sieroń
There's also a tradeoff - downloading larger graphic files vs.
processing time. In case of clients poor connection it's better to do
it programmatically than make them wait for the graphics to download
methinks.

 --
Tom Sieron.

On 10/16/06, Rey Bango [EMAIL PROTECTED] wrote:
 Rick Faircloth wrote:
  The best question for me would be:
 
  How much does it cost to do it programmatically?
 
  How long for the download time of any needed
  script...how long for the processing to occur...
 
  if it's minimal, then I would much rather do it on-the-fly
  than take time to process each photo or graphic manually in Photoshop...
 
  Rick
 
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
  Behalf Of Andy Matthews
  Sent: Monday, October 16, 2006 9:12 AM
  To: jQuery Discussion.
  Subject: Re: [jQuery] [ANN] JReflection
 
  I wonder...
 
  Is this REALLY something that needs a plugin? It's obviously done already,
  but just do it in Photoshop or the Gimp or something. You're already loading
  the image, why waste browser processing time/speed with something that could
  be static.
 
  My opinion is that if it doesn't increase functionality or do something for
  you that would take forever manually, why bother with a plugin?
 

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Bug in Firefox with e.target?

2006-10-19 Thread Michael Geary
 From: Klaus Hartl
 
 I wanted to add the normalization for e.target as discussed 
 earlier. But I came across a strange bug in Firefox. Have a 
 look at the following page:
 
 http://stilbuero.de/demo/jquery/etarget.html
 
 If you click on the link the target of the click event 
 (attached to p) is alerted. In that case it is an strong 
 element, but Firefox reports an HTMLSpanElement. Safari is ok.
 
 Does anyone know what is going on?

Firefox has the correct strong element there, it's just the way it reports
it when you do an alert. Forget the event handling for the moment and try
these in the FireBug console:

$('strong')[0]

$('strong')[0].tagName 

alert( $('strong')[0] )

alert( $('strong')[0].tagName )

-Mike


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Tablesorter

2006-10-19 Thread Yehuda Katz
On 10/19/06, Christian Bach [EMAIL PROTECTED] wrote:
Hi!1. I could provied a kind of trigger for you, how about something like this.Ex.$(myTableWithTableSorter).trigger(resort);Are you saying you *could* provide this or that you already have?
2. Well it depends how your table is structured and how big it is. Pleasepost a example.
It's pretty complicated (and proprietary). I have no problem with Regex; I was just curious how the custom sorters worked. Do you need a custom parser for each sorter?
/christianYehuda Katz wrote: I have a need to have the tablesorter do the following: 1) Refresh when I need it to (I'm going to be doing DOM insertions, and will need to refresh the table after an insertion). The best thing I could think
 of thus far is $(.sortUp, .sortDown).click().click(). Obviously not the best idea. 2) Use custom sorters. I see that the table sorter SUPPORTS custom sorters and parsers, but I wasn't sure about the best way to do this.
 Christian? Anyone?  ___ jQuery mailing list
 discuss@jquery.com http://jquery.com/discuss/___jQuery mailing list
discuss@jquery.comhttp://jquery.com/discuss/-- Yehuda KatzWeb Developer | Wycats Designs
(ph)718.877.1325
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Animated Menu

2006-10-19 Thread Dan Atkinson

Something like:

http://jquery.com/docs/Plugins/limitQueue/

This allows you to limit the queue length.

Steve Urmston wrote:
 
 Hi folks
 
 I've been trying to build a menu where an image follows to match the
 hovered
 link
 
 Example: http://clearbar.co.uk/navtest.html
 
 Problem is the animate effects queue up, thus moving mouse fast can stack
 up
 pretty high.
 
 Anyone know how I could get around this, or think of a better way to
 achieve
 this effect?
 
 Cheers,
 Steven
 
 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/
 
 

-- 
View this message in context: 
http://www.nabble.com/Animated-Menu-tf2473451.html#a6899861
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Animated Menu

2006-10-19 Thread Steve Urmston
Hi againCan anyone tell me now to clear (stop) all animation on an object?cheers,steveOn 10/19/06, Adrian Sweeney 
[EMAIL PROTECTED] wrote:







with 
out looking into your code and just looking at the effect I 
suggest.

Start 
by clearing the animation path on every mouse over, then build a new animation 
to move from the current to the new position should 

so if 
you had 5 steps in your anim and 4 links 1-4

then 
if you were over 1 the icon would be at position 1 then as you moved down the 
path would be 1-2 then 1-3 and 1-4 of course if you have 5 
increments in your movement between 1  two there would be 5 between 1 and 4 
too also if you are on increment part 3 (60% of the way there then the increment 
steps should start from that x,y position to the x,y position of the 
mouse.


Adrian Sweeney Web Developer Mills  Reeve 
Tel: +44(0)121 456 8236 [EMAIL PROTECTED]
 
http://www.mills-reeve.com 

  
  -Original Message-From: Steve Urmston 
  [mailto:[EMAIL PROTECTED]] Sent: 19 October 2006 
  14:31To: discuss@jquery.comSubject: [jQuery] Animated 
  MenuHi folksI've been trying to build a menu 
  where an image follows to match the hovered linkExample: http://clearbar.co.uk/navtest.html

Problem 
  is the animate effects queue up, thus moving mouse fast can stack up pretty 
  high. Anyone know how I could get around this, or think of a better 
  way to achieve this 
effect?Cheers,Steven

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Animated Menu

2006-10-19 Thread Steve Urmston
Hi, just spotted the limit queue length post, works a charm. Thanks Danhttp://jquery.com/docs/Plugins/limitQueue/

On 10/19/06, Adrian Sweeney 
[EMAIL PROTECTED] wrote:







with 
out looking into your code and just looking at the effect I 
suggest.

Start 
by clearing the animation path on every mouse over, then build a new animation 
to move from the current to the new position should 

so if 
you had 5 steps in your anim and 4 links 1-4

then 
if you were over 1 the icon would be at position 1 then as you moved down the 
path would be 1-2 then 1-3 and 1-4 of course if you have 5 
increments in your movement between 1  two there would be 5 between 1 and 4 
too also if you are on increment part 3 (60% of the way there then the increment 
steps should start from that x,y position to the x,y position of the 
mouse.


Adrian Sweeney Web Developer Mills  Reeve 
Tel: +44(0)121 456 8236 [EMAIL PROTECTED]
 
http://www.mills-reeve.com 

  
  -Original Message-From: Steve Urmston 
  [mailto:[EMAIL PROTECTED]] Sent: 19 October 2006 
  14:31To: discuss@jquery.comSubject: [jQuery] Animated 
  MenuHi folksI've been trying to build a menu 
  where an image follows to match the hovered linkExample: http://clearbar.co.uk/navtest.html


Problem 
  is the animate effects queue up, thus moving mouse fast can stack up pretty 
  high. Anyone know how I could get around this, or think of a better 
  way to achieve this 
effect?Cheers,Steven



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] nice plugin idea - Splitter

2006-10-19 Thread Mark Gibson
Armand Datema wrote:
 I just found this link
 
 http://www.jackslocum.com/yui/2006/08/19/a-splitbar-component-for-yahoo-ui/
 
 Does a jquery version excist yet?

I don't about that, but have you tried the
'Click here and I will point it out' link!!!

Wow! That's it, documentation is going in the bin, it's
live demonstrations from now on.

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] nice plugin idea - Splitter

2006-10-19 Thread Dave Methvin
 I just found this link

http://www.jackslocum.com/yui/2006/08/19/a-splitbar-component-for-yahoo-ui/
 Does a jquery version excist yet?

I don't think so. Jack Slocum's site is a great source for plugin ideas. The
YUI guys are lucky to have him building off their framework. I say we put a
burlap sack over him, give him a whack on the head, and abduct him over to
jQuery. :-)


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] nice plugin idea - Splitter

2006-10-19 Thread Mike Alsup
 Jack Slocum's site is a great source for plugin ideas. The
 YUI guys are lucky to have him building off their framework. I say we put a
 burlap sack over him, give him a whack on the head, and abduct him over to
 jQuery. :-)


I'm with you on the sack-n-whack, Dave.  Jack's got a great site, both
technically and visually.

Armand, I'd love to see a jQuery splitter widget too.

Mike

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] nice plugin idea - Splitter

2006-10-19 Thread Christopher Jordan




That is sweet! I agree with the burlap sack idea. :-)

Dave Methvin wrote:

  
I just found this link


  
  http://www.jackslocum.com/yui/2006/08/19/a-splitbar-component-for-yahoo-ui/
  
  
Does a jquery version excist yet?

  
  
I don't think so. Jack Slocum's site is a great source for plugin ideas. The
YUI guys are lucky to have him building off their framework. I say we put a
burlap sack over him, give him a whack on the head, and abduct him over to
jQuery. :-)


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


  



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] nice plugin idea - Splitter

2006-10-19 Thread Sean O

Wow.  Wow.  Simply... awesome!
The per-section comments, collapsing, resizable, sliding nav bars, even
**inline screencast demos**!

Folks, if you haven't seen it yet, check it out:
http://www.jackslocum.com/yui/2006/08/19/a-splitbar-component-for-yahoo-ui/

I've loved everything I've seen in the YUI toolkit so far.  Seems very
professional, effects work as advertised, cross-browser, smooth as silk...

Too bad it seems a bit too advanced for me at this stage -- lots of hardcore
javascript.  I'm still trying to wrap my head around many things jQuery... 
:)

___
SEAN O



Mark Gibson-8 wrote:
 
 Armand Datema wrote:
 I just found this link
 
 http://www.jackslocum.com/yui/2006/08/19/a-splitbar-component-for-yahoo-ui/
 
 Does a jquery version excist yet?
 
 I don't about that, but have you tried the
 'Click here and I will point it out' link!!!
 
 Wow! That's it, documentation is going in the bin, it's
 live demonstrations from now on.
 
 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/
 
 

-- 
View this message in context: 
http://www.nabble.com/nice-plugin-idea---Splitter-tf2472266.html#a6901316
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] nice plugin idea - Splitter

2006-10-19 Thread Marshall Salinger









The new Yahoo Mail Beta has that
functionality. I wonder if there will be an official release in the YUI
library. I would love to see that done with jQuery. 



Ive got my billy
club ready to go.





-Original
Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf
Of Christopher Jordan
Sent: Thursday, October 19, 2006
10:01 AM
To: jQuery Discussion.
Subject: Re: [jQuery] nice plugin
idea - Splitter



That is sweet! I agree
with the burlap sack idea. :-)

Dave Methvin wrote: 

I just found this link 

http://www.jackslocum.com/yui/2006/08/19/a-splitbar-component-for-yahoo-ui/ 

Does a jquery version excist yet? 

I don't think so. Jack Slocum's site is a great source for plugin ideas. TheYUI guys are lucky to have him building off their framework. I say we put aburlap sack over him, give him a whack on the head, and abduct him over tojQuery. :-)___jQuery mailing listdiscuss@jquery.comhttp://jquery.com/discuss/ 




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery Kinda Plugin: every

2006-10-19 Thread Brian Miller
While it's not very jQuery-like, timers lend themselves to registration. 
I would attach an object to window or a more permanently/easily available
object.  This way, you don't have to leave closures around just to keep
references to the timers, just so you can stop them later.

Also, if you're attaching the timer references to DOM objects, then I
think that you are opening the door to possible serious memory leakage. 
Clever, but perhaps dangerous.

- Brian


 And I just realized I should make it possible to stop the repeating
 function later on.

 Code:
 jQuery.fn.every = function(interval,fn) {
 return this.each(function() {
 var self = this;
 this.$every = window.setInterval(function() { fn.call(self)
 },interval);
 });
 };

 Example:
 // Display the current time updated every 500 ms
 $(p.display).every(500,function() {
 $(this).html(new Date());
 });

 //... some point later in the code execution
 $(p.display).each(function() {
 window.clearInterval(this.$every);
 this.$every = null;
 });

 -blair

 Blair Mitchelmore wrote:
 I don't know if this exists already but I needed this and assumed it
 didn't and wrote it myself. Essentially it lets you do something to an
 element every given time interval.


 -blair



 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/




___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery Kinda Plugin: every

2006-10-19 Thread Jörn Zaefferer
Blair Mitchelmore schrieb:
 And I just realized I should make it possible to stop the repeating 
 function later on.

 Code:
 jQuery.fn.every = function(interval,fn) {
 return this.each(function() {
 var self = this;
 this.$every = window.setInterval(function() { fn.call(self) 
 },interval);
 });
 };

 Example:
 // Display the current time updated every 500 ms
 $(p.display).every(500,function() {
 $(this).html(new Date());
 });

 //... some point later in the code execution
 $(p.display).each(function() {
 window.clearInterval(this.$every);
 this.$every = null;
 });
   
You could package that in a second plugin method. Just need to find a 
nice name...

In addition, it may be helpful to be able to pass arguments to the 
function. There may be cases where you can't rely on a closure to pass 
arguments.

-- Jörn

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery Kinda Plugin: every

2006-10-19 Thread John Resig
What if you had a trifecta of functions:
.every()
.in()
.stop()

and allow for function calls like this:

.every( 100, text, function(){
if ( !$(this).val() )
$(this).stop(text);
});

or if you don't care about a name:

.in( slow, function(){
$(this).hide();
})
.mouseover(function(){
$(this).stop();
});

or if you wanna get really interesting, make it so that you can stop
function calls by how long their timer is set for:

.every( 500, function(){
$(#foo).load(test.html);
})
.every( 100, function(){
if ( !$(this).val() )
$(this).stop(100);
});

Just throwing out some ideas, let me know which ones stick.

--John

On 10/19/06, Blair Mitchelmore [EMAIL PROTECTED] wrote:
 And I just realized I should make it possible to stop the repeating
 function later on.

 Code:
 jQuery.fn.every = function(interval,fn) {
 return this.each(function() {
 var self = this;
 this.$every = window.setInterval(function() { fn.call(self)
 },interval);
 });
 };

 Example:
 // Display the current time updated every 500 ms
 $(p.display).every(500,function() {
 $(this).html(new Date());
 });

 //... some point later in the code execution
 $(p.display).each(function() {
 window.clearInterval(this.$every);
 this.$every = null;
 });

 -blair

 Blair Mitchelmore wrote:
  I don't know if this exists already but I needed this and assumed it
  didn't and wrote it myself. Essentially it lets you do something to an
  element every given time interval.
 
 
  -blair
 


 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/



-- 
John Resig
http://ejohn.org/
[EMAIL PROTECTED]

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Question about jQuery.merge

2006-10-19 Thread Choan C. Gálvez
Hi all.

I've been browsing the API and discovered the docs for `jQuery.merge`. Great!

One question about it: the docs say:

Merge two arrays together, removing all duplicates. The final order
or the new array is: All the results from the first array, followed by
the unique results from the second array.

But, if I merge the arrays

var a = [ 2, 3, 4, 5 ];
var b = [ 1, 1, 2, 3, 5 ];

I get:

[ 2,3,4,5,1,1 ]

So a) the removing all duplicates is not an exact definition of what
this method does or b) there is a bug in `merge` :(

Anyway, I'd label it as unexpected behavior.
-- 
Choan
http://choangalvez.nom.es/

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Question about jQuery.merge

2006-10-19 Thread Dave Methvin
 ... if I merge the arrays

 var a = [ 2, 3, 4, 5 ];
 var b = [ 1, 1, 2, 3, 5 ];
 
 I get:
 
 [ 2,3,4,5,1,1 ]
 
 So a) the removing all duplicates is not an exact definition 
 of what this method does or b) there is a bug in `merge` :(

The documentation does not match the comments in the code. The code says
this:

   // Now check for duplicates between a and b and only

Which is correct; duplicates *within* an array are not removed. In the
situations where it's being used, jQuery knows that the two arrays don't
have internal duplicates.



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Question about jQuery.merge

2006-10-19 Thread Andy Matthews
Looks like it only removed one set of duplicates.

!//--
andy matthews
web developer
certified advanced coldfusion programmer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--//-

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Choan C. Galvez
Sent: Thursday, October 19, 2006 12:31 PM
To: jQuery Discussion.
Subject: [jQuery] Question about jQuery.merge


Hi all.

I've been browsing the API and discovered the docs for `jQuery.merge`.
Great!

One question about it: the docs say:

Merge two arrays together, removing all duplicates. The final order
or the new array is: All the results from the first array, followed by
the unique results from the second array.

But, if I merge the arrays

var a = [ 2, 3, 4, 5 ];
var b = [ 1, 1, 2, 3, 5 ];

I get:

[ 2,3,4,5,1,1 ]

So a) the removing all duplicates is not an exact definition of what
this method does or b) there is a bug in `merge` :(

Anyway, I'd label it as unexpected behavior.
--
Choan
http://choangalvez.nom.es/

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] IE XML parsing problem

2006-10-19 Thread Angelo Sozzi

Hi Klaus and thanks for the help.

Unfortunately the fix did not work. I had lifted the XML traversing code
from this forum:
http://www.nabble.com/RSS-Feed-Reader-tf1831386.html#a5189745

I but for him it seemed to work in IE, so I put his code on my server and
tried myself. What seems to happen is that jQuery R89 works without a hitch
but jQuery R248 throws the IE error:

JQuery R89 demo:   http://www.sozzi.cn/jquery/feed_reader.html
JQuery R248 demo: http://www.sozzi.cn/jquery/feed_reader1.html

Unfortunately R89 breaks my other code (has a fit with [snip]...}, settings
|| {}); [snip] at http://www.sozzi.cn/jquery/fish.fn.trial3.html
and I'm not adept enough at Javascritping to look into the jQuery core code.

Hope this helps to get thinks fixed soon!

Thanks again

Angelo



You don't do anything wrong.

This is a known bug:
http://jquery.com/dev/bugs/bug/164/

Work is in progress on that I think... If it is not yet fixed in latest 
SVN, I can provide a hotfix - I ran into that as well :-)

settings.parsedXML += div class='link'  + (this.firstChild.data || 
$(this).text()) +  ;


-- Klaus
-- 
View this message in context: 
http://www.nabble.com/IE-XML-parsing-problem-tf2469241.html#a6902245
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Problems using jQuery SlideShow Plugin

2006-10-19 Thread Reynier Perez Mira
HI to every:
I'm newbie with jQuery. Right now I'm involved in a project in wich I need 
build a slideshow. I do a research and found YUI SlideShow, Dojo Widget and 
jQuery (from Interface Elements) maybe exists anothers but I like a lot jQuery 
because I found it easy to learn.

I download the needed files and put in my server. Then I made a simple page to 
test it and get some mistakes and I hope that any here can help me with that.

The Javascript code is this:

$(document).ready(
function()
{
$.slideshow(
{
container : 'banner',
loader: 'themes/simpro/images/sl/indicator.gif',
linksPosition: 'top',
nextslideClass: 'nextSlide',
prevslideClass: 'prevSlide',
captionPosition: 'bottom',
fadeDuration : 700,
autoplay: 5,
images : [
{ src: 'themes/simpro/images/sl/slide1.jpg' },
{ src: 'themes/simpro/images/sl/slide2.jpg' },
{ src: 'themes/simpro/images/sl/slide3.jpg' },
{ src: 'themes/simpro/images/sl/slide4.jpg' },
{ src: 'themes/simpro/images/sl/slide5.jpg' },
{ src: 'themes/simpro/images/sl/slide6.jpg' }
]
}
)
}
);

The errors are:
1) In links I get this string  
123456NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN

Why that?
2) If I don't want any link, how I do this?
Regards and thanks in advance
--
ReynierPM | 5to Ing. Informática
Aprendiz de mucho, maestro de poco.



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Animated Menu

2006-10-19 Thread Abdur-Rahman Advany
Steve, I just pushed the beta code to the main code. Ill try to add more 
docs...

Check out the scope method if you need to limit queue for each menu (and 
make it uniq acros multiple doms instead of only one)...

Steve Urmston wrote:
 Hi, just spotted the limit queue length post, works a charm. Thanks Dan

 http://jquery.com/docs/Plugins/limitQueue/ 
 http://jquery.com/docs/Plugins/limitQueue/





 On 10/19/06, *Adrian Sweeney*  [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:

 with out looking into your code and just looking at the effect
 I suggest.
  
 Start by clearing the animation path on every mouse over, then
 build a new animation to move from the current to the new
 position should
  
 so if you had 5 steps in your anim and 4 links 1-4
  
 then if you were over 1 the icon would be at position 1 then
 as you moved down the path would be 1-2 then 1-3 and 1-4 of
 course if you have 5 increments in your movement between 1 
 two there would be 5 between 1 and 4 too also if you are on
 increment part 3 (60% of the way there then the increment
 steps should start from that x,y position to the x,y position
 of the mouse.
  
  

 *Adrian Sweeney*
 Web Developer
 Mills  Reeve
 Tel: +44(0)121 456 8236
 [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]
 http://www.mills-reeve.com http://www.mills-reeve.com/

 -Original Message-
 *From:* Steve Urmston [mailto:[EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]]
 *Sent:* 19 October 2006 14:31
 *To:* discuss@jquery.com mailto:discuss@jquery.com
 *Subject:* [jQuery] Animated Menu

 Hi folks

 I've been trying to build a menu where an image follows to
 match the hovered link

 Example: http://clearbar.co.uk/navtest.html

 Problem is the animate effects queue up, thus moving mouse
 fast can stack up pretty high.

 Anyone know how I could get around this, or think of a
 better way to achieve this effect?

 Cheers,
 Steven






 

 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/
   


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Page fix request

2006-10-19 Thread Marshall Salinger








While looking through some of the tutorials and examples, I
noticed that this page is broken:



http://jquery.com/demo/ajax/



Even though it is fairly easy to see what is happening in
the source, it would be nice to see the page functioning properly.



Thanks,
Marshall






___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Problems with JQuery

2006-10-19 Thread Adam van den Hoven
Hey guys,

I'm just starting with jquery and I've hit what seems to be
inconsistant behaviour. I have the following markup:

form action=
span class=control date
input id=someID type=text value=HI /
input type=hidden value=Huh? class=meta /
/span
br /
/form


The values are only there becuase I had problems and I wanted to test stuff.

I then wrote the following javascript:

$(document).ready(function(){
 $(form .control.date).each( function(i){
var me = $(this)
alert( me.find( '[EMAIL PROTECTED]text]').val() );
alert( me.find( '[EMAIL PROTECTED]hidden]').val() );
alert( me.find( 'input.meta').val() );

 } );
});

Now this made sense to me at the time, but I've learned of better ways
to do this.

Now using the FULL jquery library, I get HI followed by NULL twice.
When I was using only the base and event modules (I think.. no ajax or
animation) I got back an jQuery object.

I've since learned that this is the better way to do it:
alert($('[EMAIL PROTECTED]hidden]', this).val())

It seems to me a flaw in jQuery that such a thing could happen. First
getting different results for the same (more or less) operation is a
bad thing but also having different things come back seems like a bad
idea.

Adam

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How to make input readonly with jQuery in IE

2006-10-19 Thread Brandon Aaron
On 10/19/06, Klaus Hartl [EMAIL PROTECTED] wrote:


 Jörn Zaefferer schrieb:
  Klaus Hartl schrieb:
  But I really wanted readonly. This didn't work:
  $(span.readonly input).attr(readonly, true);
 
  But these did. Note the camelCase:
  $(span.readonly input).attr(readOnly, true);
 
 
  $(span.readonly input).each(function() {
  this.readOnly = true;
  });
 
  I think that is one for the attributes fix list?
 
  ie: readonly: readOnly?

 yes!

This is now in SVN Rev: 452 and doing $().attr(readonly, true); will
work as expected.

--
Brandon Aaron

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery Kinda Plugin: every

2006-10-19 Thread Yehuda Katz
Those 3 functions would be extremely nice, and provide some much-needed built-in observer functionality (a la prototype's observer).-- YehudaOn 10/19/06, 
John Resig [EMAIL PROTECTED] wrote:
What if you had a trifecta of functions:.every().in().stop()and allow for function calls like this:.every( 100, text, function(){if ( !$(this).val() )$(this).stop(text);
});or if you don't care about a name:.in( slow, function(){$(this).hide();}).mouseover(function(){$(this).stop();});or if you wanna get really interesting, make it so that you can stop
function calls by how long their timer is set for:.every( 500, function(){$(#foo).load(test.html);}).every( 100, function(){if ( !$(this).val() )$(this).stop(100);
});Just throwing out some ideas, let me know which ones stick.--JohnOn 10/19/06, Blair Mitchelmore [EMAIL PROTECTED] wrote: And I just realized I should make it possible to stop the repeating
 function later on. Code: jQuery.fn.every = function(interval,fn) { return this.each(function() { var self = this; this.$every = window.setInterval
(function() { fn.call(self) },interval); }); }; Example: // Display the current time updated every 500 ms $(p.display).every(500,function() { $(this).html(new Date());
 }); //... some point later in the code execution $(p.display).each(function() { window.clearInterval(this.$every); this.$every = null; });
 -blair Blair Mitchelmore wrote:  I don't know if this exists already but I needed this and assumed it  didn't and wrote it myself. Essentially it lets you do something to an
  element every given time interval.-blair  ___ jQuery mailing list 
discuss@jquery.com http://jquery.com/discuss/--John Resighttp://ejohn.org/
[EMAIL PROTECTED]___jQuery mailing listdiscuss@jquery.comhttp://jquery.com/discuss/
-- Yehuda KatzWeb Developer | Wycats Designs(ph)718.877.1325
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery Kinda Plugin: every

2006-10-19 Thread Dave Methvin
Since the event handling has recently been fixed to avoid IE memory leaks,
could we leverage that? After all, a timer is an event.

$(#time).interval(1000);

basically would map to this:  

setInterval(function(){ $(#time).trigger(tick) }, 1000);

An interval of 0 would stop the timer. A one-time trigger could be done like
this:

$(#time).timeout(1000);

The handler looks like this:

$(#time).bind(tick, function(){
this.text(new Date());
});

BTW, Javascript timer receipts are just numbers so they can be assigned to
an object without causing a closure.

This approach would limit to one tick event per element--some might consider
that a feature--but you could always pass in another event name as the
second arg to timeout or interval.


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of John Resig
Sent: Thursday, October 19, 2006 1:40 PM
To: jQuery Discussion.
Subject: Re: [jQuery] jQuery Kinda Plugin: every

What if you had a trifecta of functions:
.every()
.in()
.stop()

and allow for function calls like this:

.every( 100, text, function(){
if ( !$(this).val() )
$(this).stop(text);
});

or if you don't care about a name:

.in( slow, function(){
$(this).hide();
})
.mouseover(function(){
$(this).stop();
});

or if you wanna get really interesting, make it so that you can stop
function calls by how long their timer is set for:

.every( 500, function(){
$(#foo).load(test.html);
})
.every( 100, function(){
if ( !$(this).val() )
$(this).stop(100);
});

Just throwing out some ideas, let me know which ones stick.

--John

On 10/19/06, Blair Mitchelmore [EMAIL PROTECTED] wrote:
 And I just realized I should make it possible to stop the repeating 
 function later on.

 Code:
 jQuery.fn.every = function(interval,fn) {
 return this.each(function() {
 var self = this;
 this.$every = window.setInterval(function() { fn.call(self) 
 },interval);
 });
 };

 Example:
 // Display the current time updated every 500 ms
 $(p.display).every(500,function() {
 $(this).html(new Date());
 });

 //... some point later in the code execution
 $(p.display).each(function() {
 window.clearInterval(this.$every);
 this.$every = null;
 });

 -blair

 Blair Mitchelmore wrote:
  I don't know if this exists already but I needed this and assumed it 
  didn't and wrote it myself. Essentially it lets you do something to 
  an element every given time interval.
 
 
  -blair
 


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Problems with JQuery

2006-10-19 Thread John Resig
Hi Adam -

This is due to the fact that .find() is a destructive operation, as
you noted - it modifies the original object. We've been looking at
ways to make the operation non-destructive, but still chainable. The
problem is that jQuery has been like this since day 1, and making a
change of this magnatude would have to wait until jQuery 2.0. Unless a
plugin were developed that could allow you to have the functionality
straight away. I'll look into this more and see if I can find an
acceptable compromise.

--John

On 10/19/06, Adam van den Hoven [EMAIL PROTECTED] wrote:
 Hey guys,

 I'm just starting with jquery and I've hit what seems to be
 inconsistant behaviour. I have the following markup:

 form action=
 span class=control date
 input id=someID type=text value=HI /
 input type=hidden value=Huh? class=meta /
 /span
 br /
 /form


 The values are only there becuase I had problems and I wanted to test stuff.

 I then wrote the following javascript:

 $(document).ready(function(){
  $(form .control.date).each( function(i){
 var me = $(this)
 alert( me.find( '[EMAIL PROTECTED]text]').val() );
 alert( me.find( '[EMAIL PROTECTED]hidden]').val() );
 alert( me.find( 'input.meta').val() );

  } );
 });

 Now this made sense to me at the time, but I've learned of better ways
 to do this.

 Now using the FULL jquery library, I get HI followed by NULL twice.
 When I was using only the base and event modules (I think.. no ajax or
 animation) I got back an jQuery object.

 I've since learned that this is the better way to do it:
 alert($('[EMAIL PROTECTED]hidden]', this).val())

 It seems to me a flaw in jQuery that such a thing could happen. First
 getting different results for the same (more or less) operation is a
 bad thing but also having different things come back seems like a bad
 idea.

 Adam

 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/



-- 
John Resig
http://ejohn.org/
[EMAIL PROTECTED]

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Tablesorter

2006-10-19 Thread Mark D. Lincoln








I have discovered a little problem that
others may have seen. We have pages in our Web portal that have empty
grids (tables) that are not populated until the user selects one or more values
from pick lists which enables us to request the target data from the database
server and populate the grid. Unfortunately, the table sorter raises an
exception if the table has no data rows. The exception is raised on line 66
of table sorter version 1.03, however, the real problem is that the variable on
line 58 for the first data row in null.





Mark D. Lincoln



Mark D. Lincoln, Director of Research
 Development

Eye On Solutions, LLC

(866) 253-9366x101

www.eyeonsolutions.com





-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf
Of Yehuda Katz
Sent: Thursday, October 19, 2006
9:44 AM
To: jQuery Discussion.
Subject: Re: [jQuery] Tablesorter







On 10/19/06, Christian Bach [EMAIL PROTECTED]
wrote:

Hi!

1. I could provied a kind of trigger for you, how about something like this.

Ex.

$(myTableWithTableSorter).trigger(resort);




Are you saying you *could* provide this or that you already have? 







2. Well it depends how your table is structured and
how big it is. Please
post a example. 






It's pretty complicated (and proprietary). I have no problem with Regex; I was
just curious how the custom sorters worked. Do you need a custom parser for
each sorter?







/christian


Yehuda Katz wrote:
 I have a need to have the tablesorter do the following:

 1) Refresh when I need it to (I'm going to be doing DOM insertions, and
 will
 need to refresh the table after an insertion). The best thing I could
think 
 of thus far is $(.sortUp, .sortDown).click().click().
Obviously not the
 best idea.
 2) Use custom sorters. I see that the table sorter SUPPORTS custom sorters
 and parsers, but I wasn't sure about the best way to do this. 

 Christian? Anyone?


 

 ___
 jQuery mailing list 
 discuss@jquery.com
 http://jquery.com/discuss/


___
jQuery mailing list 
discuss@jquery.com
http://jquery.com/discuss/








-- 
Yehuda Katz
Web Developer | Wycats Designs 
(ph)718.877.1325 






___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery history plugin - from making the back button work to a more elaborate Hijax solution

2006-10-19 Thread Blair McKenzie
What about situations where you want to tie history to something other than a link click? e.g. changing the value in a select, or hitting enter in a search text boxBlairOn 10/19/06, 
Mike Alsup [EMAIL PROTECTED] wrote:
Klaus, $('a.hijax').history(); jQuery.fn.history = function() {return this.each(function() {$(this).click(function(e) {jQuery.history.setHash
('#' + this.href.split('#')[1]);});}); };This is looking very nice.I like this usage pattern. Why not implement a better solution for being able to implement Hijax
 the easy way ... snip ... That concept would of course involve the back-end as well. There it must be decided upon the X-Requested-With request header what to send back (whole page or only the part of the page that needs to be updated.
I think this is the way to go.The original markup must have thecorrect urls so that the page degrades.I would consider that arequirement.I think it is also a requirement to make sure it is easy to change the
href that gets loaded (which you've done).That way I could achievethe desired results without X-Requested-With logic on the server.Using templates or SSI I could structure my docs so that a call to
mydoc.html returns the full page and a call to mydoc-p1.htmlreturns paragraph one only.Using the plugin on your demo page Icould then rewire the anchor click events like:...$('#chapter').load('mydoc-p' + i '.html');
...Mike___jQuery mailing listdiscuss@jquery.comhttp://jquery.com/discuss/

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Ajax call

2006-10-19 Thread Tombo

$.get(http://www.yahoo.com,function(txt){
  alert(txt);
});

This code works in IE but does not work in firefox.  anyone know why? 
Thanks

Tom
-- 
View this message in context: 
http://www.nabble.com/Ajax-call-tf2476168.html#a6905447
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Ajax call

2006-10-19 Thread Brandon Aaron
This is due to security limitations of firefox and requesting data
outside the scripts domain. There are workarounds ... mainly using
iframes to retrieve the data.

--
Brandon Aaron

On 10/19/06, Tombo [EMAIL PROTECTED] wrote:

 $.get(http://www.yahoo.com,function(txt){
   alert(txt);
 });

 This code works in IE but does not work in firefox.  anyone know why?
 Thanks

 Tom
 --
 View this message in context: 
 http://www.nabble.com/Ajax-call-tf2476168.html#a6905447
 Sent from the JQuery mailing list archive at Nabble.com.


 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Ajax call

2006-10-19 Thread Tombo

ahhh..  you are right...  thanks


Brandon Aaron wrote:
 
 This is due to security limitations of firefox and requesting data
 outside the scripts domain. There are workarounds ... mainly using
 iframes to retrieve the data.
 
 --
 Brandon Aaron
 
 On 10/19/06, Tombo [EMAIL PROTECTED] wrote:

 $.get(http://www.yahoo.com,function(txt){
   alert(txt);
 });

 This code works in IE but does not work in firefox.  anyone know why?
 Thanks

 Tom
 --
 View this message in context:
 http://www.nabble.com/Ajax-call-tf2476168.html#a6905447
 Sent from the JQuery mailing list archive at Nabble.com.


 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/

 
 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/
 
 

-- 
View this message in context: 
http://www.nabble.com/Ajax-call-tf2476168.html#a6905987
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] jQuery Kinda Plugin: every

2006-10-19 Thread Blair McKenzie
I like that :DA way around the one element-one tick would be to have an optional second argument on interval and timeout to label the tick. e.g. interval(1000, abc)...bind(tick-abc, function() {})
BlairOn 10/20/06, Dave Methvin [EMAIL PROTECTED] wrote:
Since the event handling has recently been fixed to avoid IE memory leaks,could we leverage that? After all, a timer is an event.$(#time).interval(1000);basically would map to this:
setInterval(function(){ $(#time).trigger(tick) }, 1000);An interval of 0 would stop the timer. A one-time trigger could be done likethis:$(#time).timeout(1000);
The handler looks like this:$(#time).bind(tick, function(){this.text(new Date());});BTW, _javascript_ timer receipts are just numbers so they can be assigned toan object without causing a closure.
This approach would limit to one tick event per element--some might considerthat a feature--but you could always pass in another event name as thesecond arg to timeout or interval.-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] OnBehalf Of John ResigSent: Thursday, October 19, 2006 1:40 PM
To: jQuery Discussion.Subject: Re: [jQuery] jQuery Kinda Plugin: everyWhat if you had a trifecta of functions:.every().in().stop()and allow for function calls like this:.every( 100, text, function(){
if ( !$(this).val() )$(this).stop(text);});or if you don't care about a name:.in( slow, function(){$(this).hide();}).mouseover(function(){
$(this).stop();});or if you wanna get really interesting, make it so that you can stopfunction calls by how long their timer is set for:.every( 500, function(){$(#foo).load(
test.html);}).every( 100, function(){if ( !$(this).val() )$(this).stop(100);});Just throwing out some ideas, let me know which ones stick.--JohnOn 10/19/06, Blair Mitchelmore 
[EMAIL PROTECTED] wrote: And I just realized I should make it possible to stop the repeating function later on. Code: jQuery.fn.every = function(interval,fn) {
 return this.each(function() { var self = this; this.$every = window.setInterval(function() { fn.call(self) },interval); }); }; Example:
 // Display the current time updated every 500 ms $(p.display).every(500,function() { $(this).html(new Date()); }); //... some point later in the code execution
 $(p.display).each(function() { window.clearInterval(this.$every); this.$every = null; }); -blair Blair Mitchelmore wrote:  I don't know if this exists already but I needed this and assumed it
  didn't and wrote it myself. Essentially it lets you do something to  an element every given time interval.-blair ___
jQuery mailing listdiscuss@jquery.comhttp://jquery.com/discuss/
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Internal workings of jquery

2006-10-19 Thread Abdur-Rahman Advany
Hi guys,

I am trying to figure out how jQuery works internally. There is a stack 
maintained within jQuery but why does jQuery change the 'this' array of 
objects? why not just pass back the modified array when using things 
like find?

Abdul

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Problems with JQuery

2006-10-19 Thread Dave Methvin
 $(document).ready(function(){
  $(form .control.date).each( function(i){
 var me = $(this)
 alert( me.find( '[EMAIL PROTECTED]text]').val() );
 alert( me.find( '[EMAIL PROTECTED]hidden]').val() );
 alert( me.find( 'input.meta').val() );

  } );
 });
 Now using the FULL jquery library, I get HI followed by NULL twice.

You are not alone, there was a similar post a few days ago:
http://www.nabble.com/parent%28%29-modifies-original-object-tf2461335.html

I think the confusion comes from storing a jQuery object in a variable with
a name that implies it represents an unchangeable set of DOM nodes. That's
not the way a jQuery object works. The methods you apply to it can change
its internal state, if that's what you want to do. This plain Javascript
does the same:

var heavyCream = [it, whip, good];
alert(heavyCream.sort());   // good, it, whip
alert(heavyCream.reverse());// whip, it, good
alert(heavyCream.pop());// good
alert(heavyCream);  // whip, it

Applying methods to a plain Javascript array changed its internal state,
just like the jQuery example. The name of the variable still implies it's
talking about heavy cream, but by the end the value sounds like Devo lyrics.

I totally agree that this can be unexpected behavior and that it needs to be
documented better in the getting started writeups. By using chained
methods you can avoid assigning jQuery objects to variables, and don't fall
into the trap of naming the variable as if it will always refer to the same
nodes. 

Making it so that destructive methods return a fresh object would be a big
deal. I know I have code that depends on pushStack so it's definitely a
breaking change. There are also performance and memory issues to think
about. Still, if a lot of people are finding this a barrier to understanding
jQuery we need to find some solution.



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Deserialize array

2006-10-19 Thread TJ

I have some serialized data

stories[]={'link':'http://digg.com/videos_gaming/Just_how_different_IS_Wii_Madden_%28answer%3A_very%29','title':'Just
 how different IS Wii Madden? (answer: very)','date':'19 Oct 
2006','description':'I knew Wii Madden allowed for juking, passing, etc with 
the Wii remote, but this new video is the first one that really shows how 
sports games will be revolutionized. Includes interviews/demonstrations with 
the developers  
producers.'}stories[]={'link':'http://digg.com/general_sciences/Gravity_Measurements_Confirm_Greenland_s_Glaciers_Precipitous_Meltdown','title':'Gravity
 Measurements Confirm Greenland's Glaciers Precipitous Meltdown','date':'19 Oct 
2006','description':'Of late, the enormous glaciers that flowdown to the sea 
from the interior of Greenland have been picking up speed. In the last few 
years, enough ice has come off the northern landmass to sustain the average 
flow of the Colorado River for six years or fill Lake Mead three times over or 
cover the state of Maryland in 10 feet of water.'}

I have serialized data like this. How can I loop through this and deserialize 
it putting it into forms using jQuery Form Deserialization Plugin  

http://www.reach1to1.com/sandbox/jquery/testform.html

-TJ



___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Sorting (not tables)

2006-10-19 Thread Erik Beeson
Hello all,I've been using jQuery for a month or so now and am really enjoying it!I haven't been able to figure out how to sort a collection of elements. I have something like the following:div class=entryspan class=foofoo1/spanspan class=barbar1/span/div
div class=entryspan class=foofoo2/spanspan class=barbar2/span/div
I would like to be able to do something like:$('.entry').sort(function(a, b) { return $('.foo', a).text()-$('.foo', b).text(); }).appendTo('#sortedStuff');Or something like that. I know _javascript_ has a sort function, but that's for arrays, so I'm not sure how that will work with jQuery? Also, a google search for 'jquery sort' (no quotes), brings up some stuff about sorting in the jQuery code, but it appears old and I can't find anything about sorting in the latest release.
Lastly, jQarray.js seems like it would do what I want, but it appears that site is gone (taking jXs with it, btw). It would be nice if plugins were cached on the jQuery site. Anybody have jQarray/jXs?Thanks,
Erik
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Mouseover/out + CSS background image behavior change in IE between r

2006-10-19 Thread EJ12N

You are very welcome! Glad it fixed your problem :)
-- 
View this message in context: 
http://www.nabble.com/Mouseover-out-%2B-CSS-background-image-behavior-change-in-IE-between-rev-249-and-413-tf2460726.html#a6907201
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Sorting (not tables)

2006-10-19 Thread Ⓙⓐⓚⓔ
tables without tables... I actually have some experience on that subject.

does your css make it look like a table? if so,
   jquery.tablesorter.js sorts tables like a champ.
   jquery.js can convert the divs and spans into trs and tds, and
slap a table tag around them!
if it does not,
 you could  read tablesorter and modify it to do your style.

good luck!

On 10/19/06, Erik Beeson [EMAIL PROTECTED] wrote:
 Hello all,

 I've been using jQuery for a month or so now and am really enjoying it!

 I haven't been able to figure out how to sort a collection of elements. I
 have something like the following:

 div class=entryspan class=foofoo1/spanspan
 class=barbar1/span/div
 div class=entryspan class=foofoo2/spanspan
 class=barbar2/span/div

 I would like to be able to do something like:

 $('.entry').sort(function(a, b) { return $('.foo', a).text()-$('.foo',
 b).text(); }).appendTo('#sortedStuff');

 Or something like that. I know javascript has a sort function, but that's
 for arrays, so I'm not sure how that will work with jQuery? Also, a google
 search for 'jquery sort' (no quotes), brings up some stuff about sorting in
 the jQuery code, but it appears old and I can't find anything about sorting
 in the latest release.

 Lastly, jQarray.js seems like it would do what I want, but it appears that
 site is gone (taking jXs with it, btw). It would be nice if plugins were
 cached on the jQuery site. Anybody have jQarray/jXs?

 Thanks,
 Erik

 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/





-- 
Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Problems with JQuery

2006-10-19 Thread Adam van den Hoven
This is all well and good but the document does not make this at all
clear. I would not have fallen into this trap if it was documented
well.

I also would never have expected that calling a find method on
anything would ever modify the thing that I was calling it on. It
makes sense that sorting an array might sort the array rather than
returning a sorted array.

In Ruby, it is a convention that distructive methods are appended with
bang (!). So that var.replace(foo, bar) returns a new string with the
appropriate replacments but var.replace!(foo, bar) modifies the value
of var directly. Its unfortunate that this is not possible in
javascript, although perhaps using something like me.find$() would be
sufficiently indicative.

Adam

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Sorting (not tables)

2006-10-19 Thread Erik Beeson
No, it doesn't look like a table. Actually, the spans are hidden and only there to make the divs sortable. The part that shows is an image (not included in my examle). They're displayed in a grid (actually a single horizontal list that line-wraps).
I'll poke around in table sorter if jQarray doesn't show up.Thanks,ErikOn 10/19/06, Ⓙⓐⓚⓔ 
[EMAIL PROTECTED] wrote:tables without tables... I actually have some experience on that subject.
does your css make it look like a table? if so, jquery.tablesorter.js sorts tables like a champ. jquery.js can convert the divs and spans into trs and tds, andslap a table tag around them!
if it does not, you couldread tablesorter and modify it to do your style.good luck!On 10/19/06, Erik Beeson [EMAIL PROTECTED] wrote:
 Hello all, I've been using jQuery for a month or so now and am really enjoying it! I haven't been able to figure out how to sort a collection of elements. I have something like the following:
 div class=entryspan class=foofoo1/spanspan class=barbar1/span/div div class=entryspan class=foofoo2/spanspan
 class=barbar2/span/div I would like to be able to do something like: $('.entry').sort(function(a, b) { return $('.foo', a).text()-$('.foo', b).text(); }).appendTo('#sortedStuff');
 Or something like that. I know _javascript_ has a sort function, but that's for arrays, so I'm not sure how that will work with jQuery? Also, a google search for 'jquery sort' (no quotes), brings up some stuff about sorting in
 the jQuery code, but it appears old and I can't find anything about sorting in the latest release. Lastly, jQarray.js seems like it would do what I want, but it appears that site is gone (taking jXs with it, btw). It would be nice if plugins were
 cached on the jQuery site. Anybody have jQarray/jXs? Thanks, Erik ___ jQuery mailing list 
discuss@jquery.com http://jquery.com/discuss/--Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ___jQuery mailing list
discuss@jquery.comhttp://jquery.com/discuss/
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Working prototype..thanks again John!

2006-10-19 Thread Greg Bird

Here is the a prototype of the finished product to show you what I was trying
to acheive.  

http://members.optusnet.com.au/greg.bird/mm/collapse.html
*  Long page broken up into smaller sections based on H2's
*  Each scetion is wrapped in a div with a unique ID
*  All but the first section is hidden
*  Side navigation created dynamically based on H2's.  This toggles the
visability of the various sections
*  Users can see entire page by clicking SHOW ALL

I am Considering using an accordian style navigation rather than show/hide.

Thanks again John.  Your help was invaluable!


John Resig wrote:
 
 Ok, I did some more digging and you're right. I don't think I ever
 actually tested nextUntil (oops!)
 
 The full implementation can be found here:
 http://john.jquery.com/jquery/test/nextuntil.html
 
 This includes a working version of nextUntil:
 $.fn.nextUntil = function(expr) {
 var match = [];
 
 // We need to figure out which elements to push onto the array
 this.each(function(){
 // Traverse through the sibling nodes
 for( var i = this.nextSibling; i; i = i.nextSibling ) {
 // Make sure that we're only dealing with elements
 if ( i.nodeType != 1 ) continue;
 
 // If we find a match then we need to stop
 if ( jQuery.filter( expr, [i] ).r.length ) break;
 
 // Otherwise, add it on to the stack
 match.push( i );
 }
 });
 
 return this.pushStack( match, arguments );
 };
 
 Additionally, I realized that .wrap() isn't going to do what you need
 it to. .wrap() wraps each matched element with the same structure. So
 if you matched 3 paragraphs, you'd have three surrounding divs too.
 Since you want it to wrap all of the matched elements with a single
 element, I made a new .wrapAll() plugin:
 
 $.fn.wrapAll = function() {
 // There needs to be at least one matched element for this to work
 if ( !this.length ) return this;
 
 // Find the element that we're wrapping with
 var b = jQuery.clean(arguments)[0];
 
 // Make sure that its in the right position in the DOM
 this[0].parentNode.insertBefore( b, this[0] );
 
 // Find its lowest point
 while ( b.firstChild ) b = b.firstChild;
 
 // And add all the elements there
 return this.appendTo(b);
 };
 
 So - all of that should help you along now. Let me know if this works for
 you.
 
 --John
 
 On 10/18/06, Greg Bird [EMAIL PROTECTED] wrote:

 Thanks for this Blair.a really interesting approach and one I
 wouldn't
 have thought of myself.

 At the moment, I am having problems with the NextUntil function, but once
 I
 have this solved, your suggestion may be a really neat implementation.

 Cheers, Greg



 Blair McKenzie-2 wrote:
 
  This is just a guess:
 
  function BuildNav() {
 $(#content h2).each(function(){
$(this).before(div class='note
  newdivmarker'/div).nextUntil(h2).appendTo(.newdivmarker); 
 $(
  div.newdivmarker).removeClass(newdivmarker);
 });
  }
 
  It relies on the assumption that appendTo moves the origonal element
 list,
  rather than clones them. Basically:
 
 1. It adds your div before the heading, with a temporary marker so
 we
 can find it again
 2. Selects all elements until the next heading
 3. Moves them to the div
 4. Removes the marker from the div
 
 
  Blair
 
 
  On 10/18/06, Greg Bird [EMAIL PROTECTED] wrote:
 
 
  Hi John,
 
 
  thanks again for your help, unfortunately I have deployed your
  suggestions
  and am still unable to get it to work.  You can view my testpage at:
  http://members.optusnet.com.au/greg.bird/mm/collapse.html
 
  My .js now reads:
 
  $(document).ready(function(){
BuildNav();
  });
  //DEFINE NextUntil FUNCTION
 
  $.fn.nextUntil = function(expr) {
  var match = [];
 
  this.each(function(){
  var cur = this.nextSibling;
  while ( cur  jQuery.filter( expr, [cur] ).r.length ) {
  match = jQuery.merge( match, [ cur ] );
  cur = cur.nextSibling;
  }
  console.log(this,cur,match);
  });
 
  return this.pushStack( match, arguments );
  };
 
  /*BUILD SIDE NAVIGATION*/
  function BuildNav() {
  $(#content h2).each(function(){
  $(this).nextUntil(h2).wrap(div class='note'/div);
  });
  }
 
  I have logged the script and it appears that the match array is not
  being
  populated.  I suspect that the Jquery.merge function is not triggering
  properly
 
  Does this function work with JQUERY 1.0.2?  In note in the JQUERY doco
  that
  the function call is now $.merge.  Trialled this without success.
 
  My aim here is to put a unique div around each section of the page and
  then
  dynamically create an expand/collapse navigation system.  Have already
  achieved a similar result with a sliding navigation system.  You can
 see
  this at:
 
  http://members.optusnet.com.au/greg.bird/mm/index.html
 
  This was easier as I didn't need to wrap 

Re: [jQuery] Sorting (not tables)

2006-10-19 Thread John Resig
Hi Erik -

With your particular example, give this plugin a try:

jQuery.fn.sort = function() {
  return this.pushStack( [].sort.apply( this, arguments ), []);
};

We've been talking about adding this for a little while now, so it may
become official:
http://jquery.com/dev/bugs/bug/255/

Using that plugin you can use your exact snippet, above. Let me know
if this helps.

--John

 I've been using jQuery for a month or so now and am really enjoying it!

 I haven't been able to figure out how to sort a collection of elements. I
 have something like the following:

 div class=entryspan class=foofoo1/spanspan
 class=barbar1/span/div
 div class=entryspan class=foofoo2/spanspan
 class=barbar2/span/div

 I would like to be able to do something like:

 $('.entry').sort(function(a, b) { return $('.foo', a).text()-$('.foo',
 b).text(); }).appendTo('#sortedStuff');

 Or something like that. I know javascript has a sort function, but that's
 for arrays, so I'm not sure how that will work with jQuery? Also, a google
 search for 'jquery sort' (no quotes), brings up some stuff about sorting in
 the jQuery code, but it appears old and I can't find anything about sorting
 in the latest release.

 Lastly, jQarray.js seems like it would do what I want, but it appears that
 site is gone (taking jXs with it, btw). It would be nice if plugins were
 cached on the jQuery site. Anybody have jQarray/jXs?

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Sorting (not tables)

2006-10-19 Thread Stephen Woodbridge
Ok, I am just not worthy! sigh
Somebody please walk me through how this plugin works.

-Steve

John Resig wrote:
 Hi Erik -
 
 With your particular example, give this plugin a try:
 
 jQuery.fn.sort = function() {
   return this.pushStack( [].sort.apply( this, arguments ), []);
 };
 
 We've been talking about adding this for a little while now, so it may
 become official:
 http://jquery.com/dev/bugs/bug/255/
 
 Using that plugin you can use your exact snippet, above. Let me know
 if this helps.
 
 --John
 
 I've been using jQuery for a month or so now and am really enjoying it!

 I haven't been able to figure out how to sort a collection of elements. I
 have something like the following:

 div class=entryspan class=foofoo1/spanspan
 class=barbar1/span/div
 div class=entryspan class=foofoo2/spanspan
 class=barbar2/span/div

 I would like to be able to do something like:

 $('.entry').sort(function(a, b) { return $('.foo', a).text()-$('.foo',
 b).text(); }).appendTo('#sortedStuff');

 Or something like that. I know javascript has a sort function, but that's
 for arrays, so I'm not sure how that will work with jQuery? Also, a google
 search for 'jquery sort' (no quotes), brings up some stuff about sorting in
 the jQuery code, but it appears old and I can't find anything about sorting
 in the latest release.

 Lastly, jQarray.js seems like it would do what I want, but it appears that
 site is gone (taking jXs with it, btw). It would be nice if plugins were
 cached on the jQuery site. Anybody have jQarray/jXs?
 
 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Sorting (not tables)

2006-10-19 Thread John Resig
Sure.

Let's start with this:
[].sort.apply( this, arguments )
'this' contains the current jQuery object, 'arguments' contains an
array of all the arguments passed in to the .sort() function.

jQuery Is a pseudo-array (not a true array) so it doesn't support
operations like .sort(), natively. To mimic this, we get the sort
function from a regular array:
[].sort
and then call it within the context of our jQuery array using
JavaScript's apply method
[].sort.apply( this, ... )
and pass in our arguments to it (which should be just a single
function, which is exactly what an array's sort function takes).

This whole mess returns a new array of DOM elements. Which brings us
to the rest:
return this.pushStack( ..., []);
The pushStack function is part of jQuery, it allows it to keep a
stateful watch over what you match (it allows you to do .find() and
.end(), for example). In this case we want to make sure that .sort()
is stateful, since it's modifying the contents of the jQuery object.

The second argument to pushStack is normally the arguments array -
this is so that you can do stuff like:
.filter(.foo,function(){ ... })
but in this case, we don't have a function to pass into .sort(), so we
just provide an empty array.

The result is a stateful way of sorting a set of DOM elements
contained within a jQuery object. It can be used like this:

$(div.items).sort(function(a,b){
return a.innerHTML  b.innerHTML ? 1 : -1;
}).remove().appendTo(#itemlist);

Hope this helps.

--John

On 10/19/06, Stephen Woodbridge [EMAIL PROTECTED] wrote:
 Ok, I am just not worthy! sigh
 Somebody please walk me through how this plugin works.

 -Steve

 John Resig wrote:
  Hi Erik -
 
  With your particular example, give this plugin a try:
 
  jQuery.fn.sort = function() {
return this.pushStack( [].sort.apply( this, arguments ), []);
  };
 
  We've been talking about adding this for a little while now, so it may
  become official:
  http://jquery.com/dev/bugs/bug/255/
 
  Using that plugin you can use your exact snippet, above. Let me know
  if this helps.
 
  --John
 
  I've been using jQuery for a month or so now and am really enjoying it!
 
  I haven't been able to figure out how to sort a collection of elements. I
  have something like the following:
 
  div class=entryspan class=foofoo1/spanspan
  class=barbar1/span/div
  div class=entryspan class=foofoo2/spanspan
  class=barbar2/span/div
 
  I would like to be able to do something like:
 
  $('.entry').sort(function(a, b) { return $('.foo', a).text()-$('.foo',
  b).text(); }).appendTo('#sortedStuff');
 
  Or something like that. I know javascript has a sort function, but that's
  for arrays, so I'm not sure how that will work with jQuery? Also, a google
  search for 'jquery sort' (no quotes), brings up some stuff about sorting in
  the jQuery code, but it appears old and I can't find anything about sorting
  in the latest release.
 
  Lastly, jQarray.js seems like it would do what I want, but it appears that
  site is gone (taking jXs with it, btw). It would be nice if plugins were
  cached on the jQuery site. Anybody have jQarray/jXs?
 
  ___
  jQuery mailing list
  discuss@jquery.com
  http://jquery.com/discuss/


 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/



-- 
John Resig
http://ejohn.org/
[EMAIL PROTECTED]

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Sorting (not tables)

2006-10-19 Thread Stephen Woodbridge
Ahhh! Thank you John!

I was confused and thinking that sort was like an iterator, but it is 
not, it is operating on the whole collection returned by the $(...) 
search. And the pushStack makes sense now, so if I wanted the unsorted 
collection later you could reach into the stack and recover it presumably.

Thank you for the enlightenment :)

-Steve

John Resig wrote:
 Sure.
 
 Let's start with this:
 [].sort.apply( this, arguments )
 'this' contains the current jQuery object, 'arguments' contains an
 array of all the arguments passed in to the .sort() function.
 
 jQuery Is a pseudo-array (not a true array) so it doesn't support
 operations like .sort(), natively. To mimic this, we get the sort
 function from a regular array:
 [].sort
 and then call it within the context of our jQuery array using
 JavaScript's apply method
 [].sort.apply( this, ... )
 and pass in our arguments to it (which should be just a single
 function, which is exactly what an array's sort function takes).
 
 This whole mess returns a new array of DOM elements. Which brings us
 to the rest:
 return this.pushStack( ..., []);
 The pushStack function is part of jQuery, it allows it to keep a
 stateful watch over what you match (it allows you to do .find() and
 .end(), for example). In this case we want to make sure that .sort()
 is stateful, since it's modifying the contents of the jQuery object.
 
 The second argument to pushStack is normally the arguments array -
 this is so that you can do stuff like:
 .filter(.foo,function(){ ... })
 but in this case, we don't have a function to pass into .sort(), so we
 just provide an empty array.
 
 The result is a stateful way of sorting a set of DOM elements
 contained within a jQuery object. It can be used like this:
 
 $(div.items).sort(function(a,b){
 return a.innerHTML  b.innerHTML ? 1 : -1;
 }).remove().appendTo(#itemlist);
 
 Hope this helps.
 
 --John
 
 On 10/19/06, Stephen Woodbridge [EMAIL PROTECTED] wrote:
 Ok, I am just not worthy! sigh
 Somebody please walk me through how this plugin works.

 -Steve

 John Resig wrote:
 Hi Erik -

 With your particular example, give this plugin a try:

 jQuery.fn.sort = function() {
   return this.pushStack( [].sort.apply( this, arguments ), []);
 };

 We've been talking about adding this for a little while now, so it may
 become official:
 http://jquery.com/dev/bugs/bug/255/

 Using that plugin you can use your exact snippet, above. Let me know
 if this helps.

 --John

 I've been using jQuery for a month or so now and am really enjoying it!

 I haven't been able to figure out how to sort a collection of elements. I
 have something like the following:

 div class=entryspan class=foofoo1/spanspan
 class=barbar1/span/div
 div class=entryspan class=foofoo2/spanspan
 class=barbar2/span/div

 I would like to be able to do something like:

 $('.entry').sort(function(a, b) { return $('.foo', a).text()-$('.foo',
 b).text(); }).appendTo('#sortedStuff');

 Or something like that. I know javascript has a sort function, but that's
 for arrays, so I'm not sure how that will work with jQuery? Also, a google
 search for 'jquery sort' (no quotes), brings up some stuff about sorting in
 the jQuery code, but it appears old and I can't find anything about sorting
 in the latest release.

 Lastly, jQarray.js seems like it would do what I want, but it appears that
 site is gone (taking jXs with it, btw). It would be nice if plugins were
 cached on the jQuery site. Anybody have jQarray/jXs?
 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/

 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/

 
 


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Problems with JQuery

2006-10-19 Thread Dave Methvin
 This is all well and good but the document does not make
 this at all clear. I would not have fallen into this trap if
 it was documented well.

Point taken, Adam. The documentation could certainly use improvement on that
point.

 I also would never have expected that calling a find method on
 on anything would ever modify the thing that I was calling it on. 

Although .find() does modify jQuery's internal node list, I agree the verb
find doesn't usually imply modification. There is some irony that jQuery's
methods like .remove() and .empty() actually *don't* change the object's
internal node list--they only remove the nodes from the document tree. All
this needs to be addressed either by documentation or changes to the
behavior.

 In Ruby, it is a convention that distructive methods are appended
 with bang (!). So that var.replace(foo, bar) returns a new string
 with the appropriate replacments but var.replace!(foo, bar) modifies
 the value of var directly. Its unfortunate that this is not possible
 in javascript, although perhaps using something like me.find$()
 would be sufficiently indicative.

That's an interesting idea. Since $ has been done to death, perhaps it could
use a trailing underscore? I think that's the only remaining special
character left. Alternatively, it could use a trailing capital letter like X
to indicate it changed the object.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Sorting (not tables)

2006-10-19 Thread Erik Beeson
 $(div.items).sort(function(a,b){
 return a.innerHTML  b.innerHTML ? 1 : -1;
 }).remove().appendTo(#itemlist);

In my code, I don't even need to call remove(). Not sure if this is
how it's supposed to work or not...

div id=entries
div class=entry.../div
div class=entry.../div
/div

$('.entry').sort(sort_func).appendTo('#entries');

Results in an in place sort. This is the desired behavior for what I
want to do, but your example above suggests that's not what you were
expecting it to do.

Thanks for the sort function. It works great!

--Erik

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Sorting (not tables)

2006-10-19 Thread John Resig
 Results in an in place sort. This is the desired behavior for what I
 want to do, but your example above suggests that's not what you were
 expecting it to do.

Huh, now that I think about it - you're right. You wouldn't need to do
a remove - good call!

--John

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Sorting (not tables)

2006-10-19 Thread Erik Beeson
Without the appendTo, the items aren't removed, but they aren't
reordered either. This is something about the 'adding items in a
different order replaces the old version' DOM feature, isn't it?

--Erik

On 10/19/06, John Resig [EMAIL PROTECTED] wrote:
  Results in an in place sort. This is the desired behavior for what I
  want to do, but your example above suggests that's not what you were
  expecting it to do.

 Huh, now that I think about it - you're right. You wouldn't need to do
 a remove - good call!

 --John

 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Working prototype..thanks again John!

2006-10-19 Thread Brandon Aaron
Looks good. Be sure to return false; in the click event handler. This
will keep it from adding the hash to the url and jumping to the top
with each click if you are scrolled.

--
Brandon Aaron

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Deserialize array

2006-10-19 Thread ashutosh bijoor
Please see the example provided on the plugin page. Your example data structure is a bit difficult to read... maybe you could simplify it for the purpose of this discussion, and also give details about the form into which you want to insert the data
On 10/20/06, TJ [EMAIL PROTECTED] wrote:
I have some serialized datastories[]={'link':'http://digg.com/videos_gaming/Just_how_different_IS_Wii_Madden_%28answer%3A_very%29','title':'Just
 how different IS Wii Madden? (answer: very)','date':'19 Oct 2006','description':'I knew Wii Madden allowed for juking, passing, etc with the Wii remote, but this new video is the first one that really shows how sports games will be revolutionized. Includes interviews/demonstrations with the developers  producers.'}stories[]={'link':'
http://digg.com/general_sciences/Gravity_Measurements_Confirm_Greenland_s_Glaciers_Precipitous_Meltdown','title':'Gravity
 Measurements Confirm Greenland's Glaciers Precipitous Meltdown','date':'19 Oct 2006','description':'Of late, the enormous glaciers that flowdown to the sea from the interior of Greenland have been picking up speed. In the last few years, enough ice has come off the northern landmass to sustain the average flow of the Colorado River for six years or fill Lake Mead three times over or cover the state of Maryland in 10 feet of water.'}
I have serialized data like this. How can I loop through this and deserialize it putting it into forms using jQuery Form Deserialization Plugin
http://www.reach1to1.com/sandbox/jquery/testform.html-TJ___jQuery mailing listdiscuss@jquery.com
http://jquery.com/discuss/-- Reach1to1 Communicationshttp://www.reach1to1.com[EMAIL PROTECTED]
98201-94408
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Working prototype..thanks again John!

2006-10-19 Thread Greg Bird

Thanks Brandon, good point.  Will implement.

Cheers, Greg


Brandon Aaron wrote:
 
 Looks good. Be sure to return false; in the click event handler. This
 will keep it from adding the hash to the url and jumping to the top
 with each click if you are scrolled.
 
 --
 Brandon Aaron
 
 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/
 
 

-- 
View this message in context: 
http://www.nabble.com/Please-help%21-Dynamically-Wrapping-DIV%27s-around-structural-markup.-tf2464168.html#a6909720
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Firefox Javascript console hangs with jQuery?

2006-10-19 Thread Michael Crowl

On any page with jQuery included, when I try to open the Javascript 
console Firefox hangs for a bit and eventually asks me if I want to 
stop the currently running script.  This occurs whether the console 
has been cleared or not, and on pages where jQuery is the only 
Javascript on the page - even if there are no currently running 
functions, as far as I can tell.

Haven't been able to find anyone else mentioning this problem anywhere.

-- mike


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Firefox Javascript console hangs with jQuery?

2006-10-19 Thread Ⓙⓐⓚⓔ
you have debugger enabled in firebug? I had a similar problem.

On 10/19/06, Michael Crowl [EMAIL PROTECTED] wrote:

 On any page with jQuery included, when I try to open the Javascript
 console Firefox hangs for a bit and eventually asks me if I want to
 stop the currently running script.  This occurs whether the console
 has been cleared or not, and on pages where jQuery is the only
 Javascript on the page - even if there are no currently running
 functions, as far as I can tell.

 Haven't been able to find anyone else mentioning this problem anywhere.

 -- mike


 ___
 jQuery mailing list
 discuss@jquery.com
 http://jquery.com/discuss/



-- 
Ⓙⓐⓚⓔ - יעקב   ʝǡǩȩ   ᎫᎪᏦᎬ
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


[jQuery] Improved jQIR?

2006-10-19 Thread Faust




Hi,

I am seeking feedback on what I think may be an improvement on Sam
Collett's jQIR plugin
http://sam.collett.googlepages.com/jQIR.html.

jQuery.fn.jQIR = function(format, path) {
var template = document.createElement('img');
return this.each(function() {
 var obj = jQuery(this);
 jQuery(template.cloneNode(true)).oneload(function() {
obj.empty().append(this) }).attr({src:path + obj.id() + '.' + format,
alt:obj.text() });
});
};

The reasons I think it may be an improvement are:

  It detects if the browser supports images before doing the
replacement. (This is a feature in ppk's version
http://www.quirksmode.org/dom/fir.html)
  It makes sure the actual image will load before doing the
replacement. (Not in ppk's version)
  It moves the image creation out of the loop and uses cloneNode in
the loop (Since ppk did it this way, I assume it might be more
efficient).
  The DOM manipulation is more jQuery centric.

I have only tested this with Firefox 1.5 and IE 6. ppk warned that IE
on Windows does
not fire the onload event of cached images. I
did not notice any problems when returning to pages via the back button
with IE. 

I am also wondering if I am using oneload correctly and
if it does any good. I used it because I don't think I need the
function bound after the initial load. Is this correct? Also, are
there any performance benefits to using oneload instead
of load? Are there any traps to avoid when deciding
between load and oneload?


Thanks in advance,

Faust


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/