[jQuery] Re: Are numerical properties/indexes supported?

2010-01-13 Thread Dean
I seem to have answered my own question here. Since the jQuery.get()
method is around, and since jQuery is an array at heart, I assume it's
supported.

On Jan 13, 2:03 am, Dean  wrote:
> Any jQuery object currently has numerical properties/indexes that
> store references to the DOM node elements matched in the search.
> (E.g., $("div")[0] is a reference to the first matched DOM node
> element in the search.) Can we rely on these properties remaining in
> jQuery indefinitely?
>
> (I haven't found reference to them in any documentation, but I suppose
> it could be that they are inherent to supporting other functions/
> methods.)


[jQuery] Are numerical properties/indexes supported?

2010-01-13 Thread Dean
Any jQuery object currently has numerical properties/indexes that
store references to the DOM node elements matched in the search.
(E.g., $("div")[0] is a reference to the first matched DOM node
element in the search.) Can we rely on these properties remaining in
jQuery indefinitely?

(I haven't found reference to them in any documentation, but I suppose
it could be that they are inherent to supporting other functions/
methods.)


[jQuery] simple plugin script

2010-01-12 Thread Dean
In my plugin, I'd like to provide a constructor (or sorts) that
returns an extended jQuery object with some additional functionality.

I've reduced this problem down to a very simple test case.

I don't get an error until I attempt to run a method of the new,
extended object. The error is "foo.rename is not a function". This
apparently means that I was not successful in extending $(this) in the
plugin's constructor, but I'm not sure why. Does anyone know why?




  Test
  http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/
jquery.js" type="text/javascript">
  
(function($)
{
  /* Extend the jQuery prototype so any selected element(s) can
implement create_content. */
  $.fn.extend
  ({
/* Initialize this extended object. */
create_content: function(settings)
{
  /* Initialize all matched elements. */
  return this.each(function(i, el)
  {
/* Extend $(this) with additional properties and methods. */
$.extend(false, $(this),
  {
s: settings,
/* Show this content. */
activate: function()
{
  return this.show();
},
/* Hide this content. */
deactivate: function()
{
  return this.hide();
},
/* Change the content. */
rename: function()
{
  return this.html(settings["text"]);
}
  }
);
  });
}, // end create_content
  }); // end $.fn.extend
})(jQuery);

$(document).ready(function()
{
  var foo = $("#foo").create_content({ text: "New text for
foo." }); // Error: foo.rename is not a function.
  var bar = $("#bar").create_content({ text: "New text for bar." });

  foo.rename();
  bar.rename();
});



  Foo
  Bar




[jQuery] Re: re-establish user selection in a div with designmode=true

2009-06-07 Thread Dean

OK, now I got it to work... I needed to re-establish the range inside
my ajax call. Cool. One wierd thing I did notice though is that
sometimes the insertion cursor disappears. Its in the right place, its
just not visible until you start to type. Thanks again for the
suggestions.


[jQuery] Re: re-establish user selection in a div with designmode=true

2009-06-07 Thread Dean

Sidenote:

Now this is truly weird. I commented out my code. After I reload the
div I have it select all the contents of the div, like this:

$('#right div.text').each(function() {
window.getSelection().removeAllRanges();
var range = document.createRange();
range.selectNodeContents(this);
window.getSelection().addRange(range);
});

What happens? The entire div is selected and then the selection goes
away and is replaced by an insertion cursor in the beginning of the
div! What the heck is this all about?


[jQuery] Re: re-establish user selection in a div with designmode=true

2009-06-07 Thread Dean

Thanks. I took your advice and thought I had everything working
nicely. Before I "update" the div my code recursively descends into
the div so that I can turn a "range component" (refNode + offset) into
an offset in a paragraph number. I tested this in firebug and it works
fine. After the div is rewritten (remember the paragraph and text stay
the same, but spans inside the paragraphs may come or go) I have code
that is similar to the "save" code discussed above except that it is
looking for a range component based on what was saved (paragraph
number and offset within the paragraph). This also seems to work fine.
But somehow, the insertion point (or selection) in the div does not
visually show up as being set, and I am following exactly what you
showed in the first code snippet in your reply as shown below. The
selection shows up as a collapsed selection at the beginning of the
div.

Did I miss something else?

On Jun 5, 8:24 pm, mkmanning  wrote:
> For FF:
> window.getSelection().removeAllRanges();
> range = document.createRange()
> range.setStart(YOUR_ELEMENT, start_position);
> range.setEnd(YOUR_ELEMENT, end_position); //0
> window.getSelection().addRange(range);
>
> For IE the equivalent is something like:
> get the range with document.body.createTextRange()
> call moveToElementText, call setEndPoint, call moveStart, call
> moveEnd, then select().
>
> It's been a while since I've had to work with any of this (and
> fortunately I wasn't having to code for IE at the time).
>
> Getting your start position is part of the problem if the caret was in
> a bunch of nested elements. One thing that might help is to pass
> window.getSelection() to the Firebug console and then you can expand
> the object to see all of the available methods (which won't
> necessarily be the same in IE :( ).
>
> I'm afraid jQuery won't be of help here. A good source for information
> on the Range and Selection objects is 
> MDC:https://developer.mozilla.org/En/DOM:Range
>
> Unfortunately, cross-browser implementations of the Range object are
> inconsistent and the documentation minimal.
>
> HTH :)


[jQuery] Re: re-establish user selection in a div with designmode=true

2009-06-05 Thread Dean

I will try to create an example of what I am trying to do. Bear in
mind that the actual manipulation is being done in javascript/jquery
but I do not see the need to show the code to explain the problem.
Suppose I have created a div that appears like a regular textarea (it
is editable), with the addition of computer generated highlights on
certain portions of the text. Somehow, the DOM for this div will be
rebuilt, either by the user clicking on a button or the fact that they
did not type anything for some period of time. Anyway, suppose it
initially looks like this:


Now is the time for all good men to come to the aid of the
country.
It is a far, far, better thing than I have ever done.
Endeavor to perservere.


Now, just imagine that the user has a selection starting just before
the word "all" in the first paragraph and just after the word "than"
in the second paragraph. The update gets executed (somehow) and causes
the entire inside of the div to be replaced as follows:


Now is the time for all good men to come to the aid of the country.
It is a far, far, better thing than I have ever done.
Endeavor to perservere.


As you can see, the paragraphs and text are the same, but some of the
words get highlighted differently in the 2 cases. In the second case,
after its all built, I want to set a selection (range?) to be just
before the word "all" in the first paragraph and just after the word
"than" in the second paragraph, exactly as it is in the first case.
When I rebuild the interior of the div (case 2) a collapsed selection
in set before the first paragraph. I really don't understand how to
get it to work. If I can figure out how to do it, life will be good!

Any other ideas?

Dean

On Jun 5, 6:29 pm, Gustavo Salomé  wrote:
> Im not sure if i get what you want to do but
> try this:
> $div=$('#div');
> div.data('old',div.html());
>
> 2009/6/5 dhoover 
>
>
>
>
>
> > I have a web app where I have created a div to masquerade at a
> > textarea so I can add highlighting according to so rules. I rely on
> > setting designmode=true. After certain amounts of idle time my code
> > grabs the text from the div, which consists of  tags and 
> > tags and re-generates the html with new spans. The paragraphs and text
> > stay the same. So far so good. But when the div "repaints" the
> > insertion is set to the beginning of the div. I want it to visually
> > stay put, meaning I need to somehow record where it was before and
> > then restore it afterwards.
>
> > Problem is, I can't seem to get my head wrapped around how selections
> > (Ranges, etc.) work. I've been googling around for the last day or so
> > and have not yet seen the light.
>
> > Any ideas?
>
> --
> Gustavo Salome Silva


[jQuery] Re: inline script html vs xhtml

2009-05-27 Thread Dean

Wow. That is totally bizzare. When I self close but don't have any
inline scripts, it works.

Thanks!

On May 27, 11:52 am, Scott Sauyet  wrote:
> dhooverwrote:
> > I am a bit perplexed at why a simple bit of code I have is firing in
> > HTML but not in the equivalent XHTML. Here is the HTML file (that
> > works as expected):
> > [ ... ]
> > 
>
> This is the culprit.  I'm not sure why, but script tags are never
> allowed to self-close like that.
>
> Try
>
>    
>
> Cheers,
>
>    -- Scott


[jQuery] Does IE simply not work or...

2009-02-16 Thread Dean C. Reed


Or is there a common work around?

I spent a few days getting familiar with JQuery and it works perfectly  
in Firefox. I go to test it in IE and literally nothing works. Aside  
from the basics, I'm using a validator plugin, but I'm getting JS  
errors at every turn. Vague errors like "object expected" when I'm  
simply calling a JS function that uses JQuery calls.


IE is very frustrating, they should just shoot it and put us out of  
our misery.





[jQuery] Re: Gathering page elements when using .post()....

2009-02-13 Thread Dean C. Reed


The serialize appears to create a string for GET, I need name/value  
pairs - object1: object1value, object2: object2value etc.


For constructing the URL, I can see how to use serialize but it won't  
work for post, I get the  JS error "Invalid object initializer".


Any ideas for using serialize with $.post()?


On Feb 11, 2009, at 2:10 PM, James wrote:



Yes, there is a way:
http://docs.jquery.com/Ajax/serialize
http://docs.jquery.com/Ajax/serializeArray

On Feb 11, 6:43 am, "webspee...@gmail.com" 
wrote:

Hey all.

I need to gather the name/value of 25 elements. Is there a quick way
of doing this with .post() rather than manually setting each one
individually?

I can do it with a URL, but I want to use POST, not GET.

Any suggestions?




[jQuery] Re: load() not loading my dynamic page

2009-02-05 Thread Dean Barker
look at onLoad()

 

www.frameJockey.co.uk
i...@framejockey.co.uk
framejoc...@gmail.com
framejoc...@yahoo.com
 [image: Google Talk:] framejoc...@gmail.com [image: Y! messenger:]
frameJockey


2009/2/5 Code Daemon 

>
> When I use load(), it works fine for static pages but doesn't seem to
> work for my dynamic page.
>
> This is what I'm doing:
>
> $('#mydiv').load('my/page');
>
> FireBug shows that the response is coming back just as it should. Any
> thoughts?


[jQuery] Re: good in FF but not in IE??? 10 lines of code ?

2009-02-04 Thread Dean Barker
Thanks fella you are a star !

 

www.frameJockey.co.uk
i...@framejockey.co.uk
framejoc...@gmail.com
framejoc...@yahoo.com
 [image: Google Talk:] framejoc...@gmail.com [image: Y! messenger:]
frameJockey


2009/2/4 donb 

>
> 

[jQuery] jQuery generated links are printing out the whole URL when user tries to print their info

2009-01-27 Thread Dean Farrell
We're having a problem with jQuery generated links appearing normally on
screen, but printing out the whole URL in print view.

Any suggestions?

Thanks,

Dean Farrell


[jQuery] Re: OT : javascript editor (with code formatting)

2008-10-08 Thread dean

I use scite its really light weight and powerful at the same time if
you have ever used TextMate on the Mac then it will be familiar.
Might be worth a look anyway.

< href="http://www.scintilla.org/";>http://www.scintilla.org/


[jQuery] Re: [New plugin] Colorpicker

2008-07-07 Thread Dean Landolt
> The picked is really nice, but I'm unable to use the arrows on firefox
> 3 / Linux.
>

The arrows work for me in FF3. You have to click and drag on them -- they're
not spin buttons, though at first glance that is how they look.


[jQuery] Re: submitting a form by pressing enter

2008-06-26 Thread Dean Landolt
It's been my experience that listening for keycodes in js can be a bit
hairy. If you have a bunch of inputs, it's probably semantic to wrap them in
a form (the div too if you like), then you could take advantage of the on
built-in event listener but just prevent the actual form submission:

$('#myForm').submit(function(e){
e.preventDefault();
doSomething();
});

On Thu, Jun 26, 2008 at 1:45 PM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> Thanks for your replies.  I have a follow up question.  Let's say I
> have a bunch of inputs, type="text" within a div with id="myDiv".  How
> do trigger an action if someone presses enter within one of those text
> fields?  This would not be a form submission necessarily.
>
>  - Dave
>
>
> On Jun 26, 5:25 am, tlob <[EMAIL PROTECTED]> wrote:
> > A page is read without css? Hmmm I think that is really really really
> > rare Even more rare than a browser without js turned on. Thats
> > only really really rare ;-)
> >
> > Or what do you mean?
> >
> > instead of moving it away, why not css display:none;? Does this brake
> > the submit?
> > cheers
> > tl
> >
> > On Jun 26, 10:22 am, Steen Nielsen <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > You need to insert a submit button in the form to get it working..
> > > 
> >
> > > if you don't want to show the button you can always hide it using CSS.
> > > I usually just positioning it -9000px to the left, that way it won't
> > > show up, but if the page is read without CSS, it will be shown
> > > correctly with a submit button
> >
> > > On Jun 26, 6:20 am, "[EMAIL PROTECTED]"
> >
> > > <[EMAIL PROTECTED]> wrote:
> > > > Hi,
> >
> > > > I have a form, with id="myForm", with a number of text fields (input
> > > > with type="text").  How do I cause a form submission by pressing
> enter
> > > > in any of those form fields?
> >
> > > > Thanks, - Dave- Hide quoted text -
> >
> > - Show quoted text -
>


[jQuery] Re: Adding hover to all table rows (tr) but the first one.

2008-06-26 Thread Dean Landolt
> Hi again,
>
> you replied directly to me with this:
>
>  Awesome! Now 1 more question.
>>
>> How can I have it not hover the last row too?
>
>
Just to expand a little on sheshnjak's point above, if it does sound like
it's a header and footer you're trying to differentiate. If that's the case,
may I suggest the more semantic  and  tags? They might come in
handy.


[jQuery] Re: Cluetips Protips Jtips

2008-06-07 Thread Dean

Karl,

Prototip has ajax and the things you've mentioned. If you are looking
for ideas to improve cluetip, it might be a good idea to a look at it.

- Dean

On Jun 8, 1:51 am, Karl Swedberg <[EMAIL PROTECTED]> wrote:
> Thanks, Rey, for mentioning that.
>
> Dan, if you have a "design eye," the clueTip plugin is completely
> skinnable. It comes with three preset themes, but I've seen a few 3rd
> party implementations of it that are gorgeous. It's all in the CSS.
>
> Prototip looks great, but one thing you might want to consider is the
> flexibility of the data source. At first glance, it looks like
> Prototip requires you to use one of the function's arguments as the
> tooltip's content. With the clueTip plugin, on the other hand, the
> content can come from a separate file, from an element in the same
> document, from the title attribute (or another attribute if specified)
> of the invoking element, or from an optional argument of the cluetip()
> method. It also has a number of options for various positioning
> schemes and open/close triggers. If something doesn't work right or
> look right, I'd love to hear how I can improve it.
>
> Cheers,
>
> --Karl
>
> 
> Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> On Jun 7, 2008, at 6:22 PM, Rey Bango wrote:
>
>
>
> > Dan,
>
> > I think has done a fabulous job with Prototip2. It's very feature
> > rich and most likely the reason that he charges for his work. With
> > that said,  the solutions you've been presented are pretty good. To
> > recap you can:
>
> > 1) Use prototip with jQuery using noConflict
> > 2) Use clueTip which is also feature rich
>
> > If the concern you have is the aesthetics, I would suggest you bring
> > that up to jQuery team member Karl Swedberg who is VERY open to
> > updating clueTip and also in receiving help in making changes. I
> > know he would appreciate another hand in making changes.
>
> > Rey...
>
> >> On Jun 2, 4:22 pm, Danjojo <[EMAIL PROTECTED]> wrote:
> >>> I really like the quality of the tooltip pop-ups found 
> >>> herehttp://www.nickstakenburg.com/projects/prototip2/
>
> >>> What is the closest thing we have to this level of quality in
> >>> jQuery?
>
> >>> Thanks,
> >>> D


[jQuery] Re: Cluetips Protips Jtips

2008-06-07 Thread Dean

Haven't seen anything of that quality done with jQuery, you could use
Prototip with jQuery noConflict.

I've emailed the author if he could port this to jQuery. He said he
would consider making his scripts framework independent, I guess that
would be even better.

Regards,
Dean


On Jun 2, 4:22 pm, Danjojo <[EMAIL PROTECTED]> wrote:
> I really like the quality of the tooltip pop-ups found 
> herehttp://www.nickstakenburg.com/projects/prototip2/
>
> What is the closest thing we have to this level of quality in jQuery?
>
> Thanks,
> D


[jQuery] Re: Promoting jQuery the WRONG way

2007-04-04 Thread -dean

Rey,

Thanks for posting this. But to be honest I think I overreacted to
Michael's comment.

To put the record straight. I don't have a problem with jQuery users.
You are a pretty great bunch from what I can gather. Mostly I think
this is just part of a recent trend whereby some people can be a bit
harsher online than they would be in a face-to-face conversation. I
should be used to it by now. :-)

-dean



[jQuery] Packer version 3.0

2007-04-02 Thread -dean

Hi guys,

I know that many jQuery users use packer to compress their scripts/
plugins. To help ensure the quality of packer I would appreciate a
little help from the jQuery community. :-)

Could you try re-compressing your scripts with the new version to make
sure I haven't introduced any new bugs? It would help me sleep at
night. ;-)

cheers,

-dean