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

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.

Related

How can I save a project as an app?

A totally noob question. I have recently finished my first calculator in HTML, CSS, JavaScript. Now I want to have this calculator on iPhone. Is there any easy way to save the project as an app? Thank you!
I would recommend using Cordova. It should fit your needs perfectly.
I developed an automated runner for Cordova that you might find useful. You can try that, or just simply follow the Cordova docs.
I hope this helps.
Maybe for the real noob, Intels XDK is also someting to check out. It helps me to simply convert html, css, javascript to apps.
If you have Mac OS you can use Xcode with Storyboards just drag and drop UIWebView and set path to your html file.

Ways to format one-liner JavaScript file

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.

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.

How to build GWT standalone offline application?

I need to design SPA with GWT technology, but I do not understand clearly how to make (compile) only one page with all JavaScript code in it.
So, for example my task is to make simple page with button and div. You click on button and div appears on page. Simple.
When I did this on GWT, I can not find a way to compile this page in simple index.html with all JS code inside (or in one .js file). Page should work in offline mode.
GWT do it for you. compile it to one .js file?
Here is simple tutorial http://code.google.com/intl/en/webtoolkit/doc/latest/tutorial/gettingstarted.html
If you have any other question, please ask
and have a look at this.allyou need is here
http://www.vogella.de/articles/GWT/article.html
Try Gears with GWT from google here the specs:
http://www.slideshare.net/tom.peck/going-offline-with-gears-and-gwt

Inline CSS/Javascript into a HTML file

I am looking for a simple commandline script/program to automatically "inline" all external css and javascript references for a html file. I basically want to create a single self-contained html file suitable for sending via E-Mail. An additional bonus would be if it could also inline images as data: UIRs, but that part is not so important.
EDIT : I wrote a little Python script for fun. It seems to work pretty well :
Inline2Mail
Or you can still try with :
Front compiler does something like that but it implies javascript. You have an online solution as well, with premailer. Finally you have a Python and a Ruby script to do it.
There is a Node.js library which solves exactly your problem: https://github.com/remy/inliner/ It can be used both as a commandline script and a library.
It will make you a single .html file which can be sent anywhere by any means and be opened later in any browser without the need in Internet connection.
If you think about inlining CSS and Javascript to make a HTML body of an email, just forget about it. Most Email clients out there will either ignore or badly damage your styles and I think all email clients will just plainly drop the inline Javascript in the body of emails.
This Python project of mine can help with getting the CSS styles inline https://github.com/rennat/pynliner
If it's not something that needs to be automated and you're using Windows you could open the web page in Internet Explorer and save it as 'Web Archive, single file (*.mht)'. This will pack everything into a single file, including CSS, JavaScript and images. Note that the recipients needs to have access to Internet Explorer to be able to open the Web Archive. Neither Google Chrome nor Firefox supports mht files, so it's probably a Microsoft only feature.

Categories

Resources