|
|
@ -610,7 +610,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
} |
|
|
|
} |
|
|
|
return connection.fetchMoreLines(numLines); |
|
|
|
return connection.fetchMoreLines(numLines); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
$scope.infiniteScroll = function() { |
|
|
|
$scope.infiniteScroll = function() { |
|
|
|
// Check if we are already fetching
|
|
|
|
// Check if we are already fetching
|
|
|
|
if ($rootScope.loadingLines) { |
|
|
|
if ($rootScope.loadingLines) { |
|
|
@ -630,6 +630,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
} |
|
|
|
} |
|
|
|
$rootScope.bufferBottom = eob.offsetTop <= bl.scrollTop + bl.clientHeight; |
|
|
|
$rootScope.bufferBottom = eob.offsetTop <= bl.scrollTop + bl.clientHeight; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
$rootScope.scrollWithBuffer = function(scrollToReadmarker, moreLines) { |
|
|
|
$rootScope.scrollWithBuffer = function(scrollToReadmarker, moreLines) { |
|
|
|
// First, get scrolling status *before* modification
|
|
|
|
// First, get scrolling status *before* modification
|
|
|
|
// This is required to determine where we were in the buffer pre-change
|
|
|
|
// This is required to determine where we were in the buffer pre-change
|
|
|
@ -664,39 +665,31 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
$scope.parseHost = function() { |
|
|
|
$scope.parseHost = function() { |
|
|
|
|
|
|
|
|
|
|
|
//The host field is multi purpose for advanced users
|
|
|
|
//The host field is multi purpose for advanced users
|
|
|
|
//There can be a combination of host, port and path
|
|
|
|
//There can be a combination of host, port and path
|
|
|
|
//If host is specified here the dedicated port field is disabled
|
|
|
|
//If host is specified here the dedicated port field is disabled
|
|
|
|
var parts; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$rootScope.hostInvalid = false; |
|
|
|
$rootScope.hostInvalid = false; |
|
|
|
|
|
|
|
|
|
|
|
//host
|
|
|
|
var parts; |
|
|
|
var regexHost = /^([^:\/]*|\[.*\])$/; |
|
|
|
var regexHost = /^([^:\/]*|\[.*\])$/; |
|
|
|
var regexHostPort = /^([^:]*|\[.*\]):(\d+)$/; |
|
|
|
var regexHostPort = /^([^:]*|\[.*\]):(\d+)$/; |
|
|
|
var regexHostPortPath = /^([^:]*|\[.*\]):(\d*)\/(.+)$/; |
|
|
|
var regexHostPortPath = /^([^:]*|\[.*\]):(\d*)\/(.+)$/; |
|
|
|
if((parts = regexHost.exec(settings.hostField)) !== null) { |
|
|
|
|
|
|
|
|
|
|
|
if ((parts = regexHost.exec(settings.hostField)) !== null) { //host only
|
|
|
|
settings.host = parts[1]; |
|
|
|
settings.host = parts[1]; |
|
|
|
$rootScope.portDisabled = false; |
|
|
|
$rootScope.portDisabled = false; |
|
|
|
} |
|
|
|
} else if ((parts = regexHostPort.exec(settings.hostField)) !== null) { //host:port
|
|
|
|
//host:port
|
|
|
|
|
|
|
|
else if((parts = regexHostPort.exec(settings.hostField)) !== null) { |
|
|
|
|
|
|
|
settings.host = parts[1]; |
|
|
|
settings.host = parts[1]; |
|
|
|
settings.port = parts[2]; |
|
|
|
settings.port = parts[2]; |
|
|
|
$rootScope.portDisabled = true; |
|
|
|
$rootScope.portDisabled = true; |
|
|
|
} |
|
|
|
} else if ((parts = regexHostPortPath.exec(settings.hostField)) !== null) { //host:port/path
|
|
|
|
//host:port/path
|
|
|
|
|
|
|
|
else if((parts = regexHostPortPath.exec(settings.hostField)) !== null) { |
|
|
|
|
|
|
|
settings.host = parts[1]; |
|
|
|
settings.host = parts[1]; |
|
|
|
settings.port = parts[2]; |
|
|
|
settings.port = parts[2]; |
|
|
|
settings.path = parts[3]; |
|
|
|
settings.path = parts[3]; |
|
|
|
$rootScope.portDisabled = true; |
|
|
|
$rootScope.portDisabled = true; |
|
|
|
} |
|
|
|
} else { |
|
|
|
else { |
|
|
|
|
|
|
|
$rootScope.hostInvalid = true; |
|
|
|
$rootScope.hostInvalid = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
$scope.connect = function() { |
|
|
|
$scope.connect = function() { |
|
|
@ -709,12 +702,14 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
$scope.connectbuttonicon = 'glyphicon-refresh glyphicon-spin'; |
|
|
|
$scope.connectbuttonicon = 'glyphicon-refresh glyphicon-spin'; |
|
|
|
connection.connect(settings.host, settings.port, settings.path, $scope.password, settings.ssl); |
|
|
|
connection.connect(settings.host, settings.port, settings.path, $scope.password, settings.ssl); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
$scope.disconnect = function() { |
|
|
|
$scope.disconnect = function() { |
|
|
|
$scope.connectbutton = 'Connect'; |
|
|
|
$scope.connectbutton = 'Connect'; |
|
|
|
$scope.connectbuttonicon = 'glyphicon-chevron-right'; |
|
|
|
$scope.connectbuttonicon = 'glyphicon-chevron-right'; |
|
|
|
bufferResume.reset(); |
|
|
|
bufferResume.reset(); |
|
|
|
connection.disconnect(); |
|
|
|
connection.disconnect(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
$scope.reconnect = function() { |
|
|
|
$scope.reconnect = function() { |
|
|
|
var bufferId = models.getActiveBuffer().id; |
|
|
|
var bufferId = models.getActiveBuffer().id; |
|
|
|
connection.attemptReconnect(bufferId, 3000); |
|
|
|
connection.attemptReconnect(bufferId, 3000); |
|
|
@ -723,6 +718,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', |
|
|
|
$scope.showModal = function(elementId) { |
|
|
|
$scope.showModal = function(elementId) { |
|
|
|
document.getElementById(elementId).setAttribute('data-state', 'visible'); |
|
|
|
document.getElementById(elementId).setAttribute('data-state', 'visible'); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
$scope.closeModal = function($event) { |
|
|
|
$scope.closeModal = function($event) { |
|
|
|
function closest(elem, selector) { |
|
|
|
function closest(elem, selector) { |
|
|
|
var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector; |
|
|
|
var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector; |
|
|
|