[jQuery] Re: Is any one else experiencing serious slowdowns on their site due to 'waiting for jqueryui.com' ?

2009-05-02 Thread Alexandre Plennevaux

Hi Stasch,

Be careful before you blame others of wrong deeds... unless you enjoy
making a fool of yourself. Make sure you check the issue is not from
your side as there is absolutely no such code in jquery, nor in
jquery-ui.

My guess is that you did some wild copy/pasting from the jquery-ui
demos, and didn't actually change the URLS. Another possibility is
that one of your plugins calls for jquery right from the server, which
is really not a good idea, as you mentionned.

Otherwise, as Michael just said, post a link so we can really help.


Cheers,

a.

On Sat, May 2, 2009 at 8:18 PM, stasch  wrote:
>
> I was surprised to today to discover that my site was running much
> slower than usual (3 to 4 times slower!).  Most of the delay was spent
> with the message 'waiting for jqueryui.com'.  This really freaked me
> out.  First of all what gives the jquery folks the right to ping their
> site from their code?  Second of all, if they're going to do that
> they'd better make sure that the site they are pinging is super fast.
> Can anybody enlighten me as to what is going on here?  Better yet, how
> can I remove that code from my jquery library?  I can't afford to have
> this kind of performance hit due to uncontrollable 'features' like
> this in my code.  And if I'm legally bound to keep that code in the
> library please advise me so that I can go back to Prototype.  Totally
> unacceptable!
>


[jQuery] Re: problem filtering out via parents() and :not()

2009-05-01 Thread Alexandre Plennevaux

hi Ricardo!

in fact i removed all code that was out of the realm of this issue, to
not make you guys read 50 lines of codes.

i keep the hasClass() suggestion though !

i don't understand why parents().is(':not("") does not work though. I
wonder if there isn't a bug because it used to work before, with
jquery 1.2.6. Maybe the switch to sizzle provoked it. I'll have to
investigate to confirm that.

thanks!

On Fri, May 1, 2009 at 7:35 PM, Ricardo  wrote:
>
> No #detailsNavigation in your HTML.. and why not simply $
> (".metaSection a").click(function(){... ? Also you can swap $thisA.is
> (:not... for !$thisA.hasClass('noSwap'), much less overhead.
>
> Despite that code looks fine, could you provide a working sample at
> jsbin.com or the likes?
>
> On May 1, 12:29 pm, pixeline  wrote:
>> Hello !
>> I'm assigning a specific "swap position" behaviour on click to a list
>> of links, all sitting inside a multilevel unordered list with id
>> "detailsNavigation"
>>
>> That behaviour only concerns specific anchors and those with class
>> "noSwap" shouldn't ... swap.
>>
>> Can you explain me why this does not work?
>>
>>  $("#detailsNavigation li ul li a").bind("click", function()
>>           {
>>                 var $thisA = $(this);
>>                 var $thisLI = $thisA.parent();
>>                 var $thisUL = $thisLI.parent();
>>                 if ($thisUL.parents('li').is(':not("#metadesign,
>> #editions, #timeline, #related")') || $thisA.is(':not(".noSwap")'))
>>                 {
>>                 // do that swappin' thingy
>>                 }
>>
>> });
>>
>> Here is the related html:
>>
>>     
>>         
>>
>>             
>>                 
>>                     
>>                         concepts
>>                         http://m2.lab-
>> au.com/projects/f551/metadesign/concepts/8/">
>>                             electrosensing
>>                     
>>                     
>>                         
>>                          referencing
>>                         
>>                         methods
>>                         > class="inactive">Data mining
>>                     
>>                 
>>             
>>         
>>     
>>
>> Thanks a lot for your help!
>>
>> Alexandre
> >
>


[jQuery] Re: how can I call php function in jquery ?

2009-04-02 Thread Alexandre Plennevaux
you'd send to your ajax.php script a value that it can process such as

ajax.php?do=delete&commentid=5

then your ajax.php :

switch($_GET['do']){
case 'delete':
// check for an id, delete it
break;

default:
// do nothing;
break;
}



On Thu, Apr 2, 2009 at 3:11 PM, dziobacz  wrote:
>
> I have in PHP file ajax.php:
> class Data
> {
>
>        public function __construct()
>        {
>                
>        }
>
>        public function select($idl)
>        {
>                
>        }
>
>        public function delete($id)
>        {
>                .
>        }
> }
>
>
> My jquery function looks now:
> function deleteComment(id)
> {
>        $.post("ajax.php",
>                {
>
>                },
>                function(data) {
>                    ...
>                }
>        );
> }
>
> How can I in function deleteComment(id) call php function delete($id)
> from file ajax.php ?


[jQuery] Re: Pointless but fun jQuery experiment

2009-03-26 Thread Alexandre Plennevaux

kelvin, that's wicked !

On Thu, Mar 26, 2009 at 11:37 AM, kanna  wrote:
>
> Nice effects, Kelvin!!
> JQuery Rocks!!!
>
> On Mar 26, 8:49 am, Nikola  wrote:
>> That was really neat... jQuery physics!
>>
>> On Mar 25, 11:40 pm, brian  wrote:
>>
>> > I'll second that!
>>
>> > On Wed, Mar 25, 2009 at 9:26 PM, Rick Faircloth
>>
>> >  wrote:
>>
>> > > Pretty cool, Kelvin!
>>
>> > > Rick
>>
>> > > -Original Message-
>> > > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
>> > > Behalf Of Kelvin Luck
>> > > Sent: Wednesday, March 25, 2009 9:22 PM
>> > > To: jquery-en
>> > > Subject: [jQuery] Pointless but fun jQuery experiment
>>
>> > > Inspired by google's chrome experiments I recently put together a
>> > > pointless but fun experiment with the help of jQuery and I thought
>> > > that people on the list might like to check it out:
>>
>> > >http://www.kelvinluck.com/assets/jquery/boingPic/index.html
>>
>> > > As I said, completely pointless but makes a nice change from "serious"
>> > > progressive enhancement!
>>
>> > > Hope you like it,
>>
>> > > Kelvin :)
>


[jQuery] Re: must show an element if exists

2009-03-26 Thread Alexandre Plennevaux

you don't have to do that check. If the element does not exist, the
show() code will not be run.



On Thu, Mar 26, 2009 at 4:40 AM, shobhitsoftskills
 wrote:
>
> hi,
>
> i am learning jQuery and confused about one thing.below is simple code
> using jQuery.
>
>   "http://www.w3.org/TR/html4/strict.dtd";>
> 
>
> 
>
> 
>
> 
> $(document).ready(function() {
> if ( $('#myDiv').length )
>  $('#myDiv').show();
>
> });
> 
>
> 
>
> 
>  Search Engines
> 
>
> 
>
>
>
>
>
> i am trying below lines.
>
> if ( $('#myDiv').length )
>  $('#myDiv').show();
>
> according to this code if element exists then element should be show
> but i did not look any thing.
>
> kindly post your thoughts.
>


[jQuery] Re: jqmodal Ajax issue

2009-03-25 Thread Alexandre Plennevaux
1/ i would make sure the div exist before initalising the jqModal, so  add
the jqm initialisation to your createDiv function or through a callback
executed when the createDiv is done.2/ for your specific question: your
check is incorrect. The good use would be to use jqmodal onShow() callback
and check at that moment whether the link is valid or not.

onshow:function(hash){
if (hash.t.attr('href') ==='#' || hash.t.attr('href') ===''){
return false;
}
// otherwise, launch the popup
hash.w.css('opacity',0.88).show();

}

from the doc:


  Each callback is passed the jqModal "hash" for a window. Relevant
hash properties are;

---
w: (jQuery object) The window element. e.g. '#example' in the sample 
above
c: (object) The config object (holds passed+default parameters)
o: (jQuery object) The overlay
t: (DOM object) The triggering element

  NOTE; If you supply a "onHide" callback, you MUST execute hash.o.remove(); to
remove the overlay. You should also hide the window via hash.w.hide();, or
with a special effect.

  NOTE; If you supply a "onShow" callback, you should make the dialog visible
via hash.w.show();, or with a special effect.

  NOTE; "onLoad" callbacks are ONLY executed if the ajax parameter was passed.
onLoad is called after the ajax response. As with $.load(), the "this"
scope is a reference to the ajax target as a DOM element.





On Wed, Mar 25, 2009 at 6:13 PM, Tad  wrote:

>
> Hello,
> I'm new to jquery and jqmodal. I have a script that runs fine except
> when the URL (href) of the anchor tag is Blank or "#". so what I want
> to do is check for that possibility and stop the Jqmodal from acting
> or put up an error message, without my page being messed up. I've
> tried to use callbacks, but get an error that the hash is not defined.
> I tried to use the click event of the anchor, but the Jqmodal would
> load the content but only show it after clicking another anchor tag or
> clicking the same one again. the goal here is to have a default pop Up
> jqmodal that checks the link it is given and doesn't use it if it will
> cause an error.
>
> ~~ code that works but doesn't check href of anchor~~
> $(function(){
> /* init pop-up/overlay */
>popUp.init();
> });
> /* pop-up/overlay Functionality */
> var popUp = {
>init: function(){
>var link = $("a.popup");
>if(link.length <= 0)
>return false;
>popUp.createDiv();
>
>$('div#popup-wraper').jqm({
>   trigger: $("a.popup"),
>   closeClass: 'close',
>   toTop: true,
>   ajax: '@href',
>   target: $("div#popup-wraper div#popup"),
>   ajaxText: ("loading..."),
>   cache: false
>})
>},
>createDiv: function(){
>var strJq = "";
>strJq += " ";
>strJq += "  Close";
>strJq += " ";
>strJq += " ";
>strJq += " ";
>strJq += "";
>$("body").append(strJq);
>}
>
> }
>
> /* pop-up/overlay Functionality END */
> ~~ end code ~~
>


[jQuery] access :hover css properties of an element via jquery

2009-03-24 Thread Alexandre Plennevaux

hello!

imagine i style the :hover pseudo-class of an element via css:

.myitem{
background-color:green;
}
.myitem:hover{
background-color:red
}

Is it possible to retrieve the background-color property of the
elemnent's :hover class via jquery?

i tried the obvious : http://jsbin.com/idudi/edit

$(function(){
var temp = $('#myitem:hover').css('background-color');
alert("color is "+temp);

});

But that didn't work. It returns the default state.


[jQuery] Re: how to load("text with the + sign in it")

2009-03-21 Thread Alexandre Plennevaux

well the missing "+" sign is in the returned (loaded) html data, not
in the url variables. there are none.

basically i do a

$('#container').load(href);

what gets display in the container is "A magazine" instead of "A+ magazine" .

if in my php script i urlencode($string) the data, then the + sign is
displayed. non sense...



On Sat, Mar 21, 2009 at 1:04 AM, James  wrote:
>
> Could you post how you're doing the .load() jQuery part?
> It sounds like you're passing it through the url, like:
> $.load("page.php"+myVar);
> In this case, you should use some kind of Javascript function to
> encode the variable:
> $.load("page.php?q="+encodeURIComponent(myVar));
>
> Else, it's recommended you should try putting the data in as a
> separate parameter:
> $.load("page.php", {q:myVar});
> the + sign should not be converted. Note that if you do this you're
> POST-ing the data.
>
> On Mar 20, 5:14 am, Alexandre Plennevaux 
> wrote:
>> Hello, i tried that, but htmlentities("A+") echos "A+", so it does not
>> convert it.
>>
>> On Fri, Mar 20, 2009 at 4:06 PM, Martijn Houtman
>>
>>  wrote:
>>
>> > On Mar 20, 2009, at 3:59 PM, Alexandre Plennevaux wrote:
>>
>> >> i'm doing an ajax call via the load() function. The fetched string
>> >> contains the "+" sign, and it gets removed in the resulting html. Why
>> >> is that?
>> >> note: i'm using php. The only way i found to have the string shown, is
>> >> to urlencode() it. But i don't want to urlencode() entire texts that
>> >> should remain human-readable.
>> >> I'm sure there is an obvious solution, however i can't seem to find it.
>>
>> > try htmlentities() rather than urlencode() (PHP). I believe the plus sign 
>> > is
>> > interpreted as a space. Please do note that this escapes _all_ HTML code, 
>> > so
>> > it will not be interpreted as HTML (if it contains any).
>>
>> > Regards,
>> > --
>> > Martijn.
>>
>>


[jQuery] Re: how to load("text with the + sign in it")

2009-03-20 Thread Alexandre Plennevaux

Hello, i tried that, but htmlentities("A+") echos "A+", so it does not
convert it.

On Fri, Mar 20, 2009 at 4:06 PM, Martijn Houtman
 wrote:
>
>
> On Mar 20, 2009, at 3:59 PM, Alexandre Plennevaux wrote:
>
>> i'm doing an ajax call via the load() function. The fetched string
>> contains the "+" sign, and it gets removed in the resulting html. Why
>> is that?
>> note: i'm using php. The only way i found to have the string shown, is
>> to urlencode() it. But i don't want to urlencode() entire texts that
>> should remain human-readable.
>> I'm sure there is an obvious solution, however i can't seem to find it.
>
> try htmlentities() rather than urlencode() (PHP). I believe the plus sign is
> interpreted as a space. Please do note that this escapes _all_ HTML code, so
> it will not be interpreted as HTML (if it contains any).
>
> Regards,
> --
> Martijn.
>


[jQuery] how to load("text with the + sign in it")

2009-03-20 Thread Alexandre Plennevaux

friends,

i'm doing an ajax call via the load() function. The fetched string
contains the "+" sign, and it gets removed in the resulting html. Why
is that?
note: i'm using php. The only way i found to have the string shown, is
to urlencode() it. But i don't want to urlencode() entire texts that
should remain human-readable.
I'm sure there is an obvious solution, however i can't seem to find it.

thank you in advance for your help in solving this weird issue.

Alexandre


[jQuery] Re: Call for contributors: A simple, fast and flexible grid/spreadsheet component.

2009-03-17 Thread Alexandre Plennevaux

really impressive. As soon as it gets to a stable release i'll try it
out on my addressbook application.
the only thing i will miss is less semantic data (no use of a  anymore).
But i know all my users have javascript enabled. In that case, i guess
it's not such a relevant criteria anymore.

On Tue, Mar 17, 2009 at 8:20 AM, Tin  wrote:
>
> More updates to the Model (DataView).
>
> Added:
> - addItem
> - insertItem
> - updateItem
> - deleteItem
>
> Plus a bunch of bug fixes and code cleanup.
>
> Demo:
> http://slickgrid.googlecode.com/svn/trunk/example4-model.html
>
>


[jQuery] Re: jScoll Pane and Hidden Divs

2009-03-13 Thread Alexandre Plennevaux

can u put up an online demo somewhere?  ( http://jsbin.com/ )




On Fri, Mar 13, 2009 at 8:55 AM, Nic Hubbard  wrote:
>
> Well, I had thought of that, but I am needing to fade it in with the
> fadeIn() function.  Not sure how how to do this when the jScroll is
> inside the hidden div...
>
> On Mar 13, 12:41 am, Alexandre Plennevaux 
> wrote:
>> yep it's correct: you need to initialise it then hide it. you could
>> also position it outside the view port, initialise it, hide it, then
>> position it back in the viewport to avoid the initial display.
>>
>> On Fri, Mar 13, 2009 at 6:43 AM, Nic Hubbard  wrote:
>>
>> > I have a hidden div that uses the .fadeIn() function when a link is
>> > clicked.  Inside this is a div that uses jScroll Pane.  But, for some
>> > reason when I hide that parent div first, jScroll pane won't work.  It
>> > seems like it might not be initialized inside a hidden div.
>>
>> > Is this true?  Any ideas on how to get this working?
>>
>> >http://67.207.148.241/exhibitions(Mouse over Exhibitions)
>>
>> > Thanks!


[jQuery] Re: jScoll Pane and Hidden Divs

2009-03-13 Thread Alexandre Plennevaux

yep it's correct: you need to initialise it then hide it. you could
also position it outside the view port, initialise it, hide it, then
position it back in the viewport to avoid the initial display.

On Fri, Mar 13, 2009 at 6:43 AM, Nic Hubbard  wrote:
>
> I have a hidden div that uses the .fadeIn() function when a link is
> clicked.  Inside this is a div that uses jScroll Pane.  But, for some
> reason when I hide that parent div first, jScroll pane won't work.  It
> seems like it might not be initialized inside a hidden div.
>
> Is this true?  Any ideas on how to get this working?
>
> http://67.207.148.241/exhibitions (Mouse over Exhibitions)
>
> Thanks!


[jQuery] Re: How to remove li inside UL

2009-03-09 Thread Alexandre Plennevaux

this is probably because your selector returns no object. show the
html code you run your script against, to be able to properly
diagnose.

On Mon, Mar 9, 2009 at 11:53 AM, niraj  wrote:
>
> Hi,
>
> I want to remove selected list items from a UL. Can i do using remove
> ().
> I get an error when i get a list of items:
>
> var li = $('.items');
> li[0].remove();
>
> I am getting error li[0].remove() is not a function in Mozilla Firefox
> firebird debugger.
>
> ~nk
>


[jQuery] Re: ajaxStart() question

2009-03-06 Thread Alexandre Plennevaux

Thank you Ryan,

Thus my initial question becomes : does jquery stores somewhere all
dom elements in the process of being updated by an ajax call ?

like $.ajax.processingElements = ['container1','container2'];

if not, i guess that i could turn this into a plugin that adds on
ajaxStart() an element to a global array and removes on ajaxComplete
or ajaxError.


°-¨



On Fri, Mar 6, 2009 at 5:35 PM, ryan.j  wrote:
>
> yeah, thats basically what i was thinking.
>
> personally i'd try to track the container and use a generic piece of
> code for the the loading image. that way you could just use $
> (container).children(".loading") to traverse the DOM.
>
> or if for any reason you want to make them unique perhaps even build
> an id for each loading image based on the container's id. (eg. cont1 >
> cont1_Img or something)
>
> On Mar 6, 4:12 pm, Alexandre Plennevaux  wrote:
>> no, nothing depend on it. I see now that there is a potential problem
>> with the way i set up my throbber logic: there is only one available
>> "loading" div for several zones. So if one zone is loading and another
>> call is triggered, the "loading" panel will move to the second zone
>> before zone1 is actually done loading.
>> So i should create the divs each time or create directly as many divs
>> as there are updatable zones, thus using a class instead of an id.
>>
>> On Fri, Mar 6, 2009 at 5:02 PM, Rick Faircloth  
>> wrote:
>>
>> > Is anything in your code dependent on your "loading" graphic id,
>> > or would a class identifier be sufficient?
>>
>> > -Original Message-
>> > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
>> > Behalf Of Alexandre Plennevaux
>> > Sent: Friday, March 06, 2009 10:31 AM
>> > To: jquery-en@googlegroups.com
>> > Subject: [jQuery] Re: ajaxStart() question
>>
>> > hi there,
>>
>> > well, i trigger the ajax request much like this:  no matter what they role 
>> > is, all my interface buttons finish by an action called 
>> > UI.refresh({section:'projects', sortby:'time', item:'love-me'});
>>
>> > this function compares the sent properties to the current UI stored 
>> > properties, and if there is a change, trigger specific actions. That
>> > UI.refresh() function is therefore structured like this:
>>
>> > ui.refresh:function(Obj){
>>
>> > // 1. compare the 2 objects: current UI and Obj. If changes, update UI
>>
>> > if(Obj.section && Obj.section!== UI.section){ queueArray.push('section'); 
>> > UI.section= Obj.section; } // same for all properties
>>
>> > 2. loop through the queueArray and make necessary UI changes
>>
>> >  for (i = 0; i < queueArray.length; i++)
>> >        {
>> >            switch (queueArray[i])
>> >            {
>> >                case 'section':
>>
>> >                    // Animating the strata
>> >                    var $thisLI = $('#' + UI.section);
>> >                    $thisLI.strataToCenter(); 
>> > $('#leftcol').load(UI.CURRENT_URL);
>>
>> >                    break;
>> > case 'item':
>> > //do this and that...
>> > $('#projectNav').load('thatpage');
>> > break;
>> > }
>> > }
>>
>> > }
>>
>> > it may seems like overwork to you guys, but my app is quite big and this 
>> > structure helps me keep the code well structured.
>>
>> > Thanks for taking the time to help me...
>>
>> > On Fri, Mar 6, 2009 at 4:16 PM, ryan.j  
>> > wrote:
>>
>> >> that crossed my mind, but from the comments above i think he he wants
>> >> multiple content boxes being populated from a number of different
>> >> triggers, although he's using an id (of which he can only have one
>> >> instance of anyway) as the identifier for the loading icon.
>>
>> >> i'm not sure this is the best way of doing it, cos unless i'm
>> >> misunderstanding quite what he wants to do he'll only be able to
>> >> process one ajax request at a time doing it like this.
>>
>> >> Alexandre, how are you triggering the ajax request?


[jQuery] Re: ajaxStart() question

2009-03-06 Thread Alexandre Plennevaux

no, nothing depend on it. I see now that there is a potential problem
with the way i set up my throbber logic: there is only one available
"loading" div for several zones. So if one zone is loading and another
call is triggered, the "loading" panel will move to the second zone
before zone1 is actually done loading.
So i should create the divs each time or create directly as many divs
as there are updatable zones, thus using a class instead of an id.

On Fri, Mar 6, 2009 at 5:02 PM, Rick Faircloth  wrote:
>
> Is anything in your code dependent on your "loading" graphic id,
> or would a class identifier be sufficient?
>
> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
> Behalf Of Alexandre Plennevaux
> Sent: Friday, March 06, 2009 10:31 AM
> To: jquery-en@googlegroups.com
> Subject: [jQuery] Re: ajaxStart() question
>
>
> hi there,
>
> well, i trigger the ajax request much like this:  no matter what they role 
> is, all my interface buttons finish by an action called 
> UI.refresh({section:'projects', sortby:'time', item:'love-me'});
>
> this function compares the sent properties to the current UI stored 
> properties, and if there is a change, trigger specific actions. That
> UI.refresh() function is therefore structured like this:
>
> ui.refresh:function(Obj){
>
> // 1. compare the 2 objects: current UI and Obj. If changes, update UI
>
> if(Obj.section && Obj.section!== UI.section){ queueArray.push('section'); 
> UI.section= Obj.section; } // same for all properties
>
>
> 2. loop through the queueArray and make necessary UI changes
>
>  for (i = 0; i < queueArray.length; i++)
>        {
>            switch (queueArray[i])
>            {
>                case 'section':
>
>                    // Animating the strata
>                    var $thisLI = $('#' + UI.section);
>                    $thisLI.strataToCenter(); 
> $('#leftcol').load(UI.CURRENT_URL);
>
>                    break;
> case 'item':
> //do this and that...
> $('#projectNav').load('thatpage');
> break;
> }
> }
>
> }
>
>
> it may seems like overwork to you guys, but my app is quite big and this 
> structure helps me keep the code well structured.
>
> Thanks for taking the time to help me...
>
>
> On Fri, Mar 6, 2009 at 4:16 PM, ryan.j  wrote:
>>
>> that crossed my mind, but from the comments above i think he he wants
>> multiple content boxes being populated from a number of different
>> triggers, although he's using an id (of which he can only have one
>> instance of anyway) as the identifier for the loading icon.
>>
>> i'm not sure this is the best way of doing it, cos unless i'm
>> misunderstanding quite what he wants to do he'll only be able to
>> process one ajax request at a time doing it like this.
>>
>> Alexandre, how are you triggering the ajax request?
>
>


[jQuery] Re: ajaxStart() question

2009-03-06 Thread Alexandre Plennevaux

hi there,

well, i trigger the ajax request much like this:  no matter what they
role is, all my interface buttons finish by an action called
UI.refresh({section:'projects', sortby:'time', item:'love-me'});

this function compares the sent properties to the current UI stored
properties, and if there is a change, trigger specific actions. That
UI.refresh() function is therefore structured like this:

ui.refresh:function(Obj){

// 1. compare the 2 objects: current UI and Obj. If changes, update UI

if(Obj.section && Obj.section!== UI.section){
queueArray.push('section');
UI.section= Obj.section;
}
// same for all properties


2. loop through the queueArray and make necessary UI changes

 for (i = 0; i < queueArray.length; i++)
{
switch (queueArray[i])
{
case 'section':

// Animating the strata
var $thisLI = $('#' + UI.section);
$thisLI.strataToCenter();
$('#leftcol').load(UI.CURRENT_URL);

break;
case 'item':
//do this and that...
$('#projectNav').load('thatpage');
break;
}
}

}


it may seems like overwork to you guys, but my app is quite big and
this structure helps me keep the code well structured.

Thanks for taking the time to help me...


On Fri, Mar 6, 2009 at 4:16 PM, ryan.j  wrote:
>
> that crossed my mind, but from the comments above i think he he wants
> multiple content boxes being populated from a number of different
> triggers, although he's using an id (of which he can only have one
> instance of anyway) as the identifier for the loading icon.
>
> i'm not sure this is the best way of doing it, cos unless i'm
> misunderstanding quite what he wants to do he'll only be able to
> process one ajax request at a time doing it like this.
>
> Alexandre, how are you triggering the ajax request?


[jQuery] Re: ajaxStart() question

2009-03-06 Thread Alexandre Plennevaux

just in case it helps, here is the code i have so far:

 var $loadAnim = $('').appendTo('body');

$loadAnim.ajaxStart(function(el)
{
// the following behavior will be done each time an
ajax call is triggered
var $loadTarget = $('#container'); // 

[jQuery] Re: ajaxStart() question

2009-03-06 Thread Alexandre Plennevaux

thanks ryan, but i want to set it generically for all ajax calls, for
instance, via ajaxStart() instead of having to attach the behaviour to
every single trigger element.

On Fri, Mar 6, 2009 at 11:30 AM, ryan.j  wrote:
>
> but since you already specify the target element for the .load() at
> some point, you'll already have it to put in the callback?
>
> function doLoad(el, url) {
>  var contEl = $(el)
>  contEl .append('');
>  contEl .load( url, function(){
>    contEl .remove('#loadIcon');
>  });
> }
>
> load
>
> On Mar 6, 10:14 am, Alexandre Plennevaux 
> wrote:
>> yes, thanks but that does not help my specific need: what i need to
>> know is if the ajax object stores the container in which it will load
>> the content in a property that i can retrieve, so that the load
>> animation goes on top of it.
>>
>> On Fri, Mar 6, 2009 at 11:11 AM, ryan.j  wrote:
>>
>> > oh and it may or may not be any use, but you can grab all manner of
>> > nice animated loading graphics here...http://www.ajaxload.info/


[jQuery] Re: ajaxStart() question

2009-03-06 Thread Alexandre Plennevaux

yes, thanks but that does not help my specific need: what i need to
know is if the ajax object stores the container in which it will load
the content in a property that i can retrieve, so that the load
animation goes on top of it.

On Fri, Mar 6, 2009 at 11:11 AM, ryan.j  wrote:
>
> oh and it may or may not be any use, but you can grab all manner of
> nice animated loading graphics here... http://www.ajaxload.info/


[jQuery] ajaxStart() question

2009-03-06 Thread Alexandre Plennevaux

Hello!

I would like to launch a function each time an ajax call is made, that
places a "loading" throbber in the container in which the new content
will be inserted.
Typically, these will be $('#mycontainer').load() calls.

I'm puzzled on how to detect the container upon calling my function.
Someone has an idea?

Thanks!

Alexandre


[jQuery] Re: next() question

2009-03-04 Thread Alexandre Plennevaux

Thank you Ricardo, that's an illuminating break down.

On Wed, Mar 4, 2009 at 5:20 PM, ricardobeat  wrote:
>
> :after is used to insert generated content after an element, not to
> select the next element. In your code, the :after(...) is doing
> nothing, it reads as $('ul.tab-menu a').eq(index + 1) - what's working
> is the index.
>
> You don't need to save the index as it's in the scope of the function:
>
> $('#tabs img.albumImage').each(function(index) {
>   var $tabs = $('ul.tab-menu a');
>   $(this).click(function() {
>        // in albums, clicking on an image brings the user to the next
> image
>        $( $tabs[index + 1] ).click();
>   });
> });
>
> The selector you were after is $('li:has(.tab-menu-item-selected) + li
> a.tab-menu-item'), but doing the whole parent().next().children('a.tab-
> menu-item') stuff is faster, despite being verbose.
>
> cheers,
> - ricardo
>
>
> On Mar 4, 1:01 pm, Joseph Le Brech  wrote:
>> http://docs.jquery.com/DOM/Traversing/Selectors#Not_supported
>>
>> i seen the + operator seems to do something similar, it means an element 
>> preceding.
>>
>> Date: Wed, 4 Mar 2009 16:54:46 +0100
>> Subject: [jQuery] Re: next() question
>> From: aplennev...@gmail.com
>> To: jquery-en@googlegroups.com
>>
>> thanks i got it to work, sort of.
>>
>> $('#tabs img.albumImage').each(function(index)
>>                             {
>>                                 var $img = $(this).data('tabindex', index);
>>                                 $img.click(function()
>>                                 {
>>                                    // in albums, clicking on an image brings 
>> the user to the next image
>>                                     var index = $(this).data('tabindex');
>>                                     $('ul.tab-menu 
>> a:after("a.tab-menu-item-selected")').eq(index + 1).trigger('click');
>>                                 });
>>                             });
>>
>> :after is not documented on the jquery selector 
>> page:http://docs.jquery.com/Selectors
>>
>> should it be added?
>>
>> On Wed, Mar 4, 2009 at 4:21 PM, Joseph Le Brech  wrote:
>>
>> you should be able to use the :after pseudo element
>>
>> http://www.w3.org/TR/CSS2/selector.html#before-and-after
>>
>> > Date: Wed, 4 Mar 2009 16:10:03 +0100
>> > Subject: [jQuery] next() question
>> > From: aplennev...@gmail.com
>> > To: jquery-en@googlegroups.com
>>
>> - Show quoted text -
>>
>>
>>
>>
>>
>> > Hello,
>>
>> > say i have this markup:
>>
>> > 
>> > > > href="#fragment0">0
>> > 1
>> > 2
>> > 3
>> > 4
>> > < li>5
>> > 6
>> > Arca 180
>>
>> > 
>>
>> > I need to find the anchor link that immediately follows
>> > a.tab-menu-item-selected. i tried using next but i never get it right
>>
>> > $('a.tab-menu-item-selected').next('a.tab-menu-item').length returns 
>> > always 0
>>
>> > any idea how to find this selector would be greatly appreciated.
>>
>> > Thanks
>>
>> > Alexandre
>>
>> Windows Live Messenger just got better. Find out more!
>>
>> _
>>  25GB of FREE Online Storage – Find out 
>> morehttp://clk.atdmt.com/UKM/go/134665320/direct/01/


[jQuery] Re: next() question

2009-03-04 Thread Alexandre Plennevaux

wow, clever, that does the trick !

$('ul.tab-menu 
a.tab-menu-item-selected').parent().next().children('a.tab-menu-item').trigger('click.simplyTabs');



On Wed, Mar 4, 2009 at 4:58 PM, mkmanning  wrote:
>
> next() finds the the unique next siblings for that element (in this
> case their are none). You want the  that is the child of the
> element's parent's next sibling, which takes longer to write in
> English than in jQuery :)
>
>  $('a.tab-menu-item-selected').parent().next().children();
>
> nb this assumes the  is the only child, otherwise add a filter expr
> in children
>
> On Mar 4, 7:21 am, Joseph Le Brech  wrote:
> > you should be able to use the :after pseudo element
> >
> > http://www.w3.org/TR/CSS2/selector.html#before-and-after
> >
> >
> >
> > > Date: Wed, 4 Mar 2009 16:10:03 +0100
> > > Subject: [jQuery] next() question
> > > From: aplennev...@gmail.com
> > > To: jquery-en@googlegroups.com
> >
> > > Hello,
> >
> > > say i have this markup:
> >
> > > 
> > >  > > href="#fragment0">0
> > > 1
> > > 2
> > > 3
> > > 4
> > > < li>5
> > > 6
> > > Arca 180
> >
> > > 
> >
> > > I need to find the anchor link that immediately follows
> > > a.tab-menu-item-selected. i tried using next but i never get it right
> >
> > > $('a.tab-menu-item-selected').next('a.tab-menu-item').length returns 
> > > always 0
> >
> > > any idea how to find this selector would be greatly appreciated.
> >
> > > Thanks
> >
> > > Alexandre
> >
> > _
> > Free photo editing software from Windows Live . Try it 
> > now!http://clk.atdmt.com/UKM/go/134665240/direct/01/


[jQuery] Re: next() question

2009-03-04 Thread Alexandre Plennevaux
thanks i got it to work, sort of.

$('#tabs img.albumImage').each(function(index)
{
var $img = $(this).data('tabindex', index);
$img.click(function()
{
   // in albums, clicking on an image brings
the user to the next image
var index =
$(this).data('tabindex');
$('ul.tab-menu
a:after("a.tab-menu-item-selected")').eq(index + 1).trigger('click');
});
});


:after is not documented on the jquery selector page:
http://docs.jquery.com/Selectors

should it be added?

On Wed, Mar 4, 2009 at 4:21 PM, Joseph Le Brech wrote:

>  you should be able to use the :after pseudo element
>
> http://www.w3.org/TR/CSS2/selector.html#before-and-after
>
>
> > Date: Wed, 4 Mar 2009 16:10:03 +0100
> > Subject: [jQuery] next() question
> > From: aplennev...@gmail.com
> > To: jquery...@googlegroups.com- Show quoted text -
>
> >
> >
> > Hello,
> >
> > say i have this markup:
> >
> > 
> >  > href="#fragment0">0
> > 1
> > 2
> > 3
> > 4
> > < li>5
> > 6
> > Arca 180
> >
> > 
> >
> > I need to find the anchor link that immediately follows
> > a.tab-menu-item-selected. i tried using next but i never get it right
> >
> > $('a.tab-menu-item-selected').next('a.tab-menu-item').length returns
> always 0
> >
> >
> > any idea how to find this selector would be greatly appreciated.
> >
> > Thanks
> >
> > Alexandre
>
> --
> Windows Live Messenger just got better. Find out 
> more!
>


[jQuery] next() question

2009-03-04 Thread Alexandre Plennevaux

Hello,

say i have this markup:


0
   1
   2
   3
   4
 < li>5
  6
  Arca 180



I need to find the anchor link that immediately follows
a.tab-menu-item-selected. i tried using next but i never get it right

$('a.tab-menu-item-selected').next('a.tab-menu-item').length  returns always 0


any idea how to find this selector would be greatly appreciated.

Thanks

Alexandre


[jQuery] Re: [plugin] jqModal +r14 updated

2009-03-01 Thread Alexandre Plennevaux

that's a nice upgrade Brice!



On Sun, Mar 1, 2009 at 9:21 AM, Brice Burgess  wrote:
>
> Plugin Page: http://dev.iceburg.net/jquery/jqModal/
>
> updated jqModal to +r14
>
> Changes include smart detection of the triggering element. This allows you
> to call $.jqmShow() and $.jqmHide() within the event context of a
> non-initialized triggering element, and that element will mask a proper
> initialized trigger.
>
> This (very minor) change is intended to improve the plugin's natural
> behavior -- that is; to behave as expected. It will make "live querying"
> modal triggers easier for some.
>
> A simple example of the new behavior follows. It will show and load the
> remote content of all anchor links into the modal window whenever they are
> clicked.
>
> 
>
> http://my.ajax/content";>open modal with my.ajax/content
>
> 
>
> 
>
> jQuery().ready(function($){
>
>  // initialize modal,
>  // load the container with a remote return based on the 'href'
>  //    attribute of triggering element(s)
>
>  $('#jqModal').jqm({ajax:'@href'});
>
>
>  // open the modal whenever anchor links on the page are clicked
>  $('a').live('click',function(){
>     $('#jqModal').jqmShow();
>  });
>
>
> });
> 
>
> 
>
>
> NOTE: Before this change, you would normally either
>
> a) pass triggers on $.jqm() initialization (e.g.)
>    $('#jqModal').jqm({trigger:'a.openModal',...});
>
> or
>
> b) pass the triggering element to $.jqmShow() calls --
>   [which you still can, and which will override auto-detection.]
>     $('a.openModal').click(function(){
>     $('#jqModal').jqmShow(this);
>   });
>     $('#jqModal').jqmShow($('a.openModal')[0]);
>     I realize the new behavior is similar to b) above, but passing the
> element to $.jqmShow() did not seem a "natural" fit. The new method is
> easier for those without scope/context knowledge [and the new method uses
> less bytes in your client code!! ;) (j/k) :pony_skiing==1]
>     So; I hope you all enjoy. And yes; a rewrite, lint-loving spawn of
> jqModal with quiteExpressiveVariableNames is a necessity   eventually ;)
>     ~ Brice
>


[jQuery] Advertising in jquery docs: normal?

2009-02-28 Thread Alexandre Plennevaux

Hi there,

Since the docs are based on a wiki, i wonder if this is intended or
not by the jquery team:  on this page, the links chapter contains an
incentive to buy a jquery book.
http://docs.jquery.com/Removeclass


see:

" For more details buy the jQuery Reference Guide here in this site
http://www.packtpub.com/jQuery/book/mid/1004077zztq0 "


Not that it's out of context,, irrelevant or overly visually invasive,
but is this not  a hidden advertisement? Is this allowed?


Alexandre


[jQuery] Re: Horizontal animation works on F.F. IE7. Fails on IE6

2009-02-23 Thread Alexandre Plennevaux

in fact, i just tested it on IE6, and i can't even click on the form
inputs, so i 'd assume either you disabled them, or there is a
transparent div with a higher z-index that prevents from clicking it.

On Mon, Feb 23, 2009 at 10:36 PM, Alexandre Plennevaux
 wrote:
> can you check taht for IE6, the element is not ALREADY at position
> left=0 ? hence no animation?
>
> On Mon, Feb 23, 2009 at 6:22 PM, ab2qik  wrote:
>>
>> Hi,
>>
>> Horizontal animation of an element works on F.F. IE7. It fails to work
>> on IE6?
>>
>> Example:
>> From: http://codesolv.net/se-update/library-slide.html
>>
>> Click on any radio button under Form factors heading. An element
>> slides open.
>> This can be closed by the top right close button.
>>
>> Works on F.F./IE7.
>>
>> Any suggegstions for a fix for IE6?
>>
>> Thankyou,
>> ab2qik
>>
>


[jQuery] Re: Horizontal animation works on F.F. IE7. Fails on IE6

2009-02-23 Thread Alexandre Plennevaux

can you check taht for IE6, the element is not ALREADY at position
left=0 ? hence no animation?

On Mon, Feb 23, 2009 at 6:22 PM, ab2qik  wrote:
>
> Hi,
>
> Horizontal animation of an element works on F.F. IE7. It fails to work
> on IE6?
>
> Example:
> From: http://codesolv.net/se-update/library-slide.html
>
> Click on any radio button under Form factors heading. An element
> slides open.
> This can be closed by the top right close button.
>
> Works on F.F./IE7.
>
> Any suggegstions for a fix for IE6?
>
> Thankyou,
> ab2qik
>


[jQuery] Re: ui tabs : what are the only necessary CSS files ?

2009-02-23 Thread Alexandre Plennevaux

thanks Richard,

I'm having a lot of trouble upgrading to ui tabs so see you around on
the jquery ui group :)

Alexandre


On Mon, Feb 23, 2009 at 11:32 AM, Richard D. Worth  wrote:
> ui.core.css
> ui.tabs.css
> ui.theme.css
>
> Note: if you have any further questions about jQuery UI, we'd love to answer
> them over here:
>
> http://groups.google.com/group/jquery-ui
>
> Thanks.
>
> - Richard
>
> On Mon, Feb 23, 2009 at 4:32 AM, Alexandre Plennevaux
>  wrote:
>>
>> Hi,
>>
>> I'm trying to use ui Tabs , but i don't need all the rest of the UI
>> distribution, yet they all come into the generated download. I'm a bit
>> lost in all those css files.
>>
>> What is the bare minimum css that i absolutely need to make the ui.tabs
>> work?
>>
>> Thank you,
>>
>> Alexandre
>
>


[jQuery] ui tabs : what are the only necessary CSS files ?

2009-02-23 Thread Alexandre Plennevaux

Hi,

I'm trying to use ui Tabs , but i don't need all the rest of the UI
distribution, yet they all come into the generated download. I'm a bit
lost in all those css files.

What is the bare minimum css that i absolutely need to make the ui.tabs work?

Thank you,

Alexandre


[jQuery] Re: default value of an object's property

2009-02-18 Thread Alexandre Plennevaux

ok thanks a lot for all this. I'll summarize it in a blog post for my
own recurring memory leaks :)

On Thu, Feb 19, 2009 at 3:20 AM, RobG  wrote:
>
>
>
> On Feb 19, 10:56 am, Alexandre Plennevaux 
> wrote:
>> thanks a lot. But why did they made it so complex? do we really need
>> the granularity to differenciate between "undefined", null, 0, "" and
>> false ?
>
> Yes, they are all have their uses in different circumstances.
>
> For example, host methods like getElementById return null if they
> can't find the element they're after.  It lets you know that the
> method ran OK, it just didn't find the element.  Others, like
> getElementsByTagName, always return a collection.  If it's empty, a
> test like:
>
>  if (nodeCollection) {...}
>
>
> will evaluate to true, however since there are no elements in the
> collection, it's length with be zero so:
>
>  if (nodeCollection.length) {...}
>
>
> will evaluate to false (and true if there is at least one node in the
> collection).
>
> Javascript was intended to be a simple, easy to learn language so it
> has lots of features that are designed to make programming easier -
> e.g. lose typing and automatic conversion of primitives to objects
> where required.  Those same features raise other issues when you dig
> into the detail.
>
>
> --
> Rob


[jQuery] Re: default value of an object's property

2009-02-18 Thread Alexandre Plennevaux

thanks a lot. But why did they made it so complex? do we really need
the granularity to differenciate between "undefined", null, 0, "" and
false ?

On Thu, Feb 19, 2009 at 1:51 AM, RobG  wrote:
>
>
>
> On Feb 19, 9:44 am, Alexandre Plennevaux 
> wrote:
>> thanks guys, so if i understand correctly, an unset property, if
>> tested, returns "false". Correct ?
>
> Strictly, no.  It returns undefined, which may evaluate to false
> depending on the test, which should be based on the possible values
> and how they should be treated.
>
> If you just want to see if it has some value that is or isn't
> "falsey", use:
>
>  if (obj.property) {...}
>
>
> which will evaluate to false where obj.property has one of a number of
> values - undefined, null, NaN, 0 (i.e. the number zero but not the
> string zero), boolean false and so on.  If you declare the property
> but don't give it a value, its value is undefined (as in not defined)
> and if evaluated as part of an exrpession, undefined (the special
> undefined value) is returned.
>
> Therefore if you declare it and later want to see if it has been
> assigned a value, the best test is probably:
>
>  if (obj.property === undefined) {...}
>
> It's your decision as to which is more appropriate.
>
>
> --
> Rob


[jQuery] Re: Javascript Generated by $()load does not render

2009-02-18 Thread Alexandre Plennevaux

see if this resolves your issue:


...

 $(document).ready(function(){
 $.ajaxSetup( {
dataType: 'script'
}) ;

   $("#dynamic_content").load(myscript,"task=entry",
   function(resp,stat,xhr){
   //alert(resp);  // leave for testing
   }
   );
 });

On Wed, Feb 18, 2009 at 6:31 PM, Tim Johnson  wrote:
>
> On Wednesday 18 February 2009, Alexandre Plennevaux wrote:
>> you can use load, you just have to setup the ajaxSetup controlling
>> your ajax main parameters so you set it to your liking, then you call
>> the load(). It is built on top of the ajax method to ease its use.
>> See: http://docs.jquery.com/Ajax/jQuery.ajaxSetup#options
>  I am looking at: http://docs.jquery.com/Types#Options
>  in addition I am looking at printed material
>  I see from the book: "jQuery In Action" - page 252 documentation for
>  $.ajaxSetup(properties). The properties object can contain a dataType value.
>
>  1)What datatype value would configure $load so that it would handle
>  both script and html. IOWS the CGI script returns both javascript
>  and html?
>
>  2)Are these datatype strings themselves case sensitive.
>
>  Time is limited for me right now, I'll do my home work a little
>  later. :-)
>
>  thanks again
>


[jQuery] Re: default value of an object's property

2009-02-18 Thread Alexandre Plennevaux

@josh: it works superbly. Thanks a lot for this elegant solution !

On Thu, Feb 19, 2009 at 12:44 AM, Alexandre Plennevaux
 wrote:
> thanks guys, so if i understand correctly, an unset property, if
> tested, returns "false". Correct ?
>
> On Wed, Feb 18, 2009 at 11:35 PM, mkmanning  wrote:
>>
>> The method that Josh posted is (in some people's opinion) the
>> preferred method for assigning values, and is sometimes called the
>> 'default pattern' for obvious reasons (the other common form is the
>> guard pattern &&). It, along with the ternary, is usually more
>> succinct than if/else, the latter being better suited to logic flow.
>>
>> On Feb 18, 1:24 pm, Ricardo Tomasi  wrote:
>>> or simply if (!Obj.sortby) Obj.sortby = 'time'; it's a bit more
>>> efficient. All of undefined, null, 0 or "" will evaluate to false,
>>> there's no need to check for each of them.
>>>
>>> Anyway, Alexandre, the ternary you posted should also work, there is
>>> probably something else wrong in your code.
>>>
>>> - ricardo
>>>
>>> On Feb 18, 3:52 pm, "Josh Nathanson"  wrote:
>>>
>>> > I think this might work, give it a try:
>>>
>>> > Obj.sortby = Obj.sortby || 'time';
>>>
>>> > -- Josh
>>>
>>> > -Original Message-
>>> > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
>>> > Behalf Of Alexandre Plennevaux
>>> > Sent: Wednesday, February 18, 2009 9:07 AM
>>> > To: Jquery-en
>>> > Subject: [jQuery] default value of an object's property
>>>
>>> > hi there,
>>>
>>> > a quick question: i'm using an object to pass a series of variables.
>>> > Sometimes, i test for a specific property, which might not exist.
>>> > I can't seem to find the right way, i tried
>>>
>>> >  Obj.sortby = (typeof Obj.sortby == 'undefined' || Obj.sortby==''
>>> > ||Obj.sortby == null) ? 'time' : Obj.sortby;
>>>
>>> > but everytime that property "sortby" hasn't been set, firebug returns
>>> > it as "null"
>>>
>>> > can you clear that up for me?
>>>
>>> > Thanks a lot!
>>>
>>> > Alexandre
>


[jQuery] Re: default value of an object's property

2009-02-18 Thread Alexandre Plennevaux

thanks guys, so if i understand correctly, an unset property, if
tested, returns "false". Correct ?

On Wed, Feb 18, 2009 at 11:35 PM, mkmanning  wrote:
>
> The method that Josh posted is (in some people's opinion) the
> preferred method for assigning values, and is sometimes called the
> 'default pattern' for obvious reasons (the other common form is the
> guard pattern &&). It, along with the ternary, is usually more
> succinct than if/else, the latter being better suited to logic flow.
>
> On Feb 18, 1:24 pm, Ricardo Tomasi  wrote:
>> or simply if (!Obj.sortby) Obj.sortby = 'time'; it's a bit more
>> efficient. All of undefined, null, 0 or "" will evaluate to false,
>> there's no need to check for each of them.
>>
>> Anyway, Alexandre, the ternary you posted should also work, there is
>> probably something else wrong in your code.
>>
>> - ricardo
>>
>> On Feb 18, 3:52 pm, "Josh Nathanson"  wrote:
>>
>> > I think this might work, give it a try:
>>
>> > Obj.sortby = Obj.sortby || 'time';
>>
>> > -- Josh
>>
>> > -Original Message-
>> > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
>> > Behalf Of Alexandre Plennevaux
>> > Sent: Wednesday, February 18, 2009 9:07 AM
>> > To: Jquery-en
>> > Subject: [jQuery] default value of an object's property
>>
>> > hi there,
>>
>> > a quick question: i'm using an object to pass a series of variables.
>> > Sometimes, i test for a specific property, which might not exist.
>> > I can't seem to find the right way, i tried
>>
>> >  Obj.sortby = (typeof Obj.sortby == 'undefined' || Obj.sortby==''
>> > ||Obj.sortby == null) ? 'time' : Obj.sortby;
>>
>> > but everytime that property "sortby" hasn't been set, firebug returns
>> > it as "null"
>>
>> > can you clear that up for me?
>>
>> > Thanks a lot!
>>
>> > Alexandre


[jQuery] default value of an object's property

2009-02-18 Thread Alexandre Plennevaux

hi there,

a quick question: i'm using an object to pass a series of variables.
Sometimes, i test for a specific property, which might not exist.
I can't seem to find the right way, i tried

 Obj.sortby = (typeof Obj.sortby == 'undefined' || Obj.sortby==''
||Obj.sortby == null) ? 'time' : Obj.sortby;


but everytime that property "sortby" hasn't been set, firebug returns
it as "null"

can you clear that up for me?

Thanks a lot!

Alexandre


[jQuery] Re: Javascript Generated by $()load does not render

2009-02-18 Thread Alexandre Plennevaux

you can use load, you just have to setup the ajaxSetup controlling
your ajax main parameters so you set it to your liking, then you call
the load(). It is built on top of the ajax method to ease its use.
See: http://docs.jquery.com/Ajax/jQuery.ajaxSetup#options



On Wed, Feb 18, 2009 at 5:18 PM, Tim Johnson  wrote:
>
> On Tuesday 17 February 2009, Alexandre Plennevaux wrote:
>> i suppose that you change try specifying the dataType as "script" that
>> your ajax calls expect:
>>
>> Taken from: http://docs.jquery.com/Ajax/jQuery.ajax
>>
>> dataType
>>
>> The type of data that you're expecting back from the server. If none
>> is specified, jQuery will intelligently pass either responseXML or
>> responseText to your success callback, based on the MIME type of the
>> response. The available types (and the result passed as the first
>> argument to your success callback) are:
>  Thank you. That clears up a lot. But the question that remains is that
>  two different types of data are returned:
>  1)Script
>  2)Text
>  The answer may be in the mime type. $()load is so much easier to use.
>  I will research futher.
>  regards
>  tim
>
>
>


[jQuery] Re: Javascript Generated by $()load does not render

2009-02-17 Thread Alexandre Plennevaux

i suppose that you change try specifying the dataType as "script" that
your ajax calls expect:

Taken from: http://docs.jquery.com/Ajax/jQuery.ajax

dataType

The type of data that you're expecting back from the server. If none
is specified, jQuery will intelligently pass either responseXML or
responseText to your success callback, based on the MIME type of the
response. The available types (and the result passed as the first
argument to your success callback) are:

* "xml": Returns a XML document that can be processed via jQuery.
* "html": Returns HTML as plain text; included script tags are
evaluated when inserted in the DOM.
* "script": Evaluates the response as JavaScript and returns it as
plain text. Disables caching unless option "cache" is used. Note: This
will turn POSTs into GETs for remote-domain requests.
* "json": Evaluates the response as JSON and returns a JavaScript Object.
* "jsonp": Loads in a JSON block using JSONP. Will add an extra
"?callback=?" to the end of your URL to specify the callback. (Added
in jQuery 1.2)
* "text": A plain text string.





On Wed, Feb 18, 2009 at 1:34 AM, Tim Johnson  wrote:
>
> I have a script that generates javascript validation code when called
> in the following code:
>  $(document).ready(function(){
>$("#dynamic_content").load(myscript,"task=entry",
>function(resp,stat,xhr){
>//alert(resp);  // leave for testing
>}
>);
>  });
> All of the contented rendered by 'myscript' is written to the innerHtml of
> div "dynamic_content" *except for the javascript*.
>
> I am viewing the content rendered by the script in firefox using the
> "View Formatted Source" add-on.
>
>  If I uncomment the alert() above, I see the javascript in the response.
>
> Does anyone have an answer for this mystery. Or a work-around. Any links
> to discussions on this topic?
>
> thanks
> Tim
>


[jQuery] Re: jquery context menu plugin: issue with find()

2009-02-16 Thread Alexandre Plennevaux

hi dave,

thanks for the reply. In fact, it's my fault: i was calling the
command against the wrong selector set. It has to be the context menu
itself, not the element which triggers the context menu. it makes
sense when you know it , but i wish i wouldn't have had to look into
the online example source code to find that out.

thanks!

alexandre

On Tue, Feb 17, 2009 at 3:38 AM, Dave Methvin  wrote:
>
>> console.log('plugin is disabling option : ' +
>>  d[i]); // RETURNS A VALID ANSWER
>> $(this).find('a[href="' + d[i] +
>>  '"]').parent().addClass('disabled');
>> // THE SELECTOR RETURNS 0
>>  ELEMENTS, ALTHOUGH THE MARKUP IS CORRECT.
>
> Break down the selector there a bit. It seems like the most likely
> broken spot is the check for an exact match between the href and d[i].
> If you switch it to [href~='+d[i]+']' do you still get a match?


[jQuery] Re: Custom ScrollBar

2009-02-16 Thread Alexandre Plennevaux

i personally have no issue with jscrollpane and jquery 1.3.1 _  i use
it extensively so i suggest that you recheck your code.



On Mon, Feb 16, 2009 at 4:29 PM, Alexandru Dinulescu
 wrote:
> Hello.
>
> I am looking for a custom vertical scrollbar plugin. I want to put it in a
> fluid width / height div, and so far i havent found anything. The only thing
> i did found is jScrollpane which doesnt like to work with jquery 1.3.1 so if
> anyone has any info please let me know.
>
> Thanks
>
> ---
> Alexandru Dinulescu
> Web Developer
> (X)HTML/CSS Specialist
> Expert Guarantee Certified Developer
> XHTML: http://www.expertrating.com/transcript.asp?transcriptid=1879053
> CSS : http://www.expertrating.com/transcript.asp?transcriptid=1870619
> RentACoder Profile:
> http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInfo.aspx?lngAuthorId=6995323
>
> MainWebsite: http://alexd.adore.ro
> Portofolio: http://alexd.adore.ro/project_page.php
>


[jQuery] jquery context menu plugin: issue with find()

2009-02-16 Thread Alexandre Plennevaux

Hi there,

Please save the life of those few hairs left on my skull. I've been
trying to understand why this doesn't work:

i'm using the jquery Context Menu
(http://abeautifulsite.net/notebook/80 ) to display a context menu
which options vary according to each item.

So i'm using a "data" custom attribute to store which options should
be active and the metadata plugin to retrieve the values. Works fine.

Now, i need to disable context menu options according to the fetched
data, but there, the functionality advertised on the plugin website
does not seem to work for me.
It is this part of the code which fails:

// THE PLUGIN CODE BIT
 // Disable context menu items on the fly
disableContextMenuItems: function(o)
{
if (o == undefined)
{
// Disable all
$(this).find('li').addClass('disabled');
return ($(this));
}
$(this).each(function()
{
if (o != undefined)
{
var d = o.split(',');
for (var i = 0; i < d.length; i++)
{

console.log('plugin is disabling option : ' +
d[i]); // RETURNS A VALID ANSWER
$(this).find('a[href="' + d[i] +
'"]').parent().addClass('disabled');  // THE SELECTOR RETURNS 0
ELEMENTS, ALTHOUGH THE MARKUP IS CORRECT.
}
}
});
return ($(this));
},


// MY SCRIPT
// it creates the contextMenu and disables for each file, the relevant options
$("a.folderLink").each(function()
{
var thisFolder = $(this);
thisFolder.contextMenu({ menu: 'contextMenu' },
function(action, el, pos)
{
var url = $(el).attr('href');
var directoryItem = $(el).attr('id');
alert('url : ' + $(el).attr('href') + '\nAction: ' +
action + '  \nElement ID: ' + directoryItem);

});
// disable non allowed options
var menuOptions = thisFolder.metadata({ type: 'attr', name: 'data' });
var optionsToDisable = [];
for (var my_option in menuOptions)
{
if (menuOptions.my_option == '0' || menuOptions.my_option
== null || typeof menuOptions.my_option === 'undefined')
{
optionsToDisable.push('#' + my_option);
}
}
if (optionsToDisable.length > 0)
{
optionsToDisable = optionsToDisable.join(',');
//optionsToDisable = "'" + optionsToDisable + "'";
console.log("optionsToDisable = " + optionsToDisable);
thisFolder.disableContextMenuItems(optionsToDisable);
}
thisFolder.disableContextMenuItems();
});


So that's it: the issue is with the find() call, which does not find
an element that is there in the markup.


[jQuery] Re: ui.tabs question

2009-01-22 Thread Alexandre Plennevaux

So i've tried using the latest build of ui1.6rc5, including the tabs +
jquery 1.3 and i reproduced exactly the demo sample available on the
jqueryUI ui.Tabs demo page with the required CSS files, but it still
breaks the tabbing functionality. I've reduced my code to simply call
$("#mydiv > ul).tabs();
Klaus can you please tell me if something has changed in the necessary
html markup from tabs 3 to the latest tab release? Is there something
else, specific, that i should look for ?
I'll try to isolate further my implementation to understand what the
problem is in the meanwhile but any pointers would be time savers for
me. Thanks a lot

alexandre

On Wed, Jan 21, 2009 at 11:30 PM, Alexandre Plennevaux
 wrote:
> In that case, thank you Klaus for the preventive comment.
>
> On Wed, Jan 21, 2009 at 11:25 PM, Klaus Hartl
>  wrote:
>>
>> Sorry to hear that, but I was only referring to MorningZ's example,
>> which contained an outdated syntax and I wanted to prevent you (and
>> everybody else) to use it and wonder why it wouldn't work.
>>
>> I'll try to quote better next time.
>>
>> --Klaus
>>
>>
>> On 21 Jan., 22:43, Alexandre Plennevaux  wrote:
>>> Well, quite Frankly Klaus, i started this project 3 years ago and i
>>> used the tabs when it was but a plugin like another.
>>> The fact that now i have to integrate ui.core with ui.tabs is not
>>> really a good thing in my case: i don't have needs for anything else
>>> from the ui library, therefore i wish that alongside, there was a
>>> distro as a standalone plugin.
>>> I'm using jquery 1.3 so i've made myself a personalised ui distro
>>> using rc5, but now it breaks the hell out of my app, i don't have tabs
>>> anymore so here i go, back to the starting point, redoing things that
>>> were actually working well, but for that one missing callback.
>>>
>>> ah, it's hard to have a reproach to make to jquery. First in 3 years
>>> in my case, and it's not like i'm mad or anything. Just ... annoyed.
>>>
>>> :)
>>>
>>> On Wed, Jan 21, 2009 at 7:30 PM, Klaus Hartl  
>>> wrote:
>>>
>>> > Seems to be using a fairly outdated version. The event's name to bind
>>> > has changed since quite a while. Why not take a look at the
>>> > documentation:
>>> >http://docs.jquery.com/UI/Tabs#Events
>>>
>>> > --Klaus
>>>
>>> > On 21 Jan., 16:36, MorningZ  wrote:
>>> >> I've got this code working if it helps
>>>
>>> >> $("#TabContainer ul.tabs").tabs().bind("select.ui-tabs", function(e,
>>> >> ui) {
>>> >>  //Code inside here runs when tab is selected
>>>
>>> >> });
>>>
>>> >> On Jan 21, 10:29 am, Alexandre Plennevaux 
>>> >> wrote:
>>>
>>> >> > Hi all,
>>>
>>> >> > I'm using ui.tabs and i would like to trigger a function when a tab is
>>> >> > clicked, or more precisely, when a new panel gets shown.
>>>
>>> >> > I figured from the doc i should use the select callback but that does
>>> >> > not work... HEre is the code i use
>>>
>>> >> > var $tabs = $("#tabbedTextContent").tabs({
>>> >> > selected: 0,
>>> >> > fx: { opacity: 'toggle', duration: 
>>> >> > 200 },
>>> >> > select: function(e, ui)
>>> >> > {
>>> >> > alert("hi");  //

[jQuery] Re: Download a file from server...

2009-01-21 Thread Alexandre Plennevaux

Well, AFAIK It HAS to be triggered by a click event on a A anchor, so,
just make sure your onclick handler returns true.

For the "force download" functionality, this writeup of mine might help you:

http://www.pixeline.be/blog/2009/php-force-download-script-convert-url-to-localpath/




On Thu, Jan 22, 2009 at 2:30 AM, MorningZ  wrote:
>
> You don't want AJAX in this situation have the page post like
> normal and do what you lay out above...  AJAX is *not* the solution to
> every problem
>
> On Jan 21, 6:46 pm, AlexDeLarge 
> wrote:
>> Hi,
>>
>> I have situation like this: I post certain data with $.post to PHP-
>> script which is supposed to handle the data, create a file from it and
>> then trigger browser to open a Save As-dialog. Everything works just
>> fine except the Save As-dialog, I just can't make it pop-up.
>>
>> For the Save As dialog the PHP-script ha s following statements:
>>
>> header('Content-disposition: attachment; filename=stats.txt');
>> header('Content-type: text/plain');
>> readfile('stats.txt');
>>
>> And this just doesn't work through $.post, or at least I can't make it
>> happen.
>>
>> Is there any way to make this work?


[jQuery] Re: ui.tabs question

2009-01-21 Thread Alexandre Plennevaux

In that case, thank you Klaus for the preventive comment.

On Wed, Jan 21, 2009 at 11:25 PM, Klaus Hartl
 wrote:
>
> Sorry to hear that, but I was only referring to MorningZ's example,
> which contained an outdated syntax and I wanted to prevent you (and
> everybody else) to use it and wonder why it wouldn't work.
>
> I'll try to quote better next time.
>
> --Klaus
>
>
> On 21 Jan., 22:43, Alexandre Plennevaux  wrote:
>> Well, quite Frankly Klaus, i started this project 3 years ago and i
>> used the tabs when it was but a plugin like another.
>> The fact that now i have to integrate ui.core with ui.tabs is not
>> really a good thing in my case: i don't have needs for anything else
>> from the ui library, therefore i wish that alongside, there was a
>> distro as a standalone plugin.
>> I'm using jquery 1.3 so i've made myself a personalised ui distro
>> using rc5, but now it breaks the hell out of my app, i don't have tabs
>> anymore so here i go, back to the starting point, redoing things that
>> were actually working well, but for that one missing callback.
>>
>> ah, it's hard to have a reproach to make to jquery. First in 3 years
>> in my case, and it's not like i'm mad or anything. Just ... annoyed.
>>
>> :)
>>
>> On Wed, Jan 21, 2009 at 7:30 PM, Klaus Hartl  
>> wrote:
>>
>> > Seems to be using a fairly outdated version. The event's name to bind
>> > has changed since quite a while. Why not take a look at the
>> > documentation:
>> >http://docs.jquery.com/UI/Tabs#Events
>>
>> > --Klaus
>>
>> > On 21 Jan., 16:36, MorningZ  wrote:
>> >> I've got this code working if it helps
>>
>> >> $("#TabContainer ul.tabs").tabs().bind("select.ui-tabs", function(e,
>> >> ui) {
>> >>  //Code inside here runs when tab is selected
>>
>> >> });
>>
>> >> On Jan 21, 10:29 am, Alexandre Plennevaux 
>> >> wrote:
>>
>> >> > Hi all,
>>
>> >> > I'm using ui.tabs and i would like to trigger a function when a tab is
>> >> > clicked, or more precisely, when a new panel gets shown.
>>
>> >> > I figured from the doc i should use the select callback but that does
>> >> > not work... HEre is the code i use
>>
>> >> > var $tabs = $("#tabbedTextContent").tabs({
>> >> > selected: 0,
>> >> > fx: { opacity: 'toggle', duration: 
>> >> > 200 },
>> >> > select: function(e, ui)
>> >> > {
>> >> > alert("hi");  //

[jQuery] Re: ui.tabs question

2009-01-21 Thread Alexandre Plennevaux

Well, quite Frankly Klaus, i started this project 3 years ago and i
used the tabs when it was but a plugin like another.
The fact that now i have to integrate ui.core with ui.tabs is not
really a good thing in my case: i don't have needs for anything else
from the ui library, therefore i wish that alongside, there was a
distro as a standalone plugin.
I'm using jquery 1.3 so i've made myself a personalised ui distro
using rc5, but now it breaks the hell out of my app, i don't have tabs
anymore so here i go, back to the starting point, redoing things that
were actually working well, but for that one missing callback.

ah, it's hard to have a reproach to make to jquery. First in 3 years
in my case, and it's not like i'm mad or anything. Just ... annoyed.

:)


On Wed, Jan 21, 2009 at 7:30 PM, Klaus Hartl  wrote:
>
> Seems to be using a fairly outdated version. The event's name to bind
> has changed since quite a while. Why not take a look at the
> documentation:
> http://docs.jquery.com/UI/Tabs#Events
>
> --Klaus
>
>
>
> On 21 Jan., 16:36, MorningZ  wrote:
>> I've got this code working if it helps
>>
>> $("#TabContainer ul.tabs").tabs().bind("select.ui-tabs", function(e,
>> ui) {
>>  //Code inside here runs when tab is selected
>>
>> });
>>
>> On Jan 21, 10:29 am, Alexandre Plennevaux 
>> wrote:
>>
>> > Hi all,
>>
>> > I'm using ui.tabs and i would like to trigger a function when a tab is
>> > clicked, or more precisely, when a new panel gets shown.
>>
>> > I figured from the doc i should use the select callback but that does
>> > not work... HEre is the code i use
>>
>> > var $tabs = $("#tabbedTextContent").tabs({
>> > selected: 0,
>> > fx: { opacity: 'toggle', duration: 200 
>> > },
>> > select: function(e, ui)
>> > {
>> > alert("hi");  //

[jQuery] Re: ui.tabs question

2009-01-21 Thread Alexandre Plennevaux

hi MorningZ

unfortunately that doesn't seem to work for me. Question: you attach
that event to the tabs ul element ?

On Wed, Jan 21, 2009 at 4:36 PM, MorningZ  wrote:
>
> I've got this code working if it helps
>
> $("#TabContainer ul.tabs").tabs().bind("select.ui-tabs", function(e,
> ui) {
> //Code inside here runs when tab is selected
> });
>
>
>
>
> On Jan 21, 10:29 am, Alexandre Plennevaux 
> wrote:
>> Hi all,
>>
>> I'm using ui.tabs and i would like to trigger a function when a tab is
>> clicked, or more precisely, when a new panel gets shown.
>>
>> I figured from the doc i should use the select callback but that does
>> not work... HEre is the code i use
>>
>> var $tabs = $("#tabbedTextContent").tabs({
>> selected: 0,
>> fx: { opacity: 'toggle', duration: 200 },
>> select: function(e, ui)
>> {
>> alert("hi");  //

[jQuery] ui.tabs question

2009-01-21 Thread Alexandre Plennevaux

Hi all,

I'm using ui.tabs and i would like to trigger a function when a tab is
clicked, or more precisely, when a new panel gets shown.

I figured from the doc i should use the select callback but that does
not work... HEre is the code i use

var $tabs = $("#tabbedTextContent").tabs({
selected: 0,
fx: { opacity: 'toggle', duration: 200 },
select: function(e, ui)
{
alert("hi");  //

[jQuery] Re: Problems with the New API Browser

2009-01-16 Thread Alexandre Plennevaux

Well, i for one really love the new API interface _ such a much less
noisy interface than the docs.jquery.com interface! clearer, snappier.
it turns out i don't use the navigation menu much, i use the filter
box mostly. that's probably why i'm not so annoyed by its limits.
really liked the interfacing with  jsbin, yet i would like to be able
to contribute with a comments system (like the awesome php doc, where
people conribute snippets related to the php function displayed on
that page). congratz Remy, and let us designers know if u need help !

On Fri, Jan 16, 2009 at 12:40 AM, Remy Sharp  wrote:
>
> I think the animation of menus is one for the options as well then.  I
> understand what you mean, once you're familiar with it, you just want
> to get on with it.
>
> On Jan 15, 9:28 pm, Ricardo Tomasi  wrote:
>> Two things bother me more:
>>
>> - James' #3 point, that other categories hide when you click one, an
>> accordion would be a better fit for quick navigation.
>> - the subcategories. I like to see the method's names directly,
>> deciding between "Hierarchy" or "Child filters" is not an intuitive
>> task. They should be in a kind of tree with the subcategories as
>> separators.
>>
>> These two things would speed up navigation a lot. As it is, it's quite
>> interesting the first time, but gets irritating after a while.
>>
>> Thanks for this Remy, and long live JSBin! :)
>>
>> cheers,
>> - ricardo
>>
>> On Jan 15, 6:35 pm, Remy Sharp  wrote:
>>
>> > Hi James,
>>
>> > Thank you for your detailed feedback - all good points.
>>
>> > I want to push out another release when 1.3.1 goes live - so I'd like
>> > to get some, if not all, of the feedback addressed (including others).
>>
>> > 1 + 2) almost the same thing - the first problem I see is the AIR
>> > browser, which obviously doesn't have a back browser button (which
>> > would be solved by your first point).  This needs some UI input (which
>> > I'll come on to in a minute).
>>
>> > 3) I've talked with Yehuda Katz, the original author of Visual jQuery,
>> > about navigation interfaces - there's two options (as alternatives to
>> > what I have now) that we talked about: tree nav and accordion.
>>
>> > Generally speaking, the tree navigation didn't take as well as the
>> > Visual jQuery approach.  An accordion (I think) would solve the issues
>> > you've specifically mentioned, but would also solve some similar
>> > feedback I've read, i.e. wanting to be able to scan a category whilst
>> > maintaining some hierarchy. (note that you can do this - but it
>> > doesn't quite solve the problem:http://api.jquery.com?category=attributes
>> > ).
>>
>> > 4) Easy to solve - I didn't have access to a designer (I'm a coder
>> > through and through) but a few simple tweaks to the CSS (I suspect)
>> > should sort this out.
>>
>> > 5) I've had the same feedback, but both as a pro *and* as a con (as
>> > you have) - so I was going to create an options area that would
>> > maintain some certain settings - the focus opacity being one of them.
>>
>> > 6) This is common piece of feedback - and simply a technical block I
>> > ran in to and ran out of time.  Permalinks are my to priority right
>> > now, I want people to link straight in to a specific function.  I
>> > won't be able to have the URL change as the user browses - but the
>> > title of the function (and probably some other visual que, i.e. icon)
>> > will give the user a permalink to the function.
>>
>> > I also want this to work for categories too, so:
>>
>> >http://api.jquery.com/attr-would show a list of all the matched
>> > functions (alahttp://api.jquery.com/?attr) - but I'd like it if the
>> > category hierarchy would also show in left sidebar.
>>
>> > In addition:
>>
>> >http://api.jquery.com/Core-would land open the Core category - and
>> > so on through the subcategories.
>>
>> > I'd be more than happy if you contact me offline to lend a hand with
>> > some of the UI changes required.
>>
>> > @Pappy - there's more I want to do with landing pages, but it's a
>> > slightly more complicated job (given that, I think, 1.3.1 is supposed
>> > to be going out next week) - but some fast view on all the functions
>> > would be useful - I agree.
>>
>> > If there's more feedback - I'd love to hear it - particular the issues
>> > people have.
>>
>> > Many thanks,
>>
>> > Remy.
>>
>> > On Jan 15, 4:22 am, James Van Dyke  wrote:
>>
>> > > Does anyone else find the new API browser to be a bit cumbersome?
>>
>> > > My gripes:
>>
>> > > 1)  No "back" link at top of vertical navigation list.  You must click
>> > > the category to cancel your choice and essentially go back.  However,
>> > > this isn't very intuitive and there aren't any affordances to this
>> > > behavior save for a small 'x' in the highlighted category box that
>> > > doesn't do anything on hover or even have a tooltip.
>>
>> > > 2)  The browser's back button is broken.  Kind of a big annoyance when
>> > > you're not used to the application.
>>
>> > > 3)  

[jQuery] Re: teaching jquery instead of javascript ?

2009-01-08 Thread Alexandre Plennevaux

hi Ricardo,  it's actually 120 hours per year, and it's the last two
years. so 240 hours.

On Fri, Jan 9, 2009 at 4:44 AM, Ricardo Tomasi  wrote:
>
> Yes but what happens when you find an error in your script? It might
> be a very basic mistake but you won't have a clue if you don't know
> javascript itself. What happens 5 years from know if a totally
> different library, with different syntax, takes over?
>
> I agree with Peter Higgins, it's much more useful to teach the basics
> first, then introduce jQuery, if they got the very basics then they
> can learn the rest on their own. It's like teaching someone to use the
> Blueprint CSS framework and not explaining what classes really are.
> They`ll find themselves lost at the first adversity.
>
> - ricardo
>
> Do you mean 2 hours a week for 3 years? That's enough to learn well 5
> different languages :D
>
> On Jan 8, 8:30 pm, Kean  wrote:
>> Your audience are designers, they will pick up jQuery faster because
>> they think in CSS.
>>
>> At what point do you teach them javascript?
>> When you teach them how to create plugins for jQuery.
>>
>> I hope this helps.
>>
>> On Jan 8, 2:13 pm, Nikola  wrote:
>>
>> > Why not integrate the basic "JavaScript Fundamentals" in each jQuery
>> > lesson.  You could show some general examples and explain the
>> > rudimentary JavaScript principal (I'm thinking a 15 minute
>> > introduction...) then teach the jQuery and demonstrate how and why
>> > jQuery is the "write less, do more" JavaScript library..  This way,
>> > students get the gist of the JavaScript while learning jQuery. This
>> > may not be as desirable as learning jQuery on top of a strong
>> > JavaScript foundation but it can certainly help them to become
>> > stronger jQuery developers while giving them an introductory
>> > foundation in JavaScript principals.


[jQuery] Re: teaching jquery instead of javascript ?

2009-01-08 Thread Alexandre Plennevaux

Yeah, actually me too. I remember i used bits of javascript but could
never get good at it. It's only with jquery that i became convinced
that it was the right technology and my personal flash killer
technology. I definitely know much more about javascript than before,
when i simply gave up on it because crossbrowser issues made it a
no-go.
Personally, i'm a jack of all trades, half designer half coder, that's
why i value all of you guys' opinion , keep them coming !


On Thu, Jan 8, 2009 at 11:43 PM, Nikola  wrote:
>
> That's very true and in fact that's how I'm learning JavaScript
> myself.  jQuery is an awesome way to learn, it's smart, fun and
> powerful.


[jQuery] Re: how to select all first td's inside all in a table

2009-01-08 Thread Alexandre Plennevaux

I believe you have two options:

$('tr>td')

or

$('tr td:first-child')

i've never used first-child myself so i may understand it wrongly.Let me know !

On Thu, Jan 8, 2009 at 10:58 PM, Tijmen Smit  wrote:
>
> I have a table that contains several , all of them look like
> this.
>
>
>20-04
>459
>559
>659
>439
>519
>599
>424
>489
>554
>
>
>27-04
>506
>606
>706
>486
>566
>646
>471
>536
>601
>
>
>
> One of the things that I would like to do is add the class "date" to
> the first td that exists after a .
>
> I came up with this -> $("#prijslijst-appartement tr td:eq
> (0)").addClass("date"); , but that doesn't really do what I thought It
> would. It only adds the date class to one td, and it ignores all the
> other  in the table. What I was hoping it would do is finding all
> , and then add the date class to the first  in all the  in
> the entire table.
>
> You can see the example here -> http://tijmensmit.com/dev/td/prijslijst.html.
> The one with the date class on it has the pink border around it.
>
> Its not only the first  which I should target, the 3th, 6th and
> 9th  within each  should also be given a different class.
>
> What would be the best way to do this, and to make sure it looks in
> all  in the entire table, and not stops after the first one?
>
> Thanks,
> Tijmen


[jQuery] Re: teaching jquery instead of javascript ?

2009-01-08 Thread Alexandre Plennevaux

Thanks seasoup, that's what i intended . Besides, the few hours they
will get to learn javascript may not be enough to give them a strong
basis. But i'm discovering the school, so i might be wrong. I'll
reconsider this next year. The option to teach jquery as a second
level course makes definitely a lot of sense though.

On Thu, Jan 8, 2009 at 11:02 PM, seasoup  wrote:
>
> I think that a designer who knows jQuery is ahead of those that do
> not.  I would love to work with a designer who could put together the
> rudimentary functionality of a website with jQuery. If designers can
> pick up jQuery that would be great, most designers do not bother to
> learn javascript.  There are exceptions, but generally it's just not
> the way they think.
>
> On the other hand, i would not tell the school that you will not teach
> javascript, you wont get the job.  Tell them you will introduce
> javascript through the jQuery framework instead.
>
> On Jan 8, 1:46 pm, "Andy Matthews"  wrote:
>> I'd look at teaching jQuery as a 2nd level course. Once you've covered at
>> least the basics of JavaScript, then you can get into jQuery.
>>
>> -Original Message-
>> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
>>
>> Behalf Of Klaus Hartl
>> Sent: Thursday, January 08, 2009 3:38 PM
>> To: jQuery (English)
>> Subject: [jQuery] Re: teaching jquery instead of javascript ?
>>
>> jQuery is JavaScript, and at some point you need to know JavaScript.
>>
>> I would never hire anyone who claims to know jQuery but not JavaScript.
>>
>> my 0.02$
>>
>> --Klaus
>>
>> On 8 Jan., 22:23, pixeline  wrote:
>> > Hello mates,
>>
>> > I will start to teach web usability to freshly graduated youngsters in
>> > a graphic design school  _ web dept, web dept.
>> > The Board recently proposed me to also take over javascript. Now i
>> > intend to them i'm not literate enough in javascript to actually teach
>> > it. But i proposed instead to teach jquery, with the main argument
>> > being: it's a 3-year programme, it's not with 2 hours a week that most
>> > kids will get professionnal level javascript skills. Teaching jquery
>> > on the other hand, may give these junior designers a useful knowledge
>> > and discover scripting from a starting point that they understand _
>> > not the (with all due respect:) ) geek's "code is poetry" point of
>> > view, but from the "in your face" designer point of view.
>>
>> > I would like to know what you guys think of my argument: is teaching
>> > the usage of a specific javascript framework relevant to the business
>> > world? Would you hire a freshman that cannot program pure javascript
>> > but can pretty much achieve the same result, in less time, with
>> > jquery?
>>
>> > Looking forward to reading your thoughts !
>>
>> > Cheers,
>>
>> > Alexandre


[jQuery] Re: teaching jquery instead of javascript ?

2009-01-08 Thread Alexandre Plennevaux

Thank you all guys, these are  very useful clarifications to me !

On Thu, Jan 8, 2009 at 10:46 PM, Andy Matthews  wrote:
>
> I'd look at teaching jQuery as a 2nd level course. Once you've covered at
> least the basics of JavaScript, then you can get into jQuery.
>
> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
> Behalf Of Klaus Hartl
> Sent: Thursday, January 08, 2009 3:38 PM
> To: jQuery (English)
> Subject: [jQuery] Re: teaching jquery instead of javascript ?
>
>
> jQuery is JavaScript, and at some point you need to know JavaScript.
>
> I would never hire anyone who claims to know jQuery but not JavaScript.
>
> my 0.02$
>
> --Klaus
>
> On 8 Jan., 22:23, pixeline  wrote:
>> Hello mates,
>>
>> I will start to teach web usability to freshly graduated youngsters in
>> a graphic design school  _ web dept, web dept.
>> The Board recently proposed me to also take over javascript. Now i
>> intend to them i'm not literate enough in javascript to actually teach
>> it. But i proposed instead to teach jquery, with the main argument
>> being: it's a 3-year programme, it's not with 2 hours a week that most
>> kids will get professionnal level javascript skills. Teaching jquery
>> on the other hand, may give these junior designers a useful knowledge
>> and discover scripting from a starting point that they understand _
>> not the (with all due respect:) ) geek's "code is poetry" point of
>> view, but from the "in your face" designer point of view.
>>
>> I would like to know what you guys think of my argument: is teaching
>> the usage of a specific javascript framework relevant to the business
>> world? Would you hire a freshman that cannot program pure javascript
>> but can pretty much achieve the same result, in less time, with
>> jquery?
>>
>> Looking forward to reading your thoughts !
>>
>> Cheers,
>>
>> Alexandre
>
>
>


[jQuery] Re: if statement testing for null value

2009-01-08 Thread Alexandre Plennevaux

try using !== instead of !=  as this checks also against the variable type.

you can also try

if ( typeof myvar ==='undefined'){
//error
}



On Thu, Jan 8, 2009 at 10:25 PM, Chuk  wrote:
>
> Hi.  I have a form with a disabled submit button when the page is
> loaded.  I'm trying to activate that submit button only when two text
> fields(ids="equipmentNumber" and "description") and three select boxes
> (ids="type","department"," and "location") contain a value.  Here is
> my current code:
>
> if ($('#equipmentNumber').val() != null && $('#description').val() !=
> null && $('#type').val() != null && $('#department') != null && $
> ('#location').val() != null)
> {
>$('#submit').attr("disabled",false);
> }
>
> However, this condition is always true...even if each field is blank.
> Does anyone see right off where I've messed up?


[jQuery] Re: Ajax: how to choose between post, get or ajax() ??

2009-01-08 Thread Alexandre Plennevaux

Thank you Mike. I 'm set to use ajax() because  i think i need the
cache option set to false.

On Thu, Jan 8, 2009 at 6:23 PM, Mike Alsup  wrote:
>
>> I need to silently update an xml file to store some user's usage
>> statistics, basically i pass an object to a php script, which
>> generates the xml and stores it in a file.
>>
>> Now, looking at the ajax chapter of the docs, i'm not quite sure
>> what's the best method to do that:
>> $.get, $.post or $.ajax ?
>>
>> I think $.post() is good enough for my need but i'd be very interested
>> to hear your opinion.
>
> $.get and $.post are just convenience methods that cover $.ajax.  In
> your case a 'get' is inappropriate (from a semantic point of view;
> you're changing data) so $.post or $.ajax should be used.  If you need
> fine-grained control over the options then use $.ajax.  Otherwise
> $.post will call $.ajax for you passing in default option values.
>
> Mike
>


[jQuery] Re: example on site, have question

2009-01-06 Thread Alexandre Plennevaux

Basically, what this snippet does, is

1/ adding a DIV element at the end of the BODY element;
2/ counting the new amount of DIV
3/ printing the string "there are XX dvis" in every SPAN element
available in the DOM
4/ triggering the onclick() event so the script runs once on page ready.

So the whole script actually runs whenever the document is ready, and
then every time someone clicks on the body.


On Tue, Jan 6, 2009 at 5:05 PM, Andy  wrote:
>
> I'm trying to figure out how this works.  It appears it is re-
> iterating the click function in this call.  Why would this work?  I
> don't see how I would know to create the method this way if I was
> going to recreate this.
>
>  $(document).ready(function(){
>
> $(document.body).click(function () {
> $(document.body).append($(""));
> var n = $("div").size();
> $("span").text("There are " + n + " divs." + "Click to add
> more.");
>  }).click(); // trigger the click to start
> });
>


[jQuery] Re: feature suggestion: .attr() without params returns the whole list of attributes

2009-01-06 Thread Alexandre Plennevaux

quite nice karl, thanx !

On Tue, Jan 6, 2009 at 6:09 PM, Karl Swedberg  wrote:
>
> I just played around in Firebug and noticed that DOM elements have an 
> "attributes" property (in Firefox, at least), so I tried this, using the 
> first textarea in my document as an example:
>
> var a = $('textarea')[0].attributes,
>   attrs = [];
> for (i=0; i < a.length; i++) {
>   attrs.push(a[i].nodeName + ': ' + a[i].nodeValue);
> }
> attrs.join('\n');
>
> and Firebug displayed all of the attributes, including expandos:
> "id: other_qualifications
>  name: other_qualifications
>  class: optional
>  rows: 3
>  itsalltext_uid: 212w1e1b2r3d231z2g232q302c2x231i1e172v342v3b1p1p"
>
> Not exactly what you wanted, but I still thought it was kind of cool/worth 
> sharing.
> --Karl
> 
> Karl Swedberg
> www.englishrules.com
> www.learningjquery.com
>
>
>
> On Jan 6, 2009, at 11:06 AM, Ricardo Tomasi wrote:
>
> You can't see all data saved either..
>
> On Jan 6, 12:01 pm, Balazs Endresz  wrote:
>
> Why not use $(el).data() for that?
>
> On Jan 6, 12:57 pm, "Alexandre Plennevaux" 
>
> wrote:
>
> I would like to suggest a feature to add to jquery attributes commands:
>
> I 'm using custom attributes to store UI states. At some point i would find
>
> it handy to be able to just console.log($(this).attr() ) to see all the
>
> attributes and their value.
>
> Not a groundbreaking change, but a nice -to-have...
>
> thanks
>
> Alexandre
>


[jQuery] feature suggestion: .attr() without params returns the whole list of attributes

2009-01-06 Thread Alexandre Plennevaux
I would like to suggest a feature to add to jquery attributes commands:

I 'm using custom attributes to store UI states. At some point i would find
it handy to be able to just console.log($(this).attr() ) to see all the
attributes and their value.

Not a groundbreaking change, but a nice -to-have...

thanks

Alexandre


[jQuery] animations staggering when $().load called _ advise please

2009-01-04 Thread Alexandre Plennevaux

Hello friends,

I have a dropdown menu that animates horziontally each time you click
on one its links. Some of them reveal  a submenu, others load some
html via  ajax ($(container).load();)  and others do both.

I notice that animations tend to stagger when ajax calls are under
progress . What would be a good approach to remove these lags? Of
course, once the data is loaded and in the cache, no more staggering.
There is a lot of html bits so preloading all of them is not really my
favourite option, so here i stand, asking for your advises.

Thank you and have a great week !

Alexandre


[jQuery] Re: Call object method onclick

2009-01-04 Thread Alexandre Plennevaux

this worked for me: http://jsbin.com/utahi

On Sun, Jan 4, 2009 at 5:31 PM, fatslags2...@gmail.com
 wrote:
>
> function Viewer()
> {
>
> };
>
> Viewer.prototype.constructor = Viewer;
>
> Viewer.prototype =
> {
>getFullAreaId: function() { return this._fullAreaId; },
>setFullAreaId: function(fullAreaId) { this._fullAreaId =
> fullAreaId; },
>
>initialize: function()
>{
>$("#thumbs img:first").click(/* execute this.doX on mouse
> click */);
>},
>
>doX: function()
>{
>alert(this.getFullAreaId());
>}
> };
>
> How can I make the click event execute the doX method?
>
> Regards,
> FatSlags2004


[jQuery] Re: event binding issue

2009-01-03 Thread Alexandre Plennevaux

Hi Michael ,

sorry it's my fault i made a stupid mistake somewhere else ( i dare
not tell you what it was, I think i'd better get some sleep :) ). The
code as such worked, so i would assume the wrap() does not unbind the
events.

Thanks again!

alexandre

On Sat, Jan 3, 2009 at 11:50 PM, Michael Geary  wrote:
>
> Without testing it, off the top of my head I think it may be the .wrap()
> that is doing you in. That has to remove the element from the DOM and
> re-insert it, and I think that loses the event binding.
>
> Also, I take it that $dsanchors refers to a UL, is that right? Then you're
> temporarily inserting the A element directly into the UL, which is invalid.
> Maybe browsers allow it anyway, but there's no guarantee what they will do.
>
> I would try this instead:
>
>$('' + linkText + '')
>.attr({
>'href': '#' + index,
>'id': index,
>'class': linkText == selected ? 'selected' : 'notSelected'
>})
>.wrap('')
>.appendTo($dsanchors);
>
>$('#'+index).bind('click', function() {
>    alert("hi");
>return false;
>});
>
> -Mike
>
>> -Original Message-
>> From: jquery-en@googlegroups.com
>> [mailto:jquery...@googlegroups.com] On Behalf Of Alexandre Plennevaux
>> Sent: Saturday, January 03, 2009 2:20 PM
>> To: Jquery-en
>> Subject: [jQuery] event binding issue
>>
>>
>> hello friends,
>>
>> i'm injecting a menu ( UL > LI > A markup) and binding each A
>> anchor a click event, but the event fails to trigger. Can you
>> explain me what i'm dooing wrong?
>>
>> here is the code sample:
>>
>>  $('' + linkText + '').appendTo($dsanchors).attr({
>> 'href': '#' + index,
>> 'id': index,
>> 'class': (linkText == selected) ? 'selected'
>> : 'notSelected'
>> }).bind('click', function()
>> {
>>
>> alert("hi");
>>
>> return false;
>> }).wrap('');
>>
>>
>> the html is correctly injected, but the event is not attached.
>>
>
>


[jQuery] event binding issue

2009-01-03 Thread Alexandre Plennevaux

hello friends,

i'm injecting a menu ( UL > LI > A markup) and binding each A anchor a
click event, but the event fails to trigger. Can you explain me what
i'm dooing wrong?

here is the code sample:

 $('' + linkText + '').appendTo($dsanchors).attr({
'href': '#' + index,
'id': index,
'class': (linkText == selected) ? 'selected' : 'notSelected'
}).bind('click', function()
{

alert("hi");

return false;
}).wrap('');


the html is correctly injected, but the event is not attached.


[jQuery] Re: setInterval(obj.method,200) problem: scoping?

2009-01-02 Thread Alexandre Plennevaux

nice example, now i think i get it.

Indeed actionscript (v2 at least) is based on ecmascript, much like
javascript if i'm not mistaken.
I came to web design/dev from actionscript one and gradually made my
way to jquery. Anyway, actionscript keeps you away from the internal
cooking by using a metaphor, "timeline": basically you work with
objects and organise them on a main timeline, "_root" (or "_level0").
Each object has its own timeline, can be put inside another object, so
you would address it as _root.myStepMother.face.hairyChin;

I wrongly assumed javascript would allow me to do it for
setInterval(). hehe, how boring would be the world without all these
little variations, now wouldn't it :) ?
That's pretty much the problem with using metaphors: it's nice to get
you fast into a certain task, but you have to actually break it up to
be able to master the technology behind.

Thank you Mike and Peter for your excellent help !


On Sat, Jan 3, 2009 at 2:44 AM, Michael Geary  wrote:
>
> Thanks, Alexandre, it's kind of you to say that.
>
> About this code...
>
>> datascape.myInterval = setInterval(window.datascape.move,400);
>
> Let's break it down a little. It's exactly the same as doing:
>
>  var callback = window.datascape.move;
>  datascape.myInterval = setInterval( callback, 400 );
>
> As you can see from this code, JavaScript doesn't "remember" that the
> callback function was a property of the datascape object. When you get a
> reference to the function, that's all you get, a reference to the function
> itself, without any information about what object the function may have been
> a method of. So when setInterval calls the function later, it just calls it
> as a plain old function, and "this" is the global/window object.
>
> Doesn't ActionScript work the same way? It may have a different global
> object, but I thought most of the JavaScript semantics were similar except
> for the ActionScript extensions. I haven't worked with ActionScript so I
> don't know.
>
> -Mike
>
>> From: Alexandre Plennevaux
>>
>> Michael, did you know that i 'm becoming a big fan of your
>> explanations?
>>
>> if i follow your explanation correctly, this should have
>> worked, isn't it ?
>>
>> datascape.myInterval = setInterval(window.datascape.move,400);
>>
>> Yet it didn't. I guess i 'm kind of assimilating the
>> javascript window object to actionscript's _root object, and
>> that assumption is probably plain wrong :)
>>
>>
>> On Fri, Jan 2, 2009 at 11:49 PM, Michael Geary  wrote:
>> >
>> > Hi Alexandre,
>> >
>> > Don't go adopting a coding practice just because of a
>> single mailing
>> > list message. :-)
>> >
>> > There's nothing wrong with quoting property names in an object
>> > literal, but the majority of experienced JavaScript
>> programmers do not
>> > quote them except when necessary. As an example, browse
>> through the jQuery source code:
>> >
>> > http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js
>> >
>> > Most of the property names in the code are not quoted, except for
>> > those few that are invalid identifiers or reserved words.
>> >
>> > Regarding setTimeout and setInterval, a minor nitpick on
>> terminology:
>> > "setTimeout and setInterval scope the called function to
>> the window object".
>> > Actually, the *scope* of the called function is determined by its
>> > position in the source code. JavaScript uses lexical
>> scoping, where a
>> > nested function can directly refer to variables declared in outer
>> > functions or in the global scope. That's why your
>> setInterval callback
>> > is able to use your thisObj variable, because the
>> interpreter follows
>> > the scope chain from the inner function up to the outer
>> function and finds the variable there.
>> >
>> > What you're talking about is the value of "this" in the setInterval
>> > callback. setInterval and setTimeout call your callback
>> function as a
>> > method of the global object (which is the window object in
>> a browser).
>> > Or another way to put it is that they don't call the function as a
>> > method of any object at all, and by default "this" is set
>> to the global object.
>> >
>> > In any case, terminology nitpicks aside, your code is the
>> right way to
>> > solve the problem! :-)
>> >
&g

[jQuery] Re: setInterval(obj.method,200) problem: scoping?

2009-01-02 Thread Alexandre Plennevaux

Thanks a lot Peter, that function is really neat !

On Sat, Jan 3, 2009 at 2:25 AM, pete higgins  wrote:
>
> Here is your orig snippet rewritten to use the rescope function I pasted:
>
> var datascape = {
>  'mouseX': 0,
>  'myInterval': 0,
>  'create': function(){
>  $('#datascape').bind('mousemove', rescope(this, function(e)
>   {
>   this.mouseX = e.pageX;
>   })).bind("mouseover", rescope(this, function()
>   {
>   this.myInterval = setInterval(rescope(this, "move"), 200);
>
>   })).bind("mouseout", rescope(this, function()
>   {
>   clearInterval(this.myInterval);
>   }));
>  },
>
>  'move': function(){
> $.log('datascape.move : mouseX = ' + this.mouseX);
>   }
> }
>
> Though I didn't test it ...
>
> You are calling window.datascape.move still in the "window scope",
> when you want the scope (this) to be retained throughout your function
> calls. Saving a ref to it (var self = this) and accessing it in a
> function is still the solution. rescope is just that wrapped in a
> function for sugar (more or less). By passing 'this' to the rescope()
> function, you are effectively doing the same as self = this;
> function(){ self.foo(); } .. I find it much cleaner (the non-stripped
> version of rescope() allows for passing an ambigious number of
> parameters to the rescope'd function) and easier to work with when I'm
> explicitly setting the execution scope.
>
> Regards,
> Peter Higgins
>
> On Fri, Jan 2, 2009 at 8:06 PM, Alexandre Plennevaux
>  wrote:
>>
>> Michael, did you know that i 'm becoming a big fan of your explanations?
>>
>> if i follow your explanation correctly, this should have worked, isn't it ?
>>
>> datascape.myInterval = setInterval(window.datascape.move,400);
>>
>> Yet it didn't. I guess i 'm kind of assimilating the javascript window
>> object to actionscript's _root object, and that assumption is probably
>> plain wrong :)
>>
>>
>> On Fri, Jan 2, 2009 at 11:49 PM, Michael Geary  wrote:
>>>
>>> Hi Alexandre,
>>>
>>> Don't go adopting a coding practice just because of a single mailing list
>>> message. :-)
>>>
>>> There's nothing wrong with quoting property names in an object literal, but
>>> the majority of experienced JavaScript programmers do not quote them except
>>> when necessary. As an example, browse through the jQuery source code:
>>>
>>> http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js
>>>
>>> Most of the property names in the code are not quoted, except for those few
>>> that are invalid identifiers or reserved words.
>>>
>>> Regarding setTimeout and setInterval, a minor nitpick on terminology:
>>> "setTimeout and setInterval scope the called function to the window object".
>>> Actually, the *scope* of the called function is determined by its position
>>> in the source code. JavaScript uses lexical scoping, where a nested function
>>> can directly refer to variables declared in outer functions or in the global
>>> scope. That's why your setInterval callback is able to use your thisObj
>>> variable, because the interpreter follows the scope chain from the inner
>>> function up to the outer function and finds the variable there.
>>>
>>> What you're talking about is the value of "this" in the setInterval
>>> callback. setInterval and setTimeout call your callback function as a method
>>> of the global object (which is the window object in a browser). Or another
>>> way to put it is that they don't call the function as a method of any object
>>> at all, and by default "this" is set to the global object.
>>>
>>> In any case, terminology nitpicks aside, your code is the right way to solve
>>> the problem! :-)
>>>
>>> -Mike
>>>
>>>> From: Alexandre Plennevaux
>>>>
>>>> hi donb, according to a lengthy discussion we had on this
>>>> mailinglist yesterday the quotes are good practice. see:
>>>> http://groups.google.com/group/jquery-en/msg/821f4eb134c51d3d
>>>>  (is is just one message on a 31-long thread, if u have time
>>>> ,read the whole thread it is interesting )
>>>>
>>>> As for this issue after extensive googling i found out that
>>>> setTimeout and setInterval scop

[jQuery] Re: setInterval(obj.method,200) problem: scoping?

2009-01-02 Thread Alexandre Plennevaux

Michael, did you know that i 'm becoming a big fan of your explanations?

if i follow your explanation correctly, this should have worked, isn't it ?

datascape.myInterval = setInterval(window.datascape.move,400);

Yet it didn't. I guess i 'm kind of assimilating the javascript window
object to actionscript's _root object, and that assumption is probably
plain wrong :)


On Fri, Jan 2, 2009 at 11:49 PM, Michael Geary  wrote:
>
> Hi Alexandre,
>
> Don't go adopting a coding practice just because of a single mailing list
> message. :-)
>
> There's nothing wrong with quoting property names in an object literal, but
> the majority of experienced JavaScript programmers do not quote them except
> when necessary. As an example, browse through the jQuery source code:
>
> http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js
>
> Most of the property names in the code are not quoted, except for those few
> that are invalid identifiers or reserved words.
>
> Regarding setTimeout and setInterval, a minor nitpick on terminology:
> "setTimeout and setInterval scope the called function to the window object".
> Actually, the *scope* of the called function is determined by its position
> in the source code. JavaScript uses lexical scoping, where a nested function
> can directly refer to variables declared in outer functions or in the global
> scope. That's why your setInterval callback is able to use your thisObj
> variable, because the interpreter follows the scope chain from the inner
> function up to the outer function and finds the variable there.
>
> What you're talking about is the value of "this" in the setInterval
> callback. setInterval and setTimeout call your callback function as a method
> of the global object (which is the window object in a browser). Or another
> way to put it is that they don't call the function as a method of any object
> at all, and by default "this" is set to the global object.
>
> In any case, terminology nitpicks aside, your code is the right way to solve
> the problem! :-)
>
> -Mike
>
>> From: Alexandre Plennevaux
>>
>> hi donb, according to a lengthy discussion we had on this
>> mailinglist yesterday the quotes are good practice. see:
>> http://groups.google.com/group/jquery-en/msg/821f4eb134c51d3d
>>  (is is just one message on a 31-long thread, if u have time
>> ,read the whole thread it is interesting )
>>
>> As for this issue after extensive googling i found out that
>> setTimeout and setInterval scope the called function to the
>> window object, not the object the setinterval is called in.
>>
>> Therefore here is how to do it:
>>
>> var datascape = {
>>'mouseX': 0,
>> 'myInterval': 0,
>> 'create': function(){
>>
>>  var thisObj = this;  //<-- store this object instance in a variable
>>
>>$('#datascape').bind('mousemove', function(e)
>>  {
>>  this.mouseX = e.pageX;
>>  }).bind("mouseover", function()
>>  {
>>  datascape.myInterval = setInterval(function() {
>> thisObj.move(); }, 1000);  // <-- use the vairable
>> referencing the instance
>>
>>  }).bind("mouseout", function()
>>  {
>>  clearInterval(datascape.myInterval);
>>  });
>> },
>>
>> 'move': function(){
>>$.log('datascape.move : mouseX = ' + this.mouseX);
>>  }
>>  }
>>
>> On Thu, Jan 1, 2009 at 3:46 PM, donb
>>  wrote:
>> >
>> > You should change 'move' to move (remove apostrophes).
>> >
>> >
>> > On Jan 1, 9:01 am, "Alexandre Plennevaux" 
>> > wrote:
>> >> Hello mates,
>> >>
>> >> i have an object datascape which among other things, contains a
>> >> property storing the mouse position, and a function that uses that
>> >> property. Inside another method i
>> >>
>> >> var datascape = {
>> >>'mouseX': 0,
>> >>'myInterval': 0,
>> >>'create': function(){
>> >>$('#datascape').bind('mousemove', function(e)
>> >> {
>> >> this.mouseX = e.pageX;
>> >> }).bind("mouseover", function()
>> >> {
>> >> this.myInterval = setInterval(this.move, 200);
>> >>
>> >> }).bind("mouseout", function()
>> >> {
>> >> clearInterval(this.myInterval);
>> >> });
>> >>},
>> >>
>> >>'move': function(){
>> >>   $.log('datascape.move : mouseX = ' + this.mouseX);
>> >> }
>> >>
>> >> }
>> >>
>> >> Yet the script does not work:
>> >> firebug console points at the setInterval call, saying:
>> >>
>> >> useless setInterval call (missing quotes around
>> >> argument?)http://localhost/prototype/_js/frontend/proto.03.js
>> >> Line 172
>> >>
>> >> can someone help me / explain what i'm doing wrong ?
>> >>
>> >> Thank you,
>> >>
>> >> Alexandre
>> >>
>> >> PS: to all jquerians: happy 2009 !!
>>
>
>


[jQuery] Re: setInterval(obj.method,200) problem: scoping?

2009-01-01 Thread Alexandre Plennevaux

hi Dave,

thanks a lot for the feedback. The reason i'm not using the dom but
rather more "conceptual" objects is because the application is quite
complex, and its easier for my small brain to keep track of all
variables as object properties.

On Fri, Jan 2, 2009 at 2:02 AM, Dave Methvin  wrote:
>
> Whoops, I missed the original issue, which was that setInterval needs
> to be told its this object.
>
> So change this:
>
> this.interval = setInterval(function(){
>$.log('datascape.move : mouseX = ' + this.mouseX);
>  }, 1000);
>
> to this:
>
> var self = this;
> this.interval = setInterval(function(){
>$.log('datascape.move : mouseX = ' + self.mouseX);
>  }, 1000);
>


[jQuery] Re: setInterval(obj.method,200) problem: scoping?

2009-01-01 Thread Alexandre Plennevaux

hi donb, according to a lengthy discussion we had on this mailinglist
yesterday the quotes are good practice. see:
http://groups.google.com/group/jquery-en/msg/821f4eb134c51d3d  (is is
just one message on a 31-long thread, if u have time ,read the whole
thread it is interesting )

As for this issue after extensive googling i found out that setTimeout
and setInterval scope the called function to the window object, not
the object the setinterval is called in.

Therefore here is how to do it:

var datascape = {
   'mouseX': 0,
'myInterval': 0,
'create': function(){

 var thisObj = this;  //<-- store this object instance in a variable

   $('#datascape').bind('mousemove', function(e)
 {
 this.mouseX = e.pageX;
 }).bind("mouseover", function()
 {
 datascape.myInterval = setInterval(function() {
thisObj.move(); }, 1000);  // <-- use the vairable referencing the
instance

 }).bind("mouseout", function()
 {
 clearInterval(datascape.myInterval);
 });
},

'move': function(){
   $.log('datascape.move : mouseX = ' + this.mouseX);
 }
 }

On Thu, Jan 1, 2009 at 3:46 PM, donb  wrote:
>
> You should change 'move' to move (remove apostrophes).
>
>
> On Jan 1, 9:01 am, "Alexandre Plennevaux" 
> wrote:
>> Hello mates,
>>
>> i have an object datascape which among other things, contains a
>> property storing the mouse position, and a function that uses that
>> property. Inside another method i
>>
>> var datascape = {
>>'mouseX': 0,
>>'myInterval': 0,
>>'create': function(){
>>$('#datascape').bind('mousemove', function(e)
>> {
>> this.mouseX = e.pageX;
>> }).bind("mouseover", function()
>> {
>> this.myInterval = setInterval(this.move, 200);
>>
>> }).bind("mouseout", function()
>> {
>> clearInterval(this.myInterval);
>> });
>>},
>>
>>'move': function(){
>>   $.log('datascape.move : mouseX = ' + this.mouseX);
>> }
>>
>> }
>>
>> Yet the script does not work:
>> firebug console points at the setInterval call, saying:
>>
>> useless setInterval call (missing quotes around 
>> argument?)http://localhost/prototype/_js/frontend/proto.03.js
>> Line 172
>>
>> can someone help me / explain what i'm doing wrong ?
>>
>> Thank you,
>>
>> Alexandre
>>
>> PS: to all jquerians: happy 2009 !!


[jQuery] setInterval(obj.method,200) problem: scoping?

2009-01-01 Thread Alexandre Plennevaux

Hello mates,

i have an object datascape which among other things, contains a
property storing the mouse position, and a function that uses that
property. Inside another method i

var datascape = {
   'mouseX': 0,
   'myInterval': 0,
   'create': function(){
   $('#datascape').bind('mousemove', function(e)
{
this.mouseX = e.pageX;
}).bind("mouseover", function()
{
this.myInterval = setInterval(this.move, 200);

}).bind("mouseout", function()
{
clearInterval(this.myInterval);
});
   },

   'move': function(){
  $.log('datascape.move : mouseX = ' + this.mouseX);
}
}

Yet the script does not work:
firebug console points at the setInterval call, saying:

useless setInterval call (missing quotes around argument?)
http://localhost/prototype/_js/frontend/proto.03.js
Line 172

can someone help me / explain what i'm doing wrong ?

Thank you,

Alexandre

PS: to all jquerians: happy 2009 !!


[jQuery] Re: Unable to populate my div in Firefox

2009-01-01 Thread Alexandre Plennevaux

try this:

function doData(p_id,cat,cat_id,first,last){
var url = "doData.php?p_id="+ p_id +"&cat="+ cat +"&cat_id=" + cat_id;
$('#doContainer').empty().load(url,function(htmlData,result));
if(result=="success"){
$(this).html(htmlData);
}else{
$(this).html("ERROR LOADING "+url);
}
}

On Thu, Jan 1, 2009 at 10:06 AM, sho...@ckwi.net  wrote:
>
> i m getting strange problem. i m unable to pupulate my div in Firefox
> Mozilla. but in IE i m getting no problem.
>
> i m using following function.
>
> function doData(p_id,cat,cat_id,first,last){
>
>document.getElementById("doContainer").innerHTML="";
>
>$.ajax({
>url : "doData.php?p_id="+ p_id +"&cat="+ cat +"&cat_id=" + 
> cat_id ,
>success : function (data) {
>$("#doContainer").html(data);  // this is not working in 
> firefox
>
>
>}
> });
>}
>
>
> $("#doContainer").html(data) is not working in firefox. plz give my
> any alternative solution r assist me to get it done. as i m in trouble
> due to this.
>


[jQuery] Re: A beautiful diagram

2009-01-01 Thread Alexandre Plennevaux

wow, that's an amazing library, some demos are really impressive! i
like the polar clock for instance:
http://raphaeljs.com/polar-clock.html

thanks for the link ricardo !

On Wed, Dec 31, 2008 at 10:50 PM, Ricardo Tomasi  wrote:
>
> raphael js might be of help: raphaeljs.com
>
> On Dec 31, 9:39 am, vlain  wrote:
>> Hi to everybody (happy 2009),
>>
>> I have to create a diagram (a view from some data). The diagram
>> includes objects (rectangle, rounded rectangle, ellipse...) and
>> connection beetween objects (different kind of lines). Each object
>> have to display some informations as clickable text and image.
>> Diagram has to allow simple cute effects (zoom_in, zoom_out,
>> highlight...) for example on mouse hover and so on.
>>
>> Any hints for a library/plugin above jQuery?


[jQuery] Re: HELP: Screening questions for JavaScript developer candidates:

2008-12-31 Thread Alexandre Plennevaux

friends, following what i learned in this post i'm busy rewriting my object.

i have a specific question.

in my old code i would have something like:

var datascape = new Object();
datascape.ini = function(){

datascape.availableWidth = $(window).width();
}

};


can i rewrite it like this:

var datascape= {
'ini': function(){
this.availableWidth = $(window).width();
}

So that, if i need it somewhere else, i can just get to its value
"datascape.availableWidth"  or do i have to explicitate it ?

var datascape= {
'ini': function(){
datascape.availableWidth = $(window).width();
}


Thanks !!!

On Wed, Dec 31, 2008 at 5:16 PM, pete higgins  wrote:
>
>> and, yeah, I usually put in bare keys (sans quotes) unless necessary, too.
>> Not sure why. I guess I just like the clean look.
>
> Yah, they just seem to be wasted bytes, huh?
>
> One thing to note, and the only reason I try to force myself to use
> the quotes is for portability. If the data is "really" JSON and
> expects to be consumed by languages not javascript, the quotes are
> [likely] necessary, eg PHP. js and php can share a common json
> fragment if they are quoted.
>
> $d = json_decode(file("someFile.json"));
> foreach($d as $item => $val){ .. }
>
> really its just a distinction between "what js can do" and "JSON"
>
> this isn't JSON:
> var foo = { bar:function(){ .. }, baz: new Date() };
>
> (I know you know, too, btw)
>
> About anything can be a key in JS. (DomNodes can't, though btw, but
> functions objects etc)
>
> var bar = { a:"b", c:"d" };
> var bar2 = [1,2,3,4];
> var foo = {};
> foo[bar] = "baz";
> foo[bar2] = "baz2";
>
> if(bar in foo){ console.log(foo[bar]); } // baz
> if(bar2 in foo){ console.log(foo[bar2]); } // baz2
>
> Fun. Thanks for the banter, Karl.
>
> Regards,
> Peter Higgins
>


[jQuery] Re: Setting the request header contentType

2008-12-31 Thread Alexandre Plennevaux
did you try playing with the $.ajax scriptCharset option ?
see: http://docs.jquery.com/Ajax/jQuery.ajax


On Wed, Dec 31, 2008 at 1:27 PM, AdrianMG  wrote:
>
> I am not pretty sure but I think you can work with UTF8 only in AJAX,
> but I recommend you work with UTF8 always
>
> On Dec 30, 2:09 pm, Romain Viovi  wrote:
>> Hello Everybody,
>>
>> I'm experiencing some problems with the $.ajax
>>
>> When sending simple post request, request Headers (logged with firebug)
>> are always "application/x-www-form-urlencoded; charset=UTF-8" tagged for
>> content-type
>>
>> see :
>>
>> Request Headers
>> User-Agent  Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5)
>> Gecko/2008120122 Firefox/3.0.5
>> Accept  */*
>> Accept-Language fr
>> Accept-Encoding gzip,deflate
>> Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
>> Keep-Alive  300
>> Connection  keep-alive
>> Content-Typeapplication/x-www-form-urlencoded; charset=UTF-8
>> X-Requested-WithXMLHttpRequest
>> Content-Length  152
>>
>> But, i'm always working with iso-8859-1 encoding, my page include
>> headers with the good charset, php.ini is set to the good default charset.
>>
>> So, when i retrieve the $_POST, i've to utf8_decode() cause utf8 datas
>> are retrieved and special chars as "é", "à" are not recognised
>>
>> I think I shouldn't have to do that...
>>
>> Here's the test.html file :
>>
>> > "http://www.w3.org/TR/html4/loose.dtd";>
>> 
>> 
>> 
>> Test encoding
>> > src="jquery-1.2.6.js">
>> 
>> 
>> 
>> 
>> > type="button" onclick="send();" value="ok" />
>> 
>> 
>> 
>> 
>>
>> function send(){
>> $.ajax({
>> type: "POST",
>> url: "./test.php",
>> contentType: "application/x-www-form-urlencoded;
>> charset=iso-8859-1",
>> data: {
>> qry: $('#qry')[0].value
>> },
>> success: function(data){
>> $('#answers').empty().append(data);
>> return;
>> }
>>
>> });
>> }
>> 
>> 
>> 
>>
>> And the test.php :
>>
>> > header("Content-Type: text/html; charset=ISO-8859-1");
>> var_dump($_POST);
>> ?>
>>
>> Thanx for the help !
>>
>> --
>> Romain Viovi
>> 42 rue Pigalle
>> 75009 Paris
>>
>> +33 6 63 16 90 15
>> +33 9 54 40 84 40
>>
>> romain.vi...@gmail.com


[jQuery] Re: HELP: Screening questions for JavaScript developer candidates:

2008-12-31 Thread Alexandre Plennevaux

Kean and especially Michael,

Thank you for sharing this very useful knowledge bit ! This must be
the most insightful thread in a while :)

Alexandre


On Wed, Dec 31, 2008 at 8:49 AM, Kean  wrote:
>
> Alexandre,
>
> Another word of caution. Do choose your labels carefully. Avoid
> keywords.
> Adding quotes to keyword labels ensure compatibility with YUI
> compressor.
>
> var a = {
>// new without quotes produce error in ie
>"new": function() {
>alert("new");
>},
>// class without quotes produce error in ie
>"class": function() {
>alert("class");
>},
>// YUI compressor won't compress if you have no quotes on keywords
>float: function() {
>alert("float");
>},
>int: function(){
>alert("int");
>}
> }
>
> a.new(); // still fails in ie
> a.class(); // still fails in ie
> a.float();
> a.int();
>


[jQuery] Re: HELP: Screening questions for JavaScript developer candidates:

2008-12-30 Thread Alexandre Plennevaux

why? It's just a shorthand, isn't it ? does it affect the computer
resources in any manner ?

On Wed, Dec 31, 2008 at 3:12 AM, Kean  wrote:
>
> Just a nitpick.
>
> Don't do this
> var datascape = new Object();
> var datascape2 = new Array();
>
> Instead
> var datascape = {};
> var datascape2 = [];
>
>
> On Dec 30, 1:27 pm, "Alexandre Plennevaux" 
> wrote:
>> wair, you're all scarrying me:
>>
>> i often do things like this:
>>
>> var datascape = new Object();
>>
>> datascape.el = $('#datascape');
>> datascape.ini = function(){
>> datascape.el.click(function(){
>>   dothis();
>>   dothat();
>> });
>>
>> }
>>
>> is this pattern causing a potential memory leak problem, because the
>> js object is linked to a DOM element?
>>
>> On Tue, Dec 30, 2008 at 10:10 PM, Kean  wrote:
>>
>> > A good reason why closure is used
>>
>> >http://yuiblog.com/blog/2006/06/01/global-domination/
>>
>> > On Dec 30, 1:04 pm, Kean  wrote:
>> >> Klaus is right,
>>
>> >> Here's an article about closure causing 
>> >> leakshttp://www.javascriptkit.com/javatutors/closuresleak/index.shtml
>>
>> >> On Dec 30, 4:38 am, "Alexandre Plennevaux" 
>> >> wrote:
>>
>> >> > Klaus, you got me: frankly i have no "real" idea what is the purpose
>> >> > of enclosure.
>> >> > That's abstract art to me. i just read in several places that it's
>> >> > good to use it, so i trust my sources, do it and move on. Not that i'm
>> >> > proud of it, but, to use a metaphor, one does not need to know the
>> >> > internals of a car in order to be able to drive it, although it surely
>> >> > is a valuable knowledge if one wants to keep its car in a good state !
>> >> > Yet, since the car changes every six months, it's just up to you,
>> >> > wheather you're driven by the pure developer's passion or by consumer
>> >> > pragmatism.
>>
>> >> > On Tue, Dec 30, 2008 at 1:28 PM, Klaus Hartl 
>> >> >  wrote:
>>
>> >> > > On 30 Dez., 08:45, "Alexandre Plennevaux" 
>> >> > > wrote:
>> >> > >> "JavaScript enclosures"?
>>
>> >> > >> i think it has to do with encapsulating your code inside a function 
>> >> > >> so
>> >> > >> that all vars are inside the function's scope, so not cluttering the
>> >> > >> global namespace.
>> >> > >> This, to avoid memory leak.
>>
>> >> > > Are you implying that global variables do leak memory? There are good
>> >> > > reasons to not clutter the global namespace but I don't believe
>> >> > > avoiding leaks is one of them.
>>
>> >> > > Actually you do increase the chance to create leaks in IE if you use
>> >> > > closures under certain circumstances.
>>
>> >> > > --Klaus


[jQuery] Re: HELP: Screening questions for JavaScript developer candidates:

2008-12-30 Thread Alexandre Plennevaux

wair, you're all scarrying me:

i often do things like this:

var datascape = new Object();

datascape.el = $('#datascape');
datascape.ini = function(){
datascape.el.click(function(){
  dothis();
  dothat();
});
}


is this pattern causing a potential memory leak problem, because the
js object is linked to a DOM element?



On Tue, Dec 30, 2008 at 10:10 PM, Kean  wrote:
>
> A good reason why closure is used
>
> http://yuiblog.com/blog/2006/06/01/global-domination/
>
>
>
> On Dec 30, 1:04 pm, Kean  wrote:
>> Klaus is right,
>>
>> Here's an article about closure causing 
>> leakshttp://www.javascriptkit.com/javatutors/closuresleak/index.shtml
>>
>> On Dec 30, 4:38 am, "Alexandre Plennevaux" 
>> wrote:
>>
>> > Klaus, you got me: frankly i have no "real" idea what is the purpose
>> > of enclosure.
>> > That's abstract art to me. i just read in several places that it's
>> > good to use it, so i trust my sources, do it and move on. Not that i'm
>> > proud of it, but, to use a metaphor, one does not need to know the
>> > internals of a car in order to be able to drive it, although it surely
>> > is a valuable knowledge if one wants to keep its car in a good state !
>> > Yet, since the car changes every six months, it's just up to you,
>> > wheather you're driven by the pure developer's passion or by consumer
>> > pragmatism.
>>
>> > On Tue, Dec 30, 2008 at 1:28 PM, Klaus Hartl  
>> > wrote:
>>
>> > > On 30 Dez., 08:45, "Alexandre Plennevaux" 
>> > > wrote:
>> > >> "JavaScript enclosures"?
>>
>> > >> i think it has to do with encapsulating your code inside a function so
>> > >> that all vars are inside the function's scope, so not cluttering the
>> > >> global namespace.
>> > >> This, to avoid memory leak.
>>
>> > > Are you implying that global variables do leak memory? There are good
>> > > reasons to not clutter the global namespace but I don't believe
>> > > avoiding leaks is one of them.
>>
>> > > Actually you do increase the chance to create leaks in IE if you use
>> > > closures under certain circumstances.
>>
>> > > --Klaus


[jQuery] selector question: how many ul above $(this) ?

2008-12-30 Thread Alexandre Plennevaux

hello mates,

i have a multiple level dropdown menu, the markup is an unordered list
of the likes:


me
  me
 me
   me
 me
 me
  

me
   
me
 me
 me
   me
 me
 me
  

me
   


me


Imagine i click in the link 3 levels down the list. Can someone tell
me how i can find the value "3", meaning, the amount of parent ul?
i tried

var $thisA = $(this);
var $thisLI = $thisA.parent();
var $thisMenu = $thisLI.parent();
var $thisSubmenu = $thisLI.children('ul');

var thisMenuLevelInt = $thisLI.parents().index($thisMenu[0]);

but that always returns 0.


Your help is as usual, *much* appreciated !

Alexandre


[jQuery] Re: HELP: Screening questions for JavaScript developer candidates:

2008-12-30 Thread Alexandre Plennevaux

Klaus, you got me: frankly i have no "real" idea what is the purpose
of enclosure.
That's abstract art to me. i just read in several places that it's
good to use it, so i trust my sources, do it and move on. Not that i'm
proud of it, but, to use a metaphor, one does not need to know the
internals of a car in order to be able to drive it, although it surely
is a valuable knowledge if one wants to keep its car in a good state !
Yet, since the car changes every six months, it's just up to you,
wheather you're driven by the pure developer's passion or by consumer
pragmatism.



On Tue, Dec 30, 2008 at 1:28 PM, Klaus Hartl  wrote:
>
> On 30 Dez., 08:45, "Alexandre Plennevaux" 
> wrote:
>> "JavaScript enclosures"?
>>
>> i think it has to do with encapsulating your code inside a function so
>> that all vars are inside the function's scope, so not cluttering the
>> global namespace.
>> This, to avoid memory leak.
>
> Are you implying that global variables do leak memory? There are good
> reasons to not clutter the global namespace but I don't believe
> avoiding leaks is one of them.
>
> Actually you do increase the chance to create leaks in IE if you use
> closures under certain circumstances.
>
> --Klaus


[jQuery] Re: HELP: Screening questions for JavaScript developer candidates:

2008-12-29 Thread Alexandre Plennevaux

"JavaScript enclosures"?


i think it has to do with encapsulating your code inside a function so
that all vars are inside the function's scope, so not cluttering the
global namespace.
This, to avoid memory leak.

something the likes:

(function(){
/// your code goes here

})(jquery);

I have absolutely no idea if this bits-and-pieces knowledge of mine is
any good, or even if it makes sense :)



On Tue, Dec 30, 2008 at 6:14 AM, Angel Marquez  wrote:
> haha
> they are contemplating hiring me!
> I already sent it back and thought I'd post it here to see the response.
> Appreciate it.
> I think my answers were correct..
> The first argument method is 'void', correct?
>
> On Mon, Dec 29, 2008 at 9:07 PM, Michael Geary  wrote:
>>
>> Huh?
>>
>> Are you writing these questions, or you've been given them to answer and
>> you're looking for help answering them, or what?
>>
>> If you're looking for the answers, is the potential employer
>> contemplating hiring you, or hiring the rest of us in this group? :-)
>>
>> The list seems to be first and foremost a test to weed out older
>> candidates. You need mighty good eyes to read that tiny font!
>>
>> Anyway, let me skip right to the end:
>>
>> BONUS 7: (Super-impressive) Q: Can you summarize the definition of
>> "JavaScript enclosures"?
>>
>> No, I can't. Can you? What the heck is a "JavaScript enclosure"?
>>
>> -Mike
>>
>> p.s. Is there anything to do with jQuery here?
>>
>> 
>> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
>> Behalf Of Angel Marquez
>> Sent: Monday, December 29, 2008 7:48 PM
>> To: jquery-en@googlegroups.com
>> Subject: [jQuery] HELP: Screening questions for JavaScript developer
>> candidates:
>>
>> (required) Q: Describe the difference in result of the JavaScript DOM
>> methods getElementById and getElementsByClassName.
>>
>> 2. (required) Given this JavaScript statement:
>>
>>objXHR.open('GET',' HYPERLINK "http://"; http://myURL.com',true);
>>
>> a. Q: What, probably, is the type of the object named "objXHR"?
>>
>> b. Q: What is the purpose of each of the parameters being passed
>> to the "open" method?
>>
>> Q: If an absolute URL is passed in the second argument, what kind of
>> restriction usually applies?
>>
>>3. (required) How would you (a) declare and then (b) instantiate a
>> JavaScript class to describe a "Square" object, taking one argument in its
>> constructor?  The instance of a Square should have sides 4 units in length.
>> ( c )What properties might a Square object have and how would they be coded?
>>
>> a. declare: function Square(numericSideArgument) {
>> ... (some other stuff)
>> }
>> b. use: var mySquare = new Square(4);
>> c. methods: perimeter, coded as "this.perimeter =
>> numericSideArgument * 4;"
>>   area, coded as "this.area =
>> numericSideArgument ^ 2;" (squared, i.e. width * height)
>> So, the whole definition of Square would be:
>>
>> function Square(numericSideArgument) {
>>
>>this.perimeter = numericSideArgument * 4;
>> this.area = numericSideArgument ^ 2;
>> return this;
>>
>>}
>>
>> So, Q: "mySquare.perimeter" would equal?
>>
>>  Q: "mySquare.area" would equal ?
>>
>>   4. (desired) An object called "auto" has an "id" attribute with value of
>> "taurus" and a "color" attribute with value "blue".  Additionally, it has a
>> child object "radio", which contains an array "knob" which contains three
>> items with names and shapes:
>>
>> name: power, shape: round
>>
>> name: tune, shape: oval
>>
>> name: scan, shape: square
>>
>> Q: What does the acronym JSON stand for?
>> Q: What does this object look like in JSON?
>>
>>BONUS 5. (CSS-related) Describe the difference between a  element
>> versus a .
>>
>>BONUS 6. (Advanced JavaScript and YUI) If I have a JavaScript
>> collection object "YAHOO.util.Dom" with a member method "setStyle" that
>> takes three arguments
>>
>> "an array of element id's"
>>
>> "a css property name", and
>>
>> "a single float value",
>>
>> ...Q: how would I write the single line of JavaScript that sets the
>> transparency of DIV's "layer1" and "layer2" to "66%"?
>>
>> Q: How would I write the single line of JavaScript that sets the
>> background color of only DIV "layer1" to hexadecimal "black"?
>>
>> Q: If there was another method which DID take a single-value,
>> non-array, in that first argument, in object-oriented terminology, the
>> method would be said to be "what"?
>>
>> Q: Does JavaScript support overloading?
>>
>> BONUS 7: (Super-impressive) Q: Can you summarize the definition of
>> "JavaScript enclosures"?
>
>


[jQuery] Re: load() callback only performs once every two click

2008-12-29 Thread Alexandre Plennevaux

hey ricardo, thanks for the input. I found the error: i was actually
hiding the load container somewhere else in the code. *sight*...

On Tue, Dec 30, 2008 at 5:52 AM, Ricardo Tomasi  wrote:
>
> I don't see any click event handlers, and from what it looks you can't
> tell visually if the load() was successful because on the 2nd time the
> background is already red.
>
> On Dec 29, 9:07 pm, "Alexandre Plennevaux" 
> wrote:
>> Strange...
>>
>> i'm loading html inside a div, and have this callback:
>>
>>  $('#datascape').show().load('index.php?splash=labau',{}, function(html, 
>> result)
>> {
>>
>> $('#datascape').css({background: 'red'});
>>
>> });
>>
>> yet, the callback performs only once out of 2 triggering calls.
>> Firebug does log each call correctly so it seems it's a rendering
>> issue, yet it happens in FF3, IE7 and chrome.
>>
>> Does this weirdness sound familiar to you, or any idea what's going wrong?
>>
>> Thanks,
>>
>> Alexandre


[jQuery] load() callback only performs once every two click

2008-12-29 Thread Alexandre Plennevaux

Strange...

i'm loading html inside a div, and have this callback:

 $('#datascape').show().load('index.php?splash=labau',{}, function(html, result)
{

$('#datascape').css({background: 'red'});

});


yet, the callback performs only once out of 2 triggering calls.
Firebug does log each call correctly so it seems it's a rendering
issue, yet it happens in FF3, IE7 and chrome.

Does this weirdness sound familiar to you, or any idea what's going wrong?

Thanks,

Alexandre


[jQuery] Re: loading a DOM fragment via ajax

2008-12-29 Thread Alexandre Plennevaux

thanks it works indeed. one thing though: apparently, the load() call
does load the entire html spitted by the server side script or html
page, the selector is actually "just" trimming the loaded content. So
it's not a reduction of the amount of data loaded, just a welcome help
to reduce further dom querying.



On Mon, Dec 29, 2008 at 11:15 PM, Mike Alsup  wrote:
>
>> thank you Mike !
>>
>> Now, i don't actually want to display the loaded content, just need to
>> traverse it, and generate a submenu (one  element per  element
>> found, using the h3 element attributes). Can i actually load it inside
>> a variable?
>
> Sure.  I think this will work:
>
> $('').load("myfile.php #dsViewport h3");


[jQuery] Re: loading a DOM fragment via ajax

2008-12-29 Thread Alexandre Plennevaux

thank you Mike !

Now, i don't actually want to display the loaded content, just need to
traverse it, and generate a submenu (one  element per  element
found, using the h3 element attributes). Can i actually load it inside
a variable?


On Mon, Dec 29, 2008 at 10:47 PM, Mike Alsup  wrote:
>
>> say i have a html file containing a #viewPort div, with a series of
>> divs each containing an h4 tag.
>>
>> If the file was not external, i would simply select what i need like this:
>>
>> $('#dsViewport h3');
>>
>> Now, it is an external file,  so my question is: is it possible to
>> load this file via $.load("myfile.php#dsViewport h3");  or is the
>> syntax different, or not possible at all ?
>>
>> Thank you for your insight,
>>
>> Alexandre
>
> I  believe the syntax you need is this:
>
> $('#someElement').load("myfile.php #dsViewport h3");
>
> The first space delimits the url.  Everything after that is a
> selector.
>
>


[jQuery] Re: HOW: jQuery AJAX to replace iFRAME

2008-12-29 Thread Alexandre Plennevaux

add to the script:

return false;

to prevent the default  behaviour


$(document).ready(function(){
$('a.ajaxLink').click(function(){
var url = $(this).attr('href');
$('#ihateiframes').empty().load(url);
});
return false;
});


On Mon, Dec 29, 2008 at 3:32 PM, BlueStunt  wrote:
>
> I'm trying to do the same thing, the code you suggested works, but the
> text on the page changes to what's in the html file I link to but then
> the browser also moves to the page, how do i stop this?
> On Dec 22, 1:51 pm, "Alexandre Plennevaux" 
> wrote:
>> say the container that will display the loaded content, i.e, your iframe
>> becomes
>>
>> 
>> click me
>> click me 2
>> 
>> this will be replaced
>> 
>>
>> your javascript will be:
>>
>> $(document).ready(function(){
>> $('a.ajaxLink').click(function(){
>> var url = $(this).attr('href');
>> $('#ihateiframes').empty().load(url);
>>
>> });
>> });
>> On Mon, Dec 22, 2008 at 6:51 AM, Ayan  wrote:
>>
>> > Hi
>>
>> > Currently my page has a iFrame (loads an external web-page) in it.
>>
>> > I have seen this tutorial that uses simple AJAX to replace this
>> > iFrame.
>> >http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm
>> > (see the small DEMO, I want exactly the same with just 2 Links)
>>
>> > My question is - How can I do the same using jQuery's AJAX to do the
>> > same ?
>>
>> > Thats is, when these 2 Button/Link hit, it will fetch corresponding
>> > remote html and paste it in a DIV. Thats it.
>>
>> > Please do reply.
>>
>> > Ayan Debnath
>> > INDIA.
>


[jQuery] loading a DOM fragment via ajax

2008-12-29 Thread Alexandre Plennevaux

Hello Friends,

say i have a html file containing a #viewPort div, with a series of
divs each containing an h4 tag.

If the file was not external, i would simply select what i need like this:

$('#dsViewport h3');

Now, it is an external file,  so my question is: is it possible to
load this file via $.load("myfile.php#dsViewport h3");  or is the
syntax different, or not possible at all ?

Thank you for your insight,

Alexandre


[jQuery] Re: Getting a menu item Li to do 2 things at once? onclick AND regular href trigger?

2008-12-29 Thread Alexandre Plennevaux

really?  I thought one had to namespace an event for it not to
overwrite previously set behaviours.

$('a').bind('click.scroll',function(){
 scrollTo(moon);
 });

$('a').bind('click.alert1',function(){
alert('Me works too'); });
 });


On Mon, Dec 29, 2008 at 5:06 PM, Ricardo Tomasi  wrote:
>
> You can add as many listeners as you want:
>
> $('a').click(function(){
> scrollTo(moon);
> });
>
> $('a').click(function(){
> alert('Me works too');
> });
>
> $('a').click(function(){
>alert('damn, stop using alerts');
> });
>
> $('a').click(function(){
>openFlash();
> });
>
>
> On Dec 29, 7:37 am, yvonney  wrote:
>> Hi... just starting out to get this going.
>>
>> I'm guessing that the reason onclick code has the #, for example: > href="#" onclick="someFunction.add "etc code etc etc" >
>>
>> is because it can't do the onclick AND more typical things like this
>> example:
>>
>> 
>>
>> Is because they conflict...
>>
>> SOo!
>>
>> I have my Li/ul menu code doing a bunch of scrollto stuff. Took weeks
>> to figure out.
>>
>> NOW I need to have the SAME menu, when I click on the Li's bring up a
>> different flv video for each menu item (li)
>>
>> sheeesh... do I use live query or what.
>> I'm REALLY stumped... I do have a much greater 'sorta'  understanding
>> of the: neolao flv player, swfobject2, jquery.swfobject.js, jmedia
>> plugin, luke's flash plugin, and malsup's medai plugin.
>>
>> whew! :--)
>>
>> Though the REAL problem is to get some kinda elegant way of having the
>> flv videos play in a seperate div location (stop when new video starts
>> as well) when I click on each and every menu item.
>>
>> And, there menu items already are doing their scrollto coda-scroller
>> type thing already.
>>
>> Yes... this question is my biggest question ever...
>> Could a guru please comment on how to get the menu items to do BOTH
>> what they're doing now as standard   
>> AND also do the calling of the (I guess?) onclick thing to call the
>> videos individually at the same time.
>>
>> I guess it shouldn't take me more than all year to do... hehehe what's
>> left of it thank fully! if that makes sense...hehehe
>>
>> thank you for reading.


[jQuery] Re: Hiding a div with content loaded via .load function

2008-12-29 Thread Alexandre Plennevaux

you have to make sure the DOM element (i.e. your close button) is
available when you define your "close()" function. or use the
livequery plugin. or use event delegation.

On Mon, Dec 29, 2008 at 4:09 AM, amnesia440  wrote:
>
> Hello.
>
> I am trying to load a login form into the #login_pop_box div via
> the .load function:
>
> $('#login_pop_box').hide();
>  $('a#login_pop_box_on').click(function() {
>$('#login_pop_box').load('ajax/login_global');
>$('#login_pop_box').fadeIn('400');
>  });
>  $('a#login_pop_box_off').click(function() {
>$(this).parents('#login_pop_box').fadeOut('300');
>  })
>
> This works, but when I try to cose the window with a link contained in
> the content I just loaded, nothing happens.
>
> Here is the link i the loaded content:
> [x]close
>


[jQuery] Re: Please help with navigation script

2008-12-28 Thread Alexandre Plennevaux
hi pranshu,

it's hard to tell exactly, you could optimize a bit more your code,
and use variable caching for example.
In this regard, I find this post to be really helpful:
http://www.tvidesign.co.uk/blog/improve-your-jquery-25-excellent-tips.aspx

anyway,  does the problem occur if you comment out each
$('#refine_by').text()  calls, such as   $('#refine_by').text('Refine
by category'); ?







On Sun, Dec 28, 2008 at 11:27 PM, precar  wrote:
>
> Still stuck on this...would really appreciate someone's help.
>
>
> Thanks,
> Pranshu.
>
>
> On Dec 27, 11:56 am, precar  wrote:
>> Hi,
>>
>> I cleaned up the code a bit and wanted to repost it.  The site is 
>> athttp://pranshuarya.com/test/pthesis/.  Once again, the specific
>> problem is this:
>> When you click Portfolio > Refine by category and select a category,
>> it loads and works fine. But then you cannot re-click on Refine by
>> category to select another category. The link stops working after it's
>> been used once.
>>
>> // display category list in pop-up
>> $.get('categories.php',function(cats) {
>>$('#refine_by').toggle(function() {
>>   $('#refine_by').text('Click to close');
>>   $('#categories').append('> div>').append('reset').show('slow').append
>> ('');
>>   $(cats).find('categories').each(function() {
>>  var $entry = $(this);
>>  var $cat = $entry.find('category').text();
>>  var category = '' + $cat + '';
>>  $('#categories ul').append($(category));
>>  });
>>   $('#category_close').click(function() {
>>  $('#categories').hide('slow');
>>  $('#refine_by').text('Refine by category');
>>  });
>>   $('#reset_sites').click(function() {
>>  reset_sites();
>>  });
>>
>> // selection from category list
>> $('#categories ul li').bind('click',function() {
>>var index = $('#categories ul li').index(this);
>>$.throbberShow({image:'images/ajax-loader.gif', parent:'#sites'});
>>$.get(index + ".php",function(data) {
>>var $category = $(cats).find('category').eq(index).text();
>>$('#sites').empty().append('').append
>> ('Click to close')
>>.append('');
>>$(data).find('site').each(function() {
>>   var $entry = $(this);
>>   var $site_title = $entry.find('site_title').text();
>>   var html_site = '' + $site_title + '';
>>   $('#sites ul').append($(html_site));
>>   });
>>cat_box_close();
>>
>> // site details for category-filtered sites
>> $('#sites ul li').bind('click',function() {
>>var index = $('#sites ul li').index(this);
>>$('#site_details').empty().append('> id="site_details_lower_border">');
>>$('li:not(this)').removeClass('selected');
>>$(this).addClass('selected');
>>$imageURL = $(data).find('imageURL').eq(index).text();
>>$skills = $(data).find('skills_used').eq(index).text();
>>$siteURL = $(data).find('siteURL').eq(index).text();
>>
>>var html_image = '';
>>$('#site_details').append($(html_image));
>>$('#site_details div').addClass('screenshot');
>>
>>if($(data).find('imageURL2').eq(index).text() != '') {
>>   $imageURL2 = $(data).find('imageURL2').eq(index).text();
>>   var html_image2 = '';
>>   if($(data).find('siteURL2').eq(index)) {
>>  $siteURL2 = $(data).find('siteURL2').eq(index).text();
>>  html_image2 += '';
>>  }
>>   else
>>  html_image2 += '';
>>   $('#site_details').append($(html_image2));
>>   $('#site_details div').addClass('screenshot');
>>   }
>>else
>>   $('#site_details div.screenshot').removeClass
>> ('screenshot').addClass('screenshot_single');
>>
>>$('a...@href^=http]').attr({'target': '_blank'}).attr({'title':
>> 'Visit site'});
>>
>>if($(data).find('description').eq(index)) {
>>   $desc = $(data).find('description').eq(index).text();
>>   var html_desc = '' + $desc + '';
>>   $('#site_details').append($(html_desc));
>>   }
>>if($(data).find('site_details').eq(index) != '') {
>>   $details = $(data).find('site_details').eq(index).text();
>>   var html_details = '' + $details + '> div>';
>>   $('#site_details').append($(html_details));
>>   }
>>
>>var html_skills = 'Skills used:> strong>' + $skills + '';
>>$('#site_details').append($(html_skills));
>>});
>> // end of site details for category-filtered sites
>>});});
>>
>> // End of category list pop-up
>>
>> },
>>
>> // other part of toggle function on #refine_by
>>   function() {
>>  cat_box_close();
>>   });
>>});
>>
>> Thanks,
>> Pranshu.
>>
>> On Dec 27, 7:29 am, donb  wrote:
>>
>> > I didn't look too deeply into the code, but I suspect you are
>> > expecting appended elements to respond to click events, but those new
>> > elements will have no click event present, only the ones initially
>> > created by the ready function.
>>
>> > A working example link would be helpful.
>>
>> > On Dec 26, 1:13 pm, precar  wrote:
>>
>> > > H

[jQuery] Re: Code not working in IE but is working in FF

2008-12-28 Thread Alexandre Plennevaux

can u show your updated code ?

On Sun, Dec 28, 2008 at 4:02 PM, Althalos  wrote:
>
> Srry for my first reply to this message. It DOES work if one remove
> the anonymity. One has also to remove ( function ) () in favor of an
> initiating functionname() instead =)
>
> On 28 Dec, 10:32, "Alexandre Plennevaux" 
> wrote:
>>  Maybe try a named function instead of an anonymous one ? so avoiding
>> arguments.callee by using your function name instead?
>>
>> On Sun, Dec 28, 2008 at 2:03 AM, Althalos  wrote:
>>
>> > Nope, I'm sorry but that doesn't seem to work. Note that setting
>> > opacity to zero works in both browsers.
>>
>> > On 28 Dec, 01:25, "Alexandre Plennevaux" 
>> > wrote:
>> >> really not sure, but maybe try
>>
>> >> A/
>>
>> >> 1- (step/1)  instead of 1-step/1
>>
>> >> B/
>>
>> >> $("#slogan").css('opacity',0);  instead of 
>> >> $("#slogan").css('opacity','0');
>>
>> >> On Sun, Dec 28, 2008 at 1:04 AM, Althalos  
>> >> wrote:
>>
>> >> > I posted something similarly before but I posted wrong code. This
>> >> > time, everything is correct and I'll provide all the information
>> >> > needed.
>>
>> >> > First of all, the URL to the site which is not working is
>> >> >http://uf.ekdahlproduction.com/itsvintage2/
>>
>> >> > The error: In FF everything works perfectly but in IE it gets stuck on
>> >> > 1% and nothing happens whatsoever.
>>
>> >> > The code:
>> >> > $(document).ready(function(){
>> >> >$("#slogan").css('opacity','0');
>> >> >var step = 1;
>> >> >   (function(){
>> >> >  step -= 100;
>> >> >  $("#percentage").text(100-step/100 + '%');
>> >> >  if ( step > 0 )
>> >> > $("#logo").fadeTo(100,1-step/1, arguments.callee);
>> >> > else window.location = "http://uf.ekdahlproduction.com/
>> >> > itsvintage2/home.html";
>> >> >  if ( step == 3500 )
>> >> >$("#slogan").fadeTo(3500,1);
>> >> >   })();
>>
>> >> > });
>>
>> >> > Comments: I have noticed that it changes the opacity correctly, and
>> >> > also sets the content of #percentage to 1%, therefore Jquery must be
>> >> > working. Maybe this can be some kind of general javascript error?
>> >> > Something that IE interprets differently than FF?
>>
>> >> > Thank you


[jQuery] Re: Code not working in IE but is working in FF

2008-12-28 Thread Alexandre Plennevaux

 Maybe try a named function instead of an anonymous one ? so avoiding
arguments.callee by using your function name instead?



On Sun, Dec 28, 2008 at 2:03 AM, Althalos  wrote:
>
> Nope, I'm sorry but that doesn't seem to work. Note that setting
> opacity to zero works in both browsers.
>
> On 28 Dec, 01:25, "Alexandre Plennevaux" 
> wrote:
>> really not sure, but maybe try
>>
>> A/
>>
>> 1- (step/1)  instead of 1-step/1
>>
>> B/
>>
>> $("#slogan").css('opacity',0);  instead of $("#slogan").css('opacity','0');
>>
>> On Sun, Dec 28, 2008 at 1:04 AM, Althalos  wrote:
>>
>> > I posted something similarly before but I posted wrong code. This
>> > time, everything is correct and I'll provide all the information
>> > needed.
>>
>> > First of all, the URL to the site which is not working is
>> >http://uf.ekdahlproduction.com/itsvintage2/
>>
>> > The error: In FF everything works perfectly but in IE it gets stuck on
>> > 1% and nothing happens whatsoever.
>>
>> > The code:
>> > $(document).ready(function(){
>> >$("#slogan").css('opacity','0');
>> >var step = 1;
>> >   (function(){
>> >  step -= 100;
>> >  $("#percentage").text(100-step/100 + '%');
>> >  if ( step > 0 )
>> > $("#logo").fadeTo(100,1-step/1, arguments.callee);
>> > else window.location = "http://uf.ekdahlproduction.com/
>> > itsvintage2/home.html";
>> >  if ( step == 3500 )
>> >$("#slogan").fadeTo(3500,1);
>> >   })();
>>
>> > });
>>
>> > Comments: I have noticed that it changes the opacity correctly, and
>> > also sets the content of #percentage to 1%, therefore Jquery must be
>> > working. Maybe this can be some kind of general javascript error?
>> > Something that IE interprets differently than FF?
>>
>> > Thank you


[jQuery] Re: Code not working in IE but is working in FF

2008-12-27 Thread Alexandre Plennevaux

really not sure, but maybe try


A/

1- (step/1)  instead of 1-step/1


B/

$("#slogan").css('opacity',0);  instead of $("#slogan").css('opacity','0');


On Sun, Dec 28, 2008 at 1:04 AM, Althalos  wrote:
>
> I posted something similarly before but I posted wrong code. This
> time, everything is correct and I'll provide all the information
> needed.
>
> First of all, the URL to the site which is not working is
> http://uf.ekdahlproduction.com/itsvintage2/
>
> The error: In FF everything works perfectly but in IE it gets stuck on
> 1% and nothing happens whatsoever.
>
> The code:
> $(document).ready(function(){
>$("#slogan").css('opacity','0');
>var step = 1;
>   (function(){
>  step -= 100;
>  $("#percentage").text(100-step/100 + '%');
>  if ( step > 0 )
> $("#logo").fadeTo(100,1-step/1, arguments.callee);
> else window.location = "http://uf.ekdahlproduction.com/
> itsvintage2/home.html";
>  if ( step == 3500 )
>$("#slogan").fadeTo(3500,1);
>   })();
>
> });
>
> Comments: I have noticed that it changes the opacity correctly, and
> also sets the content of #percentage to 1%, therefore Jquery must be
> working. Maybe this can be some kind of general javascript error?
> Something that IE interprets differently than FF?
>
> Thank you


[jQuery] Re: I wrote a YUI Multi FIle Compression Utility

2008-12-23 Thread Alexandre Plennevaux

ok , i tried it out and i can see it spits out my js files completely
minified. Nice... really nice.

how about going to the next automation process:


what if i could point your app to my index.html, which contains a
dozen LINK to css files and SCRIPT to js files. Could it compile all
of the CSS in one css file, and all of the js in one js file (so as to
decrease the http connections), both minified, outputting a
index.prod.html with the link to the optimized css file and js file ?

i would have so much use for such a tool i'd pay for it, allowing me
to keep a dev version and a prod version synchronised automatically.

thanks for listening.


On Tue, Dec 23, 2008 at 6:46 PM, K-BL  wrote:
>
> My utility is used for manual compression, this would ensure best
> results from your server.  YUI Compressor (and some other compression
> engines) take unnecessary characters out of your code (line breaks,
> spaces, comments), optimizes private functions/variables, and returns
> a non-encoded, single line output.
>
> On Dec 23, 12:03 pm, "Alexandre Plennevaux" 
> wrote:
>> it sounds very interesting, but i'm quite puzzled on how to do it
>> correctly. i'm interested in reducing the load time of my websites but
>> i don't really master these compression logics.
>> I would have assumed i'd have to point to the html file loading the
>> js+css files but your app seems to look for folders.
>> If i'm correct, what file structure is supposed to work for this? I
>> for one store all my javascript in a _js folder , which contains a
>> "frontend" for the files dealing with the frontend, and a "backend"
>> for the javascript files used in the backend app. I have a 3rd folder
>> "jquery_plugins" folder inside this _js, which contains a folder for
>> each plugin that i use.
>>
>> given that folder structure, is it possible to use your app?
>>
>> Sorry if this is out of my league...
>>
>> On Tue, Dec 23, 2008 at 5:27 PM, K-BL  wrote:
>>
>> > Hey Guys,
>> > I just finished writing a YUI Multi-File Compression Utility.  It's
>> > really simple, it just runs some CLI commands, but more importantly,
>> > it compiles entire directories and sub directories with a clean UI.
>> > For us IT guys, it makes quick site changes a breeze from source to
>> > compressed in just seconds.
>>
>> > Anyway, find it 
>> > here:http://jqueryplugins.weebly.com/yui-compressor-multi-file-utility.html
>>
>> > If you like it, let me know.  Also, source is available in C#.
>>
>> > K-BL


[jQuery] Re: I wrote a YUI Multi FIle Compression Utility

2008-12-23 Thread Alexandre Plennevaux

it sounds very interesting, but i'm quite puzzled on how to do it
correctly. i'm interested in reducing the load time of my websites but
i don't really master these compression logics.
I would have assumed i'd have to point to the html file loading the
js+css files but your app seems to look for folders.
If i'm correct, what file structure is supposed to work for this? I
for one store all my javascript in a _js folder , which contains a
"frontend" for the files dealing with the frontend, and a "backend"
for the javascript files used in the backend app. I have a 3rd folder
"jquery_plugins" folder inside this _js, which contains a folder for
each plugin that i use.

given that folder structure, is it possible to use your app?

Sorry if this is out of my league...

On Tue, Dec 23, 2008 at 5:27 PM, K-BL  wrote:
>
> Hey Guys,
> I just finished writing a YUI Multi-File Compression Utility.  It's
> really simple, it just runs some CLI commands, but more importantly,
> it compiles entire directories and sub directories with a clean UI.
> For us IT guys, it makes quick site changes a breeze from source to
> compressed in just seconds.
>
> Anyway, find it here: 
> http://jqueryplugins.weebly.com/yui-compressor-multi-file-utility.html
>
> If you like it, let me know.  Also, source is available in C#.
>
> K-BL
>


[jQuery] Re: JQuery Spell Checker plugin

2008-12-23 Thread Alexandre Plennevaux

even simpler: right-click > view source.

http://brandonaaron.net/jquery/plugins/spellcheck/jquery.spellcheck.js




On Tue, Dec 23, 2008 at 5:12 PM, MorningZ  wrote:
>
> "Any idea how to get this plugin"
>
> - Load up Firefox and Firebug (which you should have as a JavaScript
> developer)
> - Pull up the page you link to above
> - in the "Net" tab on Firebug, go to the "jquery.spell.check.js" line
> - Right click the "Response" tab and choose "Copy Response Body"
>
> The contents of the script is now sitting in your clipboard
>
>
>
>
>
> On Dec 23, 10:40 am, Raghu  wrote:
>> Hi, I am looking for JQuery spell checker plugin from brandon... I can below
>> below link but there is no script and documentation available..
>> Any idea how to get this plugin.
>>
>> http://plugins.jquery.com/project/spellcheck
>>
>> Thanks
>> Raghu


[jQuery] Re: question

2008-12-23 Thread Alexandre Plennevaux

did you try listing the arguments array within each detected function ?

On Tue, Dec 23, 2008 at 1:18 PM, Dirceu Barquette
 wrote:
> Thanks.
> You are right!
> But, do you have any suggest?
>
> Thank you!
>
> Dirceu Barquette
>
> 2008/12/23 MorningZ 
>>
>> Advice:  more specific subject lines than the ultra vague and useless
>> "question" will get you better and faster help
>>
>>
>>
>> On Dec 23, 6:10 am, "Dirceu Barquette" 
>> wrote:
>> > Hi,
>> >
>> > Has anybody a solution?
>> >
>> > showing a few jQuery methods :
>> > var Typeof = {};
>> > for (v in $) {
>> > Typeof = typeof $[v];
>> > $(''+Typeof+'  '+v+'
>> > ').appendTo('body');
>> >
>> > }
>> >
>> > Is it possible showing parameters list for each method above?
>> >
>> > thank you!!!
>> >
>> > Dirceu Barquette
>


[jQuery] Re: Help Test jQuery 1.3 Beta 1

2008-12-22 Thread Alexandre Plennevaux

will sure do right now, as i'm about to release another
experiment-in-webdesign, end of january, and will need the best
javascript library to support it.  Thanks a lot !

On Mon, Dec 22, 2008 at 6:49 PM, John Resig  wrote:
>
> Hi Everyone -
>
> The jQuery dev team just got jQuery 1.3 Beta 1 out the door. Help us
> test this release and make sure it goes nice and smoothly!
> http://blog.jquery.com/2008/12/22/help-test-jquery-13-beta-1/
>
> Thanks in advance.
>
> --John
>


[jQuery] Re: Masked Input Plugin 1.2.1 Released

2008-12-22 Thread Alexandre Plennevaux
i think personally that indeed a callback onError, that is called when
the input loses focus would be great. from thereon, the user can
defines what to do. for instance, as a UI developer, i would add a
"error" class to the wrapping div,  and add "Incomplete data" message
to the right of the input. But another would go as far as
alert("missing data you moron !!")  . At least my desk neighbour
would, he's so uneducated :)



On Mon, Dec 22, 2008 at 4:25 PM, Josh Bush  wrote:
>
> Thank you Jörn and Alexandre for your feedback.  I'm thinking that
> maybe I should just provide a hook that gets called when the plugin
> detects invalid input.  I could just provide a default function that
> blanks the input as it is today, but would let the user decide what to
> do there.
>
> Any ideas on how I can make my plugin more extensible are more than
> welcome.
>
> Josh
>
> On Dec 22, 9:08 am, "Jörn Zaefferer" 
> wrote:
>> I second that! An option to make the plugin more tolerant, especially
>> in combination with other forms of validation, would be perfect. Other
>> changes all sounds fine. The fix for "users typed over existing input"
>> will be much appreciated.
>>
>> Thanks
>> Jörn
>>
>> On Mon, Dec 22, 2008 at 3:59 PM, Alexandre Plennevaux
>>
>>  wrote:
>> > Josh, these are very cool additions, love the New mask syntax option '?' 
>> > and
>> > the improved usability.
>> > Thanks for your hard work!
>>
>> > just noticed in the demo that if i don't fill the input completely and go 
>> > to
>> > another input, it removes the entered value entirely as soon as the input
>> > loses focus. That's a bit harsh. Maybe that's where a validation should 
>> > take
>> > over and paint the input red so that the user realizes he didn't completely
>> > filled in the content.
>>
>> > On Mon, Dec 22, 2008 at 3:39 PM, Josh Bush  wrote:
>>
>> >> There is now a new version of my Masked Input Plugin (
>> >>http://digitalbush.com/projects/masked-input-plugin/) for jQuery.
>> >> Version 1.2.1 moves one step closer to my bigger picture for the
>> >> plugin.  I had to make a few breaking changes to do so, but I feel
>> >> that the end result is worth it.  This release adds a lot more polish
>> >> to the 1.2 release.  Here's what we've got.
>>
>> >> * BREAKING CHANGE: Removed deprecated $.mask.addPlaceholder method.
>> >> Use the "$.mask.definitions['']="";" syntax instead.  I said I was
>> >> going to do this on the last release and now seems just as good a time
>> >> as any.
>> >> * BREAKING CHANGE: Removed "allowPartial" option in favor of new mask
>> >> syntax I'll describe below.  A discussion and code exchange with
>> >> Michael Bray inspired this change.  I hate that it's a breaking
>> >> change, but the new way makes a lot more sense.
>> >> * New mask syntax option '?'.  Anything listed after '?' within the
>> >> mask is considered optional user input.  The common example for this
>> >> is phone number + optional extension.  The new syntax will look like
>> >> this: "(999) 999-? x9"
>> >> * I got rid of the awkward input behavior where users typed over top
>> >> of existing input.  The plugin acted like a word processor Insert
>> >> mode.  This has always agrivated me, so now the input shifts on input
>> >> and backspace/delete.
>> >> * Now calling .change() on blur if the value has changed since the
>> >> plugin prevents the change event from being fired naturally.
>> >> * Pasting incomplete test no longer wipes the input.  Instead, the
>> >> cursor is just placed where the input leaves off.
>> >> * Fixed backspace detection for iPhone.  Plugin is now iPhone
>> >> compatible.
>> >> * Fixed pasting bug when mask starts with a literal and caret position
>> >> is on the literal character.
>>
>> >> I feel really good about this release.  I made some changes that I
>> >> feel are good for the direction of the plugin.  Iif you don't like
>> >> some of the changes please let me know and I'll look at adding them
>> >> back in as options.  I'm trying hard not to bloat things up, but I
>> >> don't want to remove features that are needed.
>>
>> >> Merry Christmas!
>> >> Josh
>> >> digitalbush.com


[jQuery] Re: Bizarre rendering issue (FF 3, IE 6)

2008-12-22 Thread Alexandre Plennevaux

ok, i got it, well, at least the problem.

now, i'm not sure about how to solve it.

1/ maybe it's a css issue.

in your stylesheet, try changing this

#aboutus .nav .navmain a.current,
#aboutus .nav .navsecondary a.current {
  color: #a5ee26;
}
#aboutus .nav ul.navsecondary {
  left: 130px;
  top: 115px;
}
#aboutus .nav .navsecondary a {
  color: #c87eeb;
}


into

#aboutus .nav ul.navsecondary {
  left: 130px;
  top: 115px;
}
#aboutus .nav .navsecondary a {
  color: #c87eeb;
}

#aboutus .nav .navmain a.current,
#aboutus .nav .navsecondary a.current {
  color: #a5ee26;
}


2./  i noticed you use the function

doShowStorywrap(c)  sometimes passing it a jquery object, sometimes
just "this". The case in which the rendering does not happen is when
you don't use a jquery object, so i would try that, see if that
changes anything.




On Mon, Dec 22, 2008 at 4:10 PM, userdude  wrote:
>
>
> Hi Alexandre,
>
> Thank you for the reply. I'm not sure what you mean by enable debugging in
> Firebug.
>
> Basically, the first submenu item for specific menu item should always
> default to having the "current" class.
>
> Although I can tell that something is occurring using console.log to inspect
> the a-link addClass method, the actual html for the page rendering is not
> applying; I effectively cannot see the results of the addClass method that
> is run if I am doing an addClass method during only the main menu
> selections.
>
> The best way to see what I mean is to:
>
> * first, click the "about us" link.
> * then, click the "what we do" link
>
> The "what we do" link should be highlighted just like after the second click
> when clicking on the "about us" link. As far as I can tell, addClass is
> running, but the page is not actually rendering the change, and Firebug is
> not showing the class in the HTML inspector.
>
> Right-click on the "what we do" link, select "Inspect Element", then click
> on the "about us" link. See the current goes away? It should stay, and I
> can't figure out why it's not working.
>
> Thanks!
> Jared
>
>
> Alexandre Plennevaux-2 wrote:
> >
> > jared, your website is supernice and promising, but i for one don't
> > understand anything about your problem description. i think either you're
> > lacking sleep or you wrote too fast :)
> >
> > Can you rephrase please, for people that don't yet know your website
> > internals (or lack sleep themselves ) ?can you also enable logging (i have
> > firebug) on the page online, because the console doesn't show anything
> > here.
> >
> > Thanks
> >
> > alexandre
> >
> > On Mon, Dec 22, 2008 at 2:08 PM, userdude  wrote:
> >
> >>
> >>
> >> I am having an issue with the following jQuery code:
> >>
> >> http://www.houseofoverlord.com/c/jeniffer/bhive/test2.html
> >> http://www.houseofoverlord.com/c/jeniffer/bhive/test2.html
> >>
> >> The rendering that is not occurring is when the page:
> >>
> >> * Loads
> >> * When clicking the main (horizontal) menu items
> >>
> >> What is supposed to happen is the default (first) navsecondary a tag is
> >> supposed to receive a current class designation. If I console.log,
> >> everything seems fine, but the screen display does not show the change,
> >> and
> >> the HTML view in Firefox does not demonstrate the update
> >> (class="current").
> >>
> >> If you click on "about us" and then click on "what we do", that behavior
> >> is
> >> supposed to happen automatically when clicking the "about us" menu link.
> >>
> >> Anybody know what's going on?
> >>
> >> Thanks!
> >> Jared
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Bizarre-rendering-issue-%28FF-3%2C-IE-6%29-tp21127522s27240p21127522.html
> >> Sent from the jQuery General Discussion mailing list archive at
> >> Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context: 
> http://www.nabble.com/Bizarre-rendering-issue-%28FF-3%2C-IE-6%29-tp21127522s27240p21129366.html
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.
>


[jQuery] Re: Masked Input Plugin 1.2.1 Released

2008-12-22 Thread Alexandre Plennevaux
Josh, these are very cool additions, love the New mask syntax option '?' and
the improved usability.
Thanks for your hard work!

just noticed in the demo that if i don't fill the input completely and go to
another input, it removes the entered value entirely as soon as the input
loses focus. That's a bit harsh. Maybe that's where a validation should take
over and paint the input red so that the user realizes he didn't completely
filled in the content.



On Mon, Dec 22, 2008 at 3:39 PM, Josh Bush  wrote:

>
> There is now a new version of my Masked Input Plugin (
> http://digitalbush.com/projects/masked-input-plugin/ ) for jQuery.
> Version 1.2.1 moves one step closer to my bigger picture for the
> plugin.  I had to make a few breaking changes to do so, but I feel
> that the end result is worth it.  This release adds a lot more polish
> to the 1.2 release.  Here's what we've got.
>
> * BREAKING CHANGE: Removed deprecated $.mask.addPlaceholder method.
> Use the "$.mask.definitions['']="";" syntax instead.  I said I was
> going to do this on the last release and now seems just as good a time
> as any.
> * BREAKING CHANGE: Removed "allowPartial" option in favor of new mask
> syntax I'll describe below.  A discussion and code exchange with
> Michael Bray inspired this change.  I hate that it's a breaking
> change, but the new way makes a lot more sense.
> * New mask syntax option '?'.  Anything listed after '?' within the
> mask is considered optional user input.  The common example for this
> is phone number + optional extension.  The new syntax will look like
> this: "(999) 999-? x9"
> * I got rid of the awkward input behavior where users typed over top
> of existing input.  The plugin acted like a word processor Insert
> mode.  This has always agrivated me, so now the input shifts on input
> and backspace/delete.
> * Now calling .change() on blur if the value has changed since the
> plugin prevents the change event from being fired naturally.
> * Pasting incomplete test no longer wipes the input.  Instead, the
> cursor is just placed where the input leaves off.
> * Fixed backspace detection for iPhone.  Plugin is now iPhone
> compatible.
> * Fixed pasting bug when mask starts with a literal and caret position
> is on the literal character.
>
> I feel really good about this release.  I made some changes that I
> feel are good for the direction of the plugin.  Iif you don't like
> some of the changes please let me know and I'll look at adding them
> back in as options.  I'm trying hard not to bloat things up, but I
> don't want to remove features that are needed.
>
> Merry Christmas!
> Josh
> digitalbush.com


[jQuery] Re: Bizarre rendering issue (FF 3, IE 6)

2008-12-22 Thread Alexandre Plennevaux
jared, your website is supernice and promising, but i for one don't
understand anything about your problem description. i think either you're
lacking sleep or you wrote too fast :)

Can you rephrase please, for people that don't yet know your website
internals (or lack sleep themselves ) ?can you also enable logging (i have
firebug) on the page online, because the console doesn't show anything here.

Thanks

alexandre

On Mon, Dec 22, 2008 at 2:08 PM, userdude  wrote:

>
>
> I am having an issue with the following jQuery code:
>
> http://www.houseofoverlord.com/c/jeniffer/bhive/test2.html
> http://www.houseofoverlord.com/c/jeniffer/bhive/test2.html
>
> The rendering that is not occurring is when the page:
>
> * Loads
> * When clicking the main (horizontal) menu items
>
> What is supposed to happen is the default (first) navsecondary a tag is
> supposed to receive a current class designation. If I console.log,
> everything seems fine, but the screen display does not show the change, and
> the HTML view in Firefox does not demonstrate the update (class="current").
>
> If you click on "about us" and then click on "what we do", that behavior is
> supposed to happen automatically when clicking the "about us" menu link.
>
> Anybody know what's going on?
>
> Thanks!
> Jared
> --
> View this message in context:
> http://www.nabble.com/Bizarre-rendering-issue-%28FF-3%2C-IE-6%29-tp21127522s27240p21127522.html
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.
>
>


  1   2   3   4   5   6   7   >