Use single line if's for simple return criteria

This commit is contained in:
Samuel Mannehed 2016-09-30 21:55:49 +02:00
parent b199e3c60c
commit 1c1cc1d0e9
1 changed files with 7 additions and 15 deletions

View File

@ -591,8 +591,7 @@ var UI;
}, },
controlbarHandleMouseUp: function(e) { controlbarHandleMouseUp: function(e) {
if ((e.type == "mouseup") && (e.button != 0)) if ((e.type == "mouseup") && (e.button != 0)) return;
return;
// mouseup and mousedown on the same place toggles the controlbar // mouseup and mousedown on the same place toggles the controlbar
if (UI.controlbarGrabbed && !UI.controlbarDrag) { if (UI.controlbarGrabbed && !UI.controlbarDrag) {
@ -604,8 +603,7 @@ var UI;
}, },
controlbarHandleMouseDown: function(e) { controlbarHandleMouseDown: function(e) {
if ((e.type == "mousedown") && (e.button != 0)) if ((e.type == "mousedown") && (e.button != 0)) return;
return;
var ptr = Util.getPointerEvent(e); var ptr = Util.getPointerEvent(e);
@ -1129,9 +1127,7 @@ var UI;
// Update parameters that depend on the clip setting // Update parameters that depend on the clip setting
updateViewClip: function() { updateViewClip: function() {
var display; var display;
if (!UI.rfb) { if (!UI.rfb) return;
return;
}
var display = UI.rfb.get_display(); var display = UI.rfb.get_display();
var cur_clip = display.get_viewport(); var cur_clip = display.get_viewport();
@ -1282,13 +1278,11 @@ var UI;
* ------v------*/ * ------v------*/
showVirtualKeyboard: function() { showVirtualKeyboard: function() {
if (!UI.isTouchDevice) if (!UI.isTouchDevice) return;
return;
var input = document.getElementById('noVNC_keyboardinput'); var input = document.getElementById('noVNC_keyboardinput');
if (document.activeElement == input) if (document.activeElement == input) return;
return;
UI.keyboardVisible = true; UI.keyboardVisible = true;
document.getElementById('noVNC_keyboard_button') document.getElementById('noVNC_keyboard_button')
@ -1303,13 +1297,11 @@ var UI;
}, },
hideVirtualKeyboard: function() { hideVirtualKeyboard: function() {
if (!UI.isTouchDevice) if (!UI.isTouchDevice) return;
return;
var input = document.getElementById('noVNC_keyboardinput'); var input = document.getElementById('noVNC_keyboardinput');
if (document.activeElement != input) if (document.activeElement != input) return;
return;
input.blur(); input.blur();
}, },