diff --git a/resources/index.html b/resources/index.html
index e207082..913ec51 100644
--- a/resources/index.html
+++ b/resources/index.html
@@ -22,6 +22,16 @@
This is a test alert
+
+
+ Dialog!
+ This is dialog content!
+
+
+
+
+
+
diff --git a/resources/js/helpers.js b/resources/js/helpers.js
index 6e50018..b55fc02 100644
--- a/resources/js/helpers.js
+++ b/resources/js/helpers.js
@@ -114,7 +114,40 @@ function hasChineseChars(str) {
}
return true
-}
+}
+
+function openDialog(title, message, negBtn = false, affirmBtn = closeDialog) {
+ const dialog = document.getElementById('miscDialog')
+ const titleElm = document.getElementById('dialogTitle')
+ const contents = document.getElementById('dialogContent')
+ const noBtn = document.getElementById('dialogButtonNeg')
+ const yesBtn = document.getElementById('dialogButtonAffirm')
+
+ if (!noBtn) {
+ noBtn.style.display = 'none'
+ } else {
+ noBtn.style.removeProperty('display')
+ noBtn.onclick = () => closeDialog()
+ }
+
+ yesBtn.onclick = () => {
+ affirmBtn()
+ closeDialog()
+ }
+
+ // Set title and message
+ titleElm.innerText = title
+ contents.innerText = message
+
+ // Show the dialog
+ dialog.style.display = 'block'
+}
+
+function closeDialog() {
+ const dialog = document.getElementById('miscDialog')
+
+ dialog.style.display = 'none'
+}
/**
* Minimize the window
diff --git a/resources/js/options.js b/resources/js/options.js
index 5004108..3f8f4e9 100644
--- a/resources/js/options.js
+++ b/resources/js/options.js
@@ -21,6 +21,18 @@ async function toggleServerLaunchSection() {
// Save setting
config.serverLaunchPanel = !config.serverLaunchPanel
Neutralino.storage.setData('config', JSON.stringify(config))
+
+ // Show a dialog for those who may want to open the downloads section
+ if (config.serverLaunchPanel && !config.serverFolder) {
+ closeSettings()
+
+ openDialog(
+ 'You found the Grasscutter server launcher!' || localeObj.serverEnableDialogTitle,
+ 'If you do not have an existing Grasscutter installation to set, would you like to download a build?' || localeObj.serverEnableDialogText,
+ true,
+ openDownloads
+ )
+ }
}
/**
diff --git a/resources/style/index.css b/resources/style/index.css
index 89dd3d1..0e1ebcd 100644
--- a/resources/style/index.css
+++ b/resources/style/index.css
@@ -35,6 +35,7 @@ img {
margin: 10px;
}
+#miscDialog span,
#firstTimeNotice span {
display: block;
text-align: center;
@@ -159,6 +160,7 @@ img {
margin: 10px;
}
+#miscDialog,
#firstTimeNotice,
#loginPanel,
#downloadPanel,
@@ -627,4 +629,16 @@ img {
#alert.show {
top: 6%;
+}
+
+#dialogTitle {
+ font-weight: bold;
+}
+
+#dialogBtns {
+ display: flex;
+ justify-content: space-around;
+ align-items: center;
+ width: 100%;
+ margin: 0.6em;
}
\ No newline at end of file