mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-22 11:42:14 -08:00
Added eslint. To lint, npm run lint.
Linted the entire project. Using different rules for the script files as there are a lot of undefined variables just because of the way the DOM's global scope works. Mostly just code cleanup, however the linter did catch a minor bug with a settings regex. That has been corrected.
This commit is contained in:
parent
ededf85892
commit
810e81521c
50
.eslintrc.json
Normal file
50
.eslintrc.json
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"es6": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2017,
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"indent": [
|
||||||
|
"error",
|
||||||
|
4,
|
||||||
|
{
|
||||||
|
"SwitchCase": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"linebreak-style": [
|
||||||
|
"error",
|
||||||
|
"windows"
|
||||||
|
],
|
||||||
|
"quotes": [
|
||||||
|
"error",
|
||||||
|
"single"
|
||||||
|
],
|
||||||
|
"semi": [
|
||||||
|
"error",
|
||||||
|
"never"
|
||||||
|
],
|
||||||
|
"no-var": [
|
||||||
|
"error"
|
||||||
|
],
|
||||||
|
"no-console": [
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"no-control-regex": [
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"no-unused-vars": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"vars": "all",
|
||||||
|
"args": "none",
|
||||||
|
"ignoreRestSiblings": false,
|
||||||
|
"argsIgnorePattern": "reject"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
47
.eslintrc.scripts.json
Normal file
47
.eslintrc.scripts.json
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"es6": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2017,
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"indent": [
|
||||||
|
"error",
|
||||||
|
4,
|
||||||
|
{
|
||||||
|
"SwitchCase": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"linebreak-style": [
|
||||||
|
"error",
|
||||||
|
"windows"
|
||||||
|
],
|
||||||
|
"quotes": [
|
||||||
|
"error",
|
||||||
|
"single"
|
||||||
|
],
|
||||||
|
"semi": [
|
||||||
|
"error",
|
||||||
|
"never"
|
||||||
|
],
|
||||||
|
"no-var": [
|
||||||
|
"error"
|
||||||
|
],
|
||||||
|
"no-console": [
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"no-control-regex": [
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"no-unused-vars": [
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"no-undef": [
|
||||||
|
0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -22,7 +22,7 @@ const crypto = require('crypto')
|
|||||||
const EventEmitter = require('events')
|
const EventEmitter = require('events')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const isDev = require('electron-is-dev')
|
const isDev = require('electron-is-dev')
|
||||||
const mkpath = require('mkdirp');
|
const mkpath = require('mkdirp')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const Registry = require('winreg')
|
const Registry = require('winreg')
|
||||||
const request = require('request')
|
const request = require('request')
|
||||||
@ -70,13 +70,13 @@ class Library extends Asset {
|
|||||||
static mojangFriendlyOS(){
|
static mojangFriendlyOS(){
|
||||||
const opSys = process.platform
|
const opSys = process.platform
|
||||||
if (opSys === 'darwin') {
|
if (opSys === 'darwin') {
|
||||||
return 'osx';
|
return 'osx'
|
||||||
} else if (opSys === 'win32'){
|
} else if (opSys === 'win32'){
|
||||||
return 'windows';
|
return 'windows'
|
||||||
} else if (opSys === 'linux'){
|
} else if (opSys === 'linux'){
|
||||||
return 'linux';
|
return 'linux'
|
||||||
} else {
|
} else {
|
||||||
return 'unknown_os';
|
return 'unknown_os'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,12 +241,11 @@ class AssetGuard extends EventEmitter {
|
|||||||
if(hash == null){
|
if(hash == null){
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
let fileName = path.basename(filePath)
|
|
||||||
let buf = fs.readFileSync(filePath)
|
let buf = fs.readFileSync(filePath)
|
||||||
let calcdhash = AssetGuard._calculateHash(buf, algo)
|
let calcdhash = AssetGuard._calculateHash(buf, algo)
|
||||||
return calcdhash === hash
|
return calcdhash === hash
|
||||||
}
|
}
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -926,7 +925,7 @@ class AssetGuard extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check the JAVA_HOME environment variable.
|
// Check the JAVA_HOME environment variable.
|
||||||
const jHome = AssetGuard._scanJavaHome()
|
let jHome = AssetGuard._scanJavaHome()
|
||||||
if(jHome != null){
|
if(jHome != null){
|
||||||
// Ensure we are at the absolute root.
|
// Ensure we are at the absolute root.
|
||||||
if(jHome.contains('/Contents/Home')){
|
if(jHome.contains('/Contents/Home')){
|
||||||
@ -1099,7 +1098,6 @@ class AssetGuard extends EventEmitter {
|
|||||||
//Asset constants
|
//Asset constants
|
||||||
const resourceURL = 'http://resources.download.minecraft.net/'
|
const resourceURL = 'http://resources.download.minecraft.net/'
|
||||||
const localPath = path.join(self.commonPath, 'assets')
|
const localPath = path.join(self.commonPath, 'assets')
|
||||||
const indexPath = path.join(localPath, 'indexes')
|
|
||||||
const objectPath = path.join(localPath, 'objects')
|
const objectPath = path.join(localPath, 'objects')
|
||||||
|
|
||||||
const assetDlQueue = []
|
const assetDlQueue = []
|
||||||
@ -1112,7 +1110,7 @@ class AssetGuard extends EventEmitter {
|
|||||||
self.emit('progress', 'assets', acc, total)
|
self.emit('progress', 'assets', acc, total)
|
||||||
const hash = value.hash
|
const hash = value.hash
|
||||||
const assetName = path.join(hash.substring(0, 2), hash)
|
const assetName = path.join(hash.substring(0, 2), hash)
|
||||||
const urlName = hash.substring(0, 2) + "/" + hash
|
const urlName = hash.substring(0, 2) + '/' + hash
|
||||||
const ast = new Asset(key, hash, value.size, resourceURL + urlName, path.join(objectPath, assetName))
|
const ast = new Asset(key, hash, value.size, resourceURL + urlName, path.join(objectPath, assetName))
|
||||||
if(!AssetGuard._validateLocal(ast.to, 'sha1', ast.hash)){
|
if(!AssetGuard._validateLocal(ast.to, 'sha1', ast.hash)){
|
||||||
dlSize += (ast.size*1)
|
dlSize += (ast.size*1)
|
||||||
@ -1271,7 +1269,7 @@ class AssetGuard extends EventEmitter {
|
|||||||
|
|
||||||
_parseDistroModules(modules, version, servid){
|
_parseDistroModules(modules, version, servid){
|
||||||
let alist = []
|
let alist = []
|
||||||
let asize = 0;
|
let asize = 0
|
||||||
let decompressqueue = []
|
let decompressqueue = []
|
||||||
for(let ob of modules){
|
for(let ob of modules){
|
||||||
let obType = ob.getType
|
let obType = ob.getType
|
||||||
@ -1525,7 +1523,7 @@ class AssetGuard extends EventEmitter {
|
|||||||
}, (err) => {
|
}, (err) => {
|
||||||
|
|
||||||
if(err){
|
if(err){
|
||||||
console.log('An item in ' + identifier + ' failed to process');
|
console.log('An item in ' + identifier + ' failed to process')
|
||||||
} else {
|
} else {
|
||||||
console.log('All ' + identifier + ' have been processed successfully')
|
console.log('All ' + identifier + ' have been processed successfully')
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ const DEFAULT_CONFIG = {
|
|||||||
modConfigurations: []
|
modConfigurations: []
|
||||||
}
|
}
|
||||||
|
|
||||||
let config = null;
|
let config = null
|
||||||
|
|
||||||
// Persistance Utility Functions
|
// Persistance Utility Functions
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// Work in progress
|
// Work in progress
|
||||||
const {Client} = require('discord-rpc')
|
const {Client} = require('discord-rpc')
|
||||||
const ConfigManager = require('./configmanager')
|
|
||||||
|
|
||||||
let client
|
let client
|
||||||
let activity
|
let activity
|
||||||
|
@ -483,7 +483,7 @@ class DistroIndex {
|
|||||||
* @returns {Server} The main server.
|
* @returns {Server} The main server.
|
||||||
*/
|
*/
|
||||||
getMainServer(){
|
getMainServer(){
|
||||||
return getServer(this.mainServer)
|
return this.mainServer != null ? this.getServer(this.mainServer) : null
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ class ProcessBuilder {
|
|||||||
for(let i=0; i<mcArgs.length; ++i){
|
for(let i=0; i<mcArgs.length; ++i){
|
||||||
if(argDiscovery.test(mcArgs[i])){
|
if(argDiscovery.test(mcArgs[i])){
|
||||||
const identifier = mcArgs[i].match(argDiscovery)[1]
|
const identifier = mcArgs[i].match(argDiscovery)[1]
|
||||||
let val = null;
|
let val = null
|
||||||
switch(identifier){
|
switch(identifier){
|
||||||
case 'auth_player_name':
|
case 'auth_player_name':
|
||||||
val = this.authUser.displayName
|
val = this.authUser.displayName
|
||||||
@ -273,7 +273,7 @@ class ProcessBuilder {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
if(val != null){
|
if(val != null){
|
||||||
mcArgs[i] = val;
|
mcArgs[i] = val
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,8 +152,8 @@ const refreshMojangStatuses = async function(){
|
|||||||
console.log('Refreshing Mojang Statuses..')
|
console.log('Refreshing Mojang Statuses..')
|
||||||
|
|
||||||
let status = 'grey'
|
let status = 'grey'
|
||||||
let tooltipEssentialHTML = ``
|
let tooltipEssentialHTML = ''
|
||||||
let tooltipNonEssentialHTML = ``
|
let tooltipNonEssentialHTML = ''
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const statuses = await Mojang.status()
|
const statuses = await Mojang.status()
|
||||||
@ -366,7 +366,7 @@ function asyncSystemScan(launchAfter = true){
|
|||||||
} else if(m.context === 'complete'){
|
} else if(m.context === 'complete'){
|
||||||
|
|
||||||
switch(m.data){
|
switch(m.data){
|
||||||
case 'download':
|
case 'download': {
|
||||||
// Show installing progress bar.
|
// Show installing progress bar.
|
||||||
remote.getCurrentWindow().setProgressBar(2)
|
remote.getCurrentWindow().setProgressBar(2)
|
||||||
|
|
||||||
@ -383,6 +383,7 @@ function asyncSystemScan(launchAfter = true){
|
|||||||
setLaunchDetails(eLStr + dotStr)
|
setLaunchDetails(eLStr + dotStr)
|
||||||
}, 750)
|
}, 750)
|
||||||
break
|
break
|
||||||
|
}
|
||||||
case 'java':
|
case 'java':
|
||||||
// Download & extraction complete, remove the loading from the OS progress bar.
|
// Download & extraction complete, remove the loading from the OS progress bar.
|
||||||
remote.getCurrentWindow().setProgressBar(-1)
|
remote.getCurrentWindow().setProgressBar(-1)
|
||||||
@ -497,14 +498,15 @@ function dlAsync(login = true){
|
|||||||
}
|
}
|
||||||
} else if(m.context === 'progress'){
|
} else if(m.context === 'progress'){
|
||||||
switch(m.data){
|
switch(m.data){
|
||||||
case 'assets':
|
case 'assets': {
|
||||||
const perc = (m.value/m.total)*20
|
const perc = (m.value/m.total)*20
|
||||||
setLaunchPercentage(40+perc, 100, parseInt(40+perc))
|
setLaunchPercentage(40+perc, 100, parseInt(40+perc))
|
||||||
break
|
break
|
||||||
|
}
|
||||||
case 'download':
|
case 'download':
|
||||||
setDownloadPercentage(m.value, m.total, m.percent)
|
setDownloadPercentage(m.value, m.total, m.percent)
|
||||||
break
|
break
|
||||||
case 'extract':
|
case 'extract': {
|
||||||
// Show installing progress bar.
|
// Show installing progress bar.
|
||||||
remote.getCurrentWindow().setProgressBar(2)
|
remote.getCurrentWindow().setProgressBar(2)
|
||||||
|
|
||||||
@ -522,6 +524,7 @@ function dlAsync(login = true){
|
|||||||
}, 750)
|
}, 750)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if(m.context === 'complete'){
|
} else if(m.context === 'complete'){
|
||||||
switch(m.data){
|
switch(m.data){
|
||||||
case 'download':
|
case 'download':
|
||||||
@ -1022,7 +1025,7 @@ function loadNews(){
|
|||||||
let content = el.find('content\\:encoded').text()
|
let content = el.find('content\\:encoded').text()
|
||||||
let regex = /src="(?!http:\/\/|https:\/\/)(.+)"/g
|
let regex = /src="(?!http:\/\/|https:\/\/)(.+)"/g
|
||||||
let matches
|
let matches
|
||||||
while(matches = regex.exec(content)){
|
while((matches = regex.exec(content))){
|
||||||
content = content.replace(matches[1], newsHost + matches[1])
|
content = content.replace(matches[1], newsHost + matches[1])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ function toggleOverlay(toggleState, dismissable = false, content = 'overlayConte
|
|||||||
if(toggleState){
|
if(toggleState){
|
||||||
document.getElementById('main').setAttribute('overlay', true)
|
document.getElementById('main').setAttribute('overlay', true)
|
||||||
// Make things untabbable.
|
// Make things untabbable.
|
||||||
$("#main *").attr('tabindex', '-1')
|
$('#main *').attr('tabindex', '-1')
|
||||||
$('#' + content).parent().children().hide()
|
$('#' + content).parent().children().hide()
|
||||||
$('#' + content).show()
|
$('#' + content).show()
|
||||||
if(dismissable){
|
if(dismissable){
|
||||||
@ -41,7 +41,7 @@ function toggleOverlay(toggleState, dismissable = false, content = 'overlayConte
|
|||||||
} else {
|
} else {
|
||||||
document.getElementById('main').removeAttribute('overlay')
|
document.getElementById('main').removeAttribute('overlay')
|
||||||
// Make things tabbable.
|
// Make things tabbable.
|
||||||
$("#main *").removeAttr('tabindex')
|
$('#main *').removeAttr('tabindex')
|
||||||
$('#overlayContainer').fadeOut({
|
$('#overlayContainer').fadeOut({
|
||||||
duration: 250,
|
duration: 250,
|
||||||
start: () => {
|
start: () => {
|
||||||
@ -232,9 +232,9 @@ function populateServerListings(){
|
|||||||
const distro = DistroManager.getDistribution()
|
const distro = DistroManager.getDistribution()
|
||||||
const giaSel = ConfigManager.getSelectedServer()
|
const giaSel = ConfigManager.getSelectedServer()
|
||||||
const servers = distro.getServers()
|
const servers = distro.getServers()
|
||||||
let htmlString = ``
|
let htmlString = ''
|
||||||
for(const serv of servers){
|
for(const serv of servers){
|
||||||
htmlString += `<button class="serverListing" servid="${serv.getID()}" ${serv.getID() === giaSel ? `selected` : ``}>
|
htmlString += `<button class="serverListing" servid="${serv.getID()}" ${serv.getID() === giaSel ? 'selected' : ''}>
|
||||||
<img class="serverListingImg" src="${serv.getIcon()}"/>
|
<img class="serverListingImg" src="${serv.getIcon()}"/>
|
||||||
<div class="serverListingDetails">
|
<div class="serverListingDetails">
|
||||||
<span class="serverListingName">${serv.getName()}</span>
|
<span class="serverListingName">${serv.getName()}</span>
|
||||||
@ -251,7 +251,7 @@ function populateServerListings(){
|
|||||||
<circle class="cls-2" cx="53.73" cy="53.9" r="38"/>
|
<circle class="cls-2" cx="53.73" cy="53.9" r="38"/>
|
||||||
</svg>
|
</svg>
|
||||||
<span class="serverListingStarTooltip">Main Server</span>
|
<span class="serverListingStarTooltip">Main Server</span>
|
||||||
</div>` : ``}
|
</div>` : ''}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</button>`
|
</button>`
|
||||||
@ -262,8 +262,8 @@ function populateServerListings(){
|
|||||||
|
|
||||||
function populateAccountListings(){
|
function populateAccountListings(){
|
||||||
const accountsObj = ConfigManager.getAuthAccounts()
|
const accountsObj = ConfigManager.getAuthAccounts()
|
||||||
const accounts = Array.from(Object.keys(accountsObj), v=>accountsObj[v]);
|
const accounts = Array.from(Object.keys(accountsObj), v=>accountsObj[v])
|
||||||
let htmlString = ``
|
let htmlString = ''
|
||||||
for(let i=0; i<accounts.length; i++){
|
for(let i=0; i<accounts.length; i++){
|
||||||
htmlString += `<button class="accountListing" uuid="${accounts[i].uuid}" ${i===0 ? 'selected' : ''}>
|
htmlString += `<button class="accountListing" uuid="${accounts[i].uuid}" ${i===0 ? 'selected' : ''}>
|
||||||
<img src="https://crafatar.com/renders/head/${accounts[i].uuid}?scale=2&default=MHF_Steve&overlay">
|
<img src="https://crafatar.com/renders/head/${accounts[i].uuid}?scale=2&default=MHF_Steve&overlay">
|
||||||
|
@ -363,7 +363,7 @@ function populateAuthAccounts(){
|
|||||||
const authKeys = Object.keys(authAccounts)
|
const authKeys = Object.keys(authAccounts)
|
||||||
const selectedUUID = ConfigManager.getSelectedAccount().uuid
|
const selectedUUID = ConfigManager.getSelectedAccount().uuid
|
||||||
|
|
||||||
let authAccountStr = ``
|
let authAccountStr = ''
|
||||||
|
|
||||||
authKeys.map((val) => {
|
authKeys.map((val) => {
|
||||||
const acc = authAccounts[val]
|
const acc = authAccounts[val]
|
||||||
@ -412,12 +412,12 @@ function prepareAccountsTab() {
|
|||||||
* Disable decimals, negative signs, and scientific notation.
|
* Disable decimals, negative signs, and scientific notation.
|
||||||
*/
|
*/
|
||||||
document.getElementById('settingsGameWidth').addEventListener('keydown', (e) => {
|
document.getElementById('settingsGameWidth').addEventListener('keydown', (e) => {
|
||||||
if(/[-\.eE]/.test(e.key)){
|
if(/^[-.eE]$/.test(e.key)){
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
document.getElementById('settingsGameHeight').addEventListener('keydown', (e) => {
|
document.getElementById('settingsGameHeight').addEventListener('keydown', (e) => {
|
||||||
if(/[-\.eE]/.test(e.key)){
|
if(/^[-.eE]$/.test(e.key)){
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -104,7 +104,7 @@ function showMainUI(data){
|
|||||||
}, 750)
|
}, 750)
|
||||||
// Disable tabbing to the news container.
|
// Disable tabbing to the news container.
|
||||||
initNews().then(() => {
|
initNews().then(() => {
|
||||||
$("#newsContainer *").attr('tabindex', '-1')
|
$('#newsContainer *').attr('tabindex', '-1')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ async function validateSelectedAccount(){
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
const accountsObj = ConfigManager.getAuthAccounts()
|
const accountsObj = ConfigManager.getAuthAccounts()
|
||||||
const accounts = Array.from(Object.keys(accountsObj), v => accountsObj[v]);
|
const accounts = Array.from(Object.keys(accountsObj), v => accountsObj[v])
|
||||||
// This function validates the account switch.
|
// This function validates the account switch.
|
||||||
setSelectedAccount(accounts[0].uuid)
|
setSelectedAccount(accounts[0].uuid)
|
||||||
toggleOverlay(false)
|
toggleOverlay(false)
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* modules, excluding dependencies.
|
* modules, excluding dependencies.
|
||||||
*/
|
*/
|
||||||
// Requirements
|
// Requirements
|
||||||
const $ = require('jquery');
|
const $ = require('jquery')
|
||||||
const {ipcRenderer, remote, shell, webFrame} = require('electron')
|
const {ipcRenderer, remote, shell, webFrame} = require('electron')
|
||||||
const isDev = require('electron-is-dev')
|
const isDev = require('electron-is-dev')
|
||||||
|
|
||||||
@ -50,6 +50,7 @@ if(!isDev){
|
|||||||
ipcRenderer.send('autoUpdateAction', 'checkForUpdate')
|
ipcRenderer.send('autoUpdateAction', 'checkForUpdate')
|
||||||
}, 1800000)
|
}, 1800000)
|
||||||
ipcRenderer.send('autoUpdateAction', 'checkForUpdate')
|
ipcRenderer.send('autoUpdateAction', 'checkForUpdate')
|
||||||
|
break
|
||||||
case 'realerror':
|
case 'realerror':
|
||||||
if(info != null && info.code != null){
|
if(info != null && info.code != null){
|
||||||
if(info.code === 'ERR_UPDATER_INVALID_RELEASE_FEED'){
|
if(info.code === 'ERR_UPDATER_INVALID_RELEASE_FEED'){
|
||||||
@ -108,7 +109,7 @@ $(function(){
|
|||||||
|
|
||||||
document.addEventListener('readystatechange', function () {
|
document.addEventListener('readystatechange', function () {
|
||||||
if (document.readyState === 'interactive'){
|
if (document.readyState === 'interactive'){
|
||||||
console.log('UICore Initializing..');
|
console.log('UICore Initializing..')
|
||||||
|
|
||||||
// Bind close button.
|
// Bind close button.
|
||||||
Array.from(document.getElementsByClassName('fCb')).map((val) => {
|
Array.from(document.getElementsByClassName('fCb')).map((val) => {
|
||||||
@ -157,10 +158,10 @@ document.addEventListener('readystatechange', function () {
|
|||||||
//const targetWidth2 = document.getElementById("server_selection").getBoundingClientRect().width
|
//const targetWidth2 = document.getElementById("server_selection").getBoundingClientRect().width
|
||||||
//const targetWidth3 = document.getElementById("launch_button").getBoundingClientRect().width
|
//const targetWidth3 = document.getElementById("launch_button").getBoundingClientRect().width
|
||||||
|
|
||||||
document.getElementById("launch_details").style.maxWidth = 266.01
|
document.getElementById('launch_details').style.maxWidth = 266.01
|
||||||
document.getElementById("launch_progress").style.width = 170.8
|
document.getElementById('launch_progress').style.width = 170.8
|
||||||
document.getElementById("launch_details_right").style.maxWidth = 170.8
|
document.getElementById('launch_details_right').style.maxWidth = 170.8
|
||||||
document.getElementById("launch_progress_label").style.width = 53.21
|
document.getElementById('launch_progress_label').style.width = 53.21
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +171,7 @@ document.addEventListener('readystatechange', function () {
|
|||||||
* Open web links in the user's default browser.
|
* Open web links in the user's default browser.
|
||||||
*/
|
*/
|
||||||
$(document).on('click', 'a[href^="http"]', function(event) {
|
$(document).on('click', 'a[href^="http"]', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault()
|
||||||
//console.log(os.homedir())
|
//console.log(os.homedir())
|
||||||
shell.openExternal(this.href)
|
shell.openExternal(this.href)
|
||||||
})
|
})
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
const app = require('electron')
|
|
||||||
const remote = require('electron').BrowserWindow
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Doesn't work yet.
|
|
||||||
*/
|
|
||||||
exports.setIconBadge = function(text){
|
|
||||||
if(process.platform === 'darwin'){
|
|
||||||
app.dock.setBadge('' + text)
|
|
||||||
} else if (process.platform === 'win32'){
|
|
||||||
const win = remote.getFocusedWindow()
|
|
||||||
if(text === ''){
|
|
||||||
win.setOverlayIcon(null, '')
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Create badge
|
|
||||||
const canvas = document.createElement('canvas')
|
|
||||||
canvas.height = 140;
|
|
||||||
canvas.width = 140;
|
|
||||||
const ctx = canvas.getContext('2d')
|
|
||||||
ctx.fillStyle = '#a02d2a'
|
|
||||||
ctx.beginPath()
|
|
||||||
ctx.ellipse(70, 70, 70, 70, 0, 0, 2 * Math.PI)
|
|
||||||
ctx.fill()
|
|
||||||
ctx.textAlign = 'center'
|
|
||||||
ctx.fillStyle = 'white'
|
|
||||||
|
|
||||||
if(text.length > 2 ){
|
|
||||||
ctx.font = '75px sans-serif'
|
|
||||||
ctx.fillText('' + text, 70, 98)
|
|
||||||
} else if (text.length > 1){
|
|
||||||
ctx.font = '100px sans-serif'
|
|
||||||
ctx.fillText('' + text, 70, 105)
|
|
||||||
} else {
|
|
||||||
ctx.font = '125px sans-serif'
|
|
||||||
ctx.fillText('' + text, 70, 112)
|
|
||||||
}
|
|
||||||
|
|
||||||
const badgeDataURL = canvas.toDataURL()
|
|
||||||
const img = NativeImage.createFromDataURL(badgeDataURL)
|
|
||||||
win.setOverlayIcon(img, '' + text)
|
|
||||||
}
|
|
||||||
}
|
|
2
index.js
2
index.js
@ -130,7 +130,7 @@ function getPlatformIcon(filename){
|
|||||||
return path.join(__dirname, 'app', 'assets', 'images', filename)
|
return path.join(__dirname, 'app', 'assets', 'images', filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
app.on('ready', createWindow);
|
app.on('ready', createWindow)
|
||||||
|
|
||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
// On macOS it is common for applications and their menu bar
|
// On macOS it is common for applications and their menu bar
|
||||||
|
888
package-lock.json
generated
888
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,8 @@
|
|||||||
"dist:win": "npm run dist -- --win --x64",
|
"dist:win": "npm run dist -- --win --x64",
|
||||||
"dist:mac": "npm run dist -- --mac",
|
"dist:mac": "npm run dist -- --mac",
|
||||||
"dist:linux": "npm run dist -- --linux --x64",
|
"dist:linux": "npm run dist -- --linux --x64",
|
||||||
"dist:all": "npm run dist -- -wl --x64"
|
"dist:all": "npm run dist -- -wl --x64",
|
||||||
|
"lint": "eslint --config .eslintrc.json --ignore-pattern app/assets/js/scripts/*.js . && eslint --config .eslintrc.scripts.json app/assets/js/scripts"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "10.5.x"
|
"node": "10.5.x"
|
||||||
@ -47,7 +48,8 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^2.0.5",
|
"electron": "^2.0.5",
|
||||||
"electron-builder": "^20.24.4"
|
"electron-builder": "^20.24.4",
|
||||||
|
"eslint": "^5.2.0"
|
||||||
},
|
},
|
||||||
"build": {
|
"build": {
|
||||||
"appId": "westeroscraftlauncher",
|
"appId": "westeroscraftlauncher",
|
||||||
|
Loading…
Reference in New Issue
Block a user