diff --git a/README.md b/README.md index 266d5d5..b6ca6a7 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Yomea is currently in development state, at this point no builds are shipped by ## Steps to build this repository -> [!NOTE] +> [!IMPORTANT] > Make sure you have installed `git` and `curl`. **1.** Firstly clone Yomea repository onto your machine. diff --git a/rust-src/components/script.js b/rust-src/components/script.js index ff7d0b9..3a08b7b 100644 --- a/rust-src/components/script.js +++ b/rust-src/components/script.js @@ -1,5 +1,34 @@ +const { invoke } = window.__TAURI__.core; +const { listen } = window.__TAURI__.event; + +const title = document.getElementById('tab-title'); +const searchbar = document.getElementById('searchbar'); + document.addEventListener('DOMContentLoaded', () => { - window.__TAURI__.core.invoke('get_title').then(title => { - document.getElementById('tab-title').innerText = title; + invoke('get_title').then(t => { + title.innerText = t; + if(t) title.style.display = null; }); + + searchbar.addEventListener('keydown', ({ target, key }) => { + const url = target.value.trim(); + if(key.toUpperCase() == 'ENTER' && url != 'about:blank') invoke('load_url', { url }); + }); + + document.querySelector('#controls>svg').addEventListener('click', () => invoke('close')); + + window.addEventListener('contextmenu', event => event.preventDefault()); +}); + +listen('title_change', ({ payload }) => { + if(payload) { + title.innerText = payload; + title.style.display = null; + } + else title.style.display = 'none'; +}); + +listen('url_change', ({ payload }) => { + const url = payload.endsWith('/') ? payload.substring(0, payload.length - 1) : payload; + if(payload && url != 'about:blank') searchbar.value = url; }); \ No newline at end of file diff --git a/rust-src/components/styles.css b/rust-src/components/styles.css index 8134851..2d37e4b 100644 --- a/rust-src/components/styles.css +++ b/rust-src/components/styles.css @@ -21,14 +21,20 @@ body::before { } nav { - padding: .75rem 1.25rem; + /* padding: .75rem 1.25rem; */ + padding: .75rem 1.25rem .75rem .75rem; display: grid; grid-template-columns: repeat(3, 1fr); align-items: center; height: -webkit-fill-available; + -webkit-app-region: drag; } -nav > #tabs, nav > #controls { +nav svg, nav > #searchbar, nav > * > div { + -webkit-app-region: no-drag; +} + +nav > #tabs, nav > #controls { height: -webkit-fill-available; display: flex; gap: .5rem; diff --git a/rust-src/components/topbar.html b/rust-src/components/topbar.html index 16ff67d..aeb458a 100644 --- a/rust-src/components/topbar.html +++ b/rust-src/components/topbar.html @@ -2,22 +2,25 @@ - + +