diff --git a/.gitignore b/.gitignore index 27af7609..ec388491 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,11 @@ .DS_Store .idea +*.sublime-workspace # Node.js package manager -/node_modules -/npm-debug.log +node_modules +npm-debug.log dist -package_dist +releases webogram*.zip -*.sublime-workspace \ No newline at end of file +app/js/templates.js \ No newline at end of file diff --git a/app/css/app.css b/app/css/app.css index c63dd0c9..63f16628 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -1,7 +1,7 @@ /* app css stylesheet */ html { - background: #dee4e9 url(../img/bg_tile.png?1) 0 0 repeat; + background: #dee4e9 url(../img/bg_tile.png) 0 0 repeat; /*background-size: 300px 468px;*/ } body { @@ -255,12 +255,12 @@ input[type="number"]::-webkit-inner-spin-button { height: 18px; vertical-align: text-top; - background: url(../img/icons/IconsetW.png?1) -15px -419px no-repeat; + background: url(../img/icons/IconsetW.png) -15px -419px no-repeat; background-size: 42px 620px; opacity: 0.6; } .is_1x .icon-back { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .tg_page_head .navbar-quick-nav a:hover .icon-back { opacity: 1; @@ -484,7 +484,7 @@ input[type="number"]::-webkit-inner-spin-button { margin-right: -7px; } .im_dialogs_col .nano > .pane { - background : rgba(0,0,0,.0); + background : rgba(0,0,0,0.0); width : 12px; right: 0px; -webkit-transition : .2s; @@ -510,7 +510,7 @@ input[type="number"]::-webkit-inner-spin-button { .im_dialogs_search_field { font-size: 12px; line-height: normal; - background: #F2F2F2 url(../img/icons/IconsetW.png?1) -6px -205px no-repeat; + background: #F2F2F2 url(../img/icons/IconsetW.png) -6px -205px no-repeat; background-size: 42px 620px; border: 1px solid #F2F2F2; border-radius: 3px; @@ -519,7 +519,7 @@ input[type="number"]::-webkit-inner-spin-button { margin: 0; } .is_1x .im_dialogs_search_field { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_dialogs_search_field:focus, .im_dialogs_search_field:active { @@ -534,12 +534,12 @@ input[type="number"]::-webkit-inner-spin-button { width: 13px; height: 13px; vertical-align: text-top; - background: url(../img/icons/IconsetW.png?1) -15px -192px no-repeat; + background: url(../img/icons/IconsetW.png) -15px -192px no-repeat; background-size: 42px 620px; opacity: 0.6; } .is_1x .im_dialogs_search_clear { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_dialogs_search_clear:hover { opacity: 1; @@ -787,11 +787,11 @@ a.im_dialog:hover .im_dialog_date { margin-top: 7px; margin-left: 6px; - background: url(../img/icons/IconsetW.png?1) -17px -444px no-repeat; + background: url(../img/icons/IconsetW.png) -17px -444px no-repeat; background-size: 42px 620px; } .is_1x .icon-caret { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_history_panel_media_dropdown .dropdown-menu { @@ -994,11 +994,11 @@ div.im_message_video_thumb { width: 15px; height: 19px; - background: url(../img/icons/IconsetW.png?1) -14px -389px no-repeat; + background: url(../img/icons/IconsetW.png) -14px -389px no-repeat; background-size: 42px 620px; } .is_1x .icon-geo-point { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } @@ -1022,7 +1022,7 @@ div.im_message_video_thumb { height: 38px; vertical-align: text-top; - background: #F2F2F2 url(../img/icons/IconsetW.png?1) -2px -229px no-repeat; + background: #F2F2F2 url(../img/icons/IconsetW.png) -2px -229px no-repeat; background-size: 42px 620px; border-radius: 3px; margin-right: 10px; @@ -1030,7 +1030,7 @@ div.im_message_video_thumb { .is_1x .icon-document, .is_1x .icon-photo, .is_1x .icon-video { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_message_selected .icon-document, @@ -1109,13 +1109,13 @@ img.im_message_document_thumb { height: 38px; vertical-align: text-top; - background: #F2F2F2 url(../img/icons/IconsetW.png?1) -2px -277px no-repeat; + background: #F2F2F2 url(../img/icons/IconsetW.png) -2px -277px no-repeat; background-size: 42px 620px; border-radius: 3px; margin-right: 10px; } .is_1x .icon-audio { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_message_audio_info { @@ -1246,14 +1246,14 @@ img.im_message_document_thumb { display: none; width: 16px; height: 10px; - background: url(../img/icons/Checks2_2x.png?1) 0 0 no-repeat; + background: url(../img/icons/Checks2_2x.png) 0 0 no-repeat; background-size: 16px 10px; top: 2px; position: relative; } .icon-message-status-tick.message-status-unread-tick { /*width: 13px;*/ - background: url(../img/icons/Checks1_2x.png?1) 0 0 no-repeat; + background: url(../img/icons/Checks1_2x.png) 0 0 no-repeat; background-size: 16px 10px; } .im_message_date { @@ -1378,12 +1378,12 @@ textarea.im_message_field { width: 19px; height: 23px; vertical-align: text-top; - background: url(../img/icons/IconsetW.png?1) -12px -68px no-repeat; + background: url(../img/icons/IconsetW.png) -12px -68px no-repeat; background-size: 42px 620px; opacity: 0.8; } .is_1x .icon-paperclip { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_attach:hover .icon-paperclip { opacity: 1; @@ -1406,12 +1406,12 @@ textarea.im_message_field { width: 23px; height: 23px; vertical-align: text-top; - background: url(../img/icons/IconsetW.png?1) -10px -4px no-repeat; + background: url(../img/icons/IconsetW.png) -10px -4px no-repeat; background-size: 42px 620px; opacity: 0.8; } .is_1x .icon-emoji { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_emoji_btn:hover .icon-emoji { opacity: 1; @@ -1456,12 +1456,12 @@ textarea.im_message_field { width: 25px; height: 21px; vertical-align: text-top; - background: url(../img/icons/IconsetW.png?1) -9px -132px no-repeat; + background: url(../img/icons/IconsetW.png) -9px -132px no-repeat; background-size: 42px 620px; opacity: 0.8; } .is_1x .icon-camera { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_media_attach:hover .icon-camera { opacity: 1; @@ -1879,14 +1879,14 @@ img.img_fullsize { .emoji-menu-tail { display: none; - background: url(../img/icons/IconsetW.png?1) -14px -268px no-repeat; + background: url(../img/icons/IconsetW.png) -14px -268px no-repeat; background-size: 42px 620px; width: 14px; height: 7px; margin: 0 83px; } .is_1x .emoji-menu-tail { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } @@ -2030,7 +2030,7 @@ img.img_fullsize { .contacts_modal_search_field { font-size: 12px; line-height: normal; - background: #F2F2F2 url(../img/icons/IconsetW.png?1) -6px -205px no-repeat; + background: #F2F2F2 url(../img/icons/IconsetW.png) -6px -205px no-repeat; background-size: 42px 620px; border: 1px solid #F2F2F2; border-radius: 3px; @@ -2039,7 +2039,7 @@ img.img_fullsize { margin: 0; } .is_1x .contacts_modal_search_field { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .contacts_modal_search_field:focus, .contacts_modal_search_field:active { @@ -2054,12 +2054,12 @@ img.img_fullsize { width: 13px; height: 13px; vertical-align: text-top; - background: url(../img/icons/IconsetW.png?1) -15px -192px no-repeat; + background: url(../img/icons/IconsetW.png) -15px -192px no-repeat; background-size: 42px 620px; opacity: 0.6; } .is_1x .contacts_modal_search_clear { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .contacts_modal_search_clear:hover { opacity: 1; @@ -2131,12 +2131,12 @@ a.contacts_modal_contact:hover .contacts_modal_contact_status { top: 22px; width: 17px; height: 15px; - background: url(../img/icons/IconsetW.png?1) -13px -366px no-repeat; + background: url(../img/icons/IconsetW.png) -13px -366px no-repeat; background-size: 42px 620px; opacity: 0.5; } .is_1x .icon-contact-tick { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .contacts_modal_members_list a.contacts_modal_contact:hover .icon-contact-tick { background-position: -13px -366px; @@ -2229,11 +2229,11 @@ a.contacts_modal_contact:hover .contacts_modal_contact_status { width: 12px; height: 15px; - background: url(../img/icons/IconsetW.png?1) -15px -319px no-repeat; + background: url(../img/icons/IconsetW.png) -15px -319px no-repeat; background-size: 42px 620px; } .is_1x .icon-delete { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_message_selected { background: #f2f6fa; @@ -2276,11 +2276,11 @@ a.contacts_modal_contact:hover .contacts_modal_contact_status { width: 26px; height: 26px; margin: 13px 0 0 40px; - background: url(../img/icons/IconsetW.png?1) -9px -516px no-repeat; + background: url(../img/icons/IconsetW.png) -9px -516px no-repeat; background-size: 42px 620px; } .is_1x .icon-select-tick { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_history_selectable .icon-select-tick, .im_content_message_select_area:hover .icon-select-tick { diff --git a/app/index.html b/app/index.html index 29a5a0b1..4e23df0d 100644 --- a/app/index.html +++ b/app/index.html @@ -4,10 +4,14 @@ Webogram + + - + - + + + @@ -21,31 +25,39 @@
- + + - + - - - - - + + + + + - + - + + + + + + + + + + + + - - - - - - - + \ No newline at end of file diff --git a/app/js/app.js b/app/js/app.js index 9d6ea783..cb8b4501 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -30,9 +30,12 @@ angular.module('myApp', [ 'ngAnimate', 'ngSanitize', 'ui.bootstrap', + 'mtproto.services', 'myApp.filters', 'myApp.services', - 'mtproto.services', + /*PRODUCTION_ONLY_BEGIN + 'myApp.templates', + PRODUCTION_ONLY_END*/ 'myApp.directives', 'myApp.controllers' ]). @@ -63,9 +66,9 @@ config(['$locationProvider', '$routeProvider', '$compileProvider', function($loc // $locationProvider.html5Mode(true); - $routeProvider.when('/', {templateUrl: 'partials/welcome.html?4', controller: 'AppWelcomeController'}); - $routeProvider.when('/login', {templateUrl: 'partials/login.html?5', controller: 'AppLoginController'}); - $routeProvider.when('/im', {templateUrl: 'partials/im.html?13', controller: 'AppIMController', reloadOnSearch: false}); + $routeProvider.when('/', {templateUrl: 'partials/welcome.html', controller: 'AppWelcomeController'}); + $routeProvider.when('/login', {templateUrl: 'partials/login.html', controller: 'AppLoginController'}); + $routeProvider.when('/im', {templateUrl: 'partials/im.html', controller: 'AppIMController', reloadOnSearch: false}); $routeProvider.otherwise({redirectTo: '/'}); }]); diff --git a/app/js/controllers.js b/app/js/controllers.js index 6de7255b..cdd727c4 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -168,7 +168,7 @@ angular.module('myApp.controllers', []) $scope.isLoggedIn = true; $scope.openSettings = function () { $modal.open({ - templateUrl: 'partials/settings_modal.html?3', + templateUrl: 'partials/settings_modal.html', controller: 'SettingsModalController', scope: $rootScope.$new(), windowClass: 'settings_modal_window' @@ -191,7 +191,7 @@ angular.module('myApp.controllers', []) scope.userIDs = userIDs; $modal.open({ - templateUrl: 'partials/chat_create_modal.html?3', + templateUrl: 'partials/chat_create_modal.html', controller: 'ChatCreateModalController', scope: scope, windowClass: 'contacts_modal_window' @@ -979,7 +979,7 @@ angular.module('myApp.controllers', []) scope.chatID = $scope.chatID; $modal.open({ - templateUrl: 'partials/chat_edit_modal.html?3', + templateUrl: 'partials/chat_edit_modal.html', controller: 'ChatEditModalController', scope: scope, windowClass: 'contacts_modal_window' diff --git a/app/js/directives.js b/app/js/directives.js index e23d52e3..6ab3bac5 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -16,7 +16,7 @@ angular.module('myApp.directives', ['myApp.filters']) restrict: 'AE', scope: true, translude: false, - templateUrl: 'partials/dialog.html?5' + templateUrl: 'partials/dialog.html' }; }) @@ -25,7 +25,7 @@ angular.module('myApp.directives', ['myApp.filters']) restrict: 'AE', scope: true, translude: false, - templateUrl: 'partials/message.html?7' + templateUrl: 'partials/message.html' }; }) diff --git a/app/js/lib/mtproto.js b/app/js/lib/mtproto.js index f032152c..4682afa5 100644 --- a/app/js/lib/mtproto.js +++ b/app/js/lib/mtproto.js @@ -1122,7 +1122,7 @@ factory('MtpAuthorizer', function (MtpDcConfigurator, MtpRsaKeysManager, MtpSecu console.log('PQ factorization start'); if (!!window.Worker) { - var worker = new Worker('js/lib/pq_worker.js?1'); + var worker = new Worker('js/lib/pq_worker.js'); worker.onmessage = function (e) { auth.p = e.data[0]; @@ -1416,7 +1416,7 @@ factory('MtpAesService', function ($q) { }; } - var worker = new Worker('js/lib/aes_worker.js?2'), + var worker = new Worker('js/lib/aes_worker.js'), taskID = 0, awaiting = {}; @@ -1468,7 +1468,7 @@ factory('MtpSha1Service', function ($q) { }; } - var worker = new Worker('js/lib/sha1_worker.js?2'), + var worker = new Worker('js/lib/sha1_worker.js'), taskID = 0, awaiting = {}; diff --git a/app/js/lib/pq_worker.js b/app/js/lib/pq_worker.js index 3cc216a7..721a2c24 100644 --- a/app/js/lib/pq_worker.js +++ b/app/js/lib/pq_worker.js @@ -6,7 +6,7 @@ */ importScripts( - '../../vendor/console-polyfill/console-polyfill.js?1', + '../../vendor/console-polyfill/console-polyfill.js', 'mtproto.js', '../../vendor/jsbn/jsbn_combined.js' ); diff --git a/app/js/lib/sha1_worker.js b/app/js/lib/sha1_worker.js index 5dee15f0..1d7cd87f 100644 --- a/app/js/lib/sha1_worker.js +++ b/app/js/lib/sha1_worker.js @@ -6,9 +6,9 @@ */ importScripts( - '../../vendor/console-polyfill/console-polyfill.js?1', + '../../vendor/console-polyfill/console-polyfill.js', 'mtproto.js', - '../../vendor/cryptoJS/crypto.js?1' + '../../vendor/cryptoJS/crypto.js' ); onmessage = function (e) { diff --git a/app/js/services.js b/app/js/services.js index 79b659d9..de2334fa 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -290,7 +290,7 @@ angular.module('myApp.services', []) scope.userID = userID; var modalInstance = $modal.open({ - templateUrl: 'partials/user_modal.html?2', + templateUrl: 'partials/user_modal.html', controller: 'UserModalController', scope: scope, windowClass: 'user_modal_window' @@ -444,7 +444,7 @@ angular.module('myApp.services', []) scope.chatID = chatID; var modalInstance = $modal.open({ - templateUrl: 'partials/chat_modal.html?4', + templateUrl: 'partials/chat_modal.html', controller: 'ChatModalController', windowClass: 'chat_modal_window', scope: scope @@ -1792,7 +1792,7 @@ angular.module('myApp.services', []) scope.photoID = photoID; var modalInstance = $modal.open({ - templateUrl: 'partials/photo_modal.html?1', + templateUrl: 'partials/photo_modal.html', controller: 'PhotoModalController', scope: scope }); @@ -1892,7 +1892,7 @@ angular.module('myApp.services', []) scope.player = {}; var modalInstance = $modal.open({ - templateUrl: 'partials/video_modal.html?1', + templateUrl: 'partials/video_modal.html', controller: 'VideoModalController', scope: scope }); diff --git a/app/partials/im.html b/app/partials/im.html index 54ce1021..735e2e22 100644 --- a/app/partials/im.html +++ b/app/partials/im.html @@ -1,4 +1,4 @@ -
+
diff --git a/app/partials/login.html b/app/partials/login.html index 5cd289d5..b52c3b38 100644 --- a/app/partials/login.html +++ b/app/partials/login.html @@ -1,4 +1,4 @@ -
+
@@ -35,4 +35,4 @@ {{progress.enabled ? 'Checking code...' : 'Sign in'}} -
\ No newline at end of file +
diff --git a/app/partials/welcome.html b/app/partials/welcome.html index c4c721ba..3071b474 100644 --- a/app/partials/welcome.html +++ b/app/partials/welcome.html @@ -1,4 +1,4 @@ -
+
@@ -14,4 +14,4 @@ Start Messaging
- \ No newline at end of file + diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 00000000..ff7d5b0d --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,123 @@ +var gulp = require('gulp'); +var es = require('event-stream'); +var pj = require('./package.json'); +var $ = require('gulp-load-plugins')(); +var concat = require('gulp-concat'); + + +// The generated file is being created at src +// so it can be fetched by usemin. +gulp.task('templates', function() { + return gulp.src('app/partials/*.html') + .pipe($.angularTemplatecache('templates.js', { + root: 'partials', + module: 'myApp.templates', + standalone: true + })) + .pipe(gulp.dest('app/js')); +}); + +gulp.task('usemin', ['templates', 'enable-production'], function() { + return gulp.src('app/index.html') + .pipe($.usemin({ + html: [$.minifyHtml({empty: true})], + js: ['concat', $.rev()], + css: [$.minifyCss(), 'concat'] + })) + .pipe(gulp.dest('dist')); +}); + +gulp.task('copy', function() { + return es.concat( + gulp.src(['app/favicon.ico', 'app/favicon_unread.ico', 'app/manifest.webapp', 'app/manifest.json', 'app/**/*worker.js']) + .pipe(gulp.dest('dist')), + gulp.src(['app/img/**/*', '!app/img/screenshot*']) + .pipe(gulp.dest('dist/img')), + gulp.src('app/vendor/console-polyfill/console-polyfill.js') + .pipe(gulp.dest('dist/vendor/console-polyfill')), + gulp.src('app/js/lib/mtproto.js') + .pipe(gulp.dest('dist/js/lib')), + gulp.src('app/js/lib/config.js') + .pipe(gulp.dest('dist/js/lib')), + gulp.src('app/vendor/jsbn/jsbn_combined.js') + .pipe(gulp.dest('dist/vendor/jsbn')), + gulp.src('app/vendor/cryptoJS/crypto.js') + .pipe(gulp.dest('dist/vendor/cryptoJS')) + ); +}); + +gulp.task('compress-dist', ['add-csp'], function() { + return gulp.src('dist/**/*') + .pipe($.zip('webogram_v' + pj.version + '.zip')) + .pipe(gulp.dest('releases')); +}); + +gulp.task('cleanup-dist', ['compress-dist'], function() { + return gulp.src(['releases/**/*', '!releases/*.zip']).pipe($.clean()); +}); + +gulp.task('add-csp', ['build'], function() { + return gulp.src('dist/index.html') + .pipe($.replace('', '')) + .pipe(gulp.dest('dist')); +}); + +gulp.task('update-version-manifests', function() { + return gulp.src(['app/manifest.webapp', 'app/manifest.json']) + .pipe($.replace(/"version": ".*",/, '"version": "' + pj.version + '",')) + .pipe(gulp.dest('app')); +}); + +gulp.task('update-version-settings', function() { + return gulp.src('app/partials/settings_modal.html') + .pipe($.replace(/alpha .*<\/span>/, 'alpha ' + pj.version + '<\/span>')) + .pipe(gulp.dest('app/partials')); +}); + +gulp.task('update-version-comments', function() { + return gulp.src('app/**/*.js') + .pipe($.replace(/Webogram v[0-9.]*/, 'Webogram v' + pj.version)) + .pipe(gulp.dest('app')); +}); + + +gulp.task('enable-production', function() { + return es.concat( + gulp.src('app/**/*.html') + .pipe($.replace(/PRODUCTION_ONLY_BEGIN/g, 'PRODUCTION_ONLY_BEGIN-->')) + .pipe($.replace(/PRODUCTION_ONLY_END/, '/g, 'PRODUCTION_ONLY_BEGIN')) + .pipe($.replace(/