From 0832bbe197c72c5009eb5c2e9777819cf7e27fd6 Mon Sep 17 00:00:00 2001 From: MoskalykA <100430077+MoskalykA@users.noreply.github.com> Date: Mon, 6 Feb 2023 13:39:32 +0100 Subject: [PATCH 01/70] style(es_extended): run prettier --- [core]/es_extended/html/css/app.css | 19 +++++---- [core]/es_extended/html/js/app.js | 60 ++++++++++++++------------- [core]/es_extended/html/js/wrapper.js | 59 ++++++++++++-------------- 3 files changed, 67 insertions(+), 71 deletions(-) diff --git a/[core]/es_extended/html/css/app.css b/[core]/es_extended/html/css/app.css index 0bdbc9083..cfd2f67b1 100644 --- a/[core]/es_extended/html/css/app.css +++ b/[core]/es_extended/html/css/app.css @@ -1,11 +1,11 @@ @font-face { - font-family: 'Pricedown'; - src: url('../fonts/pdown.ttf'); + font-family: "Pricedown"; + src: url("../fonts/pdown.ttf"); } @font-face { - font-family: 'bankgothic'; - src: url('../fonts/bankgothic.ttf'); + font-family: "bankgothic"; + src: url("../fonts/bankgothic.ttf"); } html { @@ -20,11 +20,12 @@ html { font-size: 2em; font-weight: bold; color: #fff; - text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; + text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, + 1px 1px 0 #000; } .menu { - font-family: 'Open Sans', sans-serif; + font-family: "Open Sans", sans-serif; min-width: 400px; min-height: 250px; color: #fff; @@ -34,7 +35,7 @@ html { } .menu .head { - font-family: 'Open Sans', sans-serif; + font-family: "Open Sans", sans-serif; font-size: 28px; padding: 10px; background: #1a1a1a; @@ -51,14 +52,14 @@ html { } .menu .head span { - font-family: 'Pricedown'; + font-family: "Pricedown"; font-size: 28px; padding-left: 15px; padding-top: 6px; } .menu .menu-items .menu-item { - font-family: 'Open Sans', sans-serif; + font-family: "Open Sans", sans-serif; font-size: 14px; height: 40px; display: block; diff --git a/[core]/es_extended/html/js/app.js b/[core]/es_extended/html/js/app.js index 26fb67e4a..029ecc00c 100644 --- a/[core]/es_extended/html/js/app.js +++ b/[core]/es_extended/html/js/app.js @@ -1,38 +1,40 @@ (() => { - ESX = {}; + ESX = {}; - ESX.inventoryNotification = function (add, label, count) { - let notif = ''; + ESX.inventoryNotification = function (add, label, count) { + let notif = ""; - if (add) { - notif += '+'; - } else { - notif += '-'; - } + if (add) { + notif += "+"; + } else { + notif += "-"; + } - if (count) { - notif += count + ' ' + label; - } else { - notif += ' ' + label; - } + if (count) { + notif += count + " " + label; + } else { + notif += " " + label; + } - let elem = $('
' + notif + '
'); - $('#inventory_notifications').append(elem); + let elem = $("
" + notif + "
"); + $("#inventory_notifications").append(elem); - $(elem).delay(3000).fadeOut(1000, function () { - elem.remove(); - }); - }; + $(elem) + .delay(3000) + .fadeOut(1000, function () { + elem.remove(); + }); + }; - window.onData = (data) => { - if (data.action === 'inventoryNotification') { - ESX.inventoryNotification(data.add, data.item, data.count); - } - }; + window.onData = (data) => { + if (data.action === "inventoryNotification") { + ESX.inventoryNotification(data.add, data.item, data.count); + } + }; - window.onload = function (e) { - window.addEventListener('message', (event) => { - onData(event.data); - }); - }; + window.onload = function (e) { + window.addEventListener("message", (event) => { + onData(event.data); + }); + }; })(); diff --git a/[core]/es_extended/html/js/wrapper.js b/[core]/es_extended/html/js/wrapper.js index 0d2087093..92ee2785a 100644 --- a/[core]/es_extended/html/js/wrapper.js +++ b/[core]/es_extended/html/js/wrapper.js @@ -1,42 +1,35 @@ (() => { + let ESXWrapper = {}; + ESXWrapper.MessageSize = 1024; + ESXWrapper.messageId = 0; - let ESXWrapper = {}; - ESXWrapper.MessageSize = 1024; - ESXWrapper.messageId = 0; + window.SendMessage = function (namespace, type, msg) { + ESXWrapper.messageId = + ESXWrapper.messageId < 65535 ? ESXWrapper.messageId + 1 : 0; + const str = JSON.stringify(msg); - window.SendMessage = function (namespace, type, msg) { + for (let i = 0; i < str.length; i++) { + let count = 0; + let chunk = ""; - ESXWrapper.messageId = (ESXWrapper.messageId < 65535) ? ESXWrapper.messageId + 1 : 0; - const str = JSON.stringify(msg); + while (count < ESXWrapper.MessageSize && i < str.length) { + chunk += str[i]; - for (let i = 0; i < str.length; i++) { + count++; + i++; + } - let count = 0; - let chunk = ''; + i--; - while (count < ESXWrapper.MessageSize && i < str.length) { + const data = { + __type: type, + id: ESXWrapper.messageId, + chunk: chunk, + }; - chunk += str[i]; + if (i == str.length - 1) data.end = true; - count++; - i++; - } - - i--; - - const data = { - __type: type, - id: ESXWrapper.messageId, - chunk: chunk - } - - if (i == str.length - 1) - data.end = true; - - $.post('http://' + namespace + '/__chunk', JSON.stringify(data)); - - } - - } - -})() + $.post("http://" + namespace + "/__chunk", JSON.stringify(data)); + } + }; +})(); From 7cf0ed00c67f0b23e05ec63b5c5bcd87f9d694d6 Mon Sep 17 00:00:00 2001 From: MoskalykA <100430077+MoskalykA@users.noreply.github.com> Date: Mon, 6 Feb 2023 13:39:56 +0100 Subject: [PATCH 02/70] style(esx_context): run prettier --- [core]/esx_context/index.html | 899 +++++++++++++++++----------------- 1 file changed, 459 insertions(+), 440 deletions(-) diff --git a/[core]/esx_context/index.html b/[core]/esx_context/index.html index cba395b1a..676709631 100644 --- a/[core]/esx_context/index.html +++ b/[core]/esx_context/index.html @@ -1,443 +1,462 @@ - - - - - - - - - ESX Context HUD - - - - - - -
-
- -
- Unselectable Item - Testing, testing a description here. -
-
-
- -
- Disabled Item - Testing, testing a description here. -
-
-
- -
- Item - Testing, testing a description here. Generic words to force overflow. -
-
-
- - - - + + + + + + + + ESX Context HUD + + + + + +
+
+ +
+ Unselectable Item + Testing, testing a description here. +
+
+
+ +
+ Disabled Item + Testing, testing a description here. +
+
+
+ +
+ Item + Testing, testing a description here. Generic words to force + overflow. +
+
+
+ + + From ea6be461b4dbe952d930c2e913124f5eb1317dbf Mon Sep 17 00:00:00 2001 From: MoskalykA <100430077+MoskalykA@users.noreply.github.com> Date: Mon, 6 Feb 2023 13:40:26 +0100 Subject: [PATCH 03/70] style(esx_identity): run prettier --- [core]/esx_identity/html/css/style.css | 214 ++++++++++++------------- [core]/esx_identity/html/index.html | 154 +++++++++++++----- [core]/esx_identity/html/js/script.js | 32 ++-- 3 files changed, 240 insertions(+), 160 deletions(-) diff --git a/[core]/esx_identity/html/css/style.css b/[core]/esx_identity/html/css/style.css index 5915443e8..939753f73 100644 --- a/[core]/esx_identity/html/css/style.css +++ b/[core]/esx_identity/html/css/style.css @@ -1,152 +1,152 @@ -@import url('https://fonts.googleapis.com/css2?family=Oswald&display=swap'); +@import url("https://fonts.googleapis.com/css2?family=Oswald&display=swap"); body { - font-family: sans-serif; - overflow: hidden; - display: none; + font-family: sans-serif; + overflow: hidden; + display: none; } .dialog { - width: 332px; - opacity : 0.95; - position : absolute; - margin-left: auto; - margin-right: auto; - top : 30.0%; - padding: 20px; - left : 50%; /* à 50%/50% du parent référent */ - transform : translate(-50%); /* décalage de 50% de sa propre taille */ - background-color: #152029; - border-radius : 10px; - box-shadow: 0 -5px 3px -3px #21303d, 0 5px 3px -3px #21303d; - border:none; - margin:5px; - margin-bottom:20px; - color: #ffffff; + width: 332px; + opacity: 0.95; + position: absolute; + margin-left: auto; + margin-right: auto; + top: 30%; + padding: 20px; + left: 50%; /* à 50%/50% du parent référent */ + transform: translate(-50%); /* décalage de 50% de sa propre taille */ + background-color: #152029; + border-radius: 10px; + box-shadow: 0 -5px 3px -3px #21303d, 0 5px 3px -3px #21303d; + border: none; + margin: 5px; + margin-bottom: 20px; + color: #ffffff; } .title { - font-family: 'Oswald', sans-serif; - font-size: 22px; - text-align: center; - padding: 5px; - margin-bottom: 20px; + font-family: "Oswald", sans-serif; + font-size: 22px; + text-align: center; + padding: 5px; + margin-bottom: 20px; } input { - margin-bottom: 15px; - border: none; - border-bottom: 2px solid #58636c; - width: 100%; - outline: none; - padding: 10px; - padding-left:0; - font-family: 'Oswald', sans-serif; - color: #ffffff; - text-align:left; - background-color: #152029; -} - -::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */ - color: rgba(84,97,105,255); - font-family: 'Oswald', sans-serif; - font-weight: 200; - opacity: 1; /* Firefox */ + margin-bottom: 15px; + border: none; + border-bottom: 2px solid #58636c; + width: 100%; + outline: none; + padding: 10px; + padding-left: 0; + font-family: "Oswald", sans-serif; + color: #ffffff; + text-align: left; + background-color: #152029; +} + +::placeholder { + /* Chrome, Firefox, Opera, Safari 10.1+ */ + color: rgba(84, 97, 105, 255); + font-family: "Oswald", sans-serif; + font-weight: 200; + opacity: 1; /* Firefox */ } .radio-toolbar input[type="radio"] { - opacity: 0; - position: absolute; - width: 36%; + opacity: 0; + position: absolute; + width: 36%; } .radio-toolbar label { - display: inline-block; - margin-top: 5px; - background-color: rgba(15,15,15,0.9); - padding: 10px 20px; - font-family: 'Oswald', sans-serif; - font-weight: 500; - font-size: 16px; - color: #FFFFFF; - border: none; - border-radius: 5px; - width: 36%; + display: inline-block; + margin-top: 5px; + background-color: rgba(15, 15, 15, 0.9); + padding: 10px 20px; + font-family: "Oswald", sans-serif; + font-weight: 500; + font-size: 16px; + color: #ffffff; + border: none; + border-radius: 5px; + width: 36%; } .radio-toolbar input[type="radio"]:checked + label { - width: 36%; - background-color:rgba(15,15,15,0.9); - border: none; - border-bottom: 1px solid #93a3b6; - border-radius: 5px; - color: #ffffff; + width: 36%; + background-color: rgba(15, 15, 15, 0.9); + border: none; + border-bottom: 1px solid #93a3b6; + border-radius: 5px; + color: #ffffff; } .radio-toolbar input[type="radio"]:focus + label { - background-color:rgba(15,15,15,0.9); - border: none; - border-bottom: 1px solid #93a3b6; - border-radius: 5px; - color: #ffffff; + background-color: rgba(15, 15, 15, 0.9); + border: none; + border-bottom: 1px solid #93a3b6; + border-radius: 5px; + color: #ffffff; } .radio-toolbar label:hover { - background-color: rgba(28, 24, 24, 0.931); - width: 36%; - color: #ffffff; + background-color: rgba(28, 24, 24, 0.931); + width: 36%; + color: #ffffff; } button { - display: block; - margin-top: 35px; - /*padding: 10px;*/ - background-color: #4569c6; - outline: none; - border: 2px double rgba(40, 40, 40, 0.9); - color: #FFFFFF; - height: 30px; - width: 100%; + display: block; + margin-top: 35px; + /*padding: 10px;*/ + background-color: #4569c6; + outline: none; + border: 2px double rgba(40, 40, 40, 0.9); + color: #ffffff; + height: 30px; + width: 100%; } h1 { - display: block; - margin-top: 5px; - margin-right: 5px; - padding: 10px; - background-color: rgba(15,15,15,0.9); - color: #ffffff; - width: 93%; - text-align: center; + display: block; + margin-top: 5px; + margin-right: 5px; + padding: 10px; + background-color: rgba(15, 15, 15, 0.9); + color: #ffffff; + width: 93%; + text-align: center; } .range-wrap { - position: relative; - margin: 0 auto 3rem; + position: relative; + margin: 0 auto 3rem; } .range { - width: 100%; + width: 100%; } .bubble { - background: rgba(15,15,15,0.9); - color: #ffffff; - padding: 4px 12px; - position: absolute; - border-radius: 4px; - left: 50%; - transform: translateX(-50%); + background: rgba(15, 15, 15, 0.9); + color: #ffffff; + padding: 4px 12px; + position: absolute; + border-radius: 4px; + left: 50%; + transform: translateX(-50%); } - .bubble::after { - content: ""; - position: absolute; - width: 2px; - height: 2px; - background: rgba(15,15,15,0.9); - color: black; - top: -1px; - left: 50%; + content: ""; + position: absolute; + width: 2px; + height: 2px; + background: rgba(15, 15, 15, 0.9); + color: black; + top: -1px; + left: 50%; } diff --git a/[core]/esx_identity/html/index.html b/[core]/esx_identity/html/index.html index d9ca6d934..0e38d430d 100644 --- a/[core]/esx_identity/html/index.html +++ b/[core]/esx_identity/html/index.html @@ -1,45 +1,119 @@ - - - - + + + + - ESX Identity - + ESX Identity + - -
-
IDENTITY
-
-
First Name
-
-
Last Name
-
-
Date of Birth (MM/DD/YYYY)
-
-
Height
-
-
-
- - - - - -
-
- -
-
If the submit button doesn't work, please ensure that you've entered the fields correctly.
-
- - - + +
+
IDENTITY
+
+
+ First Name +
+
+
+ Last Name +
+
+
+ Date of Birth (MM/DD/YYYY) +
+
+
+ Height +
+
+
+
+ + + + + +
+
+ +
+
+ If the submit button doesn't work, please ensure that you've entered + the fields correctly. +
+
+ + + diff --git a/[core]/esx_identity/html/js/script.js b/[core]/esx_identity/html/js/script.js index 5364f8c82..e5ffea115 100644 --- a/[core]/esx_identity/html/js/script.js +++ b/[core]/esx_identity/html/js/script.js @@ -1,37 +1,43 @@ $(document).ready(function () { - $.post('http://esx_identity/ready', JSON.stringify({})); + $.post("http://esx_identity/ready", JSON.stringify({})); - window.addEventListener('message', function (event) { - if (event.data.type === 'enableui') { + window.addEventListener("message", function (event) { + if (event.data.type === "enableui") { event.data.enable ? $(document.body).show() : $(document.body).hide(); } }); - $('#register').submit(function (event) { + $("#register").submit(function (event) { event.preventDefault(); - const dofVal = $('#dateofbirth').val(); + const dofVal = $("#dateofbirth").val(); if (!dofVal) return; const dateCheck = new Date(dofVal); - const year = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(dateCheck); - const month = new Intl.DateTimeFormat('en', { month: '2-digit' }).format(dateCheck); - const day = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(dateCheck); + const year = new Intl.DateTimeFormat("en", { year: "numeric" }).format( + dateCheck + ); + const month = new Intl.DateTimeFormat("en", { month: "2-digit" }).format( + dateCheck + ); + const day = new Intl.DateTimeFormat("en", { day: "2-digit" }).format( + dateCheck + ); const formattedDate = `${day}/${month}/${year}`; $.post( - 'http://esx_identity/register', + "http://esx_identity/register", JSON.stringify({ - firstname: $('#firstname').val(), - lastname: $('#lastname').val(), + firstname: $("#firstname").val(), + lastname: $("#lastname").val(), dateofbirth: formattedDate, sex: $("input[type='radio'][name='sex']:checked").val(), - height: $('#height').val(), + height: $("#height").val(), }) ); - $('#register').trigger('reset'); + $("#register").trigger("reset"); }); }); From aa92104550de7e27fec20fa212d1282bab70088d Mon Sep 17 00:00:00 2001 From: MoskalykA <100430077+MoskalykA@users.noreply.github.com> Date: Mon, 6 Feb 2023 13:41:08 +0100 Subject: [PATCH 04/70] style(esx_menu_default): run prettier --- [core]/esx_menu_default/html/css/app.css | 4 +- [core]/esx_menu_default/html/js/app.js | 364 +++++++++++------------ 2 files changed, 184 insertions(+), 184 deletions(-) diff --git a/[core]/esx_menu_default/html/css/app.css b/[core]/esx_menu_default/html/css/app.css index a4312dfea..e7f07e2b8 100644 --- a/[core]/esx_menu_default/html/css/app.css +++ b/[core]/esx_menu_default/html/css/app.css @@ -1,11 +1,11 @@ -@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500;600&display=swap'); +@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@500;600&display=swap"); ::-webkit-scrollbar { display: none; } .menu { - font-family: 'Poppins', sans-serif; + font-family: "Poppins", sans-serif; min-width: 350px; color: #fff; position: absolute; diff --git a/[core]/esx_menu_default/html/js/app.js b/[core]/esx_menu_default/html/js/app.js index 2ce7a0f97..d53e3de83 100644 --- a/[core]/esx_menu_default/html/js/app.js +++ b/[core]/esx_menu_default/html/js/app.js @@ -1,378 +1,378 @@ -;(function () { +(function () { let MenuTpl = '' + - '' - window.ESX_MENU = {} - ESX_MENU.ResourceName = 'esx_menu_default' - ESX_MENU.opened = {} - ESX_MENU.focus = [] - ESX_MENU.pos = {} + "{{{label}}}{{#isSlider}} : <{{{sliderLabel}}}>{{/isSlider}}" + + "" + + "{{/elements}}" + + "" + + "" + + ""; + window.ESX_MENU = {}; + ESX_MENU.ResourceName = "esx_menu_default"; + ESX_MENU.opened = {}; + ESX_MENU.focus = []; + ESX_MENU.pos = {}; ESX_MENU.open = function (namespace, name, data) { - if (typeof ESX_MENU.opened[namespace] == 'undefined') { - ESX_MENU.opened[namespace] = {} + if (typeof ESX_MENU.opened[namespace] == "undefined") { + ESX_MENU.opened[namespace] = {}; } - if (typeof ESX_MENU.opened[namespace][name] != 'undefined') { - ESX_MENU.close(namespace, name) + if (typeof ESX_MENU.opened[namespace][name] != "undefined") { + ESX_MENU.close(namespace, name); } - if (typeof ESX_MENU.pos[namespace] == 'undefined') { - ESX_MENU.pos[namespace] = {} + if (typeof ESX_MENU.pos[namespace] == "undefined") { + ESX_MENU.pos[namespace] = {}; } for (let i = 0; i < data.elements.length; i++) { - if (typeof data.elements[i].type == 'undefined') { - data.elements[i].type = 'default' + if (typeof data.elements[i].type == "undefined") { + data.elements[i].type = "default"; } } - data._index = ESX_MENU.focus.length - data._namespace = namespace - data._name = name + data._index = ESX_MENU.focus.length; + data._namespace = namespace; + data._name = name; for (let i = 0; i < data.elements.length; i++) { - data.elements[i]._namespace = namespace - data.elements[i]._name = name + data.elements[i]._namespace = namespace; + data.elements[i]._name = name; } - ESX_MENU.opened[namespace][name] = data - ESX_MENU.pos[namespace][name] = 0 + ESX_MENU.opened[namespace][name] = data; + ESX_MENU.pos[namespace][name] = 0; for (let i = 0; i < data.elements.length; i++) { if (data.elements[i].selected) { - ESX_MENU.pos[namespace][name] = i + ESX_MENU.pos[namespace][name] = i; } else { - data.elements[i].selected = false + data.elements[i].selected = false; } } ESX_MENU.focus.push({ namespace: namespace, - name: name - }) + name: name, + }); - ESX_MENU.render() - $('#menu_' + namespace + '_' + name) - .find('.menu-item.selected')[0] - .scrollIntoView() - } + ESX_MENU.render(); + $("#menu_" + namespace + "_" + name) + .find(".menu-item.selected")[0] + .scrollIntoView(); + }; ESX_MENU.close = function (namespace, name) { - delete ESX_MENU.opened[namespace][name] + delete ESX_MENU.opened[namespace][name]; for (let i = 0; i < ESX_MENU.focus.length; i++) { if ( ESX_MENU.focus[i].namespace == namespace && ESX_MENU.focus[i].name == name ) { - ESX_MENU.focus.splice(i, 1) - break + ESX_MENU.focus.splice(i, 1); + break; } } - ESX_MENU.render() - } + ESX_MENU.render(); + }; ESX_MENU.render = function () { - let menuContainer = document.getElementById('menus') - let focused = ESX_MENU.getFocused() - menuContainer.innerHTML = '' - $(menuContainer).hide() + let menuContainer = document.getElementById("menus"); + let focused = ESX_MENU.getFocused(); + menuContainer.innerHTML = ""; + $(menuContainer).hide(); for (let namespace in ESX_MENU.opened) { for (let name in ESX_MENU.opened[namespace]) { - let menuData = ESX_MENU.opened[namespace][name] - let view = JSON.parse(JSON.stringify(menuData)) + let menuData = ESX_MENU.opened[namespace][name]; + let view = JSON.parse(JSON.stringify(menuData)); for (let i = 0; i < menuData.elements.length; i++) { - let element = view.elements[i] + let element = view.elements[i]; switch (element.type) { - case 'default': - break + case "default": + break; - case 'slider': { - element.isSlider = true + case "slider": { + element.isSlider = true; element.sliderLabel = - typeof element.options == 'undefined' + typeof element.options == "undefined" ? element.value - : element.options[element.value] + : element.options[element.value]; - break + break; } default: - break + break; } if (i == ESX_MENU.pos[namespace][name]) { - element.selected = true + element.selected = true; } } - let menu = $(Mustache.render(MenuTpl, view))[0] - $(menu).hide() - menuContainer.appendChild(menu) + let menu = $(Mustache.render(MenuTpl, view))[0]; + $(menu).hide(); + menuContainer.appendChild(menu); } } - if (typeof focused != 'undefined') { - $('#menu_' + focused.namespace + '_' + focused.name).show() + if (typeof focused != "undefined") { + $("#menu_" + focused.namespace + "_" + focused.name).show(); } - $(menuContainer).show() - } + $(menuContainer).show(); + }; ESX_MENU.submit = function (namespace, name, data) { $.post( - 'http://' + ESX_MENU.ResourceName + '/menu_submit', + "http://" + ESX_MENU.ResourceName + "/menu_submit", JSON.stringify({ _namespace: namespace, _name: name, current: data, - elements: ESX_MENU.opened[namespace][name].elements + elements: ESX_MENU.opened[namespace][name].elements, }) - ) - } + ); + }; ESX_MENU.cancel = function (namespace, name) { $.post( - 'http://' + ESX_MENU.ResourceName + '/menu_cancel', + "http://" + ESX_MENU.ResourceName + "/menu_cancel", JSON.stringify({ _namespace: namespace, - _name: name + _name: name, }) - ) - } + ); + }; ESX_MENU.change = function (namespace, name, data) { $.post( - 'http://' + ESX_MENU.ResourceName + '/menu_change', + "http://" + ESX_MENU.ResourceName + "/menu_change", JSON.stringify({ _namespace: namespace, _name: name, current: data, - elements: ESX_MENU.opened[namespace][name].elements + elements: ESX_MENU.opened[namespace][name].elements, }) - ) - } + ); + }; ESX_MENU.getFocused = function () { - return ESX_MENU.focus[ESX_MENU.focus.length - 1] - } + return ESX_MENU.focus[ESX_MENU.focus.length - 1]; + }; - window.onData = data => { + window.onData = (data) => { switch (data.action) { - case 'openMenu': { - ESX_MENU.open(data.namespace, data.name, data.data) - break + case "openMenu": { + ESX_MENU.open(data.namespace, data.name, data.data); + break; } - case 'closeMenu': { - ESX_MENU.close(data.namespace, data.name) - break + case "closeMenu": { + ESX_MENU.close(data.namespace, data.name); + break; } - case 'controlPressed': { + case "controlPressed": { switch (data.control) { - case 'ENTER': { - let focused = ESX_MENU.getFocused() + case "ENTER": { + let focused = ESX_MENU.getFocused(); - if (typeof focused != 'undefined') { - let menu = ESX_MENU.opened[focused.namespace][focused.name] - let pos = ESX_MENU.pos[focused.namespace][focused.name] - let elem = menu.elements[pos] + if (typeof focused != "undefined") { + let menu = ESX_MENU.opened[focused.namespace][focused.name]; + let pos = ESX_MENU.pos[focused.namespace][focused.name]; + let elem = menu.elements[pos]; if (menu.elements.length > 0) { - ESX_MENU.submit(focused.namespace, focused.name, elem) + ESX_MENU.submit(focused.namespace, focused.name, elem); } } - break + break; } - case 'BACKSPACE': { - let focused = ESX_MENU.getFocused() + case "BACKSPACE": { + let focused = ESX_MENU.getFocused(); - if (typeof focused != 'undefined') { - ESX_MENU.cancel(focused.namespace, focused.name) + if (typeof focused != "undefined") { + ESX_MENU.cancel(focused.namespace, focused.name); } - break + break; } - case 'TOP': { - let focused = ESX_MENU.getFocused() + case "TOP": { + let focused = ESX_MENU.getFocused(); - if (typeof focused != 'undefined') { - let menu = ESX_MENU.opened[focused.namespace][focused.name] - let pos = ESX_MENU.pos[focused.namespace][focused.name] + if (typeof focused != "undefined") { + let menu = ESX_MENU.opened[focused.namespace][focused.name]; + let pos = ESX_MENU.pos[focused.namespace][focused.name]; if (pos > 0) { - ESX_MENU.pos[focused.namespace][focused.name]-- + ESX_MENU.pos[focused.namespace][focused.name]--; } else { ESX_MENU.pos[focused.namespace][focused.name] = - menu.elements.length - 1 + menu.elements.length - 1; } let elem = - menu.elements[ESX_MENU.pos[focused.namespace][focused.name]] + menu.elements[ESX_MENU.pos[focused.namespace][focused.name]]; for (let i = 0; i < menu.elements.length; i++) { if (i == ESX_MENU.pos[focused.namespace][focused.name]) { - menu.elements[i].selected = true + menu.elements[i].selected = true; } else { - menu.elements[i].selected = false + menu.elements[i].selected = false; } } - ESX_MENU.change(focused.namespace, focused.name, elem) - ESX_MENU.render() + ESX_MENU.change(focused.namespace, focused.name, elem); + ESX_MENU.render(); - $('#menu_' + focused.namespace + '_' + focused.name) - .find('.menu-item.selected')[0] - .scrollIntoView() + $("#menu_" + focused.namespace + "_" + focused.name) + .find(".menu-item.selected")[0] + .scrollIntoView(); } - break + break; } - case 'DOWN': { - let focused = ESX_MENU.getFocused() + case "DOWN": { + let focused = ESX_MENU.getFocused(); - if (typeof focused != 'undefined') { - let menu = ESX_MENU.opened[focused.namespace][focused.name] - let pos = ESX_MENU.pos[focused.namespace][focused.name] - let length = menu.elements.length + if (typeof focused != "undefined") { + let menu = ESX_MENU.opened[focused.namespace][focused.name]; + let pos = ESX_MENU.pos[focused.namespace][focused.name]; + let length = menu.elements.length; if (pos < length - 1) { - ESX_MENU.pos[focused.namespace][focused.name]++ + ESX_MENU.pos[focused.namespace][focused.name]++; } else { - ESX_MENU.pos[focused.namespace][focused.name] = 0 + ESX_MENU.pos[focused.namespace][focused.name] = 0; } let elem = - menu.elements[ESX_MENU.pos[focused.namespace][focused.name]] + menu.elements[ESX_MENU.pos[focused.namespace][focused.name]]; for (let i = 0; i < menu.elements.length; i++) { if (i == ESX_MENU.pos[focused.namespace][focused.name]) { - menu.elements[i].selected = true + menu.elements[i].selected = true; } else { - menu.elements[i].selected = false + menu.elements[i].selected = false; } } - ESX_MENU.change(focused.namespace, focused.name, elem) - ESX_MENU.render() + ESX_MENU.change(focused.namespace, focused.name, elem); + ESX_MENU.render(); - $('#menu_' + focused.namespace + '_' + focused.name) - .find('.menu-item.selected')[0] - .scrollIntoView() + $("#menu_" + focused.namespace + "_" + focused.name) + .find(".menu-item.selected")[0] + .scrollIntoView(); } - break + break; } - case 'LEFT': { - let focused = ESX_MENU.getFocused() + case "LEFT": { + let focused = ESX_MENU.getFocused(); - if (typeof focused != 'undefined') { - let menu = ESX_MENU.opened[focused.namespace][focused.name] - let pos = ESX_MENU.pos[focused.namespace][focused.name] - let elem = menu.elements[pos] + if (typeof focused != "undefined") { + let menu = ESX_MENU.opened[focused.namespace][focused.name]; + let pos = ESX_MENU.pos[focused.namespace][focused.name]; + let elem = menu.elements[pos]; switch (elem.type) { - case 'default': - break + case "default": + break; - case 'slider': { - let min = typeof elem.min == 'undefined' ? 0 : elem.min + case "slider": { + let min = typeof elem.min == "undefined" ? 0 : elem.min; if (elem.value > min) { - elem.value-- - ESX_MENU.change(focused.namespace, focused.name, elem) + elem.value--; + ESX_MENU.change(focused.namespace, focused.name, elem); } - ESX_MENU.render() - break + ESX_MENU.render(); + break; } default: - break + break; } - $('#menu_' + focused.namespace + '_' + focused.name) - .find('.menu-item.selected')[0] - .scrollIntoView() + $("#menu_" + focused.namespace + "_" + focused.name) + .find(".menu-item.selected")[0] + .scrollIntoView(); } - break + break; } - case 'RIGHT': { - let focused = ESX_MENU.getFocused() + case "RIGHT": { + let focused = ESX_MENU.getFocused(); - if (typeof focused != 'undefined') { - let menu = ESX_MENU.opened[focused.namespace][focused.name] - let pos = ESX_MENU.pos[focused.namespace][focused.name] - let elem = menu.elements[pos] + if (typeof focused != "undefined") { + let menu = ESX_MENU.opened[focused.namespace][focused.name]; + let pos = ESX_MENU.pos[focused.namespace][focused.name]; + let elem = menu.elements[pos]; switch (elem.type) { - case 'default': - break + case "default": + break; - case 'slider': { + case "slider": { if ( - typeof elem.options != 'undefined' && + typeof elem.options != "undefined" && elem.value < elem.options.length - 1 ) { - elem.value++ - ESX_MENU.change(focused.namespace, focused.name, elem) + elem.value++; + ESX_MENU.change(focused.namespace, focused.name, elem); } - if (typeof elem.max != 'undefined' && elem.value < elem.max) { - elem.value++ - ESX_MENU.change(focused.namespace, focused.name, elem) + if (typeof elem.max != "undefined" && elem.value < elem.max) { + elem.value++; + ESX_MENU.change(focused.namespace, focused.name, elem); } - ESX_MENU.render() - break + ESX_MENU.render(); + break; } default: - break + break; } - $('#menu_' + focused.namespace + '_' + focused.name) - .find('.menu-item.selected')[0] - .scrollIntoView() + $("#menu_" + focused.namespace + "_" + focused.name) + .find(".menu-item.selected")[0] + .scrollIntoView(); } - break + break; } default: - break + break; } - break + break; } } - } + }; window.onload = function (e) { - window.addEventListener('message', event => { - onData(event.data) - }) - } -})() + window.addEventListener("message", (event) => { + onData(event.data); + }); + }; +})(); From 5b81c1b737eba451c1c672aa6a45a4225c6a0dc6 Mon Sep 17 00:00:00 2001 From: MoskalykA <100430077+MoskalykA@users.noreply.github.com> Date: Mon, 6 Feb 2023 13:41:31 +0100 Subject: [PATCH 05/70] style(esx_menu_dialog): run prettier --- [core]/esx_menu_dialog/html/css/app.css | 100 +++---- [core]/esx_menu_dialog/html/js/app.js | 350 ++++++++++++------------ [core]/esx_menu_dialog/html/ui.html | 37 ++- 3 files changed, 254 insertions(+), 233 deletions(-) diff --git a/[core]/esx_menu_dialog/html/css/app.css b/[core]/esx_menu_dialog/html/css/app.css index db52551b6..c2f590c4c 100644 --- a/[core]/esx_menu_dialog/html/css/app.css +++ b/[core]/esx_menu_dialog/html/css/app.css @@ -1,89 +1,89 @@ - -@import url('https://fonts.googleapis.com/css?family=Montserrat&display=swap'); +@import url("https://fonts.googleapis.com/css?family=Montserrat&display=swap"); #controls { - font-family: montserrat; - font-size: 3em; - color: #FFF; - position: absolute; - bottom: 40; - right: 40; + font-family: montserrat; + font-size: 3em; + color: #fff; + position: absolute; + bottom: 40; + right: 40; } .controls { - display: none; + display: none; } .dialog { - font-family: montserrat; - background: rgba(33, 33, 33, 0.8); + font-family: montserrat; + background: rgba(33, 33, 33, 0.8); color: #fff; - position: absolute; - border-top-left-radius: 5px; - border-top-right-radius: 5px; - overflow: hidden; - top: 50%; - left: 50%; - width: 600px; - height: 152px; - transform: translate(-50%, -50%); + position: absolute; + border-top-left-radius: 5px; + border-top-right-radius: 5px; + overflow: hidden; + top: 50%; + left: 50%; + width: 600px; + height: 152px; + transform: translate(-50%, -50%); } .head { - display: flex; - flex-basis: 100%; - align-items: center; - color: #fff; + display: flex; + flex-basis: 100%; + align-items: center; + color: #fff; } .dialog.big { - height: 200px; + height: 200px; } .dialog .head { - background: rgba(25, 25, 25, 0.9); - text-align: center; - height: 40px; + background: rgba(25, 25, 25, 0.9); + text-align: center; + height: 40px; } .dialog .head span::before { - content: ""; - display: inline-block; - height: 100%; - vertical-align: middle; + content: ""; + display: inline-block; + height: 100%; + vertical-align: middle; } .dialog input[type="text"] { - width: 60%; - height: 32px; + width: 60%; + height: 32px; outline: 0; background: none; text-align: center; margin-top: 26px; margin-left: 125px; - font-size: large; + font-size: large; transition: all 0.2s ease-in-out; color: white; border: 0.5px solid #ffffff3b; border-radius: 0px; } -.dialog input[type="text"]:active, .dialog input[type="text"]:hover { +.dialog input[type="text"]:active, +.dialog input[type="text"]:hover { color: white; } .dialog textarea { - width: 100%; - height: 128px; + width: 100%; + height: 128px; } .dialog button[name="submit"] { - width: 17.6%; - height: 32px; + width: 17.6%; + height: 32px; margin-left: 160px; font-weight: 300; color: rgb(37, 34, 53); - border-radius: 10px; + border-radius: 10px; text-transform: uppercase; background: rgb(50, 79, 208); outline: 0; @@ -93,17 +93,17 @@ .dialog button { z-index: 9999; - transform: translate(-0%, 50%); + transform: translate(-0%, 50%); } .dialog button[name="cancel"] { - width: 17.6%; - height: 32px; + width: 17.6%; + height: 32px; margin-left: 60px; border: none; text-transform: uppercase; font-weight: 200; - border-radius: 10px; + border-radius: 10px; color: rgb(53, 34, 34); outline: 0; background: #c74545; @@ -124,9 +124,9 @@ .head::before, .head::after { - content: ""; - flex-grow: 1; - background: #00e1ff; - height: 2px; - margin: 0px 3px; + content: ""; + flex-grow: 1; + background: #00e1ff; + height: 2px; + margin: 0px 3px; } diff --git a/[core]/esx_menu_dialog/html/js/app.js b/[core]/esx_menu_dialog/html/js/app.js index 85a172b65..5186bcf70 100644 --- a/[core]/esx_menu_dialog/html/js/app.js +++ b/[core]/esx_menu_dialog/html/js/app.js @@ -1,170 +1,184 @@ (function () { - let MenuTpl = - '