This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create our web view | |
var win = Ti.UI.createWindow({ backgroundColor: "#fff" }); | |
var web = Ti.UI.createWebView({ url: "http://chicago.craigslist.org/" }); | |
// inject our css when the web view finishes loading (because we need to inject into the head element) | |
web.addEventListener('load', function () { | |
// first, specify the CSS file that we should load | |
var cssFileName = 'styles.css'; | |
// read in the contents | |
var cssFromFile = Ti.Filesystem.getFile(cssFileName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Define our parser class. It takes in some text, and then you can call "linkifyURLs", or one of the other methods, | |
* and then call "getHTML" to get the fully parsed text back as HTML! | |
* @param text that you want parsed | |
*/ | |
function Parser(text) { | |
var html = text; | |
var urlRegex = /((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); | |
var html = '<html><body>' | |
+ '<a href="http://pedro.com">Pedro</a> ' | |
+ '<a href="http://is.com">is</a> ' | |
+ '<a href="http://a.com">a</a> ' | |
+ '<a href="http://balla.com">balla!</a>.' | |
+ '</body></html>'; | |
var web = Ti.UI.createWebView({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); | |
var web = Ti.UI.createWebView({ | |
url: 'http://www.appcelerator.com/' | |
}); | |
var linkJS = 'document.titaniumLinkQueue = [];' | |
+ '(function(){' | |
+ 'var links = document.getElementsByTagName("a");' | |
+ 'for(var i = 0, l = links.length; i < l; i++) {' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Appcelerator Titanium (JS) code to produce multiple selection type data entry in a single window. | |
// via @CJ_Reed | |
// and Dan Tamas : http://cssgallery.info/making-a-combo-box-in-titanium-appcelerator-code-and-video | |
var win = Titanium.UI.currentWindow; | |
// build custom tableView data/layout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The following snippet will ask the user to rate your app the second time they launch it. | |
* It lets the user rate it now, "Remind Me Later" or never rate the app. | |
*/ | |
var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); | |
win.addEventListener('open', checkReminderToRate); | |
win.add(Ti.UI.createLabel({ text: 'This is a simple app that will remind you to rate it.' })); | |
win.open(); | |
function checkReminderToRate() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var circle = Titanium.UI.createView({ | |
height:200, | |
width:200, | |
borderRadius:50, | |
backgroundColor:'#336699', | |
top:10, | |
left:50 | |
}); | |
currentWindow.add(circle); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This gist is only for Android. | |
If you would like launch native apps | |
on iPhone, iPad, you can find information about it in Appcelerator Docs: | |
-https://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Platform.canOpenURL-method.html | |
-https://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Platform.openURL-method.html | |
More info about iOS URL Schemes: http://handleopenurl.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var content = ''; | |
var boundary = '---------------------------170062046428149'; | |
content += '--'+ boundary + '\r\n'; | |
content += 'Content-Disposition: form-data; name="uploadToken"\r\n'; | |
content += '\r\n'; | |
content += upload_token + '\r\n'; | |
content += '--'+ boundary + '\r\n'; | |
content += 'Content-Disposition: form-data; name="destFolderPath"\r\n'; | |
content += '\r\n'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This app uses RGraph library to build Android-compatible pie charts using Titanium Mobile. | |
Brief screencast to demo functionality: | |
http://youtu.be/itTEwQmvNfY?hd=1 | |
This was for a work prototype/mockup, so excuse the esoteric text labels and fake activity indicator. | |
I borrowed heavily from prior art. | |
Aaron Saunder's "Titanium Appcelerator Quickie: Google Charts and Appcelerator" |
OlderNewer