New feature: Automatically connect

Check if user saved password, and then offer to automatically connect.
Use a angular watch on the autoconnect and connect as soon as user
selects it.

Check for error messages so it doesn't try to reconnect if there is
errors.
rewrite-with-urlplugin
Tor Hveem 11 years ago
parent 95c9969e71
commit 065d8a240d
  1. 6
      index.html
  2. 10
      js/glowingbear.js

@ -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">

@ -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();
}
}] }]
); );

Loading…
Cancel
Save