I am looking for way (preferably and online site) to a reverse Uglify of some javascript. The Website: http://jsbeautifier.org/ is great for minifed code, but it is does not do a great job for ugly stuff.
There is this awesome online tool, JSNice, that makes a great job of finding names to obfuscated variables.
We make even obfuscated JavaScript code readable.
We will rename variables and parameters to names that we learn from thousands of open source projects.
Furthermore, often we are also able to guess or infer type annotations.
Chrome dev tools ability to Pretty Print
All you need to do is to click the { } icon on the bottom toolbar to activate this feature. Of course, the names will still be obfuscated (depending on what program minfied the JavaScript in the first place), but you will at least be able to set break points and debug the code.
Source: Tip #2 in this archived article.
Depends on what options you used when you uglify your code. If you just remove the line breaks, then Chrome dev tools will be able to do a great work as sirinivas explained. But if you mangle the code, then there is no way you can get the exact previous code. (in uglifying var logngvariable = a + b; becomes var c=a+b;. there is no way a tool can figure out the previous name logngvariable )
On the otherhand if you want an un-uglified code you may not uglify it at the first place... :)
Related
My team and I took over a legacy project with only partially implemented i18n. Now we'd like to find all hardcoded strings in the project. Can you guys think of a regex, plugin (VS Code other other) or script/tool for this?
Interestingly, searching for this issue turns up mostly desktop programming languages.
You can use the VS Code extension i18n Ally: https://marketplace.visualstudio.com/items?itemName=Lokalise.i18n-ally
I'm also working on a text extraction project and this has made things a lot faster. If you highlight static/hardcoded text there is a shortcut action you can use that prompts you to create a corresponding key for the text and moves the text to your json file, speeds things up a lot. I created a keyboard shortcut for it like so:
{
"key": "shift+cmd+i",
"command": "i18n-ally.extract-text"
}
Back to your immediate question, the extension has a beta feature for detecting hardcoded strings that is pretty useful. One issue I have with it is I can't figure out yet if there's a way to stop it from detecting inline CSS strings; it would be nice to ignore all that.
Some of the features are experimental/in beta so I can't vouch for it being error proof, but so far it's been very useful for me. Hope that's helpful.
i have web application in asp.net 2.0
i have following image in firebug
when i debug javascript using F10 whole line no 67 gets executed in one go, when i press F10 again line 68 gets executed
so in line no 67 there are more than one statements and they are executed in one go.
so how to debug statement by statement in firebug ??
thanks.
This is a common problem when debugging minified javascript code.
Ideally you should be debugging with non-minified javascript. If this is your site, you should swap out the JS code for the dev versions while you're testing.
If it's a library, a lot of third party tools provide a .min.js version and a plain .js version, so swap out the .min.js and use the .js` instead for now. If it's your own code, you should have the original code to hand anyway.
Having said that, if it's library code, the odds are you don't need to debug it anyway; the problem is likely to be in your own code, not in the library. Set the break point in your own code, and step over any library calls.
If you must test your site using minified code, then you need to use a technology called "Source Maps" to help you.
A Source Map keeps a set of links betweeen the original un-minified JS code and the minified version that is being run. This allows you to debug your site using the minified code, but to see the original un-minified code in the debugger.
This is relatively new technology. I know it's definitely available in the Chrome. I'm not sure whether it's available in Firebug yet though. You might want to investigate a bit further. If it isn't available yet, it will be very soon. (maybe take a look at the beta version or the nightlies)
Of course even if it is available, in order to actually use it you need to have the original source code and the source map so the debugger can do the mapping. Again, third party libs should provide these for you. For your own code, you'll need to generate the map as part of the minifying process.
Further reading about source maps: http://net.tutsplus.com/tutorials/tools-and-tips/source-maps-101/
Hope that helps.
F10 and F11 to step into and to step over
After having written large amounts of code in Intellij Idea Ultimate edition, I often want to test a method, or big pieces.
I often resort to having to paste the code in firebug in firefox, a small annoying cramping space, with no editor features. If the code needs adjusting I need to do it there, test again, copy and insert into Intellij Idea.
Is it possible to run firebug like console code, right in Intellij ? Similar to in Java debug mode with the Inspect tool ? It would have been really useful, even more useful just to highlight some code and press run.
Browser support is not important, any browser will do.
Is this possible already? Is there an Intellij plugin for this? Why not? :(
Thanks!
If the browser is not important, you could use the node.js plugin as a javascript repl / debugger. Keep in mind that it will not provide an HTML DOM so if your code makes jQuery calls, it will not run out of the box. Otherwise, if it's just plain javascript, it will run just fine.
Just stumbled over this. A bit late but anyway:
Debugging Javascript, editing values, etc. works fine using intelliJ with its Chrome Plugin.
See https://www.jetbrains.com/idea/webhelp/configuring-javascript-debugger.html or
http://blog.jetbrains.com/idea/2011/03/intellij-idea-debugging-javascript-in-google-chrome/
You can set breakpoints to stop where you want and can from there evaluate expressions and all the other stuff you would like to do.
Hope this is what you wanted to know.
I'm using Visual Studio 2012 and the JsLint plugin.
Is there a better way to use JsLint for inline javascript in CSHTML files?
If I try to select the javascript text and run the tools just on the selection I get a bunch of errors related to spacing (e.g. "var should be on column 13, not 9"). This happens because the IDE indents the javascript code inside the <script>tags.
I get errors on variables that are rendered from razor code like this: result = #Html.Raw(JsonConvert.SerializeObject(Model));
I currently just copy the code onto an empty .js file and run the tool from there, but it's kinda of nuisance to be switching.
What would be the best configuration (or alternate plugin) to work easier with jsLint validation on this scenario?
Resharper is the best tool I've used for javascript coding. It works very well and highlights the majority of the issues that you'd be looking for with JsLint, though it's not nearly as comprehensive of course.
On the other hand, I'd be concerned about the amount of javascript you're writing in a view. If you have that much, perhaps you should consider moving it out of your views into standalone files.
I think you just need to open up the options pane. I'm using the VS.2010 version, but my Tools >>> JSLint Options menu option opens up the following settings pane:
You're running into JSLint without the white option set to true.
You might want to steal some of the other settings I've got above to remove some of the more draconian rules. The above works very well for me. ;^)
Most of my javascript work is done with Firebug and I feel annoying most of the times having to switch between the HTML mode and console mode (which again I split into output mode and input mode). When I switch to a different page to see the HTML and come back, I lose the code that I write. What is the best way to go about developing javascript applications using firebug?
Something like a mini IDE would be awesome: It just has to let me insert some code, examine the current page and then let me execute it. Any suggestions?
I use a simple text editor (vim) to write Javascript and HTML, and I check the result every now and then in Firefox. I have always two windows open: one for my text editor, and one with the current page open in Firefox. After saving a change in the Javascript, I switch to the browser and refresh the page to observe results. That was my workflow until recently.
A couple of weeks ago, I discovered the Combiner tool by Nicholas C. Zakas. To release my Javascript code, I am now using a complete build process based on Apache Ant, similar to what I was using while doing Java development previously.
The first step is to check the Javascript code with the JSLint tool by Douglas Crockford. I used to painfully copy and paste my Javascript code in the online version of the tool, once in a while; being able to run it on all my Javascript files at once with this Ant script is a huge convenience.
The second step is to combine all my Javascript files into a single file using the Combiner tool. The third step is to minify the Javascript code using YUI Compressor by Yahoo!. These last two steps allow to optimize the delivery of Javascript code to reduce page loading.
You can find an example Ant build file that you may adapt to your own needs. I am currently using this file to build my own Javascript library, bezen.org.
The other answers so far have been correct: I've never heard of anyone actually developing inside Firefox/Firebug, because it's a tool designed for debugging, not coding. To do your coding, you should use a tool designed for it (either a text editor or a full-fledged IDE).
But that being said, you might want to check out FireEclipse (Link). It will allow you to integrate Firebug with the Eclipse IDE (which itself has at least three different JS plug-ins to choose from). Alternatively I think the main (aka Web Standard Toolkit, aka WST) JS editor for Eclipse has some functionality which is similar to Firebug, but I've never used it so I don't know the details.
Hope that helps.
Write your HTML in an editor/IDE
Save your changes
Preview it in your browser
Debug using Firebug
Make your code edits in your SOURCE CODE
Repeat
Firebug is for debugging and allows you to do some "what if" fiddling while the page is live. This is not a replacement for an IDE.