Merge pull request #374 from glowing-bear/autoconn

New feature: Automatically connect
This commit is contained in:
Lorenz Hübschle-Schneider 2014-07-21 14:50:44 +01:00
commit ff63a9d8bd
2 changed files with 16 additions and 0 deletions

View File

@ -77,6 +77,12 @@
Save password in your browser Save password in your browser
</label> </label>
</div> </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"> <div class="checkbox">
<label class="control-label" for="ssl"> <label class="control-label" for="ssl">
<input type="checkbox" id="ssl" ng-model="ssl"> <input type="checkbox" id="ssl" ng-model="ssl">

View File

@ -829,6 +829,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
if ($scope.savepassword) { if ($scope.savepassword) {
$store.bind($scope, "password", ""); $store.bind($scope, "password", "");
} }
$store.bind($scope, "autoconnect", false);
// If we are on mobile change some defaults // If we are on mobile change some defaults
// We use 968 px as the cutoff, which should match the value in glowingbear.css // 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('sidebar').setAttribute('data-state', 'hidden');
document.getElementById('content').setAttribute('sidebar-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) // toggle sidebar (if on mobile)
$scope.toggleSidebar = function() { $scope.toggleSidebar = function() {
@ -1230,6 +1236,10 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$scope.favico.reset(); $scope.favico.reset();
}; };
if ($scope.autoconnect && !$rootScope.connected && !$rootScope.sslError && !$rootScope.securityError && !$rootScope.errorMessage) {
$scope.connect();
}
}] }]
); );