Vanessa 2023-03-19 12:00:52 +08:00
parent 01e86e2732
commit bbca23b47d

View file

@ -154,38 +154,38 @@
<img id="icon"> <img id="icon">
<div class="drag"></div> <div class="drag"></div>
<script> <script>
const getSearch = (key) => { const getSearch = (key) => {
if (window.location.search.indexOf('?') === -1) { if (window.location.search.indexOf('?') === -1) {
return '' return ''
}
let value = ''
const data = window.location.search.split('?')[1].split('&')
data.find(item => {
const keyValue = item.split('=')
if (keyValue[0] === key) {
value = keyValue[1]
return true
}
})
return value
} }
let value = ''
const data = window.location.search.split('?')[1].split('&') document.querySelector('#icon').src = decodeURIComponent(`${getSearch('icon')}`)
data.find(item => {
const keyValue = item.split('=') document.getElementById('title').innerHTML = decodeURIComponent(getSearch('title'))
if (keyValue[0] === key) { document.getElementById('content').innerHTML = decodeURIComponent(getSearch('content'))
value = keyValue[1] document.querySelectorAll('.version').forEach(item => {
return true item.textContent = `🔖 v${getSearch('v')}`
}
}) })
return value
}
document.querySelector('#icon').src = decodeURIComponent(`${getSearch('icon')}`) document.getElementById('close').addEventListener('click', () => {
const {getCurrentWindow} = require('@electron/remote')
document.getElementById('title').innerHTML = decodeURIComponent(getSearch('title')) getCurrentWindow().destroy()
document.getElementById('content').innerHTML = decodeURIComponent(getSearch('content')) })
document.querySelectorAll('.version').forEach(item => { document.getElementById('min').addEventListener('click', () => {
item.textContent = `🔖 v${getSearch('v')}` const {getCurrentWindow} = require('@electron/remote')
}) getCurrentWindow().minimize()
})
document.getElementById('close').addEventListener('click', () => {
const {ipcRenderer} = require('electron')
ipcRenderer.send('siyuan-first-quit')
})
document.getElementById('min').addEventListener('click', () => {
const {getCurrentWindow} = require('@electron/remote')
getCurrentWindow().minimize()
})
</script> </script>
</body> </body>
</html> </html>