mirror of
https://github.com/moparisthebest/mail
synced 2025-01-08 12:08:07 -05:00
added unsandboxed mobile.html version for ios
This commit is contained in:
parent
b46c281715
commit
15008a23e9
@ -8,7 +8,6 @@
|
||||
<link rel="stylesheet" href="css/styles.css"/>
|
||||
|
||||
<!-- The Scripts -->
|
||||
<script src="lib/cordova-2.5.0.js"></script>
|
||||
<script src="lib/jquery-1.8.2.min.js"></script>
|
||||
<script src="lib/underscore-1.4.4.min.js"></script>
|
||||
<script src="lib/backbone-1.0.0.min.js"></script>
|
||||
|
@ -21,6 +21,35 @@ app.Controller = function() {
|
||||
callback();
|
||||
};
|
||||
|
||||
/**
|
||||
* Start the application by loading the view templates
|
||||
*/
|
||||
this.start = function(callback) {
|
||||
// the views to load
|
||||
var views = [
|
||||
'login',
|
||||
'compose',
|
||||
'folderlist',
|
||||
'messagelist',
|
||||
'messagelistitem',
|
||||
'read'
|
||||
];
|
||||
|
||||
// are we running in native app or in browser?
|
||||
if (document.URL.indexOf("http") === 0 || document.URL.indexOf("chrome") === 0) {
|
||||
console.log('Assuming Browser environment...');
|
||||
onDeviceReady();
|
||||
} else {
|
||||
console.log('Assuming Cordova environment...');
|
||||
document.addEventListener("deviceready", onDeviceReady, false);
|
||||
}
|
||||
|
||||
function onDeviceReady() {
|
||||
console.log('Starting app.');
|
||||
app.util.tpl.loadTemplates(views, callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Executes a number of commands
|
||||
*/
|
||||
|
31
src/js/mobile-loader.js
Normal file
31
src/js/mobile-loader.js
Normal file
@ -0,0 +1,31 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var controller,
|
||||
router;
|
||||
|
||||
/**
|
||||
* Load templates and start the application
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
controller = new app.Controller();
|
||||
controller.init(function() {
|
||||
controller.start(startApp);
|
||||
});
|
||||
});
|
||||
|
||||
function startApp() {
|
||||
// start backone.js router
|
||||
router = new app.Router();
|
||||
Backbone.history.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method shim to ease message posting between sandbox and main window
|
||||
*/
|
||||
app.util.postMessage = function(cmd, args, callback) {
|
||||
// handle the workload in the main window
|
||||
controller.execute(cmd, args, callback);
|
||||
};
|
||||
|
||||
}());
|
@ -20,6 +20,7 @@
|
||||
mainWindow = e.source;
|
||||
mainWindowOrigin = e.origin;
|
||||
|
||||
// start backone.js router
|
||||
router = new app.Router();
|
||||
Backbone.history.start();
|
||||
}
|
||||
|
@ -1,41 +1,21 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var views = [
|
||||
'login',
|
||||
'compose',
|
||||
'folderlist',
|
||||
'messagelist',
|
||||
'messagelistitem',
|
||||
'read'
|
||||
];
|
||||
var controller;
|
||||
|
||||
/**
|
||||
* Load templates and start the application
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
// are we running in native app or in browser?
|
||||
var isBrowser = false;
|
||||
if (document.URL.indexOf("http") === 0 || document.URL.indexOf("chrome") === 0) {
|
||||
isBrowser = true;
|
||||
}
|
||||
|
||||
if (!isBrowser) {
|
||||
document.addEventListener("deviceready", onDeviceReady, false);
|
||||
} else {
|
||||
onDeviceReady();
|
||||
}
|
||||
|
||||
function onDeviceReady() {
|
||||
console.log('Starting in Browser: ' + isBrowser);
|
||||
app.util.tpl.loadTemplates(views, startApp);
|
||||
}
|
||||
controller = new app.Controller();
|
||||
controller.init(function() {
|
||||
controller.start(startApp);
|
||||
});
|
||||
});
|
||||
|
||||
function startApp() {
|
||||
// sandboxed ui in iframe
|
||||
var sandbox = document.getElementById('sandboxFrame').contentWindow;
|
||||
var controller = new app.Controller();
|
||||
|
||||
// set global listener for events from sandbox
|
||||
window.onmessage = function(e) {
|
||||
@ -52,14 +32,11 @@
|
||||
});
|
||||
};
|
||||
|
||||
// init controller
|
||||
controller.init(function() {
|
||||
// init sandbox ui
|
||||
sandbox.postMessage({
|
||||
cmd: 'init',
|
||||
args: app.util.tpl.templates
|
||||
}, '*');
|
||||
});
|
||||
// init sandbox ui
|
||||
sandbox.postMessage({
|
||||
cmd: 'init',
|
||||
args: app.util.tpl.templates
|
||||
}, '*');
|
||||
}
|
||||
|
||||
}());
|
58
src/mobile.html
Normal file
58
src/mobile.html
Normal file
@ -0,0 +1,58 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Mail</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="css/jquery.mobile-1.2.0.min.css"/>
|
||||
<link rel="stylesheet" href="css/styles.css"/>
|
||||
|
||||
<!-- The Scripts -->
|
||||
<script src="lib/cordova-2.5.0.js"></script>
|
||||
<script src="lib/jquery-1.8.2.min.js"></script>
|
||||
<script src="lib/underscore-1.4.4.min.js"></script>
|
||||
<script src="lib/backbone-1.0.0.min.js"></script>
|
||||
<script src="js/jqm-config.js"></script>
|
||||
<script src="lib/jquery.mobile-1.2.0.min.js"></script>
|
||||
<script src="lib/lawnchair/lawnchair-git.js"></script>
|
||||
<script src="lib/lawnchair/lawnchair-adapter-webkit-sqlite-git.js"></script>
|
||||
<script src="lib/lawnchair/lawnchair-adapter-indexed-db-git.js"></script>
|
||||
|
||||
<script src="lib/forge/forge.rsa.bundle.js"></script>
|
||||
<script src="lib/uuid.js"></script>
|
||||
|
||||
<script src="js/app-config.js"></script>
|
||||
|
||||
<script src="js/model/email-model.js"></script>
|
||||
<script src="js/model/folder-model.js"></script>
|
||||
<script src="js/model/account-model.js"></script>
|
||||
<script src="js/model/publickey-model.js"></script>
|
||||
|
||||
<script src="js/crypto/util.js"></script>
|
||||
<script src="js/crypto/pbkdf2.js"></script>
|
||||
<script src="js/crypto/aes-cbc.js"></script>
|
||||
<script src="js/crypto/rsa.js"></script>
|
||||
<script src="js/crypto/crypto-batch.js"></script>
|
||||
<script src="js/crypto/crypto.js"></script>
|
||||
|
||||
<script src="js/dao/lawnchair-dao.js"></script>
|
||||
<script src="js/dao/devicestorage.js"></script>
|
||||
<script src="js/dao/cloudstorage-dao.js"></script>
|
||||
<script src="js/dao/keychain-dao.js"></script>
|
||||
<script src="js/dao/email-dao.js"></script>
|
||||
|
||||
<script src="js/view/login-view.js"></script>
|
||||
<script src="js/view/compose-view.js"></script>
|
||||
<script src="js/view/messagelist-view.js"></script>
|
||||
<script src="js/view/messagelistitem-view.js"></script>
|
||||
<script src="js/view/folderlist-view.js"></script>
|
||||
<script src="js/view/read-view.js"></script>
|
||||
|
||||
<script src="js/app-router.js"></script>
|
||||
<script src="js/app-controller.js"></script>
|
||||
<script src="js/mobile-loader.js"></script>
|
||||
</head>
|
||||
|
||||
<body></body>
|
||||
|
||||
</html>
|
@ -13,9 +13,6 @@
|
||||
<script src="lib/backbone-1.0.0.min.js"></script>
|
||||
<script src="js/jqm-config.js"></script>
|
||||
<script src="lib/jquery.mobile-1.2.0.min.js"></script>
|
||||
|
||||
<script src="lib/forge/forge.rsa.bundle.js"></script>
|
||||
<script src="lib/uuid.js"></script>
|
||||
|
||||
<script src="js/app-config.js"></script>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user