[jQuery] Re: Way to convert DOM event to jQuery event?
What about using the metadata plugin and storing data in the class attribute? A little hackish (in HTML5 can use the data attribute, which is more proper...): http://plugins.jquery.com/project/metadata In addition to rel, you could also use the title attribute on the anchor, no? Scott On Tue, Sep 22, 2009 at 4:47 PM, WalterGR walte...@gmail.com wrote: On Sep 22, 6:38 am, Liam Potter radioactiv...@gmail.com wrote: or this a href=# rel=foobarbazshow details/a $(a).click(function(){ var rel = $(this).attr('rel'); } now you have passed foobarbaz to jquery. This works only if I don't already need to use rel. I feel like there _must_ be a better way... Certainly this attribute abuse isn't a jQuery best practice? Walter
[jQuery] ANN eyedropper color picker plugin
[cross posted from the plugin list, which seems to have died in February] Hey folks, I've been absent from the jquery lists for quite awhile, but just recently had the opportunity to build a cool little plugin for a project I'm working on so I decided to release it to the public. This plugin acts as an eyedropper-style color picker, allowing a user to select a color by clicking a pixel in an image. The plugin replaces selected img elements on the page with a canvas element, and provides click, mousemove and mouseout event callbacks. The callback is sent a color object (describing the color under the mouse for the event). It also shows a little hovering preview of the color near the cursor when over the image. You can find it on github with a simple demo included: http://github.com/sstrudeau/jquery-dropper I'm hoping to receive some feedback on things like: * callback function naming conventions * which other arguments would be useful appropriate to send via the callback * should I instead (or also) trigger events instead/as well as offer callbacks? * any best practice examples for making something like the color hover chip style-able, optional? * any other feedback No live demo yet -- but if I hear a clamor, I might find a place to tuck one. Notable limitations: doesn't work on IE (the VML canvas hack doesn't offer pixel-level access to images) and images must be hosted from the same domain as the origin page (canvas security limitation). Thanks, Scott
[jQuery] Re: ANN eyedropper color picker plugin
Since github seems to be suffering from a DoS attack, I posted a demo here: http://sstrudeau.com/jquery-dropper/demo/index.html Scott On Wed, Sep 16, 2009 at 12:47 PM, Scott Trudeau scott.trud...@gmail.comwrote: [cross posted from the plugin list, which seems to have died in February] Hey folks, I've been absent from the jquery lists for quite awhile, but just recently had the opportunity to build a cool little plugin for a project I'm working on so I decided to release it to the public. This plugin acts as an eyedropper-style color picker, allowing a user to select a color by clicking a pixel in an image. The plugin replaces selected img elements on the page with a canvas element, and provides click, mousemove and mouseout event callbacks. The callback is sent a color object (describing the color under the mouse for the event). It also shows a little hovering preview of the color near the cursor when over the image. You can find it on github with a simple demo included: http://github.com/sstrudeau/jquery-dropper I'm hoping to receive some feedback on things like: * callback function naming conventions * which other arguments would be useful appropriate to send via the callback * should I instead (or also) trigger events instead/as well as offer callbacks? * any best practice examples for making something like the color hover chip style-able, optional? * any other feedback No live demo yet -- but if I hear a clamor, I might find a place to tuck one. Notable limitations: doesn't work on IE (the VML canvas hack doesn't offer pixel-level access to images) and images must be hosted from the same domain as the origin page (canvas security limitation). Thanks, Scott
[jQuery] Re: ANN eyedropper color picker plugin
This wouldn't be too difficult to turn into a greasemonkey script. It wouldn't work for images that are hosted from a domain other than the parent page, however, which is a frequent case; Firefox will throw canvas security exceptions for every img element not in the domain if you do $('img').dropper(). You could probably do a $('img').each() loop and check that the src attribute is in the page domain before making the image pickable, but you would only be able to pick from a subset of (possibly 0) images on the page. You could also turn it into a bookmarklet a la Karl Swedberg's jquerify bookmarklet (same caveats apply, greasemonkey not required): http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet Scott On Wed, Sep 16, 2009 at 5:45 PM, Jack Killpatrick j...@ihwy.com wrote: great, thanks. This would be really handy as a greasemonkey script. I use a FF plugin that does the eyedropper thing a lot (during design work), but it has it's shortcomings. If a greasemonkey script gave me the eyedropper and a box with the sampled color and hex value, that'd be rad. - Jack Scott Trudeau wrote: Since github seems to be suffering from a DoS attack, I posted a demo here: http://sstrudeau.com/jquery-dropper/demo/index.html Scott On Wed, Sep 16, 2009 at 12:47 PM, Scott Trudeau scott.trud...@gmail.comwrote: [cross posted from the plugin list, which seems to have died in February] Hey folks, I've been absent from the jquery lists for quite awhile, but just recently had the opportunity to build a cool little plugin for a project I'm working on so I decided to release it to the public. This plugin acts as an eyedropper-style color picker, allowing a user to select a color by clicking a pixel in an image. The plugin replaces selected img elements on the page with a canvas element, and provides click, mousemove and mouseout event callbacks. The callback is sent a color object (describing the color under the mouse for the event). It also shows a little hovering preview of the color near the cursor when over the image. You can find it on github with a simple demo included: http://github.com/sstrudeau/jquery-dropper I'm hoping to receive some feedback on things like: * callback function naming conventions * which other arguments would be useful appropriate to send via the callback * should I instead (or also) trigger events instead/as well as offer callbacks? * any best practice examples for making something like the color hover chip style-able, optional? * any other feedback No live demo yet -- but if I hear a clamor, I might find a place to tuck one. Notable limitations: doesn't work on IE (the VML canvas hack doesn't offer pixel-level access to images) and images must be hosted from the same domain as the origin page (canvas security limitation). Thanks, Scott
[jQuery] Re: slide down animation jumps at the end
IIRC this can be caused by padding and/or margin being other than 0. On Tue, May 6, 2008 at 2:10 PM, Yann [EMAIL PROTECTED] wrote: I got a smilingly simple problem but I have spent way to much time trying to fix it unsuccessfully already... Hoping some jQuery guru can figure this one out for me... The javascript is pretty basic: // set defaults $('.news_content').hide(); $('.news_item_bg div:first').show(); $('#latest_news a:first').addClass('selected'); // set news links behavior $('#latest_news a').click(function () { $('#latest_news a').removeClass('selected'); $(this).addClass('selected'); var target = $(this).attr('href'); $(.news_content:visible).animate({color: '#fff'}, 500).slideUp(1000, function() { $(target).slideDown(1000).animate({color: '#fff'}, 1000); }); return false; }); But when it slides down, the end of the animation is choppy, more accurately, it seems that the height is calculated wrong during the animation and readjusted at the end... Anyone else has experienced this problem before? I must be doing something wrong since Google search didn't turn anything up... Thanks! -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: [ANN] Simple focusFirst and ajaxLinkBind Plugins
To be a little more specific, for example, do this: var e = $('form input:visible'); Not: e = $('form input:visible') On Sun, Apr 27, 2008 at 8:11 PM, Mike Alsup [EMAIL PROTECTED] wrote: Comments welcome! I'd recommend not using global vars. Both of those plugins are doing so. -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: [ANN] Simple focusFirst and ajaxLinkBind Plugins
Yes. That creates a single scope for all the plugin code and allows you to use $() inside that scope. Handy when the next user comes along that doesn't use the $() alias for jQuery() (e.g., because they also use Prototype or another library), while keeping the plugin code tight. Scott On Sun, Apr 27, 2008 at 8:25 PM, s.ross [EMAIL PROTECTED] wrote: Righto. Also, there might be some benefit in wrapping w/ (function($) { // stuff })(jQuery); Yes? I have a couple of extend's to do that will make things work much more nicely. Thx for the comments. On Apr 27, 2008, at 5:23 PM, Scott Trudeau wrote: To be a little more specific, for example, do this: var e = $('form input:visible'); Not: e = $('form input:visible') On Sun, Apr 27, 2008 at 8:11 PM, Mike Alsup [EMAIL PROTECTED] wrote: Comments welcome! I'd recommend not using global vars. Both of those plugins are doing so. -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: Remote JSON Ajax call - error function not called
No, I don't think there is. When you use JSONP or other script-tag techniques, jQuery creates the script tag DOM element, but I don't think it can get any response if the script fails to load. Whatever happens, happens. It's technically possible to simulate a timeout by wrapping the JSONP callback function, wait for the timeout period, and then check to see if the callback function set some known value. If it hasn't set this value after the defined timeout interval, destroy the callback function and script tag, and trigger a timeout. I built a custom JSONP function that does this since jQuery didn't back when I needed it. I've been meaning to look at core and contribute a patch to simulate timeouts for JSONP calls, but the code is pretty wacky so I haven't had time to parse it and understand how a patch like this might work. Not sure if the state of affairs has changed since 1.1.2... Scott On Tue, Apr 15, 2008 at 3:52 PM, patrick davey [EMAIL PROTECTED] wrote: Hi, I am trying to retrieve JSON Data from a remote server and manipulate teh returned data. That all works fine - the callback is executed and it all works as expected. The issue I am running into is that I want to use timeouts and error messages also - and they are not working. I tried the following code (just demo code - not the one I am using) $.ajax({ type:GET, url: http://www.thisSite.com/badurl.asp;, data:jsoncallback=?, dataType: json, timeout: 1000, error: function(){ alert('Error loading document'); }, success: function(data){ alert(data); } }); If I run the above function I would expect the error function to be called as it would get a 404 error for the bad URL... but that *does not happen*. No function is called. If, however, you change the URL to be a local address (but still incorrect) then the error function *is* called. I'm sure I'm missing something fundamental!! But is there a way to call error functions for remote urls? And if so how! Thanks, Patrick -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: Getting URL hash
Not sure if there's a jQuery way ... this: var hashAnchor = self.document.location.hash.substring(1); Has worked for me... Scott On Mon, Apr 14, 2008 at 12:48 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, Not sure if this is the right terminology, but what is the JQuery way to detect if, and then store in a variable, the URL's hash value, meaning anything coming after the #? Thanks, - Dave -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: [POLL] Online jQuery Training from John Resig
I'm declining to answer the poll since I couldn't decide unless I had some sense of the training agenda, cost and even date/time. In the mean time I'll subscribe to John's blog, buy every book he writes and tell everyone else to do the same. :) Scott On Wed, Mar 5, 2008 at 11:55 PM, Rey Bango [EMAIL PROTECTED] wrote: The jQuery team is looking to gauge interest in jQuery training delivered in a live, online format by jQuery project lead John Resig. Nobody knows jQuery better than John and in terms of JavaScript, he's considered one of the best in the world. So a training class delivered by him would surely help anyone become more proficient in JavaScript and jQuery. So, if you could take a couple of minutes to participate in the following poll, that would be a big help in determining how to proceed: http://www.polldaddy.com/poll.aspx?p=388570 Thanks, The jQuery Team -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: How to define FireBug?
I frequently do something like: if(typeof window.console == 'undefined') window.console = { log: function() {} }; So I can just use console.log() at will since if Firebug (or alternative) is not present, it will just do nothing when called. You can also extend that to do some kind of alternate logging if console.logisn't defined. E.g., if(typeof window.console == 'undefined') { window.console = { log: function(msg) { $('div#log').append('p'+ msg '/p'); } } } A little less trouble than installing Firebug Lite, but not quite as nice. Scott On Thu, Feb 14, 2008 at 7:14 AM, spinnach [EMAIL PROTECTED] wrote: try if (window.console) { console.log(...); } dennis. mtest wrote: Hello all :) If it possible to define Firebug? Install it or not? Like it possible do whis browsers by command: if ($.browser.safari) { alert(this is safari!); } maybe like this :)) if ($.extensions.firebug) { alert(FireBug is install!); } Thank you to attention, and one more time sorry for my poor english:), but I try hard :) -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: Adding a callback function to a extended jquery function
I haven't writen a plugn that does this but something like: $.fn.addFeedback = function(feedbackMessage, callback ){ ... if(jQuery.isFunction(callback) callback.apply($(this)); ?? Someone with better plugin-fu could probably tell me how that's all wrong. Also, you might need to deal with timing issues if you want to make sure the callback is run only after the animations / setTimeout complete. Scott On Feb 5, 2008 10:35 AM, Dan Eastwell [EMAIL PROTECTED] wrote: Hello, I have the following function: // Show and fade out a feedback message $.fn.addFeedback = function(feedbackMessage){ var offset = $(this).offset(); var feedbackDiv = div class='feedback' id='feedbackElement' style='display:none;position:absolute;left: + offset.left + px;top: + (offset.top + 0) +px'p + feedbackMessage + /p/div; $(body).append(feedbackDiv); $('#feedbackElement').fadeIn('slow'); setTimeout($('#feedbackElement').fadeOut('slow', function(){$('#feedbackElement').remove();});,3000); } How do I change this to add an optional callback function to operate once the function has completed? Thanks, Dan. -- Daniel Eastwell Portfolio and articles: http://www.thoughtballoon.co.uk Blog: http://www.thoughtballoon.co.uk/blog -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: set focus on change
Well, in that specific code, you should be able to just $('#testField').focus(); because you are only working with a single field. That said, I think maybe $(this).focus() is what you want for the generic case? (can't recall what $(this) is inside an event callback). Scott On Feb 4, 2008 10:26 AM, Matt Williams [EMAIL PROTECTED] wrote: I want to run a validation function after a user enters data. If the validation fails, I want do an alert telling them so and set the focus back to that field. But even at the most basic level, I can't get the focus to stay / go back to the field that was changed. Interesting that it does seem to work in IE 7, but not FF. $(document).ready(function(){ $('#testField').change(function() { alert('wrong value'); this.focus(); }); }); Any ideas here? Or suggestions on how to reset focus back to the field that changed? Thanks, Matt -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: jQuery + PHP MCV Framework
CodeIgniters' alergy to GET params is bizarre. I don't have any code for you; my jQuery + CI stuff has all been dead simple for AJAX; I just create a special controller for the few ajax calls I make and generate the URLs whole rather than using params ... One of these days I need to dig in and come up with a better .htaccess rule set and router for CI since it's such a nice light weight framework otherwise... well, except its ActiveRecord implementation. ;) Scott On Jan 15, 2008 4:49 AM, dynegara [EMAIL PROTECTED] wrote: Hi guys, is anyone there using jQuery with php mcv framework like CodeIgniter / Cake ? how do you guys solving the problem url param generated by jquery example: abc.php?c=controllerm=methodsp1=var1$p2=var2 into abc.php/controller/methods/var1/var2 any tips will be very useful for me. thx dian yn -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: Loading dynamic JS libraries with jQuery
Look at $.getScript: http://docs.jquery.com/Ajax/jQuery.getScript Try something like: $(document).ready(function() { $.getScript('script/jquery.form.js'); }); You can wrap $.getScript in your function to do the script path prepend and .js append. No need to do all the messy DOM stuff yourself. That's what jQuery is for. ;) Scott On Jan 15, 2008 6:20 PM, Nazgulled [EMAIL PROTECTED] wrote: Hi, I'm trying to load JS files (libraries) dynamically at run-time with jQuery but I'm not being able to... I thought I had this working before but now it's not. Here's my code: INDEX.HTML html head script type=text/javascript src=scripts/jquery.js/script script type=text/javascript src=scripts/global.js/script /head body /body /html GLOBAL.JS function loadJavascript(scriptFile) { var scriptsPath; // Builds the correct scripts path scriptsPath = $('script').attr('src'); scriptsPath = scriptsPath.replace(/\w+\.js$/, ''); // Creates the script element and appends it to the head $(document.createElement('script')) .attr('src', scriptsPath + scriptFile + .js) .attr('type', 'text/javascript') .appendTo('head'); } $(document).ready(function() { // Dynamically loads a list of javascript files loadJavascript('jquery.form'); } It should have created a script element like this: script type=text/javascript src=scripts/jquery.form.js/script And appended it to the head element, but it didn't work... I'm using the latest jQuery v1.2.2. Hope someone can clarify this to me... Why can't I do this? -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: Synchronous JSONP
What about using the success callback of the JSONP call to initiate the location.href? Something like: $('a').click(function() { var href = $(this).attr('href'); $.ajax({ url: 'http://example.com/jsonpmethod?callback=?', dataType: 'jsonp', success: function(data) { // do whatever with json encoded data location.href = href; } }); return false; }); On Jan 8, 2008 8:06 PM, Glen Lipka [EMAIL PROTECTED] wrote: I think my thought process on this was messed up anyway. Here is the use situation. We are using JSONP to send activity on pages to avoid cross-site scripting problems. One of those activities is clicking on a link. The problem is that the JSONP is asynchronous so that when the link is clicked, the page unloads before the JSONP has a chance to do it's thing. What is the best way of allowing the JSONP to do it's thing and pause the unload of the page long enough for it to work? Glen On Jan 8, 2008 1:37 PM, Benjamin Sterling [EMAIL PROTECTED] wrote: Glen, I have never done it, but I say a while back that you can use the jQuery.extend method to overwrite a default method. I will see if I can dig that up, but that may point you in the right direction in the mean time. On 1/8/08, Glen Lipka [EMAIL PROTECTED] wrote: Right now in 1.2.1 the JSONP method uses an asynchronous call to do it's thing. This sometimes causes a problem when we are sending a call about a click event on a link. The page unloads before the JSONP is finished. Changing it to be optional (async or synchronous) helps fix that problem. Code we used inside jQuery (with a param call to .ajax) /* If the request is not async, we need to wait for the script to l oad before returning. */ else if (!s.async) { var done = false; // Attach handlers for all browsers script.onload = script.onreadystatechange = function(){ if ( !done (!this.readyState || this.readyState == loaded || this.readyState == complete) ) { } }; } QUESTION: Putting this directly into our copy of jQuery is probably a bad idea. *How can this be turned into a plugin?* Thanks much, Glen -- Benjamin Sterling http://www.KenzoMedia.com http://www.KenzoHosting.com http://www.benjaminsterling.com -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: Using JSONP...I'm clueless.
Ryura, You don't need to use getJSON but you do need to find out exactly how the JSONP service you are using expects the callback function to be specified in the URL. The echo you provided shows that the service you are calling is not prepending the JSON encoded object with the name of the function. Normally the GET param for a JSONP callback function is simply callback -- I don't recall if jQuery will append this by default if it doesn't see a ? at the end of the provided URL -- but it can be anything. For example, it could be jsonpCallback, in which case your URL should be something like: http://somedomain.net/jsonp/selection.php?jsonpCallback=? jQuery will autogenerate your callback function (which eventually will invoke your success callback) and replace the trailing ? with the autogenerated function name. Scott On Dec 28, 2007 12:42 PM, dfd [EMAIL PROTECTED] wrote: Why not use getJSON? From the docs http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback As of jQuery 1.2, you can load JSON data located on another domain if you specify a JSONP callback, which can be done like so: myurl? callback=?. jQuery automatically replaces the ? with the correct method name to call, calling your specified callback. This is a piece of working code: $.getJSON(http://ws.geonames.org/searchJSON?q=+m.editSearch +featureClass=PfeatureClass=Acallback=?, function(data){ // the callback-function, data came from geonames if (data.totalResultsCount 0){ Regards, Frank On 24 Dez., 22:31, Ryura [EMAIL PROTECTED] wrote: Basically, I'm trying to pull data from a database on a different server. On the site without the database (we'll sayhttp://thisdomain.com/index.html), I have var gomon = new Array(); gomon[0] = Test; gomon[1] = Testx; gomon[2] = Test3; $.ajax({ type: GET, url: http://somedomain.net/jsonp/selection.php;, dataType: jsonp, data: foo=+gomon, success: function(gata){ alert(gata.go[3]].repping) } }); selection.php basically is echoing this: ({ go: [ {zepping:grrr,zamount:1,zepped:Ryura,tzme:2}, {zepping:garrr,zamount:1,zepped:Ryura,tzme:2}, {zepping:gsrrr,zamount:1,zepped:Ryura,tzme:2}, {zepping:grrrd,zamount:1,zepped:Ryura,tzme:2} ] }) Now, when viewing thisdomain.com/index.html, Firebug gives me this error: [Exception... 'Permission denied to call method XMLHttpRequest.open' when calling method: [nsIDOMEventListener::handleEvent] nsresult: 0x8057001e (NS_ERROR_XPC_JS_THREW_STRING) location: unknown data: no] And nothing executes. What did I do wrong? Thanks, Ryura -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: .GetJSON, retrieve a list of key/value from JSON object?
for(key in myJSONobject) { var value = myJSONobject[key]; } should get you started ... On Dec 19, 2007 11:00 AM, Mathieu Dumais-Savard [EMAIL PROTECTED] wrote: Hi, I have no problem using jSON so far except that I am looking for a way to browse the items sent from the server to the client in such fashion: foreach key (keys myJSONobject) { var value = (myJSONobject[keys]) ; } Any hint? Thanks! -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: Data containing ? at the start getting converted to jsonp.... by ajax() call
? is a reserved character in URLs (it separates the domain from the GET parameters) and must be encoded if it's data. http://www.blooberry.com/indexdot/html/topics/urlencoding.htm Scott On Dec 4, 2007 2:00 PM, Ben Bennett [EMAIL PROTECTED] wrote: This is my first post so I really should thank everyone for a fanatastic library. However, I think I have found a bug... Using jQuery 1.2.1, if I have: $.ajax({ type: POST, url: test.html, dataType: json, data: {query: queryString}, }); When queryString starts with a ? it will get converted to jsonp1231234124... This is clearly happening because of the code at line 2226 of the full release version: // Build temporary JSONP function if ( s.dataType == json (s.data s.data.match(jsre) || s.url.match(jsre)) ) { jsonp = jsonp + jsc++; // Replace the =? sequence both in the query string and the data if ( s.data ) s.data = s.data.replace(jsre, = + jsonp); s.url = s.url.replace(jsre, = + jsonp); ... But I see no way to prevent that from happening. Now... one might suggest that I should avoid a leading ? in my option names. But I am taking them from input boxes and ? is a valid thing for a user to type. Unfortunately there seems to be no good way to escape the string to prevent this behavior (without teaching the called code how to unescape it). Also, the docs don't mention that the =? escaping happens to a json dataType... I see it for jsonp. Is this behavior intentional? If so, there should be a way to suppress it or at a way for the calling code to escape the values to cause a leading ? to be passed to the server. -ben -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: Any server status if use script tag for XSS?
I actually posted to the dev list about a similar issue (using JSONP, which is script-like). I'd like to put a short timer on the script calls and receive a timeout if the callback function fails to fire. Scott On 10/8/07, Jacky [EMAIL PROTECTED] wrote: Hi, I would like to call crossite script. So I use the script tag technique (create script tag, assign src and append to head) to do so. But unlike xmlhttprequest, I cannot get any response status from it. So I just wonder if there is anyway I can detect if the remote script is not available? I tried to use try-catch, which works on Firefox but not IE. Code: $(document).ready(function(){ try{ var s = document.createElement(script); s.type = text/javascript; s.src = http://thisurldoesnotexist/dsfsdlfjk.js ; document.appendChild(s); } catch(e){ alert(any error); } }); -- Best Regards, Jacky 網絡暴民 http://jacky.seezone.net -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: Counting the number of child elements that a div has
It should. I just typed this into my Firebug console on a page including jQuery: $('body').append('div id=test/div'); $('#test').append('p'+ $('#test').children().size() +'/p'); $('#test').append('p'+ $('#test').children().size() +'/p'); $('#test').append('p'+ $('#test').children().size() +'/p'); Seemed to work as expected Scott On 10/3/07, wattaka [EMAIL PROTECTED] wrote: Thanks Wizzud, but this does not work with elements that are dynamically added to the DOM, is there another way? Thanks On Oct 3, 11:26 pm, Wizzud [EMAIL PROTECTED] wrote: var ct = $('div').children().size(); wattaka wrote: How can I count the number of child elements that a div container has? Thanks -- View this message in context: http://www.nabble.com/Counting-the-number-of-child-elements-that-a-di... Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: Release: jQuery treeview plugin 1.3
Jörn, Nice plugin. I'm hoping to make use of it very soon. I'm having trouble with the demo (both on bassistance and on jquery docs). Collapse All / Expand All / Toggle All seems to work, but clicking the +/- does not. Firebug reports no errors. It renders poorly on IE. Tested: FF2/Mac, Safari2/Mac, IE6/Win, IE7/Win Scott On 10/2/07, Jörn Zaefferer [EMAIL PROTECTED] wrote: Good news everyone! The treeview plugin version 1.3 is out, giving you an even better tool at hand to display and navigate your trees. Plugin page(s): http://jquery.com/plugins/project/treeview http://bassistance.de/jquery-plugins/jquery-plugin-treeview/ Demos: http://jquery.bassistance.de/treeview/ - Fixes for all outstanding bugs - Added persistence features - location based: click on a link in the treeview and reopen that link after the page loaded - cookie based: save the state of the tree in a cookie on each click and load that on reload - smoothed animations, fixing flickering in both IE and Opera - Tested in Firefox 2, IE 6 7, Opera 9, Safari 3 - Requires jQuery 1.2+ In addition, the documentation has been rewritten and is now hosted on the jQuery documentation wiki: http://docs.jquery.com/Plugins/Treeview/treeview Have fun Jörn -- -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: $.post() and CI inquiry
* CI = CodeIgniter, I presume Steve, I'm not sure I understand your question, but when you call: $('#pendingUsers').load('index.php/meduser/check_pending_users'); It should load the HTML returned by index.php/meduser/check_pending_users into whatever element has the id pendingUsers ... CI doesn't need to know about the target DIV. It just needs to return some HTML. If you need to do something differently depending on the result of check_pending_users, that becomes a little more complex. Scott On 8/13/07, Steve Finkelstein [EMAIL PROTECTED] wrote: Hi all, I have a simple javascript file being loaded externally that has the following code: -- snip -- $(document).ready(function() { $('#pendingUsers').load('index.php/meduser/check_pending_users',false, function() { $('#pendingUsers a').click(function() { $.post('index.php/meduser/pull_user_information', {id: $(this).attr('rel')} ); }); }); setInterval(function() { $('#pendingUsers').load('index.php/meduser/check_pending_users'); }, 30); // initially hide the main content div until a pending user is clicked. }); -- snip -- My issue here is I'm not sure how with CI to associate the $.post() with the div I want to populate the data back from the server with in a view. My view contains a div id=main/div area where the results should be posted back. My controller looks like this: function pull_user_information() { $id = $this-input-post('id'); $data['query'] = $this-db_users-query('select * from tbl_signups where ID=$id' ); $this-load-view('default/meduser_useraccordny_view', $data); } I'm trying to populate the rel of the anchor tag into $id and using that to query the database. I can then pass that into the meduser_useraccordny_view, however I'm still not entirely sure how to populate the particular div. Any assistance would be appreciated! -- .|.. Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: Need help 're-stripping' a table
Heh. IE has me so trained not to use fancy css selectors I forgot about :even. I just wrote the same thing like: $(tr).each(function(i){ if(i % 2 == 0) $(this).addClass(on); else $(this).removeClass(on); }); On 8/6/07, cliff [EMAIL PROTECTED] wrote: Actually, I figured it out. $('#pageElement') should be $('#'+pageElement) This is most of the function $('#'+pageElement).remove(); stripeMe(); function stripeMe() { $(.stripeMe tr).removeClass(alt); $(.stripeMe tr:even).addClass(alt); rowOver(); } function rowOver() { $(.stripeMe tr).mouseover(function() {$ (this).addClass(over);}).mouseout(function() {$ (this).removeClass(over);}); } On Aug 6, 5:44 pm, Benjamin Sterling [EMAIL PROTECTED] wrote: Cliff, I must have missed something, but what is stripeMe();? Do you have a demo page to look at? On 8/6/07, cliff [EMAIL PROTECTED] wrote: I am trying to remove a row from a table and then re-strip it as follows: $('#rowid').remove(); stripeMe(); But I can't get this to work. Either re-striping isn't working or the row isn't being completely remove. Help! -- Benjamin Sterlinghttp://www.KenzoMedia.comhttp://www.KenzoHosting.com -- .|.. Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: jqmodal overlay opaque (solid) in IE7
I eventually found a solution to this. I switched to jquery 1.1.2 and it works fine on IE. With jquery 1.1.3 jqModal overlay is opaque (solid) on IE7. Have not attempted to investigate the cause. Scott On 7/11/07, Scott Trudeau [EMAIL PROTECTED] wrote: I'm attempting a very simple use of jqmodal -- basically the first example on the plugin page. Works fine in FF but in IE the overlay appears opaque. Anything obvious I should look for? So far, my googling suggests z-index issues if the jqmWindow isn't a direct child of body, but I don't think this would affect opacity of the overlay ... positioning / z-index of the window is fine. Can provide code in a bit ... Scott -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets -- .|.. Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] jqmodal overlay opaque (solid) in IE7
I'm attempting a very simple use of jqmodal -- basically the first example on the plugin page. Works fine in FF but in IE the overlay appears opaque. Anything obvious I should look for? So far, my googling suggests z-index issues if the jqmWindow isn't a direct child of body, but I don't think this would affect opacity of the overlay ... positioning / z-index of the window is fine. Can provide code in a bit ... Scott -- Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: making ajax calls in jqmodal window. Possible?
I think you can do this. Ping me tomorrow at scott AT pando DOT com with more detail to see if what you're trying to do is something I've recently done. Scott On 7/10/07, Jack Killpatrick [EMAIL PROTECTED] wrote: Anyone? I ended up giving up (for now) and switched to using thickbox for the modal, but would rather use jqModal for this. FWIW, I don't want to embed the ajax stuff that the modal needs to do in the parent page, because the functionality is something that can be opened from any page in the site, so I want it to be contained in the code for the modal that is opened. - Jack Jack Killpatrick wrote: Hi All, Anyone know if it's possible to make ajax calls from inside a jqModal popup window that was loaded via ajax? I have code like this: $(document).ready( function() { $('#userSwitcher').hide(); $('#userSwitcher').jqm({ trigger:'a.jqmTrigger', ajax:'/pos2/purchase/quick_change.cfm', target:$('#users'), modal:true, onShow:function(h){ h.w.show(); } }); }); a id=aUserSwitcher href=## class=jqmTriggerSwitch/a div id=userSwitcher class=jqmWindow style=width:600px;height:500px div id=users/div /div and have included jqModal.js and jqModal.css in the calling page, then in the quick_change.cfm file I'm doing additional ajax calls: var url = something.html $.get( url, function(template){ etc but that $.get() never fires AND the userSwitcher div loads up real quick, then the whole page goes white and goes nowhere: it just spins. Bug? Is this possible via jqModal? I'm pretty sure I had something like this working with the thickbox plugin a few months ago, but the jquery.com site was down earlier tonight when I went fishing for the latest code to try to use, so I tried using jqModal. TIA, Jack -- .|.. Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: How to Rotate an Image 90 Degrees
I'm developing in Coldfusion, by the way. But, I don't think I can use a server side script for this as I need it to update without a page refresh... There are a number of ways you could do this with a .ajax or similar call. E.g., let's say you write a coldfusion script that accepts as parameters the image path and some rotation parameters (let's say 90, 180 or 270 for degrees of rotation to the right). E.g., http://example.com/rotateimage.cf/?image=foo.jpgrotate=90 ... and have that script rotate the source image, save it to disk, and return the new image (you can set headers to deliver a straight-up image from that URL). If it makes sense for your app, you could cache the rotated images and check the cache first ... but those are details. Then, for example, onclick you could replace the src attribute of an img tag with the rotated version of the URL. Lots of details here, but that might work. You could also have the CF script process the image and return the direct URL to the static file and replace it with that, instead... Scott On 6/27/07, cfdvlpr [EMAIL PROTECTED] wrote: I've taken a look at swfIR and that seems to work. However, I'm not sure that I can change the src of the image with Jquery and have it still work (without a page refresh). Please correct me if I am wrong. I'm developing in Coldfusion, by the way. But, I don't think I can use a server side script for this as I need it to update without a page refresh... -- .|.. Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: John Resig Wikipedia Article
Brian, I actually disagree. I think a person himself is least best able to judge his notability -- since notability, by definition, involves the opinion and reputation of a person held by others. A published author and creator of a very widely used piece of software is certainly notable enough for a wikipedia entry. I encourage those with the time to write something! Scott On 6/26/07, Brian Miller [EMAIL PROTECTED] wrote: I think that our opinion matters less than John's. Before considering writing an article about him, you might want to ask him whether he wants an article to be written about himself. After all, who else knows his history (and how notable it is) better then he does? - Brian The jQuery article on Wikipedia... http://en.wikipedia.org/wiki/JQuery ...has a link to John Resig, but no article has been written. Considering Wikipedia's guidelines, I think John is a notable enough subject to go into an encyclopedia, being the founder of jQuery. What do you all think? -- .|.. Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: How to Rotate an Image 90 Degrees
Reportedly, this script: http://sourceforge.net/projects/excanvas Replicates canvass support in IE6. Anyone use it? Does it work well? Scott On 6/26/07, Aaron Heimlich [EMAIL PROTECTED] wrote: Since when does IE have native canvas support? On 6/26/07, Erik Beeson [EMAIL PROTECTED] wrote: JavaScript is with canvas[1] or SVG[2], both of which don't have enough browser support to Huh? Canvas works on IE6 (with excanvas), IE7, FF since 1.x, Safari and Opera. What other browsers are you looking for? --Erik -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com -- .|.. Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: How to Rotate an Image 90 Degrees
It's a javascript script, not a plug-in. On 6/26/07, Aaron Heimlich [EMAIL PROTECTED] wrote: On 6/26/07, Ganeshji Marwaha [EMAIL PROTECTED] wrote: r u kidding... IE doesnt... excanvas simulates canvas behavior in IE. Which goes back to what I said about their not being enough browser support for the effort to be worthwhile (ON PUBLIC FACING WEB SITES). If you can convince your IE users to download and install excanvas, then more power to you. -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com -- .|.. Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: Macrumors running live udpates of WWDC
I run one site that gets ~ 55k uniques a day with a pretty good global distribution and Safari is 1.2% and another site that gets only about 1000/day and is a more North American, and I get 2.5% Safari users, so I agree 2-3% seems realistic. On 6/11/07, Andy Matthews [EMAIL PROTECTED] wrote: I usually merge two sources for browser stats: http://www.thecounter.com/stats/2007/May/browser.php puts Safari at around 3% and http://www.echoecho.com/ (right column, halfway down) places Safari at around 1% So I'd say that 2-3% might be realistic. But how many uniques make up that list? From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Felix Geisendörfer Sent: Monday, June 11, 2007 2:30 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Macrumors running live udpates of WWDC I have SERIOUS, SERIOUS doubts that there are 18 million people using Safari. I doubt there are that many people using Macs to be perfectly honest.I also think that FF numbers are underestimated and IE numbers overesimtated: See http://www.w3schools.com/browsers/browsers_stats.asp -- Felix -- http://www.thinkingphp.org http://www.fg-webdesign.de Andy Matthews wrote: I have SERIOUS, SERIOUS doubts that there are 18 million people using Safari. I doubt there are that many people using Macs to be perfectly honest. From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Sent: Monday, June 11, 2007 1:11 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Macrumors running live udpates of WWDC 11:09 amSafari On WINDOWS 11:09 am18 Million Safari users Marketshare has climbed to 4.9% IE has 78%, Firefox 15%, others 2% We Dream Big On 6/11/07, Shelane Enos [EMAIL PROTECTED] wrote: That's a feature they've previously announced that I'm looking forward to. On 6/11/07 10:52 AM, ?ⓐⓚⓔ [EMAIL PROTECTED] wrote: 10:49 amusing safari to make widgets from web pages Woo hoo! On 6/11/07, ?ⓐⓚⓔ [EMAIL PROTECTED] wrote: thanks Shelane! I've been tuned in since 10 am!!! On 6/11/07, Shelane Enos [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Macrumors.com http://Macrumors.com is running a continuous AJAX update of the keynote address of WWDC. No more update in 60 seconds countdown. -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ -- .|.. Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: NEWS: 217 Sites Using jQuery and Growing
Ditto for ViralVideos.com ... very lightly and I haven't touched it in months ... but it uses a little jQuery... Scott On 5/25/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: You can add youngisrael-stl.org (a synagogue in St. Louis)--uses jQuery for lots of effects and enhancements Danny Wachsstock On May 23, 7:32 pm, Rey Bango [EMAIL PROTECTED] wrote: I just wanted to let everyone know that the list of sites continues to grow. We are currently at 217 sites (that we know of) and growing, it seems, almost daily. http://docs.jquery.com/Sites_Using_jQuery On behalf of the jQuery project, thank you so much for your continued site contributions. Rey... -- BrightLight Development, LLC. 954-775- (o) 954-600-2726 (c) [EMAIL PROTECTED]://www.iambright.com -- .|.. Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets
[jQuery] Re: Drupal and JQuery
Merc, You might want to look at the work being done on what's called the AHAH framework for Drupal. The guy working on that is doing a lot of thinking about how to correctly integrate jQuery and Drupal's FormAPI in a clean, safe, degradable fashion. The widget you describe is essentially a Drupal form or part of one. Scott On 4/18/07, merc [EMAIL PROTECTED] wrote: Hello everybody, I am in the middle of developing a karma module for Drupal (amazingly, it doesn't have one already and we need one for Free Software Magazine). While I know Drupa quite well, I know nothing about Javascript and JQuery. I am finding things a little difficult, to be honest. I know how Ajax works, but I am a little lost. Basically, I need to display a small voting SELECT for each published comment (-3 to +3). A logged in user should be able to pick a number - the second s/he changes the selected number (0 by default), the browser should send the query to the server (with node id and vote). The server should register the vote. The page at that point should display the registered node where the SELECT was - or a short error message. Believe it or not, I tried to do this and failed miserably. I am looking for somebody out there who would be willing to give me a hand with the JQuery side of the module. I looked at: http://docs.jquery.com/Ajax But I just haven't understood what I should do exactly. Now... I was wondering if there were a good soul out there willing to help me with this. All of the code will be released under the GPL. I am happy to pay $100, to say thank you. Please get in touch with me if you want to lend us a hand - [EMAIL PROTECTED] Thanks a lot for your help! Merc. -- View this message in context: http://www.nabble.com/Drupal-and-JQuery-tf3601206s15494.html#a10059393 Sent from the JQuery mailing list archive at Nabble.com. -- .|.. Scott Trudeau scott.trudeau AT gmail DOT com http://sstrudeau.com/ AIM: sodthestreets