Is there any performance difference between using arrays vs. using JSON?
|
|
# ¿ Feb 26, 2009 20:12 |
|
|
# ¿ May 4, 2024 16:59 |
Lets say I have an element and I use onmouseover and onmouseout to toggle the visibility of another smaller element that is to appear on top it. I'd like for the smaller element to remain visible when the mouse moves over the smaller element. Of course this currently is not the case, since it fires the onmouseout on the main element when I mouse over the smaller element. What is a good solution to this? edit: In case I explained that terribly, I found an example. In gmail, when you are viewing an email and mouse over the green name of the person who sent it, a little box pops up to email/chat/etc that user. When you mouse off the name, if box disappears. If you mouse off the name (and on to the little popup), the popup does not disappear. It seems like I could get it behaving the way I want with a timer, that way I can detect if they mouse off the element and on to the popup. Is there a different approach? fletcher fucked around with this message at 02:59 on Feb 5, 2010 |
|
# ¿ Feb 5, 2010 02:48 |
supster posted:If the element you are binding the hover event to is a parent of the smaller element then you'll always be hovering the parent element even if it's inside the smaller element. Ah, I guess that was my issue. The smaller element wasn't actually a child, they were siblings, since the "main" element was an img. Using setTimeout seems to work great. Thanks for your input!
|
|
# ¿ Feb 5, 2010 03:42 |
Munkeymon posted:I suppose reverse engineering that would be easier than trying to get jQuery to play nice with Prototype :\ Probably not! http://docs.jquery.com/Using_jQuery_with_Other_Libraries
|
|
# ¿ Apr 12, 2010 20:29 |
How do I call a userscript function in the Firebug console?
|
|
# ¿ Dec 1, 2011 20:48 |
Wheany posted:If the function is declared in the global scope, probably just by typing some_function(your, arguments). I'm pretty sure userscripts work basically the same way as any other javascript. code:
code:
code:
fletcher fucked around with this message at 00:13 on Dec 2, 2011 |
|
# ¿ Dec 1, 2011 23:13 |
Funking Giblet posted:Nothing wrong with doing it "by hand", beats loading a few 100k of script. Ehhh I would have to disagree with that. It's only 33KB minified, and you can load it from Google's CDN (meaning it is probably already in the users browser cache anyways). Then you can write his thing as: code:
fletcher fucked around with this message at 20:43 on Jun 26, 2012 |
|
# ¿ Jun 26, 2012 20:41 |
edit: whoops I should probably put this in the jQuery thread
fletcher fucked around with this message at 23:59 on Nov 4, 2013 |
|
# ¿ Nov 4, 2013 22:08 |
The only way to do it is probably as a browser extension, like ColorZilla does.
|
|
# ¿ Nov 7, 2013 00:51 |
Mr. Wynand posted:Oh yeah? You better tell Firefox that. That was the first thing I thought of too. I mean if we can render them with js now, probably not too far off from authoring them in js.
|
|
# ¿ Nov 15, 2013 20:46 |
Even just a -1 will do it, not sure what the deal is there. http://jsfiddle.net/HdL8W/ * removed the 400x400 attributes on the canvas since they were confusing * added a border to the canvas so we can position the rectangle a little easier * put a space between new & Array instead of newArray to get rid of javascript error edit: oh probably because the pixels are 0 indexed so a size of 250x250 gives you pixels 0 to 249 to work with so you want it to be (244, 244) to (249, 249) for the bottom right rectangle fletcher fucked around with this message at 01:48 on Dec 13, 2013 |
|
# ¿ Dec 13, 2013 01:45 |
Pollyanna posted:...Oh Sorry, I'm not used to JSON. What I do at the moment is take a massive array and create an <option> tag for each element, which slows everything the gently caress down. I was hoping to use Select2's data functions to speed that up, but I may be a little lost. In your template, assign it to a javascript variable: code:
|
|
# ¿ Jan 10, 2014 04:55 |
Wheany posted:Can you seriously not debug greasemonkey scripts like a civilized person? Is dumping variables to the console the only way to know what the hell is going on inside a script? In Chrome I can go to Sources->Content Scripts->apbdobdcekdieksnciesxksdiskkdsisdi->script.js and see my greasemonkey script and set breakpoints and stuff In Firefox/Firebug I'm also able to see my script in the sources tab, breakpoints seem to work fine there too I have // @grant window in my script, not sure if that impacts the ability to use the debugger or not
|
|
# ¿ Jan 23, 2014 22:54 |
Maybe your webserver is returning the file with the wrong charset? Check the response headers on the network tab:
|
|
# ¿ Jan 25, 2014 04:46 |
That's what you're supposed to do in Flask when it's Python code that is being executed server side, but you're in JavaScript land and that code is executed by your browser. JavaScript has no idea about Flask stuff and what url_for() is.
|
|
# ¿ Jan 28, 2014 03:54 |
q1 being in array index 0 is confusing. What do you plan on doing with radioArray after this?code:
|
|
# ¿ Mar 6, 2014 00:10 |
Right on. The alerts can be handy for debugging. Are you familiar with the developer tools that are built into modern browsers? (hit f12!) I like to use console.log('hi there') and console.dir(myObject) when debugging things, it can be a little less annoying than the alerts. If you do need the array, I would suggest with going with something like this: code:
|
|
# ¿ Mar 6, 2014 00:47 |
adserver.company.com and www.company.com are both subdomains of company.com so you don't have to worry about cross-domain anything (which is good because cross-domain cookies do no exist). Take a look at the domain attribute of the cookie string. You'll want to specify domain=.company.com so the cookie can be used by all subdomains of company.com.
|
|
# ¿ May 6, 2014 01:44 |
I'm running into some JS errors after incorporating dropzone.js into my app. Everything works fine in dev mode (separate & unminified assets) but after I do a real build (JS assets are combined & minified using uglifyjs) I run into "undefined is not a function". So I'm assuming it's something to do with the combine/minify step but I'm having a hard time narrowing it down further. edit: I added a semicolon to the end of the dropzone.js file and it seems to have fixed the issue...but surely somebody else would have run into that issue if the problem was in fact caused by dropzone.js. So I'm not entirely convinced I have the correct fix, if anybody has some advice for me. fletcher fucked around with this message at 03:06 on May 20, 2014 |
|
# ¿ May 20, 2014 02:05 |
^^ Looks like it was in fact a bug in the dropzone library: https://github.com/enyo/dropzone/issues/589
|
|
# ¿ May 21, 2014 19:19 |
'a' is the index of the array (i.e. data[0], data[1], etc) 'b' is the object at that array index Check out this fiddle for an example: http://jsfiddle.net/EuSms/1/
|
|
# ¿ Jul 1, 2014 23:10 |
fuf posted:Is this the right place for obscure Node questions? In the "created" handler that picks up the "new dirctory" event, can't you just list the files in that new directory and do whatever you want with them?
|
|
# ¿ Jul 25, 2014 20:19 |
Raskolnikov2089 posted:I've been staring at this for the last 1/2 hour trying to figure out where my syntax error is. You're missing a closing parenthesis on the line with the if statement
|
|
# ¿ Jul 26, 2014 03:00 |
Raskolnikov2089 posted:Ughhhhh okay, thats enough for the night. Is your debugger not giving you useful error messages? All I did was paste it into jsfiddle, open the Firebug console, hit Run, and it gave me a very clear error message:
|
|
# ¿ Jul 26, 2014 03:27 |
0zzyRocks posted:I wrote a jQuery plugin to handle styling of a file input. Check it out, it hasn't been updated in a while but it may be of some use to you. https://github.com/ozzyogkush/jquery.styledFileInput I appreciate the thought, but...it hasn't been updated in over 2 years and there's still no documentation or even an example of what it does? edit: oh there is an example.html, make it a live demo!
|
|
# ¿ Aug 29, 2014 00:11 |
Wheany posted:Hmm, since I would be receiving HTML with Xmlhttprequest, I guess I could just replace img src with img data-src or something before using innerhtml to create a DOM tree, then set the src attribute only on the images I actually want loaded. I've done this, it worked out pretty well
|
|
# ¿ Sep 17, 2014 10:17 |
Storgar posted:I dunno... Just seems like a natural way of doing it to me? I have a REST api where I can get a list of posts. I want to make that the only method of obtaining such objects (rather than a having a second way of populating the page with a server-side function outside the REST api). How do people usually do it? Seems fine to me. Also, what percentage of users even disable javascript? Is it even worth the effort for graceful degradation these days?
|
|
# ¿ Nov 27, 2014 04:13 |
|
|
# ¿ May 4, 2024 16:59 |
Somebody wanted inline table editing in our Confluence instance for work so they added a plugin for it. It drives me nuts though, so I'm trying to write a userscript to disable it on all pages. Currently the only way we can disable it with a built in mechanism is on a per-page basis. It seems like Jira takes all these plugins and combines them into a batch.js file. It's basically got a setTimeout in there looking for tables so it can apply the inline editing on top of them I'm trying to come up with an easy way to short circuit this thing in a userscript so it doesn't work anymore but I couldn't think of a simple way to do it. Any suggestions?
|
|
# ¿ Oct 20, 2020 23:50 |