Skip to content

Commit

Permalink
or-and support
Browse files Browse the repository at this point in the history
  • Loading branch information
Algoinde committed Mar 27, 2022
1 parent ae56ce9 commit 39a3283
Showing 1 changed file with 40 additions and 5 deletions.
45 changes: 40 additions & 5 deletions frontend/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ function unlerp(min, max, value) {
async function pleem(id) {
let frac = unlerp(3, 4000, +id);
frac = Math.min(Math.floor(frac * 70), 70);
osc.frequency.value = [174.61307100227927, 184.99610451960257, 195.99654533869912, 207.6511064082122, 219.99868374231448, 233.08048623253953, 246.94017317862662, 261.6239999973751, 277.18097259579804, 293.66301092378137, 311.12512225209025, 329.6255847540217, 349.22614200339063, 369.99220903796777, 391.9930906760873, 415.30221281503555, 439.9973674831575, 466.1609724635201, 493.8803463556016, 523.2479999930003, 554.3619451897422, 587.3260218455986, 622.2502445020995, 659.2511695058387, 698.4522840044455, 739.9844180734609, 783.9861813495528, 830.6044256272934, 879.9947349633721, 932.3219449239223, 987.7606927078998, 1046.4959999825007, 1108.7238903757761, 1174.6520436872686, 1244.5004890000369, 1318.5023390072677, 1396.904568004219, 1479.9688361419721, 1567.9723626938617, 1661.2088512490309, 1759.989469920858, 1864.6438898416084, 1975.5213854091928, 2092.991999958002, 2217.4477807441367, 2349.3040873666805, 2489.00097799175, 2637.004678005717, 2793.8091359990954, 2959.937672274046, 3135.944725377236, 3322.417702486951, 3519.9789398299445, 3729.2877796707453, 3951.0427708051725, 4185.983999902005, 4434.895561473442, 4698.608174717648, 4978.001955966852, 5274.009355993795, 5587.618271979502, 5919.875344528292, 6271.889450733495, 6644.835404951677, 7039.957879636343, 7458.575559316544, 7902.085541583915, 8371.967999776009, 8869.791122917219, 9397.216349403865, 9956.003911900405 ][frac];
osc.frequency.value = [174.61307100227927, 184.99610451960257, 195.99654533869912, 207.6511064082122, 219.99868374231448, 233.08048623253953, 246.94017317862662, 261.6239999973751, 277.18097259579804, 293.66301092378137, 311.12512225209025, 329.6255847540217, 349.22614200339063, 369.99220903796777, 391.9930906760873, 415.30221281503555, 439.9973674831575, 466.1609724635201, 493.8803463556016, 523.2479999930003, 554.3619451897422, 587.3260218455986, 622.2502445020995, 659.2511695058387, 698.4522840044455, 739.9844180734609, 783.9861813495528, 830.6044256272934, 879.9947349633721, 932.3219449239223, 987.7606927078998, 1046.4959999825007, 1108.7238903757761, 1174.6520436872686, 1244.5004890000369, 1318.5023390072677, 1396.904568004219, 1479.9688361419721, 1567.9723626938617, 1661.2088512490309, 1759.989469920858, 1864.6438898416084, 1975.5213854091928, 2092.991999958002, 2217.4477807441367, 2349.3040873666805, 2489.00097799175, 2637.004678005717, 2793.8091359990954, 2959.937672274046, 3135.944725377236, 3322.417702486951, 3519.9789398299445, 3729.2877796707453, 3951.0427708051725, 4185.983999902005, 4434.895561473442, 4698.608174717648, 4978.001955966852, 5274.009355993795, 5587.618271979502, 5919.875344528292, 6271.889450733495, 6644.835404951677, 7039.957879636343, 7458.575559316544, 7902.085541583915, 8371.967999776009, 8869.791122917219, 9397.216349403865, 9956.003911900405 ][frac] || 440;
await delay(1);
osc.connect(gain);
await delay(40);
osc.disconnect(gain);
try{
osc.disconnect(gain);
}catch(e){}
}
Expand Down Expand Up @@ -249,7 +251,8 @@ let stick;
function packetFilter(packet) {
if(!filter.length && !JSONfilter.length) return false;
const and = filter.length && JSONfilter.length;
let and = filter.length && JSONfilter.length;
if(!orand) and = false;
let text, json;
if(filter.length && packet.protoName.includes && packet.protoName.toLowerCase().includes(filter.toLowerCase())) text = true;
if(filter.length && ('' + packet.packetID).includes(filter)) text = true;
Expand All @@ -260,7 +263,7 @@ function packetFilter(packet) {
return false;
}
let FilteredPackets = [];
$: if(filter.length || JSONfilter.length) {
$: if(filter.length || JSONfilter.length || orand) {
tick().then(() => {
FilteredPackets = Packets.filter(packetFilter, filter, JSONfilter);
setTimeout(() => {
Expand Down Expand Up @@ -295,7 +298,7 @@ onMount(async () => {
window.q = (id) => {
new WSMessage('FindIdReq', {id: id}).send();
}
let node, details, filterTableHost;
let node, details, filterTableHost, orand = true;
</script>

<svelte:head>
Expand Down Expand Up @@ -333,6 +336,13 @@ let node, details, filterTableHost;
<div class="main-host">
<div class="filter-host">
<input type="text" bind:value={filter} placeholder=" PACKET" />
<div class="orand" on:click={() => orand = !orand}>
{#if orand}
<span and>AND</span>
{:else}
<span or>OR</span>
{/if}
</div>
<input type="text" bind:value={JSONfilter} placeholder=" JSON" />
</div>
<div class="results-host" class:open={filter.length || JSONfilter.length}>
Expand Down Expand Up @@ -555,5 +565,30 @@ input[type="text"] {
.results-host :global(.tr > div) {
background: transparent !important;
}
.orand {
font-size: 0.8em;
box-sizing: border-box;
padding: 3px;
background: rgba(0,0,0,0.7);
border-bottom: 1px solid rgba(255,255,255,0.2);
cursor: pointer;
}
.orand:hover {
background: rgba(0,0,0,0.2);
}
.orand span {
background: #1AA1E7;
color: white;
font-weight: 700;
padding: 0.3em 0.2em;
display: block;
border-radius: 2px;
min-width: 2.2em;
text-align: center;
user-select: none;
}
.orand span[or] {
margin-top: 1.5em;
}
</style>

0 comments on commit 39a3283

Please sign in to comment.