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
demos = [{ | |
description: "A parent with the layout property set to 'vertical' uses a vertical layout mechanism instead. Here, a child is placed in relation to the bottom of the previous child.", | |
children: [{height:80,width:100,left:30},{top:5,left:20,height:80,width:60}] | |
},{ | |
iphone: "Everything works as normal, even negative offsets (not on Android though!) and zIndexes. Except...", | |
android: "Negative top offsets have weird behaviour in a vertical layout on Android. Here, the second child ends up before the first!", | |
children: [{height:80,width:100,left:30,zIndex:1},{top:-5,left:20,height:80,width:60}] | |
},{ | |
iphone: "...the top and bottom properties are both used as margins (on Android only top!). So the height difference between two siblings is the sum of the bottom of the first and the top of the second.", | |
android: "The height difference between two siblings is controlled by the top property of the second sibling. On iPhone, the bottom prop of the first is added to the difference as well.", |
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 Platform | |
* Copyright (c) 2009-2011 by Appcelerator, Inc. All Rights Reserved. | |
* Licensed under the terms of the Apache Public License | |
* Please see the LICENSE included with this distribution for details. | |
**/ | |
// Code is stripped-down version of Tweetanium, to expose new structure paradigm | |
(function(){ | |
S.ui.createFooWin = function(){ |
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
Ti.include("/struct/struct.js"); | |
S.app.mainWindow = S.ui.createApplicationWindow(); | |
S.app.mainWindow.open(); | |
S.app.mood = "RADIANT!"; | |
Ti.App.fireEvent("app:mood.update"); | |
setTimeout(function(){Ti.App.fireEvent("app:msg",{msg:"Welcome!"});},1000); |
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
function map(doc){ | |
if(doc.username && doc.presentation){ | |
emit(doc._id, doc); | |
} | |
} |
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
win.add(createKraWebView({template: "templateexamaple.html",data:{name:"ole",role:"bass",presentation:"<p>Nice guy!</p>"}})); |
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
K.createKraWebView = function(o){ | |
var webview = K.create(K.merge({url: "../views/"+ (o.masterPageFile || "_masterpage.html")} o), | |
template = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory+"/views/"+o.templateFile).read().text, | |
opts = { template: template, data: {data: o.data} }; | |
webview.addEventListener("load",function(){ webview.evalJS("render("+JSON.stringify(opts)+")"); }); | |
return webview; | |
}, |
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
(function(){ | |
var hash = decodeURIComponent((location.href.match(/#(.*)$/) || [])[1]); | |
if(hash){ | |
var el = document.querySelector(hash), t = 0; | |
do { t += el.offsetTop; } | |
while (el.offsetParent && (el = el.offsetParent)); | |
window.scrollTo(0, t); | |
} |
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
"plr-gate":{ | |
conds: [{ // array of condition objects | |
'if': { // all properties here are conditions to be evaluated | |
"hasflag": "haskey" // tests for global flag of the given name | |
}, | |
then: { // effects to take place if all conditions were true | |
on: true, // collision takes place on the square | |
stop: "b", // stops the marble motion, with animation "b" (bounce) | |
setwalltype: "none" // makes the gate disappear | |
}, |
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
// CSS-like styling | |
// test.css | |
tableView { | |
background-color: #f00; | |
color: #fff; | |
} | |
row { background-color: #0f0; } | |
.info { right: 0; } | |
// HTML-like templates combined with micro-templates or mustasche |