Skip to content

Commit

Permalink
phonegap compatibility updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sheppard committed Feb 8, 2017
1 parent 286b217 commit ff62ca0
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 32 deletions.
3 changes: 3 additions & 0 deletions app/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
{{#ios.icons}}
<icon src="{{filename}}" width="{{width}}" height="{{height}}" />
{{/ios.icons}}
{{#ios-splash.icons}}
<splash src="{{filename}}" width="{{width}}" height="{{height}}" />
{{/ios-splash.icons}}
</platform>

<platform name="windows">
Expand Down
33 changes: 1 addition & 32 deletions app/index-phonegap.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,7 @@
<link rel="stylesheet" href="css/{{ project_name }}.css">
<script src="cordova.js"></script>
<script src="js/lib/require.js"></script>
<script>
function getBaseUrl() {
var baseurl = window.location.pathname.replace("index.html",'');
baseurl = baseurl.replace(/\/$/,'');
if (baseurl == 'www') {
// Windows
baseurl = '/www';
}
return baseurl;
}

require.config({
'config': {
'{{ project_name }}/config': {
'router': {
'base_url': getBaseUrl()
},
'store': {
'service': 'https://{{ domain }}',
'defaults': {'format': 'json'}
},
}
}
});
require(['js/{{ project_name }}'], function() {
require(['{{ project_name }}/main', 'wq/app'], function(ready, app) {
ready.then(function() {
app.replaceState('');
});
});
});
</script>
<script src="js/pginit.js"></script>
</head>
<body>
<p style='text-align: center'>
Expand Down
33 changes: 33 additions & 0 deletions app/js/pginit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
function getBaseUrl() {
var baseurl = window.location.pathname.replace("index.html",'');
baseurl = baseurl.replace(/\/$/,'');
if (baseurl == 'www') {
// Windows
baseurl = '/www';
}
return baseurl;
}

require.config({
'config': {
'{{ project_name }}/config': {
'router': {
'base_url': getBaseUrl()
},
'store': {
'service': 'https://{{ domain }}',
'defaults': {'format': 'json'}
},
}
}
});

document.addEventListener('deviceready', function() {
require(['js/{{ project_name }}'], function() {
require(['{{ project_name }}/main', 'wq/app'], function(ready, app) {
ready.then(function() {
app.replaceState('');
});
});
});
});

0 comments on commit ff62ca0

Please sign in to comment.