[jQuery] Re: Disabling ctrl+v(paste) in forms with jquery
On Aug 20, 4:47 pm, Web Specialist [EMAIL PROTECTED] wrote: I'm looking a script to disable users to paste content in forms using ctrl+v. How to avoid that? Since that facility is provided independent of JS by the underlying native widgets (often at a deeper level than the browser application itself), i don't believe this can be done from JS. Also, removing a facility which a user expects to work everywhere is poor practice, as it leads to a confusing user experience. As a user it would really piss me off to find out that copy/paste is disabled for a specific field/form. Widgets which do disable copy/paste are normally coded at the level of the underlying UI toolkit. The only example i'm aware of in the real world is password fields, which often disable copy/paste. If the underlying UI toolkit has a password-style field which prohibits copy/ paste AND the browser uses this widget type for input type='password' fields, then you inherit this functionality, otherwise i don't think it can be reliably achieved via JS. Consider, too, that a user can disable JS to re-enable copy/paste.
[jQuery] Re: Square brackets in name-attribute
On Aug 20, 4:37 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: a problem I couldn't find a solution for is the following: I have an input element with the attribute: input name=[DUS][1] / http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_element_that_has_weird_characters_in_its_ID.3F That FAQ is about the ID field but the same applies to other fields.
[jQuery] Re: Disabling ctrl+v(paste) in forms with jquery
On Aug 20, 4:58 pm, Stephan Beal [EMAIL PROTECTED] wrote: On Aug 20, 4:47 pm, Web Specialist [EMAIL PROTECTED] wrote: I'm looking a script to disable users to paste content in forms using ctrl+v. How to avoid that? And don't forget that you'd also have to disable Shift-Insert AND the right-mouse button AND the menu button available on many keyboards (equivalent to the right mouse button, normally). In short - you're not going to be able to block that feature reliably from JS.
[jQuery] Re: How can I add new plugins to JQuery plugin list?
On Aug 20, 4:30 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Last time I working under creation of new plugins for JQuery. What I need to publish my plugins description in JQuery site? Where have I to place my plugins in external web-servers or it's possible to put my files into JQuery web-site? There exists any validation phase for new jquery plugins ? Thaks for advance. Go create an account here: http://jquery.com/plugins/ and then just follow the links to create a new plugin. That does not include the plugin in the Subversion tree, but it provides a centralized location where people can find your plugin, including downloads and bug reporting. That tool allows you to link to an external home page for your plugin, demo page, etc. As an example: http://jquery.com/plugins/project/Spoilers
[jQuery] Re: Keeping a mouseover-triggered animation from running
On Aug 20, 6:25 pm, Gordon [EMAIL PROTECTED] wrote: My first attempt simply did an animate () on the hovered item and another one when it was unhovered. this produced the desired scaling effect, but it also ran into a few problems when the mouse was moved over several items in quick succession. i think what you're looking for is the hoverIntent plugin: http://cherne.net/brian/resources/jquery.hoverIntent.html
[jQuery] Re: ASP.NET IDs
On Aug 18, 10:29 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: 2) I'm also using AJAX update panel to update a gridview. Everything is working great. However, once I update the gridview and it's refreshed in AJAX, my jQuery no longer works, even though the code is there. This sounds like one of the FAQ questions: http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_Ajax_request.3F
[jQuery] Re: Avoiding invalid markup
On Aug 19, 5:55 am, Kyle [EMAIL PROTECTED] wrote: $(this).hide().parent().prepend(img class='ajax-loader' src='ajax- loader.gif' height='14px' style='padding-left:7px;' alt='loading...'/ ); This, obviously, is in the head tag. However, when I run it through the validator, it is returning an error: ... I want to avoid invalid markup; how can I get around this? In what context are you using $(this)? If $(this) resolves to the HEAD then parent() will resolve (i believe) to the HTML node, to which you are prepending an IMG, which of course is illegal. The way to avoid that is to use a legal path to the element which you want to add the IMG to. Without seeing your code i can't say much more than that. :?
[jQuery] Re: $.load() POSTing instead of GETing
On Aug 19, 12:10 am, Pops [EMAIL PROTECTED] wrote: The default is GET, however, if you pass the 2nd parameter as URL data and not a function, then jQuery assumes a POST is desired. Studying this seems odd. I can take a swag at the reasons: - As a poor's man security consideration against ajax injections. and - If you are sending JSON data, its cleaner to send non name=value pair data as a post. One of the negative side-effects is, however, that POST is not configured consistently across servers. For example, i had the example same problem as the OP... i was trying to load() an HTML file and it worked on my local system. When, however, i uploaded it to my hoster the code suddenly failed. Firebug revealed that POST was erroring out on my hoster because POST was not allowed for HTML files on that server. So i had to rework the code to use get(). i remember trying to set GET as the default ajax behaviour and that load() ignored that.
[jQuery] Re: Simulate foucs on any div, really get Firebug and use it
On Aug 18, 9:43 pm, Mitch [EMAIL PROTECTED] wrote: In fact this demo has a little bit of every thing in it. That's what impressed me. It really is a full-fledged app (or appears to be - i couldn't figure out how to get it to do anything, so i assume it's a prototype or mock-up). You did a hell of a job on the UI.
[jQuery] Re: Find URLs in text?
On Aug 18, 9:50 pm, Rod Begbie [EMAIL PROTECTED] wrote: Quick question to attempt to avoid reinventing the wheel. Is anyone aware of a Javascript library (JQuery or otherwise) which will find URLs in a chunk of text and either turn them into links, or make it easy for me to do so myself? (Something like Perl's URI::Find module, or the urlizer formatter in Django?) Hi, Rob! Try googling for regex to find URLs (or variants thereof). That returns LOTS of relevant links. Note that JavaScript uses mostly Perl- compatible regular expressions, so you can also look into examples posted for Perl and/or PHP code. The first result to the above query looks to be relevant: http://www.truerwords.net/articles/ut/urlactivation.html
[jQuery] Re: Documentation Nit: .load - Incorrect Info regarding how data is sent
On Aug 19, 12:31 am, Pops [EMAIL PROTECTED] wrote: In the docs for .load, it has: params (Object): (optional) A set of key/value pairs that will be sent as data to the server. That is not what I am seeing, the following $('#containerId').load(url,k1=v1k2=v2); Hi, Pops! That should be: $(...).load('url', {k1='v1', k2:'v2'}); :)
[jQuery] Re: Documentation Nit: .load - Incorrect Info regarding how data is sent
On Aug 19, 12:39 am, Stephan Beal [EMAIL PROTECTED] wrote: $(...).load('url', {k1='v1', k2:'v2'}); s/k1=/k1:/, of course.
[jQuery] Re: $.load() POSTing instead of GETing
On Aug 19, 12:55 am, Pops [EMAIL PROTECTED] wrote: What was you sending? i wasn't sending anything - i just wanted to load the contents of an HTML snippet file (not a complete/well-formed HTML document) into a DIV. We write our own web server and as such we conform to HTTP RFC standards, and it was never a consideration to be aware of configuration options for standard GET/POST required operations. I mean, a web server either supports proper RFC 1945 (HTTP 1.0) or RFC 2616 (HTTP 1.1) or it doesn't in which case, its broken :-) Apache can be configured to allow/disallow POST for certain extensions. On my provider they have POST to HTML disabled (presumably it is enabled for SHTML, and is definitely enabled for PHP). bandwidh DSL speeds that differ in direction. Fast input (downloads), slow output (uploads) created a timing issue which causes a TCP/IP frame reset. The visual error for users was PAGE NOT FOUND. No, the error was method [POST] not allowed, and was/is a simple Apache config option. Since it is unusual to have .html files serve as dynamic file sources, disabling POST for them seems to be reasonable (but annoying for my case because on my local server it had worked, causing confusion after i tested it remotely). My assumption was that load() would respect the default settings set for ajax(), which i subsequently set to use GET, but load() appears to ignore those options. Using get() worked around the problem, in any case.
[jQuery] Re: Documentation Nit: .load - Incorrect Info regarding how data is sent
On Aug 19, 1:16 am, Pops [EMAIL PROTECTED] wrote: Stephan, You're pulling my leg? Not as far as i know, but... Firebug shows this when I enter the following in the console: console.log($.param({k1='v1', k2='v2'})); 0=%7B1=k2=13=%3D4='5=v6=17='8=%2C9=%2010=k11=212= %3D13='14=v15=216='17=%7D Um... err... ??? i may be wrong on what the param object should be, but my understanding is that it's an Object/map of key/val pairs. Maybe someone out there can correct or confirm that?
[jQuery] Re: Documentation Nit: .load - Incorrect Info regarding how data is sent
On Aug 19, 1:21 am, Stephan Beal [EMAIL PROTECTED] wrote: Um... err... ??? i may be wrong on what the param object should be, but my understanding is that it's an Object/map of key/val pairs. Maybe someone out there can correct or confirm that? From the example on the docs page: http://docs.jquery.com/Ajax#load.28_url.2C_params.2C_callback_.29 $(#feeds).load(feeds.html, {limit: 25}, function() { alert(The last 25 entries in the feed have been loaded); } ); In that usage, the params object is indeed an object/map. The problem with that example is that it uses an HTML file as the target, whereas (as mentioned in my other post a few minutes ago), POST isn't configured to work on some web servers for HTML files.
[jQuery] Re: stupid dev tricks: marking current page links
Regexes are definitely worth learning. Once you know them, you can use them in many different programming languages (and even non-programming tools) and you'll be SO happy that you know how to use them. Brief follow-up: http://xkcd.com/208/ That's based on a true story.
[jQuery] Re: Hover Delay
On Aug 17, 3:43 pm, b0bd0gz [EMAIL PROTECTED] wrote: I have a image which underneath has a p tag which contains some text, when the image is loaded the p tag is hidden until the cursor hovers over the image, then the p tag is shown. What I want to know is, is there a way I can only show the p tag if the cursor is held over the image for a set amount of time, else keep it hidden. http://cherne.net/brian/resources/jquery.hoverIntent.html That's exactly what you want.
[jQuery] Re: Avoiding anonymous functions - enhancement suggestion
On Aug 17, 5:51 pm, Matt Kruse [EMAIL PROTECTED] wrote: Assigning event functions like click() require an anonymous function for what is often a very small snippet of code. These anonymous functions are confusing to inexperienced javascript coders and make the code less readable, IMO. People who are unwilling to become comfortable with the language they're working in (e.g., by using its available features, such as anonymous functions) shouldn't be working in the language. I think it would be great to be able to pass a string to these functions and have it internally turned into a function. i think this would be counter-intuitive. If i pass a string to a function and know that it will be executed, i would expect the string to be eval()'d, not run in a Function object, and those evaluate their code with different scoping rules. This simple code change seems to do the job: // Handle event binding jQuery.fn[o] = function(f){ return f ? this.bind(o, ((typeof f==string)?Function(f):f)) : this.trigger(o); }; Shouldn't that be (new Function(f)) instead of (Function(f))? Is it possible to change jQuery to accept a string in addition to a function reference where possible? Although you would lose the potential benefit of the closure by passing a string, you could always pass the function ref instead if you needed to. IMO this change would be far more complex that it seems because, for example, the following no longer applies: if( typeof f == function ) { ... } That would have to be changed to include checks for Function: if( (typeof f == function) || (f instanceof Function) ) and the call syntax for those are different. You can, as far as i know, simply do f() when f is an instance of Function (i may be wrong on that, but i don't believe JS offers any sort of operator overloading for built-in types). Not only would the core be affected, but plugin authors might also have to go back and make similar changes, for consistency. The cascade of side-effects is enormous. i personally see no benefit, and several potential down-sides, to this change.
[jQuery] Re: Avoiding anonymous functions - enhancement suggestion
On Aug 17, 6:49 pm, Stephan Beal [EMAIL PROTECTED] wrote: According to the rhino book: ... One more follow-up here and i'll shut up: Also according to the rhino book: The Function() constructor parses the function body and creates a new function object each time it is called. ... By contrast, a function literal or nested function that appears within a loop or function is not recompiled each time it is encountered. So using Function(...) inside an $(...).each() loop could be disastrous, memory-wise. To summarize, the main problems with passing strings to create Function instances, compared to using anonymous functions, are: a) scoping rules are different (more eval()-like, no lexical scoping) for Function, as opposed to lexical scoping for anonymous functions. b) Function(...) body is recompiled on each call, whereas function does not. Only (a) should directly affect a user, but (b) would certainly come up at some point when someone traverses a table with 5k+ cells in it.
[jQuery] Re: Avoiding anonymous functions - enhancement suggestion
On Aug 17, 6:25 pm, Glen Lipka [EMAIL PROTECTED] wrote: the base code. I think slamming ideas is a bad practice. It might not make it into the code, but all ideas should have the benefit of the doubt that the suggestion is thoughtful. Saying i personally see no benefit is a statement of personal opinion, and not a slam. My apologies for the confusion. I used to feel uncomfortable with the function() {} part. It had alot of parens and brackets to keep track of and made me nervous. You work in an editor which doesn't do parent/brace matching for you? So I am mixed about it. To me, Longer seems more understandable but shorter is more readable. But offering both approaches at once has problematic technical implications, which i detailed in my first post. In summary, calling a function() and a Function() cannot be done uniformly. That is, you cannot do: function f(a,b,c) { ... } var f1 = f; var f2 = new Function(...); f1(1,2,3); f2(1,2,3); // this won't work And that means that the jQuery internals would have to accommodate both cases if it were to support this syntax. A quick look in a JS book implies that you could use f.apply() or f.call() for both approaches, but that also requires fiddling with the arguments lists (moving the args into an array). Also, according to this book (the rhino book), Function.arguments is being removed from ECMAScript 3, making it even more different from normal functions. And try generically passing multiple arguments to the Function ctor... it cannot be done generically - it would require a block for each different number of arguments. So, to respond more gently this time: my considered technical opinion is that this change would result in so many bugs and workarounds that it could no longer be considered a feature.
[jQuery] Re: Avoiding anonymous functions - enhancement suggestion
On Aug 17, 6:33 pm, Matt Kruse [EMAIL PROTECTED] wrote: On Aug 17, 11:11 am, Stephan Beal [EMAIL PROTECTED] wrote: i think this would be counter-intuitive. If i pass a string to a function and know that it will be executed, i would expect the string to be eval()'d, not run in a Function object, and those evaluate their code with different scoping rules. How so? Both are run in the context of the global object, are they not? According to the rhino book: A last, very important point about the Function() constructor is that the funcions is creates do not use lexical scoping; insteawd, they are always compiled as if they were top-level functions... That alone completely rules out their use for many use-cases as event handlers, which often want access to variables from their containing scope. Shouldn't that be (new Function(f)) instead of (Function(f))? Same diff, but shorter. i don't think those are the same, as (Function(...)) is not creating a new object, but theoretically its working directly on the prototype object. Maybe i'm wrong on this, but it looks suspicious to me. IMO this change would be far more complex that it seems because, for example, the following no longer applies: if( typeof f == function ) { ... } Why would you want to do this, anyway? When a function takes multiple argument types you have to check what those types are. That gets more complicated with two distinctly different ways of having functions. Once it gets past the initial call to click() or whatever, it is a function all the way down. If you define a new Function, the resulting object is typeof 'function'. ~ SpiderApe -e x=new Function('1');print(typeof x); function You're right - i wasn't aware of that. There would be no visible effect anywhere else in plugins, etc. i said earlier (in two posts) that the call syntax is different, but that is apparently incorrect: ~ SpiderApe -e x=new Function('print(1);');x(); 1 JS apparently offers special-case handling of this type. The cascade of side-effects is enormous. I don't see any side-effect at all, but I may of course be wrong ;) My apologies - i grossly overstated the side-effects (/me smacks forehead). But the scoping issue is still critical, as event handlers often need access to variables from their contained scope, and that apparently can't be done with Function objects.
[jQuery] Re: problem with selector in IE
On Aug 17, 7:36 pm, Potluri [EMAIL PROTECTED] wrote: table id=srTable tbody tra1 /tr tra2 /tr tra3 /tr tra4 /tr /tbody /table This isn't legal HTML. TR elements can only contain TD elements, not text. Try replacing each row with: trtda1/td/tr
[jQuery] Re: flicker on tooltips fix ?
alexfoxy wrote: The problem occurs when you hover over both tooltip and icon underneath, it begins to flicker. I know why this happens, but I don't know how to solve it. If you mean the quickly toggling on and off when your mouse is near the right side of the item, this happens because the so-called hotspot of the mouse physically changes when the mouse pointer switches between pointer mode and another mode. When this happens, the hotspot is over your item when the mouse is in pointer mode, but then the hotspot moves out of the item when it switches to its different mode. This is an unfortunate detail that we cannot fix at the JS-level (it's more a problem with the window manager or desktop environment, IMO, since it doesn't take care to keep the hotspot consistent). BTW, the hotspot is the part of the mouse pointer which is actually used for coordinate determination. When you have a pointer-style mouse pointer the hotspot is obvious - the tip of the pointer. When you have a hand-shaped or cursor-shaped pointer the hotspot is not so obvious. For a great example of this problem, visit: http://wanderinghorse.net/computing/javascript/jquery/spoilers/demo.html and put your mouse near the far right edge of the first Spoilers entry. When positioned properly you can see the mouse pointer switching modes. When it does the, the hotspot moves, which has the unfortunate side-effect of performing a mouse-out event because the hotspot is no longer in the widget. So... the fix is to keep your mouse pointer somewhere away from the far right edge of the tooltipped item.
[jQuery] Re: How to show Updating container
On Aug 17, 6:36 pm, Potluri [EMAIL PROTECTED] wrote: function() { $(#rs_loading).show(); someFuncTORefine(); $(#rs_loading).hide(); } ... I dont know where it's breaking it rs_loading container is shown after the someFuncTORefine() is executed. So it appears once the refinement function is done but not exactly when the click is made. I spent lot of time on this figuring out whats going wrong. Can Any one help me out plz... If i'm not mistaken this happens because your browser is not guaranteed to update any UI elements while a script is actually running. Most (all?) browsers will freeze the UI while a script is running and avoid making updates to it (there are several technical reasons for this). Once your script stops running, THEN the UI is given a chance to refresh.
[jQuery] Re: Avoiding anonymous functions - enhancement suggestion
On Aug 17, 8:54 pm, Joan Piedra [EMAIL PROTECTED] wrote: On 8/17/07, John Resig [EMAIL PROTECTED] wrote: $(...).onclick().toggle().end(); The same would happen to John's code, this would mess me up. Just my opinion tho. i agree with Joan here. The semantics on the above would SEEM to be: $(selector) = get the list onclick() = apply onclick() to each member of the list toggle() = toggle each member of the list but in fact they would be something entirely different. i very much like the use of anonymous functions. The above approach would, it seems, end up requiring us to write extra little wrapper functions (probably all of them as plugins, increasing the chance of a name collision) when we could have used a anonymous functions.
[jQuery] Re: JSON String problem
On Aug 16, 3:27 pm, Erik Beeson [EMAIL PROTECTED] wrote: Yep, that's a feature of JavaScript. No quotes means it's a number, not a string, and numbers that start with 0 are assumed to be octal (base 8). Even parseInt(063) will give you 51, since again, it assumes you mean octal. I suggest you either strip of the leading zero on the server side, and allow it to transmit as a number (no quotes), or wrap it in quotes and pull it out with parseInt(063, 10) to force it to do base 10. The OP may run into additional problems if he has numbers like 099, which is syntactically octal but not a legal octal value. Terry wrote: I would rather not have to re-write my sql to force in it but want JSON to recognize this as a string value and numeric. You can have one or the other. JSON is only a simple data format and doesn't have any brains attached to it at all, so i can't know this is both a number and a string. The parseInt(...,10) which Erik mentioned is probably your best/safest bet, especially if you have numbers which aren't legal octal values (see above).
[jQuery] stupid dev tricks: marking current page links
Hi, all! We've all attempted several different ways of highlighting navigation links which point to the current page. Often times we mark the page via our PHP by adding a class (e.g. currentPage) to the navigation link which points to the current page, or some such. Here's a slightly different approach... Today i bought Eric Meyer's CSS book from O'Reilly book (unfortunately, they only had the German edition :( ) and reading the section on selectors gave me an idea which i haven't yet seen used in web design, but which probably does exist out there somewhere: use CSS to select the current page based off of window.location. AFAIK, only MSIE has the ability to run javascript from inside the CSS, but a small bit of jQuery can accomplish the same thing fairly portably... jQuery(function(){ var loc = ''+window.location; // Be SURE to force a copy, otherwise we modify .location next... loc = loc.replace( /https?:\/\/[^\/]+/, '' ); // You may want/need to do this: // loc = loc.replace( /index.php$/, '' ); // loc = loc.replace( /index.html$/, '' ); var sel = '[EMAIL PROTECTED]'+loc+']'; // alert( sel+\n+$(sel)[0].href ); // see below for info $(sel).css('background-color','#004040') .css('color','#fff') .css('font-style', 'italic') .css('text-decoration', 'none'); }); Obviously, you may want to expand the selector to only highly this link inside your navigation menu, and you might even want to disable the link (set the href to null should do the trick) or replace the A element with a plain SPAN to make in non-clickable. There is a bit of trickery to keep in mind here because of how the href attribute works. If you use $(a...)[0].href you will get a fully-qualified href, but using $([EMAIL PROTECTED]'/unqualified/name']) is needed to select the link - using a fully-qualified href in the selector will fail unless your links actually are actually fully qualified (which they normally aren't). You can see this behaviour by uncommenting the alert() shown above. This approach might also have an odd side effect due to the stripping of the domain name from window.location: you might end up marking external links as the current page, which would obviously be incorrect. How to generically solve that is left as an exercise for the reader (and if you do it, please post here so i won't have to solve the problem myself ;). Happy hacking!
[jQuery] Re: What does Unobtrusive Javascript mean?
On Aug 16, 4:13 pm, Pops [EMAIL PROTECTED] wrote: Ive seen this term referred to a few times, especially here: http://simonwillison.net/2007/Aug/15/jquery/ What does Unobtrusive Javascript mean? Hi, Pops! google: what does unobtrusive javascript mean? http://onlinetools.org/articles/unobtrusivejavascript/chapter1.html Says: The first rule of the unobtrusive Javascript club is don't talk about the unobtrusive Javascript club. No, hang on, it is... :)
[jQuery] Re: JSON String problem
On Aug 16, 3:42 pm, Terry B [EMAIL PROTECTED] wrote: query level but that is too cumbersome. I can't believe JSon does not have any options or settings that force all values to strings. Anyone played with this at all? JSON is a no-logic data interchange format, not a language, so it neither options nor a way to apply them. While it superficially appears to be JavaScript, conventions-compliant JSON does not have access to the full features of JS (e.g. the ability to use a function as a value). The reason for this is to allow JSON to be used in non-JS environments (there are parsers implemented in several different programming languages). There are no directives which suggest to a JSON parser, please do [this] or [that]..., in the same way that a plain text file doesn't have a way to tell a text editor interpret characters with the value 0x20 as a vertical bar instead of a space. In fact you might be able to generate JSON which looks like this: { ... val:parseInt('064',10) ... }; and it might work with jQuery's getJSON() (haven't tried it, but i assume they just eval() the JSON code), but it won't work with JSON parsers which don't eval() to JSON tree.
[jQuery] Re: stupid dev tricks: marking current page links
On Aug 16, 5:13 pm, Karl Swedberg [EMAIL PROTECTED] wrote: One way to avoid marking external links as the current page would be to begin with an if statement: if (location.hostname == 'www.mysite.com') { The main problem with that is you've normally got to add several domains: your test server(s) (i uses aliases for localhost along with apache named vhosts), mysite.com, and www.mysite.com. It's easy to forget to add one of them. you might be able to avoid the next line by using this: var loc = location.pathname; That's a good trick - i wasn't aware of 'location'. So the modified code looks like: var loc = location.pathname; var sel = '[EMAIL PROTECTED]'+loc+']'; $(sel).css('background-color','#004040') .css('color','#fff') .css('font-style', 'italic') .css('text-decoration', 'none'); Or, if you're a space-saving fanatic: $('[EMAIL PROTECTED]'+location.pathname+']').css(...); That can ALMOST be done in plain CSS, without the JS scaffolding. :)
[jQuery] Re: stupid dev tricks: marking current page links
On Aug 16, 6:28 pm, Bernd Matzner [EMAIL PROTECTED] wrote: how about plain and stupid checking if the current url is in the link? ... i hadn't considered making sure it works when people link from external sites. :/ $('a').each(function(){ if( window.location.href.indexOf( $(this).attr('href') ) = 0 The main disadvantage (admittedly small) is that this will run the function for every link on a page, whereas the href=... selector is faster. The idea behind it is that if you have some scenario like users coming from Google ads, with extra GET variables in the URL, it should still work, except in scenarios where you have dynamic pages using get variables: in this case the current link is only highlighted if it's identical with the current page. The extra length clause is to leave '#' or '/' links out. That's why Karl's solution is so slick: the location.pathname var doesn't include GET params and such. The one special case i can see is that '/some/path/' actually resolves to /some/path/index.php (or similar). On my sites i never link to the index file directly (only to the dir, with trailing slash), but if a site has multiple maintainers it would be easy to get a mixture of links which contain (or don't) the index.php/html/asp file.
[jQuery] Re: stupid dev tricks: marking current page links
On Aug 16, 7:04 pm, Bernd Matzner [EMAIL PROTECTED] wrote: a href=index.htmlA/a | a href=/index.htmlB/a | a href=http://localhost/index.html;C/a | a href=index.html? sdsdg=sdgD/a Doh, of course i hadn't considered that the navigation links themselves having GET options (i was thinking about people passing in args from external links). You're right - i think a solution like yours is the only real way of handling that case. None of my sites use GET parameters in their navigation links, so i'm going to punt on that problem. But your approach is the most generic solution, it would seem. As for the each() function - I'm sure the if clause could be made into a regex, which, unfortunately, is not my forté - that's why I wrote plain and stupid ;-) Regexes are definitely worth learning. Once you know them, you can use them in many different programming languages (and even non-programming tools) and you'll be SO happy that you know how to use them. They are without a doubt one of the pieces of knowledge with the highest return on invested time of anything i've every learned. Hardly a day goes by that i don't use them for some programming task or other. :)
[jQuery] Re: jQuery negatives: dual/triple/quadruple special-case uses for both function calls and method names
On Aug 16, 7:39 pm, Mitch [EMAIL PROTECTED] wrote: quote jQuery is definitely a popular utility function library, but the sheer amount of dual/triple/quadruple special-case uses for both function calls and method names is an instant turnoff for me. This also turns me off to some degree. The main problem i have is that jQuery(...) can take so many different argument types. In fact, jQuery(function(){...}) as a shortcut for $(document).ready(function() {...}) bugs me the most. immediate sense, like .one or .eq, and you can't immediately tell if a method acts on the first element in the collection or all of them. i agree that gt(), lt(), eq(), get(), etc, could/should have been more verbosely named. Shortcuts like lt, gt, etc. may be familiar to people who use the Unix shell (test 4 -lt 3), but they're simply opaque to anyone else. I can't recommend jQuery to the developers I am mentoring because it is in itself a completely separate abstraction An interesting point - don't recommend jQ IF the point of your work is teaching JavaScript. , and a muddy one at that. Probably over-stated. They will end up having to learn jQuery instead of having to learn DOM, CSS and JS, and when being considered as a direct replacement for those it fails both due to complexity and inconsistency. Again, over-stated. Summary: The author has apparently let a couple of relatively minor details get on his nerves, to the point that he can no longer reconcile his feelings. i can relate to this - i hate/despise/refuse to use Python because whitespace is significant in that language (and whitespace should rarely, if ever, be significant), and its completely naive approach to implementing package-private data. Technosophically speaking, i simply cannot excuse those failings of the language, and refuse to learn it on those grouds. Simon Willison apparently has a similar hang-up about jQuery. And, like i am in my hate-hate relationship with Python, he's in the minority.
[jQuery] Re: stupid dev tricks: marking current page links
On Aug 16, 8:59 pm, Karl Swedberg [EMAIL PROTECTED] wrote: Most sites I've seen with these GET vars attached have something URLs like this: index.html?category=2amp;product=210 So if I'm on that page, the one for product 210 within category 2, I don't want to have a link to index.html highlighted. But I think your solution will highlight it. The answer to that is almost certainly it depends on the site. I think I'll play around with this some more tonight. This is fun. :) :D If you come up with a generic approach, which addresses Bernd's points and your above point, i'd love to see it. Maybe a plugin with options for ignoring/respecting GET parameters? By the way, Stephan, if you're modifying all those css properties, you might want to put them in your stylesheet instead as .foo {color: #040400; /* etc. */ } and then do .addClass('foo'). For quick hacks/tinkering i prefer the .css() approach, but i didn't know about: Or at least use the map version of .css(), like this: .css({ 'background-color': '#004040', 'color': '#fff', ... That's much more convenient. :)
[jQuery] Re: stupid dev tricks: marking current page links
On Aug 16, 9:03 pm, Stephan Beal [EMAIL PROTECTED] wrote: and your above point, i'd love to see it. Maybe a plugin with options for ignoring/respecting GET parameters? And while you're writing that plugin (hint, hint ;), another point to address is the common practice of linking some element of the site header back to the home page. e.g. clicking the site logo takes you to '/'. You don't want that link marked like this. That's really where the benefit of restricting your selector to your navigation menu comes in, i think.
[jQuery] Re: Tabs not working
On Aug 15, 1:12 pm, Klaus Hartl [EMAIL PROTECTED] wrote: I really can't see any reason why it shouldn't work... It seems that the problem has something to do with this: Before clicking a tab: div id=one class=tabs-container tabs-hideTEST/div div id=two class=tabs-containerTEST/div After clicking a tab: div id=one class=tabs-container tabs-hideTEST/div div id=two class=tabs-container tabs-hide style=TEST/div Note that both tabs now have the tabs-hide style.
[jQuery] Re: stupid dev tricks: gzipping jQuery without mod_deflate
On Aug 15, 2:33 pm, Brandon Aaron [EMAIL PROTECTED] wrote: Thanks for sharing this. Use the minified version instead of the packed version for even better file size savings. :) i experimented on that. i expected the new YUI minifier to give better compression (as it does on all of my plugins), but it only compresses jQ to 30k. i got the best jQ compression using a PHP port of the Edwards Packer: http://wanderinghorse.net/computing/javascript/#packers In any case, the different pack/min techniques will give different results on different inputs. On very small JS files MIN is normally better because of the PACK overhead (just under 200 bytes, i think). On large files, PACK tends to beat out MIN, but this isn't always so. YUI minifier is damned good, at least on my code, but it seems to not be the best packer for jQ. Anyway... the point is simply to experiment and find the best one for your purposes. A couple K either way probably isn't going to kill anyone.
[jQuery] Re: stupid dev tricks: gzipping jQuery without mod_deflate
On Aug 15, 3:33 pm, xavier [EMAIL PROTECTED] wrote: This means that : 1) you assume all clients are able to deal with compressed pages No - PHP does that negotiation automatically (supposedly) and ignores the gzip if it thinks the client can't handle it. 2) your server is going to compress it for each visitor. Why wouldn't they? 3) the headers might or might not be properly dealing with its type. i don't understand what you mean by this. The HTTP response header from the PHP script? With mod_rewrite, they are nice tricks to have a compressed file and serve it instead of the normal file if needed. Have you tried compressing the js file and send it instead of the file without using mod_compress/mod_rewrite ? i haven't tried that because i wouldn't expect sub-optimal browsers to be able to grok it (by that i mean MSIE/Safari/Opera). Since i don't have those browsers to test, i don't want to try anything too tricky which might break those browsers. @Joel/Brandon: after more experimentation, i am getting better compression if i use the YUImin and ob_gzhandler. The difference is minimal compared to jsmin, but there is a difference. e.g. jquery 1.1.3.1: YUImin + gzip: 10896 bytes jsmin + gzip: 11505 packer + gzip: 11486
[jQuery] Some snippets for newbies, Part 1 of N
Hi, all! i'm working on rewriting the web site for my mother's business and i'm finally getting to integrate some jQuery in a production site. Unfortunately, i don't have a link to show anything (it's on an internal test server), but i wanted to share some of the tidbits with the n00bs in the crowd, to show them just how damned simple it can be to create impressive (or just convenient) effects with jQuery... Part 1a, tagging anchors with an image. My mother's site hosts lots of PDF files (house plans - she owns a house-building company). Rather than label each of the links with something like PDF format, it was a tiny, tiny job to add a small PDF icon next to each and every link in the site: jQuery(function(){ $('[EMAIL PROTECTED]') .append(img src='/img/pdf.png' height='16' width='16' class='no_decoration'/); }); Where 'no_decoration' is to differentiate these images from the (many) other images which have a stylized border: img.no_decoration { border: none; } When it comes to doing more with less, GNU Make is one of the few other tools which i consider to be as expressive as jQuery. Part 1b: i wanted to tinker with a slide-show like feature. After playing with the Cycle plugin, i found that it wouldn't do the job for me because i'm working with images of many different sizes (Cycle appears to only work well when all images are the same size). So i threw together a most-minimalistic fadeIn/fadeOut slideshow mini-plugin and thought it might be informative to the n00bs... jQuery.fn.imageFader = function( options ) { options = jQuery.extend({ fadeOutSpeed:750, fadeInSpeed:500, delay:4500 },options); var imgs = jQuery('img',this); imgs.gt(0).hide(); var pos = 0; var current = 0; function cycle() { function doIn(to) { imgs.eq(to).fadeIn( options.fadeInSpeed ); } function doOut(from,to) { imgs.eq(from).fadeOut( options.fadeOutSpeed, function() {doIn(to)} ); } pos = (pos = (imgs.length-1)) ? 0 : ++pos; doOut( current, pos ); current = pos; }; setInterval( cycle, options.delay ); return this; }; Just populate a DIV with some images: div id='MyImages'img .../img .../img ...//div And: $('#MyImages').imageFader(); Viola! Again, few tools let you accomplish so much with so little code. Plus this plugin degrades reasonably well in the absence of javascript - instead of a slideshow you get all of your images plopped down side-by- side. (Reminder: don't use that plugin for real-life sites - use one of the several excellent plugins already available for the job. This is for demonstration purposes only.) The end i've only been using jQuery about 5 weeks now, and already it's at the top of my all-time list of favourite tools, right alongside emacs, firefox, GNU Make and sqlite. Happy hacking!
[jQuery] Re: stupid dev tricks: gzipping jQuery without mod_deflate
On Aug 15, 11:02 pm, Ganeshji Marwaha [EMAIL PROTECTED] wrote: Very cool... I will start using this technique right away... But my only concern is, since this technique compresses the file everytime it is requested, isn't it an overkill on the server's CPU? Getting this level of transparency is worth the small computational cost, IMO. It is essentially the same as Apache using mod_deflate (Apache 2.x) or mod_gzip (Apache 1.x). The default compression level for the gzip algorithm performs REALLY quickly.
[jQuery] Re: stupid dev tricks: gzipping jQuery without mod_deflate
On Aug 15, 11:32 pm, Erik Beeson [EMAIL PROTECTED] wrote: I cache the packed versions. Actually, I concatenate all of the scripts that I need for a page, minify them (used to use packer, now I use YUImin), and then cache that, all on the fly. So I have one script tag like: The problem with caching is that it fails on some hosting providers. For example, if i did this on the SourceForge servers, the cached file would be owned by some web user other than me, which means my account cannot remove the file. Writing files from a web server is often problematic vis-a-vis file access rights, especially when your account is not the one which apache runs as. It is possible to tell apache, with the right module(s?), to run each virtual host as a different user, but it's not always possible to set this up (e.g. SourceForge sites).
[jQuery] Re: stupid dev tricks: gzipping jQuery without mod_deflate
On Aug 15, 11:08 am, Stephan Beal [EMAIL PROTECTED] wrote: ... This approach could just as easily be used to combine all required JS scripts on the fly (just be sure to insert a ';' after each one to accommodate scripts which don't have them), then gzip them, to help reduce the overall download overhead. A small follow-up: After doing some reading, it turns out that PHP has a more efficient manner of reading text files (which uses mem-mapping to avoid extra string copying), called file_get_contents(). So here's a slightly expanded version which uses that function (using fopen() and friends would probably be optimal, though) and takes an array of JS files, effectively concatenating the results into one script: ?php ob_start( 'ob_gzhandler' ); // optional: header( Expires: Fri, 27 Aug 2010 12:12:12 GMT ); foreach( array( 'jquery-1.1.3.1.yuimin.js', 'jquery.cycle.all.yuimin.js' ) as $fn ) { echo file_get_contents($fn); echo ;\n; // accommodate scripts which are missing a trailing semicolon } ob_end_flush(); ? Happy hacking!
[jQuery] Re: caption supported?
On Aug 16, 4:20 am, Stephan Beal [EMAIL PROTECTED] wrote: My guess is that when you create your table the TBODY is automatically getting added to it (someone posted complaining about that behaviour a few days ago), which means that your append(caption) will fail and your append(tbody) is actually NOT working because the tbody is already in the table when that is reached. But that's a guess. Try inspecting the dom after you create the table, before you append the caption/tbody. PS: if that's the problem, try adding your caption using prepend() instead of append(). That may work around the problem of the automatically generated tbody.
[jQuery] Re: caption supported?
On Aug 16, 3:56 am, Benjamin Sterling [EMAIL PROTECTED] wrote: Hey, I am trying to build a table dynamically, but jQuery keep erroring out on $('table').append('caption'); Is caption supported? $('table').append('tbody'); works fine. it's not jQuery which is ignoring your request. jQuery indirectly uses the browser's internal facilities for creating DOM trees, which means that the browser's engine is the one denying you. According to this site: http://www.w3schools.com/tags/tag_caption.asp the caption must be the first tag after TABLE, before TBODY (if any). But after some experimentation via their try it link, i couldn't get it to fail either way, but maybe konqueror is especially tollerant (i.e., not compliant) here. My guess is that when you create your table the TBODY is automatically getting added to it (someone posted complaining about that behaviour a few days ago), which means that your append(caption) will fail and your append(tbody) is actually NOT working because the tbody is already in the table when that is reached. But that's a guess. Try inspecting the dom after you create the table, before you append the caption/tbody.
[jQuery] Re: new Plugin every: jQuery-oriented setTimeout and setInterval
On Aug 14, 3:34 pm, Blair Mitchelmore [EMAIL PROTECTED] wrote: (Though I think the next step in improving how plugins interoperate is allowing multiple plugins to operate under the same name by having the plugin provide some sort of argument test to determine if the provided arguments are valid and then using that plugin on a case by case basis) i think namespaces would be a better idea, e.g.: $(...).blair.start(...); $(...).blair.stop(...) i don't know if that type of thing is possible using the current jQ code. That sounds like a good question for the list.
[jQuery] Re: using getJSON() with IE vs FF
On Aug 14, 12:41 pm, Pops [EMAIL PROTECTED] wrote: JSON: div id=JsonDump/div script type='text/javascript' $(document).ready(function() { var url = /code/jSystemMonitor.wcx; var secs = 5000; $(#JsonDump).ajaxComplete(function(request, settings){ $(this).append(li+settings.responseText+/li); }); var res = $.getJSON(url); setInterval( function() { var res = $.getJSON(url); }, secs); }); An unrelated problem: you are adding LI elements directly to a DIV. According to an earlier post on this list, LI elements are illegal outside of a UL or OL element. You may want to change: JSON: div id=JsonDump/div to: JSON: ul id=JsonDump/ul
[jQuery] Re: is this possible in jQ: plugin namespaces?
On Aug 14, 4:05 pm, Benjamin Sterling [EMAIL PROTECTED] wrote: Stephan, I believe it is possible, M. Alsup does just that in is cycle plugin:http://malsup.com/jquery/cycle/jquery.cycle.all.js?v1.4 That *almost* does what i'm looking for, but not quite. In that case, a single plugin uses child objects to hold the transitions. That is, in effect, a namespace in and of itself. But what i'm looking for is: $(...).malsup.cycle(...); Such that all of Malsup's plugins could be placed under the 'malsup' namespace. My initial attempts to do this in jQ have failed so far, e.g.: if( ! 'myns' in jQuery.fn ) { jQuery.fn.myns = {}; } jQuery.fn.myns.myPlugin = function(...){...}; $(...).myns.myPlugin(...);
[jQuery] Re: New Yahoo Minifier - YUI Compressor
On Aug 14, 7:02 pm, Dan G. Switzer, II [EMAIL PROTECTED] wrote: The idea behind compression tools that use Rhino is they actually have the ability to parse the JS and really understand how the variables work--which allows for things such as more accurate variable replacement. While YUImin uses Rhino, it may be interesting to note that the .jar file has Rhino built in, so you don't need to set your CLASSPATH or write a wrapper script to launch it. This makes it an ideal candidate for inclusion in the jQuery tree, IMO. i just finished updating all of my plugin pages to include YUImin'd copies and they are, without exception, smaller than the MIN'd and PACK'd versions. e.g. http://wanderinghorse.net/computing/javascript/jquery/colorpicker/ This has just become my packer of choice.
[jQuery] Re: New Yahoo Minifier - YUI Compressor
On Aug 14, 7:37 pm, Tane Piper [EMAIL PROTECTED] wrote: Absolutly, that worried me at first about rhino, but It's great to see its already included. If anyone can work out how to included this in eclipse as a runnable program to compress the code, please share it - I tried myself, but I'm not familiar with its environment variables Not for Eclipse, but here are my GNU Make rules to PACK/MIN/YUIMin my plugins: #!/do/not/make # Common rules for JavaScript dirs. whnet.makefile.js := $(word $(words $(MAKEFILE_LIST)),$ (MAKEFILE_LIST)) $(whnet.makefile.js): whnet.jspack.php := $(toc2.top_srcdir)/computing/javascript/packer.php whnet.exec.jspack := $(whnet.bins.php) $(whnet.jspack.php) whnet.exec.jsmin := $(toc2.top_srcdir)/computing/javascript/jsmin $(whnet.exec.jsmin): $(whnet.exec.jsmin).c @gcc -o $@ $(whnet.exec.jsmin).c $(if $(whnet.bins.java),,$(eval error java binary not found in PATH)) whnet.exec.jsyuimin := $(whnet.bins.java) -jar $(toc2.top_srcdir)/ computing/javascript/yuicompressor-1.0.jar $(whnet.exec.jsyuimin): # $(whnet.rules.js.eval.jspack) # Usage: $(eval $(call whnet.rules.js.eval.jspack,SOURCE_FILE)) # Strips the .js extension from SOURCE_FILE and creates rules for generating # SOURCE_FILE.pack.js and SOURCE_FILE.min.js define whnet.rules.js.eval.jspack ## PACK rules: $(1): $(toc2.files.makefile) $(whnet.makefile.js) $(1).pack.js := $$(patsubst %.js,%.pack.js,$(1)) $$($(1).pack.js): $(1) @echo -n PACKing $(1): ; $$(whnet.exec.jspack) $(1) $$@ @stat --printf %s == $(1); stat --printf %s\n $$@ jspack: $$($(1).pack.js) package.clean_files += $$($(1).pack.js) ## MIN rules: $(1).min.js := $$(patsubst %.js,%.min.js,$(1)) $$($(1).min.js): $(1) $(whnet.exec.jsmin) @echo -n MINing $(1): ; $$(whnet.exec.jsmin) $(1) $$@ @stat --printf %s == $(1); stat --printf %s\n $$@ jspack: $$($(1).min.js) package.clean_files += $$($(1).min.js) ## YUIMIN rules: $(1).yuimin.js := $$(patsubst %.js,%.yuimin.js,$(1)) $$($(1).yuimin.js): $(1) $(whnet.exec.jsyuimin) @echo -n YUI-MINing $(1): ; $$(whnet.exec.jsyuimin) -o $$@ $(1) / dev/null @stat --printf %s == $(1); stat --printf %s\n $$@ jspack: $$($(1).yuimin.js) package.clean_files += $$($(1).yuimin.js) endef whnet.rules.js.call.jspack = $(eval $(call whnet.rules.js.eval.jspack, $(1)))
[jQuery] Re: input type=button / : which event is that?
On Aug 14, 10:30 pm, lukek [EMAIL PROTECTED] wrote: Is there an specific event raised when a button (input type=button) is selected? Or am I being a bit stupid? To capture this I am having to use: $(#myButton) Try: $(...).click( function(){...} ); :) if (event.keCode == 13) { ^^ and there's a typo here.
[jQuery] Re: focus with DIVs
On Aug 15, 12:46 am, Mitchell Waite [EMAIL PROTECTED] wrote: Is there a way to use focus with a div rather than just an input element? Focus, by definition, applies only to elements which can accept input. Focus is in fact short for input focus. If there is not how would you handle it so when a container gains or losses focus some visual effect occurs (like its background becomes gray). Since focus can only happen on input elements, any such feature would require significant kludges. According to selfhtml.de, the following elements can accept onfocus: JavaScript allows: body frame input layer select textarea HTML 4.0 allows: a area button input label select textarea Source: http://de.selfhtml.org/javascript/sprache/eventhandler.htm#onfocus
[jQuery] Re: Looping through data object
On Aug 12, 6:49 pm, Eridius [EMAIL PROTECTED] wrote: options = { var1: 'one', var2: 'two' } is there a wayt too loop throught this object like i can does with .each? for( var key in obj ) { var val = obj[key]; ... } :D
[jQuery] Re: scollovers animation
On Aug 11, 6:21 am, Blair Mitchelmore [EMAIL PROTECTED] wrote: Here's my (40 line) proof of concept. It's not as foolproof as the ... algorithm so its glitchy when the font gets really big or really small). Source code:http://jquery.offput.ca/js/jquery.scrollover.js Simple (even for my standards) demo:http://jquery.offput.ca/scrollover/ Nice, Blair :). You're right, though - the effect is pretty annoying. Someone posted a good use for it, though - showing answers to questions when you hover over the question.
[jQuery] Re: ie playing up!
On Aug 11, 3:34 pm, phill [EMAIL PROTECTED] wrote: a sample is available here:www.chantrybeeproducts.co.nr/jqueryani/ i am having a few problems, i was wondering if some one could help, in ie whe the main body of the content, it flashes up before it is shown and after it has been hidden? what is casuing this is their a way arround it? i unfortunately can't answer your question, but i can offer this advice from a usability perspective: don't do it. The lag involved in the animation is incredibly annoying. When a user navigates a site they expect it to respond quickly. Here we have not only the page load delay, but also the animation delay (which is longer than the load delay). When i click your Home button i've got to wait up to 6 seconds (on a 16MBit line). A quick profile with Firebox shows me that only about 1 second of that time is spend loading the page and its related graphics, so the other 5 seconds are wasted on the eye candy. What you've done is an interesting idea, but the lag is just too annoying. Another recommendation is to use the PACK'd jquery.js, instead of the uncompressed one. As it is now, jquery.js accounts for most of your page's size (80%+) because you're using the unpacked version. :D
[jQuery] Re: Please fix TreeView bassistance - Please DEV to not stable plugins
On Aug 10, 3:31 am, Mario Moura [EMAIL PROTECTED] wrote: Please John Resig ask to plugin providers make plugins to work with all browsers (or FF and IE at least) if no please post JQuery.NamePlugin(DEV).js or something like this. DEV to Not Stable. Hi, Mario! Some comments: a) Whether or not a plugin works in Firefox or MSIE or Opera has NOTHING to do with whether it is in development or not. That may simply be a design decision. Please don't assume that just because something does not work in MSIE, that this is a bug. b) John Resig has NO authority over the release (or release state) of plugins (except perhaps the plugins released via the official SVN tree). If he were to become a dictator and say, nobody is allowed to release plugins unless they work on all browsers, several developers would probably walk out on him. c) Not all developers have access to all browsers, so they cannot test for every possible environment. For example, i don't possess a copy of Windows nor do i own a Mac, so i can't test a thing on MSIE or Safari. d) The web is a very volatile/hostile environment, and there will rarely be solutions which work on ALL versions of ALL browsers. That is simply something you'll have to come to terms with if you're going to do web development. Happy hacking!
[jQuery] scollovers animation
Hiya! i just found this via digg: http://www.scrollovers.com/ and i thought that might be a tempting animation effect for one of the more talented plugin authors out there. The implementation code is 175 lines long, but i'd bet that one of you jQuery gurus can get it down to 20 or less. :)
[jQuery] Re: scollovers animation
On Aug 9, 7:05 pm, Karl Swedberg [EMAIL PROTECTED] wrote: Stephan, I thought you were the KING of plugins! :-) Nonono, you misunderstand ... i produce a lot of plugins (7 so far, and i've been using jQuery only a month or two), but they're all crap compared to most of the existing plugins. ;) Why not have a go at it? i don't know enough about animation using CSS/JS to be able to implement it nicely, and i know there are other plugin authors out there (yourself included) who could code that in 20 minutes or less. :)
[jQuery] Slightly OT: overview of HTML5 elements
i thought this might interest some of you: http://www.ibm.com/developerworks/library/x-html5/?ca=dgr-lnxw01NewHTML --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups jQuery (English) group. To post to this group, send email to jquery-en@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jquery-en?hl=en -~--~~~~--~~--~--~---
[jQuery] Re: An open letter to non-Believers...
On 8/8/07, Yehuda Katz [EMAIL PROTECTED] wrote: Hey, Send it to [EMAIL PROTECTED] :-D Hi, Yehuda! i did, a day or two after i originally posted it, but got no response. :( -- - stephan beal http://wanderinghorse.net/home/stephan/
[jQuery] Re: An open letter to non-Believers...
- to make best use of any dynamic pages you must eventually get around to learning CSS to some degree or another. And while you must understand what a DOM is, in the abstract, you don't need to know much about the specifics when using jQuery, and you certainly (and suprisingly) don't need to use the standardized DOM API. However, knowing the standard API helps one understand what jQuery is doing, which is always good. In short, I think, lots and lots of side by side example. The idea, show the DOM/CSS way and the JQUERY way. Also for me, the language syntax is completely new to me. Amen on both points. It takes some time for a curious newbie to set up a few working examples, and this is a definite barrier to entry. Again, just a few days into it, it may want to devote some doc pages to this syntax. I am completely amaze that its every possible! I had to study the JQUERY.JS (actually JTIP.JS) code to learn how these function() as parameters work - very complex stuff IMO for most people. Unfortunately, JavaScript has been an underdog for a long time, and part of the reason is because people don't generally know about its support for anonymous functions and closures, both of which are powerful features. i only learned about its support for closures when i started work on SpiderApe. That completely changed the way i work with JS. Amen, brothers and sisters. So are we back to the old APL saying: Definitely. Every Great New Approach has its fanatics. Hell, even Apple has more than its fair share of fanatics (though i'm quite certain that i'll never understand why). If the JQUERY programmer can not program the WORLD in one line of code, he won't prrogram at all? : i think 3 lines of code is the accepted convention ;). Maybe the poor bastards are using something else that is more code documentation friendly? and are saying the JQUERY people, like the old APL programmer, are sadistic? g i wouldn't say sadistic, but the word extreme does come to mind. Thanks for your long and insightful reply, Pops! -- - stephan beal http://wanderinghorse.net/home/stephan/
[jQuery] Announcement: Spoilers plugin
Hi, all! Yet another plugin: http://jquery.com/plugins/project/Spoilers Demo: http://wanderinghorse.net/computing/javascript/jquery/spoilers/demo.html It is used to hide spoiler text from casual readers, who can reveal the text by mousing over it. See the web site for an example of how this can be useful. The code is based upon this jQuery forum thread: http://groups.google.com/group/jquery-en/browse_thread/thread/9d34cad45e541e36/8f02c8f79b5c7985 Many thanks to Michael Geary and Jay Salvat for doing the detective work in figuring out how this feature works on the imdb.com site. The code is trivial (a couple of lines) and it should work in any jQ- supported browser, though it is untested aside from Firefox 2.x, Konqueror 3.5.x, and Galeon 2.0.x. :)
[jQuery] Re: Announcement: Spoilers plugin
On Aug 8, 6:17 pm, Sam Collett [EMAIL PROTECTED] wrote: You like developing plugins don't you? ;) :D jQuery makes it too easy to do. This particular plugin has a trivial implementation: jQuery.fn.initSpoilers = function( props ) { props = jQuery.extend({ revealedClass:'reveal' }, props ? props : {}); this.hover( function() { $ (this).addClass( props.revealedClass ); }, function() { $ (this).removeClass( props.revealedClass ); } ); return this; }; Most of the real work happens via CSS. How about an option to show the spoilers when you click on a link 'show spoilers'. I've seen a few forums (can't think of the exact URL's off the top of my head though) that have this. e.g. $ ('.jqSpoiler').initSpoilers(click) or $ ('.jqSpoiler').initSpoilers(hover) i was thinking not only of that, but also of how best to integrate optional hoverIntent support (since hoverIntent is quite popular). i'm trying to consolidate the discrepancies between click and hover, so that the option can be integrated in a unified way (i hate special- case code). For the click, i was thinking: clicking on the overlay will unhide the text, and mouse-out will hide it again, but that might be tedious/ annoying in practice (haven't tried it yet). Your thoughts? Should a second click be required to re-hide the text? i think re-hiding may not be necessary: if a click is used to un-hide then the user obviously wants to reveal the text, and re-hiding it is probably not desired.
[jQuery] Re: Announcement: Spoilers plugin
On Aug 8, 6:28 pm, Stephan Beal [EMAIL PROTECTED] wrote: For the click, i was thinking: clicking on the overlay will unhide the text, and mouse-out will hide it again, but that might be tedious/ @Sam Dan: i've added click-toggle and hoverIntent support via an optional init parameter: $('.jqSpoiler').initSpoilers({method:'click'}); $('.jqSpoiler').initSpoilers({method:'hoverIntent'}); // requires hoverIntent plugin The default is method:'hover'. This doubled the MIN'd size of the code, though. It's now a whopping 424 bytes ;). These features will be included in tomorrow's release. (i use the date as the version number, and i've already made a release today, so i've gotta wait another 5 hours [CET/GMT+1] before i can make a new release ;). You can have multiple types of spoiler revealing on one page by simply using a marker class, like this: // On-hover spoiler: $('.jqSpoiler').initSpoilers(); // On-hover spoiler using hoverIntent plugin: $('.jqSpoilerIntent').initSpoilers({method:'hoverIntent'}) .addClass('jqSpoiler'); // Clickable spoiler: $('.jqSpoilerClick').initSpoilers({method:'click'}) .addClass('jqSpoiler'); The addClass() is used to ensure that the items marked with the marker classes get the same CSS treatment.
[jQuery] Re: i need to build a tree dynamic...
On Aug 8, 5:10 pm, cesar c [EMAIL PROTECTED] wrote: I've a doubtI dont know how to implement a tree dinamic with jquery... I see de treeview api but the tree's structure is in the body how can i build dynamically this tree with jquery? You can build any DOM elements dynamically in jQuery using a number of techniques. One of the simplest is: $(body).append(divdynamically-created content/div); See: http://docs.jquery.com/API/1.1.2/Core#.24.28_html_.29
[jQuery] Re: Jquery can show Images from file:///C:?
On Aug 8, 1:28 am, Mario Moura [EMAIL PROTECTED] wrote: What I am trying is show an image into my browser with this tag img width=50 height=50 src=file:///C:/Users/example.JPG/ into my browser. Is it possible? or is a security lock from browsers? Both. It is possible, but only if your browser allows it. I am using $.post() It is likely that you won't be able to POST to a JPG file. You should use GET. For example, on my local web server i can POST to HTML files, but on my hosting provider i cannot - i have to use GET for HTML files. So I could send the path that user choice C:/Users/example.JPG to my php and return img width=50 height=50 src=file:///C:/Users/example.JPG/ Imagine what would happen if any JavaScript could read a local file and then POST it back to the web site. Scary stuff. But isnt working because browsers cant show this tag img width=50 height=50 src=file:///C:/Users/example.JPG/ As well it should not. See above. I can upload the file to webserver I know but will be more fast and I can save some bandwidth traffic if I could do this. And avoid malicious users consume my bandwidth traffic. But this feature is far more malicious than bandwidth theft. So Jquery can show Images from file:///C:? or something like this? This is not a question of jQ, but of JavaScript and the browser's security settings. i would NEVER enable my browser to allow reading of local files. i don't even think that Firefox lets you configure it to do that.
[jQuery] Re: doubt about jQuery
On Aug 6, 5:30 am, Igo88 [EMAIL PROTECTED] wrote: Hi...i am new to JavaScript but i have been reading a little...and i entered jQuery web page, and i have a some Doubts... 1) Is jQuery programming faster than traditional javaScript programming?? It depends on what you are doing. If you are working at all with the HTML DOM (most web page programming does) then YES, working with jQuery will save you lots and lots of time (the more code you write, the more time jQuery will save you). 2)Is jQuery available for the Client without downloading anything?... ALL JavaScript requires that the client download something, but the download happens automatically as part of the web page. If you mean, for example, a plugin, then NO, jQuery does not require any plugins. It only requires that your browser have JavaScript enabled.
[jQuery] Re: Help
On Aug 6, 12:27 pm, Muhammad Mohsin [EMAIL PROTECTED] wrote: How to send jquery $.get php varibles. i need to call ajax file with multivaribles how can i do it The documentation is your friend: http://docs.jquery.com/Ajax#.24.get.28_url.2C_params.2C_callback_.29
[jQuery] Re: help on $.get
On Aug 6, 12:41 pm, mohsin [EMAIL PROTECTED] wrote: how to pass multiple value from php to $.get in jQuery. i need to pass varibles from php to ajax file ...buti cann't find no way to do it. You can't pass variables from PHP to JavaScript. You can pass them from JS to PHP by making a GET or POST request, which fetches some arbitrary content (as a SINGLE result). You can use JSON results to simulate the effect of passing multiple values to JS: http://docs.jquery.com/Ajax#.24.getJSON.28_url.2C_params.2C_callback_.29 simply package your multiple PHP results into a JSON object and fetch that from your JS code.
[jQuery] Re: $Ajax memory problem
On Aug 6, 9:10 am, Michael Schwarz [MVP] [EMAIL PROTECTED] wrote: And did anybody of you write a periodical updater that is using POST without having memory leak problems? If i'm not mistaken, someone posted about this problem yesterday or the day before and posted a fix to the jQuery bug database. i'm sorry, but i don't have the links available. The problem had to do with jQuery not emptying an internal array, but instead just set all values to null. This meant the array kept growing, but most of its values were null. My assumption is that this fix will end up in 1.1.4 or 1.2.
[jQuery] Re: $Ajax memory problem
On Aug 6, 1:20 pm, Stephan Beal [EMAIL PROTECTED] wrote: If i'm not mistaken, someone posted about this problem yesterday or the day before and posted a fix to the jQuery bug database. i'm sorry, but i don't have the links available. Here's the bug link: http://dev.jquery.com/ticket/1463 Not sure if that's the same problem you're seeing, but it sounds similar.
[jQuery] Re: problem or unable to understand html(val) empty() function
On Aug 6, 7:45 am, Klaus Hartl [EMAIL PROTECTED] wrote: This is a typical case of running into unexpected results because of invalid HTML. A p element must not contain a list. What happens here is that a browser implicitly closes the paragraph before the list starts. Is there a more general rule to follow than no lists in a paragraph, such as no block-level elements in a paragraph? i'd never heard that certain elements aren't strictly allowed in a paragraph (except in the HTML 5.0 draft, where block-level elements won't be allowed inside of inline elements, if i'm not mistaken).
[jQuery] Re: (generic) Accordion plugin question
On Aug 6, 5:23 pm, Karl Swedberg [EMAIL PROTECTED] wrote: As Dan mentioned, this isn't tough to accomplish. I wrote a tutorial a while back that shows how to implement something like this at a basic level: http://www.learningjquery.com/2007/02/more-showing-more-hiding Excellent. Thanks for the link :). Thanks Dan and Karl!
[jQuery] follow-up: (generic) Accordion plugin question
On Aug 6, 5:23 pm, Karl Swedberg [EMAIL PROTECTED] wrote: http://www.learningjquery.com/2007/02/more-showing-more-hiding To follow up, here's how trivial it is (with jQuery) to write a very basic accordion-like widget which does not support Highlander behaviour (there can be only one). HTML (same structure as the official Accordion plugin): div id=SlinkyMain div div class=SlinkyHeaderAbout/div div class='SlinkyContent'This is an application skeleton. Edit to suit./div /div div div class=SlinkyHeaderDice/div div class='SlinkyContent' span id='DiceResultsTarget'Click a die button/spanbr/ button id='Button1d6'/buttonbr/ button id='Button2d6'/buttonbr/ button id='Button3d6'/buttonbr/ /div /div /div!-- #SlinkyMain -- (The classes are not significant - use whatever you like.) JS: jQuery.fn.initSlinky = function( props ) { props = jQuery.extend({ speed:'fast' }, props ? props : {}); var wrappers = $(' div',this); var contents = $('div:last',wrappers); contents.hide(); var heads = $('div:first',wrappers); heads.click( function() { $(this).next().slideToggle(props.speed); }); return this; }; (It could of course be written in less code, but i'm about to add a bunch of stuff where the local vars will come in handy.) Thanks again, Karl :).
[jQuery] request: need help naming new plugin
Hi, all! i just put together an accordion-like plugin based off of this Karl Swedberg's article: http://www.learningjquery.com/2007/02/more-showing-more-hiding The difference from other Accordions is that it does not enforce Highlander Behaviour. That is, it does not force only one of the panels be opened at a time - any number can be opened or closed. The problem i'm having is the name... Ideas i've got so far are: - Slinky. i like this one, but i'm worried about trademark infringement. (For those who don't know what a Slinky is: http://en.wikipedia.org/wiki/Slinky) - LowlanderAccordion. You know - the opposite of a Highlander Accordion. i like this, but it's a bit long. And just Lowlander is a bit nondescriptive. Anyone out there got a suggestion? As soon as it's got a decent name i can release it to the world.
[jQuery] Re: request: need help naming new plugin
On Aug 7, 12:31 am, John Resig [EMAIL PROTECTED] wrote: Toggle Pane Okay, it'd be hard to turn down the opportunity to say, The Man named my plugin for me, so TogglePane it is. Thanks, John!
[jQuery] Announcement: new plugin: TogglePane
Yo! http://jquery.com/plugins/project/TogglePane Only 719 bytes MIN'd. :D Many thanks to: a) Joern Zaefferer for his Accordion plugin, which inspired this plugin. b) John Resig for naming it. Well, and of course for writing jQuery. c) Karl Swedberg, for his article which made this plugin possible: http://www.learningjquery.com/2007/02/more-showing-more-hiding Happy Hacking!
[jQuery] Announce: dice roller plugin
Hi, all! As if the world really needs this... well, i needed it. BogoDice is a simple dice roller plugin: http://jquery.com/plugins/project/BogoDice There's a link to the demo page there. The full docs are in the uncompressed sources. The most significant TODO for the plugin is the ability to call server- side code to fetch dice results, instead of rolling them client- side, as that would be useful for online games where absolute trust in the dice results is an issue. Packed, the code is less than 900 bytes, and MIN'd it's under 750. (Yes, the MIN copy is smaller than the PACK... not sure why.)
[jQuery] (generic) Accordion plugin question
Hi, all! All these posts about various Accordion plugins has gotten me looking at several, and after trying them out i've got a generic question: Is there any Accordion(like) plugin out there which does not force all elements except the selected one to be closed? What if i want to open multiple panels at one time, and close them individually? i guess my real question is, would this feature be feasible within the framework of the existing code bases, without major changes to the public API. e.g., adding it as an option to the plugin: {allowMultipleOpen:true}. ???
[jQuery] Re: Before automatically closes tags...?
On Aug 2, 7:46 pm, DaveG [EMAIL PROTECTED] wrote: What I'd really like is a way to insert dom elements without automatic closure taking place. I checked out jQ and didn't see a flag in the code; although to be honest I'm not sure I fully understood what's going on in there ;) The automatic closure is happening due to HOW the functions like after() and before() are implemented. When you pass HTML to them, they use the browser-supplied DOM functions to create a miniature DOM tree. Your BROWSER is what creates the tree and gives jQuery back a well- formed DOM tree, which jQuery can than append/prepend/whatever to your existing DOM tree. This is, in fact, the only sane way to implement the behaviour, as implementing a full-fledged HTML parser into jQ would increase its size by several times.
[jQuery] Re: Ken Burns effects using jQuery?
On Aug 2, 7:54 pm, Ganeshji Marwaha [EMAIL PROTECTED] wrote: it looks great nicolas. but i would sincerely recommend one demo per page. i second Ganeshji's opinion: too many demos on one page. It brings my browser to a near standstill.
[jQuery] Re: If user clicks in one place OR another place OR another place...
On Aug 2, 10:17 pm, cfdvlpr [EMAIL PROTECTED] wrote: However, I'd like to also get access to the attributes of a span within that li. What line of code would give me a variable with that span's attributes? You can use the $('selector') syntax, simply pass on a context argument as the second argument: var s = $(selector,$(this)) That limits the searches to under the given content. (Though i'm not 100% certain whether you need the $() around 'this' or not.)
[jQuery] Re: The JS/jquery version of PHP's array_unique
On Jul 31, 11:44 am, fambizzari [EMAIL PROTECTED] wrote: In this case, how about adding the following function in_array(needle, haystack) JS has an operator for that: if( needle in haystack ) ... i only learned that after i wrote a native C function to add the feature to SpiderMonkey :/.
[jQuery] Re: The JS/jquery version of PHP's array_unique
On Jul 31, 9:48 pm, Klaus Hartl [EMAIL PROTECTED] wrote: Thanks for that Stephan! Very handy! I think I'm now going to read a few chapters from JavaScript - The Definitive Guide again... :-) i spoke too soon, though: the 'in' operator checks for a given KEY, whereas in_array() checks for a value. So they both have different purposes. [EMAIL PROTECTED]:~/cvs/jquery$ SpiderApe -e 'var a=[];a[1]=a;a[2]=b;print(2 in a);' true [EMAIL PROTECTED]:~/cvs/jquery$ SpiderApe -e 'var a=[];a[1]=a;a[2]=b;print(b in a);' false
[jQuery] Re: What would be the best way to do this / does this plug in excist
On Jul 30, 1:31 pm, Armand Datema [EMAIL PROTECTED] wrote: I Need to make the following. ,,, if I click the + image after link3 i have the following Try: http://bassistance.de/jquery-plugins/jquery-plugin-treeview/ http://be.twixt.us/jquery/treeView.php
[jQuery] interesting JS animation, candidate for jQuery plugin
Hi, all! i just came across this by accident and thought it might interest some plugin author enough to write a similar feature for jQuery: http://imdb.com/title/tt0084787/faq scroll way down, or search for Are there any deleted scenes for this movie?, and look for the red text which says Spoilers!. It is an effect which hides certain text until you mouse over it, at which point the real text is revealed. The intention is to keep people from accidentally seeing text which might spoil a film for them (i.e. reveal more information than they might want to know before seeing the film).
[jQuery] Re: How does everyone handle the constant updating of jQuery and plug-ins?
On Jul 29, 2:40 am, John Resig [EMAIL PROTECTED] wrote: My primary concern is that it isn't open, nor does it foster a community that promotes openness. Another concern about a subscription service is that it could very well offend the plugin authors who write the code but don't get part of the subscription fees.
[jQuery] Re: How does everyone handle the constant updating of jQuery and plug-ins?
On Jul 29, 6:49 pm, Rick Faircloth [EMAIL PROTECTED] wrote: An equitable system would have to be worked out, but no one who contributes would have been excluded... The Debian team recently (some months ago) got into a political pickle when they *hired* a release manager. The fact that anyone was getting paid caused several of the developers to (reportedly) leave the team. It wasn't necessarily that they wanted to be paid as well, but the principal that some individuals were getting paid at all while thousands of other contributors were not. While the idea has its merits, i think a subscription service for jQuery plugins would open up a similar can of worms. i agree completely with Karl that donations should be voluntary, and that nobody would complain about a monthly donation (whether it be 3 Euros or 20 Euros). But while money has the potential to build bridges, it more often than not just builds walls.
[jQuery] Re: How does everyone handle the constant updating of jQuery and plug-ins?
On Jul 29, 8:19 pm, Rick Faircloth [EMAIL PROTECTED] wrote: Do you know of a similar situation like what we've been discussing where a subscription service or something similar was successfully implemented? Now that you mention it... the closest things i'm aware of are: a) Commercial Linux distros (e.g. RedHat Suse). b) SourceForge (which i proudly subscribe to) offers free and subscription service. At sf.net, a subscription gives you no benefits other than bumping your support requests to the top of the list and adding a small dollar-sign icon next to your user name. i support them not for the support request bumping, but because they've hosted my projects since many years. c) Kingdom of Loathing (www.kingdomofloathing.com) and similar web- based games, which are free but offer additional features/bonuses if you donate (not the same as subscription, though). i'm not aware of any real subscription services for Open Source projects, though, as opposed to subscriptions for commercial content (e.g. ipod-related stuff).
[jQuery] Re: How does everyone handle the constant updating of jQuery and plug-ins?
On Jul 28, 3:11 am, Rick Faircloth [EMAIL PROTECTED] wrote: What does everyone do to stay updated with the latest jQuery and plug-ins for every website? Once you have a site working with your copy of jQ, there is no reason to update it unless you find that it has a new feature you need or fixes a bug you needed fixing. While it is, i understand, quite tempting to go around and update all sites to the latest version, there normally is no need to. Update only as *needed*. i run into the same problem with the PHP framework which powers my sites - upgrading all sites is a real pain in the butt... so i simply update those sites which would truly benefit from an update. If there's no gain in upgrading, it's not an upgrade.
[jQuery] Re: named function vs anonymous functions
On Jul 28, 2:53 am, Klaus Hartl [EMAIL PROTECTED] wrote: Jeffrey, this is exactly what I was thinking... So now does it work or not? Jein. If you want to call a method of an OBJECT, it won't work because you need a reference to THAT object (which you can encapsulate in a closure/anonymous function). If you want to call a method of a CLASS then yes it will work because 'this' is then no longer tied to a specific OBJECT. In some ways, passing SomeClass.SomeFunc as a function reference is equivalent to passing a pointer to a static member function in C++ (with the exception that there really can be a 'this' available in the function, but that it can refer to an object which is not of type SomeClass).
[jQuery] Re: How does everyone handle the constant updating of jQuery and plug-ins?
On Jul 28, 3:06 pm, Rick Faircloth [EMAIL PROTECTED] wrote: We need some kind of system where plug-ins are tested and deemed compatible with this version or that version of the core and not with some other version. An automated system that checks for compatibility and dependencies. That's not technically plausible/possible because to automatically test for compatibility the automated system must understand the following: a) Which functions belong to jQuery and which not. b) For ANY GIVEN INPUTS, what are the expected outputs. That requires knowing a hell of a lot about semantics. It is up to the PLUGIN AUTHORS to verify whether or not their plugin works with any given jQ version. That is NOT to say that plugin authors are obligated to test against every jQ release, because that's just not plausible. Authors SHOULD, however, say, this version of my plugin was tested with version XYZ of jQuery and appears to work. Aside from that, plugin authors have done us the favour of giving us something to work with and are in no way obligated to support us beyond that. Though of course most plugin authors do support their code, my point is simply that they're not obligated to, and we cannot enforce upon them that they test with every version of jQuery. There can never be a 100% guaranty that any given plugin works in 100% of cases with a given version of jQuery, because the whole environment which jQuery lives in (web browsers) is simply too fluid and full of incompatibilities between browsers (e.g. see how many subject lines in this forum have IE in them). I'm just trying to figure out a way to manage a fast-growing library and all its little plug-in children which are multiplying very rapidly! i sympathize completely with what you're after, but i've got over two decades of programming experience which tells me that an automated tool to do what you're looking for cannot work, at least it cannot work 100% correctly 100% of the time. And, in my experience, a tool which fails 5% of the time is worse than one which fails 90% of the time because people will come to trust the 95% tool and will let the 5% of failures simply slip through without a second glance.
[jQuery] Re: named function vs anonymous functions
On Jul 28, 11:35 am, Christof Donat [EMAIL PROTECTED] wrote: Hi, If you want to call a method of a CLASS then yes it will work because 'this' is then no longer tied to a specific OBJECT. Yes, it is. It is tied to the class object, which is the constructor function object in JavaScript: Thanks for the clarification. By specific object i meant more something along the lines of a specific object which the client creates, e.g.: var x = new Foo(); x.someFunc(); i wasn't aware that 'this' defaults to the ctor object. Strange behaviour.
[jQuery] Re: Anyway to kill a bunch of queued up mouse events
On Jul 28, 1:30 am, Mitchell Waite [EMAIL PROTECTED] wrote: I have this small script that shows and hides a button when you mouse over a Mitchell, please, for the second time, DO NOT HIJACK THREADS!!! This is at least the 3rd time i've seen you do it in the past few days! When you have a question START A NEW THREAD with YOUR question instead of STEALING SOMEONE ELSE'S!!! (Am i the only one who gets royally pissed off by this???)
[jQuery] Re: How does everyone handle the constant updating of jQuery and plug-ins?
On Jul 28, 5:13 pm, Rey Bango [EMAIL PROTECTED] wrote: ... plugin authors, a chance to see if anything breaks. And the code is in SVN so there's no reason for someone to not be able to test it. That's a key phrase, to not BE ABLE to test it. Certainly authors are able, but we must recognize that most plugin authors write a plugin to scratch their own itch, and as long as it works for them, they have little incentive to go out of their way to make sure that it works for others. i think we're all guilty of that at some level. As with any development effort, testing is the part that everyone hates but we really need you guys in the community to pound on the early releases to ensure that your code doesn't break. i'm just playing devil's advocate here: as a developer, if my code works for me, where is the incentive to spend my energy testing use cases which i won't personally use? The point is that nobody can *expect* any developer to continue to re- test their code under conditions which they don't personally use/ experience. e.g. i don't own a copy of Windows and cannot/will not test using MSIE. Nor will i install Opera just to make sure that my code works for the 1% of users who choose to use Opera. If an Opera user wants to test it, great, otherwise it won't get tested. The jQuery team is small as it is and we like it that way because it allows us to have a streamlined approach to things. And that team's only responsibility (interpreted lightly) is to make sure that their code works as advertised, and not to ensure that every (or, for that matter, ANY) plugin works with their core code. we need to continue to rely on the plugin authors and the community to test things out. With so many plugins in the repo, its just too big of a task to test all of them out. Amen, borther. But i think people expect too much of plugin authors in general (i.e., take too much for granted). They (the authors) write a plugin to scratch a personal itch and then release it for others with the same itch. We cannot *expect* the authors to then be pro-active about checking against newer jQ releases. Of course, many are quite active/pro-active, but we cannot *expect* it, nonetheless. Am i going to go back and test my plugins against every new jQ release? Only if i happen to be using that release somewhere. And i think most plugin authors take the same approach. Perhaps i'm splitting hairs or arguing over semantics here, though. i admit that i have a hard time viewing the world through a normal user's eyes, as 98% of my time is spent in hacker-land, and coders and users often have much different expectations. :D
[jQuery] Re: How does everyone handle the constant updating of jQuery and plug-ins?
On Jul 28, 5:55 pm, Rey Bango [EMAIL PROTECTED] wrote: My advice to all who are concerned about this is to engage the plugin authors in some way to motivate them to update their work. If they don't want to, then consider adopting the plugin and enhancing it. That's happened on several occasions which much success. Just a quick comment to the Users out there: often a simple, i use your plugin mail works wonders to motivate a coder. If one feels that his code is getting used then he's more likely to keep enhancing it. If it is used but he never hears about it (i.e., gets no fan mail) then it is far more likely to fall to the way-side. :D
[jQuery] Re: Anyway to kill a bunch of queued up mouse events
On Jul 28, 5:59 pm, Mitchell Waite [EMAIL PROTECTED] wrote: I started this thread myself, how is that hijacking? The top post of this thread was from Nicolas Hoizey and is about a completely different topic: From: Nicolas Hoizey [EMAIL PROTECTED] Date: Thu, 26 Jul 2007 23:12:51 +0200 Local: Thurs, Jul 26 2007 11:12 pm Subject: Ken Burns effects using jQuery?
[jQuery] Re: Anyway to kill a bunch of queued up mouse events
On Jul 28, 7:54 pm, Stephan Beal [EMAIL PROTECTED] wrote: can find. The New Topic button is unfortunately not available when reading a post (it's only visible from the list-of-posts view). i lied - it does show up as a normal link in the top/right of the page. When in the list-of-posts view it is also available as a button.
[jQuery] Re: IE and the Invalid Source Code Error
Hi, Mike! Something not directly related to your problem, but maybe helpful nonetheless... you can chain a lot of these calls to make them run faster. As it is written now, you are forcing jQ to repeat a few of the searches several times... On Jul 27, 1:54 am, mcraig [EMAIL PROTECTED] wrote: $(#switchkey p).corner(bottom 6px;); ... $(#switchkey p).click(function() { $(#switchcontent).animate({height: 'toggle', opacity: 'toggle'}, 500, function() { Can be: $(#switchkey p).corner(bottom 6px;) .$(#switchkey p).click(function() {... $(#switchkey p).html('Close Site Panel'); $(#switchkey p).corner(bottom 6px;); $(#switchkey p).html('Site Panel'); $(#switchkey p).corner(bottom 6px;); Those can/should all be chained together: $(#switchkey p).html('Close Site Panel') .corner(bottom 6px;) .html('Site Panel') .corner(bottom 6px;); Doing so should speed up that portion of code more than 50%. $(#logincontent).animate({height: 'toggle', opacity: 'toggle'}, 500, function() { if ($(#logincontent).is(':visible')) { Inside the anonymous function 'this' refers to #logincontent, so you should use this instead of $('#logincontent'), to avoid doing yet another search for an item you already have. $(#loginkey p).html('Close Login'); $(#loginkey p).corner(bottom 6px;); You can chain these. $(#loginkey p).html('Login'); $(#loginkey p).corner(bottom 6px;); And these, too. Chaining does not only exist to make code prettier, but to save a lot of internal work. Every time you do $('#foo'), the whole DOM has to be searched to find the element, which takes so-called linear time (meaning that the time it takes grows in direct proportion to the length of your DOM), whereas if you chain calls you perform the search only once and re-use the found element. The speed savings are in direct relation to how many calls you can effectively chain. e.g. if you can chain 3 calls then you've effectively cut the search time to 1/3rd of what it would be when not chaining the calls. Failing to use chaining (or caching a $(...) result) inside of a loop can be a big performance hit. Good luck solving your IE problem! i'm so glad i don't own Windows, so i don't have to put up with that browser! :D
[jQuery] Re: My Jquery-Tab plugin allow selectable remote tab and add oninit even function
On Jul 27, 9:23 am, [EMAIL PROTECTED] wrote: Happy to share this plugin! It is base on Klaus's tab plugin.http://www.twe-market.com/tab/#remote-tab-4 Nice :). Two comments: a) In Firefox, the Download link is almost completely hidden/covered up by the tabs. b) i would recommend renaming your file from jquery.tabs.js to avoid a name conflict with Klaus' tabs. :D
[jQuery] Re: hiding a div when clicked outside of it
On Jul 27, 1:43 pm, Maggi [EMAIL PROTECTED] wrote: Hi Ganeshji! You could create an overlay background div with 100% in height and width and write a small jQuery code for that. The problem with this approach is that this consumes the click, such that if the user clicks on another clickable element inside the page, the event won't be delivered and the user will have to click AGAIN. As before, Ganeshji, i think the click-outside-the-element type of design (which you also suggested for the Confirmer plugin) will lead to event-related bugs and kludgy workarounds, in particular where cross-browser compatibility is concerned.