|
Benjamin Black posted:Uh, but the class is only ever used once on the page. Wow, you sure are a nice person. Glad you got it all figured out, and good luck in all future endeavors.
|
# ? Feb 1, 2012 03:25 |
|
|
# ? May 16, 2024 15:32 |
|
Lumpy posted:Wow, you sure are a nice person. Glad you got it all figured out, and good luck in all future endeavors. Did I come off that dickish? If I did I'm sorry. Thank you for helping me. The Man From Melmac fucked around with this message at 05:16 on Feb 1, 2012 |
# ? Feb 1, 2012 05:11 |
|
Benjamin Black posted:Uh, but the class is only ever used once on the page. Just pointing out that this doesn't matter. If you build an array with a single value it is still an array, it doesn't care that it doesn't "need" to be an array. This is pretty essential to understand for all programming, not just Javascript. Any time you run a "elementsBySomething" (other than Id) it's going to return a collection, even if it's just a single item.
|
# ? Feb 1, 2012 15:09 |
|
subx posted:Just pointing out that this doesn't matter. If you build an array with a single value it is still an array, it doesn't care that it doesn't "need" to be an array. This is pretty essential to understand for all programming, not just Javascript. I was referring more to the comment that mentioned 'ALL h1 tags within the banana class will have their text replaced' (or something to that effect), which isn't really a problem for the site I'm working on.
|
# ? Feb 1, 2012 21:55 |
|
peepsalot posted:Or don't because IE up to and including IE 8 do not support it. Try document.querySelector or document.querySelectorAll for IE8 and above, allows some CSS type selectors as well.
|
# ? Feb 1, 2012 23:23 |
|
I have an issue I've been trying to wrap my head around all day and am hoping someone can point out where I've been dumb. I wrote a custom script to listen to events from a media player (JW Player). I set up an event listener like this code:
code:
code:
Now, all of the above works just dandy with IE9 and every other regular browser. Of course, IE8 and lower don't (shocking!) because those browsers don't know what the gently caress addEventListener, etc are. So I re-wrote some IE8/lower specific code like this: code:
I don't know nearly enough about it - can anyone tell me how the document.dispatchEvent routine, etc I've got can be translated into something that works with IE8/lower? I know at some point I am just going to attack this with a hammer and redo the whole thing in JQuery-land, but that's a bigger project than I have time for at the moment. Thanks for any advice! Edit: I did end up re-doing it in JQuery, that turned out to be the right solution. Ixian fucked around with this message at 15:47 on Feb 8, 2012 |
# ? Feb 2, 2012 03:54 |
|
I'd like to create two fields: an input box and a multi-line select box. I'm using jquery, and I'd like to search the selectbox based on input in the text field. How would I go about this? I've seen it done before, http://www.realestate.com.au/buy (Click a state first and type any suburb into the box). Any suggestions or help would be much appreciated. I don't want to filter the contents of the selectbox, but rather have it automatically scroll down to the closest match to the input field value.
|
# ? Feb 2, 2012 04:04 |
|
SpaceAceJase posted:I'd like to create two fields: an input box and a multi-line select box. I didn't see what you were asking for on that link. But I did some investigation because this is an interesting question: You can set where the listbox is scrolled to: $("select")[0].scrollTop = 100 That'll make it scroll 100px down. The issue I ran into is that there seems to be no way to determine the position accurately of each list element. $("option")[0].clientHeight $("option").eq(0).outerHeight(true) Both of these return 0. I can only assume the height is 100% browser/platform dependent and every static number would be incorrect. Apparently you can scroll to an element by selecting it but that did not work in my tests, at least with a multi-select. So apart from rolling your own control so you know the heights of the list elements, this does not seem possible.
|
# ? Feb 5, 2012 18:35 |
|
jQuery provides some nice functions like offset and position. offset() will give you an elements position in the document, while position() will give you the elements location within its parent. You can also retrieve the calculated height of each element through calls to height. Also, there is a jQuery function scrollTop. Essentially you would find the first matching element, and then call $('#myselectbox').scrollTop($(selector).position().top); Though I'm guessing you want to animate this, so it is just a matter of animating the scroll top to the appropriate position.
|
# ? Feb 6, 2012 10:39 |
|
Any of you ever look in-depth into browser form-caching? I have an unanswered stackoverflow question that's left me kinda stumped. Can't really find any useful specs or documentation on it - the terms just mean too many other things.
|
# ? Feb 7, 2012 18:26 |
|
I have never looked in to form caching, but what do you mean in the Stack Overflow question when you say:quote:I was hoping I could save the "new" widget count in a hidden field and then on domReady simply generate the missing input fields and assign them their original names and IDs but this doesn't seem to work, browsers don't seem to want to do anything with generated content. Dynamically generated HTML is definitely used all the time. Could you clarify what the problem you are running in to at this point is exactly?
|
# ? Feb 7, 2012 21:27 |
|
Mr. Wynand posted:Any of you ever look in-depth into browser form-caching? I have an unanswered stackoverflow question that's left me kinda stumped. Can't really find any useful specs or documentation on it - the terms just mean too many other things. In terms of the familiar browser behavior, the term I think you're looking for is 'autocompletion', specifically 'session history caching' (using mozilla's terminology). Googling turned up this mozilla doc page (the introduction talks about the browser behavior in general, though the subject of the page is about how to turn it off by using the form attribute). From your stack overflow question: quote:Overall this is probably sensible enough, but is there maybe a way to interact with this form cache mechanism directly? I don't think so. However, even if there was a way to control it, you'd still have to deal with the fact that user's can turn off that behavior in their browser settings. That is, if the caching behavior you're looking to implement is central to your widget's functionality, you probably don't want to rely upon (or modify, somehow) that built-in browser behavior. quote:One possible work-around would be to store not only the new item count in a hidden field but some sort of serialization of the full content of the new widgets. Should work but it's a fair bit of additional effort :/ Yeah, something along those lines. If you're working with a popular framework (jquery/mootools/etc), there's probably a plugin out there that does something very close to what you want - Sisyphus, for example.
|
# ? Feb 7, 2012 22:03 |
|
This feature has been requested: * They want a county map of Wisconsin. * They want to be able to click a county and highlight it. * They want to be able to highlight multiple counties. Now, I have a couple of options. One: * Find a map of the counties of Wisconsin (done) * Make an image map of it (not done) * Create or find a Javascript to color in the image mapped portions. This would not be precise, as I'd either have to dumb down some of the county borders, or accept that the coloring would not fill in the counties fully. Two: * Find an SVG of the counties if Wisconsin (done) * Find a script that allows on-the-fly changing of a county's color. This would be precise, due to the fact that it's an SVG. Which sounds more sane, and does Javascript or jQuery exist for either one?
|
# ? Feb 15, 2012 17:55 |
|
Golbez posted:* Create or find a Javascript to color in the image mapped portions. This would not be precise, as I'd either have to dumb down some of the county borders, or accept that the coloring would not fill in the counties fully. You don't need to go this far, you can just put a colored dot on the image to indicate highlighted sections.
|
# ? Feb 15, 2012 18:10 |
|
baquerd posted:You don't need to go this far, you can just put a colored dot on the image to indicate highlighted sections. They want the whole county filled in, though. This is to create a printable pretty map.
|
# ? Feb 15, 2012 18:13 |
|
Another option would be to stack a transparent GIFs/PNGs for each county atop each other, dynamically adding or toggling each's visibility according what's been selected. Or just indicate selection through changing the styling of their textual labels.
|
# ? Feb 15, 2012 18:15 |
|
I've never used this, but it seems pretty neat from the demo http://davidlynch.org/blog/2008/03/maphilight-image-map-mouseover-highlighting/
|
# ? Feb 15, 2012 18:18 |
|
You could try something with overlays in Google Maps Just from a quick Googling, this might help: http://elliottmediagroup.com/2011/01/24/maps-api/
|
# ? Feb 15, 2012 18:21 |
|
Blinkz0rz posted:You could try something with overlays in Google Maps I thought about that, but since this is going out in commercial literature there's probably license issues with that. And I think they want the map with all the county borders. And now that I think of it, the final step of this - getting a PDF printout of it. Like, within other PDF sheets. In other words, having to pass all this data back to the server. Hrmmm. Edit: I'm a little surprised at saying this but the idea of using a transparent image for each county seems to make the most sense, and it's the easiest to handle server-side as well. Thankfully this is Wisconsin and not Texas so I don't have to manage 250 pictures. Golbez fucked around with this message at 18:37 on Feb 15, 2012 |
# ? Feb 15, 2012 18:33 |
|
Even if you already decided to do this with transparent pictures... From Javascript perspective, svg is pretty close to html. Just add a stylesheet to the the svg-file: code:
code:
code:
|
# ? Feb 26, 2012 11:02 |
|
Golbez posted:This feature has been requested: use raphael.js with option #2 http://raphaeljs.com/australia.html
|
# ? Feb 26, 2012 14:16 |
|
Deus Rex posted:use raphael.js with option #2 Thanks for the response, though I ended up getting mapper.js and heavily modifying it for what I needed.
|
# ? Feb 26, 2012 18:27 |
|
I need to scrape the page type, product ID, and similar info from pages like this, this, this and others from the same platform. The most nearly obvious way to do it, since the page structure is less than consistent, is to check the URL using window.location.search and parse it from there. I have code:
code:
Is there a good way to parse out just the PROD or CTGY or whatever? I can use string.search() or .match() to find "Product_Code=BUTTS", but I can't just parse out the "BUTTS". Edit: Apparently it is possible to just parse out the "BUTTS". /product_code=(\w*)/gi. Still don't have a good place to test everything. darthbob88 fucked around with this message at 00:17 on Feb 27, 2012 |
# ? Feb 26, 2012 23:57 |
|
Do you not keep a local copy of the website for you to test on? If you really have no other way, open up the firebug or chrome js console and start trying out your code.
|
# ? Feb 27, 2012 01:16 |
|
It's not my website, the company I work for is going to provide a recommendation service to the owners of that site, so I'm three degrees removed from the actual owner. Been saving copies to my computer so I can work on it locally, but there's a difference between C://path/to/file and http://www.the.literal?url. Had quite forgotten that Chrome's console can do that sort of thing, I've only been using it to see what errors have come up. Will try that now.
|
# ? Feb 27, 2012 03:32 |
|
I cannot for the life of me get jQuery Mobile and Backbone.js to play nicely with each other. I am too much of a newbie jQM, Backbone, and JS to really know what I'm doing, and the latest complete, easily-googled example of integration is a year old and obsolete, or a months-old article hinting at a part 2 which never materialized. I'm desperate to get this working. Can someone help me out? (I also happen to be using precompiled Handlebars templates, and am planning on using PhoneGap to deploy it as an app to the App Store + Android market.)
|
# ? Mar 6, 2012 02:04 |
|
What kind of problem are you having?
|
# ? Mar 6, 2012 05:00 |
|
ComptimusPrime posted:What kind of problem are you having? Well, I scrapped the code because my dealings with it devolved into cargo-culty copying of snippets to alter its behavior. Specifically, jQuery Mobile's responding to URL changes no matter what combination of the following I use: code:
So I'm basically at a loss because I have a very weak concept of how jQM works, how Backbone works, and how they interact, because I usually throw poo poo together and use it and fix it until it works before focusing on learning and improving the conceptual integrity and clarity of my understanding and the project itself. --- Well gently caress me. Someone wrote a blog post and pushed to GitHub 13 hours ago finally explaining this. http://coenraets.org/blog/2012/03/using-backbone-js-with-jquery-mobile/ https://github.com/ccoenraets/backbone-jquerymobile Hallelujah. I am saved.
|
# ? Mar 6, 2012 05:29 |
|
Holy poo poo, I thought the "F12 Developer Tools" was actually just some weird string error nobody ever bothered to fix. Oh, Microsoft
|
# ? Mar 11, 2012 20:06 |
|
I assume it was initially a placeholder name that never got changed, since the alternative is just too dumb.
|
# ? Mar 11, 2012 21:49 |
|
I'm trying to learn backbone for a small project, and I am really having a tough time working through it. What I need is to be able to grow a chain of content down, and then be able to collapse it back upwards, where the only expand/collapse buttons that are enabled are on the very last item. I have it sort of working bare-bones now, and I was hoping some experts could give it a quick glance and point out all the horrible things I'm doing wrong. Css: http://pastebin.com/RYbwKTC0 Coffeescript: http://pastebin.com/M9pY7mpc Javascript for the Coffeescript: http://pastebin.com/eCYcgx8H I would put it up an a demo but I don't know a quick free place to set something like that up. Not exactly an online demo, but here is everything in a nice little zip file. http://www.mediafire.com/?smw5j4nfw5uka94 Online demo with source! http://test.isawalion.com/ Atimo fucked around with this message at 16:34 on Mar 14, 2012 |
# ? Mar 12, 2012 07:25 |
|
I've been a bad posted and forgot to check in with my question, sorry.Orbis Tertius posted:I don't think so. However, even if there was a way to control it, you'd still have to deal with the fact that user's can turn off that behavior in their browser settings. That is, if the caching behavior you're looking to implement is central to your widget's functionality, you probably don't want to rely upon (or modify, somehow) that built-in browser behavior. It's not "central" no, and the whole point is to try and maintain the user's expectation about widgets - i.e. if i hit refresh (without shift) or go back my widget state should be where I left it. If they turned off this feature then they obviously do not expect this and all is well. quote:Yeah, something along those lines. If you're working with a popular framework (jquery/mootools/etc), there's probably a plugin out there that does something very close to what you want - Sisyphus, for example. Yeah so going through LocalStorage is actually a bad thing in this case because that would work against the usual behavior (e.g. shift refresh will fail to clear the value). Anyway this isn't a huge deal. I've found it a very convenient and useful nicety in the past, but it kinda falls on its face once you generate series of fields
|
# ? Mar 12, 2012 22:37 |
|
ComptimusPrime posted:I have never looked in to form caching, but what do you mean in the Stack Overflow question when you say: Well of course it's used, but it doesn't seem to be noticed by the browser's form cache mechanism (the one that preserves your form through refreshes and back-navigation)
|
# ? Mar 12, 2012 22:38 |
|
Is there any code I can tack onto the default Twitter website widget to get it to cycle through say the last 5 tweets or so dynamically instead of showing only the latest one statically? Here is my code Thanks!
|
# ? Mar 12, 2012 22:50 |
|
I have been given a nice problem to solve and have no idea what I am going to do... I need to us the JustGiving Javascript API to enable functionality to a flash app. Is there a way for me to utilise JS in actionscript 3? Here is a link to the API if anyone fancies a look. https://api.justgiving.com/docs The project is for a major charity who have zero technical people to help me out, so its goon power or nothing.
|
# ? Mar 26, 2012 22:16 |
|
You can use ExternalInterface to call js from flash and vice versa. http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html
|
# ? Mar 26, 2012 23:03 |
|
5TonsOfFlax posted:You can use ExternalInterface to call js from flash and vice versa. thanks 5TonsOfFlax OK so this should't be too hard then? Where would you recommend hiring someone to do this small snippet? A Javascript programmer or a flash programmer?
|
# ? Mar 27, 2012 11:08 |
|
thegasman2000 posted:thanks 5TonsOfFlax You'll need both (or one person who can do both, which is fairly common). You'll need AS guy to expose any Actionscript methods that JS needs to call via externalInterface (and maybe write them if what you want to do isn't already in the AS). You'll need JS guy to be aware of the methods that were exposed, and to write code to call them based on page events. If the AS stuff already exists in the flash file, then AS guy literally just adds one line per method to the actionscript file and writes down the 'public' names he gave them.
|
# ? Mar 27, 2012 13:05 |
|
Lumpy posted:You'll need both (or one person who can do both, which is fairly common). You'll need AS guy to expose any Actionscript methods that JS needs to call via externalInterface (and maybe write them if what you want to do isn't already in the AS). You'll need JS guy to be aware of the methods that were exposed, and to write code to call them based on page events. Are you that guy?
|
# ? Mar 27, 2012 13:09 |
|
|
# ? May 16, 2024 15:32 |
|
thegasman2000 posted:Are you that guy? Uhh.. I could be, I guess. PM me with your contact info and I'll ask you some questions to see if I am. Mainly a question of time / timing; the code will be no problem, it's if I have the time to do it by the time you need it. OTherwise, there are lots of "that guy" here in goon-land.
|
# ? Mar 27, 2012 16:57 |