|
v1nce posted:it's probably not that hard to make this native java script: JavaScript code:
|
# ? May 11, 2015 10:13 |
|
|
# ? May 16, 2024 17:49 |
|
huhu posted:Just looked up what a parser was... don't think that's what I'm doing. Just to be explicit, read this (http://stackoverflow.com/questions/8227612/how-to-create-document-objects-with-javascript), look at the response than mentions var doc = (new DOMParser).parseFromString(markup, mime_type), and then use vince/wheany's JQuery stuff to populate the array, rather than looking at the HTML input as a string yourself. Make the browser do the work. Bruegels Fuckbooks fucked around with this message at 13:20 on May 11, 2015 |
# ? May 11, 2015 13:13 |
|
Wheany posted:code and stuff You know that thing I told you not to do? Here's how to do it: code:
I am an enabler Bruegels Fuckbooks posted:Much better advice
|
# ? May 11, 2015 13:25 |
|
v1nce posted:The main difference is the regex method ignores HTML comments and picks up everything that even looks remotely like an element.
|
# ? May 11, 2015 13:53 |
|
could doJavaScript code:
JavaScript code:
JavaScript code:
RobertKerans fucked around with this message at 15:26 on May 11, 2015 |
# ? May 11, 2015 14:16 |
|
...at least I know a bit more about strings. Only spent like 7 hours in the wrong direction but what do you really learn if you get it right the first time? Thanks for the suggestions. They do seem much better uses.
|
# ? May 11, 2015 15:50 |
|
What's a good parallax scrolling plugin? I've tried https://github.com/Prinzhorn/skrollr (couldn't get scrolling to work on mobile) and https://github.com/markdalgleish/stellar.js (looks bad on mobile and is buggy)
|
# ? May 11, 2015 17:03 |
|
"Looks bad and is buggy" should be the warning label on any library that tries to hijack scroll behavior. Just say no.
|
# ? May 11, 2015 17:16 |
|
Do parallax background images really count as hijacking scroll behaviour? They are kind of a design necessity at this point so I definitely need to come up with something.
|
# ? May 11, 2015 17:18 |
|
If they are just animated constantly its not scroll hijacking. That crap people do with parallax backgrounds on scroll is janky as gently caress.
|
# ? May 11, 2015 18:25 |
|
huhu posted:...at least I know a bit more about strings. Only spent like 7 hours in the wrong direction but what do you really learn if you get it right the first time? Thanks for the suggestions. They do seem much better uses. Better 7 hours than 7 months, right?
|
# ? May 11, 2015 18:34 |
|
fuf posted:Do parallax background images really count as hijacking scroll behaviour? Legible type is a "design necessity". Faux parallax stuff is distinctly not.
|
# ? May 11, 2015 18:51 |
|
Does attaching crap like parallax to scroll events actually work on mobile these days? Last time I tried to do something similar it was a mess because iOS wouldn't fire scroll events until after the user completed a scroll.
|
# ? May 11, 2015 19:53 |
|
As of iOS 7 or iOS 8, scroll events actually work. It's been a huge boon for mobile prototyping.
|
# ? May 11, 2015 21:21 |
|
Scroll events work but gently caress that noise, because they don't work on momentum (and they're a poo poo show in general on mobile). Use CSS and degrade gracefully: http://keithclark.co.uk/articles/pure-css-parallax-websites/
Maluco Marinero fucked around with this message at 23:37 on May 11, 2015 |
# ? May 11, 2015 23:34 |
|
Let's say I have a conditional that I'm parsing from a string, such as -code:
|
# ? May 13, 2015 15:55 |
|
So you're basically just wanting to store the string in some form that you can evaluate later? Is there a reason you have to parse it now instead of just storing it as a string and then evaluating the string later?
|
# ? May 13, 2015 16:08 |
|
Not particularly, but I'll still need to parse it and evaluate it at some point. Preferably without the use of eval. (E. Also don't take the object paths literally here, I'll have logic to fetch those values, the issue is parsing the Boolean logic to perform on them) WrathOfBlade fucked around with this message at 17:03 on May 13, 2015 |
# ? May 13, 2015 16:49 |
|
WrathOfBlade posted:Not particularly, but I'll still need to parse it and evaluate it at some point. Preferably without the use of eval. Is it always going to be groups of AND separated by OR conditions? So (first) || (second) || (third)...? If that's the case it could be pretty straightforward: code:
Alternatively, while this is not a good solution, if you need more complex conditions you could simply store them as strings and eval them
|
# ? May 13, 2015 19:24 |
|
Goddammit. I've got a problem that should be impossible. When I try to set a breakpoint in 4TellBoost.js on http://www.eabco.net/Ruger-1022-Scope-Mount--Precision-Machined-Weaver-Style-Base_p_14362.html, viewing in Firefox, the breakpoint just jumps to the bottom of the script. I've tested it on other scripts, and it appears to be a problem only with certain scripts, but I can't find any pattern. jQuery.min.js comes from their servers and will let me place a breakpoint anywhere, analytics.js just sends breakpoints to the bottom of the script, but all the Facebook scripts work fine. My boss thought it might be because of this, but that doesn't explain the issues with analytics.js, which has no comments. Is there any better explanation, or should I get my computer exorcised?
|
# ? May 14, 2015 01:01 |
|
I'm trying to create a page where users can log in with their tumblr account and fill out a form to post to their blog. I'm using hello.js with the tumblr module. I've modified the tumblr module demo and everything seems to be working in terms of logging in and authenticating. However, I'm unable to convince the API to let me use any OAUTH-restricted POST commands. GET commands, such as retrieving a user's followed blogs, work fine. But if I try something simple such as user/follow to follow a new blog, I get a "401 Not Authorized" response. What could be causing OAUTH restricted GET commands to be working fine, but POST does not? You can see my testing code live at http://www.jereddanielson.com/testing/tumblr/hello.js-master/demos/tumblr.html Below is the pertinent javascript. I'm using the OAUTH proxy at https://auth-server.herokuapp.com/ code:
|
# ? May 14, 2015 02:29 |
|
I asked a similar question before, but how are you supposed to develop/debug a user script in the year 2015? As far as I can tell, Greasemonkey does not expose the source to at least Firefox's native developer tools in any way, so you can't set breakpoints and step through the code. I tried doing it in Chrome and it wouldn't even let me run the file because it was not installed from the web store. I couldn't find the source file anywhere in the developer tools even when using Tampermonkey. So back to Opera 12 I went and it highlighted exactly where a syntax error that was preventing the file from running was.
|
# ? May 14, 2015 13:26 |
I'm stuck in something that's probably easy but my brain is broken and doesn't like recursion. I need to convert an array of objects to an nested object, like this: JavaScript code:
JavaScript code:
|
|
# ? May 14, 2015 14:22 |
|
gmq posted:I'm stuck in something that's probably easy but my brain is broken and doesn't like recursion. Does you have to read properties dynamically or will there be a 'defined type'?
|
# ? May 14, 2015 14:58 |
Newf posted:Does you have to read properties dynamically or will there be a 'defined type'? In the future it'll be dynamic but right now they all use the same.
|
|
# ? May 14, 2015 15:51 |
|
It bothers me that superscript-2 (²) is not a valid Javascript character. I'm doing some basic statistics and want to provide an API with correct notation such as σ/s for standard deviation (ok!) and and σ²/s² for variance (not ok).
|
# ? May 14, 2015 18:46 |
|
Something like this should work with a fixed schema:JavaScript code:
|
# ? May 14, 2015 18:53 |
necrotic posted:Something like this should work with a fixed schema: You're my hero, I knew reduce would work but I kept hitting a brick wall while trying to do it.
|
|
# ? May 14, 2015 19:27 |
|
Anyone have any suggestions for a good tool to learn regular expressions? Everything I've found so far just seems to throw it all at you at once and it's a bit overwhelming. Maybe a bunch of small steps where there are exercises and such?
|
# ? May 15, 2015 01:24 |
|
Friedl's book is still what I recommend.
|
# ? May 15, 2015 01:49 |
|
huhu posted:Anyone have any suggestions for a good tool to learn regular expressions? Everything I've found so far just seems to throw it all at you at once and it's a bit overwhelming. Maybe a bunch of small steps where there are exercises and such? (Also for the record, the solution I turned out to be looking for earlier was a variation of Shunting-yard algorithm.)
|
# ? May 15, 2015 01:53 |
|
huhu posted:Anyone have any suggestions for a good tool to learn regular expressions? Everything I've found so far just seems to throw it all at you at once and it's a bit overwhelming. Maybe a bunch of small steps where there are exercises and such? This guide seems fairly direct, and doesn't miss out a ton of useful stuff like lookaheads: http://okeschool.com/tutorial/2392/regex/regex-basics/introduction.html regex101 is a great tool for explaining what's going on. I suggest you combine it with the above tutorials: https://regex101.com/ Be aware that you can only learn regex syntax like you can learn a programming language. Actually parsing complex regex in your head isn't something you should expect to be able to do, and don't be surprised if you have to re-learn the regex syntax the first few times you use it. Also, regular-expressions.info is an example of how make documentation more complicated and misleading than the thing you're explaining. Avoid this massive piece of poo poo.
|
# ? May 15, 2015 04:35 |
|
WrathOfBlade posted:Not sure if it's what you're looking for, but I learned a lot by screwing around in rubular and seeing what worked. That looks pretty interesting, thanks.I decided to play around with it and within 5 minutes I managed to figure this out: code:
Edit: v1nce posted:This guide seems fairly direct, and doesn't miss out a ton of useful stuff like lookaheads:
|
# ? May 15, 2015 04:37 |
|
huhu posted:Anyone have any suggestions for a good tool to learn regular expressions? http://www.weitz.de/regex-coach/
|
# ? May 15, 2015 08:29 |
|
Wheany posted:I asked a similar question before, but how are you supposed to develop/debug a user script in the year 2015? Did you have Chrome in developer mode? https://developer.chrome.com/extensions/faq#faq-dev-01 I thought it was supposed to let you install/enable and debug user extensions in that mode. Dunno if that'll enable Tampermonkey debugging, but it might be worth a shot. also Opera 12 supremacy
|
# ? May 15, 2015 15:00 |
|
Munkeymon posted:also Opera 12 supremacy It's so loving dumb that Chrome says that "you might have been tricked into installing this", or whatever, but there is no "no I was not, I just wrote the drat thing myself" button. Well except maybe the developer mode, maybe. e: The developer mode lets you open a directory that has the same structure as a Chrome extension. It does not enable you to just pick a .user.js file. Wheany fucked around with this message at 16:00 on May 15, 2015 |
# ? May 15, 2015 15:58 |
|
Wheany posted:It's so loving dumb that Chrome says that "you might have been tricked into installing this", or whatever, but there is no "no I was not, I just wrote the drat thing myself" button. Well except maybe the developer mode, maybe. Will it let you debug a script loaded via Tampermonkey, though? Seems like a not-unlikely side effect.
|
# ? May 15, 2015 16:27 |
|
Munkeymon posted:Will it let you debug a script loaded via Tampermonkey, though? Seems like a not-unlikely side effect. Not in a way I can figure out. I tried putting a debugger statement in the script and it did nothing.
|
# ? May 15, 2015 16:34 |
|
Wheany posted:Not in a way I can figure out. I tried putting a debugger statement in the script and it did nothing. I've debugged tampermonkey scripts. I think I had to turn on some setting in tampermonkey that inserted a breakpoint at script start, and then activate breakpoints from there.
|
# ? May 15, 2015 16:43 |
|
|
# ? May 16, 2024 17:49 |
|
Subjunctive posted:I've debugged tampermonkey scripts. I think I had to turn on some setting in tampermonkey that inserted a breakpoint at script start, and then activate breakpoints from there. Is this it?
|
# ? May 15, 2015 16:53 |