From f848c310705a8ab71900d5a82933286338303fd3 Mon Sep 17 00:00:00 2001 From: makio135 Date: Mon, 8 Apr 2019 17:25:43 +0200 Subject: [PATCH] =?UTF-8?q?host=20/path=20shortcuts,=20supports=20complex?= =?UTF-8?q?=20paths=20=F0=9F=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++++ desktop/src/scripts/helpers.js | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8c0c61d..751598f 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,10 @@ You can also build it for your system using `npm run build_osx`, `npm run build_ - send to **multiple hosts** at once: `;2a#foo` in ORCΛ sends `/foo` to the third and tenth hosts in Λioi +- **host /path shortcuts**: (supports **complex paths**) + `;#1;2f` in ORCΛ sends `0.2` to the second host in Λioi with its path defined in Λioi + `;#a;yo;135` in ORCΛ sends `yo 135` to the tenth host in Λioi with its path defined in Λioi + Λioi does not support: - complex paths (eg. `/foo/bar`) - negative values diff --git a/desktop/src/scripts/helpers.js b/desktop/src/scripts/helpers.js index d860269..681cee3 100644 --- a/desktop/src/scripts/helpers.js +++ b/desktop/src/scripts/helpers.js @@ -52,9 +52,14 @@ const parseOrcaMsg = data => { let indexes = [0] let path = clientPath - if(clientPath.includes('#')) { + + if(clientPath.startsWith('#')) { + indexes = [parseInt(clientPath[1], 36)] + path = document.querySelector(`p.msg[data-index="${indexes[0]}"]`).innerText.split(' ')[0].substr(1) + } + else if(clientPath.includes('#')) { const [clientArg, pathArg] = clientPath.split('#') - indexes = clientArg.split('').map(d=>parseInt(d,36)) + indexes = clientArg.split('').map(d=>parseInt(d, 36)) path = pathArg }