[jQuery] Re: get value of checked checkboxes into a list

2008-01-11 Thread James Dempster

$().ready(function() {
$('#editOptions').click(function() {
alert($('input:checkbox[name=listProductID]:checked')); //
returns only the first value, selected or not
});
});

untested but should work.

Also see,
http://docs.jquery.com/Selectors/checkbox
http://docs.jquery.com/Selectors/checked

p.s.
#listProductID will select a single element which has an ID of
listProductID as none of your inputs have that ID I don't see how it's
selecting them. they all have the same name so you would need to use
the attribute selector see 
http://docs.jquery.com/Selectors/attributeEquals#attributevalue

On Jan 11, 5:44 am, Duncan [EMAIL PROTECTED] wrote:
 All,

 I am lost right now, still pretty green with jQuery. I have a number of
 checkboxes on a page

 input type=checkbox name=listProductID value=2
 input type=checkbox name=listProductID value=3
 input type=checkbox name=listProductID value=4
 input type=checkbox name=listProductID value=5

 and a button at the end.

 button name=editOptions id=editOptionsEdit /button

 I would like to have the value of alll checked checkboxes put into a list
 for use in a variable.

 how would I go about this?

 $().ready(function() {
 $('#editOptions').click(function(){
 alert($('#listProductID').val());//returns only the first value,
 selected or not
 });
 });

 Thanks

 --
 Duncan I Loxton
 [EMAIL PROTECTED]


[jQuery] updated Tablefilter Feedback please

2007-11-19 Thread James Dempster

Sometime back I created the first test version of table filter.
Quite some time has past and I've taken on lots of the ideas that
where mentioned.

I'm now back again.

If people could take a look at the work I've done and provide
feedback. This is currently a headless plugin. Event driven only. I've
not provided any documentation yet, the full release will contain more
examples documentation etc. It's worth noting that the plugin has
support for custom filters.

http://code.jdempster.com/jquery/trunk/tablefilter/jquery.tablefilter.example.html

Also I would really appreciate some help from a ui or a designer in
terms of a good ui for this plugin. The ui needs to support table
filtering or individual column filtering.

The final release will have an option to replace the ui with your own
or use the plugin as just event driven.


[jQuery] Re: HELP: Debugging Issue

2007-11-19 Thread James Dempster

sounds horrid but you can put alert or console.log throughout your
code see where it gets to last before hanging

On Nov 19, 5:07 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 On one page, Firefox throws the a script is taking too long message.

 On clicking 'Debug Script', it points to the following line of jQuery:

 /first.push(second[i]);

 /Which is in...

 /merge: function(first, second)
 {
  }
 /
 Assuming that there aren't any problems with jQuery, how can i find out
 which code is throwing this error?

 Thanks

 Fahed


[jQuery] Re: HELP: Debugging Issue

2007-11-19 Thread James Dempster

oops... or alternatively use break points and step though your coding
using the debugger in firebug

On Nov 19, 5:07 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 On one page, Firefox throws the a script is taking too long message.

 On clicking 'Debug Script', it points to the following line of jQuery:

 /first.push(second[i]);

 /Which is in...

 /merge: function(first, second)
 {
  }
 /
 Assuming that there aren't any problems with jQuery, how can i find out
 which code is throwing this error?

 Thanks

 Fahed


[jQuery] Re: Appending text to an attribute

2007-11-19 Thread James Dempster

I don't think I full understand where your data is or where it's
coming from. But heres an example from what I can understand.

$('ul.actions a').each(function() {
  var $this = $(this);
  $this.attr('href', $this.attr('href') + '#somewhere');
});

On Nov 18, 8:55 pm, Eric Lanehart [EMAIL PROTECTED] wrote:
 Hello everyone,

 In advance of my question below I must say that I'm a designer that
 has HTML/CSS down very well, and I can deal with Ruby/PHP in my
 templates to do some pretty basic variable stuff and conditional
 logic. My attempts to pick up Javascript though have always fallen
 pretty short. Tried Jeremy Keith's DOM Scripting book, but got lost
 pretty quick once I tried applying the knowledge. I got introduced to
 jQuery through Klaus Hartl's Tabs plug-in (now apart of jQuery UI),
 which is literally going to change the design process at my company
 quite a bit =) I can't wait for the new version of his Remote plugin.
 I've since picked up Learning jQuery and made it up through Chapter 6,
 but it hasn't answered my question thus far and the next chapter is
 about AJAX (!). The API reference hasn't been of much help either.
 Also looked through quite a few threads here, also couldn't find what
 I'm looking for.

 So I think my question is probably going to be pretty dumb, which is
 why I gave you all the treatise of an explanation above! I'm trying to
 access the href attribute of elements that match a certain selector,
 grab whatever is there for each matched element, and append a standard
 string to whatever is already there.

 For example, I want to find every element that matches ul.actions a,
 and append the anchor link #somewhere to the end of each link (as
 specified in the href attribute). The attr method of course doesn't do
 this as it wipes out the contents. I'm sure there must be a way of
 saying add this to what's already there, i.e.:

 attr($this + '#somewhere');

 But I can't quite figure out the syntax. I loosely remember this.href
 from DOM Scripting so I tried searching around that, and I think I
 might also need to use the each method? And if there is no built-in
 facility for saying keep whatever is there, would I maybe have to
 fetch that stuff first assign them to variables, and then go the route
 I started to go above? I'm lost as to what exact combination of these
 things will do the trick though.

 Help! (and thank you very much for your time)


[jQuery] Re: Add a li based on updates the database

2007-11-19 Thread James Dempster

take a look at http://docs.jquery.com/Ajax Maybe json would be the
easiest way to send the data to the client, php has a nice functions
for json http://uk2.php.net/manual/en/function.json-encode.php

On Nov 19, 3:09 am, Chris [EMAIL PROTECTED] wrote:
 Okay,
 So i have a basic shopping cart/order system application.  I would
 like the back-end (php and mysql based) that displays current orders
 to be able dynamically see a new order and display it on the page,
 without refreshing the page?  How do i have jQuery work with my php to
 accomplish this?
 Thank you for any help!!


[jQuery] Re: .append() is not inserting data into my div

2007-11-19 Thread James Dempster

append expects html data starting with a html element e.g div or an
element please check that this is the case. can you provide an example
of what data contains?

On Nov 18, 8:31 pm, Shawn [EMAIL PROTECTED] wrote:
 Hello, this code doesn't seem to insert or append any HTML when I call
 it,
 but it does insert the HTML when I use the HTML() function.

 *
 This does not work.*
 function queue(itemId, mediaType) {
$.get(ajax/getPlaylistItem.aspx, {itemId: itemId, mediaType:
 mediaType}, function(data){
   alert(Data Loaded:  + data);$(#playlist
 div.scrollbox).append(data);

 });

 }

 *
 This works!*
 function queue(itemId, mediaType) {
$.get(ajax/getPlaylistItem.aspx, {itemId: itemId, mediaType:
 mediaType}, function(data){
   alert(Data Loaded:  + data);$(#playlist
 div.scrollbox).html(data);
 // append() doesnt work!
 });

 }

 I've also tried a couple other methods of inserting data, but they
 didn't
 respond either.

 Thanks,

 -- shawn


[jQuery] Re: how to use :empty selector

2007-11-19 Thread James Dempster

:empty Matches all elements that are empty, be it elements or text.
I think what your checking is value so it isn't covered by this
selector.

I think you'd have to loop though them all checking the value.
$(document).ready(function() {
  $(input[type=text]).each(function () {
if ($(this).val() == '') {
  alert(empty text);
  $(this).focus();
}
  });
});

On Nov 19, 10:19 am, Cyril C [EMAIL PROTECTED] wrote:
 hi all,

 i want to select all empty tag  input type='text' .
 I try this :

 $(document).ready(function() {
 $(input[type=text]:empty).each(function (i) {
 alert(vide);
 $(this).val(i);
   });

 });

 But ALL tag  input type='text'  are selected not ONLY the EMPTY
 one.

 PLZ help.


[jQuery] Re: updated Tablefilter Feedback please

2007-11-19 Thread James Dempster

Do you think this plugin needs a default UI? Or shall it remain event
driven only requiring the end developer to implement there own UI?
Does some one have any thoughts or comments on the subject?


[jQuery] Re: Is it possible to alter internal CSS properties?

2007-11-01 Thread James Dempster

You could use LiveQuery, or I've not checked if this is the right way
of doing it or even if it will work but I guess you could do.

$('style type=text/css.someClass { background-color:yellow }/
style').appendTo('head');

/James

On Nov 1, 9:24 am, Jesse Klaasse [EMAIL PROTECTED] wrote:
 As we all know, we can do the following using jQuery:

 $('.someClass').css(background-color: yellow);

 This first matches all elements which have the class someClass, and then
 alters the css of the matched elements.
 This won't work when the class is dynamically added somewhere in the
 page, for example on a mouseover.

 Is it somehow possible to really alter the internal style sheet
 definition, in order to reflect the wanted changes when a class is
 dynamically added?

 My guess is that this is not possible at all, but I'm not sure.. Any
 ideas? Thanks!



[jQuery] Re: LiveQuery (Discuss Please)

2007-11-01 Thread James Dempster

I less than one pence would be I love and use the plugin, but I don't
believe it's used enough to but included into jQuery core, I would
like to see jQuery core stay light and fresh. There's nothing wrong
with adding LiveQuery yourself, just add another file or append all
the plugins you want to the same js file.

/James

On Nov 1, 2:04 am, Yehuda Katz [EMAIL PROTECTED] wrote:
 So as far as I'm concerned, livequery is the biggest advance in jQuery since
 its inception (no, I am not its author). I'm trying to understand why it's
 having such a slow rate of adoption.

 it solves this problem:
 $(div.klass).draggable();
 $(#foo).load(url, function() { $(div.klass).draggable(); });

 beautifully, as you now only need to do:

 $(div.klass).livequery(function() { $(this).draggable() });
 $(#foo).load(url);

 Obviously, that was only a simple example. The more general case, wanting to
 bind some event handler to a selector regardless of when it appears on the
 page, is extremely common. So again, I'm trying to understand why the rate
 of adoption has been so slow. Any thoughts?

 --
 Yehuda Katz
 Web Developer | Procore Technologies
 (ph)  718.877.1325



[jQuery] Re: LiveQuery (Discuss Please)

2007-11-01 Thread James Dempster

My less than one pence worth would be I love and use the plugin, but I
don't think it should be included into jQuery core, I would
like to see jQuery core stay light and fresh. There's nothing wrong
with adding LiveQuery yourself, either just add another js file to
your html or append all the plugins you want to the same js file.

/James

On Nov 1, 2:04 am, Yehuda Katz [EMAIL PROTECTED] wrote:
 So as far as I'm concerned, livequery is the biggest advance in jQuery since
 its inception (no, I am not its author). I'm trying to understand why it's
 having such a slow rate of adoption.

 it solves this problem:
 $(div.klass).draggable();
 $(#foo).load(url, function() { $(div.klass).draggable(); });

 beautifully, as you now only need to do:

 $(div.klass).livequery(function() { $(this).draggable() });
 $(#foo).load(url);

 Obviously, that was only a simple example. The more general case, wanting to
 bind some event handler to a selector regardless of when it appears on the
 page, is extremely common. So again, I'm trying to understand why the rate
 of adoption has been so slow. Any thoughts?

 --
 Yehuda Katz
 Web Developer | Procore Technologies
 (ph)  718.877.1325



[jQuery] Re: Download JQuery

2007-10-30 Thread James Dempster

Just a quick note I'd like to add, all the files are functionally the
same. The only differences are the ones outlined by Dan G. Switzer II

On Oct 30, 11:01 am, shapper [EMAIL PROTECTED] wrote:
 Hello,

 I want to download and start using JQuery.

 Which one should I download?
 And why the file sizes do no match?

 For example, for
 45.3Kb 
 -http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.1
 14Kb -http://docs.jquery.com/Release:jQuery_1.2.1

 Thanks,
 Miguel



[jQuery] Re: Toggle all checkboxes, best way?

2007-10-30 Thread James Dempster

I would suggest a couple of changes

var $checkboxes = $('input[type=checkbox]');
$('a').toggle(function() {
  $checkboxes.attr('checked','checked');
  return false;
}, function() {
  $checkboxes.removeAttr('checked');
  return false;
});

p.s.
do you really need to post a 6K dealerskinslogo.bmp, I'm sure you
didn't mean to post it, but if you are going to have a logo should it
really be a bmp file??

I've not tested but it should work. There's no need to use the .each

On Oct 30, 4:28 pm, Andy Matthews [EMAIL PROTECTED] wrote:
 I've got some code which I think is pretty simple. But I'd like to see if
 there's a quicker (less code) way to do this. I simply want to be able to
 toggle all checkboxes on a page on/off.

 Is there a better way?

 var $checkboxes = $('input[type=checkbox]');

 $('a').toggle(function(){
// toggle me on
$checkboxes.each(function(){
 $(this).attr('checked','checked');
});
return false;
   },function(){
$checkboxes.each(function(){
 $(this).removeAttr('checked');
});
   });

 

 Andy Matthews
 Senior ColdFusion Developer

 Office:  877.707.5467 x747
 Direct:  615.627.9747
 Fax:  615.467.6249
 [EMAIL PROTECTED]http://www.dealerskins.com/

  dealerskinslogo.bmp
 6KDownload



[jQuery] Re: sending html via POST

2007-10-28 Thread James Dempster

you where nearly there formdata is a jQuery object if you want in html
contents of that object try...
formdata = $('div#htm_snippet').html();

/James

On Oct 28, 10:24 am, Moody [EMAIL PROTECTED] wrote:
 So here's what I'd like to do:

 on form submission, send some data from a form input and also a
 snippet of html to a php script for further processing...

 so far I have something like:

 formdata = $('div#htm_snippet');

 $('form').submit(function(){
 $.post(url, {snippet: formdata}, function(data){
 $('body').append(data);
 });

 My php script at the moment just reads the $_POST variable and spits
 it back out, but all it returns is
 [object Object]

 so where am I going wrong?

 --thanks --



[jQuery] Re: Imagebox plugin onClick event

2007-10-28 Thread James Dempster

you can bind an onclick event to an element by selecting the element
though jQuery then using .click(function() {});

e.g. $('img.imagebox').click(function() { $('div.large
img').attr('href', $(this).attr('href'); });

this would bind a click event to every image with a class name of
image box, when clicked on would load the image into a div with a
class name of large.

Hope this helps you on the track to what you are trying todo.

/James

On Oct 28, 8:06 am, faraz [EMAIL PROTECTED] wrote:
 Hi,
  I am working on Imagebox jquery plugin.I works on document ready
 event.But in my script i want it to work on mouseclick Event.I tried
 to make it work but not successful.Can anyone tell me how can i
 perform this functionality.In short i want imagebox slideshow onClick
 event.Your help will do a great for me.



[jQuery] Re: getting inside attribute?

2007-10-28 Thread James Dempster

Try $('label').css('display'); this will return the value your looking
for.

On Oct 28, 7:39 am, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Hi,

 Given following, is there a way to get the value of 'display'? is it
 'none' or something else?
 thanks,

 AC.

 label for=state  style=display:none;



[jQuery] Re: getting inside attribute?

2007-10-28 Thread James Dempster
That's because .css('display') or any other css property returns the
computed style. As block is the default style for that element it will
return block on spans it will return inline as that's the default display
style.

/James

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


 Thanks, this works, I notice that css(display) will return block
 when there is no style defined

 On Oct 28, 7:13 pm, James Dempster [EMAIL PROTECTED] wrote:
  Try $('label').css('display'); this will return the value your looking
  for.
 
  On Oct 28, 7:39 am, [EMAIL PROTECTED]
 
  [EMAIL PROTECTED] wrote:
   Hi,
 
   Given following, is there a way to get the value of 'display'? is it
   'none' or something else?
   thanks,
 
   AC.
 
   label for=state  style=display:none;


 



[jQuery] Re: passing this

2007-10-28 Thread James Dempster

There is already a jQuery .parent() method.

Not quite sure what your trying todo. But each method is run in the
context of the selected elements.

e.g.

jQuery.fn.extend({
test: function() {
return this.each(function() {
   // do something with elements
});
}
});

would do something with all the selected elements via test. $
('div').test()

/James

On Oct 27, 8:49 pm, Jean-Sébastien [EMAIL PROTECTED]
wrote:
 Hello,

 i want to call a function $('#selection').parent.child()

 with the following code :

 jQuery.fn.extend({
   parent: {
 child: function(o){ doSomethingWith(selectedElement) }
   }

 });

 but i dont know how to pass the selected element through parent
 (#selection) to child function.

 regards.



[jQuery] Re: How to Check jQuery Status

2007-10-26 Thread James Dempster
That's because you are providing the parentheses () which executes the
function there and then rather than passing the function to be executed
later when the ajax request is complete.

Try.
jQuery.post(/BFEWebApp/PreviewBFEDListServlet,detaillitstring= +
detailListString, processReqChange);

/James

On 10/26/07, SDyke [EMAIL PROTECTED] wrote:



 Can you elaborate. I have a third parameter in my calling code:

 jQuery.post(/BFEWebApp/PreviewBFEDListServlet,detaillitstring= +
 detailListString, processReqChange());

 The processReqChange() turns on the link. However, this function is called
 as soon as the post code fires.


 Adrian Lynch-2 wrote:
 
 
  You can supply a callback function when making your AJAX call. When
  the result is returned it will run the callback and this is where you
  can make the link appear.
 
  Adrian
 
  On Oct 26, 2:34 pm, SDyke [EMAIL PROTECTED] wrote:
  I am using jQuery to do an AJAX post. The servlet runs code to generate
  an
  Excel file. On the firing page a hyperlink appears that will display
 the
  Excel file. My problem is keeping the link from appearing before the
 file
  has finished generating. How do I use a response flag to tell the page
  code
  to display the link?
 
 
 

 --
 View this message in context:
 http://www.nabble.com/How-to-Check-jQuery-Status-tf4697072s27240.html#a13431182
 Sent from the jQuery General Discussion mailing list archive at Nabble.com
 .


 



[jQuery] Re: binding dynamically inserted DOM elements

2007-10-18 Thread James Dempster

I suggest using liveQuery as mentioned and like you've found.

On Oct 18, 9:03 pm, schmingle [EMAIL PROTECTED] wrote:
 nevermind, i think i found the solution:

 http://brandonaaron.net/docs/livequery/

 are there any other known methods?

 On Oct 18, 12:59 pm, schmingle [EMAIL PROTECTED] wrote:

  i have a piece of code that inserts new objects into the DOM.  these
  objects are of the same class as other objects already in the DOM to
  which jquery has bound.  how do i get these new objects to bind the
  same as the existing ones?  in other words... let's say i have this:

  $('.foo').click(function() { doSomething()});

  when i insert new .foo objects, i want them to also have their click
  event bound to doSomething().  is there a built-in jquery method to do
  this?  or do i simply need to do the binding as the new object is
  added?

  thanks!



[jQuery] Re: PHP variable into jQuery

2007-10-18 Thread James Dempster

If all these checkboxes are in the same container where no other
checkboxes are you can use somthing like this
$('#id input:checkbox:checked').length

Or if there are other checkboxes in the way you can give all these
checkboxes the same class name and do
$('#id input.classname:checkbox:checked').length

Think these should both work, if I've understood what you are asking
for.

On Oct 18, 8:41 pm, choffman [EMAIL PROTECTED] wrote:
 Hello,
 I have a form where the values are pulled from MySQL and looped
 through using PHP. The name and id values are create dynamically.

 For example HTML:
 Item A input type=checkbox name=event_id_22 id=eid_22 / 
 Item B input type=checkbox name=event_id_23 id=eid_23 / 

 For example PHP:
 Item A input type=checkbox name=event_id_$value id=eid_$value /

 Item B input type=checkbox name=event_id_$value id=eid_$value /



 I'm using jQuery to count the boxes that get checked.  How can I get
 jQuery to see my PHP variable so it can count the number of boxes that
 get checked?  Thoughts?

 $(document).ready(function() {
 $(#eid_??).click(function() {
 if (this.checked == true) {
 var event_id = $(#eid_??).length;
 $(#eventItems).text(event_id);
 }

 if (this.checked == false) {
 $(#eventItems).empty();
 }
 });

 });



[jQuery] Re: IE6 Stylesheet Woes

2007-10-09 Thread James Dempster
Hmm interestingly odd issue. Boo Boo to M$ IE

/James

On 10/9/07, Andy Kent [EMAIL PROTECTED] wrote:


 Thanks a heap for your help James, after lots of trial and error I
 managed to track down the source of the problem.

 It's a very curious IE issue, your examples work fine provided you
 don't try to access document.stylesheets first, if you do then that
 seems to kick IE off on a parsing spree.

 Oh well, all fixed now, thanks for your help.

 Andy.


 On 8 Oct, 17:03, James Dempster [EMAIL PROTECTED] wrote:
  Thats strange, I've added lots of strange chars and it still works ok
 for
  me.
 
  Screenshots
 .http://www.jdempster.com/public/jss/ie6.pnghttp://www.jdempster.com/public/jss/ie7.pnghttp://www.jdempster.com/public/jss/ff2.png
 
  I did test it in more but these will do for now. Can any one else check
  their IE?
 
  /James
 
  On 10/8/07, Andy Kent [EMAIL PROTECTED] wrote:
 
 
 
   This has the same issue I'm afraid.
 
   It works for all those examples as IE thinks they are valid. Give
   something like div~p:first a go though and I you get the selector
   replaced with the string 'UNKOWN' in the innerHTML source code.
 
   Thanks for the attempt but sill no prize yet!
 
   :( *tears*
 
   Andy.
 
   On 8 Oct, 14:43, James Dempster [EMAIL PROTECTED] wrote:
I've pinched some code from Christian Bach (
 http://lovepeacenukes.com/
jquery/ie6cssfix/) and put it into it's own test case. Tested it on
Win IE 6/7, FF 1.5/2, Safari3, Opera 9 and they all showed the same
results.
 
Test it out. Hopefully it can help
   .http://www.jdempster.com/public/jss/js_css.html
 
On Oct 8, 11:29 am, Andy Kent [EMAIL PROTECTED] wrote:
 
 Unfortunately after some experimentation this method still appears
 to
 yield 'UNKNOWN' in place of selectors that are not understood by
 IE.
 
 Poo.
 
 On 8 Oct, 11:15, Andy Kent [EMAIL PROTECTED] wrote:
 
  Thanks Mike, that's a huge help and sounds like it will solve my
  problem perfectly. I will have a play now.
 
  Should jQuery not be clever enough to handle this internally
 when
   you
  call .text() on a style element?
  Is it worth filing as a bug do you think?
 
  Andy.
 
  On 8 Oct, 11:07, Michael Geary [EMAIL PROTECTED] wrote:
 
   Andy, you can read or write the content of an IE stylesheet
 with:
 
  $('style')[n].styleSheet.cssText
 
   where n is the index of the stylesheet you want.
 
   Instead of browser detection, I test for the presence of that
   .styleSheet
   property, and then either use .styleSheet.cssText or .text()
   depending.
 
   Some example non-jQuery code that I use (shows writing and
   replacing but not
   reading):
 
   function addStyle( css ) {
   var style = document.createElement( 'style' );
   style.type = 'text/css';
   head.appendChild( style );
   if( style.styleSheet )
   style.styleSheet.cssText = css;
   else
   style.appendChild( document.createTextNode(css) );
   return style;
   }
 
   function changeStyle( style, css ) {
   if( style.styleSheet )
   style.styleSheet.cssText = css;
   else
   style.replaceChild( document.createTextNode(css),
   style.firstChild );
   return style;
   }
 
   -Mike From: Andy Kent
 
I'm working on fixing my JSS plugin for IE, it appears that
IE has really problems with showing you the source of
stylesheets that are between style tags.
 
$('style').text() - returns null
 
$('style').html() - returns the source but it is modified,
e.g. all non-supported selectors are changed to 'UNKOWN'
(very unhelpful!)
 
Before I delve deeper into this does anyone have a work
around already??
 
I assume this is supposed to be some sort of security
 feature
but it seems very strange seeing as loading external styles
works as expected.
 
Thanks,
Andy.


 



[jQuery] Re: Replacing text based on language selection

2007-10-09 Thread James Dempster

Do you have an example of the problem you are getting?
Do you get any javascript errors?
Have you ensured characters are correctly encoded?

On Oct 9, 7:44 pm, Danjojo [EMAIL PROTECTED] wrote:
 Update: I figured out it is actually working , but only in FireFox 2+

 ANything I can do differently to adjust it to work in IE7 and IE6?  We
 can always fall back and demo in FireFox, but I would rather learn of
 the solution.

 THanks guys.

 On Oct 9, 1:53 pm, Danjojo [EMAIL PROTECTED] wrote:

  I think what I need to do will work... I just ran into a road block.
  One of my co-workers has filled out an XML sheet for me, with REAL
  japanese values i.e.

  subAboutLocUSロケーション/subAboutLoc
  subAboutWWグローバルロケーション/subAboutWW
  subAboutProductOverview製品概要/subAboutProductOverview
  subAboutTradeShows展示会/subAboutTradeShows
  subAboutEduTrainingセミナーamp; トレーニング/subAboutEduTraining
  subAboutCareerOpps就職案内/subAboutCareerOpps
  subAboutFinancial財政情報/subAboutFinancial
  subAboutSMCHistory会社沿革 History/subAboutSMCHistory
  subAboutOrderTrackオーダートラッキング/subAboutOrderTrack

  My Jquery worked on a test I did for a German Sheet where I just
  changed it to read German Locations if the language_sheet_de.xml had
  been loaded because that was the value in the subAboutLoc tag.

  But it is NOT working and displaying it for the Japanese style sheet.
  My web page still says US Locations in that menu spot. The JQuery is:

  // Load XML document based on language
  var langSheet = language_sheet_ + country + .xml
  $.ajax({
  type: GET,
  url: langSheet,
  dataType: xml, // specify the return type as xml
  success: function(xmlDoc){
  $(xmlDoc).find('subAboutLoc').each(function(){
  var item_text = $(this).text();
  $('#subAboutLoc').text(item_text);
  });

  }
  });

  And at the top of the XML file is:
  ?xml version=1.0 encoding=utf-8 ?



[jQuery] Re: IE6 Stylesheet Woes

2007-10-08 Thread James Dempster

I've pinched some code from Christian Bach (http://lovepeacenukes.com/
jquery/ie6cssfix/) and put it into it's own test case. Tested it on
Win IE 6/7, FF 1.5/2, Safari3, Opera 9 and they all showed the same
results.

Test it out. Hopefully it can help.
http://www.jdempster.com/public/jss/js_css.html

On Oct 8, 11:29 am, Andy Kent [EMAIL PROTECTED] wrote:
 Unfortunately after some experimentation this method still appears to
 yield 'UNKNOWN' in place of selectors that are not understood by IE.

 Poo.

 On 8 Oct, 11:15, Andy Kent [EMAIL PROTECTED] wrote:

  Thanks Mike, that's a huge help and sounds like it will solve my
  problem perfectly. I will have a play now.

  Should jQuery not be clever enough to handle this internally when you
  call .text() on a style element?
  Is it worth filing as a bug do you think?

  Andy.

  On 8 Oct, 11:07, Michael Geary [EMAIL PROTECTED] wrote:

   Andy, you can read or write the content of an IE stylesheet with:

  $('style')[n].styleSheet.cssText

   where n is the index of the stylesheet you want.

   Instead of browser detection, I test for the presence of that .styleSheet
   property, and then either use .styleSheet.cssText or .text() depending.

   Some example non-jQuery code that I use (shows writing and replacing but 
   not
   reading):

   function addStyle( css ) {
   var style = document.createElement( 'style' );
   style.type = 'text/css';
   head.appendChild( style );
   if( style.styleSheet )
   style.styleSheet.cssText = css;
   else
   style.appendChild( document.createTextNode(css) );
   return style;
   }

   function changeStyle( style, css ) {
   if( style.styleSheet )
   style.styleSheet.cssText = css;
   else
   style.replaceChild( document.createTextNode(css),
   style.firstChild );
   return style;
   }

   -Mike From: Andy Kent

I'm working on fixing my JSS plugin for IE, it appears that
IE has really problems with showing you the source of
stylesheets that are between style tags.

$('style').text() - returns null

$('style').html() - returns the source but it is modified,
e.g. all non-supported selectors are changed to 'UNKOWN'
(very unhelpful!)

Before I delve deeper into this does anyone have a work
around already??

I assume this is supposed to be some sort of security feature
but it seems very strange seeing as loading external styles
works as expected.

Thanks,
Andy.



[jQuery] Re: IE6 Stylesheet Woes

2007-10-08 Thread James Dempster
Thats strange, I've added lots of strange chars and it still works ok for
me.

Screenshots.
http://www.jdempster.com/public/jss/ie6.png
http://www.jdempster.com/public/jss/ie7.png
http://www.jdempster.com/public/jss/ff2.png

I did test it in more but these will do for now. Can any one else check
their IE?

/James

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


 This has the same issue I'm afraid.

 It works for all those examples as IE thinks they are valid. Give
 something like div~p:first a go though and I you get the selector
 replaced with the string 'UNKOWN' in the innerHTML source code.

 Thanks for the attempt but sill no prize yet!

 :( *tears*

 Andy.

 On 8 Oct, 14:43, James Dempster [EMAIL PROTECTED] wrote:
  I've pinched some code from Christian Bach (http://lovepeacenukes.com/
  jquery/ie6cssfix/) and put it into it's own test case. Tested it on
  Win IE 6/7, FF 1.5/2, Safari3, Opera 9 and they all showed the same
  results.
 
  Test it out. Hopefully it can help
 .http://www.jdempster.com/public/jss/js_css.html
 
  On Oct 8, 11:29 am, Andy Kent [EMAIL PROTECTED] wrote:
 
   Unfortunately after some experimentation this method still appears to
   yield 'UNKNOWN' in place of selectors that are not understood by IE.
 
   Poo.
 
   On 8 Oct, 11:15, Andy Kent [EMAIL PROTECTED] wrote:
 
Thanks Mike, that's a huge help and sounds like it will solve my
problem perfectly. I will have a play now.
 
Should jQuery not be clever enough to handle this internally when
 you
call .text() on a style element?
Is it worth filing as a bug do you think?
 
Andy.
 
On 8 Oct, 11:07, Michael Geary [EMAIL PROTECTED] wrote:
 
 Andy, you can read or write the content of an IE stylesheet with:
 
$('style')[n].styleSheet.cssText
 
 where n is the index of the stylesheet you want.
 
 Instead of browser detection, I test for the presence of that
 .styleSheet
 property, and then either use .styleSheet.cssText or .text()
 depending.
 
 Some example non-jQuery code that I use (shows writing and
 replacing but not
 reading):
 
 function addStyle( css ) {
 var style = document.createElement( 'style' );
 style.type = 'text/css';
 head.appendChild( style );
 if( style.styleSheet )
 style.styleSheet.cssText = css;
 else
 style.appendChild( document.createTextNode(css) );
 return style;
 }
 
 function changeStyle( style, css ) {
 if( style.styleSheet )
 style.styleSheet.cssText = css;
 else
 style.replaceChild( document.createTextNode(css),
 style.firstChild );
 return style;
 }
 
 -Mike From: Andy Kent
 
  I'm working on fixing my JSS plugin for IE, it appears that
  IE has really problems with showing you the source of
  stylesheets that are between style tags.
 
  $('style').text() - returns null
 
  $('style').html() - returns the source but it is modified,
  e.g. all non-supported selectors are changed to 'UNKOWN'
  (very unhelpful!)
 
  Before I delve deeper into this does anyone have a work
  around already??
 
  I assume this is supposed to be some sort of security feature
  but it seems very strange seeing as loading external styles
  works as expected.
 
  Thanks,
  Andy.


 



[jQuery] Re: How do I get this to fade in

2007-10-08 Thread James Dempster

I'm not sure if the script you have quite makes sense to me. But I've
added where I think it should go.

script type=text/javascript
$(document).ready(function(){
$(.thumbnail li).click(function(){
$(#large li).html($
(this).html()).hide().fadeIn('slow');
return false;
});
});
/script

Hope it helps :¬)

/James

On Oct 8, 11:47 am, skinnytiger [EMAIL PROTECTED] wrote:
 I'm using the below script to load html into a placeholder, it all
 looks groovy but I want it to fade in, where do I add the .fadeIn() to
 get this to work?

 script type=text/javascript
 $(document).ready(function(){
 $(.thumbnail li).click(function(){
 $(#large li).html($(this).html());
 return false;
 });

 });

 /script



[jQuery] Re: Problems with jQuery Firefox

2007-10-07 Thread James Dempster

Nope never had a problem with firefox and jQuery.

Do you have an example?

On Oct 6, 10:39 pm, tramblie [EMAIL PROTECTED] wrote:
 The jQuery's Ajax Requests (and some other) API won't work with
 Firefox (2.0.0.7) has someone noticed the same problem? Is it an
 incompatibility, a bug or what?



[jQuery] Re: TableSorter - Storing Sorted Columns To Restore After Ajax Call

2007-10-06 Thread James Dempster

Your quite welcome to use the tablesorter cookie widget.
http://www.jdempster.com/category/code/jquery/tablesortercookiewidget/

On Oct 6, 6:54 pm, zacware [EMAIL PROTECTED] wrote:
 I have a page whereby everytime it receive focus the tables on it refreshes
 automatically so the user always has the latest data

 I want to store the currently selected sort order from tablesorter so that
 after I re-create the table again I can specify what the users sort order
 was before the table was recreated

 Any suggestions on how I do that? I see using FireBug that the sorted
 columns have sortcol, sortdesc in them but was wondering if there was an
 existing to get this data rather than coming up with my own method.

 --
 View this message in 
 context:http://www.nabble.com/TableSorter---Storing-Sorted-Columns-To-Restore...
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: tablefilter preview

2007-10-03 Thread James Dempster
Sorry things have been moving rather slowly I am still working on it, just
don't have much free time right now :(

But when it is complete it will work in IE.

/James

On 10/3/07, Jesse Klaasse [EMAIL PROTECTED] wrote:



 Great efforts so far! I think I will be using your plugin when it's
 ready..
 For now, just one comment: the plugin doesn't work in IE7, I get a
 javascript error Object doesn't support this action.
 Please keep us posted!


 LetsSurf wrote:
 
  I've been writing a tablefilter plugin to sit along side tablesorter
  from Christian Bach. It will supply multi column filtering. Have
  support for different filter types, e.g. text (case sensitive/
  insensitive), numeric, regex + any more people might add.
  [...]
  I'm releasing a preview, to get some feedback on the UI.
 

 --
 View this message in context:
 http://www.nabble.com/tablefilter-preview-tf4521631s27240.html#a12976215
 Sent from the jQuery General Discussion mailing list archive at Nabble.com
 .


 



[jQuery] Re: How to add/remove dynamic blocks of html

2007-10-02 Thread James Dempster
I'd total agree with what Michael said. Infact HTML coding guidelines and
W3C Standards say that HTML quotes should be double 
Also as a PHP developer I tend to use single quotes ' for programming, but
that's because in PHP it doesn't use the parse engine looking for varibles,
but thats a different topic ;) So I tend to also use single quotes in
Javascript, it's just easier that way.

/James

On 10/2/07, Michael Geary [EMAIL PROTECTED] wrote:


  From: James Dempster
 
  Much nicer to split the lines making it more readable.
 
  $(this).parent().append([
  p,
  input type='text' class='+inputClass+',
  button onclick='$(this).parent().remove();return
 false;'x/button,
  /p
  ].join());

 Also, once you're using .join, you don't have to use + inside it; you can
 use comma for all your string concatenation. And there's a missing / in
 the
 input tag, so let's fix that:

 $(this).parent().append([
  p,
  input type='text' class=', inputClass, ' /,
  button onclick='$(this).parent().remove();return
 false;'x/button,
  /p
 ].join());

 Finally, this is purely stylistic, but I like to put the begin tags and
 end
 tags on separate lines to make it easier to make sure they are matched up,
 and also (really getting into personal preference here) I like to swap
 around the  and ' quote marks, using  as the HTML quote and ' as the
 JavaScript quote:

 $(this).parent().append([
  'p',
  'input type=text class=', inputClass, ' /',
  'button onclick=$(this).parent().remove();return false;',
  'x',
  '/button',
  '/p'
 ].join(''));

 I do the quotes this way because seems a lot more common to use  in HTML
 code, and because I type a lot more JavaScript quotes than HTML quotes, so
 using ' for the JavaScript quotes makes it a tiny bit easier to type. :-)

 -Mike


 



[jQuery] Re: How to add/remove dynamic blocks of html

2007-10-01 Thread James Dempster
One of the greatest things about jQuery though is that the code is quite
easy to read and understand, so if unsure just check. If still unsure, then
what a great active community though the groups !

Love the tips, it might be quite nice if maybe the core could be changed to
accept an array (maybe it already does) maybe it would be an extra overhead
that's not needed.

/James

On 10/1/07, Michael Geary [EMAIL PROTECTED] wrote:


 Glad you like the [].join('') trick, Howard - and good catch on the
 unnecessary wrapper. You didn't miss anything, and that
 simplifies the example down to:

   $('#exampleCA').append( [
   'table style=width:718px;border:2px inset #336699',
   'tr class=exampleRow',
   'td style=text-align:center;color:white;',
   'I was created by jQuery append',
   '/td',
   '/tr',
   '/table'
   ].join('') );

 One other thing I like about this approach is that - unlike the +
 concatenation operator - the comma operator has lower precedence
 than the ? : conditional operator and the || and  logical operators. So
 you can write code like this:

   var html = [
  'div',
 name ? name : 'no name',
  '/div'
   ].join('');

 You could do that with string concatenation, but it would require
 parenthesis around the conditional expression, which adds a bit of
 ugliness.

 You're right on the appendTo vs. append question too - the docs need to be
 updated. Check the source code:

jQuery.each({
   appendTo: append,
   prependTo: prepend,
   insertBefore: before,
   insertAfter: after,
   replaceAll: replaceWith
}, function(i,n){
   jQuery.fn[ i ] = function(){
  var a = arguments;
  return this.each(function(){
 for ( var j = 0, al = a.length; j  al; j++ )
jQuery(a[j])[n]( this );
  });
   };
});

 appendTo is just a wrapper around append - just like prependTo, etc. And
 all of these functions run their arguments through
 domManip(), which is the code that handles the text vs. DOM element
 question.

 I wouldn't assume that any jQuery function that takes a string will also
 take DOM elements or jQuery objects, but for this group of
 functions it's certainly true.

 -Mike

  From: howardk
 
  Nice use of join()! I'm new to JavaScript and jQuery both,
  and it's nice to come across little snippets like this I can
  readily add to my jQuery repetoire and that slightly expand
  my understanding of JavaScript.
 
  By the way, the docs show that it's legal to pass, as an
  argument to append(), either a jQuery object (as you're
  doing), a DOM element, or a string. So you really don't need
  to wrap the stringified array in a jQuery object before you
  pass it in. Unless there's another reason for doing so that
  I'm missing.
 
  Apropos to the above, I wonder why the docs for appendTo()
  show a string as being the only legal argument type? I tried
  a test passing in a jQuery object instead and it worked just
  fine. Does that mean you can use a jQuery object *any* time a
  string is called for in other jQuery methods as well? Or just
  a case of the documentation needing to be adjusted in this one case?


 



[jQuery] Re: How to add/remove dynamic blocks of html

2007-10-01 Thread James Dempster

I think this it what your trying todo...

$(this).parent().append([p, input type='text' class='+inputClass
+', button onclick='$(this).parent().remove();return false;'x/
button, /p].join());

Much nicer to split the lines making it more readable.

$(this).parent().append([
p,
input type='text' class='+inputClass+',
button onclick='$(this).parent().remove();return false;'x/
button,
/p
].join());

hope this helps

On Oct 1, 5:29 pm, Matt [EMAIL PROTECTED] wrote:
 Hi everyone,
 I have been using FlyDOM, and am trying to convert some of that code
 to use the jQuery append, after reading what Mike wrote about better
 performance. I am trying to dynamically insert some attributes.
 However I'm getting a syntax error, so I think I'm not understanding
 something simple here on how the append/join syntax works. Here is an
 example:

 $($(this).parent()).append([p,input type='text'
 class='+inputClass+',button onclick: '+$
 (this).parent().remove();return false;+',/p].join());

 I get an: missing ] after element list error in Firebug. Any thoughts?
 Thanks.

 Matt

 On Sep 29, 11:17 am, Michael Geary [EMAIL PROTECTED] wrote:

   From: James Dempster

   I've never really understood the point to FlyDOM. It seems
   like a nice idea, but whats wrong with just using jQuery?

   FlyDOM
   $('#exampleCA').createAppend(
   'table', { width: '718px', style: 'border: 2px inset #336699;' }, [
   'tr', { className: 'exampleRow' }, [
   'td', { align: 'center', style: 'color: white;' },
   'I was created by createAppend()!'
   ]
   ]
   );

   jQuery
   $('#exampleCA').append($(
   'table style=width:718px;border:2px inset #336699'+
   'tr class=exampleRow'+
   'td style=text-align:center;color:white;'+
   'I was created by jQuery append'+
   '/td'+
   '/tr'+
   '/table'
   ));

   As far as I can tell both of these would do the same thing?
   They're both as easy as each other, maybe jQuery is even
   easier as it's plain html. Would the jQuery version be faster
   also as it could just inject the html into the DOM using
   something like innerHTML.

  Yes indeed, innerHTML is faster than DOM insertion, and you also remove the 
  overhead of the code that interprets the element list.

  In fact, I wrote the first jQuery DOM plugin, and I don't use my own plugin 
  any more!

  You can improve the speed even more by using [].join instead of string 
  concatenation:

   $('#exampleCA').append($( [
   'table style=width:718px;border:2px inset #336699',
   'tr class=exampleRow',
   'td style=text-align:center;color:white;',
   'I was created by jQuery append',
   '/td',
   '/tr',
   '/table'
   ].join('') ));

  In your simple test case it won't make any difference, but if you are 
  stringing together a lot of HTML code, [].join will speed it
  up in most browsers.

  -Mike



[jQuery] Re: How to add/remove dynamic blocks of html

2007-09-29 Thread James Dempster

I've never really understood the point to FlyDOM. It seems like a nice
idea, but whats wrong with just using jQuery?

FlyDOM
$('#exampleCA').createAppend(
'table', { width: '718px', style: 'border: 2px inset #336699;' },
[
'tr', { className: 'exampleRow' }, [
'td', { align: 'center', style: 'color: white;' }, 'I was
created by createAppend()!'
]
]
);

jQuery
$('#exampleCA').append($(
'table style=width:718px;border:2px inset #336699'+
'tr class=exampleRow'+
'td style=text-align:center;color:white;'+
'I was created by jQuery append'+
'/td'+
'/tr'+
'/table'
));

As far as I can tell both of these would do the same thing? They're
both as easy as each other, maybe jQuery is even easier as it's plain
html. Would the jQuery version be faster also as it could just inject
the html into the DOM using something like innerHTML.

Any ideas?


On Sep 29, 5:14 pm, Glen Lipka [EMAIL PROTECTED] wrote:
 I suggest LiveQuery.  Really easy to use.  I haven't tried the other.
 Also check out the FlyDOM plugin.  Might be 
 useful.http://jquery.com/plugins/project/FlyDOM

 Glen

 On 9/29/07, goodieboy [EMAIL PROTECTED] wrote:



  Hi,

  I've created code to dynamically add blocks of form elements to a
  form. Basically, a set of text fields and radio buttons. It seems to
  work fine now, but my code is completely dependent on the structure of
  the html, which is expected I guess and I'd like to do is simplify my
  code. Because I'm adding new html which needs to have events attached
  to specific items, I have to re-attach each event handlers. I wonder,
  would it be better to use something like LiveQuery or the Intercept
  plugin? How are people handling this type of thing?

  Thanks,
  Matt



[jQuery] Re: How to add/remove dynamic blocks of html

2007-09-29 Thread James Dempster
Thanks Mike, that is nice to know. Ofcourse all that could go on one line
but I dont find it very readable and will be doing what you mentioned from
now on.

On 9/29/07, Michael Geary [EMAIL PROTECTED] wrote:


  From: James Dempster
 
  I've never really understood the point to FlyDOM. It seems
  like a nice idea, but whats wrong with just using jQuery?
 
  FlyDOM
  $('#exampleCA').createAppend(
  'table', { width: '718px', style: 'border: 2px inset #336699;' }, [
  'tr', { className: 'exampleRow' }, [
  'td', { align: 'center', style: 'color: white;' },
  'I was created by createAppend()!'
  ]
  ]
  );
 
  jQuery
  $('#exampleCA').append($(
  'table style=width:718px;border:2px inset #336699'+
  'tr class=exampleRow'+
  'td style=text-align:center;color:white;'+
  'I was created by jQuery append'+
  '/td'+
  '/tr'+
  '/table'
  ));
 
  As far as I can tell both of these would do the same thing?
  They're both as easy as each other, maybe jQuery is even
  easier as it's plain html. Would the jQuery version be faster
  also as it could just inject the html into the DOM using
  something like innerHTML.

 Yes indeed, innerHTML is faster than DOM insertion, and you also remove
 the overhead of the code that interprets the element list.

 In fact, I wrote the first jQuery DOM plugin, and I don't use my own
 plugin any more!

 You can improve the speed even more by using [].join instead of string
 concatenation:

 $('#exampleCA').append($( [
  'table style=width:718px;border:2px inset #336699',
  'tr class=exampleRow',
  'td style=text-align:center;color:white;',
  'I was created by jQuery append',
  '/td',
  '/tr',
  '/table'
 ].join('') ));

 In your simple test case it won't make any difference, but if you are
 stringing together a lot of HTML code, [].join will speed it
 up in most browsers.

 -Mike


 



-- 
/James


[jQuery] tablefilter preview

2007-09-26 Thread James Dempster

Hi Group,

I've been writing a tablefilter plugin to sit along side tablesorter
from Christian Bach. It will supply multi column filtering. Have
support for different filter types, e.g. text (case sensitive/
insensitive), numeric, regex + any more people might add.

It will be optional on wether to add the UI or not, allowing people to
create there own is they so wish. Utilising the filter events which
are bound to each thead th allowing you to trigger these events from
your own UI.

I'm releasing a preview, to get some feedback on the UI.

One of the things I'm struggling with is where and how I should go
about adding support for table level filtering, the column level
filtering seems fine. Should I simply add another filter icon just
above the table?

The other thing, thanks to some feedback from Christian I added multi
language support for the UI, but currently the filterBox UI is only
created the once, then is simple shown and hidden with the form values
being change. This means if the user changes the language after the
initial creation of the filterBox the language change is ignored. What
are people thoughts on this? Should I recreate the filterBox UI,
change the wording to the new language?

This is a preview release to get some feedback, it's still a work in
progress. Any feedback welcome.

Link: 
http://code.jdempster.com/jquery/trunk/tablefilter/jquery.tablefilter.example.html



[jQuery] Re: tablefilter preview

2007-09-26 Thread James Dempster
Some really good ideas there that I hadn't thought of.

Think your right about the multipule conditions that would be very awesome.
It's going to take some more time and thinking though.

Filters like 35 using the filtertype numeric already work, but  35 and
90 don't. I like your ideas and your feedback and will start to implement
them. Don't know how long it's going to take me but I'm sure this plugin
will be pretty good when it's all done.

Thanks for you feedback.
/James

On 9/26/07, Chris [EMAIL PROTECTED] wrote:


 I like the looks of the UI, but when I implemented some table
 filtering for my own purposes, I need more functionality. (My UI was
 terrible so no help there.)

 For numeric data I needed relational filters, e.g.,  35 and
 multiple filters, e.g.,  35 and  90. That made the UI for adding
 and removing filters more complex, but perhaps single numeric filters
 could work if you had a suitable simple grammar for multiple
 conditions.

 For text fields, I also needed to be able to say give me rows that do
 NOT contain regexp


 



[jQuery] Re: filter not working when expression contains spaces

2007-09-26 Thread James Dempster

The filter you specified is one rule with two elements described in
it. Being firstly an element with a class attribute containing myClass
with a child anchor element. Maybe you possibly mean a.myClass meaning
an anchor element which has a myClass class attribute? As I think
filter will only apply the rule to the element and not check children
elements.

On Sep 26, 5:21 pm, duff [EMAIL PROTECTED] wrote:
 Hi all,

 I have started to use Jquery a couple month ago, and i really love the
 framework.

 I am currently working on an event delegation plugin, attaching
 generic event to the document and applying filters to the target
 element to determine if an event should be applied.

 I have however noticed some weird behavior for the .is() and .filter()
 function :

 I am using the latest jquery version 1.2.1 and am having some troubles
 with the filter function.

 If you use filter with an expression containing a space ( '.myClass a'
 for example), nothing is filtered at all.

 $('*').filter('.myClass a' );  returns all the nodes on the page.

 Is it the expected behaviour ? Is there other ways to efficiently
 check if a given node matches a given rule ?

 document.addEventListener('click',
 function(target){
 if $(target).is('.myClass a'){
   //do sth
 }
 if 
 $(target).is('.myOtherClass a'){
   //do sth else
 }
  }
 );

 Thanks



[jQuery] Re: Tablesorter 2.0

2007-09-14 Thread James Dempster

The problem with Zebra Striping widget in tablesorter is because it
uses a little bit of xpath, which has been taken out of jQuery 1.2, to
fix this replace the format function on line 819 or around there with

$( tbody:first  tr:visible,table)
  .filter(':even')
  
.removeClass(table.config.widgetZebra.css[1]).addClass(table.config.widgetZebra.css[0])
  .end().filter(':odd')
  
.removeClass(table.config.widgetZebra.css[0]).addClass(table.config.widgetZebra.css[1])
;
I've changed the way it works, benchmarks show that this method is
faster
If you want to keep the same function the simpler change is to replace
the / with  in the jQuery expression its around about the same line.

I've also noticed that if you have any events bound to items within
the table, they are lost on sort. After some kind help from Brandon
Aron we worked out that the changes to the empty() in 1.2 is much
better on memory management and cleans the bound events from the
browser. To fix this change around line 245 to
  tableBody = $(tbody:first,table),
  rows = [];
  tableBody.innerHTML = '';

This has been tested in most browsers but needs to be checked out
fully by Christian Bach developer of tablesorter, I've not seen him
online for a while, but as soon as I do I'll point him in this
direction.

Hope this helps.

On Sep 14, 9:39 pm, pixelwizzard [EMAIL PROTECTED] wrote:
 Hi all I just ran into a problem with Tablesorter and JQuery 1.2 now
 working with the zebra.  had to go back to JQuery 1.1.3.  Anyone know
 what happened?

 On Sep 11, 9:09 am, rortelli [EMAIL PROTECTED] wrote:

  Hi all,tablesorter2.0 has some strange behaviours with jQuery 1.2, thezebra
  stripes seems not to work correctly... ;)

  On Sep 10, 11:55 am, [EMAIL PROTECTED]

  [EMAIL PROTECTED] wrote:
   Hello,

   On 20 aug, 11:33, lukek [EMAIL PROTECTED] wrote:

By the way I had another question. -- In the unpacked version of the
latest script your comment on line 555 says apply easy methods that
trigger binded events.

Does this mean I can insert function calls in here - ie around line
560?

I say this because I have added a call to applyWidget() as I reckon
all the widgets should be reloaded when the update event is triggered
- eg after I insert rows I want to reapply thezebrawidget.

   I'm not sure if this helps anyone, but as this thread gave some
   pointers for my issue, here goes:

   I also wanted to reapply thezebrawidget each time I add rows to the
   table. However in my case the rows are coming from an AJAX query,
   similar tohttp://tablesorter.com/docs/example-ajax.html
   The example there just applies a defined sorting when new data arrives
   with triggering sorton (after update) - this will also reapply the
  zebrafrom the sort operation. However I didn't want to loose the
   sorting that the user might have had already changed to, away from the
   default, and I wanted the arriving data to get sorted into the pre-
   existing data according to the sort selection. I didn't find a good
   way to get to the configuration saved, so I just ended up with this:

   $(table).trigger(update);
   var current_sort = $(table.tablesorter).get(0).config.sortList;
   $(table).trigger(sorton, [current_sort]);

   Hopefully there already is (that I don't know of yet), or will be, a
   good way to keep the sorting selection in tact. Maybe something like
   this in tablesorter2 itself:

   $this.bind(resort, function(e) {
   // update header count index
   updateHeaderSortCount(this,sortList);

   //set css for headers
   setHeadersCss(this,$headers,config.sortList,sortCSS);

   // sort the table and append it to the dom
   appendToTable(this,multisort(this,config.sortList,cache));

   });

   Some of these calls (like setHeadersCss) is probably not necessary
   from just a resort, as everything in the headers remains the same.

   Best Regards,
   Mart Raudsepp



[jQuery] Animate scrollTop

2007-08-23 Thread James Dempster

I was wondering if the changes that allow animate scrollTop would be
making it to the next release?

e.g. http://dev.jquery.com/~john/ticket/step/test2.html



[jQuery] Re: Animate scrollTop

2007-08-23 Thread James Dempster
ahh that's brilliant, :¬) what a fantastic page. I very much look forward to
1.2

/James

On 8/23/07, John Resig [EMAIL PROTECTED] wrote:


 http://docs.jquery.com/JQuery_1.2_Roadmap#Animating_scrollLeft.2FscrollTop

 On 8/23/07, James Dempster [EMAIL PROTECTED] wrote:
 
  I was wondering if the changes that allow animate scrollTop would be
  making it to the next release?
 
  e.g. http://dev.jquery.com/~john/ticket/step/test2.html
 
 

 



[jQuery] serverCookieJar, thoughts please

2007-08-15 Thread James Dempster

after Dan G. Switzer, II mentioned here
http://groups.google.com/group/jquery-en/browse_frm/thread/cf786440e6154366/16e79411ae8b118d#16e79411ae8b118d
regarding cookies being sent with every request and the 4KB limit it
got me thinking, maybe store this on the server and make one request
for it each page load, it might make more sense then sending it
backwards and forwards all the time.

So I tried to make serverCookieJar example here
http://www.jdempster.com/wp-content/uploads/2007/08/jquery.servercookiejar.example.html
http://www.jdempster.com/wp-content/uploads/2007/08/jquery.servercookiejar.js

I'm abit unsure about the design regarding line 50  68 where I make a
synchronous ajax request which could tie the browser up until the
request is complete. I think I can safely remove this from the save
function. But for the load function it's important that this data is
brought down before anything else is done.

What are peoples thoughts on this?

/James



[jQuery] Re: stupid dev tricks: gzipping jQuery without mod_deflate

2007-08-15 Thread James Dempster

Before ob_gzhandler() actually sends compressed data, it determines
what type of content encoding the browser will accept (gzip,
deflate or none at all) and will return its output accordingly.

From http://uk.php.net/ob_gzhandler

On Aug 15, 2:33 pm, xavier [EMAIL PROTECTED] wrote:
 This means that :
 1) you assume all clients are able to deal with compressed pages
 2) your server is going to compress it for each visitor.
 3) the headers might or might not be properly dealing with its type.

 With mod_rewrite, they are nice tricks to have a compressed file and
 serve it instead of the normal file if needed.

 Have you tried compressing the js file and send it instead of the file
 without using mod_compress/mod_rewrite ?

 X+

 On Aug 15, 11:08 am, Stephan Beal [EMAIL PROTECTED] wrote:

  Hi, all!

  i'm working on re-designing the web site for my mother's company,
  which was horribly neglected/abused by the previous webmaster, and i
  came across an interesting problem...

  A part of the refactoring is to use jQuery for parts of the site.
  However, since all of the pages use the same site layout template
  (which includes the headers/script tags) yet most of the site won't
  actually use the JS features, i wanted to make the jQ download as tiny
  as possible.

  Unfortunately, i don't have admin rights on my server so i cannot
  activate mod_gzip/mod_deflate to gzip the stuff on the fly. But here's
  an easy workaround...

  Create a PHP file called jquery.php:

  ?php
ob_start( 'ob_gzhandler' );
echo join('',file('jquery-1.1.3.1.pack.js'));
ob_end_flush();
  ?

  Now, in the main site layout template i have:

  script type='text/javascript' src='/include/js/jquery.php'/script

  Firebug confirms that the jQ transfer is then 12k, which is tolerable
  for my purposes.

  It would be only a tiny amount of extra work to integrate the PHP port
  of Dean Edwards' packer, such that the packing is done each time
  jquery.php is called, but that seems like overkill to me.

  This approach could just as easily be used to combine all required JS
  scripts on the fly (just be sure to insert a ';' after each one to
  accommodate scripts which don't have them), then gzip them, to help
  reduce the overall download overhead.



[jQuery] Re: function to return value from ajax

2007-08-14 Thread James Dempster

worked it out guys, silly me it's loading data synchronously instead
of asynchronously. Done by doing...

function test() {
  var html = $.ajax({
   url: some.php,
   async: false // -- heres the key !
  }).responseText;
  return html;
}

:-) thanks all

On Aug 14, 1:54 pm, James Dempster [EMAIL PROTECTED] wrote:
 I'm looking for something that will wait inside the function until it
 has the data to return, so not the callback type system that currently
 exists.
 Something that will mimic this type of stuff will do too.

 e.g.
 function test() {
   $.ajax stuff here
   return data; // return data from the ajax request

 }

 var bler = test();

 On Aug 14, 12:08 pm, SeViR [EMAIL PROTECTED] wrote:

  James Dempster escribió: Is it possible to make a function that returns a 
  value from an ajax
   request. I want the javascript execution to stop until the function
   returns it's value. Inside the function it makes it's ajax request
   then returns a value based on the data returned. Currently I only see
   that a callback function is called.

  You can return HTML or JSON, I prefer JSON:
  your server response:
  {stat: ERROR, msg:Problem with the database.}

  JavaScript:
  $.post(url, {data}, function(json){
  data = eval((+json+));

  if(data.stat == ERROR){
 alert(data.msg);
  }

  });

  This function wait the server response, and run the code when the
  data is back.

  --
  Best Regards,
   José Francisco Rives Lirola sevir1ATgmail.com

   SeViR CW · Computer Design
   http://www.sevir.org

   Murcia - Spain



[jQuery] Re: function to return value from ajax

2007-08-14 Thread James Dempster
This is what my plan is
http://www.jdempster.com/wp-content/uploads/2007/08/jquery.servercookiejar.example.html
http://www.jdempster.com/wp-content/uploads/2007/08/jquery.servercookiejar.js

I can't think of any other way of doing it. Doing it synchronously ensures
that the value has been retrieved from the server before access.

/James

On 8/14/07, Michael Geary [EMAIL PROTECTED] wrote:


 Are you *sure* you want to do this?

 It locks up the browser completely - and all other browser windows in many
 browsers - until the ajax call returns.

 If it's just a matter of coding convenience, balance that against the
 inconvenience it will cause your visitors if the site is slow to respond.

 Or is there another design reason why you need the synchronous call?

 -Mike

  From: James Dempster
 
  worked it out guys, silly me it's loading data synchronously
  instead of asynchronously. Done by doing...
 
  function test() {
var html = $.ajax({
 url: some.php,
 async: false // -- heres the key !
}).responseText;
return html;
  }
 
  :-) thanks all
 
   I'm looking for something that will wait inside the
   function until it has the data to return, so not the
   callback type system that currently exists.
   Something that will mimic this type of stuff will do too.
  
   e.g.
   function test() {
 $.ajax stuff here
 return data; // return data from the ajax request
  
   }
  
   var bler = test();


 



[jQuery] Re: new cookieJar plugin, feedback please

2007-08-13 Thread James Dempster

Very true, 4KB is a large amount of data to send on each request.
Until something like FF storage stuff is more widely implemented then
I think devs have little options.

I was thinking of putting some kind of calculation on how much space
is being used, and some way to inform the developer on reaching the
limit, but I don't know :-/

On Aug 13, 2:02 pm, Dan G. Switzer, II [EMAIL PROTECTED]
wrote:
 LetsSurf,

 I've just finished writing a cookieJar plugin for jQuery, as I
 couldn't find anything like it for jQuery.

 http://www.jdempster.com/category/code/jquery/cookiejar/

 Thought I would post it here in the hope of some feedback.
 Please let me know what you think. Is this a good approach to the
 problem. If you found any problems or have any suggestions.

 Looks interesting, but one suggestion I would make is to put a reminder
 prominently displayed on the page that reminds developers that:

 1) Cookies are sent with each request header.
 2) The total Cookie size per domain is generally 4K (which is per the 
 spechttp://www.ietf.org/rfc/rfc2109.txt.) This is not a per Cookie limit, but 
 a
 total name-value pair.

 Here's what Microsoft says about IE:

 http://support.microsoft.com/kb/306070

 Each cookie begins with a name-value pair. This pair is followed by zero or
 by more attribute-value pairs that are separated by semicolons. For one
 domain name, each cookie is limited to 4,096 bytes. This total can exist as
 one name-value pair of 4 kilobytes (KB) or as up to 20 name-value pairs that
 total 4 KB. If the computer does not have sufficient space to store the
 cookie, the cookie is discarded. It is not truncated. Applications should
 use as few cookies as possible and as small a cookie as possible.
 Additionally, applications should be able to handle the loss of a cookie.

 I only point these out as important as it could be very tempting for a
 developer to want to stick a large JSON packet in a cookie, but they must
 know the repercussions of doing this.

 -Dan