|
I can't figure out why the result would be i = 0:code:
|
# ¿ Jun 2, 2009 22:54 |
|
|
# ¿ May 6, 2024 03:27 |
|
Lumpy posted:Because you have i set up as a global. Because you didn't use this or var in front of it. Fucks sake. I promise I'll stay home when I'm sick next time.
|
# ¿ Jun 3, 2009 15:52 |
|
If you're using those with the for loop form for(something in somethingElse), Chrome will apply them in whatever order it wants rather than the one you expect. Opera may as well, but I know Chrome does. Supervillin, what options did you use? I'm not getting any complaints about unescaped characters (nor do I see anything wrong with the expressions myself).
|
# ¿ Jan 15, 2010 18:21 |
|
I have this code in a frame (the kind with a frameset and everything):code:
edit: unfucking mixed newlines Munkeymon fucked around with this message at 21:41 on Mar 30, 2010 |
# ¿ Mar 30, 2010 18:23 |
|
Nigglypuff posted:Try $(window).load(...) instead. That does work and .ready() probably does as well. I'm just an idiot for copying and pasting an old version of Google's URL. _gat didn't exist when I was calling it because urchin.js doesn't define a _gat object - ga.js defines a _gat object. Munkeymon fucked around with this message at 18:06 on Mar 31, 2010 |
# ¿ Mar 31, 2010 17:59 |
|
I'd like to replace this junk:code:
|
# ¿ Apr 5, 2010 23:01 |
|
Supervillin posted:Pretty sure Prototype will treat that argument as an ID, so if you try $('whatever') it returns document.getElementById('whatever'), not window.whatever or document.whatever. So it's probably returning null. That's the impression I got, too, but getElementById does return null while the dollar function actually returns an element. Edit: maybe the Prototype $() has to return something other than null since null wouldn't chain. Anyway, it's not a huge deal - just one of many ugly things. Munkeymon fucked around with this message at 15:03 on Apr 6, 2010 |
# ¿ Apr 6, 2010 14:59 |
|
Is there a more reliable way of finding the viewable pixel real estate than Prototype's viewport methods? I'm trying to make images shrink to fit the viewport but after a resize, the methods report the document dimensions instead of the dimensions of the window. Since HTML flows down like it's going out of style, I end up with wacky numbers for viewport height (ie bigger than my monitor) and pictures that flow off the screen given otherwise working resize code. This behavior doesn't seem to be entirely consistent since it was working fine at the end of last week in my tests and this morning the same tests are failing.
|
# ¿ Apr 12, 2010 15:46 |
|
Lumpy posted:jQuery(window).height(); I suppose reverse engineering that would be easier than trying to get jQuery to play nice with Prototype :\
|
# ¿ Apr 12, 2010 20:20 |
|
fletcher posted:Probably not! Oh nice - of course the test server just took a poo poo so I can't do anything with it but, hey, at least now I know.
|
# ¿ Apr 12, 2010 21:35 |
|
dancavallaro posted:What is an example of a use case where it makes sense to use == over ===? Do you find that it matters in most situations? Serious question. The code I deal with at work is terrible in many ways and depends on the ambiguity that type coercion provides to not fall over constantly, but I still find that, even when I think about it, I almost never see the point in putting the extra restriction on the conditional. I mean, do I really care that the answer was a string '2' instead of a Number 2 when either one can and will work? I know that's a trivial example, but I'm having a hard time thinking of an instance where it mattered.
|
# ¿ Sep 1, 2010 20:04 |
|
Does anyone know of a premade plugin or code chunk, preferably for scriptaculous, that I can use to make the content of a div drag-scrollable? Think PDF or google maps style navigation where you click and yank the whole of the content around. All I can find on Goolge is poo poo about building a drag and drop interface and I know about Draggable, but it's not really meant for this. When I drag the content up past the top and/or left edge of the viewport, the canvas shrinks and the scrollbars become useless. Other than that, it's almost perfect and the snap effect using a callback is letting me do some neat things pretty easily.
|
# ¿ Sep 21, 2010 23:35 |
|
Golbez posted:Oh, I wasn't saying you were disagreeing, I was just astonished that anyone would have used such comments at all these days. Bugzilla has no business hiding its Javascript from IE 2.0. It might have made sense during the Clinton administration, but not any longer. It's almost as if Bugzilla is really freakin old
|
# ¿ Oct 4, 2010 19:11 |
|
Gordon Cole posted:http://www.iokat.com/posts/2/a-javascript-prototypal-inheritance-pattern-that-doesnt-suck You mention Firefox in the article, but even the latest 3.x doesn't seem to support Object.create() so you might want to explicitly mention which browsers (or just which JS engines) it's going to work on if it's that badly supported.
|
# ¿ Nov 15, 2010 22:52 |
|
Lumpy posted:Javascript will add semi-colons for you. And that's a Bad Thing. A new guy at my company uses GNU style brace formatting and forgets semicolons all the time. When writing Javascript. Yeah, everything you just thought and probably more.
|
# ¿ Jan 5, 2011 15:51 |
|
Lumpy posted:
snapshotLength is the number of items in the snapshot returned by the document.evaluate call that's doing an XPath query on the current DOM. I don't know for sure why they don't stuff them into a regular array, but I'd guess they wanted to make it extra clear that you can't just add more nodes into the result of evaluate and expect them to show up in the DOM. https://developer.mozilla.org/en/XPathResult It's pretty neat because you can use it like jQuery's selectors* when you write a user script for browsers that aren't total garbage. *Actually, I read that jQuery's selector engine just uses XPath queries on browsers that support them, but have been to lazy to verify
|
# ¿ Jan 17, 2011 17:07 |
|
I wrote this to make it easier to slap a quick canvas element into jsconsolecode:
*I tired using my IP, too in case it was a security thing, but no dice.
|
# ¿ Mar 8, 2011 17:25 |
|
Flamadiddle posted:Is this standard behaviour for all uses of .match? I understand that the whole string matches the expression, but I don't want to capture that match... Should I be using a non-capturing group around the whole expression? If you use the global flag on the expression, the match object will only contain matching subsequences. Using the expression /\d{2}(?=\/)/g on your previous example, you only get "14" and "03" back in the match object. All that said, why is it a problem to have the whole string in the match object?
|
# ¿ Mar 14, 2011 14:57 |
|
Knackered posted:It's an anonymous function that's executed straight away, so you don't need to give the function a name. Remove the name and it works just fine in Opera. I was going to extend it to delete the old canvas and load a new one, so I wanted the creator to have a name. Then I started messing with it to get it to work and ended up leaving the name on. Anyway, I forgot to post a follow-up, but it turns out the Opera just won't load it from the local machine over HTTP. Sticking it on my cheapo web host fixed the problem. Munkeymon fucked around with this message at 17:29 on Mar 22, 2011 |
# ¿ Mar 22, 2011 16:54 |
|
Is validationErrors is defined somewhere? You know you can use try/catch blocks, right? Wrap that whole thing in a try block and alert the exception's message property: code:
|
# ¿ Mar 23, 2011 03:01 |
|
I'm not great at CSS, but I think that's what's doing it and not the JS - especially since when I open your example page in FF, I just get two JavaScript errors that indicate the plugin code isn't running:code:
Munkeymon fucked around with this message at 23:10 on Mar 24, 2011 |
# ¿ Mar 24, 2011 23:08 |
|
If that's all you want to do, just set the innerHtml property to an empty string (or a space if the empty fucks up somehow): document.getElementById('inputfieldcellPHONE').innerHtml = ' ';
|
# ¿ Apr 14, 2011 22:23 |
|
Are you sure you're doing this when the DOM is loaded? If you just stick it in a bare script node in the header, it will run before the browser is ready to manipulate the HTML.
|
# ¿ Apr 14, 2011 22:42 |
|
http://www.webreference.com/programming/javascript/onloads/ might help with the onload thing
|
# ¿ Apr 14, 2011 22:51 |
|
Use http://nodejs.org/docs/v0.4.8/api/fs.html#fs.readdirSync and a normal for loop, then
Munkeymon fucked around with this message at 15:30 on Jul 5, 2011 |
# ¿ Jul 1, 2011 20:32 |
|
Edit: nevermind - it wasn't anywhere near what I was thinking it was and this question was totally invalid
Munkeymon fucked around with this message at 16:37 on Jul 5, 2011 |
# ¿ Jul 5, 2011 16:34 |
|
I'm looking at using a canvas element to do some animating that involves rendering text on a slant. I get that easel could make it slightly less annoying to render text into a canvas and then render that canvas rotated on a different canvas, but I was hoping there would be a library that has that sort of functionality encapsulated already. Anyone know of one? Edit: managed to misread the easel docs. I think it'll do what I need no prob Munkeymon fucked around with this message at 22:48 on Aug 17, 2011 |
# ¿ Aug 17, 2011 22:45 |
|
That would use just as much memory which was what everyone seems to be concerned about. A DAWG (which is a specialized trie) is the best way to store a list of words for quick membership checking. If it's a static list, the code could be loaded as a pre-built object graph and that would be very quick. Unless you have a huge list, Lumpy's idea is probably not going to be an issue for a modern browser on reasonably fast hardware. Still could be fun to implement if you like to do that sort of thing. edit: clarity Munkeymon fucked around with this message at 19:19 on Aug 18, 2011 |
# ¿ Aug 18, 2011 15:16 |
|
ynohtna posted:http://jsfiddle.net in conjunction with your browser's web developer tools is a good start for interactive exploration. If you just want to poke at the JavaScript language without messing with HTML, there's also http://jsconsole.com/ and http://www.jconsole.com/
|
# ¿ Oct 18, 2011 15:15 |
|
Wheany posted:IE has F12 developer tools (or whatever the gently caress they're called) built-in It really is just called 'F12 developer tools' of all things
|
# ¿ Dec 29, 2011 22:41 |
|
sonic bed head posted:A Javascript Object - an object ls basically a key-based lookup. An array is a special case of object where it acts a lot like a C# List as long as you use numbers in the square brackets, will tell you how big it is (or let you tell it how big to be) using the special length property and has a bunch of nice helper methods stuck on.* You can still tack arbitrary stuff on to an array just like an object if you really want to: code:
|
# ¿ Jan 6, 2012 21:37 |
|
subx posted:I think things just not being typed is where I get confused. Just being able to tack random poo poo onto a variable feels weird. It can be a lot of fun when you get used to it
|
# ¿ Jan 6, 2012 22:32 |
|
Sagacity posted:What's dodgy about Pouet? It's quite awesome. It looks and feels like oldschool sites. Not that I would know anything about those...
|
# ¿ Jun 4, 2012 16:58 |
|
thelightguy posted:Considering that the demoscene grew out of the warez scene, why wouldn't they share similar visual elements? I'm not complaining - just explaining
|
# ¿ Jun 5, 2012 21:17 |
|
This here is the Javascript thread. Javascript actually has nothing to do with Java - it was named that way for marketing purposes (Java was supposed to be the Next Big Thing at the time). Here is the Java thread: http://forums.somethingawful.com/showthread.php?threadid=2780384 That said, you probably don't need to download API docs if you can get to them in a web browser, so I don't know why that would be part of a guide at all.
|
# ¿ Oct 4, 2012 20:04 |
|
neogeo0823 posted:I'm pretty sure this is the right place to ask this, but if it's not please let me know and I'll take it elsewhere. I'll also preface this by saying I have absolutely zero programming knowledge. If you're thinking about dumping many user automatically, this is probably a job for something like scrapy rather than a GreaseMonkey script
|
# ¿ Dec 7, 2012 16:40 |
|
neogeo0823 posted:After looking at the overview of that program, I'm not sure that it would work the way we need it to. The reason I was thinking of going with a GreaseMonkey script was because we've got a couple of those that we run for other things already, and there's a couple bits of important info that can only be viewed by the user logging in and viewing their own profile. This is something every user does every time they log in, so having our members install a script that adds all the info to a spreadsheet as they log in solves a lot of headaches about having to make sure the data is both accurate and up to date. Oh, I think see what you're getting at: you want everyone's browser to upload their information to some central location when they happen to log in because only they can see it, right? I was thinking you wanted to scrape a whole lot of other peoples' information in mass by visiting their profiles with a script enabled, which would be fairly silly.
|
# ¿ Dec 7, 2012 20:17 |
|
Wheany posted:Well, you can definitely scrape that information from the page when a player visits the page with their browser. Then you could save the data into the browser's local storage automatically. It's at least not a terrible idea. Sure, it's doable and it'd work, but it's more, repetitive work than writing a scraper (when that's possible - obviously not in this case).
|
# ¿ Dec 11, 2012 23:40 |
|
Boz0r posted:Thanks, I get it now. I think the code is supposed to be a horrible mess to demonstrate the variable scope. We had to guess whether the result would be 1, 2, 3 or 4. http://bonsaiden.github.com/JavaScript-Garden/#function.scopes Specifically under Hoisting: quote:JavaScript hoists declarations. This means that both var statements and function declarations will be moved to the top of their enclosing scope. Your original example becomes something like JavaScript code:
edit:ed to better reflect reality. Also, holy poo poo I can finally hit tab in the editor without it selecting a different page element! Munkeymon fucked around with this message at 21:08 on Jan 22, 2013 |
# ¿ Jan 22, 2013 19:48 |
|
|
# ¿ May 6, 2024 03:27 |
|
Huh, I'm surprised I didn't notice that during my stupid JavaScript tricks exploratory phase.
|
# ¿ Jan 22, 2013 21:04 |