Implement swiping for mobile devices
This commit is contained in:
parent
27690ada58
commit
abefa7430a
1 changed files with 28 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
||||||
var weechat = angular.module('weechat', ['ngRoute', 'localStorage', 'weechatModels', 'plugins', 'ngSanitize', 'ngWebsockets', 'pasvaz.bindonce']);
|
var weechat = angular.module('weechat', ['ngRoute', 'localStorage', 'weechatModels', 'plugins', 'ngSanitize', 'ngWebsockets', 'pasvaz.bindonce', 'ngTouch']);
|
||||||
|
|
||||||
weechat.filter('toArray', function () {
|
weechat.filter('toArray', function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
@ -618,8 +618,30 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
$scope.noembed = true;
|
$scope.noembed = true;
|
||||||
$scope.notimestamp = true;
|
$scope.notimestamp = true;
|
||||||
}
|
}
|
||||||
|
// Open and close panels while on mobile devices through swiping
|
||||||
|
$scope.swipeSidebar = function() {
|
||||||
|
if (document.body.clientWidth < 968) {
|
||||||
|
$('#sidebar').collapse('toggle');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$scope.openNick = function() {
|
||||||
|
if (document.body.clientWidth < 968) {
|
||||||
|
if($scope.nonicklist) {
|
||||||
|
$scope.nonicklist = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.closeNick = function() {
|
||||||
|
if (document.body.clientWidth < 968) {
|
||||||
|
if(!$scope.nonicklist) {
|
||||||
|
$scope.nonicklist = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Watch model and update show setting when it changes
|
// Watch model and update show setting when it changes
|
||||||
$scope.$watch('noembed', function() {
|
$scope.$watch('noembed', function() {
|
||||||
$rootScope.visible = $scope.noembed === false;
|
$rootScope.visible = $scope.noembed === false;
|
||||||
|
@ -632,6 +654,11 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
||||||
$rootScope.predicate = $scope.orderbyserver ? 'serverSortKey' : 'number';
|
$rootScope.predicate = $scope.orderbyserver ? 'serverSortKey' : 'number';
|
||||||
|
|
||||||
$scope.setActiveBuffer = function(bufferId, key) {
|
$scope.setActiveBuffer = function(bufferId, key) {
|
||||||
|
// 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
|
||||||
|
if (document.body.clientWidth < 968) {
|
||||||
|
$('#sidebar').collapse('toggle');
|
||||||
|
}
|
||||||
return models.setActiveBuffer(bufferId, key);
|
return models.setActiveBuffer(bufferId, key);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue