Add appcache support for offline standalone app

This commit is contained in:
Colin McLeod
2015-05-27 23:59:54 -07:00
parent 1796b0fb46
commit 280411f35c
27 changed files with 98 additions and 20 deletions

View File

@@ -1,14 +1,18 @@
/**
* BBCode Generator functions for embedding in the Elite Dangerous Forums
*/
angular.module('app').factory('Utils', ['$state','$http', function ($state, $http) {
angular.module('app').factory('Utils', ['$window','$state','$http', '$q', function ($window, $state, $http, $q) {
var shortenAPI = 'https://www.googleapis.com/urlshortener/v1/url?key=';
function shortenUrl(url) {
return $http.post(shortenAPI + GAPI_KEY, {longUrl:url}).then(function(response) {
return response.data.id;
});
if ($window.navigator.onLine) {
return $http.post(shortenAPI + GAPI_KEY, {longUrl:url}).then(function(response) {
return response.data.id;
});
} else {
return $q.reject({statusText: 'Not Online'});
}
}
function comparisonBBCode(facets, builds, link) {