Installer base
This commit is contained in:
parent
66d7636228
commit
db31c2662a
|
@ -0,0 +1,3 @@
|
|||
dist/
|
||||
pack.bat
|
||||
run.bat
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"name": "Install",
|
||||
"description": "Better Discord enhances Discord.",
|
||||
"version": "0.1.0",
|
||||
"homepage": "https://github.com/Jiiks/BetterDiscordApp",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"electron-prebuilt": "^1.0.0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,225 @@
|
|||
html, body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
background:#212229;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
html, body {
|
||||
width:800px;
|
||||
height:400px;
|
||||
}
|
||||
|
||||
* {
|
||||
font-family: Calibri;
|
||||
color:#E8E8E8;
|
||||
outline:none;
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
#titleBar {
|
||||
display:flex;
|
||||
-webkit-app-region: drag;
|
||||
pointer-events: none;
|
||||
width:100%;
|
||||
height:40px;
|
||||
background:#212229;
|
||||
border-bottom:1px solid #000;
|
||||
box-shadow:0 1px 0 0 #303030;
|
||||
}
|
||||
|
||||
#titleBar h3 {
|
||||
color:#FFF;
|
||||
}
|
||||
|
||||
.icon {
|
||||
display:inline-block;
|
||||
width:40px;
|
||||
height:40px;
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
.icon-image {
|
||||
background:blue;
|
||||
height:30px;
|
||||
width:30px;
|
||||
}
|
||||
|
||||
.title {
|
||||
display:inline-block;
|
||||
height:40px;
|
||||
line-height:40px;
|
||||
color:#FFF;
|
||||
}
|
||||
|
||||
.main-container {
|
||||
display:flex;
|
||||
width:100%;
|
||||
height:calc(100% - 40px);
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width:200px;
|
||||
height:100%;
|
||||
border-right:1px solid #000;
|
||||
box-shadow:1px 0 0 0 #303030;
|
||||
background:#212229;
|
||||
z-index:90001;
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
.sidebar-inner {
|
||||
width:100%;
|
||||
height:100%;
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
.main {
|
||||
flex-grow:1;
|
||||
padding:5px;
|
||||
transform:translateX(0);
|
||||
}
|
||||
|
||||
.panel-container {
|
||||
position:absolute;
|
||||
left:10px;
|
||||
transition: all 0.5s ease-in;
|
||||
}
|
||||
|
||||
.panel {
|
||||
display:inline-block;
|
||||
width:590px;
|
||||
position:absolute;
|
||||
}
|
||||
|
||||
#panel-1 {
|
||||
left:600px;
|
||||
}
|
||||
|
||||
#panel-2 {
|
||||
left:1200px;
|
||||
}
|
||||
|
||||
#panel-3 {
|
||||
left:1800px;
|
||||
}
|
||||
|
||||
#licensetext {
|
||||
width: 100%;
|
||||
overflow-y: scroll;
|
||||
white-space: pre-line;
|
||||
height:280px;
|
||||
}
|
||||
|
||||
#licenseform {
|
||||
float:right;
|
||||
margin-top:5px;
|
||||
margin-right:10px;
|
||||
}
|
||||
|
||||
input[type='radio'] {
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
label {
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
label, input[type='radio']{
|
||||
font-size: 16px;
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
margin-left: 3px;
|
||||
line-height: 25px;
|
||||
height: 28px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
|
||||
ul {
|
||||
margin:0;
|
||||
padding:0;
|
||||
list-style:none;
|
||||
}
|
||||
|
||||
li {
|
||||
list-style:none;
|
||||
color:gray;
|
||||
}
|
||||
|
||||
li.active {
|
||||
color:#FFF;
|
||||
}
|
||||
|
||||
li.visited {
|
||||
color:#EBEBEB;
|
||||
}
|
||||
|
||||
li:before {
|
||||
content: "";
|
||||
display:inline-block;
|
||||
background:gray;
|
||||
border-radius: 50%;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
margin-right:3px;
|
||||
}
|
||||
|
||||
li.active:before {
|
||||
background:dodgerblue;
|
||||
}
|
||||
|
||||
li.visited:before {
|
||||
background:#00D443;
|
||||
}
|
||||
|
||||
.controls {
|
||||
position:absolute;
|
||||
bottom:5px;
|
||||
right:5px;
|
||||
}
|
||||
|
||||
button {
|
||||
color:gray;
|
||||
width:60px;
|
||||
background:#1b1c23;
|
||||
border-style:solid;
|
||||
border-color:#000;
|
||||
border-width:0 1px 1px 0;
|
||||
padding:5px;
|
||||
box-shadow:1px 1px 0 0 #303030 inset;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
color:#FFF;
|
||||
background:#24262f;
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
background:#292929;
|
||||
border-color:#191919;
|
||||
color:gray;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background:#282828 !important;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar, ::-webkit-scrollbar-track-piece {
|
||||
background:#383838 !important;
|
||||
}
|
||||
|
||||
input.path {
|
||||
width: 450px;
|
||||
height: 23px;
|
||||
background: rgb(27, 28, 35) none repeat scroll 0% 0%;
|
||||
border: 1px solid rgb(17, 17, 17);
|
||||
box-shadow: -1px -1px 0px 0px rgb(50, 49, 49) inset;
|
||||
border-width: 1px 0px 0px 1px;
|
||||
border-style: solid;
|
||||
border-color: #111;
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<script type="text/javascript" src="js/jquery-2.0.0.min.js"></script>
|
||||
<script type="text/javascript" src="js/main.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="titleBar">
|
||||
<div class="icon">
|
||||
<div class="icon-image"></div>
|
||||
</div>
|
||||
<div class="title">
|
||||
BetterDiscord Installer - v0.1.1
|
||||
</div>
|
||||
</div>
|
||||
<div class="main-container">
|
||||
<div class="sidebar">
|
||||
<div class="sidebar-inner">
|
||||
<ul>
|
||||
<li id="li-0" class="active">Introduction</li>
|
||||
<li id="li-1">License</li>
|
||||
<li id="li-2">Destination</li>
|
||||
<li id="li-3">Installation</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="main">
|
||||
<div class="panel-container">
|
||||
<div class="panel" id="panel-0">
|
||||
<h2>Welcome to the BetterDiscord setup</h2>
|
||||
<p>
|
||||
The setup will isntall BetterDiscord on your computer.
|
||||
<br>
|
||||
Click "Next" to continue or "Cancel" to exit the setup.
|
||||
</p>
|
||||
</div>
|
||||
<div class="panel" id="panel-1">
|
||||
<div id="licensetext">The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2016 Jiiks | Jiiks.net
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
</div>
|
||||
<form action="" id="licenseform">
|
||||
<input type="radio" name="licensegroup" value="Accept" id="accept" disabled="true"><label for="accept">Accept</label>
|
||||
<input type="radio" name="licensegroup" value="Decline" id="decline" checked="true"><label for="decline">Decline</label>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="panel" id="panel-2">
|
||||
<p>Setup will install BetterDiscord to the following location. Click Install to continue.</p>
|
||||
<input class="path" id="discordPath" type="text" style="height:26px;" disabled="true" />
|
||||
<button id="path" style="height:26px;">Browse</button>
|
||||
|
||||
<p style="font-size:14px">*If the path is not pointing to the latest version of Discord then click "Browse" and select it
|
||||
<br>
|
||||
*Installer will kill Discord process
|
||||
</p>
|
||||
|
||||
<input type="checkbox" name="restart" id="restart" checked="true">
|
||||
<label for="restart" style="margin:0; line-height: 18px;">Restart Discord after installation</label>
|
||||
</div>
|
||||
|
||||
<div class="panel" id="panel-3">feafewa</div>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<button id="back" style="display: none;">Back</button>
|
||||
<button id="next">Next</button>
|
||||
<button id="cancel">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,78 @@
|
|||
'use strict';
|
||||
|
||||
const ipcRenderer = require('electron').ipcRenderer;
|
||||
|
||||
$(function() {
|
||||
|
||||
var currentPanel = 0;
|
||||
|
||||
$("#accept").on("change", function() {
|
||||
console.log("WTF");
|
||||
$("#next").prop("disabled", true);
|
||||
if($(this).prop("checked")) {
|
||||
$("#next").prop("disabled", false);
|
||||
}
|
||||
});
|
||||
|
||||
$("#decline").on("change", function() {
|
||||
$("#next").prop("disabled", true);
|
||||
if(!$(this).prop("checked")) {
|
||||
$("#next").prop("disabled", false);
|
||||
}
|
||||
});
|
||||
|
||||
$("#back").on("click", function(){
|
||||
currentPanel--;
|
||||
if(currentPanel <= 0) currentPanel = 0;
|
||||
switchPanel();
|
||||
});
|
||||
|
||||
$("#next").on("click", function() {
|
||||
currentPanel++;
|
||||
if(currentPanel >= 3) currentPanel = 3;
|
||||
switchPanel();
|
||||
});
|
||||
|
||||
$("#path").on("click", function() {
|
||||
var p = ipcRenderer.sendSync('sync', 'openDirectory');
|
||||
if(p != null) {
|
||||
$("#discordPath").val(p);
|
||||
}
|
||||
});
|
||||
|
||||
$("#licensetext").on("scroll", function() {
|
||||
var e = $(this);
|
||||
if(e.height() + e.scrollTop() >= e[0].scrollHeight) {
|
||||
$("#accept").prop("disabled", false);
|
||||
} else {
|
||||
$("#accept").prop("disabled", true);
|
||||
$("#decline").prop("checked", true)
|
||||
$("#next").prop("disabled", true);
|
||||
}
|
||||
});
|
||||
|
||||
function switchPanel() {
|
||||
$(".panel-container").css("left", currentPanel*-600+10 + "px");
|
||||
switch(currentPanel) {
|
||||
case 0:
|
||||
$("#back").hide();
|
||||
$("#next").show();
|
||||
$("#next").text("Next");
|
||||
$("#next").prop("disabled", false);
|
||||
break;
|
||||
case 1:
|
||||
$("#back").show();
|
||||
$("#next").text("Next");
|
||||
$("#next").prop("disabled", !$("#accept").prop("checked"));
|
||||
break;
|
||||
case 2:
|
||||
$("#back").show();
|
||||
$("#next").show();
|
||||
$("#next").text("Install");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$("#discordPath").val(ipcRenderer.sendSync('sync', 'getInstallPath'));
|
||||
|
||||
})();
|
|
@ -0,0 +1,53 @@
|
|||
'use strict';
|
||||
|
||||
const electron = require('electron');
|
||||
const app = electron.app;
|
||||
const BrowserWindow = electron.BrowserWindow;
|
||||
const ipcMain = electron.ipcMain;
|
||||
|
||||
let mainWindow
|
||||
|
||||
const {dialog} = require('electron');
|
||||
|
||||
var installPath = process.platform == "win32" ? process.env.LOCALAPPDATA + "\\Discord\\app-0.0.290\\" :
|
||||
process.platform == "darwin" ? "\\Applications\\Discord.app\\" : "";
|
||||
function createWindow() {
|
||||
var width = 800;
|
||||
var height = 400;
|
||||
|
||||
mainWindow = new BrowserWindow({
|
||||
width: width,
|
||||
height: height,
|
||||
maxWidth: width,
|
||||
maxHeight: height,
|
||||
minWidth: width,
|
||||
minHeight: height,
|
||||
fullscreenable: false,
|
||||
maximizable: false,
|
||||
frame: false
|
||||
});
|
||||
|
||||
mainWindow.loadURL('file://' + __dirname + '/data/index.html');
|
||||
}
|
||||
|
||||
ipcMain.on('sync', function(event, arg) {
|
||||
switch(arg) {
|
||||
case "openDirectory":
|
||||
var p = dialog.showOpenDialog({properties: ['openDirectory'], defaultPath: installPath });
|
||||
if(p != undefined) {
|
||||
installPath = p[0];
|
||||
event.returnValue = installPath;
|
||||
} else {
|
||||
event.returnValue = null;
|
||||
}
|
||||
break;
|
||||
case "getInstallPath":
|
||||
event.returnValue = installPath;
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
app.on('ready', createWindow);
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name" : "bd-electron",
|
||||
"version" : "0.1.0",
|
||||
"main" : "main.js"
|
||||
}
|
Loading…
Reference in New Issue