Ways to format one-liner JavaScript file - javascript

What are some of the best and quickest ways to format a JavaScript file.
I ask because I've downloaded a file called slides.min.jquery.js and I
would like to know how to change it so instead of being a one-liner it
is formatted properly.
I've got Aptana Studio but don't know how to open a JavaScript Project.
Any ideas? Thanks. Or else another tool will do.
Thanks.

You can use a tool like jsbeautifier to de-minify the compressed js.
Firefox has a plugin called deminifyer which can be used for this purpose as an offline solution.

Related

Difficult to read source code for some web pages?

I have been trying to find an explanation for this, but everywhere I looked doesn't seem to answer my question. Essentially, whenever I look at the "view page source" option on a webpage like Facebook or my school's home page (gvsu.edu), the source code is just a huge wall of text. As a result, I have a few questions:
Is this how it looks in the editor? If not, why is it formatted this way when I look at the source code?
Is there any way to decipher this code so I can see how it works?
Are there any advantages to formatting the code this way?
Thanks.
Is this how it looks in the editor? If not, why is it formatted this way when I look at the source code?
no, usually programmers try to make code as readable as they can, this is a "minified" version of the code, it's done to make files smaller so people can receive it faster in their browsers.
Is there any way to decipher this code so I can see how it works?
you can use some online tool to like this, you will have to format html, css and javascript individually.
Are there any advantages to formatting the code this way?
already answered, but here I can add that usually you don't format the html/css/js that way, you have a tool that does that job for you like gulp-htmlmin, gulp uglify, cssmin or many others, and you work with a "development" version of the files, when you are done editing you run some scripts and they spit that minified version to you, so you can upload it to your server.

Lotus-1-2-3 (wk1) file parsing guidelines

I'm trying to make a little converter from wk1 (lotus-1-2-3) files to excel for a friend. The files have only simple data, no functions or anything really complicated.
I couldn't find anything related to guidelines to parse or documentation of wk1 file structure. I already tried going through libreoffice code but my C++ is very rusty (academic level, 6 years ago).
I usually code in PHP and JavaScript, and I didn't find anything related to this for these languages.
I believe I read somewhere that Lotus-1-2-3 is abandonware now, so I don't think is "illegal" or anything.
Is there any information available about this? What would be the best approach to "decoding" the data (other than that just give up)?
Thanks
For me there is no reason to re-invent the wheel...
There is a free software that can convert these files.
It is even available as portable app AND it has a command- line parameter to convert between formats:
soffice --headless --convert-to <TargetFileExtension>:<NameOfFilter> file_to_convert.xxx
So if you really need an "own" program: package it with the portable version of libreoffice and make a nice interface to select the source and target file and run the command line...

How to migrate browser-based HTML5 and Javascript code into Xcode?

I have an HTML file containing JavaScript code, which is read by PC browsers(like IE).
Now I want to "migrate" those codes to make it part of my iOS app.
Is there an easy way to do this? I now using Titanium is a good way but what if I intend to use Xcode? (Also, the HTML contains some JQuery codes.)
Thank you very much!
Use UIWebView and you can run it as is.

Needed help with javascript

So guys I am working on a program to like download stuff using javascript. I hav written the following code:
function download()
{
alert("Hello");
var url='http://somesite/somefile.rar';
window.open(url,'Download');
}
The code is pretty easy, but is there some other way to download the file using javascript? Also having downloaded the file is there some way to store it locally in the location of our choice, like d-drive? I had come across the javascript file api while searching the web, is it any useful in my scenario? Please help.
Edit: Fixed code formatting
No, this isn't possible. It is up to the client where to save files, not you.
Through Javascript, you can only set the file name that you want, but would not be able to access the file system i.e. All the folders, etc..

how to implement javascript in uiwebview for pdf file implementation?

I am trying to implement pdf annotation with ipad using uiwebview. I am able to load the pdf file but i am not able to use the functions. I felt that i am able to use javascript with uiwebview and implement the things,but then found saying that javascript is not available for pdf file.
http://www.icab.de/blog/2010/01/12/search-and-highlight-text-in-uiwebview/comment-page-3/#comment-7600
Can you help me with some solution if possible. I am now really in need of some solutions.
Thank you.
Alas, you can't do anything about PDF shown in a UIWebView.
You need to work hard parsing PDF files and manipulating it.

Categories

Resources