Having a hard time with this Dave, and I'm afraid the thread has moved a
little ahead of my level. Here's where I'm at:
var intLink = ['site1.com/','site2.com/'];
function linkExc(){
if (document.getElementsByTagName) {
var a = document.getElementsByTagName(a);
for(var
On 12/14/06, Dave Methvin [EMAIL PROTECTED] wrote:
Uh oh, I know what it is. It's a bug in pushStack.
If the last arg to pushStack is a function, it does .each(fn) with the
filtered set but returns the original set. If there are two trailing
function args, the first is treated as above.
On 12/15/06, agent2026 [EMAIL PROTECTED] wrote:
Having a hard time with this Dave, and I'm afraid the thread has moved a
little ahead of my level. Here's where I'm at:
var intLink = ['site1.com/','site2.com/'];
function linkExc(){
if (document.getElementsByTagName) {
var a =
Has this been fixed in svn or has a bug ticket been opened?
I just opened two tickets.
pushStack bug:
http://jquery.com/dev/bugs/bug/511/
Document functions on destructive methods:
http://jquery.com/dev/bugs/bug/512/
___
jQuery mailing list
Hi,
I was just looking at this again, and wondered how I could make it work with
a string of links to not be external. For example using a for loop to go
through var intLink = link1, link2, link3, etc. Just not sure how to go
about getting the loop in there.
$([EMAIL PROTECTED]:not([EMAIL
I was just looking at this again, and wondered how I could
make it work with a string of links to not be external. For
example using a for loop to go through var intLink = link1,
link2, link3, etc.
$([EMAIL PROTECTED]:not([EMAIL PROTECTED]'+intLink+']):not(.thickbox))
.bind(click,
On 12/14/06, Dave Methvin [EMAIL PROTECTED] wrote:
*SNIP*
It would be nice if there was a $().grep() to filter the elements:
$([EMAIL PROTECTED]:not(.thickbox)).grep(function(){
for ( var i=0; i notthese.length; i++ )
if ( this.href == notthese[i] ) return false;
return true;
I looked at 1.0.3 source and filter() accepts a function and it
appears that if that function returns true the element is included
otherwise it returns false.
Thanks for pointing that out Jonathan, I was almost certain there was one
but I thought it was .grep() and the docs don't mention
Dave Methvin schrieb:
I looked at 1.0.3 source and filter() accepts a function and it
appears that if that function returns true the element is included
otherwise it returns false.
Thanks for pointing that out Jonathan, I was almost certain there was
one but I thought it was .grep()
On 12/14/06, Dave Methvin [EMAIL PROTECTED] wrote:
I looked at 1.0.3 source and filter() accepts a function and it
appears that if that function returns true the element is included
otherwise it returns false.
Thanks for pointing that out Jonathan, I was almost certain there was one
but I
If that was the case, jQuery(#main a).filter(function() { return false; })
would return nothing. But it doesn't. It returns the original group of
elements. At least for me.
-- Yehuda
On 12/14/06, Dave Methvin [EMAIL PROTECTED] wrote:
I looked at 1.0.3 source and filter() accepts a function
Am I mistaken, or does the string have to match exactly in this case? In
other words href=http://www.notthis.com; will return false, while
href=http://notthis.com/directory/file; will return true.
Adam
Jonathan Sharp wrote:
On 12/14/06, Dave Methvin [EMAIL PROTECTED] wrote:
*SNIP*
It
Am I mistaken, or does the string have to match
exactly in this case?
Yep, but you could implement a left-case-insensitive match or even a
regexp-based pattern match. The jQuery part wouldn't change at all.
___
jQuery mailing list
On 12/14/06, Yehuda Katz [EMAIL PROTECTED] wrote:
If that was the case, jQuery(#main a).filter(function() { return false;
}) would return nothing. But it doesn't. It returns the original group of
elements. At least for me.
Hm... I also tested this and filter didn't prune the list with my
upon testing filter with a function returns lots of items that aren't
nodes! But among them are the nodes in question.
$([EMAIL PROTECTED]:not(.thickbox))
.filter(function(el){
2 args[args.length-2];
_
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Jonathan Sharp
Sent: Thursday, December 14, 2006 2:31 PM
To: jQuery Discussion.
Subject: Re: [jQuery] Change href of external links
On 12/14/06, Yehuda Katz [EMAIL PROTECTED] wrote
Lol, sweet. Looking forward to the ESP version.
Small typo, in case anyone comes across this:
dave.methvin wrote:
$([EMAIL PROTECTED]:not([EMAIL PROTECTED]'internal.com/']):not(.thickbox))
.bind(click, function(){ return !window.open(this.href); });
Should be [EMAIL PROTECTED],
Dave Methvin schrieb:
You start with 10 lines of jQuery that would have been 20 lines of
tedious DOM Javascript. By the time you are done it's down to two or
three lines and it couldn't get any shorter unless it read your mind.
Dave, ha, that is a great quote. It belongs to the homepage!
--
Dave Methvin schrieb:
You start with 10 lines of jQuery that would have been 20 lines of
tedious DOM Javascript. By the time you are done it's down to two or
three lines and it couldn't get any shorter unless it read your mind.
Dave, ha, that is a great quote. It belongs to the homepage!
I
Thanks guys, excellent solutions and points. I've gone with Dave's solution,
as it allows some tag flexibility without adding much code.
One question: is it not possible to combine .not arguments? Tried playing
with the quotes, but it only seems to work if they are separated.
.not([EMAIL
One question: is it not possible to combine .not arguments?
Tried playing with the quotes, but it only seems to work if
they are separated.
.not([EMAIL PROTECTED]'internal.com/'])
.not([EMAIL PROTECTED]'thickbox'])
Even better, you could use the :not() selector to do the job all at once, I
Hi all,
New to jQuery, and I'm trying to use it to set my external links to open a
new window without using any attributes to mark the external links. I can
do this with regular js, using a.href.match, but I can't get it to work with
jQuery. Tried various directions, but no go.
Sure I'll
On 28/11/06, agent2026 [EMAIL PROTECTED] wrote:
Hi all,
New to jQuery, and I'm trying to use it to set my external links to open a
new window without using any attributes to mark the external links. I can
do this with regular js, using a.href.match, but I can't get it to work with
jQuery.
I think one of greatest features of jQuery is support of XPath and
CSS3 selectors, so why to mess up code with each() and match()?
Use this nice way:
$([EMAIL PROTECTED]'http:']).click(function(){
...
});
More about it:
http://jquery.com/docs/Base/Expression/XPath/
New to jQuery, and I'm trying to use it to set my external links to open
a
new window without using any attributes to mark the external links. I
can
do this with regular js, using a.href.match, but I can't get it to work
with
jQuery. Tried various directions, but no go.
Sure I'll
Actually, you have to check for href attribs that start with http
but then make sure that they're not http://yourdomain.com; because IE
will translate relative links into absolute ones in the returned
string from aTagRef.href. I'd also make sure that they don't start
with javascript: and mailto:;.
On 28/11/06, Jörn Zaefferer [EMAIL PROTECTED] wrote:
New to jQuery, and I'm trying to use it to set my external links to open
a
new window without using any attributes to mark the external links. I
can
do this with regular js, using a.href.match, but I can't get it to work
with
For further clarification, here's some sample (untested mock up) code
that is a jQuery version of something I did a while back:
allowedDomains = ['mydomain.com','myotherdomain.net'];
$('[EMAIL PROTECTED]http]').each(function(){
var isExt = true;
for(var
Woah, that's pretty tight. Nice one.
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
When testing, keep in mind that browsers behaviour
with href attributes is quite inconsistent. While some
return only the value as found in the markup, others
add the domain and protocol.
Right, IE usually adds the base href to relative URLs. I think this would
work in all browsers:
Or even better:
$([EMAIL PROTECTED]'https:']).attr(target,_blank);
It's easy to go overboard with JS where its not really needed. :)
Another thing you may need to consider is that some browsers seem to return
the full url for the href attribute, even for relative links. You may want
to filter
31 matches
Mail list logo