Merge pull request #180 from tribut/nonmobile-focus

Focus input bar when not on mobile
This commit is contained in:
David Cormier 2014-02-24 09:08:59 -05:00
commit 24234be451
3 changed files with 22 additions and 22 deletions

View File

@ -486,7 +486,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
});
}
var mobile_cutoff = 968;
$scope.mobile_cutoff = 968;
$rootScope.countWatchers = function () {
var root = $(document.getElementsByTagName('body'));
@ -663,7 +663,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
// If we are on mobile chhange some defaults
// We use 968 px as the cutoff, which should match the value in glowingbear.css
if (document.body.clientWidth < mobile_cutoff) {
if (document.body.clientWidth < $scope.mobile_cutoff) {
$scope.nonicklist = true;
$scope.noembed = true;
$scope.notimestamp = true;
@ -671,24 +671,24 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
// Open and close panels while on mobile devices through swiping
$scope.swipeSidebar = function() {
if (document.body.clientWidth < mobile_cutoff) {
if (document.body.clientWidth < $scope.mobile_cutoff) {
$scope.showSidebar = !$scope.showSidebar;
}
};
$scope.openNick = function() {
if (document.body.clientWidth < mobile_cutoff) {
if($scope.nonicklist) {
if (document.body.clientWidth < $scope.mobile_cutoff) {
if($scope.nonicklist) {
$scope.nonicklist = false;
}
}
}
};
$scope.closeNick = function() {
if (document.body.clientWidth < mobile_cutoff) {
if(!$scope.nonicklist) {
if (document.body.clientWidth < $scope.mobile_cutoff) {
if(!$scope.nonicklist) {
$scope.nonicklist = true;
}
}
}
};
@ -718,7 +718,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$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 < mobile_cutoff) {
if (document.body.clientWidth < $scope.mobile_cutoff) {
$scope.showSidebar = false;
}
return models.setActiveBuffer(bufferId, key);
@ -1001,11 +1001,11 @@ weechat.directive('inputBar', function() {
models) {
// Focuses itself when active buffer is changed
/*
$rootScope.$on('activeBufferChanged', function() {
angular.element('#sendMessage').focus();
if (document.body.clientWidth >= $scope.mobile_cutoff) {
angular.element('#sendMessage').focus();
}
});
*/
$scope.completeNick = function() {
// input DOM node

View File

@ -271,15 +271,15 @@ plugins.factory('userPlugins', function() {
*/
var asciinemaPlugin = new Plugin(function(message) {
var regexp = /http(s){0,1}:\/\/(www\.){0,1}asciinema.org\/a\/(\d+)/;
var match = message.match(regexp);
if (match) {
var regexp = /http(s){0,1}:\/\/(www\.){0,1}asciinema.org\/a\/(\d+)/;
var match = message.match(regexp);
if (match) {
var id = match[3];
return "<script type='text/javascript' src='https://asciinema.org/a/" + id + ".js' id='asciicast-" + id + "' async></script>";
}
}
});
asciinemaPlugin.name = "ascii cast";
return {
plugins: [youtubePlugin, dailymotionPlugin, allocinePlugin, imagePlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin]
};

View File

@ -3,10 +3,10 @@ var websockets = angular.module('ngWebsockets', []);
websockets.factory('ngWebsockets',
['$rootScope','$q',
function($rootScope, $q) {
this.protocol = null;
var ws = null;
var callbacks = {};
var currentCallBackId = 0;
@ -24,7 +24,7 @@ function($rootScope, $q) {
};
/*
* Returns the current callback id
*/