[jQuery] Re: How to animate remove() and html() ?

2008-03-09 Thread Fabien Meghazi

  .html() isn't suitable - ie what does it mean to 'slowly' change the
  html content of an element?? Perhaps a typing effect, or cloning a
  div, changing the content then fading the original - but these would
  be specialised effects that you should code yourself.

Please, don't pay attention to my post. I asked this because my brain
was too asleep to find the answer by itself.

In fact what I wanted was this :

$.get(URL, function(html) {
html = $(html).hide();
$(#foobar).append(html);
$(html).fadeIn(fast);
});

Maybe you know a better way (less lines) to do this ?

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: How to animate remove() and html() ?

2008-03-09 Thread Fabien Meghazi

 not tested :

 $.get(URL, function(html) {
 $(html).hide().appendTo('#foobar').fadeIn(fast);
  });

Yeps working. Thanks !


-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: How to animate remove() and html() ?

2008-03-07 Thread Fabien Meghazi

  You can do a similar thing with show (or fadeIn, etc).

  $('divText/div')
   .hide()
   .appendTo(somewhere)
   .fadeIn(1000);


Thanks guys! And sorry about asking questions when I know the answer.
It must be because I'm working 16h/day while sleeping 5h/day  since 2
weeks. My brain is slowly freezing. And I must admitt thhhhh
,rkkka  Rzzz


-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] How to animate remove() and html() ?

2008-03-06 Thread Fabien Meghazi

Is there a way to animate remove() and html() like it's possible to
hide(slow) ?

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: OT: how to benchmark user hardware?

2008-01-22 Thread Fabien Meghazi

 1/ detect user setup or perform some tests, to determine the available CPU, 
 graphic Card, RAM, browser,OS. It may not even be necessary to know these 
 datas, if we run a test that just tells us if the end user specs are speedy 
 or not.
 2/ send a different javscript file according to the results of the benchmark.

 Has anyone done somethiing similaror have any thought about this?

You won't be able to determine gfx card, ram, etc... in javascript.
(except for the window size)
You can find the browser and os in the user agent, see $.browser or
this plugin :
http://davecardwell.co.uk/javascript/jquery/plugins/jquery-browserdetect/

As for the CPU benchmark I had some old links in my bookmarks :

The first one is in french. I think it's not accurate at all
http://www.toutjavascript.com/main/script.php3?url=evalcpu

And there was another called BenchJS but the link is down. Maybe you
should google about this one.

But keep in mind that theoretically, there's no such as thing as
hardware detection in javascript browser's implementation. (for the
moment)

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: Is there a way to hide the script

2008-01-21 Thread Fabien Meghazi

 If I make a long jQuery script, and when the webpage is loaded, when we look
 at the source code, then everyone will be able to see the jQuery script. Are
 there any ways to get this hidden. I wanna hide these scripts for SEO reason
 as well...

Why don't you put your code in a .js file that you include in your
html with the script tag ?
If your goal is to forbid people to have a look at your code in any
circumstance then you must keep in mind that it's just impossible. All
you can do is obfuscation but it will never stop someone to see your
code.
You must keep in mind that everything running on the client can be
figured out by anyone who wants to take a deeper look into it. (Even
flash's action script can be decompiled) Thinking like this will also
improve the way you manage security in your apps.

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: BBC Redesign

2008-01-02 Thread Fabien Meghazi

  Looks like the long-overdue BBC redesign is using jQuery (and a metric ton
  of whitespace and internal CSS):
 
  http://www.bbc.co.uk/home/beta/

Using the portlets is slow as hell on my computer


-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: server side jquery

2007-12-18 Thread Fabien Meghazi

  on rails etc... These serve the data to the visitor's browser software,
  and that data can be html, xml, css or javascript and jquery included. but
  it cannot RUN or EXECUTE it.
 
 In classic Asp we use server side Java/Vb Script.

Of course you can run any language server side using a virtual machine
an interpreter or even compiled code. You can use asp/jscript which is
the microsoft implementation of ecmascript and it can run server side.

But your question is : Is it possible to run excute jquery on server side.

The answer could be yes :

Using any javascript interpreter, you can run the jquery.js file. But
it will throw an error because it won't find the window object.
Why is that ?
Because jquery is a wonderful javascript library which give you the
possibility to manipulate a web page DOM in the context of a browser
(read client side). So the usage of jquery in a server side context is
pointless.

Maybe it would help if you describe what you want to do.

You could start an instance of firefox (remote mode) on the server and
you can control the borwser from your application.
I would be interesting to know what you want to do exactly.

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: server side jquery

2007-12-16 Thread Fabien Meghazi

  No, it is not possible.
  Unfortunately, John Resig made a mistake while designing jQuery. He
  assumed that the window object is always defined.

 I don't think that was a mistake. I'm sure if John had intended for jQuery
 to be used on the server, he would have designed it as such.

I guess I forgot to put some smileys around !

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: server side jquery

2007-12-16 Thread Fabien Meghazi

 Well, I feel silly now.  Maybe jQuery + env.js + Rhino can come to my house
 and do some laundry as well.

Well of course talking about jQuery server side is pointless.
Now there's a context where it comes interesting.
Something I would really like to see is a ruby binding to libxml with
a jQuery like structure.
When I have to deal with xml in a server side app, I can't stop
telling me that such a module would be great.


-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: server side jquery

2007-12-15 Thread Fabien Meghazi

On 12/15/07, Sharique [EMAIL PROTECTED] wrote:

 Is it possible to run excute jquery on server side.

No, it is not possible.
Unfortunately, John Resig made a mistake while designing jQuery. He
assumed that the window object is always defined. This is too bad
because we can't run it server side in order to manipulate the
server's DOM (Drivers Of Machine)

Try to run jquery in spidermonkey and you will see for youself :

[EMAIL PROTECTED] /tmp/jquery [22]$ smjs jquery-1.2.1.js
jquery-1.2.1.js:17: ReferenceError: window is not defined


John, if you listen, could you add support for server side AJAX
(Active Java And X-Ray) ?


-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: jChess

2007-12-08 Thread Fabien Meghazi

 Ok all you eager beavers go play.

 http://www.bloodmoongames.com/opensource/jChess/

I think you forgot a special move. Don't know how it is called in
english but in french it's called prise en passant

See pictures at the end of this page to see what I mean :

http://echec.jeu.free.fr/regles/speciaux.php

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: AJAX Security

2007-11-23 Thread Fabien Meghazi

  1. Non AJAX
 
  User need to select a username, fill in the captcha, and submit the
  form = no automation possible as need to fill in the captcahe
 
 You can validate Captchas via ajax...

Exactly, this is where I would like to go ;-)

Just include captchas in your api.


-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: AJAX Security

2007-11-22 Thread Fabien Meghazi

 In non AJAX apps, automatic checking can be prevented using Captcha in
 the registration page.

As you could do with an AJAX application, I don't understand what
would prevent you to do so.
What main difference do you see between a GET or POST made by the
browser when submitting a plain old form and a GET or POST made using
XMLHttpRequest ? What would be more secure with a plain old form ?
Maybe I didn't understood what you meant (my english is not so good).
I think the real security issue to care of is what your server side
logic does returns in case of an Ajax context and how your ajax client
side scripts handle the returned data. But with Xss exploits knowledge
in mind you should be able to put away those concerns.

 For example, in Yahoo, guess how they are checking?
 https://edit.yahoo.com/membership/json?PartnerName=yahoo_defaultRequestVersion=1AccountID=johndoeGivenName=FamilyName=ApiName=ValidateFields1763407

Yes this is a bad method, but you're not forced to do something bad.


-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: AJAX Security

2007-11-20 Thread Fabien Meghazi

 With a blank or mismatched referrer, the script will always return a
 username as unavailable.

 Unfortunately the referrer is easily spoofed, so I'm not sure how effective
 this will be.

And just because it can be easily spoofed then you should not use referer.

Please explain the difference between your worries about an ajax
application and a non-ajax application.


-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: Release: jQuery Validation plugin 1.1.1

2007-10-18 Thread Fabien Meghazi

 Plugin page(s): http://jquery.com/plugins/project/validate/a 
 http://bassistance.de/jquery-plugins/jquery-plugin-validation/

the demo page (index.html) from the zip file
(http://jquery.bassistance.de/validate/jquery.validate.zip)
fires up this error :

jQuery(element).data is not a function
jquery.validate.js (line 875)

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: Bind event that should be executed first

2007-10-17 Thread Fabien Meghazi

 if (v.form()) // runs form validation and returns true if successful
 // you have to dig into the validation source
  to figure this out
  [...]
 Granted, documentation still needs a lot of work, but the method is
 documented here:
 http://jquery.bassistance.de/api-browser/plugins.html#jQueryvalidatorprotoypeform

Hi Jörn,

Exhuming an old thread, but it might be handy for other people.

When using validator.form() the error messages are shown but the first
error input is not focussed. Is this the normal behaviour ? If yes, is
there a method I can call for validator so it will focus the first
error field in case validate fails ?

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: Bind event that should be executed first

2007-10-04 Thread Fabien Meghazi

 After much googling, I found this, which states that the firing order of
 multiple event handlers bound to the same event is arbitrary:

Mhh I see.

But all event binded functions to a form submit via jquery are stored
somewhere right ?
If I could get those functions, then unbind the submit event and
rebind it with my stuff first then calling previous bindings
functions, it would do what I want.

Do you think it is possible ?

Jörn,
Do you bind submit buttons onclick or form's onsubmit for validation ?


-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Bind event that should be executed first

2007-10-03 Thread Fabien Meghazi

Hi all,

I have to bind an event of type submit to a form but I have to make
sure that the function binded will be executed before other submit
bindings.

Is it possible with jQuery ?

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: Bind event that should be executed first

2007-10-03 Thread Fabien Meghazi

 One way to go about it is to put all your submit functions within a sort of
 master function, that will be the only function bound to the submit event.
 Then you can guarantee the order of execution.  Like so:

In fact I don't have the hand of the possible previous bindings so I
can't bundle them into a master function.

My case is that I use Mike's form plugin with Jörn's validation plugin.
The thing is that when user's click on a button (after initialization
of both others plugin), a dhtml editor is replacing a textarea and I
have to bind the form submit in order to restore the correct value of
the textarea before other plugin's submit bindings are triggered.

Is there a solution for that ? Even if it's pure javascript outside
jQuery's api.

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: Bind event that should be executed first

2007-10-03 Thread Fabien Meghazi

 $(#myform).submit(function() {
 // do your textarea thing here
 var v = $(this).validate(validateoptionshere);

In fact my stuff is a plugin for fck editor so I want it to to be unobstrusive.

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: Bind event that should be executed first

2007-10-03 Thread Fabien Meghazi

 $(#myform).submit(function() {
 // do your textarea thing here
 var v = $(this).validate(validateoptionshere);

Do you know where javascript events are stored ? In elements dom or somewhere ?
If yes I would be able to keep them apart, unbind and rebind with my
stuff then the old bindings I kept apart ?

Maybe what I say is silly, I don't know

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Avoid enter keypress to submit form

2007-09-25 Thread Fabien Meghazi

Hi,

Is there an non javascript way to avoid enter keystroke in an input
to trigger the form submit or am I forced to catch keystroke code 13
in javascript ?

If force to do in javascript, is there a way to catch keystroke event
of only one input and not window object ? Is there already a jquery
plugin for this ?

Regards.

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: Adding :hover css support to IE6 - ie6HoverFix

2007-09-23 Thread Fabien Meghazi

 Updated the script to support :focus and :after

 http://lovepeacenukes.com/jquery/ie6cssfix/

Mhhh :focus on input !! I need this ! ;-)

Unfortunately I tried it on the application I'm currently working and
it makes IE eating 10 Mo every seconds until swapspace is filled.
Going to look at it. keep you informed

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: Adding :hover css support to IE6 - ie6HoverFix

2007-09-23 Thread Fabien Meghazi

  Updated the script to support :focus and :after
 
  http://lovepeacenukes.com/jquery/ie6cssfix/

May I ask you why you are fetching inline/remote css in the updated
version of your script instead if keeping using document.styleSheets ?
I didn't read carefully the updated version so maybe I didn't found a
reason why to do so. But the new method is quite slower when you have
huge css declaration. All those regexp done on big css is quite slow.
Besides, the regexp is wrong for some case :

eg: #admin_menu_intra a:hover {
...
}

in css will be smashed to

#admin_menu_intraa:hover{...}

then if I follow correctly your script (not did true debugging yet so
I'm not 100% sure) the value used for element matching will be
#admin_menu_intraa and it won't match anything.

If you don't mind, I will use a mix between your new and old script,
keeping the style iteration throught document.styleSheets like the old
version and support for :focus  :after like the new one.

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: Adding :hover css support to IE6 - ie6HoverFix

2007-09-23 Thread Fabien Meghazi

 May I ask you why you are fetching inline/remote css in the updated
 version of your script instead if keeping using document.styleSheets ?

Ok, understood, you're doing this because of :after

As I'm not using it, I will use the old version with just support for
:hover  :focus

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: overide or deleting events

2007-09-22 Thread Fabien Meghazi

 by the way is there a way to check if an object has bind to a certain
 events?

You have event namespaces in jQuery 1.2

http://www.learningjquery.com/2007/09/namespace-your-events

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: Image + map area + mouseout event

2007-09-21 Thread Fabien Meghazi

Ok, here's a test case of my problem. If anyone has an idea about how
to fix it ?

http://amigrave.com/upload/posts/jquery/mouseover_and_map_area.htm

I considered hoverIntent but it won't be an option for me.

An ugly fix would be to detect if mouse position is not over the image
before firing doStuff() function but it's not an elegant solution and
I even don't know how to do this. Anyway, if there's no solution I'll
be forced to do it so any hint about this is welcome.

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: Adding :hover css support to IE6 - ie6HoverFix

2007-09-21 Thread Fabien Meghazi

 Here is a simple script that solves the problem:
  http://lovepeacenukes.com/jquery/ie6hoverfix/

Cool !!

Got some questions:

1) would it be possible to detect :hover declarations in css in order
to do stuff only on css rules that actually have a :hover declared

2) what if a $(#foo).load(index.html) is done. Will the new
elements loaded benefit of your plugin or should $.ie6HoverFix();
function be called again ? Will this cause a problem if the function
is called twice in the same DOM tree ?

3) As your loops have a lot of iteration I think you should avoid this
kind of loops :

for(var i = 0; i  cssRules.length; i++) {

and use this instead :

for (var i = 0, ii = cssRules.length; i  ii; i++) {

this avoid the cssRules.length to be evaluated at each iteration (faster)


Thanks for sharing this ! I will be able to get rid of those

if ($.browser.msie) {
$(table tr).hover(function() {
$(this).addClass(hover);
}, function() {
$(this).removeClass(hover);
});
}

laying everywhere in my pages ;-)

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: Adding :hover css support to IE6 - ie6HoverFix

2007-09-21 Thread Fabien Meghazi

 1. The script only looks for declarations in the stylesheets, that's the
 beauty of it.

yes, but I mean that if you look at the content of the cssRules
variable you will see that there are a lot of css declaration which
could be avoided (or they can't ?)

 3. Yeah i know but I'm lazy.

Here's an optimized version if you want (hope tabs will be kept). I
also added a condition in order to check cssRules[i][1] in the last
loop because on the page I tested, the value is empty for two items
and it causes an error in IE when addRule() is called with empty
second argument (I didn't checked why).


// ie6HoverFix - Author : Christian Bach
$.ie6HoverFix = function() {
if ($.browser.msie  $.browser.version  7) {
var cssRules = [], newStyleSheet = document.createStyleSheet(),
styleSheets = document.styleSheets;
function parseCSS(rule) {
var prefix = ie6fix-;
var select = rule.selectorText, style = 
rule.style.cssText;
var element = select.replace(/:(hover).*$/, '');
var pseudo = select.replace(/[^:]+:([a-z-]+).*/i, '$1');
var styleRule = element + . + prefix + pseudo;
var className = prefix + pseudo;
$(element).hover(function(e) {
$(this).addClass(className);
}, function(e) {
$(this).removeClass(className)
});
cssRules.push([styleRule,style]);
}
for (var i = 0, ii = styleSheets.length; i  ii; i++) {
for(var j = 0, jj = styleSheets[i].rules.length; j  
jj; j++) {
parseCSS(styleSheets[i].rules[j]);
}
}
for (var i = 0, ii = cssRules.length; i  ii; i++) {
var ruledef = cssRules[i][1];
if (ruledef.length != 0) {
newStyleSheet.addRule(cssRules[i][0], ruledef);
}
}
}
};



-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: Adding :hover css support to IE6 - ie6HoverFix

2007-09-21 Thread Fabien Meghazi

  1. The script only looks for declarations in the stylesheets, that's the
  beauty of it.
 yes, but I mean that if you look at the content of the cssRules
 variable you will see that there are a lot of css declaration which
 could be avoided (or they can't ?)

Christian,

Ok, here's what I meant :
In parseCss(), checking if css selector contains :hover (and return
if not) will only do stuff on css selectors where :hover is present. I
guess in most cases this is what we want. (correct me if I'm wrong).
It's quite faster (I can feel it because I've got a 1ghz laptop :-)

Anyway, here's a version of your script where we can choose if stuff
should be done only for :hover selectors or not.

Calling $.ie6HoverFix(); has the normal behaviour as you designed it.
Calling $.ie6HoverFix(true);  will redo css declaration only for
:hover selectors

Here it is. What do you think ?

// ie6HoverFix - Author : Christian Bach
$.ie6HoverFix = function(only_hovers) {
if ($.browser.msie  $.browser.version  7) {
only_hovers = only_hovers || false;
var cssRules = [], newStyleSheet = document.createStyleSheet(),
styleSheets = document.styleSheets;
function parseCSS(rule) {
var prefix = ie6fix-;
var select = rule.selectorText, style = 
rule.style.cssText;
if (only_hovers  select.indexOf(:hover) == -1) {
return;
}
var element = select.replace(/:(hover).*$/, '');
var pseudo = select.replace(/[^:]+:([a-z-]+).*/i, '$1');
var styleRule = element + . + prefix + pseudo;
var className = prefix + pseudo;
$(element).hover(function(e) {
$(this).addClass(className);
}, function(e) {
$(this).removeClass(className)
});
cssRules.push([styleRule,style]);
}
for (var i = 0, ii = styleSheets.length; i  ii; i++) {
for(var j = 0, jj = styleSheets[i].rules.length; j  
jj; j++) {
parseCSS(styleSheets[i].rules[j]);
}
}
for (var i = 0, ii = cssRules.length; i  ii; i++) {
var ruledef = cssRules[i][1];
if (ruledef.length != 0) {
newStyleSheet.addRule(cssRules[i][0], ruledef);
}
}
}
};




-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Image + map area + mouseout event

2007-09-20 Thread Fabien Meghazi

Hi all,

I've got an image with a map area defined for it. Eg:

img id=myimage src=img/myimage.gif width=260 height=219
border=0 usemap=#myimage_map/

map name=myimage_map id=myimage_map
area href=# alt=foo shape=polygon coords=233, 135, 219, ...
area href=# alt=bar shape=polygon coords=13, 125, 319, ...
...
/map

I've got a mouseout event binded to the image itself :

$(#myimage).bind(mouseout, function() {
console.log(Hello)
doStuff();
});

My problem is that when the cursor is over an area in the image, the
mousout event of the image is called. (probably because of those event
bubbling/capturing I never understoof how to deal with). I tried
event.stopPropagation() and event.preventDefault() without success.

Is there a way to avoid that behaviour ?

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: Image + map area + mouseout event

2007-09-20 Thread Fabien Meghazi

 Try adding return false; -

Already tried too


-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: Image + map area + mouseout event

2007-09-20 Thread Fabien Meghazi

 Maybe you can bind a mouseover event to the map areas, that would do nothing
 but return false.  This may keep the mouseout from firing when you mouseover
 an area --

Alreadt tried it too :(
I'll try to put a test case online

-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Selecting previous elements

2007-09-03 Thread Fabien Meghazi

Hi all,

here's my situation :

ul
liA/li
liB/li
liC/li
liD/li
/ul

I've got $(this) containing the jquery object of element liC/li
I would like a jquery selection of previous elements and current
element included, in other words I would like [A, B, C]

What is the fastest way to accomplish this ?

I was thinking about $(this).parent().find(li).lt(X)

but X would be the index of current element (C) and I don't know how to get it.

Besides, I'm sure there's a faster way I'm not yet aware of.

Thanks for you help.


-- 
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] BlockUI inside click()

2007-06-15 Thread Fabien Meghazi


Hi all,

I'm puzzled with the following code (context explained below) :

$(document).ready(function() {
var modal = $(#modal_yesno)[0];
$(.a_delete).css(cursor, pointer).click(function() {
var tr = $(this).parent().parent();
var id = $(tr).attr(id).replace(item_, );
console.log(id);// first console log
$(#modal_yes).click(function() {
console.log(id);// second console log
$.unblockUI();
});
$(#modal_no).click($.unblockUI);
$.blockUI(modal, { width: '275px' });
});
});


Explanation of the context :

This code is used in an listing html table. Last td of each row
contains an image with class=a_delete. I apply the click() block
here before. The first lines of the block keeps variable tr  which is
the tr row parent of the image. I take of the id attribute in order
to get the ID of the row. As the purpose of this is to delete the row,
I want a confirmation using BlockUI. #modal_yes is the YES button in
the modal div. My problem is that when the code is triggered, the
first block extract the id correctly and the second one have the good
ID the first time. But when I click again on another row, the first
part have the good id but the BlockUI block still uses the old ID.
Seems that this block have always the old variable scope but I don't
understand why. Can someone enlighten me before I go nuts ?

Console log output :

# I click on row with id 618 :

618   # first console log
618   # second console log

# now I click on row with id 620

620   # first console log
618   # second console log


Thanks.




--
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: BlockUI inside click()

2007-06-15 Thread Fabien Meghazi



Try adding this to your yes click handler code:

$(this).unbind('click');


Like this ?

$(#modal_yes).click(function() {
$(this).unbind('click');
console.log(id);// second console log
$.unblockUI();
});

If I do this, the effect is that the Yes button's click is not binded
anymore. Clicking on it doesn't do anything.
I tried to add it at the end of the block but it's the same effect


[jQuery] Re: BlockUI inside click()

2007-06-15 Thread Fabien Meghazi



If I do this, the effect is that the Yes button's click is not binded
anymore. Clicking on it doesn't do anything.
I tried to add it at the end of the block but it's the same effect


Rectification :
With unbind in the yes click handler, the Yes button doesn't work
anymore the second time the code is triggered. First time it is
working ok.


--
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: BlockUI inside click()

2007-06-15 Thread Fabien Meghazi



Rectification :
With unbind in the yes click handler, the Yes button doesn't work
anymore the second time the code is triggered. First time it is
working ok.


Mike,

I found the solution but I don't understand it :
If I move the $.blockUI() call to the beginning of the
$(.a_delete).click handler then it works. Unbinding click even is
needed in order to avoid click event stacking. (it was not happening
before moving $.blockUI()

So the working code looks like this :

$(document).ready(function() {
  var modal = $(#modal_yesno)[0];
  $(.a_delete).css(cursor, pointer).click(function() {
  $.blockUI(modal, { width: '275px' });
  var tr = $(this).parent().parent();
  var id = $(tr).attr(id).replace(item_, );
  console.log(id);// first console log
  $(#modal_yes).click(function() {
  console.log(id);// second console log
  $.unblockUI();
  $(this).unbind('click');
  });
  $(#modal_no).click($.unblockUI);
  });
});


Does it make sense to you ?

The only thing I see would be that blockUI does clone the modal div,
and that things are messed up because events are registered before
this clone() or something like that.

--
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: Validate plugin : is this a normal behaviour ?

2007-06-06 Thread Fabien Meghazi



That is a bug. Could you give the latest revision a try? It contains a
fix for this behaviour:
http://dev.jquery.com/browser/trunk/plugins/validate/jquery.validate.js?format=txt


Thanks a lot ! It works fine :
http://www.amigrave.com/upload/posts/jquery/validate2.htm

ass_kissing veracity=true
   All your plugins rocks !!
   They are all well written and well structured.
/ass_kissing

--
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Selecting all but first-child

2007-04-24 Thread Fabien Meghazi


Hi all,

What is the more elegant way to select all but first-child of a set of
elements ?

I tried

$(div.myclass:not(first-child)).css(do, stuff);

whithout success

--
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: datePicker v2 beta

2007-04-24 Thread Fabien Meghazi



It's a clean 10 out of 10 from me.


Yeah sure !! This is an excellent plugin !

Maybe adding ESC key mapping in order to close would be a plus.


[jQuery] Re: flash losing focus

2007-04-18 Thread Fabien Meghazi



hey, i got a swf with a game inside, the problem that some times when user
plays in the game and press space or f12 or whatever... its scrolls down
and stuff like that
is there a way to make sure that allways the game will listen to the keys ?


Hi,

Could you point out what is the jQuery relevant part of your message ?

Thanks.


[jQuery] Re: Is this a bug ?

2007-04-11 Thread Fabien Meghazi



I had a play around with it and the only thing I could figure out is
that the first td tag is being stripped during the function you
mentioned - $(a).html(ah);

The only thing I can think of is that perhaps it is something to do
with the way IE handles whitespace -
I've put a copy of your test page up with firebug for IE so you can
see what I mean about the first td tag - 
http://lazydragon.dreamhosters.com/test.html


Wow !! That's strange!!! I'm not sure that it's due to whitespaces
because I tried the same test case without whitespaces in the nodes to
clone and the problem was still present. I tried to trim(), I tried to
remove all whitespaces, same problem.

The funny thing is when you play with variable ah before it's
html()ed to the element

I tried :

ah = br/' + ah;

then you get : brtd (the td is here but we can't see it)

try:

ah = nobr/ + ah;

then you get :

nobrimg ... (the td dispaeared)

And while playing with this you can observe weird stuff in FF too
(td disapearing in FF)


And when you html() the code inline there's no problem ! (even with
whitespaces) So maybe the problem is in jQuery afterall.
Eg:
console.log($(a).html('\t\t  \t  tdHello/td\t\t  ').html());


Maybe I should fill a bug so jquery devs can take a look at this.


[jQuery] Re: Is this a bug ?

2007-04-11 Thread Fabien Meghazi


Now I'm thinking ... Is there still some people using Internet Explorer ? ;-)

On 4/11/07, Scott Sauyet [EMAIL PROTECTED] wrote:


Fabien Meghazi wrote:
 Maybe I should fill a bug so jquery devs can take a look at this.

It is a bizarre one.  My little brain can't see anything to cause this;
maybe some of the experts can.  Perhaps more demos are in order, but I'm
not sure what more to even try.

Good luck,

   -- Scott





--
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: new plugin - columnManager

2007-04-11 Thread Fabien Meghazi



Well, for example...I've a table that is showing a lot of userdata
(phone numbers, locations, birth dates and some other stuff). Some of
the users don't want to see all the informations for whatever reasons,
so I let them decide what they'll get to see. I'm using it with the
popup window shown in the second table on the demo page.


Roman,

Along with saveState, an option to specify a custom function callback
to be called when the user toggled a column would be handy if we want
to customize the way columns preferences should be managed (eg:
session or db) so we can have total control of columns preferences
management.

Good job!

--
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]


[jQuery] Re: outerHTML and Firefox does not work

2007-04-10 Thread Fabien Meghazi



Correct. Only Internet Explorer supports outerHTML. Even innerHTML
started off as a Microsoft only thing, but because it was used so
widely other browsers have adopted it as a defacto standard.

What are you trying to do that you need to use outerHTML?


Hi everyone in this thead, I was about to ask the same question when I
saw this thread. The problem is that no response has been given, so
let me ask again :

Is there a way to get the equivalent of outerHTML's result of a node
using jQuery ? (Y/n)

Got this:

nodeA
   nodeB id=test
nodeC/
   /nodeB
   nodeD/
/nodeA

I would like this

$(#test).jquerymagic()

to return this :

   nodeB id=test
nodeC/
   /nodeB

Same behaviour than $.html() but including the node's tag html too.

It's probably so basic that I must be blind and can't see the
evidence. Please, open my eyes.

Thanks.