Added option to dismiss Java download prompt.

You will be given an option to install Java manually. Selecting this will bring you to a final prompt which gives some useful information about installing Java and where you can find help. You have two options on this prompt. The first is to simply aknowledge it, which will dismiss it. The second is to go back to the first prompt.
This commit is contained in:
Daniel Scalzi 2018-04-14 22:20:59 -04:00
parent 66a3854a24
commit 631c3cd6d4
No known key found for this signature in database
GPG Key ID: 5CA2F145B63535F9
3 changed files with 74 additions and 8 deletions

View File

@ -1417,6 +1417,12 @@ p {
font-weight: bold; font-weight: bold;
} }
#overlayActionContainer {
display: flex;
flex-direction: column;
justify-content: center;
}
#overlayAcknowledge { #overlayAcknowledge {
background: none; background: none;
border: 1px solid #ffffff; border: 1px solid #ffffff;
@ -1437,3 +1443,17 @@ p {
border-color: rgba(255, 255, 255, 0.75); border-color: rgba(255, 255, 255, 0.75);
color: rgba(255, 255, 255, 0.75); color: rgba(255, 255, 255, 0.75);
} }
#overlayDismiss {
font-family: 'Avenir Book';
font-weight: bold;
font-size: 10px;
text-decoration: none;
padding-top: 2.5px;
}
#overlayDismiss:hover {
color: rgba(255, 255, 255, 0.75);
}
#overlayDismiss:active {
color: rgba(165, 165, 165, 0.75);
}

View File

@ -99,17 +99,21 @@ document.addEventListener('readystatechange', function(){
* Toggle the visibility of the overlay. * Toggle the visibility of the overlay.
* *
* @param {boolean} toggleState True to display, false to hide. * @param {boolean} toggleState True to display, false to hide.
* @param {boolean} dismissable Optional. True to show the dismiss option, otherwise false.
*/ */
function toggleOverlay(toggleState){ function toggleOverlay(toggleState, dismissable = false){
if(toggleState == null){ if(toggleState == null){
toggleState = !document.getElementById('main').hasAttribute('overlay') toggleState = !document.getElementById('main').hasAttribute('overlay')
} }
if(toggleState){ if(toggleState){
document.getElementById('main').setAttribute('overlay', true) document.getElementById('main').setAttribute('overlay', true)
$('#overlayDismiss').toggle(dismissable)
$('#overlayContainer').fadeToggle(250) $('#overlayContainer').fadeToggle(250)
} else { } else {
document.getElementById('main').removeAttribute('overlay') document.getElementById('main').removeAttribute('overlay')
$('#overlayContainer').fadeToggle(250) $('#overlayContainer').fadeToggle(250, () => {
$('#overlayDismiss').toggle(dismissable)
})
} }
} }
@ -119,11 +123,13 @@ function toggleOverlay(toggleState){
* @param {string} title Overlay title text. * @param {string} title Overlay title text.
* @param {string} description Overlay description text. * @param {string} description Overlay description text.
* @param {string} acknowledge Acknowledge button text. * @param {string} acknowledge Acknowledge button text.
* @param {string} dismiss Dismiss button text.
*/ */
function setOverlayContent(title, description, acknowledge){ function setOverlayContent(title, description, acknowledge, dismiss = 'Dismiss'){
document.getElementById('overlayTitle').innerHTML = title document.getElementById('overlayTitle').innerHTML = title
document.getElementById('overlayDesc').innerHTML = description document.getElementById('overlayDesc').innerHTML = description
document.getElementById('overlayAcknowledge').innerHTML = acknowledge document.getElementById('overlayAcknowledge').innerHTML = acknowledge
document.getElementById('overlayDismiss').innerHTML = dismiss
} }
/** /**
@ -142,6 +148,22 @@ function setOverlayHandler(handler){
} }
} }
/**
* Set the onclick handler of the overlay dismiss button.
* If the handler is null, a default handler will be added.
*
* @param {function} handler
*/
function setDismissHandler(handler){
if(handler == null){
document.getElementById('overlayDismiss').onclick = () => {
toggleOverlay(false)
}
} else {
document.getElementById('overlayDismiss').onclick = handler
}
}
/* Launch Progress Wrapper Functions */ /* Launch Progress Wrapper Functions */
/** /**
@ -212,21 +234,42 @@ function asyncSystemScan(launchAfter = true){
sysAEx.on('message', (m) => { sysAEx.on('message', (m) => {
if(m.content === 'validateJava'){ if(m.content === 'validateJava'){
m.result = null
if(m.result == null){ if(m.result == null){
// If the result is null, no valid Java installation was found. // If the result is null, no valid Java installation was found.
// Show this information to the user. // Show this information to the user.
setOverlayContent( setOverlayContent(
'No Compatible<br>Java Installation Found', 'No Compatible<br>Java Installation Found',
'In order to join WesterosCraft, you need a 64-bit installation of Java 8. Would you like us to install a copy? By installing, you accept <a href="http://www.oracle.com/technetwork/java/javase/terms/license/index.html">Oracle\'s license agreement</a>.', 'In order to join WesterosCraft, you need a 64-bit installation of Java 8. Would you like us to install a copy? By installing, you accept <a href="http://www.oracle.com/technetwork/java/javase/terms/license/index.html">Oracle\'s license agreement</a>.',
'Install Java' 'Install Java',
'Install Manually'
) )
setOverlayHandler(() => { setOverlayHandler(() => {
setLaunchDetails('Preparing Java Download..') setLaunchDetails('Preparing Java Download..')
sysAEx.send({task: 0, content: '_enqueueOracleJRE', argsArr: [ConfigManager.getLauncherDirectory()]}) sysAEx.send({task: 0, content: '_enqueueOracleJRE', argsArr: [ConfigManager.getLauncherDirectory()]})
toggleOverlay(false) toggleOverlay(false)
}) })
toggleOverlay(true) setDismissHandler(() => {
$('#overlayContent').fadeOut(250, () => {
//$('#overlayDismiss').toggle(false)
setOverlayContent(
'Don\'t Forget!<br>Java is Required',
'A valid x64 installation of Java 8 is required to launch. Downloads can be found on <a href="http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html">Oracle\'s website</a>. Once installed, you will be able to connect to the server.<br><br>Please refer to our <a href="http://westeroscraft.wikia.com/wiki/Troubleshooting_Guide">Troubleshooting Guide</a> if you have any difficulty.',
'I Understand',
'Go Back'
)
setOverlayHandler(() => {
toggleLaunchArea(false)
toggleOverlay(false)
})
setDismissHandler(() => {
toggleOverlay(false, true)
asyncSystemScan()
})
$('#overlayContent').fadeIn(250)
})
})
toggleOverlay(true, true)
// TODO Add option to not install Java x64. // TODO Add option to not install Java x64.
@ -423,7 +466,7 @@ function dlAsync(login = true){
//if(!(await AuthManager.validateSelected())){ //if(!(await AuthManager.validateSelected())){
// //
//} //}
const authUser = ConfigManager.getSelectedAccount(); const authUser = ConfigManager.getSelectedAccount()
console.log('authu', authUser) console.log('authu', authUser)
let pb = new ProcessBuilder(ConfigManager.getGameDirectory(), serv, versionData, forgeData, authUser) let pb = new ProcessBuilder(ConfigManager.getGameDirectory(), serv, versionData, forgeData, authUser)
setLaunchDetails('Launching game..') setLaunchDetails('Launching game..')

View File

@ -2,6 +2,9 @@
<div id="overlayContent"> <div id="overlayContent">
<span id="overlayTitle">Lorem Ipsum:<br>Finis Illud</span> <span id="overlayTitle">Lorem Ipsum:<br>Finis Illud</span>
<span id="overlayDesc">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud..</span> <span id="overlayDesc">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud..</span>
<button id="overlayAcknowledge">Conare Iterum</button> <div id="overlayActionContainer">
<button id="overlayAcknowledge">Conare Iterum</button>
<a href="javascript:void(0);" id="overlayDismiss" style="display: none;">Dismiss</a>
</div>
</div> </div>
</div> </div>