/********************************
* MAPP
********************************/
var app = new mapp();
/********************************
* Include files
* Embedded to DOM
********************************/
app.include('/helpers/url.js');
app.include('/helpers/misc.js');
app.include('/libraries/jquery.js');
/*******************************
* Model
*******************************/
app.model('shape', function(){
app.settings('model.shape', {
x: 0,
y: 0,
w: 200,
h: 150
});
});
/********************************
* Controllers (DOM Manipulation)
********************************/
app.controller('add_shape', function(){
/* Load MOdels */
app.include('/models/shape.js');
var shape = app.model('shape').set('x', 50).set('y', 50);
/* Load into views */
app.views('/views/page.js', '#page');
});
/********************************
* Router
********************************/
app.router('/hell', function(){
app.views('/views/hell.js', '#page');
});
app.router('/heaven', function(data){
app.views('/views/heaven.js', '#page', data);
});
app.start(function(){
app.addCSS('.rectangle', {
position: 'absolute'
width: '200px',
height: '150px'
});
app.on('mouse.click', '.rectangle button.add', function(){
app.controller('add_shape');
});
app.on('mouse.click', '#next', function(){
app.goto('/hell');
});
var data = {hello: 'world'};
app.on('mouse.click', '#ajax-this', function(){
app.ajax('POST http://domain.com/file.php', data, function( response ){
app.views('#page', response.data);
});
});
app.on('mouse.click', '#ajax-this2', function(){
app.ajax('http://domain.com/file.php', data, function( response ){
app.goto('/heaven');
});
});
});
/********************************
* Function Filter
********************************/
app.create('myfunction', function(params){
// statement here
});
app.summon('myfunction', {
data: 'data1',
data2: 'data2'
});
/********************************
* Effects Manipulation
********************************/
app.animation('fadein', '#myid', '500s');
app.animation('opacity:0.5', '#myid', '500s');