2014-08-24 18:53:55 +02:00
|
|
|
(function() {
|
|
|
|
'use strict';
|
|
|
|
|
2015-02-04 22:50:35 +01:00
|
|
|
var weechat = angular.module('weechat', ['ngRoute', 'localStorage', 'weechatModels', 'plugins', 'IrcUtils', 'ngSanitize', 'ngWebsockets', 'ngTouch'], ['$compileProvider', function($compileProvider) {
|
2014-12-22 21:14:28 +01:00
|
|
|
// hacky way to be able to find out if we're in debug mode
|
|
|
|
weechat.compileProvider = $compileProvider;
|
2015-02-04 22:50:35 +01:00
|
|
|
}]);
|
2014-10-31 10:07:41 +01:00
|
|
|
weechat.config(['$compileProvider', function ($compileProvider) {
|
2014-12-30 21:05:40 +01:00
|
|
|
// hack to determine whether we're executing the tests
|
|
|
|
if (typeof(it) === "undefined" && typeof(describe) === "undefined") {
|
|
|
|
$compileProvider.debugInfoEnabled(false);
|
|
|
|
}
|
2014-10-31 10:07:41 +01:00
|
|
|
}]);
|
2013-02-18 00:49:42 +01:00
|
|
|
|
2014-12-22 22:17:01 +01:00
|
|
|
weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', '$log', 'models', 'connection', 'notifications', 'utils', 'settings',
|
|
|
|
function ($rootScope, $scope, $store, $timeout, $log, models, connection, notifications, utils, settings) {
|
2013-12-16 17:09:17 +01:00
|
|
|
|
2014-08-31 16:29:13 +02:00
|
|
|
$scope.command = '';
|
2014-09-01 14:33:42 +02:00
|
|
|
$scope.themes = ['dark', 'light'];
|
2014-12-30 20:24:33 +01:00
|
|
|
|
|
|
|
settings.setDefaults({
|
|
|
|
'theme': 'dark',
|
|
|
|
'host': 'localhost',
|
|
|
|
'port': 9001,
|
|
|
|
'ssl': (window.location.protocol === "https:"),
|
|
|
|
'savepassword': false,
|
|
|
|
'autoconnect': false,
|
|
|
|
'nonicklist': utils.isMobileUi(),
|
|
|
|
'noembed': utils.isMobileUi(),
|
|
|
|
'onlyUnread': false,
|
|
|
|
'hotlistsync': true,
|
|
|
|
'orderbyserver': true,
|
|
|
|
'useFavico': true,
|
|
|
|
'showtimestamp': true,
|
|
|
|
'showtimestampSeconds': false,
|
|
|
|
'fontsize': '14px',
|
|
|
|
'fontfamily': (utils.isMobileUi() ? 'sans-serif' : 'Inconsolata, Consolas, Monaco, Ubuntu Mono, monospace'),
|
|
|
|
'readlineBindings': false
|
|
|
|
});
|
2014-12-22 22:17:01 +01:00
|
|
|
$scope.settings = settings;
|
2014-08-31 16:29:13 +02:00
|
|
|
|
2014-04-28 14:40:27 +02:00
|
|
|
// From: http://stackoverflow.com/a/18539624 by StackOverflow user "plantian"
|
2013-12-17 21:30:22 +01:00
|
|
|
$rootScope.countWatchers = function () {
|
2014-04-28 14:40:27 +02:00
|
|
|
var q = [$rootScope], watchers = 0, scope;
|
|
|
|
while (q.length > 0) {
|
|
|
|
scope = q.pop();
|
|
|
|
if (scope.$$watchers) {
|
|
|
|
watchers += scope.$$watchers.length;
|
2013-12-16 17:09:17 +01:00
|
|
|
}
|
2014-04-28 14:40:27 +02:00
|
|
|
if (scope.$$childHead) {
|
|
|
|
q.push(scope.$$childHead);
|
|
|
|
}
|
|
|
|
if (scope.$$nextSibling) {
|
|
|
|
q.push(scope.$$nextSibling);
|
|
|
|
}
|
|
|
|
}
|
2014-05-06 18:38:20 +02:00
|
|
|
$log.debug(watchers);
|
2013-12-16 17:09:17 +01:00
|
|
|
};
|
|
|
|
|
2014-02-25 21:41:41 +01:00
|
|
|
$scope.isinstalled = (function() {
|
|
|
|
// Check for firefox & app installed
|
|
|
|
if (navigator.mozApps !== undefined) {
|
|
|
|
navigator.mozApps.getSelf().onsuccess = function _onAppReady(evt) {
|
|
|
|
var app = evt.target.result;
|
|
|
|
if (app) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}());
|
|
|
|
|
2013-10-06 12:34:41 +02:00
|
|
|
|
2014-03-05 12:46:17 +01:00
|
|
|
// Detect page visibility attributes
|
|
|
|
(function() {
|
|
|
|
// Sadly, the page visibility API still has a lot of vendor prefixes
|
|
|
|
if (typeof document.hidden !== "undefined") { // Chrome >= 33, Firefox >= 18, Opera >= 12.10, Safari >= 7
|
|
|
|
$scope.documentHidden = "hidden";
|
|
|
|
$scope.documentVisibilityChange = "visibilitychange";
|
|
|
|
} else if (typeof document.webkitHidden !== "undefined") { // 13 <= Chrome < 33
|
|
|
|
$scope.documentHidden = "webkitHidden";
|
|
|
|
$scope.documentVisibilityChange = "webkitvisibilitychange";
|
|
|
|
} else if (typeof document.mozHidden !== "undefined") { // 10 <= Firefox < 18
|
|
|
|
$scope.documentHidden = "mozHidden";
|
|
|
|
$scope.documentVisibilityChange = "mozvisibilitychange";
|
|
|
|
} else if (typeof document.msHidden !== "undefined") { // IE >= 10
|
|
|
|
$scope.documentHidden = "msHidden";
|
|
|
|
$scope.documentVisibilityChange = "msvisibilitychange";
|
|
|
|
}
|
|
|
|
})();
|
|
|
|
|
2014-07-18 13:13:54 +02:00
|
|
|
// Enable debug mode if "?debug=1" or "?debug=true" is set
|
|
|
|
(function() {
|
|
|
|
window.location.search.substring(1).split('&').forEach(function(f) {
|
|
|
|
var segs = f.split('=');
|
|
|
|
if (segs[0] === "debug" && ["true", "1"].indexOf(segs[1]) != -1) {
|
|
|
|
$rootScope.debugMode = true;
|
|
|
|
}
|
|
|
|
});
|
2014-10-31 10:07:41 +01:00
|
|
|
// If we haven't reloaded yet, do an angular reload with debug infos
|
|
|
|
// store whether this has happened yet in a GET parameter
|
2014-12-22 21:14:28 +01:00
|
|
|
if ($rootScope.debugMode && !weechat.compileProvider.debugInfoEnabled()) {
|
|
|
|
angular.reloadWithDebugInfo();
|
2014-10-31 10:07:41 +01:00
|
|
|
}
|
2014-07-18 13:13:54 +02:00
|
|
|
})();
|
|
|
|
|
2014-03-05 12:46:17 +01:00
|
|
|
|
|
|
|
$rootScope.isWindowFocused = function() {
|
|
|
|
if (typeof $scope.documentHidden === "undefined") {
|
|
|
|
// Page Visibility API not supported, assume yes
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
var isHidden = document[$scope.documentHidden];
|
|
|
|
return !isHidden;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
if (typeof $scope.documentVisibilityChange !== "undefined") {
|
|
|
|
document.addEventListener($scope.documentVisibilityChange, function() {
|
|
|
|
if (!document[$scope.documentHidden]) {
|
|
|
|
// We just switched back to the glowing-bear window and unread messages may have
|
|
|
|
// accumulated in the active buffer while the window was in the background
|
|
|
|
var buffer = models.getActiveBuffer();
|
2014-04-15 22:01:13 +02:00
|
|
|
// This can also be triggered before connecting to the relay, check for null (not undefined!)
|
|
|
|
if (buffer !== null) {
|
|
|
|
buffer.unread = 0;
|
|
|
|
buffer.notification = 0;
|
2014-03-05 12:46:17 +01:00
|
|
|
|
2014-04-15 22:01:13 +02:00
|
|
|
// Trigger title and favico update
|
|
|
|
$rootScope.$emit('notificationChanged');
|
|
|
|
}
|
2014-03-05 12:46:17 +01:00
|
|
|
|
|
|
|
// the unread badge in the bufferlist doesn't update if we don't do this
|
|
|
|
$rootScope.$apply();
|
|
|
|
}
|
|
|
|
}, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-03-07 18:07:05 +01:00
|
|
|
$rootScope.$on('activeBufferChanged', function(event, unreadSum) {
|
2013-10-12 22:09:02 +02:00
|
|
|
var ab = models.getActiveBuffer();
|
2014-06-26 22:38:04 +02:00
|
|
|
|
2014-07-01 20:41:27 +02:00
|
|
|
// Discard surplus lines. This is done *before* lines are fetched because that saves us the effort of special handling for the
|
|
|
|
// case where a buffer is opened for the first time ;)
|
|
|
|
var minRetainUnread = ab.lines.length - unreadSum + 5; // do not discard unread lines and keep 5 additional lines for context
|
|
|
|
var surplusLines = ab.lines.length - (2 * $scope.lines_per_screen + 10); // retain up to 2*(screenful + 10) + 10 lines because magic numbers
|
2014-09-04 23:34:52 +02:00
|
|
|
var linesToRemove = Math.min(minRetainUnread, surplusLines);
|
|
|
|
|
|
|
|
if (linesToRemove > 0) {
|
|
|
|
ab.lines.splice(0, linesToRemove); // remove the lines from the buffer
|
|
|
|
ab.requestedLines -= linesToRemove; // to ensure that the correct amount of lines is fetched should more be requested
|
|
|
|
ab.lastSeen -= linesToRemove; // adjust readmarker
|
|
|
|
ab.allLinesFetched = false; // we just removed lines, so we don't have all of them. re-enable "fetch more lines"
|
|
|
|
}
|
2014-06-26 22:38:04 +02:00
|
|
|
|
2014-04-20 17:44:50 +02:00
|
|
|
$scope.bufferlines = ab.lines;
|
|
|
|
$scope.nicklist = ab.nicklist;
|
2014-03-07 18:56:48 +01:00
|
|
|
|
2014-04-25 15:36:31 +02:00
|
|
|
// Send a request for the nicklist if it hasn't been loaded yet
|
|
|
|
if (!ab.nicklistRequested()) {
|
|
|
|
connection.requestNicklist(ab.fullName, function() {
|
|
|
|
$scope.showNicklist = $scope.updateShowNicklist();
|
|
|
|
// Scroll after nicklist has been loaded, as it may break long lines
|
|
|
|
$rootScope.scrollWithBuffer(true);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
// Check if we should show nicklist or not
|
|
|
|
$scope.showNicklist = $scope.updateShowNicklist();
|
|
|
|
}
|
|
|
|
|
2014-06-27 04:36:30 +02:00
|
|
|
if (ab.requestedLines < $scope.lines_per_screen) {
|
2014-02-10 20:32:00 +01:00
|
|
|
// buffer has not been loaded, but some lines may already be present if they arrived after we connected
|
2014-03-07 18:07:05 +01:00
|
|
|
// try to determine how many lines to fetch
|
2014-07-06 12:30:38 +02:00
|
|
|
var numLines = $scope.lines_per_screen + 10; // that's (a screenful plus 10 lines) plus 10 lines, just to be safe
|
2014-03-07 18:07:05 +01:00
|
|
|
if (unreadSum > numLines) {
|
|
|
|
// request up to 4*(screenful + 10 lines)
|
|
|
|
numLines = Math.min(4*numLines, unreadSum);
|
|
|
|
}
|
2014-06-18 23:10:33 +02:00
|
|
|
$scope.fetchMoreLines(numLines).then(
|
|
|
|
// Update initial scroll position
|
|
|
|
// Most relevant when first connecting to properly initalise
|
|
|
|
function() {
|
|
|
|
$timeout(function() {
|
2014-09-23 02:08:27 +02:00
|
|
|
var bl = document.getElementById("bufferlines");
|
|
|
|
var lastScrollHeight = bl.scrollHeight;
|
|
|
|
var scrollHeightObserver = function() {
|
|
|
|
if (bl) {
|
|
|
|
var newScrollHeight = bl.scrollHeight;
|
|
|
|
if (newScrollHeight !== lastScrollHeight) {
|
|
|
|
$rootScope.updateBufferBottom($rootScope.bufferBottom);
|
|
|
|
lastScrollHeight = newScrollHeight;
|
|
|
|
}
|
|
|
|
setTimeout(scrollHeightObserver, 500);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
$rootScope.updateBufferBottom(true);
|
|
|
|
$rootScope.scrollWithBuffer(true);
|
|
|
|
bl.onscroll = _.debounce(function() {
|
|
|
|
$rootScope.updateBufferBottom();
|
|
|
|
}, 80);
|
|
|
|
setTimeout(scrollHeightObserver, 500);
|
2014-06-18 23:10:33 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|
2014-02-10 19:44:15 +01:00
|
|
|
}
|
2014-08-28 18:25:40 +02:00
|
|
|
notifications.updateTitle(ab);
|
2013-10-19 12:14:32 +02:00
|
|
|
|
2014-09-23 02:08:27 +02:00
|
|
|
$timeout(function() {
|
|
|
|
$rootScope.scrollWithBuffer(true);
|
|
|
|
});
|
2013-10-19 12:14:32 +02:00
|
|
|
// If user wants to sync hotlist with weechat
|
|
|
|
// we will send a /buffer bufferName command every time
|
|
|
|
// the user switches a buffer. This will ensure that notifications
|
|
|
|
// are cleared in the buffer the user switches to
|
2014-12-22 22:17:01 +01:00
|
|
|
if (settings.hotlistsync && ab.fullName) {
|
2013-10-19 12:14:32 +02:00
|
|
|
connection.sendCoreCommand('/buffer ' + ab.fullName);
|
|
|
|
}
|
2013-10-22 14:24:09 +02:00
|
|
|
|
|
|
|
// Clear search term on buffer change
|
|
|
|
$scope.search = '';
|
2013-12-17 21:30:22 +01:00
|
|
|
|
2014-08-28 18:25:40 +02:00
|
|
|
if (!utils.isMobileUi()) {
|
2014-05-04 12:21:35 +02:00
|
|
|
// This needs to happen asynchronously to prevent the enter key handler
|
|
|
|
// of the input bar to be triggered on buffer switch via the search.
|
|
|
|
// Otherwise its current contents would be sent to the new buffer
|
|
|
|
setTimeout(function() {
|
|
|
|
document.getElementById('sendMessage').focus();
|
|
|
|
}, 0);
|
2014-02-25 22:17:29 +01:00
|
|
|
}
|
2013-10-12 22:09:02 +02:00
|
|
|
});
|
2014-02-18 19:13:23 +01:00
|
|
|
|
2014-08-28 18:25:40 +02:00
|
|
|
$rootScope.favico = new Favico({animation: 'none'});
|
2014-02-18 19:13:23 +01:00
|
|
|
|
2013-10-15 15:21:13 +02:00
|
|
|
$rootScope.$on('notificationChanged', function() {
|
2014-08-28 18:25:40 +02:00
|
|
|
notifications.updateTitle();
|
2014-02-20 23:37:06 +01:00
|
|
|
|
2014-12-22 22:17:01 +01:00
|
|
|
if (settings.useFavico && $rootScope.favico) {
|
2014-08-28 18:25:40 +02:00
|
|
|
notifications.updateFavico();
|
2013-10-15 15:21:13 +02:00
|
|
|
}
|
|
|
|
});
|
2013-10-12 22:09:02 +02:00
|
|
|
|
2014-02-21 14:54:17 +01:00
|
|
|
$rootScope.$on('relayDisconnect', function() {
|
2014-10-16 17:12:48 +02:00
|
|
|
// Reset title
|
|
|
|
$rootScope.pageTitle = '';
|
|
|
|
$rootScope.notificationStatus = '';
|
|
|
|
notifications.cancelAll();
|
|
|
|
|
2014-07-02 00:07:34 +02:00
|
|
|
models.reinitialize();
|
2014-03-05 14:20:48 +01:00
|
|
|
$rootScope.$emit('notificationChanged');
|
2014-05-06 21:59:10 +02:00
|
|
|
$scope.connectbutton = 'Connect';
|
2014-02-21 14:54:17 +01:00
|
|
|
});
|
2014-05-06 21:59:10 +02:00
|
|
|
$scope.connectbutton = 'Connect';
|
2014-02-21 14:54:17 +01:00
|
|
|
|
2014-07-02 00:07:34 +02:00
|
|
|
$scope.getBuffers = models.getBuffers.bind(models);
|
2014-02-25 21:42:59 +01:00
|
|
|
|
2014-04-20 17:44:50 +02:00
|
|
|
$scope.bufferlines = {};
|
|
|
|
$scope.nicklist = {};
|
|
|
|
|
2013-12-16 14:09:01 +01:00
|
|
|
$scope.activeBuffer = models.getActiveBuffer;
|
2013-10-08 15:55:07 +02:00
|
|
|
|
2014-07-28 11:02:43 +02:00
|
|
|
$rootScope.connected = false;
|
2014-02-14 15:14:55 +01:00
|
|
|
$rootScope.waseverconnected = false;
|
2014-10-18 12:25:14 +02:00
|
|
|
$rootScope.userdisconnect = false;
|
|
|
|
$rootScope.reconnecting = false;
|
2013-02-16 19:18:14 +01:00
|
|
|
|
2013-10-08 15:55:07 +02:00
|
|
|
$rootScope.models = models;
|
|
|
|
|
2013-10-27 07:48:30 +01:00
|
|
|
$rootScope.iterCandidate = null;
|
|
|
|
|
2014-12-22 22:17:01 +01:00
|
|
|
if (settings.savepassword) {
|
|
|
|
$scope.$watch('password', function() {
|
|
|
|
settings.password = $scope.password;
|
|
|
|
});
|
|
|
|
settings.addCallback('password', function(password) {
|
|
|
|
$scope.password = password;
|
|
|
|
});
|
|
|
|
$scope.password = settings.password;
|
|
|
|
} else {
|
|
|
|
settings.password = '';
|
2013-10-25 13:43:03 +02:00
|
|
|
}
|
2014-02-27 14:28:01 +01:00
|
|
|
|
2014-03-31 02:12:01 +02:00
|
|
|
$rootScope.wasMobileUi = false;
|
2014-08-28 18:25:40 +02:00
|
|
|
if (utils.isMobileUi()) {
|
2014-03-31 02:12:01 +02:00
|
|
|
$rootScope.wasMobileUi = true;
|
2014-02-27 14:28:01 +01:00
|
|
|
}
|
|
|
|
|
2014-12-22 22:17:01 +01:00
|
|
|
if (!settings.fontfamily) {
|
2014-08-28 18:25:40 +02:00
|
|
|
if (utils.isMobileUi()) {
|
2014-12-22 22:17:01 +01:00
|
|
|
settings.fontfamily = 'sans-serif';
|
2014-07-25 03:41:33 +02:00
|
|
|
} else {
|
2014-12-22 22:17:01 +01:00
|
|
|
settings.fontfamily = "Inconsolata, Consolas, Monaco, Ubuntu Mono, monospace";
|
2014-07-25 03:41:33 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-08 10:51:17 +02:00
|
|
|
$scope.isSidebarVisible = function() {
|
2014-10-16 16:32:53 +02:00
|
|
|
return document.getElementById('content').getAttribute('sidebar-state') === 'visible';
|
2014-07-08 10:51:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
$scope.showSidebar = function() {
|
|
|
|
document.getElementById('sidebar').setAttribute('data-state', 'visible');
|
|
|
|
document.getElementById('content').setAttribute('sidebar-state', 'visible');
|
2014-08-28 18:25:40 +02:00
|
|
|
if (utils.isMobileUi()) {
|
2014-08-13 10:22:41 +02:00
|
|
|
// de-focus the input bar when opening the sidebar on mobile, so that the keyboard goes down
|
|
|
|
_.each(document.getElementsByTagName('textarea'), function(elem) {
|
2014-09-23 23:36:03 +02:00
|
|
|
$timeout(function(){elem.blur();});
|
2014-08-13 10:22:41 +02:00
|
|
|
});
|
|
|
|
}
|
2014-07-08 10:51:17 +02:00
|
|
|
};
|
|
|
|
|
2014-08-13 09:39:32 +02:00
|
|
|
$rootScope.hideSidebar = function() {
|
2014-08-28 18:25:40 +02:00
|
|
|
if (utils.isMobileUi()) {
|
2014-07-23 20:16:48 +02:00
|
|
|
document.getElementById('sidebar').setAttribute('data-state', 'hidden');
|
|
|
|
document.getElementById('content').setAttribute('sidebar-state', 'hidden');
|
|
|
|
}
|
2014-07-08 10:51:17 +02:00
|
|
|
};
|
2014-12-22 22:17:01 +01:00
|
|
|
settings.addCallback('autoconnect', function(autoconnect) {
|
|
|
|
if (autoconnect && !$rootScope.connected && !$rootScope.sslError && !$rootScope.securityError && !$rootScope.errorMessage) {
|
2014-07-20 14:32:53 +02:00
|
|
|
$scope.connect();
|
|
|
|
}
|
|
|
|
});
|
2014-07-08 10:51:17 +02:00
|
|
|
|
|
|
|
// toggle sidebar (if on mobile)
|
|
|
|
$scope.toggleSidebar = function() {
|
2014-08-28 18:25:40 +02:00
|
|
|
if (utils.isMobileUi()) {
|
2014-07-08 10:51:17 +02:00
|
|
|
if ($scope.isSidebarVisible()) {
|
|
|
|
$scope.hideSidebar();
|
|
|
|
} else {
|
|
|
|
$scope.showSidebar();
|
|
|
|
}
|
2014-02-23 15:17:59 +01:00
|
|
|
}
|
2014-02-19 16:15:23 +01:00
|
|
|
};
|
2014-02-24 11:28:43 +01:00
|
|
|
|
2014-07-08 10:51:17 +02:00
|
|
|
// Open and close panels while on mobile devices through swiping
|
2014-02-19 16:15:23 +01:00
|
|
|
$scope.openNick = function() {
|
2014-08-28 18:25:40 +02:00
|
|
|
if (utils.isMobileUi()) {
|
2014-12-22 22:17:01 +01:00
|
|
|
if (settings.nonicklist) {
|
|
|
|
settings.nonicklist = false;
|
2014-02-24 11:28:43 +01:00
|
|
|
}
|
2014-02-19 16:15:23 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.closeNick = function() {
|
2014-08-28 18:25:40 +02:00
|
|
|
if (utils.isMobileUi()) {
|
2014-12-22 22:17:01 +01:00
|
|
|
if (!settings.nonicklist) {
|
|
|
|
settings.nonicklist = true;
|
2014-02-24 11:28:43 +01:00
|
|
|
}
|
2014-02-19 16:15:23 +01:00
|
|
|
}
|
|
|
|
};
|
2013-12-18 23:09:53 +01:00
|
|
|
|
2013-12-08 22:29:48 +01:00
|
|
|
// Watch model and update channel sorting when it changes
|
2014-12-22 22:17:01 +01:00
|
|
|
settings.addCallback('orderbyserver', function(orderbyserver) {
|
|
|
|
$rootScope.predicate = orderbyserver ? 'serverSortKey' : 'number';
|
2013-12-08 22:29:48 +01:00
|
|
|
});
|
|
|
|
|
2014-12-22 22:17:01 +01:00
|
|
|
settings.addCallback('useFavico', function(useFavico) {
|
2014-02-20 23:35:34 +01:00
|
|
|
// this check is necessary as this is called on page load, too
|
|
|
|
if (!$rootScope.connected) {
|
|
|
|
return;
|
|
|
|
}
|
2014-12-22 22:17:01 +01:00
|
|
|
if (useFavico) {
|
2014-08-28 18:25:40 +02:00
|
|
|
notifications.updateFavico();
|
2014-02-20 23:35:34 +01:00
|
|
|
} else {
|
2014-08-28 18:25:40 +02:00
|
|
|
$rootScope.favico.reset();
|
2014-02-20 23:35:34 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-07-07 01:48:19 +02:00
|
|
|
// Update font family when changed
|
2014-12-22 22:17:01 +01:00
|
|
|
settings.addCallback('fontfamily', function(fontfamily) {
|
|
|
|
utils.changeClassStyle('favorite-font', 'fontFamily', fontfamily);
|
2014-07-07 01:48:19 +02:00
|
|
|
});
|
2014-07-07 16:09:25 +02:00
|
|
|
// Update font size when changed
|
2014-12-22 22:17:01 +01:00
|
|
|
settings.addCallback('fontsize', function(fontsize) {
|
|
|
|
utils.changeClassStyle('favorite-font', 'fontSize', fontsize);
|
2014-07-21 16:07:38 +02:00
|
|
|
});
|
2013-10-02 02:32:18 +02:00
|
|
|
|
2013-12-14 15:40:11 +01:00
|
|
|
$scope.setActiveBuffer = function(bufferId, key) {
|
2014-02-19 15:53:03 +01:00
|
|
|
// If we are on mobile we need to collapse the menu on sidebar clicks
|
|
|
|
// We use 968 px as the cutoff, which should match the value in glowingbear.css
|
2014-08-28 18:25:40 +02:00
|
|
|
if (utils.isMobileUi()) {
|
2014-07-08 10:51:17 +02:00
|
|
|
$scope.hideSidebar();
|
2014-02-19 15:53:03 +01:00
|
|
|
}
|
2013-12-14 15:40:11 +01:00
|
|
|
return models.setActiveBuffer(bufferId, key);
|
2013-07-30 15:22:37 +02:00
|
|
|
};
|
|
|
|
|
2014-02-16 15:10:56 +01:00
|
|
|
$scope.openBuffer = function(bufferName) {
|
|
|
|
var fullName = models.getActiveBuffer().fullName;
|
|
|
|
fullName = fullName.substring(0, fullName.lastIndexOf('.') + 1) + bufferName; // substitute the last part
|
2013-12-14 15:40:11 +01:00
|
|
|
|
2014-02-16 15:10:56 +01:00
|
|
|
if (!$scope.setActiveBuffer(fullName, 'fullName')) {
|
|
|
|
var command = 'join';
|
|
|
|
if (['#', '&', '+', '!'].indexOf(bufferName.charAt(0)) < 0) { // these are the characters a channel name can start with (RFC 2813-2813)
|
|
|
|
command = 'query';
|
|
|
|
}
|
|
|
|
connection.sendMessage('/' + command + ' ' + bufferName);
|
2013-12-14 15:40:11 +01:00
|
|
|
}
|
2013-12-16 14:09:01 +01:00
|
|
|
};
|
2013-12-14 15:40:11 +01:00
|
|
|
|
2014-02-10 21:17:51 +01:00
|
|
|
|
2014-08-28 18:25:40 +02:00
|
|
|
//XXX this does not belong here (or does it?)
|
2014-02-10 21:17:51 +01:00
|
|
|
// Calculate number of lines to fetch
|
2014-02-28 11:23:10 +01:00
|
|
|
$scope.calculateNumLines = function() {
|
Fix that bug where only one line was loaded
Let me tell the story backwards:
For some reason, only one line would be fetched in `fetchMoreLines`, but
neither `numLines` nor `buffer.requestedLines` were `undefined`. The
paramater `numLines` must have had some strange value, though.
`connection.fetchMoreLines` is invoked through the main controllers
`$scope.fetchMoreLines`, which sets the parameter to `$scope.lines` if it was
undefined before. That value is computed in `$scope.calculateNumLines`,
which takes the height of the lines area and divides it by the height of the first
bufferline. This computation is retriggered on every `resize` event.
The first bufferline is the 'fetch more lines' link at the top of the window. If the
currently active buffer doesn't have more lines, it is hidden with `ngHide`,
causing its `clientHeight` property to be `0`, and the number of lines to be
fetched `$scope.lines = Infinity` (due to a division by zero).
In `connection.fetchMoreLines`, the following request is then made:
`"buffer:0x" + buffer.id + "/own_lines/last_line(-" + numLines + ")/data"`
to which WeeChat responds with one line. Voilà, there's your mess.
2014-05-03 16:07:12 +02:00
|
|
|
var bufferlineElements = document.querySelectorAll(".bufferline");
|
|
|
|
var lineHeight = 0, idx = 0;
|
|
|
|
while (lineHeight === 0 && idx < bufferlineElements.length) {
|
|
|
|
lineHeight = bufferlineElements[idx++].clientHeight;
|
|
|
|
}
|
2014-02-28 11:23:10 +01:00
|
|
|
var areaHeight = document.querySelector("#bufferlines").clientHeight;
|
|
|
|
// Fetch 10 lines more than theoretically needed so that scrolling up will correctly trigger the loading of more lines
|
|
|
|
// Also, some lines might be hidden, so it's probably better to have a bit of buffer there
|
|
|
|
var numLines = Math.ceil(areaHeight/lineHeight + 10);
|
2014-06-27 04:36:30 +02:00
|
|
|
$scope.lines_per_screen = numLines;
|
2014-02-28 11:23:10 +01:00
|
|
|
};
|
|
|
|
$scope.calculateNumLines();
|
|
|
|
|
2014-09-23 02:08:27 +02:00
|
|
|
// get animationframe method
|
|
|
|
window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame;
|
|
|
|
|
2014-02-28 11:23:10 +01:00
|
|
|
// Recalculate number of lines on resize
|
|
|
|
window.addEventListener("resize", _.debounce(function() {
|
|
|
|
// Recalculation fails when not connected
|
|
|
|
if ($rootScope.connected) {
|
2014-03-13 19:49:29 +01:00
|
|
|
// Show the sidebar if switching away from mobile view, hide it when switching to mobile
|
|
|
|
// Wrap in a condition so we save ourselves the $apply if nothing changes (50ms or more)
|
2014-08-28 18:25:40 +02:00
|
|
|
if ($scope.wasMobileUi && !utils.isMobileUi()) {
|
2014-07-08 10:51:17 +02:00
|
|
|
$scope.showSidebar();
|
2014-03-13 19:49:29 +01:00
|
|
|
}
|
2014-08-28 18:25:40 +02:00
|
|
|
$scope.wasMobileUi = utils.isMobileUi();
|
2014-02-28 11:23:10 +01:00
|
|
|
$scope.calculateNumLines();
|
2014-06-18 23:10:33 +02:00
|
|
|
|
|
|
|
// if we're scrolled to the bottom, scroll down to the same position after the resize
|
|
|
|
// most common use case: opening the keyboard on a mobile device
|
2014-09-23 02:08:27 +02:00
|
|
|
if ($rootScope.bufferBottom) {
|
|
|
|
var rescroll = function(){
|
|
|
|
$rootScope.updateBufferBottom(true);
|
|
|
|
};
|
|
|
|
$timeout(rescroll, 500);
|
|
|
|
window.requestAnimationFrame(rescroll);
|
2014-06-18 23:10:33 +02:00
|
|
|
}
|
2014-02-28 11:23:10 +01:00
|
|
|
}
|
|
|
|
}, 100));
|
|
|
|
|
2014-02-10 19:43:52 +01:00
|
|
|
$rootScope.loadingLines = false;
|
2014-03-07 18:07:05 +01:00
|
|
|
$scope.fetchMoreLines = function(numLines) {
|
|
|
|
if (!numLines) {
|
2014-06-27 04:36:30 +02:00
|
|
|
numLines = $scope.lines_per_screen;
|
2014-03-07 18:07:05 +01:00
|
|
|
}
|
2014-06-18 23:10:33 +02:00
|
|
|
return connection.fetchMoreLines(numLines);
|
2014-02-10 20:32:00 +01:00
|
|
|
};
|
2014-02-10 19:43:52 +01:00
|
|
|
|
2014-09-23 02:08:27 +02:00
|
|
|
$rootScope.updateBufferBottom = function(bottom) {
|
|
|
|
var eob = document.getElementById("end-of-buffer");
|
|
|
|
var bl = document.getElementById('bufferlines');
|
|
|
|
if (bottom) {
|
|
|
|
eob.scrollIntoView();
|
|
|
|
}
|
|
|
|
$rootScope.bufferBottom = eob.offsetTop <= bl.scrollTop + bl.clientHeight;
|
|
|
|
};
|
2014-09-13 18:58:31 +02:00
|
|
|
$rootScope.scrollWithBuffer = function(scrollToReadmarker, moreLines) {
|
2013-12-28 16:50:31 +01:00
|
|
|
// First, get scrolling status *before* modification
|
|
|
|
// This is required to determine where we were in the buffer pre-change
|
|
|
|
var bl = document.getElementById('bufferlines');
|
|
|
|
var sVal = bl.scrollHeight - bl.clientHeight;
|
|
|
|
|
2013-10-16 23:59:27 +02:00
|
|
|
var scroll = function() {
|
2013-12-09 11:10:11 +01:00
|
|
|
var sTop = bl.scrollTop;
|
2013-12-28 16:50:31 +01:00
|
|
|
// Determine if we want to scroll at all
|
2014-02-05 11:19:54 +01:00
|
|
|
// Give the check 3 pixels of slack so you don't have to hit
|
|
|
|
// the exact spot. This fixes a bug in some browsers
|
2014-09-13 18:58:31 +02:00
|
|
|
if (((scrollToReadmarker || moreLines) && sTop < sVal) || (Math.abs(sTop - sVal) < 3)) {
|
2014-02-11 21:40:25 +01:00
|
|
|
var readmarker = document.querySelector(".readmarker");
|
2014-09-13 18:58:31 +02:00
|
|
|
if (scrollToReadmarker && readmarker) {
|
2013-12-28 16:50:31 +01:00
|
|
|
// Switching channels, scroll to read marker
|
2014-02-11 21:40:25 +01:00
|
|
|
bl.scrollTop = readmarker.offsetTop - readmarker.parentElement.scrollHeight + readmarker.scrollHeight;
|
2014-09-13 18:58:31 +02:00
|
|
|
} else if (moreLines) {
|
|
|
|
// We fetched more lines but the read marker is still out of view
|
|
|
|
// Keep the scroll position constant
|
|
|
|
bl.scrollTop = bl.scrollHeight - bl.clientHeight - sVal;
|
2013-12-28 16:50:31 +01:00
|
|
|
} else {
|
|
|
|
// New message, scroll with buffer (i.e. to bottom)
|
2014-09-23 02:08:27 +02:00
|
|
|
var eob = document.getElementById("end-of-buffer");
|
|
|
|
eob.scrollIntoView();
|
2013-10-22 19:58:12 +02:00
|
|
|
}
|
2014-09-23 02:08:27 +02:00
|
|
|
$rootScope.updateBufferBottom();
|
2013-10-11 18:45:01 +02:00
|
|
|
}
|
2013-12-16 14:09:01 +01:00
|
|
|
};
|
2013-10-22 19:58:12 +02:00
|
|
|
// Here be scrolling dragons
|
|
|
|
$timeout(scroll);
|
2014-09-23 02:08:27 +02:00
|
|
|
window.requestAnimationFrame(scroll);
|
2013-12-16 14:09:01 +01:00
|
|
|
};
|
2013-10-07 16:58:41 +02:00
|
|
|
|
2013-02-16 19:18:14 +01:00
|
|
|
|
2013-02-18 00:49:42 +01:00
|
|
|
$scope.connect = function() {
|
2014-08-28 18:25:40 +02:00
|
|
|
notifications.requestNotificationPermission();
|
2014-04-22 19:03:12 +02:00
|
|
|
$rootScope.sslError = false;
|
2014-05-06 21:48:40 +02:00
|
|
|
$rootScope.securityError = false;
|
2014-04-22 19:03:12 +02:00
|
|
|
$rootScope.errorMessage = false;
|
2014-09-23 02:08:27 +02:00
|
|
|
$rootScope.bufferBottom = true;
|
2014-05-06 21:59:10 +02:00
|
|
|
$scope.connectbutton = 'Connecting ...';
|
2014-12-22 22:17:01 +01:00
|
|
|
connection.connect(settings.host, settings.port, $scope.password, settings.ssl);
|
2013-12-16 14:09:01 +01:00
|
|
|
};
|
2013-10-16 14:44:44 +02:00
|
|
|
$scope.disconnect = function() {
|
2014-05-06 21:59:10 +02:00
|
|
|
$scope.connectbutton = 'Connect';
|
2013-10-16 14:25:07 +02:00
|
|
|
connection.disconnect();
|
2013-12-16 14:09:01 +01:00
|
|
|
};
|
2014-10-18 12:25:14 +02:00
|
|
|
$scope.reconnect = function() {
|
|
|
|
var bufferId = models.getActiveBuffer().id;
|
|
|
|
connection.attemptReconnect(bufferId, 3000);
|
|
|
|
};
|
2014-08-28 18:25:40 +02:00
|
|
|
|
|
|
|
//XXX this is a bit out of place here, either move up to the rest of the firefox install code or remove
|
2013-10-21 15:51:05 +02:00
|
|
|
$scope.install = function() {
|
2014-02-08 13:49:21 +01:00
|
|
|
if (navigator.mozApps !== undefined) {
|
2014-02-22 13:45:36 +01:00
|
|
|
// Find absolute url with trailing '/' or '/index.html' removed
|
|
|
|
var base_url = location.protocol + '//' + location.host +
|
|
|
|
location.pathname.replace(/\/(index\.html)?$/, '');
|
|
|
|
var request = navigator.mozApps.install(base_url + '/manifest.webapp');
|
2013-10-21 15:51:05 +02:00
|
|
|
request.onsuccess = function () {
|
|
|
|
$scope.isinstalled = true;
|
|
|
|
// Save the App object that is returned
|
|
|
|
var appRecord = this.result;
|
|
|
|
// Start the app.
|
|
|
|
appRecord.launch();
|
|
|
|
alert('Installation successful!');
|
|
|
|
};
|
|
|
|
request.onerror = function () {
|
|
|
|
// Display the error information from the DOMError object
|
|
|
|
alert('Install failed, error: ' + this.error.name);
|
|
|
|
};
|
2014-02-08 13:49:21 +01:00
|
|
|
} else {
|
2013-10-21 15:51:05 +02:00
|
|
|
alert('Sorry. Only supported in Firefox v26+');
|
|
|
|
}
|
2013-12-16 14:09:01 +01:00
|
|
|
};
|
2013-10-21 15:51:05 +02:00
|
|
|
|
2014-07-06 16:05:48 +02:00
|
|
|
$scope.showModal = function(elementId) {
|
|
|
|
document.getElementById(elementId).setAttribute('data-state', 'visible');
|
|
|
|
};
|
|
|
|
$scope.closeModal = function($event) {
|
|
|
|
function closest(elem, selector) {
|
|
|
|
var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector;
|
|
|
|
while (elem) {
|
|
|
|
if (matchesSelector.call(elem, selector)) return elem;
|
|
|
|
else elem = elem.parentElement;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
closest($event.target, '.gb-modal').setAttribute('data-state', 'hidden');
|
2014-07-05 15:36:58 +02:00
|
|
|
};
|
|
|
|
|
2014-07-05 15:37:43 +02:00
|
|
|
$scope.toggleAccordion = function(event) {
|
|
|
|
event.stopPropagation();
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
var target = event.target.parentNode.parentNode.parentNode;
|
|
|
|
target.setAttribute('data-state', target.getAttribute('data-state') === 'active' ? 'collapsed' : 'active');
|
|
|
|
|
|
|
|
// Hide all other siblings
|
|
|
|
var siblings = target.parentNode.children;
|
|
|
|
for (var childId in siblings) {
|
|
|
|
var child = siblings[childId];
|
|
|
|
if (child.nodeType === 1 && child !== target) {
|
|
|
|
child.setAttribute('data-state', 'collapsed');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2013-10-06 12:34:41 +02:00
|
|
|
|
2014-08-28 18:25:40 +02:00
|
|
|
//XXX what do we do with this?
|
2013-10-11 14:44:05 +02:00
|
|
|
$scope.hasUnread = function(buffer) {
|
2013-12-17 21:30:22 +01:00
|
|
|
// if search is set, return every buffer
|
2014-02-08 13:49:21 +01:00
|
|
|
if ($scope.search && $scope.search !== "") {
|
2013-10-11 23:47:47 +02:00
|
|
|
return true;
|
|
|
|
}
|
2014-12-22 22:17:01 +01:00
|
|
|
if (settings.onlyUnread) {
|
2013-10-19 20:11:01 +02:00
|
|
|
// Always show current buffer in list
|
2014-02-08 14:20:33 +01:00
|
|
|
if (models.getActiveBuffer() === buffer) {
|
2013-10-19 20:11:01 +02:00
|
|
|
return true;
|
|
|
|
}
|
2014-09-13 18:39:29 +02:00
|
|
|
// Always show core buffer in the list (issue #438)
|
|
|
|
if (buffer.fullName === "core.weechat") {
|
|
|
|
return true;
|
|
|
|
}
|
2013-10-19 20:11:01 +02:00
|
|
|
return buffer.unread > 0 || buffer.notification > 0;
|
|
|
|
}
|
|
|
|
return true;
|
2013-10-11 14:44:05 +02:00
|
|
|
};
|
2013-10-11 15:59:55 +02:00
|
|
|
|
2013-10-27 10:48:20 +01:00
|
|
|
// Watch model and update show setting when it changes
|
2014-12-22 22:17:01 +01:00
|
|
|
settings.addCallback('nonicklist', function() {
|
2013-10-27 10:48:20 +01:00
|
|
|
$scope.showNicklist = $scope.updateShowNicklist();
|
2014-09-23 02:08:27 +02:00
|
|
|
// restore bottom view
|
|
|
|
if ($rootScope.connected && $rootScope.bufferBottom) {
|
|
|
|
$timeout(function(){
|
|
|
|
$rootScope.updateBufferBottom(true);
|
|
|
|
}, 500);
|
|
|
|
}
|
2013-10-27 10:48:20 +01:00
|
|
|
});
|
|
|
|
$scope.showNicklist = false;
|
2013-12-17 21:30:22 +01:00
|
|
|
// Utility function that template can use to check if nicklist should
|
2013-10-27 10:48:20 +01:00
|
|
|
// be displayed for current buffer or not
|
|
|
|
// is called on buffer switch
|
|
|
|
$scope.updateShowNicklist = function() {
|
|
|
|
var ab = models.getActiveBuffer();
|
2014-02-08 13:49:21 +01:00
|
|
|
if (!ab) {
|
2013-10-27 10:48:20 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// Check if option no nicklist is set
|
2014-12-22 22:17:01 +01:00
|
|
|
if (settings.nonicklist) {
|
2013-10-27 10:48:20 +01:00
|
|
|
return false;
|
|
|
|
}
|
2014-03-07 18:52:32 +01:00
|
|
|
// Check if nicklist is empty
|
|
|
|
if (ab.isNicklistEmpty()) {
|
2013-10-27 10:48:20 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
2013-12-16 14:09:01 +01:00
|
|
|
};
|
2013-10-27 10:48:20 +01:00
|
|
|
|
2014-08-28 18:25:40 +02:00
|
|
|
//XXX not sure whether this belongs here
|
2013-10-11 15:59:55 +02:00
|
|
|
$rootScope.switchToActivityBuffer = function() {
|
|
|
|
// Find next buffer with activity and switch to it
|
2014-07-02 00:07:34 +02:00
|
|
|
var sortedBuffers = _.sortBy($scope.getBuffers(), 'number');
|
2014-02-17 13:37:14 +01:00
|
|
|
var i, buffer;
|
2014-02-18 19:13:23 +01:00
|
|
|
// Try to find buffer with notification
|
2014-02-17 13:37:14 +01:00
|
|
|
for (i in sortedBuffers) {
|
|
|
|
buffer = sortedBuffers[i];
|
2014-02-08 13:49:21 +01:00
|
|
|
if (buffer.notification > 0) {
|
2013-10-11 15:59:55 +02:00
|
|
|
$scope.setActiveBuffer(buffer.id);
|
2014-02-21 17:03:35 +01:00
|
|
|
return; // return instead of break so that the second for loop isn't executed
|
2014-02-17 13:31:23 +01:00
|
|
|
}
|
|
|
|
}
|
2014-02-18 19:13:23 +01:00
|
|
|
// No notifications, find first buffer with unread lines instead
|
2014-02-17 13:37:14 +01:00
|
|
|
for (i in sortedBuffers) {
|
|
|
|
buffer = sortedBuffers[i];
|
2014-02-18 19:13:23 +01:00
|
|
|
if (buffer.unread > 0) {
|
2013-10-11 15:59:55 +02:00
|
|
|
$scope.setActiveBuffer(buffer.id);
|
2014-02-21 17:03:35 +01:00
|
|
|
return;
|
2013-10-11 15:59:55 +02:00
|
|
|
}
|
2013-10-11 22:43:01 +02:00
|
|
|
}
|
2013-12-16 14:09:01 +01:00
|
|
|
};
|
2014-02-28 00:31:32 +01:00
|
|
|
// Helper function since the keypress handler is in a different scope
|
|
|
|
$rootScope.toggleNicklist = function() {
|
2014-12-22 22:17:01 +01:00
|
|
|
settings.nonicklist = !settings.nonicklist;
|
2014-02-28 03:25:59 +01:00
|
|
|
};
|
2013-10-11 15:59:55 +02:00
|
|
|
|
2013-10-27 07:48:30 +01:00
|
|
|
|
2013-10-17 13:13:01 +02:00
|
|
|
$scope.handleSearchBoxKey = function($event) {
|
|
|
|
// Support different browser quirks
|
|
|
|
var code = $event.keyCode ? $event.keyCode : $event.charCode;
|
|
|
|
// Handle escape
|
2014-02-08 14:20:33 +01:00
|
|
|
if (code === 27) {
|
2013-10-19 20:11:01 +02:00
|
|
|
$event.preventDefault();
|
|
|
|
$scope.search = '';
|
2013-10-17 13:13:01 +02:00
|
|
|
} // Handle enter
|
2014-02-08 14:20:33 +01:00
|
|
|
else if (code === 13) {
|
2013-10-19 20:11:01 +02:00
|
|
|
$event.preventDefault();
|
2014-02-21 09:37:55 +01:00
|
|
|
if ($scope.filteredBuffers.length > 0) {
|
2014-09-03 14:39:38 +02:00
|
|
|
$scope.setActiveBuffer($scope.filteredBuffers[0].id);
|
2014-02-21 09:37:55 +01:00
|
|
|
}
|
2013-10-19 20:11:01 +02:00
|
|
|
$scope.search = '';
|
2013-10-17 13:13:01 +02:00
|
|
|
}
|
2013-12-16 14:09:01 +01:00
|
|
|
};
|
2013-10-15 15:21:13 +02:00
|
|
|
|
2013-10-28 13:55:46 +01:00
|
|
|
// Prevent user from accidentally leaving the page
|
|
|
|
window.onbeforeunload = function(event) {
|
2014-08-31 16:29:13 +02:00
|
|
|
|
|
|
|
if ($scope.command !== null && $scope.command !== '') {
|
|
|
|
event.preventDefault();
|
|
|
|
// Chrome requires this
|
|
|
|
// Firefox does not show the site provides message
|
|
|
|
event.returnValue = "Any unsent input will be lost. Are you sure that you want to quit?";
|
|
|
|
|
|
|
|
} else {
|
|
|
|
if ($rootScope.connected) {
|
|
|
|
$scope.disconnect();
|
|
|
|
}
|
|
|
|
$scope.favico.reset();
|
2014-02-21 00:52:45 +01:00
|
|
|
}
|
2013-10-28 13:55:46 +01:00
|
|
|
};
|
|
|
|
|
2014-08-28 18:25:40 +02:00
|
|
|
}]);
|
2013-10-27 20:49:51 +01:00
|
|
|
|
2013-12-17 21:30:22 +01:00
|
|
|
weechat.config(['$routeProvider',
|
2013-10-27 20:49:51 +01:00
|
|
|
function($routeProvider) {
|
|
|
|
$routeProvider.when('/', {
|
|
|
|
templateUrl: 'index.html',
|
2013-12-17 21:39:22 +01:00
|
|
|
controller: 'WeechatCtrl'
|
2013-10-27 20:49:51 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
]);
|
2014-08-24 18:53:55 +02:00
|
|
|
|
|
|
|
})();
|