Browse Source

Bugfixes

master
Igor Zhukov 9 years ago
parent
commit
829be1817f
  1. 2
      Makefile
  2. 3
      app/badbrowser.html
  3. 8
      app/index.html
  4. 36
      app/js/directives.js
  5. 4
      app/js/lib/ng_utils.js
  6. 2
      app/js/lib/push_worker.js
  7. 17
      app/js/messages_manager.js
  8. 2
      app/partials/desktop/message.html
  9. 2
      app/partials/desktop/message_service.html
  10. 2
      app/partials/mobile/message.html
  11. 2
      app/partials/mobile/message_service.html
  12. 2
      app/vendor/jquery.nanoscroller/nanoscroller.js
  13. 36
      gulpfile.js

2
Makefile

@ -13,7 +13,7 @@ ghdist: @@ -13,7 +13,7 @@ ghdist:
cd dist && git checkout gh-pages
publish:
./node_modules/gulp/bin/gulp.js build
./node_modules/gulp/bin/gulp.js publish
echo -n "Please open http://localhost:8000/dist/index.html and check if everything works fine." && read -e
./node_modules/gulp/bin/gulp.js deploy

3
app/badbrowser.html

@ -5,8 +5,7 @@ @@ -5,8 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Telegram Web</title>
<!-- build:css css/app.css -->
<link rel="stylesheet" href="vendor/angular/angular-csp.css"/>
<!-- build:css css/badbrowser.css -->
<link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" href="css/app.css"/>
<!-- endbuild -->

8
app/index.html

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
<!doctype html>
<html lang="en" manifest="webogram.appcache" ng-csp="" xmlns:ng="http://angularjs.org" id="ng-app">
<html lang="en" manifest="webogram.appcache" ng-csp="" xmlns:ng="http://angularjs.org" id="ng-app" style="display: none;">
<head>
<!--[if lte IE 9]>
<meta HTTP-EQUIV="REFRESH" content="0; url=badbrowser.html">
@ -17,12 +17,6 @@ @@ -17,12 +17,6 @@
<link rel="manifest" href="manifest.json"/>
<style>
html {
display: none;
}
</style>
<!-- <link rel="stylesheet" href="css/font.css"/> -->
<!-- <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600&amp;subset=cyrillic,cyrillic-ext,latin,latin-ext" rel="stylesheet" type="text/css"> -->

36
app/js/directives.js

@ -501,28 +501,24 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -501,28 +501,24 @@ angular.module('myApp.directives', ['myApp.filters'])
.directive('myReplyMessage', function (AppMessagesManager, AppPeersManager, $rootScope) {
return {
templateUrl: templateUrl('reply_message'),
scope: {
'replyMessage': '=myReplyMessage'
},
scope: {},
link: link
}
function link ($scope, element, attrs) {
if (attrs.watch) {
$scope.$watch('replyMessage', function () {
checkMessage($scope, element)
$scope.$parent.$watch(attrs.myReplyMessage, function (mid) {
checkMessage($scope, element, mid)
})
} else {
checkMessage($scope, element)
var mid = $scope.$parent.$eval(attrs.myReplyMessage)
checkMessage($scope, element, mid)
}
}
function checkMessage ($scope, element) {
var message = $scope.replyMessage
if (!message.loading) {
updateMessage($scope, element)
} else {
var mid = message.mid
function checkMessage ($scope, element, mid) {
var message = $scope.replyMessage = AppMessagesManager.wrapSingleMessage(mid)
if (message.loading) {
var stopWaiting = $scope.$on('messages_downloaded', function (e, mids) {
if (mids.indexOf(mid) != -1) {
$scope.replyMessage = AppMessagesManager.wrapForDialog(mid)
@ -530,6 +526,8 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -530,6 +526,8 @@ angular.module('myApp.directives', ['myApp.filters'])
stopWaiting()
}
})
} else {
updateMessage($scope, element)
}
}
@ -559,18 +557,14 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -559,18 +557,14 @@ angular.module('myApp.directives', ['myApp.filters'])
.directive('myPinnedMessage', function (AppMessagesManager, AppPeersManager, $rootScope) {
return {
templateUrl: templateUrl('pinned_message'),
scope: {
'pinnedMessage': '=myPinnedMessage'
},
scope: {},
link: link
}
function link ($scope, element, attrs) {
var message = $scope.pinnedMessage
if (!message.loading) {
updateMessage($scope, element)
} else {
var mid = message.mid
var mid = $scope.$parent.$eval(attrs.myPinnedMessage)
var message = $scope.pinnedMessage = AppMessagesManager.wrapSingleMessage(mid)
if (message.loading) {
var stopWaiting = $scope.$on('messages_downloaded', function (e, mids) {
if (mids.indexOf(mid) != -1) {
$scope.pinnedMessage = AppMessagesManager.wrapForDialog(mid)
@ -578,6 +572,8 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -578,6 +572,8 @@ angular.module('myApp.directives', ['myApp.filters'])
stopWaiting()
}
})
} else {
updateMessage($scope, element)
}
}

4
app/js/lib/ng_utils.js

@ -1455,8 +1455,6 @@ angular.module('izhukov.utils', []) @@ -1455,8 +1455,6 @@ angular.module('izhukov.utils', [])
if (!entities.length) {
newText = newText.trim()
}
console.warn(dT(), newText, entities);
// throw new Error(11);
return newText
}
@ -1819,8 +1817,6 @@ angular.module('izhukov.utils', []) @@ -1819,8 +1817,6 @@ angular.module('izhukov.utils', [])
code.push(text.substr(lastOffset))
console.log(code, entities)
return code.join('')
}

2
app/js/lib/push_worker.js

@ -1 +1 @@ @@ -1 +1 @@
console.log('push worker')
console.log('push worker placeholder')

17
app/js/messages_manager.js

@ -213,8 +213,10 @@ angular.module('myApp.services') @@ -213,8 +213,10 @@ angular.module('myApp.services')
var offsetDate = 0
var offsetID = 0
var offsetPeerID = 0
var offsetIndex = 0
if (dialogsOffsetDate) {
offsetDate = dialogsOffsetDate + ServerTimeManager.serverTimeOffset
offsetIndex = dialogsOffsetDate * 0x10000
}
return MtpApiManager.invokeApi('messages.getDialogs', {
offset_date: offsetDate,
@ -233,8 +235,13 @@ angular.module('myApp.services') @@ -233,8 +235,13 @@ angular.module('myApp.services')
saveMessages(dialogsResult.messages)
var maxSeenIdIncremented = offsetDate ? true : false
var hasPrepend = false
angular.forEach(dialogsResult.dialogs, function (dialog) {
saveConversation(dialog)
if (offsetIndex && dialog.index > offsetIndex) {
newDialogsToHandle[dialog.peerID] = dialog
hasPrepend = true
}
if (!maxSeenIdIncremented &&
!AppPeersManager.isChannel(AppPeersManager.getPeerID(dialog.peer))) {
@ -248,6 +255,11 @@ angular.module('myApp.services') @@ -248,6 +255,11 @@ angular.module('myApp.services')
dialogs.length >= dialogsResult.count) {
allDialogsLoaded = true
}
if (hasPrepend &&
!newDialogsHandlePromise) {
newDialogsHandlePromise = $timeout(handleNewDialogs, 0)
}
})
}
@ -2143,11 +2155,6 @@ angular.module('myApp.services') @@ -2143,11 +2155,6 @@ angular.module('myApp.services')
}
}
var replyToMsgID = message.reply_to_mid
if (replyToMsgID) {
message.reply_to_msg = wrapSingleMessage(replyToMsgID)
}
return messagesForHistory[msgID] = message
}

2
app/partials/desktop/message.html

@ -48,7 +48,7 @@ @@ -48,7 +48,7 @@
</span>
<a class="im_message_reply_wrap" my-reply-message="historyMessage.reply_to_msg" ng-if="::historyMessage.reply_to_mid"></a>
<a class="im_message_reply_wrap" my-reply-message="::historyMessage.reply_to_mid" ng-if="::historyMessage.reply_to_mid"></a>
<div ng-if="::historyMessage.fwdFromID || false" class="im_message_fwd_from">
<span class="copyonly"><span my-i18n="message_forwarded_message"></span>:&nbsp;</span>

2
app/partials/desktop/message_service.html

@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
<span ng-switch-when="messageActionChannelDeletePhoto" my-i18n="message_service_removed_channel_photo"></span>
<span ng-switch-when="messageActionPinMessage" my-i18n="message_service_pinned_message">
<my-i18n-param name="message"><a class="im_service_message_pinned" my-pinned-message="historyMessage.reply_to_msg"></a></my-i18n-param>
<my-i18n-param name="message"><a class="im_service_message_pinned" my-pinned-message="::historyMessage.reply_to_mid"></a></my-i18n-param>
</span>

2
app/partials/mobile/message.html

@ -46,7 +46,7 @@ @@ -46,7 +46,7 @@
<a class="im_message_author" my-peer-link="historyMessage.fromID" short="historyMessage.toID > 0" color="historyMessage.toID < 0" no-watch="true"></a>
<a ng-if="::historyMessage.viaBotID && !historyMessage.fwdFromID" class="im_message_author_via" my-i18n="message_via_bot" ng-click="selectInlineBot(historyMessage.viaBotID, $event)"><my-i18n-param name="bot"><span class="im_message_fwd_author" my-peer-link="historyMessage.viaBotID" username="true" no-watch="true"></span></my-i18n-param></a>
<a class="im_message_reply_wrap" my-reply-message="historyMessage.reply_to_msg" ng-if="::historyMessage.reply_to_mid"></a>
<a class="im_message_reply_wrap" my-reply-message="::historyMessage.reply_to_mid" ng-if="::historyMessage.reply_to_mid"></a>
<div ng-if="::!!historyMessage.fwdFromID &amp;&amp; !historyMessage.media" class="im_message_fwd_header" ng-switch="!!historyMessage.viaBotID" my-i18n>
<span ng-switch-when="true" my-i18n-format="message_forwarded_via_message_mobile"></span>

2
app/partials/mobile/message_service.html

@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
<span ng-switch-when="messageActionChannelDeletePhoto" my-i18n="message_service_removed_channel_photo"></span>
<span ng-switch-when="messageActionPinMessage" my-i18n="message_service_pinned_message">
<my-i18n-param name="message"><a my-pinned-message="historyMessage.reply_to_msg"></a></my-i18n-param>
<my-i18n-param name="message"><a my-pinned-message="historyMessage.reply_to_mid"></a></my-i18n-param>
</span>
<span ng-switch-default my-i18n="message_service_unsupported_action">

2
app/vendor/jquery.nanoscroller/nanoscroller.js vendored

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
/*! nanoScrollerJS - v0.8.4 - 2014
* http://jamesflorentino.github.com/nanoScrollerJS/
* Copyright (c) 2014 James Florentino; Licensed MIT */
(function($, window, document) {
;(function($, window, document) {
"use strict";
var BROWSER_IS_IE7, BROWSER_SCROLLBAR_WIDTH, DOMSCROLL, DOWN, DRAG, ENTER, KEYDOWN, KEYUP, MOUSEDOWN, MOUSEENTER, MOUSEMOVE, MOUSEUP, MOUSEWHEEL, NanoScroll, PANEDOWN, RESIZE, SCROLL, SCROLLBAR, TOUCHMOVE, UP, WHEEL, cAF, defaults, getBrowserScrollbarWidth, hasTransform, isFFWithBuggyScrollbar, rAF, transform, _elementStyle, _prefixStyle, _vendor;
defaults = {

36
gulpfile.js

@ -7,6 +7,8 @@ var http = require('http') @@ -7,6 +7,8 @@ var http = require('http')
var st = require('st')
var del = require('del')
var runSequence = require('run-sequence')
var swPrecache = require('sw-precache')
// The generated file is being created at src
// so it can be fetched by usemin.
@ -19,6 +21,19 @@ gulp.task('templates', function () { @@ -19,6 +21,19 @@ gulp.task('templates', function () {
}))
.pipe(gulp.dest('app/js'))
})
gulp.task('clean-templates', function () {
return del(['app/js/templates.js'])
})
gulp.task('usemin-index', function () {
return gulp.src('app/index.html')
.pipe($.usemin({
html: [$.minifyHtml({empty: true})],
js: ['concat', $.ngAnnotate()/*, $.uglify({outSourceMap: false})*/],
css: ['concat', $.minifyCss({compatibility: true, keepBreaks: true})]
}))
.pipe(gulp.dest('dist'))
})
gulp.task('usemin-badbrowser', function() {
return gulp.src('app/badbrowser.html')
@ -29,16 +44,6 @@ gulp.task('usemin-badbrowser', function() { @@ -29,16 +44,6 @@ gulp.task('usemin-badbrowser', function() {
.pipe(gulp.dest('dist'));
});
gulp.task('usemin', function () {
return gulp.src('app/index.html')
.pipe($.usemin({
html: [$.minifyHtml({empty: true})],
js: ['concat', $.ngAnnotate(), $.uglify({outSourceMap: false})],
css: ['concat', $.minifyCss({compatibility: true, keepBreaks: true})]
}))
.pipe(gulp.dest('dist'))
})
// ulimit -n 10240 on OS X
gulp.task('imagemin', function () {
return gulp.src(['app/img/**/*', '!app/img/screenshot*', '!app/img/*.wav'])
@ -172,7 +177,8 @@ var fileGlobs = [ @@ -172,7 +177,8 @@ var fileGlobs = [
'!dist/*.html',
'!dist/fonts/*',
'!dist/img/icons/icon*.png',
'!dist/js/background.js'
'!dist/js/background.js',
'!dist/css/badbrowser.css'
]
function writeServiceWorkerFile (rootDir, handleFetch, callback) {
@ -181,7 +187,8 @@ function writeServiceWorkerFile (rootDir, handleFetch, callback) { @@ -181,7 +187,8 @@ function writeServiceWorkerFile (rootDir, handleFetch, callback) {
handleFetch: handleFetch,
logger: $.util.log,
staticFileGlobs: fileGlobs,
stripPrefix: rootDir + '/',
stripPrefix: './' + rootDir + '/',
importScripts: ['js/lib/push_worker.js'],
verbose: true
}
swPrecache.write(path.join(rootDir, 'service_worker.js'), config, callback)
@ -272,16 +279,17 @@ gulp.task('build', ['clean'], function (callback) { @@ -272,16 +279,17 @@ gulp.task('build', ['clean'], function (callback) {
runSequence(
['less', 'templates'],
'enable-production',
'usemin',
'usemin-index',
'usemin-badbrowser',
['copy', 'copy-locales', 'copy-images', 'disable-production'],
'clean-templates',
callback
)
})
gulp.task('package', ['cleanup-dist'])
gulp.task('offline', ['add-appcache-manifest', 'generate-service-worker'])
gulp.task('publish', ['add-appcache-manifest', 'generate-service-worker'])
gulp.task('deploy', function () {
return gulp.src('./dist/**/*')

Loading…
Cancel
Save