2015-12-18 16:50:36 +01:00
|
|
|
(function(document) {
|
2015-12-19 01:18:02 +01:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var app = document.querySelector('#app');
|
|
|
|
|
|
|
|
// Sets app default base URL
|
|
|
|
app.baseUrl = '/';
|
2016-06-22 22:10:27 +02:00
|
|
|
|
2015-12-18 16:50:36 +01:00
|
|
|
|
2016-05-18 14:12:55 +02:00
|
|
|
// don't display the install prompt if the user has *already* installed
|
|
|
|
window.addEventListener('beforeinstallprompt', function(event) {
|
|
|
|
if (window.matchMedia('(display-mode: standalone)').matches) {
|
|
|
|
return event.preventDefault();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-12-19 01:18:02 +01:00
|
|
|
app.displayInstalledToast = function() {
|
|
|
|
// Check to make sure caching is actually enabled—it won't be in the dev environment.
|
|
|
|
if (!Polymer.dom(document).querySelector('platinum-sw-cache').disabled) {
|
|
|
|
Polymer.dom(document).querySelector('#caching-complete').show();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-12-23 13:57:13 +01:00
|
|
|
app.displayToast = function(msg) {
|
|
|
|
var toast = Polymer.dom(document).querySelector('#toast');
|
|
|
|
toast.text = msg;
|
|
|
|
toast.show();
|
|
|
|
};
|
|
|
|
|
2015-12-19 01:18:02 +01:00
|
|
|
// Listen for template bound event to know when bindings
|
|
|
|
// have resolved and content has been stamped to the page
|
|
|
|
app.addEventListener('dom-change', function() {
|
|
|
|
console.log('Our app is ready to rock!');
|
2015-12-31 02:23:39 +01:00
|
|
|
app.conn = document.querySelector('connection-wrapper');
|
2015-12-19 01:18:02 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
// See https://github.com/Polymer/polymer/issues/1381
|
|
|
|
window.addEventListener('WebComponentsReady', function() {
|
|
|
|
// imports are loaded and elements have been registered
|
|
|
|
|
|
|
|
});
|
2015-12-18 16:50:36 +01:00
|
|
|
|
2015-12-26 13:33:16 +01:00
|
|
|
app._showAbout=function(){
|
|
|
|
document.querySelector('#pages').select(0);
|
|
|
|
};
|
2015-12-18 16:50:36 +01:00
|
|
|
})(document);
|