|
|
@ -1,6 +1,13 @@ |
|
|
|
(function() { |
|
|
|
(function() { |
|
|
|
'use strict'; |
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// cordova splash screen
|
|
|
|
|
|
|
|
document.addEventListener("deviceready", function () { |
|
|
|
|
|
|
|
if (navigator.splashscreen !== undefined) { |
|
|
|
|
|
|
|
navigator.splashscreen.hide(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, false); |
|
|
|
|
|
|
|
|
|
|
|
var weechat = angular.module('weechat', ['ngRoute', 'localStorage', 'weechatModels', 'bufferResume', 'plugins', 'IrcUtils', 'ngSanitize', 'ngWebsockets', 'ngTouch'], ['$compileProvider', function($compileProvider) { |
|
|
|
var weechat = angular.module('weechat', ['ngRoute', 'localStorage', 'weechatModels', 'bufferResume', 'plugins', 'IrcUtils', 'ngSanitize', 'ngWebsockets', 'ngTouch'], ['$compileProvider', function($compileProvider) { |
|
|
|
// hacky way to be able to find out if we're in debug mode
|
|
|
|
// hacky way to be able to find out if we're in debug mode
|
|
|
|
weechat.compileProvider = $compileProvider; |
|
|
|
weechat.compileProvider = $compileProvider; |
|
|
@ -37,12 +44,12 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
'onlyUnread': false, |
|
|
|
'onlyUnread': false, |
|
|
|
'hotlistsync': true, |
|
|
|
'hotlistsync': true, |
|
|
|
'orderbyserver': true, |
|
|
|
'orderbyserver': true, |
|
|
|
'useFavico': true, |
|
|
|
'useFavico': !utils.isCordova(), |
|
|
|
'soundnotification': true, |
|
|
|
'soundnotification': true, |
|
|
|
'fontsize': '14px', |
|
|
|
'fontsize': '14px', |
|
|
|
'fontfamily': (utils.isMobileUi() ? 'sans-serif' : 'Inconsolata, Consolas, Monaco, Ubuntu Mono, monospace'), |
|
|
|
'fontfamily': (utils.isMobileUi() ? 'sans-serif' : 'Inconsolata, Consolas, Monaco, Ubuntu Mono, monospace'), |
|
|
|
'readlineBindings': false, |
|
|
|
'readlineBindings': false, |
|
|
|
'enableJSEmoji': (utils.isMobileUi() ? false : true), |
|
|
|
'enableJSEmoji': !utils.isMobileUi(), |
|
|
|
'enableMathjax': false, |
|
|
|
'enableMathjax': false, |
|
|
|
'enableQuickKeys': true, |
|
|
|
'enableQuickKeys': true, |
|
|
|
'customCSS': '', |
|
|
|
'customCSS': '', |
|
|
@ -89,10 +96,10 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
})(); |
|
|
|
})(); |
|
|
|
|
|
|
|
|
|
|
|
// Show a TLS warning if GB was loaded over an unencrypted connection,
|
|
|
|
// Show a TLS warning if GB was loaded over an unencrypted connection,
|
|
|
|
// except for local instances (testing or electron)
|
|
|
|
// except for local instances (testing, cordova, or electron)
|
|
|
|
$scope.show_tls_warning = (window.location.protocol !== "https:") && |
|
|
|
$scope.show_tls_warning = (window.location.protocol !== "https:") && |
|
|
|
(["localhost", "127.0.0.1", "::1"].indexOf(window.location.hostname) === -1) && |
|
|
|
(["localhost", "127.0.0.1", "::1"].indexOf(window.location.hostname) === -1) && |
|
|
|
!window.is_electron && !window.cordova; |
|
|
|
!window.is_electron && !utils.isCordova(); |
|
|
|
|
|
|
|
|
|
|
|
if (window.is_electron) { |
|
|
|
if (window.is_electron) { |
|
|
|
// Use packaged emojione sprite in the electron app
|
|
|
|
// Use packaged emojione sprite in the electron app
|
|
|
@ -225,7 +232,9 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$rootScope.favico = new Favico({animation: 'none'}); |
|
|
|
if (!utils.isCordova()) { |
|
|
|
|
|
|
|
$rootScope.favico = new Favico({animation: 'none'}); |
|
|
|
|
|
|
|
} |
|
|
|
$scope.notifications = notifications.unreadCount('notification'); |
|
|
|
$scope.notifications = notifications.unreadCount('notification'); |
|
|
|
$scope.unread = notifications.unreadCount('unread'); |
|
|
|
$scope.unread = notifications.unreadCount('unread'); |
|
|
|
|
|
|
|
|
|
|
@ -234,7 +243,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
$scope.notifications = notifications.unreadCount('notification'); |
|
|
|
$scope.notifications = notifications.unreadCount('notification'); |
|
|
|
$scope.unread = notifications.unreadCount('unread'); |
|
|
|
$scope.unread = notifications.unreadCount('unread'); |
|
|
|
|
|
|
|
|
|
|
|
if (settings.useFavico && $rootScope.favico) { |
|
|
|
if (!utils.isCordova() && settings.useFavico && $rootScope.favico) { |
|
|
|
notifications.updateFavico(); |
|
|
|
notifications.updateFavico(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -243,7 +252,12 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
// Reset title
|
|
|
|
// Reset title
|
|
|
|
$rootScope.pageTitle = ''; |
|
|
|
$rootScope.pageTitle = ''; |
|
|
|
$rootScope.notificationStatus = ''; |
|
|
|
$rootScope.notificationStatus = ''; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// cancel outstanding notifications (incl cordova)
|
|
|
|
notifications.cancelAll(); |
|
|
|
notifications.cancelAll(); |
|
|
|
|
|
|
|
if (window.plugin !== undefined && window.plugin.notification !== undefined && window.plugin.notification.local !== undefined) { |
|
|
|
|
|
|
|
window.plugin.notification.local.cancelAll(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
models.reinitialize(); |
|
|
|
models.reinitialize(); |
|
|
|
$rootScope.$emit('notificationChanged'); |
|
|
|
$rootScope.$emit('notificationChanged'); |
|
|
@ -369,6 +383,11 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
if (!$rootScope.connected) { |
|
|
|
if (!$rootScope.connected) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (utils.isCordova()) { |
|
|
|
|
|
|
|
return; // cordova doesn't have a favicon
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (useFavico) { |
|
|
|
if (useFavico) { |
|
|
|
notifications.updateFavico(); |
|
|
|
notifications.updateFavico(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -382,7 +401,8 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
// This also fires when the page is loaded if enabled.
|
|
|
|
// This also fires when the page is loaded if enabled.
|
|
|
|
// Note that this says MathJax but we switched to KaTeX
|
|
|
|
// Note that this says MathJax but we switched to KaTeX
|
|
|
|
settings.addCallback('enableMathjax', function(enabled) { |
|
|
|
settings.addCallback('enableMathjax', function(enabled) { |
|
|
|
if (enabled && !$rootScope.mathjax_init) { |
|
|
|
// no latex math support for cordova right now
|
|
|
|
|
|
|
|
if (!utils.isCordova() && enabled && !$rootScope.mathjax_init) { |
|
|
|
// Load MathJax only once
|
|
|
|
// Load MathJax only once
|
|
|
|
$rootScope.mathjax_init = true; |
|
|
|
$rootScope.mathjax_init = true; |
|
|
|
|
|
|
|
|
|
|
@ -803,7 +823,10 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
if ($rootScope.connected) { |
|
|
|
if ($rootScope.connected) { |
|
|
|
$scope.disconnect(); |
|
|
|
$scope.disconnect(); |
|
|
|
} |
|
|
|
} |
|
|
|
$scope.favico.reset(); |
|
|
|
|
|
|
|
|
|
|
|
if (!utils.isCordova()) { |
|
|
|
|
|
|
|
$scope.favico.reset(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|