Re: [jQuery] This code is too complex for a noob, can someone break this down.

2010-01-23 Thread Amos King
submits a row to the server and then updates the content of the approve row
to what is returned from the server.

On Sat, Jan 23, 2010 at 9:06 AM, Bugman1400 wrote:

>
> href="javascript:void(0);" onclick='$.get("do.php",{ cmd: "approve", id:
> " echo $rrows['id']; ?>" } ,function(data){ $("#approve ?>").html(data); });' ?>" });'>Approve
> --
> View this message in context:
> http://old.nabble.com/This-code-is-too-complex-for-a-noob%2C-can-someone-break-this-down.-tp27282222s27240p27286206.html
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.
>
>


-- 
Amos King
http://dirtyInformation.com
http://github.com/Adkron
--
Looking for something to do? Visit http://ImThere.com


Re: [jQuery] Re: how to get href value

2010-01-23 Thread Amos King
Greg, I'm not sure how your's is much diffrent then the original.

On Sat, Jan 23, 2010 at 7:04 AM, Greg Tarnoff wrote:

>
> Actually all of these are slow. The last example will run anytime you
> click the page. You only want to run this if they click an A element.
> So attach a click event to A.   Try this:
>
> $(document).ready(function(){
> $('a').click(function(){
>  alert($(this).attr('href'););
> });
> });
> only do the e.preventDefault(); if you don't want it to go somewhere.
>
> I use this method all the time to get the HREF, always putting it into
> a variable, and affect the page. Usually for things like sliding
> panels. By putting in #myid it remains accessible when JS isnturned
> off.
>
>
> On Jan 23, 4:30 am, Andrei Eftimie  wrote:
> > >> $(document).ready(function() {
> > >>$("a").click(function(event) {
> > >>alert( "You clicked a link to " + this.href );
> > >>return false;
> > >>});
> > >> });
> >
> > This method is very slow.
> >
> > Try using event delegation:
> >
> > $(document).ready(function() {
> > $(document).click(function(event){
> > if ($(event.target).is('a') {
> >  alert( "You clicked a link to " + event.target.href);
> >  return false;
> > }
> > });
> >
> > });
> >
> > --
> > Andrei Eftimiehttp://eftimie.com+40 758 833 281
> >
> > Puncthttp://designpunct.ro
>



-- 
Amos King
http://dirtyInformation.com
http://github.com/Adkron
--
Looking for something to do? Visit http://ImThere.com


[jQuery] Re: 14 Days of jQuery - Donation for free ebook

2010-01-18 Thread Amos King
It says Jan 19 books will be distributed.

On Jan 13, 11:06 am, Peter Duerden  wrote:
> I made adonationvia PayPal that qualifies to receive a random free
> ebook (seehttp://jquery14.com/donate). Just wondering how/when I
> would hear about obtaining the book? Of have I jumped the gun by
> making mydonationtoo early and not "during the 14 Days of jQuery"?


[jQuery] Re: 14 Days of jQuery - Donation for free ebook

2010-01-18 Thread Amos King
Did you ever hear back about this?  I'm in the same boat.

On Jan 13, 11:06 am, Peter Duerden  wrote:
> I made adonationvia PayPal that qualifies to receive a random free
> ebook (seehttp://jquery14.com/donate). Just wondering how/when I
> would hear about obtaining the book? Of have I jumped the gun by
> making mydonationtoo early and not "during the 14 Days of jQuery"?


Re: [jQuery] ZIP with JQeury

2010-01-15 Thread Amos King
If there is a solution I would think that it would be entirely too slow on
any file size worth zipping, and the file would have to already be loaded on
the page.  If you are talking about files to be uploaded from the server I
don't believe there is any way that javascript could be tied to the
filesystem in that way.  If you are using envjs or jsc(macs javascript
console) then you can get to the system, and you could write an algorithm to
zip files.

Amos

On Fri, Jan 15, 2010 at 8:13 AM, waseem sabjee wrote:

> This is usually handled by server side script like ASP or PHP as you have
> to work with either the users file system or your FTP.
> So my answer would be No.
>
> if there is a solution I would like to know it.
>
>
> On Fri, Jan 15, 2010 at 1:46 PM, mind01 wrote:
>
>> Hey there,
>>
>> Is there any solution to make a ZIP file with JQuery or something?
>>
>> Greetz
>>
>
>


-- 
Amos King
http://dirtyInformation.com
http://github.com/Adkron
--
Looking for something to do? Visit http://ImThere.com


Re: [jQuery] Re: plugin dev help

2010-01-15 Thread Amos King
Can someone take another look at the new version and let me know of anything
that stands out that could be better?

http://gist.github.com/277243

Amos

On Fri, Jan 15, 2010 at 1:25 AM, Amos King  wrote:

> Thanks, I saw the metadata plugin today and I started redoing mine.  You
> can take another look at:
>
> http://gist.github.com/277243
>
> Let me know what you think.
>
> Thanks,
> Amos
>
>
> On Fri, Jan 15, 2010 at 1:18 AM, Thomas  wrote:
>
>> When I started writing reusable plugins at work, I've read a couple of
>> tutorials first, but then found this one:
>>
>>
>> http://www.learningjquery.com/2007/10/a-plugin-development-pattern
>>
>>
>> All my plugins since then are based on that pattern, and I strongly
>> felt I've understood every little nuance of why the pattern was like
>> it was. For me, it really is *the* reference on best practices for
>> jquery plugin patterns.
>>
>> The only line that is outdated on that 2+ year old article is the one
>> about how to include the metadata-plugin (which I strongly recommend).
>>
>>
>> Original in the article:
>> var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
>>
>> Updated line:
>> var o = $.metadata ? $.extend({}, opts, $this.metadata()) : opts;
>>
>>
>>
>> On Jan 14, 4:14 pm, Amos King  wrote:
>> > I want to start making parts of my code into plugins, but I'm not sure
>> of
>> > the best way to approach it.  If anyone has any ideas on how to make
>> this a
>> > little better that would be great.
>> >
>> > http://gist.github.com/277243
>> >
>> > Thanks,
>> > Amos
>> >
>> > --
>> > Amos Kinghttp://dirtyInformation.comhttp://github.com/Adkron
>> > --
>> > Looking for something to do? Visithttp://ImThere.com
>>
>
>
>
> --
> Amos King
> http://dirtyInformation.com
> http://github.com/Adkron
> --
> Looking for something to do? Visit http://ImThere.com
>



-- 
Amos King
http://dirtyInformation.com
http://github.com/Adkron
--
Looking for something to do? Visit http://ImThere.com


Re: [jQuery] Resolved

2010-01-15 Thread Amos King
Wouldn't this just compare the first element of the list of objects
returned?

Amos

On Fri, Jan 15, 2010 at 3:45 AM, Sébastien BEIRNAERT <
beirnaert.sebast...@gmail.com> wrote:

> I found out how to compare 2 JQuery object : juste add [0] at the end
> of the JQ object
> ex : $('div.block01')[0] == $('div.block02')[0]
>
> Worked great for me
>
> Bye
>
> Sébastien
>



-- 
Amos King
http://dirtyInformation.com
http://github.com/Adkron
--
Looking for something to do? Visit http://ImThere.com


Re: [jQuery] Re: Select all items in list on form submit

2010-01-15 Thread Amos King
Try tying in to the click event of the submit instead of the submit event.
 Just make sure to return false so the submit doesn't go off.

On Fri, Jan 15, 2010 at 5:12 AM, Richard McKenna <
richardofmcke...@googlemail.com> wrote:

> So here's the full example. What it should do is select all the items
> that have been moved to the right hand side, then submit the form.
>
> http://67.199.29.196/selecttest.cfm
>
>
> On Jan 14, 9:27 pm, pedalpete  wrote:
> > Can you give a bit more detail?
> >
> > Is the submit not firing? or the .each?
> >
> > I always like to give my selectors an element+class/id, apparently it
> > is more efficient, and I have noticed that some browses (it seems only
> > sometimes) will miss some elements when only using the id/class.
> >
> > But throw some alerts in there so you can see what is not firing, and
> > then we can go from there.
>



-- 
Amos King
http://dirtyInformation.com
http://github.com/Adkron
--
Looking for something to do? Visit http://ImThere.com


Re: [jQuery] Re: plugin dev help

2010-01-14 Thread Amos King
Thanks, I saw the metadata plugin today and I started redoing mine.  You can
take another look at:

http://gist.github.com/277243

Let me know what you think.

Thanks,
Amos

On Fri, Jan 15, 2010 at 1:18 AM, Thomas  wrote:

> When I started writing reusable plugins at work, I've read a couple of
> tutorials first, but then found this one:
>
>
> http://www.learningjquery.com/2007/10/a-plugin-development-pattern
>
>
> All my plugins since then are based on that pattern, and I strongly
> felt I've understood every little nuance of why the pattern was like
> it was. For me, it really is *the* reference on best practices for
> jquery plugin patterns.
>
> The only line that is outdated on that 2+ year old article is the one
> about how to include the metadata-plugin (which I strongly recommend).
>
>
> Original in the article:
> var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
>
> Updated line:
> var o = $.metadata ? $.extend({}, opts, $this.metadata()) : opts;
>
>
>
> On Jan 14, 4:14 pm, Amos King  wrote:
> > I want to start making parts of my code into plugins, but I'm not sure of
> > the best way to approach it.  If anyone has any ideas on how to make this
> a
> > little better that would be great.
> >
> > http://gist.github.com/277243
> >
> > Thanks,
> > Amos
> >
> > --
> > Amos Kinghttp://dirtyInformation.comhttp://github.com/Adkron
> > --
> > Looking for something to do? Visithttp://ImThere.com
>



-- 
Amos King
http://dirtyInformation.com
http://github.com/Adkron
--
Looking for something to do? Visit http://ImThere.com


Re: [jQuery] Cloning content with radio buttons

2010-01-14 Thread Amos King
Are you duplicating the whole form?  If so you can just call reset on the
new form you created.  If not I think you can run through and just set the
'selected' attribute on each button to a false.

On Thu, Jan 14, 2010 at 2:08 PM, Essie  wrote:

> Hello all,
>
> I am attempting to duplicate a large area on a form that contains
> input and textareas. However, when cloning the radio buttons, the
> selected items end up on the cloned entry, and do not stay on the
> initial entry like the input, select, and textarea.
>
> I thought this was due to ID's, but even after removing them as a
> test, the issue still occurs. Here is example code:
>
>
> --
> 
>$(document).ready(function(){
>$("#submit").click(function(){
>  $('#test').clone(true).insertAfter('#test');
>});
>});
> 
> 
>  test
> 
> 
>
> --
>
> I realize this is horrible HTML, I'm just using it to get feedback on
> my issue. Either way, with the real code, the IDs and Names are
> changed later down after the clone, and the values are reset to
> nothing.
>
> TIA
>



-- 
Amos King
http://dirtyInformation.com
http://github.com/Adkron
--
Looking for something to do? Visit http://ImThere.com


Re: [jQuery] Re: delay ajax search while using keyup

2010-01-14 Thread Amos King
If you do this on keydown and key up then it will only stop the call when
they have a key pressed.  My suggestion is to set the var on keyup use
setTimeout to call a function one second after the keyup to set the var back
to true.  Create another setTimeout on the keyup for 1.1 seconds that checks
the state of the var and makes the call if it is ready.  Although that may
have some timing issues too.  Good luck.  Give it a little more thought and
I think you can come up with something.

Amos

On Thu, Jan 14, 2010 at 7:57 PM, mslade  wrote:

> Here's what I would do.  Hope this makes sense:
>
>  [0] On key down, set some global state variable to true.
>
>  [1] On key up, set the state variable to false.
>
>  [1a] Then use setTimeout() to have it call a new function in 1 second
> (adjust for usability).
>
>  [2] Your new function will look to to see if the state variable from
> [1] is still false.  If it is false, do your ajax.  If it is not
> false, do nothing.
>
> On Jan 14, 8:20 pm, Info  wrote:
> > Hi There,
> > I have some code (below) that does an ajax call on keyup of a form
> > field. It works great.but I really want to pause the call for 1
> > sec after they do the keyup to allow them to put in some text. Is
> > there a way to take this code and do that?
> >
> > $(document).ready(function(){
> > $('#search').keyup(function() {
> > var searchVal = $('#search').val();
> > $.ajax({
> > type: 'GET',
> > url: 'qryget_customers.php',
> > data: 'search=' + searchVal,
> > dataType: 'html',
> > beforeSend: function() {
> > $('#search_slips').html(' src="../common/images/ajax-
> > loader.gif" alt="loading..." />');
> > },
> > success: function(response) {
> > $('#search_slips').html(response);
> > }
> > });
> > });
> >
> > });
>



-- 
Amos King
http://dirtyInformation.com
http://github.com/Adkron
--
Looking for something to do? Visit http://ImThere.com


Re: [jQuery] Re: Read ajax response headers?

2010-01-14 Thread Amos King
Why do you want an if when the separation of concerns is all there for you?

Amos

On Thu, Jan 14, 2010 at 1:21 PM, bryan  wrote:

> Holy moly, that's beautiful. Thanks so much for your help!
>
>
>
> On Jan 14, 11:04 am, Mike Alsup  wrote:
> > > So if someone has a second, can you let me know if the above code
> > > could potentially get out of sync? Maybe when I create the list item
> >
> > You don't need to use both the success and complete fn.  You can use
> > complete like this:
> >
> > complete: function(xhr, status) {
> > if (status == "success") {
> > $('ul.notes').append('' + xhr.responseText +
> > '');
> > var key = XMLHttpRequest.getResponseHeader('Note-Key');
> > $('ul.notes > li:last-child a').attr('href', '#' + key);
> > }
> >
> >
> >
> > }
>



-- 
Amos King
http://dirtyInformation.com
http://github.com/Adkron
--
Looking for something to do? Visit http://ImThere.com


[jQuery] plugin dev help

2010-01-14 Thread Amos King
I want to start making parts of my code into plugins, but I'm not sure of
the best way to approach it.  If anyone has any ideas on how to make this a
little better that would be great.

http://gist.github.com/277243

Thanks,
Amos

-- 
Amos King
http://dirtyInformation.com
http://github.com/Adkron
--
Looking for something to do? Visit http://ImThere.com


[jQuery] Re: Shortest possible method of adding/removing class on mouseenter/leave without a plugin

2010-01-13 Thread Amos King
css hover is not supported on some browsers.

Amos

On Jan 13, 1:00 pm, MorningZ  wrote:
> i don't understand the ".each" part  jQuery is already going to do
> that
>
> $('#nav > li').bind('mouseenter mouseleave', function() { $
> (this).toggleClass('hover'); });
>
> *should* be equiv, although i must say that's untested
>
> and how about *zero* jQuery code and just using CSS's ":hover" pseudo?
>
> http://www.w3schools.com/css/pr_pseudo_hover.asp
>
> On Jan 13, 1:22 pm, seasoup  wrote:
>
>
>
> > Is this it, or do you have something shorter?
>
> > $('#nav > li').each( function () {
> >         var $this = $(this);
> >         $this.bind('mouseenter mouseleave', function()
> > { $this.toggleClass('hover') });
>
> > });
>
> > I thought hover would work, but it only does the mouseenter with one
> > parameter, instead of doing the same function for both enter and
> > leave.
>
> > $('#nav > li').each( function () {
> >         var $this = $(this);
> >         $this.hover(function() { $this.toggleClass('hover') });   //
> > only mouseover
>
> > });
>
> > which could be abstracted to a hoverClass plugin
> > $('#nav > li').hoverClass('hover');