From dc973f594a884bc8a6e5d1c07d0ee9c9924b4e3a Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Wed, 25 Jun 2014 15:24:47 +0400 Subject: [PATCH] Improved iOS standalone experience --- app/css/app.css | 3 +++ app/js/app.js | 29 +++++++++++++++-------------- app/js/lib/config.js | 1 + app/webogram.appcache | 2 +- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/app/css/app.css b/app/css/app.css index e904816f..821ef27f 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -194,6 +194,9 @@ input[type="number"] { margin: 0; } +.ios_standalone .tg_page_head .navbar > .container { + margin-top: 20px; +} .tg_page_head .navbar > .container .navbar-brand { padding: 9px 15px; opacity: 0.9; diff --git a/app/js/app.js b/app/js/app.js index 74cb4deb..9f4e1448 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -7,16 +7,6 @@ 'use strict'; -$(document.body) - .addClass(Config.Navigator.osX ? 'osx' : 'non_osx') - .addClass(Config.Navigator.retina ? 'is_2x' : 'is_1x'); - -$(window).on('load', function () { - setTimeout(function () { - window.scrollTo(0,1); - }, 0); -}); - // Declare app level module which depends on filters, and services angular.module('myApp', [ 'ngRoute', @@ -51,10 +41,6 @@ config(['$locationProvider', '$routeProvider', '$compileProvider', 'StorageProvi } } - if (Config.Modes.test) { - StorageProvider.setPrefix('t_'); - } - $.emojiarea.spritesheetPath = 'img/emojisprite_!.png'; $.emojiarea.spritesheetDimens = Config.EmojiCategorySpritesheetDimens; $.emojiarea.iconSize = 20; @@ -64,6 +50,9 @@ config(['$locationProvider', '$routeProvider', '$compileProvider', 'StorageProvi $compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|file|blob|filesystem|chrome-extension|app):|data:image\//); $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|file|mailto|blob|filesystem|chrome-extension|app):|data:image\//); + if (Config.Modes.test) { + StorageProvider.setPrefix('t_'); + } $routeProvider.when('/', {templateUrl: 'partials/welcome.html', controller: 'AppWelcomeController'}); $routeProvider.when('/login', {templateUrl: 'partials/login.html', controller: 'AppLoginController'}); @@ -71,3 +60,15 @@ config(['$locationProvider', '$routeProvider', '$compileProvider', 'StorageProvi $routeProvider.otherwise({redirectTo: '/'}); }]); + + +(function () { + var classes = [ + Config.Navigator.osX ? 'osx' : 'non_osx', + Config.Navigator.retina ? 'is_2x' : 'is_1x' + ]; + if (Config.Modes.ios_standalone) { + classes.push('ios_standalone'); + } + $(document.body).addClass(classes.join(' ')); +})(); \ No newline at end of file diff --git a/app/js/lib/config.js b/app/js/lib/config.js index 4c0fb8aa..29dd28d9 100644 --- a/app/js/lib/config.js +++ b/app/js/lib/config.js @@ -28,6 +28,7 @@ Config.Modes = { test: location.search.indexOf('test=1') > 0, debug: location.search.indexOf('debug=1') > 0, packed: location.protocol == 'app:' || location.protocol == 'chrome-extension:', + ios_standalone: window.navigator.standalone && navigator.userAgent.match(/iOS|iPhone|iPad/), chrome_packed: window.chrome && chrome.app && chrome.app.window && true || false }; diff --git a/app/webogram.appcache b/app/webogram.appcache index 70b57f2a..8acfe5e6 100644 --- a/app/webogram.appcache +++ b/app/webogram.appcache @@ -1,6 +1,6 @@ CACHE MANIFEST -# 15 +# 18 NETWORK: *