From 93b7f9b40be54e542b83b129c9221e0803473c35 Mon Sep 17 00:00:00 2001 From: Chaphasilor Date: Sun, 12 Apr 2020 14:43:04 +0200 Subject: [PATCH] applied prettier --write --- public/chat.html | 3 +- public/css/chat.css | 24 ++++----- public/css/snackbar.css | 8 ++- public/js/chat.js | 8 ++- public/js/jquery.ui.touch-punch.js | 86 ++++++++++++++---------------- 5 files changed, 62 insertions(+), 67 deletions(-) diff --git a/public/chat.html b/public/chat.html index d635206..260580d 100644 --- a/public/chat.html +++ b/public/chat.html @@ -1,9 +1,8 @@ - - + ZipChat diff --git a/public/css/chat.css b/public/css/chat.css index 3fa07d6..d8dbe6e 100644 --- a/public/css/chat.css +++ b/public/css/chat.css @@ -361,23 +361,24 @@ button:hover { /* Begin mobile layout */ @media (max-width: 640px) { -/* @media (min-width: 320px) and (max-width: 480px) { */ + /* @media (min-width: 320px) and (max-width: 480px) { */ - html, body { + html, + body { width: 100%; height: 100%; font-size: 1em; } - + #header { z-index: 5; } - + #header img { width: auto; height: 2rem; } - + #header p { margin: 0; line-height: 2rem; @@ -485,12 +486,12 @@ button:hover { display: none !important; } - .buttonContainer:nth-child(3) , + .buttonContainer:nth-child(3), .buttonContainer:nth-child(5) { display: none; } - #entire-chat { + #entire-chat { position: absolute; top: 3rem; right: 0; @@ -529,21 +530,20 @@ button:hover { bottom: 0; width: 80%; height: 2rem; - margin: .5rem 0; + margin: 0.5rem 0; padding: 0; box-shadow: none; } - + .compose input { width: 90%; height: 2rem; line-height: 2rem; } - + .compose input::placeholder { color: white; } - } -/* End mobile layout */ \ No newline at end of file +/* End mobile layout */ diff --git a/public/css/snackbar.css b/public/css/snackbar.css index 3e67c97..256f784 100644 --- a/public/css/snackbar.css +++ b/public/css/snackbar.css @@ -95,7 +95,6 @@ /* Mobile Styles Start */ @media (max-width: 640px) { - .snackbar-container { position: fixed; top: 5rem; @@ -110,7 +109,7 @@ height: auto; margin: 0; margin-top: 1rem; - padding: .5rem; + padding: 0.5rem; word-wrap: break-word; line-height: 1.2rem; font-size: 1rem; @@ -122,7 +121,7 @@ .snackbar-container .action { width: 15%; - padding: .2rem; + padding: 0.2rem; border-radius: 10px; display: inline-block; border: none; @@ -136,10 +135,9 @@ .snackbar-pos.bottom-center, .snackbar-pos.top-center { - left: calc(10vw - 0.5rem);; + left: calc(10vw - 0.5rem); transform: none; } - } /* Mobile Styles End */ diff --git a/public/js/chat.js b/public/js/chat.js index 320515d..05a45ab 100644 --- a/public/js/chat.js +++ b/public/js/chat.js @@ -358,8 +358,12 @@ function rePositionLocalVideo() { // Get position of remote video var bounds = remoteVideo.position(); let localVideo = $("#local-video"); - if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { - bounds.top = $(window).height()*0.75; + if ( + /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( + navigator.userAgent + ) + ) { + bounds.top = $(window).height() * 0.75; bounds.left += 10; } else { bounds.top += 10; diff --git a/public/js/jquery.ui.touch-punch.js b/public/js/jquery.ui.touch-punch.js index 16ce41d..e98e06c 100644 --- a/public/js/jquery.ui.touch-punch.js +++ b/public/js/jquery.ui.touch-punch.js @@ -9,9 +9,8 @@ * jquery.ui.mouse.js */ (function ($) { - // Detect touch support - $.support.touch = 'ontouchend' in document; + $.support.touch = "ontouchend" in document; // Ignore browsers without touch support if (!$.support.touch) { @@ -19,17 +18,16 @@ } var mouseProto = $.ui.mouse.prototype, - _mouseInit = mouseProto._mouseInit, - _mouseDestroy = mouseProto._mouseDestroy, - touchHandled; + _mouseInit = mouseProto._mouseInit, + _mouseDestroy = mouseProto._mouseDestroy, + touchHandled; /** * Simulate a mouse event based on a corresponding touch event * @param {Object} event A touch event * @param {String} simulatedType The corresponding mouse event */ - function simulateMouseEvent (event, simulatedType) { - + function simulateMouseEvent(event, simulatedType) { // Ignore multi-touch events if (event.originalEvent.touches.length > 1) { return; @@ -38,25 +36,25 @@ event.preventDefault(); var touch = event.originalEvent.changedTouches[0], - simulatedEvent = document.createEvent('MouseEvents'); - + simulatedEvent = document.createEvent("MouseEvents"); + // Initialize the simulated mouse event using the touch event's coordinates simulatedEvent.initMouseEvent( - simulatedType, // type - true, // bubbles - true, // cancelable - window, // view - 1, // detail - touch.screenX, // screenX - touch.screenY, // screenY - touch.clientX, // clientX - touch.clientY, // clientY - false, // ctrlKey - false, // altKey - false, // shiftKey - false, // metaKey - 0, // button - null // relatedTarget + simulatedType, // type + true, // bubbles + true, // cancelable + window, // view + 1, // detail + touch.screenX, // screenX + touch.screenY, // screenY + touch.clientX, // clientX + touch.clientY, // clientY + false, // ctrlKey + false, // altKey + false, // shiftKey + false, // metaKey + 0, // button + null // relatedTarget ); // Dispatch the simulated event to the target element @@ -68,11 +66,13 @@ * @param {Object} event The widget element's touchstart event */ mouseProto._touchStart = function (event) { - var self = this; // Ignore the event if another widget is already being handled - if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) { + if ( + touchHandled || + !self._mouseCapture(event.originalEvent.changedTouches[0]) + ) { return; } @@ -83,13 +83,13 @@ self._touchMoved = false; // Simulate the mouseover event - simulateMouseEvent(event, 'mouseover'); + simulateMouseEvent(event, "mouseover"); // Simulate the mousemove event - simulateMouseEvent(event, 'mousemove'); + simulateMouseEvent(event, "mousemove"); // Simulate the mousedown event - simulateMouseEvent(event, 'mousedown'); + simulateMouseEvent(event, "mousedown"); }; /** @@ -97,7 +97,6 @@ * @param {Object} event The document's touchmove event */ mouseProto._touchMove = function (event) { - // Ignore event if not handled if (!touchHandled) { return; @@ -107,7 +106,7 @@ this._touchMoved = true; // Simulate the mousemove event - simulateMouseEvent(event, 'mousemove'); + simulateMouseEvent(event, "mousemove"); }; /** @@ -115,23 +114,21 @@ * @param {Object} event The document's touchend event */ mouseProto._touchEnd = function (event) { - // Ignore event if not handled if (!touchHandled) { return; } // Simulate the mouseup event - simulateMouseEvent(event, 'mouseup'); + simulateMouseEvent(event, "mouseup"); // Simulate the mouseout event - simulateMouseEvent(event, 'mouseout'); + simulateMouseEvent(event, "mouseout"); // If the touch interaction did not move, it should trigger a click if (!this._touchMoved) { - // Simulate the click event - simulateMouseEvent(event, 'click'); + simulateMouseEvent(event, "click"); } // Unset the flag to allow other widgets to inherit the touch event @@ -145,14 +142,13 @@ * original mouse event handling methods. */ mouseProto._mouseInit = function () { - var self = this; // Delegate the touch handlers to the widget's element self.element.bind({ - touchstart: $.proxy(self, '_touchStart'), - touchmove: $.proxy(self, '_touchMove'), - touchend: $.proxy(self, '_touchEnd') + touchstart: $.proxy(self, "_touchStart"), + touchmove: $.proxy(self, "_touchMove"), + touchend: $.proxy(self, "_touchEnd"), }); // Call the original $.ui.mouse init method @@ -163,18 +159,16 @@ * Remove the touch event handlers */ mouseProto._mouseDestroy = function () { - var self = this; // Delegate the touch handlers to the widget's element self.element.unbind({ - touchstart: $.proxy(self, '_touchStart'), - touchmove: $.proxy(self, '_touchMove'), - touchend: $.proxy(self, '_touchEnd') + touchstart: $.proxy(self, "_touchStart"), + touchmove: $.proxy(self, "_touchMove"), + touchend: $.proxy(self, "_touchEnd"), }); // Call the original $.ui.mouse destroy method _mouseDestroy.call(self); }; - -})(jQuery); \ No newline at end of file +})(jQuery);