HEX
Server: Apache/2.4.25 (Debian)
System: Linux server17 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
User: web37 (1062)
PHP: 7.4.30
Disabled: show_source, highlight_file, apache_child_terminate, apache_get_modules, apache_note, apache_setenv, virtual, dl, disk_total_space, posix_getpwnam, posix_getpwuid, posix_mkfifo, posix_mknod, posix_setpgid, posix_setsid, posix_setuid, posix_uname, proc_nice, openlog, syslog, pfsockopen
Upload Files
File: /var/www/web37/htdocs/lovetalk/admin/js/controlpanel.js
(function () {

	"use strict";

	$(function () {
		// Setup the hamburger menu
		var $sidebar = $( ".sidebar" ),
			$menu = $sidebar.find( ".menu" ),
			$body = $( "body" ),
			$window = $( window ),
			touchDevice = $( "html" ).hasClass( "touchevents" ),
			touches = [];

		var showSidebar = function ( e ) {
			e.preventDefault();
			e.stopPropagation();
			$sidebar
				.stop( false, false )
				.animate({ "left": 0 }, 500);
			if ( !touchDevice ) {
				$body.one( "click", hideSidebar );
			} else {
				$body[ 0 ].addEventListener( 'touchstart', touchStart );
				$body[ 0 ].addEventListener( 'touchmove', touchMove );
			}
			return false;
		};

		var hideSidebar = function ( e ) {
			if ( touchDevice ) {
				$body[ 0 ].removeEventListener( 'touchstart', touchStart );
				$body[ 0 ].removeEventListener( 'touchmove', touchMove );
			}
			$sidebar
				.stop( false, false )
				.animate({ "left": "-101%" }, 500);
		};

		var touchStart = function () {
			touches = [];
		};

		var touchMove = function ( e ) {
			touches.push( e );
			if ( touches.length > 1 ) {
				var diffX = touches[ touches.length - 1 ].touches[ 0 ].clientX - touches[ 0 ].touches[ 0 ].clientX;
				var diffY = touches[ touches.length - 1 ].touches[ 0 ].clientY - touches[ 0 ].touches[ 0 ].clientY;
				if ( diffX < -30 && Math.abs(diffX) > Math.abs(diffY) ) {
					hideSidebar( e );
				}
			}
		};

		$( ".toolbar .hamburger" ).on( "click", showSidebar );

		// WSXTHR-1043: Do this only on the desktop screen
		if ( !touchDevice ) {
			$window.on( "resize", hideSidebar );
		}
	});

})();