mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-08-14 13:11:48 +08:00
full port changing support
This commit is contained in:
parent
4fc95aad22
commit
30aeba0794
@ -164,9 +164,12 @@ async function setBackgroundImage() {
|
|||||||
*/
|
*/
|
||||||
async function handleFavoriteInput() {
|
async function handleFavoriteInput() {
|
||||||
const ip = document.querySelector('#ip').value
|
const ip = document.querySelector('#ip').value
|
||||||
|
const port = document.querySelector('#port').value
|
||||||
const ipArr = await getFavIps()
|
const ipArr = await getFavIps()
|
||||||
|
|
||||||
if (!ip || !ipArr.includes(ip)) {
|
const addr = `${ip}:${port}`
|
||||||
|
|
||||||
|
if (!ip || !ipArr.includes(addr)) {
|
||||||
document.querySelector('#star').src = 'icons/star_empty.svg'
|
document.querySelector('#star').src = 'icons/star_empty.svg'
|
||||||
} else {
|
} else {
|
||||||
document.querySelector('#star').src = 'icons/star_filled.svg'
|
document.querySelector('#star').src = 'icons/star_filled.svg'
|
||||||
@ -180,13 +183,18 @@ async function handleFavoriteInput() {
|
|||||||
*/
|
*/
|
||||||
async function setIp(ip) {
|
async function setIp(ip) {
|
||||||
const ipInput = document.querySelector('#ip')
|
const ipInput = document.querySelector('#ip')
|
||||||
|
const portInput = document.querySelector('#port')
|
||||||
|
|
||||||
|
const parseIp = ip.split(':')[0]
|
||||||
|
const parsePort = ip.split(':')[1]
|
||||||
|
|
||||||
// Set star
|
// Set star
|
||||||
if (ip) {
|
if (ip) {
|
||||||
document.querySelector('#star').src = 'icons/star_filled.svg'
|
document.querySelector('#star').src = 'icons/star_filled.svg'
|
||||||
}
|
}
|
||||||
|
|
||||||
ipInput.value = ip
|
ipInput.value = parseIp
|
||||||
|
portInput.value = parsePort
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,8 +77,11 @@ async function handleLanguageChange(elm) {
|
|||||||
*/
|
*/
|
||||||
async function setFavorite() {
|
async function setFavorite() {
|
||||||
const ip = document.querySelector('#ip').value
|
const ip = document.querySelector('#ip').value
|
||||||
|
const port = document.querySelector('#port').value
|
||||||
const ipArr = await getFavIps()
|
const ipArr = await getFavIps()
|
||||||
|
|
||||||
|
const addr = `${ip}:${port}`
|
||||||
|
|
||||||
// Set star icon
|
// Set star icon
|
||||||
const star = document.querySelector('#star')
|
const star = document.querySelector('#star')
|
||||||
|
|
||||||
@ -86,13 +89,13 @@ async function handleLanguageChange(elm) {
|
|||||||
star.src = 'icons/star_empty.svg'
|
star.src = 'icons/star_empty.svg'
|
||||||
|
|
||||||
// remove from list
|
// remove from list
|
||||||
ipArr.splice(ipArr.indexOf(ip), 1)
|
ipArr.splice(ipArr.indexOf(addr), 1)
|
||||||
} else {
|
} else {
|
||||||
star.src = 'icons/star_filled.svg'
|
star.src = 'icons/star_filled.svg'
|
||||||
|
|
||||||
// add to list
|
// add to list
|
||||||
if (ip && !ipArr.includes(ip)) {
|
if (ip && !ipArr.includes(addr)) {
|
||||||
ipArr.push(ip)
|
ipArr.push(addr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user