|
peepsalot posted:Chrome dev tools lets you edit js source of a remote website from within the browser, is there any way to just reload the page with those local modifications applied? Otherwise what is the loving point of letting you edit any of this in browser. I use this sort of functionality to rapidly develop a fix for UI issues and test for cross browser compatibility. By developing in the browser first, when I actually do modify code and republish, I already know it works. I don't know what you are trying to do, but if you are trying to customize your experience while accessing resources from a sever you don't contorl you might want to look into plugins like "Greasemonkey" for Firefox or "Tampermonkey" for Chrome. You can write custom scripts that run when the URL meets certain criteria, like a specific domain, page, or query string. I am currently using Greasemonkey to periodically ping the server on a website I have to login to by reloading an image that is always in the header. This keeps my session from timing out. You can do lots of things and there are community scripts available that you might find useful.
|
# ? Aug 25, 2014 18:39 |
|
|
# ? Jun 1, 2024 05:23 |
|
nexus6 posted:I'm having an issue in Drupal which I'm pretty sure is JS related but I'm getting no errors or warning in the console at all so I have no idea where to look for a solution. JavaScript having access to the local file system is a scary thing, and there are security concerns that might complicate what you are doing. If you try to get too fancy you might trigger security mechanisms preventing your code from functioning as expected. I ran into a problem trying to customize a file upload button. You can't use CSS to style it, but if you try to hide the native browser file upload button and use JavaScript to programatically trigger it, most browsers will freak out. The fix in my case was to create an HTML label and style it as a custom upload button, and link the label to the native browser button. If you click a label its associated input will also be clicked. That is how you can click on the text of a radio button to select it, instead of having to click on the actual radio button. This might have nothing to do with your situation, but I just wanted to point out that this sort of thing can trigger security issues.
|
# ? Aug 25, 2014 19:01 |
|
I'm not trying to be fancy, I'm trying to get it to do its default functionality. Something appears to be blocking it, I can see that there should be a JS file being run that, for some reason, isn't. Since I'm not getting any console errors I'm at a loss to find out what is (or isn't) happening.
|
# ? Aug 26, 2014 17:26 |
|
nexus6 posted:I'm not trying to be fancy, I'm trying to get it to do its default functionality. Something appears to be blocking it, I can see that there should be a JS file being run that, for some reason, isn't. Since I'm not getting any console errors I'm at a loss to find out what is (or isn't) happening. That seems like an issue with Drupal that should be taken up in a related thread? Or maybe their support site.
|
# ? Aug 26, 2014 22:43 |
|
Sounds pretty impossible to even start helping out without a test case or example to look at.
|
# ? Aug 27, 2014 01:58 |
|
Malfeasible posted:You can't use CSS to style it, but if you try to hide the native browser file upload button and use JavaScript to programatically trigger it, most browsers will freak out. You can at least make it bigger and transparent (opacity: 0) and have it over another element that acts as a placeholder. Then when the user goes to click the placeholder, they will click on the transparent file select button instead.
|
# ? Aug 27, 2014 06:00 |
|
Chenghiz posted:Sounds pretty impossible to even start helping out without a test case or example to look at. Tell me about it. It's a currently live client site so I can't just hand out admin access and since the problem is it's not doing what should be default functionality I can't really set up an example with recreating the site entirely.
|
# ? Aug 27, 2014 13:56 |
|
nexus6 posted:Tell me about it. It's a currently live client site so I can't just hand out admin access and since the problem is it's not doing what should be default functionality I can't really set up an example with recreating the site entirely. My guess is that a security exception is thrown and some piece of code is catching and discarding them. Try activating "Pause On Caught Exceptions" in Chrome and see what happens. edit: this thing Wheany fucked around with this message at 14:47 on Aug 27, 2014 |
# ? Aug 27, 2014 14:43 |
|
Hmm, not getting anything illuminating. Getting a few 'Failed to execute 'webkitMatchesSelector'' errors but they don't seem to be unique to uploading files.
|
# ? Aug 27, 2014 17:27 |
|
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
|
# ? Aug 29, 2014 00:08 |
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 |
|
Apologies, I am "learning javascript" by tweaking D3 examples and I'm trying my third, so basically I only barely understand javascript. My second effort was: http://bradybutterfield.com/musicGenreFDG/ My question is: if I had snapshots of the music genre map at 1980, 1981, 1982, etc. and wanted nodes and links to grow, shrink, appear and disappear, etc., how would I accomplish that? (This is the closest example I could find but if it's going to lead me astray I'm not going to figure that out myself) http://bost.ocks.org/mike/nations/
|
# ? Aug 29, 2014 16:35 |
|
If anyone uses SublimeLinter with jQuery code could you post your SublimeLinter settings? Nothing I've tried seems to work.
|
# ? Aug 31, 2014 19:11 |
|
The Milkman posted:If anyone uses SublimeLinter with jQuery code could you post your SublimeLinter settings? Nothing I've tried seems to work. Is it not working at all, or just not doing something you expect? I use jquery and sublime linter with default settings and it works fine for me.
|
# ? Aug 31, 2014 21:27 |
|
Chenghiz posted:Is it not working at all, or just not doing something you expect? I use jquery and sublime linter with default settings and it works fine for me. Yeah it's running but it's marking things like $ and document as not defined. So basically everything is red. I'm using ST3 beta with the corresponding SublimeLinter if that makes a difference
|
# ? Sep 1, 2014 02:50 |
|
The Milkman posted:Yeah it's running but it's marking things like $ and document as not defined. So basically everything is red. code:
It assumes some by default but you have to add others. There might be a way to set these in setting but I'm not currently aware of it.
|
# ? Sep 1, 2014 03:35 |
|
Chenghiz posted:oh, yeah that's a thing. it doesn't like global variables. put this at the top of your file: You can also configure this project wide by adding a .jshintrc file in the root of the said project.
|
# ? Sep 1, 2014 06:55 |
|
I've got a ui that wants to be a bit pushy about encouraging users to use the numpad, but that would be super annoying (not to mention useless) for any users at a numpad-deficient laptop. Is there any way to determine whether a user's keyboard has a numpad?
|
# ? Sep 1, 2014 20:08 |
|
pangstrom posted:Apologies, I am "learning javascript" by tweaking D3 examples and I'm trying my third, so basically I only barely understand javascript. Really the main thing is to refactor your code so you have an update function that takes in the data, d3 selections will do most of the heavy lifting for you.
|
# ? Sep 1, 2014 20:18 |
|
Newf posted:I've got a ui that wants to be a bit pushy about encouraging users to use the numpad, but that would be super annoying (not to mention useless) for any users at a numpad-deficient laptop. Is there any way to determine whether a user's keyboard has a numpad? code:
|
# ? Sep 1, 2014 20:18 |
|
Lumpy posted:
|
# ? Sep 3, 2014 12:12 |
|
Alligator posted:You should take a look at the three update examples, here http://bl.ocks.org/mbostock/3808218 here http://bl.ocks.org/mbostock/3808221 and here http://bl.ocks.org/mbostock/3808234. Here's a simple example using a force layout http://bl.ocks.org/mbostock/1095795.
|
# ? Sep 3, 2014 14:03 |
|
I'm new to Javascript and programming in general. I'm working on a space-themed tabletop game and I'm wondering about the proper way to set up constructors. First off, I have a Weapon constructor:code:
code:
|
# ? Sep 4, 2014 13:36 |
|
Squack McQuack posted:I'm new to Javascript and programming in general. I'm working on a space-themed tabletop game and I'm wondering about the proper way to set up constructors. First off, I have a Weapon constructor: All your questions about inheritance in Javascript are answered there: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain
|
# ? Sep 4, 2014 15:26 |
|
Squack McQuack posted:I'm new to Javascript and programming in general. I'm working on a space-themed tabletop game and I'm wondering about the proper way to set up constructors. First off, I have a Weapon constructor: Generally with games it's best to go with the simplest thing that works. Right now I'd say that would be: code:
|
# ? Sep 4, 2014 15:56 |
|
Skiant posted:All your questions about inheritance in Javascript are answered there: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain HappyHippo posted:Generally with games it's best to go with the simplest thing that works. Right now I'd say that would be: Perfect, thank you! I'll read over Skiant's link but I think HappyHippo's solution will do what I need it to.
|
# ? Sep 4, 2014 16:17 |
|
Any tips, recommended reading, suggested tools to step up my profiling/optimization game? I have some particularly computationally expensive code that I am trying to optimize for speed. I've been using the built in dev tools in chrome browser to do CPU profiling, looking at which functions are taking up the most time and seeing if/how I can make them more efficient. The profile data representations given by chrome seem kinda clunky to me though, like I'm not seeing any info on a call count for functions, and the overall nested interface feels a bit tedious to navigate for complex code, etc. I just feel like 'There's Got To Be A Better Way!'
|
# ? Sep 8, 2014 21:03 |
|
This thing looks promising: http://spy-js.com/ Does your code do lots of scope traversal? Getting variables from above the current scope is a common source of JS performance problems. You could try making local copies if that's what's happening. Does any of your program iterate over large sets of data that don't need to be processed in any particular order? Running the computations in parallel may help as well: http://adambom.github.io/parallel.js/
|
# ? Sep 9, 2014 15:10 |
|
rt4 posted:This thing looks promising: http://spy-js.com/ If you use Jetbrains IDE's, they integrate spy.js. https://www.youtube.com/watch?v=vPIbwxzC5cU
|
# ? Sep 9, 2014 19:09 |
|
rt4 posted:Does your code do lots of scope traversal? Getting variables from above the current scope is a common source of JS performance problems. Anything can be slow in the right (wrong) situation, but modern engines have optimized upvar access *heavily*, in part because the function-literal module pattern relies on them so heavily. It shouldn't be more than 100% slower than a local variable access, and those are *very* fast. I wouldn't rush to distort your code to avoid upvars, unless you've ruled out everything else. (Accessing globals can have different effects, sort of a different story.)
|
# ? Sep 9, 2014 20:54 |
|
Thermopyle posted:If you use Jetbrains IDE's, they integrate spy.js. Whoooaaa. The source code following part is pretty cool.
|
# ? Sep 9, 2014 20:54 |
|
Thermopyle posted:If you use Jetbrains IDE's, they integrate spy.js. What the gently caress.
|
# ? Sep 9, 2014 21:24 |
|
You should all be using IntelliJ, seriously. Worth every penny. Hopefully they'll add the upcoming CLion as an extension and make it the most comprehensive IDE around.
|
# ? Sep 9, 2014 21:30 |
|
rt4 posted:You should all be using IntelliJ I am
|
# ? Sep 9, 2014 21:37 |
|
Unfortunately spy.js chokes on js with React JSX in it.
|
# ? Sep 9, 2014 22:50 |
|
rt4 posted:You should all be using IntelliJ, seriously. Worth every penny. Hopefully they'll add the upcoming CLion as an extension and make it the most comprehensive IDE around. I second this. I was absolutely in love with Atom and Brackets for working in Node all day at work in our obscure framework. Once I found WebStorm, my entire workflow changed. The community typescript stubs are amazing. poo poo, I can even tweet from inside the IDE.
|
# ? Sep 10, 2014 12:06 |
|
I've been using Sublime Text with a shitload of packages (working with Node and Angular mostly) so far and I'm extremely happy with it, but maybe I'm missing out on a special feature that would totally win me over?
|
# ? Sep 10, 2014 12:51 |
|
Thermopyle posted:Unfortunately spy.js chokes on js with React JSX in it. Yeah, I'm using Kendo and when I get to the part of the page I actually want to profile spy.js chokes.
|
# ? Sep 10, 2014 13:30 |
|
Skiant posted:I've been using Sublime Text with a shitload of packages (working with Node and Angular mostly) so far and I'm extremely happy with it, but maybe I'm missing out on a special feature that would totally win me over? Give the free trial a shot. I use Sublime Text for lots of little stuff but it barely compares with a full-fledged IDE.
|
# ? Sep 10, 2014 13:58 |
|
|
# ? Jun 1, 2024 05:23 |
|
peepsalot posted:Any tips, recommended reading, suggested tools to step up my profiling/optimization game? If it's computationally expensive, shove it to a WebWorker?
|
# ? Sep 12, 2014 06:42 |