[jQuery] Filter List Items w/ Sub-Lists

2009-08-05 Thread Panman

I have selected a list that contains sub-lists. Now, I'd like to
search for the list items that contain sub-lists (but not including
the sub-list-items). I think the example below will explain what I'm
trying to do.

HTML:

  Do Not Need
  NEED THIS ITEM

  Do Not Need
  Do Not Need

  
  Do Not Need
  NEED THIS ITEM

  Do Not Need
  Do Not Need
  NEED THIS ITEM

  Do Not Need
  Do Not Need

  
  Do Not Need

  
  Do Not Need


jQuery:
$('.start-here li').filter(':has(li)').append('');

The above jQuery statement selects the correct  but also all child
's, which I do not want.


[jQuery] Using each() for multiple $('table') elements

2009-06-10 Thread Panman

I know this is a easy fix, I'm doing something wrong...

I've selected multiple tables and tried to use each for applying
cornering to each table. Inside the callback function, I try to find
the first/last table cells to apply cornering for each corner.
However, when there are multiple tables it looks at _all_ the tr
elements for the first/last rows. See example code:

// Add cornering to tables
$('table.corner-me').addClass('ui-corner-all').each(function(){
var $table = $(this);
$table.find('tr:first :first-child').addClass('ui-corner-tl');
$table.find('tr:first :last-child').addClass('ui-corner-tr');
$table.find('tr:last :first-child').addClass('ui-corner-bl');
$table.find('tr:last :last-child').addClass('ui-corner-br');
});



  
Header 1
Header 2
  
  
Data A1
Data B1
  
  
Data A2
Data B2
  



  
Data A1
Data B1
  
  
Data A2
Data B2
  
  
Data A3
Data B3
  



[jQuery] Tablesorter UI Theme Support

2009-05-29 Thread Panman

This is a double post, at least going to be a double post from in the
jQuery Plugin list. I'm being moderated yet on that list, and it
doesn't seem to get much activity.

--

Hi, I'm going to post this here since the Tablesorter developer hasn't
gotten back to me yet.

I took a copy of the latest version in SVN and modified it to have
jQuery UI Theme support. It seems to work very well and anyone is
welcome to use it. Here are the features:

New Options
--
uiTheme: boolean true/false (default false)
uiThemeIconAsc: string 'icon-class-name' (default  'ui-icon-carat-1-
s')
uiThemeIconDesc: string 'icon-class-name' (default  'ui-icon-carat-1-
n')
uiThemeIconSort: string 'icon-class-name' (default  'ui-icon-carat-2-n-
s')

New Widgets
---
zebraStripes - same thing as zebra, just vertically
checkers - just what it sounds like

Note: zebra and zebraStripes can be used together but zebra must be
first

Download
---
I was hoping this would be included into tablesorter so I just threw
up the modified version on my work site for now. Let me know what you
think!

http://www.stma.k12.mn.us/tablesorter.zip


[jQuery] CSS Style Property Assigned by Class

2009-04-30 Thread Panman

For some reason I cannot get jQuery.css('name') to return a style
property that was assigned by a class. However, it returns the
property if it was assigned by style="". Has anyone else run into this
issue? Bug? Here is my test code:



http://www.w3.org/
TR/html4/strict.dtd">

CSS Test

.apply-border {
  border: 1px solid blue;
}

http://ajax.googleapis.com/ajax/libs/jquery/1.3/
jquery.min.js" type="text/javascript">

$(document).ready(function() {
  $('#byStyle').append($('#byStyle').css('border'));
  $('#byClass').append($('#byClass').css('border'));
});


Border applied by
style = 
Border applied by class = 



[jQuery] Re: Ajax timeout doesn't call error function?

2009-04-21 Thread PanMan

I tried that without the if (see code above) and the error isn't
thrown.
I also used a Jquery JSONP library, and there the error is thrown
(immediately) when the user is offline.
I'm trying to get that same behavior. Adding my own timeout has as
disadvantage that I'd have to wait for that, while the error should
happen immediately when the user is offline.
Any idea's are welcome.
Thanks!
PanMan.

On Apr 20, 4:02 pm, "Mauricio \(Maujor\) Samy Silva"
 wrote:
> >A timeout is not considered an error.
>
> No. It's an error.
>
> Do the following:
>
> "timeout": 1,
>     "error": function(d,msg) {
>
>     if (msg=="timeout") {
>     alert("Ops! Could not load stuff - A timedout error occur");
>     } else {      
>     alert("Could not load stuff  - Another errorType occur");
>     },
> ...
>
> Maurício
>   -Mensagem Original-
>   De: Martijn Houtman
>   Para: jquery-en@googlegroups.com
>   Enviada em: segunda-feira, 20 de abril de 2009 10:47
>   Assunto: [jQuery] Re: Ajax timeout doesn't call error function?
>
>   Hey PanMan,
>
>   On Apr 20, 2009, at 12:28 PM, PanMan wrote:
>
>     This works, but the error is never thrown. If I change the URL to
>
>     something that's broken, I do get the error message, but on timeout it
>
>     never happens.
>
>     Am I doing anything wrong? Or is this a bug somewhere?
>
>   No, this is not a bug. A timeout is not considered an error. You'd be 
> better off using manual timeouts or use some sort of ajax manager.
>
>   For my setup I used a combination of both, in which I set a timer with a 
> certain value for connection timeout, and clear that timer when I actually 
> receive data. The timer calls an anonymous function which aborts the ajax 
> request (and in my case, calls the request again). This works fine for me.
>
>   Regards,
>   --
>   Martijn.


[jQuery] Re: Ajax timeout doesn't call error function?

2009-04-20 Thread PanMan


On Apr 20, 3:03 pm, "Mauricio \(Maujor\) Samy Silva"
 wrote:
> > Hi!
> > I'm trying to setup an ajax call which throws an error on timeout.
> ...
> > "timeout": 1,
> > "error": function(d,msg) {
> >          alert("Could not load stuff");
> >      },
> ...
> > This works, but the error is never thrown. If I change the URL to
> > something that's broken, I do get the error message, but on timeout it
> > never happens.
>
> ---
> Are you sure that your request spends more than 10s ?
>
> Maurício

Hi!
I tried this while offline. The jquery JsonP lib times-out directly
(which would be my preference). But I'm sure nothing loads in 10s,
since I'm offline. (this is for an app over flaky mobile connections).
PanMan.


[jQuery] Ajax timeout doesn't call error function?

2009-04-20 Thread PanMan

Hi!
I'm trying to setup an ajax call which throws an error on timeout.

function getXMLfeed(url, target) {
$.ajax({
"url": url,
"timeout": 1,
"error": function(d,msg) {
  alert("Could not load stuff");
  },
   "success": function(data){
var json = $.xml2json(data);
gotdata(json, target);
}
 });

This works, but the error is never thrown. If I change the URL to
something that's broken, I do get the error message, but on timeout it
never happens.
Am I doing anything wrong? Or is this a bug somewhere?
Thanks!
PanMan.


[jQuery] Select Last

2009-04-02 Thread Panman

Sounds simple but I cannot get it to work. Here is the structure.


  Abc
  Abc

  Abc
  Abc
  123

  
  Abc
  Abc


I want to get the last  in the _sub_ list. Here is what I've tried
with no success. Ideas?

$('.list li li:last a').addClass('last-li');
$('.list li ul li:last a').addClass('last-li');
$('.list li:has(ul) li:last a').addClass('last-li');


[jQuery] Re: jQuery.getScript and Browser Cache

2008-11-11 Thread Panman

True, combining files would be the best option.

I'm thinking in the case where I would like to detect weather or not a
specific plugin is required. So if x element exists then include x
plugin. Just looking for something like the Dojo require, which loads
its' modules.

Another option I thought of is to $('head').append('');

On Nov 11, 3:13 pm, "Michael Geary" <[EMAIL PROTECTED]> wrote:
> Are you going to always be loading these .js files into your page?
>
> If so, the most efficient option by far is to concatenate all of them into a
> single .js file that you load with a single  tag.
>
> Maybe explain more about why you want a bootstrap file, and what exactly you
> want it to do?
>
> -Mike
>
> > From: Panman
>
> > Are browsers able to cache calls from jQuery.getScript
> > (http:// docs.jquery.com/Ajax/jQuery.getScript)? I'm just
> > trying to determine either to use that or just use HTML
> > <script> tags to get jQuery plugin files and such. Would like
> > the most officiant option. The reason being, I'd like to
> > break out the first option into a separate JavaScript file,
> > like a bootstrap file.
>
> > Option 1:
> > <script type="text/javascript" src="/_assets/js/jquery.js">
> > 
> > $.getScript("/_assets/js/jquery.ui.all.js");
> > $.getScript("/_assets/js/jquery.hoverIntent.js");
> > 
>
> > 
>
> > Option 2:
> > 
> > </
> > script>
> > <script type="text/javascript" src="/_assets/js/
> > jquery.hoverIntent.js">


[jQuery] jQuery.getScript and Browser Cache

2008-11-11 Thread Panman

Are browsers able to cache calls from jQuery.getScript (http://
docs.jquery.com/Ajax/jQuery.getScript)? I'm just trying to determine
either to use that or just use HTML  tags to get jQuery plugin
files and such. Would like the most officiant option. The reason
being, I'd like to break out the first option into a separate
JavaScript file, like a bootstrap file.

Option 1: