2017-05-08 21:56:08 -07:00
|
|
|
var $ = require('jQuery');
|
2017-04-22 17:59:26 -07:00
|
|
|
const remote = require('electron').remote
|
2017-05-08 21:56:08 -07:00
|
|
|
const shell = require('electron').shell
|
2017-05-13 01:24:15 -07:00
|
|
|
const path = require('path')
|
2017-04-22 14:20:23 -07:00
|
|
|
|
2017-05-08 21:56:08 -07:00
|
|
|
/* Open web links in the user's default browser. */
|
|
|
|
$(document).on('click', 'a[href^="http"]', function(event) {
|
|
|
|
event.preventDefault();
|
2017-05-13 01:24:15 -07:00
|
|
|
//testdownloads()
|
|
|
|
shell.openExternal(this.href)
|
2017-05-08 21:56:08 -07:00
|
|
|
});
|
|
|
|
|
2017-05-13 01:24:15 -07:00
|
|
|
testdownloads = async function(){
|
|
|
|
const ag = require(path.join(__dirname, 'assets', 'js', 'assetguard.js'))
|
|
|
|
const basePath = path.join(__dirname, '..', 'mcfiles')
|
|
|
|
let versionData = await ag.loadVersionData('1.11.2', basePath)
|
|
|
|
await ag.validateAssets(versionData, basePath)
|
|
|
|
console.log('assets done')
|
|
|
|
await ag.validateLibraries(versionData, basePath)
|
|
|
|
console.log('libs done')
|
|
|
|
ag.runQueue()
|
|
|
|
}
|
|
|
|
|
2017-05-08 21:56:08 -07:00
|
|
|
/*Opens DevTools window if you type "wcdev" in sequence.
|
|
|
|
This will crash the program if you are using multiple
|
|
|
|
DevTools, for example the chrome debugger in VS Code. */
|
2017-04-22 17:59:26 -07:00
|
|
|
const match = [87, 67, 68, 69, 86]
|
|
|
|
let at = 0;
|
|
|
|
|
|
|
|
document.addEventListener('keydown', function (e) {
|
|
|
|
switch(e.keyCode){
|
|
|
|
case match[0]:
|
|
|
|
if(at === 0) ++at
|
|
|
|
break
|
|
|
|
case match[1]:
|
|
|
|
if(at === 1) ++at
|
|
|
|
break
|
|
|
|
case match[2]:
|
|
|
|
if(at === 2) ++at
|
|
|
|
break
|
|
|
|
case match[3]:
|
|
|
|
if(at === 3) ++at
|
|
|
|
case match[4]:
|
|
|
|
if(at === 4) ++at
|
|
|
|
break
|
|
|
|
default:
|
|
|
|
at = 0
|
|
|
|
}
|
|
|
|
if(at === 5) {
|
|
|
|
var window = remote.getCurrentWindow()
|
|
|
|
window.toggleDevTools()
|
|
|
|
at = 0
|
2017-04-22 14:20:23 -07:00
|
|
|
}
|
2017-05-08 21:56:08 -07:00
|
|
|
})
|