How to convert any .htc file into .js file? - javascript

How can I convert any .htc file into .js and use the resulting JavaScript?
For example, this is a .htc file: http://curved-corner.googlecode.com/files/border-radius.htc. I want to convert it into .js.
I want to convert it because the CMS I'm working with will not allow me to attach the .htc file. I think it's because of a mime type issue.

It is not possible to convert any .htc file to an "equivalent" .js file. That is, it's not possible automatically, in general. However for the specific file you've posted, you could convert it using jQuery's live event.
But anyway, there's plenty of Javascript-only libraries that do the "border-radius" thing, why do you need to specific convert this one? A quick google search turns up dozens.

You might find some interesting information regarding conversion of HTC to JavaScript objects in this blog: http://ehudpardo.blogspot.com/2011/09/part-1-converting-htc-behaviors-to.html

Related

Converting XML SpreadSheet to XLSX using Javascript

I need to convert a XML SpreadSheet to a native Excel file (XLSX), without using MSOffice.
In particular I need to make this conversion using Javascript.
I'm searching for in "StackOverflow" web page and also in google and other portals, but I don't find nothing about it.
The XML SpreadSheet sample file is like this:
enter image description here
On the other hand, I've discovered the "excelcnv.exe" command for conversion between formats, included in MSOffice Excel installation, but just I got to convert from XLS to XLSX, but not from XML SpreadSheet to XLSX...In fact I haven't found any documentation about this "excelcnv.exe" command so I don't know if it is possible this conversion.
Also I've found about some javascript libraries like oxml.js or XLSX but I think this libraries allow create a native excel file from scratch, not convert from input files in XML SpreadSheet format.
Maybe anybody could know how do this using javascript or some javascript library.
Any help will be very welcome :)
Thanks in advance,
You need to change the file extension. From xml to xls.
Then excelcnv will convert correctly.
excelcnv.exe -oice <INPUT> <OUPUT>

Retain syntax highlighting when converting souce code file (.java, .css, .js) to pdf

I have this feature on my web app that allows you to convert files (any format) to pdf and is allowed for viewing.
I'm already able to do that. My problem is when I convert source code files such as .java or .js it is read like an ordinary text file with no highlighting when converted to pdf.
I want to be able to retain syntax highlight of those file when it is converted to pdf as well. Is there any way in doing this?
Short Answer: No, there is no way to keep the syntax highlighting from source code file to PDF.
Long Answer: The syntax highlighting is a feature of your IDE, it's not part of your source file itself so there is no way to keep it. However, you can create your own syntax highlighting before converting in to PDF.

Create .ics file with javascript

I have to create a .ics file with Javascript. I haven't got the possibility to use jquery.
Is there a way to create this file?
Thanks for your help
You can use one of the methods described here to write a file in Javascript, then the content of the .ics file is up to you to determine. It's quite trivial since the ics format is simple. (complete RFC)

How do I extract a zip file using javascript?

How do I parse zip file string. I looked for hours I couldn't find an easy to do it. All the examples I found didn't make much sense.
I use zipjs to handle zip files. A simple library that can handle reading and writing zip files.
BE MORE CLEAR NEXT TIME. I think this answer is what you need to hear.
A zip file can not be parsed with simple JavaScript. There is simply no native function that can ope ZIP files. There are certain libraries out there, but personally i have not found one that worked properly, and most use some kind of flash plugin to make it "work".
If you really want a zip file to be presented in Javascript, you will have to build its function with PHP. PHP can write to zip files, and read them: PHP ZIP. If you want to read the contents of a zip file, you would have to upload the file to the server (can be done with JS), then make the PHP return a JSON object with all the file_info of all the files inside the ZIP. And last but not least, JS should be able to acces another PHP page that retrieves a particular file, which can be done by reading the file and setting a mimetype before outputting its contents.

Is it possible to store a whole webpage in a single binary file and display the site using JS?

Assuming I have some images, css and html concatenated in one file. Is it possible to use JS to display the html with images and css properly by ripping up the concatenated binary file somehow?
There are some ways to pack everything into a single file. But all of them are not crossbrowser. Everything depends on your goals.
Take a look at these formats:
MHTML http://en.wikipedia.org/wiki/MHTML
Webarchive http://en.wikipedia.org/wiki/Webarchive
Mozilla Archive Format http://en.wikipedia.org/wiki/Mozilla_Archive_Format
All of them are browser specific and even requires some extensions to be installed.
The easiest and the most supported way is to put all css and js files right into your html file. And use data:uri format to include your images into html.
Theoretically it is even possible to write a binary file reader in javascript.

Categories

Resources