From 21e87610b6cf011a2871b0f3d0b5dc29f030de1d Mon Sep 17 00:00:00 2001 From: MoskalykA <100430077+MoskalykA@users.noreply.github.com> Date: Mon, 6 Feb 2023 13:41:51 +0100 Subject: [PATCH] style(esx_menu_list): run prettier --- [core]/esx_menu_list/html/css/app.css | 65 +++-- [core]/esx_menu_list/html/js/app.js | 331 ++++++++++++++------------ [core]/esx_menu_list/html/ui.html | 24 +- 3 files changed, 217 insertions(+), 203 deletions(-) diff --git a/[core]/esx_menu_list/html/css/app.css b/[core]/esx_menu_list/html/css/app.css index fc2f712f..1e7bc9ce 100644 --- a/[core]/esx_menu_list/html/css/app.css +++ b/[core]/esx_menu_list/html/css/app.css @@ -1,56 +1,55 @@ @font-face { - font-family: bankgothic; - src: url('../fonts/bankgothic.ttf'); + font-family: bankgothic; + src: url("../fonts/bankgothic.ttf"); } @font-face { - font-family: pcdown; - src: url('../fonts/pdown.ttf'); + font-family: pcdown; + src: url("../fonts/pdown.ttf"); } .menu { - font-family: bankgothic; - position: absolute; - left: 50%; - top: 40%; - transform: translate(-50%, -50%); - overflow-y: auto; - max-height: 90%; + font-family: bankgothic; + position: absolute; + left: 50%; + top: 40%; + transform: translate(-50%, -50%); + overflow-y: auto; + max-height: 90%; } .menu button { - font-family: bankgothic; + font-family: bankgothic; } -.menu>table { - border-collapse: separate; - border-spacing: 0 5px; - min-width: 400px; - background: rgba(33, 33, 33, 0.0); +.menu > table { + border-collapse: separate; + border-spacing: 0 5px; + min-width: 400px; + background: rgba(33, 33, 33, 0); } -.menu>table>thead { - background: rgba(10, 10, 10, 0.9); - text-align: center; - height: 20px; - line-height: 20px; - margin-bottom: 20px; - color: #fff; +.menu > table > thead { + background: rgba(10, 10, 10, 0.9); + text-align: center; + height: 20px; + line-height: 20px; + margin-bottom: 20px; + color: #fff; } .menu td { - - text-align: center; - padding: 8px; - margin: 20px; + text-align: center; + padding: 8px; + margin: 20px; } .menu tbody tr:nth-child(even) { - color: #fff; - background: rgba(40, 40, 40, 0.8); + color: #fff; + background: rgba(40, 40, 40, 0.8); } .menu tbody tr:nth-child(odd) { - color: #fff; - background: rgba(40, 40, 40, 0.8); -} \ No newline at end of file + color: #fff; + background: rgba(40, 40, 40, 0.8); +} diff --git a/[core]/esx_menu_list/html/js/app.js b/[core]/esx_menu_list/html/js/app.js index fd113858..72e0e3ee 100644 --- a/[core]/esx_menu_list/html/js/app.js +++ b/[core]/esx_menu_list/html/js/app.js @@ -1,192 +1,209 @@ -(function(){ +(function () { + let MenuTpl = + '"; + window.ESX_MENU = {}; + ESX_MENU.ResourceName = "esx_menu_list"; + ESX_MENU.opened = {}; + ESX_MENU.focus = []; + ESX_MENU.data = {}; - let MenuTpl = - '' - ; + ESX_MENU.open = function (namespace, name, data) { + if (typeof ESX_MENU.opened[namespace] == "undefined") { + ESX_MENU.opened[namespace] = {}; + } - window.ESX_MENU = {}; - ESX_MENU.ResourceName = 'esx_menu_list'; - ESX_MENU.opened = {}; - ESX_MENU.focus = []; - ESX_MENU.data = {}; + if (typeof ESX_MENU.opened[namespace][name] != "undefined") { + ESX_MENU.close(namespace, name); + } - ESX_MENU.open = function(namespace, name, data) { + data._namespace = namespace; + data._name = name; - if (typeof ESX_MENU.opened[namespace] == 'undefined') { - ESX_MENU.opened[namespace] = {}; - } + ESX_MENU.opened[namespace][name] = data; - if (typeof ESX_MENU.opened[namespace][name] != 'undefined') { - ESX_MENU.close(namespace, name); - } + ESX_MENU.focus.push({ + namespace: namespace, + name: name, + }); - data._namespace = namespace; - data._name = name; + ESX_MENU.render(); + }; - ESX_MENU.opened[namespace][name] = data; + ESX_MENU.close = function (namespace, name) { + delete ESX_MENU.opened[namespace][name]; - ESX_MENU.focus.push({ - namespace: namespace, - name : name - }); - - ESX_MENU.render(); - }; + 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.close = function(namespace, name) { - delete ESX_MENU.opened[namespace][name]; + ESX_MENU.render(); + }; - for (let i=0; i' + + matches[k][1] + + "" + ); + } - view.rows.push({cols: []}); + view.rows[i].cols.push({ data: data, content: col }); + } + } - for (let j=0; j' + matches[k][1] + ''); - } + menuContainer.appendChild(menu[0]); + } + } - view.rows[i].cols.push({data: data, content: col}); - } - } + if (typeof focused != "undefined") { + $("#menu_" + focused.namespace + "_" + focused.name).show(); + } - let menu = $(Mustache.render(MenuTpl, view)); + $(menuContainer).show(); + }; - menu.find('button[data-namespace][data-name]').click(function() { - ESX_MENU.data[$(this).data('namespace')][$(this).data('name')][parseInt($(this).data('id'))].currentRow = parseInt($(this).data('id')) + 1; - ESX_MENU.submit($(this).data('namespace'), $(this).data('name'), { - data : ESX_MENU.data[$(this).data('namespace')][$(this).data('name')][parseInt($(this).data('id'))], - value: $(this).data('value') - }); - }); + ESX_MENU.submit = function (namespace, name, data) { + $.post( + "http://" + ESX_MENU.ResourceName + "/menu_submit", + JSON.stringify({ + _namespace: namespace, + _name: name, + data: data.data, + value: data.value, + }) + ); + }; - menu.hide(); + ESX_MENU.cancel = function (namespace, name) { + $.post( + "http://" + ESX_MENU.ResourceName + "/menu_cancel", + JSON.stringify({ + _namespace: namespace, + _name: name, + }) + ); + }; - menuContainer.appendChild(menu[0]); - } - } + ESX_MENU.getFocused = function () { + return ESX_MENU.focus[ESX_MENU.focus.length - 1]; + }; - if (typeof focused != 'undefined') { - $('#menu_' + focused.namespace + '_' + focused.name).show(); - } + window.onData = (data) => { + switch (data.action) { + case "openMenu": { + ESX_MENU.open(data.namespace, data.name, data.data); + break; + } - $(menuContainer).show(); - }; + case "closeMenu": { + ESX_MENU.close(data.namespace, data.name); + break; + } + } + }; - ESX_MENU.submit = function(namespace, name, data){ - $.post('http://' + ESX_MENU.ResourceName + '/menu_submit', JSON.stringify({ - _namespace: namespace, - _name : name, - data : data.data, - value : data.value - })); - }; + window.onload = function (e) { + window.addEventListener("message", (event) => { + onData(event.data); + }); + }; - ESX_MENU.cancel = function(namespace, name){ - $.post('http://' + ESX_MENU.ResourceName + '/menu_cancel', JSON.stringify({ - _namespace: namespace, - _name : name - })); - }; - - ESX_MENU.getFocused = function(){ - return ESX_MENU.focus[ESX_MENU.focus.length - 1]; - }; - - window.onData = (data) => { - switch(data.action){ - case 'openMenu' : { - ESX_MENU.open(data.namespace, data.name, data.data); - break; - } - - case 'closeMenu' : { - ESX_MENU.close(data.namespace, data.name); - break; - } - } - }; - - window.onload = function(e){ - window.addEventListener('message', (event) => { - onData(event.data); - }); - }; - - document.onkeyup = function(data) { - if(data.which == 27) { - let focused = ESX_MENU.getFocused(); - ESX_MENU.cancel(focused.namespace, focused.name); - } - }; - -})(); \ No newline at end of file + document.onkeyup = function (data) { + if (data.which == 27) { + let focused = ESX_MENU.getFocused(); + ESX_MENU.cancel(focused.namespace, focused.name); + } + }; +})(); diff --git a/[core]/esx_menu_list/html/ui.html b/[core]/esx_menu_list/html/ui.html index af5fd03b..62f6bda9 100644 --- a/[core]/esx_menu_list/html/ui.html +++ b/[core]/esx_menu_list/html/ui.html @@ -1,16 +1,14 @@ + + + - - - + + - - - - - - - - - - \ No newline at end of file + + + + + +