[jQuery] Re: keyup() fires multiple times?

2010-03-01 Thread Keith Hughitt
Looks like the problem is OS-specific. In Ubuntu 9.10, for example,
there is an option that is enabled by default in the user's keyboard
preferences
which causes key-holds to simulate multiple key-presses. Turning this
off results in the expected behavior. On Windows, the default behavior
is for key-holds to behave like key-holds so no problem exists.

Any suggestions for normalizing behavior across platforms?

Keith

On Jan 5, 3:38 pm, Keith Hughitt  wrote:
> Hi all,
>
> I'm creating a method for the first time which causes some action to
> happen while a key is pressed. I've noticed, however, that the 'keyup'
> event which I would  normally use to determine when the key is
> released is fired continually, even when the key is still being
> pressed.
>
> e.g.
>
> http://www.w3.org/
> TR/html4/strict.dtd">
> 
> 
>         jQuery > Keyup Test
>         http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/</a>
> jquery.js" type="text/javascript">
> 
> 
> 
> $(function () {
>     $(document).keydown(function (e) {
>         console.log("keydown");
>     }).keyup(function (e) {
>         console.log("KEYUP");
>     });});
>
> 
> 
> 
>
> Instead of seeing "keydown", "keydown"..."keydown", "KEYUP". It
> switches back and forth between the two continually. So far I've
> tested the same demo in FF 3.5, 3.7 and Chrome 3.x.
>
> Any ideas?
>
> Thanks!


[jQuery] keyup() fires multiple times?

2010-01-05 Thread Keith Hughitt
Hi all,

I'm creating a method for the first time which causes some action to
happen while a key is pressed. I've noticed, however, that the 'keyup'
event which I would  normally use to determine when the key is
released is fired continually, even when the key is still being
pressed.

e.g.

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


jQuery > Keyup Test
http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/
jquery.js" type="text/javascript">



$(function () {
$(document).keydown(function (e) {
console.log("keydown");
}).keyup(function (e) {
console.log("KEYUP");
});
});




Instead of seeing "keydown", "keydown"..."keydown", "KEYUP". It
switches back and forth between the two continually. So far I've
tested the same demo in FF 3.5, 3.7 and Chrome 3.x.

Any ideas?

Thanks!


[jQuery] Temporarily disabling events?

2008-08-27 Thread Keith Hughitt

Hi all,

I was wondering if anyone had any suggestions as to a method to
temporarily disable/prevent certain events from firing once one event
is fired? E.g. when pressing one button, I want to disable all other
button presses until an animation has finished.

One idea is to temporarily add some class (e.g. "disabled") to each
other button, and remove it once the animation is done. There are
probably better ways than this, however.

Any ideas?

Thanks,
Keith


[jQuery] Passing around sibling nodes in jQuery?

2008-08-21 Thread Keith Hughitt

Hi all,

I was wondering if anyone knows how I might be able to pass around two
sibling nodes constructed on the fly? I'm building a definition list,
and have a function which creates two adjacent domnodes, something
like:

var term = $('term');
var defn = $('defn');

I was hoping to return them to be inserted into the list:

return term.after(defn);

However only one of the nodes gets returned. I could wrap them in a
single container, return that container, and then take them back out,
but that is somewhat roundabout.

Any ideas?


Thanks,
Keith


[jQuery] Re: Selecting unusual CSS identifiers

2008-08-20 Thread Keith Hughitt

Thanks!

It worked perfectly with with jQuery. I had tried using single
backslashes to escape,
but never thought to try two. I appreciate the explanation as well :)

Take care,
Keith

On Aug 19, 4:26 pm, "Michael Geary" <[EMAIL PROTECTED]> wrote:
> Use two backslashes before each special character.
>
> A backslash in a jQuery selector escapes the next character. But you need
> two of them because backslash is also the escape character for JavaScript
> strings. The first backslash escapes the second one, giving you one actual
> backslash in your string - which then escapes the next character for jQuery.
>
> $('.first\\:\\:second')
>
> The rules for jQuery may be slightly different than CSS, but the double
> backslash should do the trick.
>
> -Mike
>
> > From: Keith Hughitt
>
> > Does anyone know if it possible to select elements with id's
> > or classname's that include colons or other similar
> > characters? So far I haven't found any evidence that "::" is
> > not valid as part of a CSS identifier, but have been unable
> > to select elements with a class "first::second."
>
> > Any ideas?
>
> > Thanks,
> > Keith


[jQuery] Re: how to add a delay to tooltip removal

2008-08-20 Thread Keith Hughitt

Hey Jörn,

Any chance you might also be able to allow having events displayed on
after an element is clicked? This would also help
get around the problem of including URL's inside tooltips.

Thanks,
Keith

On Jul 15, 2:09 pm, Matt <[EMAIL PROTECTED]> wrote:
> Thanks Jorn, since I have to have that post-delay(damn requirements!),
> I'm certainly going to work on implementing it, as best I can :). I'll
> contact you if/when I've got something. Thanks!
>
> Matt
>
> On Jul 15, 10:18 am, "Jörn Zaefferer" <[EMAIL PROTECTED]>
> wrote:
>
> > There is no easy way, no. You'd have to look at the
> > delay-implementation and apply that to hiding, including timeout
> > cancel on rehover. If you can provide a patch, no matter how messy,
> > I'll look into implementing it into the plugin.
>
> > Jörn
>
> > On Tue, Jul 15, 2008 at 6:26 PM, Matt <[EMAIL PROTECTED]> wrote:
>
> > > Hello,
> > > I'm using Joern's fantastictooltipplugin. For a project I'm working
> > > on, I need the tooltips to persist for a certain number of seconds
> > > after the user has ceased hovering over the element(in this case a
> > > label). I am already using the delay option, but was wondering if
> > > there was an easy way to add a post-delay before hiding thetooltip.
> > > Thanks!
>
> > > Matt


[jQuery] Selecting unusual CSS identifiers

2008-08-19 Thread Keith Hughitt

Hey all,

Does anyone know if it possible to select elements with id's or
classname's that include colons or other similar characters? So far I
haven't found any evidence that "::" is not valid as part of a CSS
identifier, but have been unable to select elements with a class
"first::second."

Any ideas?

Thanks,
Keith


[jQuery] Re: Feedback for new plugin idea: ui.querybuilder

2008-07-21 Thread Keith Hughitt

Chris-
I looked into OpenSearch some. It seems like a pretty promising
standard. For the plugin I want to be able to leave
it up to the developer exactly how the actual queries are generated.
Ideally, once the plugin is done, it could easily be extended
to handle OpenSearch, or any other type of queries. The important
question to consider initially is what minimum set of meta-data
is sufficient to enable these queries to be built (again, the
developer could extend the "SearchCriterion" objects being passed
around
to include any other data they would like).

Rene-
I'm also worried it could be hard to use once finished.. That's why
I'm trying to take some time now to plan it out carefully
and make it as easy to use as possible.

> How does the UI know what graphics to display for a criterion?

Good point. I had thought of allowing "image" or "thumbnails" as a
"type"
of SearchCriterion (text and date/date-range being the other types).
The thumbnails could
either be stored in a separate array "thumbnails," or possibly a hash
with the name of
the choice pointing to the thumbnail to use for that choice. I know
this is already fairly complex,
but to be able to offer this functionality in an automated way, there
isn't really any way to avoid it.
An instance of a thumbnailed "SearchCriterion" might then look like:

{
 name: 'material',
 type  : 'thumbnails'
 description: 'Please select a type of material'
 choices: ["wood", "plastic", "metal"],
 selected: null,
 priority: 1,
 requires: null,
 provides: [
 "wood" -> [SearchCriterion, SearchCriterion],
 "plastic" -> [SearchCriterion]
 ],
 thumbnails: [
 "wood" -> "tree.gif",
 "plastic" -> "bottle.gif",
 "metal" -> "steel.gif"
 ]
}

> How do you plan to communicate a search-query to the server?

This part I would leave completely up to the developer. Basically,
each choice for a given SearchCriterion would be associated
with some value. Once the user hits "search," the developer would have
a list of search keys and values (e.g. "material" -> "wood").
It is then up to them on how to deal with this. They would be allowed
to assign an event handler to the search button of course,
so it could be simply a matter of iterating through the search keys
and values and appending them to a url query string:

 http://www.somesite.com/search.php?material=wood&etc

In my case, I will be generating some XML to send off to the server. I
will leave it completely up the the developer though how the
query itself it formed. The plugin simply helps to get a collection of
keys and values from the user from which that query can easily
be built.

> And what kind of results-display do you propose?

Again this isn't something I plan to handle. Although it certainly
would be possibly to envision a search plugin that not only generates
and
sends off queries, but also displays the results, I plan to focus only
on the query interface end of things. The results interface will be up
to the developer to create.


Thank you both for the feedback and suggestions. Please let me know if
you have any other thought or ideas.

Take care,
Keith


> And what kind of results-display do you propose?


On Jul 18, 3:13 pm, "Rene Veerman" <[EMAIL PROTECTED]> wrote:
> I like the idea for this plugin, but fear it might be hard to use once done.
>
> Searches can be about anything.
> How does the UI know what graphics to display for a criterion?
>
> How do you plan to communicate a search-query to the server?
> And what kind of results-display do you propose?
>
> On Fri, Jul 18, 2008 at 5:11 PM, Keith Hughitt <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > Hi all,
>
> > I've started designing a jQuery UI plugin for building complex search
> > queries in a visual fashion, and wanted to see what people though, or
> > if people had any suggestions. Once the plugin is finished, anyone is
> > welcome to use it of course. I also posted this message in the jQuery
> > UI group, but I thought I'd post it here as well for those who aren't
> > members of the UI group.
>
> > I. Overview
>
> > The goal of the plugin is to create a UI component for piecing
> > together complex multi-component search queries and a simple and
> > visual way. The plugin will allow the user to select some set of
> > desired "search criterion," and then when then submit a query when
> > ready (the rest of the logic thereafter is out of the realm of this
> > plugin, and will be handled by the developer).
>
&

[jQuery] Feedback for new plugin idea: ui.querybuilder

2008-07-18 Thread Keith Hughitt

Hi all,

I've started designing a jQuery UI plugin for building complex search
queries in a visual fashion, and wanted to see what people though, or
if people had any suggestions. Once the plugin is finished, anyone is
welcome to use it of course. I also posted this message in the jQuery
UI group, but I thought I'd post it here as well for those who aren't
members of the UI group.

I. Overview

The goal of the plugin is to create a UI component for piecing
together complex multi-component search queries and a simple and
visual way. The plugin will allow the user to select some set of
desired "search criterion," and then when then submit a query when
ready (the rest of the logic thereafter is out of the realm of this
plugin, and will be handled by the developer).

To handle this, the plugin will be broken into three components:
Inactive, active, and current search criterion. The inactive and
active criterion are lists of criterion (will come back to exactly
what these are later) that either have or have not been applied, and
the current search criterion is a single criterion currently in
"focus." Although the  Developer will have control over where these
various components sit, one simple setup would be to have a single
container split horizontally into the three components:

(See Gimp mock-up at 
http://i61.photobucket.com/albums/h78/hughitt1/uiquerybuilderannotated.png)

II. Use case:

1. When the application initially loads, and the inactive search
criterion section is populated with a list of criterion the user can
use to search by. The current section displays a single search
criterion (the most useful one to begin with), possibly with
thumbnails for each choice. The inactive section is empty to begin
with.

2. The user clicks "option 2" and the filter moves from "current" ->
"active" (possibly with some animation), and a new filter from the
inactive section moves to "current."

3. User selects again and there are now two "active" search criterion.
The current search criterion isn't something the user cares about so
they click on one of the other inactive filters and it is swapped with
the current one.

4. This process continues until the user is satisfied with the chosen
parameters. The "inactive" list may be updated dynamically with new
search criterion that are relevant to some criterion already chosen.

5. (Optionally) If the developer has access to a method that returns
only the *number* of results for a given query, then this value can be
queried each time the user adjusts the query and displayed on screen.

6. The user hits "search" and some function provided by the developer
pieces together the active search criterion to produce and query
string and sends it off.


III. Some useful methods to have:

addCriterion
removeCriterion
activateCriterion
deactivateCriterion
swapCurrent
updateAvailableCriterion
updateNumResults
submitQuery

Event handlers could be available for each action (adding, removing,
swapping, etc.) to give the developer further control.


IV. How to represent a search criterion?

There are many different ways you could handle this. While I would
like the keep the plugin very general, and  make as few assumptions as
possible, I also want the plugin to handle most of the work. So far,
what I'm thinking would be best would be to pass around
"SearchCriterion" objects which have the following properties:

name: int
type  : string
description: string
choices: array
selected: (int, string, date, etc).
priority: int
requires: array
provides: array

I don't know if I will implement all of these, but using this
structure will make things pretty straight-forward for the plugin.

-"name" would act as both a display name for the search criterion, and
possibly also as a unique ID.
-"type" would allow specifying what to display when the filter is the
current one displayed: text only, thumbnails and text, a datepicker,
or a daterange picker.
- "description": for tooltips
- "choices": available choices to display (special case: dates and
date ranges)
- "selected": when active, this will hold the value the user selected.
- "priority": can be set to give some search criterion priority over
others for when to be displayed (0 being the initial criterion to
display under "current."
- "requires" (optional) Names of other criterion required for this one
to be used
- "provides" (optional) If present criterion becomes active, add these
to the list of inactive. E.g. If the user choses "Automobile", add the
search criterion "Number of Wheels." to the list.

V. Conclusion

There are still some details that need to be hammered out, but this is
the idea in a nut-shell. What do people think about it? Any ideas or
suggestions?

Any feedback would be greatly appreciated.

Take care,
Keith