Merge pull request #374 from glowing-bear/autoconn
New feature: Automatically connect
This commit is contained in:
commit
ff63a9d8bd
|
@ -77,6 +77,12 @@
|
|||
Save password in your browser
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox" ng-show="savepassword">
|
||||
<label class="control-label" for="autoconnect">
|
||||
<input type="checkbox" id="autoconnect" ng-model="autoconnect">
|
||||
Automatically connect
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label class="control-label" for="ssl">
|
||||
<input type="checkbox" id="ssl" ng-model="ssl">
|
||||
|
|
|
@ -829,6 +829,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
if ($scope.savepassword) {
|
||||
$store.bind($scope, "password", "");
|
||||
}
|
||||
$store.bind($scope, "autoconnect", false);
|
||||
|
||||
// If we are on mobile change some defaults
|
||||
// We use 968 px as the cutoff, which should match the value in glowingbear.css
|
||||
|
@ -885,6 +886,11 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
document.getElementById('sidebar').setAttribute('data-state', 'hidden');
|
||||
document.getElementById('content').setAttribute('sidebar-state', 'hidden');
|
||||
};
|
||||
$scope.$watch('autoconnect', function() {
|
||||
if ($scope.autoconnect && !$rootScope.connected) {
|
||||
$scope.connect();
|
||||
}
|
||||
});
|
||||
|
||||
// toggle sidebar (if on mobile)
|
||||
$scope.toggleSidebar = function() {
|
||||
|
@ -1230,6 +1236,10 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
$scope.favico.reset();
|
||||
};
|
||||
|
||||
if ($scope.autoconnect && !$rootScope.connected && !$rootScope.sslError && !$rootScope.securityError && !$rootScope.errorMessage) {
|
||||
$scope.connect();
|
||||
}
|
||||
|
||||
}]
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue